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/Modal/index.js
CHANGED
|
@@ -1,78 +1,70 @@
|
|
|
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/modal/style";
|
|
2
3
|
import _Modal from "antd/lib/modal";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function _iterableToArrayLimit(arr, i) {
|
|
13
|
-
|
|
4
|
+
var _excluded = ["visible", "children", "logo", "title", "height", "width", "className", "supportFullscreen", "onToggleFullscreen", "onCancel"];
|
|
5
|
+
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
|
+
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
|
|
16
15
|
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
|
-
|
|
18
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; }
|
|
19
|
-
|
|
20
17
|
import { useState, useEffect, Fragment } from 'react';
|
|
21
18
|
import cn from 'classnames';
|
|
22
19
|
import Icon from '../Icon';
|
|
23
20
|
import './index.less';
|
|
24
|
-
|
|
25
21
|
var Title = function Title(_ref) {
|
|
26
22
|
var title = _ref.title,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return React.createElement(Fragment, null, React.createElement("div", null, logo && React.createElement("img", {
|
|
23
|
+
logo = _ref.logo,
|
|
24
|
+
fullscreen = _ref.fullscreen,
|
|
25
|
+
_ref$supportFullscree = _ref.supportFullscreen,
|
|
26
|
+
supportFullscreen = _ref$supportFullscree === void 0 ? true : _ref$supportFullscree,
|
|
27
|
+
onToggleFullscreen = _ref.onToggleFullscreen,
|
|
28
|
+
onClose = _ref.onClose;
|
|
29
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, logo && /*#__PURE__*/React.createElement("img", {
|
|
34
30
|
src: logo
|
|
35
|
-
}), React.createElement("span", null, title)), React.createElement("div", {
|
|
31
|
+
}), /*#__PURE__*/React.createElement("span", null, title)), /*#__PURE__*/React.createElement("div", {
|
|
36
32
|
className: "tnt-modal-header-actions"
|
|
37
|
-
}, supportFullscreen && React.createElement(Icon, {
|
|
33
|
+
}, supportFullscreen && /*#__PURE__*/React.createElement(Icon, {
|
|
38
34
|
className: "fullscreen",
|
|
39
35
|
type: fullscreen ? 'fullscreen-exit' : 'fullscreen',
|
|
40
36
|
onClick: onToggleFullscreen
|
|
41
|
-
}), React.createElement(Icon, {
|
|
37
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
42
38
|
className: "close",
|
|
43
39
|
type: "close",
|
|
44
40
|
onClick: onClose
|
|
45
41
|
})));
|
|
46
42
|
};
|
|
47
|
-
|
|
48
43
|
export default (function (props) {
|
|
49
44
|
var _cn;
|
|
50
|
-
|
|
51
45
|
var visible = props.visible,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
children = props.children,
|
|
47
|
+
logo = props.logo,
|
|
48
|
+
title = props.title,
|
|
49
|
+
_props$height = props.height,
|
|
50
|
+
height = _props$height === void 0 ? '90vh' : _props$height,
|
|
51
|
+
_props$width = props.width,
|
|
52
|
+
width = _props$width === void 0 ? '85%' : _props$width,
|
|
53
|
+
className = props.className,
|
|
54
|
+
supportFullscreen = props.supportFullscreen,
|
|
55
|
+
_onToggleFullscreen = props.onToggleFullscreen,
|
|
56
|
+
onCancel = props.onCancel,
|
|
57
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
65
58
|
var _useState = useState(rest.fullscreen || false),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
fullscreen = _useState2[0],
|
|
61
|
+
setFullscreen = _useState2[1];
|
|
70
62
|
useEffect(function () {
|
|
71
63
|
setFullscreen(rest.fullscreen);
|
|
72
64
|
}, [rest.fullscreen, visible]);
|
|
73
|
-
return React.createElement(_Modal, _extends({
|
|
65
|
+
return /*#__PURE__*/React.createElement(_Modal, _extends({
|
|
74
66
|
visible: visible,
|
|
75
|
-
title: React.createElement(Title, {
|
|
67
|
+
title: /*#__PURE__*/React.createElement(Title, {
|
|
76
68
|
logo: logo,
|
|
77
69
|
title: title,
|
|
78
70
|
fullscreen: fullscreen,
|
package/es/Page/Box.js
CHANGED
|
@@ -1,68 +1,62 @@
|
|
|
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/card/style";
|
|
2
3
|
import _Card from "antd/lib/card";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
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
|
-
|
|
4
|
+
var _excluded = ["inLayout", "clsPrefix", "children", "noPadding", "headerHeight", "bordered", "bodyStyle", "headStyle", "height", "size", "contentTotalMargin"];
|
|
5
|
+
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
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
12
11
|
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
|
-
|
|
14
12
|
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
|
-
|
|
16
13
|
import React from 'react';
|
|
17
14
|
import { addUnitForValue } from './utils';
|
|
18
|
-
|
|
19
15
|
var Box = function Box(_ref) {
|
|
20
16
|
var inLayout = _ref.inLayout,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
_ref$clsPrefix = _ref.clsPrefix,
|
|
18
|
+
clsPrefix = _ref$clsPrefix === void 0 ? 'tnt-page' : _ref$clsPrefix,
|
|
19
|
+
children = _ref.children,
|
|
20
|
+
_ref$noPadding = _ref.noPadding,
|
|
21
|
+
noPadding = _ref$noPadding === void 0 ? false : _ref$noPadding,
|
|
22
|
+
headerHeight = _ref.headerHeight,
|
|
23
|
+
_ref$bordered = _ref.bordered,
|
|
24
|
+
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
25
|
+
_ref$bodyStyle = _ref.bodyStyle,
|
|
26
|
+
bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
|
|
27
|
+
_ref$headStyle = _ref.headStyle,
|
|
28
|
+
headStyle = _ref$headStyle === void 0 ? {} : _ref$headStyle,
|
|
29
|
+
height = _ref.height,
|
|
30
|
+
_ref$size = _ref.size,
|
|
31
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
32
|
+
_ref$contentTotalMarg = _ref.contentTotalMargin,
|
|
33
|
+
contentTotalMargin = _ref$contentTotalMarg === void 0 ? '0px' : _ref$contentTotalMarg,
|
|
34
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
35
|
var cardTitleHeight = 0;
|
|
41
36
|
console.log('inLayout', inLayout);
|
|
42
37
|
console.log('restProps', restProps);
|
|
43
|
-
|
|
44
38
|
if (restProps.title) {
|
|
45
39
|
// 根据Card的size,计算Card的title的高度值
|
|
46
|
-
cardTitleHeight = size === 'small' ? 40 : 60;
|
|
47
|
-
|
|
40
|
+
cardTitleHeight = size === 'small' ? 40 : 60;
|
|
41
|
+
// 如果Card的自定义高度,Card的title就使用此高度
|
|
48
42
|
if (headStyle.hasOwnProperty(height)) {
|
|
49
43
|
cardTitleHeight = headStyle.height;
|
|
50
44
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
45
|
+
}
|
|
53
46
|
|
|
47
|
+
// 如果设置了noPadding,优先级最高
|
|
54
48
|
if (noPadding) {
|
|
55
49
|
bodyStyle.padding = 0;
|
|
56
50
|
headStyle.padding = 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
51
|
+
}
|
|
59
52
|
|
|
53
|
+
// 如果传入只有数字,需要默认加px
|
|
60
54
|
cardTitleHeight = addUnitForValue(cardTitleHeight);
|
|
61
55
|
var cardBodyHeight = "calc(".concat(height, " - ").concat(headerHeight, " - ").concat(contentTotalMargin, " - ").concat(cardTitleHeight, ")");
|
|
62
|
-
return React.createElement(_Card, _extends({
|
|
56
|
+
return /*#__PURE__*/React.createElement(_Card, _extends({
|
|
63
57
|
className: "".concat(clsPrefix, "-box-card"),
|
|
64
58
|
bordered: bordered,
|
|
65
|
-
bodyStyle: _objectSpread({}, bodyStyle, {
|
|
59
|
+
bodyStyle: _objectSpread(_objectSpread({}, bodyStyle), {}, {
|
|
66
60
|
// overflow: 'auto',
|
|
67
61
|
height: inLayout ? "calc(100% - ".concat(headerHeight, ")") : cardBodyHeight
|
|
68
62
|
}),
|
|
@@ -70,5 +64,4 @@ var Box = function Box(_ref) {
|
|
|
70
64
|
headStyle: headStyle
|
|
71
65
|
}, restProps), children);
|
|
72
66
|
};
|
|
73
|
-
|
|
74
67
|
export default Box;
|
package/es/Page/index.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
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; } }
|
|
16
|
-
|
|
17
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
18
|
-
|
|
1
|
+
var _excluded = ["height", "headerHeight", "children", "title", "goBack", "goBackText", "center", "extra", "size", "inLayout", "className"];
|
|
2
|
+
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); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
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); }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
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; }
|
|
14
|
+
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); }
|
|
19
15
|
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; }
|
|
20
|
-
|
|
21
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; }
|
|
22
|
-
|
|
23
17
|
import React from 'react';
|
|
24
18
|
import cn from 'classnames';
|
|
25
19
|
import Icon from '../Icon';
|
|
@@ -27,59 +21,54 @@ import { computeWidth, addUnitForValue } from './utils';
|
|
|
27
21
|
import Box from './Box';
|
|
28
22
|
import './index.less';
|
|
29
23
|
var clsPrefix = 'tnt-page';
|
|
30
|
-
|
|
31
24
|
var isPageBox = function isPageBox(child) {
|
|
32
25
|
var _child$props;
|
|
33
|
-
|
|
34
26
|
return (child == null ? void 0 : child.type) === Box || (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.pageBox);
|
|
35
27
|
};
|
|
36
|
-
|
|
37
28
|
var PageLayout = function PageLayout(_ref) {
|
|
38
29
|
var _childrenToArray, _childrenToArray$filt, _childrenToArray2, _cn;
|
|
39
|
-
|
|
40
30
|
var _ref$height = _ref.height,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
31
|
+
height = _ref$height === void 0 ? '100vh' : _ref$height,
|
|
32
|
+
_ref$headerHeight = _ref.headerHeight,
|
|
33
|
+
headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
title = _ref.title,
|
|
36
|
+
goBack = _ref.goBack,
|
|
37
|
+
goBackText = _ref.goBackText,
|
|
38
|
+
center = _ref.center,
|
|
39
|
+
extra = _ref.extra,
|
|
40
|
+
_ref$size = _ref.size,
|
|
41
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
42
|
+
_ref$inLayout = _ref.inLayout,
|
|
43
|
+
inLayout = _ref$inLayout === void 0 ? false : _ref$inLayout,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
57
46
|
// 如果传入只有数字,需要默认加px
|
|
58
47
|
var computedHeaderHeight = addUnitForValue(headerHeight);
|
|
59
|
-
var computedHeight = addUnitForValue(height);
|
|
48
|
+
var computedHeight = addUnitForValue(height);
|
|
60
49
|
|
|
50
|
+
// 判断是否有标题栏
|
|
61
51
|
if (!(title || extra || center)) {
|
|
62
52
|
computedHeaderHeight = '0px';
|
|
63
53
|
}
|
|
64
|
-
|
|
65
54
|
if (inLayout) {
|
|
66
55
|
computedHeaderHeight = '40px';
|
|
67
|
-
}
|
|
68
|
-
|
|
56
|
+
}
|
|
69
57
|
|
|
58
|
+
// 计算中间的zIndex,灰色递减,白色递增
|
|
70
59
|
var whiteCols = 0;
|
|
71
|
-
var childrenToArray = [];
|
|
60
|
+
var childrenToArray = [];
|
|
72
61
|
|
|
73
|
-
|
|
62
|
+
// 计算children type是box的数量
|
|
63
|
+
var boxCount = 0;
|
|
74
64
|
|
|
65
|
+
// 如果children是单个节点,统一转为数组处理计算层级
|
|
75
66
|
console.log('children', children);
|
|
76
|
-
|
|
77
67
|
if (_typeof(children) === 'object') {
|
|
78
68
|
childrenToArray = [children];
|
|
79
69
|
} else if (Array.isArray(children)) {
|
|
80
70
|
childrenToArray = _toConsumableArray(children);
|
|
81
71
|
}
|
|
82
|
-
|
|
83
72
|
console.log('React.Children', React.Children);
|
|
84
73
|
React.Children.map(children, function (child) {
|
|
85
74
|
if (isPageBox(child)) {
|
|
@@ -104,34 +93,34 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
104
93
|
marginTop: computedHeaderHeight,
|
|
105
94
|
padding: inLayout ? '16px 20px' : '0px'
|
|
106
95
|
};
|
|
107
|
-
return React.createElement("section", _extends({
|
|
96
|
+
return /*#__PURE__*/React.createElement("section", _extends({
|
|
108
97
|
className: cn(clsPrefix, (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, 'in-layout', inLayout), _defineProperty(_cn, 'not-in-layout', !inLayout), _cn))
|
|
109
|
-
}, restProps), (title || goBack || center || extra) && React.createElement("div", {
|
|
98
|
+
}, restProps), (title || goBack || center || extra) && /*#__PURE__*/React.createElement("div", {
|
|
110
99
|
className: "".concat(clsPrefix, "-header"),
|
|
111
100
|
style: headerStyle
|
|
112
|
-
}, React.createElement("div", {
|
|
101
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
113
102
|
className: "".concat(clsPrefix, "-header-section")
|
|
114
|
-
}, goBack && React.createElement("div", {
|
|
103
|
+
}, goBack && /*#__PURE__*/React.createElement("div", {
|
|
115
104
|
className: "page-header-section-back",
|
|
116
105
|
onClick: function onClick() {
|
|
117
106
|
goBack();
|
|
118
107
|
}
|
|
119
|
-
}, React.createElement(Icon, {
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
120
109
|
type: "left"
|
|
121
|
-
}), React.createElement("span", null, goBackText ? goBackText : '返回')), title), [center, extra].map(function (item) {
|
|
122
|
-
return React.createElement("div", {
|
|
123
|
-
className: "".concat(clsPrefix, "-header-section")
|
|
110
|
+
}), /*#__PURE__*/React.createElement("span", null, goBackText ? goBackText : '返回')), title), [center, extra].map(function (item, i) {
|
|
111
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: "".concat(clsPrefix, "-header-section"),
|
|
113
|
+
key: i
|
|
124
114
|
}, item);
|
|
125
|
-
})), React.createElement("div", {
|
|
115
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
126
116
|
className: "".concat(clsPrefix, "-content"),
|
|
127
117
|
style: contentStyle
|
|
128
118
|
}, React.Children.map(children, function (child) {
|
|
129
119
|
// 如果children不是Box,就不需要多列布局
|
|
130
120
|
if (!child.type) {
|
|
131
121
|
// console.log("没有type");
|
|
132
|
-
return React.cloneElement(React.createElement("div", null, child));
|
|
122
|
+
return /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.createElement("div", null, child));
|
|
133
123
|
}
|
|
134
|
-
|
|
135
124
|
var extraProps = _objectSpread({
|
|
136
125
|
headerHeight: computedHeaderHeight,
|
|
137
126
|
size: size,
|
|
@@ -139,27 +128,24 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
139
128
|
contentTotalMargin: inLayout ? '32px' : '0px',
|
|
140
129
|
inLayout: inLayout
|
|
141
130
|
}, child.props);
|
|
142
|
-
|
|
143
131
|
if (!isPageBox(child)) {
|
|
144
|
-
return React.cloneElement(child, extraProps);
|
|
132
|
+
return /*#__PURE__*/React.cloneElement(child, extraProps);
|
|
145
133
|
}
|
|
146
|
-
|
|
147
134
|
var _child$props2 = child.props,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
135
|
+
_child$props2$mode = _child$props2.mode,
|
|
136
|
+
mode = _child$props2$mode === void 0 ? 'gray' : _child$props2$mode,
|
|
137
|
+
width = _child$props2.width;
|
|
151
138
|
var style = {
|
|
152
139
|
flex: computeWidth(width),
|
|
153
140
|
// 设置cols层级关系
|
|
154
141
|
zIndex: mode === 'gray' ? endIndex-- : startIndex++
|
|
155
142
|
};
|
|
156
143
|
var className = cn("".concat(clsPrefix, "-box ").concat(clsPrefix, "-box-").concat(mode));
|
|
157
|
-
return React.createElement('div', {
|
|
144
|
+
return /*#__PURE__*/React.createElement('div', {
|
|
158
145
|
className: className,
|
|
159
146
|
style: style
|
|
160
|
-
}, React.cloneElement(child, extraProps));
|
|
147
|
+
}, /*#__PURE__*/React.cloneElement(child, extraProps));
|
|
161
148
|
})));
|
|
162
149
|
};
|
|
163
|
-
|
|
164
150
|
PageLayout.Box = Box;
|
|
165
151
|
export default PageLayout;
|
package/es/Page/utils.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
var computeWidth = function computeWidth(width) {
|
|
2
2
|
var flex = '1';
|
|
3
3
|
var validNumber = isValidNumber(width);
|
|
4
|
-
|
|
5
4
|
if (/(%|px)$/.test(width) && validNumber) {
|
|
6
5
|
flex = "0 0 ".concat(width);
|
|
7
6
|
} else if (!isNaN(width)) {
|
|
8
7
|
flex = "0 0 ".concat(width, "px");
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return flex;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
var isValidNumber = function isValidNumber(value) {
|
|
15
12
|
return !isNaN(parseFloat(value));
|
|
16
13
|
};
|
|
17
|
-
|
|
18
14
|
var addUnitForValue = function addUnitForValue(value) {
|
|
19
15
|
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'px';
|
|
20
16
|
return !isNaN(value) ? "".concat(value).concat(unit) : value;
|
|
21
17
|
};
|
|
22
|
-
|
|
23
18
|
export { computeWidth, isValidNumber, addUnitForValue };
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import "antd/lib/checkbox/style";
|
|
2
2
|
import _Checkbox from "antd/lib/checkbox";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
3
|
+
var _excluded = ["value", "onChange"];
|
|
4
|
+
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
5
|
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
6
|
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
7
|
export default (function (_ref) {
|
|
11
8
|
var value = _ref.value,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return React.createElement(_Checkbox, _extends({}, props, {
|
|
9
|
+
_onChange = _ref.onChange,
|
|
10
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
|
+
return /*#__PURE__*/React.createElement(_Checkbox, _extends({}, props, {
|
|
16
12
|
checked: value,
|
|
17
13
|
onChange: function onChange(evt) {
|
|
18
14
|
_onChange == null ? void 0 : _onChange(evt.target.checked);
|
|
@@ -1,55 +1,46 @@
|
|
|
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/select/style";
|
|
2
3
|
import _Select from "antd/lib/select";
|
|
3
|
-
|
|
4
|
-
function _extends() { _extends = Object.assign
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
4
|
+
var _excluded = ["options", "params", "queryKey", "fieldNames", "loadData"];
|
|
5
|
+
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
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; } }
|
|
18
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
17
|
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; }
|
|
21
|
-
|
|
22
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; }
|
|
23
|
-
|
|
24
19
|
import React, { useState, useEffect } from 'react';
|
|
25
20
|
var Option = _Select.Option;
|
|
26
21
|
export default (function (props) {
|
|
27
22
|
var options = props.options,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
params = props.params,
|
|
24
|
+
_props$queryKey = props.queryKey,
|
|
25
|
+
queryKey = _props$queryKey === void 0 ? 'name' : _props$queryKey,
|
|
26
|
+
_props$fieldNames = props.fieldNames,
|
|
27
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
28
|
+
label: 'label',
|
|
29
|
+
value: 'value'
|
|
30
|
+
} : _props$fieldNames,
|
|
31
|
+
loadData = props.loadData,
|
|
32
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
39
33
|
var _useState = useState(options || []),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
items = _useState2[0],
|
|
36
|
+
setItems = _useState2[1];
|
|
44
37
|
var _useState3 = useState(''),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
query = _useState4[0],
|
|
40
|
+
setQuery = _useState4[1];
|
|
49
41
|
var onSearch = function onSearch(val) {
|
|
50
42
|
setQuery(val);
|
|
51
43
|
};
|
|
52
|
-
|
|
53
44
|
if (loadData) {
|
|
54
45
|
useEffect(function () {
|
|
55
46
|
loadData(_objectSpread(_defineProperty({}, queryKey, query), params || {})).then(function (items) {
|
|
@@ -57,11 +48,10 @@ export default (function (props) {
|
|
|
57
48
|
});
|
|
58
49
|
}, [params, query]);
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
useEffect(function () {
|
|
62
52
|
setItems(options || []);
|
|
63
53
|
}, [options]);
|
|
64
|
-
return React.createElement(_Select, _extends({
|
|
54
|
+
return /*#__PURE__*/React.createElement(_Select, _extends({
|
|
65
55
|
allowClear: true,
|
|
66
56
|
showSearch: true,
|
|
67
57
|
optionFilterProp: "children",
|
|
@@ -72,7 +62,7 @@ export default (function (props) {
|
|
|
72
62
|
var value = item instanceof Object ? item[valueKey] : item;
|
|
73
63
|
var label = item instanceof Object ? item[labelKey] : item;
|
|
74
64
|
var optionProps = item instanceof Object ? item : {};
|
|
75
|
-
return React.createElement(Option, _extends({}, optionProps, {
|
|
65
|
+
return /*#__PURE__*/React.createElement(Option, _extends({}, optionProps, {
|
|
76
66
|
key: value,
|
|
77
67
|
value: value
|
|
78
68
|
}), label);
|