tntd 1.4.32 → 1.4.33-beta.1

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