catchup-library-web 2.7.6 → 2.7.8
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.js +21 -10
- package/dist/index.mjs +22 -11
- package/package.json +1 -1
- package/src/components/activities/ActivityPreviewByData.tsx +6 -2
- package/src/components/activities/material-contents/GroupingActivityMaterialContent.tsx +6 -4
- package/src/components/activities/material-contents/MCMAActivityMaterialContent.tsx +4 -3
- package/src/components/activities/material-contents/MatchingActivityMaterialContent.tsx +6 -5
package/dist/index.js
CHANGED
|
@@ -5521,7 +5521,6 @@ var GroupingActivityMaterialContent = ({
|
|
|
5521
5521
|
};
|
|
5522
5522
|
}, [draggedValue]);
|
|
5523
5523
|
(0, import_react21.useEffect)(() => {
|
|
5524
|
-
if (hasShuffledRef.current) return;
|
|
5525
5524
|
const shuffleArray2 = (array) => {
|
|
5526
5525
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5527
5526
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -5536,8 +5535,12 @@ var GroupingActivityMaterialContent = ({
|
|
|
5536
5535
|
materialList.push(materialValue);
|
|
5537
5536
|
}
|
|
5538
5537
|
});
|
|
5539
|
-
|
|
5540
|
-
|
|
5538
|
+
if (!hasShuffledRef.current) {
|
|
5539
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5540
|
+
hasShuffledRef.current = true;
|
|
5541
|
+
} else {
|
|
5542
|
+
setShuffledMaterialList(materialList);
|
|
5543
|
+
}
|
|
5541
5544
|
}, [materialMap]);
|
|
5542
5545
|
(0, import_react21.useEffect)(() => {
|
|
5543
5546
|
if (showCorrectAnswer) {
|
|
@@ -5969,7 +5972,6 @@ var MatchingActivityMaterialContent = ({
|
|
|
5969
5972
|
};
|
|
5970
5973
|
}, [draggedValue]);
|
|
5971
5974
|
(0, import_react22.useEffect)(() => {
|
|
5972
|
-
if (hasShuffledRef.current) return;
|
|
5973
5975
|
const shuffleArray2 = (array) => {
|
|
5974
5976
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5975
5977
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -5982,8 +5984,12 @@ var MatchingActivityMaterialContent = ({
|
|
|
5982
5984
|
Object.keys(materialMap).forEach((materialKey) => {
|
|
5983
5985
|
materialList.push(materialMap[materialKey]);
|
|
5984
5986
|
});
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
+
if (!hasShuffledRef.current) {
|
|
5988
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5989
|
+
hasShuffledRef.current = true;
|
|
5990
|
+
} else {
|
|
5991
|
+
setShuffledMaterialList(materialList);
|
|
5992
|
+
}
|
|
5987
5993
|
}, [materialMap]);
|
|
5988
5994
|
(0, import_react22.useEffect)(() => {
|
|
5989
5995
|
if (showCorrectAnswer) {
|
|
@@ -6387,7 +6393,8 @@ var MCMAActivityMaterialContent = ({
|
|
|
6387
6393
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DividerLine_default, {}) }),
|
|
6388
6394
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", children: checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
6389
6395
|
(materialSubKey, index2) => {
|
|
6390
|
-
const
|
|
6396
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
6397
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
6391
6398
|
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
6392
6399
|
);
|
|
6393
6400
|
const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
|
|
@@ -6405,7 +6412,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6405
6412
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6406
6413
|
BaseImage_default,
|
|
6407
6414
|
{
|
|
6408
|
-
src:
|
|
6415
|
+
src: currentDisplayAnswerList.includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
|
|
6409
6416
|
alt: "checkbox",
|
|
6410
6417
|
size: "small",
|
|
6411
6418
|
onClick: () => {
|
|
@@ -6436,7 +6443,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6436
6443
|
);
|
|
6437
6444
|
}
|
|
6438
6445
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
6439
|
-
displayAnswerMap[materialKey]
|
|
6446
|
+
displayAnswerMap[materialKey] || ""
|
|
6440
6447
|
).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6441
6448
|
"span",
|
|
6442
6449
|
{
|
|
@@ -7633,8 +7640,12 @@ var ActivityPreviewByData = ({
|
|
|
7633
7640
|
if (optionList.length === 0) return;
|
|
7634
7641
|
setSelectedType(optionList[0].id);
|
|
7635
7642
|
}, [optionList]);
|
|
7643
|
+
const prevDataStringRef = (0, import_react27.useRef)("");
|
|
7636
7644
|
(0, import_react27.useEffect)(() => {
|
|
7637
7645
|
if (activityTemplateTypeList.length === 0) return;
|
|
7646
|
+
const dataString = JSON.stringify(data);
|
|
7647
|
+
if (dataString === prevDataStringRef.current) return;
|
|
7648
|
+
prevDataStringRef.current = dataString;
|
|
7638
7649
|
const currentAnswerMapMap = {};
|
|
7639
7650
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
7640
7651
|
if (answerType === activityTemplateMap.type) {
|
|
@@ -7647,7 +7658,7 @@ var ActivityPreviewByData = ({
|
|
|
7647
7658
|
}
|
|
7648
7659
|
}
|
|
7649
7660
|
setAnswerMapMap(currentAnswerMapMap);
|
|
7650
|
-
}, [activityTemplateTypeList]);
|
|
7661
|
+
}, [activityTemplateTypeList, data]);
|
|
7651
7662
|
const RenderSelectedActivityContent = () => {
|
|
7652
7663
|
if (!selectedType) return null;
|
|
7653
7664
|
const commonProps = {
|
package/dist/index.mjs
CHANGED
|
@@ -5281,7 +5281,6 @@ var GroupingActivityMaterialContent = ({
|
|
|
5281
5281
|
};
|
|
5282
5282
|
}, [draggedValue]);
|
|
5283
5283
|
useEffect10(() => {
|
|
5284
|
-
if (hasShuffledRef.current) return;
|
|
5285
5284
|
const shuffleArray2 = (array) => {
|
|
5286
5285
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5287
5286
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -5296,8 +5295,12 @@ var GroupingActivityMaterialContent = ({
|
|
|
5296
5295
|
materialList.push(materialValue);
|
|
5297
5296
|
}
|
|
5298
5297
|
});
|
|
5299
|
-
|
|
5300
|
-
|
|
5298
|
+
if (!hasShuffledRef.current) {
|
|
5299
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5300
|
+
hasShuffledRef.current = true;
|
|
5301
|
+
} else {
|
|
5302
|
+
setShuffledMaterialList(materialList);
|
|
5303
|
+
}
|
|
5301
5304
|
}, [materialMap]);
|
|
5302
5305
|
useEffect10(() => {
|
|
5303
5306
|
if (showCorrectAnswer) {
|
|
@@ -5729,7 +5732,6 @@ var MatchingActivityMaterialContent = ({
|
|
|
5729
5732
|
};
|
|
5730
5733
|
}, [draggedValue]);
|
|
5731
5734
|
useEffect11(() => {
|
|
5732
|
-
if (hasShuffledRef.current) return;
|
|
5733
5735
|
const shuffleArray2 = (array) => {
|
|
5734
5736
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
5735
5737
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -5742,8 +5744,12 @@ var MatchingActivityMaterialContent = ({
|
|
|
5742
5744
|
Object.keys(materialMap).forEach((materialKey) => {
|
|
5743
5745
|
materialList.push(materialMap[materialKey]);
|
|
5744
5746
|
});
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
+
if (!hasShuffledRef.current) {
|
|
5748
|
+
setShuffledMaterialList(shuffleArray2(materialList));
|
|
5749
|
+
hasShuffledRef.current = true;
|
|
5750
|
+
} else {
|
|
5751
|
+
setShuffledMaterialList(materialList);
|
|
5752
|
+
}
|
|
5747
5753
|
}, [materialMap]);
|
|
5748
5754
|
useEffect11(() => {
|
|
5749
5755
|
if (showCorrectAnswer) {
|
|
@@ -6147,7 +6153,8 @@ var MCMAActivityMaterialContent = ({
|
|
|
6147
6153
|
/* @__PURE__ */ jsx36("div", { className: "hidden md:block flex-shrink-0", children: /* @__PURE__ */ jsx36(DividerLine_default, {}) }),
|
|
6148
6154
|
/* @__PURE__ */ jsx36("div", { className: "flex-1 min-h-0 overflow-y-auto", children: checkCanAnswerQuestion() ? /* @__PURE__ */ jsx36("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
|
|
6149
6155
|
(materialSubKey, index2) => {
|
|
6150
|
-
const
|
|
6156
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
6157
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
6151
6158
|
(learnerAnswer) => learnerAnswer === materialSubKey
|
|
6152
6159
|
);
|
|
6153
6160
|
const learnerAnswerState = !isPreview ? "HIDDEN" : materialSubKey !== foundAnswer ? "EMPTY" : checkAnswerState(correctAnswerList, foundAnswer);
|
|
@@ -6165,7 +6172,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6165
6172
|
/* @__PURE__ */ jsx36(
|
|
6166
6173
|
BaseImage_default,
|
|
6167
6174
|
{
|
|
6168
|
-
src:
|
|
6175
|
+
src: currentDisplayAnswerList.includes(materialSubKey) ? "/icons/checkbox.webp" : "/icons/checkbox-empty.webp",
|
|
6169
6176
|
alt: "checkbox",
|
|
6170
6177
|
size: "small",
|
|
6171
6178
|
onClick: () => {
|
|
@@ -6196,7 +6203,7 @@ var MCMAActivityMaterialContent = ({
|
|
|
6196
6203
|
);
|
|
6197
6204
|
}
|
|
6198
6205
|
) }) : /* @__PURE__ */ jsx36("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
|
|
6199
|
-
displayAnswerMap[materialKey]
|
|
6206
|
+
displayAnswerMap[materialKey] || ""
|
|
6200
6207
|
).map((inputPart, index2) => /* @__PURE__ */ jsx36(
|
|
6201
6208
|
"span",
|
|
6202
6209
|
{
|
|
@@ -7276,7 +7283,7 @@ var ActivityEvaluationRubricContent = ({
|
|
|
7276
7283
|
var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
|
|
7277
7284
|
|
|
7278
7285
|
// src/components/activities/ActivityPreviewByData.tsx
|
|
7279
|
-
import { useEffect as useEffect16, useState as useState26 } from "react";
|
|
7286
|
+
import { useEffect as useEffect16, useRef as useRef8, useState as useState26 } from "react";
|
|
7280
7287
|
|
|
7281
7288
|
// src/components/boxes/SelectionBox.tsx
|
|
7282
7289
|
import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -7393,8 +7400,12 @@ var ActivityPreviewByData = ({
|
|
|
7393
7400
|
if (optionList.length === 0) return;
|
|
7394
7401
|
setSelectedType(optionList[0].id);
|
|
7395
7402
|
}, [optionList]);
|
|
7403
|
+
const prevDataStringRef = useRef8("");
|
|
7396
7404
|
useEffect16(() => {
|
|
7397
7405
|
if (activityTemplateTypeList.length === 0) return;
|
|
7406
|
+
const dataString = JSON.stringify(data);
|
|
7407
|
+
if (dataString === prevDataStringRef.current) return;
|
|
7408
|
+
prevDataStringRef.current = dataString;
|
|
7398
7409
|
const currentAnswerMapMap = {};
|
|
7399
7410
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
7400
7411
|
if (answerType === activityTemplateMap.type) {
|
|
@@ -7407,7 +7418,7 @@ var ActivityPreviewByData = ({
|
|
|
7407
7418
|
}
|
|
7408
7419
|
}
|
|
7409
7420
|
setAnswerMapMap(currentAnswerMapMap);
|
|
7410
|
-
}, [activityTemplateTypeList]);
|
|
7421
|
+
}, [activityTemplateTypeList, data]);
|
|
7411
7422
|
const RenderSelectedActivityContent = () => {
|
|
7412
7423
|
if (!selectedType) return null;
|
|
7413
7424
|
const commonProps = {
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import DropdownActivityContent from "./DropdownActivityContent";
|
|
3
3
|
import FillInTheBlanksActivityContent from "./FillInTheBlanksActivityContent";
|
|
4
4
|
import GroupingActivityContent from "./GroupingActivityContent";
|
|
@@ -102,8 +102,12 @@ const ActivityPreviewByData = ({
|
|
|
102
102
|
setSelectedType(optionList[0].id);
|
|
103
103
|
}, [optionList]);
|
|
104
104
|
|
|
105
|
+
const prevDataStringRef = useRef<string>("");
|
|
105
106
|
useEffect(() => {
|
|
106
107
|
if (activityTemplateTypeList.length === 0) return;
|
|
108
|
+
const dataString = JSON.stringify(data);
|
|
109
|
+
if (dataString === prevDataStringRef.current) return;
|
|
110
|
+
prevDataStringRef.current = dataString;
|
|
107
111
|
const currentAnswerMapMap: any = {};
|
|
108
112
|
for (const activityTemplateMap of activityTemplateTypeList) {
|
|
109
113
|
if (answerType === activityTemplateMap.type) {
|
|
@@ -117,7 +121,7 @@ const ActivityPreviewByData = ({
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
setAnswerMapMap(currentAnswerMapMap);
|
|
120
|
-
}, [activityTemplateTypeList]);
|
|
124
|
+
}, [activityTemplateTypeList, data]);
|
|
121
125
|
|
|
122
126
|
const RenderSelectedActivityContent = () => {
|
|
123
127
|
if (!selectedType) return null;
|
|
@@ -48,8 +48,6 @@ const GroupingActivityMaterialContent = ({
|
|
|
48
48
|
}, [draggedValue]);
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
|
-
if (hasShuffledRef.current) return;
|
|
52
|
-
|
|
53
51
|
const shuffleArray = (array: any) => {
|
|
54
52
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
55
53
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -66,8 +64,12 @@ const GroupingActivityMaterialContent = ({
|
|
|
66
64
|
}
|
|
67
65
|
});
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
if (!hasShuffledRef.current) {
|
|
68
|
+
setShuffledMaterialList(shuffleArray(materialList));
|
|
69
|
+
hasShuffledRef.current = true;
|
|
70
|
+
} else {
|
|
71
|
+
setShuffledMaterialList(materialList);
|
|
72
|
+
}
|
|
71
73
|
}, [materialMap]);
|
|
72
74
|
|
|
73
75
|
useEffect(() => {
|
|
@@ -56,7 +56,8 @@ const MCMAActivityMaterialContent = ({
|
|
|
56
56
|
<div className="flex flex-row w-full flex-wrap ">
|
|
57
57
|
{materialMap[materialKey].map(
|
|
58
58
|
(materialSubKey: string, index: number) => {
|
|
59
|
-
const
|
|
59
|
+
const currentDisplayAnswerList = displayAnswerMap[materialKey] || [];
|
|
60
|
+
const foundAnswer = currentDisplayAnswerList.find(
|
|
60
61
|
(learnerAnswer: string) => learnerAnswer === materialSubKey
|
|
61
62
|
);
|
|
62
63
|
const learnerAnswerState = !isPreview
|
|
@@ -84,7 +85,7 @@ const MCMAActivityMaterialContent = ({
|
|
|
84
85
|
>
|
|
85
86
|
<BaseImage
|
|
86
87
|
src={
|
|
87
|
-
|
|
88
|
+
currentDisplayAnswerList.includes(materialSubKey)
|
|
88
89
|
? "/icons/checkbox.webp"
|
|
89
90
|
: "/icons/checkbox-empty.webp"
|
|
90
91
|
}
|
|
@@ -131,7 +132,7 @@ const MCMAActivityMaterialContent = ({
|
|
|
131
132
|
) : (
|
|
132
133
|
<p key={materialKey} className="text-xl">
|
|
133
134
|
{constructInputWithSpecialExpressionList(
|
|
134
|
-
displayAnswerMap[materialKey]
|
|
135
|
+
displayAnswerMap[materialKey] || ""
|
|
135
136
|
).map((inputPart, index) => (
|
|
136
137
|
<span
|
|
137
138
|
key={index}
|
|
@@ -48,9 +48,6 @@ const MatchingActivityMaterialContent = ({
|
|
|
48
48
|
}, [draggedValue]);
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
|
-
// Only shuffle once, ever
|
|
52
|
-
if (hasShuffledRef.current) return;
|
|
53
|
-
|
|
54
51
|
const shuffleArray = (array: any) => {
|
|
55
52
|
const copyArray = JSON.parse(JSON.stringify(array));
|
|
56
53
|
for (let i = copyArray.length - 1; i > 0; i--) {
|
|
@@ -65,8 +62,12 @@ const MatchingActivityMaterialContent = ({
|
|
|
65
62
|
materialList.push(materialMap[materialKey]);
|
|
66
63
|
});
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
if (!hasShuffledRef.current) {
|
|
66
|
+
setShuffledMaterialList(shuffleArray(materialList));
|
|
67
|
+
hasShuffledRef.current = true;
|
|
68
|
+
} else {
|
|
69
|
+
setShuffledMaterialList(materialList);
|
|
70
|
+
}
|
|
70
71
|
}, [materialMap]);
|
|
71
72
|
|
|
72
73
|
useEffect(() => {
|