@vtx/components 2.5.15 → 2.5.16

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 (234) hide show
  1. package/README.md +19 -19
  2. package/lib/_util/filterSpecialCharacters.js +61 -50
  3. package/lib/_util/filterSpecialCharacters.js.map +1 -1
  4. package/lib/_util/getComponentProps.js +1 -4
  5. package/lib/_util/getComponentProps.js.map +1 -1
  6. package/lib/_util/getUrlParam.js +1 -8
  7. package/lib/_util/getUrlParam.js.map +1 -1
  8. package/lib/_util/isFunction.js +0 -1
  9. package/lib/_util/isFunction.js.map +1 -1
  10. package/lib/_util/isObject.js +0 -1
  11. package/lib/_util/isObject.js.map +1 -1
  12. package/lib/_util/useInterval.js +0 -3
  13. package/lib/_util/useInterval.js.map +1 -1
  14. package/lib/_util/useSet.js +23 -39
  15. package/lib/_util/useSet.js.map +1 -1
  16. package/lib/config.js +1 -2
  17. package/lib/config.js.map +1 -1
  18. package/lib/index.js +0 -22
  19. package/lib/index.js.map +1 -1
  20. package/lib/vtx-color-picker/index.js +10 -27
  21. package/lib/vtx-color-picker/index.js.map +1 -1
  22. package/lib/vtx-color-picker/style/css.js +0 -2
  23. package/lib/vtx-color-picker/style/css.js.map +1 -1
  24. package/lib/vtx-color-picker/style/index.js +0 -2
  25. package/lib/vtx-color-picker/style/index.js.map +1 -1
  26. package/lib/vtx-color-picker/style/index.less +12 -12
  27. package/lib/vtx-combogrid/Combogrid.js +45 -84
  28. package/lib/vtx-combogrid/Combogrid.js.map +1 -1
  29. package/lib/vtx-combogrid/index.js +27 -53
  30. package/lib/vtx-combogrid/index.js.map +1 -1
  31. package/lib/vtx-combogrid/style/css.js +0 -7
  32. package/lib/vtx-combogrid/style/css.js.map +1 -1
  33. package/lib/vtx-combogrid/style/index.js +0 -7
  34. package/lib/vtx-combogrid/style/index.js.map +1 -1
  35. package/lib/vtx-datagrid/Alert.js +4 -13
  36. package/lib/vtx-datagrid/Alert.js.map +1 -1
  37. package/lib/vtx-datagrid/ColumnSetting.js +24 -49
  38. package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
  39. package/lib/vtx-datagrid/ResizeableTitle.js +4 -16
  40. package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
  41. package/lib/vtx-datagrid/index.js +90 -148
  42. package/lib/vtx-datagrid/index.js.map +1 -1
  43. package/lib/vtx-datagrid/renderColumnButtons.js +8 -39
  44. package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
  45. package/lib/vtx-datagrid/style/css.js +0 -10
  46. package/lib/vtx-datagrid/style/css.js.map +1 -1
  47. package/lib/vtx-datagrid/style/index.js +0 -10
  48. package/lib/vtx-datagrid/style/index.js.map +1 -1
  49. package/lib/vtx-date-picker/QdatePicker.js +22 -52
  50. package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
  51. package/lib/vtx-date-picker/YearPicker.js +13 -36
  52. package/lib/vtx-date-picker/YearPicker.js.map +1 -1
  53. package/lib/vtx-date-picker/generatePicker.js +27 -69
  54. package/lib/vtx-date-picker/generatePicker.js.map +1 -1
  55. package/lib/vtx-date-picker/index.js +3 -10
  56. package/lib/vtx-date-picker/index.js.map +1 -1
  57. package/lib/vtx-date-picker/style/css.js +0 -1
  58. package/lib/vtx-date-picker/style/css.js.map +1 -1
  59. package/lib/vtx-date-picker/style/index.js +0 -1
  60. package/lib/vtx-date-picker/style/index.js.map +1 -1
  61. package/lib/vtx-editor/index.js +10 -29
  62. package/lib/vtx-editor/index.js.map +1 -1
  63. package/lib/vtx-editor/style/css.js +0 -2
  64. package/lib/vtx-editor/style/css.js.map +1 -1
  65. package/lib/vtx-editor/style/index.js +0 -2
  66. package/lib/vtx-editor/style/index.js.map +1 -1
  67. package/lib/vtx-export/index.js +31 -64
  68. package/lib/vtx-export/index.js.map +1 -1
  69. package/lib/vtx-export/style/css.js +0 -6
  70. package/lib/vtx-export/style/css.js.map +1 -1
  71. package/lib/vtx-export/style/index.js +0 -6
  72. package/lib/vtx-export/style/index.js.map +1 -1
  73. package/lib/vtx-export/style/index.less +6 -6
  74. package/lib/vtx-form-layout/Card.js +11 -33
  75. package/lib/vtx-form-layout/Card.js.map +1 -1
  76. package/lib/vtx-form-layout/Divider.js +1 -7
  77. package/lib/vtx-form-layout/Divider.js.map +1 -1
  78. package/lib/vtx-form-layout/FormItem.js +13 -38
  79. package/lib/vtx-form-layout/FormItem.js.map +1 -1
  80. package/lib/vtx-form-layout/Pane.js +3 -9
  81. package/lib/vtx-form-layout/Pane.js.map +1 -1
  82. package/lib/vtx-form-layout/Row.js +1 -8
  83. package/lib/vtx-form-layout/Row.js.map +1 -1
  84. package/lib/vtx-form-layout/context.js +1 -4
  85. package/lib/vtx-form-layout/context.js.map +1 -1
  86. package/lib/vtx-form-layout/index.js +9 -24
  87. package/lib/vtx-form-layout/index.js.map +1 -1
  88. package/lib/vtx-form-layout/style/css.js +0 -8
  89. package/lib/vtx-form-layout/style/css.js.map +1 -1
  90. package/lib/vtx-form-layout/style/index.js +0 -8
  91. package/lib/vtx-form-layout/style/index.js.map +1 -1
  92. package/lib/vtx-image/Image.js +65 -100
  93. package/lib/vtx-image/Image.js.map +1 -1
  94. package/lib/vtx-image/Preview.js +30 -59
  95. package/lib/vtx-image/Preview.js.map +1 -1
  96. package/lib/vtx-image/PreviewGroup.js +17 -47
  97. package/lib/vtx-image/PreviewGroup.js.map +1 -1
  98. package/lib/vtx-image/index.js +4 -11
  99. package/lib/vtx-image/index.js.map +1 -1
  100. package/lib/vtx-image/style/css.js +0 -1
  101. package/lib/vtx-image/style/css.js.map +1 -1
  102. package/lib/vtx-image/style/index.js +0 -1
  103. package/lib/vtx-image/style/index.js.map +1 -1
  104. package/lib/vtx-import/index.js +46 -79
  105. package/lib/vtx-import/index.js.map +1 -1
  106. package/lib/vtx-import/result.js +10 -28
  107. package/lib/vtx-import/result.js.map +1 -1
  108. package/lib/vtx-import/style/css.js +0 -2
  109. package/lib/vtx-import/style/css.js.map +1 -1
  110. package/lib/vtx-import/style/index.js +0 -2
  111. package/lib/vtx-import/style/index.js.map +1 -1
  112. package/lib/vtx-input/TextArea.js +11 -28
  113. package/lib/vtx-input/TextArea.js.map +1 -1
  114. package/lib/vtx-input/index.js +21 -46
  115. package/lib/vtx-input/index.js.map +1 -1
  116. package/lib/vtx-input/style/css.js +0 -1
  117. package/lib/vtx-input/style/css.js.map +1 -1
  118. package/lib/vtx-input/style/index.js +0 -1
  119. package/lib/vtx-input/style/index.js.map +1 -1
  120. package/lib/vtx-input/useLength.js +7 -20
  121. package/lib/vtx-input/useLength.js.map +1 -1
  122. package/lib/vtx-modal/Title.js +2 -8
  123. package/lib/vtx-modal/Title.js.map +1 -1
  124. package/lib/vtx-modal/index.js +51 -81
  125. package/lib/vtx-modal/index.js.map +1 -1
  126. package/lib/vtx-modal/style/css.js +0 -2
  127. package/lib/vtx-modal/style/css.js.map +1 -1
  128. package/lib/vtx-modal/style/index.js +0 -2
  129. package/lib/vtx-modal/style/index.js.map +1 -1
  130. package/lib/vtx-page-layout/Basic.js +5 -10
  131. package/lib/vtx-page-layout/Basic.js.map +1 -1
  132. package/lib/vtx-page-layout/Content.js +15 -26
  133. package/lib/vtx-page-layout/Content.js.map +1 -1
  134. package/lib/vtx-page-layout/Pane.js +3 -12
  135. package/lib/vtx-page-layout/Pane.js.map +1 -1
  136. package/lib/vtx-page-layout/TableLayout.js +24 -54
  137. package/lib/vtx-page-layout/TableLayout.js.map +1 -1
  138. package/lib/vtx-page-layout/TableWrap.js +11 -22
  139. package/lib/vtx-page-layout/TableWrap.js.map +1 -1
  140. package/lib/vtx-page-layout/container.js +25 -54
  141. package/lib/vtx-page-layout/container.js.map +1 -1
  142. package/lib/vtx-page-layout/index.js +1 -10
  143. package/lib/vtx-page-layout/index.js.map +1 -1
  144. package/lib/vtx-page-layout/style/css.js.map +1 -1
  145. package/lib/vtx-page-layout/style/index.js.map +1 -1
  146. package/lib/vtx-rps-frame/index.js +37 -52
  147. package/lib/vtx-rps-frame/index.js.map +1 -1
  148. package/lib/vtx-rps-frame/style/css.js.map +1 -1
  149. package/lib/vtx-rps-frame/style/index.js.map +1 -1
  150. package/lib/vtx-rps-frame/style/index.less +8 -8
  151. package/lib/vtx-scrollable-row/index.js +30 -66
  152. package/lib/vtx-scrollable-row/index.js.map +1 -1
  153. package/lib/vtx-scrollable-row/style/css.js +0 -1
  154. package/lib/vtx-scrollable-row/style/css.js.map +1 -1
  155. package/lib/vtx-scrollable-row/style/index.js +0 -1
  156. package/lib/vtx-scrollable-row/style/index.js.map +1 -1
  157. package/lib/vtx-search/VtxCol.js +7 -26
  158. package/lib/vtx-search/VtxCol.js.map +1 -1
  159. package/lib/vtx-search/VtxRow.js +7 -14
  160. package/lib/vtx-search/VtxRow.js.map +1 -1
  161. package/lib/vtx-search/index.js +55 -98
  162. package/lib/vtx-search/index.js.map +1 -1
  163. package/lib/vtx-search/style/css.js +0 -5
  164. package/lib/vtx-search/style/css.js.map +1 -1
  165. package/lib/vtx-search/style/index.js +0 -5
  166. package/lib/vtx-search/style/index.js.map +1 -1
  167. package/lib/vtx-search-map-input/index.js +46 -76
  168. package/lib/vtx-search-map-input/index.js.map +1 -1
  169. package/lib/vtx-search-map-input/style/css.js +0 -3
  170. package/lib/vtx-search-map-input/style/css.js.map +1 -1
  171. package/lib/vtx-search-map-input/style/index.js +0 -3
  172. package/lib/vtx-search-map-input/style/index.js.map +1 -1
  173. package/lib/vtx-select/index.js +31 -74
  174. package/lib/vtx-select/index.js.map +1 -1
  175. package/lib/vtx-select/style/css.js +0 -8
  176. package/lib/vtx-select/style/css.js.map +1 -1
  177. package/lib/vtx-select/style/index.js +0 -8
  178. package/lib/vtx-select/style/index.js.map +1 -1
  179. package/lib/vtx-signature/index.js +18 -33
  180. package/lib/vtx-signature/index.js.map +1 -1
  181. package/lib/vtx-signature/style/css.js +0 -2
  182. package/lib/vtx-signature/style/css.js.map +1 -1
  183. package/lib/vtx-signature/style/index.js +0 -2
  184. package/lib/vtx-signature/style/index.js.map +1 -1
  185. package/lib/vtx-split-pane/Pane.js +11 -22
  186. package/lib/vtx-split-pane/Pane.js.map +1 -1
  187. package/lib/vtx-split-pane/Resizer.js +20 -40
  188. package/lib/vtx-split-pane/Resizer.js.map +1 -1
  189. package/lib/vtx-split-pane/SplitPane.js +54 -107
  190. package/lib/vtx-split-pane/SplitPane.js.map +1 -1
  191. package/lib/vtx-split-pane/index.js +1 -6
  192. package/lib/vtx-split-pane/index.js.map +1 -1
  193. package/lib/vtx-split-pane/style/css.js +0 -3
  194. package/lib/vtx-split-pane/style/css.js.map +1 -1
  195. package/lib/vtx-split-pane/style/index.js +0 -3
  196. package/lib/vtx-split-pane/style/index.js.map +1 -1
  197. package/lib/vtx-statistics-column/Back.js +2 -9
  198. package/lib/vtx-statistics-column/Back.js.map +1 -1
  199. package/lib/vtx-statistics-column/Item.js +14 -30
  200. package/lib/vtx-statistics-column/Item.js.map +1 -1
  201. package/lib/vtx-statistics-column/Total.js +14 -30
  202. package/lib/vtx-statistics-column/Total.js.map +1 -1
  203. package/lib/vtx-statistics-column/context.js +1 -4
  204. package/lib/vtx-statistics-column/context.js.map +1 -1
  205. package/lib/vtx-statistics-column/index.js +1 -18
  206. package/lib/vtx-statistics-column/index.js.map +1 -1
  207. package/lib/vtx-statistics-column/style/css.js.map +1 -1
  208. package/lib/vtx-statistics-column/style/index.js.map +1 -1
  209. package/lib/vtx-time-picker/index.js +5 -19
  210. package/lib/vtx-time-picker/index.js.map +1 -1
  211. package/lib/vtx-time-picker/style/css.js.map +1 -1
  212. package/lib/vtx-time-picker/style/index.js.map +1 -1
  213. package/lib/vtx-upload/FilePreview.js +15 -33
  214. package/lib/vtx-upload/FilePreview.js.map +1 -1
  215. package/lib/vtx-upload/index.js +78 -147
  216. package/lib/vtx-upload/index.js.map +1 -1
  217. package/lib/vtx-upload/style/css.js +0 -6
  218. package/lib/vtx-upload/style/css.js.map +1 -1
  219. package/lib/vtx-upload/style/index.js +0 -6
  220. package/lib/vtx-upload/style/index.js.map +1 -1
  221. package/lib/vtx-ztree/index.js +71 -122
  222. package/lib/vtx-ztree/index.js.map +1 -1
  223. package/lib/vtx-ztree/style/css.js +0 -1
  224. package/lib/vtx-ztree/style/css.js.map +1 -1
  225. package/lib/vtx-ztree/style/index.js +0 -1
  226. package/lib/vtx-ztree/style/index.js.map +1 -1
  227. package/lib/vtx-ztree-select/index.js +60 -121
  228. package/lib/vtx-ztree-select/index.js.map +1 -1
  229. package/lib/vtx-ztree-select/style/css.js +0 -4
  230. package/lib/vtx-ztree-select/style/css.js.map +1 -1
  231. package/lib/vtx-ztree-select/style/index.js +0 -4
  232. package/lib/vtx-ztree-select/style/index.js.map +1 -1
  233. package/package.json +121 -121
  234. package/CHANGELOG.md +0 -842
