tntd 1.3.57 → 1.3.62
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/Application.js +1 -1
- package/components/QueryForm/Field/index.js +2 -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 +158 -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 +1 -1
|
@@ -1,174 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
import { Divider } from 'antd';
|
|
3
|
-
import GlobalNavigation from './GlobalNavigation';
|
|
4
|
-
import Language from './Language';
|
|
5
|
-
import Theme from './Theme';
|
|
6
|
-
import LanguageTheme from './CompatibleLanguage';
|
|
7
|
-
import Application from './Application';
|
|
8
|
-
import Avatar from './Avatar';
|
|
9
|
-
|
|
10
|
-
const Actions = styled.ul`
|
|
11
|
-
list-style: none;
|
|
12
|
-
display: inline-block;
|
|
13
|
-
line-height: ${props => `${props.theme.headerHeight}px`};
|
|
14
|
-
margin: 0 0 0 20px;
|
|
15
|
-
.hasHeaderTabs & {
|
|
16
|
-
margin: 0;
|
|
17
|
-
}
|
|
18
|
-
padding: 0;
|
|
19
|
-
white-space: nowrap;
|
|
1
|
+
"use strict";
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
require("antd/es/divider/style");
|
|
11
|
+
|
|
12
|
+
var _divider = _interopRequireDefault(require("antd/es/divider"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _GlobalNavigation = _interopRequireDefault(require("./GlobalNavigation"));
|
|
17
|
+
|
|
18
|
+
var _Language = _interopRequireDefault(require("./Language"));
|
|
19
|
+
|
|
20
|
+
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
21
|
+
|
|
22
|
+
var _CompatibleLanguage = _interopRequireDefault(require("./CompatibleLanguage"));
|
|
23
|
+
|
|
24
|
+
var _Application = _interopRequireDefault(require("./Application"));
|
|
25
|
+
|
|
26
|
+
var _Avatar = _interopRequireDefault(require("./Avatar"));
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
margin: 0 10px;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
33
|
+
|
|
34
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
|
+
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
+
|
|
38
|
+
function _templateObject() {
|
|
39
|
+
var data = _taggedTemplateLiteral(["\n list-style: none;\n display: inline-block;\n line-height: ", ";\n margin: 0 0 0 20px;\n .hasHeaderTabs & {\n margin: 0;\n }\n padding: 0;\n white-space: nowrap;\n\n .isInIframe & {\n display: none;\n }\n\n & > li {\n height: 100%;\n display: inline-block;\n vertical-align: top;\n cursor: pointer;\n font-size: 20px;\n margin: 0 7.5px;\n color: ", ";\n .large-size & {\n margin: 0 10px;\n }\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n &:last-of-type {\n margin-right: 0;\n }\n .hasHeaderTabs &{\n color: #455064;\n }\n // \u5220\u9664\u8272\u7CFB\u533A\u5206 \u7EDF\u4E00\u8272\u8C03\n // .hasHeaderTabs:not(.tnt-themeS1) & {\n // color: rgba(255,255,255,.8);\n // }\n .hasHeaderTabs:not(.tnt-themeS1) & {\n color: #455064 !important;\n }\n }\n"]);
|
|
40
|
+
|
|
41
|
+
_templateObject = function _templateObject() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
49
|
+
|
|
50
|
+
var Actions = _styledComponents["default"].ul(_templateObject(), function (props) {
|
|
51
|
+
return "".concat(props.theme.headerHeight, "px");
|
|
52
|
+
}, function (props) {
|
|
53
|
+
return "".concat(props.theme.headerActionsColor);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var _default = (0, _styledComponents.withTheme)(function (props) {
|
|
57
|
+
var _props$config = props.config;
|
|
58
|
+
_props$config = _props$config === void 0 ? {} : _props$config;
|
|
59
|
+
|
|
60
|
+
var _props$config$theme = _props$config.theme,
|
|
61
|
+
theme = _props$config$theme === void 0 ? true : _props$config$theme,
|
|
62
|
+
_props$config$avatar = _props$config.avatar,
|
|
63
|
+
avatar = _props$config$avatar === void 0 ? true : _props$config$avatar,
|
|
64
|
+
_props$config$languag = _props$config.language,
|
|
65
|
+
language = _props$config$languag === void 0 ? true : _props$config$languag,
|
|
66
|
+
_props$config$applica = _props$config.application,
|
|
67
|
+
application = _props$config$applica === void 0 ? false : _props$config$applica,
|
|
68
|
+
_props$config$globalN = _props$config.globalNavigation,
|
|
69
|
+
globalNavigation = _props$config$globalN === void 0 ? false : _props$config$globalN,
|
|
70
|
+
compatible = props.theme.compatible,
|
|
71
|
+
_props$userInfo = props.userInfo,
|
|
72
|
+
userInfo = _props$userInfo === void 0 ? {} : _props$userInfo,
|
|
73
|
+
menus = props.menus,
|
|
74
|
+
apps = props.apps,
|
|
75
|
+
extraActions = props.extraActions,
|
|
76
|
+
headerRef = props.headerRef,
|
|
77
|
+
onLanguageChange = props.onLanguageChange,
|
|
78
|
+
onThemeChange = props.onThemeChange,
|
|
79
|
+
onApplicationChange = props.onApplicationChange,
|
|
80
|
+
onAppChange = props.onAppChange,
|
|
81
|
+
onCollapseChange = props.onCollapseChange,
|
|
82
|
+
onPersonalSetting = props.onPersonalSetting,
|
|
83
|
+
onChangePassword = props.onChangePassword,
|
|
84
|
+
onLogout = props.onLogout,
|
|
85
|
+
onLogoClick = props.onLogoClick,
|
|
86
|
+
AvatarCustom = props.AvatarCustom,
|
|
87
|
+
rest = _objectWithoutProperties(props, ["config", "theme", "userInfo", "menus", "apps", "extraActions", "headerRef", "onLanguageChange", "onThemeChange", "onApplicationChange", "onAppChange", "onCollapseChange", "onPersonalSetting", "onChangePassword", "onLogout", "onLogoClick", "AvatarCustom"]);
|
|
88
|
+
|
|
89
|
+
return React.createElement(Actions, rest, extraActions, globalNavigation && React.createElement(_GlobalNavigation["default"], {
|
|
90
|
+
headerRef: headerRef,
|
|
91
|
+
menus: menus
|
|
92
|
+
}), !AvatarCustom && (!compatible ? React.createElement(React.Fragment, null, language && React.createElement(_Language["default"], {
|
|
93
|
+
language: userInfo.lang,
|
|
94
|
+
onChange: onLanguageChange
|
|
95
|
+
}), theme && React.createElement(_Theme["default"], {
|
|
96
|
+
theme: userInfo.theme,
|
|
97
|
+
onChange: onThemeChange
|
|
98
|
+
})) : React.createElement(_CompatibleLanguage["default"], {
|
|
99
|
+
config: props.config,
|
|
100
|
+
language: userInfo.lang,
|
|
101
|
+
theme: userInfo.theme,
|
|
102
|
+
onLanguageChange: onLanguageChange,
|
|
103
|
+
onThemeChange: onThemeChange
|
|
104
|
+
})), application && React.createElement(_Application["default"], {
|
|
105
|
+
language: userInfo.lang,
|
|
106
|
+
apps: apps,
|
|
107
|
+
onChange: onApplicationChange
|
|
108
|
+
}), avatar && React.createElement(React.Fragment, null, React.createElement(_divider["default"], {
|
|
109
|
+
type: "vertical"
|
|
110
|
+
}), AvatarCustom ? React.createElement(AvatarCustom, {
|
|
111
|
+
userInfo: userInfo,
|
|
112
|
+
onPersonalSetting: onPersonalSetting,
|
|
113
|
+
onChangePassword: onChangePassword,
|
|
114
|
+
onLogout: onLogout,
|
|
115
|
+
onThemeChange: onThemeChange,
|
|
116
|
+
config: {
|
|
117
|
+
theme: theme,
|
|
118
|
+
language: language
|
|
52
119
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
application = false,
|
|
63
|
-
globalNavigation = false
|
|
64
|
-
} = {},
|
|
65
|
-
theme: {
|
|
66
|
-
compatible
|
|
67
|
-
},
|
|
68
|
-
userInfo = {},
|
|
69
|
-
menus,
|
|
70
|
-
apps,
|
|
71
|
-
extraActions,
|
|
72
|
-
headerRef,
|
|
73
|
-
onLanguageChange,
|
|
74
|
-
onThemeChange,
|
|
75
|
-
onApplicationChange,
|
|
76
|
-
onAppChange,
|
|
77
|
-
onCollapseChange,
|
|
78
|
-
onPersonalSetting,
|
|
79
|
-
onChangePassword,
|
|
80
|
-
onLogout,
|
|
81
|
-
onLogoClick,
|
|
82
|
-
AvatarCustom,
|
|
83
|
-
...rest
|
|
84
|
-
} = props;
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<Actions {...rest}>
|
|
88
|
-
{extraActions}
|
|
89
|
-
{
|
|
90
|
-
globalNavigation && (
|
|
91
|
-
<GlobalNavigation
|
|
92
|
-
headerRef={headerRef}
|
|
93
|
-
menus={menus}
|
|
94
|
-
/>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
{
|
|
98
|
-
!AvatarCustom &&
|
|
99
|
-
(
|
|
100
|
-
!compatible ? (
|
|
101
|
-
<>
|
|
102
|
-
{
|
|
103
|
-
language && (
|
|
104
|
-
<Language
|
|
105
|
-
language={userInfo.lang}
|
|
106
|
-
onChange={onLanguageChange}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
{
|
|
111
|
-
theme && (
|
|
112
|
-
<Theme
|
|
113
|
-
theme={userInfo.theme}
|
|
114
|
-
onChange={onThemeChange}
|
|
115
|
-
/>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
</>
|
|
119
|
-
) : (
|
|
120
|
-
<LanguageTheme
|
|
121
|
-
config={props.config}
|
|
122
|
-
language={userInfo.lang}
|
|
123
|
-
theme={userInfo.theme}
|
|
124
|
-
onLanguageChange={onLanguageChange}
|
|
125
|
-
onThemeChange={onThemeChange}
|
|
126
|
-
/>
|
|
127
|
-
)
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
{
|
|
131
|
-
application && (
|
|
132
|
-
<Application
|
|
133
|
-
language={userInfo.lang}
|
|
134
|
-
apps={apps}
|
|
135
|
-
onChange={onApplicationChange}
|
|
136
|
-
/>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
{
|
|
140
|
-
avatar && (
|
|
141
|
-
<>
|
|
142
|
-
<Divider type="vertical" />
|
|
143
|
-
{
|
|
144
|
-
AvatarCustom ?
|
|
145
|
-
<AvatarCustom
|
|
146
|
-
userInfo={userInfo}
|
|
147
|
-
onPersonalSetting={onPersonalSetting}
|
|
148
|
-
onChangePassword={onChangePassword}
|
|
149
|
-
onLogout={onLogout}
|
|
150
|
-
onThemeChange={onThemeChange}
|
|
151
|
-
config={{
|
|
152
|
-
theme,
|
|
153
|
-
language
|
|
154
|
-
}}
|
|
155
|
-
/> :
|
|
156
|
-
<Avatar
|
|
157
|
-
userInfo={userInfo}
|
|
158
|
-
onPersonalSetting={onPersonalSetting}
|
|
159
|
-
onChangePassword={onChangePassword}
|
|
160
|
-
onLogout={onLogout}
|
|
161
|
-
onThemeChange={onThemeChange}
|
|
162
|
-
config={{
|
|
163
|
-
theme,
|
|
164
|
-
language
|
|
165
|
-
}}
|
|
166
|
-
/>
|
|
167
|
-
}
|
|
168
|
-
</>
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
</Actions>
|
|
172
|
-
);
|
|
120
|
+
}) : React.createElement(_Avatar["default"], {
|
|
121
|
+
userInfo: userInfo,
|
|
122
|
+
onPersonalSetting: onPersonalSetting,
|
|
123
|
+
onChangePassword: onChangePassword,
|
|
124
|
+
onLogout: onLogout,
|
|
125
|
+
onThemeChange: onThemeChange,
|
|
126
|
+
config: {
|
|
127
|
+
theme: theme,
|
|
128
|
+
language: language
|
|
173
129
|
}
|
|
174
|
-
);
|
|
130
|
+
})));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
exports["default"] = _default;
|
package/lib/Layout/HeaderNavs.js
CHANGED
|
@@ -1,93 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
import styled, { withTheme } from 'styled-components';
|
|
3
|
-
import cn from 'classnames';
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
|
-
const Navs = styled.ul`
|
|
7
|
-
margin: 0;
|
|
8
|
-
padding: 0;
|
|
9
|
-
list-style: none;
|
|
10
|
-
text-align: right;
|
|
11
|
-
`;
|
|
12
|
-
const NavItem = styled.li`
|
|
13
|
-
position: relative;
|
|
14
|
-
margin: 0;
|
|
15
|
-
padding: 0 20px;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
display: inline-block;
|
|
18
|
-
line-height: ${props => props.theme.size === 'large' ? '60px' : '50px'};
|
|
19
|
-
transition: background-color .5;
|
|
20
|
-
|
|
21
|
-
a {
|
|
22
|
-
font-size: 14px;
|
|
23
|
-
color: ${props => props.theme.secondaryTextColor};
|
|
24
|
-
text-rendering: optimizeLegibility;
|
|
25
|
-
-webkit-font-smoothing: antialiased;
|
|
26
|
-
-moz-osx-font-smoothing: grayscale;
|
|
27
|
-
.tnt-themeS1 & {
|
|
28
|
-
color: rgba(255,255,255,.8);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
"use strict";
|
|
31
2
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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"] = exports.HeaderNavs = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
25
|
+
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
32
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
33
|
+
|
|
34
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
|
+
|
|
36
|
+
function _templateObject2() {
|
|
37
|
+
var data = _taggedTemplateLiteral(["\n position: relative;\n margin: 0;\n padding: 0 20px;\n cursor: pointer;\n display: inline-block;\n line-height: ", ";\n transition: background-color .5;\n\n a {\n font-size: 14px;\n color: ", ";\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n .tnt-themeS1 & {\n color: rgba(255,255,255,.8);\n }\n }\n\n &:hover, &.active {\n a {\n color: ", ";\n .tnt-themeS1 & {\n color: #418AFF;\n }\n }\n }\n &.active {\n &:after {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 3px;\n background: ", ";\n display: inline-block;\n content: \"\";\n .tnt-themeS1 & {\n background: #418AFF;\n }\n }\n }\n"]);
|
|
38
|
+
|
|
39
|
+
_templateObject2 = function _templateObject2() {
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _templateObject() {
|
|
47
|
+
var data = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n list-style: none;\n text-align: right;\n"]);
|
|
48
|
+
|
|
49
|
+
_templateObject = function _templateObject() {
|
|
50
|
+
return data;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
57
|
+
|
|
58
|
+
var Navs = _styledComponents["default"].ul(_templateObject());
|
|
59
|
+
|
|
60
|
+
var NavItem = _styledComponents["default"].li(_templateObject2(), function (props) {
|
|
61
|
+
return props.theme.size === 'large' ? '60px' : '50px';
|
|
62
|
+
}, function (props) {
|
|
63
|
+
return props.theme.secondaryTextColor;
|
|
64
|
+
}, function (props) {
|
|
65
|
+
return props.theme.primaryColor;
|
|
66
|
+
}, function (props) {
|
|
67
|
+
return props.theme.primaryColor;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var HeaderNavs = (0, _styledComponents.withTheme)(function (_ref) {
|
|
71
|
+
var theme = _ref.theme,
|
|
72
|
+
_ref$navs = _ref.navs,
|
|
73
|
+
navs = _ref$navs === void 0 ? [] : _ref$navs,
|
|
74
|
+
onChange = _ref.onChange,
|
|
75
|
+
onSelect = _ref.onSelect,
|
|
76
|
+
props = _objectWithoutProperties(_ref, ["theme", "navs", "onChange", "onSelect"]);
|
|
77
|
+
|
|
78
|
+
var _useState = (0, _react.useState)(props.selectedKey || (0, _lodash.get)(navs, '0.key')),
|
|
79
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
80
|
+
selectedKey = _useState2[0],
|
|
81
|
+
setSelectedKey = _useState2[1];
|
|
82
|
+
|
|
83
|
+
var onClickNav = function onClickNav(nav) {
|
|
84
|
+
setSelectedKey(nav.key);
|
|
85
|
+
onSelect && onSelect(nav);
|
|
86
|
+
|
|
87
|
+
if (selectedKey !== nav.key) {
|
|
88
|
+
onChange && onChange(nav);
|
|
89
|
+
setSelectedKey(nav.key);
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
};
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
(0, _react.useEffect)(function () {
|
|
94
|
+
setSelectedKey(props.selectedKey || (0, _lodash.get)(navs, '0.key'));
|
|
95
|
+
}, [navs, props.selectedKey]);
|
|
96
|
+
return React.createElement(Navs, props, navs.map(function (nav) {
|
|
97
|
+
return React.createElement(NavItem, {
|
|
98
|
+
key: nav.key,
|
|
99
|
+
theme: theme,
|
|
100
|
+
className: (0, _classnames["default"])({
|
|
101
|
+
active: selectedKey === nav.key
|
|
102
|
+
}),
|
|
103
|
+
onClick: function onClick() {
|
|
104
|
+
return onClickNav(nav);
|
|
105
|
+
}
|
|
106
|
+
}, React.createElement("a", {
|
|
107
|
+
href: nav.key,
|
|
108
|
+
onClick: function onClick(evt) {
|
|
109
|
+
return evt.preventDefault();
|
|
110
|
+
}
|
|
111
|
+
}, nav.name));
|
|
112
|
+
}));
|
|
113
|
+
});
|
|
114
|
+
exports.HeaderNavs = HeaderNavs;
|
|
115
|
+
var _default = HeaderNavs;
|
|
116
|
+
exports["default"] = _default;
|