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.
Files changed (163) hide show
  1. package/components/Handle/README.md +0 -20
  2. package/components/Handle/index.js +27 -6
  3. package/components/locale.js +8 -2
  4. package/dist/1.tntd.js +1 -1
  5. package/dist/stats.json +23819 -24067
  6. package/dist/tntd.css +1 -1
  7. package/dist/tntd.js +13 -8
  8. package/es/ArrayInput/icon.js +5 -5
  9. package/es/ArrayInput/index.js +108 -76
  10. package/es/AuthContext.js +1 -1
  11. package/es/Columns/index.js +38 -31
  12. package/es/DevelopmentLogin/LoginModal.js +45 -32
  13. package/es/DevelopmentLogin/index.js +17 -13
  14. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  15. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  16. package/es/Ellipsis/index.js +69 -58
  17. package/es/Handle/README.md +0 -20
  18. package/es/Handle/index.js +67 -32
  19. package/es/Icon/fonts/iconfont.js +12 -7
  20. package/es/Icon/index.js +13 -10
  21. package/es/Img/Contain.js +29 -24
  22. package/es/Img/Cover.js +54 -40
  23. package/es/Img/index.js +45 -36
  24. package/es/Layout/ActionsContext.js +2 -3
  25. package/es/Layout/AppList.js +92 -37
  26. package/es/Layout/Application.js +72 -26
  27. package/es/Layout/Avatar.js +66 -29
  28. package/es/Layout/CompatibleLanguage.js +94 -39
  29. package/es/Layout/EnterpriseLayout/Avatar.js +76 -38
  30. package/es/Layout/EnterpriseLayout/Language.js +32 -14
  31. package/es/Layout/EnterpriseLayout/Theme.js +34 -16
  32. package/es/Layout/EnterpriseLayout/index.js +16 -14
  33. package/es/Layout/GlobalNavigation/NavigationPopup.js +170 -59
  34. package/es/Layout/GlobalNavigation/index.js +54 -20
  35. package/es/Layout/Header.js +46 -25
  36. package/es/Layout/HeaderActions.js +56 -42
  37. package/es/Layout/HeaderNavs.js +47 -20
  38. package/es/Layout/HeaderTabs.js +102 -49
  39. package/es/Layout/Iconfont.js +1 -1
  40. package/es/Layout/Language.js +32 -14
  41. package/es/Layout/Layout.js +108 -86
  42. package/es/Layout/Logo.js +32 -16
  43. package/es/Layout/OrgAppList.js +107 -62
  44. package/es/Layout/SideMenu.js +124 -63
  45. package/es/Layout/Theme.js +61 -23
  46. package/es/Layout/checkAuth.js +29 -0
  47. package/es/Layout/index.js +34 -26
  48. package/es/Layout/paaslayout/CompactSideMenu.js +74 -35
  49. package/es/Layout/paaslayout/Header.js +45 -22
  50. package/es/Layout/paaslayout/Logo.js +13 -3
  51. package/es/Layout/paaslayout/SideMenu.js +78 -39
  52. package/es/Layout/paaslayout/index.js +102 -75
  53. package/es/Layout/storage.js +9 -10
  54. package/es/Layout/utils.js +136 -0
  55. package/es/LoadingButton/index.js +24 -15
  56. package/es/Modal/index.js +46 -38
  57. package/es/Page/Box.js +41 -34
  58. package/es/Page/index.js +67 -52
  59. package/es/Page/utils.js +5 -0
  60. package/es/QueryForm/Field/Checkbox.js +9 -5
  61. package/es/QueryForm/Field/Select.js +41 -31
  62. package/es/QueryForm/Field/SelectInput.js +41 -26
  63. package/es/QueryForm/Field/fieldsMap.js +1 -0
  64. package/es/QueryForm/Field/index.js +71 -41
  65. package/es/QueryForm/createActions.js +7 -6
  66. package/es/QueryForm/index.js +135 -76
  67. package/es/QueryListScene/List.js +128 -74
  68. package/es/QueryListScene/QueryForm.js +81 -46
  69. package/es/QueryListScene/QueryListScene.js +40 -25
  70. package/es/QueryListScene/Title.js +3 -3
  71. package/es/QueryListScene/Toolbar.js +12 -11
  72. package/es/Select/DropDownWrap.js +50 -29
  73. package/es/Select/index.js +231 -135
  74. package/es/Table/ResizableTable/index.js +40 -26
  75. package/es/Table/index.js +16 -18
  76. package/es/Title/index.js +23 -21
  77. package/es/locale.js +11 -3
  78. package/es/utils/checkAuth.js +5 -3
  79. package/es/utils/findMenuInfoByPath.js +4 -0
  80. package/es/utils/index.js +23 -12
  81. package/lib/ArrayInput/icon.js +6 -6
  82. package/lib/ArrayInput/index.js +127 -78
  83. package/lib/AuthContext.js +4 -1
  84. package/lib/Columns/index.js +47 -31
  85. package/lib/DevelopmentLogin/LoginModal.js +58 -32
  86. package/lib/DevelopmentLogin/index.js +27 -16
  87. package/lib/Ellipsis/Svg/CopySVG.js +15 -13
  88. package/lib/Ellipsis/Svg/TickSVG.js +10 -8
  89. package/lib/Ellipsis/index.js +80 -57
  90. package/lib/Handle/README.md +0 -20
  91. package/lib/Handle/index.js +80 -32
  92. package/lib/Icon/fonts/iconfont.js +12 -7
  93. package/lib/Icon/index.js +20 -11
  94. package/lib/Img/Contain.js +34 -24
  95. package/lib/Img/Cover.js +65 -42
  96. package/lib/Img/index.js +51 -36
  97. package/lib/Layout/ActionsContext.js +4 -1
  98. package/lib/Layout/AppList.js +118 -40
  99. package/lib/Layout/Application.js +86 -26
  100. package/lib/Layout/Avatar.js +86 -32
  101. package/lib/Layout/CompatibleLanguage.js +110 -39
  102. package/lib/Layout/EnterpriseLayout/Avatar.js +100 -41
  103. package/lib/Layout/EnterpriseLayout/Header.js +113 -0
  104. package/lib/Layout/EnterpriseLayout/HeaderActions.js +104 -0
  105. package/lib/Layout/EnterpriseLayout/Language.js +48 -17
  106. package/lib/Layout/EnterpriseLayout/Theme.js +44 -16
  107. package/lib/Layout/EnterpriseLayout/index.js +23 -14
  108. package/lib/Layout/GlobalNavigation/NavigationPopup.js +186 -59
  109. package/lib/Layout/GlobalNavigation/index.js +74 -23
  110. package/lib/Layout/Header.js +63 -28
  111. package/lib/Layout/HeaderActions.js +74 -45
  112. package/lib/Layout/HeaderNavs.js +61 -23
  113. package/lib/Layout/HeaderTabs.js +118 -51
  114. package/lib/Layout/Iconfont.js +5 -1
  115. package/lib/Layout/Language.js +48 -17
  116. package/lib/Layout/Layout.js +128 -88
  117. package/lib/Layout/Logo.js +43 -19
  118. package/lib/Layout/OrgAppList.js +127 -64
  119. package/lib/Layout/SideMenu.js +143 -65
  120. package/lib/Layout/Theme.js +73 -23
  121. package/lib/Layout/checkAuth.js +39 -0
  122. package/lib/Layout/createActions.js +5 -0
  123. package/lib/Layout/images/index.js +28 -0
  124. package/lib/Layout/index.js +55 -30
  125. package/lib/Layout/paaslayout/CompactSideMenu.js +84 -35
  126. package/lib/Layout/paaslayout/Header.js +55 -22
  127. package/lib/Layout/paaslayout/Logo.js +19 -3
  128. package/lib/Layout/paaslayout/SideMenu.js +87 -39
  129. package/lib/Layout/paaslayout/index.js +122 -77
  130. package/lib/Layout/storage.js +40 -11
  131. package/lib/Layout/utils.js +166 -0
  132. package/lib/LoadingButton/index.js +29 -15
  133. package/lib/Modal/index.js +53 -38
  134. package/lib/Page/Box.js +45 -34
  135. package/lib/Page/index.js +77 -52
  136. package/lib/Page/utils.js +9 -1
  137. package/lib/QueryForm/Field/Checkbox.js +13 -5
  138. package/lib/QueryForm/Field/Select.js +53 -33
  139. package/lib/QueryForm/Field/SelectInput.js +56 -28
  140. package/lib/QueryForm/Field/fieldsMap.js +15 -1
  141. package/lib/QueryForm/Field/index.js +81 -43
  142. package/lib/QueryForm/createActions.js +12 -6
  143. package/lib/QueryForm/index.js +157 -78
  144. package/lib/QueryForm/useForm.js +5 -0
  145. package/lib/QueryListScene/List.js +140 -76
  146. package/lib/QueryListScene/QueryForm.js +86 -46
  147. package/lib/QueryListScene/QueryListScene.js +46 -25
  148. package/lib/QueryListScene/Title.js +7 -3
  149. package/lib/QueryListScene/Toolbar.js +16 -11
  150. package/lib/QueryListScene/createActions.js +5 -0
  151. package/lib/QueryListScene/index.js +10 -0
  152. package/lib/QueryListScene/useActions.js +5 -0
  153. package/lib/Select/DropDownWrap.js +56 -31
  154. package/lib/Select/index.js +241 -135
  155. package/lib/Table/ResizableTable/index.js +48 -26
  156. package/lib/Table/index.js +28 -17
  157. package/lib/Title/index.js +28 -21
  158. package/lib/index.js +56 -35
  159. package/lib/locale.js +19 -4
  160. package/lib/utils/checkAuth.js +9 -4
  161. package/lib/utils/findMenuInfoByPath.js +8 -1
  162. package/lib/utils/index.js +42 -15
  163. package/package.json +2 -2
