mario-education 2.4.300-layout → 2.4.301-layout
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.
|
@@ -39,5 +39,6 @@ declare const useQuestionDetail: (id?: number | undefined, type?: number | undef
|
|
|
39
39
|
setEditedTrue: () => Promise<void>;
|
|
40
40
|
handleGetLabelQuestions: (questionType: any) => Promise<void>;
|
|
41
41
|
labelQuestions: IQuestionLabel;
|
|
42
|
+
tinyMCEKey: string;
|
|
42
43
|
};
|
|
43
44
|
export default useQuestionDetail;
|
package/dist/index.js
CHANGED
|
@@ -1656,6 +1656,7 @@ var SkillSelector = function SkillSelector(_ref) {
|
|
|
1656
1656
|
};
|
|
1657
1657
|
|
|
1658
1658
|
var QUESTION_URL = marioCore.BASE_URL + "/api/question";
|
|
1659
|
+
var TINY_MCE_KEY_URL = "/api/TinyMCEKey";
|
|
1659
1660
|
var get$2 = function get(filter) {
|
|
1660
1661
|
return marioCore.api.get(QUESTION_URL, {
|
|
1661
1662
|
params: filter
|
|
@@ -1691,6 +1692,9 @@ var getLabelQuestions = function getLabelQuestions(filter) {
|
|
|
1691
1692
|
params: filter
|
|
1692
1693
|
});
|
|
1693
1694
|
};
|
|
1695
|
+
var getTinyMCEKeyApi = function getTinyMCEKeyApi() {
|
|
1696
|
+
return marioCore.api.get("" + TINY_MCE_KEY_URL);
|
|
1697
|
+
};
|
|
1694
1698
|
|
|
1695
1699
|
var QuestionSelector = function QuestionSelector(_ref) {
|
|
1696
1700
|
var value = _ref.value,
|
|
@@ -14460,7 +14464,9 @@ var SliderScale = function SliderScale(_ref) {
|
|
|
14460
14464
|
id: "combo-box-demo",
|
|
14461
14465
|
freeSolo: true,
|
|
14462
14466
|
options: fromLabels.filter(function (r) {
|
|
14463
|
-
|
|
14467
|
+
var _fromLabel$toLocaleLo;
|
|
14468
|
+
|
|
14469
|
+
return !(fromLabel !== null && fromLabel !== void 0 && fromLabel.trim()) ? true : r.toLocaleLowerCase().includes(fromLabel === null || fromLabel === void 0 ? void 0 : (_fromLabel$toLocaleLo = fromLabel.toLocaleLowerCase()) === null || _fromLabel$toLocaleLo === void 0 ? void 0 : _fromLabel$toLocaleLo.trim());
|
|
14464
14470
|
}) || [],
|
|
14465
14471
|
value: fromLabel || null,
|
|
14466
14472
|
onChange: function onChange(_e, value) {
|
|
@@ -14481,7 +14487,9 @@ var SliderScale = function SliderScale(_ref) {
|
|
|
14481
14487
|
id: "combo-box-demo",
|
|
14482
14488
|
freeSolo: true,
|
|
14483
14489
|
options: toLabels.filter(function (r) {
|
|
14484
|
-
|
|
14490
|
+
var _toLabel$toLocaleLowe;
|
|
14491
|
+
|
|
14492
|
+
return !(toLabel !== null && toLabel !== void 0 && toLabel.trim()) ? true : r.toLocaleLowerCase().includes(toLabel === null || toLabel === void 0 ? void 0 : (_toLabel$toLocaleLowe = toLabel.toLocaleLowerCase()) === null || _toLabel$toLocaleLowe === void 0 ? void 0 : _toLabel$toLocaleLowe.trim());
|
|
14485
14493
|
}) || [],
|
|
14486
14494
|
value: toLabel || null,
|
|
14487
14495
|
onChange: function onChange(_e, value) {
|
|
@@ -15110,6 +15118,10 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15110
15118
|
labelQuestions = _useState3[0],
|
|
15111
15119
|
setLabelQuestions = _useState3[1];
|
|
15112
15120
|
|
|
15121
|
+
var _useState4 = React.useState(""),
|
|
15122
|
+
tinyMCEKey = _useState4[0],
|
|
15123
|
+
setTinyMCEKey = _useState4[1];
|
|
15124
|
+
|
|
15113
15125
|
var getMinIdCategory = function getMinIdCategory(categories) {
|
|
15114
15126
|
var sortedCategory = categories.sort(function (c1, c2) {
|
|
15115
15127
|
return c1.id - c2.id;
|
|
@@ -15118,7 +15130,7 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15118
15130
|
return (firstCategory === null || firstCategory === void 0 ? void 0 : firstCategory.id) || 1;
|
|
15119
15131
|
};
|
|
15120
15132
|
|
|
15121
|
-
var
|
|
15133
|
+
var getTinyMCEKey = function getTinyMCEKey() {
|
|
15122
15134
|
try {
|
|
15123
15135
|
var _temp3 = function _temp3() {
|
|
15124
15136
|
dispatch(marioCore.setLoading(false));
|
|
@@ -15127,6 +15139,37 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15127
15139
|
dispatch(marioCore.setLoading(true));
|
|
15128
15140
|
|
|
15129
15141
|
var _temp4 = _catch(function () {
|
|
15142
|
+
return Promise.resolve(getTinyMCEKeyApi()).then(function (res) {
|
|
15143
|
+
var data = res.data;
|
|
15144
|
+
|
|
15145
|
+
if (!!data) {
|
|
15146
|
+
setTinyMCEKey(data.key);
|
|
15147
|
+
}
|
|
15148
|
+
});
|
|
15149
|
+
}, function (err) {
|
|
15150
|
+
var _err$response, _err$response$data;
|
|
15151
|
+
|
|
15152
|
+
dispatch(marioCore.setAlert({
|
|
15153
|
+
type: "danger",
|
|
15154
|
+
message: ((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.title) || "Get question failed"
|
|
15155
|
+
}));
|
|
15156
|
+
});
|
|
15157
|
+
|
|
15158
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
15159
|
+
} catch (e) {
|
|
15160
|
+
return Promise.reject(e);
|
|
15161
|
+
}
|
|
15162
|
+
};
|
|
15163
|
+
|
|
15164
|
+
var getQuestionCategories = function getQuestionCategories() {
|
|
15165
|
+
try {
|
|
15166
|
+
var _temp7 = function _temp7() {
|
|
15167
|
+
dispatch(marioCore.setLoading(false));
|
|
15168
|
+
};
|
|
15169
|
+
|
|
15170
|
+
dispatch(marioCore.setLoading(true));
|
|
15171
|
+
|
|
15172
|
+
var _temp8 = _catch(function () {
|
|
15130
15173
|
return Promise.resolve(get$i()).then(function (res) {
|
|
15131
15174
|
var items = res.data.items;
|
|
15132
15175
|
var categoryId = getMinIdCategory(items);
|
|
@@ -15135,15 +15178,15 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15135
15178
|
}));
|
|
15136
15179
|
});
|
|
15137
15180
|
}, function (err) {
|
|
15138
|
-
var _err$
|
|
15181
|
+
var _err$response2, _err$response2$data;
|
|
15139
15182
|
|
|
15140
15183
|
dispatch(marioCore.setAlert({
|
|
15141
15184
|
type: "danger",
|
|
15142
|
-
message: ((_err$
|
|
15185
|
+
message: ((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.title) || "Get question failed"
|
|
15143
15186
|
}));
|
|
15144
15187
|
});
|
|
15145
15188
|
|
|
15146
|
-
return Promise.resolve(
|
|
15189
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
|
|
15147
15190
|
} catch (e) {
|
|
15148
15191
|
return Promise.reject(e);
|
|
15149
15192
|
}
|
|
@@ -15162,13 +15205,13 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15162
15205
|
}, [id, type]);
|
|
15163
15206
|
var getData = React.useCallback(function () {
|
|
15164
15207
|
try {
|
|
15165
|
-
var
|
|
15208
|
+
var _temp11 = function _temp11() {
|
|
15166
15209
|
dispatch(marioCore.setLoading(false));
|
|
15167
15210
|
};
|
|
15168
15211
|
|
|
15169
15212
|
dispatch(marioCore.setLoading(true));
|
|
15170
15213
|
|
|
15171
|
-
var
|
|
15214
|
+
var _temp12 = _catch(function () {
|
|
15172
15215
|
return Promise.resolve(getById$2(id)).then(function (res) {
|
|
15173
15216
|
var _res$data$category, _res$data, _res$data2, _res$data3;
|
|
15174
15217
|
|
|
@@ -15183,15 +15226,15 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15183
15226
|
}
|
|
15184
15227
|
});
|
|
15185
15228
|
}, function (err) {
|
|
15186
|
-
var _err$
|
|
15229
|
+
var _err$response3, _err$response3$data;
|
|
15187
15230
|
|
|
15188
15231
|
dispatch(marioCore.setAlert({
|
|
15189
15232
|
type: "danger",
|
|
15190
|
-
message: ((_err$
|
|
15233
|
+
message: ((_err$response3 = err.response) === null || _err$response3 === void 0 ? void 0 : (_err$response3$data = _err$response3.data) === null || _err$response3$data === void 0 ? void 0 : _err$response3$data.title) || "Get key failed"
|
|
15191
15234
|
}));
|
|
15192
15235
|
});
|
|
15193
15236
|
|
|
15194
|
-
return Promise.resolve(
|
|
15237
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12));
|
|
15195
15238
|
} catch (e) {
|
|
15196
15239
|
return Promise.reject(e);
|
|
15197
15240
|
}
|
|
@@ -15208,14 +15251,14 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15208
15251
|
try {
|
|
15209
15252
|
var _exit2 = false;
|
|
15210
15253
|
|
|
15211
|
-
var
|
|
15254
|
+
var _temp15 = function _temp15(_result) {
|
|
15212
15255
|
if (_exit2) return _result;
|
|
15213
15256
|
dispatch(marioCore.setLoading(false));
|
|
15214
15257
|
};
|
|
15215
15258
|
|
|
15216
15259
|
dispatch(marioCore.setLoading(true));
|
|
15217
15260
|
|
|
15218
|
-
var
|
|
15261
|
+
var _temp16 = _catch(function () {
|
|
15219
15262
|
var next = !!id ? update$2 : create$2;
|
|
15220
15263
|
var validator = validationChoices(data);
|
|
15221
15264
|
if (validator.isError) throw new Error(validator.message);
|
|
@@ -15228,28 +15271,28 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15228
15271
|
backToList();
|
|
15229
15272
|
});
|
|
15230
15273
|
}, function (err) {
|
|
15231
|
-
var _err$
|
|
15274
|
+
var _err$response4, _err$response4$data;
|
|
15232
15275
|
|
|
15233
15276
|
dispatch(marioCore.setAlert({
|
|
15234
15277
|
type: "danger",
|
|
15235
|
-
message: ((_err$
|
|
15278
|
+
message: ((_err$response4 = err.response) === null || _err$response4 === void 0 ? void 0 : (_err$response4$data = _err$response4.data) === null || _err$response4$data === void 0 ? void 0 : _err$response4$data.title) || err.message
|
|
15236
15279
|
}));
|
|
15237
15280
|
});
|
|
15238
15281
|
|
|
15239
|
-
return Promise.resolve(
|
|
15282
|
+
return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(_temp15) : _temp15(_temp16));
|
|
15240
15283
|
} catch (e) {
|
|
15241
15284
|
return Promise.reject(e);
|
|
15242
15285
|
}
|
|
15243
15286
|
}, [id]);
|
|
15244
15287
|
var handleGetLabelQuestions = React.useCallback(function (questionType) {
|
|
15245
15288
|
try {
|
|
15246
|
-
var
|
|
15289
|
+
var _temp19 = function _temp19() {
|
|
15247
15290
|
dispatch(marioCore.setLoading(false));
|
|
15248
15291
|
};
|
|
15249
15292
|
|
|
15250
15293
|
dispatch(marioCore.setLoading(true));
|
|
15251
15294
|
|
|
15252
|
-
var
|
|
15295
|
+
var _temp20 = _catch(function () {
|
|
15253
15296
|
return Promise.resolve(getLabelQuestions({
|
|
15254
15297
|
isDefaultSurvey: true,
|
|
15255
15298
|
questionType: questionType
|
|
@@ -15257,19 +15300,22 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15257
15300
|
setLabelQuestions(res.data);
|
|
15258
15301
|
});
|
|
15259
15302
|
}, function (err) {
|
|
15260
|
-
var _err$
|
|
15303
|
+
var _err$response5, _err$response5$data;
|
|
15261
15304
|
|
|
15262
15305
|
dispatch(marioCore.setAlert({
|
|
15263
15306
|
type: "danger",
|
|
15264
|
-
message: ((_err$
|
|
15307
|
+
message: ((_err$response5 = err.response) === null || _err$response5 === void 0 ? void 0 : (_err$response5$data = _err$response5.data) === null || _err$response5$data === void 0 ? void 0 : _err$response5$data.title) || err.message
|
|
15265
15308
|
}));
|
|
15266
15309
|
});
|
|
15267
15310
|
|
|
15268
|
-
return Promise.resolve(
|
|
15311
|
+
return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(_temp19) : _temp19(_temp20));
|
|
15269
15312
|
} catch (e) {
|
|
15270
15313
|
return Promise.reject(e);
|
|
15271
15314
|
}
|
|
15272
15315
|
}, []);
|
|
15316
|
+
React.useEffect(function () {
|
|
15317
|
+
getTinyMCEKey();
|
|
15318
|
+
}, []);
|
|
15273
15319
|
return {
|
|
15274
15320
|
questionDetail: questionDetail,
|
|
15275
15321
|
setEditorRef: setEditorRef,
|
|
@@ -15279,7 +15325,8 @@ var useQuestionDetail$1 = function useQuestionDetail(id, type) {
|
|
|
15279
15325
|
setEdited: setEdited,
|
|
15280
15326
|
setEditedTrue: setEditedTrue,
|
|
15281
15327
|
handleGetLabelQuestions: handleGetLabelQuestions,
|
|
15282
|
-
labelQuestions: labelQuestions
|
|
15328
|
+
labelQuestions: labelQuestions,
|
|
15329
|
+
tinyMCEKey: tinyMCEKey
|
|
15283
15330
|
};
|
|
15284
15331
|
};
|
|
15285
15332
|
|
|
@@ -15356,7 +15403,8 @@ var QuestionDetail = function QuestionDetail() {
|
|
|
15356
15403
|
setEdited = _useQuestionDetail.setEdited,
|
|
15357
15404
|
setEditedTrue = _useQuestionDetail.setEditedTrue,
|
|
15358
15405
|
handleGetLabelQuestions = _useQuestionDetail.handleGetLabelQuestions,
|
|
15359
|
-
labelQuestions = _useQuestionDetail.labelQuestions
|
|
15406
|
+
labelQuestions = _useQuestionDetail.labelQuestions,
|
|
15407
|
+
tinyMCEKey = _useQuestionDetail.tinyMCEKey;
|
|
15360
15408
|
|
|
15361
15409
|
var header = !!id ? t(EDIT_QUESTION_HEADER) : t(CREATE_QUESTION_HEADER);
|
|
15362
15410
|
var confirmText = !!id ? t("update") : t("create");
|
|
@@ -15461,8 +15509,8 @@ var QuestionDetail = function QuestionDetail() {
|
|
|
15461
15509
|
className: styles["form-question-text"] + " mb-2"
|
|
15462
15510
|
}, React__default.createElement(marioCore.RequiredLabel, {
|
|
15463
15511
|
text: t("question_text")
|
|
15464
|
-
}), (questionDetail.text || !id) && React__default.createElement(tinymceReact.Editor, {
|
|
15465
|
-
apiKey:
|
|
15512
|
+
}), (questionDetail.text || !id) && !!tinyMCEKey && React__default.createElement(tinymceReact.Editor, {
|
|
15513
|
+
apiKey: tinyMCEKey,
|
|
15466
15514
|
initialValue: questionDetail.text,
|
|
15467
15515
|
init: marioCore.editorConfig.question,
|
|
15468
15516
|
onEditorChange: function onEditorChange(content) {
|
|
@@ -69901,7 +69949,7 @@ var useHeaderSideBar = function useHeaderSideBar(_navigations) {
|
|
|
69901
69949
|
|
|
69902
69950
|
var openProfile = function openProfile() {
|
|
69903
69951
|
handleClose();
|
|
69904
|
-
var url = "/
|
|
69952
|
+
var url = "/admin/user/" + userId;
|
|
69905
69953
|
history.push(url);
|
|
69906
69954
|
};
|
|
69907
69955
|
|