fan-standard-comp 3.2.0 → 3.2.2

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 (293) hide show
  1. package/Readme.md +1 -33
  2. package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
  3. package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
  4. package/dist/fan-standard-comp.umd.js +166 -444
  5. package/dist/fonts/iconfont.ttf +0 -0
  6. package/dist/fonts/iconfont.woff +0 -0
  7. package/dist/fonts/lg.ttf +0 -0
  8. package/dist/fonts/lg.woff +0 -0
  9. package/dist/fonts/lg.woff2 +0 -0
  10. package/es/ButtonGroup/ButtonList.d.ts +2 -1
  11. package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
  12. package/es/ButtonGroup/PopConfirmTitle.js +5 -5
  13. package/es/ButtonGroup/index.d.ts +3 -1
  14. package/es/ButtonGroup/index.js +147 -178
  15. package/es/ButtonGroup/style/index.less +4 -1
  16. package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  17. package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
  18. package/es/CalendarCoordPicker/index.d.ts +8 -0
  19. package/es/CalendarCoordPicker/index.js +296 -0
  20. package/es/CalendarCoordPicker/index.less +31 -0
  21. package/es/ConfigContext/index.d.ts +7 -0
  22. package/es/ConfigContext/index.js +12 -0
  23. package/es/DragContent/index.d.ts +1 -1
  24. package/es/DragContent/index.js +5 -5
  25. package/es/FormComp/ChunkUploader/api.js +14 -14
  26. package/es/FormComp/ChunkUploader/index.js +132 -139
  27. package/es/FormComp/ChunkUploader/lib.js +21 -21
  28. package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
  29. package/es/FormComp/EditButton/index.d.ts +1 -1
  30. package/es/FormComp/EditButton/index.js +15 -17
  31. package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  32. package/es/FormComp/FieldComponent/ReUpload.js +37 -23
  33. package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
  34. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
  35. package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  36. package/es/FormComp/FieldComponent/index.d.ts +1 -1
  37. package/es/FormComp/FieldComponent/index.js +33 -23
  38. package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
  39. package/es/FormComp/RenderItemGroup/index.js +24 -8
  40. package/es/FormComp/Uploader/index.d.ts +3 -1
  41. package/es/FormComp/Uploader/index.js +243 -119
  42. package/es/FormComp/VarTemplate/index.js +57 -64
  43. package/es/ImageGallery/ImagePreview.d.ts +13 -0
  44. package/es/ImageGallery/ImagePreview.js +168 -0
  45. package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  46. package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  47. package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  48. package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  49. package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  50. package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  51. package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
  52. package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  53. package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  54. package/es/ImageGallery/SliderContent.d.ts +7 -0
  55. package/es/ImageGallery/SliderContent.js +699 -0
  56. package/es/ImageGallery/Thumbnail.d.ts +3 -0
  57. package/es/ImageGallery/Thumbnail.js +296 -0
  58. package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
  59. package/es/ImageGallery/hook/uniqueId.js +10 -0
  60. package/es/ImageGallery/index.d.ts +4 -0
  61. package/es/ImageGallery/index.js +29 -0
  62. package/es/ImageGallery/style/index.less +5 -0
  63. package/es/ImageGallery/types.d.ts +5 -0
  64. package/es/ImageGallery/types.js +1 -0
  65. package/es/NavLeafScroll/index.js +94 -50
  66. package/es/RefactorTree/index.d.ts +1 -1
  67. package/es/RefactorTree/index.js +6 -6
  68. package/es/RefactorTree/indexTreeNode.d.ts +1 -1
  69. package/es/RefactorTree/indexTreeNode.js +19 -17
  70. package/es/RefactorTree/util.js +18 -18
  71. package/es/SpecIcon/fonts/demo_index.html +559 -5
  72. package/es/SpecIcon/fonts/iconfont.css +101 -3
  73. package/es/SpecIcon/fonts/iconfont.js +34 -27
  74. package/es/SpecIcon/fonts/iconfont.json +168 -0
  75. package/es/SpecIcon/fonts/iconfont.svg +163 -171
  76. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  77. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  78. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  79. package/es/SpecIcon/style/iconfont.less +106 -11
  80. package/es/SplitterLayout/Pane.d.ts +1 -1
  81. package/es/SplitterLayout/index.js +25 -26
  82. package/es/StandardContent/SplitterLayout/Pane.js +3 -3
  83. package/es/StandardContent/SplitterLayout/index.js +25 -26
  84. package/es/StandardContent/SubfieldContent.d.ts +1 -1
  85. package/es/StandardContent/WrapperContent.d.ts +1 -1
  86. package/es/StandardDragModal/index.d.ts +11 -3
  87. package/es/StandardDragModal/index.js +25 -3
  88. package/es/StandardFilter/index.d.ts +5 -16
  89. package/es/StandardFilter/index.js +212 -200
  90. package/es/StandardFilter/indexClass.d.ts +37 -0
  91. package/es/StandardFilter/indexClass.js +217 -0
  92. package/es/StandardFilter/style/index.less +82 -9
  93. package/es/StandardForm/StepForm.d.ts +1 -1
  94. package/es/StandardForm/StepForm.js +28 -22
  95. package/es/StandardForm/TabForm.d.ts +1 -1
  96. package/es/StandardForm/TabForm.js +41 -43
  97. package/es/StandardForm/index.d.ts +1 -1
  98. package/es/StandardForm/index.js +5 -5
  99. package/es/StandardModal/UpdateFormRef.js +0 -1
  100. package/es/StandardModal/index.d.ts +2 -1
  101. package/es/StandardModal/index.js +25 -39
  102. package/es/StandardPanel/index.d.ts +1 -1
  103. package/es/StandardPanel/index.js +7 -7
  104. package/es/StandardTable/index.d.ts +1 -0
  105. package/es/StandardTable/index.js +44 -26
  106. package/es/components/IconNode/index.d.ts +1 -1
  107. package/es/components/IconNode/index.js +0 -1
  108. package/es/data/general.config.js +31 -0
  109. package/es/index.d.ts +3 -1
  110. package/es/index.js +6 -2
  111. package/es/utils/filterPermission.js +7 -10
  112. package/es/utils/getParentNodes.js +101 -26
  113. package/es/utils/index.js +2 -3
  114. package/es/utils/urlUtils.js +76 -0
  115. package/lib/ButtonGroup/ButtonList.d.ts +2 -1
  116. package/lib/ButtonGroup/ButtonList.js +2 -3
  117. package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
  118. package/lib/ButtonGroup/ButtonMenu.js +2 -3
  119. package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
  120. package/lib/ButtonGroup/index.d.ts +3 -1
  121. package/lib/ButtonGroup/index.js +151 -183
  122. package/lib/ButtonGroup/style/index.less +4 -1
  123. package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  124. package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
  125. package/lib/CalendarCoordPicker/index.d.ts +8 -0
  126. package/lib/CalendarCoordPicker/index.js +305 -0
  127. package/lib/CalendarCoordPicker/index.less +31 -0
  128. package/lib/ConfigContext/index.d.ts +7 -0
  129. package/lib/ConfigContext/index.js +17 -0
  130. package/lib/DragContent/DragBar.js +2 -3
  131. package/lib/DragContent/index.d.ts +1 -1
  132. package/lib/DragContent/index.js +9 -10
  133. package/lib/FormComp/ChunkUploader/api.js +15 -15
  134. package/lib/FormComp/ChunkUploader/index.js +135 -142
  135. package/lib/FormComp/ChunkUploader/lib.js +22 -22
  136. package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
  137. package/lib/FormComp/ChunkUploader/worker.js +1 -1
  138. package/lib/FormComp/EditButton/index.d.ts +1 -1
  139. package/lib/FormComp/EditButton/index.js +19 -22
  140. package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  141. package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
  142. package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
  143. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
  144. package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  145. package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
  146. package/lib/FormComp/FieldComponent/index.d.ts +1 -1
  147. package/lib/FormComp/FieldComponent/index.js +38 -26
  148. package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
  149. package/lib/FormComp/RenderItemGroup/index.js +26 -11
  150. package/lib/FormComp/Uploader/index.d.ts +3 -1
  151. package/lib/FormComp/Uploader/index.js +244 -123
  152. package/lib/FormComp/VarTemplate/index.js +63 -71
  153. package/lib/FormComp/index.js +1 -1
  154. package/lib/ImageGallery/ImagePreview.d.ts +13 -0
  155. package/lib/ImageGallery/ImagePreview.js +178 -0
  156. package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  157. package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  158. package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  159. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  160. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  161. package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  162. package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
  163. package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  164. package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  165. package/lib/ImageGallery/SliderContent.d.ts +7 -0
  166. package/lib/ImageGallery/SliderContent.js +708 -0
  167. package/lib/ImageGallery/Thumbnail.d.ts +3 -0
  168. package/lib/ImageGallery/Thumbnail.js +306 -0
  169. package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
  170. package/lib/ImageGallery/hook/uniqueId.js +17 -0
  171. package/lib/ImageGallery/index.d.ts +4 -0
  172. package/lib/ImageGallery/index.js +36 -0
  173. package/lib/ImageGallery/style/index.less +5 -0
  174. package/lib/ImageGallery/types.d.ts +5 -0
  175. package/lib/ImageGallery/types.js +5 -0
  176. package/lib/NavLeafScroll/index.js +98 -55
  177. package/lib/RefactorTree/index.d.ts +1 -1
  178. package/lib/RefactorTree/index.js +10 -11
  179. package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
  180. package/lib/RefactorTree/indexTreeNode.js +23 -22
  181. package/lib/RefactorTree/util.js +18 -18
  182. package/lib/SpecIcon/fonts/demo_index.html +559 -5
  183. package/lib/SpecIcon/fonts/iconfont.css +101 -3
  184. package/lib/SpecIcon/fonts/iconfont.js +34 -27
  185. package/lib/SpecIcon/fonts/iconfont.json +168 -0
  186. package/lib/SpecIcon/fonts/iconfont.svg +163 -171
  187. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  188. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  189. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  190. package/lib/SpecIcon/index.js +2 -3
  191. package/lib/SpecIcon/style/iconfont.less +106 -11
  192. package/lib/SplitterLayout/Pane.d.ts +1 -1
  193. package/lib/SplitterLayout/Pane.js +2 -3
  194. package/lib/SplitterLayout/index.js +27 -29
  195. package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
  196. package/lib/StandardContent/SplitterLayout/index.js +27 -29
  197. package/lib/StandardContent/SubfieldContent.d.ts +1 -1
  198. package/lib/StandardContent/SubfieldContent.js +2 -3
  199. package/lib/StandardContent/WrapperContent.d.ts +1 -1
  200. package/lib/StandardContent/WrapperContent.js +2 -3
  201. package/lib/StandardDragModal/index.d.ts +11 -3
  202. package/lib/StandardDragModal/index.js +27 -33
  203. package/lib/StandardFilter/index.d.ts +5 -16
  204. package/lib/StandardFilter/index.js +215 -201
  205. package/lib/StandardFilter/indexClass.d.ts +37 -0
  206. package/lib/StandardFilter/indexClass.js +223 -0
  207. package/lib/StandardFilter/style/index.less +82 -9
  208. package/lib/StandardForm/ActionList.js +2 -3
  209. package/lib/StandardForm/StepForm.d.ts +1 -1
  210. package/lib/StandardForm/StepForm.js +32 -27
  211. package/lib/StandardForm/TabForm.d.ts +1 -1
  212. package/lib/StandardForm/TabForm.js +45 -48
  213. package/lib/StandardForm/index.d.ts +1 -1
  214. package/lib/StandardForm/index.js +9 -10
  215. package/lib/StandardModal/UpdateFormRef.js +3 -4
  216. package/lib/StandardModal/index.d.ts +2 -1
  217. package/lib/StandardModal/index.js +29 -43
  218. package/lib/StandardPanel/index.d.ts +1 -1
  219. package/lib/StandardPanel/index.js +11 -12
  220. package/lib/StandardTable/index.d.ts +1 -0
  221. package/lib/StandardTable/index.js +49 -29
  222. package/lib/components/IconNode/index.d.ts +1 -1
  223. package/lib/components/IconNode/index.js +2 -4
  224. package/lib/components/index.js +1 -1
  225. package/lib/data/func.code.js +2 -3
  226. package/lib/data/general.config.js +33 -3
  227. package/lib/data/index.js +1 -1
  228. package/lib/index.d.ts +3 -1
  229. package/lib/index.js +30 -10
  230. package/lib/utils/ValueFormat.js +1 -2
  231. package/lib/utils/filterPermission.js +11 -18
  232. package/lib/utils/getParentNodes.js +103 -29
  233. package/lib/utils/index.js +5 -27
  234. package/lib/utils/urlUtils.js +82 -0
  235. package/package.json +14 -9
  236. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  237. package/dist/fonts/iconfont.eot +0 -0
  238. package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  239. package/es/StandardDragModal/ChangeStandardModal.js +0 -493
  240. package/es/StandardDragModal/DraggableModal.d.ts +0 -7
  241. package/es/StandardDragModal/DraggableModal.js +0 -31
  242. package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
  243. package/es/StandardDragModal/DraggableModalContext.js +0 -5
  244. package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
  245. package/es/StandardDragModal/DraggableModalInner.js +0 -114
  246. package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  247. package/es/StandardDragModal/DraggableModalProvider.js +0 -40
  248. package/es/StandardDragModal/Modal.d.ts +0 -11
  249. package/es/StandardDragModal/Modal.js +0 -24
  250. package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
  251. package/es/StandardDragModal/ResizeHandle.js +0 -8
  252. package/es/StandardDragModal/clamp.d.ts +0 -1
  253. package/es/StandardDragModal/clamp.js +0 -3
  254. package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
  255. package/es/StandardDragModal/draggableModalReducer.js +0 -157
  256. package/es/StandardDragModal/getWindowSize.d.ts +0 -4
  257. package/es/StandardDragModal/getWindowSize.js +0 -6
  258. package/es/StandardDragModal/index.less +0 -65
  259. package/es/StandardDragModal/useDrag.d.ts +0 -5
  260. package/es/StandardDragModal/useDrag.js +0 -66
  261. package/es/StandardDragModal/usePrevious.d.ts +0 -1
  262. package/es/StandardDragModal/usePrevious.js +0 -8
  263. package/es/StandardDragModal/useResize.d.ts +0 -7
  264. package/es/StandardDragModal/useResize.js +0 -74
  265. package/es/utils/dictSelectUtil.js +0 -153
  266. package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  267. package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
  268. package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
  269. package/lib/StandardDragModal/DraggableModal.js +0 -40
  270. package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
  271. package/lib/StandardDragModal/DraggableModalContext.js +0 -15
  272. package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
  273. package/lib/StandardDragModal/DraggableModalInner.js +0 -124
  274. package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  275. package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
  276. package/lib/StandardDragModal/Modal.d.ts +0 -11
  277. package/lib/StandardDragModal/Modal.js +0 -32
  278. package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
  279. package/lib/StandardDragModal/ResizeHandle.js +0 -18
  280. package/lib/StandardDragModal/clamp.d.ts +0 -1
  281. package/lib/StandardDragModal/clamp.js +0 -10
  282. package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
  283. package/lib/StandardDragModal/draggableModalReducer.js +0 -167
  284. package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
  285. package/lib/StandardDragModal/getWindowSize.js +0 -13
  286. package/lib/StandardDragModal/index.less +0 -65
  287. package/lib/StandardDragModal/useDrag.d.ts +0 -5
  288. package/lib/StandardDragModal/useDrag.js +0 -73
  289. package/lib/StandardDragModal/usePrevious.d.ts +0 -1
  290. package/lib/StandardDragModal/usePrevious.js +0 -15
  291. package/lib/StandardDragModal/useResize.d.ts +0 -7
  292. package/lib/StandardDragModal/useResize.js +0 -81
  293. package/lib/utils/dictSelectUtil.js +0 -161