@@ -4,64 +4,42 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _input = _interopRequireDefault(require("antd/lib/input"));
11
-
12
9
  var _lodash = _interopRequireDefault(require("lodash.isequal"));
13
-
14
10
  var _lodash2 = _interopRequireDefault(require("lodash.merge"));
15
-
16
11
  var _lodash3 = _interopRequireDefault(require("lodash.debounce"));
17
-
18
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
19
-
20
13
  var _classnames2 = _interopRequireDefault(require("classnames"));
21
-
22
14
  var _config = _interopRequireDefault(require("../config"));
23
-
24
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
-
26
- 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; }
27
-
28
- 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; }
29
-
30
- 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); }
31
-
16
+ 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; }
17
+ 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; }
18
+ 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); }
32
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
- 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); } }
35
-
20
+ 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); } }
36
21
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
-
38
- 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); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
- 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); }; }
43
-
22
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
44
23
  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); }
45
-
46
24
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
- 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; } }
49
-
25
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
50
26
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
- 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; }
53
-
54
- var VtxZtree = /*#__PURE__*/function (_React$Component) {
55
- _inherits(VtxZtree, _React$Component);
56
-
57
- var _super = _createSuper(VtxZtree);
58
-
27
+ 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); }
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
+ 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; }
30
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
31
+ 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); } /*
32
+ * @Author: yemu
33
+ * @Date: 2021-04-08 22:03:07
34
+ * @LastEditTime: 2021-04-09 10:36:45
35
+ * @LastEditors: yemu
36
+ * @Description: 树形控件
37
+ */
38
+ var VtxZtree = exports["default"] = /*#__PURE__*/function (_React$Component) {
59
39
  function VtxZtree(props) {
60
40
  var _this;
61
-
62
41
  _classCallCheck(this, VtxZtree);
63
-
64
- _this = _super.call(this, props);
42
+ _this = _callSuper(this, VtxZtree, [props]);
65
43
  _this.treeId = "tree-".concat(new Date().getTime(), "-").concat(parseInt(Math.random() * 10000));
66
44
  _this.zTreeObj = null;
67
45
  _this.treeSetting = {};
@@ -70,14 +48,14 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
70
48
  _this.searchTimeOutId = null;
71
49
  _this.loadPromise = _this.loadTreeResource();
72
50
  _this.loadComplete = false;
73
- _this.fuzzySearch = (0, _lodash3["default"])(_this.fuzzySearch.bind(_assertThisInitialized(_this)), 300);
51
+ _this.fuzzySearch = (0, _lodash3["default"])(_this.fuzzySearch.bind(_this), 300);
74
52
  _this.state = {
75
53
  searchVal: ''
76
54
  };
77
55
  return _this;
78
56
  }
79
-
80
- _createClass(VtxZtree, [{
57
+ _inherits(VtxZtree, _React$Component);
58
+ return _createClass(VtxZtree, [{
81
59
  key: "loadTreeResource",
82
60
  value: function loadTreeResource() {
83
61
  if (!$.fn.zTree) {
@@ -104,10 +82,8 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
104
82
  key: "componentDidMount",
105
83
  value: function componentDidMount() {
106
84
  var _this2 = this;
107
-
108
85
  this.loadPromise.then(function () {
109
86
  _this2.loadComplete = true;
110
-
111
87
  _this2.refreshTree(_this2.props);
112
88
  });
113
89
  }
@@ -115,7 +91,6 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
115
91
  key: "componentDidUpdate",
116
92
  value: function componentDidUpdate(prevProps) {
117
93
  if (!this.loadComplete) return;
118
-
119
94
  if (!(0, _lodash["default"])(prevProps.refreshFlag, this.props.refreshFlag) || !(0, _lodash["default"])(prevProps.data, this.props.data)) {
120
95
  this.refreshTree(this.props);
121
96
  }
@@ -124,13 +99,14 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
124
99
  key: "componentWillUnmount",
125
100
  value: function componentWillUnmount() {
126
101
  this.zTreeObj && this.zTreeObj.destroy();
127
- } // 初始化树的配置
102
+ }
128
103
 
104
+ // 初始化树的配置
129
105
  }, {
130
106
  key: "initTreeSetting",
131
107
  value: function initTreeSetting(props) {
132
- var t = this; // 初始化树的配置
133
-
108
+ var t = this;
109
+ // 初始化树的配置
134
110
  this.treeSetting = {
135
111
  check: {
136
112
  enable: !!props.checkable,
@@ -242,32 +218,30 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
242
218
  }
243
219
  }
244
220
  }
245
- }; // 继承外部配置
246
-
221
+ };
222
+ // 继承外部配置
247
223
  if (_typeof(this.props.customCfg) == 'object') {
248
224
  (0, _lodash2["default"])(this.treeSetting, this.props.customCfg);
249
225
  }
250
- } // 初始化树的数据,对expandedKeys,checkedKeys做处理
226
+ }
251
227
 
228
+ // 初始化树的数据,对expandedKeys,checkedKeys做处理
252
229
  }, {
253
230
  key: "initTreeNodes",
254
231
  value: function initTreeNodes(props) {
255
232
  var t = this;
256
233
  this.keyNameMapping = {};
257
-
258
234
  if (!Array.isArray(props.data)) {
259
235
  this.treeNodes = [];
260
236
  } else {
261
237
  var checkedKeys = props.checkedKeys || [];
262
238
  var expandedKeys = props.expandedKeys || [];
263
239
  var chkDisabled = !!props.disableCheckboxAll;
264
-
265
240
  this.treeNodes = function genNodes(nodes) {
266
241
  return nodes.map(function (item) {
267
242
  var checked = checkedKeys.indexOf(item.key) != -1;
268
243
  var open = expandedKeys.indexOf(item.key) != -1;
269
244
  t.keyNameMapping[item.key] = item.name;
270
-
271
245
  if (Array.isArray(item.children) && item.children.length > 0) {
272
246
  return _objectSpread(_objectSpread({
273
247
  chkDisabled: chkDisabled,
@@ -288,22 +262,19 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
288
262
  }
289
263
  }).map(function (item) {
290
264
  if (Array.isArray(item.children) && item.children.length > 0) {
291
- var newNode = _objectSpread({}, item); // 如果子节点全部被勾选,父节点自动勾选
292
-
293
-
265
+ var newNode = _objectSpread({}, item);
266
+ // 如果子节点全部被勾选,父节点自动勾选
294
267
  if (item.children.every(function (item) {
295
268
  return item.checked;
296
269
  })) {
297
270
  newNode.checked = true;
298
- } // 如果配置了自动展开父节点,父节点自动展开
299
-
300
-
271
+ }
272
+ // 如果配置了自动展开父节点,父节点自动展开
301
273
  if (props.autoExpandParent && item.children.some(function (item) {
302
274
  return item.open;
303
275
  })) {
304
276
  newNode.open = true;
305
277
  }
306
-
307
278
  return newNode;
308
279
  } else {
309
280
  return item;
@@ -311,8 +282,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
311
282
  });
312
283
  }(props.data);
313
284
  }
314
- } // 重新生成树
285
+ }
315
286
 
287
+ // 重新生成树
316
288
  }, {
317
289
  key: "refreshTree",
318
290
  value: function refreshTree(newProps) {
@@ -320,65 +292,62 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
320
292
  this.initTreeSetting(newProps);
321
293
  this.initTreeNodes(newProps);
322
294
  this.zTreeObj = $.fn.zTree.init($("#".concat(this.treeId)), this.treeSetting, this.treeNodes);
323
-
324
295
  if (Array.isArray(newProps.selectedKeys)) {
325
296
  this.selectNodes(newProps.selectedKeys, newProps.multiple);
326
- } // 初始化全展开判断
327
-
328
-
297
+ }
298
+ // 初始化全展开判断
329
299
  if (newProps.defaultExpandAll && !newProps.expandedKeys) {
330
300
  this.zTreeObj.expandAll(true);
331
301
  }
332
- } // 展开或折叠相关节点,expandFlag为true表示展开,false表示折叠
302
+ }
333
303
 
304
+ // 展开或折叠相关节点,expandFlag为true表示展开,false表示折叠
334
305
  }, {
335
306
  key: "expandNodes",
336
307
  value: function expandNodes(expandedKeys) {
337
308
  var expandFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
338
-
339
309
  for (var i = 0, len = expandedKeys.length; i < len; i++) {
340
310
  var node = this.zTreeObj.getNodesByParam('key', expandedKeys[i]).pop();
341
-
342
311
  if (node) {
343
312
  this.zTreeObj.expandNode(node, expandFlag, false, false);
344
313
  }
345
314
  }
346
- } // 勾选节点, checkedFlag为true表示勾选,false表示取消勾选
315
+ }
347
316
 
317
+ // 勾选节点, checkedFlag为true表示勾选,false表示取消勾选
348
318
  }, {
349
319
  key: "checkNodes",
350
320
  value: function checkNodes(checkedKeys) {
351
321
  var checkedFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
352
-
353
322
  for (var i = 0, len = checkedKeys.length; i < len; i++) {
354
323
  var node = this.zTreeObj.getNodesByParam('key', checkedKeys[i]).pop();
355
-
356
324
  if (node) {
357
325
  // 隐藏节点的勾选状态也要改变
358
326
  node.checked = checkedFlag;
359
- this.zTreeObj.updateNode(node, true); // this.zTreeObj.checkNode(node,checkedFlag,false);
327
+ this.zTreeObj.updateNode(node, true);
328
+ // this.zTreeObj.checkNode(node,checkedFlag,false);
360
329
  }
361
330
  }
362
- } // 点击选择节点
331
+ }
363
332
 
333
+ // 点击选择节点
364
334
  }, {
365
335
  key: "selectNodes",
366
336
  value: function selectNodes(selectedKeys, multiple) {
367
337
  for (var i = 0, len = selectedKeys.length; i < len; i++) {
368
338
  var node = this.zTreeObj.getNodesByParam('key', selectedKeys[i]).pop();
369
-
370
339
  if (node) {
371
340
  this.zTreeObj.selectNode(node, multiple, true);
372
341
  }
373
342
  }
374
- } // 取消选择节点
343
+ }
375
344
 
345
+ // 取消选择节点
376
346
  }, {
377
347
  key: "cancelSelectedNodes",
378
348
  value: function cancelSelectedNodes(selectedKeys) {
379
349
  for (var i = 0, len = selectedKeys.length; i < len; i++) {
380
350
  var node = this.zTreeObj.getNodesByParam('key', selectedKeys[i]).pop();
381
-
382
351
  if (node) {
383
352
  this.zTreeObj.cancelSelectedNode(node);
384
353
  }
@@ -392,38 +361,34 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
392
361
  var nameKey = this.zTreeObj.setting.data.key.name; // get the key of the node name
393
362
  // isHighLight = isHighLight===false?false:true;//default true, only use false to disable highlight
394
363
  // isExpand = isExpand?true:false; // not to expand in default
395
-
396
364
  this.zTreeObj.setting.view.nameIsHTML = isHighLight; // allow use html in node name for highlight use
397
365
 
398
366
  var metaChar = '[\\[\\]\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; // js meta characters
399
-
400
367
  var rexMeta = new RegExp(metaChar, 'gi'); // regular expression to match meta characters
368
+
401
369
  // searchNodeLazy(keyworld);
370
+ ztreeFilter(t.zTreeObj, keyworld);
402
371
 
403
- ztreeFilter(t.zTreeObj, keyworld); // -----------------------------内部函数----------------------------------
372
+ // -----------------------------内部函数----------------------------------
404
373
  // keywords filter function
405
-
406
374
  function ztreeFilter(zTreeObj, _keywords) {
407
375
  if (!_keywords) {
408
376
  _keywords = ''; // default blank for _keywords
409
- } // function to find the matching node
410
-
377
+ }
411
378
 
379
+ // function to find the matching node
412
380
  function filterFunc(node) {
413
381
  if (node && node.oldname && node.oldname.length > 0) {
414
382
  node[nameKey] = node.oldname; // recover oldname of the node if exist
415
383
  }
416
-
417
384
  zTreeObj.updateNode(node); // update node to for modifications take effect
418
-
419
385
  if (_keywords.length == 0) {
420
386
  // return true to show all nodes if the keyword is blank
421
- zTreeObj.showNode(node); // zTreeObj.expandNode(node,isExpand);
422
-
387
+ zTreeObj.showNode(node);
388
+ // zTreeObj.expandNode(node,isExpand);
423
389
  return true;
424
- } // transform node name and keywords to lowercase
425
-
426
-
390
+ }
391
+ // transform node name and keywords to lowercase
427
392
  if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase()) != -1) {
428
393
  if (isHighLight) {
429
394
  // highlight process
@@ -434,12 +399,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
434
399
  // add escape character before meta characters
435
400
  return '\\' + matchStr;
436
401
  });
437
-
438
402
  node.oldname = node[nameKey]; // store the old name
439
-
440
403
  var rexGlobal = new RegExp(newKeywords, 'gi'); // 'g' for global,'i' for ignore case
441
404
  // use replace(RegExp,replacement) since replace(/substr/g,replacement) cannot be used here
442
-
443
405
  node[nameKey] = node.oldname.replace(rexGlobal, function (originalText) {
444
406
  // highlight the matching words in node name
445
407
  var highLightText = '<span style="color: whitesmoke;background-color:#f50;">' + originalText + '</span>';
@@ -447,38 +409,29 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
447
409
  });
448
410
  zTreeObj.updateNode(node); // update node for modifications take effect
449
411
  }
450
-
451
412
  zTreeObj.showNode(node); // show node with matching keywords
452
-
453
413
  return true; // return true and show this node
454
414
  }
