tntd 1.4.20 → 1.4.21
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/Handle/README.md +0 -20
- package/components/Handle/index.js +27 -6
- package/components/locale.js +8 -2
- package/dist/1.tntd.js +1 -1
- package/dist/stats.json +23819 -24067
- package/dist/tntd.css +1 -1
- package/dist/tntd.js +13 -8
- package/es/ArrayInput/icon.js +5 -5
- package/es/ArrayInput/index.js +108 -76
- package/es/AuthContext.js +1 -1
- package/es/Columns/index.js +38 -31
- package/es/DevelopmentLogin/LoginModal.js +45 -32
- package/es/DevelopmentLogin/index.js +17 -13
- package/es/Ellipsis/Svg/CopySVG.js +13 -13
- package/es/Ellipsis/Svg/TickSVG.js +8 -8
- package/es/Ellipsis/index.js +69 -58
- package/es/Handle/README.md +0 -20
- package/es/Handle/index.js +67 -32
- package/es/Icon/fonts/iconfont.js +12 -7
- package/es/Icon/index.js +13 -10
- package/es/Img/Contain.js +29 -24
- package/es/Img/Cover.js +54 -40
- package/es/Img/index.js +45 -36
- package/es/Layout/ActionsContext.js +2 -3
- package/es/Layout/AppList.js +92 -37
- package/es/Layout/Application.js +72 -26
- package/es/Layout/Avatar.js +66 -29
- package/es/Layout/CompatibleLanguage.js +94 -39
- package/es/Layout/EnterpriseLayout/Avatar.js +76 -38
- package/es/Layout/EnterpriseLayout/Language.js +32 -14
- package/es/Layout/EnterpriseLayout/Theme.js +34 -16
- package/es/Layout/EnterpriseLayout/index.js +16 -14
- package/es/Layout/GlobalNavigation/NavigationPopup.js +170 -59
- package/es/Layout/GlobalNavigation/index.js +54 -20
- package/es/Layout/Header.js +46 -25
- package/es/Layout/HeaderActions.js +56 -42
- package/es/Layout/HeaderNavs.js +47 -20
- package/es/Layout/HeaderTabs.js +102 -49
- package/es/Layout/Iconfont.js +1 -1
- package/es/Layout/Language.js +32 -14
- package/es/Layout/Layout.js +108 -86
- package/es/Layout/Logo.js +32 -16
- package/es/Layout/OrgAppList.js +107 -62
- package/es/Layout/SideMenu.js +124 -63
- package/es/Layout/Theme.js +61 -23
- package/es/Layout/checkAuth.js +29 -0
- package/es/Layout/index.js +34 -26
- package/es/Layout/paaslayout/CompactSideMenu.js +74 -35
- package/es/Layout/paaslayout/Header.js +45 -22
- package/es/Layout/paaslayout/Logo.js +13 -3
- package/es/Layout/paaslayout/SideMenu.js +78 -39
- package/es/Layout/paaslayout/index.js +102 -75
- package/es/Layout/storage.js +9 -10
- package/es/Layout/utils.js +136 -0
- package/es/LoadingButton/index.js +24 -15
- package/es/Modal/index.js +46 -38
- package/es/Page/Box.js +41 -34
- package/es/Page/index.js +67 -52
- package/es/Page/utils.js +5 -0
- package/es/QueryForm/Field/Checkbox.js +9 -5
- package/es/QueryForm/Field/Select.js +41 -31
- package/es/QueryForm/Field/SelectInput.js +41 -26
- package/es/QueryForm/Field/fieldsMap.js +1 -0
- package/es/QueryForm/Field/index.js +71 -41
- package/es/QueryForm/createActions.js +7 -6
- package/es/QueryForm/index.js +135 -76
- package/es/QueryListScene/List.js +128 -74
- package/es/QueryListScene/QueryForm.js +81 -46
- package/es/QueryListScene/QueryListScene.js +40 -25
- package/es/QueryListScene/Title.js +3 -3
- package/es/QueryListScene/Toolbar.js +12 -11
- package/es/Select/DropDownWrap.js +50 -29
- package/es/Select/index.js +231 -135
- package/es/Table/ResizableTable/index.js +40 -26
- package/es/Table/index.js +16 -18
- package/es/Title/index.js +23 -21
- package/es/locale.js +11 -3
- package/es/utils/checkAuth.js +5 -3
- package/es/utils/findMenuInfoByPath.js +4 -0
- package/es/utils/index.js +23 -12
- package/lib/ArrayInput/icon.js +6 -6
- package/lib/ArrayInput/index.js +127 -78
- package/lib/AuthContext.js +4 -1
- package/lib/Columns/index.js +47 -31
- package/lib/DevelopmentLogin/LoginModal.js +58 -32
- package/lib/DevelopmentLogin/index.js +27 -16
- package/lib/Ellipsis/Svg/CopySVG.js +15 -13
- package/lib/Ellipsis/Svg/TickSVG.js +10 -8
- package/lib/Ellipsis/index.js +80 -57
- package/lib/Handle/README.md +0 -20
- package/lib/Handle/index.js +80 -32
- package/lib/Icon/fonts/iconfont.js +12 -7
- package/lib/Icon/index.js +20 -11
- package/lib/Img/Contain.js +34 -24
- package/lib/Img/Cover.js +65 -42
- package/lib/Img/index.js +51 -36
- package/lib/Layout/ActionsContext.js +4 -1
- package/lib/Layout/AppList.js +118 -40
- package/lib/Layout/Application.js +86 -26
- package/lib/Layout/Avatar.js +86 -32
- package/lib/Layout/CompatibleLanguage.js +110 -39
- package/lib/Layout/EnterpriseLayout/Avatar.js +100 -41
- package/lib/Layout/EnterpriseLayout/Header.js +113 -0
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
- package/lib/Layout/EnterpriseLayout/Language.js +48 -17
- package/lib/Layout/EnterpriseLayout/Theme.js +44 -16
- package/lib/Layout/EnterpriseLayout/index.js +23 -14
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +186 -59
- package/lib/Layout/GlobalNavigation/index.js +74 -23
- package/lib/Layout/Header.js +63 -28
- package/lib/Layout/HeaderActions.js +74 -45
- package/lib/Layout/HeaderNavs.js +61 -23
- package/lib/Layout/HeaderTabs.js +118 -51
- package/lib/Layout/Iconfont.js +5 -1
- package/lib/Layout/Language.js +48 -17
- package/lib/Layout/Layout.js +128 -88
- package/lib/Layout/Logo.js +43 -19
- package/lib/Layout/OrgAppList.js +127 -64
- package/lib/Layout/SideMenu.js +143 -65
- package/lib/Layout/Theme.js +73 -23
- package/lib/Layout/checkAuth.js +39 -0
- package/lib/Layout/createActions.js +5 -0
- package/lib/Layout/images/index.js +28 -0
- package/lib/Layout/index.js +55 -30
- package/lib/Layout/paaslayout/CompactSideMenu.js +84 -35
- package/lib/Layout/paaslayout/Header.js +55 -22
- package/lib/Layout/paaslayout/Logo.js +19 -3
- package/lib/Layout/paaslayout/SideMenu.js +87 -39
- package/lib/Layout/paaslayout/index.js +122 -77
- package/lib/Layout/storage.js +40 -11
- package/lib/Layout/utils.js +166 -0
- package/lib/LoadingButton/index.js +29 -15
- package/lib/Modal/index.js +53 -38
- package/lib/Page/Box.js +45 -34
- package/lib/Page/index.js +77 -52
- package/lib/Page/utils.js +9 -1
- package/lib/QueryForm/Field/Checkbox.js +13 -5
- package/lib/QueryForm/Field/Select.js +53 -33
- package/lib/QueryForm/Field/SelectInput.js +56 -28
- package/lib/QueryForm/Field/fieldsMap.js +15 -1
- package/lib/QueryForm/Field/index.js +81 -43
- package/lib/QueryForm/createActions.js +12 -6
- package/lib/QueryForm/index.js +157 -78
- package/lib/QueryForm/useForm.js +5 -0
- package/lib/QueryListScene/List.js +140 -76
- package/lib/QueryListScene/QueryForm.js +86 -46
- package/lib/QueryListScene/QueryListScene.js +46 -25
- package/lib/QueryListScene/Title.js +7 -3
- package/lib/QueryListScene/Toolbar.js +16 -11
- package/lib/QueryListScene/createActions.js +5 -0
- package/lib/QueryListScene/index.js +10 -0
- package/lib/QueryListScene/useActions.js +5 -0
- package/lib/Select/DropDownWrap.js +56 -31
- package/lib/Select/index.js +241 -135
- package/lib/Table/ResizableTable/index.js +48 -26
- package/lib/Table/index.js +28 -17
- package/lib/Title/index.js +28 -21
- package/lib/index.js +56 -35
- package/lib/locale.js +19 -4
- package/lib/utils/checkAuth.js +9 -4
- package/lib/utils/findMenuInfoByPath.js +8 -1
- package/lib/utils/index.js +42 -15
- package/package.json +2 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
|
4
|
+
|
|
5
|
+
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
|
6
|
+
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
8
|
+
|
|
9
|
+
export var isGroupMenu = function isGroupMenu(menu) {
|
|
10
|
+
return (menu == null ? void 0 : menu.children) && !(menu == null ? void 0 : menu.path);
|
|
11
|
+
};
|
|
12
|
+
export var getSelectedMenuInfo = function getSelectedMenuInfo(selectedKey) {
|
|
13
|
+
var menus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
14
|
+
var subMenu;
|
|
15
|
+
var menu;
|
|
16
|
+
var parentMenus = [];
|
|
17
|
+
|
|
18
|
+
if (selectedKey) {
|
|
19
|
+
traverseTree(menus, function (node, pnode, pnodes) {
|
|
20
|
+
if (!isGroupMenu(node) && node.code === selectedKey) {
|
|
21
|
+
subMenu = node;
|
|
22
|
+
menu = pnode;
|
|
23
|
+
parentMenus = pnodes;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
// 默认找到第一个菜单项
|
|
29
|
+
traverseTree(menus, function (node, pnode, pnodes) {
|
|
30
|
+
if (!isGroupMenu(node)) {
|
|
31
|
+
subMenu = node;
|
|
32
|
+
menu = pnode;
|
|
33
|
+
parentMenus = pnodes;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
subMenu: subMenu,
|
|
41
|
+
menu: menu,
|
|
42
|
+
parentMenus: parentMenus
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export var findMenuInfoByPath = function findMenuInfoByPath(menuTree, path, matchFunc) {
|
|
46
|
+
var menu;
|
|
47
|
+
var subMenu;
|
|
48
|
+
var matchedSubMenu;
|
|
49
|
+
var parentMenus;
|
|
50
|
+
|
|
51
|
+
if (path) {
|
|
52
|
+
traverseTree(menuTree, function (menu, pnode, pnodes) {
|
|
53
|
+
if (!isGroupMenu(menu)) {
|
|
54
|
+
var _menu;
|
|
55
|
+
|
|
56
|
+
if (((_menu = menu) == null ? void 0 : _menu.path) === path) {
|
|
57
|
+
subMenu = menu;
|
|
58
|
+
menu = pnode;
|
|
59
|
+
parentMenus = pnodes;
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
|
|
64
|
+
matchedSubMenu = menu;
|
|
65
|
+
menu = pnode;
|
|
66
|
+
parentMenus = pnodes;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
subMenu: subMenu,
|
|
72
|
+
matchedSubMenu: matchedSubMenu,
|
|
73
|
+
menu: menu,
|
|
74
|
+
parentMenus: parentMenus
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
subMenu: subMenu,
|
|
80
|
+
menu: menu,
|
|
81
|
+
parentMenus: parentMenus
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export var hasLevel3 = function hasLevel3(menus) {
|
|
85
|
+
return menus == null ? void 0 : menus.some(function (menu) {
|
|
86
|
+
var _menu$children;
|
|
87
|
+
|
|
88
|
+
return menu == null ? void 0 : (_menu$children = menu.children) == null ? void 0 : _menu$children.some(function (item) {
|
|
89
|
+
var _item$children;
|
|
90
|
+
|
|
91
|
+
return item == null ? void 0 : (_item$children = item.children) == null ? void 0 : _item$children.length;
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
export var isNewTabMenu = function isNewTabMenu(menu) {
|
|
96
|
+
var _ref = menu || {},
|
|
97
|
+
target = _ref.target,
|
|
98
|
+
path = _ref.path;
|
|
99
|
+
|
|
100
|
+
return target === '_blank' || /^http/i.test(path) && /blankType=newTarget/.test(path);
|
|
101
|
+
};
|
|
102
|
+
export var openInNewTab = function openInNewTab(path) {
|
|
103
|
+
window.open(path, '_blank');
|
|
104
|
+
};
|
|
105
|
+
export var traverseTree = function traverseTree(treeData, callback, pnode) {
|
|
106
|
+
var pnodes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
107
|
+
(treeData || []).every(function (node, index) {
|
|
108
|
+
var result;
|
|
109
|
+
|
|
110
|
+
if (callback) {
|
|
111
|
+
result = callback(node, pnode, (pnodes == null ? void 0 : pnodes.length) ? pnodes : [pnode].filter(function (item) {
|
|
112
|
+
return !!item;
|
|
113
|
+
}), index);
|
|
114
|
+
} // 回调函数返回false则终止遍历
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if (result !== false) {
|
|
118
|
+
node && traverseTree(node.children || [], callback, node, [node].concat(_toConsumableArray(pnodes)));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result !== false;
|
|
122
|
+
});
|
|
123
|
+
return treeData;
|
|
124
|
+
};
|
|
125
|
+
export var safeParseJSON = function safeParseJSON(str, defaultObj) {
|
|
126
|
+
var result;
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
result = JSON.parse(str);
|
|
130
|
+
} catch (err) {
|
|
131
|
+
console.warn('json parse error:', err);
|
|
132
|
+
result = typeof defaultObj === 'undefined' ? str : defaultObj;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return result || defaultObj;
|
|
136
|
+
};
|
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
import "antd/lib/button/style";
|
|
2
2
|
import _Button from "antd/lib/button";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
3
|
+
|
|
4
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
5
|
+
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
7
|
+
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
10
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
|
|
11
14
|
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; }
|
|
15
|
+
|
|
12
16
|
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; }
|
|
17
|
+
|
|
13
18
|
import { useState, useEffect } from "react";
|
|
14
19
|
export default (function (_ref) {
|
|
15
20
|
var loadingText = _ref.loadingText,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
pLoading = _ref.loading,
|
|
22
|
+
onClick = _ref.onClick,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
otherProps = _objectWithoutProperties(_ref, ["loadingText", "loading", "onClick", "children"]);
|
|
25
|
+
|
|
20
26
|
var _useState = useState(pLoading),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
loading = _useState2[0],
|
|
29
|
+
setLoading = _useState2[1];
|
|
30
|
+
|
|
24
31
|
var doClick = function doClick(evt) {
|
|
25
32
|
if (!loading) {
|
|
26
33
|
setLoading(true);
|
|
27
34
|
var returnVal = onClick && onClick(evt, function () {
|
|
28
35
|
return setLoading(false);
|
|
29
36
|
});
|
|
37
|
+
|
|
30
38
|
if (returnVal instanceof Promise) {
|
|
31
39
|
returnVal.then(function () {
|
|
32
40
|
return setLoading(false);
|
|
@@ -36,10 +44,11 @@ export default (function (_ref) {
|
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
};
|
|
47
|
+
|
|
39
48
|
useEffect(function () {
|
|
40
49
|
setLoading(pLoading);
|
|
41
50
|
}, [pLoading]);
|
|
42
|
-
return
|
|
51
|
+
return React.createElement(_Button, _extends({}, otherProps, {
|
|
43
52
|
loading: loading,
|
|
44
53
|
onClick: doClick
|
|
45
54
|
}), loading ? loadingText || children : children);
|
package/es/Modal/index.js
CHANGED
|
@@ -1,70 +1,78 @@
|
|
|
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); }
|
|
2
1
|
import "antd/lib/modal/style";
|
|
3
2
|
import _Modal from "antd/lib/modal";
|
|
4
|
-
|
|
5
|
-
function _extends() { _extends = Object.assign
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
function _iterableToArrayLimit(arr, i) {
|
|
3
|
+
|
|
4
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
5
|
+
|
|
6
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
|
|
15
16
|
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; }
|
|
17
|
+
|
|
16
18
|
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; }
|
|
19
|
+
|
|
17
20
|
import { useState, useEffect, Fragment } from 'react';
|
|
18
21
|
import cn from 'classnames';
|
|
19
22
|
import Icon from '../Icon';
|
|
20
23
|
import './index.less';
|
|
24
|
+
|
|
21
25
|
var Title = function Title(_ref) {
|
|
22
26
|
var title = _ref.title,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return
|
|
27
|
+
logo = _ref.logo,
|
|
28
|
+
fullscreen = _ref.fullscreen,
|
|
29
|
+
_ref$supportFullscree = _ref.supportFullscreen,
|
|
30
|
+
supportFullscreen = _ref$supportFullscree === void 0 ? true : _ref$supportFullscree,
|
|
31
|
+
onToggleFullscreen = _ref.onToggleFullscreen,
|
|
32
|
+
onClose = _ref.onClose;
|
|
33
|
+
return React.createElement(Fragment, null, React.createElement("div", null, logo && React.createElement("img", {
|
|
30
34
|
src: logo
|
|
31
|
-
}),
|
|
35
|
+
}), React.createElement("span", null, title)), React.createElement("div", {
|
|
32
36
|
className: "tnt-modal-header-actions"
|
|
33
|
-
}, supportFullscreen &&
|
|
37
|
+
}, supportFullscreen && React.createElement(Icon, {
|
|
34
38
|
className: "fullscreen",
|
|
35
39
|
type: fullscreen ? 'fullscreen-exit' : 'fullscreen',
|
|
36
40
|
onClick: onToggleFullscreen
|
|
37
|
-
}),
|
|
41
|
+
}), React.createElement(Icon, {
|
|
38
42
|
className: "close",
|
|
39
43
|
type: "close",
|
|
40
44
|
onClick: onClose
|
|
41
45
|
})));
|
|
42
46
|
};
|
|
47
|
+
|
|
43
48
|
export default (function (props) {
|
|
44
49
|
var _cn;
|
|
50
|
+
|
|
45
51
|
var visible = props.visible,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
children = props.children,
|
|
53
|
+
logo = props.logo,
|
|
54
|
+
title = props.title,
|
|
55
|
+
_props$height = props.height,
|
|
56
|
+
height = _props$height === void 0 ? '90vh' : _props$height,
|
|
57
|
+
_props$width = props.width,
|
|
58
|
+
width = _props$width === void 0 ? '85%' : _props$width,
|
|
59
|
+
className = props.className,
|
|
60
|
+
supportFullscreen = props.supportFullscreen,
|
|
61
|
+
_onToggleFullscreen = props.onToggleFullscreen,
|
|
62
|
+
onCancel = props.onCancel,
|
|
63
|
+
rest = _objectWithoutProperties(props, ["visible", "children", "logo", "title", "height", "width", "className", "supportFullscreen", "onToggleFullscreen", "onCancel"]);
|
|
64
|
+
|
|
58
65
|
var _useState = useState(rest.fullscreen || false),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
fullscreen = _useState2[0],
|
|
68
|
+
setFullscreen = _useState2[1];
|
|
69
|
+
|
|
62
70
|
useEffect(function () {
|
|
63
71
|
setFullscreen(rest.fullscreen);
|
|
64
72
|
}, [rest.fullscreen, visible]);
|
|
65
|
-
return
|
|
73
|
+
return React.createElement(_Modal, _extends({
|
|
66
74
|
visible: visible,
|
|
67
|
-
title:
|
|
75
|
+
title: React.createElement(Title, {
|
|
68
76
|
logo: logo,
|
|
69
77
|
title: title,
|
|
70
78
|
fullscreen: fullscreen,
|
package/es/Page/Box.js
CHANGED
|
@@ -1,62 +1,68 @@
|
|
|
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); }
|
|
2
1
|
import "antd/lib/card/style";
|
|
3
2
|
import _Card from "antd/lib/card";
|
|
4
|
-
|
|
5
|
-
function _extends() { _extends = Object.assign
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
3
|
+
|
|
4
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
11
12
|
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; }
|
|
13
|
+
|
|
12
14
|
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; }
|
|
15
|
+
|
|
13
16
|
import React from 'react';
|
|
14
17
|
import { addUnitForValue } from './utils';
|
|
18
|
+
|
|
15
19
|
var Box = function Box(_ref) {
|
|
16
20
|
var inLayout = _ref.inLayout,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
_ref$clsPrefix = _ref.clsPrefix,
|
|
22
|
+
clsPrefix = _ref$clsPrefix === void 0 ? 'tnt-page' : _ref$clsPrefix,
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
_ref$noPadding = _ref.noPadding,
|
|
25
|
+
noPadding = _ref$noPadding === void 0 ? false : _ref$noPadding,
|
|
26
|
+
headerHeight = _ref.headerHeight,
|
|
27
|
+
_ref$bordered = _ref.bordered,
|
|
28
|
+
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
29
|
+
_ref$bodyStyle = _ref.bodyStyle,
|
|
30
|
+
bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
|
|
31
|
+
_ref$headStyle = _ref.headStyle,
|
|
32
|
+
headStyle = _ref$headStyle === void 0 ? {} : _ref$headStyle,
|
|
33
|
+
height = _ref.height,
|
|
34
|
+
_ref$size = _ref.size,
|
|
35
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
36
|
+
_ref$contentTotalMarg = _ref.contentTotalMargin,
|
|
37
|
+
contentTotalMargin = _ref$contentTotalMarg === void 0 ? '0px' : _ref$contentTotalMarg,
|
|
38
|
+
restProps = _objectWithoutProperties(_ref, ["inLayout", "clsPrefix", "children", "noPadding", "headerHeight", "bordered", "bodyStyle", "headStyle", "height", "size", "contentTotalMargin"]);
|
|
39
|
+
|
|
35
40
|
var cardTitleHeight = 0;
|
|
36
41
|
console.log('inLayout', inLayout);
|
|
37
42
|
console.log('restProps', restProps);
|
|
43
|
+
|
|
38
44
|
if (restProps.title) {
|
|
39
45
|
// 根据Card的size,计算Card的title的高度值
|
|
40
|
-
cardTitleHeight = size === 'small' ? 40 : 60;
|
|
41
|
-
|
|
46
|
+
cardTitleHeight = size === 'small' ? 40 : 60; // 如果Card的自定义高度,Card的title就使用此高度
|
|
47
|
+
|
|
42
48
|
if (headStyle.hasOwnProperty(height)) {
|
|
43
49
|
cardTitleHeight = headStyle.height;
|
|
44
50
|
}
|
|
45
|
-
}
|
|
51
|
+
} // 如果设置了noPadding,优先级最高
|
|
52
|
+
|
|
46
53
|
|
|
47
|
-
// 如果设置了noPadding,优先级最高
|
|
48
54
|
if (noPadding) {
|
|
49
55
|
bodyStyle.padding = 0;
|
|
50
56
|
headStyle.padding = 0;
|
|
51
|
-
}
|
|
57
|
+
} // 如果传入只有数字,需要默认加px
|
|
58
|
+
|
|
52
59
|
|
|
53
|
-
// 如果传入只有数字,需要默认加px
|
|
54
60
|
cardTitleHeight = addUnitForValue(cardTitleHeight);
|
|
55
61
|
var cardBodyHeight = "calc(".concat(height, " - ").concat(headerHeight, " - ").concat(contentTotalMargin, " - ").concat(cardTitleHeight, ")");
|
|
56
|
-
return
|
|
62
|
+
return React.createElement(_Card, _extends({
|
|
57
63
|
className: "".concat(clsPrefix, "-box-card"),
|
|
58
64
|
bordered: bordered,
|
|
59
|
-
bodyStyle: _objectSpread(
|
|
65
|
+
bodyStyle: _objectSpread({}, bodyStyle, {
|
|
60
66
|
// overflow: 'auto',
|
|
61
67
|
height: inLayout ? "calc(100% - ".concat(headerHeight, ")") : cardBodyHeight
|
|
62
68
|
}),
|
|
@@ -64,4 +70,5 @@ var Box = function Box(_ref) {
|
|
|
64
70
|
headStyle: headStyle
|
|
65
71
|
}, restProps), children);
|
|
66
72
|
};
|
|
73
|
+
|
|
67
74
|
export default Box;
|