@@ -1,19 +1,18 @@
1
+ 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); }
1
2
  import "antd/es/badge/style";
2
3
  import _Badge from "antd/es/badge";
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); }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); }
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); }; }
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); }
11
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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); }
4
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
6
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ 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); }
9
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
10
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
11
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
12
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
14
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
15
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
16
  // @ts-ignore
18
17
  import React, { Component } from 'react';
19
18
  import SpecIcon from "../SpecIcon/index";
@@ -21,13 +20,12 @@ import _ from 'lodash';
21
20
  import classNames from 'classnames';
22
21
  import './style/index.less';
23
22
  var NavLeafScroll = /*#__PURE__*/function (_Component) {
24
- _inherits(NavLeafScroll, _Component);
25
- var _super = _createSuper(NavLeafScroll);
26
23
  function NavLeafScroll(props) {
27
24
  var _this;
28
25
  _classCallCheck(this, NavLeafScroll);
29
- _this = _super.call(this, props);
30
- _defineProperty(_assertThisInitialized(_this), "initFloorValues", function () {
26
+ _this = _callSuper(this, NavLeafScroll, [props]);
27
+ // 初始化楼层相关的值,如:是否允许触发滚动,默认滚动区间高度等
28
+ _this.initFloorValues = function () {
31
29
  var _this$props = _this.props,
32
30
  baseItemHeight = _this$props.baseItemHeight,
33
31
  baseItemWidth = _this$props.baseItemWidth,
@@ -39,13 +37,16 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
39
37
  title: 'title',
40
38
  count: 'count'
41
39
  } : _this$props$optionNam,
42
- type = _this$props.type; // 元素个数占用的高度是否不超过内容区域
40
+ type = _this$props.type,
41
+ align = _this$props.align;
42
+ // 元素个数占用的高度是否不超过内容区域
43
43
  var isInsideEnough = navList.length * baseItemHeight <= _this.mainWrap.current.clientHeight;
44
44
  var wrapHeight = _this.mainWrap.current.clientHeight - (isInsideEnough ? 0 : 32 * 2); // 每次需要移动的偏移量 32是上下切换角占用的高度
45
45
  var floorHeight = _this.leafNav.current.clientHeight; // 所有楼层占用的高度
46
46
  // const isEnough = wrapHeight % baseItemHeight === 0; // 剩余的是否足够容纳一个单元格
47
47
  var isInsideEnoughWidth = navList.length * baseItemWidth <= _this.mainWrap.current.clientWidth;
48
48
  var wrapWidth = _this.mainWrap.current.clientWidth - (isInsideEnoughWidth ? 0 : 30 * 2);
49
+ console.log('this.mainWrap.current.clientWidth', _this.mainWrap.current.clientWidth, wrapWidth, isInsideEnoughWidth);
49
50
  var floorWidth = _this.leafNav.current.clientWidth; // 所有楼层占用的宽度
50
51
  if (type === 'horizontal') {
51
52
  // 判断有效区域与单元格高度:若小于,则直接使用单元格高度,否则将内容区高度去除不足一个单元格高度
@@ -82,9 +83,19 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
82
83
  var stepNo = type === 'horizontal' ? wrapWidth === 0 ? 0 : Math.floor(matchIndex / (wrapWidth / baseItemWidth)) : wrapHeight === 0 ? 0 : Math.floor(matchIndex / (wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
83
84
  var stepTotalSize = Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
84
85
  _this.setState({
85
- leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : 0,
86
- leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : 0,
86
+ leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : _this.calculateScrollSize('X', {
87
+ wrapHeight: wrapHeight,
88
+ floorHeight: floorHeight,
89
+ wrapWidth: wrapWidth,
90
+ floorWidth: floorWidth
91
+ }),
87
92
  // 如果当前默认传值有楼层节点,则需要判断其所在的位置
93
+ leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : _this.calculateScrollSize('Y', {
94
+ wrapHeight: wrapHeight,
95
+ floorHeight: floorHeight,
96
+ wrapWidth: wrapWidth,
97
+ floorWidth: floorWidth
98
+ }),
88
99
  arrowPermit: {
89
100
  prev: matchIndex !== -1 && stepNo !== 0,
90
101
  left: matchIndex !== -1 && stepNo !== 0,
@@ -94,18 +105,45 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
94
105
  });
95
106
  } else {
96
107
  _this.setState({
97
- leafNavScrollX: 0,
98
- leafNavScrollY: 0,
108
+ // 当只有一页的情况下,单元格不超出且配置了align='center'的情况下,默认居中展示。
109
+ leafNavScrollX: _this.calculateScrollSize('X', {
110
+ wrapHeight: wrapHeight,
111
+ floorHeight: floorHeight,
112
+ wrapWidth: wrapWidth,
113
+ floorWidth: floorWidth
114
+ }),
115
+ // 横向排版默认偏移
116
+ leafNavScrollY: _this.calculateScrollSize('Y', {
117
+ wrapHeight: wrapHeight,
118
+ floorHeight: floorHeight,
119
+ wrapWidth: wrapWidth,
120
+ floorWidth: floorWidth
121
+ }),
122
+ // 纵向排版默认偏移
99
123
  arrowPermit: {
100
124
  prev: false,
101
125
  left: false,
102
126
  next: floorHeight > wrapHeight,
103
- right: floorWidth > wrapWidth
127
+ // 所有单独格占用高度是否大于内容高度,判断是否有下一页
128
+ right: floorWidth > wrapWidth // 所有单独格占用高度是否大于内容高度,判断是否有下一页
104
129
  }
105
130
  });
106
131
  }
107
- });
108
- _defineProperty(_assertThisInitialized(_this), "handleLeafControl", function (method) {
132
+ };
133
+ // 计算初始时或者切换后,居中时默认滚动位置
134
+ _this.calculateScrollSize = function (direction, params) {
135
+ var wrapHeight = params.wrapHeight,
136
+ floorHeight = params.floorHeight,
137
+ wrapWidth = params.wrapWidth,
138
+ floorWidth = params.floorWidth;
139
+ var align = _this.props.align;
140
+ if (direction === 'X') {
141
+ return align === 'center' && !(floorWidth > wrapWidth) ? (_this.mainWrap.current.clientWidth - floorWidth) / 2 : 0; // // 横向排版默认偏移
142
+ } else {
143
+ return align === 'center' && !(floorHeight > wrapHeight) ? (_this.mainWrap.current.clientHeight - floorHeight) / 2 : 0; // 纵向排版默认偏移
144
+ }
145
+ };
146
+ _this.handleLeafControl = function (method) {
109
147
  var type = _this.props.type;
110
148
  var _this$state = _this.state,
111
149
  floorRelatedSize = _this$state.floorRelatedSize,
@@ -123,7 +161,6 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
123
161
  left: method === 'left' ? scrollX !== 0 : true,
124
162
  right: method === 'left' ? true : scrollX !== maxNextPosition // 滚动大小与最大滚动值一致时,向右滚动禁用,
125
163
  },
126
-
127
164
  leafNavScrollX: scrollX
128
165
  });
129
166
  } else {
@@ -134,30 +171,31 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
134
171
  prev: method === 'prev' ? scrollY !== 0 : true,
135
172
  next: method === 'prev' ? true : scrollY !== _maxNextPosition // 滚动大小与最大滚动值一致时,向下滚动禁用,
136
173
  },
137
-
138
174
  leafNavScrollY: scrollY
139
175
  });
140
176
  }
