@tinyweb_dev/oe-exam-sdk 0.1.24 → 0.1.27
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/README.md +5 -4
- package/dist/components/exams/ExamPreviewDialog.d.ts +7 -6
- package/dist/components/exams/ExamPreviewDialog.js +1 -1
- package/dist/components/exams/index.d.ts +0 -1
- package/dist/components/exams/take/components/QuestionRenderer.js +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversListenAndWriteRenderer.js +1 -1
- package/dist/components/exams/take/components/question-renderers/MoversWordFillStructuredFormRenderer.js +1 -1
- package/dist/components/exams/take/exam-taking.utils.d.ts +0 -13
- package/dist/components/exams/take/exam-taking.utils.js +1 -1
- package/dist/components/exams/take/utils/answer-transformers.js +1 -1
- package/dist/components/exams/take/utils/question-transformers.d.ts +7 -17
- package/dist/components/exams/take/utils/question-transformers.js +1 -1
- package/dist/components/questions/_shared/config/question-types.config.js +1 -1
- package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.d.ts +36 -0
- package/dist/components/questions/_shared/types/cross-out-word-group.type.d.ts +40 -0
- package/dist/components/questions/_shared/types/index.d.ts +1 -0
- package/dist/components/questions/_shared/types/index.js +1 -1
- package/dist/components/questions/_shared/types/true-false-group.type.d.ts +31 -0
- package/dist/components/questions/_shared/types/true-false-group.type.js +1 -0
- package/dist/components/questions/_shared/types/word-fill-structured-form.type.d.ts +29 -26
- package/dist/components/questions/creator/question-type-registry.js +1 -1
- package/dist/components/questions/index.d.ts +0 -1
- package/dist/components/questions/index.js +1 -1
- package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +1 -1
- package/dist/components/questions/types/choose-the-correct-answer/transform.js +1 -1
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/index.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/index.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/register.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/register.js +1 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/transform.d.ts +2 -0
- package/dist/components/questions/types/choose-the-correct-answer-group/transform.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/index.d.ts +4 -0
- package/dist/components/questions/types/cross-out-word-group/index.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/register.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/register.js +1 -0
- package/dist/components/questions/types/cross-out-word-group/transform.d.ts +2 -0
- package/dist/components/questions/types/cross-out-word-group/transform.js +1 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +1 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +1 -0
- package/dist/components/questions/types/true-false-group/index.d.ts +4 -0
- package/dist/components/questions/types/true-false-group/index.js +1 -0
- package/dist/components/questions/types/true-false-group/register.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/register.js +1 -0
- package/dist/components/questions/types/true-false-group/transform.d.ts +2 -0
- package/dist/components/questions/types/true-false-group/transform.js +1 -0
- package/dist/components/questions/types/word-fill-structured-form/WfsfWordBankEditor.d.ts +14 -0
- package/dist/components/questions/types/word-fill-structured-form/WfsfWordBankEditor.js +1 -0
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.d.ts +1 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +1 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.d.ts +1 -1
- package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +1 -1
- package/dist/components/questions/types/word-fill-structured-form/register.js +1 -1
- package/dist/components/questions/types/word-fill-structured-form/transform.d.ts +5 -2
- package/dist/components/questions/types/word-fill-structured-form/transform.js +1 -1
- package/dist/components/questions/types/word-fill-structured-form/wfsf-word-bank.utils.d.ts +24 -0
- package/dist/components/questions/types/word-fill-structured-form/wfsf-word-bank.utils.js +1 -0
- package/dist/components/questions/viewer/QuestionViewer.js +1 -1
- package/dist/components/results/renderers/review-question-body-dedicated.js +1 -1
- package/dist/components/results/review-data.js +1 -1
- package/dist/components/themes/english-certification/EcWordFillStructuredForm.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/mcp/config.d.ts +12 -0
- package/dist/mcp/config.js +1 -0
- package/dist/mcp/http-client.d.ts +6 -0
- package/dist/mcp/http-client.js +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/tools/_helpers.d.ts +4 -0
- package/dist/mcp/tools/_helpers.js +1 -0
- package/dist/mcp/tools/exams.d.ts +2 -0
- package/dist/mcp/tools/exams.js +1 -0
- package/dist/mcp/tools/index.d.ts +2 -0
- package/dist/mcp/tools/index.js +1 -0
- package/dist/mcp/tools/results.d.ts +2 -0
- package/dist/mcp/tools/results.js +1 -0
- package/dist/shared/constants/question-skills.js +1 -1
- package/dist/shared/lib/i18n/messages/en/admin.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/en/admin.js +1 -1
- package/dist/shared/lib/i18n/messages/en.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/vi/admin.d.ts +4 -11
- package/dist/shared/lib/i18n/messages/vi/admin.js +1 -1
- package/dist/shared/lib/i18n/messages/vi.d.ts +4 -11
- package/dist/shared/lib/utils/question-reverse-transform.js +1 -1
- package/dist/shared/lib/utils/question-transform.js +1 -1
- package/dist/shared/types/common.types.d.ts +1 -1
- package/dist/shared/types/questions/choose-the-correct-answer-group.d.ts +41 -0
- package/dist/shared/types/questions/choose-the-correct-answer-group.js +1 -0
- package/dist/shared/types/questions/cross-out-word-group.d.ts +41 -0
- package/dist/shared/types/questions/cross-out-word-group.js +1 -0
- package/dist/shared/types/questions/index.d.ts +2 -0
- package/dist/shared/types/questions/index.js +1 -1
- package/package.json +165 -163
- package/dist/components/exams/ExamPreviewPartContent.d.ts +0 -18
- package/dist/components/exams/ExamPreviewPartContent.js +0 -1
- package/dist/components/exams/ExamPreviewSidebar.d.ts +0 -17
- package/dist/components/exams/ExamPreviewSidebar.js +0 -1
- package/dist/components/exams/exam-preview.types.d.ts +0 -34
- package/dist/components/exams/exam-preview.types.js +0 -1
- package/dist/components/questions/_shared/utils/parseFillBlankStem.d.ts +0 -30
- package/dist/components/questions/_shared/utils/parseFillBlankStem.js +0 -1
- package/dist/components/questions/question-bank/EditQuestionBankDialog.d.ts +0 -2
- package/dist/components/questions/question-bank/EditQuestionBankDialog.js +0 -1
- package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +0 -23
- package/dist/components/questions/question-bank/QuestionEditorRenderer.js +0 -1
- package/dist/components/questions/question-bank/difficulty.d.ts +0 -15
- package/dist/components/questions/question-bank/difficulty.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/index.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/index.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +0 -6
- package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/types.d.ts +0 -1
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.d.ts +0 -8
- package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.js +0 -1
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.d.ts +0 -5
- package/dist/components/questions/question-bank/editor-adapters/writing-adapters.js +0 -1
- package/dist/components/questions/question-bank/index.d.ts +0 -4
- package/dist/components/questions/question-bank/index.js +0 -1
- package/dist/components/questions/question-bank/types.d.ts +0 -59
- /package/dist/components/questions/{question-bank/editor-adapters/types.js → _shared/types/choose-the-correct-answer-group.type.js} +0 -0
- /package/dist/components/questions/{question-bank/types.js → _shared/types/cross-out-word-group.type.js} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
export type CrossOutWordItemMode = 'CROSS_OUT' | 'CROSS_OUT_AND_REPLACE';
|
|
3
|
+
export interface CrossOutWordGroupItemAnswer {
|
|
4
|
+
type: CrossOutWordItemMode;
|
|
5
|
+
/** Word to cross out. Empty string = line is correct. */
|
|
6
|
+
crossOut: string;
|
|
7
|
+
/** Replacement word. Only for CROSS_OUT_AND_REPLACE. */
|
|
8
|
+
replaceWith?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CrossOutWordGroupItemData {
|
|
11
|
+
type: CrossOutWordItemMode;
|
|
12
|
+
question: string;
|
|
13
|
+
correctAnswer: CrossOutWordGroupItemAnswer;
|
|
14
|
+
isExample?: boolean;
|
|
15
|
+
points: number;
|
|
16
|
+
questionNumber: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CrossOutWordGroupData {
|
|
19
|
+
instruction: string;
|
|
20
|
+
items: CrossOutWordGroupItemData[];
|
|
21
|
+
explanation?: string;
|
|
22
|
+
points?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface CrossOutWordGroupCreatorProps {
|
|
25
|
+
initialData?: CrossOutWordGroupData;
|
|
26
|
+
onSave?: (data: CrossOutWordGroupData) => void;
|
|
27
|
+
onCancel?: () => void;
|
|
28
|
+
onChange?: (data: CrossOutWordGroupData) => void;
|
|
29
|
+
externalErrors?: string[];
|
|
30
|
+
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
|
31
|
+
validationRef?: MutableRefObject<{
|
|
32
|
+
triggerValidation: () => Promise<boolean>;
|
|
33
|
+
getFormData?: () => CrossOutWordGroupData;
|
|
34
|
+
} | null>;
|
|
35
|
+
}
|
|
36
|
+
export interface CrossOutWordGroupClientProps {
|
|
37
|
+
questionData: CrossOutWordGroupData;
|
|
38
|
+
isReviewMode?: boolean;
|
|
39
|
+
userAnswers?: Array<CrossOutWordGroupItemAnswer | null | undefined>;
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./listening-drawline.type";export*from"./listen-and-tick-answer.type";export*from"./arrange-letters-into-words.type";export*from"./write-short-paragraph.type";export*from"./fill-missing-words-in-grid.type";export*from"./look-and-choose-answer.type";export*from"./look-picture-fill-word-hint.type";export*from"./label-the-picture.type";export*from"./read-and-color-objects.type";export*from"./fill-in-blank.type";export*from"./read-passage-and-answer-questions.type";export*from"./word-fill-structured-form.type";
|
|
1
|
+
export*from"./choose-the-correct-answer-group.type";export*from"./listening-drawline.type";export*from"./listen-and-tick-answer.type";export*from"./arrange-letters-into-words.type";export*from"./write-short-paragraph.type";export*from"./fill-missing-words-in-grid.type";export*from"./look-and-choose-answer.type";export*from"./look-picture-fill-word-hint.type";export*from"./label-the-picture.type";export*from"./read-and-color-objects.type";export*from"./fill-in-blank.type";export*from"./read-passage-and-answer-questions.type";export*from"./word-fill-structured-form.type";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
export interface TrueFalseGroupItemData {
|
|
3
|
+
question: string;
|
|
4
|
+
correctAnswer: boolean;
|
|
5
|
+
isExample?: boolean;
|
|
6
|
+
points: number;
|
|
7
|
+
questionNumber: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TrueFalseGroupData {
|
|
10
|
+
instruction: string;
|
|
11
|
+
items: TrueFalseGroupItemData[];
|
|
12
|
+
explanation?: string;
|
|
13
|
+
points?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TrueFalseGroupCreatorProps {
|
|
16
|
+
initialData?: TrueFalseGroupData;
|
|
17
|
+
onSave?: (data: TrueFalseGroupData) => void;
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
onChange?: (data: TrueFalseGroupData) => void;
|
|
20
|
+
externalErrors?: string[];
|
|
21
|
+
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
|
22
|
+
validationRef?: MutableRefObject<{
|
|
23
|
+
triggerValidation: () => Promise<boolean>;
|
|
24
|
+
getFormData?: () => TrueFalseGroupData;
|
|
25
|
+
} | null>;
|
|
26
|
+
}
|
|
27
|
+
export interface TrueFalseGroupClientProps {
|
|
28
|
+
questionData: TrueFalseGroupData;
|
|
29
|
+
isReviewMode?: boolean;
|
|
30
|
+
userAnswers?: boolean[];
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WORD_FILL_STRUCTURED_FORM — creator / client contracts.
|
|
3
|
+
* wordBank + viewMode: plan 0024 (WITH_OPTIONS) + 0025 (WITH_WORD_BANK).
|
|
4
|
+
*/
|
|
5
|
+
export type WfsfViewMode = 'WITH_OPTIONS' | 'WITH_WORD_BANK';
|
|
6
|
+
/** Shared suggestion box (plan 0025). */
|
|
7
|
+
export type WfsfSharedWordBankEntry = {
|
|
7
8
|
word: string;
|
|
8
9
|
isExample?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** Per-blank dropdown options (plan 0024). `null` = free-type slot. */
|
|
12
|
+
export type WfsfOptionsWordBankEntry = {
|
|
13
|
+
options: string[];
|
|
9
14
|
} | null;
|
|
15
|
+
export type WfsfWordBankEntry = WfsfSharedWordBankEntry | WfsfOptionsWordBankEntry;
|
|
10
16
|
export interface WordFillStructuredFormData {
|
|
11
17
|
title?: string;
|
|
12
18
|
imageUrl?: string;
|
|
13
19
|
content: string;
|
|
14
20
|
answers: Record<string, string>;
|
|
15
|
-
/**
|
|
16
|
-
* letter = square 1-char box; word = single-word underline; phrase = multi-word.
|
|
17
|
-
* Default when omitted: word.
|
|
18
|
-
*/
|
|
19
|
-
blankStyle?: WfsfBlankStyle;
|
|
20
|
-
/**
|
|
21
|
-
* WITH_OPTIONS (0024): per-blank options.
|
|
22
|
-
* WITH_WORD_BANK (0025): shared chip box { word }[] (not 1:1 blanks).
|
|
23
|
-
* Pure free-type pages omit these fields.
|
|
24
|
-
*/
|
|
25
|
-
viewMode?: 'WITH_OPTIONS' | 'WITH_WORD_BANK' | 'DEFAULT' | string;
|
|
26
|
-
/** OPTIONS: index i ↔ {i}; WORD_BANK: shared list of { word }. */
|
|
27
|
-
wordBank?: WfsfWordBankEntry[];
|
|
28
21
|
points?: number;
|
|
22
|
+
/** Student rubric / page instruction (shown in client header). */
|
|
23
|
+
instruction?: string;
|
|
29
24
|
explanation?: string;
|
|
30
25
|
caseSensitive?: boolean;
|
|
26
|
+
/** Free-type width hint when not WITH_OPTIONS. */
|
|
27
|
+
blankStyle?: 'letter' | 'word' | 'phrase';
|
|
28
|
+
/** Discriminates wordBank shape (0024 / 0025). */
|
|
29
|
+
viewMode?: WfsfViewMode | null;
|
|
30
|
+
/**
|
|
31
|
+
* WITH_OPTIONS: index i ↔ blank {i}; entry null = free-type.
|
|
32
|
+
* WITH_WORD_BANK: shared list (not 1:1 with blanks).
|
|
33
|
+
*/
|
|
34
|
+
wordBank?: WfsfWordBankEntry[];
|
|
31
35
|
groupTitle?: string;
|
|
32
36
|
groupSubtitle?: string;
|
|
33
37
|
groupContent?: string;
|
|
@@ -46,17 +50,15 @@ export interface WordFillStructuredFormCreatorProps {
|
|
|
46
50
|
triggerValidation: () => Promise<boolean>;
|
|
47
51
|
getFormData: () => WordFillStructuredFormData;
|
|
48
52
|
} | null>;
|
|
49
|
-
/** Group config from exam template (e.g. [{ number: 1, questionCount: 5 }]) */
|
|
50
53
|
groups?: Array<{
|
|
51
54
|
number: number;
|
|
52
55
|
questionCount: number;
|
|
53
56
|
}>;
|
|
54
|
-
/** Zero-based index of this question within the current part */
|
|
55
57
|
questionIndexInPart?: number;
|
|
56
|
-
/** Part ID for shared group state across questions in the same group */
|
|
57
58
|
partId?: string;
|
|
58
|
-
/** Group type from exam template (e.g. "BASIC", "DOCUMENT") */
|
|
59
59
|
groupType?: string;
|
|
60
|
+
/** Template / host viewMode override (Pearson edit dialog). */
|
|
61
|
+
viewMode?: WfsfViewMode | 'DEFAULT' | 'CONVERSATION' | 'EMAIL' | null;
|
|
60
62
|
}
|
|
61
63
|
export interface WordFillStructuredFormClientProps {
|
|
62
64
|
questionData: WordFillStructuredFormData;
|
|
@@ -64,8 +66,9 @@ export interface WordFillStructuredFormClientProps {
|
|
|
64
66
|
userAnswer?: Record<string, string>;
|
|
65
67
|
onAnswerChange?: (questionNumber: string, value: string) => void;
|
|
66
68
|
autoFillCorrectAnswers?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/**
|
|
69
|
+
/** Page rubric — prefer over hard-coded type label in header. */
|
|
70
|
+
instruction?: string;
|
|
71
|
+
/** Optional part/question index for "Bài N" prefix in header. */
|
|
70
72
|
questionNumber?: number;
|
|
73
|
+
explanation?: string;
|
|
71
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fillInBlankRegistration as r}from"../types/fill-in-blank/register";import{arrangeLettersIntoWordsRegistration as e}from"../types/arrange-letters-into-words/register";import{writeShortParagraphRegistration as t}from"../types/write-short-paragraph/register";import{fillMissingWordsInGridRegistration as s}from"../types/fill-missing-words-in-grid/register";import{lookPictureChooseCorrectAnswerRegistration as o}from"../types/look-picture-choose-correct-answer/register";import{lookPictureFillBlankChooseAnswerRegistration as i}from"../types/look-picture-fill-blank-choose-answer/register";import{lookPictureFillWordHintRegistration as _}from"../types/look-picture-fill-word-hint/register";import{labelThePictureRegistration as p}from"../types/label-the-picture/register";import{readAndColorObjectsRegistration as E}from"../types/read-and-color-objects/register";import{imageObjectMatchingRegistration as m}from"../types/image-object-matching/register";import{readPassageAndAnswerQuestionsRegistration as
|
|
1
|
+
import{fillInBlankRegistration as r}from"../types/fill-in-blank/register";import{arrangeLettersIntoWordsRegistration as e}from"../types/arrange-letters-into-words/register";import{writeShortParagraphRegistration as t}from"../types/write-short-paragraph/register";import{fillMissingWordsInGridRegistration as s}from"../types/fill-missing-words-in-grid/register";import{lookPictureChooseCorrectAnswerRegistration as o}from"../types/look-picture-choose-correct-answer/register";import{lookPictureFillBlankChooseAnswerRegistration as i}from"../types/look-picture-fill-blank-choose-answer/register";import{lookPictureFillWordHintRegistration as _}from"../types/look-picture-fill-word-hint/register";import{labelThePictureRegistration as p}from"../types/label-the-picture/register";import{readAndColorObjectsRegistration as E}from"../types/read-and-color-objects/register";import{imageObjectMatchingRegistration as m}from"../types/image-object-matching/register";import{readPassageAndAnswerQuestionsRegistration as R}from"../types/read-passage-and-answer-questions/register";import{chooseTheCorrectAnswerRegistration as S}from"../types/choose-the-correct-answer/register";import{chooseTheCorrectAnswerGroupRegistration as g}from"../types/choose-the-correct-answer-group/register";import{trueFalseGroupRegistration as n}from"../types/true-false-group/register";import{crossOutWordGroupRegistration as a}from"../types/cross-out-word-group/register";import{writeAShortLetterRegistration as A}from"../types/write-a-short-letter/register";import{writeCorrectVerbFormRegistration as O}from"../types/write-correct-verb-form/register";import{chooseCorrectAdjectiveRegistration as N}from"../types/choose-correct-adjective/register";import{answerTheQuestionRegistration as T}from"../types/answer-the-question/register";import{trueFalseRegistration as I}from"../types/true-false/register";import{wordOrderingRegistration as f}from"../types/word-ordering/register";import{wordFillParagraphRegistration as y}from"../types/word-fill-paragraph/register";import{matchByWritingAnswerRegistration as c}from"../types/match-by-writing-answer/register";import{writeSentencesRegistration as C}from"../types/write-sentences/register";import{listenAndChooseFromAnswerGroupRegistration as l}from"../types/listen-and-choose-from-answer-group/register";import{listenAndChooseObjectsInSceneRegistration as L}from"../types/listen-and-choose-objects-in-scene/register";import{listenAndDragObjectsIntoSceneRegistration as d}from"../types/listen-and-drag-objects-into-scene/register";import{listenAndSpeakAnswerRegistration as D}from"../types/listen-and-speak-answer/register";import{listenAndSpeakImageGroupRegistration as P}from"../types/listen-and-speak-image-group/register";import{listenAndSpeakQuestionListRegistration as G}from"../types/listen-and-speak-question-list/register";import{ListenAndSpeakCompareImagesRegistration as w}from"../types/listen-and-speak-compare-images/register";import{listenAndSpeakWithStoryImagesRegistration as W}from"../types/listen-and-speak-with-story-images/register";import{listenAndSpeakOddOneOutRegistration as u}from"../types/listen-and-speak-odd-one-out/register";import{listenAndSpeakInfoExchangeRegistration as h}from"../types/listen-and-speak-info-exchange/register";import{speakingDescribeImageRegistration as H}from"../types/speaking-describe-image/register";import{spontaneousQARegistration as U}from"../types/spontaneous-qa/register";import{readDisplayedContentRegistration as k}from"../types/read-displayed-content/register";import{speakingConversationRegistration as K}from"../types/speaking-conversation/register";import{gnSpeakingInterviewRegistration as F}from"../types/gn-speaking-interview/register";import{speakingCueCardRegistration as M}from"../types/speaking-cue-card/register";import{wordFillStructuredFormRegistration as b}from"../types/word-fill-structured-form/register";export const questionTypeRegistry={CHOOSE_THE_CORRECT_ANSWER:S,CHOOSE_THE_CORRECT_ANSWER_GROUP:g,TRUE_FALSE_GROUP:n,CROSS_OUT_WORD_GROUP:a,FILL_IN_BLANK:r,ARRANGE_LETTERS_INTO_WORDS:e,WRITE_SHORT_PARAGRAPH:t,FILL_MISSING_WORDS_IN_GRID:s,LOOK_PICTURE_CHOOSE_CORRECT_ANSWER:o,LOOK_PICTURE_FILL_BLANK_CHOOSE_ANSWER:i,LOOK_PICTURE_FILL_WORD_HINT:_,LABEL_THE_PICTURE:p,READ_AND_COLOR_OBJECTS:E,IMAGE_OBJECT_MATCHING:m,READ_PASSAGE_AND_ANSWER_QUESTIONS:R,WRITE_A_SHORT_LETTER:A,WRITE_CORRECT_VERB_FORM:O,CHOOSE_CORRECT_ADJECTIVE:N,ANSWER_THE_QUESTION:T,TRUE_FALSE:I,WORD_ORDERING:f,WORD_FILL_PARAGRAPH:y,MATCH_BY_WRITING_ANSWER:c,WRITE_SENTENCES:C,LISTEN_AND_CHOOSE_FROM_ANSWER_GROUP:l,LISTEN_AND_CHOOSE_OBJECTS_IN_SCENE:L,LISTEN_AND_DRAG_OBJECTS_INTO_SCENE:d,LISTEN_AND_SPEAK_ANSWER:D,LISTEN_AND_SPEAK_IMAGE_GROUP:P,LISTEN_AND_SPEAK_QUESTION_LIST:G,LISTEN_AND_SPEAK_COMPARE_IMAGES:w,LISTEN_AND_SPEAK_WITH_STORY_IMAGES:W,LISTEN_AND_SPEAK_ODD_ONE_OUT:u,LISTEN_AND_SPEAK_INFO_EXCHANGE:h,SPEAKING_DESCRIBE_IMAGE:H,SPONTANEOUS_QA:U,READ_DISPLAYED_CONTENT:k,SPEAKING_CONVERSATION:K,GN_SPEAKING_INTERVIEW:F,SPEAKING_CUE_CARD:M,WORD_FILL_STRUCTURED_FORM:b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./creator";export*from"./creator/dedicated-component-router";export*from"./creator/question-type-registry";export*from"./components";export*from"./groups/ArticlesGroupCard";export*from"./groups/BasicQuestionGroupCard";export*from"./groups/DocumentGroupCard";export*from"./groups/MatchAnswerGroupCard";export*from"./viewer";export*from"./_shared";
|
|
1
|
+
export*from"./creator";export*from"./creator/dedicated-component-router";export*from"./creator/question-type-registry";export*from"./components";export*from"./groups/ArticlesGroupCard";export*from"./groups/BasicQuestionGroupCard";export*from"./groups/DocumentGroupCard";export*from"./groups/MatchAnswerGroupCard";export*from"./viewer";export*from"./_shared";
|
package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useState as s,useEffect as a,useMemo as l}from"react";import{Check as n,X as i,CircleHelp as d,Lightbulb as o,ClipboardList as c,Users as m,BookOpen as g}from"lucide-react";import{usePresignedFileUrl as h}from"../../../../shared/lib/hooks";import{cn as b}from"../../../../shared/lib/utils";function p({src:r,alt:t,className:s}){const{previewUrl:a,isLoading:l}=h(r);return l?e("div",{className:"flex h-16 w-16 items-center justify-center",children:e("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-200 border-t-blue-500"})}):e("img",{src:a||r,alt:t,className:b("max-h-20 w-auto object-contain rounded-md",s),onError:e=>{const r=e.target;r.onerror=null,r.src="/images/placeholder-image.svg"}})}export function ChooseTheCorrectAnswerClient({questionData:x,onSubmit:u,isReviewMode:f=!1,userAnswer:N,questionConfig:w}){const v=Boolean(x.multipleAnswers||Array.isArray(x.correctAnswer)),y=l(()=>Array.isArray(x.correctAnswer)?x.correctAnswer:-1===x.correctAnswer?[]:[x.correctAnswer],[x.correctAnswer]),j=l(()=>void 0===N?[]:Array.isArray(N)?N:-1===N?[]:[N],[N]),[C,k]=s(j),{previewUrl:A,isLoading:U}=h(x.imageUrl||"");a(()=>{k(j)},[j]);const S=C.length>0,T=f&&C.length===y.length&&C.every(e=>y.includes(e)),$=e=>0===e.length?"(Chưa trả lời)":e.map(e=>{const r=String.fromCharCode(65+e);return"image"===x.optionType?`Đáp án ${r}`:`${r}. ${x.options[e]}`}).join(", "),q=!w||0===w.length||w.includes("question"),I=!w||0===w.length||w.includes("imageUrl")||w.includes("image");console.log("questionConfig",w),console.log("showImage",I);const B=!w||0===w.length||w.includes("options"),G=x.imageUrl?.trim()?x.imageUrl:"",L=Array.isArray(x.articles)&&x.articles.length>0;return r("div",{className:"space-y-4",children:[x.isGroup&&(x.groupTitle||x.groupSubtitle||x.groupContent||x.groupImageUrl||L)&&r("div",{className:"relative overflow-hidden rounded-2xl border border-indigo-100 bg-white shadow-sm ring-1 ring-black/5 transition-all",children:[e("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-50/80 via-white to-blue-50/30 opacity-70 pointer-events-none"}),e("div",{className:"absolute left-0 top-0 bottom-0 w-1.5 bg-gradient-to-b from-indigo-500 to-blue-600 rounded-l-2xl"}),r("div",{className:"relative p-6 sm:p-7",children:[r("div",{className:"flex items-start gap-4 mb-5 border-b border-indigo-50/60 pb-4",children:[e("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-indigo-100 to-blue-100 shadow-inner ring-1 ring-indigo-200/50",children:e(g,{className:"h-5 w-5 text-indigo-600"})}),r("div",{className:"flex-1 pt-1",children:[e("div",{className:"flex items-center gap-2 mb-1",children:x.groupNumber&&r("span",{className:"inline-flex items-center rounded-md bg-indigo-50 px-2 py-1 text-xs font-semibold text-indigo-700 ring-1 ring-inset ring-indigo-700/10",children:["Bài đọc ",x.groupNumber]})}),x.groupTitle&&e("h4",{className:"text-xl font-bold text-slate-800 leading-tight tracking-tight",children:x.groupTitle}),x.groupSubtitle&&e("p",{className:"mt-1 text-sm text-slate-500 leading-snug",children:x.groupSubtitle})]})]}),L&&e("div",{className:"flex flex-col gap-4",children:x.articles.map((t,s)=>r("div",{className:"group relative overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-all hover:shadow-md hover:border-indigo-200",children:[r("div",{className:"flex items-center gap-2 border-b border-slate-100 bg-gradient-to-r from-indigo-50/60 to-blue-50/40 px-4 py-2.5",children:[e("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-indigo-500 to-blue-600 text-xs font-bold text-white shadow-sm",children:String.fromCharCode(65+s)}),e("h5",{className:"flex-1 truncate text-sm font-bold text-slate-800",children:t.name||`Bài viết ${s+1}`})]}),r("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-start",children:[t.imageUrl&&e("div",{className:"flex flex-shrink-0 items-center justify-center rounded-md bg-slate-50 p-2 sm:w-40",children:e(p,{src:t.imageUrl,alt:t.name||`Article ${s+1}`,className:"max-h-40 w-auto rounded-md object-contain"})}),t.content&&e("div",{className:"prose prose-sm prose-slate max-w-none flex-1 text-[14px] leading-relaxed text-slate-700",children:t.content.split("\n").map((r,t)=>e("p",{className:"mb-2 last:mb-0",children:r},t))})]})]},s))}),!L&&r("div",{className:"space-y-6 text-slate-700",children:[x.groupContent&&e("div",{className:"prose prose-slate prose-p:leading-relaxed prose-p:mb-3 max-w-none text-[15px]",dangerouslySetInnerHTML:{__html:x.groupContent.replace(/\{(\d+)\}/g,(e,r)=>`<span style="display:inline-block;min-width:100px;padding:1px 5px;margin:0 5px;background:#eef2ff;border-bottom:2px solid #6366f1;color:#4f46e5;font-weight:700;font-size:0.85em;text-align:center;vertical-align:baseline;letter-spacing:2px">———(${Number(r)+1})———</span>`).split("\n").map(e=>`<p class="last:mb-0">${e}</p>`).join("")}}),x.groupImageUrl&&r("div",{className:"mt-5 relative overflow-hidden rounded-xl border border-slate-200/60 bg-slate-50 shadow-sm transition-all hover:shadow-md",children:[e("div",{className:"flex items-center justify-between border-b border-slate-200/60 bg-slate-100/50 px-4 py-2",children:r("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("span",{className:"ml-2 text-[11px] font-semibold uppercase tracking-wider text-slate-500",children:"Tài liệu đính kèm"})]})}),e("div",{className:"flex items-center justify-center p-4 min-h-[160px]",children:e(p,{src:x.groupImageUrl,alt:x.groupTitle||"Group Image Attachment",className:"max-h-72 w-auto object-contain drop-shadow-sm rounded-lg"})})]})]})]})]}),r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-5 py-3",children:[r("div",{className:"flex items-center gap-3",children:[e("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-sm",children:e(d,{className:"h-4 w-4"})}),e("span",{className:"text-sm font-medium text-gray-700",children:v?"Chọn các đáp án đúng":"Chọn đáp án đúng"})]}),f&&S&&r("div",{className:b("flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold",T?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:[e(T?n:i,{className:"h-3.5 w-3.5"}),T?"Đúng":"Sai"]})]}),r("div",{className:"p-5 space-y-5",children:[(x.askerName||x.answererName)&&r("div",{className:"flex items-center gap-4 rounded-lg border border-purple-100 bg-gradient-to-r from-purple-50 to-violet-50 px-4 py-3",children:[e(m,{className:"h-4 w-4 flex-shrink-0 text-purple-500"}),r("div",{className:"flex items-center gap-4 text-sm",children:[x.askerName&&r("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium text-gray-500",children:"Người hỏi:"}),e("span",{className:"font-semibold text-purple-700",children:x.askerName})]}),x.askerName&&x.answererName&&e("div",{className:"h-4 w-px bg-purple-200"}),x.answererName&&r("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium text-gray-500",children:"Người trả lời:"}),e("span",{className:"font-semibold text-purple-700",children:x.answererName})]})]})]}),q&&e("div",{className:"rounded-lg bg-gradient-to-r from-blue-50 to-indigo-50 p-4 border border-blue-100",children:e("h3",{className:"text-base font-semibold text-gray-800 leading-relaxed",children:x.question||"Câu hỏi chưa được nhập"})}),I&&(A||G)&&r("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-gradient-to-br from-slate-50 to-gray-100",children:[e("div",{className:"border-b border-gray-100 px-3 py-1.5",children:r("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"h-2 w-2 rounded-full bg-red-400"}),e("div",{className:"h-2 w-2 rounded-full bg-yellow-400"}),e("div",{className:"h-2 w-2 rounded-full bg-green-400"}),e("span",{className:"ml-2 text-xs font-medium text-gray-500",children:"Hình ảnh"})]})}),e("div",{className:"flex items-center justify-center p-4",children:U?e("div",{className:"flex h-48 items-center justify-center",children:e("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-gray-200 border-t-blue-500"})}):e("img",{src:A||G,alt:"Question illustration",className:"max-h-56 w-auto object-contain rounded-md",onError:e=>{const r=e.target;r.onerror=null,r.src="/images/placeholder-image.svg"}})})]}),B&&r("div",{className:"space-y-2.5",children:[e("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:v?"Chọn một hoặc nhiều đáp án":"Chọn đáp án"}),x.options.map((t,s)=>{const a=C.includes(s),l=(d=s,!!f&&y.includes(d));var d;const o=String.fromCharCode(65+s);return r("button",{type:"button",onClick:()=>(e=>{if(f)return;const r=v?C.includes(e)?C.filter(r=>r!==e):[...C,e].sort((e,r)=>e-r):[e];k(r),u?.(v?r:r[0])})(s),disabled:f,className:b("group flex w-full items-center gap-3 rounded-lg border-2 p-3.5 text-left transition-all",f?l?"border-green-400 bg-green-50":a?"border-red-400 bg-red-50":"border-gray-200 bg-gray-50":a?"border-blue-500 bg-blue-50 shadow-sm ring-2 ring-blue-100":"border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm"),children:[e("div",{className:b("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg text-sm font-bold transition-all",f?l?"bg-green-500 text-white":a?"bg-red-500 text-white":"bg-gray-200 text-gray-600":a?"bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-sm":"bg-gray-100 text-gray-600 group-hover:bg-gray-200"),children:o}),"image"===x.optionType?e("div",{className:"flex-1 flex items-center justify-center py-1",children:e(p,{src:t,alt:`Đáp án ${o}`})}):e("span",{className:b("flex-1 text-sm font-medium",f&&l?"text-green-800":f&&a&&!l?"text-red-800":"text-gray-700"),children:t}),f&&(l||a)&&e("div",{className:b("flex h-6 w-6 items-center justify-center rounded-full",l?"bg-green-500":"bg-red-500"),children:e(l?n:i,{className:"h-4 w-4 text-white"})})]},s)})]}),!f&&!S&&r("div",{className:"rounded-lg border border-amber-200 bg-gradient-to-r from-amber-50 to-yellow-50 p-3 flex items-center gap-2",children:[e("div",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full bg-amber-400 text-white",children:e("span",{className:"text-xs font-bold",children:"!"})}),e("span",{className:"text-sm text-amber-800",children:v?"Vui lòng chọn ít nhất một đáp án":"Vui lòng chọn một đáp án"})]})]})]}),f&&x.explanation&&r("div",{className:"overflow-hidden rounded-xl border border-blue-200 bg-gradient-to-br from-blue-50 to-indigo-50 shadow-sm",children:[r("div",{className:"flex items-center gap-2 border-b border-blue-100 bg-white/50 px-4 py-3",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-amber-400 to-orange-500 text-white shadow-sm",children:e(o,{className:"h-4 w-4"})}),e("h4",{className:"text-sm font-semibold text-gray-800",children:"Giải thích"})]}),e("div",{className:"p-4",children:e("p",{className:"text-sm text-gray-700 leading-relaxed",children:x.explanation})})]}),f&&r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center gap-2 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-4 py-3",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-slate-500 to-gray-600 text-white shadow-sm",children:e(c,{className:"h-4 w-4"})}),e("h4",{className:"text-sm font-semibold text-gray-800",children:"Tổng kết"})]}),r("div",{className:"p-4 space-y-3",children:[r("div",{className:"flex items-center justify-between rounded-lg bg-gray-50 p-3",children:[e("span",{className:"text-sm text-gray-600",children:"Đáp án của bạn:"}),e("span",{className:b("text-sm font-semibold",T?"text-green-600":S?"text-red-600":"text-gray-500"),children:$(C)})]}),r("div",{className:"flex items-center justify-between rounded-lg bg-green-50 p-3 border border-green-100",children:[e("span",{className:"text-sm text-gray-600",children:"Đáp án đúng:"}),e("span",{className:"text-sm font-semibold text-green-600",children:$(y)})]}),r("div",{className:b("flex items-center justify-between rounded-lg p-3 border",T?"bg-green-50 border-green-200":"bg-red-50 border-red-200"),children:[e("span",{className:"text-sm text-gray-600",children:"Kết quả:"}),e("div",{className:b("flex items-center gap-1.5 text-sm font-semibold",T?"text-green-600":"text-red-600"),children:r(t,T?{children:[e(n,{className:"h-4 w-4"}),e("span",{children:"Chính xác"})]}:{children:[e(i,{className:"h-4 w-4"}),e("span",{children:"Sai"})]})})]})]})]})]})}
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useState as s,useEffect as a,useMemo as n}from"react";import{Check as l,X as i,CircleHelp as d,Lightbulb as o,ClipboardList as c,Users as m,BookOpen as g}from"lucide-react";import{usePresignedFileUrl as h}from"../../../../shared/lib/hooks";import{cn as b}from"../../../../shared/lib/utils";import{normalizeChooseAnswerCorrectAnswer as p}from"./normalize";function u({src:r,alt:t,className:s}){const{previewUrl:a,isLoading:n}=h(r);return n?e("div",{className:"flex h-16 w-16 items-center justify-center",children:e("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-200 border-t-blue-500"})}):e("img",{src:a||r,alt:t,className:b("max-h-20 w-auto object-contain rounded-md",s),onError:e=>{const r=e.target;r.onerror=null,r.src="/images/placeholder-image.svg"}})}export function ChooseTheCorrectAnswerClient({questionData:x,onSubmit:f,isReviewMode:N=!1,userAnswer:w,questionConfig:v}){const y=Boolean(x.multipleAnswers||Array.isArray(x.correctAnswer)),j=n(()=>{const e=p(x.correctAnswer,x.options);return Array.isArray(e)?e:-1===e?[]:[e]},[x.correctAnswer,x.options]),C=n(()=>{if(null==w)return[];const e=p(w,x.options);return Array.isArray(e)?e:-1===e?[]:[e]},[w,x.options]),[k,A]=s(C),{previewUrl:U,isLoading:S}=h(x.imageUrl||"");a(()=>{A(C)},[C]);const T=k.length>0,$=N&&k.length===j.length&&k.every(e=>j.includes(e)),q=e=>0===e.length?"(Chưa trả lời)":e.map(e=>{const r=String.fromCharCode(65+e);return"image"===x.optionType?`Đáp án ${r}`:`${r}. ${x.options[e]}`}).join(", "),I=!v||0===v.length||v.includes("question"),B=!v||0===v.length||v.includes("imageUrl")||v.includes("image");console.log("questionConfig",v),console.log("showImage",B);const G=!v||0===v.length||v.includes("options"),L=x.imageUrl?.trim()?x.imageUrl:"",z=Array.isArray(x.articles)&&x.articles.length>0;return r("div",{className:"space-y-4",children:[x.isGroup&&(x.groupTitle||x.groupSubtitle||x.groupContent||x.groupImageUrl||z)&&r("div",{className:"relative overflow-hidden rounded-2xl border border-indigo-100 bg-white shadow-sm ring-1 ring-black/5 transition-all",children:[e("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-50/80 via-white to-blue-50/30 opacity-70 pointer-events-none"}),e("div",{className:"absolute left-0 top-0 bottom-0 w-1.5 bg-gradient-to-b from-indigo-500 to-blue-600 rounded-l-2xl"}),r("div",{className:"relative p-6 sm:p-7",children:[r("div",{className:"flex items-start gap-4 mb-5 border-b border-indigo-50/60 pb-4",children:[e("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-indigo-100 to-blue-100 shadow-inner ring-1 ring-indigo-200/50",children:e(g,{className:"h-5 w-5 text-indigo-600"})}),r("div",{className:"flex-1 pt-1",children:[e("div",{className:"flex items-center gap-2 mb-1",children:x.groupNumber&&r("span",{className:"inline-flex items-center rounded-md bg-indigo-50 px-2 py-1 text-xs font-semibold text-indigo-700 ring-1 ring-inset ring-indigo-700/10",children:["Bài đọc ",x.groupNumber]})}),x.groupTitle&&e("h4",{className:"text-xl font-bold text-slate-800 leading-tight tracking-tight",children:x.groupTitle}),x.groupSubtitle&&e("p",{className:"mt-1 text-sm text-slate-500 leading-snug",children:x.groupSubtitle})]})]}),z&&e("div",{className:"flex flex-col gap-4",children:x.articles.map((t,s)=>r("div",{className:"group relative overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-all hover:shadow-md hover:border-indigo-200",children:[r("div",{className:"flex items-center gap-2 border-b border-slate-100 bg-gradient-to-r from-indigo-50/60 to-blue-50/40 px-4 py-2.5",children:[e("div",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-indigo-500 to-blue-600 text-xs font-bold text-white shadow-sm",children:String.fromCharCode(65+s)}),e("h5",{className:"flex-1 truncate text-sm font-bold text-slate-800",children:t.name||`Bài viết ${s+1}`})]}),r("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-start",children:[t.imageUrl&&e("div",{className:"flex flex-shrink-0 items-center justify-center rounded-md bg-slate-50 p-2 sm:w-40",children:e(u,{src:t.imageUrl,alt:t.name||`Article ${s+1}`,className:"max-h-40 w-auto rounded-md object-contain"})}),t.content&&e("div",{className:"prose prose-sm prose-slate max-w-none flex-1 text-[14px] leading-relaxed text-slate-700",children:t.content.split("\n").map((r,t)=>e("p",{className:"mb-2 last:mb-0",children:r},t))})]})]},s))}),!z&&r("div",{className:"space-y-6 text-slate-700",children:[x.groupContent&&e("div",{className:"prose prose-slate prose-p:leading-relaxed prose-p:mb-3 max-w-none text-[15px]",dangerouslySetInnerHTML:{__html:x.groupContent.replace(/\{(\d+)\}/g,(e,r)=>`<span style="display:inline-block;min-width:100px;padding:1px 5px;margin:0 5px;background:#eef2ff;border-bottom:2px solid #6366f1;color:#4f46e5;font-weight:700;font-size:0.85em;text-align:center;vertical-align:baseline;letter-spacing:2px">———(${Number(r)+1})———</span>`).split("\n").map(e=>`<p class="last:mb-0">${e}</p>`).join("")}}),x.groupImageUrl&&r("div",{className:"mt-5 relative overflow-hidden rounded-xl border border-slate-200/60 bg-slate-50 shadow-sm transition-all hover:shadow-md",children:[e("div",{className:"flex items-center justify-between border-b border-slate-200/60 bg-slate-100/50 px-4 py-2",children:r("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("div",{className:"h-2.5 w-2.5 rounded-full bg-slate-300"}),e("span",{className:"ml-2 text-[11px] font-semibold uppercase tracking-wider text-slate-500",children:"Tài liệu đính kèm"})]})}),e("div",{className:"flex items-center justify-center p-4 min-h-[160px]",children:e(u,{src:x.groupImageUrl,alt:x.groupTitle||"Group Image Attachment",className:"max-h-72 w-auto object-contain drop-shadow-sm rounded-lg"})})]})]})]})]}),r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-5 py-3",children:[r("div",{className:"flex items-center gap-3",children:[e("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-sm",children:e(d,{className:"h-4 w-4"})}),e("span",{className:"text-sm font-medium text-gray-700",children:y?"Chọn các đáp án đúng":"Chọn đáp án đúng"})]}),N&&T&&r("div",{className:b("flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold",$?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:[e($?l:i,{className:"h-3.5 w-3.5"}),$?"Đúng":"Sai"]})]}),r("div",{className:"p-5 space-y-5",children:[(x.askerName||x.answererName)&&r("div",{className:"flex items-center gap-4 rounded-lg border border-purple-100 bg-gradient-to-r from-purple-50 to-violet-50 px-4 py-3",children:[e(m,{className:"h-4 w-4 flex-shrink-0 text-purple-500"}),r("div",{className:"flex items-center gap-4 text-sm",children:[x.askerName&&r("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium text-gray-500",children:"Người hỏi:"}),e("span",{className:"font-semibold text-purple-700",children:x.askerName})]}),x.askerName&&x.answererName&&e("div",{className:"h-4 w-px bg-purple-200"}),x.answererName&&r("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"font-medium text-gray-500",children:"Người trả lời:"}),e("span",{className:"font-semibold text-purple-700",children:x.answererName})]})]})]}),I&&e("div",{className:"rounded-lg bg-gradient-to-r from-blue-50 to-indigo-50 p-4 border border-blue-100",children:e("h3",{className:"text-base font-semibold text-gray-800 leading-relaxed",children:x.question||"Câu hỏi chưa được nhập"})}),B&&(U||L)&&r("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-gradient-to-br from-slate-50 to-gray-100",children:[e("div",{className:"border-b border-gray-100 px-3 py-1.5",children:r("div",{className:"flex items-center gap-1.5",children:[e("div",{className:"h-2 w-2 rounded-full bg-red-400"}),e("div",{className:"h-2 w-2 rounded-full bg-yellow-400"}),e("div",{className:"h-2 w-2 rounded-full bg-green-400"}),e("span",{className:"ml-2 text-xs font-medium text-gray-500",children:"Hình ảnh"})]})}),e("div",{className:"flex items-center justify-center p-4",children:S?e("div",{className:"flex h-48 items-center justify-center",children:e("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-gray-200 border-t-blue-500"})}):e("img",{src:U||L,alt:"Question illustration",className:"max-h-56 w-auto object-contain rounded-md",onError:e=>{const r=e.target;r.onerror=null,r.src="/images/placeholder-image.svg"}})})]}),G&&r("div",{className:"space-y-2.5",children:[e("span",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider",children:y?"Chọn một hoặc nhiều đáp án":"Chọn đáp án"}),x.options.map((t,s)=>{const a=k.includes(s),n=(d=s,!!N&&j.includes(d));var d;const o=String.fromCharCode(65+s);return r("button",{type:"button",onClick:()=>(e=>{if(N)return;const r=y?k.includes(e)?k.filter(r=>r!==e):[...k,e].sort((e,r)=>e-r):[e];A(r),f?.(y?r:r[0])})(s),disabled:N,className:b("group flex w-full items-center gap-3 rounded-lg border-2 p-3.5 text-left transition-all",N?n?"border-green-400 bg-green-50":a?"border-red-400 bg-red-50":"border-gray-200 bg-gray-50":a?"border-blue-500 bg-blue-50 shadow-sm ring-2 ring-blue-100":"border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50 hover:shadow-sm"),children:[e("div",{className:b("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg text-sm font-bold transition-all",N?n?"bg-green-500 text-white":a?"bg-red-500 text-white":"bg-gray-200 text-gray-600":a?"bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-sm":"bg-gray-100 text-gray-600 group-hover:bg-gray-200"),children:o}),"image"===x.optionType?e("div",{className:"flex-1 flex items-center justify-center py-1",children:e(u,{src:t,alt:`Đáp án ${o}`})}):e("span",{className:b("flex-1 text-sm font-medium",N&&n?"text-green-800":N&&a&&!n?"text-red-800":"text-gray-700"),children:t}),N&&(n||a)&&e("div",{className:b("flex h-6 w-6 items-center justify-center rounded-full",n?"bg-green-500":"bg-red-500"),children:e(n?l:i,{className:"h-4 w-4 text-white"})})]},s)})]}),!N&&!T&&r("div",{className:"rounded-lg border border-amber-200 bg-gradient-to-r from-amber-50 to-yellow-50 p-3 flex items-center gap-2",children:[e("div",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full bg-amber-400 text-white",children:e("span",{className:"text-xs font-bold",children:"!"})}),e("span",{className:"text-sm text-amber-800",children:y?"Vui lòng chọn ít nhất một đáp án":"Vui lòng chọn một đáp án"})]})]})]}),N&&x.explanation&&r("div",{className:"overflow-hidden rounded-xl border border-blue-200 bg-gradient-to-br from-blue-50 to-indigo-50 shadow-sm",children:[r("div",{className:"flex items-center gap-2 border-b border-blue-100 bg-white/50 px-4 py-3",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-amber-400 to-orange-500 text-white shadow-sm",children:e(o,{className:"h-4 w-4"})}),e("h4",{className:"text-sm font-semibold text-gray-800",children:"Giải thích"})]}),e("div",{className:"p-4",children:e("p",{className:"text-sm text-gray-700 leading-relaxed",children:x.explanation})})]}),N&&r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center gap-2 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-4 py-3",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-slate-500 to-gray-600 text-white shadow-sm",children:e(c,{className:"h-4 w-4"})}),e("h4",{className:"text-sm font-semibold text-gray-800",children:"Tổng kết"})]}),r("div",{className:"p-4 space-y-3",children:[r("div",{className:"flex items-center justify-between rounded-lg bg-gray-50 p-3",children:[e("span",{className:"text-sm text-gray-600",children:"Đáp án của bạn:"}),e("span",{className:b("text-sm font-semibold",$?"text-green-600":T?"text-red-600":"text-gray-500"),children:q(k)})]}),r("div",{className:"flex items-center justify-between rounded-lg bg-green-50 p-3 border border-green-100",children:[e("span",{className:"text-sm text-gray-600",children:"Đáp án đúng:"}),e("span",{className:"text-sm font-semibold text-green-600",children:q(j)})]}),r("div",{className:b("flex items-center justify-between rounded-lg p-3 border",$?"bg-green-50 border-green-200":"bg-red-50 border-red-200"),children:[e("span",{className:"text-sm text-gray-600",children:"Kết quả:"}),e("div",{className:b("flex items-center gap-1.5 text-sm font-semibold",$?"text-green-600":"text-red-600"),children:r(t,$?{children:[e(l,{className:"h-4 w-4"}),e("span",{children:"Chính xác"})]}:{children:[e(i,{className:"h-4 w-4"}),e("span",{children:"Sai"})]})})]})]})]})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const transformChooseTheCorrectAnswer=e=>{const r=e.answer;if(!r?.options||void 0===r.correctAnswer)return{apiContent:{},apiCorrectAnswer:{}};const t={question:r.question||"",optionType:r.optionType||"text",options:r.options,...r.multipleAnswers?{multipleAnswers:!0}:{}};r.imageUrl&&(t.imageUrl=r.imageUrl),r.askerName&&(t.askerName=r.askerName),r.answererName&&(t.answererName=r.answererName);const o=!!(r.groupTitle||r.groupSubtitle||r.groupContent||r.groupImageUrl||r.articles&&r.articles.length>0)?{title:r.groupTitle||"",subtitle:r.groupSubtitle||"",content:r.groupContent||"",imageUrl:r.groupImageUrl||"",...r.articles?{articles:r.articles}:{}}:void 0;return{apiContent:t,apiCorrectAnswer:{answer:r.correctAnswer,...r.multipleAnswers?{multipleAnswers:!0}:{}},isExample:r.isExample||!1,basicGroupData:o,groupNumber:r.groupNumber||1}};
|
|
1
|
+
export const transformChooseTheCorrectAnswer=e=>{const r=e.answer;if(!r?.options||void 0===r.correctAnswer)return{apiContent:{},apiCorrectAnswer:{}};const t={question:r.question||"",optionType:r.optionType||"text",options:r.options,...r.multipleAnswers?{multipleAnswers:!0}:{}};r.imageUrl&&(t.imageUrl=r.imageUrl),r.askerName&&(t.askerName=r.askerName),r.answererName&&(t.answererName=r.answererName);const o=!!(r.groupTitle||r.groupSubtitle||r.groupContent||r.groupImageUrl||r.articles&&r.articles.length>0)?{title:r.groupTitle||"",subtitle:r.groupSubtitle||"",content:r.groupContent||"",imageUrl:r.groupImageUrl||"",...r.articles?{articles:r.articles}:{}}:void 0,i=(e,r=[])=>{if("number"==typeof e)return r[e]&&"object"==typeof r[e]&&r[e].id?r[e].id:`opt-${e+1}`;if("string"==typeof e){if(e.startsWith("opt-")||isNaN(Number(e)))return e;const t=parseInt(e,10);if(!isNaN(t))return r[t]&&"object"==typeof r[t]&&r[t].id?r[t].id:`opt-${t+1}`}return String(e??"")};return{apiContent:t,apiCorrectAnswer:{answer:((e,r=[])=>Array.isArray(e)?e.map(e=>i(e,r)):i(e,r))(r.correctAnswer,r.options),...r.multipleAnswers?{multipleAnswers:!0}:{}},isExample:r.isExample||!1,basicGroupData:o,groupNumber:r.groupNumber||1}};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ChooseTheCorrectAnswerGroupClientProps } from '../../_shared/types/choose-the-correct-answer-group.type';
|
|
2
|
+
export declare function ChooseTheCorrectAnswerGroupClient({ questionData, isReviewMode, userAnswers, }: ChooseTheCorrectAnswerGroupClientProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Check as t,CircleHelp as s,Lightbulb as i,Star as a}from"lucide-react";import{cn as n}from"../../../../shared/lib/utils";const d=["A","B","C","D","E","F"];export function ChooseTheCorrectAnswerGroupClient({questionData:l,isReviewMode:o=!1,userAnswers:c=[]}){const m=l.items||[];return r("div",{className:"space-y-4",children:[l.instruction&&e("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800",children:l.instruction}),m.map((i,l)=>{const m=c[l];return r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-4 py-2.5",children:[r("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-white",children:e(s,{className:"h-3.5 w-3.5"})}),r("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",i.questionNumber||l+1]}),i.isExample&&r("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-700",children:[e(a,{className:"h-3 w-3"}),"Example"]})]}),r("span",{className:"text-xs text-gray-500",children:[i.points||0," điểm"]})]}),r("div",{className:"space-y-3 p-4",children:[e("p",{className:"text-sm font-semibold leading-relaxed text-gray-800",children:i.question||"Câu hỏi chưa được nhập"}),e("div",{className:"space-y-2",children:i.options.map((s,a)=>{const l=s.id===i.correctAnswer,c=s.id===m;return r("div",{className:n("flex items-center gap-3 rounded-lg border-2 px-3 py-2.5 text-sm",o&&l?"border-green-400 bg-green-50":c?"border-blue-400 bg-blue-50":"border-gray-200 bg-white"),children:[e("span",{className:n("flex h-7 w-7 items-center justify-center rounded-md text-xs font-bold",o&&l?"bg-green-500 text-white":"bg-gray-100 text-gray-600"),children:d[a]||a+1}),e("span",{className:"flex-1 text-gray-800",children:s.text||`Đáp án ${d[a]}`}),o&&l&&e(t,{className:"h-4 w-4 text-green-600"})]},s.id||a)})})]})]},`${i.questionNumber}-${l}`)}),o&&l.explanation&&r("div",{className:"flex items-start gap-2 rounded-xl border border-amber-100 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:[e(i,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),l.explanation]})]})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ChooseTheCorrectAnswerGroupCreatorProps } from '../../_shared/types/choose-the-correct-answer-group.type';
|
|
2
|
+
export declare function ChooseTheCorrectAnswerGroupCreator({ initialData, onChange, externalErrors, onUnsavedChangesChange, validationRef, }: ChooseTheCorrectAnswerGroupCreatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEffect as n,useRef as r,useState as i}from"react";import{Button as o}from"../../../../components/ui/button";import{Label as s}from"../../../../components/ui/label";import{Input as a}from"../../../../components/ui/input";import{Textarea as c}from"../../../../components/ui/textarea";import{PointsInput as l}from"../../../../components/ui/points-input";import{Card as p,CardContent as m,CardHeader as u,CardTitle as h}from"../../../../components/ui/card";import{Switch as d}from"../../../../components/ui/switch";import{useDebouncedCallback as g}from"../../../../shared/lib/hooks";import{Eye as x,Pencil as f,Plus as v,Star as y,Trash2 as b}from"lucide-react";import{ChooseTheCorrectAnswerGroupClient as N}from"./ChooseTheCorrectAnswerGroupClient";const C=["A","B","C","D","E","F"];function w(e){return{question:"",optionType:"text",options:[{id:"opt-1",text:""},{id:"opt-2",text:""},{id:"opt-3",text:""}],correctAnswer:"opt-1",isExample:!1,points:1,questionNumber:e}}function A(e){return e.reduce((e,t)=>t.isExample?e:e+("number"==typeof t.points?t.points:1),0)}function q(e,t){const n=Number.parseInt(e.replace(/[^0-9]/g,""),10);return Number.isNaN(n)?t?0:1:t?Math.max(0,n):Math.max(1,n)}export function ChooseTheCorrectAnswerGroupCreator({initialData:E,onChange:k,externalErrors:j,onUnsavedChangesChange:T,validationRef:$}){const[D,F]=i(E?.instruction||"Choose the correct answer."),[G,M]=i(()=>{return e=E?.items,Array.isArray(e)&&0!==e.length?e.map((e,t)=>({question:e.question||"",optionType:"image"===e.optionType?"image":"text",options:Array.isArray(e.options)&&e.options.length>=2?e.options.map((e,t)=>({id:e.id||`opt-${t+1}`,text:e.text||""})):w(t+1).options,correctAnswer:e.correctAnswer||"opt-1",isExample:!0===e.isExample,points:e.isExample?0:"number"==typeof e.points?e.points:1,questionNumber:e.questionNumber||t+1})):[w(1)];var e}),[V,O]=i(E?.explanation||""),[R,Z]=i(!1),[z,B]=i([]),H=r(k),I=r("");n(()=>{H.current=k},[k]);const J=(e=D,t=G,n=V)=>({instruction:e,items:t,explanation:n,points:A(t)}),S=g(e=>{H.current?.(e)},300);n(()=>{const e=J(),t=JSON.stringify(e);t!==I.current&&(I.current=t,T?.(!0),S(e))},[D,G,V,S,T]);n(()=>{$&&($.current={triggerValidation:async()=>{const e=(()=>{const e=[];return D.trim()||e.push("Vui lòng nhập hướng dẫn."),G.length<1&&e.push("Cần ít nhất một câu hỏi."),G.forEach((t,n)=>{t.question.trim()||e.push(`Câu ${n+1}: nội dung câu hỏi là bắt buộc.`),t.options.filter(e=>""!==e.text.trim()).length<2&&e.push(`Câu ${n+1}: cần ít nhất 2 đáp án.`),t.options.some(e=>e.id===t.correctAnswer&&""!==e.text.trim())||e.push(`Câu ${n+1}: hãy chọn đáp án đúng.`)}),e})();return B(e),0===e.length},getFormData:()=>J()})});const U=(e,t)=>{M(n=>n.map((n,r)=>r===e?{...n,...t}:n))};if(R)return t("div",{className:"space-y-4",children:[e("div",{className:"flex justify-end",children:t(o,{type:"button",variant:"outline",onClick:()=>Z(!1),children:[e(f,{className:"mr-2 h-4 w-4"}),"Chỉnh sửa"]})}),e(N,{questionData:J(),isReviewMode:!0})]});const X=[...z,...j||[]];return t("div",{className:"space-y-4",children:[e("div",{className:"flex justify-end",children:t(o,{type:"button",variant:"outline",onClick:()=>Z(!0),children:[e(x,{className:"mr-2 h-4 w-4"}),"Xem trước"]})}),t(p,{children:[e(u,{children:e(h,{children:"Nhóm chọn đáp án đúng"})}),t(m,{className:"space-y-4",children:[t("div",{className:"space-y-2",children:[e(s,{htmlFor:"group-instruction",children:"Hướng dẫn"}),e(a,{id:"group-instruction",value:D,onChange:e=>F(e.target.value),placeholder:"Choose the correct answer."})]}),t("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-4",children:[e(l,{value:A(G),allowZero:!0,readOnly:!0}),e("p",{className:"mt-2 text-xs text-gray-500",children:"Tổng điểm được cộng từ các câu không phải example."})]})]})]}),G.map((n,r)=>t(p,{children:[t(u,{className:"flex flex-row items-center justify-between space-y-0",children:[t(h,{className:"text-base",children:["Câu ",r+1]}),e(o,{type:"button",variant:"ghost",size:"sm",onClick:()=>{return e=r,void M(t=>t.length<=1?t:t.filter((t,n)=>n!==e).map((e,t)=>({...e,questionNumber:t+1})));var e},disabled:G.length<=1,children:e(b,{className:"h-4 w-4"})})]}),t(m,{className:"space-y-4",children:[t("div",{className:"flex items-center justify-between rounded-lg border border-amber-100 bg-amber-50 px-3 py-2",children:[t("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-800",children:[e(y,{className:"h-4 w-4"}),"Câu ví dụ"]}),e(d,{checked:!0===n.isExample,onCheckedChange:e=>U(r,{isExample:e,points:e?0:n.points||1})})]}),t("div",{className:"space-y-2",children:[e(s,{children:"Câu hỏi"}),e(c,{value:n.question,onChange:e=>U(r,{question:e.target.value}),rows:2,placeholder:"A place for someone to stay or live is called"})]}),e("div",{className:"space-y-2",children:n.options.map((i,o)=>t("div",{className:"flex items-center gap-2",children:[e("input",{type:"radio",name:`correct-${r}`,checked:n.correctAnswer===i.id,onChange:()=>U(r,{correctAnswer:i.id})}),e("span",{className:"w-6 text-sm font-semibold text-gray-600",children:C[o]||o+1}),e(a,{value:i.text,onChange:e=>((e,t,n)=>{M(r=>r.map((r,i)=>{if(i!==e)return r;const o=r.options.map((e,r)=>r===t?{...e,text:n}:e);return{...r,options:o}}))})(r,o,e.target.value),placeholder:`Đáp án ${C[o]}`})]},i.id))}),!n.isExample&&e(l,{value:n.points,allowZero:!0,onChange:e=>U(r,{points:q(e.target.value,!0)})})]})]},`item-${r}`)),t(o,{type:"button",variant:"outline",onClick:()=>{M(e=>[...e,w(e.length+1)])},children:[e(v,{className:"mr-2 h-4 w-4"}),"Thêm câu hỏi"]}),t(p,{children:[e(u,{children:e(h,{className:"text-base",children:"Giải thích"})}),e(m,{children:e(c,{id:"explanation",value:V,onChange:e=>O(e.target.value),placeholder:"VD: Câu trả lời đúng là... vì...",rows:3})})]}),X.length>0&&e("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:X.map(t=>e("p",{children:t},t))})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./ChooseTheCorrectAnswerGroupCreator";export*from"./ChooseTheCorrectAnswerGroupClient";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ChooseTheCorrectAnswerGroupCreator as t}from"./ChooseTheCorrectAnswerGroupCreator";function e(t){return function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}(t)?t:{}}function n(t,e=""){return"string"==typeof t?t:e}export const chooseTheCorrectAnswerGroupRegistration={component:t,transformInitialData:t=>{const o=t?.content,i=t?.answer,r=t?.correctAnswer||i?.correctAnswer||{},s=t?.explanation||i?.explanation||"",a=Array.isArray(r?.answer)?r.answer:[];if(Array.isArray(o?.items)){const t=o.items.map((t,o)=>function(t,o,i){const r=e(t),s=e(r.content),a=e(r.correctAnswer),p=Array.isArray(s.options)?s.options:[],c=p.length>=2?p.map((t,o)=>{const i=e(t);return{id:n(i.id,`opt-${o+1}`),text:n(i.text)}}):[{id:"opt-1",text:""},{id:"opt-2",text:""},{id:"opt-3",text:""}],u=!0===r.isExample;return{question:n(s.question)||n(r.question),optionType:"image"===n(s.optionType)?"image":"text",options:c,correctAnswer:n(a.answer)||i||c[0]?.id||"opt-1",isExample:u,points:u?0:"number"==typeof r.points?r.points:1,questionNumber:"number"==typeof r.questionNumber?r.questionNumber:o+1}}(t,o,a[o]));return{instruction:o?.meta?.instruction||"Choose the correct answer.",items:t,explanation:s,points:t.reduce((t,e)=>e.isExample?t:t+(e.points||0),0)}}return Array.isArray(i?.items)?{instruction:i.instruction||"Choose the correct answer.",items:i.items,explanation:s,points:i.points}:{instruction:"Choose the correct answer.",items:[(p=1,{question:"",optionType:"text",options:[{id:"opt-1",text:""},{id:"opt-2",text:""},{id:"opt-3",text:""}],correctAnswer:"opt-1",isExample:!1,points:1,questionNumber:p})],explanation:s,points:1};var p},getExtraProps:t=>({onUnsavedChangesChange:t.onUnsavedChangesChange,validationRef:t.validationRef}),wrapOnSave:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}},wrapOnChange:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,e){return t?.id&&""!==t.id.trim()?t.id:`opt-${e+1}`}function e(t){return t.reduce((t,e)=>{if(e.isExample)return t;return t+("number"==typeof e.points?e.points:1)},0)}export const transformChooseTheCorrectAnswerGroup=n=>{const r=n.answer,o=Array.isArray(r?.items)?r.items:[];if(0===o.length)return{apiContent:{items:[]},apiCorrectAnswer:{answer:[]}};const s=o.map((e,n)=>{const r=(e.options||[]).map((e,n)=>({id:t(e,n),text:e.text||""})),o=e.correctAnswer||r[0]?.id||"opt-1";return{questionType:"CHOOSE_THE_CORRECT_ANSWER",...e.isExample?{isExample:!0}:{},content:{question:e.question||"",options:r,optionType:e.optionType||"text"},correctAnswer:{answer:o},points:e.isExample?0:"number"==typeof e.points?e.points:1,questionNumber:e.questionNumber||n+1}});return{apiContent:{meta:{instruction:r?.instruction||"Choose the correct answer."},items:s},apiCorrectAnswer:{answer:s.map(t=>t.correctAnswer.answer)},totalPoints:e(o)}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{CircleHelp as r,Lightbulb as s,Star as i}from"lucide-react";import{cn as a}from"../../../../shared/lib/utils";function n(e){return e?"CROSS_OUT_AND_REPLACE"===e.type?`gạch "${e.crossOut}" → "${e.replaceWith||""}"`:e.crossOut?`gạch "${e.crossOut}"`:"câu đúng (không gạch)":"—"}export function CrossOutWordGroupClient({questionData:d,isReviewMode:l=!1,userAnswers:o=[]}){const c=d.items||[];return t("div",{className:"space-y-4",children:[d.instruction&&e("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800",children:d.instruction}),c.map((s,d)=>{const c=o[d],m="CROSS_OUT_AND_REPLACE"===s.type;return t("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[t("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-4 py-2.5",children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-white",children:e(r,{className:"h-3.5 w-3.5"})}),t("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",s.questionNumber||d+1]}),s.isExample&&t("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-700",children:[e(i,{className:"h-3 w-3"}),"Example"]}),e("span",{className:a("rounded-full px-2 py-0.5 text-xs font-semibold",m?"bg-violet-100 text-violet-700":"bg-sky-100 text-sky-700"),children:m?"Gạch + thay":"Chỉ gạch"})]}),t("span",{className:"text-xs text-gray-500",children:[s.points||0," điểm"]})]}),t("div",{className:"space-y-3 p-4",children:[e("p",{className:"text-sm font-semibold leading-relaxed text-gray-800",children:s.question||"Câu hỏi chưa được nhập"}),t("div",{className:"rounded-lg border border-gray-100 bg-gray-50 px-3 py-2 text-sm text-gray-700",children:[e("span",{className:"font-medium text-gray-500",children:"Đáp án: "}),n(s.correctAnswer)]}),l&&t("div",{className:"rounded-lg border border-blue-100 bg-blue-50 px-3 py-2 text-sm text-blue-800",children:[e("span",{className:"font-medium",children:"Học sinh: "}),n(c)]})]})]},`${s.questionNumber}-${d}`)}),l&&d.explanation&&t("div",{className:"flex items-start gap-2 rounded-xl border border-amber-100 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:[e(s,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),d.explanation]})]})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { CrossOutWordGroupCreatorProps } from '../../_shared/types/cross-out-word-group.type';
|
|
2
|
+
export declare function CrossOutWordGroupCreator({ initialData, onChange, externalErrors, onUnsavedChangesChange, validationRef, }: CrossOutWordGroupCreatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEffect as r,useRef as n,useState as c}from"react";import{Button as s}from"../../../../components/ui/button";import{Label as i}from"../../../../components/ui/label";import{Input as a}from"../../../../components/ui/input";import{Textarea as o}from"../../../../components/ui/textarea";import{PointsInput as l}from"../../../../components/ui/points-input";import{Card as h,CardContent as m,CardHeader as u,CardTitle as d}from"../../../../components/ui/card";import{Switch as p}from"../../../../components/ui/switch";import{Select as g,SelectContent as x,SelectItem as N,SelectTrigger as C,SelectValue as f}from"../../../../components/ui/select";import{useDebouncedCallback as O}from"../../../../shared/lib/hooks";import{Eye as v,Pencil as b,Plus as y,Star as w,Trash2 as S}from"lucide-react";import{CrossOutWordGroupClient as A}from"./CrossOutWordGroupClient";function _(e,t=!1){if(""===e)return t?0:1;const r=parseInt(e.replace(/[^0-9]/g,""),10);if(Number.isNaN(r))return t?0:1;const n=t?0:1;return Math.max(n,r)}const E="Cross out the extra or incorrect word. If the word is incorrect, write the correct word. If the line is correct, leave it blank.";function R(e,t="",r=""){return"CROSS_OUT_AND_REPLACE"===e?{type:e,crossOut:t,replaceWith:r}:{type:"CROSS_OUT",crossOut:t}}function T(e){return{type:"CROSS_OUT",question:"",correctAnswer:R("CROSS_OUT"),isExample:!1,points:1,questionNumber:e}}function U(e){return e.reduce((e,t)=>t.isExample?e:e+("number"==typeof t.points?t.points:1),0)}export function CrossOutWordGroupCreator({initialData:D,onChange:q,externalErrors:W,onUnsavedChangesChange:$,validationRef:k}){const[L,P]=c(D?.instruction||E),[j,F]=c(()=>{return e=D?.items,Array.isArray(e)&&0!==e.length?e.map((e,t)=>{const r="CROSS_OUT_AND_REPLACE"===e.type||"CROSS_OUT_AND_REPLACE"===e.correctAnswer?.type?"CROSS_OUT_AND_REPLACE":"CROSS_OUT",n=R(r,e.correctAnswer?.crossOut||"",e.correctAnswer?.replaceWith||"");return{type:r,question:e.question||"",correctAnswer:n,isExample:!0===e.isExample,points:e.isExample?0:"number"==typeof e.points?e.points:1,questionNumber:e.questionNumber||t+1}}):[T(1)];var e}),[V,G]=c(D?.explanation||""),[I,z]=c(!1),[H,M]=c([]),X=n(q),J=n("");r(()=>{X.current=q},[q]);const Z=(e=L,t=j,r=V)=>({instruction:e,items:t,explanation:r,points:U(t)}),B=O(e=>{X.current?.(e)},300);r(()=>{const e=Z(),t=JSON.stringify(e);t!==J.current&&(J.current=t,B(e),$?.(!0))},[L,j,V,B,$]);r(()=>{k&&(k.current={triggerValidation:async()=>(()=>{const e=[];return L.trim()||e.push("Hướng dẫn (Instruction) không được để trống."),0===j.length&&e.push("Cần ít nhất một câu hỏi trong nhóm."),j.forEach((t,r)=>{t.question.trim()||e.push(`Câu ${r+1}: Nội dung câu không được để trống.`),"CROSS_OUT_AND_REPLACE"===t.type&&(t.correctAnswer.crossOut.trim()||e.push(`Câu ${r+1}: Cần nhập từ cần gạch (crossOut).`),t.correctAnswer.replaceWith?.trim()||e.push(`Câu ${r+1}: Cần nhập từ thay thế (replaceWith).`))}),M(e),0===e.length})(),getFormData:()=>Z()})},[k,L,j,V]);const K=(e,t)=>{F(r=>{const n=[...r],c=n[e];return c?(n[e]={...c,...t},n):r})},Q=(e,t)=>{F(r=>{const n=[...r],c=n[e];if(!c)return r;const s=c.type;return n[e]={...c,correctAnswer:R(s,void 0!==t.crossOut?t.crossOut:c.correctAnswer.crossOut,void 0!==t.replaceWith?t.replaceWith:c.correctAnswer.replaceWith||"")},n})},Y=Z(),ee=W&&W.length>0?W:H;return t("div",{className:"space-y-6",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{children:[e("h3",{className:"text-lg font-medium text-gray-900",children:"Tạo câu hỏi Gạch từ / Sửa từ (Nhóm)"}),e("p",{className:"text-sm text-gray-500",children:"Mix 2 dạng: chỉ gạch từ thừa, hoặc gạch từ sai rồi thay bằng từ đúng"})]}),t(s,{type:"button",variant:"outline",size:"sm",onClick:()=>z(e=>!e),className:"gap-2",children:[e(I?b:v,{className:"h-4 w-4"}),I?"Chế độ chỉnh sửa":"Xem trước học sinh"]})]}),ee.length>0&&t("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4",children:[e("h3",{className:"text-sm font-medium text-red-800",children:"Cần sửa các lỗi sau:"}),e("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-sm text-red-700",children:ee.map((t,r)=>e("li",{children:t},r))})]}),I?t(h,{children:[e(u,{children:e(d,{className:"text-base font-semibold",children:"Xem trước hiển thị học sinh"})}),e(m,{children:e(A,{questionData:Y})})]}):t("div",{className:"space-y-6",children:[t(h,{children:[e(u,{children:e(d,{className:"text-base font-semibold",children:"Hướng dẫn chung (Instruction)"})}),t(m,{children:[e(i,{htmlFor:"instruction",children:"Hướng dẫn bài làm"}),e(a,{id:"instruction",value:L,onChange:e=>P(e.target.value),placeholder:E,className:"mt-1"})]})]}),t(h,{children:[t(u,{className:"flex flex-row items-center justify-between",children:[t(d,{className:"text-base font-semibold",children:["Danh sách câu (",j.length,")"]}),t(s,{type:"button",variant:"outline",size:"sm",onClick:()=>{F(e=>[...e,T(e.length+1)])},className:"gap-2",children:[e(y,{className:"h-4 w-4"}),"Thêm câu"]})]}),e(m,{className:"space-y-4",children:j.map((r,n)=>t("div",{className:"space-y-4 rounded-lg border border-gray-200 bg-gray-50/50 p-4",children:[t("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[t("div",{className:"flex items-center gap-2",children:[e("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-blue-100 text-xs font-semibold text-blue-700",children:r.questionNumber||n+1}),t("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",n+1]})]}),t("div",{className:"flex flex-wrap items-center gap-4",children:[e("div",{className:"w-52",children:t(g,{value:r.type,onValueChange:e=>((e,t)=>{F(r=>{const n=[...r],c=n[e];return c?(n[e]={...c,type:t,correctAnswer:R(t,c.correctAnswer.crossOut,c.correctAnswer.replaceWith||"")},n):r})})(n,e),children:[e(C,{children:e(f,{placeholder:"Loại câu"})}),t(x,{children:[e(N,{value:"CROSS_OUT",children:"Chỉ gạch (CROSS_OUT)"}),e(N,{value:"CROSS_OUT_AND_REPLACE",children:"Gạch + thay (CROSS_OUT_AND_REPLACE)"})]})]})}),t("div",{className:"flex items-center gap-2",children:[e(p,{id:`example-${n}`,checked:r.isExample||!1,onCheckedChange:e=>K(n,{isExample:e,points:e?0:1})}),t(i,{htmlFor:`example-${n}`,className:"flex cursor-pointer items-center gap-1 text-xs",children:[e(w,{className:"h-3 w-3 text-amber-500"}),"Example"]})]}),!r.isExample&&e("div",{className:"w-24",children:e(l,{value:r.points,allowZero:!0,onChange:e=>K(n,{points:_(e.target.value,!0)})})}),j.length>1&&e(s,{type:"button",variant:"ghost",size:"sm",onClick:()=>(e=>{F(t=>t.length<=1?t:t.filter((t,r)=>r!==e).map((e,t)=>({...e,questionNumber:t+1})))})(n),className:"text-red-500 hover:bg-red-50 hover:text-red-600",children:e(S,{className:"h-4 w-4"})})]})]}),t("div",{children:[e(i,{htmlFor:`question-${n}`,children:"Nội dung câu"}),e(o,{id:`question-${n}`,value:r.question,onChange:e=>K(n,{question:e.target.value}),placeholder:"Nhập câu gốc...",className:"mt-1 bg-white",rows:2})]}),t("div",{className:"grid gap-4 md:grid-cols-2",children:[t("div",{children:[t(i,{htmlFor:`crossout-${n}`,children:["Từ cần gạch (crossOut)","CROSS_OUT"===r.type&&e("span",{className:"ml-1 text-xs font-normal text-gray-500",children:"— để trống nếu câu đúng"})]}),e(a,{id:`crossout-${n}`,value:r.correctAnswer.crossOut,onChange:e=>Q(n,{crossOut:e.target.value}),placeholder:"CROSS_OUT"===r.type?"VD: to (hoặc trống)":"VD: have",className:"mt-1 bg-white"})]}),"CROSS_OUT_AND_REPLACE"===r.type&&t("div",{children:[e(i,{htmlFor:`replace-${n}`,children:"Từ thay thế (replaceWith)"}),e(a,{id:`replace-${n}`,value:r.correctAnswer.replaceWith||"",onChange:e=>Q(n,{replaceWith:e.target.value}),placeholder:"VD: has",className:"mt-1 bg-white"})]})]})]},n))})]}),t(h,{children:[e(u,{children:e(d,{className:"text-base",children:"Giải thích"})}),e(m,{children:e(o,{id:"explanation",value:V,onChange:e=>G(e.target.value),placeholder:"VD: Câu trả lời đúng là... vì...",rows:3})})]})]})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./CrossOutWordGroupCreator";export*from"./CrossOutWordGroupClient";export*from"./transform";export*from"./register";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CrossOutWordGroupCreator as t}from"./CrossOutWordGroupCreator";const e="Cross out the extra or incorrect word. If the word is incorrect, write the correct word. If the line is correct, leave it blank.";function n(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function r(t){return n(t)?t:{}}function o(t,e=""){return"string"==typeof t?t:e}function s(t,e="",n=""){return"CROSS_OUT_AND_REPLACE"===t?{type:t,crossOut:e,replaceWith:n}:{type:"CROSS_OUT",crossOut:e}}export const crossOutWordGroupRegistration={component:t,transformInitialData:t=>{const i=t?.content,a=t?.answer,c=t?.correctAnswer||a?.correctAnswer||{},p=t?.explanation||a?.explanation||"",u=Array.isArray(c?.answer)?c.answer:[];if(Array.isArray(i?.items)){const t=i.items.map((t,e)=>function(t,e,i){const a=r(t),c=r(a.content),p=r(a.correctAnswer),u=n(p.answer)?p.answer:n(i)?i:{},l=function(t){return"CROSS_OUT_AND_REPLACE"===t?"CROSS_OUT_AND_REPLACE":"CROSS_OUT"}(c.type||u.type),y=!0===a.isExample;return{type:l,question:o(c.question)||o(a.question),correctAnswer:s(l,o(u.crossOut),o(u.replaceWith)),isExample:y,points:y?0:"number"==typeof a.points?a.points:1,questionNumber:"number"==typeof a.questionNumber?a.questionNumber:e+1}}(t,e,u[e]));return{instruction:i?.meta?.instruction||e,items:t,explanation:p,points:t.reduce((t,e)=>e.isExample?t:t+(e.points||0),0)}}return Array.isArray(a?.items)?{instruction:a.instruction||e,items:a.items,explanation:p,points:a.points}:{instruction:e,items:[(l=1,{type:"CROSS_OUT",question:"",correctAnswer:s("CROSS_OUT"),isExample:!1,points:1,questionNumber:l})],explanation:p,points:1};var l},getExtraProps:t=>({onUnsavedChangesChange:t.onUnsavedChangesChange,validationRef:t.validationRef}),wrapOnSave:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}},wrapOnChange:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return t.reduce((t,r)=>{if(r.isExample)return t;return t+("number"==typeof r.points?r.points:1)},0)}function r(t){return"CROSS_OUT_AND_REPLACE"===t?"CROSS_OUT_AND_REPLACE":"CROSS_OUT"}export const transformCrossOutWordGroup=e=>{const n=e.answer,o=Array.isArray(n?.items)?n.items:[];if(0===o.length)return{apiContent:{items:[]},apiCorrectAnswer:{answer:[]}};const s=o.map((t,e)=>{const n=r(t.type||t.correctAnswer?.type),o=function(t,e){const n=r(t?.type||e),o={type:n,crossOut:"string"==typeof t?.crossOut?t.crossOut.trim():""};return"CROSS_OUT_AND_REPLACE"===n&&(o.replaceWith="string"==typeof t?.replaceWith?t.replaceWith.trim():""),o}(t.correctAnswer,n);return{questionType:"CROSS_OUT_WORD",...t.isExample?{isExample:!0}:{},content:{type:n,question:t.question||""},correctAnswer:{answer:o},points:t.isExample?0:"number"==typeof t.points?t.points:1,questionNumber:t.questionNumber||e+1}});return{apiContent:{meta:{instruction:n?.instruction||"Cross out the extra or incorrect word. If the word is incorrect, write the correct word."},items:s},apiCorrectAnswer:{answer:s.map(t=>t.correctAnswer.answer)},totalPoints:t(o)}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Check as t,CircleHelp as s,Lightbulb as a,Star as i,X as l}from"lucide-react";import{cn as n}from"../../../../shared/lib/utils";export function TrueFalseGroupClient({questionData:d,isReviewMode:o=!1,userAnswers:m=[]}){const c=d.items||[];return r("div",{className:"space-y-4",children:[d.instruction&&e("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800",children:d.instruction}),c.map((a,d)=>{const c=m[d],x=a.correctAnswer;return r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white px-4 py-2.5",children:[r("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500 to-indigo-600 text-white",children:e(s,{className:"h-3.5 w-3.5"})}),r("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",a.questionNumber||d+1]}),a.isExample&&r("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-semibold text-amber-700",children:[e(i,{className:"h-3 w-3"}),"Example"]})]}),r("span",{className:"text-xs text-gray-500",children:[a.points||0," điểm"]})]}),r("div",{className:"space-y-3 p-4",children:[e("p",{className:"text-sm font-semibold leading-relaxed text-gray-800",children:a.question||"Câu hỏi chưa được nhập"}),e("div",{className:"flex items-center gap-3",children:[{value:!0,label:"True"},{value:!1,label:"False"}].map(s=>{const a=s.value===x,i=s.value===c;return r("div",{className:n("flex flex-1 items-center justify-center gap-2 rounded-lg border-2 px-4 py-2 text-sm font-semibold transition-colors",o&&a?"border-green-500 bg-green-50 text-green-700":o&&i&&!a?"border-red-500 bg-red-50 text-red-700":i?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-200 bg-white text-gray-700"),children:[s.value?e(t,{className:"h-4 w-4"}):e(l,{className:"h-4 w-4"}),e("span",{children:s.label})]},String(s.value))})})]})]},`${a.questionNumber}-${d}`)}),o&&d.explanation&&r("div",{className:"flex items-start gap-2 rounded-xl border border-amber-100 bg-amber-50 px-4 py-3 text-sm text-amber-800",children:[e(a,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),d.explanation]})]})}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { TrueFalseGroupCreatorProps } from '../../_shared/types/true-false-group.type';
|
|
2
|
+
export declare function TrueFalseGroupCreator({ initialData, onChange, externalErrors, onUnsavedChangesChange, validationRef, }: TrueFalseGroupCreatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEffect as n,useRef as r,useState as i}from"react";import{Button as s}from"../../../../components/ui/button";import{Label as a}from"../../../../components/ui/label";import{Input as c}from"../../../../components/ui/input";import{Textarea as l}from"../../../../components/ui/textarea";import{PointsInput as o}from"../../../../components/ui/points-input";import{Card as m,CardContent as h,CardHeader as u,CardTitle as d}from"../../../../components/ui/card";import{Switch as p}from"../../../../components/ui/switch";import{useDebouncedCallback as g}from"../../../../shared/lib/hooks";import{Eye as x,Pencil as N,Plus as f,Star as b,Trash2 as v}from"lucide-react";import{TrueFalseGroupClient as y}from"./TrueFalseGroupClient";function w(e,t=!1){if(""===e)return t?0:1;const n=parseInt(e.replace(/[^0-9]/g,""),10);if(Number.isNaN(n))return t?0:1;const r=t?0:1;return Math.max(r,n)}function C(e){return{question:"",correctAnswer:!0,isExample:!1,points:1,questionNumber:e}}function q(e){return e.reduce((e,t)=>t.isExample?e:e+("number"==typeof t.points?t.points:1),0)}export function TrueFalseGroupCreator({initialData:k,onChange:E,externalErrors:T,onUnsavedChangesChange:A,validationRef:F}){const[j,D]=i(k?.instruction||"Tick True or False."),[z,$]=i(()=>{return e=k?.items,Array.isArray(e)&&0!==e.length?e.map((e,t)=>({question:e.question||"",correctAnswer:"boolean"!=typeof e.correctAnswer||e.correctAnswer,isExample:!0===e.isExample,points:e.isExample?0:"number"==typeof e.points?e.points:1,questionNumber:e.questionNumber||t+1})):[C(1)];var e}),[G,H]=i(k?.explanation||""),[I,V]=i(!1),[S,X]=i([]),J=r(E),M=r("");n(()=>{J.current=E},[E]);const O=(e=j,t=z,n=G)=>({instruction:e,items:t,explanation:n,points:q(t)}),R=g(e=>{J.current?.(e)},300);n(()=>{const e=O(),t=JSON.stringify(e);t!==M.current&&(M.current=t,R(e),A?.(!0))},[j,z,G,R,A]);n(()=>{F&&(F.current={triggerValidation:async()=>(()=>{const e=[];return j.trim()||e.push("Hướng dẫn (Instruction) không được để trống."),0===z.length&&e.push("Cần ít nhất một câu hỏi trong nhóm."),z.forEach((t,n)=>{t.question.trim()||e.push(`Câu ${n+1}: Nội dung câu hỏi không được để trống.`)}),X(e),0===e.length})(),getFormData:()=>O()})},[F,j,z,G]);const U=(e,t)=>{$(n=>{const r=[...n],i=r[e];return i?(r[e]={...i,...t},r):n})},Z=O(),B=T&&T.length>0?T:S;return t("div",{className:"space-y-6",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{children:[e("h3",{className:"text-lg font-medium text-gray-900",children:"Tạo câu hỏi Đúng / Sai (Nhóm)"}),e("p",{className:"text-sm text-gray-500",children:"Thêm danh sách các câu hỏi True/False trong 1 nhóm"})]}),t(s,{type:"button",variant:"outline",size:"sm",onClick:()=>V(e=>!e),className:"gap-2",children:[e(I?N:x,{className:"h-4 w-4"}),I?"Chế độ chỉnh sửa":"Xem trước học sinh"]})]}),B.length>0&&e("div",{className:"rounded-lg bg-red-50 p-4 border border-red-200",children:e("div",{className:"flex",children:t("div",{className:"ml-3",children:[e("h3",{className:"text-sm font-medium text-red-800",children:"Cần sửa các lỗi sau:"}),e("div",{className:"mt-2 text-sm text-red-700",children:e("ul",{className:"list-disc space-y-1 pl-5",children:B.map((t,n)=>e("li",{children:t},n))})})]})})}),I?t(m,{children:[e(u,{children:e(d,{className:"text-base font-semibold",children:"Xem trước hiển thị học sinh"})}),e(h,{children:e(y,{questionData:Z})})]}):t("div",{className:"space-y-6",children:[t(m,{children:[e(u,{children:e(d,{className:"text-base font-semibold",children:"Hướng dẫn chung (Instruction)"})}),e(h,{className:"space-y-4",children:t("div",{children:[e(a,{htmlFor:"instruction",children:"Hướng dẫn bài làm"}),e(c,{id:"instruction",value:j,onChange:e=>D(e.target.value),placeholder:"VD: Tick True or False.",className:"mt-1"})]})})]}),t(m,{children:[t(u,{className:"flex flex-row items-center justify-between",children:[t(d,{className:"text-base font-semibold",children:["Danh sách câu hỏi (",z.length,")"]}),t(s,{type:"button",variant:"outline",size:"sm",onClick:()=>{$(e=>[...e,C(e.length+1)])},className:"gap-2",children:[e(f,{className:"h-4 w-4"}),"Thêm câu hỏi"]})]}),e(h,{className:"space-y-4",children:z.map((n,r)=>t("div",{className:"space-y-4 rounded-lg border border-gray-200 bg-gray-50/50 p-4 transition-colors hover:border-gray-300",children:[t("div",{className:"flex items-center justify-between gap-4",children:[t("div",{className:"flex items-center gap-2",children:[e("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-blue-100 text-xs font-semibold text-blue-700",children:n.questionNumber||r+1}),t("span",{className:"text-sm font-medium text-gray-700",children:["Câu hỏi ",r+1]})]}),t("div",{className:"flex items-center gap-4",children:[t("div",{className:"flex items-center gap-2",children:[e(p,{id:`example-${r}`,checked:n.isExample||!1,onCheckedChange:e=>U(r,{isExample:e,points:e?0:1})}),t(a,{htmlFor:`example-${r}`,className:"flex items-center gap-1 text-xs cursor-pointer",children:[e(b,{className:"h-3 w-3 text-amber-500"}),"Câu mẫu (Example)"]})]}),!n.isExample&&e("div",{className:"w-24",children:e(o,{value:n.points,allowZero:!0,onChange:e=>U(r,{points:w(e.target.value,!0)})})}),z.length>1&&e(s,{type:"button",variant:"ghost",size:"sm",onClick:()=>(e=>{$(t=>t.length<=1?t:t.filter((t,n)=>n!==e).map((e,t)=>({...e,questionNumber:t+1})))})(r),className:"text-red-500 hover:bg-red-50 hover:text-red-600",children:e(v,{className:"h-4 w-4"})})]})]}),t("div",{children:[e(a,{htmlFor:`question-${r}`,children:"Nội dung câu hỏi"}),e(l,{id:`question-${r}`,value:n.question,onChange:e=>U(r,{question:e.target.value}),placeholder:"Nhập nội dung câu hỏi...",className:"mt-1 bg-white",rows:2})]}),t("div",{children:[e(a,{className:"mb-2 block text-xs font-medium text-gray-700",children:"Đáp án đúng"}),t("div",{className:"flex items-center gap-4",children:[e(s,{type:"button",variant:!0===n.correctAnswer?"default":"outline",size:"sm",onClick:()=>U(r,{correctAnswer:!0}),className:"w-24",children:"True"}),e(s,{type:"button",variant:!1===n.correctAnswer?"default":"outline",size:"sm",onClick:()=>U(r,{correctAnswer:!1}),className:"w-24",children:"False"})]})]})]},r))})]}),t(m,{children:[e(u,{children:e(d,{className:"text-base",children:"Giải thích"})}),e(h,{children:e(l,{id:"explanation",value:G,onChange:e=>H(e.target.value),placeholder:"VD: Câu trả lời đúng là... vì...",rows:3})})]})]})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export*from"./TrueFalseGroupCreator";export*from"./TrueFalseGroupClient";export*from"./transform";export*from"./register";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TrueFalseGroupCreator as t}from"./TrueFalseGroupCreator";function e(t){return function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}(t)?t:{}}function n(t,e=""){return"string"==typeof t?t:e}export const trueFalseGroupRegistration={component:t,transformInitialData:t=>{const r=t?.content,s=t?.answer,i=t?.correctAnswer||s?.correctAnswer||{},o=t?.explanation||s?.explanation||"",a=Array.isArray(i?.answer)?i.answer:[];if(Array.isArray(r?.items)){const t=r.items.map((t,r)=>function(t,r,s){const i=e(t),o=e(i.content),a=e(i.correctAnswer),p=!0===i.isExample,u="boolean"==typeof a.answer?a.answer:"boolean"!=typeof s||s;return{question:n(o.question)||n(i.question),correctAnswer:u,isExample:p,points:p?0:"number"==typeof i.points?i.points:1,questionNumber:"number"==typeof i.questionNumber?i.questionNumber:r+1}}(t,r,a[r]));return{instruction:r?.meta?.instruction||"Tick True or False.",items:t,explanation:o,points:t.reduce((t,e)=>e.isExample?t:t+(e.points||0),0)}}return Array.isArray(s?.items)?{instruction:s.instruction||"Tick True or False.",items:s.items,explanation:o,points:s.points}:{instruction:"Tick True or False.",items:[(p=1,{question:"",correctAnswer:!0,isExample:!1,points:1,questionNumber:p})],explanation:o,points:1};var p},getExtraProps:t=>({onUnsavedChangesChange:t.onUnsavedChangesChange,validationRef:t.validationRef}),wrapOnSave:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}},wrapOnChange:(t,e)=>{const n=t;return{type:e.questionType,content:e.state.content,points:n.points??e.state.points??1,level:e.state.level,difficulty:e.state.difficulty,skill:e.state.skill,answer:n,explanation:n.explanation||""}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.reduce((e,r)=>{if(r.isExample)return e;return e+("number"==typeof r.points?r.points:1)},0)}export const transformTrueFalseGroup=r=>{const t=r.answer,n=Array.isArray(t?.items)?t.items:[];if(0===n.length)return{apiContent:{items:[]},apiCorrectAnswer:{answer:[]}};const s=n.map((e,r)=>{const t=!("boolean"==typeof e.correctAnswer)||e.correctAnswer;return{questionType:"TRUE_FALSE",...e.isExample?{isExample:!0}:{},content:{question:e.question||""},correctAnswer:{answer:t},points:e.isExample?0:"number"==typeof e.points?e.points:1,questionNumber:e.questionNumber||r+1}});return{apiContent:{meta:{instruction:t?.instruction||"Tick True or False."},items:s},apiCorrectAnswer:{answer:s.map(e=>e.correctAnswer.answer)},totalPoints:e(n)}};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WfsfOptionsWordBankEntry, WfsfSharedWordBankEntry } from '../../_shared/types/word-fill-structured-form.type';
|
|
2
|
+
import type { WfsfBankMode } from './wfsf-word-bank.utils';
|
|
3
|
+
export type WfsfWordBankEditorProps = {
|
|
4
|
+
mode: WfsfBankMode;
|
|
5
|
+
onModeChange: (mode: WfsfBankMode) => void;
|
|
6
|
+
sharedBank: WfsfSharedWordBankEntry[];
|
|
7
|
+
onSharedBankChange: (next: WfsfSharedWordBankEntry[]) => void;
|
|
8
|
+
optionsBank: WfsfOptionsWordBankEntry[];
|
|
9
|
+
onOptionsBankChange: (next: WfsfOptionsWordBankEntry[]) => void;
|
|
10
|
+
blankKeys: string[];
|
|
11
|
+
answers: Record<string, string>;
|
|
12
|
+
onAnswerChange: (key: string, value: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function WfsfWordBankEditor({ mode, onModeChange, sharedBank, onSharedBankChange, optionsBank, onOptionsBankChange, blankKeys, answers, onAnswerChange, }: WfsfWordBankEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import{CheckCircle2 as r,Library as n,ListChecks as a,Plus as s,Trash2 as l}from"lucide-react";import{Button as i}from"../../../../components/ui/button";import{Card as o,CardContent as d,CardHeader as c,CardTitle as h}from"../../../../components/ui/card";import{Checkbox as m}from"../../../../components/ui/checkbox";import{Input as g}from"../../../../components/ui/input";import{Label as p}from"../../../../components/ui/label";const x=[{id:"FREE_TYPE",label:"Tự gõ",hint:"Không word bank"},{id:"WITH_WORD_BANK",label:"Word Bank chung",hint:"Hộp gợi ý shared"},{id:"WITH_OPTIONS",label:"Options từng ô",hint:"Dropdown theo blank"}];export function WfsfWordBankEditor({mode:b,onModeChange:u,sharedBank:f,onSharedBankChange:N,optionsBank:y,onOptionsBankChange:w,blankKeys:v,answers:k,onAnswerChange:C}){const j=()=>{N([...f,{word:""}])};return t("div",{className:"space-y-4",children:[t(o,{className:"overflow-hidden border-0 bg-white shadow-lg shadow-indigo-100/50",children:[e("div",{className:"h-1 bg-gradient-to-r from-indigo-400 to-purple-400"}),e(c,{className:"px-4 py-3",children:t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-indigo-100",children:e(n,{className:"h-3.5 w-3.5 text-indigo-600"})}),t("div",{children:[e(h,{className:"text-base font-semibold text-gray-800",children:"Word Bank / gợi ý đáp án"}),e("p",{className:"mt-0.5 text-xs text-gray-500",children:"Chọn chế độ hiển thị cho học sinh khi làm bài (WFSF plan 0024/0025)"})]})]})}),e(d,{className:"space-y-3 px-4 pb-4",children:e("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3",children:x.map(r=>{const n=b===r.id;return t("button",{type:"button",onClick:()=>u(r.id),className:"rounded-xl border-2 px-3 py-2.5 text-left transition-all "+(n?"border-indigo-400 bg-indigo-50 shadow-sm":"border-gray-200 bg-white hover:border-indigo-200"),children:[e("span",{className:"block text-sm font-semibold "+(n?"text-indigo-800":"text-gray-700"),children:r.label}),e("span",{className:"mt-0.5 block text-[11px] text-gray-500",children:r.hint})]},r.id)})})})]}),"WITH_WORD_BANK"===b&&t(o,{className:"overflow-hidden border-0 bg-white shadow-lg shadow-purple-100/50",children:[e("div",{className:"h-1 bg-gradient-to-r from-purple-400 to-pink-400"}),e(c,{className:"px-4 py-3",children:t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-purple-100",children:e(n,{className:"h-3.5 w-3.5 text-purple-600"})}),t(h,{className:"text-base font-semibold text-gray-800",children:["Word Bank (",f.filter(e=>e.word.trim()).length," từ)"]})]}),t(i,{type:"button",variant:"outline",size:"sm",onClick:j,className:"gap-1.5 border-purple-200 text-purple-600 hover:bg-purple-50",children:[e(s,{className:"h-3.5 w-3.5"}),"Thêm từ"]})]})}),t(d,{className:"space-y-3 px-4 pb-4",children:[t("p",{className:"text-xs text-gray-500",children:["Danh sách gợi ý (đáp án + từ nhiễu). Không bắt buộc khớp 1:1 với số chỗ trống. Đánh dấu ",e("strong",{children:"Example"})," nếu từ là mẫu."]}),0===f.length?t("div",{className:"flex h-24 flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-gray-200 bg-gray-50",children:[e("p",{className:"text-sm text-gray-400",children:"Chưa có từ nào"}),t(i,{type:"button",variant:"outline",size:"sm",onClick:j,children:[e(s,{className:"mr-1 h-3.5 w-3.5"}),"Thêm từ"]})]}):e("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:f.map((r,n)=>t("div",{className:"rounded-lg border p-3 "+(r.isExample?"border-amber-300 bg-amber-50/50":"border-gray-200 bg-gray-50/50"),children:[t("div",{className:"mb-2 flex items-center justify-between",children:[e("span",{className:"flex h-7 w-7 items-center justify-center rounded-lg text-xs font-bold text-white "+(r.isExample?"bg-gradient-to-br from-amber-400 to-orange-500":"bg-gradient-to-br from-purple-500 to-pink-600"),children:n+1}),t("div",{className:"flex items-center gap-2",children:[t("div",{className:"flex items-center gap-1.5",children:[e(m,{id:`wfsf-ex-${n}`,checked:!!r.isExample,onCheckedChange:e=>((e,t)=>{const r=[...f];r[e]={...r[e],isExample:t||void 0},N(r)})(n,!0===e)}),e(p,{htmlFor:`wfsf-ex-${n}`,className:"cursor-pointer text-xs text-gray-600",children:"Example"})]}),e(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>(e=>{N(f.filter((t,r)=>r!==e))})(n),className:"h-7 w-7 p-0 text-gray-400 hover:bg-red-50 hover:text-red-500",children:e(l,{className:"h-3.5 w-3.5"})})]})]}),e(g,{value:r.word,onChange:e=>((e,t)=>{const r=[...f];r[e]={...r[e],word:t},N(r)})(n,e.target.value),placeholder:"Nhập từ...",className:r.isExample?"bg-amber-50":"border-gray-200"})]},n))})]})]}),"WITH_OPTIONS"===b&&t(o,{className:"overflow-hidden border-0 bg-white shadow-lg shadow-teal-100/50",children:[e("div",{className:"h-1 bg-gradient-to-r from-teal-400 to-cyan-400"}),e(c,{className:"px-4 py-3",children:t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-teal-100",children:e(a,{className:"h-3.5 w-3.5 text-teal-600"})}),t(h,{className:"text-base font-semibold text-gray-800",children:["Lựa chọn theo chỗ trống (",v.length,")"]})]})}),e(d,{className:"space-y-4 px-4 pb-4",children:0===v.length?t("p",{className:"rounded-lg border-2 border-dashed border-gray-200 p-6 text-center text-sm text-gray-500",children:["Chưa có chỗ trống. Thêm ","{0}",", ","{1}","… trong nội dung trước."]}):v.map((n,a)=>{const o=y[a]??null,d=null==o,c=k[n]||"";return t("div",{className:"rounded-xl border-2 p-4 "+(d?"border-dashed border-gray-200 bg-gray-50/40":"border-gray-200 bg-white"),children:[t("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[t("div",{className:"flex items-center gap-2",children:[e("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-teal-500 to-cyan-600 text-sm font-bold text-white",children:n}),t("span",{className:"text-sm font-semibold text-gray-700",children:["Chỗ trống ",e("code",{className:"text-teal-700",children:`{${n}}`})]}),c&&t("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700",children:[e(r,{className:"h-3 w-3"}),c]})]}),t("label",{className:"flex items-center gap-2 text-xs text-gray-600",children:[e(m,{checked:d,onCheckedChange:e=>((e,t)=>{const r=[...y];r[e]=t?null:{options:["",""]},w(r)})(a,!0===e)}),"Free-type (không options)"]})]}),!d&&o&&t("div",{className:"space-y-2",children:[o.options.map((r,s)=>t("div",{className:"flex items-center gap-2",children:[e("button",{type:"button",title:"Chọn làm đáp án đúng",onClick:()=>r.trim()&&C(n,r.trim()),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-xs font-bold "+(c===r.trim()&&r.trim()?"bg-green-500 text-white":"bg-gray-100 text-gray-500 hover:bg-green-100 hover:text-green-600"),children:String.fromCharCode(65+s)}),e(g,{value:r,onChange:e=>((e,t,r)=>{const n=[...y],a=n[e];if(null==a)return;const s=[...a.options];s[t]=r,n[e]={options:s},w(n)})(a,s,e.target.value),placeholder:`Lựa chọn ${String.fromCharCode(65+s)}`,className:"flex-1 border-gray-200 text-sm"}),o.options.length>2&&e(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>((e,t)=>{const r=[...y],n=r[e];if(null==n||n.options.length<=2)return;const a=n.options.filter((e,r)=>r!==t);r[e]={options:a},w(r);const s=v[e],l=n.options[t];s&&k[s]===l&&C(s,"")})(a,s),className:"h-8 w-8 p-0 text-red-400 hover:bg-red-50 hover:text-red-600",children:e(l,{className:"h-3.5 w-3.5"})})]},s)),t(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>(e=>{const t=[...y],r=t[e];null!=r&&(t[e]={options:[...r.options,""]},w(t))})(a),className:"mt-1 gap-1 text-xs text-teal-600 hover:bg-teal-50",children:[e(s,{className:"h-3 w-3"}),"Thêm lựa chọn"]})]})]},n)})})]})]})}
|
package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WordFillStructuredFormClientProps } from '../../_shared/types/word-fill-structured-form.type';
|
|
3
|
-
export declare function WordFillStructuredFormClient({ questionData, isReviewMode, userAnswer, onAnswerChange, autoFillCorrectAnswers,
|
|
3
|
+
export declare function WordFillStructuredFormClient({ questionData, isReviewMode, userAnswer, onAnswerChange, autoFillCorrectAnswers, instruction, questionNumber, explanation, }: WordFillStructuredFormClientProps): React.JSX.Element;
|