mario-core 2.10.5-release → 2.10.6-release
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/index.js +159 -23
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +159 -23
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22208,6 +22208,93 @@ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.it
|
|
|
22208
22208
|
|
|
22209
22209
|
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
22210
22210
|
|
|
22211
|
+
// Asynchronously implement a generic for loop
|
|
22212
|
+
function _for(test, update, body) {
|
|
22213
|
+
var stage;
|
|
22214
|
+
for (;;) {
|
|
22215
|
+
var shouldContinue = test();
|
|
22216
|
+
if (_isSettledPact(shouldContinue)) {
|
|
22217
|
+
shouldContinue = shouldContinue.v;
|
|
22218
|
+
}
|
|
22219
|
+
if (!shouldContinue) {
|
|
22220
|
+
return result;
|
|
22221
|
+
}
|
|
22222
|
+
if (shouldContinue.then) {
|
|
22223
|
+
stage = 0;
|
|
22224
|
+
break;
|
|
22225
|
+
}
|
|
22226
|
+
var result = body();
|
|
22227
|
+
if (result && result.then) {
|
|
22228
|
+
if (_isSettledPact(result)) {
|
|
22229
|
+
result = result.s;
|
|
22230
|
+
} else {
|
|
22231
|
+
stage = 1;
|
|
22232
|
+
break;
|
|
22233
|
+
}
|
|
22234
|
+
}
|
|
22235
|
+
if (update) {
|
|
22236
|
+
var updateValue = update();
|
|
22237
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
22238
|
+
stage = 2;
|
|
22239
|
+
break;
|
|
22240
|
+
}
|
|
22241
|
+
}
|
|
22242
|
+
}
|
|
22243
|
+
var pact = new _Pact();
|
|
22244
|
+
var reject = _settle.bind(null, pact, 2);
|
|
22245
|
+
(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
|
|
22246
|
+
return pact;
|
|
22247
|
+
function _resumeAfterBody(value) {
|
|
22248
|
+
result = value;
|
|
22249
|
+
do {
|
|
22250
|
+
if (update) {
|
|
22251
|
+
updateValue = update();
|
|
22252
|
+
if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
|
|
22253
|
+
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
|
22254
|
+
return;
|
|
22255
|
+
}
|
|
22256
|
+
}
|
|
22257
|
+
shouldContinue = test();
|
|
22258
|
+
if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
|
|
22259
|
+
_settle(pact, 1, result);
|
|
22260
|
+
return;
|
|
22261
|
+
}
|
|
22262
|
+
if (shouldContinue.then) {
|
|
22263
|
+
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
22264
|
+
return;
|
|
22265
|
+
}
|
|
22266
|
+
result = body();
|
|
22267
|
+
if (_isSettledPact(result)) {
|
|
22268
|
+
result = result.v;
|
|
22269
|
+
}
|
|
22270
|
+
} while (!result || !result.then);
|
|
22271
|
+
result.then(_resumeAfterBody).then(void 0, reject);
|
|
22272
|
+
}
|
|
22273
|
+
function _resumeAfterTest(shouldContinue) {
|
|
22274
|
+
if (shouldContinue) {
|
|
22275
|
+
result = body();
|
|
22276
|
+
if (result && result.then) {
|
|
22277
|
+
result.then(_resumeAfterBody).then(void 0, reject);
|
|
22278
|
+
} else {
|
|
22279
|
+
_resumeAfterBody(result);
|
|
22280
|
+
}
|
|
22281
|
+
} else {
|
|
22282
|
+
_settle(pact, 1, result);
|
|
22283
|
+
}
|
|
22284
|
+
}
|
|
22285
|
+
function _resumeAfterUpdate() {
|
|
22286
|
+
if (shouldContinue = test()) {
|
|
22287
|
+
if (shouldContinue.then) {
|
|
22288
|
+
shouldContinue.then(_resumeAfterTest).then(void 0, reject);
|
|
22289
|
+
} else {
|
|
22290
|
+
_resumeAfterTest(shouldContinue);
|
|
22291
|
+
}
|
|
22292
|
+
} else {
|
|
22293
|
+
_settle(pact, 1, result);
|
|
22294
|
+
}
|
|
22295
|
+
}
|
|
22296
|
+
}
|
|
22297
|
+
|
|
22211
22298
|
// Asynchronously call a function and send errors to recovery continuation
|
|
22212
22299
|
function _catch(body, recover) {
|
|
22213
22300
|
try {
|
|
@@ -49700,12 +49787,56 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49700
49787
|
}
|
|
49701
49788
|
};
|
|
49702
49789
|
|
|
49790
|
+
var safeImport = function safeImport(importUsersCSV, formData, chunkIndex) {
|
|
49791
|
+
try {
|
|
49792
|
+
var _exit3 = false;
|
|
49793
|
+
var _retry = 0;
|
|
49794
|
+
return Promise.resolve(_for(function () {
|
|
49795
|
+
return !_exit3 && _retry < 2;
|
|
49796
|
+
}, function () {
|
|
49797
|
+
return _retry++;
|
|
49798
|
+
}, function () {
|
|
49799
|
+
return _catch(function () {
|
|
49800
|
+
_exit3 = true;
|
|
49801
|
+
return Promise.resolve(importUsersCSV(formData));
|
|
49802
|
+
}, function (err) {
|
|
49803
|
+
var _exit2 = false;
|
|
49804
|
+
|
|
49805
|
+
function _temp6(_result) {
|
|
49806
|
+
if (_exit2) return _result;
|
|
49807
|
+
throw err;
|
|
49808
|
+
}
|
|
49809
|
+
|
|
49810
|
+
if (err.response) {
|
|
49811
|
+
throw err;
|
|
49812
|
+
}
|
|
49813
|
+
|
|
49814
|
+
console.warn("\u26A0\uFE0F Chunk " + chunkIndex + " network error, retry " + (_retry + 1) + "/2...");
|
|
49815
|
+
|
|
49816
|
+
var _temp5 = function () {
|
|
49817
|
+
if (_retry < 1) {
|
|
49818
|
+
return Promise.resolve(new Promise(function (res) {
|
|
49819
|
+
return setTimeout(res, 500);
|
|
49820
|
+
})).then(function () {});
|
|
49821
|
+
} else {
|
|
49822
|
+
throw err;
|
|
49823
|
+
}
|
|
49824
|
+
}();
|
|
49825
|
+
|
|
49826
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
49827
|
+
});
|
|
49828
|
+
}));
|
|
49829
|
+
} catch (e) {
|
|
49830
|
+
return Promise.reject(e);
|
|
49831
|
+
}
|
|
49832
|
+
};
|
|
49833
|
+
|
|
49703
49834
|
var upload = React.useCallback(function (file) {
|
|
49704
49835
|
try {
|
|
49705
|
-
var
|
|
49836
|
+
var _exit5 = false;
|
|
49706
49837
|
|
|
49707
|
-
var
|
|
49708
|
-
if (
|
|
49838
|
+
var _temp14 = function _temp14(_result4) {
|
|
49839
|
+
if (_exit5) return _result4;
|
|
49709
49840
|
dispatch(setLoading(false));
|
|
49710
49841
|
var inputId = document.getElementById(id$1);
|
|
49711
49842
|
var input = document.getElementById('import-student');
|
|
@@ -49718,9 +49849,9 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49718
49849
|
if (!type || !file) return Promise.resolve();
|
|
49719
49850
|
dispatch(setLoading(true));
|
|
49720
49851
|
|
|
49721
|
-
var
|
|
49722
|
-
function
|
|
49723
|
-
if (
|
|
49852
|
+
var _temp15 = _catch(function () {
|
|
49853
|
+
function _temp11(_result3) {
|
|
49854
|
+
if (_exit5) return _result3;
|
|
49724
49855
|
dispatch(setAlert({
|
|
49725
49856
|
type: "success",
|
|
49726
49857
|
message: "Import CSV successfully"
|
|
@@ -49730,7 +49861,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49730
49861
|
var formData = new FormData();
|
|
49731
49862
|
formData.append("file", file, file.name);
|
|
49732
49863
|
|
|
49733
|
-
var
|
|
49864
|
+
var _temp10 = function () {
|
|
49734
49865
|
if (type == CSVType$1.AllUser) {
|
|
49735
49866
|
return Promise.resolve(file.text()).then(function (fileTextRaw) {
|
|
49736
49867
|
var fileText = fileTextRaw.trim();
|
|
@@ -49752,7 +49883,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49752
49883
|
});
|
|
49753
49884
|
var header = parsedData.meta.fields;
|
|
49754
49885
|
var dataRows = parsedData.data;
|
|
49755
|
-
var chunkSize =
|
|
49886
|
+
var chunkSize = 30;
|
|
49756
49887
|
var chunks = [];
|
|
49757
49888
|
|
|
49758
49889
|
for (var _i = 0; _i < dataRows.length; _i += chunkSize) {
|
|
@@ -49764,47 +49895,52 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49764
49895
|
chunks.push(csvChunk);
|
|
49765
49896
|
}
|
|
49766
49897
|
|
|
49767
|
-
var
|
|
49898
|
+
var _temp7 = _forTo(chunks, function (i) {
|
|
49768
49899
|
var blob = new Blob([chunks[i]], {
|
|
49769
49900
|
type: "text/csv"
|
|
49770
49901
|
});
|
|
49771
49902
|
var formData = new FormData();
|
|
49772
49903
|
formData.append("file", blob, "students_chunk" + (i + 1) + ".csv");
|
|
49773
|
-
return Promise.resolve(importUsersCSV$1
|
|
49904
|
+
return Promise.resolve(safeImport(importUsersCSV$1, formData, i + 1)).then(function () {
|
|
49905
|
+
return Promise.resolve(new Promise(function (res) {
|
|
49906
|
+
return setTimeout(res, 500);
|
|
49907
|
+
})).then(function () {});
|
|
49908
|
+
});
|
|
49774
49909
|
});
|
|
49775
49910
|
|
|
49776
|
-
if (
|
|
49911
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
49777
49912
|
});
|
|
49778
49913
|
} else {
|
|
49779
|
-
var
|
|
49914
|
+
var _temp16 = function () {
|
|
49780
49915
|
if (isCheckDomainIBS) {
|
|
49781
|
-
var
|
|
49916
|
+
var _temp17 = function () {
|
|
49782
49917
|
if (type == CSVType$1.ClassReflection) {
|
|
49783
49918
|
return Promise.resolve(importClassReflectionCSV$1(formData)).then(function () {});
|
|
49784
49919
|
}
|
|
49785
49920
|
}();
|
|
49786
49921
|
|
|
49787
|
-
if (
|
|
49922
|
+
if (_temp17 && _temp17.then) return _temp17.then(function () {});
|
|
49788
49923
|
} else {
|
|
49789
49924
|
return Promise.resolve(importCSV$1(formData, type.toString())).then(function () {});
|
|
49790
49925
|
}
|
|
49791
49926
|
}();
|
|
49792
49927
|
|
|
49793
|
-
if (
|
|
49928
|
+
if (_temp16 && _temp16.then) return _temp16.then(function () {});
|
|
49794
49929
|
}
|
|
49795
49930
|
}();
|
|
49796
49931
|
|
|
49797
|
-
return
|
|
49932
|
+
return _temp10 && _temp10.then ? _temp10.then(_temp11) : _temp11(_temp10);
|
|
49798
49933
|
}, function (err) {
|
|
49799
49934
|
var _err$response, _err$response$data;
|
|
49800
49935
|
|
|
49936
|
+
console.error("❌ Upload failed", err);
|
|
49801
49937
|
dispatch(setAlert({
|
|
49802
49938
|
type: "danger",
|
|
49803
49939
|
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) || err.message
|
|
49804
49940
|
}));
|
|
49805
49941
|
});
|
|
49806
49942
|
|
|
49807
|
-
return Promise.resolve(
|
|
49943
|
+
return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(_temp14) : _temp14(_temp15));
|
|
49808
49944
|
} catch (e) {
|
|
49809
49945
|
return Promise.reject(e);
|
|
49810
49946
|
}
|
|
@@ -49812,7 +49948,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49812
49948
|
|
|
49813
49949
|
var uploadByTeacherId = function uploadByTeacherId(file) {
|
|
49814
49950
|
try {
|
|
49815
|
-
var
|
|
49951
|
+
var _temp20 = function _temp20() {
|
|
49816
49952
|
dispatch(setLoading(false));
|
|
49817
49953
|
var input = document.getElementById('teacherSelector');
|
|
49818
49954
|
input && (input.value = "");
|
|
@@ -49829,7 +49965,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49829
49965
|
if (!type || !file) return Promise.resolve();
|
|
49830
49966
|
dispatch(setLoading(true));
|
|
49831
49967
|
|
|
49832
|
-
var
|
|
49968
|
+
var _temp21 = _catch(function () {
|
|
49833
49969
|
var formData = new FormData();
|
|
49834
49970
|
formData.append("file", file, file.name);
|
|
49835
49971
|
return Promise.resolve(importStudentByTeacher$1(defaultTeacher, formData)).then(function () {
|
|
@@ -49847,7 +49983,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49847
49983
|
}));
|
|
49848
49984
|
});
|
|
49849
49985
|
|
|
49850
|
-
return Promise.resolve(
|
|
49986
|
+
return Promise.resolve(_temp21 && _temp21.then ? _temp21.then(_temp20) : _temp20(_temp21));
|
|
49851
49987
|
} catch (e) {
|
|
49852
49988
|
return Promise.reject(e);
|
|
49853
49989
|
}
|
|
@@ -49855,7 +49991,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49855
49991
|
|
|
49856
49992
|
var onConfirm = function onConfirm(values) {
|
|
49857
49993
|
try {
|
|
49858
|
-
var
|
|
49994
|
+
var _temp24 = function _temp24() {
|
|
49859
49995
|
dispatch(setLoading(false));
|
|
49860
49996
|
var input = document.getElementById(id$1);
|
|
49861
49997
|
input && (input.value = "");
|
|
@@ -49864,7 +50000,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49864
50000
|
if (!dataFile || !dataFile) return Promise.resolve();
|
|
49865
50001
|
dispatch(setLoading(true));
|
|
49866
50002
|
|
|
49867
|
-
var
|
|
50003
|
+
var _temp25 = _catch(function () {
|
|
49868
50004
|
var formData = new FormData();
|
|
49869
50005
|
formData.append("file", dataFile, dataFile.name);
|
|
49870
50006
|
formData.append("teacherName", values.teacherName);
|
|
@@ -49888,7 +50024,7 @@ var useCSVImportTab = function useCSVImportTab() {
|
|
|
49888
50024
|
}));
|
|
49889
50025
|
});
|
|
49890
50026
|
|
|
49891
|
-
return Promise.resolve(
|
|
50027
|
+
return Promise.resolve(_temp25 && _temp25.then ? _temp25.then(_temp24) : _temp24(_temp25));
|
|
49892
50028
|
} catch (e) {
|
|
49893
50029
|
return Promise.reject(e);
|
|
49894
50030
|
}
|