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
|
@@ -4,129 +4,85 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
require("antd/es/modal/style");
|
|
9
|
-
|
|
10
8
|
var _modal = _interopRequireDefault(require("antd/es/modal"));
|
|
11
|
-
|
|
12
9
|
require("antd/es/button/style");
|
|
13
|
-
|
|
14
10
|
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
15
|
-
|
|
16
11
|
require("antd/es/col/style");
|
|
17
|
-
|
|
18
12
|
var _col = _interopRequireDefault(require("antd/es/col"));
|
|
19
|
-
|
|
20
13
|
require("antd/es/row/style");
|
|
21
|
-
|
|
22
14
|
var _row = _interopRequireDefault(require("antd/es/row"));
|
|
23
|
-
|
|
24
15
|
require("antd/es/form/style");
|
|
25
|
-
|
|
26
16
|
var _form = _interopRequireDefault(require("antd/es/form"));
|
|
27
|
-
|
|
28
17
|
var _tslib = require("tslib");
|
|
29
|
-
|
|
30
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
31
|
-
|
|
32
19
|
var _data = require("../data");
|
|
33
|
-
|
|
34
20
|
var _RenderItemGroup = _interopRequireDefault(require("../FormComp/RenderItemGroup"));
|
|
35
|
-
|
|
36
21
|
var _ValueFormat = _interopRequireDefault(require("../utils/ValueFormat.js"));
|
|
37
|
-
|
|
38
22
|
var _IconNode = _interopRequireDefault(require("../components/IconNode"));
|
|
39
|
-
|
|
40
23
|
var _TabForm = _interopRequireDefault(require("../StandardForm/TabForm"));
|
|
41
|
-
|
|
42
24
|
var _StepForm = _interopRequireDefault(require("../StandardForm/StepForm"));
|
|
43
|
-
|
|
44
25
|
var _ActionList = _interopRequireDefault(require("../StandardForm/ActionList.js"));
|
|
45
|
-
|
|
46
26
|
require("./style/index.less");
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
require("ant-design-draggable-modal/dist/index.css");
|
|
51
|
-
|
|
52
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
53
|
-
|
|
54
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
27
|
+
var _Modal2 = _interopRequireDefault(require("../StandardDragModal/Modal"));
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
56
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
|
-
|
|
58
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
59
|
-
|
|
31
|
+
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); }
|
|
60
32
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
61
|
-
|
|
62
33
|
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."); }
|
|
63
|
-
|
|
64
34
|
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); }
|
|
65
|
-
|
|
66
35
|
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; }
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
71
|
-
|
|
36
|
+
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; } }
|
|
37
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { DraggableModal, DraggableModalProvider } from '../StandardDragModal/index'
|
|
72
38
|
var StandardModal = function StandardModal(props) {
|
|
73
39
|
var children = props.children,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
40
|
+
className = props.className,
|
|
41
|
+
style = props.style,
|
|
42
|
+
_props$size = props.size,
|
|
43
|
+
size = _props$size === void 0 ? 'md' : _props$size,
|
|
44
|
+
type = props.type,
|
|
45
|
+
formItemGroup = props.formItemGroup,
|
|
46
|
+
title = props.title,
|
|
47
|
+
visible = props.visible,
|
|
48
|
+
formPrefix = props.formPrefix,
|
|
49
|
+
formPostfix = props.formPostfix,
|
|
50
|
+
initialValues = props.initialValues,
|
|
51
|
+
hideRequiredMark = props.hideRequiredMark,
|
|
52
|
+
bodyStyle = props.bodyStyle,
|
|
53
|
+
footer = props.footer,
|
|
54
|
+
footerButtonGroup = props.footerButtonGroup,
|
|
55
|
+
hideFooter = props.hideFooter,
|
|
56
|
+
_getFormFields = props.getFormFields,
|
|
57
|
+
_props$fieldStatus = props.fieldStatus,
|
|
58
|
+
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
59
|
+
_props$formLayout = props.formLayout,
|
|
60
|
+
formLayout = _props$formLayout === void 0 ? 'horizontal' : _props$formLayout,
|
|
61
|
+
tabsConfig = props.tabsConfig,
|
|
62
|
+
stepsConfig = props.stepsConfig,
|
|
63
|
+
displayLayout = props.displayLayout,
|
|
64
|
+
_props$dragAble = props.dragAble,
|
|
65
|
+
dragAble = _props$dragAble === void 0 ? false : _props$dragAble,
|
|
66
|
+
otherProps = (0, _tslib.__rest)(props, ["children", "className", "style", "size", "type", "formItemGroup", "title", "visible", "formPrefix", "formPostfix", "initialValues", "hideRequiredMark", "bodyStyle", "footer", "footerButtonGroup", "hideFooter", "getFormFields", "fieldStatus", "formLayout", "tabsConfig", "stepsConfig", "displayLayout", "dragAble"]);
|
|
102
67
|
var _Form$useForm = _form.default.useForm(),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
68
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
69
|
+
modalForm = _Form$useForm2[0];
|
|
106
70
|
var _useState = (0, _react.useState)(),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
71
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
72
|
+
modalFormRef = _useState2[0],
|
|
73
|
+
setModalFormRef = _useState2[1]; // <---- set the ref when Form Rendered
|
|
112
74
|
var _useState3 = (0, _react.useState)(0),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
75
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
76
|
+
bodyMaxHeight = _useState4[0],
|
|
77
|
+
setBodyMaxHeight = _useState4[1]; // setTabFormChild
|
|
118
78
|
var _useState5 = (0, _react.useState)(),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
79
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
80
|
+
formChild = _useState6[0],
|
|
81
|
+
setFormChild = _useState6[1]; // <---- set the ref when Form Rendered
|
|
122
82
|
// 按钮栏是否有显示(默认显示)
|
|
123
|
-
|
|
124
|
-
|
|
125
83
|
var hasFooterBar = (0, _react.useMemo)(function () {
|
|
126
84
|
var _a, _b, _c, _d, _e;
|
|
127
|
-
|
|
128
85
|
var openLog = false;
|
|
129
|
-
|
|
130
86
|
if (type === 'tabForm' || type === 'stepForm') {
|
|
131
87
|
if (type === 'tabForm') {
|
|
132
88
|
var activeTabInfo = formItemGroup.find(function (fItem) {
|
|
@@ -135,71 +91,62 @@ var StandardModal = function StandardModal(props) {
|
|
|
135
91
|
openLog && console.log('rule 0-1', ((_a = activeTabInfo === null || activeTabInfo === void 0 ? void 0 : activeTabInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
136
92
|
return ((_b = activeTabInfo === null || activeTabInfo === void 0 ? void 0 : activeTabInfo.actions) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
137
93
|
}
|
|
138
|
-
|
|
139
94
|
if (type === 'stepForm') {
|
|
140
95
|
var currentStepInfo = formItemGroup[stepsConfig.current];
|
|
141
96
|
openLog && console.log('rule 0-2', ((_c = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _c === void 0 ? void 0 : _c.length) > 0);
|
|
142
97
|
return ((_d = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _d === void 0 ? void 0 : _d.length) > 0;
|
|
143
98
|
}
|
|
144
|
-
|
|
145
99
|
return true;
|
|
146
100
|
} else {
|
|
147
101
|
if (hideFooter) {
|
|
148
102
|
openLog && console.log('rule 1');
|
|
149
103
|
return false;
|
|
150
104
|
}
|
|
151
|
-
|
|
152
105
|
if (fieldStatus && fieldStatus !== 'default') {
|
|
153
106
|
if (props.hasOwnProperty('footerButtonGroup')) {
|
|
154
107
|
// 如果有配置按钮组件,则还是要显示按钮
|
|
155
108
|
return true;
|
|
156
109
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
110
|
+
openLog && console.log('rule 2');
|
|
111
|
+
// disabled/viewOnly都不显示按钮
|
|
160
112
|
return false;
|
|
161
113
|
}
|
|
162
|
-
|
|
163
114
|
if (props.hasOwnProperty('footerButtonGroup') && footerButtonGroup) {
|
|
164
115
|
if (Array.isArray(footerButtonGroup) && footerButtonGroup.length === 0) {
|
|
165
|
-
openLog && console.log('rule 4');
|
|
166
|
-
|
|
116
|
+
openLog && console.log('rule 4');
|
|
117
|
+
// 返回为空数组不占用按钮栏
|
|
167
118
|
return false;
|
|
168
119
|
} else if (typeof footerButtonGroup === 'function' && (!footerButtonGroup() || ((_e = footerButtonGroup()) === null || _e === void 0 ? void 0 : _e.length) === 0)) {
|
|
169
|
-
openLog && console.log('rule 5');
|
|
170
|
-
|
|
120
|
+
openLog && console.log('rule 5');
|
|
121
|
+
// 配置类型为Function且返回值为null或者返回数组长度为0时,不显示按钮栏
|
|
171
122
|
return false;
|
|
172
123
|
}
|
|
173
|
-
|
|
174
124
|
openLog && console.log('rule 3');
|
|
175
125
|
return true;
|
|
176
126
|
} else if (footerButtonGroup === false) {
|
|
177
|
-
openLog && console.log('rule 7');
|
|
178
|
-
|
|
127
|
+
openLog && console.log('rule 7');
|
|
128
|
+
// 显示
|
|
179
129
|
return true;
|
|
180
130
|
}
|
|
181
|
-
|
|
182
131
|
if (props.hasOwnProperty('footer') && !footer) {
|
|
183
132
|
openLog && console.log('rule 8');
|
|
184
133
|
return false;
|
|
185
134
|
}
|
|
186
|
-
|
|
187
135
|
openLog && console.log('rule 9');
|
|
188
136
|
return true;
|
|
189
137
|
}
|
|
190
|
-
}, [fieldStatus, hideFooter, footer, footerButtonGroup, type, tabsConfig, stepsConfig, formItemGroup]);
|
|
191
|
-
|
|
138
|
+
}, [fieldStatus, hideFooter, footer, footerButtonGroup, type, tabsConfig, stepsConfig, formItemGroup]);
|
|
139
|
+
// 设置限制弹窗高度
|
|
192
140
|
var initBodyMaxHeight = function initBodyMaxHeight() {
|
|
193
141
|
var title = props.title;
|
|
194
142
|
var bodyHeight = document.body.offsetHeight;
|
|
195
143
|
var baseReduce = 80 + 32; // 默认需要减去的高度(上下空白间距150及内部内容间距16*2
|
|
196
144
|
// console.log('弹窗是否有按钮:', hasFooterBar ? '是' : '否')
|
|
197
|
-
|
|
198
|
-
|
|
145
|
+
setBodyMaxHeight("".concat(bodyHeight - (title ? 55 : 0) - (hasFooterBar ? 55 : 0) - baseReduce, "px"));
|
|
146
|
+
// setBodyMaxHeight(`${bodyHeight - (title ? 55 : 0) - ((footer || footerButtonGroup) ? 55 : 0) - baseReduce +
|
|
199
147
|
// ((fieldStatus && fieldStatus !== 'default' && !footerButtonGroup) || hideFooter ? 55 : 0)}px`)
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
|
|
148
|
+
};
|
|
149
|
+
// fill Form when modal open 此处可解决获取 Form.useForm warning
|
|
203
150
|
(0, _react.useEffect)(function () {
|
|
204
151
|
if (visible && modalFormRef) {
|
|
205
152
|
// <---- check ref before use the form instance
|
|
@@ -207,47 +154,43 @@ var StandardModal = function StandardModal(props) {
|
|
|
207
154
|
initialValues && modalForm.setFieldsValue(Object.assign({}, initialValues));
|
|
208
155
|
forceUpdateForm();
|
|
209
156
|
}
|
|
210
|
-
}
|
|
157
|
+
}
|
|
158
|
+
// if (!visible && modalFormRef) {
|
|
211
159
|
// clearAllFieldsValue() // 清空表单传参数
|
|
212
160
|
// }
|
|
213
|
-
|
|
214
161
|
}, [modalFormRef, visible]);
|
|
215
162
|
(0, _react.useEffect)(function () {
|
|
216
163
|
if (visible) {
|
|
217
|
-
initBodyMaxHeight();
|
|
218
|
-
|
|
164
|
+
initBodyMaxHeight();
|
|
165
|
+
// 让resize事件触发 initBodyMaxHeight
|
|
219
166
|
window.addEventListener('resize', initBodyMaxHeight);
|
|
220
167
|
} else {
|
|
221
168
|
window.removeEventListener('resize', initBodyMaxHeight);
|
|
222
169
|
}
|
|
223
170
|
}, [fieldStatus, title, visible, hideFooter, footer, footerButtonGroup]);
|
|
224
|
-
|
|
225
171
|
var handleSubmit = function handleSubmit() {
|
|
226
172
|
var type = props.type,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (type === 'form') {
|
|
173
|
+
formItemGroup = props.formItemGroup,
|
|
174
|
+
onSubmit = props.onSubmit;
|
|
175
|
+
if (type === 'form' || type === 'gridForm') {
|
|
231
176
|
modalForm.validateFields().then(function (values) {
|
|
232
177
|
if (Object.prototype.hasOwnProperty.call(values, 'false')) {
|
|
233
178
|
delete values.false; // 自定义结构会莫名的出来一个false字段
|
|
234
179
|
}
|
|
235
180
|
|
|
236
181
|
var resultValues = (0, _ValueFormat.default)(values, formItemGroup);
|
|
237
|
-
|
|
238
182
|
if (onSubmit) {
|
|
239
183
|
onSubmit(Object.assign({}, resultValues));
|
|
240
184
|
}
|
|
241
185
|
}).catch(function () {
|
|
242
186
|
// 定位到第一条表单异常的
|
|
243
187
|
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
244
|
-
|
|
245
188
|
if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
|
|
246
189
|
Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
|
|
247
|
-
}
|
|
248
|
-
|
|
190
|
+
}
|
|
191
|
+
// console.error('表单填写有误', errorInfo, '第一条数据',errorInfo.errorFields[0].name[0])
|
|
249
192
|
});
|
|
250
|
-
} else if (type === 'stepForm' || type === 'tabForm'
|
|
193
|
+
} else if (type === 'stepForm' || type === 'tabForm') {
|
|
251
194
|
// onSubmit && onSubmit()
|
|
252
195
|
formChild.validateFields().then(function (values) {
|
|
253
196
|
// console.log(values)
|
|
@@ -256,26 +199,23 @@ var StandardModal = function StandardModal(props) {
|
|
|
256
199
|
}
|
|
257
200
|
|
|
258
201
|
var resultValues = (0, _ValueFormat.default)(values, formItemGroup);
|
|
259
|
-
|
|
260
202
|
if (onSubmit) {
|
|
261
203
|
onSubmit(Object.assign({}, resultValues));
|
|
262
204
|
}
|
|
263
205
|
}).catch(function () {
|
|
264
206
|
// 定位到第一条表单异常的
|
|
265
207
|
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
266
|
-
|
|
267
208
|
if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
|
|
268
209
|
Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
|
|
269
|
-
}
|
|
270
|
-
|
|
210
|
+
}
|
|
211
|
+
// console.error('表单填写有误', errorInfo, '第一条数据',errorInfo.errorFields[0].name[0])
|
|
271
212
|
});
|
|
272
213
|
} else {
|
|
273
214
|
// 没有表单数组 formItemGroup 配置
|
|
274
215
|
onSubmit && onSubmit();
|
|
275
216
|
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
|
|
217
|
+
};
|
|
218
|
+
// 重置所有表单
|
|
279
219
|
var clearAllFieldsValue = function clearAllFieldsValue() {
|
|
280
220
|
// let allFields = {}
|
|
281
221
|
// Object.keys(modalForm.getFieldsValue()).map((item) => allFields[item] = undefined)
|
|
@@ -288,24 +228,20 @@ var StandardModal = function StandardModal(props) {
|
|
|
288
228
|
if (type === 'form') clearAllFieldsValue();
|
|
289
229
|
if (afterClose) afterClose();
|
|
290
230
|
};
|
|
291
|
-
|
|
292
231
|
var handleCancel = function handleCancel() {
|
|
293
232
|
var onCancel = props.onCancel;
|
|
294
233
|
if (onCancel) onCancel();
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
|
|
234
|
+
};
|
|
235
|
+
// 强制更新表单值,用于赋初始化实例值
|
|
298
236
|
var forceUpdateForm = function forceUpdateForm() {
|
|
299
237
|
_getFormFields && _getFormFields(modalForm.getFieldsValue() || {}, modalForm);
|
|
300
238
|
};
|
|
301
|
-
|
|
302
239
|
var renderFormItemGroup = function renderFormItemGroup() {
|
|
303
240
|
var fieldStatus = props.fieldStatus,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
241
|
+
formItemGroup = props.formItemGroup,
|
|
242
|
+
_props$size2 = props.size,
|
|
243
|
+
size = _props$size2 === void 0 ? 'md' : _props$size2,
|
|
244
|
+
type = props.type;
|
|
309
245
|
if (Array.isArray(formItemGroup)) {
|
|
310
246
|
if (type === 'gridForm') {
|
|
311
247
|
// 栅格组
|
|
@@ -313,7 +249,6 @@ var StandardModal = function StandardModal(props) {
|
|
|
313
249
|
gutter: 20
|
|
314
250
|
}, formItemGroup.map(function (item, index) {
|
|
315
251
|
var childrenFields = item.fields || [];
|
|
316
|
-
|
|
317
252
|
if (item.label) {
|
|
318
253
|
childrenFields = [{
|
|
319
254
|
type: item.type,
|
|
@@ -321,7 +256,6 @@ var StandardModal = function StandardModal(props) {
|
|
|
321
256
|
protoConfig: Object.assign({}, item.protoConfig)
|
|
322
257
|
}].concat(childrenFields);
|
|
323
258
|
}
|
|
324
|
-
|
|
325
259
|
return /*#__PURE__*/_react.default.createElement(_col.default, {
|
|
326
260
|
key: index,
|
|
327
261
|
span: item.gridSpan || 24
|
|
@@ -338,7 +272,6 @@ var StandardModal = function StandardModal(props) {
|
|
|
338
272
|
}));
|
|
339
273
|
}));
|
|
340
274
|
}
|
|
341
|
-
|
|
342
275
|
return /*#__PURE__*/_react.default.createElement(_RenderItemGroup.default, {
|
|
343
276
|
size: size,
|
|
344
277
|
layout: formLayout,
|
|
@@ -351,13 +284,10 @@ var StandardModal = function StandardModal(props) {
|
|
|
351
284
|
form: modalForm
|
|
352
285
|
});
|
|
353
286
|
}
|
|
354
|
-
|
|
355
287
|
return formItemGroup;
|
|
356
288
|
};
|
|
357
|
-
|
|
358
289
|
var handleStepType = function handleStepType(type, extraFunc) {
|
|
359
290
|
var current = stepsConfig.current;
|
|
360
|
-
|
|
361
291
|
switch (type) {
|
|
362
292
|
case 'submit':
|
|
363
293
|
case 'next':
|
|
@@ -370,51 +300,46 @@ var StandardModal = function StandardModal(props) {
|
|
|
370
300
|
formChild.validateFields(validatorGroup).then(function () {
|
|
371
301
|
// if (stepClick) stepClick(type, formChild, values);
|
|
372
302
|
extraFunc();
|
|
373
|
-
}).catch(function () {
|
|
303
|
+
}).catch(function () {
|
|
304
|
+
// console.log('表单校验不通过 ', errorFields.map(err => err))
|
|
374
305
|
});
|
|
375
306
|
break;
|
|
376
|
-
|
|
377
307
|
case 'prev':
|
|
378
308
|
// if (stepClick) stepClick(type, formChild);
|
|
379
309
|
extraFunc();
|
|
380
310
|
break;
|
|
381
|
-
|
|
382
311
|
case 'cancel':
|
|
383
312
|
// if (stepClick) stepClick(type, formChild);
|
|
384
313
|
extraFunc();
|
|
385
314
|
break;
|
|
386
|
-
|
|
387
315
|
default:
|
|
388
316
|
// extraFunc()
|
|
389
317
|
break;
|
|
390
318
|
}
|
|
391
319
|
};
|
|
392
|
-
|
|
393
320
|
var renderButtonGroup = function renderButtonGroup() {
|
|
394
321
|
var footerButtonGroup = props.footerButtonGroup,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
322
|
+
confirmLoading = props.confirmLoading,
|
|
323
|
+
cancelText = props.cancelText,
|
|
324
|
+
confirmText = props.confirmText,
|
|
325
|
+
okText = props.okText,
|
|
326
|
+
okButtonProps = props.okButtonProps,
|
|
327
|
+
confirmButtonProps = props.confirmButtonProps,
|
|
328
|
+
cancelButtonProps = props.cancelButtonProps;
|
|
403
329
|
if (footerButtonGroup) {
|
|
404
330
|
if (Array.isArray(footerButtonGroup)) {
|
|
405
331
|
if (footerButtonGroup.length === 0) return null; // <div>按钮组合配置为空</div>
|
|
406
|
-
|
|
407
332
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, footerButtonGroup.map(function (item) {
|
|
408
333
|
if (_typeof(item) === 'object') {
|
|
409
334
|
if (item.isHide) return null;
|
|
410
335
|
var name = item.name,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
336
|
+
_type = item.type,
|
|
337
|
+
icon = item.icon,
|
|
338
|
+
ghost = item.ghost,
|
|
339
|
+
disabled = item.disabled,
|
|
340
|
+
loading = item.loading,
|
|
341
|
+
fn = item.fn,
|
|
342
|
+
others = (0, _tslib.__rest)(item, ["name", "type", "icon", "ghost", "disabled", "loading", "fn"]);
|
|
418
343
|
return /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
419
344
|
key: name,
|
|
420
345
|
type: _type || 'primary',
|
|
@@ -437,10 +362,8 @@ var StandardModal = function StandardModal(props) {
|
|
|
437
362
|
if (typeof footerButtonGroup === 'function') {
|
|
438
363
|
return footerButtonGroup(modalForm, props);
|
|
439
364
|
}
|
|
440
|
-
|
|
441
365
|
return footerButtonGroup;
|
|
442
366
|
}
|
|
443
|
-
|
|
444
367
|
if (footer) return footer;
|
|
445
368
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
446
369
|
key: "submit",
|
|
@@ -452,10 +375,8 @@ var StandardModal = function StandardModal(props) {
|
|
|
452
375
|
onClick: handleCancel
|
|
453
376
|
}, cancelButtonProps), cancelText || '取消'));
|
|
454
377
|
};
|
|
455
|
-
|
|
456
378
|
var renderFooter = function renderFooter() {
|
|
457
379
|
var _a, _b;
|
|
458
|
-
|
|
459
380
|
if (type === 'stepForm') {
|
|
460
381
|
var currentStepInfo = formItemGroup[stepsConfig.current];
|
|
461
382
|
return ((_a = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? /*#__PURE__*/_react.default.createElement(_ActionList.default, {
|
|
@@ -465,7 +386,6 @@ var StandardModal = function StandardModal(props) {
|
|
|
465
386
|
other: props
|
|
466
387
|
}) : null;
|
|
467
388
|
}
|
|
468
|
-
|
|
469
389
|
if (type === 'tabForm') {
|
|
470
390
|
var activeTabInfo = formItemGroup.find(function (fItem) {
|
|
471
391
|
return fItem.key === (tabsConfig === null || tabsConfig === void 0 ? void 0 : tabsConfig.activeKey);
|
|
@@ -476,11 +396,9 @@ var StandardModal = function StandardModal(props) {
|
|
|
476
396
|
other: props
|
|
477
397
|
}) : null;
|
|
478
398
|
}
|
|
479
|
-
|
|
480
399
|
return hasFooterBar ? renderButtonGroup() : null;
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
|
|
400
|
+
};
|
|
401
|
+
// 内容渲染
|
|
484
402
|
var renderChildrenNodes = function renderChildrenNodes() {
|
|
485
403
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children, (type === 'form' || type === 'gridForm') && /*#__PURE__*/_react.default.createElement(_form.default, {
|
|
486
404
|
layout: formLayout,
|
|
@@ -522,11 +440,10 @@ var StandardModal = function StandardModal(props) {
|
|
|
522
440
|
initialValues: Object.assign({}, initialValues),
|
|
523
441
|
displayLayout: displayLayout
|
|
524
442
|
}));
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
|
|
443
|
+
};
|
|
444
|
+
// 可拖动及缩放
|
|
528
445
|
if (dragAble) {
|
|
529
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
446
|
+
return /*#__PURE__*/_react.default.createElement(_Modal2.default, Object.assign({
|
|
530
447
|
destroyOnClose: true,
|
|
531
448
|
initialWidth: otherProps.width || _data.general.modalSize[size].width,
|
|
532
449
|
initialHeight: otherProps.height,
|
|
@@ -539,7 +456,24 @@ var StandardModal = function StandardModal(props) {
|
|
|
539
456
|
onOk: handleSubmit,
|
|
540
457
|
title: title,
|
|
541
458
|
footer: renderFooter()
|
|
542
|
-
}), renderChildrenNodes())
|
|
459
|
+
}), renderChildrenNodes());
|
|
460
|
+
/* return <DraggableModalProvider>
|
|
461
|
+
<DraggableModal destroyOnClose
|
|
462
|
+
initialWidth={otherProps.width || general.modalSize[size].width}
|
|
463
|
+
initialHeight={otherProps.height}
|
|
464
|
+
zIndex={1001}
|
|
465
|
+
{...otherProps}
|
|
466
|
+
visible={visible}
|
|
467
|
+
className={`standardModal ${className || ''} ${fieldStatus === 'viewOnly' ? 'is-view' : ''}`}
|
|
468
|
+
onCancel={handleCancel}
|
|
469
|
+
afterClose={onAfterClose}
|
|
470
|
+
onOk={handleSubmit}
|
|
471
|
+
title={title}
|
|
472
|
+
footer={renderFooter()}
|
|
473
|
+
>
|
|
474
|
+
{renderChildrenNodes()}
|
|
475
|
+
</DraggableModal>
|
|
476
|
+
</DraggableModalProvider>*/
|
|
543
477
|
}
|
|
544
478
|
|
|
545
479
|
return /*#__PURE__*/_react.default.createElement(_modal.default, Object.assign({
|
|
@@ -563,6 +497,5 @@ var StandardModal = function StandardModal(props) {
|
|
|
563
497
|
onOk: handleSubmit
|
|
564
498
|
}), renderChildrenNodes());
|
|
565
499
|
};
|
|
566
|
-
|
|
567
500
|
var _default = StandardModal;
|
|
568
501
|
exports.default = _default;
|