tntd 1.4.20 → 1.4.22

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