tntd 1.4.18 → 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/Ellipsis/index.js +1 -1
- 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 +28426 -28000
- 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 +59 -70
- 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 +58 -81
- 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/lib/QueryForm/index.js
CHANGED
|
@@ -1,92 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
require("antd/lib/form/style");
|
|
9
|
-
|
|
10
9
|
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
11
|
-
|
|
12
10
|
require("antd/lib/drawer/style");
|
|
13
|
-
|
|
14
11
|
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
15
|
-
|
|
16
12
|
require("antd/lib/badge/style");
|
|
17
|
-
|
|
18
13
|
var _badge = _interopRequireDefault(require("antd/lib/badge"));
|
|
19
|
-
|
|
20
14
|
require("antd/lib/button/style");
|
|
21
|
-
|
|
22
15
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
23
|
-
|
|
24
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
17
|
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
27
|
-
|
|
28
18
|
var _lodash = require("lodash");
|
|
29
|
-
|
|
30
19
|
var _useForm = _interopRequireDefault(require("./useForm"));
|
|
31
|
-
|
|
32
20
|
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
33
|
-
|
|
34
21
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
35
|
-
|
|
36
22
|
var _Field = _interopRequireDefault(require("./Field"));
|
|
37
|
-
|
|
38
23
|
var _locale = require("../locale");
|
|
39
|
-
|
|
40
24
|
require("./index.less");
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
-
|
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
46
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
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; }
|
|
55
|
-
|
|
56
|
-
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; }
|
|
57
|
-
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
58
32
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
33
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
36
|
+
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); }
|
|
37
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
40
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
66
41
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
67
|
-
|
|
68
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
69
|
-
|
|
70
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
71
|
-
|
|
72
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
73
|
-
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
74
44
|
var clsPrefix = 'tnt-queryform';
|
|
75
|
-
|
|
76
|
-
var QueryForm =
|
|
77
|
-
/*#__PURE__*/
|
|
78
|
-
function (_React$PureComponent) {
|
|
45
|
+
var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
|
|
79
46
|
_inherits(QueryForm, _React$PureComponent);
|
|
80
|
-
|
|
47
|
+
var _super = _createSuper(QueryForm);
|
|
81
48
|
function QueryForm(props) {
|
|
82
49
|
var _this;
|
|
83
|
-
|
|
84
50
|
_classCallCheck(this, QueryForm);
|
|
85
|
-
|
|
86
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
51
|
+
_this = _super.call(this, props);
|
|
87
52
|
_this.onWindowResize = (0, _lodash.debounce)(function () {
|
|
88
53
|
var current = _this.fieldsRef.current;
|
|
89
|
-
|
|
90
54
|
if (current) {
|
|
91
55
|
setTimeout(function () {
|
|
92
56
|
_this.setState({
|
|
@@ -95,82 +59,60 @@ function (_React$PureComponent) {
|
|
|
95
59
|
}, 25);
|
|
96
60
|
}
|
|
97
61
|
}, 50);
|
|
98
|
-
|
|
99
62
|
_this.search = function (params) {
|
|
100
|
-
_this.props.onSearch(_objectSpread({}, _this.form.getValues(),
|
|
63
|
+
_this.props.onSearch(_objectSpread(_objectSpread({}, _this.form.getValues()), params));
|
|
101
64
|
};
|
|
102
|
-
|
|
103
65
|
_this.onSearch = function () {
|
|
104
66
|
_this.props.onSearch == null ? void 0 : _this.props.onSearch(_this.form.getValues());
|
|
105
67
|
};
|
|
106
|
-
|
|
107
68
|
_this.onReset = function () {
|
|
108
69
|
var _this$props = _this.props,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
70
|
+
initialValues = _this$props.initialValues,
|
|
71
|
+
onReset = _this$props.onReset;
|
|
112
72
|
_this.form.setValues(_objectSpread({}, initialValues));
|
|
113
|
-
|
|
114
73
|
_this.updateDrawerFieldsValueCount();
|
|
115
|
-
|
|
116
74
|
onReset == null ? void 0 : onReset(initialValues);
|
|
117
75
|
};
|
|
118
|
-
|
|
119
76
|
_this.onToggleExpand = function () {
|
|
120
77
|
_this.setState({
|
|
121
78
|
expanded: !_this.state.expanded
|
|
122
79
|
});
|
|
123
|
-
|
|
124
80
|
_this.props.onToggleExpand == null ? void 0 : _this.props.onToggleExpand(!_this.state.expanded);
|
|
125
81
|
};
|
|
126
|
-
|
|
127
82
|
_this.onShowDrawer = function () {
|
|
128
83
|
_this.setState({
|
|
129
84
|
drawerVisible: true
|
|
130
85
|
});
|
|
131
86
|
};
|
|
132
|
-
|
|
133
87
|
_this.onFieldChange = function (name, value) {
|
|
134
88
|
var values = _this.form.getValues();
|
|
135
|
-
|
|
136
|
-
var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
|
|
137
|
-
|
|
89
|
+
var newValues = _objectSpread(_objectSpread({}, values), {}, _defineProperty({}, name, value));
|
|
138
90
|
var changedInfo = {
|
|
139
91
|
name: name,
|
|
140
92
|
value: value,
|
|
141
93
|
preValue: values == null ? void 0 : values[name]
|
|
142
94
|
};
|
|
143
95
|
var onChange = _this.props.onChange;
|
|
144
|
-
|
|
145
96
|
_this.form.setData('values', newValues);
|
|
146
|
-
|
|
147
97
|
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
148
98
|
rest[_key - 2] = arguments[_key];
|
|
149
99
|
}
|
|
150
|
-
|
|
151
100
|
onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
|
|
152
|
-
|
|
153
101
|
_this.updateDrawerFieldsValueCount(newValues);
|
|
154
102
|
};
|
|
155
|
-
|
|
156
103
|
_this.updateDrawerFieldsValueCount = function () {
|
|
157
104
|
var values = _this.form.getValues();
|
|
158
|
-
|
|
159
105
|
var _this$props2 = _this.props,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
106
|
+
showFieldCount = _this$props2.showFieldCount,
|
|
107
|
+
children = _this$props2.children;
|
|
163
108
|
if (showFieldCount) {
|
|
164
109
|
var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
|
|
165
110
|
var _cur$props;
|
|
166
|
-
|
|
167
|
-
if (index >= showFieldCount && (values == null ? void 0 : values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name])) {
|
|
111
|
+
if (index >= showFieldCount && values != null && values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name]) {
|
|
168
112
|
acc++;
|
|
169
113
|
}
|
|
170
|
-
|
|
171
114
|
return acc;
|
|
172
115
|
}, 0);
|
|
173
|
-
|
|
174
116
|
if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
|
|
175
117
|
_this.setState({
|
|
176
118
|
drawerFieldsValueCount: drawerFieldsValueCount
|
|
@@ -178,102 +120,92 @@ function (_React$PureComponent) {
|
|
|
178
120
|
}
|
|
179
121
|
}
|
|
180
122
|
};
|
|
181
|
-
|
|
182
123
|
var form = props.form,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
124
|
+
_initialValues = props.initialValues,
|
|
125
|
+
_props$showExpand = props.showExpand,
|
|
126
|
+
showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
|
|
127
|
+
renderActions = props.renderActions,
|
|
128
|
+
defaultExpanded = props.defaultExpanded;
|
|
188
129
|
_this.state = {
|
|
189
130
|
showMore: false,
|
|
190
131
|
expanded: defaultExpanded || !showExpand || renderActions ? true : false,
|
|
191
132
|
drawerVisible: false,
|
|
192
133
|
drawerFieldsValueCount: 0
|
|
193
134
|
};
|
|
194
|
-
_this.fieldsRef = (0, _react.createRef)();
|
|
195
|
-
_this.formBoxRef = (0, _react.createRef)();
|
|
135
|
+
_this.fieldsRef = /*#__PURE__*/(0, _react.createRef)();
|
|
136
|
+
_this.formBoxRef = /*#__PURE__*/(0, _react.createRef)();
|
|
196
137
|
_this.form = form || (0, _createActions["default"])();
|
|
197
|
-
|
|
198
138
|
_this.form.setData('initialValues', _initialValues);
|
|
199
|
-
|
|
200
139
|
_this.form.setData('values', _objectSpread({}, _initialValues));
|
|
201
|
-
|
|
202
140
|
return _this;
|
|
203
141
|
}
|
|
204
|
-
|
|
205
142
|
_createClass(QueryForm, [{
|
|
206
143
|
key: "render",
|
|
207
144
|
value: function render() {
|
|
208
145
|
var _this2 = this;
|
|
209
|
-
|
|
210
146
|
var _this$props3 = this.props,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
147
|
+
children = _this$props3.children,
|
|
148
|
+
_this$props3$classNam = _this$props3.className,
|
|
149
|
+
className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
|
|
150
|
+
_this$props3$initialV = _this$props3.initialValues,
|
|
151
|
+
initialValues = _this$props3$initialV === void 0 ? {} : _this$props3$initialV,
|
|
152
|
+
renderActions = _this$props3.renderActions,
|
|
153
|
+
_this$props3$showSear = _this$props3.showSearch,
|
|
154
|
+
showSearch = _this$props3$showSear === void 0 ? true : _this$props3$showSear,
|
|
155
|
+
_this$props3$showRese = _this$props3.showReset,
|
|
156
|
+
showReset = _this$props3$showRese === void 0 ? true : _this$props3$showRese,
|
|
157
|
+
showFieldCount = _this$props3.showFieldCount,
|
|
158
|
+
_this$props3$drawerPr = _this$props3.drawerProps,
|
|
159
|
+
drawerProps = _this$props3$drawerPr === void 0 ? {} : _this$props3$drawerPr,
|
|
160
|
+
size = _this$props3.size;
|
|
225
161
|
var extraActions = this.props.extraActions;
|
|
226
162
|
var _this$state = this.state,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
163
|
+
expanded = _this$state.expanded,
|
|
164
|
+
showMore = _this$state.showMore,
|
|
165
|
+
drawerVisible = _this$state.drawerVisible,
|
|
166
|
+
drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
|
|
232
167
|
var renderFormActions = renderActions || function () {
|
|
233
|
-
return _react["default"].createElement(_react["default"].Fragment, null, showFieldCount && _react["default"].createElement(_badge["default"], {
|
|
168
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, showFieldCount && /*#__PURE__*/_react["default"].createElement(_badge["default"], {
|
|
234
169
|
count: drawerFieldsValueCount
|
|
235
|
-
}, _react["default"].createElement(_button["default"], {
|
|
170
|
+
}, /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
236
171
|
onClick: _this2.onShowDrawer
|
|
237
|
-
}, _react["default"].createElement(_Icon["default"], {
|
|
172
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
238
173
|
type: "filter"
|
|
239
|
-
}), _this2.getText('moreFiltering'))), showSearch && _react["default"].createElement(_button["default"], {
|
|
174
|
+
}), _this2.getText('moreFiltering'))), showSearch && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
240
175
|
type: "primary",
|
|
241
176
|
onClick: _this2.onSearch
|
|
242
|
-
}, _this2.getText('search')), showReset && _react["default"].createElement(_button["default"], {
|
|
177
|
+
}, _this2.getText('search')), showReset && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
243
178
|
onClick: _this2.onReset
|
|
244
|
-
}, _this2.getText('reset')), showMore && !showFieldCount && _react["default"].createElement(_button["default"], {
|
|
179
|
+
}, _this2.getText('reset')), showMore && !showFieldCount && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
245
180
|
className: "expand-link",
|
|
246
181
|
type: "link",
|
|
247
182
|
onClick: _this2.onToggleExpand
|
|
248
183
|
}, _this2.getText(expanded ? 'collapse' : 'expand')), _react["default"].Children.map(children, function (child) {
|
|
249
184
|
var _child$props;
|
|
250
|
-
|
|
251
|
-
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && _react["default"].cloneElement(child);
|
|
185
|
+
return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && /*#__PURE__*/_react["default"].cloneElement(child);
|
|
252
186
|
}));
|
|
253
187
|
};
|
|
254
|
-
|
|
255
|
-
return _react["default"].createElement("div", {
|
|
188
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
256
189
|
ref: this.formBoxRef,
|
|
257
190
|
className: (0, _classnames3["default"])(clsPrefix, _defineProperty({}, className, className))
|
|
258
|
-
}, _react["default"].createElement(_form["default"], {
|
|
191
|
+
}, /*#__PURE__*/_react["default"].createElement(_form["default"], {
|
|
259
192
|
layout: "inline",
|
|
260
193
|
className: (0, _classnames3["default"])({
|
|
261
194
|
expanded: !showMore || expanded,
|
|
262
195
|
showMore: showMore
|
|
263
196
|
})
|
|
264
|
-
}, _react["default"].createElement("div", {
|
|
197
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
265
198
|
ref: this.fieldsRef
|
|
266
199
|
}, _react["default"].Children.map(children, function (child, index) {
|
|
267
200
|
var _child$props2;
|
|
268
|
-
|
|
269
|
-
return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && _react["default"].cloneElement(child, {
|
|
201
|
+
return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
270
202
|
form: _this2.form,
|
|
271
203
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
272
204
|
onChange: _this2.onFieldChange
|
|
273
205
|
});
|
|
274
|
-
})), _react["default"].createElement("div", {
|
|
206
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
275
207
|
className: "".concat(clsPrefix, "-actions")
|
|
276
|
-
}, renderFormActions()), showFieldCount && _react["default"].createElement(_drawer["default"], _extends({
|
|
208
|
+
}, renderFormActions()), showFieldCount && /*#__PURE__*/_react["default"].createElement(_drawer["default"], _extends({
|
|
277
209
|
title: this.getText('moreFiltering'),
|
|
278
210
|
visible: drawerVisible,
|
|
279
211
|
onClose: function onClose() {
|
|
@@ -289,19 +221,19 @@ function (_React$PureComponent) {
|
|
|
289
221
|
'large-size': size === 'large'
|
|
290
222
|
}, className, className))
|
|
291
223
|
}), _react["default"].Children.map(children, function (child, index) {
|
|
292
|
-
return child && index >= showFieldCount && _react["default"].cloneElement(child, {
|
|
224
|
+
return child && index >= showFieldCount && /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
293
225
|
form: _this2.form,
|
|
294
226
|
isFieldInDrawer: true,
|
|
295
227
|
initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
|
|
296
228
|
onChange: _this2.onFieldChange,
|
|
297
229
|
onSearch: _this2.onSearch
|
|
298
230
|
});
|
|
299
|
-
}), _react["default"].createElement(_button["default"], {
|
|
231
|
+
}), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
300
232
|
type: "primary",
|
|
301
233
|
onClick: this.onSearch
|
|
302
|
-
}, this.getText('search')), _react["default"].createElement(_button["default"], {
|
|
234
|
+
}, this.getText('search')), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
303
235
|
onClick: this.onReset
|
|
304
|
-
}, this.getText('reset')))), extraActions && _react["default"].createElement("div", {
|
|
236
|
+
}, this.getText('reset')))), extraActions && /*#__PURE__*/_react["default"].createElement("div", {
|
|
305
237
|
className: "".concat(clsPrefix, "-extra")
|
|
306
238
|
}, extraActions));
|
|
307
239
|
}
|
|
@@ -314,7 +246,6 @@ function (_React$PureComponent) {
|
|
|
314
246
|
key: "isFieldsWidthOverflow",
|
|
315
247
|
value: function isFieldsWidthOverflow() {
|
|
316
248
|
var current = this.fieldsRef.current;
|
|
317
|
-
|
|
318
249
|
if (current) {
|
|
319
250
|
return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
|
|
320
251
|
var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
|
|
@@ -324,30 +255,23 @@ function (_React$PureComponent) {
|
|
|
324
255
|
return acc;
|
|
325
256
|
}, 0);
|
|
326
257
|
}
|
|
327
|
-
|
|
328
258
|
return false;
|
|
329
259
|
}
|
|
330
260
|
}, {
|
|
331
261
|
key: "updateFieldHeight",
|
|
332
262
|
value: function updateFieldHeight() {
|
|
333
263
|
var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
|
|
334
|
-
|
|
335
264
|
var formBoxRef = this.formBoxRef,
|
|
336
|
-
|
|
337
|
-
|
|
265
|
+
fieldsRef = this.fieldsRef;
|
|
338
266
|
var getFieldHeight = function getFieldHeight() {
|
|
339
267
|
var _current$children;
|
|
340
|
-
|
|
341
268
|
var current = fieldsRef.current;
|
|
342
269
|
var height = '32px';
|
|
343
|
-
|
|
344
|
-
if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
|
|
270
|
+
if (current && (_current$children = current.children) != null && _current$children[0]) {
|
|
345
271
|
height = window.getComputedStyle(current.children[0]).height;
|
|
346
272
|
}
|
|
347
|
-
|
|
348
273
|
return height;
|
|
349
274
|
};
|
|
350
|
-
|
|
351
275
|
var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector(".".concat(clsPrefix, "-actions"));
|
|
352
276
|
var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
|
|
353
277
|
var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
|
|
@@ -368,25 +292,24 @@ function (_React$PureComponent) {
|
|
|
368
292
|
value: function componentDidMount() {
|
|
369
293
|
var current = this.fieldsRef.current;
|
|
370
294
|
var _this$props4 = this.props,
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
295
|
+
showFieldCount = _this$props4.showFieldCount,
|
|
296
|
+
_this$props4$showExpa = _this$props4.showExpand,
|
|
297
|
+
showExpand = _this$props4$showExpa === void 0 ? true : _this$props4$showExpa,
|
|
298
|
+
renderActions = _this$props4.renderActions;
|
|
375
299
|
this.updateFieldHeight();
|
|
376
|
-
this.form.on('search', this.search);
|
|
377
|
-
// || renderActions
|
|
300
|
+
this.form.on('search', this.search);
|
|
378
301
|
|
|
302
|
+
// 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
|
|
303
|
+
// || renderActions
|
|
379
304
|
if (!showFieldCount && !showExpand) {
|
|
380
305
|
return;
|
|
381
306
|
}
|
|
382
|
-
|
|
383
307
|
if (!showFieldCount) {
|
|
384
308
|
if (current && this.isFieldsWidthOverflow()) {
|
|
385
309
|
this.setState({
|
|
386
310
|
showMore: true
|
|
387
311
|
});
|
|
388
312
|
}
|
|
389
|
-
|
|
390
313
|
window.addEventListener('resize', this.onWindowResize);
|
|
391
314
|
} else {
|
|
392
315
|
this.updateDrawerFieldsValueCount();
|
|
@@ -403,10 +326,8 @@ function (_React$PureComponent) {
|
|
|
403
326
|
this.form.off('search', this.search);
|
|
404
327
|
}
|
|
405
328
|
}]);
|
|
406
|
-
|
|
407
329
|
return QueryForm;
|
|
408
330
|
}(_react["default"].PureComponent);
|
|
409
|
-
|
|
410
331
|
;
|
|
411
332
|
QueryForm.Field = _Field["default"];
|
|
412
333
|
QueryForm.useForm = _useForm["default"];
|
package/lib/QueryForm/useForm.js
CHANGED
|
@@ -4,16 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = useForm;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
function useForm() {
|
|
15
11
|
var form = (0, _react.useRef)((0, _createActions["default"])());
|
|
16
12
|
return [form.current];
|
|
17
13
|
}
|
|
18
|
-
|
|
19
14
|
;
|