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.
- package/Readme.md +1 -33
- package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
- package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
- package/dist/fan-standard-comp.umd.js +166 -444
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/dist/fonts/lg.ttf +0 -0
- package/dist/fonts/lg.woff +0 -0
- package/dist/fonts/lg.woff2 +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +2 -1
- package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/es/ButtonGroup/PopConfirmTitle.js +5 -5
- package/es/ButtonGroup/index.d.ts +3 -1
- package/es/ButtonGroup/index.js +146 -180
- package/es/ButtonGroup/style/index.less +4 -1
- package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
- package/es/CalendarCoordPicker/index.d.ts +8 -0
- package/es/CalendarCoordPicker/index.js +296 -0
- package/es/CalendarCoordPicker/index.less +31 -0
- package/es/ConfigContext/index.d.ts +7 -0
- package/es/ConfigContext/index.js +12 -0
- package/es/DragContent/index.d.ts +1 -1
- package/es/DragContent/index.js +5 -5
- package/es/FormComp/ChunkUploader/api.js +14 -14
- package/es/FormComp/ChunkUploader/index.js +132 -139
- package/es/FormComp/ChunkUploader/lib.js +21 -21
- package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
- package/es/FormComp/EditButton/index.d.ts +1 -1
- package/es/FormComp/EditButton/index.js +15 -17
- package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/es/FormComp/FieldComponent/ReUpload.js +37 -23
- package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
- package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/es/FormComp/FieldComponent/index.d.ts +1 -1
- package/es/FormComp/FieldComponent/index.js +33 -23
- package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
- package/es/FormComp/RenderItemGroup/index.js +24 -8
- package/es/FormComp/Uploader/index.d.ts +3 -1
- package/es/FormComp/Uploader/index.js +243 -119
- package/es/FormComp/VarTemplate/index.js +57 -64
- package/es/ImageGallery/ImagePreview.d.ts +13 -0
- package/es/ImageGallery/ImagePreview.js +168 -0
- package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/es/ImageGallery/SliderContent.d.ts +7 -0
- package/es/ImageGallery/SliderContent.js +699 -0
- package/es/ImageGallery/Thumbnail.d.ts +3 -0
- package/es/ImageGallery/Thumbnail.js +296 -0
- package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/es/ImageGallery/hook/uniqueId.js +10 -0
- package/es/ImageGallery/index.d.ts +4 -0
- package/es/ImageGallery/index.js +29 -0
- package/es/ImageGallery/style/index.less +5 -0
- package/es/ImageGallery/types.d.ts +5 -0
- package/es/ImageGallery/types.js +1 -0
- package/es/NavLeafScroll/index.js +94 -50
- package/es/RefactorTree/index.d.ts +1 -1
- package/es/RefactorTree/index.js +6 -6
- package/es/RefactorTree/indexTreeNode.d.ts +1 -1
- package/es/RefactorTree/indexTreeNode.js +19 -17
- package/es/RefactorTree/util.js +18 -18
- package/es/SpecIcon/fonts/demo_index.html +559 -5
- package/es/SpecIcon/fonts/iconfont.css +101 -3
- package/es/SpecIcon/fonts/iconfont.js +34 -27
- package/es/SpecIcon/fonts/iconfont.json +168 -0
- package/es/SpecIcon/fonts/iconfont.svg +163 -171
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/style/iconfont.less +106 -11
- package/es/SplitterLayout/Pane.d.ts +1 -1
- package/es/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SplitterLayout/Pane.js +3 -3
- package/es/StandardContent/SplitterLayout/index.js +25 -26
- package/es/StandardContent/SubfieldContent.d.ts +1 -1
- package/es/StandardContent/WrapperContent.d.ts +1 -1
- package/es/StandardDragModal/index.d.ts +11 -3
- package/es/StandardDragModal/index.js +25 -3
- package/es/StandardFilter/index.d.ts +5 -16
- package/es/StandardFilter/index.js +212 -200
- package/es/StandardFilter/indexClass.d.ts +37 -0
- package/es/StandardFilter/indexClass.js +217 -0
- package/es/StandardFilter/style/index.less +82 -9
- package/es/StandardForm/StepForm.d.ts +1 -1
- package/es/StandardForm/StepForm.js +28 -22
- package/es/StandardForm/TabForm.d.ts +1 -1
- package/es/StandardForm/TabForm.js +41 -43
- package/es/StandardForm/index.d.ts +1 -1
- package/es/StandardForm/index.js +5 -5
- package/es/StandardModal/UpdateFormRef.js +0 -1
- package/es/StandardModal/index.d.ts +2 -1
- package/es/StandardModal/index.js +25 -39
- package/es/StandardPanel/index.d.ts +1 -1
- package/es/StandardPanel/index.js +7 -7
- package/es/StandardTable/index.d.ts +1 -0
- package/es/StandardTable/index.js +44 -26
- package/es/components/IconNode/index.d.ts +1 -1
- package/es/components/IconNode/index.js +0 -1
- package/es/data/general.config.js +31 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +6 -2
- package/es/utils/filterPermission.js +7 -10
- package/es/utils/getParentNodes.js +101 -26
- package/es/utils/index.js +2 -3
- package/es/utils/urlUtils.js +76 -0
- package/lib/ButtonGroup/ButtonList.d.ts +2 -1
- package/lib/ButtonGroup/ButtonList.js +2 -3
- package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
- package/lib/ButtonGroup/ButtonMenu.js +2 -3
- package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
- package/lib/ButtonGroup/index.d.ts +3 -1
- package/lib/ButtonGroup/index.js +150 -185
- package/lib/ButtonGroup/style/index.less +4 -1
- package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
- package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
- package/lib/CalendarCoordPicker/index.d.ts +8 -0
- package/lib/CalendarCoordPicker/index.js +305 -0
- package/lib/CalendarCoordPicker/index.less +31 -0
- package/lib/ConfigContext/index.d.ts +7 -0
- package/lib/ConfigContext/index.js +17 -0
- package/lib/DragContent/DragBar.js +2 -3
- package/lib/DragContent/index.d.ts +1 -1
- package/lib/DragContent/index.js +9 -10
- package/lib/FormComp/ChunkUploader/api.js +15 -15
- package/lib/FormComp/ChunkUploader/index.js +135 -142
- package/lib/FormComp/ChunkUploader/lib.js +22 -22
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
- package/lib/FormComp/ChunkUploader/worker.js +1 -1
- package/lib/FormComp/EditButton/index.d.ts +1 -1
- package/lib/FormComp/EditButton/index.js +19 -22
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
- package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
- package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
- package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
- package/lib/FormComp/FieldComponent/index.d.ts +1 -1
- package/lib/FormComp/FieldComponent/index.js +38 -26
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
- package/lib/FormComp/RenderItemGroup/index.js +26 -11
- package/lib/FormComp/Uploader/index.d.ts +3 -1
- package/lib/FormComp/Uploader/index.js +244 -123
- package/lib/FormComp/VarTemplate/index.js +63 -71
- package/lib/FormComp/index.js +1 -1
- package/lib/ImageGallery/ImagePreview.d.ts +13 -0
- package/lib/ImageGallery/ImagePreview.js +178 -0
- package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
- package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
- package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
- package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
- package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
- package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
- package/lib/ImageGallery/SliderContent.d.ts +7 -0
- package/lib/ImageGallery/SliderContent.js +708 -0
- package/lib/ImageGallery/Thumbnail.d.ts +3 -0
- package/lib/ImageGallery/Thumbnail.js +306 -0
- package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
- package/lib/ImageGallery/hook/uniqueId.js +17 -0
- package/lib/ImageGallery/index.d.ts +4 -0
- package/lib/ImageGallery/index.js +36 -0
- package/lib/ImageGallery/style/index.less +5 -0
- package/lib/ImageGallery/types.d.ts +5 -0
- package/lib/ImageGallery/types.js +5 -0
- package/lib/NavLeafScroll/index.js +98 -55
- package/lib/RefactorTree/index.d.ts +1 -1
- package/lib/RefactorTree/index.js +10 -11
- package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
- package/lib/RefactorTree/indexTreeNode.js +23 -22
- package/lib/RefactorTree/util.js +18 -18
- package/lib/SpecIcon/fonts/demo_index.html +559 -5
- package/lib/SpecIcon/fonts/iconfont.css +101 -3
- package/lib/SpecIcon/fonts/iconfont.js +34 -27
- package/lib/SpecIcon/fonts/iconfont.json +168 -0
- package/lib/SpecIcon/fonts/iconfont.svg +163 -171
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.js +2 -3
- package/lib/SpecIcon/style/iconfont.less +106 -11
- package/lib/SplitterLayout/Pane.d.ts +1 -1
- package/lib/SplitterLayout/Pane.js +2 -3
- package/lib/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
- package/lib/StandardContent/SplitterLayout/index.js +27 -29
- package/lib/StandardContent/SubfieldContent.d.ts +1 -1
- package/lib/StandardContent/SubfieldContent.js +2 -3
- package/lib/StandardContent/WrapperContent.d.ts +1 -1
- package/lib/StandardContent/WrapperContent.js +2 -3
- package/lib/StandardDragModal/index.d.ts +11 -3
- package/lib/StandardDragModal/index.js +27 -33
- package/lib/StandardFilter/index.d.ts +5 -16
- package/lib/StandardFilter/index.js +215 -201
- package/lib/StandardFilter/indexClass.d.ts +37 -0
- package/lib/StandardFilter/indexClass.js +223 -0
- package/lib/StandardFilter/style/index.less +82 -9
- package/lib/StandardForm/ActionList.js +2 -3
- package/lib/StandardForm/StepForm.d.ts +1 -1
- package/lib/StandardForm/StepForm.js +32 -27
- package/lib/StandardForm/TabForm.d.ts +1 -1
- package/lib/StandardForm/TabForm.js +45 -48
- package/lib/StandardForm/index.d.ts +1 -1
- package/lib/StandardForm/index.js +9 -10
- package/lib/StandardModal/UpdateFormRef.js +3 -4
- package/lib/StandardModal/index.d.ts +2 -1
- package/lib/StandardModal/index.js +29 -43
- package/lib/StandardPanel/index.d.ts +1 -1
- package/lib/StandardPanel/index.js +11 -12
- package/lib/StandardTable/index.d.ts +1 -0
- package/lib/StandardTable/index.js +49 -29
- package/lib/components/IconNode/index.d.ts +1 -1
- package/lib/components/IconNode/index.js +2 -4
- package/lib/components/index.js +1 -1
- package/lib/data/func.code.js +2 -3
- package/lib/data/general.config.js +33 -3
- package/lib/data/index.js +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +30 -10
- package/lib/utils/ValueFormat.js +1 -2
- package/lib/utils/filterPermission.js +11 -18
- package/lib/utils/getParentNodes.js +103 -29
- package/lib/utils/index.js +5 -27
- package/lib/utils/urlUtils.js +82 -0
- package/package.json +14 -9
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fonts/iconfont.eot +0 -0
- package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/es/StandardDragModal/ChangeStandardModal.js +0 -493
- package/es/StandardDragModal/DraggableModal.d.ts +0 -7
- package/es/StandardDragModal/DraggableModal.js +0 -31
- package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/es/StandardDragModal/DraggableModalContext.js +0 -5
- package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/es/StandardDragModal/DraggableModalInner.js +0 -114
- package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/es/StandardDragModal/DraggableModalProvider.js +0 -40
- package/es/StandardDragModal/Modal.d.ts +0 -11
- package/es/StandardDragModal/Modal.js +0 -24
- package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/es/StandardDragModal/ResizeHandle.js +0 -8
- package/es/StandardDragModal/clamp.d.ts +0 -1
- package/es/StandardDragModal/clamp.js +0 -3
- package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/es/StandardDragModal/draggableModalReducer.js +0 -157
- package/es/StandardDragModal/getWindowSize.d.ts +0 -4
- package/es/StandardDragModal/getWindowSize.js +0 -6
- package/es/StandardDragModal/index.less +0 -65
- package/es/StandardDragModal/useDrag.d.ts +0 -5
- package/es/StandardDragModal/useDrag.js +0 -66
- package/es/StandardDragModal/usePrevious.d.ts +0 -1
- package/es/StandardDragModal/usePrevious.js +0 -8
- package/es/StandardDragModal/useResize.d.ts +0 -7
- package/es/StandardDragModal/useResize.js +0 -74
- package/es/utils/dictSelectUtil.js +0 -153
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
- package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
- package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
- package/lib/StandardDragModal/DraggableModal.js +0 -40
- package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
- package/lib/StandardDragModal/DraggableModalContext.js +0 -15
- package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
- package/lib/StandardDragModal/DraggableModalInner.js +0 -124
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
- package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
- package/lib/StandardDragModal/Modal.d.ts +0 -11
- package/lib/StandardDragModal/Modal.js +0 -32
- package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
- package/lib/StandardDragModal/ResizeHandle.js +0 -18
- package/lib/StandardDragModal/clamp.d.ts +0 -1
- package/lib/StandardDragModal/clamp.js +0 -10
- package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
- package/lib/StandardDragModal/draggableModalReducer.js +0 -167
- package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
- package/lib/StandardDragModal/getWindowSize.js +0 -13
- package/lib/StandardDragModal/index.less +0 -65
- package/lib/StandardDragModal/useDrag.d.ts +0 -5
- package/lib/StandardDragModal/useDrag.js +0 -73
- package/lib/StandardDragModal/usePrevious.d.ts +0 -1
- package/lib/StandardDragModal/usePrevious.js +0 -15
- package/lib/StandardDragModal/useResize.d.ts +0 -7
- package/lib/StandardDragModal/useResize.js +0 -81
- 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
|
|
7
|
-
function
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
function
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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 (
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
216
|
-
|
|
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;
|