catchup-library-web 2.2.2 → 2.2.3
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +234 -184
- package/dist/index.mjs +233 -183
- package/package.json +1 -1
- package/src/components/activities/MCMAActivityContent.tsx +2 -0
- package/src/components/activities/MCSAActivityContent.tsx +2 -0
- package/src/components/activities/material-contents/DropdownActivityMaterialContent.tsx +146 -142
- package/src/components/activities/material-contents/FillInTheBlanksActivityMaterialContent.tsx +28 -19
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +12 -8
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +21 -3
- package/src/components/activities/material-contents/MCSAActivityMaterialContent.tsx +20 -3
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +20 -13
- package/src/properties/ActivityProperties.ts +2 -0
|
@@ -22,6 +22,7 @@ const MatchingActivityMaterialContent = ({
|
|
|
22
22
|
null
|
|
23
23
|
);
|
|
24
24
|
const [shuffledMaterialList, setShuffledMaterialList] = useState<any[]>([]);
|
|
25
|
+
const [displayAnswerMap, setDisplayAnswerMap] = useState<any>(answerMap);
|
|
25
26
|
const dragElementRef = useRef<HTMLDivElement>(null);
|
|
26
27
|
const [mousePosition, setMousePosition] = useState<{ x: number; y: number }>({
|
|
27
28
|
x: 0,
|
|
@@ -58,9 +59,12 @@ const MatchingActivityMaterialContent = ({
|
|
|
58
59
|
}, [materialMap]);
|
|
59
60
|
|
|
60
61
|
useEffect(() => {
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
if (showCorrectAnswer) {
|
|
63
|
+
setDisplayAnswerMap(materialMap);
|
|
64
|
+
} else {
|
|
65
|
+
setDisplayAnswerMap(answerMap);
|
|
66
|
+
}
|
|
67
|
+
}, [showCorrectAnswer, answerMap, materialMap]);
|
|
64
68
|
|
|
65
69
|
useEffect(() => {
|
|
66
70
|
if (!dropTargetKey || !dropZoneRefs.current[dropTargetKey]) return;
|
|
@@ -127,10 +131,10 @@ const MatchingActivityMaterialContent = ({
|
|
|
127
131
|
requestAnimationFrame(animate);
|
|
128
132
|
}, [dropTargetKey]);
|
|
129
133
|
|
|
130
|
-
const retrieveFilteredMaterialList = (
|
|
134
|
+
const retrieveFilteredMaterialList = (currentAnswerMap: any) => {
|
|
131
135
|
const selectedValueList: any = [];
|
|
132
|
-
Object.keys(
|
|
133
|
-
selectedValueList.push(
|
|
136
|
+
Object.keys(currentAnswerMap).forEach((key) => {
|
|
137
|
+
selectedValueList.push(currentAnswerMap[key]);
|
|
134
138
|
});
|
|
135
139
|
|
|
136
140
|
return shuffledMaterialList.filter(
|
|
@@ -246,7 +250,7 @@ const MatchingActivityMaterialContent = ({
|
|
|
246
250
|
}
|
|
247
251
|
};
|
|
248
252
|
|
|
249
|
-
const filteredMaterialList = retrieveFilteredMaterialList(
|
|
253
|
+
const filteredMaterialList = retrieveFilteredMaterialList(displayAnswerMap);
|
|
250
254
|
|
|
251
255
|
return (
|
|
252
256
|
<div onMouseMove={handleMouseMove} onMouseUp={handleMouseUp}>
|
|
@@ -421,10 +425,10 @@ const MatchingActivityMaterialContent = ({
|
|
|
421
425
|
</>
|
|
422
426
|
) : null}
|
|
423
427
|
|
|
424
|
-
{Object.keys(
|
|
428
|
+
{Object.keys(displayAnswerMap).map((answerMapKey, index) => {
|
|
425
429
|
const learnerAnswerState = checkAnswerState(
|
|
426
430
|
materialMap[answerMapKey],
|
|
427
|
-
|
|
431
|
+
displayAnswerMap[answerMapKey]
|
|
428
432
|
);
|
|
429
433
|
|
|
430
434
|
return (
|
|
@@ -501,17 +505,20 @@ const MatchingActivityMaterialContent = ({
|
|
|
501
505
|
className="h-full flex-1 flex flex-row items-center justify-center px-4"
|
|
502
506
|
onClick={(e) => {
|
|
503
507
|
e.stopPropagation();
|
|
504
|
-
if (
|
|
508
|
+
if (
|
|
509
|
+
checkCanAnswerQuestion() &&
|
|
510
|
+
displayAnswerMap[answerMapKey]
|
|
511
|
+
) {
|
|
505
512
|
onChange(answerMap, answerMapKey, null);
|
|
506
513
|
setSelectedValue(null);
|
|
507
514
|
}
|
|
508
515
|
}}
|
|
509
516
|
>
|
|
510
|
-
{
|
|
517
|
+
{displayAnswerMap[answerMapKey] ? (
|
|
511
518
|
contentMap.type === "TEXT" ? (
|
|
512
519
|
<p className="text-lg whitespace-pre-wrap">
|
|
513
520
|
{constructInputWithSpecialExpressionList(
|
|
514
|
-
|
|
521
|
+
displayAnswerMap[answerMapKey]
|
|
515
522
|
).map((inputPart, index) => (
|
|
516
523
|
<span
|
|
517
524
|
key={index}
|
|
@@ -533,7 +540,7 @@ const MatchingActivityMaterialContent = ({
|
|
|
533
540
|
<ShowMaterialMediaByContentType
|
|
534
541
|
key={`${uniqueValue}-${index}`}
|
|
535
542
|
contentType={contentMap.type}
|
|
536
|
-
src={
|
|
543
|
+
src={displayAnswerMap[answerMapKey]}
|
|
537
544
|
canFullScreen={false}
|
|
538
545
|
/>
|
|
539
546
|
)
|
|
@@ -78,6 +78,7 @@ export interface IMCSAActivityMaterialProps {
|
|
|
78
78
|
checkCanAnswerQuestion: () => boolean;
|
|
79
79
|
onChange: (e1: any, e2: any, e3: string) => void;
|
|
80
80
|
isPreview: boolean;
|
|
81
|
+
showCorrectAnswer: boolean;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
export interface IMCMAActivityProps {
|
|
@@ -98,6 +99,7 @@ export interface IMCMAActivityMaterialProps {
|
|
|
98
99
|
checkCanAnswerQuestion: () => boolean;
|
|
99
100
|
onChange: (e1: any, e2: any, e3: string) => void;
|
|
100
101
|
isPreview: boolean;
|
|
102
|
+
showCorrectAnswer: boolean;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
export interface IGroupingActivityProps {
|