141
- });
142
- _defineProperty(_assertThisInitialized(_this), "handleItemControl", function (key, data) {
177
+ };
178
+ // 点击节点事件
179
+ _this.handleItemControl = function (key, data) {
143
180
  var onClick = _this.props.onClick;
144
181
  onClick && onClick(key, data);
145
- });
146
- _defineProperty(_assertThisInitialized(_this), "mouseEnter", function (e) {
182
+ };
183
+ _this.mouseEnter = function (e) {
147
184
  var onMouseEnter = _this.props.onMouseEnter;
148
185
  _this.setState({
149
186
  isMouseEnter: true
150
187
  });
151
188
  onMouseEnter && onMouseEnter(e);
152
- });
153
- _defineProperty(_assertThisInitialized(_this), "mouseLeave", function (e) {
189
+ };
190
+ _this.mouseLeave = function (e) {
154
191
  var onMouseLeave = _this.props.onMouseLeave;
155
192
  _this.setState({
156
193
  isMouseEnter: false
157
194
  });
158
195
  onMouseLeave && onMouseLeave(e);
159
- });
160
- _defineProperty(_assertThisInitialized(_this), "mouseWheel", function (e) {
196
+ };
197
+ // 鼠标滚轮监听
198
+ _this.mouseWheel = function (e) {
161
199
  var type = _this.props.type;
162
200
  var _this$state2 = _this.state,
163
201
  isMouseEnter = _this$state2.isMouseEnter,
@@ -170,7 +208,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
170
208
  } else {
171
209
  type === 'horizontal' ? arrowPermit.right && _this.handleLeafControl('right') : arrowPermit.next && _this.handleLeafControl('next'); // 向下滚动(向右滚动)
172
210
  }
173
- });
211
+ };
174
212
  _this.state = {
175
213
  isMouseEnter: false,
176
214
  leafNavScrollX: 0,
@@ -187,17 +225,16 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
187
225
  // 有效内容区域的
188
226
  floorHeight: 0 // 楼层列表占用的高度
189
227
  },
