touchstudy-core 0.1.129 → 0.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Selects/theme/styles.d.ts +1 -0
- package/dist/containers/PreparedTextbook/components/ChapterBlock.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/ChapterBlockBody.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/QuestionGroupBlock.d.ts +1 -1
- package/dist/containers/PreparedTextbook/components/QuestionGroupBlockBody.d.ts +1 -1
- package/dist/containers/PreparedTextbook/configs/functions.d.ts +2 -1
- package/dist/containers/PreparedTextbook/styles/styles.d.ts +6 -0
- package/dist/index.js +156 -75
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +156 -75
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const customStyles: {
|
2
2
|
control: (baseStyles: any, state: any) => any;
|
3
3
|
input: (baseStyles: any, _: any) => any;
|
4
|
+
placeholder: (baseStyles: any, _: any) => any;
|
4
5
|
singleValue: (baseStyles: any) => any;
|
5
6
|
option: (baseStyles: any, state: any) => any;
|
6
7
|
menuPortal: (base: any) => any;
|
@@ -19,7 +19,7 @@ interface Props extends FormikProps<TextbookRequest> {
|
|
19
19
|
onOpenSubCategoryMenu: (path: string, id?: number) => void;
|
20
20
|
onOpenCategoryMenu: (path: string) => void;
|
21
21
|
onCloseCategoryMenu: () => void;
|
22
|
-
onOpenQuestionTypeMenu: (path: string) => void;
|
22
|
+
onOpenQuestionTypeMenu: (path: string, categoryId?: number, subCategoryId?: number) => void;
|
23
23
|
onCloseQuestionTypeMenu: () => void;
|
24
24
|
}
|
25
25
|
declare const ChapterBlock: FC<Props>;
|
@@ -17,7 +17,7 @@ interface Props extends FormikProps<TextbookRequest> {
|
|
17
17
|
onOpenSubCategoryMenu: (path: string, id?: number) => void;
|
18
18
|
onOpenCategoryMenu: (path: string) => void;
|
19
19
|
onCloseCategoryMenu: () => void;
|
20
|
-
onOpenQuestionTypeMenu: (path: string) => void;
|
20
|
+
onOpenQuestionTypeMenu: (path: string, categoryId?: number, subCategoryId?: number) => void;
|
21
21
|
onCloseQuestionTypeMenu: () => void;
|
22
22
|
}
|
23
23
|
declare const ChapterBlockBody: FC<Props>;
|
@@ -21,7 +21,7 @@ interface Props extends FormikProps<TextbookRequest> {
|
|
21
21
|
onOpenCategoryMenu: (path: string) => void;
|
22
22
|
onCloseCategoryMenu: () => void;
|
23
23
|
onCopiedPrevQuestionGroup: (path: string, paths: number[]) => QuestionGroupRequest | undefined;
|
24
|
-
onOpenQuestionTypeMenu: (path: string) => void;
|
24
|
+
onOpenQuestionTypeMenu: (path: string, categoryId?: number, subCategoryId?: number) => void;
|
25
25
|
onCloseQuestionTypeMenu: () => void;
|
26
26
|
}
|
27
27
|
declare const QuestionGroupBlock: FC<Props>;
|
@@ -15,7 +15,7 @@ interface Props extends FormikProps<TextbookRequest> {
|
|
15
15
|
onOpenSubCategoryMenu: (path: string, id?: number) => void;
|
16
16
|
onOpenCategoryMenu: (path: string) => void;
|
17
17
|
onCloseCategoryMenu: () => void;
|
18
|
-
onOpenQuestionTypeMenu: (path: string) => void;
|
18
|
+
onOpenQuestionTypeMenu: (path: string, categoryId?: number, subCategoryId?: number) => void;
|
19
19
|
onCloseQuestionTypeMenu: () => void;
|
20
20
|
}
|
21
21
|
declare const _default: React.NamedExoticComponent<Props>;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { TextbookDetailResponse } from "./types";
|
2
|
-
export declare const reduceToMathArticles: (textbook: any, isMath
|
2
|
+
export declare const reduceToMathArticles: (textbook: any, isMath?: number | undefined) => any;
|
3
|
+
export declare const resetAllCrategoriesAndQuestionTypesBySubject: (textbook: any, subject?: any) => any;
|
3
4
|
export declare const convertResponseToRequest: (selectedTextbook?: TextbookDetailResponse | undefined) => import("./types").TextbookRequest;
|
package/dist/index.js
CHANGED
@@ -1418,6 +1418,13 @@ var category_copy = "카테고리 복사";
|
|
1418
1418
|
var copy_items = "항목 복사";
|
1419
1419
|
var number_questions = "문제 {{n}}개";
|
1420
1420
|
var are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved = "정말로 종료하시겠습니까? 변경 사항이 저장되지 않을 수 있습니다!";
|
1421
|
+
var this_is_a_subjective_question = "주관식 문제입니다.";
|
1422
|
+
var click_here_to_enter_your_answer = "여기를 눌러 입력해주세요.";
|
1423
|
+
var subjective_answer = "주관식 정답";
|
1424
|
+
var current_correct_answer_entered = "현재 입력한 정답";
|
1425
|
+
var correct_answer_is_required = "정답은 필수입니다.";
|
1426
|
+
var cancel_2 = "취소하기";
|
1427
|
+
var article_required = "기사가 필요합니다";
|
1421
1428
|
var lang_ko = {
|
1422
1429
|
problem_solving: problem_solving,
|
1423
1430
|
my_story: my_story,
|
@@ -2471,7 +2478,14 @@ var lang_ko = {
|
|
2471
2478
|
category_copy: category_copy,
|
2472
2479
|
copy_items: copy_items,
|
2473
2480
|
number_questions: number_questions,
|
2474
|
-
are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved: are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved
|
2481
|
+
are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved: are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved,
|
2482
|
+
this_is_a_subjective_question: this_is_a_subjective_question,
|
2483
|
+
click_here_to_enter_your_answer: click_here_to_enter_your_answer,
|
2484
|
+
subjective_answer: subjective_answer,
|
2485
|
+
current_correct_answer_entered: current_correct_answer_entered,
|
2486
|
+
correct_answer_is_required: correct_answer_is_required,
|
2487
|
+
cancel_2: cancel_2,
|
2488
|
+
article_required: article_required
|
2475
2489
|
};
|
2476
2490
|
|
2477
2491
|
var problem_solving$1 = "Problem Solving";
|
@@ -3548,6 +3562,13 @@ var category_copy$1 = "Category copy";
|
|
3548
3562
|
var copy_items$1 = "Copy items";
|
3549
3563
|
var number_questions$1 = "{{n}} question(s)";
|
3550
3564
|
var are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved$1 = "Are you sure you want to quit? Your changes may not be saved!";
|
3565
|
+
var this_is_a_subjective_question$1 = "This is a subjective question.";
|
3566
|
+
var click_here_to_enter_your_answer$1 = "Click here to enter your answer.";
|
3567
|
+
var subjective_answer$1 = "Subjective answer";
|
3568
|
+
var current_correct_answer_entered$1 = "Current correct answer entered";
|
3569
|
+
var correct_answer_is_required$1 = "Correct answer is required";
|
3570
|
+
var cancel_2$1 = "Cancel";
|
3571
|
+
var article_required$1 = "Article is required";
|
3551
3572
|
var lang_en = {
|
3552
3573
|
problem_solving: problem_solving$1,
|
3553
3574
|
my_story: my_story$1,
|
@@ -4603,7 +4624,14 @@ var lang_en = {
|
|
4603
4624
|
category_copy: category_copy$1,
|
4604
4625
|
copy_items: copy_items$1,
|
4605
4626
|
number_questions: number_questions$1,
|
4606
|
-
are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved: are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved$1
|
4627
|
+
are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved: are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved$1,
|
4628
|
+
this_is_a_subjective_question: this_is_a_subjective_question$1,
|
4629
|
+
click_here_to_enter_your_answer: click_here_to_enter_your_answer$1,
|
4630
|
+
subjective_answer: subjective_answer$1,
|
4631
|
+
current_correct_answer_entered: current_correct_answer_entered$1,
|
4632
|
+
correct_answer_is_required: correct_answer_is_required$1,
|
4633
|
+
cancel_2: cancel_2$1,
|
4634
|
+
article_required: article_required$1
|
4607
4635
|
};
|
4608
4636
|
|
4609
4637
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -5948,6 +5976,11 @@ var customStyles = {
|
|
5948
5976
|
color: styles.darker
|
5949
5977
|
});
|
5950
5978
|
},
|
5979
|
+
placeholder: function placeholder(baseStyles, _) {
|
5980
|
+
return _extends({}, baseStyles, {
|
5981
|
+
whiteSpace: "nowrap"
|
5982
|
+
});
|
5983
|
+
},
|
5951
5984
|
singleValue: function singleValue(baseStyles) {
|
5952
5985
|
return _extends({}, baseStyles, {
|
5953
5986
|
fontSize: "14px",
|
@@ -5965,7 +5998,7 @@ var customStyles = {
|
|
5965
5998
|
},
|
5966
5999
|
menuPortal: function menuPortal(base) {
|
5967
6000
|
return _extends({}, base, {
|
5968
|
-
zIndex:
|
6001
|
+
zIndex: 99
|
5969
6002
|
});
|
5970
6003
|
}
|
5971
6004
|
};
|
@@ -9459,7 +9492,7 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9459
9492
|
onChange(textFilter);
|
9460
9493
|
};
|
9461
9494
|
var options = {
|
9462
|
-
height:
|
9495
|
+
height: 130,
|
9463
9496
|
menubar: false,
|
9464
9497
|
external_plugins: {
|
9465
9498
|
tiny_mce_wiris: '/editor/wiris-for-tinymce.js'
|
@@ -27421,7 +27454,7 @@ var DEFAULT_SCORE$1 = 2;
|
|
27421
27454
|
var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
27422
27455
|
return yup.object({
|
27423
27456
|
name: yup.string().required(t("name_required")),
|
27424
|
-
subjectId: yup.number().required(t("subject_required")),
|
27457
|
+
subjectId: yup.number().required(t("subject_required")).notOneOf([0], t("subject_required")),
|
27425
27458
|
preparedType: yup.string().required(t("type_required")),
|
27426
27459
|
publicationDate: yup.string().required(t("publication_date_required")),
|
27427
27460
|
publisher: yup.string().required(t("publisher_required")),
|
@@ -27448,6 +27481,9 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27448
27481
|
},
|
27449
27482
|
then: function then(schema) {
|
27450
27483
|
return schema.min(1, t("category_required"));
|
27484
|
+
},
|
27485
|
+
otherwise: function otherwise(schema) {
|
27486
|
+
return schema.min(1, t("article_required"));
|
27451
27487
|
}
|
27452
27488
|
}),
|
27453
27489
|
questions: yup.array().of(yup.object())
|
@@ -27462,11 +27498,21 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27462
27498
|
name: yup.string().required(t("name_required")),
|
27463
27499
|
questionGroups: yup.array().of(yup.object().shape({
|
27464
27500
|
articles: yup.array().of(yup.object().shape({
|
27465
|
-
categories: yup.array().of(yup.number()).min(1, t("
|
27501
|
+
categories: yup.array().of(yup.number()).min(1, t("category_required")),
|
27466
27502
|
title: yup.string().notRequired(),
|
27467
27503
|
author: yup.string().notRequired(),
|
27468
27504
|
subject: yup.string().notRequired()
|
27469
|
-
})),
|
27505
|
+
})).when("$type", {
|
27506
|
+
is: function is(type) {
|
27507
|
+
return type === 2;
|
27508
|
+
},
|
27509
|
+
then: function then(schema) {
|
27510
|
+
return schema.min(1, t("category_required"));
|
27511
|
+
},
|
27512
|
+
otherwise: function otherwise(schema) {
|
27513
|
+
return schema.min(1, t("article_required"));
|
27514
|
+
}
|
27515
|
+
}),
|
27470
27516
|
questions: yup.array().of(yup.object())
|
27471
27517
|
}))
|
27472
27518
|
}))
|
@@ -27702,6 +27748,14 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27702
27748
|
var handleOpenCategoryMenu = function handleOpenCategoryMenu() {
|
27703
27749
|
onOpenCategoryMenu(path + ".categories[0]");
|
27704
27750
|
};
|
27751
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
27752
|
+
setFieldValue(path + ".categoryOptions", [val]);
|
27753
|
+
setFieldValue(path + ".categories", [val === null || val === void 0 ? void 0 : val.value]);
|
27754
|
+
};
|
27755
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
27756
|
+
setFieldValue(path + ".categoryOptions[1]", [val]);
|
27757
|
+
setFieldValue(path + ".categories[1]", [val === null || val === void 0 ? void 0 : val.value]);
|
27758
|
+
};
|
27705
27759
|
return React__default.createElement(material.Stack, {
|
27706
27760
|
direction: "row",
|
27707
27761
|
alignItems: "center",
|
@@ -27768,10 +27822,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27768
27822
|
onMenuOpen: handleOpenCategoryMenu,
|
27769
27823
|
onMenuClose: onCloseCategoryMenu
|
27770
27824
|
},
|
27771
|
-
onChange:
|
27772
|
-
setFieldValue(path + ".categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
27773
|
-
setFieldValue(path + ".categoryOptions[0]", val);
|
27774
|
-
},
|
27825
|
+
onChange: handleChangeCategory,
|
27775
27826
|
placeholder: t("select_category")
|
27776
27827
|
});
|
27777
27828
|
}
|
@@ -27808,10 +27859,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27808
27859
|
onMenuOpen: handleOpenSubCategoryMenu,
|
27809
27860
|
onMenuClose: onCloseCategoryMenu
|
27810
27861
|
},
|
27811
|
-
onChange:
|
27812
|
-
setFieldValue(path + ".categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
27813
|
-
setFieldValue(path + ".categoryOptions[1]", val);
|
27814
|
-
},
|
27862
|
+
onChange: handleChangeSubCategory,
|
27815
27863
|
isDisabled: !data.categories[0],
|
27816
27864
|
placeholder: t("select_category")
|
27817
27865
|
});
|
@@ -27907,15 +27955,14 @@ var ArticleBlock$1 = React.memo(ArticleBlock, isEqual);
|
|
27907
27955
|
|
27908
27956
|
var styles$9 = {"question":"_1_ONI","question-article":"_2FdrR","question-title":"_3mgRf","question-label":"_2h0kA","question-input":"_exAl-","question-btn":"_2ksp8"};
|
27909
27957
|
|
27958
|
+
var labelStyle = {
|
27959
|
+
textOverflow: "ellipsis",
|
27960
|
+
overflowX: "hidden",
|
27961
|
+
width: "100%",
|
27962
|
+
whiteSpace: "nowrap"
|
27963
|
+
};
|
27964
|
+
|
27910
27965
|
var _excluded$e = ["onChange"];
|
27911
|
-
var answerTypeOptions = Object.keys(exports.QuestionAnswerType).filter(function (key) {
|
27912
|
-
return Number.isNaN(+key);
|
27913
|
-
}).map(function (label, index) {
|
27914
|
-
return {
|
27915
|
-
label: i18n.t(label.toLowerCase()),
|
27916
|
-
value: index
|
27917
|
-
};
|
27918
|
-
});
|
27919
27966
|
var BpIcon$1 = material.styled("span")(function (_ref) {
|
27920
27967
|
var theme = _ref.theme;
|
27921
27968
|
return {
|
@@ -27986,13 +28033,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
27986
28033
|
}, React__default.createElement(material.FormLabel, {
|
27987
28034
|
htmlFor: "textual_answer",
|
27988
28035
|
className: styles$9["question-label"] + " form-label"
|
27989
|
-
},
|
28036
|
+
}, t("textual_answer")), React__default.createElement(formik.Field, {
|
27990
28037
|
name: path + ".textualAnswer",
|
27991
28038
|
render: function render(_ref3) {
|
27992
28039
|
var field = _ref3.field;
|
27993
28040
|
return React__default.createElement(material.TextField, Object.assign({}, field, {
|
27994
28041
|
size: "small",
|
27995
|
-
placeholder:
|
28042
|
+
placeholder: t("textual_answer")
|
27996
28043
|
}));
|
27997
28044
|
}
|
27998
28045
|
}));
|
@@ -28018,7 +28065,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28018
28065
|
return handleCheckMultiChoice(+e.target.value);
|
28019
28066
|
}
|
28020
28067
|
}),
|
28021
|
-
label:
|
28068
|
+
label: t("number_question", {
|
28022
28069
|
number: i
|
28023
28070
|
})
|
28024
28071
|
});
|
@@ -28054,7 +28101,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28054
28101
|
checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
|
28055
28102
|
icon: React__default.createElement(BpIcon$1, null)
|
28056
28103
|
}),
|
28057
|
-
label:
|
28104
|
+
label: t("number_question", {
|
28058
28105
|
number: i
|
28059
28106
|
})
|
28060
28107
|
});
|
@@ -28063,10 +28110,27 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28063
28110
|
return null;
|
28064
28111
|
}
|
28065
28112
|
};
|
28066
|
-
|
28067
|
-
|
28068
|
-
|
28113
|
+
var handleChangeQuestionType = function handleChangeQuestionType(val) {
|
28114
|
+
if (typeof (val === null || val === void 0 ? void 0 : val.value) === "string") {
|
28115
|
+
setFieldValue(path + ".questionTypeId", 0);
|
28116
|
+
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28117
|
+
} else {
|
28118
|
+
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28119
|
+
}
|
28120
|
+
setFieldValue(path + ".questionType", val);
|
28121
|
+
};
|
28122
|
+
var _useTranslation = reactI18next.useTranslation(),
|
28123
|
+
t = _useTranslation.t;
|
28124
|
+
var answerTypeOptions = Object.keys(exports.QuestionAnswerType).filter(function (key) {
|
28125
|
+
return Number.isNaN(+key);
|
28126
|
+
}).map(function (label, index) {
|
28127
|
+
return {
|
28128
|
+
label: t(label.toLowerCase()),
|
28129
|
+
value: index
|
28130
|
+
};
|
28069
28131
|
});
|
28132
|
+
var theme = material.useTheme();
|
28133
|
+
var isTabletUp = material.useMediaQuery(theme.breakpoints.up('lg'));
|
28070
28134
|
return React__default.createElement(material.Stack, {
|
28071
28135
|
direction: "row",
|
28072
28136
|
alignItems: "center",
|
@@ -28075,11 +28139,12 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28075
28139
|
}, React__default.createElement(material.Stack, {
|
28076
28140
|
direction: "row",
|
28077
28141
|
alignItems: "center",
|
28142
|
+
minWidth: "50%",
|
28078
28143
|
flexGrow: 1
|
28079
28144
|
}, React__default.createElement(material.Box, null, React__default.createElement(material.Box, {
|
28080
28145
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28081
28146
|
sx: questionTitleStyle
|
28082
|
-
},
|
28147
|
+
}, t("problem_number_question", {
|
28083
28148
|
number: data.questionOrder + 1
|
28084
28149
|
}))), React__default.createElement(material.Box, {
|
28085
28150
|
flexGrow: 1
|
@@ -28089,12 +28154,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28089
28154
|
}, React__default.createElement(material.FormControl, {
|
28090
28155
|
sx: {
|
28091
28156
|
flexGrow: 1,
|
28092
|
-
width: "
|
28157
|
+
width: isTabletUp ? "120px" : "100px"
|
28093
28158
|
}
|
28094
28159
|
}, React__default.createElement(material.FormLabel, {
|
28095
28160
|
htmlFor: "score",
|
28096
|
-
className: styles$9["question-label"] + " form-label"
|
28097
|
-
|
28161
|
+
className: styles$9["question-label"] + " form-label",
|
28162
|
+
sx: labelStyle
|
28163
|
+
}, t("score")), React__default.createElement(formik.Field, {
|
28098
28164
|
name: path + ".score",
|
28099
28165
|
render: function render(_ref4) {
|
28100
28166
|
var field = _ref4.field;
|
@@ -28108,12 +28174,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28108
28174
|
})), isMath && React__default.createElement(material.FormGroup, {
|
28109
28175
|
sx: {
|
28110
28176
|
flexGrow: 1,
|
28111
|
-
width: "
|
28177
|
+
width: isTabletUp ? "180px" : "120px"
|
28112
28178
|
}
|
28113
28179
|
}, React__default.createElement(material.FormLabel, {
|
28114
28180
|
htmlFor: "type",
|
28115
|
-
className: styles$9["question-label"] + " form-label"
|
28116
|
-
|
28181
|
+
className: styles$9["question-label"] + " form-label",
|
28182
|
+
sx: labelStyle
|
28183
|
+
}, t("type")), React__default.createElement(formik.Field, {
|
28117
28184
|
name: path + ".questionTypeId",
|
28118
28185
|
render: function render(_ref5) {
|
28119
28186
|
var _ref5$field = _ref5.field,
|
@@ -28125,26 +28192,20 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28125
28192
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
28126
28193
|
onMenuOpen: handleOpenQuestionTypeMenu,
|
28127
28194
|
onMenuClose: onCloseQuestionTypeMenu,
|
28128
|
-
onChange:
|
28129
|
-
|
28130
|
-
setFieldValue(path + ".questionTypeId", 0);
|
28131
|
-
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28132
|
-
} else {
|
28133
|
-
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28134
|
-
}
|
28135
|
-
setFieldValue(path + ".questionType", val);
|
28136
|
-
}
|
28195
|
+
onChange: handleChangeQuestionType,
|
28196
|
+
isClearable: true
|
28137
28197
|
}));
|
28138
28198
|
}
|
28139
28199
|
})), React__default.createElement(material.FormGroup, {
|
28140
28200
|
sx: {
|
28141
28201
|
flexGrow: 1,
|
28142
|
-
width: "
|
28202
|
+
width: isTabletUp ? "180px" : "100px"
|
28143
28203
|
}
|
28144
28204
|
}, React__default.createElement(material.FormLabel, {
|
28145
28205
|
htmlFor: "question_answer_type",
|
28146
|
-
className: styles$9["question-label"] + " form-label"
|
28147
|
-
|
28206
|
+
className: styles$9["question-label"] + " form-label",
|
28207
|
+
sx: labelStyle
|
28208
|
+
}, t("question_answer_type")), React__default.createElement(formik.Field, {
|
28148
28209
|
name: path + ".questionAnswerType",
|
28149
28210
|
render: function render(_ref6) {
|
28150
28211
|
var field = _ref6.field;
|
@@ -28172,6 +28233,7 @@ var QuestionBlock$1 = React.memo(QuestionBlock, isEqual$1);
|
|
28172
28233
|
|
28173
28234
|
var _excluded$f = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28174
28235
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28236
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
28175
28237
|
var data = _ref.data,
|
28176
28238
|
path = _ref.path,
|
28177
28239
|
isMath = _ref.isMath,
|
@@ -28192,6 +28254,10 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28192
28254
|
var articles = data.articles,
|
28193
28255
|
questions = data.questions;
|
28194
28256
|
var blockErrors = _.get(errors, path);
|
28257
|
+
var handleOpenQuestionTypeMenu = React.useCallback(function (key) {
|
28258
|
+
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
28259
|
+
onOpenQuestionTypeMenu(key, (_data$articles$ = data.articles[0]) === null || _data$articles$ === void 0 ? void 0 : (_data$articles$$categ = _data$articles$.categories) === null || _data$articles$$categ === void 0 ? void 0 : _data$articles$$categ[0], (_data$articles$2 = data.articles[0]) === null || _data$articles$2 === void 0 ? void 0 : (_data$articles$2$cate = _data$articles$2.categories) === null || _data$articles$2$cate === void 0 ? void 0 : _data$articles$2$cate[1]);
|
28260
|
+
}, [(_data$articles$3 = data.articles[0]) === null || _data$articles$3 === void 0 ? void 0 : (_data$articles$3$cate = _data$articles$3.categories) === null || _data$articles$3$cate === void 0 ? void 0 : _data$articles$3$cate[0], (_data$articles$4 = data.articles[0]) === null || _data$articles$4 === void 0 ? void 0 : (_data$articles$4$cate = _data$articles$4.categories) === null || _data$articles$4$cate === void 0 ? void 0 : _data$articles$4$cate[1]]);
|
28195
28261
|
return React__default.createElement(formik.FieldArray, {
|
28196
28262
|
name: path + ".articles",
|
28197
28263
|
render: function render(arrayHelpers) {
|
@@ -28253,7 +28319,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28253
28319
|
questionTypes: questionTypes,
|
28254
28320
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28255
28321
|
optionKey: optionKey,
|
28256
|
-
onOpenQuestionTypeMenu:
|
28322
|
+
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28257
28323
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28258
28324
|
}, formikProps));
|
28259
28325
|
}
|
@@ -28375,6 +28441,14 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28375
28441
|
setFieldValue(path + ".articles[0].categoryOptions", (_questionGroup$articl2 = questionGroup.articles[0]) === null || _questionGroup$articl2 === void 0 ? void 0 : _questionGroup$articl2.categoryOptions);
|
28376
28442
|
}
|
28377
28443
|
};
|
28444
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
28445
|
+
setFieldValue(path + ".articles[0].categoryOptions", [val]);
|
28446
|
+
setFieldValue(path + ".articles[0].categories", [val === null || val === void 0 ? void 0 : val.value]);
|
28447
|
+
};
|
28448
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
28449
|
+
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28450
|
+
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28451
|
+
};
|
28378
28452
|
var summary = open ? "" : [t("number_questions", {
|
28379
28453
|
n: data.questionCount
|
28380
28454
|
}), (_data$articles$2 = data.articles[0]) === null || _data$articles$2 === void 0 ? void 0 : (_data$articles$2$cate = _data$articles$2.categoryOptions) === null || _data$articles$2$cate === void 0 ? void 0 : (_data$articles$2$cate2 = _data$articles$2$cate[0]) === null || _data$articles$2$cate2 === void 0 ? void 0 : _data$articles$2$cate2.label, (_data$articles$3 = data.articles[0]) === null || _data$articles$3 === void 0 ? void 0 : (_data$articles$3$cate = _data$articles$3.categoryOptions) === null || _data$articles$3$cate === void 0 ? void 0 : (_data$articles$3$cate2 = _data$articles$3$cate[1]) === null || _data$articles$3$cate2 === void 0 ? void 0 : _data$articles$3$cate2.label, isMath ? data.questions.map(function (i) {
|
@@ -28487,10 +28561,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28487
28561
|
onMenuOpen: handleOpenCategoryMenu,
|
28488
28562
|
onMenuClose: onCloseCategoryMenu
|
28489
28563
|
},
|
28490
|
-
onChange:
|
28491
|
-
setFieldValue(path + ".articles[0].categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
28492
|
-
setFieldValue(path + ".articles[0].categoryOptions[0]", val);
|
28493
|
-
},
|
28564
|
+
onChange: handleChangeCategory,
|
28494
28565
|
placeholder: t("select_category")
|
28495
28566
|
});
|
28496
28567
|
}
|
@@ -28525,14 +28596,12 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28525
28596
|
optionValue: field.value,
|
28526
28597
|
options: categories,
|
28527
28598
|
rest: {
|
28599
|
+
isClearable: true,
|
28528
28600
|
isLoading: optionKey === path + ".articles[0].categories[1]" ? isLoadingCategories : false,
|
28529
28601
|
onMenuOpen: handleOpenSubCategoryMenu,
|
28530
28602
|
onMenuClose: onCloseCategoryMenu
|
28531
28603
|
},
|
28532
|
-
onChange:
|
28533
|
-
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28534
|
-
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28535
|
-
},
|
28604
|
+
onChange: handleChangeSubCategory,
|
28536
28605
|
isDisabled: isDisabled || !((_data$articles$4 = data.articles[0]) !== null && _data$articles$4 !== void 0 && (_data$articles$4$cate = _data$articles$4.categories) !== null && _data$articles$4$cate !== void 0 && _data$articles$4$cate[0]),
|
28537
28606
|
placeholder: t("select_category")
|
28538
28607
|
});
|
@@ -28822,7 +28891,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
28822
28891
|
e.stopPropagation();
|
28823
28892
|
onDelete("" + t("are_you_sure_you_want_to_delete_the_chapter", {
|
28824
28893
|
chapter: title
|
28825
|
-
}), title, path.replace(/\[(\d+)\]$/,
|
28894
|
+
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
28826
28895
|
};
|
28827
28896
|
var pageNameError = _.get(errors, path + ".name");
|
28828
28897
|
var pageFromError = _.get(errors, path + ".pageFrom");
|
@@ -29265,8 +29334,8 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29265
29334
|
var questionTypeFilters = getOptionFilter();
|
29266
29335
|
return Promise.resolve(getQuestionTypesApi(isSuperAdmin, _extends({}, questionTypeFilters, {
|
29267
29336
|
subjectId: subjectId,
|
29268
|
-
|
29269
|
-
|
29337
|
+
parentCategoryId: subCategoryId,
|
29338
|
+
rootParentCategoryId: categoryId,
|
29270
29339
|
textSearch: (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.value
|
29271
29340
|
}))).then(function (res) {
|
29272
29341
|
setQuestionTypes(res.data.items.map(function (i) {
|
@@ -30060,19 +30129,35 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30060
30129
|
}));
|
30061
30130
|
};
|
30062
30131
|
|
30063
|
-
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath
|
30064
|
-
|
30065
|
-
|
30066
|
-
}
|
30067
|
-
var values = isInit ? _.cloneDeep(textbook) : textbook;
|
30068
|
-
if (isInit) values.type = isMath;
|
30132
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
30133
|
+
var values = isMath !== undefined ? _.cloneDeep(textbook) : textbook;
|
30134
|
+
if (isMath !== undefined) values.type = isMath;
|
30069
30135
|
for (var key in values) {
|
30070
30136
|
if (values.hasOwnProperty(key)) {
|
30071
30137
|
if (key === "articles") {
|
30072
30138
|
var _values$key;
|
30073
30139
|
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30074
30140
|
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30075
|
-
_reduceToMathArticles(values[key]
|
30141
|
+
_reduceToMathArticles(values[key]);
|
30142
|
+
}
|
30143
|
+
}
|
30144
|
+
}
|
30145
|
+
return values;
|
30146
|
+
};
|
30147
|
+
var _resetAllCrategoriesAndQuestionTypesBySubject = function resetAllCrategoriesAndQuestionTypesBySubject(textbook, subject) {
|
30148
|
+
var values = subject ? _.cloneDeep(textbook) : textbook;
|
30149
|
+
if (subject) {
|
30150
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
30151
|
+
values.subject = subject;
|
30152
|
+
}
|
30153
|
+
for (var key in values) {
|
30154
|
+
if (values.hasOwnProperty(key)) {
|
30155
|
+
if (key === "categories" || key === "categoryOptions") {
|
30156
|
+
values[key] = [];
|
30157
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
30158
|
+
values[key] = null;
|
30159
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30160
|
+
_resetAllCrategoriesAndQuestionTypesBySubject(values[key]);
|
30076
30161
|
}
|
30077
30162
|
}
|
30078
30163
|
}
|
@@ -30201,8 +30286,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30201
30286
|
errors = formikProps.errors,
|
30202
30287
|
dirty = formikProps.dirty,
|
30203
30288
|
submitCount = formikProps.submitCount,
|
30204
|
-
setValues = formikProps.setValues
|
30205
|
-
setFieldValue = formikProps.setFieldValue;
|
30289
|
+
setValues = formikProps.setValues;
|
30206
30290
|
React.useEffect(function () {
|
30207
30291
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
30208
30292
|
var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -30220,8 +30304,8 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30220
30304
|
setValues(newValues);
|
30221
30305
|
};
|
30222
30306
|
var handleChangeSubject = function handleChangeSubject(val) {
|
30223
|
-
|
30224
|
-
|
30307
|
+
var newValues = _resetAllCrategoriesAndQuestionTypesBySubject(values, val);
|
30308
|
+
setValues(newValues);
|
30225
30309
|
};
|
30226
30310
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
30227
30311
|
var contentsErrors = errors.chapters;
|
@@ -30306,9 +30390,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30306
30390
|
},
|
30307
30391
|
variant: "contained",
|
30308
30392
|
onClick: function onClick() {
|
30309
|
-
console.log({
|
30310
|
-
errors: errors
|
30311
|
-
});
|
30312
30393
|
if (!_.isEmpty(errors)) {
|
30313
30394
|
reactToastify.toast.error(i18n.t("please_fill_in_the_blank_fields"));
|
30314
30395
|
}
|