@@ -1,4 +1,3 @@
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/form/style";
3
2
  import _Form from "antd/lib/form";
4
3
  import "antd/lib/drawer/style";
@@ -7,22 +6,33 @@ import "antd/lib/badge/style";
7
6
  import _Badge from "antd/lib/badge";
8
7
  import "antd/lib/button/style";
9
8
  import _Button from "antd/lib/button";
10
- 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); }
11
- 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; }
12
- 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; }
13
- 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
+
10
+ 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); }
11
+
12
+ 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); }
13
+
14
+ 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; }
15
+
16
+ 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; }
17
+
18
+ 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; }
19
+
14
20
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
- 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); } }
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
- 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); }
19
- 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); }
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
- 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); }; }
22
- 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); }
21
+
22
+ 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, descriptor.key, descriptor); } }
23
+
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
+
26
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
27
+
23
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
- 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; } }
25
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
29
+
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
+
32
+ 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); }
33
+
34
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
+
26
36
  import React, { createRef } from 'react';
27
37
  import classnames from 'classnames';
28
38
  import { debounce } from 'lodash';
@@ -33,15 +43,21 @@ import Field from './Field';
33
43
  import { getText as _getText, getLanguage } from '../locale';
34
44
  import './index.less';
35
45
  var clsPrefix = 'tnt-queryform';
