tntd 1.4.32 → 1.4.33-beta.1
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/components/Ellipsis/index.js +47 -15
- package/components/QueryListScene/QueryForm.js +4 -4
- package/components/QueryListScene/createActions.js +4 -4
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24089 -23289
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +7 -10
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +79 -111
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +33 -40
- package/es/DevelopmentLogin/LoginModal.js +33 -46
- package/es/DevelopmentLogin/index.js +14 -18
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +100 -79
- package/es/Handle/index.js +46 -64
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +12 -15
- package/es/Img/Contain.js +26 -31
- package/es/Img/Cover.js +43 -57
- package/es/Img/index.js +39 -48
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +39 -94
- package/es/Layout/Application.js +28 -74
- package/es/Layout/Avatar.js +30 -67
- package/es/Layout/CompatibleLanguage.js +41 -96
- package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
- package/es/Layout/EnterpriseLayout/Language.js +16 -34
- package/es/Layout/EnterpriseLayout/Theme.js +18 -36
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
- package/es/Layout/GlobalNavigation/index.js +22 -56
- package/es/Layout/Header.js +26 -47
- package/es/Layout/HeaderActions.js +45 -59
- package/es/Layout/HeaderNavs.js +24 -51
- package/es/Layout/HeaderTabs.js +53 -106
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +16 -34
- package/es/Layout/Layout.js +88 -110
- package/es/Layout/Logo.js +17 -33
- package/es/Layout/OrgAppList.js +64 -109
- package/es/Layout/SideMenu.js +67 -128
- package/es/Layout/Theme.js +25 -63
- package/es/Layout/index.js +28 -37
- package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
- package/es/Layout/paaslayout/Header.js +23 -46
- package/es/Layout/paaslayout/Logo.js +4 -14
- package/es/Layout/paaslayout/SideMenu.js +41 -80
- package/es/Layout/paaslayout/index.js +77 -104
- package/es/Layout/storage.js +10 -9
- package/es/LoadingButton/index.js +18 -27
- package/es/Modal/index.js +42 -51
- package/es/Page/Box.js +36 -43
- package/es/Page/index.js +56 -71
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +7 -11
- package/es/QueryForm/Field/Select.js +34 -44
- package/es/QueryForm/Field/SelectInput.js +31 -46
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +46 -78
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +79 -140
- package/es/QueryListScene/List.js +83 -139
- package/es/QueryListScene/QueryForm.js +54 -91
- package/es/QueryListScene/QueryListScene.js +29 -47
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +13 -14
- package/es/QueryListScene/createActions.js +4 -4
- package/es/Select/DropDownWrap.js +32 -55
- package/es/Select/index.js +140 -232
- package/es/Table/ResizableTable/index.js +29 -43
- package/es/Table/index.js +20 -19
- package/es/Title/index.js +23 -25
- package/es/locale.js +1 -5
- package/es/utils/checkAuth.js +6 -8
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +17 -27
- package/lib/ArrayInput/icon.js +7 -9
- package/lib/ArrayInput/index.js +82 -131
- package/lib/AuthContext.js +2 -6
- package/lib/Columns/index.js +36 -54
- package/lib/DevelopmentLogin/LoginModal.js +36 -63
- package/lib/DevelopmentLogin/index.js +21 -31
- package/lib/Ellipsis/Svg/CopySVG.js +15 -18
- package/lib/Ellipsis/Svg/TickSVG.js +10 -13
- package/lib/Ellipsis/index.js +105 -93
- package/lib/Handle/index.js +51 -87
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/iconList.js +1 -2
- package/lib/Icon/index.js +16 -26
- package/lib/Img/Contain.js +29 -40
- package/lib/Img/Cover.js +48 -72
- package/lib/Img/index.js +42 -58
- package/lib/Layout/ActionsContext.js +1 -5
- package/lib/Layout/AppList.js +45 -124
- package/lib/Layout/Application.js +31 -92
- package/lib/Layout/Avatar.js +36 -91
- package/lib/Layout/CompatibleLanguage.js +44 -116
- package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
- package/lib/Layout/EnterpriseLayout/Language.js +22 -54
- package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
- package/lib/Layout/EnterpriseLayout/index.js +17 -27
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
- package/lib/Layout/GlobalNavigation/index.js +28 -80
- package/lib/Layout/Header.js +36 -68
- package/lib/Layout/HeaderActions.js +51 -81
- package/lib/Layout/HeaderNavs.js +30 -70
- package/lib/Layout/HeaderTabs.js +58 -127
- package/lib/Layout/Iconfont.js +4 -9
- package/lib/Layout/Language.js +22 -54
- package/lib/Layout/Layout.js +93 -134
- package/lib/Layout/Logo.js +26 -47
- package/lib/Layout/OrgAppList.js +69 -133
- package/lib/Layout/SideMenu.js +72 -151
- package/lib/Layout/Theme.js +28 -79
- package/lib/Layout/createActions.js +3 -9
- package/lib/Layout/images/index.js +5 -36
- package/lib/Layout/index.js +35 -63
- package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
- package/lib/Layout/paaslayout/Header.js +30 -60
- package/lib/Layout/paaslayout/Logo.js +11 -24
- package/lib/Layout/paaslayout/SideMenu.js +44 -93
- package/lib/Layout/paaslayout/index.js +82 -128
- package/lib/Layout/storage.js +26 -68
- package/lib/LoadingButton/index.js +21 -36
- package/lib/Modal/index.js +45 -62
- package/lib/Page/Box.js +38 -50
- package/lib/Page/index.js +58 -84
- package/lib/Page/utils.js +5 -16
- package/lib/QueryForm/Field/Checkbox.js +10 -19
- package/lib/QueryForm/Field/Select.js +39 -60
- package/lib/QueryForm/Field/SelectInput.js +36 -65
- package/lib/QueryForm/Field/fieldsMap.js +6 -23
- package/lib/QueryForm/Field/index.js +50 -91
- package/lib/QueryForm/createActions.js +9 -16
- package/lib/QueryForm/index.js +83 -165
- package/lib/QueryForm/useForm.js +1 -6
- package/lib/QueryListScene/List.js +89 -153
- package/lib/QueryListScene/QueryForm.js +58 -101
- package/lib/QueryListScene/QueryListScene.js +31 -56
- package/lib/QueryListScene/Title.js +6 -11
- package/lib/QueryListScene/Toolbar.js +16 -22
- package/lib/QueryListScene/createActions.js +7 -13
- package/lib/QueryListScene/index.js +5 -19
- package/lib/QueryListScene/useActions.js +1 -6
- package/lib/Select/DropDownWrap.js +35 -63
- package/lib/Select/index.js +142 -245
- package/lib/Table/ResizableTable/index.js +31 -54
- package/lib/Table/index.js +21 -34
- package/lib/Title/index.js +26 -34
- package/lib/index.js +36 -57
- package/lib/locale.js +9 -25
- package/lib/utils/checkAuth.js +9 -16
- package/lib/utils/findMenuInfoByPath.js +3 -12
- package/lib/utils/index.js +26 -60
- package/package.json +3 -2
|
@@ -4,79 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
require("antd/lib/popover/style");
|
|
9
|
-
|
|
10
8
|
var _popover = _interopRequireDefault(require("antd/lib/popover"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
-
|
|
16
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
12
|
var _lodash = require("lodash");
|
|
19
|
-
|
|
20
13
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
21
|
-
|
|
22
14
|
var _images = _interopRequireDefault(require("./images"));
|
|
23
|
-
|
|
24
15
|
var _storage = require("./storage");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function _arrayWithHoles(
|
|
37
|
-
|
|
38
|
-
function _templateObject4() {
|
|
39
|
-
var data = _taggedTemplateLiteral(["\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n min-width: 203px;\n padding: 8px 4px 8px 8px;\n .line {\n background: #f0f0f0;\n height: 1px;\n margin: 20px 0;\n width: calc(100% + 44px);\n transform: translateX(-22px);\n }\n"]);
|
|
40
|
-
|
|
41
|
-
_templateObject4 = function _templateObject4() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _templateObject3() {
|
|
49
|
-
var data = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n & > div {\n position: relative;\n display: inline-block;\n cursor: pointer;\n img {\n width: 48px;\n }\n &:first-child {\n margin-right: 10px;\n }\n &:last-child {\n margin-left: 10px;\n }\n & > i, & > .tnt-icon, & > .anticon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #1890ff;\n }\n }\n"]);
|
|
50
|
-
|
|
51
|
-
_templateObject3 = function _templateObject3() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject2() {
|
|
59
|
-
var data = _taggedTemplateLiteral(["\n margin-left: 20px;\n font-size: 20px;\n .tnt-themeS1 & {\n color: rgba(255,255,255,.85);\n }\n .isInIframe & {\n display: none;\n }\n .tnt-icon {\n font-size: 30px;\n vertical-align: middle;\n opacity: .75;\n color: #2b5696;\n .tnt-themeS1 & {\n /* color: #fff; */\n }\n }\n"]);
|
|
60
|
-
|
|
61
|
-
_templateObject2 = function _templateObject2() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject() {
|
|
69
|
-
var data = _taggedTemplateLiteral(["\n margin-bottom: 10px;\n\n & > div {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n display: inline-block;\n color: #fff;\n width: 49%;\n text-align: center;\n font-size: 14px;\n letter-spacing: 0!important;\n color: #666;\n border: 1px solid #e5e5e5;\n vertical-align: middle;\n display: inline-block;\n letter-spacing: -4px;\n cursor: pointer;\n &:first-child {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n }\n &:last-child {\n padding: 10px 17px 10px 13px;\n border-radius: 0 20px 20px 0;\n border-left: none;\n }\n &.active {\n background-color: #4b93e5;\n border-color: #4b93e5;\n color: #fff;\n }\n }\n"]);
|
|
70
|
-
|
|
71
|
-
_templateObject = function _templateObject() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
79
|
-
|
|
16
|
+
var _templateObject,
|
|
17
|
+
_templateObject2,
|
|
18
|
+
_templateObject3,
|
|
19
|
+
_templateObject4,
|
|
20
|
+
_this = void 0;
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); 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; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
28
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
80
29
|
var languages = [{
|
|
81
30
|
value: 'cn',
|
|
82
31
|
name: '中文'
|
|
@@ -88,15 +37,10 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
88
37
|
acc[cur.value] = cur;
|
|
89
38
|
return acc;
|
|
90
39
|
}, {});
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
var ThemeSwitch = _styledComponents["default"].div(_templateObject3());
|
|
97
|
-
|
|
98
|
-
var ThemeContentWrapper = _styledComponents["default"].div(_templateObject4());
|
|
99
|
-
|
|
40
|
+
var LanguageSwitch = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: 10px;\n\n & > div {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n display: inline-block;\n color: #fff;\n width: 49%;\n text-align: center;\n font-size: 14px;\n letter-spacing: 0!important;\n color: #666;\n border: 1px solid #e5e5e5;\n vertical-align: middle;\n display: inline-block;\n letter-spacing: -4px;\n cursor: pointer;\n &:first-child {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n }\n &:last-child {\n padding: 10px 17px 10px 13px;\n border-radius: 0 20px 20px 0;\n border-left: none;\n }\n &.active {\n background-color: #4b93e5;\n border-color: #4b93e5;\n color: #fff;\n }\n }\n"])));
|
|
41
|
+
var Theme = _styledComponents["default"].li(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-left: 20px;\n font-size: 20px;\n .tnt-themeS1 & {\n color: rgba(255,255,255,.85);\n }\n .isInIframe & {\n display: none;\n }\n .tnt-icon {\n font-size: 30px;\n vertical-align: middle;\n opacity: .75;\n color: #2b5696;\n .tnt-themeS1 & {\n /* color: #fff; */\n }\n }\n"])));
|
|
42
|
+
var ThemeSwitch = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n & > div {\n position: relative;\n display: inline-block;\n cursor: pointer;\n img {\n width: 48px;\n }\n &:first-child {\n margin-right: 10px;\n }\n &:last-child {\n margin-left: 10px;\n }\n & > i, & > .tnt-icon, & > .anticon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #1890ff;\n }\n }\n"])));
|
|
43
|
+
var ThemeContentWrapper = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n min-width: 203px;\n padding: 8px 4px 8px 8px;\n .line {\n background: #f0f0f0;\n height: 1px;\n margin: 20px 0;\n width: calc(100% + 44px);\n transform: translateX(-22px);\n }\n"])));
|
|
100
44
|
var themes = [{
|
|
101
45
|
value: 'themeS1',
|
|
102
46
|
img: _images["default"].themeSymbol1
|
|
@@ -104,18 +48,15 @@ var themes = [{
|
|
|
104
48
|
value: 'themeS2',
|
|
105
49
|
img: _images["default"].themeSymbol2
|
|
106
50
|
}];
|
|
107
|
-
|
|
108
51
|
var ThemeContent = function ThemeContent(props) {
|
|
109
52
|
var config = props.config,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
53
|
+
onLanguageChange = props.onLanguageChange,
|
|
54
|
+
onThemeChange = props.onThemeChange;
|
|
113
55
|
var _ref = config || {},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
56
|
+
_ref$language = _ref.language,
|
|
57
|
+
languageVisible = _ref$language === void 0 ? true : _ref$language,
|
|
58
|
+
_ref$theme = _ref.theme,
|
|
59
|
+
themeVisible = _ref$theme === void 0 ? true : _ref$theme;
|
|
119
60
|
var getTheme = function getTheme() {
|
|
120
61
|
var theme = (0, _storage.getThemeStore)() || props.theme || 'themeS2';
|
|
121
62
|
return themes.some(function (_ref2) {
|
|
@@ -123,57 +64,49 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
123
64
|
return value === theme;
|
|
124
65
|
}) ? theme : 'themeS2';
|
|
125
66
|
};
|
|
126
|
-
|
|
127
67
|
var _useState = (0, _react.useState)(getTheme()),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
theme = _useState2[0],
|
|
70
|
+
setTheme = _useState2[1];
|
|
132
71
|
var changeTheme = function changeTheme(theme) {
|
|
133
72
|
setTheme(theme);
|
|
134
73
|
(0, _storage.setThemeStore)(theme);
|
|
135
74
|
onThemeChange(theme);
|
|
136
75
|
};
|
|
137
|
-
|
|
138
76
|
var getLanguage = function getLanguage() {
|
|
139
77
|
var lang = (0, _storage.getLanguageStore)() || props.language;
|
|
140
|
-
|
|
141
78
|
if (!languagesMap[lang]) {
|
|
142
79
|
lang = (0, _lodash.get)(languages, '0.value');
|
|
143
80
|
}
|
|
144
|
-
|
|
145
81
|
return lang;
|
|
146
82
|
};
|
|
147
|
-
|
|
148
83
|
var _useState3 = (0, _react.useState)(getLanguage()),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
84
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
85
|
+
_useState4$ = _useState4[0],
|
|
86
|
+
language = _useState4$ === void 0 ? 'cn' : _useState4$,
|
|
87
|
+
setLanguage = _useState4[1];
|
|
154
88
|
var changeLanguage = function changeLanguage(language) {
|
|
155
89
|
setLanguage(language);
|
|
156
90
|
(0, _storage.setLanguageStore)(language);
|
|
157
91
|
onLanguageChange(language);
|
|
158
92
|
};
|
|
159
|
-
|
|
160
|
-
return React.createElement(ThemeContentWrapper, null, themeVisible && React.createElement(ThemeSwitch, null, themes.map(function (_ref3) {
|
|
93
|
+
return /*#__PURE__*/React.createElement(ThemeContentWrapper, null, themeVisible && /*#__PURE__*/React.createElement(ThemeSwitch, null, themes.map(function (_ref3) {
|
|
161
94
|
var value = _ref3.value,
|
|
162
|
-
|
|
163
|
-
return React.createElement("div", {
|
|
95
|
+
img = _ref3.img;
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
97
|
key: value,
|
|
165
98
|
onClick: changeTheme.bind(_this, value)
|
|
166
|
-
}, React.createElement("img", {
|
|
99
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
167
100
|
src: img
|
|
168
|
-
}), theme === value && React.createElement(_Icon["default"], {
|
|
101
|
+
}), theme === value && /*#__PURE__*/React.createElement(_Icon["default"], {
|
|
169
102
|
type: "check1"
|
|
170
103
|
}));
|
|
171
|
-
})), themeVisible && languageVisible && React.createElement("div", {
|
|
104
|
+
})), themeVisible && languageVisible && /*#__PURE__*/React.createElement("div", {
|
|
172
105
|
className: "line"
|
|
173
|
-
}), languageVisible && React.createElement(LanguageSwitch, null, languages.map(function (_ref4) {
|
|
106
|
+
}), languageVisible && /*#__PURE__*/React.createElement(LanguageSwitch, null, languages.map(function (_ref4) {
|
|
174
107
|
var value = _ref4.value,
|
|
175
|
-
|
|
176
|
-
return React.createElement("div", {
|
|
108
|
+
name = _ref4.name;
|
|
109
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
177
110
|
className: (0, _classnames["default"])({
|
|
178
111
|
active: value === language
|
|
179
112
|
}),
|
|
@@ -182,22 +115,17 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
182
115
|
}, name);
|
|
183
116
|
})));
|
|
184
117
|
};
|
|
185
|
-
|
|
186
|
-
var _default = function _default(props) {
|
|
118
|
+
var _default = exports["default"] = function _default(props) {
|
|
187
119
|
var config = props.config;
|
|
188
|
-
|
|
189
120
|
if ((config == null ? void 0 : config.language) === false && (config == null ? void 0 : config.theme) === false) {
|
|
190
121
|
return null;
|
|
191
122
|
}
|
|
192
|
-
|
|
193
|
-
return React.createElement(Theme, null, React.createElement(_popover["default"], {
|
|
123
|
+
return /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(_popover["default"], {
|
|
194
124
|
placement: "bottomRight",
|
|
195
125
|
title: null,
|
|
196
|
-
content: React.createElement(ThemeContent, props),
|
|
126
|
+
content: /*#__PURE__*/React.createElement(ThemeContent, props),
|
|
197
127
|
trigger: "click"
|
|
198
|
-
}, React.createElement(_Icon["default"], {
|
|
128
|
+
}, /*#__PURE__*/React.createElement(_Icon["default"], {
|
|
199
129
|
type: "daxiaoxie"
|
|
200
130
|
})));
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
exports["default"] = _default;
|
|
131
|
+
};
|
|
@@ -1,83 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
require("antd/lib/popover/style");
|
|
11
|
-
|
|
12
9
|
var _popover = _interopRequireDefault(require("antd/lib/popover"));
|
|
13
|
-
|
|
14
10
|
require("antd/lib/row/style");
|
|
15
|
-
|
|
16
11
|
var _row = _interopRequireDefault(require("antd/lib/row"));
|
|
17
|
-
|
|
18
12
|
require("antd/lib/divider/style");
|
|
19
|
-
|
|
20
13
|
var _divider = _interopRequireDefault(require("antd/lib/divider"));
|
|
21
|
-
|
|
22
14
|
var _react = require("react");
|
|
23
|
-
|
|
24
15
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
25
|
-
|
|
26
16
|
var _lodash = require("lodash");
|
|
27
|
-
|
|
28
17
|
var _images = _interopRequireDefault(require("../images"));
|
|
29
|
-
|
|
30
18
|
var _ActionsContext = _interopRequireDefault(require("../ActionsContext"));
|
|
31
|
-
|
|
32
19
|
var _Language = _interopRequireDefault(require("./Language"));
|
|
33
|
-
|
|
34
20
|
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
35
|
-
|
|
36
21
|
var _storage = require("../storage");
|
|
37
|
-
|
|
38
|
-
function _getRequireWildcardCache() { if (typeof WeakMap
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var data = _taggedTemplateLiteral(["\n width: 330px;\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.1);\n .isInIframe & {\n display: none;\n }\n\n .user-info-body {\n padding: 20px 15px;\n line-height: 16px;\n list-style: none;\n margin: 0;\n .user-info-body-username {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-weight: normal;\n font-size: 14px;\n color: ", ";\n line-height: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .user-info-body-account {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-size: 12px;\n color: #8B919E;\n margin-bottom: 14px;\n line-height: 14px;\n margin-left: 10px;\n }\n }\n .user-info-footer {\n border-top: ", ";\n background-color: #fff;\n height: 36px;\n line-height: 36px;\n padding: 0 15px;\n font-size: 12px;\n color: ", ";\n a{\n flex: 1;\n text-align:center;\n color: ", ";\n }\n }\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject3 = function _templateObject3() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _templateObject2() {
|
|
55
|
-
var data = _taggedTemplateLiteral(["\n .tnt-layout-personal-popover {\n .ant-popover-inner-content {\n padding: 0;\n }\n }\n"]);
|
|
56
|
-
|
|
57
|
-
_templateObject2 = function _templateObject2() {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _templateObject() {
|
|
65
|
-
var data = _taggedTemplateLiteral(["\n margin-right: 0;\n font-size: 0;\n img {\n width: 26px;\n height: 26px;\n border-radius: 50%;\n cursor: pointer;\n .large-size & {\n width: 32px;\n height: 32px;\n }\n }\n"]);
|
|
66
|
-
|
|
67
|
-
_templateObject = function _templateObject() {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
75
|
-
|
|
76
|
-
var Avatar = _styledComponents["default"].li(_templateObject());
|
|
77
|
-
|
|
78
|
-
var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject2());
|
|
79
|
-
|
|
80
|
-
var UserInfoWrapper = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
22
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
25
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
26
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
27
|
+
var Avatar = _styledComponents["default"].li(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-right: 0;\n font-size: 0;\n img {\n width: 26px;\n height: 26px;\n border-radius: 50%;\n cursor: pointer;\n .large-size & {\n width: 32px;\n height: 32px;\n }\n }\n"])));
|
|
28
|
+
var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .tnt-layout-personal-popover {\n .ant-popover-inner-content {\n padding: 0;\n }\n }\n"])));
|
|
29
|
+
var UserInfoWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 330px;\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.1);\n .isInIframe & {\n display: none;\n }\n\n .user-info-body {\n padding: 20px 15px;\n line-height: 16px;\n list-style: none;\n margin: 0;\n .user-info-body-username {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-weight: normal;\n font-size: 14px;\n color: ", ";\n line-height: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .user-info-body-account {\n margin-top: 0px;\n font-family: PingFangSC-Regular;\n font-size: 12px;\n color: #8B919E;\n margin-bottom: 14px;\n line-height: 14px;\n margin-left: 10px;\n }\n }\n .user-info-footer {\n border-top: ", ";\n background-color: #fff;\n height: 36px;\n line-height: 36px;\n padding: 0 15px;\n font-size: 12px;\n color: ", ";\n a{\n flex: 1;\n text-align:center;\n color: ", ";\n }\n }\n"])), function (props) {
|
|
81
30
|
return "".concat(props.theme.primaryTextColor);
|
|
82
31
|
}, function (props) {
|
|
83
32
|
return "1px solid ".concat(props.theme.dividerColor);
|
|
@@ -86,63 +35,59 @@ var UserInfoWrapper = _styledComponents["default"].div(_templateObject3(), funct
|
|
|
86
35
|
}, function (props) {
|
|
87
36
|
return "".concat(props.theme.primaryColor);
|
|
88
37
|
});
|
|
89
|
-
|
|
90
38
|
var UserInfoContent = function UserInfoContent(props) {
|
|
91
39
|
var userInfo = props.userInfo,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
40
|
+
_props$config = props.config,
|
|
41
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
42
|
+
onLogout = props.onLogout,
|
|
43
|
+
_props$onChangePasswo = props.onChangePassword,
|
|
44
|
+
onChangePassword = _props$onChangePasswo === void 0 ? function () {
|
|
45
|
+
return true;
|
|
46
|
+
} : _props$onChangePasswo,
|
|
47
|
+
_props$onPersonalSett = props.onPersonalSetting,
|
|
48
|
+
onPersonalSetting = _props$onPersonalSett === void 0 ? function () {
|
|
49
|
+
return true;
|
|
50
|
+
} : _props$onPersonalSett,
|
|
51
|
+
onLanguageChange = props.onLanguageChange,
|
|
52
|
+
onThemeChange = props.onThemeChange;
|
|
106
53
|
var _useContext = (0, _react.useContext)(_ActionsContext["default"]),
|
|
107
|
-
|
|
108
|
-
|
|
54
|
+
getText = _useContext.getText;
|
|
109
55
|
var _ref = config || {},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return React.createElement(UserInfoWrapper, {
|
|
56
|
+
_ref$language = _ref.language,
|
|
57
|
+
language = _ref$language === void 0 ? true : _ref$language;
|
|
58
|
+
return /*#__PURE__*/React.createElement(UserInfoWrapper, {
|
|
114
59
|
className: "user-info-setting-wrap"
|
|
115
|
-
}, React.createElement("ul", {
|
|
60
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
116
61
|
className: "user-info-body"
|
|
117
|
-
}, React.createElement("li", {
|
|
62
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
118
63
|
className: "user-info-body-username"
|
|
119
|
-
}, userInfo.userName || getText('nameNull'), React.createElement("span", {
|
|
64
|
+
}, userInfo.userName || getText('nameNull'), /*#__PURE__*/React.createElement("span", {
|
|
120
65
|
className: "user-info-body-account"
|
|
121
|
-
}, userInfo.account)), language && React.createElement(_Language["default"], {
|
|
66
|
+
}, userInfo.account)), language && /*#__PURE__*/React.createElement(_Language["default"], {
|
|
122
67
|
language: userInfo.lang,
|
|
123
68
|
onChange: onLanguageChange
|
|
124
|
-
}), React.createElement(_Theme["default"], {
|
|
69
|
+
}), /*#__PURE__*/React.createElement(_Theme["default"], {
|
|
125
70
|
theme: userInfo.theme,
|
|
126
71
|
onChange: onThemeChange
|
|
127
|
-
})), React.createElement(_row["default"], {
|
|
72
|
+
})), /*#__PURE__*/React.createElement(_row["default"], {
|
|
128
73
|
className: "user-info-footer",
|
|
129
74
|
type: "flex",
|
|
130
75
|
justify: "space-between",
|
|
131
76
|
align: "middle"
|
|
132
|
-
}, React.createElement("a", {
|
|
77
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
133
78
|
onClick: onPersonalSetting,
|
|
134
79
|
href: "/bridge/userCenter?currentTab=1"
|
|
135
|
-
}, getText('personalSettings')), React.createElement(_divider["default"], {
|
|
80
|
+
}, getText('personalSettings')), /*#__PURE__*/React.createElement(_divider["default"], {
|
|
136
81
|
type: "vertical"
|
|
137
|
-
}), React.createElement("a", {
|
|
82
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
138
83
|
onClick: onChangePassword,
|
|
139
84
|
href: "/bridge/userCenter?currentTab=2",
|
|
140
85
|
style: (0, _storage.getLanguageStore)() === 'en' ? {
|
|
141
86
|
flex: 2
|
|
142
87
|
} : {}
|
|
143
|
-
}, getText('changePwd')), React.createElement(_divider["default"], {
|
|
88
|
+
}, getText('changePwd')), /*#__PURE__*/React.createElement(_divider["default"], {
|
|
144
89
|
type: "vertical"
|
|
145
|
-
}), React.createElement("a", {
|
|
90
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
146
91
|
className: "user-info-footer-signout",
|
|
147
92
|
onClick: function onClick() {
|
|
148
93
|
if (onLogout) {
|
|
@@ -155,30 +100,25 @@ var UserInfoContent = function UserInfoContent(props) {
|
|
|
155
100
|
}
|
|
156
101
|
}, getText('signOut'))));
|
|
157
102
|
};
|
|
158
|
-
|
|
159
|
-
var _default = function _default(props) {
|
|
103
|
+
var _default = exports["default"] = function _default(props) {
|
|
160
104
|
var _images$empty2;
|
|
161
|
-
|
|
162
105
|
var _props$userInfo = props.userInfo,
|
|
163
|
-
|
|
106
|
+
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
164
107
|
var avatar = userInfo.avatar;
|
|
165
|
-
return React.createElement(Avatar, null, React.createElement(_popover["default"], {
|
|
108
|
+
return /*#__PURE__*/React.createElement(Avatar, null, /*#__PURE__*/React.createElement(_popover["default"], {
|
|
166
109
|
popupClassName: "tnt-layout-personal-popover",
|
|
167
110
|
placement: "bottomRight",
|
|
168
111
|
title: null,
|
|
169
|
-
content: React.createElement(UserInfoContent, props),
|
|
112
|
+
content: /*#__PURE__*/React.createElement(UserInfoContent, props),
|
|
170
113
|
trigger: "click"
|
|
171
|
-
}, avatar ? React.createElement("img", {
|
|
114
|
+
}, avatar ? /*#__PURE__*/React.createElement("img", {
|
|
172
115
|
src: avatar.indexOf('base64') > 0 ? avatar : (0, _lodash.get)(_images["default"][avatar], 'default', _images["default"][avatar]),
|
|
173
116
|
onError: function onError(e) {
|
|
174
117
|
var _images$empty;
|
|
175
|
-
|
|
176
118
|
e.target.onerror = null;
|
|
177
119
|
e.target.src = ((_images$empty = _images["default"].empty) == null ? void 0 : _images$empty["default"]) || _images["default"].empty;
|
|
178
120
|
}
|
|
179
|
-
}) : React.createElement("img", {
|
|
121
|
+
}) : /*#__PURE__*/React.createElement("img", {
|
|
180
122
|
src: ((_images$empty2 = _images["default"].empty) == null ? void 0 : _images$empty2["default"]) || _images["default"].empty
|
|
181
|
-
})), React.createElement(GlobalStyle, null));
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
exports["default"] = _default;
|
|
123
|
+
})), /*#__PURE__*/React.createElement(GlobalStyle, null));
|
|
124
|
+
};
|
|
@@ -1,48 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
11
|
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
17
|
-
|
|
18
12
|
var _storage = require("../storage");
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
-
|
|
32
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
-
|
|
34
|
-
function _templateObject() {
|
|
35
|
-
var data = _taggedTemplateLiteral(["\n display:inline-block;\n padding: 0 10px;\n height: 32px;\n line-height: 32px;\n text-align: center;\n background: #FFFFFF;\n border: 1px solid #E1E6EE;\n border-radius: 2px;\n font-family: PingFangSC-Regular;\n color: #17233D;\n font-size: ", ";\n cursor: pointer;\n margin-top: 8px;\n\n .tnt-icon {\n font-size: ", ";\n margin-right: 4px;\n }\n\n span {\n position: relative;\n font-size: ", ";\n top: ", ";\n font-family: auto;\n }\n\n .isInIframe & {\n display: none;\n }\n"]);
|
|
36
|
-
|
|
37
|
-
_templateObject = function _templateObject() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
|
-
|
|
13
|
+
var _templateObject;
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); 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; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
46
24
|
var languages = [{
|
|
47
25
|
value: 'cn',
|
|
48
26
|
name: '中文'
|
|
@@ -54,8 +32,7 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
54
32
|
acc[cur.value] = cur;
|
|
55
33
|
return acc;
|
|
56
34
|
}, {});
|
|
57
|
-
|
|
58
|
-
var Language = _styledComponents["default"].li(_templateObject(), function (_ref) {
|
|
35
|
+
var Language = _styledComponents["default"].li(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display:inline-block;\n padding: 0 10px;\n height: 32px;\n line-height: 32px;\n text-align: center;\n background: #FFFFFF;\n border: 1px solid #E1E6EE;\n border-radius: 2px;\n font-family: PingFangSC-Regular;\n color: #17233D;\n font-size: ", ";\n cursor: pointer;\n margin-top: 8px;\n\n .tnt-icon {\n font-size: ", ";\n margin-right: 4px;\n }\n\n span {\n position: relative;\n font-size: ", ";\n top: ", ";\n font-family: auto;\n }\n\n .isInIframe & {\n display: none;\n }\n"])), function (_ref) {
|
|
59
36
|
var size = _ref.theme.size;
|
|
60
37
|
return size === 'large' ? '14px' : '12px';
|
|
61
38
|
}, function (_ref2) {
|
|
@@ -68,41 +45,32 @@ var Language = _styledComponents["default"].li(_templateObject(), function (_ref
|
|
|
68
45
|
var size = _ref4.theme.size;
|
|
69
46
|
return size === 'large' ? '-3px' : '-2px';
|
|
70
47
|
});
|
|
71
|
-
|
|
72
|
-
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
48
|
+
var _default = exports["default"] = (0, _styledComponents.withTheme)(function (props) {
|
|
73
49
|
var onChange = props.onChange;
|
|
74
|
-
|
|
75
50
|
var getLanguage = function getLanguage() {
|
|
76
51
|
var lang = (0, _storage.getLanguageStore)() || props.language;
|
|
77
|
-
|
|
78
52
|
if (!languagesMap[lang]) {
|
|
79
53
|
lang = (0, _lodash.get)(languages, '0.value');
|
|
80
54
|
}
|
|
81
|
-
|
|
82
55
|
return lang;
|
|
83
56
|
};
|
|
84
|
-
|
|
85
57
|
var _useState = (0, _react.useState)(getLanguage()),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
_useState2$ = _useState2[0],
|
|
60
|
+
language = _useState2$ === void 0 ? 'cn' : _useState2$,
|
|
61
|
+
setLanguage = _useState2[1];
|
|
91
62
|
var switchLanguage = function switchLanguage() {
|
|
92
63
|
var lang = language === 'cn' ? 'en' : 'cn';
|
|
93
64
|
setLanguage(lang);
|
|
94
65
|
(0, _storage.setLanguageStore)(lang);
|
|
95
66
|
onChange && onChange(lang);
|
|
96
67
|
};
|
|
97
|
-
|
|
98
68
|
var otherLanguage = (0, _react.useMemo)(function () {
|
|
99
69
|
return language === 'cn' ? 'en' : 'cn';
|
|
100
70
|
}, [language]);
|
|
101
|
-
return React.createElement(Language, {
|
|
71
|
+
return /*#__PURE__*/React.createElement(Language, {
|
|
102
72
|
onClick: switchLanguage
|
|
103
|
-
}, React.createElement(_Iconfont["default"], {
|
|
73
|
+
}, /*#__PURE__*/React.createElement(_Iconfont["default"], {
|
|
104
74
|
type: "flag-".concat(otherLanguage)
|
|
105
|
-
}), React.createElement("span", null, (0, _lodash.get)(languagesMap[otherLanguage], 'name')));
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
exports["default"] = _default;
|
|
75
|
+
}), /*#__PURE__*/React.createElement("span", null, (0, _lodash.get)(languagesMap[otherLanguage], 'name')));
|
|
76
|
+
});
|