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.
Files changed (171) hide show
  1. package/components/Ellipsis/index.js +1 -1
  2. package/components/Layout/Avatar.js +4 -4
  3. package/components/Layout/EnterpriseLayout/Avatar.js +10 -7
  4. package/components/Layout/EnterpriseLayout/Language.js +5 -3
  5. package/components/Layout/EnterpriseLayout/Theme.js +6 -7
  6. package/components/Layout/EnterpriseLayout/index.js +1 -1
  7. package/components/Layout/HeaderActions.js +13 -10
  8. package/components/Layout/HeaderTabs.js +13 -14
  9. package/components/Layout/Layout.js +2 -0
  10. package/components/Layout/index.js +2 -1
  11. package/components/Layout/storage.js +12 -2
  12. package/components/Page/index.js +2 -2
  13. package/components/locale.js +7 -2
  14. package/dist/1.tntd.js +1 -12
  15. package/dist/stats.json +28426 -28000
  16. package/dist/tntd.css +1 -1
  17. package/dist/tntd.js +13 -7
  18. package/es/ArrayInput/icon.js +5 -5
  19. package/es/ArrayInput/index.js +76 -108
  20. package/es/AuthContext.js +1 -1
  21. package/es/Columns/index.js +31 -38
  22. package/es/DevelopmentLogin/LoginModal.js +32 -45
  23. package/es/DevelopmentLogin/index.js +13 -17
  24. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  25. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  26. package/es/Ellipsis/index.js +59 -70
  27. package/es/Handle/index.js +25 -35
  28. package/es/Icon/fonts/iconfont.js +7 -12
  29. package/es/Icon/index.js +10 -13
  30. package/es/Img/Contain.js +24 -29
  31. package/es/Img/Cover.js +40 -54
  32. package/es/Img/index.js +36 -45
  33. package/es/Layout/ActionsContext.js +3 -2
  34. package/es/Layout/AppList.js +37 -92
  35. package/es/Layout/Application.js +26 -72
  36. package/es/Layout/Avatar.js +32 -69
  37. package/es/Layout/CompatibleLanguage.js +39 -94
  38. package/es/Layout/EnterpriseLayout/Avatar.js +49 -79
  39. package/es/Layout/EnterpriseLayout/Language.js +19 -34
  40. package/es/Layout/EnterpriseLayout/Theme.js +23 -37
  41. package/es/Layout/EnterpriseLayout/index.js +14 -16
  42. package/es/Layout/GlobalNavigation/NavigationPopup.js +59 -170
  43. package/es/Layout/GlobalNavigation/index.js +20 -54
  44. package/es/Layout/Header.js +25 -46
  45. package/es/Layout/HeaderActions.js +52 -63
  46. package/es/Layout/HeaderNavs.js +20 -47
  47. package/es/Layout/HeaderTabs.js +61 -115
  48. package/es/Layout/Iconfont.js +1 -1
  49. package/es/Layout/Language.js +14 -32
  50. package/es/Layout/Layout.js +88 -108
  51. package/es/Layout/Logo.js +16 -32
  52. package/es/Layout/OrgAppList.js +62 -107
  53. package/es/Layout/SideMenu.js +63 -124
  54. package/es/Layout/Theme.js +23 -61
  55. package/es/Layout/index.js +29 -36
  56. package/es/Layout/paaslayout/CompactSideMenu.js +35 -74
  57. package/es/Layout/paaslayout/Header.js +22 -45
  58. package/es/Layout/paaslayout/Logo.js +3 -13
  59. package/es/Layout/paaslayout/SideMenu.js +39 -78
  60. package/es/Layout/paaslayout/index.js +75 -102
  61. package/es/Layout/storage.js +26 -9
  62. package/es/LoadingButton/index.js +15 -24
  63. package/es/Modal/index.js +38 -46
  64. package/es/Page/Box.js +34 -41
  65. package/es/Page/index.js +54 -68
  66. package/es/Page/utils.js +0 -5
  67. package/es/QueryForm/Field/Checkbox.js +5 -9
  68. package/es/QueryForm/Field/Select.js +31 -41
  69. package/es/QueryForm/Field/SelectInput.js +26 -41
  70. package/es/QueryForm/Field/fieldsMap.js +0 -1
  71. package/es/QueryForm/Field/index.js +41 -71
  72. package/es/QueryForm/createActions.js +6 -7
  73. package/es/QueryForm/index.js +76 -135
  74. package/es/QueryListScene/List.js +74 -128
  75. package/es/QueryListScene/QueryForm.js +46 -81
  76. package/es/QueryListScene/QueryListScene.js +25 -40
  77. package/es/QueryListScene/Title.js +3 -3
  78. package/es/QueryListScene/Toolbar.js +11 -12
  79. package/es/Select/DropDownWrap.js +29 -50
  80. package/es/Select/index.js +135 -231
  81. package/es/Table/ResizableTable/index.js +26 -40
  82. package/es/Table/index.js +18 -16
  83. package/es/Title/index.js +21 -23
  84. package/es/locale.js +9 -7
  85. package/es/utils/checkAuth.js +3 -5
  86. package/es/utils/findMenuInfoByPath.js +0 -4
  87. package/es/utils/index.js +12 -23
  88. package/lib/ArrayInput/icon.js +6 -6
  89. package/lib/ArrayInput/index.js +78 -127
  90. package/lib/AuthContext.js +1 -4
  91. package/lib/Columns/index.js +31 -47
  92. package/lib/DevelopmentLogin/LoginModal.js +32 -58
  93. package/lib/DevelopmentLogin/index.js +16 -27
  94. package/lib/Ellipsis/Svg/CopySVG.js +13 -15
  95. package/lib/Ellipsis/Svg/TickSVG.js +8 -10
  96. package/lib/Ellipsis/index.js +58 -81
  97. package/lib/Handle/index.js +25 -47
  98. package/lib/Icon/fonts/iconfont.js +7 -12
  99. package/lib/Icon/index.js +11 -20
  100. package/lib/Img/Contain.js +24 -34
  101. package/lib/Img/Cover.js +42 -65
  102. package/lib/Img/index.js +36 -51
  103. package/lib/Layout/ActionsContext.js +1 -4
  104. package/lib/Layout/AppList.js +40 -118
  105. package/lib/Layout/Application.js +26 -86
  106. package/lib/Layout/Avatar.js +35 -89
  107. package/lib/Layout/CompatibleLanguage.js +39 -110
  108. package/lib/Layout/EnterpriseLayout/Avatar.js +52 -101
  109. package/lib/Layout/EnterpriseLayout/Language.js +21 -49
  110. package/lib/Layout/EnterpriseLayout/Theme.js +22 -46
  111. package/lib/Layout/EnterpriseLayout/index.js +14 -23
  112. package/lib/Layout/GlobalNavigation/NavigationPopup.js +59 -186
  113. package/lib/Layout/GlobalNavigation/index.js +23 -74
  114. package/lib/Layout/Header.js +28 -63
  115. package/lib/Layout/HeaderActions.js +48 -74
  116. package/lib/Layout/HeaderNavs.js +23 -61
  117. package/lib/Layout/HeaderTabs.js +58 -126
  118. package/lib/Layout/Iconfont.js +1 -5
  119. package/lib/Layout/Language.js +17 -48
  120. package/lib/Layout/Layout.js +90 -128
  121. package/lib/Layout/Logo.js +19 -43
  122. package/lib/Layout/OrgAppList.js +64 -127
  123. package/lib/Layout/SideMenu.js +65 -143
  124. package/lib/Layout/Theme.js +23 -73
  125. package/lib/Layout/createActions.js +0 -5
  126. package/lib/Layout/images/index.js +0 -28
  127. package/lib/Layout/index.js +33 -57
  128. package/lib/Layout/paaslayout/CompactSideMenu.js +35 -84
  129. package/lib/Layout/paaslayout/Header.js +22 -55
  130. package/lib/Layout/paaslayout/Logo.js +3 -19
  131. package/lib/Layout/paaslayout/SideMenu.js +39 -87
  132. package/lib/Layout/paaslayout/index.js +77 -122
  133. package/lib/Layout/storage.js +29 -35
  134. package/lib/LoadingButton/index.js +15 -29
  135. package/lib/Modal/index.js +38 -53
  136. package/lib/Page/Box.js +34 -45
  137. package/lib/Page/index.js +54 -78
  138. package/lib/Page/utils.js +1 -9
  139. package/lib/QueryForm/Field/Checkbox.js +5 -13
  140. package/lib/QueryForm/Field/Select.js +33 -53
  141. package/lib/QueryForm/Field/SelectInput.js +28 -56
  142. package/lib/QueryForm/Field/fieldsMap.js +1 -15
  143. package/lib/QueryForm/Field/index.js +43 -81
  144. package/lib/QueryForm/createActions.js +6 -12
  145. package/lib/QueryForm/index.js +78 -157
  146. package/lib/QueryForm/useForm.js +0 -5
  147. package/lib/QueryListScene/List.js +76 -140
  148. package/lib/QueryListScene/QueryForm.js +46 -86
  149. package/lib/QueryListScene/QueryListScene.js +25 -46
  150. package/lib/QueryListScene/Title.js +3 -7
  151. package/lib/QueryListScene/Toolbar.js +11 -16
  152. package/lib/QueryListScene/createActions.js +0 -5
  153. package/lib/QueryListScene/index.js +0 -10
  154. package/lib/QueryListScene/useActions.js +0 -5
  155. package/lib/Select/DropDownWrap.js +31 -56
  156. package/lib/Select/index.js +135 -241
  157. package/lib/Table/ResizableTable/index.js +26 -48
  158. package/lib/Table/index.js +17 -28
  159. package/lib/Title/index.js +21 -28
  160. package/lib/index.js +35 -56
  161. package/lib/locale.js +11 -12
  162. package/lib/utils/checkAuth.js +4 -9
  163. package/lib/utils/findMenuInfoByPath.js +1 -8
  164. package/lib/utils/index.js +15 -42
  165. package/package.json +2 -2
  166. package/es/Layout/checkAuth.js +0 -29
  167. package/es/Layout/utils.js +0 -136
  168. package/lib/Layout/EnterpriseLayout/Header.js +0 -113
  169. package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
  170. package/lib/Layout/checkAuth.js +0 -39
  171. package/lib/Layout/utils.js +0 -166
