tntd 1.3.56 → 1.3.60
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/babel.config.js +2 -2
- package/components/Layout/OrgAppList.js +1 -1
- package/components/QueryListScene/List.js +17 -13
- package/lib/0645cf743e4e44ca9da321d689897f07.png +0 -0
- package/lib/09db77de0c24fa0f45f8a5cf299a3d11.png +0 -0
- package/lib/1d0b52448de217857b270af807e9360d.png +0 -0
- package/lib/25d78d77c9c2f0d403e5d899ceb5b1ef.png +0 -0
- package/lib/27fa44ff0c98e1594d79b73045aabedf.png +0 -0
- package/lib/2c95075adb68d6131b59cae9fa554ec2.png +0 -0
- package/lib/377c871d922a25c773a9e7c2f42ed7c0.png +0 -0
- package/lib/3d901589b40bd56ff1fde2bbb700bfe1.png +0 -0
- package/lib/4abe481e130d7be0574e45573de8beb7.png +0 -0
- package/lib/95ee2260a509cd630d89c5367ed1973b.png +0 -0
- package/lib/ArrayInput/icon.js +31 -27
- package/lib/ArrayInput/index.js +298 -211
- package/lib/AuthContext.js +13 -2
- package/lib/BlockHeader/README.md +83 -0
- package/lib/BlockHeader/fonts/OswaldLight.ttf +0 -0
- package/lib/BlockHeader/index.js +42 -0
- package/lib/BlockHeader/index.less +141 -0
- package/lib/Columns/index.js +100 -71
- package/lib/DevelopmentLogin/LoginModal.js +141 -79
- package/lib/DevelopmentLogin/index.js +55 -28
- package/lib/Ellipsis/Svg/CopySVG.js +71 -23
- package/lib/Ellipsis/Svg/TickSVG.js +49 -17
- package/lib/Ellipsis/index.js +155 -149
- package/lib/Handle/index.js +109 -72
- package/lib/Icon/fonts/iconfont.js +43 -1
- package/lib/Icon/iconList.js +8 -119
- package/lib/Icon/index.js +45 -13
- package/lib/Img/Contain.js +81 -49
- package/lib/Img/Cover.js +136 -88
- package/lib/Img/index.js +89 -36
- package/lib/Layout/ActionsContext.js +11 -2
- package/lib/Layout/AppList.js +256 -262
- package/lib/Layout/Application.js +135 -119
- package/lib/Layout/Avatar.js +137 -137
- package/lib/Layout/CompatibleLanguage.js +195 -214
- package/lib/Layout/EnterpriseLayout/Avatar.js +168 -156
- package/lib/Layout/EnterpriseLayout/Language.js +100 -75
- package/lib/Layout/EnterpriseLayout/Theme.js +94 -96
- package/lib/Layout/EnterpriseLayout/index.js +45 -32
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +407 -335
- package/lib/Layout/GlobalNavigation/index.js +158 -110
- package/lib/Layout/Header.js +116 -165
- package/lib/Layout/HeaderActions.js +129 -170
- package/lib/Layout/HeaderNavs.js +113 -90
- package/lib/Layout/HeaderTabs.js +278 -312
- package/lib/Layout/Iconfont.js +15 -2
- package/lib/Layout/Language.js +102 -63
- package/lib/Layout/Layout.js +261 -272
- package/lib/Layout/Logo.js +87 -132
- package/lib/Layout/OrgAppList.js +319 -440
- package/lib/Layout/SideMenu.js +343 -429
- package/lib/Layout/Theme.js +124 -95
- package/lib/Layout/checkAuth.js +35 -21
- package/lib/Layout/createActions.js +51 -38
- package/lib/Layout/images/index.js +41 -33
- package/lib/Layout/index.js +161 -110
- package/lib/Layout/locale.js +53 -0
- package/lib/Layout/paaslayout/CompactSideMenu.js +178 -200
- package/lib/Layout/paaslayout/Header.js +90 -84
- package/lib/Layout/paaslayout/Logo.js +32 -27
- package/lib/Layout/paaslayout/SideMenu.js +174 -161
- package/lib/Layout/paaslayout/index.js +261 -240
- package/lib/Layout/paaslayout/index.less +75 -0
- package/lib/Layout/storage.js +78 -20
- package/lib/Layout/utils.js +143 -93
- package/lib/LoadingButton/index.js +57 -29
- package/lib/Modal/index.js +108 -83
- package/lib/Page/Box.js +81 -56
- package/lib/Page/index.js +173 -151
- package/lib/Page/utils.js +30 -12
- package/lib/QueryForm/Field/Checkbox.js +33 -11
- package/lib/QueryForm/Field/Select.js +99 -63
- package/lib/QueryForm/Field/SelectInput.js +114 -69
- package/lib/QueryForm/Field/fieldsMap.js +52 -30
- package/lib/QueryForm/Field/index.js +156 -75
- package/lib/QueryForm/createActions.js +65 -50
- package/lib/QueryForm/index.js +382 -303
- package/lib/QueryForm/useForm.js +17 -6
- package/lib/QueryListScene/Field/SelectInput.js +115 -0
- package/lib/QueryListScene/Field/fieldsMap.js +52 -0
- package/lib/QueryListScene/Field/index.js +159 -0
- package/lib/QueryListScene/Field/select.js +100 -0
- package/lib/QueryListScene/List.js +362 -285
- package/lib/QueryListScene/QueryForm/index.js +423 -0
- package/lib/QueryListScene/QueryForm/index.less +141 -0
- package/lib/QueryListScene/QueryForm.js +159 -91
- package/lib/QueryListScene/QueryListScene.js +87 -33
- package/lib/QueryListScene/Title.js +20 -10
- package/lib/QueryListScene/Toolbar.js +31 -8
- package/lib/QueryListScene/createActions.js +79 -64
- package/lib/QueryListScene/index.js +40 -23
- package/lib/QueryListScene/useActions.js +17 -6
- package/lib/Select/DropDownWrap.js +124 -60
- package/lib/Select/index.js +563 -426
- package/lib/Table/ResizableTable/index.js +121 -77
- package/lib/Table/index.js +51 -19
- package/lib/Title/index.js +52 -34
- package/lib/b9dd5ff3622296fbee51ed68f4bca1bf.png +0 -0
- package/lib/bd2921989f9296089ba58efb7a76f3ef.png +0 -0
- package/lib/index.html +6 -0
- package/lib/index.js +159 -19
- package/lib/locale.js +63 -48
- package/lib/main.css +16420 -0
- package/lib/tntd.js +2 -0
- package/lib/tntd.js.LICENSE.txt +36 -0
- package/package.json +2 -2
|
@@ -1,162 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
import { Popover, Row, Divider } from 'antd';
|
|
3
|
-
import deleteAllCookiesFactory from 'delete-all-cookies';
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
import images from '../images';
|
|
6
|
-
import Language from './Language';
|
|
7
|
-
import Theme from './Theme';
|
|
8
|
-
|
|
9
|
-
const Avatar = styled.li`
|
|
10
|
-
margin-right: 0;
|
|
11
|
-
font-size: 0;
|
|
12
|
-
img {
|
|
13
|
-
width: 26px;
|
|
14
|
-
height: 26px;
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
.large-size & {
|
|
18
|
-
width: 32px;
|
|
19
|
-
height: 32px;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
1
|
+
"use strict";
|
|
23
2
|
|
|
24
|
-
|
|
25
|
-
.tnt-layout-personal-popover {
|
|
26
|
-
.ant-popover-inner-content {
|
|
27
|
-
padding: 0;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const UserInfoWrapper = styled.div`
|
|
33
|
-
width: 330px;
|
|
34
|
-
z-index: 1;
|
|
35
|
-
background-color: #fff;
|
|
36
|
-
border-radius: 4px;
|
|
37
|
-
box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.1);
|
|
38
|
-
.isInIframe & {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
41
4
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
text-align:center;
|
|
79
|
-
|
|
80
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
require("antd/es/popover/style");
|
|
11
|
+
|
|
12
|
+
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
13
|
+
|
|
14
|
+
require("antd/es/row/style");
|
|
15
|
+
|
|
16
|
+
var _row = _interopRequireDefault(require("antd/es/row"));
|
|
17
|
+
|
|
18
|
+
require("antd/es/divider/style");
|
|
19
|
+
|
|
20
|
+
var _divider = _interopRequireDefault(require("antd/es/divider"));
|
|
21
|
+
|
|
22
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
+
|
|
24
|
+
var _deleteAllCookies = _interopRequireDefault(require("delete-all-cookies"));
|
|
25
|
+
|
|
26
|
+
var _lodash = require("lodash");
|
|
27
|
+
|
|
28
|
+
var _images = _interopRequireDefault(require("../images"));
|
|
29
|
+
|
|
30
|
+
var _Language = _interopRequireDefault(require("./Language"));
|
|
31
|
+
|
|
32
|
+
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
|
+
|
|
40
|
+
function _templateObject3() {
|
|
41
|
+
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"]);
|
|
42
|
+
|
|
43
|
+
_templateObject3 = function _templateObject3() {
|
|
44
|
+
return data;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _templateObject2() {
|
|
51
|
+
var data = _taggedTemplateLiteral(["\n .tnt-layout-personal-popover {\n .ant-popover-inner-content {\n padding: 0;\n }\n }\n"]);
|
|
52
|
+
|
|
53
|
+
_templateObject2 = function _templateObject2() {
|
|
54
|
+
return data;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _templateObject() {
|
|
61
|
+
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"]);
|
|
62
|
+
|
|
63
|
+
_templateObject = function _templateObject() {
|
|
64
|
+
return data;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
71
|
+
|
|
72
|
+
var Avatar = _styledComponents["default"].li(_templateObject());
|
|
73
|
+
|
|
74
|
+
var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject2());
|
|
75
|
+
|
|
76
|
+
var UserInfoWrapper = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
77
|
+
return "".concat(props.theme.primaryTextColor);
|
|
78
|
+
}, function (props) {
|
|
79
|
+
return "1px solid ".concat(props.theme.dividerColor);
|
|
80
|
+
}, function (props) {
|
|
81
|
+
return "".concat(props.theme.primaryColor);
|
|
82
|
+
}, function (props) {
|
|
83
|
+
return "".concat(props.theme.primaryColor);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
var UserInfoContent = function UserInfoContent(props) {
|
|
87
|
+
var userInfo = props.userInfo,
|
|
88
|
+
_props$config = props.config,
|
|
89
|
+
config = _props$config === void 0 ? {} : _props$config,
|
|
90
|
+
onLogout = props.onLogout,
|
|
91
|
+
_props$onChangePasswo = props.onChangePassword,
|
|
92
|
+
onChangePassword = _props$onChangePasswo === void 0 ? function () {
|
|
93
|
+
return true;
|
|
94
|
+
} : _props$onChangePasswo,
|
|
95
|
+
_props$onPersonalSett = props.onPersonalSetting,
|
|
96
|
+
onPersonalSetting = _props$onPersonalSett === void 0 ? function () {
|
|
97
|
+
return true;
|
|
98
|
+
} : _props$onPersonalSett,
|
|
99
|
+
onLanguageChange = props.onLanguageChange,
|
|
100
|
+
onThemeChange = props.onThemeChange;
|
|
101
|
+
|
|
102
|
+
var _ref = config || {},
|
|
103
|
+
_ref$language = _ref.language,
|
|
104
|
+
language = _ref$language === void 0 ? true : _ref$language;
|
|
105
|
+
|
|
106
|
+
return React.createElement(UserInfoWrapper, {
|
|
107
|
+
className: "user-info-setting-wrap"
|
|
108
|
+
}, React.createElement("ul", {
|
|
109
|
+
className: "user-info-body"
|
|
110
|
+
}, React.createElement("li", {
|
|
111
|
+
className: "user-info-body-username"
|
|
112
|
+
}, userInfo.userName || '暂无昵称', React.createElement("span", {
|
|
113
|
+
className: "user-info-body-account"
|
|
114
|
+
}, userInfo.account)), language && React.createElement(_Language["default"], {
|
|
115
|
+
language: userInfo.lang,
|
|
116
|
+
onChange: onLanguageChange
|
|
117
|
+
}), React.createElement(_Theme["default"], {
|
|
118
|
+
theme: userInfo.theme,
|
|
119
|
+
onChange: onThemeChange
|
|
120
|
+
})), React.createElement(_row["default"], {
|
|
121
|
+
className: "user-info-footer",
|
|
122
|
+
type: "flex",
|
|
123
|
+
justify: "space-between",
|
|
124
|
+
align: "middle"
|
|
125
|
+
}, React.createElement("a", {
|
|
126
|
+
onClick: onPersonalSetting,
|
|
127
|
+
href: "/bridge/userCenter?currentTab=1"
|
|
128
|
+
}, "\u4E2A\u4EBA\u8BBE\u7F6E"), React.createElement(_divider["default"], {
|
|
129
|
+
type: "vertical"
|
|
130
|
+
}), React.createElement("a", {
|
|
131
|
+
onClick: onChangePassword,
|
|
132
|
+
href: "/bridge/userCenter?currentTab=2"
|
|
133
|
+
}, "\u4FEE\u6539\u5BC6\u7801"), React.createElement(_divider["default"], {
|
|
134
|
+
type: "vertical"
|
|
135
|
+
}), React.createElement("a", {
|
|
136
|
+
className: "user-info-footer-signout",
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
if (onLogout) {
|
|
139
|
+
onLogout();
|
|
140
|
+
(0, _deleteAllCookies["default"])(window)();
|
|
141
|
+
} else {
|
|
142
|
+
(0, _deleteAllCookies["default"])(window)();
|
|
143
|
+
window.location.href = "/user/login?callbackUrl=".concat(window.encodeURI(location.href));
|
|
144
|
+
}
|
|
81
145
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const UserInfoContent = props => {
|
|
85
|
-
const { userInfo, config={}, onLogout, onChangePassword = () => true, onPersonalSetting = () => true, onLanguageChange, onThemeChange } = props;
|
|
86
|
-
const {
|
|
87
|
-
language = true,
|
|
88
|
-
} = config || {};
|
|
89
|
-
return (
|
|
90
|
-
<UserInfoWrapper className="user-info-setting-wrap">
|
|
91
|
-
<ul className="user-info-body">
|
|
92
|
-
<li className="user-info-body-username">
|
|
93
|
-
{userInfo.userName || '暂无昵称'}
|
|
94
|
-
<span className="user-info-body-account">{userInfo.account}</span>
|
|
95
|
-
</li>
|
|
96
|
-
{
|
|
97
|
-
language &&
|
|
98
|
-
<Language
|
|
99
|
-
language={userInfo.lang}
|
|
100
|
-
onChange={onLanguageChange}
|
|
101
|
-
/>
|
|
102
|
-
}
|
|
103
|
-
<Theme
|
|
104
|
-
theme={userInfo.theme}
|
|
105
|
-
onChange={onThemeChange}
|
|
106
|
-
/>
|
|
107
|
-
</ul>
|
|
108
|
-
<Row className="user-info-footer" type="flex" justify="space-between" align="middle">
|
|
109
|
-
<a onClick={onPersonalSetting} href="/bridge/userCenter?currentTab=1">个人设置</a>
|
|
110
|
-
<Divider type="vertical"/>
|
|
111
|
-
<a onClick={onChangePassword} href="/bridge/userCenter?currentTab=2">修改密码</a>
|
|
112
|
-
<Divider type="vertical"/>
|
|
113
|
-
<a
|
|
114
|
-
className="user-info-footer-signout"
|
|
115
|
-
onClick={() => {
|
|
116
|
-
if (onLogout) {
|
|
117
|
-
onLogout();
|
|
118
|
-
deleteAllCookiesFactory(window)();
|
|
119
|
-
} else {
|
|
120
|
-
deleteAllCookiesFactory(window)();
|
|
121
|
-
window.location.href = `/user/login?callbackUrl=${window.encodeURI(location.href)}`;
|
|
122
|
-
}
|
|
123
|
-
}}
|
|
124
|
-
>退出登录</a>
|
|
125
|
-
</Row>
|
|
126
|
-
</UserInfoWrapper>
|
|
127
|
-
);
|
|
146
|
+
}, "\u9000\u51FA\u767B\u5F55")));
|
|
128
147
|
};
|
|
129
148
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/>
|
|
154
|
-
) : (
|
|
155
|
-
<img src={images.empty?.default || images.empty} />
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
</Popover>
|
|
159
|
-
<GlobalStyle />
|
|
160
|
-
</Avatar>
|
|
161
|
-
);
|
|
149
|
+
var _default = function _default(props) {
|
|
150
|
+
var _images$empty2;
|
|
151
|
+
|
|
152
|
+
var _props$userInfo = props.userInfo,
|
|
153
|
+
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo;
|
|
154
|
+
var avatar = userInfo.avatar;
|
|
155
|
+
return React.createElement(Avatar, null, React.createElement(_popover["default"], {
|
|
156
|
+
popupClassName: "tnt-layout-personal-popover",
|
|
157
|
+
placement: "bottomRight",
|
|
158
|
+
title: null,
|
|
159
|
+
content: React.createElement(UserInfoContent, props),
|
|
160
|
+
trigger: "click"
|
|
161
|
+
}, avatar ? React.createElement("img", {
|
|
162
|
+
src: avatar.indexOf('base64') > 0 ? avatar : (0, _lodash.get)(_images["default"][avatar], 'default', _images["default"][avatar]),
|
|
163
|
+
onError: function onError(e) {
|
|
164
|
+
var _images$empty;
|
|
165
|
+
|
|
166
|
+
e.target.onerror = null;
|
|
167
|
+
e.target.src = ((_images$empty = _images["default"].empty) == null ? void 0 : _images$empty["default"]) || _images["default"].empty;
|
|
168
|
+
}
|
|
169
|
+
}) : React.createElement("img", {
|
|
170
|
+
src: ((_images$empty2 = _images["default"].empty) == null ? void 0 : _images$empty2["default"]) || _images["default"].empty
|
|
171
|
+
})), React.createElement(GlobalStyle, null));
|
|
162
172
|
};
|
|
173
|
+
|
|
174
|
+
exports["default"] = _default;
|
|
@@ -1,80 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
|
|
16
|
+
var _Iconfont = _interopRequireDefault(require("../Iconfont"));
|
|
17
|
+
|
|
18
|
+
var _storage = require("../storage");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
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
|
+
|
|
46
|
+
var languages = [{
|
|
47
|
+
value: 'cn',
|
|
48
|
+
name: '中文'
|
|
49
|
+
}, {
|
|
50
|
+
value: 'en',
|
|
51
|
+
name: 'EN '
|
|
52
|
+
}];
|
|
53
|
+
var languagesMap = languages.reduce(function (acc, cur) {
|
|
54
|
+
acc[cur.value] = cur;
|
|
55
|
+
return acc;
|
|
14
56
|
}, {});
|
|
15
57
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
margin-top: 8px;
|
|
30
|
-
|
|
31
|
-
.tnt-icon {
|
|
32
|
-
font-size: ${({ theme: { size } }) => size === 'large' ? '24px' : '20px'};
|
|
33
|
-
margin-right: 4px;
|
|
34
|
-
}
|
|
58
|
+
var Language = _styledComponents["default"].li(_templateObject(), function (_ref) {
|
|
59
|
+
var size = _ref.theme.size;
|
|
60
|
+
return size === 'large' ? '14px' : '12px';
|
|
61
|
+
}, function (_ref2) {
|
|
62
|
+
var size = _ref2.theme.size;
|
|
63
|
+
return size === 'large' ? '24px' : '20px';
|
|
64
|
+
}, function (_ref3) {
|
|
65
|
+
var size = _ref3.theme.size;
|
|
66
|
+
return size === 'large' ? '14px' : '12px';
|
|
67
|
+
}, function (_ref4) {
|
|
68
|
+
var size = _ref4.theme.size;
|
|
69
|
+
return size === 'large' ? '-3px' : '-2px';
|
|
70
|
+
});
|
|
35
71
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
font-size: ${({ theme: { size } }) => size === 'large' ? '14px' : '12px'};
|
|
39
|
-
top: ${({ theme: { size } }) => size === 'large' ? '-3px' : '-2px'};
|
|
40
|
-
font-family: auto;
|
|
41
|
-
}
|
|
72
|
+
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
73
|
+
var onChange = props.onChange;
|
|
42
74
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export default withTheme(
|
|
49
|
-
props => {
|
|
50
|
-
const {
|
|
51
|
-
onChange
|
|
52
|
-
} = props;
|
|
53
|
-
const getLanguage = () => {
|
|
54
|
-
let lang = getLanguageStore() || props.language;
|
|
55
|
-
|
|
56
|
-
if (!languagesMap[lang]) {
|
|
57
|
-
lang = get(languages, '0.value');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return lang;
|
|
61
|
-
};
|
|
62
|
-
const [language = 'cn', setLanguage] = useState(getLanguage());
|
|
63
|
-
const switchLanguage = () => {
|
|
64
|
-
const lang = language === 'cn' ? 'en' : 'cn';
|
|
65
|
-
|
|
66
|
-
setLanguage(lang);
|
|
67
|
-
setLanguageStore(lang);
|
|
68
|
-
onChange && onChange(lang);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<Language onClick={switchLanguage}>
|
|
73
|
-
<Iconfont type={`flag-${language}`} />
|
|
74
|
-
<span>
|
|
75
|
-
{get(languagesMap[language], 'name')}
|
|
76
|
-
</span>
|
|
77
|
-
</Language>
|
|
78
|
-
);
|
|
75
|
+
var getLanguage = function getLanguage() {
|
|
76
|
+
var lang = (0, _storage.getLanguageStore)() || props.language;
|
|
77
|
+
|
|
78
|
+
if (!languagesMap[lang]) {
|
|
79
|
+
lang = (0, _lodash.get)(languages, '0.value');
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
|
|
82
|
+
return lang;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var _useState = (0, _react.useState)(getLanguage()),
|
|
86
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
87
|
+
_useState2$ = _useState2[0],
|
|
88
|
+
language = _useState2$ === void 0 ? 'cn' : _useState2$,
|
|
89
|
+
setLanguage = _useState2[1];
|
|
90
|
+
|
|
91
|
+
var switchLanguage = function switchLanguage() {
|
|
92
|
+
var lang = language === 'cn' ? 'en' : 'cn';
|
|
93
|
+
setLanguage(lang);
|
|
94
|
+
(0, _storage.setLanguageStore)(lang);
|
|
95
|
+
onChange && onChange(lang);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return React.createElement(Language, {
|
|
99
|
+
onClick: switchLanguage
|
|
100
|
+
}, React.createElement(_Iconfont["default"], {
|
|
101
|
+
type: "flag-".concat(language)
|
|
102
|
+
}), React.createElement("span", null, (0, _lodash.get)(languagesMap[language], 'name')));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
exports["default"] = _default;
|