455
-
456
415
  zTreeObj.hideNode(node); // hide node that not matched
457
-
458
416
  return false; // return false for node not matched
459
417
  }
460
-
461
418
  var nodesShow = zTreeObj.getNodesByFilter(filterFunc); // get all nodes that would be shown
462
-
463
419
  processShowNodes(zTreeObj, nodesShow, _keywords); // nodes should be reprocessed to show correctly
464
420
  }
421
+
465
422
  /**
466
423
  * reprocess of nodes before showing
467
424
  */
468
-
469
-
470
425
  function processShowNodes(zTreeObj, nodesShow, _keywords) {
471
426
  if (nodesShow && nodesShow.length > 0) {
472
427
  // process the ancient nodes if _keywords is not blank
473
428
  if (_keywords.length > 0) {
474
429
  $.each(nodesShow, function (n, obj) {
475
430
  var pathOfOne = obj.getPath(); // get all the ancient nodes including current node
476
-
477
431
  if (pathOfOne && pathOfOne.length > 0) {
478
432
  // i < pathOfOne.length-1 process every node in path except self
479
433
  for (var i = 0; i < pathOfOne.length - 1; i++) {
480
434
  zTreeObj.showNode(pathOfOne[i]); // show node
481
-
482
435
  zTreeObj.expandNode(pathOfOne[i], true); // expand node
483
436
  }
484
437
  }
@@ -486,15 +439,15 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
486
439
  } else {
487
440
  // show all nodes when _keywords is blank and expand the root nodes
488
441
  var rootNodes = zTreeObj.getNodesByParam('level', '0'); // get all root nodes
489
-
490
442
  $.each(rootNodes, function (n, obj) {
491
443
  zTreeObj.expandNode(obj, true); // expand all root nodes
492
444
  });
493
445
  }
494
446
  }
495
447
  }
496
- } // 清空搜索框数据(供外部调用)
448
+ }
497
449
 
