mario-education 2.4.302-layout → 2.4.304-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.
- package/dist/components/layouts/hooks/useHeaderSideBar.d.ts +1 -1
- package/dist/components/layouts/hooks/useLanguages.d.ts +10 -0
- package/dist/containers/ConductSurvey/components/diaglog/hooks/useInterventionDialog.d.ts +1 -1
- package/dist/index.js +279 -385
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +280 -386
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api, BASE_URL, useTranslation as useTranslation$1, setAlert, CustomSelector, LinkEditButton, DeleteButtonIcon, EmptyDataAlert, CommonModal, RequiredLabel, ErrorHandler, useFilters, setLoading, setClassList, setModal, QuitPrompt, AddButton, CustomPagination, setConferenceRubricList, SearchBoxContainer, getTextFromHTML, DEFAULT_LANGUAGE_CODE, generateRandomString, SuggestionCategorySelector, CreatableSelector, setSuggestionList, setStrategyList, UploadFileButton, systemStudentBadge, setBadgeList, getFileUrl, setGoalExampleList, setSubjectList, setLearningSupportCategoryList, apiUpload, utcToLocalTime, setBandScoreList, EditButtonIcon, DATE_FORMAT, setSchoolBlankDayList, SearchBox, CustomTab, SkillList, QUESTION_TYPES, EMOTIONS, QUESTION_TYPES_OPTIONS, setQuestionList, QuestionCategorySelector, setQuestionByCategory, setSelectQuestion, setResetQuestionList, setMoveItemQuestion, setEditItemQuesion, DEFAULT_FILTER as DEFAULT_FILTER$2, setReflectionList, setReflectionResultList, DATE_RESULT, StarRatingSelector, QuestionTypeSelector, CategorySelector as CategorySelector$1, editorConfig, DetailActionButtons, setAssessmentList, FULL_DATE_RESULT, setFeedbackList, TINY_MCE_API_KEY, setTutorialScreenList, setQuestionCateList, setAssignmentList, setSessionTemplateList, setSessionTemplateGeneralClassList, setCustomAlertList, systemCertificateUpload, setCertificateList, getStaticFileUrl, ACCESS_TOKEN, reset, NOTIFICATION_ALERT_KEY, setUser, setSandboxMode,
|
|
1
|
+
import { api, BASE_URL, useTranslation as useTranslation$1, setAlert, CustomSelector, LinkEditButton, DeleteButtonIcon, EmptyDataAlert, CommonModal, RequiredLabel, ErrorHandler, useFilters, setLoading, setClassList, setModal, QuitPrompt, AddButton, CustomPagination, setConferenceRubricList, SearchBoxContainer, getTextFromHTML, DEFAULT_LANGUAGE_CODE, generateRandomString, SuggestionCategorySelector, CreatableSelector, setSuggestionList, setStrategyList, UploadFileButton, systemStudentBadge, setBadgeList, getFileUrl, setGoalExampleList, setSubjectList, setLearningSupportCategoryList, apiUpload, utcToLocalTime, setBandScoreList, EditButtonIcon, DATE_FORMAT, setSchoolBlankDayList, SearchBox, CustomTab, SkillList, QUESTION_TYPES, EMOTIONS, QUESTION_TYPES_OPTIONS, setQuestionList, QuestionCategorySelector, setQuestionByCategory, setSelectQuestion, setResetQuestionList, setMoveItemQuestion, setEditItemQuesion, DEFAULT_FILTER as DEFAULT_FILTER$2, setReflectionList, setReflectionResultList, DATE_RESULT, StarRatingSelector, QuestionTypeSelector, CategorySelector as CategorySelector$1, editorConfig, DetailActionButtons, setAssessmentList, FULL_DATE_RESULT, setFeedbackList, TINY_MCE_API_KEY, setTutorialScreenList, setQuestionCateList, setAssignmentList, setSessionTemplateList, setSessionTemplateGeneralClassList, setCustomAlertList, systemCertificateUpload, setCertificateList, getStaticFileUrl, ACCESS_TOKEN, reset, NOTIFICATION_ALERT_KEY, setUser, setSandboxMode, getCookieValue, setLanguage, showMenuBar, showFontSize, NOTIFICATION_CHANNEL, setEnableIEP, setConversationOneToOne, setEnableSurvey, canAccessRoute, initAmplitude, firstCheckToken, getInfo, Loading as Loading$1, Dashboard as Dashboard$1, TheContent, LICENSE_AGGRID } from 'mario-core';
|
|
2
2
|
import { LicenseManager } from '@ag-grid-enterprise/core';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useRef, useCallback, useEffect, forwardRef, useMemo, Fragment as Fragment$1, memo, useLayoutEffect, useContext, createContext, createElement, Component } from 'react';
|
|
@@ -15647,7 +15647,6 @@ var QuestionDetail = function QuestionDetail() {
|
|
|
15647
15647
|
},
|
|
15648
15648
|
apiKey: tinyMCEKey,
|
|
15649
15649
|
value: questionDetail.text,
|
|
15650
|
-
initialValue: questionDetail.text,
|
|
15651
15650
|
init: _extends({}, editorConfig.question, {
|
|
15652
15651
|
paste_preprocess: function paste_preprocess(_plugin, args) {
|
|
15653
15652
|
args.content = args.content.replace(/<\/?(?!b\b|p\b)[^>]+>/g, "");
|
|
@@ -50046,92 +50045,83 @@ var CustomTabComponent = function CustomTabComponent(_ref) {
|
|
|
50046
50045
|
|
|
50047
50046
|
var style$2 = {"font-large":"_356Xx","table-border":"_3rVdM","Close":"_2Vs6W","Active":"_fISYg","row_name":"_2-4H1","bg-red":"_1G8nL","bg-green":"_ATqes","bg-yellow":"_U2Fov","row-status":"_2mAty","table-class-type":"_2KRfC","box-form-input":"_3bgU2","box-content":"_4h5aW","confirm_btn_title":"_3vU-q","content":"_2eddN","btn-favorite-text":"_3bpqI","description-template-left":"_3BhUP","name-template-left":"_2CA9Q","data-grid-content":"_697ao","select-right":"_1J-bu","content-confirm-model":"_2pqFa","input-title":"_1Dfbh","total-card-title":"_2-hXf","title-filter":"_36snY","form-input-title":"_1FINV","list-favorite":"_3EcML","title":"_2sFa5","title-block":"_18vbq","box-additional-title":"_NUXao","dialog-title":"_1oyCk","title-chart":"_2Yhd1","btn-send-survey":"_1xze5","btn-cancel":"_1bqU6","chip-email-default":"_2xKhD","chip-email-checked":"_ouqj6","title-content":"_2O3Tp","create-btn":"_3Cux8","general-chart-title":"_2Lxtl","action-wrapper":"_rEUU_","action-item":"_2n3hL","survey-detail":"_3vJ-g","header-survey-detail":"_Ri4lG","content-header":"_M7dFA","survey-title":"_2APad","responses-distribution":"_1I0XZ","description":"_1hw5e","list-check-question":"_1Ejsc","select-question":"_2t6cX","question":"_2cNmh","ratings-of-questions":"_3225G","show-result":"_3KDFH","chart-result-for-question":"_N5fxX","parameter":"_1NNB0","percent":"_-Fj2n","chart":"_1Qyn4","legend":"_1tBch","avr":"_2TsdE","legend-item":"_3YpJk","name":"_2W9F-","action":"_Ldh2m","header-conduct":"_1npo6","student-detail":"_1pKV2","student-name":"_1GBNs","survey-name":"_2qlBy","conduct-body":"_1dxHK","response-question":"_3IlYT","title-model":"_1UBEA","total-cards":"_38gNv","card":"_C2FoT","response-body":"_3XFlg","student":"_2fuBW","date":"_QH_aS","answer":"_3Rool","none-answer":"_l65o6","font-small":"_1mTdj","option-select":"_32CPv","icon-add-header":"_2tltH","sup-require":"_3IAjJ","span-title":"_2vOMh","checked-favorite":"_JL458","flag":"_1jRbU","filter-desktop":"_1ByZl","h-75":"_2bC49","filter-mobile":"_39EFp","d-flex":"_3ILHs","flex-between":"_1Dy7M","pointer":"_1G7Oj","ml-10":"_3pvOS","mt-20":"_3QSsx","select-type":"_1zeZ3","all-student-survey":"_2rp1M","box-input-csv":"_HGXSI","icon":"_2jqP8","model-confirm-publish":"_1DLAE","box-email-content":"_3aA8I","input-mail-content":"_3HfSn","list-chip-email":"_2mJew","box-chip-email":"_2fwdD","table-desktop":"_3_y0a","table-container":"_DFKYF","data-grid":"_3EcnW","MuiDataGrid-columnSeparator":"_3P0hc","table-mobile":"_1iMfJ","block-list-survey":"_EuZ8_","box-filter":"_3utMA","block-total":"_qlUFF","list-card-right":"_Epdgt","filter-select":"_20eFs","box-filter-left":"_MtBqD","filter-item":"_1WJAo","box-filter-right":"_2VDGv","search-input-icon":"_1FexU","inputInput":"_2JzR2","external-item":"_2iP6U","action-view":"_6y3DH","time-Date":"_17nC2","time-Hours-Minute":"_1vEXB","table-row":"_1jd05","arrow-icon":"_3Urdb","table-cell":"_qPEQy","btn-function":"_2xh2d","btn-action-text":"_2KfG4","avatar_user":"_2mUU4","innerHtml":"_2fgAa","btn-open":"_fLtnC","date-schedule":"_1amhM","pending":"_38Q73","replied":"_2mi_L","actionneeded":"_3qg29","actionneed":"_3XKeC","noscheduled":"_salNB","scheduled":"_3vFP4","completed":"_FoXPx","notstartyet":"_3bhI6","flex-item":"_36RRe","mr-10":"_2A5LB","session":"_33gcZ","schedule-now":"_2BiiZ","block-filter":"_3qVjM","block-filter-right":"_1C7WS","create-survey-container":"_2_bhv","box-create-survey":"_1h2_-","box-list-favorite":"_2Np-n","check-box-btn":"_2KGDK","stepper":"_AHiUZ","step-label":"_6O2vy","dialog-select-template":"_Vb5G5","icon-btn":"_1aD3k","icon-remove":"_rxvBN","title-btn":"_3BDjW","title-box-model":"_3V3hO","box-content-select":"_1p5SM","title-content-select":"_1wY14","description-content-select":"_3AYvl","box-function":"_1yo2i","cancel_btn":"_2q0h5","confirm_btn":"_1wniK","confirm_btn_icon":"_3rnyp","remove_btn":"_3WkIH","remove_btn_title":"_14_xL","remove_btn_icon":"_3VptO","mid_btn":"_Psdg4","box-function-flex":"_2K1MV","box-collapse":"_2-Sse","box-collapse-top":"_miLBv","box-collapse-right":"_2xNTI","collapse-chip":"_13im8","collapse-left-title":"_aft4S","box-collapse-content-item":"_26SCl","block-review-detail":"_1d4Lf","block-content-review":"_12S3I","block-template-review":"_36gKq","block-template-left":"_lw5Ox","additional-box":"_3_5ab","header-item":"_1Q3h9","header-title":"_1WGNT","space-content":"_36P3O","table-title":"_1FCFx","table-status":"_L_uPM","box-header-select":"_1k-yH","header-select-name":"_32KLh","header-select-icon":"_28PLI","header-select-detail":"_ZI06k","list-question-select":"_2EaBh","new-survey":"_SLI97","box-survey":"_dVgqi","avt-user":"_2oBnh","infor":"_3HNaN","content-text":"_SIfgw","time":"_1Sje8","card-item-mobile":"_UEtvP","card-item-left":"_1IKvD","item-name":"_2vyTL","item-detail":"_1bzAB","item-date":"_vw-CP","item-date-content":"_3tsha","table-status-mobile":"_2yS_O","button-mobile":"_1WcRD","box-detail":"_2Mctt","btn-duplicate":"_3Gz-M","box-input":"_3VFOh","item-answer":"_1zSJi","box-favorite":"_2o2b0","overview-survey":"_2sVJR","chart-view-dashboard":"_1doPS","block-chart-wrapper":"_1lkE3","block-chart-title":"_9mzcE","block-chart-top":"_QLUQO","chart-left":"_2c6UE","chart-right":"_1Pmw_","block-header-chart":"_14hBc","column-chart-percent":"_1Ml_a","chart-background":"_2AO5K","custom-marker":"_21lNI","item-legend":"_3BpNG","mark-custom":"_tnwFd","label-legend-custom":"_2juK0","mark-legend":"_13l-r","label-chart":"_3KJlm","listItem":"_1sU--","item":"_397kU","item-checkbox":"_33URL","check-box":"_X-D1i","pie-chart":"_2-TOd","box-chart-title":"_Gijux","box-chart":"_3G2tI","legend-pie-custom":"_sm5jY","color-box":"_3LqNl","generate-flag":"_24iDw","flag-item":"_V8630","count":"_39_gg","red":"_1Qdq3","yellow":"_1ukSp","green":"_Aj1d4","select-filter-top":"_3vD8W","filter-box":"_2WhAK","accordion":"_QOqG1","expanded-summary":"_oa9O2","expanded-title":"_1gxS6","expanded-detail":"_1Uklu","oveview-style":"_DU0s_","item-container":"_17V8B","note-external":"_1Mvjg","icon-back-page":"_3ckSJ","dot":"_1vzYS","table-wrapper":"_z0mjD","pagination":"_kn_xp","dot-response":"_2Nrxx","dot-not-response":"_6GUzQ","middle":"_2gw2z","table-dropdown":"_13mck","table-header":"_nxpHH","tbody-table":"_34MIA"};
|
|
50048
50047
|
|
|
50049
|
-
|
|
50050
|
-
|
|
50051
|
-
|
|
50052
|
-
|
|
50053
|
-
|
|
50054
|
-
|
|
50055
|
-
|
|
50056
|
-
|
|
50057
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
|
|
50048
|
+
function warn() {
|
|
50049
|
+
if (console && console.warn) {
|
|
50050
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50051
|
+
args[_key] = arguments[_key];
|
|
50052
|
+
}
|
|
50053
|
+
if (typeof args[0] === 'string') args[0] = `react-i18next:: ${args[0]}`;
|
|
50054
|
+
console.warn(...args);
|
|
50055
|
+
}
|
|
50058
50056
|
}
|
|
50059
|
-
|
|
50060
|
-
|
|
50061
|
-
|
|
50062
|
-
|
|
50063
|
-
|
|
50064
|
-
var toPrimitive_1 = createCommonjsModule(function (module) {
|
|
50065
|
-
var _typeof = _typeof_1$1["default"];
|
|
50066
|
-
function toPrimitive(t, r) {
|
|
50067
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
50068
|
-
var e = t[Symbol.toPrimitive];
|
|
50069
|
-
if (void 0 !== e) {
|
|
50070
|
-
var i = e.call(t, r || "default");
|
|
50071
|
-
if ("object" != _typeof(i)) return i;
|
|
50072
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
50057
|
+
const alreadyWarned = {};
|
|
50058
|
+
function warnOnce() {
|
|
50059
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
50060
|
+
args[_key2] = arguments[_key2];
|
|
50073
50061
|
}
|
|
50074
|
-
|
|
50062
|
+
if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
|
|
50063
|
+
if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
|
|
50064
|
+
warn(...args);
|
|
50075
50065
|
}
|
|
50076
|
-
|
|
50077
|
-
|
|
50078
|
-
|
|
50079
|
-
|
|
50080
|
-
|
|
50081
|
-
|
|
50082
|
-
|
|
50083
|
-
|
|
50084
|
-
|
|
50085
|
-
|
|
50086
|
-
|
|
50066
|
+
const loadedClb = (i18n, cb) => () => {
|
|
50067
|
+
if (i18n.isInitialized) {
|
|
50068
|
+
cb();
|
|
50069
|
+
} else {
|
|
50070
|
+
const initialized = () => {
|
|
50071
|
+
setTimeout(() => {
|
|
50072
|
+
i18n.off('initialized', initialized);
|
|
50073
|
+
}, 0);
|
|
50074
|
+
cb();
|
|
50075
|
+
};
|
|
50076
|
+
i18n.on('initialized', initialized);
|
|
50077
|
+
}
|
|
50078
|
+
};
|
|
50079
|
+
function loadNamespaces(i18n, ns, cb) {
|
|
50080
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
50087
50081
|
}
|
|
50088
|
-
|
|
50089
|
-
|
|
50090
|
-
|
|
50091
|
-
|
|
50092
|
-
|
|
50093
|
-
|
|
50094
|
-
function _defineProperty(e, r, t) {
|
|
50095
|
-
return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
|
|
50096
|
-
value: t,
|
|
50097
|
-
enumerable: !0,
|
|
50098
|
-
configurable: !0,
|
|
50099
|
-
writable: !0
|
|
50100
|
-
}) : e[r] = t, e;
|
|
50082
|
+
function loadLanguages(i18n, lng, ns, cb) {
|
|
50083
|
+
if (typeof ns === 'string') ns = [ns];
|
|
50084
|
+
ns.forEach(n => {
|
|
50085
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
50086
|
+
});
|
|
50087
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
50101
50088
|
}
|
|
50102
|
-
|
|
50103
|
-
}
|
|
50104
|
-
|
|
50105
|
-
|
|
50106
|
-
|
|
50107
|
-
|
|
50108
|
-
|
|
50109
|
-
|
|
50089
|
+
function oldI18nextHasLoadedNamespace(ns, i18n) {
|
|
50090
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50091
|
+
const lng = i18n.languages[0];
|
|
50092
|
+
const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
|
|
50093
|
+
const lastLng = i18n.languages[i18n.languages.length - 1];
|
|
50094
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
50095
|
+
const loadNotPending = (l, n) => {
|
|
50096
|
+
const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
|
|
50097
|
+
return loadState === -1 || loadState === 2;
|
|
50098
|
+
};
|
|
50099
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
|
|
50100
|
+
if (i18n.hasResourceBundle(lng, ns)) return true;
|
|
50101
|
+
if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
|
|
50102
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
50103
|
+
return false;
|
|
50110
50104
|
}
|
|
50111
|
-
|
|
50112
|
-
}
|
|
50113
|
-
|
|
50114
|
-
|
|
50115
|
-
|
|
50116
|
-
var createClass = createCommonjsModule(function (module) {
|
|
50117
|
-
function _defineProperties(e, r) {
|
|
50118
|
-
for (var t = 0; t < r.length; t++) {
|
|
50119
|
-
var o = r[t];
|
|
50120
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey_1(o.key), o);
|
|
50105
|
+
function hasLoadedNamespace(ns, i18n) {
|
|
50106
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50107
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
50108
|
+
warnOnce('i18n.languages were undefined or empty', i18n.languages);
|
|
50109
|
+
return true;
|
|
50121
50110
|
}
|
|
50111
|
+
const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
|
|
50112
|
+
if (!isNewerI18next) {
|
|
50113
|
+
return oldI18nextHasLoadedNamespace(ns, i18n, options);
|
|
50114
|
+
}
|
|
50115
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
50116
|
+
lng: options.lng,
|
|
50117
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
50118
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
50119
|
+
}
|
|
50120
|
+
});
|
|
50122
50121
|
}
|
|
50123
|
-
function _createClass(e, r, t) {
|
|
50124
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
50125
|
-
writable: !1
|
|
50126
|
-
}), e;
|
|
50127
|
-
}
|
|
50128
|
-
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50129
|
-
});
|
|
50130
|
-
|
|
50131
|
-
var _createClass$1 = unwrapExports(createClass);
|
|
50132
50122
|
|
|
50133
|
-
|
|
50134
|
-
|
|
50123
|
+
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
50124
|
+
const htmlEntities = {
|
|
50135
50125
|
'&': '&',
|
|
50136
50126
|
'&': '&',
|
|
50137
50127
|
'<': '<',
|
|
@@ -50153,16 +50143,10 @@ var htmlEntities = {
|
|
|
50153
50143
|
'/': '/',
|
|
50154
50144
|
'/': '/'
|
|
50155
50145
|
};
|
|
50146
|
+
const unescapeHtmlEntity = m => htmlEntities[m];
|
|
50147
|
+
const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
50156
50148
|
|
|
50157
|
-
|
|
50158
|
-
return htmlEntities[m];
|
|
50159
|
-
};
|
|
50160
|
-
|
|
50161
|
-
var unescape = function unescape(text) {
|
|
50162
|
-
return text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
50163
|
-
};
|
|
50164
|
-
|
|
50165
|
-
var defaultOptions = {
|
|
50149
|
+
let defaultOptions = {
|
|
50166
50150
|
bindI18n: 'languageChanged',
|
|
50167
50151
|
bindI18nStore: '',
|
|
50168
50152
|
transEmptyNodeValue: '',
|
|
@@ -50170,317 +50154,139 @@ var defaultOptions = {
|
|
|
50170
50154
|
transWrapTextNodes: '',
|
|
50171
50155
|
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
|
|
50172
50156
|
useSuspense: true,
|
|
50173
|
-
unescape
|
|
50157
|
+
unescape
|
|
50174
50158
|
};
|
|
50175
|
-
var i18nInstance;
|
|
50176
|
-
var I18nContext = createContext();
|
|
50177
50159
|
function getDefaults() {
|
|
50178
50160
|
return defaultOptions;
|
|
50179
50161
|
}
|
|
50180
|
-
var ReportNamespaces = function () {
|
|
50181
|
-
function ReportNamespaces() {
|
|
50182
|
-
_classCallCheck$1(this, ReportNamespaces);
|
|
50183
50162
|
|
|
50184
|
-
|
|
50185
|
-
}
|
|
50186
|
-
|
|
50187
|
-
_createClass$1(ReportNamespaces, [{
|
|
50188
|
-
key: "addUsedNamespaces",
|
|
50189
|
-
value: function addUsedNamespaces(namespaces) {
|
|
50190
|
-
var _this = this;
|
|
50191
|
-
|
|
50192
|
-
namespaces.forEach(function (ns) {
|
|
50193
|
-
if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
|
|
50194
|
-
});
|
|
50195
|
-
}
|
|
50196
|
-
}, {
|
|
50197
|
-
key: "getUsedNamespaces",
|
|
50198
|
-
value: function getUsedNamespaces() {
|
|
50199
|
-
return Object.keys(this.usedNamespaces);
|
|
50200
|
-
}
|
|
50201
|
-
}]);
|
|
50202
|
-
|
|
50203
|
-
return ReportNamespaces;
|
|
50204
|
-
}();
|
|
50163
|
+
let i18nInstance;
|
|
50205
50164
|
function getI18n() {
|
|
50206
50165
|
return i18nInstance;
|
|
50207
50166
|
}
|
|
50208
50167
|
|
|
50209
|
-
|
|
50210
|
-
|
|
50211
|
-
|
|
50212
|
-
|
|
50213
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50214
|
-
args[_key] = arguments[_key];
|
|
50215
|
-
}
|
|
50216
|
-
|
|
50217
|
-
if (typeof args[0] === 'string') args[0] = "react-i18next:: ".concat(args[0]);
|
|
50218
|
-
|
|
50219
|
-
(_console = console).warn.apply(_console, args);
|
|
50220
|
-
}
|
|
50221
|
-
}
|
|
50222
|
-
var alreadyWarned = {};
|
|
50223
|
-
function warnOnce() {
|
|
50224
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
50225
|
-
args[_key2] = arguments[_key2];
|
|
50226
|
-
}
|
|
50227
|
-
|
|
50228
|
-
if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
|
|
50229
|
-
if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
|
|
50230
|
-
warn.apply(void 0, args);
|
|
50231
|
-
}
|
|
50232
|
-
function loadNamespaces(i18n, ns, cb) {
|
|
50233
|
-
i18n.loadNamespaces(ns, function () {
|
|
50234
|
-
if (i18n.isInitialized) {
|
|
50235
|
-
cb();
|
|
50236
|
-
} else {
|
|
50237
|
-
var initialized = function initialized() {
|
|
50238
|
-
setTimeout(function () {
|
|
50239
|
-
i18n.off('initialized', initialized);
|
|
50240
|
-
}, 0);
|
|
50241
|
-
cb();
|
|
50242
|
-
};
|
|
50243
|
-
|
|
50244
|
-
i18n.on('initialized', initialized);
|
|
50245
|
-
}
|
|
50246
|
-
});
|
|
50247
|
-
}
|
|
50248
|
-
|
|
50249
|
-
function oldI18nextHasLoadedNamespace(ns, i18n) {
|
|
50250
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50251
|
-
var lng = i18n.languages[0];
|
|
50252
|
-
var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
|
|
50253
|
-
var lastLng = i18n.languages[i18n.languages.length - 1];
|
|
50254
|
-
if (lng.toLowerCase() === 'cimode') return true;
|
|
50255
|
-
|
|
50256
|
-
var loadNotPending = function loadNotPending(l, n) {
|
|
50257
|
-
var loadState = i18n.services.backendConnector.state["".concat(l, "|").concat(n)];
|
|
50258
|
-
return loadState === -1 || loadState === 2;
|
|
50259
|
-
};
|
|
50260
|
-
|
|
50261
|
-
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
|
|
50262
|
-
if (i18n.hasResourceBundle(lng, ns)) return true;
|
|
50263
|
-
if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
|
|
50264
|
-
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
50265
|
-
return false;
|
|
50266
|
-
}
|
|
50267
|
-
|
|
50268
|
-
function hasLoadedNamespace(ns, i18n) {
|
|
50269
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50270
|
-
|
|
50271
|
-
if (!i18n.languages || !i18n.languages.length) {
|
|
50272
|
-
warnOnce('i18n.languages were undefined or empty', i18n.languages);
|
|
50273
|
-
return true;
|
|
50274
|
-
}
|
|
50275
|
-
|
|
50276
|
-
var isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
|
|
50277
|
-
|
|
50278
|
-
if (!isNewerI18next) {
|
|
50279
|
-
return oldI18nextHasLoadedNamespace(ns, i18n, options);
|
|
50168
|
+
const I18nContext = createContext();
|
|
50169
|
+
class ReportNamespaces {
|
|
50170
|
+
constructor() {
|
|
50171
|
+
this.usedNamespaces = {};
|
|
50280
50172
|
}
|
|
50281
|
-
|
|
50282
|
-
|
|
50283
|
-
|
|
50284
|
-
|
|
50285
|
-
}
|
|
50286
|
-
});
|
|
50287
|
-
}
|
|
50288
|
-
|
|
50289
|
-
var arrayWithHoles = createCommonjsModule(function (module) {
|
|
50290
|
-
function _arrayWithHoles(r) {
|
|
50291
|
-
if (Array.isArray(r)) return r;
|
|
50292
|
-
}
|
|
50293
|
-
module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50294
|
-
});
|
|
50295
|
-
|
|
50296
|
-
unwrapExports(arrayWithHoles);
|
|
50297
|
-
|
|
50298
|
-
var iterableToArrayLimit = createCommonjsModule(function (module) {
|
|
50299
|
-
function _iterableToArrayLimit(r, l) {
|
|
50300
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
50301
|
-
if (null != t) {
|
|
50302
|
-
var e,
|
|
50303
|
-
n,
|
|
50304
|
-
i,
|
|
50305
|
-
u,
|
|
50306
|
-
a = [],
|
|
50307
|
-
f = !0,
|
|
50308
|
-
o = !1;
|
|
50309
|
-
try {
|
|
50310
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
50311
|
-
if (Object(t) !== t) return;
|
|
50312
|
-
f = !1;
|
|
50313
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
50314
|
-
} catch (r) {
|
|
50315
|
-
o = !0, n = r;
|
|
50316
|
-
} finally {
|
|
50317
|
-
try {
|
|
50318
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
50319
|
-
} finally {
|
|
50320
|
-
if (o) throw n;
|
|
50321
|
-
}
|
|
50322
|
-
}
|
|
50323
|
-
return a;
|
|
50173
|
+
addUsedNamespaces(namespaces) {
|
|
50174
|
+
namespaces.forEach(ns => {
|
|
50175
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
50176
|
+
});
|
|
50324
50177
|
}
|
|
50325
|
-
|
|
50326
|
-
|
|
50327
|
-
});
|
|
50328
|
-
|
|
50329
|
-
unwrapExports(iterableToArrayLimit);
|
|
50330
|
-
|
|
50331
|
-
var arrayLikeToArray = createCommonjsModule(function (module) {
|
|
50332
|
-
function _arrayLikeToArray(r, a) {
|
|
50333
|
-
(null == a || a > r.length) && (a = r.length);
|
|
50334
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
50335
|
-
return n;
|
|
50336
|
-
}
|
|
50337
|
-
module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50338
|
-
});
|
|
50339
|
-
|
|
50340
|
-
unwrapExports(arrayLikeToArray);
|
|
50341
|
-
|
|
50342
|
-
var unsupportedIterableToArray = createCommonjsModule(function (module) {
|
|
50343
|
-
function _unsupportedIterableToArray(r, a) {
|
|
50344
|
-
if (r) {
|
|
50345
|
-
if ("string" == typeof r) return arrayLikeToArray(r, a);
|
|
50346
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
50347
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
|
|
50178
|
+
getUsedNamespaces() {
|
|
50179
|
+
return Object.keys(this.usedNamespaces);
|
|
50348
50180
|
}
|
|
50349
50181
|
}
|
|
50350
|
-
module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50351
|
-
});
|
|
50352
|
-
|
|
50353
|
-
unwrapExports(unsupportedIterableToArray);
|
|
50354
|
-
|
|
50355
|
-
var nonIterableRest = createCommonjsModule(function (module) {
|
|
50356
|
-
function _nonIterableRest() {
|
|
50357
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
50358
|
-
}
|
|
50359
|
-
module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50360
|
-
});
|
|
50361
|
-
|
|
50362
|
-
unwrapExports(nonIterableRest);
|
|
50363
|
-
|
|
50364
|
-
var slicedToArray = createCommonjsModule(function (module) {
|
|
50365
|
-
function _slicedToArray(r, e) {
|
|
50366
|
-
return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
|
|
50367
|
-
}
|
|
50368
|
-
module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50369
|
-
});
|
|
50370
|
-
|
|
50371
|
-
var _slicedToArray = unwrapExports(slicedToArray);
|
|
50372
|
-
|
|
50373
|
-
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
50374
|
-
|
|
50375
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
50376
50182
|
|
|
50377
|
-
|
|
50378
|
-
|
|
50379
|
-
useEffect(
|
|
50183
|
+
const usePrevious = (value, ignore) => {
|
|
50184
|
+
const ref = useRef();
|
|
50185
|
+
useEffect(() => {
|
|
50380
50186
|
ref.current = ignore ? ref.current : value;
|
|
50381
50187
|
}, [value, ignore]);
|
|
50382
50188
|
return ref.current;
|
|
50383
50189
|
};
|
|
50384
|
-
|
|
50190
|
+
function alwaysNewT(i18n, language, namespace, keyPrefix) {
|
|
50191
|
+
return i18n.getFixedT(language, namespace, keyPrefix);
|
|
50192
|
+
}
|
|
50193
|
+
function useMemoizedT(i18n, language, namespace, keyPrefix) {
|
|
50194
|
+
return useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
50195
|
+
}
|
|
50385
50196
|
function useTranslation(ns) {
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50197
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50198
|
+
const {
|
|
50199
|
+
i18n: i18nFromProps
|
|
50200
|
+
} = props;
|
|
50201
|
+
const {
|
|
50202
|
+
i18n: i18nFromContext,
|
|
50203
|
+
defaultNS: defaultNSFromContext
|
|
50204
|
+
} = useContext(I18nContext) || {};
|
|
50205
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
50394
50206
|
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
50395
|
-
|
|
50396
50207
|
if (!i18n) {
|
|
50397
50208
|
warnOnce('You will need to pass in an i18next instance by using initReactI18next');
|
|
50398
|
-
|
|
50399
|
-
|
|
50209
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
50210
|
+
if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
|
|
50211
|
+
if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
|
|
50400
50212
|
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
50401
50213
|
};
|
|
50402
|
-
|
|
50403
|
-
var retNotReady = [notReadyT, {}, false];
|
|
50214
|
+
const retNotReady = [notReadyT, {}, false];
|
|
50404
50215
|
retNotReady.t = notReadyT;
|
|
50405
50216
|
retNotReady.i18n = {};
|
|
50406
50217
|
retNotReady.ready = false;
|
|
50407
50218
|
return retNotReady;
|
|
50408
50219
|
}
|
|
50409
|
-
|
|
50410
50220
|
if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
|
|
50411
|
-
|
|
50412
|
-
|
|
50413
|
-
|
|
50414
|
-
|
|
50415
|
-
|
|
50416
|
-
|
|
50221
|
+
const i18nOptions = {
|
|
50222
|
+
...getDefaults(),
|
|
50223
|
+
...i18n.options.react,
|
|
50224
|
+
...props
|
|
50225
|
+
};
|
|
50226
|
+
const {
|
|
50227
|
+
useSuspense,
|
|
50228
|
+
keyPrefix
|
|
50229
|
+
} = i18nOptions;
|
|
50230
|
+
let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
|
|
50417
50231
|
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
50418
50232
|
if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
|
|
50424
|
-
|
|
50425
|
-
}
|
|
50426
|
-
|
|
50427
|
-
|
|
50428
|
-
|
|
50429
|
-
|
|
50430
|
-
|
|
50431
|
-
|
|
50432
|
-
|
|
50433
|
-
var previousJoinedNS = usePrevious(joinedNS);
|
|
50434
|
-
var isMounted = useRef(true);
|
|
50435
|
-
useEffect(function () {
|
|
50436
|
-
var bindI18n = i18nOptions.bindI18n,
|
|
50437
|
-
bindI18nStore = i18nOptions.bindI18nStore;
|
|
50233
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
50234
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
50235
|
+
const getT = () => memoGetT;
|
|
50236
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
50237
|
+
const [t, setT] = useState(getT);
|
|
50238
|
+
let joinedNS = namespaces.join();
|
|
50239
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
50240
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
50241
|
+
const isMounted = useRef(true);
|
|
50242
|
+
useEffect(() => {
|
|
50243
|
+
const {
|
|
50244
|
+
bindI18n,
|
|
50245
|
+
bindI18nStore
|
|
50246
|
+
} = i18nOptions;
|
|
50438
50247
|
isMounted.current = true;
|
|
50439
|
-
|
|
50440
50248
|
if (!ready && !useSuspense) {
|
|
50441
|
-
|
|
50442
|
-
|
|
50443
|
-
|
|
50249
|
+
if (props.lng) {
|
|
50250
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
50251
|
+
if (isMounted.current) setT(getNewT);
|
|
50252
|
+
});
|
|
50253
|
+
} else {
|
|
50254
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
50255
|
+
if (isMounted.current) setT(getNewT);
|
|
50256
|
+
});
|
|
50257
|
+
}
|
|
50444
50258
|
}
|
|
50445
|
-
|
|
50446
50259
|
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
50447
|
-
setT(
|
|
50260
|
+
setT(getNewT);
|
|
50448
50261
|
}
|
|
50449
|
-
|
|
50450
50262
|
function boundReset() {
|
|
50451
|
-
if (isMounted.current) setT(
|
|
50263
|
+
if (isMounted.current) setT(getNewT);
|
|
50452
50264
|
}
|
|
50453
|
-
|
|
50454
50265
|
if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
|
|
50455
50266
|
if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
|
|
50456
|
-
return
|
|
50267
|
+
return () => {
|
|
50457
50268
|
isMounted.current = false;
|
|
50458
|
-
if (bindI18n && i18n) bindI18n.split(' ').forEach(
|
|
50459
|
-
|
|
50460
|
-
});
|
|
50461
|
-
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(function (e) {
|
|
50462
|
-
return i18n.store.off(e, boundReset);
|
|
50463
|
-
});
|
|
50269
|
+
if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
|
|
50270
|
+
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
50464
50271
|
};
|
|
50465
50272
|
}, [i18n, joinedNS]);
|
|
50466
|
-
|
|
50467
|
-
|
|
50468
|
-
if (isMounted.current && !isInitial.current) {
|
|
50273
|
+
useEffect(() => {
|
|
50274
|
+
if (isMounted.current && ready) {
|
|
50469
50275
|
setT(getT);
|
|
50470
50276
|
}
|
|
50471
|
-
|
|
50472
|
-
|
|
50473
|
-
}, [i18n, keyPrefix]);
|
|
50474
|
-
var ret = [t, i18n, ready];
|
|
50277
|
+
}, [i18n, keyPrefix, ready]);
|
|
50278
|
+
const ret = [t, i18n, ready];
|
|
50475
50279
|
ret.t = t;
|
|
50476
50280
|
ret.i18n = i18n;
|
|
50477
50281
|
ret.ready = ready;
|
|
50478
50282
|
if (ready) return ret;
|
|
50479
50283
|
if (!ready && !useSuspense) return ret;
|
|
50480
|
-
throw new Promise(
|
|
50481
|
-
|
|
50482
|
-
resolve();
|
|
50483
|
-
}
|
|
50284
|
+
throw new Promise(resolve => {
|
|
50285
|
+
if (props.lng) {
|
|
50286
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
50287
|
+
} else {
|
|
50288
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
50289
|
+
}
|
|
50484
50290
|
});
|
|
50485
50291
|
}
|
|
50486
50292
|
|
|
@@ -66672,7 +66478,7 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
66672
66478
|
|
|
66673
66479
|
unwrapExports(_extends_1$1);
|
|
66674
66480
|
|
|
66675
|
-
var arrayLikeToArray
|
|
66481
|
+
var arrayLikeToArray = createCommonjsModule(function (module) {
|
|
66676
66482
|
function _arrayLikeToArray(arr, len) {
|
|
66677
66483
|
if (len == null || len > arr.length) len = arr.length;
|
|
66678
66484
|
|
|
@@ -66687,11 +66493,11 @@ module.exports = _arrayLikeToArray;
|
|
|
66687
66493
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
66688
66494
|
});
|
|
66689
66495
|
|
|
66690
|
-
unwrapExports(arrayLikeToArray
|
|
66496
|
+
unwrapExports(arrayLikeToArray);
|
|
66691
66497
|
|
|
66692
66498
|
var arrayWithoutHoles = createCommonjsModule(function (module) {
|
|
66693
66499
|
function _arrayWithoutHoles(arr) {
|
|
66694
|
-
if (Array.isArray(arr)) return arrayLikeToArray
|
|
66500
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
|
66695
66501
|
}
|
|
66696
66502
|
|
|
66697
66503
|
module.exports = _arrayWithoutHoles;
|
|
@@ -66711,21 +66517,21 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
66711
66517
|
|
|
66712
66518
|
unwrapExports(iterableToArray);
|
|
66713
66519
|
|
|
66714
|
-
var unsupportedIterableToArray
|
|
66520
|
+
var unsupportedIterableToArray = createCommonjsModule(function (module) {
|
|
66715
66521
|
function _unsupportedIterableToArray(o, minLen) {
|
|
66716
66522
|
if (!o) return;
|
|
66717
|
-
if (typeof o === "string") return arrayLikeToArray
|
|
66523
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
66718
66524
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66719
66525
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
66720
66526
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
66721
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray
|
|
66527
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
|
66722
66528
|
}
|
|
66723
66529
|
|
|
66724
66530
|
module.exports = _unsupportedIterableToArray;
|
|
66725
66531
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
66726
66532
|
});
|
|
66727
66533
|
|
|
66728
|
-
unwrapExports(unsupportedIterableToArray
|
|
66534
|
+
unwrapExports(unsupportedIterableToArray);
|
|
66729
66535
|
|
|
66730
66536
|
var nonIterableSpread = createCommonjsModule(function (module) {
|
|
66731
66537
|
function _nonIterableSpread() {
|
|
@@ -66740,7 +66546,7 @@ unwrapExports(nonIterableSpread);
|
|
|
66740
66546
|
|
|
66741
66547
|
var toConsumableArray = createCommonjsModule(function (module) {
|
|
66742
66548
|
function _toConsumableArray(arr) {
|
|
66743
|
-
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray
|
|
66549
|
+
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
|
|
66744
66550
|
}
|
|
66745
66551
|
|
|
66746
66552
|
module.exports = _toConsumableArray;
|
|
@@ -69315,6 +69121,109 @@ var handleUserRole = function handleUserRole(userRoles) {
|
|
|
69315
69121
|
return userRoles;
|
|
69316
69122
|
};
|
|
69317
69123
|
|
|
69124
|
+
var apiGetLanguage = function apiGetLanguage() {
|
|
69125
|
+
return api.get(BASE_URL + "/api/language");
|
|
69126
|
+
};
|
|
69127
|
+
|
|
69128
|
+
var apiUpdateLanguage = function apiUpdateLanguage(lang) {
|
|
69129
|
+
return api.put(BASE_URL + "/api/language?lang=" + lang);
|
|
69130
|
+
};
|
|
69131
|
+
|
|
69132
|
+
var LANGUAGE_SYSTEM = "LANGUAGE_SYSTEM";
|
|
69133
|
+
|
|
69134
|
+
var useLanguages = function useLanguages() {
|
|
69135
|
+
var dispatch = useDispatch();
|
|
69136
|
+
|
|
69137
|
+
var _useTranslation = useTranslation$1(),
|
|
69138
|
+
i18n = _useTranslation.i18n;
|
|
69139
|
+
|
|
69140
|
+
var language = useSelector(function (state) {
|
|
69141
|
+
return state.common.language;
|
|
69142
|
+
});
|
|
69143
|
+
var defaultLanguage = getCookieValue(LANGUAGE_SYSTEM) != '' ? getCookieValue(LANGUAGE_SYSTEM) : language;
|
|
69144
|
+
|
|
69145
|
+
var _useState = useState([]),
|
|
69146
|
+
languageList = _useState[0],
|
|
69147
|
+
setLanguageList = _useState[1];
|
|
69148
|
+
|
|
69149
|
+
var _useState2 = useState(false),
|
|
69150
|
+
dropdownOpen = _useState2[0],
|
|
69151
|
+
setDropdownOpen = _useState2[1];
|
|
69152
|
+
|
|
69153
|
+
var _useState3 = useState(defaultLanguage),
|
|
69154
|
+
currentLang = _useState3[0],
|
|
69155
|
+
setCurrentLang = _useState3[1];
|
|
69156
|
+
|
|
69157
|
+
var toggle = function toggle() {
|
|
69158
|
+
return setDropdownOpen(function (prevState) {
|
|
69159
|
+
return !prevState;
|
|
69160
|
+
});
|
|
69161
|
+
};
|
|
69162
|
+
|
|
69163
|
+
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
69164
|
+
try {
|
|
69165
|
+
var _temp3 = function _temp3() {
|
|
69166
|
+
dispatch(setLoading(false));
|
|
69167
|
+
};
|
|
69168
|
+
|
|
69169
|
+
dispatch(setLoading(true));
|
|
69170
|
+
|
|
69171
|
+
var _temp4 = _catch(function () {
|
|
69172
|
+
return Promise.resolve(apiUpdateLanguage(lang)).then(function () {
|
|
69173
|
+
i18n.changeLanguage(lang);
|
|
69174
|
+
setCurrentLang(lang);
|
|
69175
|
+
dispatch(setLanguage(lang));
|
|
69176
|
+
});
|
|
69177
|
+
}, function (err) {
|
|
69178
|
+
var _err$response, _err$response$data;
|
|
69179
|
+
|
|
69180
|
+
dispatch(setAlert({
|
|
69181
|
+
type: "danger",
|
|
69182
|
+
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
|
|
69183
|
+
}));
|
|
69184
|
+
});
|
|
69185
|
+
|
|
69186
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
69187
|
+
} catch (e) {
|
|
69188
|
+
return Promise.reject(e);
|
|
69189
|
+
}
|
|
69190
|
+
};
|
|
69191
|
+
|
|
69192
|
+
var getListLanguage = function getListLanguage() {
|
|
69193
|
+
try {
|
|
69194
|
+
var _temp6 = _catch(function () {
|
|
69195
|
+
return Promise.resolve(apiGetLanguage()).then(function (res) {
|
|
69196
|
+
setLanguageList(res.data);
|
|
69197
|
+
});
|
|
69198
|
+
}, function (err) {
|
|
69199
|
+
var _err$response2, _err$response2$data;
|
|
69200
|
+
|
|
69201
|
+
dispatch(setAlert({
|
|
69202
|
+
type: "danger",
|
|
69203
|
+
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) || err.message
|
|
69204
|
+
}));
|
|
69205
|
+
});
|
|
69206
|
+
|
|
69207
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
69208
|
+
} catch (e) {
|
|
69209
|
+
return Promise.reject(e);
|
|
69210
|
+
}
|
|
69211
|
+
};
|
|
69212
|
+
|
|
69213
|
+
useEffect(function () {
|
|
69214
|
+
changeLanguageApp(defaultLanguage);
|
|
69215
|
+
getListLanguage();
|
|
69216
|
+
}, []);
|
|
69217
|
+
return {
|
|
69218
|
+
languageList: languageList,
|
|
69219
|
+
toggle: toggle,
|
|
69220
|
+
dropdownOpen: dropdownOpen,
|
|
69221
|
+
currentLang: currentLang,
|
|
69222
|
+
changeLanguageApp: changeLanguageApp,
|
|
69223
|
+
setCurrentLang: setCurrentLang
|
|
69224
|
+
};
|
|
69225
|
+
};
|
|
69226
|
+
|
|
69318
69227
|
var useStyles$g = makeStyles({
|
|
69319
69228
|
dropdown: {
|
|
69320
69229
|
zIndex: "1410 !important",
|
|
@@ -69341,22 +69250,18 @@ var useStyles$g = makeStyles({
|
|
|
69341
69250
|
});
|
|
69342
69251
|
|
|
69343
69252
|
var LanguageDropdown = function LanguageDropdown() {
|
|
69344
|
-
var defaultLanguage = !!localStorage.getItem("language") ? localStorage.getItem("language") : navigator.language || DEFAULT_LANGUAGE_CODE;
|
|
69345
|
-
|
|
69346
|
-
var _useTranslation = useTranslation$1(),
|
|
69347
|
-
i18n = _useTranslation.i18n;
|
|
69348
|
-
|
|
69349
|
-
var dispatch = useDispatch();
|
|
69350
69253
|
var classes = useStyles$g();
|
|
69351
69254
|
|
|
69352
69255
|
var _useState = useState(null),
|
|
69353
69256
|
anchorLang = _useState[0],
|
|
69354
69257
|
setAnchorLang = _useState[1];
|
|
69355
69258
|
|
|
69356
|
-
var
|
|
69357
|
-
|
|
69358
|
-
|
|
69259
|
+
var _useLanguages = useLanguages(),
|
|
69260
|
+
languageList = _useLanguages.languageList,
|
|
69261
|
+
currentLang = _useLanguages.currentLang,
|
|
69262
|
+
changeLanguageApp = _useLanguages.changeLanguageApp;
|
|
69359
69263
|
|
|
69264
|
+
console.log("admin language");
|
|
69360
69265
|
var openChooseLanguage = Boolean(anchorLang);
|
|
69361
69266
|
|
|
69362
69267
|
var handleLangClose = function handleLangClose() {
|
|
@@ -69367,27 +69272,16 @@ var LanguageDropdown = function LanguageDropdown() {
|
|
|
69367
69272
|
setAnchorLang(event.currentTarget);
|
|
69368
69273
|
};
|
|
69369
69274
|
|
|
69370
|
-
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
69371
|
-
if (!SUPPORTED_LANGUAGES_CODE.includes(lang)) lang = DEFAULT_LANGUAGE_CODE;
|
|
69372
|
-
i18n.changeLanguage(lang);
|
|
69373
|
-
localStorage.setItem("language", lang);
|
|
69374
|
-
setCurrentLang(lang);
|
|
69375
|
-
dispatch(setLanguage(lang));
|
|
69376
|
-
};
|
|
69377
|
-
|
|
69378
69275
|
var currentLanguage = useMemo(function () {
|
|
69379
|
-
var current =
|
|
69276
|
+
var current = languageList.find(function (i) {
|
|
69380
69277
|
return i.code === currentLang;
|
|
69381
69278
|
});
|
|
69382
69279
|
if (!current) return null;
|
|
69383
69280
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
|
|
69384
69281
|
className: "mr-2 " + classes.icon_lang,
|
|
69385
|
-
src: "" + getStaticFileUrl(
|
|
69386
|
-
}), current.
|
|
69387
|
-
}, [currentLang]);
|
|
69388
|
-
useEffect(function () {
|
|
69389
|
-
changeLanguageApp(currentLang);
|
|
69390
|
-
}, [currentLang]);
|
|
69282
|
+
src: "" + getStaticFileUrl("/images/language-icon.png")
|
|
69283
|
+
}), current.name);
|
|
69284
|
+
}, [currentLang, languageList]);
|
|
69391
69285
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(IconButton, {
|
|
69392
69286
|
onClick: handleLangMenu,
|
|
69393
69287
|
color: "inherit"
|
|
@@ -69411,18 +69305,18 @@ var LanguageDropdown = function LanguageDropdown() {
|
|
|
69411
69305
|
open: openChooseLanguage,
|
|
69412
69306
|
onClose: handleLangClose,
|
|
69413
69307
|
onClick: handleLangClose
|
|
69414
|
-
},
|
|
69308
|
+
}, !!languageList && languageList.length > 0 && languageList.map(function (lang) {
|
|
69415
69309
|
return React__default.createElement(MenuItem, {
|
|
69416
|
-
key:
|
|
69310
|
+
key: lang.code,
|
|
69417
69311
|
onClick: function onClick() {
|
|
69418
|
-
return
|
|
69312
|
+
return changeLanguageApp(lang.code);
|
|
69419
69313
|
},
|
|
69420
|
-
selected: currentLang ==
|
|
69314
|
+
selected: currentLang == lang.code,
|
|
69421
69315
|
className: classes.fontMedium
|
|
69422
69316
|
}, React__default.createElement("img", {
|
|
69423
69317
|
className: classes.icon_lang,
|
|
69424
|
-
src: getStaticFileUrl(
|
|
69425
|
-
}),
|
|
69318
|
+
src: getStaticFileUrl(lang.logo)
|
|
69319
|
+
}), lang.name);
|
|
69426
69320
|
})));
|
|
69427
69321
|
};
|
|
69428
69322
|
|