@pocketprep/ui-kit 3.4.51 → 3.4.53
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 +12257 -11132
- 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/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 +9 -2
- package/lib/components/Quiz/Question.vue +325 -14
- package/lib/components/Quiz/QuizContainer.vue +15 -1
- package/lib/components/Quiz/question.d.ts +12 -0
- 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"
|
|
@@ -216,10 +217,88 @@
|
|
|
216
217
|
/>
|
|
217
218
|
</template>
|
|
218
219
|
</ChoicesContainer>
|
|
220
|
+
<MatrixChoicesContainer
|
|
221
|
+
v-if="question.type === 'Matrix Checkbox' || question.type === 'Matrix Radio Button'"
|
|
222
|
+
class="uikit-question__matrix-choices-container"
|
|
223
|
+
ref="uikit-question__matrix-choices-container"
|
|
224
|
+
v-breakpoint:questionEl="breakpoints"
|
|
225
|
+
:question="question"
|
|
226
|
+
:matrix-choice-layout="question.matrixChoiceLayout"
|
|
227
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
228
|
+
:matrix-answer-keys="matrixAnswerKeys"
|
|
229
|
+
:matrix-distractor-keys="matrixDistractorKeys"
|
|
230
|
+
:selected-matrix-choices="selectedMatrixChoices"
|
|
231
|
+
:show-matrix-answers="showMatrixAnswers"
|
|
232
|
+
:review-mode="reviewMode"
|
|
233
|
+
:matrix-choice-scores="matrixChoiceScores"
|
|
234
|
+
:global-metrics="globalMetrics"
|
|
235
|
+
:is-dark-mode="isDarkMode"
|
|
236
|
+
:question-el="questionEl"
|
|
237
|
+
:breakpoints="breakpoints"
|
|
238
|
+
@emitSelectedMatrixChoice="selectMatrixChoice"
|
|
239
|
+
@emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
|
|
240
|
+
>
|
|
241
|
+
<template #motivationalMoment="{
|
|
242
|
+
isCorrect,
|
|
243
|
+
choiceKey,
|
|
244
|
+
showAnswers,
|
|
245
|
+
answerKeys,
|
|
246
|
+
}">
|
|
247
|
+
<slot
|
|
248
|
+
name="motivationalMoment"
|
|
249
|
+
:showAnswers="showAnswers"
|
|
250
|
+
:answerKeys="answerKeys"
|
|
251
|
+
:choiceKey="choiceKey"
|
|
252
|
+
:isCorrect="isCorrect"
|
|
253
|
+
/>
|
|
254
|
+
</template>
|
|
255
|
+
<template #showNamesTable="{
|
|
256
|
+
choiceKey,
|
|
257
|
+
}" >
|
|
258
|
+
<slot
|
|
259
|
+
name="showNamesTable"
|
|
260
|
+
:choiceKey="choiceKey"
|
|
261
|
+
/>
|
|
262
|
+
</template>
|
|
263
|
+
</MatrixChoicesContainer>
|
|
264
|
+
<MobileMatrixChoicesContainer
|
|
265
|
+
v-if="question.type === 'Matrix Checkbox' || question.type === 'Matrix Radio Button'"
|
|
266
|
+
class="uikit-question__mobile-matrix-choices-container"
|
|
267
|
+
v-breakpoint:questionEl="breakpoints"
|
|
268
|
+
:question="question"
|
|
269
|
+
:matrix-choice-layout="question.matrixChoiceLayout"
|
|
270
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
271
|
+
:matrix-answer-keys="matrixAnswerKeys"
|
|
272
|
+
:matrix-distractor-keys="matrixDistractorKeys"
|
|
273
|
+
:selected-matrix-choices="selectedMatrixChoices"
|
|
274
|
+
:show-matrix-answers="showMatrixAnswers"
|
|
275
|
+
:review-mode="reviewMode"
|
|
276
|
+
:global-metrics="globalMetrics"
|
|
277
|
+
:is-dark-mode="isDarkMode"
|
|
278
|
+
:question-el="questionEl"
|
|
279
|
+
:breakpoints="breakpoints"
|
|
280
|
+
@emitSelectedMatrixChoice="selectMatrixChoice"
|
|
281
|
+
@emitAnsweredMatrixRowIndex="answeredMatrixRowIndex"
|
|
282
|
+
>
|
|
283
|
+
<template #motivationalMoment="{
|
|
284
|
+
isCorrect,
|
|
285
|
+
choiceKey,
|
|
286
|
+
showAnswers,
|
|
287
|
+
answerKeys,
|
|
288
|
+
}">
|
|
289
|
+
<slot
|
|
290
|
+
name="motivationalMoment"
|
|
291
|
+
:showAnswers="showAnswers"
|
|
292
|
+
:answerKeys="answerKeys"
|
|
293
|
+
:choiceKey="choiceKey"
|
|
294
|
+
:isCorrect="isCorrect"
|
|
295
|
+
/>
|
|
296
|
+
</template>
|
|
297
|
+
</MobileMatrixChoicesContainer>
|
|
219
298
|
<slot name="unansweredFlaggedNamesTable" />
|
|
220
299
|
</div>
|
|
221
300
|
<Summary
|
|
222
|
-
v-if="isMCR && showAnswers && !showPaywall"
|
|
301
|
+
v-if="((isMCR && showAnswers) || (isMatrixQuestion && showMatrixAnswers)) && !showPaywall"
|
|
223
302
|
ref="uikit-question__summary"
|
|
224
303
|
class="uikit-question__summary"
|
|
225
304
|
:question="question"
|
|
@@ -231,6 +310,8 @@
|
|
|
231
310
|
:reference="reference"
|
|
232
311
|
:hide-references="hideReferences"
|
|
233
312
|
:is-correct="isCorrect"
|
|
313
|
+
:is-matrix-question-correct="isMatrixQuestionCorrect"
|
|
314
|
+
:is-matrix-question="isMatrixQuestion"
|
|
234
315
|
:is-unanswered="isUnanswered"
|
|
235
316
|
:review-mode="reviewMode"
|
|
236
317
|
:is-dark-mode="isDarkMode"
|
|
@@ -245,6 +326,8 @@
|
|
|
245
326
|
class="uikit-question__stats-summary"
|
|
246
327
|
:global-metrics="globalMetrics"
|
|
247
328
|
:choice-scores="choiceScores"
|
|
329
|
+
:matrix-choice-scores="matrixChoiceScores"
|
|
330
|
+
:is-matrix-question="isMatrixQuestion"
|
|
248
331
|
:is-dark-mode="isDarkMode"
|
|
249
332
|
/>
|
|
250
333
|
</slot>
|
|
@@ -277,13 +360,21 @@
|
|
|
277
360
|
>
|
|
278
361
|
<slot name="action">
|
|
279
362
|
<PocketButton
|
|
280
|
-
v-if="!showAnswers && !hideAnswer && (showCheckAnswer || isMCR)"
|
|
363
|
+
v-if="!showAnswers && !hideAnswer && (showCheckAnswer || isMCR) && !isMatrixQuestion"
|
|
281
364
|
:disabled="!selectedChoices.length"
|
|
282
365
|
:is-dark-mode="isDarkMode"
|
|
283
366
|
@click="clickCheckAnswer"
|
|
284
367
|
>
|
|
285
368
|
Check Answer
|
|
286
369
|
</PocketButton>
|
|
370
|
+
<PocketButton
|
|
371
|
+
v-if="!showMatrixAnswers && !hideAnswer && isMatrixQuestion && allMatrixRowsAreAnswered"
|
|
372
|
+
:disabled="!selectedMatrixChoices.length"
|
|
373
|
+
:is-dark-mode="isDarkMode"
|
|
374
|
+
@click="clickCheckMatrixAnswer"
|
|
375
|
+
>
|
|
376
|
+
Check Answer
|
|
377
|
+
</PocketButton>
|
|
287
378
|
<PocketButton
|
|
288
379
|
v-else-if="(showAnswers || hideAnswer) && (questionNumber >= quizLength)"
|
|
289
380
|
:is-dark-mode="isDarkMode"
|
|
@@ -376,10 +467,22 @@ import ChoicesContainer from '../Quiz/Question/ChoicesContainer.vue'
|
|
|
376
467
|
import StatsSummary from '../Quiz/Question/StatsSummary.vue'
|
|
377
468
|
import Explanation from '../Quiz/Question/Explanation.vue'
|
|
378
469
|
import PassageAndImage from '../Quiz/Question/PassageAndImage.vue'
|
|
470
|
+
import MatrixChoicesContainer from '../Quiz/Question/MatrixChoicesContainer.vue'
|
|
471
|
+
import MobileMatrixChoicesContainer from '../Quiz/Question/MobileMatrixChoicesContainer.vue'
|
|
379
472
|
import type { Study } from '@pocketprep/types'
|
|
380
473
|
import { breakpoint, dark } from '../../directives'
|
|
381
474
|
import { highlightKeywordsInText, studyModes } from '../../utils'
|
|
382
|
-
import type {
|
|
475
|
+
import type {
|
|
476
|
+
Ref,
|
|
477
|
+
TQuizMode,
|
|
478
|
+
TChoiceKey,
|
|
479
|
+
TMatrixChoiceKey,
|
|
480
|
+
TChoice,
|
|
481
|
+
TChoiceScores,
|
|
482
|
+
TMatrixChoiceScores,
|
|
483
|
+
TNamesRow,
|
|
484
|
+
TViewNames,
|
|
485
|
+
} from './question'
|
|
383
486
|
|
|
384
487
|
@Component({
|
|
385
488
|
components: {
|
|
@@ -396,6 +499,8 @@ import type { Ref, TQuizMode, TChoiceKey, TChoice, TChoiceScores, TNamesRow, TVi
|
|
|
396
499
|
StatsSummary,
|
|
397
500
|
Explanation,
|
|
398
501
|
PassageAndImage,
|
|
502
|
+
MatrixChoicesContainer,
|
|
503
|
+
MobileMatrixChoicesContainer,
|
|
399
504
|
},
|
|
400
505
|
directives: {
|
|
401
506
|
breakpoint,
|
|
@@ -414,6 +519,7 @@ export default class Question extends Vue {
|
|
|
414
519
|
@Prop({ default: true }) showNextQuestion!: boolean
|
|
415
520
|
@Prop({ default: false }) reviewMode!: boolean
|
|
416
521
|
@Prop({ default: null }) previousChoices!: TChoiceKey[] | null
|
|
522
|
+
@Prop({ default: null }) previousMatrixChoices!: TMatrixChoiceKey[] | null
|
|
417
523
|
@Prop({ default: null }) globalMetrics!: Study.Class.GlobalQuestionMetricJSON | null
|
|
418
524
|
@Prop({ default: null }) showNames!: TViewNames | null
|
|
419
525
|
@Prop({ default: true }) allowKeyboardShortcuts!: boolean
|
|
@@ -432,7 +538,11 @@ export default class Question extends Vue {
|
|
|
432
538
|
focusChoiceKey: TChoiceKey | null = null
|
|
433
539
|
choiceStrikes: TChoiceKey[] = []
|
|
434
540
|
selectedChoices: TChoiceKey[] = []
|
|
541
|
+
selectedMatrixChoices: TMatrixChoiceKey[] = []
|
|
542
|
+
answeredMatrixRowIndexes: number[] = []
|
|
543
|
+
allMatrixRowsAreAnswered = false
|
|
435
544
|
showAnswers = false
|
|
545
|
+
showMatrixAnswers = false
|
|
436
546
|
showExplanation = false
|
|
437
547
|
showPassageImageLongAlt = false
|
|
438
548
|
showExplanationImageDropdown = false
|
|
@@ -488,6 +598,10 @@ export default class Question extends Vue {
|
|
|
488
598
|
return this.question.type === 'Multiple Correct Response'
|
|
489
599
|
}
|
|
490
600
|
|
|
601
|
+
get isMatrixQuestion () {
|
|
602
|
+
return this.question.type === 'Matrix Checkbox' || this.question.type === 'Matrix Radio Button'
|
|
603
|
+
}
|
|
604
|
+
|
|
491
605
|
get passageImageUrl () {
|
|
492
606
|
const imageUrl = this.question.passageImage?.url
|
|
493
607
|
|
|
@@ -522,11 +636,13 @@ export default class Question extends Vue {
|
|
|
522
636
|
|
|
523
637
|
get passageAndImageTitle () {
|
|
524
638
|
if (this.question.passage && this.passageImageUrl) {
|
|
525
|
-
return
|
|
639
|
+
return this.question.passageLabel ? `${this.question.passageLabel} + Image` :
|
|
640
|
+
'Passage + Image'
|
|
526
641
|
} else if (!this.question.passage && this.passageImageUrl) {
|
|
527
642
|
return 'Image'
|
|
528
643
|
} else {
|
|
529
|
-
return
|
|
644
|
+
return this.question.passageLabel ? `${this.question.passageLabel}` :
|
|
645
|
+
'Passage'
|
|
530
646
|
}
|
|
531
647
|
}
|
|
532
648
|
|
|
@@ -547,6 +663,20 @@ export default class Question extends Vue {
|
|
|
547
663
|
return this.answers.map(choice => choice.key)
|
|
548
664
|
}
|
|
549
665
|
|
|
666
|
+
get matrixAnswerKeys () {
|
|
667
|
+
if (this.question?.matrixChoiceLayout) {
|
|
668
|
+
return this.question?.matrixChoiceLayout.flat().filter(choice => choice.startsWith('a'))
|
|
669
|
+
}
|
|
670
|
+
return []
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
get matrixDistractorKeys () {
|
|
674
|
+
if (this.question?.matrixChoiceLayout) {
|
|
675
|
+
return this.question?.matrixChoiceLayout.flat().filter(choice => choice.startsWith('d'))
|
|
676
|
+
}
|
|
677
|
+
return []
|
|
678
|
+
}
|
|
679
|
+
|
|
550
680
|
get distractors (): TChoice[] {
|
|
551
681
|
const distractors = this.question.choices.filter(choice => !choice.isCorrect).map((choice, index) => ({
|
|
552
682
|
text: choice.text,
|
|
@@ -574,6 +704,12 @@ export default class Question extends Vue {
|
|
|
574
704
|
&& !this.selectedChoices.join(' ').includes('d')
|
|
575
705
|
}
|
|
576
706
|
|
|
707
|
+
get isMatrixQuestionCorrect () {
|
|
708
|
+
return this.showMatrixAnswers
|
|
709
|
+
&& this.selectedMatrixChoices.length === this.matrixAnswerKeys.length
|
|
710
|
+
&& !this.selectedMatrixChoices.join(' ').includes('d')
|
|
711
|
+
}
|
|
712
|
+
|
|
577
713
|
get choiceScores (): TChoiceScores {
|
|
578
714
|
const globalMetrics = this.globalMetrics
|
|
579
715
|
|
|
@@ -608,8 +744,32 @@ export default class Question extends Vue {
|
|
|
608
744
|
return scores
|
|
609
745
|
}
|
|
610
746
|
|
|
747
|
+
get matrixChoiceScores (): TMatrixChoiceScores {
|
|
748
|
+
const globalMetrics = this.globalMetrics
|
|
749
|
+
|
|
750
|
+
const scores: TMatrixChoiceScores = {
|
|
751
|
+
totalAnswered: this.selectedMatrixChoices.length &&
|
|
752
|
+
this.showMatrixAnswers && !this.reviewMode ? 1 : 0,
|
|
753
|
+
answeredCorrectly: this.isCorrect && !this.reviewMode ? 1 : 0,
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if (!globalMetrics) {
|
|
757
|
+
return scores
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
scores.totalAnswered += (
|
|
761
|
+
(globalMetrics.answeredCorrectlyCount || 0)
|
|
762
|
+
+ (globalMetrics.answeredIncorrectlyCount || 0)
|
|
763
|
+
)
|
|
764
|
+
scores.answeredCorrectly += (globalMetrics.answeredCorrectlyCount || 0)
|
|
765
|
+
return scores
|
|
766
|
+
}
|
|
767
|
+
|
|
611
768
|
get isUnanswered () {
|
|
612
|
-
|
|
769
|
+
if (!this.isMatrixQuestion) {
|
|
770
|
+
return this.selectedChoices.length === 0
|
|
771
|
+
}
|
|
772
|
+
return this.selectedMatrixChoices.length === 0
|
|
613
773
|
}
|
|
614
774
|
|
|
615
775
|
get prompt () {
|
|
@@ -626,12 +786,17 @@ export default class Question extends Vue {
|
|
|
626
786
|
this.startReviewMode()
|
|
627
787
|
}
|
|
628
788
|
|
|
629
|
-
if (this.previousChoices) {
|
|
789
|
+
if (!this.isMatrixQuestion && this.previousChoices) {
|
|
630
790
|
this.updateSelectedChoices(this.previousChoices)
|
|
631
791
|
}
|
|
632
792
|
|
|
793
|
+
if (this.isMatrixQuestion && this.previousMatrixChoices) {
|
|
794
|
+
this.updateSelectedMatrixChoices(this.previousMatrixChoices)
|
|
795
|
+
}
|
|
796
|
+
|
|
633
797
|
if (this.initialShowAnswers) {
|
|
634
798
|
this.showAnswers = this.initialShowAnswers
|
|
799
|
+
this.showMatrixAnswers = this.initialShowAnswers
|
|
635
800
|
}
|
|
636
801
|
|
|
637
802
|
if (this.allowKeyboardShortcuts) {
|
|
@@ -739,29 +904,44 @@ export default class Question extends Vue {
|
|
|
739
904
|
if (target.classList.contains('keyword-highlight')) {
|
|
740
905
|
const keyword = target.innerHTML
|
|
741
906
|
const location = target.getAttribute('data-location')
|
|
907
|
+
const clickLocation = { x: event.clientX, y: event.clientY }
|
|
742
908
|
return {
|
|
743
909
|
keyword,
|
|
744
910
|
location,
|
|
911
|
+
clickLocation,
|
|
912
|
+
target,
|
|
745
913
|
}
|
|
746
914
|
}
|
|
747
915
|
}
|
|
748
916
|
|
|
749
917
|
startReviewMode () {
|
|
750
|
-
this.
|
|
751
|
-
|
|
752
|
-
|
|
918
|
+
if (!this.isMatrixQuestion) {
|
|
919
|
+
this.showAnswers = true
|
|
920
|
+
this.showExplanation = this.defaultShowExplanation === null ? true : this.defaultShowExplanation
|
|
921
|
+
this.selectedChoices = this.answerKeys
|
|
922
|
+
} else {
|
|
923
|
+
this.showMatrixAnswers = true
|
|
924
|
+
this.showExplanation = this.defaultShowExplanation === null ? true : this.defaultShowExplanation
|
|
925
|
+
this.selectedMatrixChoices = this.matrixAnswerKeys as TMatrixChoiceKey[]
|
|
926
|
+
}
|
|
753
927
|
}
|
|
754
928
|
|
|
755
929
|
stopReviewMode () {
|
|
756
930
|
this.showAnswers = false
|
|
931
|
+
this.showMatrixAnswers = false
|
|
757
932
|
this.showExplanation = false
|
|
758
933
|
this.selectedChoices = []
|
|
934
|
+
this.selectedMatrixChoices = []
|
|
759
935
|
}
|
|
760
936
|
|
|
761
937
|
updateSelectedChoices (choices: TChoiceKey[]) {
|
|
762
938
|
this.selectedChoices = [ ...choices ]
|
|
763
939
|
}
|
|
764
940
|
|
|
941
|
+
updateSelectedMatrixChoices (matrixChoices: TMatrixChoiceKey[]) {
|
|
942
|
+
this.selectedMatrixChoices = [ ...matrixChoices ]
|
|
943
|
+
}
|
|
944
|
+
|
|
765
945
|
// deterministic shuffling of choices so they don't change order everytime you reload the component
|
|
766
946
|
shuffleChoices (choices: TChoice[]): TChoice[] {
|
|
767
947
|
const sortedChoices = choices.sort((a, b) => {
|
|
@@ -933,6 +1113,21 @@ export default class Question extends Vue {
|
|
|
933
1113
|
}
|
|
934
1114
|
}
|
|
935
1115
|
|
|
1116
|
+
selectMatrixChoice (matrixChoiceKeys: TMatrixChoiceKey[]) {
|
|
1117
|
+
if (this.showMatrixAnswers) {
|
|
1118
|
+
return
|
|
1119
|
+
}
|
|
1120
|
+
this.selectedMatrixChoices = matrixChoiceKeys
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
answeredMatrixRowIndex (answeredRowIndexes: number[]) {
|
|
1124
|
+
if (this.showMatrixAnswers) {
|
|
1125
|
+
return
|
|
1126
|
+
}
|
|
1127
|
+
this.answeredMatrixRowIndexes = answeredRowIndexes
|
|
1128
|
+
this.allMatrixRowsAreAnswered = this.answeredMatrixRowIndexes.length === this.question.matrixLabels?.rows.length
|
|
1129
|
+
}
|
|
1130
|
+
|
|
936
1131
|
togglePassageImageLongAlt () {
|
|
937
1132
|
this.showPassageImageLongAlt = !this.showPassageImageLongAlt
|
|
938
1133
|
|
|
@@ -1077,6 +1272,29 @@ export default class Question extends Vue {
|
|
|
1077
1272
|
}
|
|
1078
1273
|
}
|
|
1079
1274
|
|
|
1275
|
+
clickCheckMatrixAnswer () {
|
|
1276
|
+
if (!this.hideAnswer) {
|
|
1277
|
+
this.showMatrixAnswers = true
|
|
1278
|
+
|
|
1279
|
+
this.emitCheckAnswer({
|
|
1280
|
+
isCorrect: this.isMatrixQuestionCorrect,
|
|
1281
|
+
selectedChoices: this.selectedMatrixChoices,
|
|
1282
|
+
questionSerial: this.question.serial,
|
|
1283
|
+
})
|
|
1284
|
+
|
|
1285
|
+
setTimeout(() => {
|
|
1286
|
+
const summaryMatrixComp =
|
|
1287
|
+
this.$refs['uikit-question__summary'] as ComponentPublicInstance | undefined
|
|
1288
|
+
const summaryMatrixExplanation =
|
|
1289
|
+
// eslint-disable-next-line max-len
|
|
1290
|
+
summaryMatrixComp?.$refs['uikit-question-summary__summary-toggle-explanation-text'] as HTMLElement | undefined
|
|
1291
|
+
if (summaryMatrixExplanation) {
|
|
1292
|
+
summaryMatrixExplanation?.focus()
|
|
1293
|
+
}
|
|
1294
|
+
}, 500)
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1080
1298
|
mappedNameRows (choiceKey: string) {
|
|
1081
1299
|
/*
|
|
1082
1300
|
There is a specific order in which we have to fill the rows in the table for visible names.
|
|
@@ -1137,6 +1355,11 @@ export default class Question extends Vue {
|
|
|
1137
1355
|
this.updateSelectedChoices(choices)
|
|
1138
1356
|
}
|
|
1139
1357
|
|
|
1358
|
+
@Watch('previousMatrixChoices', { deep: true })
|
|
1359
|
+
previousMatrixChoicesChanged (matrixChoice: TMatrixChoiceKey[]) {
|
|
1360
|
+
this.updateSelectedMatrixChoices(matrixChoice)
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1140
1363
|
@Emit('selectedChoices')
|
|
1141
1364
|
emitSelectedChoices (selectedChoices: Study.Cloud.IQuizAnswer) {
|
|
1142
1365
|
return selectedChoices
|
|
@@ -1152,6 +1375,16 @@ export default class Question extends Vue {
|
|
|
1152
1375
|
} as Study.Cloud.IQuizAnswer)
|
|
1153
1376
|
}
|
|
1154
1377
|
|
|
1378
|
+
@Watch('selectedMatrixChoices', { deep: true })
|
|
1379
|
+
selectedMatrixChoicesChanged () {
|
|
1380
|
+
this.emitSelectedChoices({
|
|
1381
|
+
isCorrect: this.selectedMatrixChoices.length === this.matrixAnswerKeys.length
|
|
1382
|
+
&& !this.selectedMatrixChoices.join(' ').includes('d'),
|
|
1383
|
+
selectedChoices: this.selectedMatrixChoices,
|
|
1384
|
+
questionSerial: this.question.serial,
|
|
1385
|
+
} as Study.Cloud.IQuizAnswer)
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1155
1388
|
@Watch('showExplanation')
|
|
1156
1389
|
showExplanationChanged () {
|
|
1157
1390
|
this.emitUpdateShowExplanation()
|
|
@@ -1311,13 +1544,80 @@ export default class Question extends Vue {
|
|
|
1311
1544
|
}
|
|
1312
1545
|
}
|
|
1313
1546
|
|
|
1547
|
+
.keyword-highlight--dark.keyword-highlight--active {
|
|
1548
|
+
height: 22px;
|
|
1549
|
+
background-color: rgba($banana-bread, 0.4);
|
|
1550
|
+
border-bottom: none;
|
|
1551
|
+
border-radius: 2px;
|
|
1552
|
+
|
|
1553
|
+
&[data-location="explanation"] {
|
|
1554
|
+
height: 20px;
|
|
1555
|
+
background-color: rgba($banana-bread, 0.4);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1314
1559
|
.keyword-highlight {
|
|
1315
|
-
|
|
1316
|
-
|
|
1560
|
+
box-sizing: border-box;
|
|
1561
|
+
background-color: rgba($banana-bread, 0.25);
|
|
1562
|
+
border-radius: 2px 2px 0 0;
|
|
1563
|
+
border-bottom: 1.5px solid $banana-bread;
|
|
1564
|
+
height: 21px;
|
|
1565
|
+
line-height: 22px;
|
|
1566
|
+
padding: 0 2px 0 1px;
|
|
1567
|
+
margin: 0 -2px 0 -1px;
|
|
1317
1568
|
cursor: pointer;
|
|
1569
|
+
|
|
1570
|
+
&[data-location="explanation"] {
|
|
1571
|
+
height: 20px;
|
|
1572
|
+
line-height: 21px;
|
|
1573
|
+
background-color: $manilla;
|
|
1574
|
+
border-radius: 1px 1px 0 0;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
&:hover:not(&--active) {
|
|
1578
|
+
background-color: rgba($banana-bread, 0.4);
|
|
1579
|
+
border-color: $butterscotch;
|
|
1580
|
+
|
|
1581
|
+
&[data-location="explanation"] {
|
|
1582
|
+
background-color: $buttermilk;
|
|
1583
|
+
border-radius: 2px 2px 0 0;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
&--active {
|
|
1588
|
+
height: 22px;
|
|
1589
|
+
line-height: 23px;
|
|
1590
|
+
background-color: $beach-sand;
|
|
1591
|
+
border-bottom: none;
|
|
1592
|
+
border-radius: 2px;
|
|
1593
|
+
|
|
1594
|
+
&[data-location="explanation"] {
|
|
1595
|
+
height: 20px;
|
|
1596
|
+
line-height: 21px;
|
|
1597
|
+
background-color: $beach-sand;
|
|
1598
|
+
border-radius: 2px;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1318
1601
|
|
|
1319
1602
|
&--dark {
|
|
1320
|
-
|
|
1603
|
+
color: $white;
|
|
1604
|
+
background-color: rgba($banana-bread, 0.3);
|
|
1605
|
+
border-color: rgba($banana-bread, 0.6);
|
|
1606
|
+
|
|
1607
|
+
&[data-location="explanation"] {
|
|
1608
|
+
background-color: rgba($banana-bread, 0.3);
|
|
1609
|
+
border-color: rgba($banana-bread, 0.6);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
&:hover:not(&--active) {
|
|
1613
|
+
background-color: rgba($banana-bread, 0.4);
|
|
1614
|
+
border-color: rgba($banana-bread, 0.8);
|
|
1615
|
+
|
|
1616
|
+
&[data-location="explanation"] {
|
|
1617
|
+
background-color: rgba($banana-bread, 0.4);
|
|
1618
|
+
border-color: rgba($banana-bread, 0.8);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1321
1621
|
}
|
|
1322
1622
|
}
|
|
1323
1623
|
|
|
@@ -1567,5 +1867,16 @@ export default class Question extends Vue {
|
|
|
1567
1867
|
margin-top: 24px;
|
|
1568
1868
|
}
|
|
1569
1869
|
}
|
|
1870
|
+
|
|
1871
|
+
&__matrix-choices-container {
|
|
1872
|
+
display: block;
|
|
1873
|
+
@include breakpoint(black-bear) {
|
|
1874
|
+
display: none;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
&__mobile-matrix-choices-container {
|
|
1879
|
+
display: block;
|
|
1880
|
+
}
|
|
1570
1881
|
}
|
|
1571
1882
|
</style>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<div
|
|
9
9
|
v-breakpoint:quizContainerEl
|
|
10
10
|
class="uikit-quiz-container__header"
|
|
11
|
+
:class="{'uikit-quiz-container__header--dark': isDarkMode}"
|
|
11
12
|
:style="customHeaderStyles"
|
|
12
13
|
>
|
|
13
14
|
<slot name="header" />
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
v-dark="isDarkMode"
|
|
20
21
|
class="uikit-quiz-container__side"
|
|
21
22
|
>
|
|
23
|
+
<slot name="definition"></slot>
|
|
22
24
|
<slot name="side" />
|
|
23
25
|
</div>
|
|
24
26
|
<div
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
<div
|
|
36
38
|
v-breakpoint:quizContainerEl
|
|
37
39
|
class="uikit-quiz-container__footer"
|
|
40
|
+
:class="{'uikit-quiz-container__footer--dark': isDarkMode}"
|
|
38
41
|
:style="customFooterStyles"
|
|
39
42
|
>
|
|
40
43
|
<slot name="footer" />
|
|
@@ -117,6 +120,8 @@ export default class QuizContainer extends Vue {
|
|
|
117
120
|
width: 100%;
|
|
118
121
|
height: 65px;
|
|
119
122
|
color: $white;
|
|
123
|
+
background-color: $brand-black;
|
|
124
|
+
z-index: 4;
|
|
120
125
|
position: relative;
|
|
121
126
|
|
|
122
127
|
&--mobile {
|
|
@@ -124,6 +129,10 @@ export default class QuizContainer extends Vue {
|
|
|
124
129
|
padding: 0 10px;
|
|
125
130
|
box-sizing: border-box;
|
|
126
131
|
}
|
|
132
|
+
|
|
133
|
+
&--dark {
|
|
134
|
+
background-color: $jet;
|
|
135
|
+
}
|
|
127
136
|
}
|
|
128
137
|
|
|
129
138
|
&__main {
|
|
@@ -143,7 +152,6 @@ export default class QuizContainer extends Vue {
|
|
|
143
152
|
height: 100%;
|
|
144
153
|
margin-right: 23px;
|
|
145
154
|
border-radius: 6px;
|
|
146
|
-
z-index: 2;
|
|
147
155
|
|
|
148
156
|
&--dark {
|
|
149
157
|
background-color: $mariner;
|
|
@@ -198,6 +206,12 @@ export default class QuizContainer extends Vue {
|
|
|
198
206
|
width: 100%;
|
|
199
207
|
height: 65px;
|
|
200
208
|
color: $white;
|
|
209
|
+
background-color: $brand-black;
|
|
210
|
+
z-index: 3;
|
|
211
|
+
|
|
212
|
+
&--dark {
|
|
213
|
+
background-color: $jet;
|
|
214
|
+
}
|
|
201
215
|
|
|
202
216
|
&--mobile {
|
|
203
217
|
height: 54px;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocketprep/ui-kit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.53",
|
|
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",
|