fan-standard-comp 3.1.9 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +35 -0
- package/dist/fan-standard-comp.umd.js +15 -10
- package/es/ButtonGroup/ButtonList.js +0 -3
- package/es/ButtonGroup/ButtonMenu.js +0 -3
- package/es/ButtonGroup/PopConfirmTitle.js +5 -15
- package/es/ButtonGroup/index.d.ts +2 -0
- package/es/ButtonGroup/index.js +223 -193
- package/es/ButtonGroup/style/index.less +1 -1
- package/es/DragContent/DragBar.js +2 -6
- package/es/DragContent/index.js +44 -75
- package/es/FormComp/ChunkUploader/api.js +6 -10
- package/es/FormComp/ChunkUploader/index.js +105 -171
- package/es/FormComp/ChunkUploader/lib.js +4 -17
- package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
- package/es/FormComp/ChunkUploader/worker.js +0 -3
- package/es/FormComp/EditButton/index.js +24 -49
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
- package/es/FormComp/FieldComponent/TitleNode.js +1 -3
- package/es/FormComp/FieldComponent/index.js +38 -74
- package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
- package/es/FormComp/FieldComponent/style/index.less +6 -0
- package/es/FormComp/RenderItemGroup/index.js +46 -74
- package/es/FormComp/Uploader/index.js +36 -77
- package/es/FormComp/Uploader/util.js +0 -6
- package/es/FormComp/VarTemplate/index.js +58 -96
- package/es/NavLeafScroll/index.js +172 -154
- package/es/NavLeafScroll/style/index.less +33 -1
- package/es/RefactorTree/index.js +36 -53
- package/es/RefactorTree/indexTreeNode.js +35 -68
- package/es/RefactorTree/util.js +9 -43
- package/es/SpecIcon/fonts/iconfont.js +7 -12
- package/es/SpecIcon/index.js +16 -25
- package/es/SplitterLayout/Pane.js +2 -5
- package/es/SplitterLayout/index.js +20 -70
- package/es/StandardContent/SplitterLayout/Pane.js +6 -10
- package/es/StandardContent/SplitterLayout/index.js +12 -63
- package/es/StandardContent/SubfieldContent.js +12 -14
- package/es/StandardContent/WrapperContent.js +8 -10
- package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/es/StandardDragModal/ChangeStandardModal.js +493 -0
- package/es/StandardDragModal/DraggableModal.d.ts +7 -0
- package/es/StandardDragModal/DraggableModal.js +31 -0
- package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/es/StandardDragModal/DraggableModalContext.js +5 -0
- package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/es/StandardDragModal/DraggableModalInner.js +114 -0
- package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/es/StandardDragModal/DraggableModalProvider.js +40 -0
- package/es/StandardDragModal/Modal.d.ts +11 -0
- package/es/StandardDragModal/Modal.js +24 -0
- package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/es/StandardDragModal/ResizeHandle.js +8 -0
- package/es/StandardDragModal/clamp.d.ts +1 -0
- package/es/StandardDragModal/clamp.js +3 -0
- package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/es/StandardDragModal/draggableModalReducer.js +157 -0
- package/es/StandardDragModal/getWindowSize.d.ts +4 -0
- package/es/StandardDragModal/getWindowSize.js +6 -0
- package/es/StandardDragModal/index.d.ts +3 -11
- package/es/StandardDragModal/index.js +3 -30
- package/es/StandardDragModal/index.less +65 -0
- package/es/StandardDragModal/useDrag.d.ts +5 -0
- package/es/StandardDragModal/useDrag.js +66 -0
- package/es/StandardDragModal/usePrevious.d.ts +1 -0
- package/es/StandardDragModal/usePrevious.js +8 -0
- package/es/StandardDragModal/useResize.d.ts +7 -0
- package/es/StandardDragModal/useResize.js +74 -0
- package/es/StandardFilter/index.d.ts +1 -0
- package/es/StandardFilter/index.js +32 -70
- package/es/StandardForm/ActionList.js +5 -7
- package/es/StandardForm/StepForm.js +50 -71
- package/es/StandardForm/TabForm.js +58 -70
- package/es/StandardForm/index.js +37 -56
- package/es/StandardModal/UpdateFormRef.js +1 -4
- package/es/StandardModal/index.d.ts +0 -1
- package/es/StandardModal/index.js +115 -159
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +20 -30
- package/es/components/IconNode/index.js +0 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +15 -14
- package/es/utils/ValueFormat.js +0 -9
- package/es/utils/dictSelectUtil.js +153 -0
- package/es/utils/filterPermission.js +16 -34
- package/es/utils/getParentNodes.js +24 -47
- package/es/utils/index.js +2 -1
- package/lib/ButtonGroup/ButtonList.js +1 -13
- package/lib/ButtonGroup/ButtonMenu.js +1 -8
- package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/ButtonGroup/index.js +226 -216
- package/lib/ButtonGroup/style/index.less +1 -1
- package/lib/DragContent/DragBar.js +2 -10
- package/lib/DragContent/index.js +47 -85
- package/lib/FormComp/ChunkUploader/api.js +6 -15
- package/lib/FormComp/ChunkUploader/index.js +107 -185
- package/lib/FormComp/ChunkUploader/lib.js +8 -27
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
- package/lib/FormComp/ChunkUploader/worker.js +1 -5
- package/lib/FormComp/EditButton/index.js +26 -60
- package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
- package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
- package/lib/FormComp/FieldComponent/index.js +38 -110
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
- package/lib/FormComp/FieldComponent/style/index.less +6 -0
- package/lib/FormComp/RenderItemGroup/index.js +46 -87
- package/lib/FormComp/Uploader/index.js +38 -95
- package/lib/FormComp/Uploader/util.js +1 -9
- package/lib/FormComp/VarTemplate/index.js +62 -106
- package/lib/FormComp/index.js +0 -2
- package/lib/NavLeafScroll/index.js +174 -165
- package/lib/NavLeafScroll/style/index.less +33 -1
- package/lib/RefactorTree/index.js +36 -67
- package/lib/RefactorTree/indexTreeNode.js +37 -83
- package/lib/RefactorTree/util.js +11 -45
- package/lib/SpecIcon/fonts/iconfont.js +7 -12
- package/lib/SpecIcon/index.js +16 -30
- package/lib/SplitterLayout/Pane.js +0 -7
- package/lib/SplitterLayout/index.js +18 -72
- package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
- package/lib/StandardContent/SplitterLayout/index.js +12 -68
- package/lib/StandardContent/SubfieldContent.js +12 -21
- package/lib/StandardContent/WrapperContent.js +8 -16
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
- package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
- package/lib/StandardDragModal/DraggableModal.js +40 -0
- package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/lib/StandardDragModal/DraggableModalContext.js +15 -0
- package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/lib/StandardDragModal/DraggableModalInner.js +124 -0
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
- package/lib/StandardDragModal/Modal.d.ts +11 -0
- package/lib/StandardDragModal/Modal.js +32 -0
- package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/lib/StandardDragModal/ResizeHandle.js +18 -0
- package/lib/StandardDragModal/clamp.d.ts +1 -0
- package/lib/StandardDragModal/clamp.js +10 -0
- package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/lib/StandardDragModal/draggableModalReducer.js +167 -0
- package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
- package/lib/StandardDragModal/getWindowSize.js +13 -0
- package/lib/StandardDragModal/index.d.ts +3 -11
- package/lib/StandardDragModal/index.js +33 -38
- package/lib/StandardDragModal/index.less +65 -0
- package/lib/StandardDragModal/useDrag.d.ts +5 -0
- package/lib/StandardDragModal/useDrag.js +73 -0
- package/lib/StandardDragModal/usePrevious.d.ts +1 -0
- package/lib/StandardDragModal/usePrevious.js +15 -0
- package/lib/StandardDragModal/useResize.d.ts +7 -0
- package/lib/StandardDragModal/useResize.js +81 -0
- package/lib/StandardFilter/index.d.ts +1 -0
- package/lib/StandardFilter/index.js +30 -78
- package/lib/StandardForm/ActionList.js +5 -12
- package/lib/StandardForm/StepForm.js +52 -90
- package/lib/StandardForm/TabForm.js +61 -88
- package/lib/StandardForm/index.js +40 -75
- package/lib/StandardModal/UpdateFormRef.js +4 -12
- package/lib/StandardModal/index.d.ts +0 -1
- package/lib/StandardModal/index.js +117 -184
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +20 -39
- package/lib/components/IconNode/index.js +0 -7
- package/lib/components/index.js +0 -2
- package/lib/data/index.js +4 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +50 -68
- package/lib/utils/ValueFormat.js +0 -10
- package/lib/utils/dictSelectUtil.js +161 -0
- package/lib/utils/filterPermission.js +15 -39
- package/lib/utils/getParentNodes.js +25 -52
- package/lib/utils/index.js +24 -9
- package/package.json +6 -5
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
8
|
+
export var useResize = function useResize(x, y, width, height, onResize) {
|
|
9
|
+
var _useState = useState(false),
|
|
10
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11
|
+
dragging = _useState2[0],
|
|
12
|
+
setDragging = _useState2[1];
|
|
13
|
+
var _useState3 = useState({
|
|
14
|
+
initX: 0,
|
|
15
|
+
initY: 0,
|
|
16
|
+
initWidth: 0,
|
|
17
|
+
initHeight: 0,
|
|
18
|
+
mouseDownX: 0,
|
|
19
|
+
mouseDownY: 0
|
|
20
|
+
}),
|
|
21
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
22
|
+
initialDragState = _useState4[0],
|
|
23
|
+
setInitialDragState = _useState4[1];
|
|
24
|
+
var onMouseDown = useCallback(function (e) {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
setInitialDragState({
|
|
27
|
+
initX: x,
|
|
28
|
+
initY: y,
|
|
29
|
+
initWidth: width,
|
|
30
|
+
initHeight: height,
|
|
31
|
+
mouseDownX: e.clientX,
|
|
32
|
+
mouseDownY: e.clientY
|
|
33
|
+
});
|
|
34
|
+
setDragging(true);
|
|
35
|
+
}, [width, height, setDragging, setInitialDragState, x, y]);
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
var onMouseMove = function onMouseMove(e) {
|
|
38
|
+
if (dragging) {
|
|
39
|
+
var initX = initialDragState.initX,
|
|
40
|
+
initY = initialDragState.initY,
|
|
41
|
+
initWidth = initialDragState.initWidth,
|
|
42
|
+
mouseDownX = initialDragState.mouseDownX,
|
|
43
|
+
initHeight = initialDragState.initHeight,
|
|
44
|
+
mouseDownY = initialDragState.mouseDownY;
|
|
45
|
+
var dx = e.clientX - mouseDownX;
|
|
46
|
+
var dy = e.clientY - mouseDownY;
|
|
47
|
+
var _width = initWidth + dx;
|
|
48
|
+
var _height = initHeight + dy;
|
|
49
|
+
return onResize({
|
|
50
|
+
x: initX,
|
|
51
|
+
y: initY,
|
|
52
|
+
width: _width,
|
|
53
|
+
height: _height
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
window.addEventListener('mousemove', onMouseMove, {
|
|
58
|
+
passive: true
|
|
59
|
+
});
|
|
60
|
+
return function () {
|
|
61
|
+
return window.removeEventListener('mousemove', onMouseMove);
|
|
62
|
+
};
|
|
63
|
+
}, [initialDragState, dragging, onResize]);
|
|
64
|
+
useEffect(function () {
|
|
65
|
+
var onMouseUp = function onMouseUp() {
|
|
66
|
+
setDragging(false);
|
|
67
|
+
};
|
|
68
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
69
|
+
return function () {
|
|
70
|
+
return window.removeEventListener('mouseup', onMouseUp);
|
|
71
|
+
};
|
|
72
|
+
}, [setDragging]);
|
|
73
|
+
return onMouseDown;
|
|
74
|
+
};
|
|
@@ -4,6 +4,7 @@ import { ButtonGroupOptionsProps } from '../ButtonGroup/index';
|
|
|
4
4
|
import './style/index.less';
|
|
5
5
|
export interface StandardFilterProps {
|
|
6
6
|
buttonGroup?: ButtonGroupOptionsProps[];
|
|
7
|
+
buttonGroupConfig?: Object;
|
|
7
8
|
formItemGroup?: FieldComponentProps[];
|
|
8
9
|
confirmText?: string;
|
|
9
10
|
onFilterSearch?: (value?: object) => void;
|
|
@@ -1,55 +1,39 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
|
|
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); }
|
|
3
2
|
import "antd/es/button/style";
|
|
4
3
|
import _Button from "antd/es/button";
|
|
5
4
|
import "antd/es/form/style";
|
|
6
5
|
import _Form from "antd/es/form";
|
|
7
|
-
|
|
8
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
-
|
|
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); }
|
|
18
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); }; }
|
|
19
|
-
|
|
20
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
21
|
-
|
|
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); }
|
|
22
15
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
27
|
-
|
|
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); }
|
|
28
18
|
import React from 'react';
|
|
29
19
|
import UtilValueFormat from '../utils/ValueFormat.js';
|
|
30
|
-
import ButtonGroup from '../ButtonGroup/index';
|
|
31
|
-
|
|
20
|
+
import ButtonGroup from '../ButtonGroup/index';
|
|
21
|
+
// import { general } from '../data/index';
|
|
32
22
|
import './style/index.less';
|
|
33
23
|
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
34
24
|
var FormItem = _Form.Item;
|
|
35
|
-
|
|
36
25
|
var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
37
26
|
_inherits(StandardFilter, _React$Component);
|
|
38
|
-
|
|
39
27
|
var _super = _createSuper(StandardFilter);
|
|
40
|
-
|
|
41
28
|
function StandardFilter(props) {
|
|
42
29
|
var _this;
|
|
43
|
-
|
|
44
30
|
_classCallCheck(this, StandardFilter);
|
|
45
|
-
|
|
46
31
|
_this = _super.call(this, props);
|
|
47
|
-
_this.filterFormRef = /*#__PURE__*/React.createRef();
|
|
48
|
-
|
|
32
|
+
_this.filterFormRef = /*#__PURE__*/React.createRef();
|
|
33
|
+
// 更新表单控件值,用于外部获取当前表单实例(force是否强制清空表单)
|
|
49
34
|
_this.updateFormFields = function (newVal, force) {
|
|
50
35
|
var getFormFields = _this.props.getFormFields;
|
|
51
36
|
var resetValues = {};
|
|
52
|
-
|
|
53
37
|
if (force) {
|
|
54
38
|
// this.filterFormRef.current.resetFields()
|
|
55
39
|
// 先清空 再赋值
|
|
@@ -58,33 +42,24 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
58
42
|
resetValues[item] = undefined;
|
|
59
43
|
});
|
|
60
44
|
}
|
|
61
|
-
|
|
62
45
|
_this.filterFormRef.current.setFieldsValue(Object.assign(Object.assign({}, resetValues), newVal)); // 直接清空表单的赋值
|
|
63
|
-
|
|
64
|
-
|
|
65
46
|
if (getFormFields) getFormFields(_this.filterFormRef.current.getFieldsValue(), _this.filterFormRef);
|
|
66
47
|
}; // 强制更新表单值,用于赋初始化实例值
|
|
67
|
-
|
|
68
|
-
|
|
69
48
|
_this.forceUpdateForm = function () {
|
|
70
49
|
var getFormFields = _this.props.getFormFields;
|
|
71
50
|
if (getFormFields) getFormFields(_this.filterFormRef.current.getFieldsValue(), _this.filterFormRef);
|
|
72
51
|
};
|
|
73
|
-
|
|
74
52
|
_this.handleSearch = function (values) {
|
|
75
53
|
var _this$props = _this.props,
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
formItemGroup = _this$props.formItemGroup,
|
|
55
|
+
onFilterSearch = _this$props.onFilterSearch; // if (Object.prototype.hasOwnProperty.call(values, false)) {
|
|
78
56
|
// delete values.false // TODO 自定义结构会莫名的出来一个false字段
|
|
79
57
|
// }
|
|
80
|
-
|
|
81
58
|
var resultValues = UtilValueFormat(values, formItemGroup);
|
|
82
|
-
|
|
83
59
|
if (onFilterSearch) {
|
|
84
60
|
onFilterSearch(Object.assign({}, resultValues));
|
|
85
61
|
}
|
|
86
62
|
};
|
|
87
|
-
|
|
88
63
|
_this.handleReset = function () {
|
|
89
64
|
var onFilterReset = _this.props.onFilterReset; // 使用此方法,表单校验无法清空掉
|
|
90
65
|
// const resetValues = this.filterFormRef.current.getFieldsValue()
|
|
@@ -92,34 +67,26 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
92
67
|
// resetValues[item] = undefined
|
|
93
68
|
// })
|
|
94
69
|
// this.filterFormRef.current.setFieldsValue({ ...resetValues }) // 直接清空表单的赋值
|
|
95
|
-
|
|
96
70
|
_this.filterFormRef.current.resetFields();
|
|
97
|
-
|
|
98
71
|
_this.setState({
|
|
99
72
|
reFormItemGroup: _this.props.formItemGroup // 重新渲染列表
|
|
100
|
-
|
|
101
73
|
});
|
|
102
74
|
|
|
103
75
|
if (onFilterReset) {
|
|
104
76
|
onFilterReset(_this.filterFormRef.current.getFieldsValue());
|
|
105
77
|
}
|
|
106
78
|
};
|
|
107
|
-
|
|
108
79
|
_this.itemIsHide = function (isHide) {
|
|
109
80
|
var current = _this.filterFormRef.current;
|
|
110
81
|
if (!isHide) return false;
|
|
111
|
-
|
|
112
82
|
if (typeof isHide === 'function') {
|
|
113
83
|
return isHide(current ? current.getFieldsValue() : {}, current);
|
|
114
84
|
}
|
|
115
|
-
|
|
116
85
|
return isHide;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
|
|
86
|
+
};
|
|
87
|
+
// 表单列表组 formItemGroup 类型为数组或者React.Node
|
|
120
88
|
_this.renderFormItemGroup = function () {
|
|
121
89
|
var reFormItemGroup = _this.state.reFormItemGroup;
|
|
122
|
-
|
|
123
90
|
if (Array.isArray(reFormItemGroup)) {
|
|
124
91
|
return /*#__PURE__*/React.createElement(RenderItemGroup, {
|
|
125
92
|
itemGroup: reFormItemGroup,
|
|
@@ -164,14 +131,12 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
164
131
|
|
|
165
132
|
return reFormItemGroup;
|
|
166
133
|
};
|
|
167
|
-
|
|
168
134
|
_this.state = {
|
|
169
135
|
// recombinationGroup: [],
|
|
170
136
|
reFormItemGroup: undefined
|
|
171
137
|
};
|
|
172
138
|
return _this;
|
|
173
139
|
}
|
|
174
|
-
|
|
175
140
|
_createClass(StandardFilter, [{
|
|
176
141
|
key: "componentDidMount",
|
|
177
142
|
value: function componentDidMount() {
|
|
@@ -182,7 +147,6 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
182
147
|
key: "componentDidUpdate",
|
|
183
148
|
value: function componentDidUpdate(prevProps) {
|
|
184
149
|
var initialValues = this.props.initialValues;
|
|
185
|
-
|
|
186
150
|
if (prevProps.initialValues !== initialValues) {
|
|
187
151
|
this.updateFormFields(initialValues, true);
|
|
188
152
|
}
|
|
@@ -191,18 +155,18 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
191
155
|
key: "render",
|
|
192
156
|
value: function render() {
|
|
193
157
|
var _this$props2 = this.props,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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;
|
|
206
170
|
return /*#__PURE__*/React.createElement(_Form, {
|
|
207
171
|
name: "standard-filter-form",
|
|
208
172
|
ref: this.filterFormRef,
|
|
@@ -234,22 +198,20 @@ var StandardFilter = /*#__PURE__*/function (_React$Component) {
|
|
|
234
198
|
options: buttonGroup,
|
|
235
199
|
min: min,
|
|
236
200
|
codes: codes,
|
|
237
|
-
permissionCodes: permissionCodes
|
|
201
|
+
permissionCodes: permissionCodes,
|
|
202
|
+
dropdownConfig: buttonGroupConfig
|
|
238
203
|
})) : null));
|
|
239
204
|
}
|
|
240
205
|
}], [{
|
|
241
206
|
key: "getDerivedStateFromProps",
|
|
242
207
|
value: function getDerivedStateFromProps(nextProps) {
|
|
243
208
|
var formItemGroup = nextProps.formItemGroup; // const restOptionList = removeNoPermission(buttonGroup, permissionCodes, codes) || []
|
|
244
|
-
|
|
245
209
|
return {
|
|
246
210
|
// recombinationGroup: restOptionList,
|
|
247
211
|
reFormItemGroup: formItemGroup
|
|
248
212
|
};
|
|
249
213
|
}
|
|
250
214
|
}]);
|
|
251
|
-
|
|
252
215
|
return StandardFilter;
|
|
253
216
|
}(React.Component);
|
|
254
|
-
|
|
255
217
|
export default StandardFilter;
|
|
@@ -2,14 +2,13 @@ import "antd/es/button/style";
|
|
|
2
2
|
import _Button from "antd/es/button";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import IconNode from "../components/IconNode";
|
|
5
|
-
|
|
6
5
|
var ActionList = function ActionList(props) {
|
|
7
6
|
var list = props.list,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
form = props.form,
|
|
8
|
+
_props$align = props.align,
|
|
9
|
+
align = _props$align === void 0 ? 'default' : _props$align,
|
|
10
|
+
other = props.other,
|
|
11
|
+
onStep = props.onStep;
|
|
13
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
13
|
className: "standardForm-actions",
|
|
15
14
|
style: {
|
|
@@ -40,5 +39,4 @@ var ActionList = function ActionList(props) {
|
|
|
40
39
|
}, item.name);
|
|
41
40
|
}));
|
|
42
41
|
};
|
|
43
|
-
|
|
44
42
|
export default ActionList;
|
|
@@ -1,66 +1,53 @@
|
|
|
1
1
|
import "antd/es/col/style";
|
|
2
2
|
import _Col from "antd/es/col";
|
|
3
|
-
import "antd/es/button/style";
|
|
4
|
-
import _Button from "antd/es/button";
|
|
5
3
|
import "antd/es/steps/style";
|
|
6
4
|
import _Steps from "antd/es/steps";
|
|
7
|
-
|
|
5
|
+
import "antd/es/button/style";
|
|
6
|
+
import _Button from "antd/es/button";
|
|
8
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
|
|
10
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
|
|
12
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
|
|
14
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
-
|
|
16
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
-
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
13
|
+
import { __rest } from "tslib";
|
|
20
14
|
import React, { useEffect, useState, useMemo } from 'react';
|
|
21
15
|
import StandardForm from './index';
|
|
22
16
|
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
23
17
|
import ActionList from "./ActionList";
|
|
24
|
-
import './style/index.less';
|
|
25
|
-
|
|
26
|
-
var Step = _Steps.Step;
|
|
18
|
+
import './style/index.less';
|
|
27
19
|
var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
28
20
|
var getFormFields = props.getFormFields,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
_props$formItemGroup = props.formItemGroup,
|
|
22
|
+
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
23
|
+
grid = props.grid,
|
|
24
|
+
layout = props.layout,
|
|
25
|
+
onSubmit = props.onSubmit,
|
|
26
|
+
_props$actionAlign = props.actionAlign,
|
|
27
|
+
actionAlign = _props$actionAlign === void 0 ? 'center' : _props$actionAlign,
|
|
28
|
+
fieldStatus = props.fieldStatus,
|
|
29
|
+
_props$fieldSize = props.fieldSize,
|
|
30
|
+
fieldSize = _props$fieldSize === void 0 ? "middle" : _props$fieldSize,
|
|
31
|
+
initialValues = props.initialValues,
|
|
32
|
+
actionHide = props.actionHide,
|
|
33
|
+
_props$stepsConfig = props.stepsConfig,
|
|
34
|
+
stepsConfig = _props$stepsConfig === void 0 ? {
|
|
35
|
+
current: 0
|
|
36
|
+
} : _props$stepsConfig,
|
|
37
|
+
stepClick = props.stepClick,
|
|
38
|
+
displayLayout = props.displayLayout;
|
|
48
39
|
var _useState = useState(),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
formChildFields = _useState2[0],
|
|
42
|
+
setFormChildFields = _useState2[1];
|
|
53
43
|
var _useState3 = useState(),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
formChild = _useState4[0],
|
|
46
|
+
setFormChild = _useState4[1];
|
|
58
47
|
var _useState5 = useState(0),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
currentStep = _useState6[0],
|
|
50
|
+
setCurrentStep = _useState6[1]; // const [fieldFailed, setFieldFailed] = useState(false)
|
|
64
51
|
useEffect(function () {
|
|
65
52
|
if (stepsConfig && (stepsConfig.current || stepsConfig.current === 0)) {
|
|
66
53
|
setCurrentStep(stepsConfig.current); // 判断是否有设置当前选中的步骤数
|
|
@@ -69,7 +56,6 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
56
|
if (formItemGroup.length === 0) return null;
|
|
70
57
|
var formGridSize = useMemo(function () {
|
|
71
58
|
if (typeof grid === 'string') return grid; // 数据格式为字符串,包括 xs,md,lg,xlg
|
|
72
|
-
|
|
73
59
|
var sizeName = 'xs';
|
|
74
60
|
if (grid <= 1) sizeName = 'xs';
|
|
75
61
|
if (grid === 2) sizeName = 'md';
|
|
@@ -80,11 +66,9 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
66
|
useEffect(function () {
|
|
81
67
|
forceUpdateForm();
|
|
82
68
|
}, [formChildFields, formChild]);
|
|
83
|
-
|
|
84
69
|
var forceUpdateForm = function forceUpdateForm() {
|
|
85
70
|
getFormFields && getFormFields(formChildFields, formChild);
|
|
86
71
|
};
|
|
87
|
-
|
|
88
72
|
var handleStepType = function handleStepType(type, extraFunc) {
|
|
89
73
|
switch (type) {
|
|
90
74
|
case 'submit':
|
|
@@ -99,26 +83,33 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
99
83
|
formChild && formChild.validateFields(valitorGroup).then(function (values) {
|
|
100
84
|
if (stepClick) stepClick(type, formChild, values);
|
|
101
85
|
extraFunc && extraFunc();
|
|
102
|
-
}).catch(function (_ref) {
|
|
103
|
-
|
|
86
|
+
}).catch(function (_ref) {
|
|
104
87
|
var errorFields = _ref.errorFields;
|
|
105
|
-
})
|
|
106
|
-
|
|
88
|
+
} // console.log('表单校验不通过 ', errorFields.map(err => err))
|
|
89
|
+
);
|
|
107
90
|
|
|
91
|
+
break;
|
|
108
92
|
case 'prev':
|
|
109
93
|
if (stepClick) stepClick(type, formChild);
|
|
110
94
|
extraFunc && extraFunc();
|
|
111
95
|
break;
|
|
112
|
-
|
|
113
96
|
case 'cancel':
|
|
114
97
|
if (stepClick) stepClick(type, formChild);
|
|
115
98
|
extraFunc && extraFunc();
|
|
116
99
|
break;
|
|
117
|
-
|
|
118
100
|
default:
|
|
119
101
|
break;
|
|
120
102
|
}
|
|
121
103
|
};
|
|
104
|
+
var stepItems = useMemo(function () {
|
|
105
|
+
return (formItemGroup || []).filter(function (fItem) {
|
|
106
|
+
return !fItem.hideStep;
|
|
107
|
+
}).map(function (item, index) {
|
|
108
|
+
var hideStep = item.hideStep,
|
|
109
|
+
StepItem = __rest(item, ["hideStep"]);
|
|
110
|
+
return Object.assign({}, StepItem);
|
|
111
|
+
});
|
|
112
|
+
}, [formItemGroup]);
|
|
122
113
|
/* const handleStepChange = (cur:any) => {
|
|
123
114
|
// 自行判断是否校验通过
|
|
124
115
|
/!* if (cur > current) {
|
|
@@ -133,8 +124,6 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
133
124
|
}*!/
|
|
134
125
|
if (stepsConfig && stepsConfig.onChange) stepsConfig.onChange(cur, formChild);
|
|
135
126
|
}*/
|
|
136
|
-
|
|
137
|
-
|
|
138
127
|
var renderStepActions = function renderStepActions(item, index) {
|
|
139
128
|
if (formItemGroup.length === 1) {
|
|
140
129
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -152,7 +141,6 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
152
141
|
}
|
|
153
142
|
}, "\u53D6\u6D88"));
|
|
154
143
|
}
|
|
155
|
-
|
|
156
144
|
var buttonList = function buttonList(itemIndex) {
|
|
157
145
|
if (itemIndex === 0) {
|
|
158
146
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
@@ -200,7 +188,6 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
200
188
|
}, "\u53D6\u6D88"));
|
|
201
189
|
}
|
|
202
190
|
};
|
|
203
|
-
|
|
204
191
|
return /*#__PURE__*/React.createElement("div", {
|
|
205
192
|
className: "standardForm-actions",
|
|
206
193
|
key: index,
|
|
@@ -209,7 +196,6 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
209
196
|
}
|
|
210
197
|
}, buttonList(index));
|
|
211
198
|
};
|
|
212
|
-
|
|
213
199
|
return /*#__PURE__*/React.createElement(StandardForm, {
|
|
214
200
|
className: layout === 'inline' ? '' : '',
|
|
215
201
|
actionGroup: [],
|
|
@@ -223,19 +209,12 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
223
209
|
},
|
|
224
210
|
onSubmit: onSubmit,
|
|
225
211
|
layout: layout,
|
|
226
|
-
onFinishFailed: function onFinishFailed() {
|
|
212
|
+
onFinishFailed: function onFinishFailed() {
|
|
213
|
+
// setFieldFailed(true)
|
|
227
214
|
}
|
|
228
|
-
}, /*#__PURE__*/React.createElement(_Steps, Object.assign({}, stepsConfig
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
description: item.description,
|
|
232
|
-
icon: item.icon,
|
|
233
|
-
status: item.status,
|
|
234
|
-
title: item.title,
|
|
235
|
-
subTitle: item.subTitle,
|
|
236
|
-
disabled: item.disabled
|
|
237
|
-
}) : null;
|
|
238
|
-
})), formItemGroup.map(function (item, index) {
|
|
215
|
+
}, /*#__PURE__*/React.createElement(_Steps, Object.assign({}, stepsConfig, {
|
|
216
|
+
items: stepItems
|
|
217
|
+
})), (formItemGroup || []).map(function (item, index) {
|
|
239
218
|
return /*#__PURE__*/React.createElement("div", {
|
|
240
219
|
key: index,
|
|
241
220
|
className: "stepForm-content ".concat(layout === 'inline' ? 'stepForm-content-inline' : ''),
|