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