touchstudy-core 0.1.149 → 0.1.150
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/containers/PreparedTextbook/components/QuestionShortInput.d.ts +3 -0
- package/dist/containers/PreparedTextbook/configs/types.d.ts +2 -2
- package/dist/index.js +138 -104
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +138 -104
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -23,7 +23,7 @@ import { useSelector, useDispatch } from 'react-redux';
|
|
23
23
|
import Select, { components } from 'react-select';
|
24
24
|
import CreatableSelect from 'react-select/creatable';
|
25
25
|
import axios from 'axios';
|
26
|
-
import _$
|
26
|
+
import _$8 from 'lodash';
|
27
27
|
import { useGoogleLogout, GoogleLogin } from '@leecheuk/react-google-login';
|
28
28
|
import 'moment/locale/ko.js';
|
29
29
|
import 'moment/locale/en-au.js';
|
@@ -1477,6 +1477,7 @@ var order_matters = "순서 상관 있음";
|
|
1477
1477
|
var order_does_not_matter = "순서 상관 없음";
|
1478
1478
|
var synonym_processing = "답 이음동의어 처리";
|
1479
1479
|
var compare_type = "비교 유형";
|
1480
|
+
var answer_cannot_be_empty = "답변은 비워둘 수 없습니다";
|
1480
1481
|
var lang_ko = {
|
1481
1482
|
problem_solving: problem_solving,
|
1482
1483
|
my_story: my_story,
|
@@ -2587,7 +2588,8 @@ var lang_ko = {
|
|
2587
2588
|
order_matters: order_matters,
|
2588
2589
|
order_does_not_matter: order_does_not_matter,
|
2589
2590
|
synonym_processing: synonym_processing,
|
2590
|
-
compare_type: compare_type
|
2591
|
+
compare_type: compare_type,
|
2592
|
+
answer_cannot_be_empty: answer_cannot_be_empty
|
2591
2593
|
};
|
2592
2594
|
|
2593
2595
|
var problem_solving$1 = "Problem Solving";
|
@@ -3721,6 +3723,7 @@ var order_matters$1 = "Order matters";
|
|
3721
3723
|
var order_does_not_matter$1 = "Order doesn't matter";
|
3722
3724
|
var synonym_processing$1 = "Answer Synonym processing";
|
3723
3725
|
var compare_type$1 = "Compare Type";
|
3726
|
+
var answer_cannot_be_empty$1 = "Answer cannot be empty";
|
3724
3727
|
var lang_en = {
|
3725
3728
|
problem_solving: problem_solving$1,
|
3726
3729
|
my_story: my_story$1,
|
@@ -4833,7 +4836,8 @@ var lang_en = {
|
|
4833
4836
|
order_matters: order_matters$1,
|
4834
4837
|
order_does_not_matter: order_does_not_matter$1,
|
4835
4838
|
synonym_processing: synonym_processing$1,
|
4836
|
-
compare_type: compare_type$1
|
4839
|
+
compare_type: compare_type$1,
|
4840
|
+
answer_cannot_be_empty: answer_cannot_be_empty$1
|
4837
4841
|
};
|
4838
4842
|
|
4839
4843
|
i18n.use(initReactI18next).init({
|
@@ -6442,7 +6446,7 @@ var getLocalDayOfWeek = function getLocalDayOfWeek(utcDateTime, dayOfWeek) {
|
|
6442
6446
|
return moment.utc(utcDateTime).add(diff, "days").local().weekday();
|
6443
6447
|
};
|
6444
6448
|
var getUtcDayOfWeek = function getUtcDayOfWeek(localDateTime, dayOfWeek) {
|
6445
|
-
var currentDayOfWeek = _$
|
6449
|
+
var currentDayOfWeek = _$8.cloneDeep(localDateTime).local().weekday();
|
6446
6450
|
var diff = dayOfWeek - currentDayOfWeek;
|
6447
6451
|
if (diff < 0) diff += 7;
|
6448
6452
|
return localDateTime.add(diff, "days").utc().weekday();
|
@@ -6943,7 +6947,7 @@ var useList = function useList(fetchData, defaultQuery) {
|
|
6943
6947
|
var _paging$page, _paging$limit;
|
6944
6948
|
return (((_paging$page = paging.page) != null ? _paging$page : 0) - 1) * ((_paging$limit = paging.limit) != null ? _paging$limit : 0) + index + 1;
|
6945
6949
|
};
|
6946
|
-
var debounceSearch = _$
|
6950
|
+
var debounceSearch = _$8.debounce(function () {
|
6947
6951
|
var _textSearchRef$curren;
|
6948
6952
|
setFilter(_extends({}, filter, {
|
6949
6953
|
currentPage: 1,
|
@@ -12782,7 +12786,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12782
12786
|
};
|
12783
12787
|
var handleDeleteWeeklyDays = function handleDeleteWeeklyDays(currentValue) {
|
12784
12788
|
if (formikProp.values.courseWeeklyDays.length <= 1) return;
|
12785
|
-
var courseWeeklyDays = _$
|
12789
|
+
var courseWeeklyDays = _$8.cloneDeep(formikProp.values.courseWeeklyDays);
|
12786
12790
|
var newValues = courseWeeklyDays.filter(function (i) {
|
12787
12791
|
var _i$startTime, _currentValue$startTi, _i$endTime, _currentValue$endTime;
|
12788
12792
|
return i.dayOfWeek !== currentValue.dayOfWeek || ((_i$startTime = i.startTime) === null || _i$startTime === void 0 ? void 0 : _i$startTime.format("HH:mm:ss")) !== ((_currentValue$startTi = currentValue.startTime) === null || _currentValue$startTi === void 0 ? void 0 : _currentValue$startTi.format("HH:mm:ss")) || ((_i$endTime = i.endTime) === null || _i$endTime === void 0 ? void 0 : _i$endTime.format("HH:mm:ss")) !== ((_currentValue$endTime = currentValue.endTime) === null || _currentValue$endTime === void 0 ? void 0 : _currentValue$endTime.format("HH:mm:ss"));
|
@@ -12818,7 +12822,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12818
12822
|
var handleChangeWeeklyDayTime = function handleChangeWeeklyDayTime(key, newValue, currentValue) {
|
12819
12823
|
var _extends2;
|
12820
12824
|
var time = newValue === null || newValue === void 0 ? void 0 : newValue.local();
|
12821
|
-
var courseWeeklyDays = _$
|
12825
|
+
var courseWeeklyDays = _$8.cloneDeep(formikProp.values.courseWeeklyDays);
|
12822
12826
|
var currentIndex = courseWeeklyDays.findIndex(function (i) {
|
12823
12827
|
var _i$startTime2, _currentValue$startTi2, _i$endTime2, _currentValue$endTime2;
|
12824
12828
|
return i.dayOfWeek === currentValue.dayOfWeek && ((_i$startTime2 = i.startTime) === null || _i$startTime2 === void 0 ? void 0 : _i$startTime2.format("HH:mm:ss")) === ((_currentValue$startTi2 = currentValue.startTime) === null || _currentValue$startTi2 === void 0 ? void 0 : _currentValue$startTi2.format("HH:mm:ss")) && ((_i$endTime2 = i.endTime) === null || _i$endTime2 === void 0 ? void 0 : _i$endTime2.format("HH:mm:ss")) === ((_currentValue$endTime2 = currentValue.endTime) === null || _currentValue$endTime2 === void 0 ? void 0 : _currentValue$endTime2.format("HH:mm:ss"));
|
@@ -12853,11 +12857,11 @@ var ClassForm = function ClassForm(_ref) {
|
|
12853
12857
|
}, [JSON.stringify(data)]);
|
12854
12858
|
var minDate = useMemo(function () {
|
12855
12859
|
if (!formikProp.values.startDate) return undefined;
|
12856
|
-
return _$
|
12860
|
+
return _$8.cloneDeep(formikProp.values.startDate).add(1, "days");
|
12857
12861
|
}, [formikProp.values.startDate]);
|
12858
12862
|
var maxDate = useMemo(function () {
|
12859
12863
|
if (!formikProp.values.endDate) return undefined;
|
12860
|
-
return _$
|
12864
|
+
return _$8.cloneDeep(formikProp.values.endDate).add(1, "days");
|
12861
12865
|
}, [formikProp.values.endDate]);
|
12862
12866
|
var WeeklyDayErrors = formikProp.touched.courseWeeklyDays && formikProp.errors.courseWeeklyDays && React__default.createElement("div", {
|
12863
12867
|
className: "mt-1"
|
@@ -12874,7 +12878,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
12874
12878
|
});
|
12875
12879
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12876
12880
|
var courseWeeklyDays = useMemo(function () {
|
12877
|
-
return _$
|
12881
|
+
return _$8.sortBy(formikProp.values.courseWeeklyDays, ["dayOfWeek"]);
|
12878
12882
|
}, [JSON.stringify(formikProp.values.courseWeeklyDays)]);
|
12879
12883
|
return React__default.createElement("div", {
|
12880
12884
|
className: "d-flex flex-column"
|
@@ -13025,7 +13029,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
13025
13029
|
value: v.startTime,
|
13026
13030
|
format: "HH:mm",
|
13027
13031
|
open: open === index + "-startTime",
|
13028
|
-
maxTime: v.endTime ? _$
|
13032
|
+
maxTime: v.endTime ? _$8.cloneDeep(v.endTime).add(-1, "minutes") : undefined,
|
13029
13033
|
onAccept: function onAccept(newValue) {
|
13030
13034
|
return handleChangeWeeklyDayTime("startTime", newValue, v);
|
13031
13035
|
},
|
@@ -13055,7 +13059,7 @@ var ClassForm = function ClassForm(_ref) {
|
|
13055
13059
|
components: ["TimePicker"]
|
13056
13060
|
}, React__default.createElement(TimePicker, {
|
13057
13061
|
value: v.endTime,
|
13058
|
-
minTime: v.startTime ? (_$cloneDeep = _$
|
13062
|
+
minTime: v.startTime ? (_$cloneDeep = _$8.cloneDeep(v.startTime)) === null || _$cloneDeep === void 0 ? void 0 : _$cloneDeep.add(1, "minutes") : undefined,
|
13059
13063
|
format: "HH:mm",
|
13060
13064
|
open: open === index + "-endTime",
|
13061
13065
|
onAccept: function onAccept(newValue) {
|
@@ -13188,7 +13192,7 @@ var useStudentInfoDrawer = function useStudentInfoDrawer(props) {
|
|
13188
13192
|
return _extends({}, state, (_extends2 = {}, _extends2[newValue] = true, _extends2));
|
13189
13193
|
});
|
13190
13194
|
};
|
13191
|
-
var debounceChangeTab = _$
|
13195
|
+
var debounceChangeTab = _$8.debounce(handleChangeTab, 300);
|
13192
13196
|
useEffect(function () {
|
13193
13197
|
var getStudent = function getStudent() {
|
13194
13198
|
try {
|
@@ -14747,7 +14751,7 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
14747
14751
|
var items = (data === null || data === void 0 ? void 0 : data.items) || [];
|
14748
14752
|
var newNotes = items;
|
14749
14753
|
if (filter !== null && filter !== void 0 && filter.currentPage && (filter === null || filter === void 0 ? void 0 : filter.currentPage) > 1) {
|
14750
|
-
newNotes = [].concat(_$
|
14754
|
+
newNotes = [].concat(_$8.uniqBy([].concat(notes, items), "id"));
|
14751
14755
|
}
|
14752
14756
|
setNotes(newNotes);
|
14753
14757
|
});
|
@@ -14770,7 +14774,7 @@ var useNotes = function useNotes(setFilter, filter) {
|
|
14770
14774
|
});
|
14771
14775
|
}, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
|
14772
14776
|
var handleNoteAdded = function handleNoteAdded(note) {
|
14773
|
-
var newNotes = [].concat(_$
|
14777
|
+
var newNotes = [].concat(_$8.uniqBy([note].concat(notes), "id"));
|
14774
14778
|
setNotes(newNotes);
|
14775
14779
|
};
|
14776
14780
|
var handleNoteUpdated = function handleNoteUpdated(note) {
|
@@ -15155,7 +15159,7 @@ var useVirtualList = function useVirtualList(studentId, defaultFilter, getItemsA
|
|
15155
15159
|
var responseItems = (responseData === null || responseData === void 0 ? void 0 : responseData.items) || [];
|
15156
15160
|
var results = responseItems;
|
15157
15161
|
if (filter !== null && filter !== void 0 && filter.currentPage && filter.currentPage > 1) {
|
15158
|
-
results = [].concat(_$
|
15162
|
+
results = [].concat(_$8.uniqBy([].concat(items, responseItems), "id"));
|
15159
15163
|
}
|
15160
15164
|
setItems(results);
|
15161
15165
|
});
|
@@ -15178,7 +15182,7 @@ var useVirtualList = function useVirtualList(studentId, defaultFilter, getItemsA
|
|
15178
15182
|
});
|
15179
15183
|
}, [filter === null || filter === void 0 ? void 0 : filter.currentPage, totalPages]);
|
15180
15184
|
var handleItemAdded = function handleItemAdded(item) {
|
15181
|
-
var results = [].concat(_$
|
15185
|
+
var results = [].concat(_$8.uniqBy([item].concat(items), "id"));
|
15182
15186
|
setItems(results);
|
15183
15187
|
};
|
15184
15188
|
var handleItemUpdated = function handleItemUpdated(item) {
|
@@ -19877,7 +19881,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
19877
19881
|
topAnswerOrder: i.topAnswerOrder == null ? 0 : i.topAnswerOrder
|
19878
19882
|
});
|
19879
19883
|
});
|
19880
|
-
var sortedMySeriesQuestionData = _$
|
19884
|
+
var sortedMySeriesQuestionData = _$8.sortBy(questionsData.filter(function (i) {
|
19881
19885
|
return i.answerOrder !== 0;
|
19882
19886
|
}), ["answerOrder", "questionOrder"]);
|
19883
19887
|
var mySeriesData = [null].concat(sortedMySeriesQuestionData.map(function (item) {
|
@@ -19887,7 +19891,7 @@ var useExamResultData = function useExamResultData(props) {
|
|
19887
19891
|
}).map(function () {
|
19888
19892
|
return null;
|
19889
19893
|
}), [null]);
|
19890
|
-
var sortedTopSeriesQuestionData = _$
|
19894
|
+
var sortedTopSeriesQuestionData = _$8.sortBy(questionsData.filter(function (i) {
|
19891
19895
|
return i.topAnswerOrder !== 0;
|
19892
19896
|
}), ["topAnswerOrder", "questionOrder"]);
|
19893
19897
|
var topSeriesData = [null].concat(sortedTopSeriesQuestionData.map(function (item) {
|
@@ -21856,7 +21860,7 @@ var usePreparedExam = function usePreparedExam(_ref) {
|
|
21856
21860
|
return Promise.reject(e);
|
21857
21861
|
}
|
21858
21862
|
};
|
21859
|
-
var debounceSearch = _$
|
21863
|
+
var debounceSearch = _$8.debounce(function () {
|
21860
21864
|
setTextbookFilter(_extends({}, textbookFilter, {
|
21861
21865
|
currentPage: 1
|
21862
21866
|
}));
|
@@ -23613,7 +23617,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
23613
23617
|
});
|
23614
23618
|
return React__default.createElement(Form, {
|
23615
23619
|
style: {
|
23616
|
-
height: !_$
|
23620
|
+
height: !_$8.isEmpty(values) && !textbookList.length ? "100%" : "unset"
|
23617
23621
|
}
|
23618
23622
|
}, React__default.createElement(Stack, null, React__default.createElement(Accordion, {
|
23619
23623
|
sx: {
|
@@ -24019,7 +24023,7 @@ var PreparedItem = function PreparedItem(_ref) {
|
|
24019
24023
|
open: openConfirmDialog,
|
24020
24024
|
onClose: handleCloseConfirmDialog,
|
24021
24025
|
onSubmit: handleResetFilter
|
24022
|
-
}), !_$
|
24026
|
+
}), !_$8.isEmpty(values) && !textbookList.length && React__default.createElement(Stack, {
|
24023
24027
|
height: 1,
|
24024
24028
|
justifyContent: "center",
|
24025
24029
|
alignItems: "center"
|
@@ -25389,7 +25393,7 @@ var useStudentClassList = function useStudentClassList(courseId) {
|
|
25389
25393
|
currentPage: 1
|
25390
25394
|
}));
|
25391
25395
|
};
|
25392
|
-
var debounceSearch = _$
|
25396
|
+
var debounceSearch = _$8.debounce(function () {
|
25393
25397
|
setFilter(_extends({}, filter, {
|
25394
25398
|
currentPage: 1
|
25395
25399
|
}));
|
@@ -25525,7 +25529,7 @@ var useTeacherClassList = function useTeacherClassList(courseId) {
|
|
25525
25529
|
currentPage: 1
|
25526
25530
|
}));
|
25527
25531
|
};
|
25528
|
-
var debounceSearch = _$
|
25532
|
+
var debounceSearch = _$8.debounce(function () {
|
25529
25533
|
setFilter(_extends({}, filter, {
|
25530
25534
|
currentPage: 1
|
25531
25535
|
}));
|
@@ -25838,7 +25842,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
25838
25842
|
});
|
25839
25843
|
}, [JSON.stringify(course)]);
|
25840
25844
|
var convertToRequestBody = function convertToRequestBody(request) {
|
25841
|
-
var localStartDate = _$
|
25845
|
+
var localStartDate = _$8.cloneDeep(request.startDate);
|
25842
25846
|
return _extends({}, request, {
|
25843
25847
|
startDate: request.startDate.utc().format(DATE_TIME_FORMAT),
|
25844
25848
|
endDate: request.endDate.utc().format(DATE_TIME_FORMAT),
|
@@ -26087,13 +26091,13 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
26087
26091
|
});
|
26088
26092
|
if (event.target.checked) {
|
26089
26093
|
setSelected(function (prev) {
|
26090
|
-
return _$
|
26094
|
+
return _$8.uniq([].concat(prev, newSelected));
|
26091
26095
|
});
|
26092
26096
|
return;
|
26093
26097
|
}
|
26094
|
-
setSelected(_$
|
26098
|
+
setSelected(_$8.difference(selected, newSelected));
|
26095
26099
|
};
|
26096
|
-
var debounceSearch = _$
|
26100
|
+
var debounceSearch = _$8.debounce(function () {
|
26097
26101
|
setFilter(_extends({}, filter, {
|
26098
26102
|
currentPage: 1
|
26099
26103
|
}));
|
@@ -26111,7 +26115,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
26111
26115
|
}) : userList.map(function (n) {
|
26112
26116
|
return n.teacherId;
|
26113
26117
|
});
|
26114
|
-
var checkLength = _$
|
26118
|
+
var checkLength = _$8.intersection(selected, newSelected).length;
|
26115
26119
|
return checkLength === userLength;
|
26116
26120
|
};
|
26117
26121
|
var handleClear = function handleClear() {
|
@@ -26146,7 +26150,7 @@ var useClassDetail = function useClassDetail(_ref) {
|
|
26146
26150
|
}));
|
26147
26151
|
setSelected([]);
|
26148
26152
|
};
|
26149
|
-
var debounceSort = _$
|
26153
|
+
var debounceSort = _$8.debounce(handleSort, 300);
|
26150
26154
|
var handleChangePage = function handleChangePage(_, page) {
|
26151
26155
|
setFilter(_extends({}, filter, {
|
26152
26156
|
currentPage: page
|
@@ -26230,8 +26234,8 @@ var LessonFormBody = function LessonFormBody(_ref) {
|
|
26230
26234
|
useEffect(function () {
|
26231
26235
|
if (open && data) formikProp.setValues(data);else formikProp.setValues(DEFAULT_LESSON_REQUEST);
|
26232
26236
|
}, [open, JSON.stringify(data)]);
|
26233
|
-
var maxTime = formikProp.values.endTime ? _$
|
26234
|
-
var minTime = formikProp.values.startTime ? _$
|
26237
|
+
var maxTime = formikProp.values.endTime ? _$8.cloneDeep(formikProp.values.endTime).add(-1, "minutes") : undefined;
|
26238
|
+
var minTime = formikProp.values.startTime ? _$8.cloneDeep(formikProp.values.startTime).add(1, "minutes") : undefined;
|
26235
26239
|
return React__default.createElement(Fragment$1, null, React__default.createElement(DialogContent, {
|
26236
26240
|
sx: {
|
26237
26241
|
overflowY: "unset"
|
@@ -26798,7 +26802,7 @@ var useClassList = function useClassList(history, classCreateUrl, classUpdateUrl
|
|
26798
26802
|
currentPage: 1
|
26799
26803
|
}));
|
26800
26804
|
};
|
26801
|
-
var debounceSearch = _$
|
26805
|
+
var debounceSearch = _$8.debounce(function () {
|
26802
26806
|
setClassFilter(_extends({}, classFilter, {
|
26803
26807
|
currentPage: 1
|
26804
26808
|
}));
|
@@ -27922,7 +27926,7 @@ var useUserList = function useUserList(role) {
|
|
27922
27926
|
currentPage: 1
|
27923
27927
|
}));
|
27924
27928
|
};
|
27925
|
-
var debounceSort = _$
|
27929
|
+
var debounceSort = _$8.debounce(handleSort, 300);
|
27926
27930
|
var getUserById = function getUserById(id) {
|
27927
27931
|
try {
|
27928
27932
|
var _temp8 = function _temp8() {
|
@@ -28080,7 +28084,7 @@ var useUserList = function useUserList(role) {
|
|
28080
28084
|
return Promise.reject(e);
|
28081
28085
|
}
|
28082
28086
|
};
|
28083
|
-
var debounceSearch = _$
|
28087
|
+
var debounceSearch = _$8.debounce(function () {
|
28084
28088
|
setFilter(_extends({}, filter, {
|
28085
28089
|
currentPage: 1
|
28086
28090
|
}));
|
@@ -29393,8 +29397,8 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
29393
29397
|
var handleAddArticle = function handleAddArticle() {
|
29394
29398
|
var _$maxBy, _$maxBy2;
|
29395
29399
|
if (!exam) return;
|
29396
|
-
var maxArticle = ((_$maxBy = _$
|
29397
|
-
var maxOrder = ((_$maxBy2 = _$
|
29400
|
+
var maxArticle = ((_$maxBy = _$8.maxBy(exam.questions, "article")) === null || _$maxBy === void 0 ? void 0 : _$maxBy.article) || 0;
|
29401
|
+
var maxOrder = ((_$maxBy2 = _$8.maxBy(exam.questions, "questionOrder")) === null || _$maxBy2 === void 0 ? void 0 : _$maxBy2.questionOrder) || 0;
|
29398
29402
|
onChangeExam(_extends({}, exam, {
|
29399
29403
|
questions: [].concat(exam.questions, [{
|
29400
29404
|
questionAnswerType: QuestionAnswerType.SingleChoice,
|
@@ -29442,7 +29446,7 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
29442
29446
|
var examGroupByArticle = useMemo(function () {
|
29443
29447
|
if (!exam) return [];
|
29444
29448
|
var articles = [];
|
29445
|
-
var groupedArticle = _$
|
29449
|
+
var groupedArticle = _$8.groupBy(exam.questions, "article");
|
29446
29450
|
for (var key in groupedArticle) {
|
29447
29451
|
if (Object.prototype.hasOwnProperty.call(groupedArticle, key)) {
|
29448
29452
|
var _questions$find, _$maxBy3;
|
@@ -29452,13 +29456,13 @@ var useExamDetailView = function useExamDetailView(props) {
|
|
29452
29456
|
categoryId: (_questions$find = questions.find(function (i) {
|
29453
29457
|
return !!i.categoryId;
|
29454
29458
|
})) === null || _questions$find === void 0 ? void 0 : _questions$find.categoryId,
|
29455
|
-
answerCount: ((_$maxBy3 = _$
|
29459
|
+
answerCount: ((_$maxBy3 = _$8.maxBy(questions, "numberOfAnswers")) === null || _$maxBy3 === void 0 ? void 0 : _$maxBy3.numberOfAnswers) || DEFAULT_ANSWER_COUNT,
|
29456
29460
|
questionCount: questions.length,
|
29457
29461
|
questions: questions
|
29458
29462
|
});
|
29459
29463
|
}
|
29460
29464
|
}
|
29461
|
-
return _$
|
29465
|
+
return _$8.sortBy(articles, "article");
|
29462
29466
|
}, [JSON.stringify(exam)]);
|
29463
29467
|
var durationOptions = useMemo(function () {
|
29464
29468
|
var options = DURATION_OPTIONS.map(function (i) {
|
@@ -31879,11 +31883,11 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
31879
31883
|
});
|
31880
31884
|
if (event.target.checked) {
|
31881
31885
|
setSelectedShare(function (prev) {
|
31882
|
-
return _$
|
31886
|
+
return _$8.uniq([].concat(prev, newSelected));
|
31883
31887
|
});
|
31884
31888
|
return;
|
31885
31889
|
}
|
31886
|
-
setSelectedShare(_$
|
31890
|
+
setSelectedShare(_$8.difference(selectedShare, newSelected));
|
31887
31891
|
};
|
31888
31892
|
var isCheckAllShare = function isCheckAllShare(userLength) {
|
31889
31893
|
var newSelected = isUpdate ? shared.map(function (n) {
|
@@ -31891,7 +31895,7 @@ var useTextbookShare = function useTextbookShare(props) {
|
|
31891
31895
|
}) : notShared.map(function (n) {
|
31892
31896
|
return n.id;
|
31893
31897
|
});
|
31894
|
-
var checkLength = _$
|
31898
|
+
var checkLength = _$8.intersection(selectedShare, newSelected).length;
|
31895
31899
|
return checkLength === userLength;
|
31896
31900
|
};
|
31897
31901
|
var handleClickCheckboxShare = function handleClickCheckboxShare(id) {
|
@@ -32150,7 +32154,7 @@ var TextbookList = function TextbookList(props) {
|
|
32150
32154
|
handleUpdateSharedTextbook = _useTextbookShare.handleUpdateSharedTextbook,
|
32151
32155
|
currentModel = _useTextbookShare.currentModel;
|
32152
32156
|
var textbookHeaders = useMemo(function () {
|
32153
|
-
var headers = _$
|
32157
|
+
var headers = _$8.clone(TEXTBOOK_HEADERS);
|
32154
32158
|
if (isTeacher && isTeacherSite) headers.splice(5, 0, {
|
32155
32159
|
title: "teacher_personal_textbook"
|
32156
32160
|
});
|
@@ -32745,7 +32749,7 @@ var useNotificationList = function useNotificationList(_ref) {
|
|
32745
32749
|
currentPage: 1
|
32746
32750
|
}));
|
32747
32751
|
};
|
32748
|
-
var debounceSearch = _$
|
32752
|
+
var debounceSearch = _$8.debounce(function () {
|
32749
32753
|
setNotificationFilter(_extends({}, notificationFilter, {
|
32750
32754
|
currentPage: 1
|
32751
32755
|
}));
|
@@ -33308,7 +33312,7 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
33308
33312
|
return !isTextType(answerType);
|
33309
33313
|
},
|
33310
33314
|
then: function then(schema) {
|
33311
|
-
return schema.min(
|
33315
|
+
return schema.min(1, t("answer_cannot_be_empty"));
|
33312
33316
|
},
|
33313
33317
|
otherwise: function otherwise(schema) {
|
33314
33318
|
return schema.notRequired();
|
@@ -33317,12 +33321,12 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
33317
33321
|
score: number().required(),
|
33318
33322
|
questionOrder: number().required(),
|
33319
33323
|
questionTypeId: number().notRequired(),
|
33320
|
-
correctTextualAnswers: array().
|
33324
|
+
correctTextualAnswers: array().when("questionAnswerType", {
|
33321
33325
|
is: function is(answerType) {
|
33322
33326
|
return isTextType(answerType);
|
33323
33327
|
},
|
33324
33328
|
then: function then(schema) {
|
33325
|
-
return schema.min(1, t("
|
33329
|
+
return schema.of(string().trim().required(t("answer_cannot_be_empty"))).min(1, t("answer_cannot_be_empty"));
|
33326
33330
|
},
|
33327
33331
|
otherwise: function otherwise(schema) {
|
33328
33332
|
return schema.notRequired();
|
@@ -33332,7 +33336,7 @@ var preparedTextbookSchema = function preparedTextbookSchema(t) {
|
|
33332
33336
|
return isTextType(answerType) && answerType !== QuestionAnswerType.ShortAnswer;
|
33333
33337
|
},
|
33334
33338
|
then: function then(schema) {
|
33335
|
-
return schema.min(2, t("
|
33339
|
+
return schema.of(string().trim().required(t("answer_cannot_be_empty"))).min(2, t("answer_cannot_be_empty"));
|
33336
33340
|
}
|
33337
33341
|
})
|
33338
33342
|
});
|
@@ -33472,7 +33476,7 @@ var CustomTextbookTab = function CustomTextbookTab(props) {
|
|
33472
33476
|
};
|
33473
33477
|
|
33474
33478
|
var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
33475
|
-
var values = isMath !== undefined ? _$
|
33479
|
+
var values = isMath !== undefined ? _$8.cloneDeep(textbook) : textbook;
|
33476
33480
|
if (isMath !== undefined) values.type = isMath;
|
33477
33481
|
for (var key in values) {
|
33478
33482
|
if (values.hasOwnProperty(key)) {
|
@@ -33487,7 +33491,7 @@ var _reduceToMathArticles = function reduceToMathArticles(textbook, isMath) {
|
|
33487
33491
|
return values;
|
33488
33492
|
};
|
33489
33493
|
var _resetAllCategoriesAndQuestionTypesBySubject = function resetAllCategoriesAndQuestionTypesBySubject(textbook, subject) {
|
33490
|
-
var values = subject ? _$
|
33494
|
+
var values = subject ? _$8.cloneDeep(textbook) : textbook;
|
33491
33495
|
if (subject) {
|
33492
33496
|
values.subjectId = subject === null || subject === void 0 ? void 0 : subject.value;
|
33493
33497
|
values.subject = subject;
|
@@ -33650,7 +33654,7 @@ var isSequentialQuestionGroups = function isSequentialQuestionGroups(questionGro
|
|
33650
33654
|
return true;
|
33651
33655
|
};
|
33652
33656
|
|
33653
|
-
var _ = _$
|
33657
|
+
var _ = _$8;
|
33654
33658
|
var ArticleBlock = function ArticleBlock(_ref) {
|
33655
33659
|
var errors = _ref.errors,
|
33656
33660
|
expandedIndex = _ref.expandedIndex,
|
@@ -33995,13 +33999,18 @@ var QuestionOrderName = function QuestionOrderName(_ref) {
|
|
33995
33999
|
}));
|
33996
34000
|
};
|
33997
34001
|
|
34002
|
+
var _$1 = _$8;
|
33998
34003
|
var QuestionShortInput = function QuestionShortInput(_ref) {
|
33999
34004
|
var name = _ref.name,
|
34000
34005
|
deletable = _ref.deletable,
|
34006
|
+
errors = _ref.errors,
|
34001
34007
|
onDelete = _ref.onDelete;
|
34002
34008
|
var _useTranslation = useTranslation(),
|
34003
34009
|
t = _useTranslation.t;
|
34004
|
-
|
34010
|
+
var error = _$1.get(errors, name);
|
34011
|
+
return React__default.createElement(Stack, {
|
34012
|
+
direction: "column"
|
34013
|
+
}, React__default.createElement(Field, {
|
34005
34014
|
name: name,
|
34006
34015
|
render: function render(_ref2) {
|
34007
34016
|
var field = _ref2.field;
|
@@ -34018,7 +34027,8 @@ var QuestionShortInput = function QuestionShortInput(_ref) {
|
|
34018
34027
|
"& input": {
|
34019
34028
|
paddingRight: deletable ? "40px" : undefined
|
34020
34029
|
}
|
34021
|
-
}
|
34030
|
+
},
|
34031
|
+
error: !!error
|
34022
34032
|
})), deletable && React__default.createElement(Stack, {
|
34023
34033
|
justifyContent: "center",
|
34024
34034
|
alignItems: "center",
|
@@ -34040,14 +34050,23 @@ var QuestionShortInput = function QuestionShortInput(_ref) {
|
|
34040
34050
|
size: 12
|
34041
34051
|
})))));
|
34042
34052
|
}
|
34043
|
-
})
|
34053
|
+
}), !!error && React__default.createElement(Typography, {
|
34054
|
+
fontWeight: 500,
|
34055
|
+
fontSize: "10px",
|
34056
|
+
lineHeight: "11.93px",
|
34057
|
+
mt: 1,
|
34058
|
+
color: !error ? "#97A1AF" : "#F34B4B"
|
34059
|
+
}, error));
|
34044
34060
|
};
|
34045
34061
|
var isEqual$1 = function isEqual(prev, next) {
|
34046
|
-
|
34062
|
+
var prevError = _$1.get(prev.errors, prev.name);
|
34063
|
+
var nextError = _$1.get(next.errors, next.name);
|
34064
|
+
return JSON.stringify(prevError) === JSON.stringify(nextError) && prev.value === next.value && prev.name == next.name && prev.deletable == next.deletable;
|
34047
34065
|
};
|
34048
34066
|
var QuestionShortInput$1 = memo(QuestionShortInput, isEqual$1);
|
34049
34067
|
|
34050
34068
|
var _excluded$h = ["onChange"];
|
34069
|
+
var _$2 = _$8;
|
34051
34070
|
var BpIcon$1 = styled("span")(function (_ref) {
|
34052
34071
|
var theme = _ref.theme;
|
34053
34072
|
return {
|
@@ -34078,6 +34097,7 @@ var BpCheckedIcon$1 = styled(BpIcon$1)({
|
|
34078
34097
|
}
|
34079
34098
|
});
|
34080
34099
|
var QuestionBlock = function QuestionBlock(_ref2) {
|
34100
|
+
var _data$correctTextualA4;
|
34081
34101
|
var answerCount = _ref2.answerCount,
|
34082
34102
|
isMath = _ref2.isMath,
|
34083
34103
|
disabled = _ref2.disabled,
|
@@ -34087,6 +34107,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34087
34107
|
isLoadingQuestionTypes = _ref2.isLoadingQuestionTypes,
|
34088
34108
|
optionKey = _ref2.optionKey,
|
34089
34109
|
questionTypes = _ref2.questionTypes,
|
34110
|
+
errors = _ref2.errors,
|
34090
34111
|
setFieldValue = _ref2.setFieldValue,
|
34091
34112
|
onCloseQuestionTypeMenu = _ref2.onCloseQuestionTypeMenu,
|
34092
34113
|
onOpenQuestionTypeMenu = _ref2.onOpenQuestionTypeMenu;
|
@@ -34095,7 +34116,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34095
34116
|
var theme = useTheme();
|
34096
34117
|
var isTabletUp = useMediaQuery(theme.breakpoints.up("lg"));
|
34097
34118
|
var handleCheckMultiChoice = function handleCheckMultiChoice(choice) {
|
34098
|
-
var
|
34119
|
+
var _data$correctAnswers;
|
34120
|
+
var updatedAnswers = (_data$correctAnswers = data.correctAnswers) != null ? _data$correctAnswers : [];
|
34099
34121
|
if (updatedAnswers.includes(choice)) {
|
34100
34122
|
updatedAnswers = updatedAnswers.filter(function (item) {
|
34101
34123
|
return item !== choice;
|
@@ -34106,36 +34128,41 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34106
34128
|
setFieldValue(path + ".correctAnswers", updatedAnswers);
|
34107
34129
|
};
|
34108
34130
|
var handleAddTextualAnswer = function handleAddTextualAnswer() {
|
34109
|
-
|
34110
|
-
setFieldValue(path + ".
|
34131
|
+
var _data$correctTextualA, _data$correctTextualA2;
|
34132
|
+
((_data$correctTextualA = data.correctTextualAnswers) === null || _data$correctTextualA === void 0 ? void 0 : _data$correctTextualA.length) === 1 && setFieldValue(path + ".questionAnswerType", QuestionAnswerType.OrderMatters);
|
34133
|
+
setFieldValue(path + ".correctTextualAnswers", [].concat((_data$correctTextualA2 = data.correctTextualAnswers) != null ? _data$correctTextualA2 : [], [""]));
|
34111
34134
|
};
|
34112
34135
|
var handleRemoveTextualAnswer = function handleRemoveTextualAnswer(remove, index) {
|
34113
|
-
|
34136
|
+
var _data$correctTextualA3;
|
34137
|
+
((_data$correctTextualA3 = data.correctTextualAnswers) === null || _data$correctTextualA3 === void 0 ? void 0 : _data$correctTextualA3.length) === 2 && setFieldValue(path + ".questionAnswerType", QuestionAnswerType.ShortAnswer);
|
34114
34138
|
remove(index);
|
34115
34139
|
};
|
34116
34140
|
var handleChangeQuestionAnswerType = function handleChangeQuestionAnswerType(value) {
|
34117
34141
|
switch (value === null || value === void 0 ? void 0 : value.value) {
|
34118
34142
|
case QuestionAnswerType.SingleChoice:
|
34119
34143
|
case QuestionAnswerType.MultipleChoice:
|
34120
|
-
setFieldValue(path + ".correctTextualAnswers",
|
34144
|
+
setFieldValue(path + ".correctTextualAnswers", null);
|
34145
|
+
if (!data.correctAnswers || data.correctAnswers.length === 0) setFieldValue(path + ".correctAnswers", [1]);
|
34121
34146
|
break;
|
34122
34147
|
default:
|
34123
|
-
if (data.correctTextualAnswers.length === 0) setFieldValue(path + ".correctTextualAnswers", [""]);
|
34148
|
+
if (!data.correctTextualAnswers || data.correctTextualAnswers.length === 0) setFieldValue(path + ".correctTextualAnswers", [""]);
|
34149
|
+
setFieldValue(path + ".correctAnswers", null);
|
34124
34150
|
break;
|
34125
34151
|
}
|
34126
|
-
setFieldValue(path + ".questionAnswerType", (value === null || value === void 0 ? void 0 : value.value) ||
|
34152
|
+
setFieldValue(path + ".questionAnswerType", (value === null || value === void 0 ? void 0 : value.value) || QuestionAnswerType.SingleChoice);
|
34127
34153
|
};
|
34128
34154
|
var handleChangeCompareType = function handleChangeCompareType(_, value) {
|
34129
|
-
setFieldValue(path + ".questionAnswerType", Number(value) ||
|
34155
|
+
setFieldValue(path + ".questionAnswerType", Number(value) || QuestionAnswerType.OrderMatters);
|
34130
34156
|
};
|
34131
34157
|
var handleOpenQuestionTypeMenu = function handleOpenQuestionTypeMenu() {
|
34132
34158
|
onOpenQuestionTypeMenu(path + ".questionTypeId");
|
34133
34159
|
};
|
34134
|
-
var isIncomplatedTextualAnswers = data.correctTextualAnswers.some(function (i) {
|
34135
|
-
return !i.trim();
|
34136
|
-
});
|
34137
34160
|
var isTextAnswerType = isTextType(data.questionAnswerType);
|
34161
|
+
var isIncomplatedTextualAnswers = isTextAnswerType && ((_data$correctTextualA4 = data.correctTextualAnswers) === null || _data$correctTextualA4 === void 0 ? void 0 : _data$correctTextualA4.some(function (i) {
|
34162
|
+
return !i.trim();
|
34163
|
+
}));
|
34138
34164
|
var renderAnswer = function renderAnswer() {
|
34165
|
+
var _data$correctAnswers3;
|
34139
34166
|
switch (data.questionAnswerType) {
|
34140
34167
|
case QuestionAnswerType.ShortAnswer:
|
34141
34168
|
case QuestionAnswerType.SynonymProcessing:
|
@@ -34144,6 +34171,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34144
34171
|
return React__default.createElement(FieldArray, {
|
34145
34172
|
name: path + ".correctTextualAnswers"
|
34146
34173
|
}, function (_ref3) {
|
34174
|
+
var _data$correctTextualA5;
|
34147
34175
|
var remove = _ref3.remove;
|
34148
34176
|
return React__default.createElement(Stack, {
|
34149
34177
|
sx: {
|
@@ -34157,18 +34185,19 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34157
34185
|
gap: "12px",
|
34158
34186
|
flexWrap: "wrap"
|
34159
34187
|
}, React__default.createElement(ListView, {
|
34160
|
-
data: data.correctTextualAnswers,
|
34188
|
+
data: (_data$correctTextualA5 = data.correctTextualAnswers) != null ? _data$correctTextualA5 : [],
|
34161
34189
|
render: function render(_, index) {
|
34162
34190
|
return React__default.createElement(Box, {
|
34163
34191
|
key: index,
|
34164
34192
|
minWidth: "200px"
|
34165
34193
|
}, React__default.createElement(QuestionShortInput$1, {
|
34194
|
+
errors: errors,
|
34166
34195
|
value: data.correctTextualAnswers[index],
|
34167
34196
|
name: path + ".correctTextualAnswers[" + index + "]",
|
34168
34197
|
onDelete: function onDelete() {
|
34169
34198
|
return handleRemoveTextualAnswer(remove, index);
|
34170
34199
|
},
|
34171
|
-
deletable: data.correctTextualAnswers.length > 1
|
34200
|
+
deletable: data.correctTextualAnswers && data.correctTextualAnswers.length > 1
|
34172
34201
|
}));
|
34173
34202
|
}
|
34174
34203
|
})));
|
@@ -34183,6 +34212,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34183
34212
|
}, function (_, i) {
|
34184
34213
|
return i + 1;
|
34185
34214
|
}).map(function (i) {
|
34215
|
+
var _data$correctAnswers2;
|
34186
34216
|
return React__default.createElement(FormControlLabel, {
|
34187
34217
|
key: i,
|
34188
34218
|
className: styles$a["question-label"] + " w-fit",
|
@@ -34190,7 +34220,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34190
34220
|
value: i,
|
34191
34221
|
disabled: disabled,
|
34192
34222
|
control: React__default.createElement(Checkbox, {
|
34193
|
-
checked: data.correctAnswers.includes(i),
|
34223
|
+
checked: (_data$correctAnswers2 = data.correctAnswers) === null || _data$correctAnswers2 === void 0 ? void 0 : _data$correctAnswers2.includes(i),
|
34194
34224
|
onChange: function onChange(e) {
|
34195
34225
|
return handleCheckMultiChoice(+e.target.value);
|
34196
34226
|
}
|
@@ -34208,7 +34238,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34208
34238
|
}, React__default.createElement(FormControl, {
|
34209
34239
|
className: "flex-grow-1 w-100"
|
34210
34240
|
}, React__default.createElement(RadioGroup, {
|
34211
|
-
value: data.correctAnswers[0],
|
34241
|
+
value: (_data$correctAnswers3 = data.correctAnswers) === null || _data$correctAnswers3 === void 0 ? void 0 : _data$correctAnswers3[0],
|
34212
34242
|
name: "answers",
|
34213
34243
|
className: "flex-row w-100"
|
34214
34244
|
}, Array.from({
|
@@ -34216,6 +34246,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34216
34246
|
}, function (_, i) {
|
34217
34247
|
return i + 1;
|
34218
34248
|
}).map(function (i) {
|
34249
|
+
var _data$correctAnswers4;
|
34219
34250
|
return React__default.createElement(FormControlLabel, {
|
34220
34251
|
key: i,
|
34221
34252
|
className: styles$a["question-label"] + " w-fit",
|
@@ -34227,7 +34258,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34227
34258
|
disabled: disabled,
|
34228
34259
|
control: React__default.createElement(Radio, {
|
34229
34260
|
size: "small",
|
34230
|
-
checked: +i === data.correctAnswers[0],
|
34261
|
+
checked: +i === ((_data$correctAnswers4 = data.correctAnswers) === null || _data$correctAnswers4 === void 0 ? void 0 : _data$correctAnswers4[0]),
|
34231
34262
|
checkedIcon: React__default.createElement(BpCheckedIcon$1, null),
|
34232
34263
|
icon: React__default.createElement(BpIcon$1, null)
|
34233
34264
|
}),
|
@@ -34275,7 +34306,7 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34275
34306
|
questionTitleStyle: questionTitleStyle
|
34276
34307
|
})), React__default.createElement(Box, {
|
34277
34308
|
flexGrow: 1
|
34278
|
-
}, data.correctTextualAnswers.length > 1 && React__default.createElement(Box, null, React__default.createElement(QuestionCompareType, {
|
34309
|
+
}, data.correctTextualAnswers && data.correctTextualAnswers.length > 1 && React__default.createElement(Box, null, React__default.createElement(QuestionCompareType, {
|
34279
34310
|
value: data.questionAnswerType,
|
34280
34311
|
onChange: handleChangeCompareType
|
34281
34312
|
})), renderAnswer())), React__default.createElement(Stack, {
|
@@ -34380,6 +34411,8 @@ var QuestionBlock = function QuestionBlock(_ref2) {
|
|
34380
34411
|
})))));
|
34381
34412
|
};
|
34382
34413
|
var isEqual$2 = function isEqual(prev, next) {
|
34414
|
+
var prevError = _$2.get(prev.errors, prev.path);
|
34415
|
+
var nextError = _$2.get(next.errors, next.path);
|
34383
34416
|
var isPrevMatched = prev.optionKey === prev.path + ".questionTypeId";
|
34384
34417
|
var isNextMatched = next.optionKey === next.path + ".questionTypeId";
|
34385
34418
|
var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
|
@@ -34388,12 +34421,12 @@ var isEqual$2 = function isEqual(prev, next) {
|
|
34388
34421
|
var nextIsLoadingQuestionTypes = isNextMatched ? next.isLoadingQuestionTypes : undefined;
|
34389
34422
|
var prevQuestionTypes = isPrevMatched ? prev.questionTypes : undefined;
|
34390
34423
|
var nextQuestionTypes = isNextMatched ? next.questionTypes : undefined;
|
34391
|
-
return prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.disabled == next.disabled && JSON.stringify(prev.questionTitleStyle) === JSON.stringify(next.questionTitleStyle) && prev.onOpenQuestionTypeMenu == next.onOpenQuestionTypeMenu;
|
34424
|
+
return JSON.stringify(prevError) === JSON.stringify(nextError) && prevOptionKey === nextOptionKey && prevIsLoadingQuestionTypes === nextIsLoadingQuestionTypes && JSON.stringify(prev.data) === JSON.stringify(next.data) && JSON.stringify(prevQuestionTypes) === JSON.stringify(nextQuestionTypes) && prev.path === next.path && prev.isMath == next.isMath && prev.answerCount == next.answerCount && prev.disabled == next.disabled && JSON.stringify(prev.questionTitleStyle) === JSON.stringify(next.questionTitleStyle) && prev.onOpenQuestionTypeMenu == next.onOpenQuestionTypeMenu;
|
34392
34425
|
};
|
34393
34426
|
var QuestionBlock$1 = memo(QuestionBlock, isEqual$2);
|
34394
34427
|
|
34395
34428
|
var _excluded$i = ["data", "path", "isMath", "open", "isLoadingCategories", "isLoadingQuestionTypes", "optionKey", "categories", "questionTypes", "disabled", "onQuestioStartOrderChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
34396
|
-
var _$
|
34429
|
+
var _$3 = _$8;
|
34397
34430
|
var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
34398
34431
|
var _data$articles$3, _data$articles$3$cate, _data$articles$4, _data$articles$4$cate, _questions$2;
|
34399
34432
|
var data = _ref.data,
|
@@ -34418,13 +34451,12 @@ var QuestionGroupBlockBody = function QuestionGroupBlockBody(_ref) {
|
|
34418
34451
|
var startOrderRef = useRef(null);
|
34419
34452
|
var articles = data.articles,
|
34420
34453
|
questions = data.questions;
|
34421
|
-
var blockErrors = _$
|
34422
|
-
console.log(path + ": ", blockErrors);
|
34454
|
+
var blockErrors = _$3.get(errors, path);
|
34423
34455
|
var handleOpenQuestionTypeMenu = useCallback(function (key) {
|
34424
34456
|
var _data$articles$, _data$articles$$categ, _data$articles$2, _data$articles$2$cate;
|
34425
34457
|
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]);
|
34426
34458
|
}, [(_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]]);
|
34427
|
-
var debounceQuestionStartOrderChange = _$
|
34459
|
+
var debounceQuestionStartOrderChange = _$3.debounce(onQuestioStartOrderChange, 300);
|
34428
34460
|
var handleChangeStartQuestionOrder = function handleChangeStartQuestionOrder(e) {
|
34429
34461
|
var value = e.target.value.replace(/\D/g, '');
|
34430
34462
|
var order = +value;
|
@@ -34536,8 +34568,8 @@ var isEqual$3 = function isEqual(prev, next) {
|
|
34536
34568
|
var isNextMatched = next.optionKey.startsWith(next.path);
|
34537
34569
|
var prevOptionKey = isPrevMatched ? prev.optionKey : undefined;
|
34538
34570
|
var nextOptionKey = isNextMatched ? next.optionKey : undefined;
|
34539
|
-
var prevBlockErrors = _$
|
34540
|
-
var nextBlockErrors = _$
|
34571
|
+
var prevBlockErrors = _$3.get(prev.errors, prev.path);
|
34572
|
+
var nextBlockErrors = _$3.get(next.errors, next.path);
|
34541
34573
|
var prevIsLoadingCategories = isPrevMatched ? prev.isLoadingCategories : undefined;
|
34542
34574
|
var nextIsLoadingCategories = isNextMatched ? next.isLoadingCategories : undefined;
|
34543
34575
|
var prevCategories = isPrevMatched ? prev.categories : undefined;
|
@@ -34557,7 +34589,7 @@ var isEqual$3 = function isEqual(prev, next) {
|
|
34557
34589
|
var QuestionGroupBlockBody$1 = memo(QuestionGroupBlockBody, isEqual$3);
|
34558
34590
|
|
34559
34591
|
var _excluded$j = ["expandedIndex", "open", "paths", "path", "isMath", "data", "categories", "isLoadingCategories", "isLoadingQuestionTypes", "questionTypes", "optionKey", "disabled", "onToggle", "onQuestionCountChange", "onDelete", "onOpenSubCategoryMenu", "onOpenCategoryMenu", "onCloseCategoryMenu", "onCopiedPrevQuestionGroup", "onCloseQuestionTypeMenu", "onOpenQuestionTypeMenu"];
|
34560
|
-
var _$
|
34592
|
+
var _$4 = _$8;
|
34561
34593
|
var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
34562
34594
|
var _data$articles$3, _data$articles$3$cate, _data$articles$3$cate2, _data$articles$4, _data$articles$4$cate, _data$articles$4$cate2;
|
34563
34595
|
var expandedIndex = _ref.expandedIndex,
|
@@ -34630,9 +34662,11 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
34630
34662
|
}));
|
34631
34663
|
} else {
|
34632
34664
|
setFieldValue(path + ".questions", questions.map(function (q) {
|
34633
|
-
var correctAnswers
|
34665
|
+
var _q$correctAnswers$fil, _q$correctAnswers;
|
34666
|
+
if (isTextType(q.questionAnswerType)) return _extends({}, q);
|
34667
|
+
var correctAnswers = (_q$correctAnswers$fil = (_q$correctAnswers = q.correctAnswers) === null || _q$correctAnswers === void 0 ? void 0 : _q$correctAnswers.filter(function (i) {
|
34634
34668
|
return i <= newAnswerCount;
|
34635
|
-
});
|
34669
|
+
})) != null ? _q$correctAnswers$fil : [1];
|
34636
34670
|
if (correctAnswers.length === 0) correctAnswers = [1];
|
34637
34671
|
return _extends({}, q, {
|
34638
34672
|
numberOfAnswers: newAnswerCount,
|
@@ -34682,10 +34716,10 @@ var QuestionGroupBlock = function QuestionGroupBlock(_ref) {
|
|
34682
34716
|
}).join(",") : ""].filter(function (i) {
|
34683
34717
|
return !!i;
|
34684
34718
|
}).join(" / ");
|
34685
|
-
var pageFromError = _$
|
34686
|
-
var pageToError = _$
|
34687
|
-
var categoryError = _$
|
34688
|
-
var blockErrors = _$
|
34719
|
+
var pageFromError = _$4.get(errors, path + ".pageFrom");
|
34720
|
+
var pageToError = _$4.get(errors, path + ".pageTo");
|
34721
|
+
var categoryError = _$4.get(errors, path + ".articles[0].categories");
|
34722
|
+
var blockErrors = _$4.get(errors, path);
|
34689
34723
|
return React__default.createElement(Accordion, {
|
34690
34724
|
expanded: open,
|
34691
34725
|
onChange: handleToggle,
|
@@ -35242,7 +35276,7 @@ var ChapterBlockBody = function ChapterBlockBody(_ref) {
|
|
35242
35276
|
};
|
35243
35277
|
|
35244
35278
|
var _excluded$l = ["data", "expandedIndex", "open", "path", "paths", "isMath", "isLoadingCategories", "isLoadingQuestionTypes", "categories", "questionTypes", "optionKey", "disabled", "onToggle", "onDelete", "onCopiedPrevQuestionGroup", "onCloseCategoryMenu", "onOpenCategoryMenu", "onOpenSubCategoryMenu", "onOpenQuestionTypeMenu", "onCloseQuestionTypeMenu"];
|
35245
|
-
var _$
|
35279
|
+
var _$5 = _$8;
|
35246
35280
|
var ChapterBlock = function ChapterBlock(_ref) {
|
35247
35281
|
var data = _ref.data,
|
35248
35282
|
expandedIndex = _ref.expandedIndex,
|
@@ -35282,10 +35316,10 @@ var ChapterBlock = function ChapterBlock(_ref) {
|
|
35282
35316
|
chapter: title
|
35283
35317
|
}), title, path.replace(/\[(\d+)\]$/, ""), expandedIndex);
|
35284
35318
|
};
|
35285
|
-
var pageNameError = _$
|
35286
|
-
var pageFromError = _$
|
35287
|
-
var pageToError = _$
|
35288
|
-
var blockErrors = _$
|
35319
|
+
var pageNameError = _$5.get(errors, path + ".name");
|
35320
|
+
var pageFromError = _$5.get(errors, path + ".pageFrom");
|
35321
|
+
var pageToError = _$5.get(errors, path + ".pageTo");
|
35322
|
+
var blockErrors = _$5.get(errors, path);
|
35289
35323
|
return React__default.createElement(Accordion, {
|
35290
35324
|
expanded: open,
|
35291
35325
|
onChange: handleToggle,
|
@@ -35633,7 +35667,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
35633
35667
|
return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : (_state$common2$user = _state$common2.user) === null || _state$common2$user === void 0 ? void 0 : _state$common2$user.academyDomain;
|
35634
35668
|
});
|
35635
35669
|
var getOptionFilter = function getOptionFilter() {
|
35636
|
-
var cloneFilter = _$
|
35670
|
+
var cloneFilter = _$8.clone(filter);
|
35637
35671
|
for (var key in cloneFilter) {
|
35638
35672
|
if (Object.prototype.hasOwnProperty.call(cloneFilter, key)) {
|
35639
35673
|
var element = cloneFilter[key];
|
@@ -35783,7 +35817,7 @@ var useTextbookOptions = function useTextbookOptions(subjectId, isMath, filter,
|
|
35783
35817
|
};
|
35784
35818
|
};
|
35785
35819
|
|
35786
|
-
var _$
|
35820
|
+
var _$6 = _$8;
|
35787
35821
|
var TextbookContentsTab = function TextbookContentsTab(props) {
|
35788
35822
|
var disabled = props.disabled,
|
35789
35823
|
values = props.values,
|
@@ -35826,7 +35860,7 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
35826
35860
|
};
|
35827
35861
|
var handleConfirmDeleteBlock = function handleConfirmDeleteBlock() {
|
35828
35862
|
if (!(openConfirmDelete !== null && openConfirmDelete !== void 0 && openConfirmDelete.path)) return;
|
35829
|
-
var items = _$
|
35863
|
+
var items = _$6.get(values, openConfirmDelete.path, []);
|
35830
35864
|
setFieldValue(openConfirmDelete.path, items.filter(function (_, i) {
|
35831
35865
|
return i !== openConfirmDelete.itemIndex;
|
35832
35866
|
}));
|
@@ -35866,12 +35900,12 @@ var TextbookContentsTab = function TextbookContentsTab(props) {
|
|
35866
35900
|
if (!newParts.length) return;
|
35867
35901
|
if (newParts.length < parts.length) {
|
35868
35902
|
var _$get, _$get2, _$get3;
|
35869
|
-
var subChapters = (_$get = _$
|
35903
|
+
var subChapters = (_$get = _$6.get(values, newPath + ".subChapters")) != null ? _$get : [];
|
35870
35904
|
var questionGroups = [];
|
35871
|
-
if (!subChapters.length) questionGroups = (_$get2 = _$
|
35872
|
-
return _$
|
35905
|
+
if (!subChapters.length) questionGroups = (_$get2 = _$6.get(values, newPath + ".questionGroups")) != null ? _$get2 : [];else questionGroups = (_$get3 = _$6.get(values, newPath + ".subChapters[" + (subChapters.length - 1) + "].questionGroups")) != null ? _$get3 : [];
|
35906
|
+
return _$6.last(questionGroups);
|
35873
35907
|
}
|
35874
|
-
return _$
|
35908
|
+
return _$6.get(values, newPath);
|
35875
35909
|
};
|
35876
35910
|
var handleOpenSubCategoryMenu = useCallback(function (key, categoryId) {
|
35877
35911
|
setOptionKey(key);
|
@@ -36363,7 +36397,7 @@ var useSelect = function useSelect(_ref) {
|
|
36363
36397
|
setLoading = _useState2[1];
|
36364
36398
|
useEffect(function () {
|
36365
36399
|
if (!email || !academy) return;
|
36366
|
-
var fetchData = _$
|
36400
|
+
var fetchData = _$8.debounce(function () {
|
36367
36401
|
try {
|
36368
36402
|
var _temp2 = function _temp2() {
|
36369
36403
|
setLoading(false);
|
@@ -36477,7 +36511,7 @@ var OwnerSelector = function OwnerSelector(_ref) {
|
|
36477
36511
|
}, errors === null || errors === void 0 ? void 0 : errors.textbookOwners[index].courseId)));
|
36478
36512
|
};
|
36479
36513
|
|
36480
|
-
var _$
|
36514
|
+
var _$7 = _$8;
|
36481
36515
|
var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
36482
36516
|
var errors = _ref.errors,
|
36483
36517
|
values = _ref.values,
|
@@ -36550,12 +36584,12 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
|
|
36550
36584
|
disabled: disabled || !!val.academyId && val.academyId !== (academy === null || academy === void 0 ? void 0 : academy.id)
|
36551
36585
|
}));
|
36552
36586
|
}
|
36553
|
-
}), _$
|
36587
|
+
}), _$7.get(errors, "textbookOwners[" + index + "].email") && React__default.createElement(Typography, {
|
36554
36588
|
fontWeight: 500,
|
36555
36589
|
fontSize: "10px",
|
36556
36590
|
lineHeight: "11.93px",
|
36557
36591
|
color: "#F34B4B"
|
36558
|
-
}, _$
|
36592
|
+
}, _$7.get(errors, "textbookOwners[" + index + "].email"))), !!(values !== null && values !== void 0 && (_values$textbookOwner = values.textbookOwners) !== null && _values$textbookOwner !== void 0 && _values$textbookOwner[index].email) && React__default.createElement(OwnerSelector, {
|
36559
36593
|
values: values,
|
36560
36594
|
errors: errors,
|
36561
36595
|
index: index,
|
@@ -36733,7 +36767,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
|
|
36733
36767
|
variant: "contained",
|
36734
36768
|
disabled: disabled,
|
36735
36769
|
onClick: function onClick() {
|
36736
|
-
if (!_$
|
36770
|
+
if (!_$8.isEmpty(errors)) {
|
36737
36771
|
toast.error(t$1("please_fill_in_the_blank_fields"));
|
36738
36772
|
}
|
36739
36773
|
},
|