tntd 1.4.18 → 1.4.20
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 +1 -1
- package/components/Layout/Avatar.js +4 -4
- package/components/Layout/EnterpriseLayout/Avatar.js +10 -7
- package/components/Layout/EnterpriseLayout/Language.js +5 -3
- package/components/Layout/EnterpriseLayout/Theme.js +6 -7
- package/components/Layout/EnterpriseLayout/index.js +1 -1
- package/components/Layout/HeaderActions.js +13 -10
- package/components/Layout/HeaderTabs.js +13 -14
- package/components/Layout/Layout.js +2 -0
- package/components/Layout/index.js +2 -1
- package/components/Layout/storage.js +12 -2
- package/components/Page/index.js +2 -2
- package/components/locale.js +7 -2
- package/dist/1.tntd.js +1 -12
- package/dist/stats.json +28426 -28000
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +13 -7
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +76 -108
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +31 -38
- package/es/DevelopmentLogin/LoginModal.js +32 -45
- package/es/DevelopmentLogin/index.js +13 -17
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +59 -70
- package/es/Handle/index.js +25 -35
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +10 -13
- package/es/Img/Contain.js +24 -29
- package/es/Img/Cover.js +40 -54
- package/es/Img/index.js +36 -45
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +37 -92
- package/es/Layout/Application.js +26 -72
- package/es/Layout/Avatar.js +32 -69
- package/es/Layout/CompatibleLanguage.js +39 -94
- package/es/Layout/EnterpriseLayout/Avatar.js +49 -79
- package/es/Layout/EnterpriseLayout/Language.js +19 -34
- package/es/Layout/EnterpriseLayout/Theme.js +23 -37
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +59 -170
- package/es/Layout/GlobalNavigation/index.js +20 -54
- package/es/Layout/Header.js +25 -46
- package/es/Layout/HeaderActions.js +52 -63
- package/es/Layout/HeaderNavs.js +20 -47
- package/es/Layout/HeaderTabs.js +61 -115
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +14 -32
- package/es/Layout/Layout.js +88 -108
- package/es/Layout/Logo.js +16 -32
- package/es/Layout/OrgAppList.js +62 -107
- package/es/Layout/SideMenu.js +63 -124
- package/es/Layout/Theme.js +23 -61
- package/es/Layout/index.js +29 -36
- package/es/Layout/paaslayout/CompactSideMenu.js +35 -74
- package/es/Layout/paaslayout/Header.js +22 -45
- package/es/Layout/paaslayout/Logo.js +3 -13
- package/es/Layout/paaslayout/SideMenu.js +39 -78
- package/es/Layout/paaslayout/index.js +75 -102
- package/es/Layout/storage.js +26 -9
- package/es/LoadingButton/index.js +15 -24
- package/es/Modal/index.js +38 -46
- package/es/Page/Box.js +34 -41
- package/es/Page/index.js +54 -68
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +5 -9
- package/es/QueryForm/Field/Select.js +31 -41
- package/es/QueryForm/Field/SelectInput.js +26 -41
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +41 -71
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +76 -135
- package/es/QueryListScene/List.js +74 -128
- package/es/QueryListScene/QueryForm.js +46 -81
- package/es/QueryListScene/QueryListScene.js +25 -40
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +11 -12
- package/es/Select/DropDownWrap.js +29 -50
- package/es/Select/index.js +135 -231
- package/es/Table/ResizableTable/index.js +26 -40
- package/es/Table/index.js +18 -16
- package/es/Title/index.js +21 -23
- package/es/locale.js +9 -7
- package/es/utils/checkAuth.js +3 -5
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +12 -23
- package/lib/ArrayInput/icon.js +6 -6
- package/lib/ArrayInput/index.js +78 -127
- package/lib/AuthContext.js +1 -4
- package/lib/Columns/index.js +31 -47
- package/lib/DevelopmentLogin/LoginModal.js +32 -58
- package/lib/DevelopmentLogin/index.js +16 -27
- package/lib/Ellipsis/Svg/CopySVG.js +13 -15
- package/lib/Ellipsis/Svg/TickSVG.js +8 -10
- package/lib/Ellipsis/index.js +58 -81
- package/lib/Handle/index.js +25 -47
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/index.js +11 -20
- package/lib/Img/Contain.js +24 -34
- package/lib/Img/Cover.js +42 -65
- package/lib/Img/index.js +36 -51
- package/lib/Layout/ActionsContext.js +1 -4
- package/lib/Layout/AppList.js +40 -118
- package/lib/Layout/Application.js +26 -86
- package/lib/Layout/Avatar.js +35 -89
- package/lib/Layout/CompatibleLanguage.js +39 -110
- package/lib/Layout/EnterpriseLayout/Avatar.js +52 -101
- package/lib/Layout/EnterpriseLayout/Language.js +21 -49
- package/lib/Layout/EnterpriseLayout/Theme.js +22 -46
- package/lib/Layout/EnterpriseLayout/index.js +14 -23
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +59 -186
- package/lib/Layout/GlobalNavigation/index.js +23 -74
- package/lib/Layout/Header.js +28 -63
- package/lib/Layout/HeaderActions.js +48 -74
- package/lib/Layout/HeaderNavs.js +23 -61
- package/lib/Layout/HeaderTabs.js +58 -126
- package/lib/Layout/Iconfont.js +1 -5
- package/lib/Layout/Language.js +17 -48
- package/lib/Layout/Layout.js +90 -128
- package/lib/Layout/Logo.js +19 -43
- package/lib/Layout/OrgAppList.js +64 -127
- package/lib/Layout/SideMenu.js +65 -143
- package/lib/Layout/Theme.js +23 -73
- package/lib/Layout/createActions.js +0 -5
- package/lib/Layout/images/index.js +0 -28
- package/lib/Layout/index.js +33 -57
- package/lib/Layout/paaslayout/CompactSideMenu.js +35 -84
- package/lib/Layout/paaslayout/Header.js +22 -55
- package/lib/Layout/paaslayout/Logo.js +3 -19
- package/lib/Layout/paaslayout/SideMenu.js +39 -87
- package/lib/Layout/paaslayout/index.js +77 -122
- package/lib/Layout/storage.js +29 -35
- package/lib/LoadingButton/index.js +15 -29
- package/lib/Modal/index.js +38 -53
- package/lib/Page/Box.js +34 -45
- package/lib/Page/index.js +54 -78
- package/lib/Page/utils.js +1 -9
- package/lib/QueryForm/Field/Checkbox.js +5 -13
- package/lib/QueryForm/Field/Select.js +33 -53
- package/lib/QueryForm/Field/SelectInput.js +28 -56
- package/lib/QueryForm/Field/fieldsMap.js +1 -15
- package/lib/QueryForm/Field/index.js +43 -81
- package/lib/QueryForm/createActions.js +6 -12
- package/lib/QueryForm/index.js +78 -157
- package/lib/QueryForm/useForm.js +0 -5
- package/lib/QueryListScene/List.js +76 -140
- package/lib/QueryListScene/QueryForm.js +46 -86
- package/lib/QueryListScene/QueryListScene.js +25 -46
- package/lib/QueryListScene/Title.js +3 -7
- package/lib/QueryListScene/Toolbar.js +11 -16
- package/lib/QueryListScene/createActions.js +0 -5
- package/lib/QueryListScene/index.js +0 -10
- package/lib/QueryListScene/useActions.js +0 -5
- package/lib/Select/DropDownWrap.js +31 -56
- package/lib/Select/index.js +135 -241
- package/lib/Table/ResizableTable/index.js +26 -48
- package/lib/Table/index.js +17 -28
- package/lib/Title/index.js +21 -28
- package/lib/index.js +35 -56
- package/lib/locale.js +11 -12
- package/lib/utils/checkAuth.js +4 -9
- package/lib/utils/findMenuInfoByPath.js +1 -8
- package/lib/utils/index.js +15 -42
- package/package.json +2 -2
- package/es/Layout/checkAuth.js +0 -29
- package/es/Layout/utils.js +0 -136
- package/lib/Layout/EnterpriseLayout/Header.js +0 -113
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
- package/lib/Layout/checkAuth.js +0 -39
- package/lib/Layout/utils.js +0 -166
|
@@ -1,58 +1,17 @@
|
|
|
1
1
|
import "antd/lib/popover/style";
|
|
2
2
|
import _Popover from "antd/lib/popover";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
3
|
+
var _templateObject,
|
|
4
|
+
_templateObject2,
|
|
5
|
+
_templateObject3,
|
|
6
|
+
_templateObject4,
|
|
7
|
+
_this = this;
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
|
-
function _templateObject4() {
|
|
15
|
-
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"]);
|
|
16
|
-
|
|
17
|
-
_templateObject4 = function _templateObject4() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _templateObject3() {
|
|
25
|
-
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"]);
|
|
26
|
-
|
|
27
|
-
_templateObject3 = function _templateObject3() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject2() {
|
|
35
|
-
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"]);
|
|
36
|
-
|
|
37
|
-
_templateObject2 = function _templateObject2() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _templateObject() {
|
|
45
|
-
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"]);
|
|
46
|
-
|
|
47
|
-
_templateObject = function _templateObject() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
14
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
|
-
|
|
56
15
|
import { useState } from 'react';
|
|
57
16
|
import styled from 'styled-components';
|
|
58
17
|
import cn from 'classnames';
|
|
@@ -71,10 +30,10 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
71
30
|
acc[cur.value] = cur;
|
|
72
31
|
return acc;
|
|
73
32
|
}, {});
|
|
74
|
-
var LanguageSwitch = styled.div(_templateObject());
|
|
75
|
-
var Theme = styled.li(_templateObject2());
|
|
76
|
-
var ThemeSwitch = styled.div(_templateObject3());
|
|
77
|
-
var ThemeContentWrapper = styled.div(_templateObject4());
|
|
33
|
+
var LanguageSwitch = styled.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"])));
|
|
34
|
+
var Theme = styled.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"])));
|
|
35
|
+
var ThemeSwitch = styled.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"])));
|
|
36
|
+
var ThemeContentWrapper = styled.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"])));
|
|
78
37
|
var themes = [{
|
|
79
38
|
value: 'themeS1',
|
|
80
39
|
img: images.themeSymbol1
|
|
@@ -82,18 +41,15 @@ var themes = [{
|
|
|
82
41
|
value: 'themeS2',
|
|
83
42
|
img: images.themeSymbol2
|
|
84
43
|
}];
|
|
85
|
-
|
|
86
44
|
var ThemeContent = function ThemeContent(props) {
|
|
87
45
|
var config = props.config,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
46
|
+
onLanguageChange = props.onLanguageChange,
|
|
47
|
+
onThemeChange = props.onThemeChange;
|
|
91
48
|
var _ref = config || {},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
49
|
+
_ref$language = _ref.language,
|
|
50
|
+
languageVisible = _ref$language === void 0 ? true : _ref$language,
|
|
51
|
+
_ref$theme = _ref.theme,
|
|
52
|
+
themeVisible = _ref$theme === void 0 ? true : _ref$theme;
|
|
97
53
|
var getTheme = function getTheme() {
|
|
98
54
|
var theme = getThemeStore() || props.theme || 'themeS2';
|
|
99
55
|
return themes.some(function (_ref2) {
|
|
@@ -101,57 +57,49 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
101
57
|
return value === theme;
|
|
102
58
|
}) ? theme : 'themeS2';
|
|
103
59
|
};
|
|
104
|
-
|
|
105
60
|
var _useState = useState(getTheme()),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
theme = _useState2[0],
|
|
63
|
+
setTheme = _useState2[1];
|
|
110
64
|
var changeTheme = function changeTheme(theme) {
|
|
111
65
|
setTheme(theme);
|
|
112
66
|
setThemeStore(theme);
|
|
113
67
|
onThemeChange(theme);
|
|
114
68
|
};
|
|
115
|
-
|
|
116
69
|
var getLanguage = function getLanguage() {
|
|
117
70
|
var lang = getLanguageStore() || props.language;
|
|
118
|
-
|
|
119
71
|
if (!languagesMap[lang]) {
|
|
120
72
|
lang = get(languages, '0.value');
|
|
121
73
|
}
|
|
122
|
-
|
|
123
74
|
return lang;
|
|
124
75
|
};
|
|
125
|
-
|
|
126
76
|
var _useState3 = useState(getLanguage()),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
77
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
+
_useState4$ = _useState4[0],
|
|
79
|
+
language = _useState4$ === void 0 ? 'cn' : _useState4$,
|
|
80
|
+
setLanguage = _useState4[1];
|
|
132
81
|
var changeLanguage = function changeLanguage(language) {
|
|
133
82
|
setLanguage(language);
|
|
134
83
|
setLanguageStore(language);
|
|
135
84
|
onLanguageChange(language);
|
|
136
85
|
};
|
|
137
|
-
|
|
138
|
-
return React.createElement(ThemeContentWrapper, null, themeVisible && React.createElement(ThemeSwitch, null, themes.map(function (_ref3) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(ThemeContentWrapper, null, themeVisible && /*#__PURE__*/React.createElement(ThemeSwitch, null, themes.map(function (_ref3) {
|
|
139
87
|
var value = _ref3.value,
|
|
140
|
-
|
|
141
|
-
return React.createElement("div", {
|
|
88
|
+
img = _ref3.img;
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
142
90
|
key: value,
|
|
143
91
|
onClick: changeTheme.bind(_this, value)
|
|
144
|
-
}, React.createElement("img", {
|
|
92
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
145
93
|
src: img
|
|
146
|
-
}), theme === value && React.createElement(Icon, {
|
|
94
|
+
}), theme === value && /*#__PURE__*/React.createElement(Icon, {
|
|
147
95
|
type: "check1"
|
|
148
96
|
}));
|
|
149
|
-
})), themeVisible && languageVisible && React.createElement("div", {
|
|
97
|
+
})), themeVisible && languageVisible && /*#__PURE__*/React.createElement("div", {
|
|
150
98
|
className: "line"
|
|
151
|
-
}), languageVisible && React.createElement(LanguageSwitch, null, languages.map(function (_ref4) {
|
|
99
|
+
}), languageVisible && /*#__PURE__*/React.createElement(LanguageSwitch, null, languages.map(function (_ref4) {
|
|
152
100
|
var value = _ref4.value,
|
|
153
|
-
|
|
154
|
-
return React.createElement("div", {
|
|
101
|
+
name = _ref4.name;
|
|
102
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
155
103
|
className: cn({
|
|
156
104
|
active: value === language
|
|
157
105
|
}),
|
|
@@ -160,20 +108,17 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
160
108
|
}, name);
|
|
161
109
|
})));
|
|
162
110
|
};
|
|
163
|
-
|
|
164
111
|
export default (function (props) {
|
|
165
112
|
var config = props.config;
|
|
166
|
-
|
|
167
113
|
if ((config == null ? void 0 : config.language) === false && (config == null ? void 0 : config.theme) === false) {
|
|
168
114
|
return null;
|
|
169
115
|
}
|
|
170
|
-
|
|
171
|
-
return React.createElement(Theme, null, React.createElement(_Popover, {
|
|
116
|
+
return /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(_Popover, {
|
|
172
117
|
placement: "bottomRight",
|
|
173
118
|
title: null,
|
|
174
|
-
content: React.createElement(ThemeContent, props),
|
|
119
|
+
content: /*#__PURE__*/React.createElement(ThemeContent, props),
|
|
175
120
|
trigger: "click"
|
|
176
|
-
}, React.createElement(Icon, {
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
177
122
|
type: "daxiaoxie"
|
|
178
123
|
})));
|
|
179
124
|
});
|
|
@@ -4,48 +4,19 @@ import "antd/lib/row/style";
|
|
|
4
4
|
import _Row from "antd/lib/row";
|
|
5
5
|
import "antd/lib/divider/style";
|
|
6
6
|
import _Divider from "antd/lib/divider";
|
|
7
|
-
|
|
8
|
-
function _templateObject3() {
|
|
9
|
-
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"]);
|
|
10
|
-
|
|
11
|
-
_templateObject3 = function _templateObject3() {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _templateObject2() {
|
|
19
|
-
var data = _taggedTemplateLiteral(["\n .tnt-layout-personal-popover {\n .ant-popover-inner-content {\n padding: 0;\n }\n }\n"]);
|
|
20
|
-
|
|
21
|
-
_templateObject2 = function _templateObject2() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _templateObject() {
|
|
29
|
-
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"]);
|
|
30
|
-
|
|
31
|
-
_templateObject = function _templateObject() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
7
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
38
8
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
|
-
|
|
9
|
+
import { useContext } from 'react';
|
|
40
10
|
import styled, { createGlobalStyle } from 'styled-components';
|
|
41
|
-
import deleteAllCookiesFactory from 'delete-all-cookies';
|
|
42
11
|
import { get } from 'lodash';
|
|
43
12
|
import images from '../images';
|
|
13
|
+
import ActionsContext from '../ActionsContext';
|
|
44
14
|
import Language from './Language';
|
|
45
15
|
import Theme from './Theme';
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
var
|
|
16
|
+
import { getLanguageStore, clearLoginCookie } from '../storage';
|
|
17
|
+
var Avatar = styled.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"])));
|
|
18
|
+
var GlobalStyle = createGlobalStyle(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .tnt-layout-personal-popover {\n .ant-popover-inner-content {\n padding: 0;\n }\n }\n"])));
|
|
19
|
+
var UserInfoWrapper = styled.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) {
|
|
49
20
|
return "".concat(props.theme.primaryTextColor);
|
|
50
21
|
}, function (props) {
|
|
51
22
|
return "1px solid ".concat(props.theme.dividerColor);
|
|
@@ -54,91 +25,90 @@ var UserInfoWrapper = styled.div(_templateObject3(), function (props) {
|
|
|
54
25
|
}, function (props) {
|
|
55
26
|
return "".concat(props.theme.primaryColor);
|
|
56
27
|
});
|
|
57
|
-
|
|
58
28
|
var UserInfoContent = function UserInfoContent(props) {
|
|
59
29
|
var userInfo = props.userInfo,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
_props$config = props.config,
|
|
31
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
32
|
+
onLogout = props.onLogout,
|
|
33
|
+
_props$onChangePasswo = props.onChangePassword,
|
|
34
|
+
onChangePassword = _props$onChangePasswo === void 0 ? function () {
|
|
35
|
+
return true;
|
|
36
|
+
} : _props$onChangePasswo,
|
|
37
|
+
_props$onPersonalSett = props.onPersonalSetting,
|
|
38
|
+
onPersonalSetting = _props$onPersonalSett === void 0 ? function () {
|
|
39
|
+
return true;
|
|
40
|
+
} : _props$onPersonalSett,
|
|
41
|
+
onLanguageChange = props.onLanguageChange,
|
|
42
|
+
onThemeChange = props.onThemeChange;
|
|
43
|
+
var _useContext = useContext(ActionsContext),
|
|
44
|
+
getText = _useContext.getText;
|
|
74
45
|
var _ref = config || {},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return React.createElement(UserInfoWrapper, {
|
|
46
|
+
_ref$language = _ref.language,
|
|
47
|
+
language = _ref$language === void 0 ? true : _ref$language;
|
|
48
|
+
return /*#__PURE__*/React.createElement(UserInfoWrapper, {
|
|
79
49
|
className: "user-info-setting-wrap"
|
|
80
|
-
}, React.createElement("ul", {
|
|
50
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
81
51
|
className: "user-info-body"
|
|
82
|
-
}, React.createElement("li", {
|
|
52
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
83
53
|
className: "user-info-body-username"
|
|
84
|
-
}, userInfo.userName || '
|
|
54
|
+
}, userInfo.userName || getText('nameNull'), /*#__PURE__*/React.createElement("span", {
|
|
85
55
|
className: "user-info-body-account"
|
|
86
|
-
}, userInfo.account)), language && React.createElement(Language, {
|
|
56
|
+
}, userInfo.account)), language && /*#__PURE__*/React.createElement(Language, {
|
|
87
57
|
language: userInfo.lang,
|
|
88
58
|
onChange: onLanguageChange
|
|
89
|
-
}), React.createElement(Theme, {
|
|
59
|
+
}), /*#__PURE__*/React.createElement(Theme, {
|
|
90
60
|
theme: userInfo.theme,
|
|
91
61
|
onChange: onThemeChange
|
|
92
|
-
})), React.createElement(_Row, {
|
|
62
|
+
})), /*#__PURE__*/React.createElement(_Row, {
|
|
93
63
|
className: "user-info-footer",
|
|
94
64
|
type: "flex",
|
|
95
65
|
justify: "space-between",
|
|
96
66
|
align: "middle"
|
|
97
|
-
}, React.createElement("a", {
|
|
67
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
98
68
|
onClick: onPersonalSetting,
|
|
99
69
|
href: "/bridge/userCenter?currentTab=1"
|
|
100
|
-
},
|
|
70
|
+
}, getText('personalSettings')), /*#__PURE__*/React.createElement(_Divider, {
|
|
101
71
|
type: "vertical"
|
|
102
|
-
}), React.createElement("a", {
|
|
72
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
103
73
|
onClick: onChangePassword,
|
|
104
|
-
href: "/bridge/userCenter?currentTab=2"
|
|
105
|
-
|
|
74
|
+
href: "/bridge/userCenter?currentTab=2",
|
|
75
|
+
style: getLanguageStore() === 'en' ? {
|
|
76
|
+
flex: 2
|
|
77
|
+
} : {}
|
|
78
|
+
}, getText('changePwd')), /*#__PURE__*/React.createElement(_Divider, {
|
|
106
79
|
type: "vertical"
|
|
107
|
-
}), React.createElement("a", {
|
|
80
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
108
81
|
className: "user-info-footer-signout",
|
|
109
82
|
onClick: function onClick() {
|
|
110
83
|
if (onLogout) {
|
|
111
84
|
onLogout();
|
|
112
|
-
|
|
85
|
+
clearLoginCookie();
|
|
113
86
|
} else {
|
|
114
|
-
|
|
87
|
+
clearLoginCookie();
|
|
115
88
|
window.location.href = "/user/login?callbackUrl=".concat(window.encodeURI(location.href));
|
|
116
89
|
}
|
|
117
90
|
}
|
|
118
|
-
},
|
|
91
|
+
}, getText('signOut'))));
|
|
119
92
|
};
|
|
120
|
-
|
|
121
93
|
export default (function (props) {
|
|
122
94
|
var _images$empty2;
|
|
123
|
-
|
|
124
95
|
var _props$userInfo = props.userInfo,
|
|
125
|
-
|
|
96
|
+
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
126
97
|
var avatar = userInfo.avatar;
|
|
127
|
-
return React.createElement(Avatar, null, React.createElement(_Popover, {
|
|
98
|
+
return /*#__PURE__*/React.createElement(Avatar, null, /*#__PURE__*/React.createElement(_Popover, {
|
|
128
99
|
popupClassName: "tnt-layout-personal-popover",
|
|
129
100
|
placement: "bottomRight",
|
|
130
101
|
title: null,
|
|
131
|
-
content: React.createElement(UserInfoContent, props),
|
|
102
|
+
content: /*#__PURE__*/React.createElement(UserInfoContent, props),
|
|
132
103
|
trigger: "click"
|
|
133
|
-
}, avatar ? React.createElement("img", {
|
|
104
|
+
}, avatar ? /*#__PURE__*/React.createElement("img", {
|
|
134
105
|
src: avatar.indexOf('base64') > 0 ? avatar : get(images[avatar], 'default', images[avatar]),
|
|
135
106
|
onError: function onError(e) {
|
|
136
107
|
var _images$empty;
|
|
137
|
-
|
|
138
108
|
e.target.onerror = null;
|
|
139
109
|
e.target.src = ((_images$empty = images.empty) == null ? void 0 : _images$empty["default"]) || images.empty;
|
|
140
110
|
}
|
|
141
|
-
}) : React.createElement("img", {
|
|
111
|
+
}) : /*#__PURE__*/React.createElement("img", {
|
|
142
112
|
src: ((_images$empty2 = images.empty) == null ? void 0 : _images$empty2["default"]) || images.empty
|
|
143
|
-
})), React.createElement(GlobalStyle, null));
|
|
113
|
+
})), /*#__PURE__*/React.createElement(GlobalStyle, null));
|
|
144
114
|
});
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
|
|
9
|
-
function _templateObject() {
|
|
10
|
-
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"]);
|
|
11
|
-
|
|
12
|
-
_templateObject = function _templateObject() {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
8
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
20
|
-
|
|
21
|
-
import { useState } from 'react';
|
|
9
|
+
import { useState, useMemo } from 'react';
|
|
22
10
|
import styled, { withTheme } from 'styled-components';
|
|
23
11
|
import { get } from 'lodash';
|
|
24
12
|
import Iconfont from '../Iconfont';
|
|
@@ -34,7 +22,7 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
34
22
|
acc[cur.value] = cur;
|
|
35
23
|
return acc;
|
|
36
24
|
}, {});
|
|
37
|
-
var Language = styled.li(_templateObject(), function (_ref) {
|
|
25
|
+
var Language = styled.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) {
|
|
38
26
|
var size = _ref.theme.size;
|
|
39
27
|
return size === 'large' ? '14px' : '12px';
|
|
40
28
|
}, function (_ref2) {
|
|
@@ -49,33 +37,30 @@ var Language = styled.li(_templateObject(), function (_ref) {
|
|
|
49
37
|
});
|
|
50
38
|
export default withTheme(function (props) {
|
|
51
39
|
var onChange = props.onChange;
|
|
52
|
-
|
|
53
40
|
var getLanguage = function getLanguage() {
|
|
54
41
|
var lang = getLanguageStore() || props.language;
|
|
55
|
-
|
|
56
42
|
if (!languagesMap[lang]) {
|
|
57
43
|
lang = get(languages, '0.value');
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
return lang;
|
|
61
46
|
};
|
|
62
|
-
|
|
63
47
|
var _useState = useState(getLanguage()),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
_useState2$ = _useState2[0],
|
|
50
|
+
language = _useState2$ === void 0 ? 'cn' : _useState2$,
|
|
51
|
+
setLanguage = _useState2[1];
|
|
69
52
|
var switchLanguage = function switchLanguage() {
|
|
70
53
|
var lang = language === 'cn' ? 'en' : 'cn';
|
|
71
54
|
setLanguage(lang);
|
|
72
55
|
setLanguageStore(lang);
|
|
73
56
|
onChange && onChange(lang);
|
|
74
57
|
};
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
var otherLanguage = useMemo(function () {
|
|
59
|
+
return language === 'cn' ? 'en' : 'cn';
|
|
60
|
+
}, [language]);
|
|
61
|
+
return /*#__PURE__*/React.createElement(Language, {
|
|
77
62
|
onClick: switchLanguage
|
|
78
|
-
}, React.createElement(Iconfont, {
|
|
79
|
-
type: "flag-".concat(
|
|
80
|
-
}), React.createElement("span", null, get(languagesMap[
|
|
63
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
64
|
+
type: "flag-".concat(otherLanguage)
|
|
65
|
+
}), /*#__PURE__*/React.createElement("span", null, get(languagesMap[otherLanguage], 'name')));
|
|
81
66
|
});
|
|
@@ -1,46 +1,34 @@
|
|
|
1
1
|
import "antd/lib/row/style";
|
|
2
2
|
import _Row from "antd/lib/row";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
|
-
|
|
3
|
+
var _templateObject,
|
|
4
|
+
_this = this;
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
|
-
function _templateObject() {
|
|
15
|
-
var data = _taggedTemplateLiteral(["\n margin-top: 20px;\n .user-info-body-theme-row{\n >div{\n width: 90px;\n height: 36px;\n line-height: 36px;\n font-family: PingFangSC-Regular;\n font-size: 12px;\n border-radius: 2px;\n text-align: center;\n cursor:pointer;\n position: relative;\n &.themeS3{\n background-image: linear-gradient(180deg, #213F83 0%, #0F75D6 100%);\n color: #FFFFFF;\n }\n &.themeS2{\n background: #17233D;\n color: #FFFFFF;\n }\n &.themeS1{\n background: #FFFFFF;\n box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1);\n color: #17233D;\n }\n .icon-checked-wrap{\n width: 14px;\n height: 14px;\n border-radius: 100%;\n background: #126BFB;\n position: absolute;\n top: -5px;\n right: -5px;\n &:after{\n content:'';\n width: 4px;\n height: 6px;\n border-color: #FFFFFF;\n border-width: 0 1px 1px 0;\n border-style: solid;\n transform: rotate(45deg);\n position: absolute;\n top: 3px;\n left: 5px;\n }\n }\n }\n }\n"]);
|
|
16
|
-
|
|
17
|
-
_templateObject = function _templateObject() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
11
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
|
-
|
|
26
12
|
import { useState } from 'react';
|
|
27
13
|
import styled from 'styled-components';
|
|
28
14
|
import Iconfont from '../Iconfont';
|
|
29
|
-
import { setThemeStore, getThemeStore } from '../storage';
|
|
30
|
-
var Theme = styled.li(_templateObject());
|
|
15
|
+
import { setThemeStore, getThemeStore, getLanguageStore } from '../storage';
|
|
16
|
+
var Theme = styled.li(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 20px;\n .user-info-body-theme-row{\n >div{\n width: 90px;\n height: 36px;\n line-height: 36px;\n font-family: PingFangSC-Regular;\n font-size: 12px;\n border-radius: 2px;\n text-align: center;\n cursor:pointer;\n position: relative;\n &.themeS3{\n background-image: linear-gradient(180deg, #213F83 0%, #0F75D6 100%);\n color: #FFFFFF;\n }\n &.themeS2{\n background: #17233D;\n color: #FFFFFF;\n }\n &.themeS1{\n background: #FFFFFF;\n box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.1);\n color: #17233D;\n }\n .icon-checked-wrap{\n width: 14px;\n height: 14px;\n border-radius: 100%;\n background: #126BFB;\n position: absolute;\n top: -5px;\n right: -5px;\n &:after{\n content:'';\n width: 4px;\n height: 6px;\n border-color: #FFFFFF;\n border-width: 0 1px 1px 0;\n border-style: solid;\n transform: rotate(45deg);\n position: absolute;\n top: 3px;\n left: 5px;\n }\n }\n }\n }\n"])));
|
|
31
17
|
var themes = [{
|
|
32
18
|
value: 'themeS3',
|
|
33
|
-
label: '科技蓝'
|
|
19
|
+
label: '科技蓝',
|
|
20
|
+
enLabel: 'Blue'
|
|
34
21
|
}, {
|
|
35
22
|
value: 'themeS2',
|
|
36
|
-
label: '暗夜黑'
|
|
23
|
+
label: '暗夜黑',
|
|
24
|
+
enLabel: 'Black'
|
|
37
25
|
}, {
|
|
38
26
|
value: 'themeS1',
|
|
39
|
-
label: '极致白'
|
|
27
|
+
label: '极致白',
|
|
28
|
+
enLabel: 'White'
|
|
40
29
|
}];
|
|
41
30
|
export default (function (props) {
|
|
42
31
|
var onChange = props.onChange;
|
|
43
|
-
|
|
44
32
|
var getTheme = function getTheme() {
|
|
45
33
|
var theme = getThemeStore() || props.theme || 'themeS3';
|
|
46
34
|
return themes.some(function (_ref) {
|
|
@@ -48,29 +36,27 @@ export default (function (props) {
|
|
|
48
36
|
return value === theme;
|
|
49
37
|
}) ? theme : 'themeS3';
|
|
50
38
|
};
|
|
51
|
-
|
|
52
39
|
var _useState = useState(getTheme()),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
theme = _useState2[0],
|
|
42
|
+
setTheme = _useState2[1];
|
|
57
43
|
var changeTheme = function changeTheme(theme) {
|
|
58
44
|
setTheme(theme);
|
|
59
45
|
setThemeStore(theme);
|
|
60
46
|
onChange(theme);
|
|
61
47
|
};
|
|
62
|
-
|
|
63
|
-
return React.createElement(Theme, null, React.createElement(_Row, {
|
|
48
|
+
return /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(_Row, {
|
|
64
49
|
type: "flex",
|
|
65
50
|
justify: "space-between",
|
|
66
51
|
className: "user-info-body-theme-row"
|
|
67
52
|
}, themes.map(function (_ref2) {
|
|
68
53
|
var value = _ref2.value,
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
label = _ref2.label,
|
|
55
|
+
enLabel = _ref2.enLabel;
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
71
57
|
className: value,
|
|
72
58
|
onClick: changeTheme.bind(_this, value)
|
|
73
|
-
}, label, theme === value && React.createElement("span", {
|
|
59
|
+
}, getLanguageStore() === 'en' ? enLabel : label, theme === value && /*#__PURE__*/React.createElement("span", {
|
|
74
60
|
className: "icon-checked-wrap"
|
|
75
61
|
}));
|
|
76
62
|
})));
|