190
-
191
228
  stepSize: 0 // 当前一页可容纳的单元格数量
192
229
  };
193
-
194
230
  _this.mainWrap = /*#__PURE__*/React.createRef();
195
231
  _this.leafWrap = /*#__PURE__*/React.createRef();
196
232
  _this.leafNav = /*#__PURE__*/React.createRef();
197
- _this.initFloorValues = _this.initFloorValues.bind(_assertThisInitialized(_this));
233
+ _this.initFloorValues = _this.initFloorValues.bind(_this);
198
234
  return _this;
199
235
  }
200
- _createClass(NavLeafScroll, [{
236
+ _inherits(NavLeafScroll, _Component);
237
+ return _createClass(NavLeafScroll, [{
201
238
  key: "componentDidMount",
202
239
  value: function componentDidMount() {
203
240
  var forbidScroll = this.props.forbidScroll;
@@ -238,7 +275,8 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
238
275
  title: 'title',
239
276
  count: 'count'
240
277
  } : _this$props2$optionNa,
241
- forbidScroll = _this$props2.forbidScroll;
278
+ forbidScroll = _this$props2.forbidScroll,
279
+ align = _this$props2.align;
242
280
  var _this$state3 = this.state,
243
281
  _this$state3$floorRel = _this$state3.floorRelatedSize,
244
282
  wrapHeight = _this$state3$floorRel.wrapHeight,
@@ -247,7 +285,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
247
285
  floorWidth = _this$state3$floorRel.floorWidth,
248
286
  stepSize = _this$state3.stepSize;
249
287
  if (type === 'horizontal') {}
250
- if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight)) {
288
+ if (JSON.stringify(navList) !== JSON.stringify(prevProps.navList) || (type === 'horizontal' ? baseItemWidth !== prevProps.baseItemWidth : baseItemHeight !== prevProps.baseItemHeight) || align !== prevProps.align) {
251
289
  this.initFloorValues();
252
290
  }
253
291
  if (forbidScroll !== prevProps.forbidScroll) {
@@ -267,11 +305,20 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
267
305
  });
268
306
  var stepNo = Math.floor(matchIndex / (type === 'horizontal' ? wrapWidth / baseItemWidth : wrapHeight / baseItemHeight)); // 当前所在的切换页数,从0开始
269
307
  var stepTotalSize = Array.isArray(navList) && Math.ceil(navList.length / stepSize) || 0; // 当前所有单元格占用的页总数
270
- console.log('stepTotalSize', stepTotalSize);
271
308
  this.setState({
272
- leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : 0,
273
- leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : 0,
309
+ leafNavScrollX: matchIndex !== -1 && stepNo !== 0 ? -wrapWidth * stepNo : this.calculateScrollSize('X', {
310
+ wrapHeight: wrapHeight,
311
+ floorHeight: floorHeight,
312
+ wrapWidth: wrapWidth,
313
+ floorWidth: floorWidth
314
+ }),
274
315
  // 如果当前默认传值有楼层节点,则需要判断其所在的位置
316
+ leafNavScrollY: matchIndex !== -1 && stepNo !== 0 ? -wrapHeight * stepNo : this.calculateScrollSize('Y', {
317
+ wrapHeight: wrapHeight,
318
+ floorHeight: floorHeight,
319
+ wrapWidth: wrapWidth,
320
+ floorWidth: floorWidth
321
+ }),
275
322
  arrowPermit: {
276
323
  prev: matchIndex !== -1 && stepNo !== 0,
277
324
  next: floorHeight > wrapHeight && stepNo + 1 !== stepTotalSize,
@@ -281,9 +328,7 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
281
328
  isMouseEnter: true
282
329
  });
283
330
  }
284
- } // 初始化楼层相关的值,如:是否允许触发滚动,默认滚动区间高度等
285
- // 点击节点事件
286
- // 鼠标滚轮监听
331
+ }
287
332
  }, {
288
333
  key: "render",
289
334
  value: function render() {
@@ -392,6 +437,5 @@ var NavLeafScroll = /*#__PURE__*/function (_Component) {
392
437
  }) : emptyNode)))));
