tntd 1.4.19 → 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/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 +28424 -27998
- 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 +58 -69
- 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 +57 -80
- 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
package/es/Layout/SideMenu.js
CHANGED
|
@@ -1,48 +1,23 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1
2
|
import "antd/lib/menu/style";
|
|
2
3
|
import _Menu from "antd/lib/menu";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var _excluded = ["code"];
|
|
5
|
+
var _templateObject, _templateObject2;
|
|
6
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
7
|
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; }
|
|
7
|
-
|
|
8
8
|
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; }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
22
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
|
-
function _templateObject2() {
|
|
25
|
-
var data = _taggedTemplateLiteral(["\n font-size: 14px;\n .large-size & {\n font-size: 15px;\n }\n color: rgba(255,255,255,.85);\n .compatible & {\n color: #A1D7FF;\n }\n .tnt-themeS1 & {\n color: ", ";\n }\n .tnt-icon {\n margin-right: 12px;\n font-size: 16px;\n position: relative;\n top: 1px;\n\n .large-size & {\n font-size: 18px;\n top: auto;\n }\n .tnt-themeS1 & {\n /* color: #7e8081; */\n color: ", ";\n }\n }\n"]);
|
|
26
|
-
|
|
27
|
-
_templateObject2 = function _templateObject2() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject() {
|
|
35
|
-
var data = _taggedTemplateLiteral(["\n background: none !important;\n &.ant-menu.ant-menu-root {\n position: relative;\n transition: none !important;\n padding-top: 10px;\n border-right: none;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n height: calc(100vh - ", ");\n overflow-y: auto;\n overflow-x: hidden;\n .collapseIconPlacementBottom & {\n padding-bottom: 36px;\n }\n .tnt-themeS1 & {\n overflow-x: unset;\n box-shadow: 10px 0 10px -5px rgba(0,0,0,0.10);\n z-index: 2;\n }\n scrollbar-width: none;\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n &::-moz-scrollbar {\n display: none;\n }\n\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u5F00\u59CB */\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n font-size: 16px\n }\n }\n\n .ant-layout-sider-collapsed & {\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n padding-left: 8px;\n }\n a {\n visibility: hidden;\n }\n }\n }\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u7ED3\u675F */\n\n .ant-menu-item:active,\n .ant-menu-submenu-title:active {\n background: none;\n }\n\n .ant-menu-submenu .ant-menu-sub {\n background: #212635;\n border-radius: 0 0 2px 2px;\n .compatible & {\n background: #07408d !important;\n }\n .tnt-themeS1 & {\n background: #fff !important;\n }\n\n // \u84DD\u8272\u7CFB\u5217 \u83DC\u5355\u5C55\u5F00\u533A\u57DF\u989C\u8272\n .tnt-themeS3 & {\n background: #07408D !important;\n }\n }\n .ant-menu-submenu.ant-menu-submenu-active,\n .ant-menu-submenu.ant-menu-submenu-selected {\n background: rgba(47,129,247,.25) !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n\n // \u84DD\u8272\u7CFB \u4E00\u7EA7\u83DC\u5355\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-active,\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-selected {\n background: none !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n // \u84DD\u8272\u7CFB \u5B50\u7EA7\u83DC\u5355\u7EA7\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n .ant-menu-item {\n margin: 0;\n font-size: 14px;\n padding-left: 54px !important;\n height: ", ";\n line-height: ", ";\n }\n\n & > .ant-menu-item {\n padding-left: 24px !important;\n width: 100%;\n\n & > .tnt-icon {\n margin-right: 12px;\n }\n & > a {\n display: inline-block;\n }\n }\n\n .ant-menu-submenu-title {\n position: relative;\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n height: ", ";\n line-height: ", ";\n .tnt-icon {\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n & > .tnt-icon {\n position: absolute;\n right: 20px;\n top: 1px;\n font-size: 10px;\n }\n\n // \u84DD\u8272\u7CFB\u4E3B\u9898\n .tnt-themeS3 & {\n color: #FFF;\n }\n .tnt-icon {\n .tnt-themeS3 & {\n color: #FFF;\n }\n }\n }\n\n & > .ant-menu-submenu .ant-menu-submenu .ant-menu-submenu-title {\n margin-top: 0;\n margin-bottom: 0;\n padding-left: 54px !important;\n }\n }\n\n &.ant-menu .menu-arrow-right {\n color: ", ";\n }\n\n .ant-menu-item, .ant-menu-item > a {\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n &:hover {\n color: #fff;\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n\n // \u84DD\u8272\u7CFB\u5217\n .tnt-themeS3 & {\n color: #fff;\n }\n &:hover {\n .tnt-themeS3 & {\n color: #fff;\n }\n }\n }\n & > .ant-menu-item.ant-menu-item-selected,\n &.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {\n color: rgba(255,255,255,.85);\n background-color: ", ";\n .compatible & {\n background-color: #013479;\n }\n & > a {\n .tnt-themeS1 & {\n color: #fff;\n }\n }\n .tnt-themeS1 & {\n color: #fff;\n background-color: ", ";\n }\n\n // \u84DD\u8272\u7CFB \u5B50\u9879\u9009\u4E2D\u989C\u8272\n .tnt-themeS3 & {\n color: #fff;\n background: #013479;\n &::after{\n content:\"\";\n display:none;\n }\n }\n }\n .ant-menu-submenu.ant-menu-submenu-selected {\n .tnt-themeS2 & {\n background: #141825;\n }\n .tnt-themeS2.compatible & {\n background: rgba(47,129,247,.25) !important;\n }\n }\n"]);
|
|
36
|
-
|
|
37
|
-
_templateObject = function _templateObject() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
20
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
|
-
|
|
46
21
|
import { useState, useEffect, useContext } from 'react';
|
|
47
22
|
import styled, { withTheme } from 'styled-components';
|
|
48
23
|
import { get } from 'lodash';
|
|
@@ -53,8 +28,8 @@ import Iconfont from './Iconfont';
|
|
|
53
28
|
var color = 'rgba(255,255,255,.85)';
|
|
54
29
|
var compatibleColor = '#a1d7ff';
|
|
55
30
|
var SubMenu = _Menu.SubMenu,
|
|
56
|
-
|
|
57
|
-
var TNTMenu = styled(_Menu)(_templateObject(), function (props) {
|
|
31
|
+
MenuItem = _Menu.Item;
|
|
32
|
+
var TNTMenu = styled(_Menu)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none !important;\n &.ant-menu.ant-menu-root {\n position: relative;\n transition: none !important;\n padding-top: 10px;\n border-right: none;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n height: calc(100vh - ", ");\n overflow-y: auto;\n overflow-x: hidden;\n .collapseIconPlacementBottom & {\n padding-bottom: 36px;\n }\n .tnt-themeS1 & {\n overflow-x: unset;\n box-shadow: 10px 0 10px -5px rgba(0,0,0,0.10);\n z-index: 2;\n }\n scrollbar-width: none;\n -ms-overflow-style: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n &::-moz-scrollbar {\n display: none;\n }\n\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u5F00\u59CB */\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n font-size: 16px\n }\n }\n\n .ant-layout-sider-collapsed & {\n & > .ant-menu-item {\n & > .tnt-icon:first-child {\n padding-left: 8px;\n }\n a {\n visibility: hidden;\n }\n }\n }\n /** \u4E00\u7EA7\u7ED3\u70B9\u662F\u83DC\u5355\u6837\u5F0F\u7ED3\u675F */\n\n .ant-menu-item:active,\n .ant-menu-submenu-title:active {\n background: none;\n }\n\n .ant-menu-submenu .ant-menu-sub {\n background: #212635;\n border-radius: 0 0 2px 2px;\n .compatible & {\n background: #07408d !important;\n }\n .tnt-themeS1 & {\n background: #fff !important;\n }\n\n // \u84DD\u8272\u7CFB\u5217 \u83DC\u5355\u5C55\u5F00\u533A\u57DF\u989C\u8272\n .tnt-themeS3 & {\n background: #07408D !important;\n }\n }\n .ant-menu-submenu.ant-menu-submenu-active,\n .ant-menu-submenu.ant-menu-submenu-selected {\n background: rgba(47,129,247,.25) !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n\n // \u84DD\u8272\u7CFB \u4E00\u7EA7\u83DC\u5355\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-active,\n & > .ant-menu-submenu .ant-menu-submenu.ant-menu-submenu-selected {\n background: none !important;\n .tnt-themeS1 & {\n background: ", " !important;\n }\n // \u84DD\u8272\u7CFB \u5B50\u7EA7\u83DC\u5355\u7EA7\u7684\u9009\u4E2D\u6548\u679C\n .tnt-themeS3 & {\n background: #204085 !important;\n }\n }\n .ant-menu-item {\n margin: 0;\n font-size: 14px;\n padding-left: 54px !important;\n height: ", ";\n line-height: ", ";\n }\n\n & > .ant-menu-item {\n padding-left: 24px !important;\n width: 100%;\n\n & > .tnt-icon {\n margin-right: 12px;\n }\n & > a {\n display: inline-block;\n }\n }\n\n .ant-menu-submenu-title {\n position: relative;\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n height: ", ";\n line-height: ", ";\n .tnt-icon {\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n & > .tnt-icon {\n position: absolute;\n right: 20px;\n top: 1px;\n font-size: 10px;\n }\n\n // \u84DD\u8272\u7CFB\u4E3B\u9898\n .tnt-themeS3 & {\n color: #FFF;\n }\n .tnt-icon {\n .tnt-themeS3 & {\n color: #FFF;\n }\n }\n }\n\n & > .ant-menu-submenu .ant-menu-submenu .ant-menu-submenu-title {\n margin-top: 0;\n margin-bottom: 0;\n padding-left: 54px !important;\n }\n }\n\n &.ant-menu .menu-arrow-right {\n color: ", ";\n }\n\n .ant-menu-item, .ant-menu-item > a {\n color: ", ";\n .tnt-themeS1 & {\n color: ", ";\n }\n &:hover {\n color: #fff;\n .tnt-themeS1 & {\n color: ", ";\n }\n }\n\n // \u84DD\u8272\u7CFB\u5217\n .tnt-themeS3 & {\n color: #fff;\n }\n &:hover {\n .tnt-themeS3 & {\n color: #fff;\n }\n }\n }\n & > .ant-menu-item.ant-menu-item-selected,\n &.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {\n color: rgba(255,255,255,.85);\n background-color: ", ";\n .compatible & {\n background-color: #013479;\n }\n & > a {\n .tnt-themeS1 & {\n color: #fff;\n }\n }\n .tnt-themeS1 & {\n color: #fff;\n background-color: ", ";\n }\n\n // \u84DD\u8272\u7CFB \u5B50\u9879\u9009\u4E2D\u989C\u8272\n .tnt-themeS3 & {\n color: #fff;\n background: #013479;\n &::after{\n content:\"\";\n display:none;\n }\n }\n }\n .ant-menu-submenu.ant-menu-submenu-selected {\n .tnt-themeS2 & {\n background: #141825;\n }\n .tnt-themeS2.compatible & {\n background: rgba(47,129,247,.25) !important;\n }\n }\n"])), function (props) {
|
|
58
33
|
return "".concat(props.theme.headerHeight, "px");
|
|
59
34
|
}, function (props) {
|
|
60
35
|
return props.theme.dividerColor;
|
|
@@ -91,7 +66,7 @@ var TNTMenu = styled(_Menu)(_templateObject(), function (props) {
|
|
|
91
66
|
}, function (props) {
|
|
92
67
|
return props.theme.primaryColor;
|
|
93
68
|
});
|
|
94
|
-
var MenuTitle = styled.span(_templateObject2(), function (props) {
|
|
69
|
+
var MenuTitle = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 14px;\n .large-size & {\n font-size: 15px;\n }\n color: rgba(255,255,255,.85);\n .compatible & {\n color: #A1D7FF;\n }\n .tnt-themeS1 & {\n color: ", ";\n }\n .tnt-icon {\n margin-right: 12px;\n font-size: 16px;\n position: relative;\n top: 1px;\n\n .large-size & {\n font-size: 18px;\n top: auto;\n }\n .tnt-themeS1 & {\n /* color: #7e8081; */\n color: ", ";\n }\n }\n"])), function (props) {
|
|
95
70
|
return props.theme.primaryTextColor;
|
|
96
71
|
}, function (props) {
|
|
97
72
|
return "".concat(props.theme.iconColor);
|
|
@@ -99,73 +74,58 @@ var MenuTitle = styled.span(_templateObject2(), function (props) {
|
|
|
99
74
|
export default withTheme(function (props) {
|
|
100
75
|
var actions = useContext(ActionsContext);
|
|
101
76
|
var language = props.language,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
_props$menus = props.menus,
|
|
78
|
+
menus = _props$menus === void 0 ? [] : _props$menus,
|
|
79
|
+
formatMenuPath = props.formatMenuPath,
|
|
80
|
+
changeRouter = props.changeRouter,
|
|
81
|
+
selectedKey = props.selectedKey,
|
|
82
|
+
openKeys = props.openKeys,
|
|
83
|
+
onSelect = props.onSelect,
|
|
84
|
+
onBeforeChange = props.onBeforeChange,
|
|
85
|
+
onChange = props.onChange,
|
|
86
|
+
onOpenChange = props.onOpenChange,
|
|
87
|
+
collapsed = props.collapsed;
|
|
114
88
|
var _getSelectedMenuInfo = getSelectedMenuInfo(selectedKey, menus),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
subMenu = _getSelectedMenuInfo.subMenu,
|
|
90
|
+
parentMenus = _getSelectedMenuInfo.parentMenus;
|
|
118
91
|
var _useState = useState([get(subMenu, 'code')]),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
92
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
+
selectedKeys = _useState2[0],
|
|
94
|
+
setSelectedKeys = _useState2[1];
|
|
123
95
|
var onSelectMenu = function onSelectMenu(param) {
|
|
124
96
|
var _ref5 = getSelectedMenuInfo(param.key, menus) || {},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var params = _objectSpread({}, param, {
|
|
97
|
+
subMenu = _ref5.subMenu,
|
|
98
|
+
parentMenus = _ref5.parentMenus;
|
|
99
|
+
var params = _objectSpread(_objectSpread({}, param), {}, {
|
|
129
100
|
data: subMenu
|
|
130
101
|
});
|
|
131
|
-
|
|
132
102
|
var defaultBeforeChange = function defaultBeforeChange(_ref6) {
|
|
133
103
|
var data = _ref6.data;
|
|
134
104
|
return !isNewTabMenu(data);
|
|
135
105
|
};
|
|
136
|
-
|
|
137
106
|
var defaultSelect = function defaultSelect(_ref7) {
|
|
138
107
|
var _window$location$path;
|
|
139
|
-
|
|
140
108
|
var data = _ref7.data;
|
|
141
|
-
|
|
142
109
|
var _ref8 = data || {},
|
|
143
|
-
|
|
144
|
-
|
|
110
|
+
path = _ref8.path;
|
|
145
111
|
var formatPath = formatMenuPath || function (path) {
|
|
146
112
|
return path;
|
|
147
113
|
};
|
|
148
|
-
|
|
149
114
|
if (isNewTabMenu(data)) {
|
|
150
115
|
openInNewTab(formatPath(data == null ? void 0 : data.path, data));
|
|
151
116
|
return;
|
|
152
117
|
}
|
|
153
|
-
|
|
154
118
|
var routerPrefix = (_window$location$path = window.location.pathname.match(/(^\/[^\/]+)/i)) == null ? void 0 : _window$location$path[1];
|
|
155
|
-
|
|
156
|
-
if (path == null ? void 0 : path.startsWith(routerPrefix)) {
|
|
119
|
+
if (path != null && path.startsWith(routerPrefix)) {
|
|
157
120
|
var forwardPath = formatPath(path, data);
|
|
158
121
|
changeRouter ? changeRouter(forwardPath, data) : window.history.pushState(data, data == null ? void 0 : data.name, forwardPath);
|
|
159
122
|
} else {
|
|
160
123
|
window.location.href = formatPath(path, data);
|
|
161
124
|
}
|
|
162
125
|
};
|
|
163
|
-
|
|
164
126
|
var finalSelect = onSelect || defaultSelect;
|
|
165
|
-
|
|
166
127
|
if (param.key !== get(selectedKeys, '0')) {
|
|
167
128
|
var finalBeforeChange = onBeforeChange || defaultBeforeChange;
|
|
168
|
-
|
|
169
129
|
if (finalBeforeChange(params, get(selectedKeys, '0'))) {
|
|
170
130
|
// SideMenu菜单收起状态
|
|
171
131
|
if (collapsed) {
|
|
@@ -179,32 +139,26 @@ export default withTheme(function (props) {
|
|
|
179
139
|
beforeOpenKeys: newOpenKeys
|
|
180
140
|
});
|
|
181
141
|
}
|
|
182
|
-
|
|
183
142
|
setSelectedKeys([param.key]);
|
|
184
143
|
onChange && onChange(params);
|
|
185
144
|
}
|
|
186
145
|
}
|
|
187
|
-
|
|
188
146
|
actions.setSelectedMenuKey(param.key);
|
|
189
147
|
setSelectedKeys([param.key]);
|
|
190
148
|
finalSelect(params);
|
|
191
149
|
};
|
|
192
|
-
|
|
193
150
|
var getExpandIcon = function getExpandIcon(code) {
|
|
194
151
|
if (props.theme.compatible) {
|
|
195
152
|
return openKeys.includes(code) ? 'minus' : 'plus';
|
|
196
153
|
}
|
|
197
|
-
|
|
198
154
|
return openKeys.includes(code) ? 'up' : 'down';
|
|
199
155
|
};
|
|
200
|
-
|
|
201
156
|
var onOpenKeysChange = function onOpenKeysChange(keys) {
|
|
202
157
|
var openKey = keys.find(function (key) {
|
|
203
158
|
return !openKeys.includes(key);
|
|
204
|
-
});
|
|
205
|
-
|
|
159
|
+
});
|
|
160
|
+
// const closeKey = openKeys.find(key => !keys.includes(key));
|
|
206
161
|
var newOpenKeys = keys;
|
|
207
|
-
|
|
208
162
|
var findParentGroupKey = function findParentGroupKey(key, openKeys) {
|
|
209
163
|
var parentGroupKey;
|
|
210
164
|
traverseTree(menus, function (node, pnode) {
|
|
@@ -212,18 +166,16 @@ export default withTheme(function (props) {
|
|
|
212
166
|
if (pnode && openKeys.includes(pnode == null ? void 0 : pnode.code)) {
|
|
213
167
|
parentGroupKey = pnode == null ? void 0 : pnode.code;
|
|
214
168
|
}
|
|
215
|
-
|
|
216
169
|
return false;
|
|
217
170
|
}
|
|
218
171
|
});
|
|
219
172
|
return parentGroupKey;
|
|
220
|
-
};
|
|
221
|
-
|
|
173
|
+
};
|
|
222
174
|
|
|
175
|
+
// 展开openKey
|
|
223
176
|
if (openKey) {
|
|
224
177
|
// 父子关系展开
|
|
225
178
|
var parentGroupKey = findParentGroupKey(openKey, openKeys);
|
|
226
|
-
|
|
227
179
|
if (parentGroupKey) {
|
|
228
180
|
newOpenKeys = keys.length > 2 ? [parentGroupKey, openKey] : keys;
|
|
229
181
|
} else {
|
|
@@ -233,25 +185,21 @@ export default withTheme(function (props) {
|
|
|
233
185
|
// 收起closeKey
|
|
234
186
|
newOpenKeys = keys;
|
|
235
187
|
}
|
|
236
|
-
|
|
237
188
|
onOpenChange(newOpenKeys);
|
|
238
189
|
};
|
|
239
|
-
|
|
240
190
|
useEffect(function () {
|
|
241
191
|
setSelectedKeys([selectedKey]);
|
|
242
|
-
|
|
243
|
-
if (selectedKey && !collapsed && (parentMenus == null ? void 0 : parentMenus.length)) {
|
|
192
|
+
if (selectedKey && !collapsed && parentMenus != null && parentMenus.length) {
|
|
244
193
|
onOpenChange(parentMenus == null ? void 0 : parentMenus.map(function (_ref10) {
|
|
245
194
|
var code = _ref10.code;
|
|
246
195
|
return code;
|
|
247
196
|
}).reverse());
|
|
248
197
|
}
|
|
249
|
-
|
|
250
198
|
actions.setSelectedMenuKey(selectedKey);
|
|
251
199
|
}, [selectedKey]);
|
|
252
200
|
actions.off('menuSelect', onSelectMenu);
|
|
253
201
|
actions.on('menuSelect', onSelectMenu);
|
|
254
|
-
return React.createElement(TNTMenu, {
|
|
202
|
+
return /*#__PURE__*/React.createElement(TNTMenu, {
|
|
255
203
|
mode: "inline",
|
|
256
204
|
defaultSelectedKeys: [],
|
|
257
205
|
openKeys: openKeys,
|
|
@@ -260,9 +208,9 @@ export default withTheme(function (props) {
|
|
|
260
208
|
}, menus == null ? void 0 : menus.map(function (menu) {
|
|
261
209
|
var MenuLink = function MenuLink(_ref11) {
|
|
262
210
|
var menuName = _ref11.menuName,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return React.createElement("a", {
|
|
211
|
+
enName = _ref11.enName,
|
|
212
|
+
path = _ref11.path;
|
|
213
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
266
214
|
href: path,
|
|
267
215
|
onClick: function onClick(evt) {
|
|
268
216
|
return evt.preventDefault();
|
|
@@ -272,69 +220,60 @@ export default withTheme(function (props) {
|
|
|
272
220
|
en: enName
|
|
273
221
|
}[language]);
|
|
274
222
|
};
|
|
275
|
-
|
|
276
223
|
if (isGroupMenu(menu)) {
|
|
277
224
|
var _menu$children;
|
|
278
|
-
|
|
279
225
|
var getSubMenuProps = function getSubMenuProps(_ref12) {
|
|
280
226
|
var code = _ref12.code,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
227
|
+
groupIcon = _ref12.groupIcon,
|
|
228
|
+
groupName = _ref12.groupName,
|
|
229
|
+
enName = _ref12.enName;
|
|
284
230
|
var isSubGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
285
231
|
return {
|
|
286
232
|
key: code,
|
|
287
|
-
title: React.createElement(MenuTitle, {
|
|
233
|
+
title: /*#__PURE__*/React.createElement(MenuTitle, {
|
|
288
234
|
style: collapsed && isSubGroup ? {
|
|
289
235
|
color: props.theme.primaryTextColor
|
|
290
236
|
} : {}
|
|
291
|
-
}, !isSubGroup && React.createElement(Iconfont, {
|
|
237
|
+
}, !isSubGroup && /*#__PURE__*/React.createElement(Iconfont, {
|
|
292
238
|
type: groupIcon
|
|
293
239
|
}), collapsed && !isSubGroup ? '' : {
|
|
294
240
|
cn: groupName,
|
|
295
241
|
en: enName
|
|
296
242
|
}[language]),
|
|
297
|
-
expandIcon: collapsed ? null : React.createElement(Iconfont
|
|
298
|
-
/* */
|
|
299
|
-
, {
|
|
243
|
+
expandIcon: collapsed ? null : /*#__PURE__*/React.createElement(Iconfont /* */, {
|
|
300
244
|
type: getExpandIcon(code)
|
|
301
245
|
})
|
|
302
246
|
};
|
|
303
247
|
};
|
|
304
|
-
|
|
305
|
-
return React.createElement(SubMenu, _extends({}, getSubMenuProps(menu), {
|
|
248
|
+
return /*#__PURE__*/React.createElement(SubMenu, _extends({}, getSubMenuProps(menu), {
|
|
306
249
|
onClick: onSelectMenu
|
|
307
250
|
}), menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.map(function (menu) {
|
|
308
251
|
if (isGroupMenu(menu)) {
|
|
309
252
|
var _menu$children2;
|
|
310
|
-
|
|
311
|
-
return React.createElement(SubMenu, _extends({}, getSubMenuProps(menu, true), {
|
|
253
|
+
return /*#__PURE__*/React.createElement(SubMenu, _extends({}, getSubMenuProps(menu, true), {
|
|
312
254
|
onClick: onSelectMenu
|
|
313
255
|
}), menu == null ? void 0 : (_menu$children2 = menu.children) == null ? void 0 : _menu$children2.map(function (_ref13) {
|
|
314
256
|
var code = _ref13.code,
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return React.createElement(MenuItem, {
|
|
257
|
+
menu = _objectWithoutProperties(_ref13, _excluded);
|
|
258
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
318
259
|
key: code
|
|
319
|
-
}, React.createElement(MenuLink, _extends({}, menu, {
|
|
260
|
+
}, /*#__PURE__*/React.createElement(MenuLink, _extends({}, menu, {
|
|
320
261
|
style: {
|
|
321
262
|
paddingLeft: '24px'
|
|
322
263
|
}
|
|
323
264
|
})));
|
|
324
265
|
}));
|
|
325
266
|
}
|
|
326
|
-
|
|
327
|
-
return React.createElement(MenuItem, {
|
|
267
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
328
268
|
key: menu == null ? void 0 : menu.code
|
|
329
|
-
}, React.createElement(MenuLink, menu));
|
|
269
|
+
}, /*#__PURE__*/React.createElement(MenuLink, menu));
|
|
330
270
|
}));
|
|
331
271
|
}
|
|
332
|
-
|
|
333
|
-
return React.createElement(MenuItem, {
|
|
272
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
334
273
|
key: menu.code,
|
|
335
274
|
onClick: onSelectMenu
|
|
336
|
-
}, React.createElement(Iconfont, {
|
|
275
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
337
276
|
type: menu.icon
|
|
338
|
-
}), React.createElement(MenuLink, menu));
|
|
277
|
+
}), /*#__PURE__*/React.createElement(MenuLink, menu));
|
|
339
278
|
}));
|
|
340
279
|
});
|
package/es/Layout/Theme.js
CHANGED
|
@@ -1,56 +1,24 @@
|
|
|
1
1
|
import "antd/lib/popover/style";
|
|
2
2
|
import _Popover from "antd/lib/popover";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
3
|
+
var _templateObject,
|
|
4
|
+
_templateObject2,
|
|
5
|
+
_templateObject3,
|
|
6
|
+
_this = this;
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
|
-
function _templateObject3() {
|
|
15
|
-
var data = _taggedTemplateLiteral(["\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n width: 156px;\n"]);
|
|
16
|
-
|
|
17
|
-
_templateObject3 = function _templateObject3() {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _templateObject2() {
|
|
25
|
-
var data = _taggedTemplateLiteral(["\n & > div {\n position: relative;\n display: inline-block;\n cursor: pointer;\n &:first-child {\n margin-right: 10px;\n }\n &:last-child {\n margin-left: 10px;\n }\n & > i, & > .tnt-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n"]);
|
|
26
|
-
|
|
27
|
-
_templateObject2 = function _templateObject2() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject() {
|
|
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"]);
|
|
36
|
-
|
|
37
|
-
_templateObject = function _templateObject() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
13
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
|
-
|
|
46
14
|
import { useState } from 'react';
|
|
47
15
|
import styled from 'styled-components';
|
|
48
16
|
import Iconfont from './Iconfont';
|
|
49
17
|
import images from './images';
|
|
50
18
|
import { setThemeStore, getThemeStore } from './storage';
|
|
51
|
-
var Theme = styled.li(_templateObject());
|
|
52
|
-
var ThemeSwitch = styled.div(_templateObject2());
|
|
53
|
-
var ThemeContentWrapper = styled.div(_templateObject3());
|
|
19
|
+
var Theme = styled.li(_templateObject || (_templateObject = _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"])));
|
|
20
|
+
var ThemeSwitch = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > div {\n position: relative;\n display: inline-block;\n cursor: pointer;\n &:first-child {\n margin-right: 10px;\n }\n &:last-child {\n margin-left: 10px;\n }\n & > i, & > .tnt-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n }\n"])));
|
|
21
|
+
var ThemeContentWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n width: 156px;\n"])));
|
|
54
22
|
var themes = [{
|
|
55
23
|
value: 'themeS1',
|
|
56
24
|
img: images.themeSymbol1
|
|
@@ -58,10 +26,8 @@ var themes = [{
|
|
|
58
26
|
value: 'themeS2',
|
|
59
27
|
img: images.themeSymbol2
|
|
60
28
|
}];
|
|
61
|
-
|
|
62
29
|
var ThemeContent = function ThemeContent(props) {
|
|
63
30
|
var onChange = props.onChange;
|
|
64
|
-
|
|
65
31
|
var getTheme = function getTheme() {
|
|
66
32
|
var theme = getThemeStore() || props.theme || 'themeS2';
|
|
67
33
|
return themes.some(function (_ref) {
|
|
@@ -69,39 +35,35 @@ var ThemeContent = function ThemeContent(props) {
|
|
|
69
35
|
return value === theme;
|
|
70
36
|
}) ? theme : 'themeS2';
|
|
71
37
|
};
|
|
72
|
-
|
|
73
38
|
var _useState = useState(getTheme()),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
theme = _useState2[0],
|
|
41
|
+
setTheme = _useState2[1];
|
|
78
42
|
var changeTheme = function changeTheme(theme) {
|
|
79
43
|
setTheme(theme);
|
|
80
44
|
setThemeStore(theme);
|
|
81
45
|
onChange(theme);
|
|
82
46
|
};
|
|
83
|
-
|
|
84
|
-
return React.createElement(ThemeContentWrapper, null, React.createElement(ThemeSwitch, null, themes.map(function (_ref2) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(ThemeContentWrapper, null, /*#__PURE__*/React.createElement(ThemeSwitch, null, themes.map(function (_ref2) {
|
|
85
48
|
var value = _ref2.value,
|
|
86
|
-
|
|
87
|
-
return React.createElement("div", {
|
|
49
|
+
img = _ref2.img;
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
51
|
key: value,
|
|
89
52
|
onClick: changeTheme.bind(_this, value)
|
|
90
|
-
}, React.createElement("img", {
|
|
53
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
91
54
|
src: img
|
|
92
|
-
}), theme === value && React.createElement(Iconfont, {
|
|
55
|
+
}), theme === value && /*#__PURE__*/React.createElement(Iconfont, {
|
|
93
56
|
type: "check1"
|
|
94
57
|
}));
|
|
95
58
|
})));
|
|
96
59
|
};
|
|
97
|
-
|
|
98
60
|
export default (function (props) {
|
|
99
|
-
return React.createElement(Theme, null, React.createElement(_Popover, {
|
|
61
|
+
return /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(_Popover, {
|
|
100
62
|
placement: "bottomRight",
|
|
101
63
|
title: null,
|
|
102
|
-
content: React.createElement(ThemeContent, props),
|
|
64
|
+
content: /*#__PURE__*/React.createElement(ThemeContent, props),
|
|
103
65
|
trigger: "click"
|
|
104
|
-
}, React.createElement(Iconfont, {
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
105
67
|
type: "change-theme"
|
|
106
68
|
})));
|
|
107
69
|
});
|