fan-standard-comp 3.1.9 → 3.2.0

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 (176) hide show
  1. package/Readme.md +35 -0
  2. package/dist/fan-standard-comp.umd.js +15 -10
  3. package/es/ButtonGroup/ButtonList.js +0 -3
  4. package/es/ButtonGroup/ButtonMenu.js +0 -3
  5. package/es/ButtonGroup/PopConfirmTitle.js +5 -15
  6. package/es/ButtonGroup/index.d.ts +2 -0
  7. package/es/ButtonGroup/index.js +223 -193
  8. package/es/ButtonGroup/style/index.less +1 -1
  9. package/es/DragContent/DragBar.js +2 -6
  10. package/es/DragContent/index.js +44 -75
  11. package/es/FormComp/ChunkUploader/api.js +6 -10
  12. package/es/FormComp/ChunkUploader/index.js +105 -171
  13. package/es/FormComp/ChunkUploader/lib.js +4 -17
  14. package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
  15. package/es/FormComp/ChunkUploader/worker.js +0 -3
  16. package/es/FormComp/EditButton/index.js +24 -49
  17. package/es/FormComp/FieldComponent/ReUpload.js +18 -38
  18. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
  19. package/es/FormComp/FieldComponent/TitleNode.js +1 -3
  20. package/es/FormComp/FieldComponent/index.js +38 -74
  21. package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
  22. package/es/FormComp/FieldComponent/style/index.less +6 -0
  23. package/es/FormComp/RenderItemGroup/index.js +46 -74
  24. package/es/FormComp/Uploader/index.js +36 -77
  25. package/es/FormComp/Uploader/util.js +0 -6
  26. package/es/FormComp/VarTemplate/index.js +58 -96
  27. package/es/NavLeafScroll/index.js +172 -154
  28. package/es/NavLeafScroll/style/index.less +33 -1
  29. package/es/RefactorTree/index.js +36 -53
  30. package/es/RefactorTree/indexTreeNode.js +35 -68
  31. package/es/RefactorTree/util.js +9 -43
  32. package/es/SpecIcon/fonts/iconfont.js +7 -12
  33. package/es/SpecIcon/index.js +16 -25
  34. package/es/SplitterLayout/Pane.js +2 -5
  35. package/es/SplitterLayout/index.js +20 -70
  36. package/es/StandardContent/SplitterLayout/Pane.js +6 -10
  37. package/es/StandardContent/SplitterLayout/index.js +12 -63
  38. package/es/StandardContent/SubfieldContent.js +12 -14
  39. package/es/StandardContent/WrapperContent.js +8 -10
  40. package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  41. package/es/StandardDragModal/ChangeStandardModal.js +493 -0
  42. package/es/StandardDragModal/DraggableModal.d.ts +7 -0
  43. package/es/StandardDragModal/DraggableModal.js +31 -0
  44. package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
  45. package/es/StandardDragModal/DraggableModalContext.js +5 -0
  46. package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
  47. package/es/StandardDragModal/DraggableModalInner.js +114 -0
  48. package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  49. package/es/StandardDragModal/DraggableModalProvider.js +40 -0
  50. package/es/StandardDragModal/Modal.d.ts +11 -0
  51. package/es/StandardDragModal/Modal.js +24 -0
  52. package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
  53. package/es/StandardDragModal/ResizeHandle.js +8 -0
  54. package/es/StandardDragModal/clamp.d.ts +1 -0
  55. package/es/StandardDragModal/clamp.js +3 -0
  56. package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
  57. package/es/StandardDragModal/draggableModalReducer.js +157 -0
  58. package/es/StandardDragModal/getWindowSize.d.ts +4 -0
  59. package/es/StandardDragModal/getWindowSize.js +6 -0
  60. package/es/StandardDragModal/index.d.ts +3 -11
  61. package/es/StandardDragModal/index.js +3 -30
  62. package/es/StandardDragModal/index.less +65 -0
  63. package/es/StandardDragModal/useDrag.d.ts +5 -0
  64. package/es/StandardDragModal/useDrag.js +66 -0
  65. package/es/StandardDragModal/usePrevious.d.ts +1 -0
  66. package/es/StandardDragModal/usePrevious.js +8 -0
  67. package/es/StandardDragModal/useResize.d.ts +7 -0
  68. package/es/StandardDragModal/useResize.js +74 -0
  69. package/es/StandardFilter/index.d.ts +1 -0
  70. package/es/StandardFilter/index.js +32 -70
  71. package/es/StandardForm/ActionList.js +5 -7
  72. package/es/StandardForm/StepForm.js +50 -71
  73. package/es/StandardForm/TabForm.js +58 -70
  74. package/es/StandardForm/index.js +37 -56
  75. package/es/StandardModal/UpdateFormRef.js +1 -4
  76. package/es/StandardModal/index.d.ts +0 -1
  77. package/es/StandardModal/index.js +115 -159
  78. package/es/StandardPanel/index.js +19 -35
  79. package/es/StandardTable/index.js +20 -30
  80. package/es/components/IconNode/index.js +0 -4
  81. package/es/index.d.ts +1 -0
  82. package/es/index.js +15 -14
  83. package/es/utils/ValueFormat.js +0 -9
  84. package/es/utils/dictSelectUtil.js +153 -0
  85. package/es/utils/filterPermission.js +16 -34
  86. package/es/utils/getParentNodes.js +24 -47
  87. package/es/utils/index.js +2 -1
  88. package/lib/ButtonGroup/ButtonList.js +1 -13
  89. package/lib/ButtonGroup/ButtonMenu.js +1 -8
  90. package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
  91. package/lib/ButtonGroup/index.d.ts +2 -0
  92. package/lib/ButtonGroup/index.js +226 -216
  93. package/lib/ButtonGroup/style/index.less +1 -1
  94. package/lib/DragContent/DragBar.js +2 -10
  95. package/lib/DragContent/index.js +47 -85
  96. package/lib/FormComp/ChunkUploader/api.js +6 -15
  97. package/lib/FormComp/ChunkUploader/index.js +107 -185
  98. package/lib/FormComp/ChunkUploader/lib.js +8 -27
  99. package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
  100. package/lib/FormComp/ChunkUploader/worker.js +1 -5
  101. package/lib/FormComp/EditButton/index.js +26 -60
  102. package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
  103. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
  104. package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
  105. package/lib/FormComp/FieldComponent/index.js +38 -110
  106. package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
  107. package/lib/FormComp/FieldComponent/style/index.less +6 -0
  108. package/lib/FormComp/RenderItemGroup/index.js +46 -87
  109. package/lib/FormComp/Uploader/index.js +38 -95
  110. package/lib/FormComp/Uploader/util.js +1 -9
  111. package/lib/FormComp/VarTemplate/index.js +62 -106
  112. package/lib/FormComp/index.js +0 -2
  113. package/lib/NavLeafScroll/index.js +174 -165
  114. package/lib/NavLeafScroll/style/index.less +33 -1
  115. package/lib/RefactorTree/index.js +36 -67
  116. package/lib/RefactorTree/indexTreeNode.js +37 -83
  117. package/lib/RefactorTree/util.js +11 -45
  118. package/lib/SpecIcon/fonts/iconfont.js +7 -12
  119. package/lib/SpecIcon/index.js +16 -30
  120. package/lib/SplitterLayout/Pane.js +0 -7
  121. package/lib/SplitterLayout/index.js +18 -72
  122. package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
  123. package/lib/StandardContent/SplitterLayout/index.js +12 -68
  124. package/lib/StandardContent/SubfieldContent.js +12 -21
  125. package/lib/StandardContent/WrapperContent.js +8 -16
  126. package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  127. package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
  128. package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
  129. package/lib/StandardDragModal/DraggableModal.js +40 -0
  130. package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
  131. package/lib/StandardDragModal/DraggableModalContext.js +15 -0
  132. package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
  133. package/lib/StandardDragModal/DraggableModalInner.js +124 -0
  134. package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  135. package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
  136. package/lib/StandardDragModal/Modal.d.ts +11 -0
  137. package/lib/StandardDragModal/Modal.js +32 -0
  138. package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
  139. package/lib/StandardDragModal/ResizeHandle.js +18 -0
  140. package/lib/StandardDragModal/clamp.d.ts +1 -0
  141. package/lib/StandardDragModal/clamp.js +10 -0
  142. package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
  143. package/lib/StandardDragModal/draggableModalReducer.js +167 -0
  144. package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
  145. package/lib/StandardDragModal/getWindowSize.js +13 -0
  146. package/lib/StandardDragModal/index.d.ts +3 -11
  147. package/lib/StandardDragModal/index.js +33 -38
  148. package/lib/StandardDragModal/index.less +65 -0
  149. package/lib/StandardDragModal/useDrag.d.ts +5 -0
  150. package/lib/StandardDragModal/useDrag.js +73 -0
  151. package/lib/StandardDragModal/usePrevious.d.ts +1 -0
  152. package/lib/StandardDragModal/usePrevious.js +15 -0
  153. package/lib/StandardDragModal/useResize.d.ts +7 -0
  154. package/lib/StandardDragModal/useResize.js +81 -0
  155. package/lib/StandardFilter/index.d.ts +1 -0
  156. package/lib/StandardFilter/index.js +30 -78
  157. package/lib/StandardForm/ActionList.js +5 -12
  158. package/lib/StandardForm/StepForm.js +52 -90
  159. package/lib/StandardForm/TabForm.js +61 -88
  160. package/lib/StandardForm/index.js +40 -75
  161. package/lib/StandardModal/UpdateFormRef.js +4 -12
  162. package/lib/StandardModal/index.d.ts +0 -1
  163. package/lib/StandardModal/index.js +117 -184
  164. package/lib/StandardPanel/index.js +22 -48
  165. package/lib/StandardTable/index.js +20 -39
  166. package/lib/components/IconNode/index.js +0 -7
  167. package/lib/components/index.js +0 -2
  168. package/lib/data/index.js +4 -7
  169. package/lib/index.d.ts +1 -0
  170. package/lib/index.js +50 -68
  171. package/lib/utils/ValueFormat.js +0 -10
  172. package/lib/utils/dictSelectUtil.js +161 -0
  173. package/lib/utils/filterPermission.js +15 -39
  174. package/lib/utils/getParentNodes.js +25 -52
  175. package/lib/utils/index.js +24 -9
  176. package/package.json +6 -5