393
438
  }
394
439
  }]);
395
- return NavLeafScroll;
396
440
  }(Component);
397
441
  export default NavLeafScroll;
@@ -36,5 +36,5 @@ interface RefactorTreeProps extends TreeProps {
36
36
  value: any;
37
37
  }[];
38
38
  }
39
- declare const RefactorTree: (props: RefactorTreeProps) => JSX.Element;
39
+ declare const RefactorTree: (props: RefactorTreeProps) => React.JSX.Element;
40
40
  export default RefactorTree;
@@ -5,9 +5,9 @@ import _Empty from "antd/es/empty";
5
5
  import "antd/es/popconfirm/style";
6
6
  import _Popconfirm from "antd/es/popconfirm";
7
7
  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); }
8
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
- 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); }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
+ 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); }
11
11
  import { __rest } from "tslib";
12
12
  // 重构树控件,可直接配置数据
13
13
  import React, { useMemo } from 'react';
@@ -38,14 +38,14 @@ var RefactorTree = function RefactorTree(props) {
38
38
  onCheck = props.onCheck,
39
39
  titleRender = props.titleRender,
40
40
  disabledFields = props.disabledFields,
41
- otherProps = __rest(props, ["treeData", "rootName", "rootKey", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck", "titleRender", "disabledFields"]); // const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
41
+ otherProps = __rest(props, ["treeData", "rootName", "rootKey", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck", "titleRender", "disabledFields"]);
42
+ // const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
42
43
  // 重新组合指定数据源字段
43
44
  var transTreeData = useMemo(function () {
44
- var _ref;
45
45
  var afterTransData = transDataParam(treeData, optionName); // 通过转换后的数据
46
46
  var resultData;
47
47
  // 如果有配置根节点,则添加 一个根节点数据
48
- resultData = rootName ? [(_ref = {}, _defineProperty(_ref, optionName.title || 'title', rootName), _defineProperty(_ref, optionName.key || 'key', rootKey || '0'), _defineProperty(_ref, 'children', afterTransData), _ref)] : afterTransData;
48
+ resultData = rootName ? [_defineProperty(_defineProperty(_defineProperty({}, optionName.title || 'title', rootName), optionName.key || 'key', rootKey || '0'), 'children', afterTransData)] : afterTransData;
49
49
  // 有配置limitKey指定限制同级节点时,添加判断节点选择限制(在父子节点不相关联条件下使用checkStrictly=true)
50
50
  if (checkStrictly && limitKey && checkedKeys) {
51
51
  if (Array.isArray(checkedKeys) && checkedKeys.length > 0 || checkedKeys && Array.isArray(checkedKeys.checked) && checkedKeys.checked.length > 0) {
@@ -35,5 +35,5 @@ interface RefactorTreeProps {
35
35
  limitKey?: string;
36
36
  checkedKeys?: any;
37
37
  }
38
- declare const RefactorTree: (props: RefactorTreeProps) => JSX.Element;
38
+ declare const RefactorTree: (props: RefactorTreeProps) => React.JSX.Element;
39
39
  export default RefactorTree;
@@ -4,12 +4,12 @@ import "antd/es/popconfirm/style";
4
4
  import _Popconfirm from "antd/es/popconfirm";
5
5
  import "antd/es/tree/style";
6
6
  import _Tree from "antd/es/tree";
7
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
8
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
11
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
13
  import { __rest } from "tslib";
14
14
  // 重构树控件,可直接配置数据
15
15
  import React, { useEffect, useState } from 'react';
@@ -40,40 +40,42 @@ var RefactorTree = function RefactorTree(props) {
40
40
  checkStrictly = props.checkStrictly,
41
41
  onSelect = props.onSelect,
42
42
  onCheck = props.onCheck,
43
- otherProps = __rest(props, ["treeData", "rootName", "rootKey", "rootIcon", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeItemReset", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck"]); // 重新组合指定数据源字段 (limitKey:用于限制只能选择指定同一层级的数据)
43
+ otherProps = __rest(props, ["treeData", "rootName", "rootKey", "rootIcon", "emptyDescription", "optionName", "defaultSelectedKeys", "nodeItemReset", "nodeExtra", "selectable", "nodeControl", "limitKey", "checkedKeys", "checkStrictly", "onSelect", "onCheck"]);
44
+ // 重新组合指定数据源字段 (limitKey:用于限制只能选择指定同一层级的数据)
44
45
  // const { title, value, children, disabled } = { value: 'value', title: 'title', children: 'children', disabled: 'disabled', ...optionName }
45
46
  var _useState = useState([]),
46
47
  _useState2 = _slicedToArray(_useState, 2),
47
48
  dataList = _useState2[0],
48
- setDataList = _useState2[1]; // 限制节点选中条件下更新列表数据
49
+ setDataList = _useState2[1];
50
+ // 限制节点选中条件下更新列表数据
49
51
  var resetDataWithLimit = function resetDataWithLimit(hasKeys, list, resultList) {
50
52
  // 利用ID匹配对应选中的完整节点数据
51
- var filterCheckedNode = function filterCheckedNode(ids, preList, matchList) {
53
+ var _filterCheckedNode = function filterCheckedNode(ids, preList, matchList) {
52
54
  if (Array.isArray(preList) && preList.length > 0) {
53
55
  preList.forEach(function (item, i) {
54
56
  if (ids.includes(item[optionName.value])) {
55
57
  matchList.push(Object.assign({}, item));
56
58
  }
57
- filterCheckedNode(ids, item[optionName.children || 'children'], matchList);
59
+ _filterCheckedNode(ids, item[optionName.children || 'children'], matchList);
58
60
  });
59
61
  }
60
62
  };
61
63
  // 筛选同一层级可选择,其他层级数据不可选择(限制按指定字段名的层级数据)
62
- var filterResetSameLevel = function filterResetSameLevel(preList, resData, matchData) {
64
+ var _filterResetSameLevel = function filterResetSameLevel(preList, resData, matchData) {
63
65
  if (Array.isArray(preList) && preList.length > 0) {
64
66
  preList.forEach(function (item, i) {
65
67
  resData[i] = Object.assign({}, item);
66
68
  resData[i].isLimit = item[limitKey] !== matchData; // [limitKey];
67
69
  var newDeepArr = [];
68
- filterResetSameLevel(item[optionName.children || 'children'], newDeepArr, matchData);
70
+ _filterResetSameLevel(item[optionName.children || 'children'], newDeepArr, matchData);
69
71
  resData[i][optionName.children || 'children'] = newDeepArr;
70
72
  });
71
73
  }
72
74
  };
73
75
  var matchItems = [];
74
- filterCheckedNode(hasKeys, list, matchItems); // 先筛选出来选中节点的数据,取其中的 level 层级的值(数据必须保证同级类型值一致)
76
+ _filterCheckedNode(hasKeys, list, matchItems); // 先筛选出来选中节点的数据,取其中的 level 层级的值(数据必须保证同级类型值一致)
75
77
  if (matchItems.length > 0) {
76
- filterResetSameLevel(list, resultList, matchItems[0][limitKey]);
78
+ _filterResetSameLevel(list, resultList, matchItems[0][limitKey]);
77
79
  }
78
80
  };
79
81
  useEffect(function () {
@@ -152,7 +154,7 @@ var RefactorTree = function RefactorTree(props) {
152
154
  name: 'delete'
153
155
  })))) : null, nodeExtra && nodeExtra);
154
156
  };
155
- var renderTreeNodes = function renderTreeNodes(data) {
157
+ var _renderTreeNodes = function renderTreeNodes(data) {
156
158
  return data.map(function (item) {
157
159
  if (item[optionName.children || 'children']) {
158
160
  return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, item, {
@@ -161,7 +163,7 @@ var RefactorTree = function RefactorTree(props) {
161
163
  className: selectable ? '' : "notPointer",
162
164
  disabled: item.isLimit || nodeItemReset && nodeItemReset(item).disabled || item[optionName.disabled || 'disabled'],
163
165
  dataRef: item
164
- }), renderTreeNodes(item[optionName.children || 'children']));
166
+ }), _renderTreeNodes(item[optionName.children || 'children']));
165
167
  }
166
168
  return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, item, {
167
169
  title: renderNodeTitle(item),
@@ -194,11 +196,11 @@ var RefactorTree = function RefactorTree(props) {
194
196
  selectable: selectable,
195
197
  checkedKeys: checkedKeys,
196
198
  checkStrictly: checkStrictly
197
- }), rootName ? /*#__PURE__*/React.createElement(TreeNode, {
199
+ }), rootName ? (/*#__PURE__*/React.createElement(TreeNode, {
198
200
  title: rootName,
199
201
  key: rootKey || '0',
200
202
  className: selectable ? '' : "notPointer",
201
203
  icon: rootIcon || null
202
- }, renderTreeNodes(dataList)) : renderTreeNodes(dataList));
204
+ }, _renderTreeNodes(dataList))) : _renderTreeNodes(dataList));
203
205
  };
204
206
  export default RefactorTree;
@@ -1,9 +1,9 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
2
2
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
7
  import { __rest } from "tslib";
8
8
  /**
9
9
  * transDataParam 根据指定选项字段名重组数据
@@ -21,7 +21,7 @@ export function transDataParam(array) {
21
21
  disabled: 'disabled',
22
22
  selectable: 'selectable'
23
23
  };
24
- var trans = function trans(list) {
24
+ var _trans = function trans(list) {
25
25
  if (!list) return null;
26
26
  return list.map(function (item) {
27
27
  if (item.hasOwnProperty(optionName.disabled || 'disabled')) {
@@ -31,7 +31,7 @@ export function transDataParam(array) {
31
31
  item.selectable = item[optionName.selectable || 'selectable'];
32
32
  }
33
33
  if (item.hasOwnProperty(optionName.children || 'children')) {
34
- item.children = item[optionName.children || 'children'] ? trans(item[optionName.children || 'children']) : [];
34
+ item.children = item[optionName.children || 'children'] ? _trans(item[optionName.children || 'children']) : [];
35
35
  }
36
36
  return Object.assign(Object.assign({}, item), {
37
37
  key: item[optionName.value || optionName.key || 'key'],
@@ -39,7 +39,7 @@ export function transDataParam(array) {
39
39
  });
40
40
  });
41
41
  };
42
- return trans(array);
42
+ return _trans(array);
43
43
  }
44
44
  /**
45
45
  * 根据限制字段limitKey进行重组数据
@@ -63,7 +63,7 @@ export function resetDataWithLimit(hasKeys, list) {
63
63
  };
64
64
  var limitKey = arguments.length > 3 ? arguments[3] : undefined;
65
65
  // 利用ID匹配对应选中的完整节点数据
66
- var filterCheckedNode = function filterCheckedNode(ids, preList) {
66
+ var _filterCheckedNode = function filterCheckedNode(ids, preList) {
67
67
  var matchList = [];
68
68
  if (Array.isArray(preList) && preList.length > 0) {
69
69
  preList.forEach(function (item, i) {
@@ -71,14 +71,14 @@ export function resetDataWithLimit(hasKeys, list) {
71
71
  matchList.push(Object.assign({}, item));
72
72
  }
73
73
  if (item[optionName.children || 'children']) {
74
- matchList = matchList.concat(filterCheckedNode(ids, item[optionName.children || 'children']));
74
+ matchList = matchList.concat(_filterCheckedNode(ids, item[optionName.children || 'children']));
75
75
  }
76
76
  });
77
77
  }
78
78
  return matchList;
79
79
  };
80
80
  // 筛选同一层级可选择,其他层级数据不可选择(限制按指定字段名的层级数据)
81
- var filterResetSameLevel = function filterResetSameLevel(preList, matchDataValue) {
81
+ var _filterResetSameLevel = function filterResetSameLevel(preList, matchDataValue) {
82
82
  if (!preList) return [];
83
83
  if (!matchDataValue) return preList;
84
84
  return preList === null || preList === void 0 ? void 0 : preList.map(function (preItem) {
@@ -91,8 +91,8 @@ export function resetDataWithLimit(hasKeys, list) {
91
91
  }
92
92
  // item.disabled = item[limitKey] !== matchDataValue || item[optionName.disabled || 'disabled']
93
93
  item.isLimit = item[limitKey] !== matchDataValue;
94
- item.children = filterResetSameLevel(item['children'], matchDataValue);
95
- item[optionName.children || 'children'] = filterResetSameLevel(item[optionName.children || 'children'], matchDataValue);
94
+ item.children = _filterResetSameLevel(item['children'], matchDataValue);
95
+ item[optionName.children || 'children'] = _filterResetSameLevel(item[optionName.children || 'children'], matchDataValue);
96
96
  return Object.assign({}, item);
97
97
  });
98
98
  };
@@ -100,9 +100,9 @@ export function resetDataWithLimit(hasKeys, list) {
100
100
  var prevList = list && Array.isArray(list) ? _toConsumableArray(list) : [];
101
101
  var _ref = _toConsumableArray(prevList),
102
102
  newList = _ref.slice(0);
103
- var filterLimitData = filterCheckedNode(hasKeys, newList);
103
+ var filterLimitData = _filterCheckedNode(hasKeys, newList);
104
104
  if (filterLimitData.length > 0) {
105
- return filterResetSameLevel(newList, filterLimitData[0][limitKey]);
105
+ return _filterResetSameLevel(newList, filterLimitData[0][limitKey]);
106
106
  } else {
107
107
  return newList;
108
108
  }
@@ -121,7 +121,7 @@ export function resetDataWithLimit(hasKeys, list) {
121
121
  * */
122
122
  export function resetDataWithDisabled(list, optionName, disabledFields) {
123
123
  // 筛选与禁用字段内值相同的节点进行禁用
124
- var filterResetTargetFields = function filterResetTargetFields(preList, fields) {
124
+ var _filterResetTargetFields = function filterResetTargetFields(preList, fields) {
125
125
  if (!preList) return [];
126
126
  return preList.map(function (preItem) {
127
127
  var oldItem = Object.assign({}, preItem);
@@ -140,7 +140,7 @@ export function resetDataWithDisabled(list, optionName, disabledFields) {
140
140
  }
141
141
  }
142
142
  if (itemKeyName === 'children') {
143
- item.children = filterResetTargetFields(item[itemKeyName], fields);
143
+ item.children = _filterResetTargetFields(item[itemKeyName], fields);
144
144
  }
145
145
  });
146
146
  return Object.assign({}, item);
@@ -149,5 +149,5 @@ export function resetDataWithDisabled(list, optionName, disabledFields) {
149
149
  var prevList = list && Array.isArray(list) ? _toConsumableArray(list) : [];
150
150
  var _ref2 = _toConsumableArray(prevList),
151
151
  newList = _ref2.slice(0);
152
- return filterResetTargetFields(newList, disabledFields);
152
+ return _filterResetTargetFields(newList, disabledFields);
153
153
  }