@pocketprep/ui-kit 3.4.52 → 3.4.54
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/dist/@pocketprep/ui-kit.js +12357 -11200
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +10 -10
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Forms/Checkbox.vue +9 -1
- package/lib/components/Forms/Radio.vue +11 -11
- package/lib/components/Forms/RadioButton.vue +140 -0
- package/lib/components/Quiz/Question/ChoicesContainer.vue +5 -1
- package/lib/components/Quiz/Question/DropdownExplanation.vue +8 -1
- package/lib/components/Quiz/Question/Explanation.vue +7 -0
- package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +614 -0
- package/lib/components/Quiz/Question/MatrixRadioGroup.vue +98 -0
- package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +710 -0
- package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +131 -0
- package/lib/components/Quiz/Question/StatsSummary.vue +11 -3
- package/lib/components/Quiz/Question/Summary.vue +28 -3
- package/lib/components/Quiz/Question.vue +293 -28
- package/lib/components/Quiz/question.d.ts +12 -0
- package/lib/utils.ts +2 -1
- package/package.json +2 -2
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
showAnswers && (isMCR || isUnanswered) && !isCorrect && !isTeachReview,
|
|
124
124
|
'uikit-question__choices--unanswered': showAnswers && !isMCR && isUnanswered && !isCorrect,
|
|
125
125
|
'uikit-question__choices--show-stats': globalMetrics,
|
|
126
|
-
'uikit-question__choices--no-actions': !(isMCR || isUnanswered)
|
|
126
|
+
'uikit-question__choices--no-actions': !(isMCR || isUnanswered || isMatrixQuestion)
|
|
127
127
|
&& !globalMetrics
|
|
128
128
|
&& (
|
|
129
129
|
reviewMode
|
|
@@ -152,6 +152,7 @@
|
|
|
152
152
|
/>
|
|
153
153
|
</div>
|
|
154
154
|
<ChoicesContainer
|
|
155
|
+
v-if="question.type !== 'Matrix Checkbox' && question.type !== 'Matrix Radio Button'"
|
|
155
156
|
ref="uikit-question__choices-container"
|
|
156
157
|
:question="question"
|
|
157
158
|
:choices="choices"
|
|
@@ -193,6 +194,9 @@
|
|
|
193
194
|
@toggleDropdownExplanationImageLongAlt="toggleExplanationImageLongAlt"
|
|
194
195
|
@click="keywordClick"
|
|
195
196
|
>
|
|
197
|
+
<template #explanationTopExperiment>
|
|
198
|
+
<slot name="explanationTopExperiment"></slot>
|
|
199
|
+
</template>
|
|
196
200
|
<template #motivationalMoment="{
|
|
197
201
|
isCorrect,
|
|
198
202
|
choiceKey,
|
|
@@ -216,10 +220,88 @@
|
|
|
216
220
|
/>
|
|
217
221
|
</template>
|
|
218
222
|
</ChoicesContainer>
|
|
223
|
+
<MatrixChoicesContainer
|
|
224
|
+
v-if="question.type === 'Matrix Checkbox' || question.type === 'Matrix Radio Button'"
|
|
225
|
+
class="uikit-question__matrix-choices-container"
|
|
226
|
+
ref="uikit-question__matrix-choices-container"
|
|
227
|
+
v-breakpoint:questionEl="breakpoints"
|
|
228
|
+
:question="question"
|
|
229
|
+
:matrix-choice-layout="question.matrixChoiceLayout"
|
|
230
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
231
|
+
:matrix-answer-keys="matrixAnswerKeys"
|
|
232
|
+
:matrix-distractor-keys="matrixDistractorKeys"
|
|
233
|
+
:selected-matrix-choices="selectedMatrixChoices"
|
|
234
|
+
:show-matrix-answers="showMatrixAnswers"
|
|
235
|
+
:review-mode="reviewMode"
|
|
236
|
+
:matrix-choice-scores="matrixChoiceScores"
|
|
237
|
+
:global-metrics="globalMetrics"
|
|
238
|
+
:is-dark-mode="isDarkMode"
|
|
239
|
+
:question-el="questionEl"
|
|
240
|
+
:breakpoints="breakpoints"
|
|
241
|
+
@emitSelectedMatrixChoice="selectMatrixChoice"
|
|
242
|
+
@emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
|
|
243
|
+
>
|
|
244
|
+
<template #motivationalMoment="{
|
|
245
|
+
isCorrect,
|
|
246
|
+
choiceKey,
|
|
247
|
+
showAnswers,
|
|
248
|
+
answerKeys,
|
|
249
|
+
}">
|
|
250
|
+
<slot
|
|
251
|
+
name="motivationalMoment"
|
|
252
|
+
:showAnswers="showAnswers"
|
|
253
|
+
:answerKeys="answerKeys"
|
|
254
|
+
:choiceKey="choiceKey"
|
|
255
|
+
:isCorrect="isCorrect"
|
|
256
|
+
/>
|
|
257
|
+
</template>
|
|
258
|
+
<template #showNamesTable="{
|
|
259
|
+
choiceKey,
|
|
260
|
+
}" >
|
|
261
|
+
<slot
|
|
262
|
+
name="showNamesTable"
|
|
263
|
+
:choiceKey="choiceKey"
|
|
264
|
+
/>
|
|
265
|
+
</template>
|
|
266
|
+
</MatrixChoicesContainer>
|
|
267
|
+
<MobileMatrixChoicesContainer
|
|
268
|
+
v-if="question.type === 'Matrix Checkbox' || question.type === 'Matrix Radio Button'"
|
|
269
|
+
class="uikit-question__mobile-matrix-choices-container"
|
|
270
|
+
v-breakpoint:questionEl="breakpoints"
|
|
271
|
+
:question="question"
|
|
272
|
+
:matrix-choice-layout="question.matrixChoiceLayout"
|
|
273
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
274
|
+
:matrix-answer-keys="matrixAnswerKeys"
|
|
275
|
+
:matrix-distractor-keys="matrixDistractorKeys"
|
|
276
|
+
:selected-matrix-choices="selectedMatrixChoices"
|
|
277
|
+
:show-matrix-answers="showMatrixAnswers"
|
|
278
|
+
:review-mode="reviewMode"
|
|
279
|
+
:global-metrics="globalMetrics"
|
|
280
|
+
:is-dark-mode="isDarkMode"
|
|
281
|
+
:question-el="questionEl"
|
|
282
|
+
:breakpoints="breakpoints"
|
|
283
|
+
@emitSelectedMatrixChoice="selectMatrixChoice"
|
|
284
|
+
@emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
|
|
285
|
+
>
|
|
286
|
+
<template #motivationalMoment="{
|
|
287
|
+
isCorrect,
|
|
288
|
+
choiceKey,
|
|
289
|
+
showAnswers,
|
|
290
|
+
answerKeys,
|
|
291
|
+
}">
|
|
292
|
+
<slot
|
|
293
|
+
name="motivationalMoment"
|
|
294
|
+
:showAnswers="showAnswers"
|
|
295
|
+
:answerKeys="answerKeys"
|
|
296
|
+
:choiceKey="choiceKey"
|
|
297
|
+
:isCorrect="isCorrect"
|
|
298
|
+
/>
|
|
299
|
+
</template>
|
|
300
|
+
</MobileMatrixChoicesContainer>
|
|
219
301
|
<slot name="unansweredFlaggedNamesTable" />
|
|
220
302
|
</div>
|
|
221
303
|
<Summary
|
|
222
|
-
v-if="isMCR && showAnswers && !showPaywall"
|
|
304
|
+
v-if="((isMCR && showAnswers) || (isMatrixQuestion && showMatrixAnswers)) && !showPaywall"
|
|
223
305
|
ref="uikit-question__summary"
|
|
224
306
|
class="uikit-question__summary"
|
|
225
307
|
:question="question"
|
|
@@ -231,20 +313,30 @@
|
|
|
231
313
|
:reference="reference"
|
|
232
314
|
:hide-references="hideReferences"
|
|
233
315
|
:is-correct="isCorrect"
|
|
316
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
317
|
+
:is-matrix-question="isMatrixQuestion"
|
|
234
318
|
:is-unanswered="isUnanswered"
|
|
235
319
|
:review-mode="reviewMode"
|
|
236
320
|
:is-dark-mode="isDarkMode"
|
|
237
321
|
:question-el="questionEl"
|
|
238
322
|
:breakpoints="breakpoints"
|
|
323
|
+
:keyword-definitions="keywordDefinitions"
|
|
324
|
+
@click="keywordClick"
|
|
239
325
|
@toggleSummaryExplanation="toggleExplanation"
|
|
240
326
|
@toggleSummaryExplanationImageLongAlt="toggleExplanationImageLongAlt"
|
|
241
|
-
|
|
327
|
+
>
|
|
328
|
+
<template #explanationTopExperiment>
|
|
329
|
+
<slot name="explanationTopExperiment"></slot>
|
|
330
|
+
</template>
|
|
331
|
+
</Summary>
|
|
242
332
|
<slot name="metricsTiles">
|
|
243
333
|
<StatsSummary
|
|
244
334
|
v-if="globalMetrics"
|
|
245
335
|
class="uikit-question__stats-summary"
|
|
246
336
|
:global-metrics="globalMetrics"
|
|
247
337
|
:choice-scores="choiceScores"
|
|
338
|
+
:matrix-choice-scores="matrixChoiceScores"
|
|
339
|
+
:is-matrix-question="isMatrixQuestion"
|
|
248
340
|
:is-dark-mode="isDarkMode"
|
|
249
341
|
/>
|
|
250
342
|
</slot>
|
|
@@ -277,13 +369,21 @@
|
|
|
277
369
|
>
|
|
278
370
|
<slot name="action">
|
|
279
371
|
<PocketButton
|
|
280
|
-
v-if="!showAnswers && !hideAnswer && (showCheckAnswer || isMCR)"
|
|
372
|
+
v-if="!showAnswers && !hideAnswer && (showCheckAnswer || isMCR) && !isMatrixQuestion"
|
|
281
373
|
:disabled="!selectedChoices.length"
|
|
282
374
|
:is-dark-mode="isDarkMode"
|
|
283
375
|
@click="clickCheckAnswer"
|
|
284
376
|
>
|
|
285
377
|
Check Answer
|
|
286
378
|
</PocketButton>
|
|
379
|
+
<PocketButton
|
|
380
|
+
v-if="!showMatrixAnswers && !hideAnswer && isMatrixQuestion && allMatrixRowsAreAnswered"
|
|
381
|
+
:disabled="!selectedMatrixChoices.length"
|
|
382
|
+
:is-dark-mode="isDarkMode"
|
|
383
|
+
@click="clickCheckMatrixAnswer"
|
|
384
|
+
>
|
|
385
|
+
Check Answer
|
|
386
|
+
</PocketButton>
|
|
287
387
|
<PocketButton
|
|
288
388
|
v-else-if="(showAnswers || hideAnswer) && (questionNumber >= quizLength)"
|
|
289
389
|
:is-dark-mode="isDarkMode"
|
|
@@ -354,7 +454,11 @@
|
|
|
354
454
|
@toggleExplanationImageLongAlt="toggleExplanationImageLongAlt"
|
|
355
455
|
@toggleExplanation="toggleExplanation"
|
|
356
456
|
@click="keywordClick"
|
|
357
|
-
|
|
457
|
+
>
|
|
458
|
+
<template #explanationTopExperiment>
|
|
459
|
+
<slot name="explanationTopExperiment"></slot>
|
|
460
|
+
</template>
|
|
461
|
+
</Explanation>
|
|
358
462
|
</div>
|
|
359
463
|
</div>
|
|
360
464
|
</template>
|
|
@@ -376,10 +480,22 @@ import ChoicesContainer from '../Quiz/Question/ChoicesContainer.vue'
|
|
|
376
480
|
import StatsSummary from '../Quiz/Question/StatsSummary.vue'
|
|
377
481
|
import Explanation from '../Quiz/Question/Explanation.vue'
|
|
378
482
|
import PassageAndImage from '../Quiz/Question/PassageAndImage.vue'
|
|
483
|
+
import MatrixChoicesContainer from '../Quiz/Question/MatrixChoicesContainer.vue'
|
|
484
|
+
import MobileMatrixChoicesContainer from '../Quiz/Question/MobileMatrixChoicesContainer.vue'
|
|
379
485
|
import type { Study } from '@pocketprep/types'
|
|
380
486
|
import { breakpoint, dark } from '../../directives'
|
|
381
487
|
import { highlightKeywordsInText, studyModes } from '../../utils'
|
|
382
|
-
import type {
|
|
488
|
+
import type {
|
|
489
|
+
Ref,
|
|
490
|
+
TQuizMode,
|
|
491
|
+
TChoiceKey,
|
|
492
|
+
TMatrixChoiceKey,
|
|
493
|
+
TChoice,
|
|
494
|
+
TChoiceScores,
|
|
495
|
+
TMatrixChoiceScores,
|
|
496
|
+
TNamesRow,
|
|
497
|
+
TViewNames,
|
|
498
|
+
} from './question'
|
|
383
499
|
|
|
384
500
|
@Component({
|
|
385
501
|
components: {
|
|
@@ -396,6 +512,8 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
|
|
|
396
512
|
StatsSummary,
|
|
397
513
|
Explanation,
|
|
398
514
|
PassageAndImage,
|
|
515
|
+
MatrixChoicesContainer,
|
|
516
|
+
MobileMatrixChoicesContainer,
|
|
399
517
|
},
|
|
400
518
|
directives: {
|
|
401
519
|
breakpoint,
|
|
@@ -414,6 +532,7 @@ export default class Question extends Vue {
|
|
|
414
532
|
@Prop({ default: true }) showNextQuestion!: boolean
|
|
415
533
|
@Prop({ default: false }) reviewMode!: boolean
|
|
416
534
|
@Prop({ default: null }) previousChoices!: TChoiceKey[] | null
|
|
535
|
+
@Prop({ default: null }) previousMatrixChoices!: TMatrixChoiceKey[] | null
|
|
417
536
|
@Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
|
|
418
537
|
@Prop({ default: null }) showNames!: TViewNames | null
|
|
419
538
|
@Prop({ default: true }) allowKeyboardShortcuts!: boolean
|
|
@@ -432,7 +551,11 @@ export default class Question extends Vue {
|
|
|
432
551
|
focusChoiceKey: TChoiceKey | null = null
|
|
433
552
|
choiceStrikes: TChoiceKey[] = []
|
|
434
553
|
selectedChoices: TChoiceKey[] = []
|
|
554
|
+
selectedMatrixChoices: TMatrixChoiceKey[] = []
|
|
555
|
+
answeredMatrixRowIndexes: number[] = []
|
|
556
|
+
allMatrixRowsAreAnswered = false
|
|
435
557
|
showAnswers = false
|
|
558
|
+
showMatrixAnswers = false
|
|
436
559
|
showExplanation = false
|
|
437
560
|
showPassageImageLongAlt = false
|
|
438
561
|
showExplanationImageDropdown = false
|
|
@@ -488,6 +611,10 @@ export default class Question extends Vue {
|
|
|
488
611
|
return this.question.type === 'Multiple Correct Response'
|
|
489
612
|
}
|
|
490
613
|
|
|
614
|
+
get isMatrixQuestion () {
|
|
615
|
+
return this.question.type === 'Matrix Checkbox' || this.question.type === 'Matrix Radio Button'
|
|
616
|
+
}
|
|
617
|
+
|
|
491
618
|
get passageImageUrl () {
|
|
492
619
|
const imageUrl = this.question.passageImage?.url
|
|
493
620
|
|
|
@@ -522,11 +649,13 @@ export default class Question extends Vue {
|
|
|
522
649
|
|
|
523
650
|
get passageAndImageTitle () {
|
|
524
651
|
if (this.question.passage && this.passageImageUrl) {
|
|
525
|
-
return
|
|
652
|
+
return this.question.passageLabel ? `${this.question.passageLabel} + Image` :
|
|
653
|
+
'Passage + Image'
|
|
526
654
|
} else if (!this.question.passage && this.passageImageUrl) {
|
|
527
655
|
return 'Image'
|
|
528
656
|
} else {
|
|
529
|
-
return
|
|
657
|
+
return this.question.passageLabel ? `${this.question.passageLabel}` :
|
|
658
|
+
'Passage'
|
|
530
659
|
}
|
|
531
660
|
}
|
|
532
661
|
|
|
@@ -547,6 +676,20 @@ export default class Question extends Vue {
|
|
|
547
676
|
return this.answers.map(choice => choice.key)
|
|
548
677
|
}
|
|
549
678
|
|
|
679
|
+
get matrixAnswerKeys () {
|
|
680
|
+
if (this.question?.matrixChoiceLayout) {
|
|
681
|
+
return this.question?.matrixChoiceLayout.flat().filter(choice => choice.startsWith('a'))
|
|
682
|
+
}
|
|
683
|
+
return []
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
get matrixDistractorKeys () {
|
|
687
|
+
if (this.question?.matrixChoiceLayout) {
|
|
688
|
+
return this.question?.matrixChoiceLayout.flat().filter(choice => choice.startsWith('d'))
|
|
689
|
+
}
|
|
690
|
+
return []
|
|
691
|
+
}
|
|
692
|
+
|
|
550
693
|
get distractors (): TChoice[] {
|
|
551
694
|
const distractors = this.question.choices.filter(choice => !choice.isCorrect).map((choice, index) => ({
|
|
552
695
|
text: choice.text,
|
|
@@ -574,6 +717,12 @@ export default class Question extends Vue {
|
|
|
574
717
|
&& !this.selectedChoices.join(' ').includes('d')
|
|
575
718
|
}
|
|
576
719
|
|
|
720
|
+
get isMatrixQuestionCorrect () {
|
|
721
|
+
return this.showMatrixAnswers
|
|
722
|
+
&& this.selectedMatrixChoices.length === this.matrixAnswerKeys.length
|
|
723
|
+
&& !this.selectedMatrixChoices.join(' ').includes('d')
|
|
724
|
+
}
|
|
725
|
+
|
|
577
726
|
get choiceScores (): TChoiceScores {
|
|
578
727
|
const globalMetrics = this.globalMetrics
|
|
579
728
|
|
|
@@ -608,8 +757,32 @@ export default class Question extends Vue {
|
|
|
608
757
|
return scores
|
|
609
758
|
}
|
|
610
759
|
|
|
760
|
+
get matrixChoiceScores (): TMatrixChoiceScores {
|
|
761
|
+
const globalMetrics = this.globalMetrics
|
|
762
|
+
|
|
763
|
+
const scores: TMatrixChoiceScores = {
|
|
764
|
+
totalAnswered: this.selectedMatrixChoices.length &&
|
|
765
|
+
this.showMatrixAnswers && !this.reviewMode ? 1 : 0,
|
|
766
|
+
answeredCorrectly: this.isCorrect && !this.reviewMode ? 1 : 0,
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
if (!globalMetrics) {
|
|
770
|
+
return scores
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
scores.totalAnswered += (
|
|
774
|
+
(globalMetrics.answeredCorrectlyCount || 0)
|
|
775
|
+
+ (globalMetrics.answeredIncorrectlyCount || 0)
|
|
776
|
+
)
|
|
777
|
+
scores.answeredCorrectly += (globalMetrics.answeredCorrectlyCount || 0)
|
|
778
|
+
return scores
|
|
779
|
+
}
|
|
780
|
+
|
|
611
781
|
get isUnanswered () {
|
|
612
|
-
|
|
782
|
+
if (!this.isMatrixQuestion) {
|
|
783
|
+
return this.selectedChoices.length === 0
|
|
784
|
+
}
|
|
785
|
+
return this.selectedMatrixChoices.length === 0
|
|
613
786
|
}
|
|
614
787
|
|
|
615
788
|
get prompt () {
|
|
@@ -626,12 +799,17 @@ export default class Question extends Vue {
|
|
|
626
799
|
this.startReviewMode()
|
|
627
800
|
}
|
|
628
801
|
|
|
629
|
-
if (this.previousChoices) {
|
|
802
|
+
if (!this.isMatrixQuestion && this.previousChoices) {
|
|
630
803
|
this.updateSelectedChoices(this.previousChoices)
|
|
631
804
|
}
|
|
632
805
|
|
|
806
|
+
if (this.isMatrixQuestion && this.previousMatrixChoices) {
|
|
807
|
+
this.updateSelectedMatrixChoices(this.previousMatrixChoices)
|
|
808
|
+
}
|
|
809
|
+
|
|
633
810
|
if (this.initialShowAnswers) {
|
|
634
811
|
this.showAnswers = this.initialShowAnswers
|
|
812
|
+
this.showMatrixAnswers = this.initialShowAnswers
|
|
635
813
|
}
|
|
636
814
|
|
|
637
815
|
if (this.allowKeyboardShortcuts) {
|
|
@@ -737,7 +915,7 @@ export default class Question extends Vue {
|
|
|
737
915
|
keywordClick (event: MouseEvent) {
|
|
738
916
|
const target = event.target as HTMLElement
|
|
739
917
|
if (target.classList.contains('keyword-highlight')) {
|
|
740
|
-
const keyword = target.
|
|
918
|
+
const keyword = target.innerText
|
|
741
919
|
const location = target.getAttribute('data-location')
|
|
742
920
|
const clickLocation = { x: event.clientX, y: event.clientY }
|
|
743
921
|
return {
|
|
@@ -750,21 +928,33 @@ export default class Question extends Vue {
|
|
|
750
928
|
}
|
|
751
929
|
|
|
752
930
|
startReviewMode () {
|
|
753
|
-
this.
|
|
754
|
-
|
|
755
|
-
|
|
931
|
+
if (!this.isMatrixQuestion) {
|
|
932
|
+
this.showAnswers = true
|
|
933
|
+
this.showExplanation = this.defaultShowExplanation === null ? true : this.defaultShowExplanation
|
|
934
|
+
this.selectedChoices = this.answerKeys
|
|
935
|
+
} else {
|
|
936
|
+
this.showMatrixAnswers = true
|
|
937
|
+
this.showExplanation = this.defaultShowExplanation === null ? true : this.defaultShowExplanation
|
|
938
|
+
this.selectedMatrixChoices = this.matrixAnswerKeys as TMatrixChoiceKey[]
|
|
939
|
+
}
|
|
756
940
|
}
|
|
757
941
|
|
|
758
942
|
stopReviewMode () {
|
|
759
943
|
this.showAnswers = false
|
|
944
|
+
this.showMatrixAnswers = false
|
|
760
945
|
this.showExplanation = false
|
|
761
946
|
this.selectedChoices = []
|
|
947
|
+
this.selectedMatrixChoices = []
|
|
762
948
|
}
|
|
763
949
|
|
|
764
950
|
updateSelectedChoices (choices: TChoiceKey[]) {
|
|
765
951
|
this.selectedChoices = [ ...choices ]
|
|
766
952
|
}
|
|
767
953
|
|
|
954
|
+
updateSelectedMatrixChoices (matrixChoices: TMatrixChoiceKey[]) {
|
|
955
|
+
this.selectedMatrixChoices = [ ...matrixChoices ]
|
|
956
|
+
}
|
|
957
|
+
|
|
768
958
|
// deterministic shuffling of choices so they don't change order everytime you reload the component
|
|
769
959
|
shuffleChoices (choices: TChoice[]): TChoice[] {
|
|
770
960
|
const sortedChoices = choices.sort((a, b) => {
|
|
@@ -936,6 +1126,21 @@ export default class Question extends Vue {
|
|
|
936
1126
|
}
|
|
937
1127
|
}
|
|
938
1128
|
|
|
1129
|
+
selectMatrixChoice (matrixChoiceKeys: TMatrixChoiceKey[]) {
|
|
1130
|
+
if (this.showMatrixAnswers) {
|
|
1131
|
+
return
|
|
1132
|
+
}
|
|
1133
|
+
this.selectedMatrixChoices = matrixChoiceKeys
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
answeredMatrixRowIndex (answeredRowIndexes: number[]) {
|
|
1137
|
+
if (this.showMatrixAnswers) {
|
|
1138
|
+
return
|
|
1139
|
+
}
|
|
1140
|
+
this.answeredMatrixRowIndexes = answeredRowIndexes
|
|
1141
|
+
this.allMatrixRowsAreAnswered = this.answeredMatrixRowIndexes.length === this.question.matrixLabels?.rows.length
|
|
1142
|
+
}
|
|
1143
|
+
|
|
939
1144
|
togglePassageImageLongAlt () {
|
|
940
1145
|
this.showPassageImageLongAlt = !this.showPassageImageLongAlt
|
|
941
1146
|
|
|
@@ -1080,6 +1285,29 @@ export default class Question extends Vue {
|
|
|
1080
1285
|
}
|
|
1081
1286
|
}
|
|
1082
1287
|
|
|
1288
|
+
clickCheckMatrixAnswer () {
|
|
1289
|
+
if (!this.hideAnswer) {
|
|
1290
|
+
this.showMatrixAnswers = true
|
|
1291
|
+
|
|
1292
|
+
this.emitCheckAnswer({
|
|
1293
|
+
isCorrect: this.isMatrixQuestionCorrect,
|
|
1294
|
+
selectedChoices: this.selectedMatrixChoices,
|
|
1295
|
+
questionSerial: this.question.serial,
|
|
1296
|
+
})
|
|
1297
|
+
|
|
1298
|
+
setTimeout(() => {
|
|
1299
|
+
const summaryMatrixComp =
|
|
1300
|
+
this.$refs['uikit-question__summary'] as ComponentPublicInstance | undefined
|
|
1301
|
+
const summaryMatrixExplanation =
|
|
1302
|
+
// eslint-disable-next-line max-len
|
|
1303
|
+
summaryMatrixComp?.$refs['uikit-question-summary__summary-toggle-explanation-text'] as HTMLElement | undefined
|
|
1304
|
+
if (summaryMatrixExplanation) {
|
|
1305
|
+
summaryMatrixExplanation?.focus()
|
|
1306
|
+
}
|
|
1307
|
+
}, 500)
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1083
1311
|
mappedNameRows (choiceKey: string) {
|
|
1084
1312
|
/*
|
|
1085
1313
|
There is a specific order in which we have to fill the rows in the table for visible names.
|
|
@@ -1140,6 +1368,11 @@ export default class Question extends Vue {
|
|
|
1140
1368
|
this.updateSelectedChoices(choices)
|
|
1141
1369
|
}
|
|
1142
1370
|
|
|
1371
|
+
@Watch('previousMatrixChoices', { deep: true })
|
|
1372
|
+
previousMatrixChoicesChanged (matrixChoice: TMatrixChoiceKey[]) {
|
|
1373
|
+
this.updateSelectedMatrixChoices(matrixChoice)
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1143
1376
|
@Emit('selectedChoices')
|
|
1144
1377
|
emitSelectedChoices (selectedChoices: Study.Cloud.IQuizAnswer) {
|
|
1145
1378
|
return selectedChoices
|
|
@@ -1155,6 +1388,16 @@ export default class Question extends Vue {
|
|
|
1155
1388
|
} as Study.Cloud.IQuizAnswer)
|
|
1156
1389
|
}
|
|
1157
1390
|
|
|
1391
|
+
@Watch('selectedMatrixChoices', { deep: true })
|
|
1392
|
+
selectedMatrixChoicesChanged () {
|
|
1393
|
+
this.emitSelectedChoices({
|
|
1394
|
+
isCorrect: this.selectedMatrixChoices.length === this.matrixAnswerKeys.length
|
|
1395
|
+
&& !this.selectedMatrixChoices.join(' ').includes('d'),
|
|
1396
|
+
selectedChoices: this.selectedMatrixChoices,
|
|
1397
|
+
questionSerial: this.question.serial,
|
|
1398
|
+
} as Study.Cloud.IQuizAnswer)
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1158
1401
|
@Watch('showExplanation')
|
|
1159
1402
|
showExplanationChanged () {
|
|
1160
1403
|
this.emitUpdateShowExplanation()
|
|
@@ -1294,12 +1537,24 @@ export default class Question extends Vue {
|
|
|
1294
1537
|
padding-right: 11px;
|
|
1295
1538
|
font-size: 16.5px;
|
|
1296
1539
|
line-height: 26px;
|
|
1540
|
+
|
|
1541
|
+
.keyword-highlight {
|
|
1542
|
+
span {
|
|
1543
|
+
font-size: 16.5px;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1297
1546
|
}
|
|
1298
1547
|
|
|
1299
1548
|
&--explanation#{&}--tablet-landscape {
|
|
1300
1549
|
padding-top: 22px;
|
|
1301
1550
|
font-size: 16px;
|
|
1302
1551
|
line-height: 24px;
|
|
1552
|
+
|
|
1553
|
+
.keyword-highlight {
|
|
1554
|
+
span {
|
|
1555
|
+
font-size: 16px;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1303
1558
|
}
|
|
1304
1559
|
}
|
|
1305
1560
|
|
|
@@ -1315,13 +1570,11 @@ export default class Question extends Vue {
|
|
|
1315
1570
|
}
|
|
1316
1571
|
|
|
1317
1572
|
.keyword-highlight--dark.keyword-highlight--active {
|
|
1318
|
-
height: 22px;
|
|
1319
1573
|
background-color: rgba($banana-bread, 0.4);
|
|
1320
|
-
border-
|
|
1574
|
+
border-color: transparent !important;
|
|
1321
1575
|
border-radius: 2px;
|
|
1322
1576
|
|
|
1323
1577
|
&[data-location="explanation"] {
|
|
1324
|
-
height: 20px;
|
|
1325
1578
|
background-color: rgba($banana-bread, 0.4);
|
|
1326
1579
|
}
|
|
1327
1580
|
}
|
|
@@ -1331,17 +1584,16 @@ export default class Question extends Vue {
|
|
|
1331
1584
|
background-color: rgba($banana-bread, 0.25);
|
|
1332
1585
|
border-radius: 2px 2px 0 0;
|
|
1333
1586
|
border-bottom: 1.5px solid $banana-bread;
|
|
1334
|
-
|
|
1335
|
-
line-height: 22px;
|
|
1336
|
-
padding: 0 2px 0 1px;
|
|
1587
|
+
padding: 5.84px 2px 0 1px;
|
|
1337
1588
|
margin: 0 -2px 0 -1px;
|
|
1338
1589
|
cursor: pointer;
|
|
1590
|
+
font-size: 10px;
|
|
1591
|
+
line-height: 1;
|
|
1339
1592
|
|
|
1340
1593
|
&[data-location="explanation"] {
|
|
1341
|
-
|
|
1342
|
-
line-height: 21px;
|
|
1594
|
+
padding-top: 4.84px;
|
|
1343
1595
|
background-color: $manilla;
|
|
1344
|
-
border-radius:
|
|
1596
|
+
border-radius: 2px 2px 0 0;
|
|
1345
1597
|
}
|
|
1346
1598
|
|
|
1347
1599
|
&:hover:not(&--active) {
|
|
@@ -1355,15 +1607,11 @@ export default class Question extends Vue {
|
|
|
1355
1607
|
}
|
|
1356
1608
|
|
|
1357
1609
|
&--active {
|
|
1358
|
-
height: 22px;
|
|
1359
|
-
line-height: 23px;
|
|
1360
1610
|
background-color: $beach-sand;
|
|
1361
|
-
border-
|
|
1611
|
+
border-color: $beach-sand;
|
|
1362
1612
|
border-radius: 2px;
|
|
1363
1613
|
|
|
1364
1614
|
&[data-location="explanation"] {
|
|
1365
|
-
height: 20px;
|
|
1366
|
-
line-height: 21px;
|
|
1367
1615
|
background-color: $beach-sand;
|
|
1368
1616
|
border-radius: 2px;
|
|
1369
1617
|
}
|
|
@@ -1403,6 +1651,12 @@ export default class Question extends Vue {
|
|
|
1403
1651
|
max-width: 492px;
|
|
1404
1652
|
box-sizing: border-box;
|
|
1405
1653
|
|
|
1654
|
+
.keyword-highlight {
|
|
1655
|
+
span {
|
|
1656
|
+
font-size: 17.5px;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1406
1660
|
&--passage-and-image {
|
|
1407
1661
|
&--mobile {
|
|
1408
1662
|
margin-bottom: 14px;
|
|
@@ -1637,5 +1891,16 @@ export default class Question extends Vue {
|
|
|
1637
1891
|
margin-top: 24px;
|
|
1638
1892
|
}
|
|
1639
1893
|
}
|
|
1894
|
+
|
|
1895
|
+
&__matrix-choices-container {
|
|
1896
|
+
display: block;
|
|
1897
|
+
@include breakpoint(black-bear) {
|
|
1898
|
+
display: none;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
&__mobile-matrix-choices-container {
|
|
1903
|
+
display: block;
|
|
1904
|
+
}
|
|
1640
1905
|
}
|
|
1641
1906
|
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type Ref = HTMLElement | null
|
|
2
2
|
|
|
3
3
|
export type TChoiceKey = `${'a' | 'd'}${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`
|
|
4
|
+
export type TMatrixChoiceKey = `${'a' | 'd'}${1 | 2 | 3 }_${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`
|
|
4
5
|
|
|
5
6
|
export type TQuizMode = 'qotd' | 'quick10' | 'timed' | 'weakest' | 'missed' | 'custom'
|
|
6
7
|
|
|
@@ -20,6 +21,11 @@ export type TChoiceScores = Partial<Record<TChoiceKey, number>> & {
|
|
|
20
21
|
answeredCorrectly: number
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
export type TMatrixChoiceScores = {
|
|
25
|
+
totalAnswered: number
|
|
26
|
+
answeredCorrectly: number
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
export type TQuestionPassageAndImageTitle = 'Passage + Image' | 'Image' | 'Passage'
|
|
24
30
|
|
|
25
31
|
export type TNamesRow = {
|
|
@@ -38,4 +44,10 @@ export type TViewNames = {
|
|
|
38
44
|
name: string
|
|
39
45
|
isFlaggedByStudent: boolean
|
|
40
46
|
}[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IRadioOptions {
|
|
50
|
+
choices: TMatrixChoiceKey[]
|
|
51
|
+
value: TMatrixChoiceKey | null
|
|
52
|
+
label?: string
|
|
41
53
|
}
|
package/lib/utils.ts
CHANGED
|
@@ -83,7 +83,8 @@ export const highlightKeywordsInText = (params: {
|
|
|
83
83
|
return acc.replace(
|
|
84
84
|
regex,
|
|
85
85
|
`$1<span class="keyword-highlight${params.isDarkMode
|
|
86
|
-
? ' keyword-highlight--dark' : ''}" data-location="${
|
|
86
|
+
? ' keyword-highlight--dark' : ''}" data-location="${
|
|
87
|
+
params.location}""><span style="pointer-events: none;">$2</span></span>$3`
|
|
87
88
|
)
|
|
88
89
|
}, params.text)
|
|
89
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocketprep/ui-kit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.54",
|
|
4
4
|
"description": "Pocket Prep UI Kit",
|
|
5
5
|
"author": "pocketprep",
|
|
6
6
|
"scripts": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"vue-router": "4.2.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@pocketprep/types": "1.
|
|
81
|
+
"@pocketprep/types": "1.14.10",
|
|
82
82
|
"@tsconfig/node16": "1.0.3",
|
|
83
83
|
"@types/node": "16.18.25",
|
|
84
84
|
"@vitejs/plugin-vue": "4.6.2",
|