@@ -1,180 +1,182 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; 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); }
2
-
3
1
  import "antd/es/badge/style";
4
2
  import _Badge from "antd/es/badge";
5
-
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); }
6
4
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
-
8
- 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); } }
9
-
10
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
11
-
12
- 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); }
13
-
14
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
-
5
+ 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); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ 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); }
8
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
9
  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); }; }
17
-
18
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
19
-
10
+ 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); }
20
11
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
-
22
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
23
-
24
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25
-
26
- 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; }
27
-
12
+ 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; } }
13
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
+ 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; }
15
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
+ 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); }
28
17
  // @ts-ignore
29
18
  import React, { Component } from 'react';
30
19
  import SpecIcon from "../SpecIcon/index";
31
20
  import _ from 'lodash';
32
21
  import classNames from 'classnames';
33
22
  import './style/index.less';
34
-
35
23
  var NavLeafScroll = /*#__PURE__*/function (_Component) {
36
24
  _inherits(NavLeafScroll, _Component);
37
-
38
25
  var _super = _createSuper(NavLeafScroll);
39
-
40
26
  function NavLeafScroll(props) {
41
27
  var _this;
42
-
43
28
  _classCallCheck(this, NavLeafScroll);
44
-
45
29
  _this = _super.call(this, props);
46
-
47
30
  _defineProperty(_assertThisInitialized(_this), "initFloorValues", function () {
48
31
  var _this$props = _this.props,
49
- baseItemHeight = _this$props.baseItemHeight,
50
- activeKey = _this$props.activeKey,
51
- navList = _this$props.navList,
52
- _this$props$optionNam = _this$props.optionName,
53
- optionName = _this$props$optionNam === void 0 ? {
54
- key: 'id',
55
- title: 'title',
56
- count: 'count'
57
- } : _this$props$optionNam; // 元素个数占用的高度是否不超过内容区域
58
-
32
+ baseItemHeight = _this$props.baseItemHeight,
33
+ baseItemWidth = _this$props.baseItemWidth,
34
+ activeKey = _this$props.activeKey,
35
+ navList = _this$props.navList,
36
+ _this$props$optionNam = _this$props.optionName,
37
+ optionName = _this$props$optionNam === void 0 ? {
38
+ key: 'id',
39
+ title: 'title',
40
+ count: 'count'
41
+ } : _this$props$optionNam,
42
+ type = _this$props.type; // 元素个数占用的高度是否不超过内容区域
59
43
  var isInsideEnough = navList.length * baseItemHeight <= _this.mainWrap.current.clientHeight;
60
44
  var wrapHeight = _this.mainWrap.current.clientHeight - (isInsideEnough ? 0 : 32 * 2); // 每次需要移动的偏移量 32是上下切换角占用的高度
61
-
62
45
  var floorHeight = _this.leafNav.current.clientHeight; // 所有楼层占用的高度
63
-
64
- var isEnough = wrapHeight % baseItemHeight === 0; // 剩余的是否足够容纳一个单元格
65
- // 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
66
-
67
- if (_this.mainWrap.current.clientHeight - (isInsideEnough ? 0 : 32 * 2) >= baseItemHeight) {
68
- wrapHeight -= wrapHeight % baseItemHeight; // 判断是否除不尽,如果还有余数,则当前 区域有效区域要去除一个单元格的高度
46
+ // const isEnough = wrapHeight % baseItemHeight === 0; // 剩余的是否足够容纳一个单元格
47
+ var isInsideEnoughWidth = navList.length * baseItemWidth <= _this.mainWrap.current.clientWidth;
48
+ var wrapWidth = _this.mainWrap.current.clientWidth - (isInsideEnoughWidth ? 0 : 30 * 2);
49
+ var floorWidth = _this.leafNav.current.clientWidth; // 所有楼层占用的宽度
50
+ if (type === 'horizontal') {
51
+ // 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
52
+ if (_this.mainWrap.current.clientWidth - (isInsideEnoughWidth ? 0 : 30 * 2) >= baseItemWidth) {
53
+ wrapWidth -= wrapWidth % baseItemWidth; // 判断是否除不尽,如果还有余数,则当前 区域有效区域要去除一个单元格的高度
54
+ } else {
55
+ wrapWidth = baseItemWidth;
56
+ }
69
57
  } else {
70
- wrapHeight = baseItemHeight;
58
+ // 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
59
+ if (_this.mainWrap.current.clientHeight - (isInsideEnough ? 0 : 32 * 2) >= baseItemHeight) {
60
+ wrapHeight -= wrapHeight % baseItemHeight; // 判断是否除不尽,如果还有余数,则当前 区域有效区域要去除一个单元格的高度
61
+ } else {
62
+ wrapHeight = baseItemHeight;
63
+ }
71
64
  }
72
-
73
- var stepSize = wrapHeight / baseItemHeight; // - (isEnough ? 0 : 1) // 当前一页可容纳的单元格数量
74
-
65
+ var stepSize = type === 'horizontal' ? wrapWidth / baseItemWidth : wrapHeight / baseItemHeight; // - (isEnough ? 0 : 1) // 当前一页可容纳的单元格数量
75
66
  _this.setState({
76
67
  floorRelatedSize: {
77
68
  wrapHeight: wrapHeight,
78
69
  // 有效内容区域的
79
- floorHeight: floorHeight // 楼层列表占用的高度
80
-
70
+ floorHeight: floorHeight,
71
+ // 楼层列表占用的高度
72
+ wrapWidth: wrapWidth,
73
+ floorWidth: floorWidth
81
74
  },
82
75
  stepSize: stepSize,
83
- showArrow: floorHeight > wrapHeight
76
+ showArrow: type === 'horizontal' ? isInsideEnoughWidth ? false : floorWidth > wrapWidth : isInsideEnough ? false : floorHeight > wrapHeight
84
77
  });
85
-
86
78
  if (activeKey && navList.length > 0) {
87
79
  var matchIndex = _.findIndex(navList, function (item) {
88
80
  return item[(optionName === null || optionName === void 0 ? void 0 : optionName.key) || 'id'] === activeKey;
89
81
  });
90
-
91
- var stepNo = wrapHeight === 0 ? 0 : Math.floor(matchIndex / (wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
92
-
82
+ var stepNo = type === 'horizontal' ? wrapWidth === 0 ? 0 : Math.floor(matchIndex / (wrapWidth / baseItemWidth)) : wrapHeight === 0 ? 0 : Math.floor(matchIndex / (wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
93
83
  var stepTotalSize = Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
94
-
95
84
  _this.setState({
85
+ leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : 0,
96
86
  leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : 0,
97
87
  // 如果当前默认传值有楼层节点,则需要判断其所在的位置
98
88
  arrowPermit: {
99
89
  prev: matchIndex !== -1 && stepNo !== 0,
100
- next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize
90
+ left: matchIndex !== -1 && stepNo !== 0,
91
+ next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize,
92
+ right: floorWidth > wrapWidth && stepNo + 1 !== stepTotalSize
101
93
  }
102
94
  });
103
95
  } else {
104
96
  _this.setState({
97
+ leafNavScrollX: 0,
105
98
  leafNavScrollY: 0,
106
99
  arrowPermit: {
107
100
  prev: false,
108
- next: floorHeight > wrapHeight
101
+ left: false,
102
+ next: floorHeight > wrapHeight,
103
+ right: floorWidth > wrapWidth
109
104
  }
110
105
  });
111
106
  }
112
107
  });
113
-
114
- _defineProperty(_assertThisInitialized(_this), "handleLeafControl", function (type) {
108
+ _defineProperty(_assertThisInitialized(_this), "handleLeafControl", function (method) {
109
+ var type = _this.props.type;
115
110
  var _this$state = _this.state,
116
- floorRelatedSize = _this$state.floorRelatedSize,
117
- leafNavScrollY = _this$state.leafNavScrollY;
111
+ floorRelatedSize = _this$state.floorRelatedSize,
112
+ leafNavScrollY = _this$state.leafNavScrollY,
113
+ leafNavScrollX = _this$state.leafNavScrollX;
118
114
  var wrapHeight = floorRelatedSize.wrapHeight,
119
- floorHeight = floorRelatedSize.floorHeight;
120
- var maxNextPosition = -(wrapHeight * (Math.ceil(floorHeight / wrapHeight) - 1)); // 向下滚动的最大值
121
-
122
- var scrollY = type === 'next' ? leafNavScrollY - wrapHeight : leafNavScrollY + wrapHeight;
115
+ floorHeight = floorRelatedSize.floorHeight,
116
+ wrapWidth = floorRelatedSize.wrapWidth,
117
+ floorWidth = floorRelatedSize.floorWidth;
118
+ if (type === 'horizontal') {
119
+ var maxNextPosition = -(wrapWidth * (Math.ceil(floorWidth / wrapWidth) - 1)); // 向右滚动的最大值
120
+ var scrollX = method === 'right' ? leafNavScrollX - wrapWidth : leafNavScrollX + wrapWidth;
121
+ _this.setState({
122
+ arrowPermit: {
123
+ left: method === 'left' ? scrollX !== 0 : true,
124
+ right: method === 'left' ? true : scrollX !== maxNextPosition // 滚动大小与最大滚动值一致时,向右滚动禁用,
125
+ },
123
126
 
124
- _this.setState({
125
- arrowPermit: {
126
- prev: type === 'prev' ? scrollY !== 0 : true,
127
- next: type === 'prev' ? true : scrollY !== maxNextPosition // 滚动大小与最大滚动值一致时,向下滚动禁用,
127
+ leafNavScrollX: scrollX
128
+ });
129
+ } else {
130
+ var _maxNextPosition = -(wrapHeight * (Math.ceil(floorHeight / wrapHeight) - 1)); // 向下滚动的最大值
131
+ var scrollY = method === 'next' ? leafNavScrollY - wrapHeight : leafNavScrollY + wrapHeight;
132
+ _this.setState({
133
+ arrowPermit: {
134
+ prev: method === 'prev' ? scrollY !== 0 : true,
135
+ next: method === 'prev' ? true : scrollY !== _maxNextPosition // 滚动大小与最大滚动值一致时,向下滚动禁用,
136
+ },
128
137
 
129
- },
130
- leafNavScrollY: scrollY
131
- });
138
+ leafNavScrollY: scrollY
139
+ });
140
+ }
132
141
  });
133
-
134
142
  _defineProperty(_assertThisInitialized(_this), "handleItemControl", function (key, data) {
135
143
  var onClick = _this.props.onClick;
136
144
  onClick && onClick(key, data);
137
145
  });
138
-
139
146
  _defineProperty(_assertThisInitialized(_this), "mouseEnter", function (e) {
140
147
  var onMouseEnter = _this.props.onMouseEnter;
141
-
142
148
  _this.setState({
143
149
  isMouseEnter: true
144
150
  });
145
-
146
151
  onMouseEnter && onMouseEnter(e);
147
152
  });
148
-
149
153
  _defineProperty(_assertThisInitialized(_this), "mouseLeave", function (e) {
150
154
  var onMouseLeave = _this.props.onMouseLeave;
151
-
152
155
  _this.setState({
153
156
  isMouseEnter: false
154
157
  });
155
-
156
158
  onMouseLeave && onMouseLeave(e);
157
159
  });
158
-
159
160
  _defineProperty(_assertThisInitialized(_this), "mouseWheel", function (e) {
161
+ var type = _this.props.type;
160
162
  var _this$state2 = _this.state,
161
- isMouseEnter = _this$state2.isMouseEnter,
162
- arrowPermit = _this$state2.arrowPermit;
163
+ isMouseEnter = _this$state2.isMouseEnter,
164
+ arrowPermit = _this$state2.arrowPermit;
163
165
  if (!isMouseEnter) return; // 鼠标没有经过内容区域,则不会滚轮监听
164
-
165
166
  e.preventDefault();
166
-
167
167
  if (e.deltaY <= 0) {
168
- arrowPermit.prev && _this.handleLeafControl('prev'); // 向上滚动
168
+ // 向上滚动(向左滚动)
169
+ type === 'horizontal' ? arrowPermit.left && _this.handleLeafControl('left') : arrowPermit.prev && _this.handleLeafControl('prev');
169
170
  } else {
170
- arrowPermit.next && _this.handleLeafControl('next'); // 向下滚动
171
- } // onWheel && onWheel(e)
172
-
171
+ type === 'horizontal' ? arrowPermit.right && _this.handleLeafControl('right') : arrowPermit.next && _this.handleLeafControl('next'); // 向下滚动(向右滚动)
172
+ }
173
173
  });
174
-
175
174
  _this.state = {
176
175
  isMouseEnter: false,
176
+ leafNavScrollX: 0,
177
+ // 水平滚动区域
177
178
  leafNavScrollY: 0,
179
+ // 垂直滚动区域
178
180
  showArrow: false,
179
181
  arrowPermit: {
180
182
  prev: false,
@@ -184,31 +186,28 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
184
186
  wrapHeight: 0,
185
187
  // 有效内容区域的
186
188
  floorHeight: 0 // 楼层列表占用的高度
187
-
188
189
  },
189
- stepSize: 0 // 当前一页可容纳的单元格数量
190
190
 
191
+ stepSize: 0 // 当前一页可容纳的单元格数量
191
192
  };
193
+
192
194
  _this.mainWrap = /*#__PURE__*/React.createRef();
193
195
  _this.leafWrap = /*#__PURE__*/React.createRef();
194
196
  _this.leafNav = /*#__PURE__*/React.createRef();
195
197
  _this.initFloorValues = _this.initFloorValues.bind(_assertThisInitialized(_this));
196
198
  return _this;
197
199
  }
198
-
199
200
  _createClass(NavLeafScroll, [{
200
201
  key: "componentDidMount",
201
202
  value: function componentDidMount() {
202
203
  var forbidScroll = this.props.forbidScroll;
203
204
  window.addEventListener('resize', this.initFloorValues);
204
-
205
205
  if (!forbidScroll) {
206
206
  // 禁用时,不启动滚动监听
207
207
  this.mainWrap.current.addEventListener('wheel', this.mouseWheel, {
208
208
  passive: false
209
209
  });
210
210
  }
211
-
212
211
  this.initFloorValues();
213
212
  }
214
213
  }, {
@@ -216,40 +215,41 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
216
215
  value: function componentWillUnmount() {
217
216
  var forbidScroll = this.props.forbidScroll;
218
217
  window.removeEventListener('resize', this.initFloorValues);
219
-
220
218
  if (!forbidScroll) {
221
219
  // 禁用时,不启动滚动监听
222
220
  this.mainWrap.current.addEventListener('wheel', this.mouseWheel, {
223
221
  passive: false
224
222
  });
225
223
  }
226
-
227
224
  this.mainWrap.current.removeEventListener('wheel', this.mouseWheel);
228
225
  }
229
226
  }, {
230
227
  key: "componentDidUpdate",
231
228
  value: function componentDidUpdate(prevProps) {
232
229
  var _this$props2 = this.props,
233
- baseItemHeight = _this$props2.baseItemHeight,
234
- navList = _this$props2.navList,
235
- activeKey = _this$props2.activeKey,
236
- _this$props2$optionNa = _this$props2.optionName,
237
- optionName = _this$props2$optionNa === void 0 ? {
238
- key: 'id',
239
- title: 'title',
240
- count: 'count'
241
- } : _this$props2$optionNa,
242
- forbidScroll = _this$props2.forbidScroll;
230
+ baseItemHeight = _this$props2.baseItemHeight,
231
+ baseItemWidth = _this$props2.baseItemWidth,
232
+ type = _this$props2.type,
233
+ navList = _this$props2.navList,
234
+ activeKey = _this$props2.activeKey,
235
+ _this$props2$optionNa = _this$props2.optionName,
236
+ optionName = _this$props2$optionNa === void 0 ? {
237
+ key: 'id',
238
+ title: 'title',
239
+ count: 'count'
240
+ } : _this$props2$optionNa,
241
+ forbidScroll = _this$props2.forbidScroll;
243
242
  var _this$state3 = this.state,
244
- _this$state3$floorRel = _this$state3.floorRelatedSize,
245
- wrapHeight = _this$state3$floorRel.wrapHeight,
246
- floorHeight = _this$state3$floorRel.floorHeight,
247
- stepSize = _this$state3.stepSize;
248
-
249
- if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || baseItemHeight !== prevProps.baseItemHeight) {
243
+ _this$state3$floorRel = _this$state3.floorRelatedSize,
244
+ wrapHeight = _this$state3$floorRel.wrapHeight,
245
+ floorHeight = _this$state3$floorRel.floorHeight,
246
+ wrapWidth = _this$state3$floorRel.wrapWidth,
247
+ floorWidth = _this$state3$floorRel.floorWidth,
248
+ stepSize = _this$state3.stepSize;
249
+ if (type === 'horizontal') {}
250
+ if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight)) {
250
251
  this.initFloorValues();
251
252
  }
252
-
253
253
  if (forbidScroll !== prevProps.forbidScroll) {
254
254
  // 禁用时,不启动滚动监听
255
255
  if (!forbidScroll) {
@@ -261,58 +261,63 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
261
261
  this.mainWrap.current.removeEventListener('wheel', this.mouseWheel);
262
262
  }
263
263
  }
264
-
265
264
  if (activeKey !== prevProps.activeKey) {
266
265
  var matchIndex = _.findIndex(navList, function (item) {
267
266
  return item[optionName.key] === activeKey;
268
267
  });
269
-
270
- var stepNo = Math.floor(matchIndex / (wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
271
-
268
+ var stepNo = Math.floor(matchIndex / (type === 'horizontal' ? wrapWidth / baseItemWidth : wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
272
269
  var stepTotalSize = Array.isArray(navList) && Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
273
-
270
+ console.log('stepTotalSize', stepTotalSize);
274
271
  this.setState({
272
+ leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : 0,
275
273
  leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : 0,
276
274
  // 如果当前默认传值有楼层节点,则需要判断其所在的位置
277
275
  arrowPermit: {
278
276
  prev: matchIndex !== -1 && stepNo !== 0,
279
- next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize
277
+ next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize,
278
+ left: matchIndex !== -1 && stepNo !== 0,
279
+ right: floorWidth > wrapWidth && stepNo + 1 !== stepTotalSize
280
280
  },
281
281
  isMouseEnter: true
282
282
  });
283
283
  }
284
284
  } // 初始化楼层相关的值,如:是否允许触发滚动,默认滚动区间高度等
285
-
285
+ // 点击节点事件
286
+ // 鼠标滚轮监听
286
287
  }, {
287
288
  key: "render",
288
289
  value: function render() {
289
290
  var _this2 = this;
290
-
291
291
  var _this$props3 = this.props,
292
- className = _this$props3.className,
293
- width = _this$props3.width,
294
- activeKey = _this$props3.activeKey,
295
- customLeafNode = _this$props3.customLeafNode,
296
- noArrowPadding = _this$props3.noArrowPadding,
297
- navList = _this$props3.navList,
298
- _this$props3$optionNa = _this$props3.optionName,
299
- optionName = _this$props3$optionNa === void 0 ? {
300
- key: 'id',
301
- title: 'title',
302
- count: 'count'
303
- } : _this$props3$optionNa,
304
- _this$props3$emptyNod = _this$props3.emptyNode,
305
- emptyNode = _this$props3$emptyNod === void 0 ? null : _this$props3$emptyNod;
292
+ className = _this$props3.className,
293
+ width = _this$props3.width,
294
+ activeKey = _this$props3.activeKey,
295
+ customLeafNode = _this$props3.customLeafNode,
296
+ noArrowPadding = _this$props3.noArrowPadding,
297
+ navList = _this$props3.navList,
298
+ _this$props3$optionNa = _this$props3.optionName,
299
+ optionName = _this$props3$optionNa === void 0 ? {
300
+ key: 'id',
301
+ title: 'title',
302
+ count: 'count'
303
+ } : _this$props3$optionNa,
304
+ _this$props3$emptyNod = _this$props3.emptyNode,
305
+ emptyNode = _this$props3$emptyNod === void 0 ? null : _this$props3$emptyNod,
306
+ type = _this$props3.type,
307
+ height = _this$props3.height;
306
308
  var _this$state4 = this.state,
307
- showArrow = _this$state4.showArrow,
308
- arrowPermit = _this$state4.arrowPermit,
309
- leafNavScrollY = _this$state4.leafNavScrollY;
309
+ showArrow = _this$state4.showArrow,
310
+ arrowPermit = _this$state4.arrowPermit,
311
+ leafNavScrollY = _this$state4.leafNavScrollY,
312
+ leafNavScrollX = _this$state4.leafNavScrollX;
310
313
  return /*#__PURE__*/React.createElement("div", {
311
- className: classNames(className, "nav-leaf"),
312
- style: width ? {
313
- width: "".concat(width, "px")
314
- } : {},
315
- ref: this.mainWrap // onWheel={this.mouseWheel}
314
+ className: classNames(className, "nav-leaf", type === 'horizontal' ? 'nav-leaf-horizontal' : ''),
315
+ style: {
316
+ width: width ? "".concat(width, "px") : '',
317
+ height: height ? "".concat(height, "px") : ''
318
+ },
319
+ ref: this.mainWrap
320
+ // onWheel={this.mouseWheel}
316
321
  ,
317
322
  onMouseEnter: this.mouseEnter,
318
323
  onMouseLeave: this.mouseLeave
@@ -322,7 +327,21 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
322
327
  padding: 0
323
328
  } : {},
324
329
  "data-prev": showArrow
325
- }, /*#__PURE__*/React.createElement("span", {
330
+ }, type === 'horizontal' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
331
+ className: classNames("nav-leaf-arrow nav-leaf-btn-left", showArrow ? '' : 'is-hide', arrowPermit.left ? '' : 'is-disabled'),
332
+ onClick: function onClick() {
333
+ return arrowPermit.left ? _this2.handleLeafControl('left') : '';
334
+ }
335
+ }, /*#__PURE__*/React.createElement(SpecIcon, {
336
+ name: "caret-left"
337
+ })), /*#__PURE__*/React.createElement("span", {
338
+ className: classNames("nav-leaf-arrow nav-leaf-btn-right", showArrow ? '' : 'is-hide', arrowPermit.right ? '' : 'is-disabled'),
339
+ onClick: function onClick() {
340
+ return arrowPermit.right ? _this2.handleLeafControl('right') : '';
341
+ }
342
+ }, /*#__PURE__*/React.createElement(SpecIcon, {
343
+ name: "caret-right"
344
+ }))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
326
345
  className: classNames("nav-leaf-arrow nav-leaf-btn-prev", showArrow ? '' : 'is-hide', arrowPermit.prev ? '' : 'is-disabled'),
327
346
  onClick: function onClick() {
328
347
  return arrowPermit.prev ? _this2.handleLeafControl('prev') : '';
@@ -336,7 +355,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
336
355
  }
337
356
  }, /*#__PURE__*/React.createElement(SpecIcon, {
338
357
  name: "caret-down"
339
- })), /*#__PURE__*/React.createElement("div", {
358
+ }))), /*#__PURE__*/React.createElement("div", {
340
359
  className: "nav-leaf-wrap",
341
360
  ref: this.leafWrap
342
361
  }, /*#__PURE__*/React.createElement("div", {
@@ -345,16 +364,17 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
345
364
  className: "nav-leaf-nav",
346
365
  ref: this.leafNav,
347
366
  style: {
348
- transform: "translate3d(0px, ".concat(leafNavScrollY, "px, 0px)")
367
+ transform: "translate3d(".concat(type === 'horizontal' ? leafNavScrollX : 0, "px, ").concat(type === 'horizontal' ? 0 : leafNavScrollY, "px, 0px)")
349
368
  }
350
369
  }, navList && navList.length > 0 ? navList.map(function (item, i) {
351
- var _this2$props;
352
-
370
+ var _this2$props, _this2$props2;
353
371
  return /*#__PURE__*/React.createElement("div", {
354
372
  key: item[optionName.key],
355
373
  className: classNames('nav-leaf-item', activeKey && activeKey === item[optionName.key] ? 'is-active' : ''),
356
- style: {
357
- height: "".concat(((_this2$props = _this2.props) === null || _this2$props === void 0 ? void 0 : _this2$props.baseItemHeight) || 40, "px")
374
+ style: type === 'horizontal' ? {
375
+ width: "".concat(((_this2$props = _this2.props) === null || _this2$props === void 0 ? void 0 : _this2$props.baseItemWidth) || 60, "px")
376
+ } : {
377
+ height: "".concat(((_this2$props2 = _this2.props) === null || _this2$props2 === void 0 ? void 0 : _this2$props2.baseItemHeight) || 40, "px")
358
378
  },
359
379
  onClick: function onClick() {
360
380
  return _this2.handleItemControl(item[optionName.key], item);
@@ -372,8 +392,6 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
372
392
  }) : emptyNode)))));
373
393
  }
374
394
  }]);
375
-
376
395
  return NavLeafScroll;
377
396
  }(Component);
378
-
379
397
  export default NavLeafScroll;
@@ -4,6 +4,12 @@
4
4
  .nav-leaf {
5
5
  width: 110px;
6
6
  height: 100%;
7
+ &.nav-leaf-horizontal {
8
+ width: 100%;
9
+ .nav-leaf-container.nav-leaf-container-scroll {
10
+ padding: 0 30px;
11
+ }
12
+ }
7
13
  //.nav-leaf-container {
8
14
  // height: ~'calc(100vh - @{nav-header-height})';
9
15
  //}
@@ -31,6 +37,17 @@
31
37
  height: 100%;
32
38
  overflow: hidden;
33
39
  }
40
+ &.nav-leaf-horizontal {
41
+ .nav-leaf-item {
42
+ display: inline-block;
43
+ text-align: center;
44
+ border-top-right-radius: 20px;
45
+ border-bottom-right-radius: 20px;
46
+ }
47
+ .nav-leaf-nav {
48
+ width: inherit;
49
+ }
50
+ }
34
51
  .nav-leaf-nav {
35
52
  position: relative;
36
53
  display: inline-block;
@@ -42,7 +59,6 @@
42
59
  }
43
60
  .nav-leaf-arrow {
44
61
  position: absolute;
45
- left: 0;
46
62
  width: 100%;
47
63
  height: 32px;
48
64
  color: @text-color;
@@ -58,11 +74,27 @@
58
74
  color: fade(@primary-color, 30%) !important;
59
75
  cursor: not-allowed !important;
60
76
  }
77
+ &.nav-leaf-btn-left {
78
+ width: 30px;
79
+ height: auto;
80
+ top: 50%;
81
+ left: 0;
82
+ transform: translateY(-50%);
83
+ }
84
+ &.nav-leaf-btn-right{
85
+ width: 30px;
86
+ height: auto;
87
+ top: 50%;
88
+ right: 0;
89
+ transform: translateY(-50%);
90
+ }
61
91
  &.nav-leaf-btn-prev {
62
92
  top: 0;
93
+ left:0;
63
94
  }
64
95
  &.nav-leaf-btn-next {
65
96
  bottom: 0;
97
+ left:0;
66
98
  }
67
99
  }
68
100
  .nav-leaf-item {