@@ -17,7 +17,7 @@ const isEllipsisActive = (e) => {
17
17
  if(e.offsetWidth === e.scrollWidth && e.offsetHeight === e.scrollHeight){
18
18
  let styleStr = 'overflow:visible; ';
19
19
  if(!e?.parentNode?.getAttribute('style')?.includes('width')){
20
- styleStr+='maxWidth:100%;';
20
+ styleStr+='max-width:100%;';
21
21
  }
22
22
  e.parentNode.setAttribute('style',styleStr);
23
23
  }
@@ -1,10 +1,10 @@
1
1
  import { useContext } from 'react';
2
2
  import styled, { createGlobalStyle } from 'styled-components';
3
3
  import { Popover, Button } from 'antd';
4
- import deleteAllCookiesFactory from 'delete-all-cookies';
5
4
  import { get } from 'lodash';
6
5
  import images from './images';
7
6
  import ActionsContext from './ActionsContext';
7
+ import { clearLoginCookie } from './storage';
8
8
 
9
9
  const Avatar = styled.li`
10
10
  margin-right: 0;
@@ -81,7 +81,7 @@ const UserInfoContent = props => {
81
81
  <UserInfoWrapper className="user-info-setting-wrap">
82
82
  <div className="user-info-body">
83
83
  <p className="user-info-body-username">
84
- {userInfo.userName || '暂无昵称'}
84
+ {userInfo.userName || getText('nameNull')}
85
85
  </p>
86
86
  <p className="user-info-body-account">
87
87
  {userInfo.account}
@@ -95,9 +95,9 @@ const UserInfoContent = props => {
95
95
  onClick={() => {
96
96
  if (onLogout) {
97
97
  onLogout();
98
- deleteAllCookiesFactory(window)();
98
+ clearLoginCookie();
99
99
  } else {
100
- deleteAllCookiesFactory(window)();
100
+ clearLoginCookie();
101
101
  window.location.href = `/user/login?callbackUrl=${window.encodeURI(location.href)}`;
102
102
  }
103
103
  }}
@@ -1,10 +1,12 @@
1
+ import { useContext } from 'react';
1
2
  import styled, { createGlobalStyle } from 'styled-components';
2
3
  import { Popover, Row, Divider } from 'antd';
3
- import deleteAllCookiesFactory from 'delete-all-cookies';
4
4
  import { get } from 'lodash';
5
5
  import images from '../images';
6
+ import ActionsContext from '../ActionsContext';
6
7
  import Language from './Language';
7
8
  import Theme from './Theme';
9
+ import { getLanguageStore, clearLoginCookie } from '../storage';
8
10
 
9
11
  const Avatar = styled.li`
10
12
  margin-right: 0;
@@ -83,6 +85,7 @@ const UserInfoWrapper = styled.div`
83
85
 
84
86
  const UserInfoContent = props => {
85
87
  const { userInfo, config={}, onLogout, onChangePassword = () => true, onPersonalSetting = () => true, onLanguageChange, onThemeChange } = props;
88
+ const { getText } = useContext(ActionsContext);
86
89
  const {
87
90
  language = true,
88
91
  } = config || {};
@@ -90,7 +93,7 @@ const UserInfoContent = props => {
90
93
  <UserInfoWrapper className="user-info-setting-wrap">
91
94
  <ul className="user-info-body">
92
95
  <li className="user-info-body-username">
93
- {userInfo.userName || '暂无昵称'}
96
+ {userInfo.userName || getText('nameNull')}
94
97
  <span className="user-info-body-account">{userInfo.account}</span>
95
98
  </li>
96
99
  {
@@ -106,22 +109,22 @@ const UserInfoContent = props => {
106
109
  />
107
110
  </ul>
108
111
  <Row className="user-info-footer" type="flex" justify="space-between" align="middle">
109
- <a onClick={onPersonalSetting} href="/bridge/userCenter?currentTab=1">个人设置</a>
112
+ <a onClick={onPersonalSetting} href="/bridge/userCenter?currentTab=1">{getText('personalSettings')}</a>
110
113
  <Divider type="vertical"/>
111
- <a onClick={onChangePassword} href="/bridge/userCenter?currentTab=2">修改密码</a>
114
+ <a onClick={onChangePassword} href="/bridge/userCenter?currentTab=2" style={getLanguageStore()==='en' ? { flex: 2 } : {}}>{getText('changePwd')}</a>
112
115
  <Divider type="vertical"/>
113
116
  <a
114
117
  className="user-info-footer-signout"
115
118
  onClick={() => {
116
119
  if (onLogout) {
117
120
  onLogout();
118
- deleteAllCookiesFactory(window)();
121
+ clearLoginCookie();
119
122
  } else {
120
- deleteAllCookiesFactory(window)();
123
+ clearLoginCookie();
121
124
  window.location.href = `/user/login?callbackUrl=${window.encodeURI(location.href)}`;
122
125
  }
123
126
  }}
124
- >退出登录</a>
127
+ >{getText('signOut')}</a>
125
128
  </Row>
126
129
  </UserInfoWrapper>
127
130
  );
@@ -1,4 +1,4 @@
1
- import { useState } from 'react';
1
+ import { useState, useMemo } from 'react';
2
2
  import styled, { withTheme } from 'styled-components';
3
3
  import { get } from 'lodash';
4
4
  import Iconfont from '../Iconfont';
@@ -68,11 +68,13 @@ export default withTheme(
68
68
  onChange && onChange(lang);
69
69
  };
70
70
 
71
+ const otherLanguage = useMemo(()=> language === 'cn' ? 'en' : 'cn',[language]);
72
+
71
73
  return (
72
74
  <Language onClick={switchLanguage}>
73
- <Iconfont type={`flag-${language}`} />
75
+ <Iconfont type={`flag-${otherLanguage}`} />
74
76
  <span>
75
- {get(languagesMap[language], 'name')}
77
+ {get(languagesMap[otherLanguage], 'name')}
76
78
  </span>
77
79
  </Language>
78
80
  );
@@ -2,7 +2,7 @@ import { useState } from 'react';
2
2
  import styled from 'styled-components';
3
3
  import { Row } from 'antd';
4
4
  import Iconfont from '../Iconfont';
5
- import { setThemeStore, getThemeStore } from '../storage';
5
+ import { setThemeStore, getThemeStore, getLanguageStore } from '../storage';
6
6
 
7
7
  const Theme = styled.li`
8
8
  margin-top: 20px;
@@ -56,9 +56,9 @@ const Theme = styled.li`
56
56
  `;
57
57
 
58
58
  const themes = [
59
- { value: 'themeS3', label: '科技蓝' },
60
- { value: 'themeS2', label: '暗夜黑' },
61
- { value: 'themeS1', label: '极致白' },
59
+ { value: 'themeS3', label: '科技蓝', enLabel: 'Blue' },
60
+ { value: 'themeS2', label: '暗夜黑', enLabel: 'Black' },
61
+ { value: 'themeS1', label: '极致白', enLabel: 'White' },
62
62
  ];
63
63
 
64
64
  export default props => {
@@ -80,15 +80,14 @@ export default props => {
80
80
  <Theme>
81
81
  <Row type="flex" justify="space-between" className="user-info-body-theme-row">
82
82
  {
83
- themes.map(({ value, label }) => (
83
+ themes.map(({ value, label, enLabel }) => (
84
84
  <div className={value} onClick={changeTheme.bind(this, value)}>
85
- {label}
85
+ {getLanguageStore() === 'en' ? enLabel: label }
86
86
  {
87
87
  theme === value &&
88
88
  <span className="icon-checked-wrap"></span>
89
89
  }
90
90
  </div>
91
-
92
91
  ))
93
92
  }
94
93
  </Row>
@@ -9,7 +9,7 @@ export default withTheme(
9
9
  props => {
10
10
  const {
11
11
  userInfo = {},
12
- extendMap = {}
12
+ extendMap = {},
13
13
  } = props;
14
14
 
15
15
  // 企业级的默认蓝色主题
@@ -1,11 +1,11 @@
1
- import styled, { withTheme } from "styled-components";
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";
1
+ import styled, { withTheme } from 'styled-components';
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
9
 
10
10
  const Actions = styled.ul`
11
11
  list-style: none;
@@ -54,6 +54,7 @@ const Actions = styled.ul`
54
54
 
55
55
  export default withTheme((props) => {
56
56
  const {
57
+ type,
57
58
  config: {
58
59
  theme = true,
59
60
  avatar = true,
@@ -71,6 +72,7 @@ export default withTheme((props) => {
71
72
  onThemeChange,
72
73
  onApplicationChange,
73
74
  onAppChange,
75
+ onOrgChange,
74
76
  onCollapseChange,
75
77
  onPersonalSetting,
76
78
  onChangePassword,
@@ -84,7 +86,7 @@ export default withTheme((props) => {
84
86
  <Actions {...rest}>
85
87
  {extraActions}
86
88
  {globalNavigation && <GlobalNavigation headerRef={headerRef} menus={menus} />}
87
- {!compatible ? (
89
+ {type !== 'enterprise' && (!compatible ? (
88
90
  <>
89
91
  {language && <Language language={userInfo.lang} onChange={onLanguageChange} />}
90
92
  {theme && <Theme theme={userInfo.theme} onChange={onThemeChange} />}
@@ -97,7 +99,7 @@ export default withTheme((props) => {
97
99
  onLanguageChange={onLanguageChange}
98
100
  onThemeChange={onThemeChange}
99
101
  />
100
- )}
102
+ ))}
101
103
  {application && (
102
104
  <Application language={userInfo.lang} apps={apps} onChange={onApplicationChange} />
103
105
  )}
@@ -115,6 +117,7 @@ export default withTheme((props) => {
115
117
  theme,
116
118
  language,
117
119
  }}
120
+ onLanguageChange={onLanguageChange}
118
121
  />
119
122
  ) : (
120
123
  <Avatar
@@ -1,8 +1,8 @@
1
- import { useState, useEffect, useRef } from "react";
2
- import styled, { withTheme } from "styled-components";
3
- import cn from "classnames";
4
- import { get } from "lodash";
5
- import Icon from "../Icon";
1
+ import { useState, useEffect, useRef } from 'react';
2
+ import styled, { withTheme } from 'styled-components';
3
+ import cn from 'classnames';
4
+ import { get } from 'lodash';
5
+ import Icon from '../Icon';
6
6
 
7
7
  const TabsContainer = styled.div`
8
8
  display: flex;
@@ -78,7 +78,7 @@ const TabItem = styled.li`
78
78
  padding: 0 20px 0 10px;
79
79
  cursor: pointer;
80
80
  display: inline-block;
81
- line-height: ${props => (props.theme.size === "large" ? "46px" : "36px")};
81
+ line-height: ${props => (props.theme.size === 'large' ? '46px' : '36px')};
82
82
  /* transition: background-color .5; */
83
83
  width: 130px;
84
84
  color: rgba(255,255,255,.6);
@@ -176,7 +176,7 @@ export const HeaderTabs = withTheme(
176
176
  language,
177
177
  ...props
178
178
  }) => {
179
- const [selectedKey, setSelectedKey] = useState(props.selectedKey || get(tabs, "0.key"));
179
+ const [selectedKey, setSelectedKey] = useState(props.selectedKey || get(tabs, '0.key'));
180
180
  const [tabItems, setTabItems] = useState(tabs || []);
181
181
  const [arrowVisible, setArrowVisible] = useState(false);
182
182
  const [tabsPositionFlags, setTabsPositionFlags] = useState({ start: true, end: true });
@@ -212,7 +212,7 @@ export const HeaderTabs = withTheme(
212
212
  const tabsDom = getTabsDom();
213
213
  const parentBBox = tabsDom.parentNode.getBoundingClientRect();
214
214
  const parentWidth = parentBBox.width - 32;
215
- let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
215
+ let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
216
216
  const index = Math.ceil(x / 130);
217
217
  const trueX = index * 130;
218
218
  let newX = Math.min(0, -(trueX - parentWidth));
@@ -230,7 +230,7 @@ export const HeaderTabs = withTheme(
230
230
  const parentWidth = parentBBox.width - 32;
231
231
  const width = tabItems.length * 130;
232
232
 
233
- let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ""));
233
+ let x = Math.abs(+tabsDom.style.transform.replace(/[^\d.-]/g, ''));
234
234
  const index = Math.floor(x / 130);
235
235
  const trueX = index * 130;
236
236
  let newX = Math.max(-(width - parentWidth), -(trueX + parentWidth));
@@ -247,7 +247,7 @@ export const HeaderTabs = withTheme(
247
247
  const index = tabs.indexOf(tabs.find(({ key }) => key === selectedKey));
248
248
  if (index === -1) return;
249
249
  const tabsDom = getTabsDom();
250
- let x = -+tabsDom.style.transform.replace(/[^\d.-]/g, "");
250
+ let x = -+tabsDom.style.transform.replace(/[^\d.-]/g, '');
251
251
  const bbox = {
252
252
  left: index * 130,
253
253
  right: (index + 1) * 130,
@@ -276,8 +276,7 @@ export const HeaderTabs = withTheme(
276
276
  };
277
277
 
278
278
  useEffect(() => {
279
- setSelectedKey(props.selectedKey || get(tabs, "0.key"));
280
- // const t = [{'code':'tagdata','enName':'tagdata','icon':'layer-color','menuName':'打标数据管理打标数据管理打标数据管理','path':'/orion/tag/datalist','key':'tagdata','name':'打标数据管理打标数据管理打标数据管理'},{'code':'taglist','enName':'taglist','icon':'home','menuName':'标签管理','path':'http://baidu.com/orion/tag/list','key':'taglist','name':'标签管理'},{'code':'relation1','enName':'dadicasesearch1','icon':'home','menuName':'案件检索1','path':'/orion/case/relation1','key':'relation1','name':'案件检索1'},{'code':'dadicasesearch-0','enName':'dadicasesearch','icon':'home','menuName':'案件检索-0','path':'/orion/case/relation0','key':'dadicasesearch-0','name':'案件检索-0'},{'code':'dadicasesearch-1','enName':'dadicasesearch','icon':'home','menuName':'案件检索-1','path':'/orion/case/relation1','key':'dadicasesearch-1','name':'案件检索-1'},{'code':'dadicasesearch-2','enName':'dadicasesearch','icon':'home','menuName':'案件检索-2','path':'/orion/case/relation2','key':'dadicasesearch-2','name':'案件检索-2'},{'code':'dadicasesearch-3','enName':'dadicasesearch','icon':'home','menuName':'案件检索-3','path':'/orion/case/relation3','key':'dadicasesearch-3','name':'案件检索-3'},{'code':'dadicasesearch-4','enName':'dadicasesearch','icon':'home','menuName':'案件检索-4','path':'/orion/case/relation4','key':'dadicasesearch-4','name':'案件检索-4'},{'code':'dadicasesearch-5','enName':'dadicasesearch','icon':'home','menuName':'案件检索-5','path':'/orion/case/relation5','key':'dadicasesearch-5','name':'案件检索-5'},{'code':'dadicasesearch-6','enName':'dadicasesearch','icon':'home','menuName':'案件检索-6','path':'/orion/case/relation6','key':'dadicasesearch-6','name':'案件检索-6'},{'code':'dadicasesearch-7','enName':'dadicasesearch','icon':'home','menuName':'案件检索-7','path':'/orion/case/relation7','key':'dadicasesearch-7','name':'案件检索-7'},{'code':'dadicasesearch-8','enName':'dadicasesearch','icon':'home','menuName':'案件检索-8','path':'/orion/case/relation8','key':'dadicasesearch-8','name':'案件检索-8'}] ;
279
+ setSelectedKey(props.selectedKey || get(tabs, '0.key'));
281
280
  setTabItems(tabs);
282
281
  }, [tabs, props.selectedKey]);
283
282
 
@@ -296,7 +295,7 @@ export const HeaderTabs = withTheme(
296
295
  return (
297
296
  <TabsContainer
298
297
  {...props}
299
- className={cn("tnt-layout-header-tabs", { [className]: className })}
298
+ className={cn('tnt-layout-header-tabs', { [className]: className })}
300
299
  >
301
300
  <Tabs className="tnt-layout-header-tabs-content" ref={tabsRef}>
302
301
  {tabItems.map((tab, index) => (
@@ -314,7 +313,7 @@ export const HeaderTabs = withTheme(
314
313
  {
315
314
  cn: tab.name,
316
315
  en: tab.enName || tab.name,
317
- }[language || "cn"]
316
+ }[language || 'cn']
318
317
  }
319
318
  </a>
320
319
  {tab.closable !== false && tabItems.length > 1 && (
@@ -79,6 +79,7 @@ const TNTLayout = styled(Layout)`
79
79
  export default withTheme(
80
80
  props => {
81
81
  const {
82
+ type,
82
83
  logo,
83
84
  name,
84
85
  enName,
@@ -224,6 +225,7 @@ export default withTheme(
224
225
  </Sider>
225
226
  <Content>
226
227
  <Header
228
+ type={type}
227
229
  userInfo={userInfo}
228
230
  config={config}
229
231
  collapsed={collapsed}
@@ -45,7 +45,7 @@ const TNTLayout = ({ type, config, showMenuInIframe = false, ...props }) => {
45
45
  const actionsContextValue = createActions({ language: getLanguageStore() || userInfo.lang || 'cn' });
46
46
  const onLanguageChange = language => {
47
47
  actionsContextValue.setLanguage(language);
48
- props?.onLanguageChange(language);
48
+ props.onLanguageChange && (props.onLanguageChange(language));
49
49
  };
50
50
 
51
51
  // layout上的指定的属性优先级会高于extendMap中的属性
@@ -83,6 +83,7 @@ const TNTLayout = ({ type, config, showMenuInIframe = false, ...props }) => {
83
83
  isInIframe={isInIframe}
84
84
  userInfo={userInfo}
85
85
  onLanguageChange={onLanguageChange}
86
+ type={type}
86
87
  />
87
88
  }
88
89
  {
@@ -1,5 +1,8 @@
1
+ import Cookies from 'universal-cookie';
1
2
  import { safeParseJSON } from '../utils';
2
3
 
4
+ const cookies = new Cookies();
5
+
3
6
  export const getSideMenuStore = () => safeParseJSON(localStorage.getItem('sideMenu'), {});
4
7
  export const setSideMenuStore = (params = {}) => {
5
8
  localStorage.setItem('sideMenu', JSON.stringify({
@@ -25,8 +28,15 @@ export const setCurrentOrgTreeStore = (currentOrgTree = []) => {
25
28
  export const getCurrentOrgTreeStore = () => safeParseJSON(localStorage.getItem('currentOrgTree'), []);
26
29
 
27
30
 
28
- export const setLanguageStore = lang => localStorage.setItem('lang', lang);
29
- export const getLanguageStore = () => localStorage.getItem('lang');
31
+ // export const setLanguageStore = lang => localStorage.setItem('lang', lang);
32
+ // export const getLanguageStore = () => localStorage.getItem('lang');
33
+ export const setLanguageStore = lang => cookies.set('lang', lang, { path: '/' });
34
+ export const getLanguageStore = () => cookies.get('lang', { path: '/' });
30
35
 
31
36
  export const setThemeStore = theme => localStorage.setItem('theme', theme);
32
37
  export const getThemeStore = () => localStorage.getItem('theme');
38
+
39
+ export const clearLoginCookie = () => {
40
+ cookies.remove('_td_token_', { path: '/' });
41
+ cookies.remove('_uid_', { path: '/' });
42
+ };
@@ -106,8 +106,8 @@ const PageLayout = ({
106
106
  {title}
107
107
  </div>
108
108
  {
109
- [center, extra].map(item => (
110
- <div className={`${clsPrefix}-header-section`}>
109
+ [center, extra].map((item, i) => (
110
+ <div className={`${clsPrefix}-header-section`} key={i}>
111
111
  {item}
112
112
  </div>
113
113
  ))
@@ -1,3 +1,6 @@
1
+ import Cookies from 'universal-cookie';
2
+
3
+ const cookies = new Cookies();
1
4
 
2
5
  export const zh_CN = {
3
6
  globalNavigation: '全局导航',
@@ -14,6 +17,7 @@ export const zh_CN = {
14
17
  totalRecords: '共%s条记录',
15
18
 
16
19
  // user popover
20
+ nameNull: '暂无昵称',
17
21
  personalSettings: '个人设置',
18
22
  changePwd: '修改密码',
19
23
  signOut: '退出'
@@ -35,7 +39,8 @@ export const en_US = {
35
39
  totalRecords: 'Total of %s records',
36
40
 
37
41
  // user popover
38
- personalSettings: 'Personal settings',
42
+ nameNull: 'No nickname yet',
43
+ personalSettings: 'Setting',
39
44
  changePwd: 'Change password',
40
45
  signOut: 'Sign out'
41
46
  };
@@ -55,6 +60,6 @@ export const getText = (key, language = 'cn', ...params) => {
55
60
  return text;
56
61
  };
57
62
 
58
- export const getLanguage = () => localStorage.getItem('lang') || 'cn';
63
+ export const getLanguage = () => cookies.get('lang', { path: '/' }) || 'cn';
59
64
 
60
65
  export default { en_US, zh_CN };
package/dist/1.tntd.js CHANGED
@@ -1,12 +1 @@
1
- (window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{75:function(e,t,r){"use strict";
2
- /*!
3
- * cookie
4
- * Copyright(c) 2012-2014 Roman Shtylman
5
- * Copyright(c) 2015 Douglas Christopher Wilson
6
- * MIT Licensed
7
- */t.parse=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var r={},t=t||{},n=e.split(p),o=t.decode||u,i=0;i<n.length;i++){var a,s=n[i],c=s.indexOf("=");c<0||(a=s.substr(0,c).trim(),'"'==(s=s.substr(++c,s.length).trim())[0]&&(s=s.slice(1,-1)),null==r[a]&&(r[a]=function(t,e){try{return e(t)}catch(e){return t}}(s,o)))}return r},t.serialize=function(e,t,r){var n=r||{},r=n.encode||i;if("function"!=typeof r)throw new TypeError("option encode is invalid");if(!a.test(e))throw new TypeError("argument name is invalid");t=r(t);if(t&&!a.test(t))throw new TypeError("argument val is invalid");var o=e+"="+t;if(null!=n.maxAge){t=+n.maxAge;if(isNaN(t))throw new Error("maxAge should be a Number");o+="; Max-Age="+Math.floor(t)}if(n.domain){if(!a.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!a.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if("function"!=typeof n.expires.toUTCString)throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(o+="; HttpOnly");n.secure&&(o+="; Secure");if(n.sameSite)switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o};var u=decodeURIComponent,i=encodeURIComponent,p=/; */,a=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/},76:function(e,t,r){"use strict";
8
- /*
9
- object-assign
10
- (c) Sindre Sorhus
11
- @license MIT
12
- */var c=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},n)).join("")?void 0:1}catch(e){return}}()?Object.assign:function(e,t){for(var r,n=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o<arguments.length;o++){for(var i in r=Object(arguments[o]))u.call(r,i)&&(n[i]=r[i]);if(c)for(var a=c(r),s=0;s<a.length;s++)p.call(r,a[s])&&(n[a[s]]=r[a[s]])}return n}},77:function(e,t,r){"use strict";r.r(t);var p=r(0),l=r(1),o=r(75);function i(e,t){void 0===t&&(t={});var r,n=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(r=n,!(t=void 0===(t=t.doNotParse)?!r||"{"!==r[0]&&"["!==r[0]&&'"'!==r[0]:t))try{return JSON.parse(n)}catch(e){}return e}var a=r(76);function n(e,t){var r=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=(t=t,"string"==typeof(e=e)?o.parse(e,t):"object"==typeof e&&null!==e?e:{}),new Promise(function(){r.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie}).catch(function(){})}function f(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var m=new(n.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=o.parse(document.cookie,e))},n.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},n.prototype.get=function(e,t,r){return void 0===t&&(t={}),this._updateBrowserValues(r),i(this.cookies[e],t)},n.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var r,n={};for(r in this.cookies)n[r]=i(this.cookies[r],e);return n},n.prototype.set=function(e,t,r){var n;"object"==typeof t&&(t=JSON.stringify(t)),this.cookies=a({},this.cookies,((n={})[e]=t,n)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.serialize(e,t,r)),this._emitChange({name:e,value:t,options:r})},n.prototype.remove=function(e,t){var r=t=a({},t,{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=a({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=o.serialize(e,"",r)),this._emitChange({name:e,value:void 0,options:t})},n.prototype.addChangeListener=function(e){this.changeListeners.push(e)},n.prototype.removeChangeListener=function(e){e=this.changeListeners.indexOf(e);0<=e&&this.changeListeners.splice(e,1)},n),y={account:void 0,password:void 0};t.default=function(e){var t=e.visible,n=e.close,r=e.signIn,o=d(Object(p.useState)(!1),2),i=o[0],a=o[1],e=localStorage.getItem("accountInfo");if(e)try{y=JSON.parse(e)}catch(e){}function s(e,t){u(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},c,h({},e,t.target.value)))}var o=d(Object(p.useState)(y),2),c=o[0],u=o[1],e=c.account,o=c.password;return React.createElement(l.Modal,{title:"开发者模拟登陆",visible:t,maskClosable:!1,onOk:function(){a(!0);var e=r&&r(c);e&&e.then&&e.then(function(r){l.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(c)),a(!1),setTimeout(function(){var e=r||{},t=e.tdToken,e=e.userId;m.set("_td_token_",t,{path:"/"}),m.set("_uid_",e,{path:"/"}),n()},500)}).catch(function(e){throw a(!1),e})},onCancel:n,confirmLoading:i},React.createElement(l.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(l.Form.Item,{label:"用户名:"},React.createElement(l.Input,{type:"text",placeholder:"请输入用户名",value:e||void 0,onChange:function(e){return s("account",e)}})),React.createElement(l.Form.Item,{label:"密码:"},React.createElement(l.Input,{type:"text",placeholder:"请输入用户名",value:o||void 0,onChange:function(e){return s("password",e)}}))))}}}]);
1
+ (window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{51:function(t,e,r){"use strict";r.r(e);var f=r(0),s=r(1);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){b(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function b(t,e,r){return(e=function(t){t=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===n(t)?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,c,i=[],u=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(i.push(n.value),i.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(c=r.return(),Object(c)!==c))return}finally{if(l)throw o}}return i}}(t,e)||function(t,e){var r;if(t)return"string"==typeof t?a(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var m=new(r(10).a),d={account:void 0,password:void 0};e.default=function(t){var e=t.visible,n=t.close,r=t.signIn,t=y(Object(f.useState)(!1),2),o=t[0],a=t[1],t=localStorage.getItem("accountInfo");if(t)try{d=JSON.parse(t)}catch(t){}function c(t,e){u(p(p({},i),{},b({},t,e.target.value)))}var t=y(Object(f.useState)(d),2),i=t[0],u=t[1],t=i.account,l=i.password;return React.createElement(s.Modal,{title:"开发者模拟登陆",visible:e,maskClosable:!1,onOk:function(){a(!0);var t=r&&r(i);t&&t.then&&t.then(function(r){s.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(i)),a(!1),setTimeout(function(){var t=r||{},e=t.tdToken,t=t.userId;m.set("_td_token_",e,{path:"/"}),m.set("_uid_",t,{path:"/"}),n()},500)}).catch(function(t){throw a(!1),t})},onCancel:n,confirmLoading:o},React.createElement(s.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(s.Form.Item,{label:"用户名:"},React.createElement(s.Input,{type:"text",placeholder:"请输入用户名",value:t||void 0,onChange:function(t){return c("account",t)}})),React.createElement(s.Form.Item,{label:"密码:"},React.createElement(s.Input,{type:"text",placeholder:"请输入用户名",value:l||void 0,onChange:function(t){return c("password",t)}}))))}}}]);