@pie-element/match 4.10.0 → 4.10.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 +342 -0
- package/configure/CHANGELOG.md +321 -0
- package/configure/lib/add-row.js.map +1 -1
- package/configure/lib/answer-config-block.js +76 -65
- package/configure/lib/answer-config-block.js.map +1 -1
- package/configure/lib/configure.js +88 -45
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/defaults.js +29 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/general-config-block.js +51 -7
- package/configure/lib/general-config-block.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/row.js +69 -60
- package/configure/lib/row.js.map +1 -1
- package/configure/package.json +7 -7
- package/configure/utils.js +12 -0
- package/controller/CHANGELOG.md +60 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +112 -5
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +3 -3
- package/docs/config-schema.json +153 -0
- package/docs/config-schema.json.md +117 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +11 -10
- package/docs/pie-schema.json +38 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/answer-grid.js +2 -2
- package/lib/answer-grid.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +2 -2
- package/lib/main.js.map +1 -1
- package/package.json +5 -5
package/docs/config-schema.json
CHANGED
|
@@ -131,6 +131,27 @@
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
|
+
"settingsPanelDisabled": {
|
|
135
|
+
"description": "Indicates if the settings panel is not available",
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"title": "settingsPanelDisabled"
|
|
138
|
+
},
|
|
139
|
+
"spellCheck": {
|
|
140
|
+
"title": "ConfigureProp",
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"settings": {
|
|
144
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
145
|
+
"type": "boolean",
|
|
146
|
+
"title": "settings"
|
|
147
|
+
},
|
|
148
|
+
"label": {
|
|
149
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
150
|
+
"type": "string",
|
|
151
|
+
"title": "label"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
134
155
|
"rationale": {
|
|
135
156
|
"title": "ConfigureProp",
|
|
136
157
|
"type": "object",
|
|
@@ -195,6 +216,109 @@
|
|
|
195
216
|
}
|
|
196
217
|
}
|
|
197
218
|
},
|
|
219
|
+
"maxImageWidth": {
|
|
220
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
221
|
+
"type": "object",
|
|
222
|
+
"properties": {
|
|
223
|
+
"teacherInstructions": {
|
|
224
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
225
|
+
"type": "number",
|
|
226
|
+
"title": "teacherInstructions"
|
|
227
|
+
},
|
|
228
|
+
"prompt": {
|
|
229
|
+
"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",
|
|
230
|
+
"type": "number",
|
|
231
|
+
"title": "prompt"
|
|
232
|
+
},
|
|
233
|
+
"rationale": {
|
|
234
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
235
|
+
"type": "number",
|
|
236
|
+
"title": "rationale"
|
|
237
|
+
},
|
|
238
|
+
"rowTitles": {
|
|
239
|
+
"description": "Indicates the max dimension for images in row labels",
|
|
240
|
+
"type": "number",
|
|
241
|
+
"title": "rowTitles"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"maxImageHeight": {
|
|
246
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
247
|
+
"type": "object",
|
|
248
|
+
"properties": {
|
|
249
|
+
"teacherInstructions": {
|
|
250
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
251
|
+
"type": "number",
|
|
252
|
+
"title": "teacherInstructions"
|
|
253
|
+
},
|
|
254
|
+
"prompt": {
|
|
255
|
+
"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",
|
|
256
|
+
"type": "number",
|
|
257
|
+
"title": "prompt"
|
|
258
|
+
},
|
|
259
|
+
"rationale": {
|
|
260
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
261
|
+
"type": "number",
|
|
262
|
+
"title": "rationale"
|
|
263
|
+
},
|
|
264
|
+
"rowTitles": {
|
|
265
|
+
"description": "Indicates the max dimension for images in row labels",
|
|
266
|
+
"type": "number",
|
|
267
|
+
"title": "rowTitles"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"withRubric": {
|
|
272
|
+
"title": "ConfigureProp",
|
|
273
|
+
"type": "object",
|
|
274
|
+
"properties": {
|
|
275
|
+
"settings": {
|
|
276
|
+
"description": "Indicates if the item has to be displayed in the Settings Panel",
|
|
277
|
+
"type": "boolean",
|
|
278
|
+
"title": "settings"
|
|
279
|
+
},
|
|
280
|
+
"label": {
|
|
281
|
+
"description": "Indicates the label for the item that has to be displayed in the Settings Panel",
|
|
282
|
+
"type": "string",
|
|
283
|
+
"title": "label"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"minQuestions": {
|
|
288
|
+
"description": "Indicates the minimum number of question rows",
|
|
289
|
+
"type": "number",
|
|
290
|
+
"title": "minQuestions"
|
|
291
|
+
},
|
|
292
|
+
"maxQuestions": {
|
|
293
|
+
"description": "Indicates the maximum number of question rows",
|
|
294
|
+
"type": "number",
|
|
295
|
+
"title": "maxQuestions"
|
|
296
|
+
},
|
|
297
|
+
"maxLengthQuestionsHeading": {
|
|
298
|
+
"description": "Indicates the maximum length of question rows headings",
|
|
299
|
+
"type": "number",
|
|
300
|
+
"title": "maxLengthQuestionsHeading"
|
|
301
|
+
},
|
|
302
|
+
"maxAnswers": {
|
|
303
|
+
"description": "Indicates the maximum number of answer columns",
|
|
304
|
+
"type": "number",
|
|
305
|
+
"title": "maxAnswers"
|
|
306
|
+
},
|
|
307
|
+
"maxLengthAnswers": {
|
|
308
|
+
"description": "Indicates the maximum length of answer columns headings",
|
|
309
|
+
"type": "number",
|
|
310
|
+
"title": "maxLengthAnswers"
|
|
311
|
+
},
|
|
312
|
+
"maxLengthFirstColumnHeading": {
|
|
313
|
+
"description": "Indicates the maximum length of first column headings",
|
|
314
|
+
"type": "number",
|
|
315
|
+
"title": "maxLengthFirstColumnHeading"
|
|
316
|
+
},
|
|
317
|
+
"width": {
|
|
318
|
+
"description": "How large (in px) should match be",
|
|
319
|
+
"type": "string",
|
|
320
|
+
"title": "width"
|
|
321
|
+
},
|
|
198
322
|
"showPrompt": {
|
|
199
323
|
"description": "Determines whether prompt field will be displayed or not",
|
|
200
324
|
"default": true,
|
|
@@ -214,6 +338,9 @@
|
|
|
214
338
|
"title": "settingsPartialScoring"
|
|
215
339
|
}
|
|
216
340
|
},
|
|
341
|
+
"required": [
|
|
342
|
+
"width"
|
|
343
|
+
],
|
|
217
344
|
"definitions": {
|
|
218
345
|
"ConfigureProp": {
|
|
219
346
|
"title": "ConfigureProp",
|
|
@@ -230,6 +357,32 @@
|
|
|
230
357
|
"title": "label"
|
|
231
358
|
}
|
|
232
359
|
}
|
|
360
|
+
},
|
|
361
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
362
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
363
|
+
"type": "object",
|
|
364
|
+
"properties": {
|
|
365
|
+
"teacherInstructions": {
|
|
366
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
367
|
+
"type": "number",
|
|
368
|
+
"title": "teacherInstructions"
|
|
369
|
+
},
|
|
370
|
+
"prompt": {
|
|
371
|
+
"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",
|
|
372
|
+
"type": "number",
|
|
373
|
+
"title": "prompt"
|
|
374
|
+
},
|
|
375
|
+
"rationale": {
|
|
376
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
377
|
+
"type": "number",
|
|
378
|
+
"title": "rationale"
|
|
379
|
+
},
|
|
380
|
+
"rowTitles": {
|
|
381
|
+
"description": "Indicates the max dimension for images in row labels",
|
|
382
|
+
"type": "number",
|
|
383
|
+
"title": "rowTitles"
|
|
384
|
+
}
|
|
385
|
+
}
|
|
233
386
|
}
|
|
234
387
|
},
|
|
235
388
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -98,6 +98,22 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
98
98
|
|
|
99
99
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
100
100
|
|
|
101
|
+
# `settingsPanelDisabled` (boolean)
|
|
102
|
+
|
|
103
|
+
Indicates if the settings panel is not available
|
|
104
|
+
|
|
105
|
+
# `spellCheck` (object)
|
|
106
|
+
|
|
107
|
+
Properties of the `spellCheck` object:
|
|
108
|
+
|
|
109
|
+
## `settings` (boolean)
|
|
110
|
+
|
|
111
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
112
|
+
|
|
113
|
+
## `label` (string)
|
|
114
|
+
|
|
115
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
116
|
+
|
|
101
117
|
# `rationale` (object)
|
|
102
118
|
|
|
103
119
|
Properties of the `rationale` object:
|
|
@@ -146,6 +162,86 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
146
162
|
|
|
147
163
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
148
164
|
|
|
165
|
+
# `maxImageWidth` (object)
|
|
166
|
+
|
|
167
|
+
Properties of the `maxImageWidth` object:
|
|
168
|
+
|
|
169
|
+
## `teacherInstructions` (number)
|
|
170
|
+
|
|
171
|
+
Indicates the max dimension for images in teacher instructions
|
|
172
|
+
|
|
173
|
+
## `prompt` (number)
|
|
174
|
+
|
|
175
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
176
|
+
|
|
177
|
+
## `rationale` (number)
|
|
178
|
+
|
|
179
|
+
Indicates the max dimension for images in rationale
|
|
180
|
+
|
|
181
|
+
## `rowTitles` (number)
|
|
182
|
+
|
|
183
|
+
Indicates the max dimension for images in row labels
|
|
184
|
+
|
|
185
|
+
# `maxImageHeight` (object)
|
|
186
|
+
|
|
187
|
+
Properties of the `maxImageHeight` object:
|
|
188
|
+
|
|
189
|
+
## `teacherInstructions` (number)
|
|
190
|
+
|
|
191
|
+
Indicates the max dimension for images in teacher instructions
|
|
192
|
+
|
|
193
|
+
## `prompt` (number)
|
|
194
|
+
|
|
195
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
196
|
+
|
|
197
|
+
## `rationale` (number)
|
|
198
|
+
|
|
199
|
+
Indicates the max dimension for images in rationale
|
|
200
|
+
|
|
201
|
+
## `rowTitles` (number)
|
|
202
|
+
|
|
203
|
+
Indicates the max dimension for images in row labels
|
|
204
|
+
|
|
205
|
+
# `withRubric` (object)
|
|
206
|
+
|
|
207
|
+
Properties of the `withRubric` object:
|
|
208
|
+
|
|
209
|
+
## `settings` (boolean)
|
|
210
|
+
|
|
211
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
212
|
+
|
|
213
|
+
## `label` (string)
|
|
214
|
+
|
|
215
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
216
|
+
|
|
217
|
+
# `minQuestions` (number)
|
|
218
|
+
|
|
219
|
+
Indicates the minimum number of question rows
|
|
220
|
+
|
|
221
|
+
# `maxQuestions` (number)
|
|
222
|
+
|
|
223
|
+
Indicates the maximum number of question rows
|
|
224
|
+
|
|
225
|
+
# `maxLengthQuestionsHeading` (number)
|
|
226
|
+
|
|
227
|
+
Indicates the maximum length of question rows headings
|
|
228
|
+
|
|
229
|
+
# `maxAnswers` (number)
|
|
230
|
+
|
|
231
|
+
Indicates the maximum number of answer columns
|
|
232
|
+
|
|
233
|
+
# `maxLengthAnswers` (number)
|
|
234
|
+
|
|
235
|
+
Indicates the maximum length of answer columns headings
|
|
236
|
+
|
|
237
|
+
# `maxLengthFirstColumnHeading` (number)
|
|
238
|
+
|
|
239
|
+
Indicates the maximum length of first column headings
|
|
240
|
+
|
|
241
|
+
# `width` (string, required)
|
|
242
|
+
|
|
243
|
+
How large (in px) should match be
|
|
244
|
+
|
|
149
245
|
# `showPrompt` (boolean)
|
|
150
246
|
|
|
151
247
|
Determines whether prompt field will be displayed or not
|
|
@@ -180,4 +276,24 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
180
276
|
|
|
181
277
|
### `label` (string)
|
|
182
278
|
|
|
183
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
279
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
280
|
+
|
|
281
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
282
|
+
|
|
283
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
284
|
+
|
|
285
|
+
### `teacherInstructions` (number)
|
|
286
|
+
|
|
287
|
+
Indicates the max dimension for images in teacher instructions
|
|
288
|
+
|
|
289
|
+
### `prompt` (number)
|
|
290
|
+
|
|
291
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
292
|
+
|
|
293
|
+
### `rationale` (number)
|
|
294
|
+
|
|
295
|
+
Indicates the max dimension for images in rationale
|
|
296
|
+
|
|
297
|
+
### `rowTitles` (number)
|
|
298
|
+
|
|
299
|
+
Indicates the max dimension for images in row labels
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -5,16 +5,16 @@ exports.model = (id, element) => ({
|
|
|
5
5
|
feedback: {
|
|
6
6
|
correct: {
|
|
7
7
|
type: 'none',
|
|
8
|
-
default: 'Correct'
|
|
8
|
+
default: 'Correct',
|
|
9
9
|
},
|
|
10
10
|
partial: {
|
|
11
11
|
type: 'none',
|
|
12
|
-
default: 'Nearly'
|
|
12
|
+
default: 'Nearly',
|
|
13
13
|
},
|
|
14
14
|
incorrect: {
|
|
15
15
|
type: 'none',
|
|
16
|
-
default: 'Incorrect'
|
|
17
|
-
}
|
|
16
|
+
default: 'Incorrect',
|
|
17
|
+
},
|
|
18
18
|
},
|
|
19
19
|
headers: ['Column 1', 'Column 2', 'Column 3'],
|
|
20
20
|
layout: 3,
|
|
@@ -25,25 +25,26 @@ exports.model = (id, element) => ({
|
|
|
25
25
|
{
|
|
26
26
|
id: 1,
|
|
27
27
|
title: 'Question Text 1',
|
|
28
|
-
values: [false, false]
|
|
28
|
+
values: [false, false],
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
id: 2,
|
|
32
32
|
title: 'Question Text 2',
|
|
33
|
-
values: [false, false]
|
|
33
|
+
values: [false, false],
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
id: 3,
|
|
37
37
|
title: 'Question Text 3',
|
|
38
|
-
values: [false, false]
|
|
38
|
+
values: [false, false],
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
id: 4,
|
|
42
42
|
title: 'Question Text 4',
|
|
43
|
-
values: [false, false]
|
|
44
|
-
}
|
|
43
|
+
values: [false, false],
|
|
44
|
+
},
|
|
45
45
|
],
|
|
46
46
|
promptEnabled: true,
|
|
47
47
|
prompt: 'Select correct answers.',
|
|
48
|
-
toolbarEditorPosition: 'bottom'
|
|
48
|
+
toolbarEditorPosition: 'bottom',
|
|
49
|
+
rubricEnabled: false,
|
|
49
50
|
});
|
package/docs/pie-schema.json
CHANGED
|
@@ -288,6 +288,11 @@
|
|
|
288
288
|
"type": "boolean",
|
|
289
289
|
"title": "rationaleEnabled"
|
|
290
290
|
},
|
|
291
|
+
"spellCheckEnabled": {
|
|
292
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
293
|
+
"type": "boolean",
|
|
294
|
+
"title": "spellCheckEnabled"
|
|
295
|
+
},
|
|
291
296
|
"studentInstructionsEnabled": {
|
|
292
297
|
"description": "Indicates if Student Instructions are enabled",
|
|
293
298
|
"type": "boolean",
|
|
@@ -308,6 +313,11 @@
|
|
|
308
313
|
"type": "string",
|
|
309
314
|
"title": "toolbarEditorPosition"
|
|
310
315
|
},
|
|
316
|
+
"rubricEnabled": {
|
|
317
|
+
"description": "Indicates if Rubric is enabled",
|
|
318
|
+
"type": "boolean",
|
|
319
|
+
"title": "rubricEnabled"
|
|
320
|
+
},
|
|
311
321
|
"id": {
|
|
312
322
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
313
323
|
"type": "string",
|
|
@@ -329,6 +339,8 @@
|
|
|
329
339
|
"rationale",
|
|
330
340
|
"rationaleEnabled",
|
|
331
341
|
"rows",
|
|
342
|
+
"rubricEnabled",
|
|
343
|
+
"spellCheckEnabled",
|
|
332
344
|
"studentInstructionsEnabled",
|
|
333
345
|
"teacherInstructionsEnabled"
|
|
334
346
|
],
|
|
@@ -349,6 +361,32 @@
|
|
|
349
361
|
}
|
|
350
362
|
}
|
|
351
363
|
},
|
|
364
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
365
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
366
|
+
"type": "object",
|
|
367
|
+
"properties": {
|
|
368
|
+
"teacherInstructions": {
|
|
369
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
370
|
+
"type": "number",
|
|
371
|
+
"title": "teacherInstructions"
|
|
372
|
+
},
|
|
373
|
+
"prompt": {
|
|
374
|
+
"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",
|
|
375
|
+
"type": "number",
|
|
376
|
+
"title": "prompt"
|
|
377
|
+
},
|
|
378
|
+
"rationale": {
|
|
379
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
380
|
+
"type": "number",
|
|
381
|
+
"title": "rationale"
|
|
382
|
+
},
|
|
383
|
+
"rowTitles": {
|
|
384
|
+
"description": "Indicates the max dimension for images in row labels",
|
|
385
|
+
"type": "number",
|
|
386
|
+
"title": "rowTitles"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
352
390
|
"ComplexFeedbackType": {
|
|
353
391
|
"title": "ComplexFeedbackType",
|
|
354
392
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -108,6 +108,10 @@ Indicates if Feedback is enabled
|
|
|
108
108
|
|
|
109
109
|
Indicates if Rationale are enabled
|
|
110
110
|
|
|
111
|
+
# `spellCheckEnabled` (boolean, required)
|
|
112
|
+
|
|
113
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
114
|
+
|
|
111
115
|
# `studentInstructionsEnabled` (boolean, required)
|
|
112
116
|
|
|
113
117
|
Indicates if Student Instructions are enabled
|
|
@@ -127,6 +131,10 @@ This element must be one of the following enum values:
|
|
|
127
131
|
|
|
128
132
|
Default: `": 'bottom'"`
|
|
129
133
|
|
|
134
|
+
# `rubricEnabled` (boolean, required)
|
|
135
|
+
|
|
136
|
+
Indicates if Rubric is enabled
|
|
137
|
+
|
|
130
138
|
# `id` (string, required)
|
|
131
139
|
|
|
132
140
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -153,6 +161,26 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
153
161
|
|
|
154
162
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
155
163
|
|
|
164
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
165
|
+
|
|
166
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
167
|
+
|
|
168
|
+
### `teacherInstructions` (number)
|
|
169
|
+
|
|
170
|
+
Indicates the max dimension for images in teacher instructions
|
|
171
|
+
|
|
172
|
+
### `prompt` (number)
|
|
173
|
+
|
|
174
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
175
|
+
|
|
176
|
+
### `rationale` (number)
|
|
177
|
+
|
|
178
|
+
Indicates the max dimension for images in rationale
|
|
179
|
+
|
|
180
|
+
### `rowTitles` (number)
|
|
181
|
+
|
|
182
|
+
Indicates the max dimension for images in row labels
|
|
183
|
+
|
|
156
184
|
## `ComplexFeedbackType` (object)
|
|
157
185
|
|
|
158
186
|
Properties of the `ComplexFeedbackType` object:
|
package/lib/answer-grid.js
CHANGED
|
@@ -37,9 +37,9 @@ var _styles = require("@material-ui/core/styles");
|
|
|
37
37
|
|
|
38
38
|
var _renderUi = require("@pie-lib/render-ui");
|
|
39
39
|
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
40
|
+
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; }
|
|
41
41
|
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
42
|
+
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; }
|
|
43
43
|
|
|
44
44
|
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); }; }
|
|
45
45
|
|
package/lib/answer-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/answer-grid.jsx"],"names":["AnswerGrid","rowId","answerIndex","event","props","onAnswerChange","choiceMode","answers","newAnswers","i","length","target","checked","rowValue","rowValueIndex","correctAnswers","classes","showCorrect","headers","rows","disabled","view","Tag","Radio","Checkbox","evaluate","controlsContainer","empty","table","map","header","idx","rowHeader","rowItem","questionText","__html","row","separator","title","id","column","correct","answerIsCorrect","tag","tagDisabled","incorrect","answerIsIncorrect","onRowValueChange","React","Component","PropTypes","object","isRequired","bool","func","string","array","styles","theme","marginLeft","marginRight","marginTop","spacing","unit","marginBottom","padding","color","margin","rowContainer","display","alignItems","textAlign","border","borderTop","primaryLight","width","text","primary","cursor","pointerEvents","opacity","backgroundColor","background","borderCollapse","borderSpacing"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,U;;;;;;;;;;;;;;;yGAcQ,UAACC,KAAD,EAAQC,WAAR;AAAA,aAAwB,UAAAC,KAAK,EAAI;AAClD,0BAAgD,MAAKC,KAArD;AAAA,YAAQC,cAAR,eAAQA,cAAR;AAAA,YAAwBC,UAAxB,eAAwBA,UAAxB;AAAA,YAAoCC,OAApC,eAAoCA,OAApC;;AACA,YAAMC,UAAU,qBAAQD,OAAR,CAAhB;;AAEA,YAAID,UAAU,KAAK,OAAnB,EAA4B;AAC1B,eAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,UAAU,CAACP,KAAD,CAAV,CAAkBS,MAAtC,EAA8CD,CAAC,EAA/C,EAAmD;AACjDD,YAAAA,UAAU,CAACP,KAAD,CAAV,CAAkBQ,CAAlB,IAAuB,KAAvB;AACD;AACF;;AAEDD,QAAAA,UAAU,CAACP,KAAD,CAAV,CAAkBC,WAAlB,IAAiCC,KAAK,CAACQ,MAAN,CAAaC,OAA9C;AAEAP,QAAAA,cAAc,CAACG,UAAD,CAAd;AACD,OAbkB;AAAA,K;w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prop-types';\nimport cx from 'classnames';\nimport Radio from '@material-ui/core/Radio';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nexport class AnswerGrid extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctAnswers: PropTypes.object,\n view: PropTypes.bool.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onAnswerChange: PropTypes.func.isRequired,\n choiceMode: PropTypes.string.isRequired,\n rows: PropTypes.array.isRequired,\n headers: PropTypes.array.isRequired,\n answers: PropTypes.object.isRequired\n };\n\n onRowValueChange = (rowId, answerIndex) => event => {\n const { onAnswerChange, choiceMode, answers } = this.props;\n const newAnswers = { ...answers };\n\n if (choiceMode === 'radio') {\n for (let i = 0; i < newAnswers[rowId].length; i++) {\n newAnswers[rowId][i] = false;\n }\n }\n\n newAnswers[rowId][answerIndex] = event.target.checked;\n\n onAnswerChange(newAnswers);\n };\n\n answerIsCorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return correctAnswers[rowId][rowValueIndex] === rowValue && rowValue === true;\n };\n\n // needs a separate method because what isn't correct isn't necessarily incorrect\n answerIsIncorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return correctAnswers[rowId][rowValueIndex] === true && rowValue === false\n || correctAnswers[rowId][rowValueIndex] === false && rowValue === true;\n };\n\n render() {\n const { classes, showCorrect, headers, rows, choiceMode, answers, disabled, view } = this.props;\n const Tag = choiceMode === 'radio' ? Radio : Checkbox;\n const evaluate = disabled && !view;\n\n if (!rows || rows.length === 0) {\n return (\n <div className={classes.controlsContainer}>\n <Typography className={classes.empty} component=\"div\">\n There are currently no questions to show.\n </Typography>\n </div>);\n }\n\n return (\n <div className={classes.controlsContainer}>\n <table className={classes.table}>\n <colgroup>\n {(headers || []).map((header, idx) => (<col key={`col-${idx}`}/>))}\n </colgroup>\n\n <thead>\n <tr>\n {(headers || []).map((header, idx) => (\n <th\n className={classes.rowHeader}\n key={`th-${idx}`}\n data-colno={`${idx}`}\n scope=\"row\"\n >\n <div\n className={cx(classes.rowItem, { [classes.questionText]: idx === 0 })}\n dangerouslySetInnerHTML={{ __html: header }}\n />\n </th>\n ))}\n </tr>\n </thead>\n\n {(rows || []).map((row, idx) => (\n <tbody key={`row-${idx}`} role=\"group\">\n <tr className={classes.separator}>\n <td\n key={`td-title-${idx}`}\n data-colno={'0'}\n >\n <div\n className={cx(classes.rowItem, classes.questionText)}\n dangerouslySetInnerHTML={{ __html: row.title }}\n />\n </td>\n\n {(answers[row.id] || []).map((rowItem, answerIndex) => (\n <td\n key={`td-${idx}-${answerIndex}`}\n className={classes.column}\n data-colno={`${answerIndex + 1}`}\n >\n <div className={classes.rowItem}>\n <Tag\n className={cx({\n [classes.correct]: (\n (showCorrect && rowItem === true) ||\n (evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex))\n ),\n [classes.tag]: true,\n [classes.checked]: rowItem === true && !evaluate,\n [classes.tagDisabled]: disabled,\n [classes.incorrect]: evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex)\n })}\n disabled={disabled}\n onChange={this.onRowValueChange(row.id, answerIndex)}\n checked={rowItem === true}\n />\n </div>\n </td>\n ))}\n </tr>\n </tbody>\n ))}\n </table>\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n controlsContainer: {\n marginLeft: 'auto',\n marginRight: 'auto',\n marginTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit\n },\n column: {\n padding: '5px 0',\n },\n correct: {\n color: `${color.correct()} !important`\n },\n incorrect: {\n color: `${color.incorrect()} !important`\n },\n empty: {\n margin: theme.spacing.unit * 2\n },\n rowContainer: {\n display: 'flex',\n alignItems: 'center',\n },\n rowHeader: {\n padding: 0\n },\n rowItem: {\n padding: '12px',\n textAlign: 'center'\n },\n separator: {\n border: 0,\n borderTop: `2.5px solid ${color.primaryLight()}`,\n width: '100%'\n },\n tag: {\n padding: '6px',\n color: color.text(),\n '&:hover': {\n color: color.primaryLight()\n }\n },\n checked: {\n color: `${color.primary()} !important`\n },\n tagDisabled: {\n color: color.disabled(),\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n opacity: 0.7,\n '&:hover': {\n color: color.disabled()\n }\n },\n table: {\n color: color.text(),\n backgroundColor: color.background(),\n borderCollapse: 'collapse',\n borderSpacing: 0,\n marginBottom: 0\n },\n questionText: {\n textAlign: 'left'\n },\n});\n\nexport default withStyles(styles)(AnswerGrid);\n"],"file":"answer-grid.js"}
|
|
1
|
+
{"version":3,"sources":["../src/answer-grid.jsx"],"names":["AnswerGrid","rowId","answerIndex","event","props","onAnswerChange","choiceMode","answers","newAnswers","i","length","target","checked","rowValue","rowValueIndex","correctAnswers","classes","showCorrect","headers","rows","disabled","view","Tag","Radio","Checkbox","evaluate","controlsContainer","empty","table","map","header","idx","rowHeader","rowItem","questionText","__html","row","separator","title","id","column","correct","answerIsCorrect","tag","tagDisabled","incorrect","answerIsIncorrect","onRowValueChange","React","Component","PropTypes","object","isRequired","bool","func","string","array","styles","theme","marginLeft","marginRight","marginTop","spacing","unit","marginBottom","padding","color","margin","rowContainer","display","alignItems","textAlign","border","borderTop","primaryLight","width","text","primary","cursor","pointerEvents","opacity","backgroundColor","background","borderCollapse","borderSpacing"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,U;;;;;;;;;;;;;;;yGAcQ,UAACC,KAAD,EAAQC,WAAR;AAAA,aAAwB,UAACC,KAAD,EAAW;AACpD,0BAAgD,MAAKC,KAArD;AAAA,YAAQC,cAAR,eAAQA,cAAR;AAAA,YAAwBC,UAAxB,eAAwBA,UAAxB;AAAA,YAAoCC,OAApC,eAAoCA,OAApC;;AACA,YAAMC,UAAU,qBAAQD,OAAR,CAAhB;;AAEA,YAAID,UA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E;AALA,KA7CY;AAsDzBQ,IAAAA,KAAK,EAAE;AACLsC,MAAAA,KAAK,EAAEA,gBAAMU,IAAN,EADF;AAELK,MAAAA,eAAe,EAAEf,gBAAMgB,UAAN,EAFZ;AAGLC,MAAAA,cAAc,EAAE,UAHX;AAILC,MAAAA,aAAa,EAAE,CAJV;AAKLpB,MAAAA,YAAY,EAAE;AALT,KAtDkB;AA6DzB9B,IAAAA,YAAY,EAAE;AACZqC,MAAAA,SAAS,EAAE;AADC;AA7DW,GAAZ;AAAA,CAAf;;eAkEe,wBAAWd,MAAX,EAAmBzD,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport Radio from '@material-ui/core/Radio';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nexport class AnswerGrid extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n correctAnswers: PropTypes.object,\n view: PropTypes.bool.isRequired,\n showCorrect: PropTypes.bool.isRequired,\n disabled: PropTypes.bool.isRequired,\n onAnswerChange: PropTypes.func.isRequired,\n choiceMode: PropTypes.string.isRequired,\n rows: PropTypes.array.isRequired,\n headers: PropTypes.array.isRequired,\n answers: PropTypes.object.isRequired,\n };\n\n onRowValueChange = (rowId, answerIndex) => (event) => {\n const { onAnswerChange, choiceMode, answers } = this.props;\n const newAnswers = { ...answers };\n\n if (choiceMode === 'radio') {\n for (let i = 0; i < newAnswers[rowId].length; i++) {\n newAnswers[rowId][i] = false;\n }\n }\n\n newAnswers[rowId][answerIndex] = event.target.checked;\n\n onAnswerChange(newAnswers);\n };\n\n answerIsCorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return correctAnswers[rowId][rowValueIndex] === rowValue && rowValue === true;\n };\n\n // needs a separate method because what isn't correct isn't necessarily incorrect\n answerIsIncorrect = (rowId, rowValue, rowValueIndex) => {\n const { correctAnswers } = this.props;\n\n return (\n (correctAnswers[rowId][rowValueIndex] === true && rowValue === false) ||\n (correctAnswers[rowId][rowValueIndex] === false && rowValue === true)\n );\n };\n\n render() {\n const { classes, showCorrect, headers, rows, choiceMode, answers, disabled, view } = this.props;\n const Tag = choiceMode === 'radio' ? Radio : Checkbox;\n const evaluate = disabled && !view;\n\n if (!rows || rows.length === 0) {\n return (\n <div className={classes.controlsContainer}>\n <Typography className={classes.empty} component=\"div\">\n There are currently no questions to show.\n </Typography>\n </div>\n );\n }\n\n return (\n <div className={classes.controlsContainer}>\n <table className={classes.table}>\n <colgroup>\n {(headers || []).map((header, idx) => (\n <col key={`col-${idx}`} />\n ))}\n </colgroup>\n\n <thead>\n <tr>\n {(headers || []).map((header, idx) => (\n <th className={classes.rowHeader} key={`th-${idx}`} data-colno={`${idx}`} scope=\"row\">\n <div\n className={cx(classes.rowItem, { [classes.questionText]: idx === 0 })}\n dangerouslySetInnerHTML={{ __html: header }}\n />\n </th>\n ))}\n </tr>\n </thead>\n\n {(rows || []).map((row, idx) => (\n <tbody key={`row-${idx}`} role=\"group\">\n <tr className={classes.separator}>\n <td key={`td-title-${idx}`} data-colno={'0'}>\n <div\n className={cx(classes.rowItem, classes.questionText)}\n dangerouslySetInnerHTML={{ __html: row.title }}\n />\n </td>\n\n {(answers[row.id] || []).map((rowItem, answerIndex) => (\n <td key={`td-${idx}-${answerIndex}`} className={classes.column} data-colno={`${answerIndex + 1}`}>\n <div className={classes.rowItem}>\n <Tag\n className={cx({\n [classes.correct]:\n (showCorrect && rowItem === true) ||\n (evaluate && this.answerIsCorrect(row.id, rowItem, answerIndex)),\n [classes.tag]: true,\n [classes.checked]: rowItem === true && !evaluate,\n [classes.tagDisabled]: disabled,\n [classes.incorrect]: evaluate && this.answerIsIncorrect(row.id, rowItem, answerIndex),\n })}\n disabled={disabled}\n onChange={this.onRowValueChange(row.id, answerIndex)}\n checked={rowItem === true}\n />\n </div>\n </td>\n ))}\n </tr>\n </tbody>\n ))}\n </table>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n controlsContainer: {\n marginLeft: 'auto',\n marginRight: 'auto',\n marginTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit,\n },\n column: {\n padding: '5px 0',\n },\n correct: {\n color: `${color.correct()} !important`,\n },\n incorrect: {\n color: `${color.incorrect()} !important`,\n },\n empty: {\n margin: theme.spacing.unit * 2,\n },\n rowContainer: {\n display: 'flex',\n alignItems: 'center',\n },\n rowHeader: {\n padding: 0,\n },\n rowItem: {\n padding: '12px',\n textAlign: 'center',\n },\n separator: {\n border: 0,\n borderTop: `2.5px solid ${color.primaryLight()}`,\n width: '100%',\n },\n tag: {\n padding: '6px',\n color: color.text(),\n '&:hover': {\n color: color.primaryLight(),\n },\n },\n checked: {\n color: `${color.primary()} !important`,\n },\n tagDisabled: {\n color: color.disabled(),\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n opacity: 0.7,\n '&:hover': {\n color: color.disabled(),\n },\n },\n table: {\n color: color.text(),\n backgroundColor: color.background(),\n borderCollapse: 'collapse',\n borderSpacing: 0,\n marginBottom: 0,\n },\n questionText: {\n textAlign: 'left',\n },\n});\n\nexport default withStyles(styles)(AnswerGrid);\n"],"file":"answer-grid.js"}
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "Component", {
|
|
|
11
11
|
return _main["default"];
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
exports["default"] =
|
|
14
|
+
exports.isComplete = exports["default"] = void 0;
|
|
15
15
|
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
17
|
|
|
@@ -78,6 +78,9 @@ var Match = /*#__PURE__*/function (_HTMLElement) {
|
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
key: "session",
|
|
81
|
+
get: function get() {
|
|
82
|
+
return this._session;
|
|
83
|
+
},
|
|
81
84
|
set: function set(s) {
|
|
82
85
|
this._session = s;
|
|
83
86
|
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["isComplete","session","model","rows","ids","map","r","id","reduce","acc","arr","answers","hasChoice","Array","isArray","includes","Match","m","_model","_render","
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["isComplete","session","model","rows","ids","map","r","id","reduce","acc","arr","answers","hasChoice","Array","isArray","includes","Match","m","_model","_render","_session","s","complete","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","el","React","createElement","Main","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAIO,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,OAAD,EAAUC,KAAV,EAAoB;AAC5C,MAAMC,IAAI,GAAG,qBAAID,KAAJ,EAAW,aAAX,CAAb;AACA,MAAME,GAAG,GAAGD,IAAI,CAACE,GAAL,CAAS,UAACC,CAAD;AAAA,WAAOA,CAAC,CAACC,EAAT;AAAA,GAAT,CAAZ;AACA,SAAOH,GAAG,CAACI,MAAJ,CAAW,UAACC,GAAD,EAAMF,EAAN,EAAa;AAC7B,QAAI,CAACE,GAAL,EAAU;AACR,aAAO,KAAP;AACD;;AACD,QAAMC,GAAG,GAAGT,OAAO,CAACU,OAAR,IAAmBV,OAAO,CAACU,OAAR,CAAgBJ,EAAhB,CAA/B;AACA,QAAMK,SAAS,GAAGC,KAAK,CAACC,OAAN,CAAcJ,GAAd,KAAsBA,GAAG,CAACK,QAAJ,CAAa,IAAb,CAAxC;AACA,WAAOH,SAAS,IAAIH,GAApB;AACD,GAPM,EAOJ,IAPI,CAAP;AAQD,CAXM;;;;IAacO,K;;;;;AACnB,mBAAc;AAAA;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKE,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKC,QAAZ;AACD,K;SAPD,aAAYC,CAAZ,EAAe;AACb,WAAKD,QAAL,GAAgBC,CAAhB;;AACA,WAAKF,OAAL;AACD;;;WAMD,wBAAeE,CAAf,EAAkB;AAChB,WAAKD,QAAL,CAAcT,OAAd,GAAwBU,CAAC,CAACV,OAA1B;AACA,UAAMW,QAAQ,GAAGtB,UAAU,CAAC,KAAKoB,QAAN,EAAgB,KAAKF,MAArB,CAA3B;AAEA,WAAKK,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,KAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoDJ,QAApD,CAAnB;;AAEA,WAAKH,OAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAED,mBAAU;AAAA;;AACR,UAAI,CAAC,KAAKD,MAAN,IAAgB,CAAC,KAAKE,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMO,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnC5B,QAAAA,KAAK,EAAE,KAAKgB,MADuB;AAEnCjB,QAAAA,OAAO,EAAE,KAAKmB,QAFqB;AAGnCW,QAAAA,eAAe,EAAE,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAHkB,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBR,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,KAAX;AACD,OAFD;AAGD;;;kDA9CgCS,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport get from 'lodash/get';\n\nexport { Main as Component };\n\nexport const isComplete = (session, model) => {\n const rows = get(model, 'config.rows');\n const ids = rows.map((r) => r.id);\n return ids.reduce((acc, id) => {\n if (!acc) {\n return false;\n }\n const arr = session.answers && session.answers[id];\n const hasChoice = Array.isArray(arr) && arr.includes(true);\n return hasChoice && acc;\n }, true);\n};\n\nexport default class Match extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n sessionChanged(s) {\n this._session.answers = s.answers;\n const complete = isComplete(this._session, this._model);\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));\n\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -33,9 +33,9 @@ var _answerGrid = _interopRequireDefault(require("./answer-grid"));
|
|
|
33
33
|
|
|
34
34
|
var _styles = require("@material-ui/core/styles");
|
|
35
35
|
|
|
36
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
36
|
+
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; }
|
|
37
37
|
|
|
38
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
38
|
+
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; }
|
|
39
39
|
|
|
40
40
|
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); }; }
|
|
41
41
|
|