36
- var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
46
+
47
+ var QueryForm =
48
+ /*#__PURE__*/
49
+ function (_React$PureComponent) {
37
50
  _inherits(QueryForm, _React$PureComponent);
38
- var _super = _createSuper(QueryForm);
51
+
39
52
  function QueryForm(props) {
40
53
  var _this;
54
+
41
55
  _classCallCheck(this, QueryForm);
42
- _this = _super.call(this, props);
56
+
57
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
43
58
  _this.onWindowResize = debounce(function () {
44
59
  var current = _this.fieldsRef.current;
60
+
45
61
  if (current) {
46
62
  setTimeout(function () {
47
63
  _this.setState({
@@ -50,60 +66,82 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
50
66
  }, 25);
51
67
  }
52
68
  }, 50);
69
+
53
70
  _this.search = function (params) {
54
- _this.props.onSearch(_objectSpread(_objectSpread({}, _this.form.getValues()), params));
71
+ _this.props.onSearch(_objectSpread({}, _this.form.getValues(), {}, params));
55
72
  };
73
+
56
74
  _this.onSearch = function () {
57
75
  _this.props.onSearch == null ? void 0 : _this.props.onSearch(_this.form.getValues());
58
76
  };
77
+
59
78
  _this.onReset = function () {
60
79
  var _this$props = _this.props,
61
- initialValues = _this$props.initialValues,
62
- onReset = _this$props.onReset;
80
+ initialValues = _this$props.initialValues,
81
+ onReset = _this$props.onReset;
82
+
63
83
  _this.form.setValues(_objectSpread({}, initialValues));
84
+
64
85
  _this.updateDrawerFieldsValueCount();
86
+
65
87
  onReset == null ? void 0 : onReset(initialValues);
66
88
  };
89
+
67
90
  _this.onToggleExpand = function () {
68
91
  _this.setState({
69
92
  expanded: !_this.state.expanded
70
93
  });
94
+
71
95
  _this.props.onToggleExpand == null ? void 0 : _this.props.onToggleExpand(!_this.state.expanded);
72
96
  };
97
+
73
98
  _this.onShowDrawer = function () {
74
99
  _this.setState({
75
100
  drawerVisible: true
76
101
  });
77
102
  };
103
+
78
104
  _this.onFieldChange = function (name, value) {
79
105
  var values = _this.form.getValues();
80
- var newValues = _objectSpread(_objectSpread({}, values), {}, _defineProperty({}, name, value));
106
+
107
+ var newValues = _objectSpread({}, values, _defineProperty({}, name, value));
108
+
81
109
  var changedInfo = {
82
110
  name: name,
83
111
  value: value,
84
112
  preValue: values == null ? void 0 : values[name]
85
113
  };
86
114
  var onChange = _this.props.onChange;
115
+
87
116
  _this.form.setData('values', newValues);
117
+
88
118
  for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
89
119
  rest[_key - 2] = arguments[_key];
90
120
  }
121
+
91
122
  onChange && onChange.apply(void 0, [newValues, changedInfo].concat(rest));
123
+
92
124
  _this.updateDrawerFieldsValueCount(newValues);
93
125
  };
126
+
94
127
  _this.updateDrawerFieldsValueCount = function () {
95
128
  var values = _this.form.getValues();
129
+
96
130
  var _this$props2 = _this.props,
97
- showFieldCount = _this$props2.showFieldCount,
98
- children = _this$props2.children;
131
+ showFieldCount = _this$props2.showFieldCount,
132
+ children = _this$props2.children;
133
+
99
134
  if (showFieldCount) {
100
135
  var drawerFieldsValueCount = children.reduce(function (acc, cur, index) {
101
136
  var _cur$props;
102
- if (index >= showFieldCount && values != null && values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name]) {
137
+
138
+ if (index >= showFieldCount && (values == null ? void 0 : values[cur == null ? void 0 : (_cur$props = cur.props) == null ? void 0 : _cur$props.name])) {
103
139
  acc++;
104
140
  }
141
+
105
142
  return acc;
106
143
  }, 0);
144
+
107
145
  if (drawerFieldsValueCount !== _this.state.drawerFieldsValueCount) {
108
146
  _this.setState({
109
147
  drawerFieldsValueCount: drawerFieldsValueCount
@@ -111,92 +149,102 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
111
149
  }
112
150
  }
113
151
  };
152
+
114
153
  var form = props.form,
115
- _initialValues = props.initialValues,
116
- _props$showExpand = props.showExpand,
117
- showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
118
- renderActions = props.renderActions,
119
- defaultExpanded = props.defaultExpanded;
154
+ _initialValues = props.initialValues,
155
+ _props$showExpand = props.showExpand,
156
+ showExpand = _props$showExpand === void 0 ? true : _props$showExpand,
157
+ renderActions = props.renderActions,
158
+ defaultExpanded = props.defaultExpanded;
120
159
  _this.state = {
121
160
  showMore: false,
122
161
  expanded: defaultExpanded || !showExpand || renderActions ? true : false,
123
162
  drawerVisible: false,
124
163
  drawerFieldsValueCount: 0
125
164
  };
126
- _this.fieldsRef = /*#__PURE__*/createRef();
127
- _this.formBoxRef = /*#__PURE__*/createRef();
165
+ _this.fieldsRef = createRef();
166
+ _this.formBoxRef = createRef();
128
167
  _this.form = form || createActions();
168
+
129
169
  _this.form.setData('initialValues', _initialValues);
170
+
130
171
  _this.form.setData('values', _objectSpread({}, _initialValues));
172
+
131
173
  return _this;
132
174
  }
175
+
133
176
  _createClass(QueryForm, [{
134
177
  key: "render",
135
178
  value: function render() {
136
179
  var _this2 = this;
180
+
137
181
  var _this$props3 = this.props,
138
- children = _this$props3.children,
139
- _this$props3$classNam = _this$props3.className,
140
- className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
141
- _this$props3$initialV = _this$props3.initialValues,
142
- initialValues = _this$props3$initialV === void 0 ? {} : _this$props3$initialV,
143
- renderActions = _this$props3.renderActions,
144
- _this$props3$showSear = _this$props3.showSearch,
145
- showSearch = _this$props3$showSear === void 0 ? true : _this$props3$showSear,
146
- _this$props3$showRese = _this$props3.showReset,
147
- showReset = _this$props3$showRese === void 0 ? true : _this$props3$showRese,
148
- showFieldCount = _this$props3.showFieldCount,
149
- _this$props3$drawerPr = _this$props3.drawerProps,
150
- drawerProps = _this$props3$drawerPr === void 0 ? {} : _this$props3$drawerPr,
151
- size = _this$props3.size;
182
+ children = _this$props3.children,
183
+ _this$props3$classNam = _this$props3.className,
184
+ className = _this$props3$classNam === void 0 ? '' : _this$props3$classNam,
185
+ _this$props3$initialV = _this$props3.initialValues,
186
+ initialValues = _this$props3$initialV === void 0 ? {} : _this$props3$initialV,
187
+ renderActions = _this$props3.renderActions,
188
+ _this$props3$showSear = _this$props3.showSearch,
189
+ showSearch = _this$props3$showSear === void 0 ? true : _this$props3$showSear,
190
+ _this$props3$showRese = _this$props3.showReset,
191
+ showReset = _this$props3$showRese === void 0 ? true : _this$props3$showRese,
192
+ showFieldCount = _this$props3.showFieldCount,
193
+ _this$props3$drawerPr = _this$props3.drawerProps,
194
+ drawerProps = _this$props3$drawerPr === void 0 ? {} : _this$props3$drawerPr,
195
+ size = _this$props3.size;
152
196
  var extraActions = this.props.extraActions;
153
197
  var _this$state = this.state,
154
- expanded = _this$state.expanded,
155
- showMore = _this$state.showMore,
156
- drawerVisible = _this$state.drawerVisible,
157
- drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
198
+ expanded = _this$state.expanded,
199
+ showMore = _this$state.showMore,
200
+ drawerVisible = _this$state.drawerVisible,
201
+ drawerFieldsValueCount = _this$state.drawerFieldsValueCount;
202
+
158
203
  var renderFormActions = renderActions || function () {
159
- return /*#__PURE__*/React.createElement(React.Fragment, null, showFieldCount && /*#__PURE__*/React.createElement(_Badge, {
204
+ return React.createElement(React.Fragment, null, showFieldCount && React.createElement(_Badge, {
160
205
  count: drawerFieldsValueCount
161
- }, /*#__PURE__*/React.createElement(_Button, {
206
+ }, React.createElement(_Button, {
162
207
  onClick: _this2.onShowDrawer
163
- }, /*#__PURE__*/React.createElement(Icon, {
208
+ }, React.createElement(Icon, {
164
209
  type: "filter"
165
- }), _this2.getText('moreFiltering'))), showSearch && /*#__PURE__*/React.createElement(_Button, {
210
+ }), _this2.getText('moreFiltering'))), showSearch && React.createElement(_Button, {
166
211
  type: "primary",
167
212
  onClick: _this2.onSearch
168
- }, _this2.getText('search')), showReset && /*#__PURE__*/React.createElement(_Button, {
213
+ }, _this2.getText('search')), showReset && React.createElement(_Button, {
169
214
  onClick: _this2.onReset
170
- }, _this2.getText('reset')), showMore && !showFieldCount && /*#__PURE__*/React.createElement(_Button, {
215
+ }, _this2.getText('reset')), showMore && !showFieldCount && React.createElement(_Button, {
171
216
  className: "expand-link",
172
217
  type: "link",
173
218
  onClick: _this2.onToggleExpand
174
219
  }, _this2.getText(expanded ? 'collapse' : 'expand')), React.Children.map(children, function (child) {
175
220
  var _child$props;
176
- return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && /*#__PURE__*/React.cloneElement(child);
221
+
222
+ return child && (child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.align) === 'right' && React.cloneElement(child);
177
223
  }));
178
224
  };
179
- return /*#__PURE__*/React.createElement("div", {
225
+
226
+ return React.createElement("div", {
180
227
  ref: this.formBoxRef,
181
228
  className: classnames(clsPrefix, _defineProperty({}, className, className))
182
- }, /*#__PURE__*/React.createElement(_Form, {
229
+ }, React.createElement(_Form, {
183
230
  layout: "inline",
184
231
  className: classnames({
185
232
  expanded: !showMore || expanded,
186
233
  showMore: showMore
187
234
  })
188
- }, /*#__PURE__*/React.createElement("div", {
235
+ }, React.createElement("div", {
189
236
  ref: this.fieldsRef
190
237
  }, React.Children.map(children, function (child, index) {
191
238
  var _child$props2;
192
- return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && /*#__PURE__*/React.cloneElement(child, {
239
+
240
+ return child && (child == null ? void 0 : (_child$props2 = child.props) == null ? void 0 : _child$props2.align) !== 'right' && (!showFieldCount || showFieldCount > index) && React.cloneElement(child, {
193
241
  form: _this2.form,
194
242
  initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
195
243
  onChange: _this2.onFieldChange
196
244
  });
197
- })), /*#__PURE__*/React.createElement("div", {
245
+ })), React.createElement("div", {
198
246
  className: "".concat(clsPrefix, "-actions")
199
- }, renderFormActions()), showFieldCount && /*#__PURE__*/React.createElement(_Drawer, _extends({
247
+ }, renderFormActions()), showFieldCount && React.createElement(_Drawer, _extends({
200
248
  title: this.getText('moreFiltering'),
201
249
  visible: drawerVisible,
202
250
  onClose: function onClose() {
@@ -212,19 +260,19 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
212
260
  'large-size': size === 'large'
213
261
  }, className, className))
214
262
  }), React.Children.map(children, function (child, index) {
215
- return child && index >= showFieldCount && /*#__PURE__*/React.cloneElement(child, {
263
+ return child && index >= showFieldCount && React.cloneElement(child, {
216
264
  form: _this2.form,
217
265
  isFieldInDrawer: true,
218
266
  initialValue: initialValues == null ? void 0 : initialValues[child.props.name],
219
267
  onChange: _this2.onFieldChange,
220
268
  onSearch: _this2.onSearch
221
269
  });
222
- }), /*#__PURE__*/React.createElement(_Button, {
270
+ }), React.createElement(_Button, {
223
271
  type: "primary",
224
272
  onClick: this.onSearch
225
- }, this.getText('search')), /*#__PURE__*/React.createElement(_Button, {
273
+ }, this.getText('search')), React.createElement(_Button, {
226
274
  onClick: this.onReset
227
- }, this.getText('reset')))), extraActions && /*#__PURE__*/React.createElement("div", {
275
+ }, this.getText('reset')))), extraActions && React.createElement("div", {
228
276
  className: "".concat(clsPrefix, "-extra")
229
277
  }, extraActions));
230
278
  }
@@ -237,6 +285,7 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
237
285
  key: "isFieldsWidthOverflow",
238
286
  value: function isFieldsWidthOverflow() {
239
287
  var current = this.fieldsRef.current;
288
+
240
289
  if (current) {
241
290
  return current.offsetWidth < [].reduce.call(current.children, function (acc, cur) {
242
291
  var marginArray = window.getComputedStyle(cur).margin.split(' ').map(function (str) {
@@ -246,23 +295,30 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
246
295
  return acc;
247
296
  }, 0);
248
297
  }
298
+
249
299
  return false;
250
300
  }
251
301
  }, {
252
302
  key: "updateFieldHeight",
253
303
  value: function updateFieldHeight() {
254
304
  var _formBoxRef$current, _formBoxRef$current2, _fieldsRef$current;
305
+
255
306
  var formBoxRef = this.formBoxRef,
256
- fieldsRef = this.fieldsRef;
307
+ fieldsRef = this.fieldsRef;
308
+
257
309
  var getFieldHeight = function getFieldHeight() {
258
310
  var _current$children;
311
+
259
312
  var current = fieldsRef.current;
260
313
  var height = '32px';
261
- if (current && (_current$children = current.children) != null && _current$children[0]) {
314
+
315
+ if (current && ((_current$children = current.children) == null ? void 0 : _current$children[0])) {
262
316
  height = window.getComputedStyle(current.children[0]).height;
263
317
  }
318
+
264
319
  return height;
265
320
  };
321
+
266
322
  var queryFormActionsDom = formBoxRef == null ? void 0 : (_formBoxRef$current = formBoxRef.current) == null ? void 0 : _formBoxRef$current.querySelector(".".concat(clsPrefix, "-actions"));
267
323
  var queryFormExtraDom = formBoxRef == null ? void 0 : (_formBoxRef$current2 = formBoxRef.current) == null ? void 0 : _formBoxRef$current2.querySelector(".".concat(clsPrefix, "-extra"));
268
324
  var formItemsDomList = fieldsRef == null ? void 0 : (_fieldsRef$current = fieldsRef.current) == null ? void 0 : _fieldsRef$current.querySelectorAll('.ant-form-item-control');
@@ -283,24 +339,25 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
283
339
  value: function componentDidMount() {
284
340
  var current = this.fieldsRef.current;
285
341
  var _this$props4 = this.props,
286
- showFieldCount = _this$props4.showFieldCount,
287
- _this$props4$showExpa = _this$props4.showExpand,
288
- showExpand = _this$props4$showExpa === void 0 ? true : _this$props4$showExpa,
289
- renderActions = _this$props4.renderActions;
342
+ showFieldCount = _this$props4.showFieldCount,
343
+ _this$props4$showExpa = _this$props4.showExpand,
344
+ showExpand = _this$props4$showExpa === void 0 ? true : _this$props4$showExpa,
345
+ renderActions = _this$props4.renderActions;
290
346
  this.updateFieldHeight();
291
- this.form.on('search', this.search);
292
-
293
- // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
347
+ this.form.on('search', this.search); // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑
294
348
  // || renderActions
349
+
295
350
  if (!showFieldCount && !showExpand) {
296
351
  return;
297
352
  }
353
+
298
354
  if (!showFieldCount) {
299
355
  if (current && this.isFieldsWidthOverflow()) {
300
356
  this.setState({
301
357
  showMore: true
302
358
  });
303
359
  }
360
+
304
361
  window.addEventListener('resize', this.onWindowResize);
305
362
  } else {
306
363
  this.updateDrawerFieldsValueCount();
@@ -317,8 +374,10 @@ var QueryForm = /*#__PURE__*/function (_React$PureComponent) {
317
374
  this.form.off('search', this.search);
318
375
  }
319
376
  }]);
377
+
320
378
  return QueryForm;
321
379
  }(React.PureComponent);
380
+
322
381
  ;
323
382
  QueryForm.Field = Field;
324
383
  QueryForm.useForm = useForm;