touchstudy-core 0.1.130 → 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 +129 -72
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +129 -72
- 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
@@ -1424,6 +1424,7 @@ var subjective_answer = "주관식 정답";
|
|
1424
1424
|
var current_correct_answer_entered = "현재 입력한 정답";
|
1425
1425
|
var correct_answer_is_required = "정답은 필수입니다.";
|
1426
1426
|
var cancel_2 = "취소하기";
|
1427
|
+
var article_required = "기사가 필요합니다";
|
1427
1428
|
var lang_ko = {
|
1428
1429
|
problem_solving: problem_solving,
|
1429
1430
|
my_story: my_story,
|
@@ -2483,7 +2484,8 @@ var lang_ko = {
|
|
2483
2484
|
subjective_answer: subjective_answer,
|
2484
2485
|
current_correct_answer_entered: current_correct_answer_entered,
|
2485
2486
|
correct_answer_is_required: correct_answer_is_required,
|
2486
|
-
cancel_2: cancel_2
|
2487
|
+
cancel_2: cancel_2,
|
2488
|
+
article_required: article_required
|
2487
2489
|
};
|
2488
2490
|
|
2489
2491
|
var problem_solving$1 = "Problem Solving";
|
@@ -3566,6 +3568,7 @@ var subjective_answer$1 = "Subjective answer";
|
|
3566
3568
|
var current_correct_answer_entered$1 = "Current correct answer entered";
|
3567
3569
|
var correct_answer_is_required$1 = "Correct answer is required";
|
3568
3570
|
var cancel_2$1 = "Cancel";
|
3571
|
+
var article_required$1 = "Article is required";
|
3569
3572
|
var lang_en = {
|
3570
3573
|
problem_solving: problem_solving$1,
|
3571
3574
|
my_story: my_story$1,
|
@@ -4627,7 +4630,8 @@ var lang_en = {
|
|
4627
4630
|
subjective_answer: subjective_answer$1,
|
4628
4631
|
current_correct_answer_entered: current_correct_answer_entered$1,
|
4629
4632
|
correct_answer_is_required: correct_answer_is_required$1,
|
4630
|
-
cancel_2: cancel_2$1
|
4633
|
+
cancel_2: cancel_2$1,
|
4634
|
+
article_required: article_required$1
|
4631
4635
|
};
|
4632
4636
|
|
4633
4637
|
i18n__default.use(reactI18next.initReactI18next).init({
|
@@ -5972,6 +5976,11 @@ var customStyles = {
|
|
5972
5976
|
color: styles.darker
|
5973
5977
|
});
|
5974
5978
|
},
|
5979
|
+
placeholder: function placeholder(baseStyles, _) {
|
5980
|
+
return _extends({}, baseStyles, {
|
5981
|
+
whiteSpace: "nowrap"
|
5982
|
+
});
|
5983
|
+
},
|
5975
5984
|
singleValue: function singleValue(baseStyles) {
|
5976
5985
|
return _extends({}, baseStyles, {
|
5977
5986
|
fontSize: "14px",
|
@@ -5989,7 +5998,7 @@ var customStyles = {
|
|
5989
5998
|
},
|
5990
5999
|
menuPortal: function menuPortal(base) {
|
5991
6000
|
return _extends({}, base, {
|
5992
|
-
zIndex:
|
6001
|
+
zIndex: 99
|
5993
6002
|
});
|
5994
6003
|
}
|
5995
6004
|
};
|
@@ -27472,6 +27481,9 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27472
27481
|
},
|
27473
27482
|
then: function then(schema) {
|
27474
27483
|
return schema.min(1, t("category_required"));
|
27484
|
+
},
|
27485
|
+
otherwise: function otherwise(schema) {
|
27486
|
+
return schema.min(1, t("article_required"));
|
27475
27487
|
}
|
27476
27488
|
}),
|
27477
27489
|
questions: yup.array().of(yup.object())
|
@@ -27490,7 +27502,17 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27490
27502
|
title: yup.string().notRequired(),
|
27491
27503
|
author: yup.string().notRequired(),
|
27492
27504
|
subject: yup.string().notRequired()
|
27493
|
-
})),
|
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
|
+
}),
|
27494
27516
|
questions: yup.array().of(yup.object())
|
27495
27517
|
}))
|
27496
27518
|
}))
|
@@ -27726,6 +27748,14 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27726
27748
|
var handleOpenCategoryMenu = function handleOpenCategoryMenu() {
|
27727
27749
|
onOpenCategoryMenu(path + ".categories[0]");
|
27728
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
|
+
};
|
27729
27759
|
return React__default.createElement(material.Stack, {
|
27730
27760
|
direction: "row",
|
27731
27761
|
alignItems: "center",
|
@@ -27792,10 +27822,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27792
27822
|
onMenuOpen: handleOpenCategoryMenu,
|
27793
27823
|
onMenuClose: onCloseCategoryMenu
|
27794
27824
|
},
|
27795
|
-
onChange:
|
27796
|
-
setFieldValue(path + ".categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
27797
|
-
setFieldValue(path + ".categoryOptions[0]", val);
|
27798
|
-
},
|
27825
|
+
onChange: handleChangeCategory,
|
27799
27826
|
placeholder: t("select_category")
|
27800
27827
|
});
|
27801
27828
|
}
|
@@ -27832,10 +27859,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27832
27859
|
onMenuOpen: handleOpenSubCategoryMenu,
|
27833
27860
|
onMenuClose: onCloseCategoryMenu
|
27834
27861
|
},
|
27835
|
-
onChange:
|
27836
|
-
setFieldValue(path + ".categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
27837
|
-
setFieldValue(path + ".categoryOptions[1]", val);
|
27838
|
-
},
|
27862
|
+
onChange: handleChangeSubCategory,
|
27839
27863
|
isDisabled: !data.categories[0],
|
27840
27864
|
placeholder: t("select_category")
|
27841
27865
|
});
|
@@ -27931,15 +27955,14 @@ var ArticleBlock$1 = React.memo(ArticleBlock, isEqual);
|
|
27931
27955
|
|
27932
27956
|
var styles$9 = {"question":"_1_ONI","question-article":"_2FdrR","question-title":"_3mgRf","question-label":"_2h0kA","question-input":"_exAl-","question-btn":"_2ksp8"};
|
27933
27957
|
|
27958
|
+
var labelStyle = {
|
27959
|
+
textOverflow: "ellipsis",
|
27960
|
+
overflowX: "hidden",
|
27961
|
+
width: "100%",
|
27962
|
+
whiteSpace: "nowrap"
|
27963
|
+
};
|
27964
|
+
|
27934
27965
|
var _excluded$e = ["onChange"];
|
27935
|
-
var answerTypeOptions = Object.keys(exports.QuestionAnswerType).filter(function (key) {
|
27936
|
-
return Number.isNaN(+key);
|
27937
|
-
}).map(function (label, index) {
|
27938
|
-
return {
|
27939
|
-
label: i18n.t(label.toLowerCase()),
|
27940
|
-
value: index
|
27941
|
-
};
|
27942
|
-
});
|
27943
27966
|
var BpIcon$1 = material.styled("span")(function (_ref) {
|
27944
27967
|
var theme = _ref.theme;
|
27945
27968
|
return {
|
@@ -28010,13 +28033,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28010
28033
|
}, React__default.createElement(material.FormLabel, {
|
28011
28034
|
htmlFor: "textual_answer",
|
28012
28035
|
className: styles$9["question-label"] + " form-label"
|
28013
|
-
},
|
28036
|
+
}, t("textual_answer")), React__default.createElement(formik.Field, {
|
28014
28037
|
name: path + ".textualAnswer",
|
28015
28038
|
render: function render(_ref3) {
|
28016
28039
|
var field = _ref3.field;
|
28017
28040
|
return React__default.createElement(material.TextField, Object.assign({}, field, {
|
28018
28041
|
size: "small",
|
28019
|
-
placeholder:
|
28042
|
+
placeholder: t("textual_answer")
|
28020
28043
|
}));
|
28021
28044
|
}
|
28022
28045
|
}));
|
@@ -28042,7 +28065,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28042
28065
|
return handleCheckMultiChoice(+e.target.value);
|
28043
28066
|
}
|
28044
28067
|
}),
|
28045
|
-
label:
|
28068
|
+
label: t("number_question", {
|
28046
28069
|
number: i
|
28047
28070
|
})
|
28048
28071
|
});
|
@@ -28078,7 +28101,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28078
28101
|
checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
|
28079
28102
|
icon: React__default.createElement(BpIcon$1, null)
|
28080
28103
|
}),
|
28081
|
-
label:
|
28104
|
+
label: t("number_question", {
|
28082
28105
|
number: i
|
28083
28106
|
})
|
28084
28107
|
});
|
@@ -28087,10 +28110,27 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28087
28110
|
return null;
|
28088
28111
|
}
|
28089
28112
|
};
|
28090
|
-
|
28091
|
-
|
28092
|
-
|
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
|
+
};
|
28093
28131
|
});
|
28132
|
+
var theme = material.useTheme();
|
28133
|
+
var isTabletUp = material.useMediaQuery(theme.breakpoints.up('lg'));
|
28094
28134
|
return React__default.createElement(material.Stack, {
|
28095
28135
|
direction: "row",
|
28096
28136
|
alignItems: "center",
|
@@ -28099,11 +28139,12 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28099
28139
|
}, React__default.createElement(material.Stack, {
|
28100
28140
|
direction: "row",
|
28101
28141
|
alignItems: "center",
|
28142
|
+
minWidth: "50%",
|
28102
28143
|
flexGrow: 1
|
28103
28144
|
}, React__default.createElement(material.Box, null, React__default.createElement(material.Box, {
|
28104
28145
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28105
28146
|
sx: questionTitleStyle
|
28106
|
-
},
|
28147
|
+
}, t("problem_number_question", {
|
28107
28148
|
number: data.questionOrder + 1
|
28108
28149
|
}))), React__default.createElement(material.Box, {
|
28109
28150
|
flexGrow: 1
|
@@ -28113,12 +28154,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28113
28154
|
}, React__default.createElement(material.FormControl, {
|
28114
28155
|
sx: {
|
28115
28156
|
flexGrow: 1,
|
28116
|
-
width: "
|
28157
|
+
width: isTabletUp ? "120px" : "100px"
|
28117
28158
|
}
|
28118
28159
|
}, React__default.createElement(material.FormLabel, {
|
28119
28160
|
htmlFor: "score",
|
28120
|
-
className: styles$9["question-label"] + " form-label"
|
28121
|
-
|
28161
|
+
className: styles$9["question-label"] + " form-label",
|
28162
|
+
sx: labelStyle
|
28163
|
+
}, t("score")), React__default.createElement(formik.Field, {
|
28122
28164
|
name: path + ".score",
|
28123
28165
|
render: function render(_ref4) {
|
28124
28166
|
var field = _ref4.field;
|
@@ -28132,12 +28174,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28132
28174
|
})), isMath && React__default.createElement(material.FormGroup, {
|
28133
28175
|
sx: {
|
28134
28176
|
flexGrow: 1,
|
28135
|
-
width: "
|
28177
|
+
width: isTabletUp ? "180px" : "120px"
|
28136
28178
|
}
|
28137
28179
|
}, React__default.createElement(material.FormLabel, {
|
28138
28180
|
htmlFor: "type",
|
28139
|
-
className: styles$9["question-label"] + " form-label"
|
28140
|
-
|
28181
|
+
className: styles$9["question-label"] + " form-label",
|
28182
|
+
sx: labelStyle
|
28183
|
+
}, t("type")), React__default.createElement(formik.Field, {
|
28141
28184
|
name: path + ".questionTypeId",
|
28142
28185
|
render: function render(_ref5) {
|
28143
28186
|
var _ref5$field = _ref5.field,
|
@@ -28149,26 +28192,20 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28149
28192
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
28150
28193
|
onMenuOpen: handleOpenQuestionTypeMenu,
|
28151
28194
|
onMenuClose: onCloseQuestionTypeMenu,
|
28152
|
-
onChange:
|
28153
|
-
|
28154
|
-
setFieldValue(path + ".questionTypeId", 0);
|
28155
|
-
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28156
|
-
} else {
|
28157
|
-
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28158
|
-
}
|
28159
|
-
setFieldValue(path + ".questionType", val);
|
28160
|
-
}
|
28195
|
+
onChange: handleChangeQuestionType,
|
28196
|
+
isClearable: true
|
28161
28197
|
}));
|
28162
28198
|
}
|
28163
28199
|
})), React__default.createElement(material.FormGroup, {
|
28164
28200
|
sx: {
|
28165
28201
|
flexGrow: 1,
|
28166
|
-
width: "
|
28202
|
+
width: isTabletUp ? "180px" : "100px"
|
28167
28203
|
}
|
28168
28204
|
}, React__default.createElement(material.FormLabel, {
|
28169
28205
|
htmlFor: "question_answer_type",
|
28170
|
-
className: styles$9["question-label"] + " form-label"
|
28171
|
-
|
28206
|
+
className: styles$9["question-label"] + " form-label",
|
28207
|
+
sx: labelStyle
|
28208
|
+
}, t("question_answer_type")), React__default.createElement(formik.Field, {
|
28172
28209
|
name: path + ".questionAnswerType",
|
28173
28210
|
render: function render(_ref6) {
|
28174
28211
|
var field = _ref6.field;
|
@@ -28196,6 +28233,7 @@ var QuestionBlock$1 = React.memo(QuestionBlock, isEqual$1);
|
|
28196
28233
|
|
28197
28234
|
var _excluded$f = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28198
28235
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28236
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
28199
28237
|
var data = _ref.data,
|
28200
28238
|
path = _ref.path,
|
28201
28239
|
isMath = _ref.isMath,
|
@@ -28216,6 +28254,10 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28216
28254
|
var articles = data.articles,
|
28217
28255
|
questions = data.questions;
|
28218
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]]);
|
28219
28261
|
return React__default.createElement(formik.FieldArray, {
|
28220
28262
|
name: path + ".articles",
|
28221
28263
|
render: function render(arrayHelpers) {
|
@@ -28277,7 +28319,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28277
28319
|
questionTypes: questionTypes,
|
28278
28320
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28279
28321
|
optionKey: optionKey,
|
28280
|
-
onOpenQuestionTypeMenu:
|
28322
|
+
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28281
28323
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28282
28324
|
}, formikProps));
|
28283
28325
|
}
|
@@ -28399,6 +28441,14 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28399
28441
|
setFieldValue(path + ".articles[0].categoryOptions", (_questionGroup$articl2 = questionGroup.articles[0]) === null || _questionGroup$articl2 === void 0 ? void 0 : _questionGroup$articl2.categoryOptions);
|
28400
28442
|
}
|
28401
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
|
+
};
|
28402
28452
|
var summary = open ? "" : [t("number_questions", {
|
28403
28453
|
n: data.questionCount
|
28404
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) {
|
@@ -28511,10 +28561,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28511
28561
|
onMenuOpen: handleOpenCategoryMenu,
|
28512
28562
|
onMenuClose: onCloseCategoryMenu
|
28513
28563
|
},
|
28514
|
-
onChange:
|
28515
|
-
setFieldValue(path + ".articles[0].categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
28516
|
-
setFieldValue(path + ".articles[0].categoryOptions[0]", val);
|
28517
|
-
},
|
28564
|
+
onChange: handleChangeCategory,
|
28518
28565
|
placeholder: t("select_category")
|
28519
28566
|
});
|
28520
28567
|
}
|
@@ -28549,14 +28596,12 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28549
28596
|
optionValue: field.value,
|
28550
28597
|
options: categories,
|
28551
28598
|
rest: {
|
28599
|
+
isClearable: true,
|
28552
28600
|
isLoading: optionKey === path + ".articles[0].categories[1]" ? isLoadingCategories : false,
|
28553
28601
|
onMenuOpen: handleOpenSubCategoryMenu,
|
28554
28602
|
onMenuClose: onCloseCategoryMenu
|
28555
28603
|
},
|
28556
|
-
onChange:
|
28557
|
-
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28558
|
-
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28559
|
-
},
|
28604
|
+
onChange: handleChangeSubCategory,
|
28560
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]),
|
28561
28606
|
placeholder: t("select_category")
|
28562
28607
|
});
|
@@ -28846,7 +28891,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
28846
28891
|
e.stopPropagation();
|
28847
28892
|
onDelete("" + t("are_you_sure_you_want_to_delete_the_chapter", {
|
28848
28893
|
chapter: title
|
28849
|
-
}), title, path.replace(/\[(\d+)\]$/,
|
28894
|
+
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
28850
28895
|
};
|
28851
28896
|
var pageNameError = _.get(errors, path + ".name");
|
28852
28897
|
var pageFromError = _.get(errors, path + ".pageFrom");
|
@@ -29289,8 +29334,8 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29289
29334
|
var questionTypeFilters = getOptionFilter();
|
29290
29335
|
return Promise.resolve(getQuestionTypesApi(isSuperAdmin, _extends({}, questionTypeFilters, {
|
29291
29336
|
subjectId: subjectId,
|
29292
|
-
|
29293
|
-
|
29337
|
+
parentCategoryId: subCategoryId,
|
29338
|
+
rootParentCategoryId: categoryId,
|
29294
29339
|
textSearch: (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.value
|
29295
29340
|
}))).then(function (res) {
|
29296
29341
|
setQuestionTypes(res.data.items.map(function (i) {
|
@@ -30084,19 +30129,35 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30084
30129
|
}));
|
30085
30130
|
};
|
30086
30131
|
|
30087
|
-
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath
|
30088
|
-
|
30089
|
-
|
30090
|
-
}
|
30091
|
-
var values = isInit ? _.cloneDeep(textbook) : textbook;
|
30092
|
-
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;
|
30093
30135
|
for (var key in values) {
|
30094
30136
|
if (values.hasOwnProperty(key)) {
|
30095
30137
|
if (key === "articles") {
|
30096
30138
|
var _values$key;
|
30097
30139
|
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30098
30140
|
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30099
|
-
_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]);
|
30100
30161
|
}
|
30101
30162
|
}
|
30102
30163
|
}
|
@@ -30225,8 +30286,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30225
30286
|
errors = formikProps.errors,
|
30226
30287
|
dirty = formikProps.dirty,
|
30227
30288
|
submitCount = formikProps.submitCount,
|
30228
|
-
setValues = formikProps.setValues
|
30229
|
-
setFieldValue = formikProps.setFieldValue;
|
30289
|
+
setValues = formikProps.setValues;
|
30230
30290
|
React.useEffect(function () {
|
30231
30291
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
30232
30292
|
var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -30244,8 +30304,8 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30244
30304
|
setValues(newValues);
|
30245
30305
|
};
|
30246
30306
|
var handleChangeSubject = function handleChangeSubject(val) {
|
30247
|
-
|
30248
|
-
|
30307
|
+
var newValues = _resetAllCrategoriesAndQuestionTypesBySubject(values, val);
|
30308
|
+
setValues(newValues);
|
30249
30309
|
};
|
30250
30310
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
30251
30311
|
var contentsErrors = errors.chapters;
|
@@ -30330,9 +30390,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30330
30390
|
},
|
30331
30391
|
variant: "contained",
|
30332
30392
|
onClick: function onClick() {
|
30333
|
-
console.log({
|
30334
|
-
errors: errors
|
30335
|
-
});
|
30336
30393
|
if (!_.isEmpty(errors)) {
|
30337
30394
|
reactToastify.toast.error(i18n.t("please_fill_in_the_blank_fields"));
|
30338
30395
|
}
|