tntd 1.4.32 → 1.4.33-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Ellipsis/index.js +47 -15
- package/components/QueryListScene/QueryForm.js +4 -4
- package/components/QueryListScene/createActions.js +4 -4
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +24089 -23289
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +7 -10
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +79 -111
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +33 -40
- package/es/DevelopmentLogin/LoginModal.js +33 -46
- package/es/DevelopmentLogin/index.js +14 -18
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +100 -79
- package/es/Handle/index.js +46 -64
- package/es/Icon/fonts/iconfont.js +7 -12
- package/es/Icon/index.js +12 -15
- package/es/Img/Contain.js +26 -31
- package/es/Img/Cover.js +43 -57
- package/es/Img/index.js +39 -48
- package/es/Layout/ActionsContext.js +3 -2
- package/es/Layout/AppList.js +39 -94
- package/es/Layout/Application.js +28 -74
- package/es/Layout/Avatar.js +30 -67
- package/es/Layout/CompatibleLanguage.js +41 -96
- package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
- package/es/Layout/EnterpriseLayout/Language.js +16 -34
- package/es/Layout/EnterpriseLayout/Theme.js +18 -36
- package/es/Layout/EnterpriseLayout/index.js +14 -16
- package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
- package/es/Layout/GlobalNavigation/index.js +22 -56
- package/es/Layout/Header.js +26 -47
- package/es/Layout/HeaderActions.js +45 -59
- package/es/Layout/HeaderNavs.js +24 -51
- package/es/Layout/HeaderTabs.js +53 -106
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +16 -34
- package/es/Layout/Layout.js +88 -110
- package/es/Layout/Logo.js +17 -33
- package/es/Layout/OrgAppList.js +64 -109
- package/es/Layout/SideMenu.js +67 -128
- package/es/Layout/Theme.js +25 -63
- package/es/Layout/index.js +28 -37
- package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
- package/es/Layout/paaslayout/Header.js +23 -46
- package/es/Layout/paaslayout/Logo.js +4 -14
- package/es/Layout/paaslayout/SideMenu.js +41 -80
- package/es/Layout/paaslayout/index.js +77 -104
- package/es/Layout/storage.js +10 -9
- package/es/LoadingButton/index.js +18 -27
- package/es/Modal/index.js +42 -51
- package/es/Page/Box.js +36 -43
- package/es/Page/index.js +56 -71
- package/es/Page/utils.js +0 -5
- package/es/QueryForm/Field/Checkbox.js +7 -11
- package/es/QueryForm/Field/Select.js +34 -44
- package/es/QueryForm/Field/SelectInput.js +31 -46
- package/es/QueryForm/Field/fieldsMap.js +0 -1
- package/es/QueryForm/Field/index.js +46 -78
- package/es/QueryForm/createActions.js +6 -7
- package/es/QueryForm/index.js +79 -140
- package/es/QueryListScene/List.js +83 -139
- package/es/QueryListScene/QueryForm.js +54 -91
- package/es/QueryListScene/QueryListScene.js +29 -47
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +13 -14
- package/es/QueryListScene/createActions.js +4 -4
- package/es/Select/DropDownWrap.js +32 -55
- package/es/Select/index.js +140 -232
- package/es/Table/ResizableTable/index.js +29 -43
- package/es/Table/index.js +20 -19
- package/es/Title/index.js +23 -25
- package/es/locale.js +1 -5
- package/es/utils/checkAuth.js +6 -8
- package/es/utils/findMenuInfoByPath.js +0 -4
- package/es/utils/index.js +17 -27
- package/lib/ArrayInput/icon.js +7 -9
- package/lib/ArrayInput/index.js +82 -131
- package/lib/AuthContext.js +2 -6
- package/lib/Columns/index.js +36 -54
- package/lib/DevelopmentLogin/LoginModal.js +36 -63
- package/lib/DevelopmentLogin/index.js +21 -31
- package/lib/Ellipsis/Svg/CopySVG.js +15 -18
- package/lib/Ellipsis/Svg/TickSVG.js +10 -13
- package/lib/Ellipsis/index.js +105 -93
- package/lib/Handle/index.js +51 -87
- package/lib/Icon/fonts/iconfont.js +7 -12
- package/lib/Icon/iconList.js +1 -2
- package/lib/Icon/index.js +16 -26
- package/lib/Img/Contain.js +29 -40
- package/lib/Img/Cover.js +48 -72
- package/lib/Img/index.js +42 -58
- package/lib/Layout/ActionsContext.js +1 -5
- package/lib/Layout/AppList.js +45 -124
- package/lib/Layout/Application.js +31 -92
- package/lib/Layout/Avatar.js +36 -91
- package/lib/Layout/CompatibleLanguage.js +44 -116
- package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
- package/lib/Layout/EnterpriseLayout/Language.js +22 -54
- package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
- package/lib/Layout/EnterpriseLayout/index.js +17 -27
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
- package/lib/Layout/GlobalNavigation/index.js +28 -80
- package/lib/Layout/Header.js +36 -68
- package/lib/Layout/HeaderActions.js +51 -81
- package/lib/Layout/HeaderNavs.js +30 -70
- package/lib/Layout/HeaderTabs.js +58 -127
- package/lib/Layout/Iconfont.js +4 -9
- package/lib/Layout/Language.js +22 -54
- package/lib/Layout/Layout.js +93 -134
- package/lib/Layout/Logo.js +26 -47
- package/lib/Layout/OrgAppList.js +69 -133
- package/lib/Layout/SideMenu.js +72 -151
- package/lib/Layout/Theme.js +28 -79
- package/lib/Layout/createActions.js +3 -9
- package/lib/Layout/images/index.js +5 -36
- package/lib/Layout/index.js +35 -63
- package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
- package/lib/Layout/paaslayout/Header.js +30 -60
- package/lib/Layout/paaslayout/Logo.js +11 -24
- package/lib/Layout/paaslayout/SideMenu.js +44 -93
- package/lib/Layout/paaslayout/index.js +82 -128
- package/lib/Layout/storage.js +26 -68
- package/lib/LoadingButton/index.js +21 -36
- package/lib/Modal/index.js +45 -62
- package/lib/Page/Box.js +38 -50
- package/lib/Page/index.js +58 -84
- package/lib/Page/utils.js +5 -16
- package/lib/QueryForm/Field/Checkbox.js +10 -19
- package/lib/QueryForm/Field/Select.js +39 -60
- package/lib/QueryForm/Field/SelectInput.js +36 -65
- package/lib/QueryForm/Field/fieldsMap.js +6 -23
- package/lib/QueryForm/Field/index.js +50 -91
- package/lib/QueryForm/createActions.js +9 -16
- package/lib/QueryForm/index.js +83 -165
- package/lib/QueryForm/useForm.js +1 -6
- package/lib/QueryListScene/List.js +89 -153
- package/lib/QueryListScene/QueryForm.js +58 -101
- package/lib/QueryListScene/QueryListScene.js +31 -56
- package/lib/QueryListScene/Title.js +6 -11
- package/lib/QueryListScene/Toolbar.js +16 -22
- package/lib/QueryListScene/createActions.js +7 -13
- package/lib/QueryListScene/index.js +5 -19
- package/lib/QueryListScene/useActions.js +1 -6
- package/lib/Select/DropDownWrap.js +35 -63
- package/lib/Select/index.js +142 -245
- package/lib/Table/ResizableTable/index.js +31 -54
- package/lib/Table/index.js +21 -34
- package/lib/Title/index.js +26 -34
- package/lib/index.js +36 -57
- package/lib/locale.js +9 -25
- package/lib/utils/checkAuth.js +9 -16
- package/lib/utils/findMenuInfoByPath.js +3 -12
- package/lib/utils/index.js +26 -60
- package/package.json +3 -2
package/es/Layout/HeaderTabs.js
CHANGED
|
@@ -1,61 +1,29 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
function _objectWithoutPropertiesLoose(
|
|
16
|
-
|
|
17
|
-
function _templateObject3() {
|
|
18
|
-
var data = _taggedTemplateLiteral(["\n position: relative;\n margin: 0;\n padding: 0 20px 0 10px;\n cursor: pointer;\n display: inline-block;\n line-height: ", ";\n /* transition: background-color .5; */\n width: 130px;\n color: rgba(255,255,255,.6);\n\n .tnt-icon[type=close] {\n display: none;\n position: absolute;\n right: 0;\n top: 0;\n font-size: 10px;\n padding: 0 10px;\n cursor: pointer;\n z-index: 1;\n }\n\n &:not(:last-child):after {\n position: absolute;\n content: \"\";\n right: 0;\n top: 6px;\n height: 24px;\n width: 1px;\n // opacity: .5;\n // background: #fff;\n background: #E1E6EE;\n opacity: .5;\n // .tnt-themeS1 & {\n // background: #E1E6EE;\n // opacity: 1;\n // }\n }\n\n &.active,\n &.activeTabPreSibling {\n &:after {\n display: none;\n }\n }\n\n a {\n font-size: 14px;\n color: ", ";//rgba(255,255,255,.6);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n transition: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n line-height: 36px;\n width: 100%;\n // &:hover {\n // color: rgba(255,255,255,.8);\n // }\n // .tnt-themeS1 & {\n // color: ", ";\n // }\n }\n\n &:hover,\n &.active {\n .tnt-icon[type=close] {\n display: unset;\n color: #455064;\n // .tnt-themeS1 & {\n // color: #455064;\n // }\n }\n }\n\n &.active {\n background: #F1F2F5;\n border-radius: 2px 2px 0 0;\n color: ", ";\n font-weight: 600;\n\n a {\n color: ", ";\n }\n }\n"]);
|
|
19
|
-
|
|
20
|
-
_templateObject3 = function _templateObject3() {
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function _templateObject2() {
|
|
28
|
-
var data = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform 0.25s linear;\n position: absolute;\n"]);
|
|
29
|
-
|
|
30
|
-
_templateObject2 = function _templateObject2() {
|
|
31
|
-
return data;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return data;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _templateObject() {
|
|
38
|
-
var data = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n overflow: hidden;\n position: relative;\n margin-right: 12px;\n margin-left: 4px;\n\n .tnt-layout-header-tabs-arrows {\n position: absolute;\n right: 0;\n bottom: 0;\n font-size: 16px;\n line-height: 36px;\n height: 36px;\n background: #fff !important;\n color: rgba(255,255,255,.8) !important;\n .tnt-icon {\n cursor: pointer;\n color: rgba(139,145,158,1);\n &[disabled] {\n color: rgba(139, 145, 158, .5);\n pointer-events: none;\n cursor: not-allowed;\n }\n }\n // background: #191D29;\n // .tnt-icon {\n // cursor: pointer;\n // &[disabled] {\n // color: rgba(139, 145, 158, .5);\n // pointer-events: none;\n // cursor: not-allowed;\n // }\n // }\n // .tnt-themeS1 & {\n // background: #fff;\n // .tnt-icon {\n // color: rgba(139,145,158,1);\n // }\n // }\n // \u591A\u7B7E\u9875\u7684\u7BAD\u5934\u6837\u5F0F\n // .tnt-themeS3 & {\n // background: ", "; //#1D4295;\n // .tnt-icon {\n // color: rgba(255, 255, 255, .5);\n // &[disabled] {\n // color: rgba(139, 145, 158, .5);\n // pointer-events: none;\n // cursor: not-allowed;\n // }\n // }\n // }\n }\n"]);
|
|
39
|
-
|
|
40
|
-
_templateObject = function _templateObject() {
|
|
41
|
-
return data;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
48
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["theme", "className", "tabs", "onTabChange", "onTabSelect", "onTabClose", "appListVisible", "orgListVisible", "orgAppListVisible", "language"];
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
49
17
|
import { useState, useEffect, useRef } from 'react';
|
|
50
18
|
import styled, { withTheme } from 'styled-components';
|
|
51
19
|
import cn from 'classnames';
|
|
52
20
|
import { get } from 'lodash';
|
|
53
21
|
import Icon from '../Icon';
|
|
54
|
-
var TabsContainer = styled.div(_templateObject(), function (props) {
|
|
22
|
+
var TabsContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1;\n overflow: hidden;\n position: relative;\n margin-right: 12px;\n margin-left: 4px;\n\n .tnt-layout-header-tabs-arrows {\n position: absolute;\n right: 0;\n bottom: 0;\n font-size: 16px;\n line-height: 36px;\n height: 36px;\n background: #fff !important;\n color: rgba(255,255,255,.8) !important;\n .tnt-icon {\n cursor: pointer;\n color: rgba(139,145,158,1);\n &[disabled] {\n color: rgba(139, 145, 158, .5);\n pointer-events: none;\n cursor: not-allowed;\n }\n }\n // background: #191D29;\n // .tnt-icon {\n // cursor: pointer;\n // &[disabled] {\n // color: rgba(139, 145, 158, .5);\n // pointer-events: none;\n // cursor: not-allowed;\n // }\n // }\n // .tnt-themeS1 & {\n // background: #fff;\n // .tnt-icon {\n // color: rgba(139,145,158,1);\n // }\n // }\n // \u591A\u7B7E\u9875\u7684\u7BAD\u5934\u6837\u5F0F\n // .tnt-themeS3 & {\n // background: ", "; //#1D4295;\n // .tnt-icon {\n // color: rgba(255, 255, 255, .5);\n // &[disabled] {\n // color: rgba(139, 145, 158, .5);\n // pointer-events: none;\n // cursor: not-allowed;\n // }\n // }\n // }\n }\n"])), function (props) {
|
|
55
23
|
return "".concat(props.theme.blueBgColor);
|
|
56
24
|
});
|
|
57
|
-
var Tabs = styled.ul(_templateObject2());
|
|
58
|
-
var TabItem = styled.li(_templateObject3(), function (props) {
|
|
25
|
+
var Tabs = styled.ul(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 14px 0 0;\n padding: 0;\n list-style: none;\n text-align: left;\n height: 36px;\n line-height: 36px;\n flex: 1;\n white-space: nowrap;\n padding-right: 40px;\n transition: transform 0.25s linear;\n position: absolute;\n"])));
|
|
26
|
+
var TabItem = styled.li(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n margin: 0;\n padding: 0 20px 0 10px;\n cursor: pointer;\n display: inline-block;\n line-height: ", ";\n /* transition: background-color .5; */\n width: 130px;\n color: rgba(255,255,255,.6);\n\n .tnt-icon[type=close] {\n display: none;\n position: absolute;\n right: 0;\n top: 0;\n font-size: 10px;\n padding: 0 10px;\n cursor: pointer;\n z-index: 1;\n }\n\n &:not(:last-child):after {\n position: absolute;\n content: \"\";\n right: 0;\n top: 6px;\n height: 24px;\n width: 1px;\n // opacity: .5;\n // background: #fff;\n background: #E1E6EE;\n opacity: .5;\n // .tnt-themeS1 & {\n // background: #E1E6EE;\n // opacity: 1;\n // }\n }\n\n &.active,\n &.activeTabPreSibling {\n &:after {\n display: none;\n }\n }\n\n a {\n font-size: 14px;\n color: ", ";//rgba(255,255,255,.6);\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n transition: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n line-height: 36px;\n width: 100%;\n // &:hover {\n // color: rgba(255,255,255,.8);\n // }\n // .tnt-themeS1 & {\n // color: ", ";\n // }\n }\n\n &:hover,\n &.active {\n .tnt-icon[type=close] {\n display: unset;\n color: #455064;\n // .tnt-themeS1 & {\n // color: #455064;\n // }\n }\n }\n\n &.active {\n background: #F1F2F5;\n border-radius: 2px 2px 0 0;\n color: ", ";\n font-weight: 600;\n\n a {\n color: ", ";\n }\n }\n"])), function (props) {
|
|
59
27
|
return props.theme.size === 'large' ? '46px' : '36px';
|
|
60
28
|
}, function (props) {
|
|
61
29
|
return props.theme.headerActionsColor;
|
|
@@ -68,56 +36,47 @@ var TabItem = styled.li(_templateObject3(), function (props) {
|
|
|
68
36
|
});
|
|
69
37
|
export var HeaderTabs = withTheme(function (_ref) {
|
|
70
38
|
var theme = _ref.theme,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
39
|
+
className = _ref.className,
|
|
40
|
+
_ref$tabs = _ref.tabs,
|
|
41
|
+
tabs = _ref$tabs === void 0 ? [] : _ref$tabs,
|
|
42
|
+
onTabChange = _ref.onTabChange,
|
|
43
|
+
onTabSelect = _ref.onTabSelect,
|
|
44
|
+
onTabClose = _ref.onTabClose,
|
|
45
|
+
appListVisible = _ref.appListVisible,
|
|
46
|
+
orgListVisible = _ref.orgListVisible,
|
|
47
|
+
orgAppListVisible = _ref.orgAppListVisible,
|
|
48
|
+
language = _ref.language,
|
|
49
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
83
50
|
var _useState = useState(props.selectedKey || get(tabs, '0.key')),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
selectedKey = _useState2[0],
|
|
53
|
+
setSelectedKey = _useState2[1];
|
|
88
54
|
var _useState3 = useState(tabs || []),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
tabItems = _useState4[0],
|
|
57
|
+
setTabItems = _useState4[1];
|
|
93
58
|
var _useState5 = useState(false),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
+
arrowVisible = _useState6[0],
|
|
61
|
+
setArrowVisible = _useState6[1];
|
|
98
62
|
var _useState7 = useState({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
63
|
+
start: true,
|
|
64
|
+
end: true
|
|
65
|
+
}),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
tabsPositionFlags = _useState8[0],
|
|
68
|
+
setTabsPositionFlags = _useState8[1];
|
|
106
69
|
var tabsRef = useRef();
|
|
107
|
-
|
|
108
70
|
var getTabsDom = function getTabsDom() {
|
|
109
71
|
return tabsRef.current;
|
|
110
72
|
};
|
|
111
|
-
|
|
112
73
|
var onTabClick = function onTabClick(tab, index) {
|
|
113
74
|
setSelectedKey(tab.key);
|
|
114
75
|
onTabSelect == null ? void 0 : onTabSelect(tab);
|
|
115
|
-
|
|
116
76
|
if (selectedKey !== tab.key) {
|
|
117
77
|
onTabChange == null ? void 0 : onTabChange(tab);
|
|
118
78
|
}
|
|
119
79
|
};
|
|
120
|
-
|
|
121
80
|
var closeTabHandle = function closeTabHandle(tab, index, evt) {
|
|
122
81
|
evt.stopPropagation();
|
|
123
82
|
var newTabItems = tabItems.filter(function (_ref2) {
|
|
@@ -126,20 +85,16 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
126
85
|
});
|
|
127
86
|
var newSelectedKey = selectedKey;
|
|
128
87
|
setTabItems(newTabItems);
|
|
129
|
-
|
|
130
88
|
if (tab.key === selectedKey) {
|
|
131
89
|
var _newTabItems$, _newTabItems;
|
|
132
|
-
|
|
133
90
|
newSelectedKey = index === 0 ? (_newTabItems$ = newTabItems[0]) == null ? void 0 : _newTabItems$.key : (_newTabItems = newTabItems[index - 1]) == null ? void 0 : _newTabItems.key;
|
|
134
91
|
setSelectedKey(newSelectedKey);
|
|
135
92
|
}
|
|
136
|
-
|
|
137
93
|
onTabClose == null ? void 0 : onTabClose(tab, newTabItems, newTabItems.find(function (_ref3) {
|
|
138
94
|
var key = _ref3.key;
|
|
139
95
|
return key === newSelectedKey;
|
|
140
96
|
}));
|
|
141
97
|
};
|
|
142
|
-
|
|
143
98
|
var onMoveToLeft = function onMoveToLeft() {
|
|
144
99
|
var tabsDom = getTabsDom();
|
|
145
100
|
var parentBBox = tabsDom.parentNode.getBoundingClientRect();
|
|
@@ -155,7 +110,6 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
155
110
|
end: Math.abs(newX) < width - parentWidth
|
|
156
111
|
});
|
|
157
112
|
};
|
|
158
|
-
|
|
159
113
|
var onMoveToRight = function onMoveToRight() {
|
|
160
114
|
var tabsDom = getTabsDom();
|
|
161
115
|
var parentBBox = tabsDom.parentNode.getBoundingClientRect();
|
|
@@ -171,7 +125,6 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
171
125
|
end: Math.abs(newX) < width - parentWidth
|
|
172
126
|
});
|
|
173
127
|
};
|
|
174
|
-
|
|
175
128
|
var translateTabsDom = function translateTabsDom(tabs, selectedKey) {
|
|
176
129
|
if (!selectedKey) return;
|
|
177
130
|
var index = tabs.indexOf(tabs.find(function (_ref4) {
|
|
@@ -189,19 +142,15 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
189
142
|
var parentWidth = parentBBox.width - 36;
|
|
190
143
|
var width = tabItems.length * 130;
|
|
191
144
|
var tailX = x + parentWidth; //当前滑动窗口尾部坐标
|
|
192
|
-
|
|
193
145
|
var newX = -x;
|
|
194
|
-
|
|
195
146
|
if (bbox.left < x) {
|
|
196
147
|
newX = -bbox.left;
|
|
197
148
|
} else if (bbox.right >= tailX) {
|
|
198
149
|
newX = parentWidth - bbox.right;
|
|
199
150
|
}
|
|
200
|
-
|
|
201
151
|
if (newX + width < parentWidth) {
|
|
202
152
|
newX = -(width - parentWidth);
|
|
203
153
|
}
|
|
204
|
-
|
|
205
154
|
newX = Math.min(0, newX);
|
|
206
155
|
tabsDom.style.transform = "translateX(".concat(newX, "px)");
|
|
207
156
|
setTabsPositionFlags({
|
|
@@ -209,7 +158,6 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
209
158
|
end: Math.abs(newX) < width - parentWidth
|
|
210
159
|
});
|
|
211
160
|
};
|
|
212
|
-
|
|
213
161
|
useEffect(function () {
|
|
214
162
|
setSelectedKey(props.selectedKey || get(tabs, '0.key'));
|
|
215
163
|
setTabItems(tabs);
|
|
@@ -222,15 +170,14 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
222
170
|
useEffect(function () {
|
|
223
171
|
translateTabsDom(tabItems, selectedKey);
|
|
224
172
|
}, [tabItems, selectedKey, appListVisible, orgListVisible, orgAppListVisible]);
|
|
225
|
-
return React.createElement(TabsContainer, _extends({}, props, {
|
|
173
|
+
return /*#__PURE__*/React.createElement(TabsContainer, _extends({}, props, {
|
|
226
174
|
className: cn('tnt-layout-header-tabs', _defineProperty({}, className, className))
|
|
227
|
-
}), React.createElement(Tabs, {
|
|
175
|
+
}), /*#__PURE__*/React.createElement(Tabs, {
|
|
228
176
|
className: "tnt-layout-header-tabs-content",
|
|
229
177
|
ref: tabsRef
|
|
230
178
|
}, tabItems.map(function (tab, index) {
|
|
231
179
|
var _tabItems;
|
|
232
|
-
|
|
233
|
-
return React.createElement(TabItem, {
|
|
180
|
+
return /*#__PURE__*/React.createElement(TabItem, {
|
|
234
181
|
key: tab.key,
|
|
235
182
|
theme: theme,
|
|
236
183
|
className: cn({
|
|
@@ -240,7 +187,7 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
240
187
|
onClick: function onClick() {
|
|
241
188
|
return onTabClick(tab, index);
|
|
242
189
|
}
|
|
243
|
-
}, React.createElement("a", {
|
|
190
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
244
191
|
href: tab.key,
|
|
245
192
|
onClick: function onClick(evt) {
|
|
246
193
|
return evt.preventDefault();
|
|
@@ -248,17 +195,17 @@ export var HeaderTabs = withTheme(function (_ref) {
|
|
|
248
195
|
}, {
|
|
249
196
|
cn: tab.name,
|
|
250
197
|
en: tab.enName || tab.name
|
|
251
|
-
}[language || 'cn']), tab.closable !== false && tabItems.length > 1 && React.createElement(Icon, {
|
|
198
|
+
}[language || 'cn']), tab.closable !== false && tabItems.length > 1 && /*#__PURE__*/React.createElement(Icon, {
|
|
252
199
|
type: "close",
|
|
253
200
|
onClick: closeTabHandle.bind(null, tab, index)
|
|
254
201
|
}));
|
|
255
|
-
})), arrowVisible && React.createElement("div", {
|
|
202
|
+
})), arrowVisible && /*#__PURE__*/React.createElement("div", {
|
|
256
203
|
className: "tnt-layout-header-tabs-arrows"
|
|
257
|
-
}, React.createElement(Icon, {
|
|
204
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
258
205
|
type: "left",
|
|
259
206
|
onClick: onMoveToLeft,
|
|
260
207
|
disabled: !tabsPositionFlags.start
|
|
261
|
-
}), React.createElement(Icon, {
|
|
208
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
262
209
|
type: "right",
|
|
263
210
|
onClick: onMoveToRight,
|
|
264
211
|
disabled: !tabsPositionFlags.end
|
package/es/Layout/Iconfont.js
CHANGED
package/es/Layout/Language.js
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
function _arrayWithHoles(
|
|
8
|
-
|
|
9
|
-
function _templateObject() {
|
|
10
|
-
var data = _taggedTemplateLiteral(["\n font-size: ", ";\n .tnt-icon {\n font-size: ", ";\n margin-right: 4px;\n }\n span {\n position: relative;\n font-size: ", ";\n top: ", ";\n font-family: auto;\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n }\n .isInIframe & {\n display: none;\n }\n"]);
|
|
11
|
-
|
|
12
|
-
_templateObject = function _templateObject() {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
20
|
-
|
|
1
|
+
var _templateObject;
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
21
9
|
import { useState } from 'react';
|
|
22
10
|
import styled, { withTheme } from 'styled-components';
|
|
23
11
|
import { get } from 'lodash';
|
|
@@ -34,7 +22,7 @@ var languagesMap = languages.reduce(function (acc, cur) {
|
|
|
34
22
|
acc[cur.value] = cur;
|
|
35
23
|
return acc;
|
|
36
24
|
}, {});
|
|
37
|
-
var Language = styled.li(_templateObject(), function (_ref) {
|
|
25
|
+
var Language = styled.li(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: ", ";\n .tnt-icon {\n font-size: ", ";\n margin-right: 4px;\n }\n span {\n position: relative;\n font-size: ", ";\n top: ", ";\n font-family: auto;\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n }\n .isInIframe & {\n display: none;\n }\n"])), function (_ref) {
|
|
38
26
|
var size = _ref.theme.size;
|
|
39
27
|
return size === 'large' ? '14px' : '12px';
|
|
40
28
|
}, function (_ref2) {
|
|
@@ -49,33 +37,27 @@ var Language = styled.li(_templateObject(), function (_ref) {
|
|
|
49
37
|
});
|
|
50
38
|
export default withTheme(function (props) {
|
|
51
39
|
var onChange = props.onChange;
|
|
52
|
-
|
|
53
40
|
var getLanguage = function getLanguage() {
|
|
54
41
|
var lang = getLanguageStore() || props.language;
|
|
55
|
-
|
|
56
42
|
if (!languagesMap[lang]) {
|
|
57
43
|
lang = get(languages, '0.value');
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
return lang;
|
|
61
46
|
};
|
|
62
|
-
|
|
63
47
|
var _useState = useState(getLanguage()),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
+
_useState2$ = _useState2[0],
|
|
50
|
+
language = _useState2$ === void 0 ? 'cn' : _useState2$,
|
|
51
|
+
setLanguage = _useState2[1];
|
|
69
52
|
var switchLanguage = function switchLanguage() {
|
|
70
53
|
var lang = language === 'cn' ? 'en' : 'cn';
|
|
71
54
|
setLanguage(lang);
|
|
72
55
|
setLanguageStore(lang);
|
|
73
56
|
onChange && onChange(lang);
|
|
74
57
|
};
|
|
75
|
-
|
|
76
|
-
return React.createElement(Language, {
|
|
58
|
+
return /*#__PURE__*/React.createElement(Language, {
|
|
77
59
|
onClick: switchLanguage
|
|
78
|
-
}, React.createElement(Iconfont, {
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
79
61
|
type: "flag-".concat(language)
|
|
80
|
-
}), React.createElement("span", null, get(languagesMap[language], 'name')));
|
|
62
|
+
}), /*#__PURE__*/React.createElement("span", null, get(languagesMap[language], 'name')));
|
|
81
63
|
});
|