450
+ // 清空搜索框数据(供外部调用)
498
451
  }, {
499
452
  key: "clearSearch",
500
453
  value: function clearSearch() {
@@ -503,13 +456,13 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
503
456
  searchVal: ''
504
457
  });
505
458
  this.refreshTree(this.props);
506
- } // 获取所有已被勾选的节点
459
+ }
507
460
 
461
+ // 获取所有已被勾选的节点
508
462
  }, {
509
463
  key: "getCheckedNodes",
510
464
  value: function getCheckedNodes() {
511
465
  var _this3 = this;
512
-
513
466
  return this.zTreeObj.getNodesByFilter(function (node) {
514
467
  // 节点被勾选(非半勾状态)
515
468
  if (_this3.props.checkStrictly) return node.checked;
@@ -517,11 +470,11 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
517
470
  }).map(function (item) {
518
471
  return _objectSpread(_objectSpread({}, item), {}, {
519
472
  name: item.oldname || item.name // 搜索树会改变节点的name
520
-
521
473
  });
522
474
  });
523
- } // 获取所有已被点击选中的节点
475
+ }
524
476
 
477
+ // 获取所有已被点击选中的节点
525
478
  }, {
526
479
  key: "getSelectedNodes",
527
480
  value: function getSelectedNodes() {
@@ -530,14 +483,16 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
530
483
  name: item.oldname || item.name
531
484
  });
