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
package/dist/index.modern.js
CHANGED
@@ -1420,6 +1420,13 @@ var category_copy = "카테고리 복사";
|
|
1420
1420
|
var copy_items = "항목 복사";
|
1421
1421
|
var number_questions = "문제 {{n}}개";
|
1422
1422
|
var are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved = "정말로 종료하시겠습니까? 변경 사항이 저장되지 않을 수 있습니다!";
|
1423
|
+
var this_is_a_subjective_question = "주관식 문제입니다.";
|
1424
|
+
var click_here_to_enter_your_answer = "여기를 눌러 입력해주세요.";
|
1425
|
+
var subjective_answer = "주관식 정답";
|
1426
|
+
var current_correct_answer_entered = "현재 입력한 정답";
|
1427
|
+
var correct_answer_is_required = "정답은 필수입니다.";
|
1428
|
+
var cancel_2 = "취소하기";
|
1429
|
+
var article_required = "기사가 필요합니다";
|
1423
1430
|
var lang_ko = {
|
1424
1431
|
problem_solving: problem_solving,
|
1425
1432
|
my_story: my_story,
|
@@ -2473,7 +2480,14 @@ var lang_ko = {
|
|
2473
2480
|
category_copy: category_copy,
|
2474
2481
|
copy_items: copy_items,
|
2475
2482
|
number_questions: number_questions,
|
2476
|
-
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
|
2483
|
+
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,
|
2484
|
+
this_is_a_subjective_question: this_is_a_subjective_question,
|
2485
|
+
click_here_to_enter_your_answer: click_here_to_enter_your_answer,
|
2486
|
+
subjective_answer: subjective_answer,
|
2487
|
+
current_correct_answer_entered: current_correct_answer_entered,
|
2488
|
+
correct_answer_is_required: correct_answer_is_required,
|
2489
|
+
cancel_2: cancel_2,
|
2490
|
+
article_required: article_required
|
2477
2491
|
};
|
2478
2492
|
|
2479
2493
|
var problem_solving$1 = "Problem Solving";
|
@@ -3550,6 +3564,13 @@ var category_copy$1 = "Category copy";
|
|
3550
3564
|
var copy_items$1 = "Copy items";
|
3551
3565
|
var number_questions$1 = "{{n}} question(s)";
|
3552
3566
|
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!";
|
3567
|
+
var this_is_a_subjective_question$1 = "This is a subjective question.";
|
3568
|
+
var click_here_to_enter_your_answer$1 = "Click here to enter your answer.";
|
3569
|
+
var subjective_answer$1 = "Subjective answer";
|
3570
|
+
var current_correct_answer_entered$1 = "Current correct answer entered";
|
3571
|
+
var correct_answer_is_required$1 = "Correct answer is required";
|
3572
|
+
var cancel_2$1 = "Cancel";
|
3573
|
+
var article_required$1 = "Article is required";
|
3553
3574
|
var lang_en = {
|
3554
3575
|
problem_solving: problem_solving$1,
|
3555
3576
|
my_story: my_story$1,
|
@@ -4605,7 +4626,14 @@ var lang_en = {
|
|
4605
4626
|
category_copy: category_copy$1,
|
4606
4627
|
copy_items: copy_items$1,
|
4607
4628
|
number_questions: number_questions$1,
|
4608
|
-
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
|
4629
|
+
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,
|
4630
|
+
this_is_a_subjective_question: this_is_a_subjective_question$1,
|
4631
|
+
click_here_to_enter_your_answer: click_here_to_enter_your_answer$1,
|
4632
|
+
subjective_answer: subjective_answer$1,
|
4633
|
+
current_correct_answer_entered: current_correct_answer_entered$1,
|
4634
|
+
correct_answer_is_required: correct_answer_is_required$1,
|
4635
|
+
cancel_2: cancel_2$1,
|
4636
|
+
article_required: article_required$1
|
4609
4637
|
};
|
4610
4638
|
|
4611
4639
|
i18n.use(initReactI18next).init({
|
@@ -5952,6 +5980,11 @@ var customStyles = {
|
|
5952
5980
|
color: styles.darker
|
5953
5981
|
});
|
5954
5982
|
},
|
5983
|
+
placeholder: function placeholder(baseStyles, _) {
|
5984
|
+
return _extends({}, baseStyles, {
|
5985
|
+
whiteSpace: "nowrap"
|
5986
|
+
});
|
5987
|
+
},
|
5955
5988
|
singleValue: function singleValue(baseStyles) {
|
5956
5989
|
return _extends({}, baseStyles, {
|
5957
5990
|
fontSize: "14px",
|
@@ -5969,7 +6002,7 @@ var customStyles = {
|
|
5969
6002
|
},
|
5970
6003
|
menuPortal: function menuPortal(base) {
|
5971
6004
|
return _extends({}, base, {
|
5972
|
-
zIndex:
|
6005
|
+
zIndex: 99
|
5973
6006
|
});
|
5974
6007
|
}
|
5975
6008
|
};
|
@@ -9472,7 +9505,7 @@ var MathTinyEditor = function MathTinyEditor(_ref) {
|
|
9472
9505
|
onChange(textFilter);
|
9473
9506
|
};
|
9474
9507
|
var options = {
|
9475
|
-
height:
|
9508
|
+
height: 130,
|
9476
9509
|
menubar: false,
|
9477
9510
|
external_plugins: {
|
9478
9511
|
tiny_mce_wiris: '/editor/wiris-for-tinymce.js'
|
@@ -27434,7 +27467,7 @@ var DEFAULT_SCORE$1 = 2;
|
|
27434
27467
|
var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
27435
27468
|
return object({
|
27436
27469
|
name: string().required(t("name_required")),
|
27437
|
-
subjectId: number().required(t("subject_required")),
|
27470
|
+
subjectId: number().required(t("subject_required")).notOneOf([0], t("subject_required")),
|
27438
27471
|
preparedType: string().required(t("type_required")),
|
27439
27472
|
publicationDate: string().required(t("publication_date_required")),
|
27440
27473
|
publisher: string().required(t("publisher_required")),
|
@@ -27461,6 +27494,9 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27461
27494
|
},
|
27462
27495
|
then: function then(schema) {
|
27463
27496
|
return schema.min(1, t("category_required"));
|
27497
|
+
},
|
27498
|
+
otherwise: function otherwise(schema) {
|
27499
|
+
return schema.min(1, t("article_required"));
|
27464
27500
|
}
|
27465
27501
|
}),
|
27466
27502
|
questions: array().of(object())
|
@@ -27475,11 +27511,21 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27475
27511
|
name: string().required(t("name_required")),
|
27476
27512
|
questionGroups: array().of(object().shape({
|
27477
27513
|
articles: array().of(object().shape({
|
27478
|
-
categories: array().of(number()).min(1, t("
|
27514
|
+
categories: array().of(number()).min(1, t("category_required")),
|
27479
27515
|
title: string().notRequired(),
|
27480
27516
|
author: string().notRequired(),
|
27481
27517
|
subject: string().notRequired()
|
27482
|
-
})),
|
27518
|
+
})).when("$type", {
|
27519
|
+
is: function is(type) {
|
27520
|
+
return type === 2;
|
27521
|
+
},
|
27522
|
+
then: function then(schema) {
|
27523
|
+
return schema.min(1, t("category_required"));
|
27524
|
+
},
|
27525
|
+
otherwise: function otherwise(schema) {
|
27526
|
+
return schema.min(1, t("article_required"));
|
27527
|
+
}
|
27528
|
+
}),
|
27483
27529
|
questions: array().of(object())
|
27484
27530
|
}))
|
27485
27531
|
}))
|
@@ -27715,6 +27761,14 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27715
27761
|
var handleOpenCategoryMenu = function handleOpenCategoryMenu() {
|
27716
27762
|
onOpenCategoryMenu(path + ".categories[0]");
|
27717
27763
|
};
|
27764
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
27765
|
+
setFieldValue(path + ".categoryOptions", [val]);
|
27766
|
+
setFieldValue(path + ".categories", [val === null || val === void 0 ? void 0 : val.value]);
|
27767
|
+
};
|
27768
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
27769
|
+
setFieldValue(path + ".categoryOptions[1]", [val]);
|
27770
|
+
setFieldValue(path + ".categories[1]", [val === null || val === void 0 ? void 0 : val.value]);
|
27771
|
+
};
|
27718
27772
|
return React__default.createElement(Stack, {
|
27719
27773
|
direction: "row",
|
27720
27774
|
alignItems: "center",
|
@@ -27781,10 +27835,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27781
27835
|
onMenuOpen: handleOpenCategoryMenu,
|
27782
27836
|
onMenuClose: onCloseCategoryMenu
|
27783
27837
|
},
|
27784
|
-
onChange:
|
27785
|
-
setFieldValue(path + ".categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
27786
|
-
setFieldValue(path + ".categoryOptions[0]", val);
|
27787
|
-
},
|
27838
|
+
onChange: handleChangeCategory,
|
27788
27839
|
placeholder: t("select_category")
|
27789
27840
|
});
|
27790
27841
|
}
|
@@ -27821,10 +27872,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27821
27872
|
onMenuOpen: handleOpenSubCategoryMenu,
|
27822
27873
|
onMenuClose: onCloseCategoryMenu
|
27823
27874
|
},
|
27824
|
-
onChange:
|
27825
|
-
setFieldValue(path + ".categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
27826
|
-
setFieldValue(path + ".categoryOptions[1]", val);
|
27827
|
-
},
|
27875
|
+
onChange: handleChangeSubCategory,
|
27828
27876
|
isDisabled: !data.categories[0],
|
27829
27877
|
placeholder: t("select_category")
|
27830
27878
|
});
|
@@ -27920,15 +27968,14 @@ var ArticleBlock$1 = memo(ArticleBlock, isEqual);
|
|
27920
27968
|
|
27921
27969
|
var styles$9 = {"question":"_1_ONI","question-article":"_2FdrR","question-title":"_3mgRf","question-label":"_2h0kA","question-input":"_exAl-","question-btn":"_2ksp8"};
|
27922
27970
|
|
27971
|
+
var labelStyle = {
|
27972
|
+
textOverflow: "ellipsis",
|
27973
|
+
overflowX: "hidden",
|
27974
|
+
width: "100%",
|
27975
|
+
whiteSpace: "nowrap"
|
27976
|
+
};
|
27977
|
+
|
27923
27978
|
var _excluded$e = ["onChange"];
|
27924
|
-
var answerTypeOptions = Object.keys(QuestionAnswerType).filter(function (key) {
|
27925
|
-
return Number.isNaN(+key);
|
27926
|
-
}).map(function (label, index) {
|
27927
|
-
return {
|
27928
|
-
label: t$1(label.toLowerCase()),
|
27929
|
-
value: index
|
27930
|
-
};
|
27931
|
-
});
|
27932
27979
|
var BpIcon$1 = styled("span")(function (_ref) {
|
27933
27980
|
var theme = _ref.theme;
|
27934
27981
|
return {
|
@@ -27999,13 +28046,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
27999
28046
|
}, React__default.createElement(FormLabel, {
|
28000
28047
|
htmlFor: "textual_answer",
|
28001
28048
|
className: styles$9["question-label"] + " form-label"
|
28002
|
-
}, t
|
28049
|
+
}, t("textual_answer")), React__default.createElement(Field, {
|
28003
28050
|
name: path + ".textualAnswer",
|
28004
28051
|
render: function render(_ref3) {
|
28005
28052
|
var field = _ref3.field;
|
28006
28053
|
return React__default.createElement(TextField, Object.assign({}, field, {
|
28007
28054
|
size: "small",
|
28008
|
-
placeholder: t
|
28055
|
+
placeholder: t("textual_answer")
|
28009
28056
|
}));
|
28010
28057
|
}
|
28011
28058
|
}));
|
@@ -28031,7 +28078,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28031
28078
|
return handleCheckMultiChoice(+e.target.value);
|
28032
28079
|
}
|
28033
28080
|
}),
|
28034
|
-
label: t
|
28081
|
+
label: t("number_question", {
|
28035
28082
|
number: i
|
28036
28083
|
})
|
28037
28084
|
});
|
@@ -28067,7 +28114,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28067
28114
|
checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
|
28068
28115
|
icon: React__default.createElement(BpIcon$1, null)
|
28069
28116
|
}),
|
28070
|
-
label: t
|
28117
|
+
label: t("number_question", {
|
28071
28118
|
number: i
|
28072
28119
|
})
|
28073
28120
|
});
|
@@ -28076,10 +28123,27 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28076
28123
|
return null;
|
28077
28124
|
}
|
28078
28125
|
};
|
28079
|
-
|
28080
|
-
|
28081
|
-
|
28126
|
+
var handleChangeQuestionType = function handleChangeQuestionType(val) {
|
28127
|
+
if (typeof (val === null || val === void 0 ? void 0 : val.value) === "string") {
|
28128
|
+
setFieldValue(path + ".questionTypeId", 0);
|
28129
|
+
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28130
|
+
} else {
|
28131
|
+
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28132
|
+
}
|
28133
|
+
setFieldValue(path + ".questionType", val);
|
28134
|
+
};
|
28135
|
+
var _useTranslation = useTranslation(),
|
28136
|
+
t = _useTranslation.t;
|
28137
|
+
var answerTypeOptions = Object.keys(QuestionAnswerType).filter(function (key) {
|
28138
|
+
return Number.isNaN(+key);
|
28139
|
+
}).map(function (label, index) {
|
28140
|
+
return {
|
28141
|
+
label: t(label.toLowerCase()),
|
28142
|
+
value: index
|
28143
|
+
};
|
28082
28144
|
});
|
28145
|
+
var theme = useTheme();
|
28146
|
+
var isTabletUp = useMediaQuery(theme.breakpoints.up('lg'));
|
28083
28147
|
return React__default.createElement(Stack, {
|
28084
28148
|
direction: "row",
|
28085
28149
|
alignItems: "center",
|
@@ -28088,11 +28152,12 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28088
28152
|
}, React__default.createElement(Stack, {
|
28089
28153
|
direction: "row",
|
28090
28154
|
alignItems: "center",
|
28155
|
+
minWidth: "50%",
|
28091
28156
|
flexGrow: 1
|
28092
28157
|
}, React__default.createElement(Box, null, React__default.createElement(Box, {
|
28093
28158
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28094
28159
|
sx: questionTitleStyle
|
28095
|
-
}, t
|
28160
|
+
}, t("problem_number_question", {
|
28096
28161
|
number: data.questionOrder + 1
|
28097
28162
|
}))), React__default.createElement(Box, {
|
28098
28163
|
flexGrow: 1
|
@@ -28102,12 +28167,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28102
28167
|
}, React__default.createElement(FormControl, {
|
28103
28168
|
sx: {
|
28104
28169
|
flexGrow: 1,
|
28105
|
-
width: "
|
28170
|
+
width: isTabletUp ? "120px" : "100px"
|
28106
28171
|
}
|
28107
28172
|
}, React__default.createElement(FormLabel, {
|
28108
28173
|
htmlFor: "score",
|
28109
|
-
className: styles$9["question-label"] + " form-label"
|
28110
|
-
|
28174
|
+
className: styles$9["question-label"] + " form-label",
|
28175
|
+
sx: labelStyle
|
28176
|
+
}, t("score")), React__default.createElement(Field, {
|
28111
28177
|
name: path + ".score",
|
28112
28178
|
render: function render(_ref4) {
|
28113
28179
|
var field = _ref4.field;
|
@@ -28121,12 +28187,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28121
28187
|
})), isMath && React__default.createElement(FormGroup, {
|
28122
28188
|
sx: {
|
28123
28189
|
flexGrow: 1,
|
28124
|
-
width: "
|
28190
|
+
width: isTabletUp ? "180px" : "120px"
|
28125
28191
|
}
|
28126
28192
|
}, React__default.createElement(FormLabel, {
|
28127
28193
|
htmlFor: "type",
|
28128
|
-
className: styles$9["question-label"] + " form-label"
|
28129
|
-
|
28194
|
+
className: styles$9["question-label"] + " form-label",
|
28195
|
+
sx: labelStyle
|
28196
|
+
}, t("type")), React__default.createElement(Field, {
|
28130
28197
|
name: path + ".questionTypeId",
|
28131
28198
|
render: function render(_ref5) {
|
28132
28199
|
var _ref5$field = _ref5.field,
|
@@ -28138,26 +28205,20 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28138
28205
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
28139
28206
|
onMenuOpen: handleOpenQuestionTypeMenu,
|
28140
28207
|
onMenuClose: onCloseQuestionTypeMenu,
|
28141
|
-
onChange:
|
28142
|
-
|
28143
|
-
setFieldValue(path + ".questionTypeId", 0);
|
28144
|
-
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28145
|
-
} else {
|
28146
|
-
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28147
|
-
}
|
28148
|
-
setFieldValue(path + ".questionType", val);
|
28149
|
-
}
|
28208
|
+
onChange: handleChangeQuestionType,
|
28209
|
+
isClearable: true
|
28150
28210
|
}));
|
28151
28211
|
}
|
28152
28212
|
})), React__default.createElement(FormGroup, {
|
28153
28213
|
sx: {
|
28154
28214
|
flexGrow: 1,
|
28155
|
-
width: "
|
28215
|
+
width: isTabletUp ? "180px" : "100px"
|
28156
28216
|
}
|
28157
28217
|
}, React__default.createElement(FormLabel, {
|
28158
28218
|
htmlFor: "question_answer_type",
|
28159
|
-
className: styles$9["question-label"] + " form-label"
|
28160
|
-
|
28219
|
+
className: styles$9["question-label"] + " form-label",
|
28220
|
+
sx: labelStyle
|
28221
|
+
}, t("question_answer_type")), React__default.createElement(Field, {
|
28161
28222
|
name: path + ".questionAnswerType",
|
28162
28223
|
render: function render(_ref6) {
|
28163
28224
|
var field = _ref6.field;
|
@@ -28185,6 +28246,7 @@ var QuestionBlock$1 = memo(QuestionBlock, isEqual$1);
|
|
28185
28246
|
|
28186
28247
|
var _excluded$f = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28187
28248
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28249
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
28188
28250
|
var data = _ref.data,
|
28189
28251
|
path = _ref.path,
|
28190
28252
|
isMath = _ref.isMath,
|
@@ -28205,6 +28267,10 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28205
28267
|
var articles = data.articles,
|
28206
28268
|
questions = data.questions;
|
28207
28269
|
var blockErrors = _.get(errors, path);
|
28270
|
+
var handleOpenQuestionTypeMenu = useCallback(function (key) {
|
28271
|
+
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
28272
|
+
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]);
|
28273
|
+
}, [(_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]]);
|
28208
28274
|
return React__default.createElement(FieldArray, {
|
28209
28275
|
name: path + ".articles",
|
28210
28276
|
render: function render(arrayHelpers) {
|
@@ -28266,7 +28332,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28266
28332
|
questionTypes: questionTypes,
|
28267
28333
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28268
28334
|
optionKey: optionKey,
|
28269
|
-
onOpenQuestionTypeMenu:
|
28335
|
+
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28270
28336
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28271
28337
|
}, formikProps));
|
28272
28338
|
}
|
@@ -28388,6 +28454,14 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28388
28454
|
setFieldValue(path + ".articles[0].categoryOptions", (_questionGroup$articl2 = questionGroup.articles[0]) === null || _questionGroup$articl2 === void 0 ? void 0 : _questionGroup$articl2.categoryOptions);
|
28389
28455
|
}
|
28390
28456
|
};
|
28457
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
28458
|
+
setFieldValue(path + ".articles[0].categoryOptions", [val]);
|
28459
|
+
setFieldValue(path + ".articles[0].categories", [val === null || val === void 0 ? void 0 : val.value]);
|
28460
|
+
};
|
28461
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
28462
|
+
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28463
|
+
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28464
|
+
};
|
28391
28465
|
var summary = open ? "" : [t("number_questions", {
|
28392
28466
|
n: data.questionCount
|
28393
28467
|
}), (_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) {
|
@@ -28500,10 +28574,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28500
28574
|
onMenuOpen: handleOpenCategoryMenu,
|
28501
28575
|
onMenuClose: onCloseCategoryMenu
|
28502
28576
|
},
|
28503
|
-
onChange:
|
28504
|
-
setFieldValue(path + ".articles[0].categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
28505
|
-
setFieldValue(path + ".articles[0].categoryOptions[0]", val);
|
28506
|
-
},
|
28577
|
+
onChange: handleChangeCategory,
|
28507
28578
|
placeholder: t("select_category")
|
28508
28579
|
});
|
28509
28580
|
}
|
@@ -28538,14 +28609,12 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28538
28609
|
optionValue: field.value,
|
28539
28610
|
options: categories,
|
28540
28611
|
rest: {
|
28612
|
+
isClearable: true,
|
28541
28613
|
isLoading: optionKey === path + ".articles[0].categories[1]" ? isLoadingCategories : false,
|
28542
28614
|
onMenuOpen: handleOpenSubCategoryMenu,
|
28543
28615
|
onMenuClose: onCloseCategoryMenu
|
28544
28616
|
},
|
28545
|
-
onChange:
|
28546
|
-
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28547
|
-
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28548
|
-
},
|
28617
|
+
onChange: handleChangeSubCategory,
|
28549
28618
|
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]),
|
28550
28619
|
placeholder: t("select_category")
|
28551
28620
|
});
|
@@ -28835,7 +28904,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
28835
28904
|
e.stopPropagation();
|
28836
28905
|
onDelete("" + t("are_you_sure_you_want_to_delete_the_chapter", {
|
28837
28906
|
chapter: title
|
28838
|
-
}), title, path.replace(/\[(\d+)\]$/,
|
28907
|
+
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
28839
28908
|
};
|
28840
28909
|
var pageNameError = _.get(errors, path + ".name");
|
28841
28910
|
var pageFromError = _.get(errors, path + ".pageFrom");
|
@@ -29278,8 +29347,8 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29278
29347
|
var questionTypeFilters = getOptionFilter();
|
29279
29348
|
return Promise.resolve(getQuestionTypesApi(isSuperAdmin, _extends({}, questionTypeFilters, {
|
29280
29349
|
subjectId: subjectId,
|
29281
|
-
|
29282
|
-
|
29350
|
+
parentCategoryId: subCategoryId,
|
29351
|
+
rootParentCategoryId: categoryId,
|
29283
29352
|
textSearch: (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.value
|
29284
29353
|
}))).then(function (res) {
|
29285
29354
|
setQuestionTypes(res.data.items.map(function (i) {
|
@@ -30073,19 +30142,35 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30073
30142
|
}));
|
30074
30143
|
};
|
30075
30144
|
|
30076
|
-
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath
|
30077
|
-
|
30078
|
-
|
30079
|
-
}
|
30080
|
-
var values = isInit ? _.cloneDeep(textbook) : textbook;
|
30081
|
-
if (isInit) values.type = isMath;
|
30145
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
30146
|
+
var values = isMath !== undefined ? _.cloneDeep(textbook) : textbook;
|
30147
|
+
if (isMath !== undefined) values.type = isMath;
|
30082
30148
|
for (var key in values) {
|
30083
30149
|
if (values.hasOwnProperty(key)) {
|
30084
30150
|
if (key === "articles") {
|
30085
30151
|
var _values$key;
|
30086
30152
|
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30087
30153
|
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30088
|
-
_reduceToMathArticles(values[key]
|
30154
|
+
_reduceToMathArticles(values[key]);
|
30155
|
+
}
|
30156
|
+
}
|
30157
|
+
}
|
30158
|
+
return values;
|
30159
|
+
};
|
30160
|
+
var _resetAllCrategoriesAndQuestionTypesBySubject = function resetAllCrategoriesAndQuestionTypesBySubject(textbook, subject) {
|
30161
|
+
var values = subject ? _.cloneDeep(textbook) : textbook;
|
30162
|
+
if (subject) {
|
30163
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
30164
|
+
values.subject = subject;
|
30165
|
+
}
|
30166
|
+
for (var key in values) {
|
30167
|
+
if (values.hasOwnProperty(key)) {
|
30168
|
+
if (key === "categories" || key === "categoryOptions") {
|
30169
|
+
values[key] = [];
|
30170
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
30171
|
+
values[key] = null;
|
30172
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30173
|
+
_resetAllCrategoriesAndQuestionTypesBySubject(values[key]);
|
30089
30174
|
}
|
30090
30175
|
}
|
30091
30176
|
}
|
@@ -30214,8 +30299,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30214
30299
|
errors = formikProps.errors,
|
30215
30300
|
dirty = formikProps.dirty,
|
30216
30301
|
submitCount = formikProps.submitCount,
|
30217
|
-
setValues = formikProps.setValues
|
30218
|
-
setFieldValue = formikProps.setFieldValue;
|
30302
|
+
setValues = formikProps.setValues;
|
30219
30303
|
useEffect(function () {
|
30220
30304
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
30221
30305
|
var message = t$1("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -30233,8 +30317,8 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30233
30317
|
setValues(newValues);
|
30234
30318
|
};
|
30235
30319
|
var handleChangeSubject = function handleChangeSubject(val) {
|
30236
|
-
|
30237
|
-
|
30320
|
+
var newValues = _resetAllCrategoriesAndQuestionTypesBySubject(values, val);
|
30321
|
+
setValues(newValues);
|
30238
30322
|
};
|
30239
30323
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
30240
30324
|
var contentsErrors = errors.chapters;
|
@@ -30319,9 +30403,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30319
30403
|
},
|
30320
30404
|
variant: "contained",
|
30321
30405
|
onClick: function onClick() {
|
30322
|
-
console.log({
|
30323
|
-
errors: errors
|
30324
|
-
});
|
30325
30406
|
if (!_.isEmpty(errors)) {
|
30326
30407
|
toast.error(t$1("please_fill_in_the_blank_fields"));
|
30327
30408
|
}
|