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