fan-standard-comp 3.2.1 → 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 +146 -180
  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 +150 -185
  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,217 +1,229 @@
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); }
2
1
  import "antd/es/button/style";
3
2
  import _Button from "antd/es/button";
4
3
  import "antd/es/form/style";
5
4
  import _Form from "antd/es/form";
6
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
- 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); } }
8
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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); }
11
- 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); }
12
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
13
- 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); }; }
14
- 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); }
15
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
16
- 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; } }
17
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
18
- import React from 'react';
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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; } }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ // @ts-nocheck
12
+ import React, { useContext, useEffect, useRef, useState, useMemo, useCallback, useImperativeHandle } from 'react';
19
13
  import UtilValueFormat from '../utils/ValueFormat.js';
20
14
  import ButtonGroup from '../ButtonGroup/index';
21
- // import { general } from '../data/index';
15
+ import { general } from '../data/index';
22
16
  import './style/index.less';
23
17
  import RenderItemGroup from '../FormComp/RenderItemGroup';
18
+ import { FanContext } from '../ConfigContext';
24
19
  var FormItem = _Form.Item;
25
- var StandardFilter = /*#__PURE__*/function (_React$Component) {
26
- _inherits(StandardFilter, _React$Component);
27
- var _super = _createSuper(StandardFilter);
28
- function StandardFilter(props) {
29
- var _this;
30
- _classCallCheck(this, StandardFilter);
31
- _this = _super.call(this, props);
32
- _this.filterFormRef = /*#__PURE__*/React.createRef();
33
- // 更新表单控件值,用于外部获取当前表单实例(force是否强制清空表单)
34
- _this.updateFormFields = function (newVal, force) {
35
- var getFormFields = _this.props.getFormFields;
36
- var resetValues = {};
37
- if (force) {
38
- // this.filterFormRef.current.resetFields()
39
- // 先清空 再赋值
40
- resetValues = _this.filterFormRef.current.getFieldsValue();
41
- Object.keys(resetValues).forEach(function (item) {
42
- resetValues[item] = undefined;
43
- });
44
- }
45
- _this.filterFormRef.current.setFieldsValue(Object.assign(Object.assign({}, resetValues), newVal)); // 直接清空表单的赋值
46
- if (getFormFields) getFormFields(_this.filterFormRef.current.getFieldsValue(), _this.filterFormRef);
47
- }; // 强制更新表单值,用于赋初始化实例值
48
- _this.forceUpdateForm = function () {
49
- var getFormFields = _this.props.getFormFields;
50
- if (getFormFields) getFormFields(_this.filterFormRef.current.getFieldsValue(), _this.filterFormRef);
51
- };
52
- _this.handleSearch = function (values) {
53
- var _this$props = _this.props,
54
- formItemGroup = _this$props.formItemGroup,
55
- onFilterSearch = _this$props.onFilterSearch; // if (Object.prototype.hasOwnProperty.call(values, false)) {
56
- // delete values.false // TODO 自定义结构会莫名的出来一个false字段
57
- // }
58
- var resultValues = UtilValueFormat(values, formItemGroup);
59
- if (onFilterSearch) {
60
- onFilterSearch(Object.assign({}, resultValues));
20
+ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
+ var InitFanContext = useContext(FanContext);
22
+ var providerConfig = InitFanContext['StandardFilter'] || {}; // 使用上下文(全局配置)设置扩展的配置项
23
+ var _Object$assign = Object.assign(Object.assign({}, providerConfig), props),
24
+ _Object$assign$formIt = _Object$assign.formItemGroup,
25
+ formItemGroup = _Object$assign$formIt === void 0 ? [] : _Object$assign$formIt,
26
+ itemGroupConfig = _Object$assign.itemGroupConfig,
27
+ initialValues = _Object$assign.initialValues,
28
+ getFormFields = _Object$assign.getFormFields,
29
+ onFilterSearch = _Object$assign.onFilterSearch,
30
+ onFilterReset = _Object$assign.onFilterReset,
31
+ className = _Object$assign.className,
32
+ style = _Object$assign.style,
33
+ _Object$assign$button = _Object$assign.buttonGroup,
34
+ buttonGroup = _Object$assign$button === void 0 ? [] : _Object$assign$button,
35
+ buttonGroupConfig = _Object$assign.buttonGroupConfig,
36
+ min = _Object$assign.min,
37
+ codes = _Object$assign.codes,
38
+ permissionCodes = _Object$assign.permissionCodes,
39
+ confirmText = _Object$assign.confirmText,
40
+ cancelText = _Object$assign.cancelText,
41
+ _Object$assign$confir = _Object$assign.confirmButtonProps,
42
+ confirmButtonProps = _Object$assign$confir === void 0 ? {} : _Object$assign$confir,
43
+ _Object$assign$cancel = _Object$assign.cancelButtonProps,
44
+ cancelButtonProps = _Object$assign$cancel === void 0 ? {} : _Object$assign$cancel,
45
+ filterButtonColSpan = _Object$assign.filterButtonColSpan,
46
+ filterButtonConfig = _Object$assign.filterButtonConfig,
47
+ formLayout = _Object$assign.formLayout,
48
+ gridLayout = _Object$assign.gridLayout,
49
+ filterFormStyle = _Object$assign.filterFormStyle,
50
+ filterBtnsStyle = _Object$assign.filterBtnsStyle,
51
+ _Object$assign$colon = _Object$assign.colon,
52
+ colon = _Object$assign$colon === void 0 ? true : _Object$assign$colon;
53
+ var filterFormRef = useRef();
54
+ // ref 的转发
55
+ useImperativeHandle(ref, function () {
56
+ return filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current;
57
+ });
58
+ var _useState = useState([]),
59
+ _useState2 = _slicedToArray(_useState, 2),
60
+ reFormItemGroup = _useState2[0],
61
+ setReFormItemGroup = _useState2[1];
62
+ var _useState3 = useState(0),
63
+ _useState4 = _slicedToArray(_useState3, 2),
64
+ isHideCount = _useState4[0],
65
+ setIsHideCount = _useState4[1]; // 表单隐藏项数量值
66
+ var filterFormLayout = useMemo(function () {
67
+ return formLayout || 'inline';
68
+ }, [formLayout]);
69
+ // 配置筛选按钮(确认与取消)
70
+ var filterActionButtons = useMemo(function () {
71
+ // 当前栅栅数量
72
+ var itemGroupSize = (itemGroupConfig === null || itemGroupConfig === void 0 ? void 0 : itemGroupConfig.size) || (filterFormLayout === 'horizontal' ? 'xxlg' : 'md');
73
+ // 计算扣除栅格列数是否还有多余的项,用来判断筛选按钮的版式(初始化的时候,可能会受默认值内配置的isHide影响导致计算错误;或自定义表单控件组栅格影响)
74
+ var complementationTimes = (formItemGroup.length - isHideCount) % general.modalSize[itemGroupSize].columnNumber;
75
+ // xs:1列 sm:1列 【span:24】
76
+ // md:2列 【span:12】
77
+ // lg:3列 xlg:3列 【span:8】
78
+ // xxlg:4列 【span:6】
79
+ if (!onFilterSearch && !onFilterReset) return [];
80
+ return [Object.assign(Object.assign({
81
+ label: '',
82
+ type: 'custom',
83
+ // display: 'block',
84
+ display: {
85
+ wrapperCol: {
86
+ // 占用的格子数按对应size配置的formItem(md下额外再新增1)
87
+ span: general.modalSize[itemGroupSize].formLayout.labelCol.span + general.modalSize[itemGroupSize].formLayout.wrapperCol.span + (itemGroupSize === 'md' ? 1 : 0)
88
+ }
89
+ },
90
+ protoFormItem: {
91
+ style: {
92
+ textAlign: filterFormLayout === 'horizontal' ? 'right' : 'left'
93
+ }
94
+ },
95
+ colSpan: filterButtonColSpan || 24 - complementationTimes * (24 / general.modalSize[itemGroupSize].columnNumber)
96
+ }, filterButtonConfig), {
97
+ customRender: function customRender() {
98
+ return /*#__PURE__*/React.createElement(FormItem, {
99
+ noStyle: true
100
+ }, onFilterSearch && /*#__PURE__*/React.createElement(_Button, Object.assign({
101
+ type: "primary",
102
+ htmlType: "submit"
103
+ }, confirmButtonProps), confirmText || '查询'), onFilterReset && /*#__PURE__*/React.createElement(_Button, Object.assign({
104
+ type: "primary",
105
+ style: {
106
+ marginLeft: 8
107
+ },
108
+ onClick: handleReset,
109
+ ghost: true
110
+ }, cancelButtonProps), cancelText || '重置'));
61
111
  }
62
- };
63
- _this.handleReset = function () {
64
- var onFilterReset = _this.props.onFilterReset; // 使用此方法,表单校验无法清空掉
65
- // const resetValues = this.filterFormRef.current.getFieldsValue()
66
- // Object.keys(resetValues).forEach((item) => {
67
- // resetValues[item] = undefined
68
- // })
69
- // this.filterFormRef.current.setFieldsValue({ ...resetValues }) // 直接清空表单的赋值
70
- _this.filterFormRef.current.resetFields();
71
- _this.setState({
72
- reFormItemGroup: _this.props.formItemGroup // 重新渲染列表
112
+ })];
113
+ }, [confirmText, cancelText, filterFormLayout, reFormItemGroup, onFilterSearch, onFilterReset, itemGroupConfig, filterFormRef, isHideCount]);
114
+ // 更新表单控件值,用于外部获取当前表单实例(force是否强制清空表单)
115
+ var updateFormFields = function updateFormFields(newVal, force) {
116
+ var resetValues = {};
117
+ if (force) {
118
+ // this.filterFormRef.current.resetFields()
119
+ // 先清空 再赋值
120
+ resetValues = filterFormRef.current.getFieldsValue();
121
+ Object.keys(resetValues).forEach(function (item) {
122
+ resetValues[item] = undefined;
73
123
  });
74
-
75
- if (onFilterReset) {
76
- onFilterReset(_this.filterFormRef.current.getFieldsValue());
77
- }
78
- };
79
- _this.itemIsHide = function (isHide) {
80
- var current = _this.filterFormRef.current;
81
- if (!isHide) return false;
82
- if (typeof isHide === 'function') {
83
- return isHide(current ? current.getFieldsValue() : {}, current);
84
- }
85
- return isHide;
86
- };
87
- // 表单列表组 formItemGroup 类型为数组或者React.Node
88
- _this.renderFormItemGroup = function () {
89
- var reFormItemGroup = _this.state.reFormItemGroup;
90
- if (Array.isArray(reFormItemGroup)) {
91
- return /*#__PURE__*/React.createElement(RenderItemGroup, {
92
- itemGroup: reFormItemGroup,
93
- layout: "inline",
94
- form: _this.filterFormRef,
95
- doUpdateFormFields: function doUpdateFormFields() {
96
- return _this.forceUpdateForm();
97
- }
98
- });
99
- /* return <>
100
- {
101
- reFormItemGroup.map((item, index) => {
102
- const { componentStyle, isHide } = item
103
- if (this.itemIsHide(isHide)) return null
104
- return (
105
- <FormItem key={item.filedName} label={item.label}
106
- name={item.type !== 'custom' && item.filedName}
107
- rules={item.rules || (item.fieldOptions ? item.fieldOptions.rules : [])}
108
- {...item.protoFormItem}>
109
- {
110
- (item.type === 'custom' && item.customRender) ? item.customRender(this.filterFormRef, { ...item }) :
111
- <FieldComponent {...item}
112
- onChange={(val, ...otherParams) => {
113
- let updateValue = val
114
- if (item.type === 'input' || item.type === 'textarea' || item.type === 'radio') {
115
- updateValue = val.target.value
116
- }
117
- if (Array.isArray(val)) {
118
- updateValue = [...val]
119
- }
120
- this.updateFormFields({ [item.filedName]: updateValue })
121
- if (item.onChange) item.onChange(val, this.filterFormRef, ...otherParams)
122
- }}
123
- style={{ width: item.type === 'checkbox' || item.type === 'radio' ? 'auto' : general.formItemStyle.xsm.width, ...componentStyle }}/>
124
- }
125
- </FormItem>
126
- )
127
- })
128
- }
129
- </>*/
130
- }
131
-
132
- return reFormItemGroup;
133
- };
134
- _this.state = {
135
- // recombinationGroup: [],
136
- reFormItemGroup: undefined
137
- };
138
- return _this;
139
- }
140
- _createClass(StandardFilter, [{
141
- key: "componentDidMount",
142
- value: function componentDidMount() {
143
- var initialValues = this.props.initialValues;
144
- this.updateFormFields(initialValues, true);
145
124
  }
146
- }, {
147
- key: "componentDidUpdate",
148
- value: function componentDidUpdate(prevProps) {
149
- var initialValues = this.props.initialValues;
150
- if (prevProps.initialValues !== initialValues) {
151
- this.updateFormFields(initialValues, true);
152
- }
125
+ filterFormRef.current.setFieldsValue(Object.assign(Object.assign({}, resetValues), newVal || {})); // 直接清空表单的赋值
126
+ updateCalculate(filterFormRef.current.getFieldsValue());
127
+ if (getFormFields) getFormFields(filterFormRef.current.getFieldsValue(), filterFormRef);
128
+ };
129
+ // 强制更新表单值,用于赋初始化实例值
130
+ var forceUpdateForm = function forceUpdateForm() {
131
+ var formValues = filterFormRef.current.getFieldsValue();
132
+ // if (Object.prototype.hasOwnProperty.call(formValues, false)) {
133
+ // delete formValues.false // TODO 自定义结构会莫名的出来一个false字段
134
+ // }
135
+ updateCalculate(formValues); // 更新当前表单数量,排除被隐藏的值
136
+ if (getFormFields) getFormFields(filterFormRef.current.getFieldsValue(), filterFormRef);
137
+ };
138
+ // 计算表单隐藏项
139
+ var updateCalculate = useCallback(function (formValues) {
140
+ setIsHideCount(reFormItemGroup.filter(function (item) {
141
+ return item.hasOwnProperty('isHide') ? item.isHide(Object.assign({}, formValues), filterFormRef) : false;
142
+ }).length);
143
+ }, [reFormItemGroup, filterFormRef]);
144
+ var handleSearch = function handleSearch(values) {
145
+ // if (Object.prototype.hasOwnProperty.call(values, false)) {
146
+ // delete values.false // TODO 自定义结构会莫名的出来一个false字段
147
+ // }
148
+ var resultValues = UtilValueFormat(values, formItemGroup);
149
+ if (onFilterSearch) {
150
+ onFilterSearch(Object.assign({}, resultValues));
153
151
  }
154
- }, {
155
- key: "render",
156
- value: function render() {
157
- var _this$props2 = this.props,
158
- className = _this$props2.className,
159
- style = _this$props2.style,
160
- onFilterReset = _this$props2.onFilterReset,
161
- _this$props2$buttonGr = _this$props2.buttonGroup,
162
- buttonGroup = _this$props2$buttonGr === void 0 ? [] : _this$props2$buttonGr,
163
- min = _this$props2.min,
164
- codes = _this$props2.codes,
165
- permissionCodes = _this$props2.permissionCodes,
166
- confirmText = _this$props2.confirmText,
167
- cancelText = _this$props2.cancelText,
168
- onFilterSearch = _this$props2.onFilterSearch,
169
- buttonGroupConfig = _this$props2.buttonGroupConfig; // const { recombinationGroup } = this.state;
170
- return /*#__PURE__*/React.createElement(_Form, {
171
- name: "standard-filter-form",
172
- ref: this.filterFormRef,
173
- layout: "inline",
174
- onFinish: this.handleSearch,
175
- className: className,
176
- style: style
177
- }, /*#__PURE__*/React.createElement("div", {
178
- className: "filter-grid"
179
- }, /*#__PURE__*/React.createElement("div", {
180
- className: "filter-form"
181
- }, this.state.reFormItemGroup ? /*#__PURE__*/React.createElement(React.Fragment, null, this.renderFormItemGroup(), /*#__PURE__*/React.createElement(FormItem, {
182
- style: {
183
- display: !onFilterSearch && !onFilterReset ? 'none' : 'inline-block'
152
+ };
153
+ var handleReset = function handleReset() {
154
+ var _a, _b;
155
+ // 使用此方法,表单校验无法清空掉
156
+ // const resetValues = this.filterFormRef.current.getFieldsValue()
157
+ // Object.keys(resetValues).forEach((item) => {
158
+ // resetValues[item] = undefined
159
+ // })
160
+ // this.filterFormRef.current.setFieldsValue({ ...resetValues }) // 直接清空表单的赋值
161
+ filterFormRef.current.resetFields();
162
+ setReFormItemGroup(formItemGroup); // 重新渲染列表
163
+ updateCalculate((_a = filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current) === null || _a === void 0 ? void 0 : _a.getFieldsValue());
164
+ if (onFilterReset) {
165
+ onFilterReset((_b = filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
166
+ }
167
+ };
168
+ useEffect(function () {
169
+ if (initialValues && JSON.stringify(initialValues) !== '{}') {
170
+ updateFormFields(initialValues, true);
171
+ }
172
+ }, [initialValues]);
173
+ useEffect(function () {
174
+ setReFormItemGroup(formItemGroup);
175
+ }, [formItemGroup]);
176
+ // / 表单列表组 formItemGroup 类型为数组或者React.Node
177
+ var renderFormItemGroup = function renderFormItemGroup() {
178
+ if (Array.isArray(reFormItemGroup)) {
179
+ // 数组则默认加上"确认与取消"按钮
180
+ return /*#__PURE__*/React.createElement(RenderItemGroup, Object.assign({
181
+ itemGroup: reFormItemGroup.concat(filterActionButtons),
182
+ size: filterFormLayout === 'horizontal' ? 'xxlg' : 'md',
183
+ layout: filterFormLayout,
184
+ form: filterFormRef,
185
+ // displayLayout={{labelCol: { span: 8 }, wrapperCol: { span: 16 },}}
186
+ doUpdateFormFields: function doUpdateFormFields() {
187
+ return forceUpdateForm();
184
188
  }
185
- }, onFilterSearch && /*#__PURE__*/React.createElement(_Button, {
186
- type: "primary",
187
- htmlType: "submit"
188
- }, " ", confirmText || '查询'), onFilterReset && /*#__PURE__*/React.createElement(_Button, {
189
- type: "primary",
190
- style: {
191
- marginLeft: 8
192
- },
193
- onClick: this.handleReset,
194
- ghost: true
195
- }, cancelText || '重置'))) : null), buttonGroup && buttonGroup.length > 0 ? /*#__PURE__*/React.createElement("div", {
196
- className: "filter-btns"
197
- }, /*#__PURE__*/React.createElement(ButtonGroup, {
198
- options: buttonGroup,
199
- min: min,
200
- codes: codes,
201
- permissionCodes: permissionCodes,
202
- dropdownConfig: buttonGroupConfig
203
- })) : null));
189
+ }, itemGroupConfig));
204
190
  }
205
- }], [{
206
- key: "getDerivedStateFromProps",
207
- value: function getDerivedStateFromProps(nextProps) {
208
- var formItemGroup = nextProps.formItemGroup; // const restOptionList = removeNoPermission(buttonGroup, permissionCodes, codes) || []
209
- return {
210
- // recombinationGroup: restOptionList,
211
- reFormItemGroup: formItemGroup
212
- };
191
+ return reFormItemGroup;
192
+ };
193
+ /**
194
+ * 生成guid
195
+ */
196
+ var guid = function guid() {
197
+ function S4() {
198
+ return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
213
199
  }
214
- }]);
215
- return StandardFilter;
216
- }(React.Component);
200
+ return "".concat(S4(), "-").concat(S4());
201
+ };
202
+ var renderButtonGroup = function renderButtonGroup() {
203
+ return buttonGroup && buttonGroup.length > 0 ? /*#__PURE__*/React.createElement("div", {
204
+ className: "filter-btns ",
205
+ style: filterBtnsStyle
206
+ }, /*#__PURE__*/React.createElement(ButtonGroup, {
207
+ options: buttonGroup,
208
+ min: min,
209
+ codes: codes,
210
+ permissionCodes: permissionCodes,
211
+ dropdownConfig: buttonGroupConfig
212
+ })) : null;
213
+ };
214
+ return /*#__PURE__*/React.createElement(_Form, {
215
+ name: 'standard-filter-form-' + guid(),
216
+ ref: filterFormRef,
217
+ layout: filterFormLayout,
218
+ onFinish: handleSearch,
219
+ className: "standard-filter ".concat(className || ''),
220
+ style: style,
221
+ colon: colon
222
+ }, /*#__PURE__*/React.createElement("div", {
223
+ className: "filter-grid filter-grid-".concat(gridLayout),
224
+ style: filterFormStyle
225
+ }, reFormItemGroup.length === 0 ? null : /*#__PURE__*/React.createElement("div", {
226
+ className: "filter-form filter-form-".concat(formLayout)
227
+ }, reFormItemGroup ? /*#__PURE__*/React.createElement(React.Fragment, null, renderFormItemGroup()) : null), renderButtonGroup()));
228
+ });
217
229
  export default StandardFilter;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { FieldComponentProps } from '../FormComp/FieldComponent';
3
+ import { ButtonGroupOptionsProps } from '../ButtonGroup/index';
4
+ import './style/index.less';
5
+ export interface StandardFilterProps {
6
+ buttonGroup?: ButtonGroupOptionsProps[];
7
+ buttonGroupConfig?: Object;
8
+ formItemGroup?: FieldComponentProps[];
9
+ confirmText?: string;
10
+ onFilterSearch?: (value?: object) => void;
11
+ onFilterReset?: (value?: object) => void;
12
+ cancelText?: string;
13
+ initialValues?: any;
14
+ getFormFields?: (fields: any, form: any) => void;
15
+ className?: string;
16
+ style?: React.CSSProperties;
17
+ min?: number;
18
+ codes?: any[];
19
+ permissionCodes?: string[];
20
+ }
21
+ declare class StandardFilter extends React.Component<StandardFilterProps, any> {
22
+ static getDerivedStateFromProps(nextProps: StandardFilterProps): {
23
+ reFormItemGroup: FieldComponentProps[];
24
+ };
25
+ private filterFormRef;
26
+ constructor(props: StandardFilterProps);
27
+ componentDidMount(): void;
28
+ componentDidUpdate(prevProps: StandardFilterProps): void;
29
+ updateFormFields: (newVal?: any, force?: boolean) => void;
30
+ forceUpdateForm: () => void;
31
+ handleSearch: (values: object) => void;
32
+ handleReset: () => void;
33
+ itemIsHide: (isHide: any) => any;
34
+ renderFormItemGroup: () => any;
35
+ render(): React.JSX.Element;
36
+ }
37
+ export default StandardFilter;