532
485
  });
533
- } // 展开所有节点(供外部调用)
486
+ }
534
487
 
488
+ // 展开所有节点(供外部调用)
535
489
  }, {
536
490
  key: "expandAll",
537
491
  value: function expandAll() {
538
492
  this.zTreeObj.expandAll(true);
539
- } // 收起所有节点(供外部调用)
493
+ }
540
494
 
495
+ // 收起所有节点(供外部调用)
541
496
  }, {
542
497
  key: "collapseAll",
543
498
  value: function collapseAll() {
@@ -548,9 +503,9 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
548
503
  value: function render() {
549
504
  var t = this;
550
505
  var _t$props = t.props,
551
- prefixCls = _t$props.prefixCls,
552
- showSearch = _t$props.showSearch,
553
- searchPlaceholder = _t$props.searchPlaceholder;
506
+ prefixCls = _t$props.prefixCls,
507
+ showSearch = _t$props.showSearch,
508
+ searchPlaceholder = _t$props.searchPlaceholder;
554
509
  return /*#__PURE__*/_react["default"].createElement("div", {
555
510
  className: (0, _classnames2["default"])("".concat(prefixCls, "-wraaper"), _defineProperty({}, "".concat(prefixCls, "-has-search"), showSearch))
556
511
  }, showSearch && /*#__PURE__*/_react["default"].createElement("div", {
@@ -570,17 +525,11 @@ var VtxZtree = /*#__PURE__*/function (_React$Component) {
570
525
  }));
571
526
  }
572
527
  }]);
573
-
574
- return VtxZtree;
575
528
  }(_react["default"].Component);
576
-
577
- exports["default"] = VtxZtree;
578
-
579
529
  _defineProperty(VtxZtree, "defaultProps", {
580
530
  showSearch: true,
581
531
  prefixCls: 'vtx-ztree'
582
532
  });
583
-
584
533
  VtxZtree.propTypes = {
585
534
  showSearch: _propTypes["default"].bool,
586
535
  searchPlaceholder: _propTypes["default"].string,