touchstudy-core 0.1.130 → 0.1.132
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 +136 -82
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +136 -82
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -1426,6 +1426,7 @@ var subjective_answer = "주관식 정답";
|
|
1426
1426
|
var current_correct_answer_entered = "현재 입력한 정답";
|
1427
1427
|
var correct_answer_is_required = "정답은 필수입니다.";
|
1428
1428
|
var cancel_2 = "취소하기";
|
1429
|
+
var article_required = "기사가 필요합니다";
|
1429
1430
|
var lang_ko = {
|
1430
1431
|
problem_solving: problem_solving,
|
1431
1432
|
my_story: my_story,
|
@@ -2485,7 +2486,8 @@ var lang_ko = {
|
|
2485
2486
|
subjective_answer: subjective_answer,
|
2486
2487
|
current_correct_answer_entered: current_correct_answer_entered,
|
2487
2488
|
correct_answer_is_required: correct_answer_is_required,
|
2488
|
-
cancel_2: cancel_2
|
2489
|
+
cancel_2: cancel_2,
|
2490
|
+
article_required: article_required
|
2489
2491
|
};
|
2490
2492
|
|
2491
2493
|
var problem_solving$1 = "Problem Solving";
|
@@ -3568,6 +3570,7 @@ var subjective_answer$1 = "Subjective answer";
|
|
3568
3570
|
var current_correct_answer_entered$1 = "Current correct answer entered";
|
3569
3571
|
var correct_answer_is_required$1 = "Correct answer is required";
|
3570
3572
|
var cancel_2$1 = "Cancel";
|
3573
|
+
var article_required$1 = "Article is required";
|
3571
3574
|
var lang_en = {
|
3572
3575
|
problem_solving: problem_solving$1,
|
3573
3576
|
my_story: my_story$1,
|
@@ -4629,7 +4632,8 @@ var lang_en = {
|
|
4629
4632
|
subjective_answer: subjective_answer$1,
|
4630
4633
|
current_correct_answer_entered: current_correct_answer_entered$1,
|
4631
4634
|
correct_answer_is_required: correct_answer_is_required$1,
|
4632
|
-
cancel_2: cancel_2$1
|
4635
|
+
cancel_2: cancel_2$1,
|
4636
|
+
article_required: article_required$1
|
4633
4637
|
};
|
4634
4638
|
|
4635
4639
|
i18n.use(initReactI18next).init({
|
@@ -5976,6 +5980,11 @@ var customStyles = {
|
|
5976
5980
|
color: styles.darker
|
5977
5981
|
});
|
5978
5982
|
},
|
5983
|
+
placeholder: function placeholder(baseStyles, _) {
|
5984
|
+
return _extends({}, baseStyles, {
|
5985
|
+
whiteSpace: "nowrap"
|
5986
|
+
});
|
5987
|
+
},
|
5979
5988
|
singleValue: function singleValue(baseStyles) {
|
5980
5989
|
return _extends({}, baseStyles, {
|
5981
5990
|
fontSize: "14px",
|
@@ -5993,7 +6002,7 @@ var customStyles = {
|
|
5993
6002
|
},
|
5994
6003
|
menuPortal: function menuPortal(base) {
|
5995
6004
|
return _extends({}, base, {
|
5996
|
-
zIndex:
|
6005
|
+
zIndex: 99
|
5997
6006
|
});
|
5998
6007
|
}
|
5999
6008
|
};
|
@@ -21637,7 +21646,8 @@ var UserDialog = function UserDialog(_ref) {
|
|
21637
21646
|
setLoadingDefaultPassCode(true);
|
21638
21647
|
var _temp3 = _catch(function () {
|
21639
21648
|
return Promise.resolve(getUserDefaultPassCodeApi(parentPhoneNumber, phoneNumber, email, true)).then(function (res) {
|
21640
|
-
|
21649
|
+
var _res$data;
|
21650
|
+
setPassCode((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.toString());
|
21641
21651
|
});
|
21642
21652
|
}, function (error) {
|
21643
21653
|
toast.error(getErrorMessage(t, error));
|
@@ -21693,6 +21703,9 @@ var UserDialog = function UserDialog(_ref) {
|
|
21693
21703
|
setRoles([].concat((data === null || data === void 0 ? void 0 : data.roles) || [Role.Teacher]));
|
21694
21704
|
}
|
21695
21705
|
}, [open]);
|
21706
|
+
useEffect(function () {
|
21707
|
+
getDefaultPassCode();
|
21708
|
+
}, [getValues().parentPhoneNumber, getValues().phoneNumber]);
|
21696
21709
|
var handleUseDefaultPassCode = function handleUseDefaultPassCode() {
|
21697
21710
|
setUseDefaultPassCode(true);
|
21698
21711
|
setPassCode(undefined);
|
@@ -21921,16 +21934,9 @@ var UserDialog = function UserDialog(_ref) {
|
|
21921
21934
|
color: theme.palette.success.main,
|
21922
21935
|
fontWeight: 600
|
21923
21936
|
}
|
21924
|
-
}, defaultPassCodeValue), React__default.createElement(Box, null, isLoadingDefaultPassCode
|
21937
|
+
}, defaultPassCodeValue), React__default.createElement(Box, null, isLoadingDefaultPassCode && React__default.createElement(CircularProgress, {
|
21925
21938
|
size: "1rem"
|
21926
|
-
})
|
21927
|
-
className: "bg-success",
|
21928
|
-
onClick: getDefaultPassCode,
|
21929
|
-
disabled: disabled
|
21930
|
-
}, React__default.createElement(FaRotateRight, {
|
21931
|
-
color: "#FFF",
|
21932
|
-
size: 10
|
21933
|
-
}))))), React__default.createElement(FormControlLabel, {
|
21939
|
+
})))), React__default.createElement(FormControlLabel, {
|
21934
21940
|
control: React__default.createElement(Radio, {
|
21935
21941
|
checked: !useDefaultPassCode,
|
21936
21942
|
onChange: function onChange() {
|
@@ -27485,6 +27491,9 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27485
27491
|
},
|
27486
27492
|
then: function then(schema) {
|
27487
27493
|
return schema.min(1, t("category_required"));
|
27494
|
+
},
|
27495
|
+
otherwise: function otherwise(schema) {
|
27496
|
+
return schema.min(1, t("article_required"));
|
27488
27497
|
}
|
27489
27498
|
}),
|
27490
27499
|
questions: array().of(object())
|
@@ -27503,7 +27512,17 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
27503
27512
|
title: string().notRequired(),
|
27504
27513
|
author: string().notRequired(),
|
27505
27514
|
subject: string().notRequired()
|
27506
|
-
})),
|
27515
|
+
})).when("$type", {
|
27516
|
+
is: function is(type) {
|
27517
|
+
return type === 2;
|
27518
|
+
},
|
27519
|
+
then: function then(schema) {
|
27520
|
+
return schema.min(1, t("category_required"));
|
27521
|
+
},
|
27522
|
+
otherwise: function otherwise(schema) {
|
27523
|
+
return schema.min(1, t("article_required"));
|
27524
|
+
}
|
27525
|
+
}),
|
27507
27526
|
questions: array().of(object())
|
27508
27527
|
}))
|
27509
27528
|
}))
|
@@ -27739,6 +27758,14 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27739
27758
|
var handleOpenCategoryMenu = function handleOpenCategoryMenu() {
|
27740
27759
|
onOpenCategoryMenu(path + ".categories[0]");
|
27741
27760
|
};
|
27761
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
27762
|
+
setFieldValue(path + ".categoryOptions", [val]);
|
27763
|
+
setFieldValue(path + ".categories", [val === null || val === void 0 ? void 0 : val.value]);
|
27764
|
+
};
|
27765
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
27766
|
+
setFieldValue(path + ".categoryOptions[1]", [val]);
|
27767
|
+
setFieldValue(path + ".categories[1]", [val === null || val === void 0 ? void 0 : val.value]);
|
27768
|
+
};
|
27742
27769
|
return React__default.createElement(Stack, {
|
27743
27770
|
direction: "row",
|
27744
27771
|
alignItems: "center",
|
@@ -27805,10 +27832,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27805
27832
|
onMenuOpen: handleOpenCategoryMenu,
|
27806
27833
|
onMenuClose: onCloseCategoryMenu
|
27807
27834
|
},
|
27808
|
-
onChange:
|
27809
|
-
setFieldValue(path + ".categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
27810
|
-
setFieldValue(path + ".categoryOptions[0]", val);
|
27811
|
-
},
|
27835
|
+
onChange: handleChangeCategory,
|
27812
27836
|
placeholder: t("select_category")
|
27813
27837
|
});
|
27814
27838
|
}
|
@@ -27845,10 +27869,7 @@ var ArticleBlock = function ArticleBlock(_ref) {
|
|
27845
27869
|
onMenuOpen: handleOpenSubCategoryMenu,
|
27846
27870
|
onMenuClose: onCloseCategoryMenu
|
27847
27871
|
},
|
27848
|
-
onChange:
|
27849
|
-
setFieldValue(path + ".categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
27850
|
-
setFieldValue(path + ".categoryOptions[1]", val);
|
27851
|
-
},
|
27872
|
+
onChange: handleChangeSubCategory,
|
27852
27873
|
isDisabled: !data.categories[0],
|
27853
27874
|
placeholder: t("select_category")
|
27854
27875
|
});
|
@@ -27944,15 +27965,14 @@ var ArticleBlock$1 = memo(ArticleBlock, isEqual);
|
|
27944
27965
|
|
27945
27966
|
var styles$9 = {"question":"_1_ONI","question-article":"_2FdrR","question-title":"_3mgRf","question-label":"_2h0kA","question-input":"_exAl-","question-btn":"_2ksp8"};
|
27946
27967
|
|
27968
|
+
var labelStyle = {
|
27969
|
+
textOverflow: "ellipsis",
|
27970
|
+
overflowX: "hidden",
|
27971
|
+
width: "100%",
|
27972
|
+
whiteSpace: "nowrap"
|
27973
|
+
};
|
27974
|
+
|
27947
27975
|
var _excluded$e = ["onChange"];
|
27948
|
-
var answerTypeOptions = Object.keys(QuestionAnswerType).filter(function (key) {
|
27949
|
-
return Number.isNaN(+key);
|
27950
|
-
}).map(function (label, index) {
|
27951
|
-
return {
|
27952
|
-
label: t$1(label.toLowerCase()),
|
27953
|
-
value: index
|
27954
|
-
};
|
27955
|
-
});
|
27956
27976
|
var BpIcon$1 = styled("span")(function (_ref) {
|
27957
27977
|
var theme = _ref.theme;
|
27958
27978
|
return {
|
@@ -28023,13 +28043,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28023
28043
|
}, React__default.createElement(FormLabel, {
|
28024
28044
|
htmlFor: "textual_answer",
|
28025
28045
|
className: styles$9["question-label"] + " form-label"
|
28026
|
-
}, t
|
28046
|
+
}, t("textual_answer")), React__default.createElement(Field, {
|
28027
28047
|
name: path + ".textualAnswer",
|
28028
28048
|
render: function render(_ref3) {
|
28029
28049
|
var field = _ref3.field;
|
28030
28050
|
return React__default.createElement(TextField, Object.assign({}, field, {
|
28031
28051
|
size: "small",
|
28032
|
-
placeholder: t
|
28052
|
+
placeholder: t("textual_answer")
|
28033
28053
|
}));
|
28034
28054
|
}
|
28035
28055
|
}));
|
@@ -28055,7 +28075,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28055
28075
|
return handleCheckMultiChoice(+e.target.value);
|
28056
28076
|
}
|
28057
28077
|
}),
|
28058
|
-
label: t
|
28078
|
+
label: t("number_question", {
|
28059
28079
|
number: i
|
28060
28080
|
})
|
28061
28081
|
});
|
@@ -28091,7 +28111,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28091
28111
|
checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
|
28092
28112
|
icon: React__default.createElement(BpIcon$1, null)
|
28093
28113
|
}),
|
28094
|
-
label: t
|
28114
|
+
label: t("number_question", {
|
28095
28115
|
number: i
|
28096
28116
|
})
|
28097
28117
|
});
|
@@ -28100,10 +28120,27 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28100
28120
|
return null;
|
28101
28121
|
}
|
28102
28122
|
};
|
28103
|
-
|
28104
|
-
|
28105
|
-
|
28123
|
+
var handleChangeQuestionType = function handleChangeQuestionType(val) {
|
28124
|
+
if (typeof (val === null || val === void 0 ? void 0 : val.value) === "string") {
|
28125
|
+
setFieldValue(path + ".questionTypeId", 0);
|
28126
|
+
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28127
|
+
} else {
|
28128
|
+
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28129
|
+
}
|
28130
|
+
setFieldValue(path + ".questionType", val);
|
28131
|
+
};
|
28132
|
+
var _useTranslation = useTranslation(),
|
28133
|
+
t = _useTranslation.t;
|
28134
|
+
var answerTypeOptions = Object.keys(QuestionAnswerType).filter(function (key) {
|
28135
|
+
return Number.isNaN(+key);
|
28136
|
+
}).map(function (label, index) {
|
28137
|
+
return {
|
28138
|
+
label: t(label.toLowerCase()),
|
28139
|
+
value: index
|
28140
|
+
};
|
28106
28141
|
});
|
28142
|
+
var theme = useTheme();
|
28143
|
+
var isTabletUp = useMediaQuery(theme.breakpoints.up('lg'));
|
28107
28144
|
return React__default.createElement(Stack, {
|
28108
28145
|
direction: "row",
|
28109
28146
|
alignItems: "center",
|
@@ -28112,11 +28149,12 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28112
28149
|
}, React__default.createElement(Stack, {
|
28113
28150
|
direction: "row",
|
28114
28151
|
alignItems: "center",
|
28152
|
+
minWidth: "50%",
|
28115
28153
|
flexGrow: 1
|
28116
28154
|
}, React__default.createElement(Box, null, React__default.createElement(Box, {
|
28117
28155
|
className: styles$9["question-title"] + " me-2 text-nowrap",
|
28118
28156
|
sx: questionTitleStyle
|
28119
|
-
}, t
|
28157
|
+
}, t("problem_number_question", {
|
28120
28158
|
number: data.questionOrder + 1
|
28121
28159
|
}))), React__default.createElement(Box, {
|
28122
28160
|
flexGrow: 1
|
@@ -28126,12 +28164,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28126
28164
|
}, React__default.createElement(FormControl, {
|
28127
28165
|
sx: {
|
28128
28166
|
flexGrow: 1,
|
28129
|
-
width: "
|
28167
|
+
width: isTabletUp ? "120px" : "100px"
|
28130
28168
|
}
|
28131
28169
|
}, React__default.createElement(FormLabel, {
|
28132
28170
|
htmlFor: "score",
|
28133
|
-
className: styles$9["question-label"] + " form-label"
|
28134
|
-
|
28171
|
+
className: styles$9["question-label"] + " form-label",
|
28172
|
+
sx: labelStyle
|
28173
|
+
}, t("score")), React__default.createElement(Field, {
|
28135
28174
|
name: path + ".score",
|
28136
28175
|
render: function render(_ref4) {
|
28137
28176
|
var field = _ref4.field;
|
@@ -28145,12 +28184,13 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28145
28184
|
})), isMath && React__default.createElement(FormGroup, {
|
28146
28185
|
sx: {
|
28147
28186
|
flexGrow: 1,
|
28148
|
-
width: "
|
28187
|
+
width: isTabletUp ? "180px" : "120px"
|
28149
28188
|
}
|
28150
28189
|
}, React__default.createElement(FormLabel, {
|
28151
28190
|
htmlFor: "type",
|
28152
|
-
className: styles$9["question-label"] + " form-label"
|
28153
|
-
|
28191
|
+
className: styles$9["question-label"] + " form-label",
|
28192
|
+
sx: labelStyle
|
28193
|
+
}, t("type")), React__default.createElement(Field, {
|
28154
28194
|
name: path + ".questionTypeId",
|
28155
28195
|
render: function render(_ref5) {
|
28156
28196
|
var _ref5$field = _ref5.field,
|
@@ -28162,26 +28202,20 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
28162
28202
|
isLoading: optionKey === path + ".questionTypeId" ? isLoadingQuestionTypes : false,
|
28163
28203
|
onMenuOpen: handleOpenQuestionTypeMenu,
|
28164
28204
|
onMenuClose: onCloseQuestionTypeMenu,
|
28165
|
-
onChange:
|
28166
|
-
|
28167
|
-
setFieldValue(path + ".questionTypeId", 0);
|
28168
|
-
setFieldValue(path + ".questionTypeName", val === null || val === void 0 ? void 0 : val.value);
|
28169
|
-
} else {
|
28170
|
-
setFieldValue(path + ".questionTypeId", (val === null || val === void 0 ? void 0 : val.value) || 0);
|
28171
|
-
}
|
28172
|
-
setFieldValue(path + ".questionType", val);
|
28173
|
-
}
|
28205
|
+
onChange: handleChangeQuestionType,
|
28206
|
+
isClearable: true
|
28174
28207
|
}));
|
28175
28208
|
}
|
28176
28209
|
})), React__default.createElement(FormGroup, {
|
28177
28210
|
sx: {
|
28178
28211
|
flexGrow: 1,
|
28179
|
-
width: "
|
28212
|
+
width: isTabletUp ? "180px" : "100px"
|
28180
28213
|
}
|
28181
28214
|
}, React__default.createElement(FormLabel, {
|
28182
28215
|
htmlFor: "question_answer_type",
|
28183
|
-
className: styles$9["question-label"] + " form-label"
|
28184
|
-
|
28216
|
+
className: styles$9["question-label"] + " form-label",
|
28217
|
+
sx: labelStyle
|
28218
|
+
}, t("question_answer_type")), React__default.createElement(Field, {
|
28185
28219
|
name: path + ".questionAnswerType",
|
28186
28220
|
render: function render(_ref6) {
|
28187
28221
|
var field = _ref6.field;
|
@@ -28209,6 +28243,7 @@ var QuestionBlock$1 = memo(QuestionBlock, isEqual$1);
|
|
28209
28243
|
|
28210
28244
|
var _excluded$f = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
28211
28245
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
28246
|
+
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate;
|
28212
28247
|
var data = _ref.data,
|
28213
28248
|
path = _ref.path,
|
28214
28249
|
isMath = _ref.isMath,
|
@@ -28229,6 +28264,10 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28229
28264
|
var articles = data.articles,
|
28230
28265
|
questions = data.questions;
|
28231
28266
|
var blockErrors = _.get(errors, path);
|
28267
|
+
var handleOpenQuestionTypeMenu = useCallback(function (key) {
|
28268
|
+
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
28269
|
+
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]);
|
28270
|
+
}, [(_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]]);
|
28232
28271
|
return React__default.createElement(FieldArray, {
|
28233
28272
|
name: path + ".articles",
|
28234
28273
|
render: function render(arrayHelpers) {
|
@@ -28290,7 +28329,7 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
28290
28329
|
questionTypes: questionTypes,
|
28291
28330
|
isLoadingQuestionTypes: isLoadingQuestionTypes,
|
28292
28331
|
optionKey: optionKey,
|
28293
|
-
onOpenQuestionTypeMenu:
|
28332
|
+
onOpenQuestionTypeMenu: handleOpenQuestionTypeMenu,
|
28294
28333
|
onCloseQuestionTypeMenu: onCloseQuestionTypeMenu
|
28295
28334
|
}, formikProps));
|
28296
28335
|
}
|
@@ -28412,6 +28451,14 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28412
28451
|
setFieldValue(path + ".articles[0].categoryOptions", (_questionGroup$articl2 = questionGroup.articles[0]) === null || _questionGroup$articl2 === void 0 ? void 0 : _questionGroup$articl2.categoryOptions);
|
28413
28452
|
}
|
28414
28453
|
};
|
28454
|
+
var handleChangeCategory = function handleChangeCategory(val) {
|
28455
|
+
setFieldValue(path + ".articles[0].categoryOptions", [val]);
|
28456
|
+
setFieldValue(path + ".articles[0].categories", [val === null || val === void 0 ? void 0 : val.value]);
|
28457
|
+
};
|
28458
|
+
var handleChangeSubCategory = function handleChangeSubCategory(val) {
|
28459
|
+
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28460
|
+
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28461
|
+
};
|
28415
28462
|
var summary = open ? "" : [t("number_questions", {
|
28416
28463
|
n: data.questionCount
|
28417
28464
|
}), (_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) {
|
@@ -28524,10 +28571,7 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28524
28571
|
onMenuOpen: handleOpenCategoryMenu,
|
28525
28572
|
onMenuClose: onCloseCategoryMenu
|
28526
28573
|
},
|
28527
|
-
onChange:
|
28528
|
-
setFieldValue(path + ".articles[0].categories[0]", val === null || val === void 0 ? void 0 : val.value);
|
28529
|
-
setFieldValue(path + ".articles[0].categoryOptions[0]", val);
|
28530
|
-
},
|
28574
|
+
onChange: handleChangeCategory,
|
28531
28575
|
placeholder: t("select_category")
|
28532
28576
|
});
|
28533
28577
|
}
|
@@ -28562,14 +28606,12 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
28562
28606
|
optionValue: field.value,
|
28563
28607
|
options: categories,
|
28564
28608
|
rest: {
|
28609
|
+
isClearable: true,
|
28565
28610
|
isLoading: optionKey === path + ".articles[0].categories[1]" ? isLoadingCategories : false,
|
28566
28611
|
onMenuOpen: handleOpenSubCategoryMenu,
|
28567
28612
|
onMenuClose: onCloseCategoryMenu
|
28568
28613
|
},
|
28569
|
-
onChange:
|
28570
|
-
setFieldValue(path + ".articles[0].categories[1]", val === null || val === void 0 ? void 0 : val.value);
|
28571
|
-
setFieldValue(path + ".articles[0].categoryOptions[1]", val);
|
28572
|
-
},
|
28614
|
+
onChange: handleChangeSubCategory,
|
28573
28615
|
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]),
|
28574
28616
|
placeholder: t("select_category")
|
28575
28617
|
});
|
@@ -28859,7 +28901,7 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
28859
28901
|
e.stopPropagation();
|
28860
28902
|
onDelete("" + t("are_you_sure_you_want_to_delete_the_chapter", {
|
28861
28903
|
chapter: title
|
28862
|
-
}), title, path.replace(/\[(\d+)\]$/,
|
28904
|
+
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
28863
28905
|
};
|
28864
28906
|
var pageNameError = _.get(errors, path + ".name");
|
28865
28907
|
var pageFromError = _.get(errors, path + ".pageFrom");
|
@@ -29302,8 +29344,8 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
29302
29344
|
var questionTypeFilters = getOptionFilter();
|
29303
29345
|
return Promise.resolve(getQuestionTypesApi(isSuperAdmin, _extends({}, questionTypeFilters, {
|
29304
29346
|
subjectId: subjectId,
|
29305
|
-
|
29306
|
-
|
29347
|
+
parentCategoryId: subCategoryId,
|
29348
|
+
rootParentCategoryId: categoryId,
|
29307
29349
|
textSearch: (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.value
|
29308
29350
|
}))).then(function (res) {
|
29309
29351
|
setQuestionTypes(res.data.items.map(function (i) {
|
@@ -30097,19 +30139,35 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
30097
30139
|
}));
|
30098
30140
|
};
|
30099
30141
|
|
30100
|
-
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath
|
30101
|
-
|
30102
|
-
|
30103
|
-
}
|
30104
|
-
var values = isInit ? _.cloneDeep(textbook) : textbook;
|
30105
|
-
if (isInit) values.type = isMath;
|
30142
|
+
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
30143
|
+
var values = isMath !== undefined ? _.cloneDeep(textbook) : textbook;
|
30144
|
+
if (isMath !== undefined) values.type = isMath;
|
30106
30145
|
for (var key in values) {
|
30107
30146
|
if (values.hasOwnProperty(key)) {
|
30108
30147
|
if (key === "articles") {
|
30109
30148
|
var _values$key;
|
30110
30149
|
values[key] = (_values$key = values[key]) !== null && _values$key !== void 0 && _values$key.length ? [values[key][0]] : [DEFAULT_ARTICLE];
|
30111
30150
|
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30112
|
-
_reduceToMathArticles(values[key]
|
30151
|
+
_reduceToMathArticles(values[key]);
|
30152
|
+
}
|
30153
|
+
}
|
30154
|
+
}
|
30155
|
+
return values;
|
30156
|
+
};
|
30157
|
+
var _resetAllCrategoriesAndQuestionTypesBySubject = function resetAllCrategoriesAndQuestionTypesBySubject(textbook, subject) {
|
30158
|
+
var values = subject ? _.cloneDeep(textbook) : textbook;
|
30159
|
+
if (subject) {
|
30160
|
+
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
30161
|
+
values.subject = subject;
|
30162
|
+
}
|
30163
|
+
for (var key in values) {
|
30164
|
+
if (values.hasOwnProperty(key)) {
|
30165
|
+
if (key === "categories" || key === "categoryOptions") {
|
30166
|
+
values[key] = [];
|
30167
|
+
} else if (key === "questionType" || key === "questionTypeId") {
|
30168
|
+
values[key] = null;
|
30169
|
+
} else if (typeof values[key] === "object" && values[key] !== null) {
|
30170
|
+
_resetAllCrategoriesAndQuestionTypesBySubject(values[key]);
|
30113
30171
|
}
|
30114
30172
|
}
|
30115
30173
|
}
|
@@ -30238,8 +30296,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30238
30296
|
errors = formikProps.errors,
|
30239
30297
|
dirty = formikProps.dirty,
|
30240
30298
|
submitCount = formikProps.submitCount,
|
30241
|
-
setValues = formikProps.setValues
|
30242
|
-
setFieldValue = formikProps.setFieldValue;
|
30299
|
+
setValues = formikProps.setValues;
|
30243
30300
|
useEffect(function () {
|
30244
30301
|
var handleBeforeUnload = function handleBeforeUnload(event) {
|
30245
30302
|
var message = t$1("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
|
@@ -30257,8 +30314,8 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30257
30314
|
setValues(newValues);
|
30258
30315
|
};
|
30259
30316
|
var handleChangeSubject = function handleChangeSubject(val) {
|
30260
|
-
|
30261
|
-
|
30317
|
+
var newValues = _resetAllCrategoriesAndQuestionTypesBySubject(values, val);
|
30318
|
+
setValues(newValues);
|
30262
30319
|
};
|
30263
30320
|
var inforErrors = errors.coverImage || errors.grade || errors.isbn || errors.preparedType || errors.publicationDate || errors.publisher;
|
30264
30321
|
var contentsErrors = errors.chapters;
|
@@ -30343,9 +30400,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
30343
30400
|
},
|
30344
30401
|
variant: "contained",
|
30345
30402
|
onClick: function onClick() {
|
30346
|
-
console.log({
|
30347
|
-
errors: errors
|
30348
|
-
});
|
30349
30403
|
if (!_.isEmpty(errors)) {
|
30350
30404
|
toast.error(t$1("please_fill_in_the_blank_fields"));
|
30351
30405
|
}
|