fan-standard-comp 3.1.10 → 3.2.1
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 -15
- 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.js +214 -215
- 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 +36 -74
- 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/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.js +30 -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 +113 -157
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +18 -29
- 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.js +217 -238
- 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 +38 -89
- 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/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.js +28 -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 +115 -182
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +18 -38
- 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 +5 -4
package/es/ButtonGroup/index.js
CHANGED
|
@@ -4,29 +4,16 @@ import "antd/es/button/style";
|
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
5
|
import "antd/es/dropdown/style";
|
|
6
6
|
import _Dropdown from "antd/es/dropdown";
|
|
7
|
-
import "antd/es/menu/style";
|
|
8
|
-
import _Menu from "antd/es/menu";
|
|
9
|
-
|
|
10
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
-
|
|
12
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
-
|
|
14
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
15
|
-
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
10
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
-
|
|
18
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
-
|
|
20
12
|
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."); }
|
|
21
|
-
|
|
22
13
|
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); }
|
|
23
|
-
|
|
24
14
|
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; }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
15
|
+
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; } }
|
|
28
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
29
|
-
|
|
30
17
|
import { __rest } from "tslib";
|
|
31
18
|
import React, { useState, useEffect } from "react";
|
|
32
19
|
import { IconNode } from "../components/index";
|
|
@@ -34,45 +21,40 @@ import SpecIcon from "../SpecIcon/index";
|
|
|
34
21
|
import PopConfirmTitle from './PopConfirmTitle';
|
|
35
22
|
import { funcCode } from "../data/index";
|
|
36
23
|
import { DownOutlined, QuestionCircleOutlined } from "@ant-design/icons";
|
|
37
|
-
import { removeNoPermission, btnIsDisabled } from '../utils/filterPermission
|
|
24
|
+
import { removeNoPermission, btnIsDisabled } from '../utils/filterPermission';
|
|
38
25
|
import './style/index.less';
|
|
39
|
-
|
|
40
26
|
var ButtonGroup = function ButtonGroup(props) {
|
|
41
27
|
var _props$type = props.type,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
28
|
+
type = _props$type === void 0 ? 'button' : _props$type,
|
|
29
|
+
_props$rowParams = props.rowParams,
|
|
30
|
+
rowParams = _props$rowParams === void 0 ? {
|
|
31
|
+
text: undefined,
|
|
32
|
+
record: undefined,
|
|
33
|
+
rowIndex: undefined
|
|
34
|
+
} : _props$rowParams,
|
|
35
|
+
_props$codes = props.codes,
|
|
36
|
+
codes = _props$codes === void 0 ? funcCode.btnFuncCodes : _props$codes,
|
|
37
|
+
permissionCodes = props.permissionCodes,
|
|
38
|
+
_props$dropdownConfig = props.dropdownConfig,
|
|
39
|
+
dropdownConfig = _props$dropdownConfig === void 0 ? {} : _props$dropdownConfig;
|
|
54
40
|
var _props$options = props.options,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
42
|
+
_props$min = props.min,
|
|
43
|
+
min = _props$min === void 0 ? 3 : _props$min; // 最小展示长度不能小于2
|
|
44
|
+
var moreText = '更多';
|
|
59
45
|
if (!options) return null; // 没有配置list返回null
|
|
60
|
-
|
|
61
46
|
var _useState = useState(-1),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
popVisibleIndex = _useState2[0],
|
|
49
|
+
setPopVisibleIndex = _useState2[1];
|
|
66
50
|
var _useState3 = useState({}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
popRow = _useState4[0],
|
|
53
|
+
setPopRow = _useState4[1];
|
|
71
54
|
var _useState5 = useState([]),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
|
+
resetList = _useState6[0],
|
|
57
|
+
setResetList = _useState6[1];
|
|
76
58
|
useEffect(function () {
|
|
77
59
|
// 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
|
|
78
60
|
setResetList(_toConsumableArray(removeNoPermission(options, permissionCodes, codes, rowParams)) || []);
|
|
@@ -82,65 +64,141 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
82
64
|
}, [options, codes, permissionCodes]);
|
|
83
65
|
useEffect(function () {
|
|
84
66
|
setPopVisibleIndex(-1);
|
|
85
|
-
}, [rowParams]);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
67
|
+
}, [rowParams]);
|
|
68
|
+
/* // 渲染按钮多层级形式 (用于筛选)
|
|
69
|
+
const buttonMenu = (group: any) => {
|
|
70
|
+
return (<Menu>
|
|
71
|
+
{
|
|
72
|
+
group.map((item: any, index: number) => {
|
|
73
|
+
if (item.children) {
|
|
74
|
+
return <Menu.SubMenu title={item.exName || item.name} key={index}>
|
|
75
|
+
{
|
|
76
|
+
item.children.map((child: any, childIndex: number) => {
|
|
77
|
+
return (<Menu.Item key={childIndex}>
|
|
78
|
+
<a onClick={child.fn ? () => child.fn(child) : null}
|
|
79
|
+
>
|
|
80
|
+
<IconNode icon={child.icon}/> {child.exName || child.name}
|
|
81
|
+
</a>
|
|
82
|
+
</Menu.Item>)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
</Menu.SubMenu>
|
|
86
|
+
}
|
|
87
|
+
return (
|
|
88
|
+
<Menu.Item key={index}>
|
|
89
|
+
<a onClick={item.fn ? () => item.fn(item) : null}>
|
|
90
|
+
<IconNode icon={item.icon}/> {item.exName || item.name}
|
|
91
|
+
</a>
|
|
92
|
+
</Menu.Item>
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
</Menu>)
|
|
97
|
+
};
|
|
98
|
+
// 渲染文本形式多级菜单列表(用于表格)
|
|
99
|
+
const textMenu = (group: any[]) => {
|
|
100
|
+
return (
|
|
101
|
+
<Menu className="spec-button-text-dropdown">
|
|
102
|
+
{
|
|
103
|
+
group.map((gItem: any, gIndex: number) => {
|
|
104
|
+
|
|
105
|
+
if (gItem.children) {
|
|
106
|
+
return <Menu.SubMenu title={gItem.exName || gItem.name} key={gItem}>
|
|
107
|
+
{
|
|
108
|
+
gItem.children.map((child: any, childIndex: number) => <Menu.Item key={childIndex}>
|
|
109
|
+
<a onClick={child.fn ? () => child.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}>
|
|
110
|
+
{child.render ? child.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (child.exName || child.name)}
|
|
111
|
+
</a>
|
|
112
|
+
</Menu.Item>)
|
|
113
|
+
}
|
|
114
|
+
</Menu.SubMenu>
|
|
115
|
+
}
|
|
116
|
+
return <Menu.Item key={gIndex}
|
|
117
|
+
disabled={btnIsDisabled(gItem.disabled, rowParams)}>
|
|
118
|
+
{
|
|
119
|
+
gItem.hasOwnProperty('confirmText') || gItem.hasOwnProperty('confirmConfig') ?
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
<a disabled={btnIsDisabled(gItem.disabled, rowParams)}
|
|
122
|
+
onClick={gItem.fn ? () => {
|
|
123
|
+
setPopVisibleIndex(rowParams.rowIndex)
|
|
124
|
+
setPopRow(gItem)
|
|
125
|
+
} : null}>
|
|
126
|
+
{gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
|
|
127
|
+
</a>
|
|
128
|
+
: <a className="spec-button-group-text"
|
|
129
|
+
onClick={gItem.fn ? () => gItem.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
disabled={btnIsDisabled(gItem.disabled, rowParams)}>
|
|
132
|
+
{gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
|
|
133
|
+
</a>
|
|
134
|
+
}
|
|
135
|
+
</Menu.Item>
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
</Menu>
|
|
139
|
+
)
|
|
140
|
+
};*/
|
|
141
|
+
// 递归转换原来的数组结构
|
|
142
|
+
var deepTransButtonMenus = function deepTransButtonMenus(groupArray) {
|
|
143
|
+
if (!Array.isArray(groupArray)) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
return groupArray.map(function (vItem, i) {
|
|
147
|
+
var code = vItem.code,
|
|
148
|
+
fn = vItem.fn,
|
|
149
|
+
exName = vItem.exName,
|
|
150
|
+
name = vItem.name,
|
|
151
|
+
children = vItem.children,
|
|
152
|
+
icon = vItem.icon,
|
|
153
|
+
others = __rest(vItem, ["code", "fn", "exName", "name", "children", "icon"]);
|
|
154
|
+
return Object.assign(Object.assign({}, others), {
|
|
155
|
+
key: code ? code + i : i,
|
|
156
|
+
icon: /*#__PURE__*/React.createElement(IconNode, {
|
|
157
|
+
icon: icon
|
|
158
|
+
}),
|
|
159
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
160
|
+
onClick: function onClick() {
|
|
161
|
+
return fn && fn(vItem);
|
|
162
|
+
}
|
|
163
|
+
}, exName || name),
|
|
164
|
+
children: children && children.length > 0 ? deepTransButtonMenus(children) : undefined
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
// {gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
|
|
169
|
+
// 自定义渲染显示的文本
|
|
170
|
+
var renderCustomLabel = function renderCustomLabel(gItem) {
|
|
171
|
+
return gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
172
|
+
return rowParams[pItem];
|
|
173
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, gItem.icon ? ' ' : '', gItem.exName || gItem.name);
|
|
174
|
+
};
|
|
175
|
+
// 渲染按钮形式 (用于筛选)
|
|
119
176
|
var RenderButtonList = function RenderButtonList(item) {
|
|
120
177
|
var exName = item.exName,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
178
|
+
name = item.name,
|
|
179
|
+
type = item.type,
|
|
180
|
+
icon = item.icon,
|
|
181
|
+
ghost = item.ghost,
|
|
182
|
+
danger = item.danger,
|
|
183
|
+
disabled = item.disabled,
|
|
184
|
+
loading = item.loading,
|
|
185
|
+
fn = item.fn,
|
|
186
|
+
code = item.code,
|
|
187
|
+
rowParams = item.rowParams,
|
|
188
|
+
others = __rest(item, ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams"]);
|
|
133
189
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
190
|
+
// overlay={buttonMenu(item.children)}
|
|
134
191
|
return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
135
|
-
|
|
192
|
+
menu: {
|
|
193
|
+
items: deepTransButtonMenus(item.children)
|
|
194
|
+
},
|
|
136
195
|
placement: "bottomRight"
|
|
137
196
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement(_Button, {
|
|
138
197
|
type: "primary"
|
|
139
|
-
},
|
|
198
|
+
}, item.exName || item.name || item.label, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
140
199
|
name: "down"
|
|
141
200
|
})));
|
|
142
201
|
}
|
|
143
|
-
|
|
144
202
|
return /*#__PURE__*/React.createElement(_Button, Object.assign({
|
|
145
203
|
type: type || 'primary',
|
|
146
204
|
danger: danger,
|
|
@@ -153,99 +211,53 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
153
211
|
icon: icon
|
|
154
212
|
}),
|
|
155
213
|
disabled: btnIsDisabled(disabled, rowParams)
|
|
156
|
-
}), exName || name);
|
|
214
|
+
}), exName || name || others.label);
|
|
157
215
|
};
|
|
158
|
-
|
|
159
|
-
|
|
216
|
+
// 递归转换原来的数组结构
|
|
217
|
+
var deepTransTextMenus = function deepTransTextMenus(groupArray) {
|
|
218
|
+
if (!Array.isArray(groupArray)) {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
return groupArray.map(function (vItem, i) {
|
|
222
|
+
var code = vItem.code,
|
|
223
|
+
fn = vItem.fn,
|
|
224
|
+
exName = vItem.exName,
|
|
225
|
+
name = vItem.name,
|
|
226
|
+
children = vItem.children,
|
|
227
|
+
icon = vItem.icon,
|
|
228
|
+
confirmText = vItem.confirmText,
|
|
229
|
+
confirmConfig = vItem.confirmConfig,
|
|
230
|
+
others = __rest(vItem, ["code", "fn", "exName", "name", "children", "icon", "confirmText", "confirmConfig"]);
|
|
160
231
|
return {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
onClick={gItem.fn ? () => gItem.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
disabled={btnIsDisabled(gItem.disabled, rowParams)}>
|
|
175
|
-
{gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
|
|
176
|
-
</a>,
|
|
177
|
-
key: gIndex + (gItem.exName || gItem.name),
|
|
178
|
-
children: gItem.children ? (gItem.children || []).map((child: any, childIndex: number) => {
|
|
179
|
-
return {
|
|
180
|
-
label: <a onClick={child.fn ? () => child.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}>
|
|
181
|
-
{child.render ? child.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (child.exName || child.name)}
|
|
182
|
-
</a>,
|
|
183
|
-
key: childIndex
|
|
184
|
-
}
|
|
185
|
-
}) : undefined
|
|
186
|
-
}
|
|
187
|
-
})
|
|
188
|
-
}*/
|
|
189
|
-
// 渲染文本形式多级菜单列表(用于表格)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var textMenu = function textMenu(group) {
|
|
193
|
-
return /*#__PURE__*/React.createElement(_Menu, {
|
|
194
|
-
className: "spec-button-text-dropdown"
|
|
195
|
-
}, group.map(function (gItem, gIndex) {
|
|
196
|
-
if (gItem.children) {
|
|
197
|
-
return /*#__PURE__*/React.createElement(_Menu.SubMenu, {
|
|
198
|
-
title: gItem.exName || gItem.name,
|
|
199
|
-
key: gItem
|
|
200
|
-
}, gItem.children.map(function (child, childIndex) {
|
|
201
|
-
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
|
202
|
-
key: childIndex
|
|
203
|
-
}, /*#__PURE__*/React.createElement("a", {
|
|
204
|
-
onClick: child.fn ? function () {
|
|
205
|
-
return child.fn.apply(child, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
232
|
+
danger: others.danger,
|
|
233
|
+
disabled: btnIsDisabled(others.disabled, rowParams),
|
|
234
|
+
key: code ? code + i : i,
|
|
235
|
+
// icon: <IconNode icon={icon}/>, // 不显示图标
|
|
236
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
237
|
+
onClick: function onClick() {
|
|
238
|
+
// 配置二次确认
|
|
239
|
+
if (vItem.hasOwnProperty('confirmText') || vItem.hasOwnProperty('confirmConfig')) {
|
|
240
|
+
fn ? (setPopVisibleIndex(rowParams.rowIndex), setPopRow(vItem)) : null;
|
|
241
|
+
} else {
|
|
242
|
+
fn && fn.apply(void 0, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
206
243
|
return rowParams[pItem];
|
|
207
244
|
})));
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
disabled: btnIsDisabled(gItem.disabled, rowParams)
|
|
218
|
-
}, gItem.hasOwnProperty('confirmText') || gItem.hasOwnProperty('confirmConfig') ?
|
|
219
|
-
/*#__PURE__*/
|
|
220
|
-
// @ts-ignore
|
|
221
|
-
React.createElement("a", {
|
|
222
|
-
disabled: btnIsDisabled(gItem.disabled, rowParams),
|
|
223
|
-
onClick: gItem.fn ? function () {
|
|
224
|
-
setPopVisibleIndex(rowParams.rowIndex);
|
|
225
|
-
setPopRow(gItem);
|
|
226
|
-
} : null
|
|
227
|
-
}, gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
228
|
-
return rowParams[pItem];
|
|
229
|
-
}))) : gItem.exName || gItem.name) : /*#__PURE__*/React.createElement("a", {
|
|
230
|
-
className: "spec-button-group-text",
|
|
231
|
-
onClick: gItem.fn ? function () {
|
|
232
|
-
return gItem.fn.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
233
|
-
return rowParams[pItem];
|
|
234
|
-
})));
|
|
235
|
-
} : null,
|
|
236
|
-
// @ts-ignore
|
|
237
|
-
disabled: btnIsDisabled(gItem.disabled, rowParams)
|
|
238
|
-
}, gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
239
|
-
return rowParams[pItem];
|
|
240
|
-
}))) : gItem.exName || gItem.name));
|
|
241
|
-
}));
|
|
242
|
-
}; // 渲染文本形式 列表(用于表格)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, renderCustomLabel(vItem)),
|
|
248
|
+
title: vItem.exName || vItem.name,
|
|
249
|
+
children: children && children.length > 0 ? deepTransTextMenus(children) : undefined
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
// 渲染文本形式 列表(用于表格)
|
|
245
254
|
var RenderTextList = function RenderTextList(item) {
|
|
246
255
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
256
|
+
// overlay={textMenu(item.children)}
|
|
247
257
|
return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
248
|
-
|
|
258
|
+
menu: {
|
|
259
|
+
items: deepTransTextMenus(item.children)
|
|
260
|
+
},
|
|
249
261
|
placement: "bottomRight"
|
|
250
262
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement("a", {
|
|
251
263
|
className: "spec-button-group-text"
|
|
@@ -255,7 +267,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
255
267
|
name: "down"
|
|
256
268
|
})));
|
|
257
269
|
}
|
|
258
|
-
|
|
259
270
|
return /*#__PURE__*/React.createElement(React.Fragment, null, item.hasOwnProperty('confirmText') || item.hasOwnProperty('confirmConfig') ? /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
|
|
260
271
|
placement: "topRight",
|
|
261
272
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)
|
|
@@ -266,7 +277,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
266
277
|
onCancel: function onCancel() {
|
|
267
278
|
if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onCancel) {
|
|
268
279
|
var _item$confirmConfig;
|
|
269
|
-
|
|
270
280
|
(_item$confirmConfig = item.confirmConfig).onCancel.apply(_item$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
271
281
|
return rowParams[pItem];
|
|
272
282
|
})));
|
|
@@ -275,7 +285,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
275
285
|
onConfirm: function onConfirm() {
|
|
276
286
|
if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onConfirm) {
|
|
277
287
|
var _item$confirmConfig2;
|
|
278
|
-
|
|
279
288
|
(_item$confirmConfig2 = item.confirmConfig).onConfirm.apply(_item$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
280
289
|
return rowParams[pItem];
|
|
281
290
|
})));
|
|
@@ -291,9 +300,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
291
300
|
title: item.exName || item.name,
|
|
292
301
|
// @ts-ignore
|
|
293
302
|
disabled: btnIsDisabled(item.disabled, rowParams)
|
|
294
|
-
}, item
|
|
295
|
-
return rowParams[pItem];
|
|
296
|
-
}))) : item.exName || item.name)) : /*#__PURE__*/React.createElement("a", {
|
|
303
|
+
}, renderCustomLabel(item))) : /*#__PURE__*/React.createElement("a", {
|
|
297
304
|
className: "spec-button-group-text",
|
|
298
305
|
title: item.exName || item.name,
|
|
299
306
|
key: item.index,
|
|
@@ -304,12 +311,9 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
304
311
|
return rowParams[pItem];
|
|
305
312
|
})));
|
|
306
313
|
} : null
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}; // 渲染展示的按钮列表
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
}, renderCustomLabel(item)));
|
|
315
|
+
};
|
|
316
|
+
// 渲染展示的按钮列表
|
|
313
317
|
var renderDisplayButton = function renderDisplayButton(item, index) {
|
|
314
318
|
/*渲染自定义*/
|
|
315
319
|
if (item.render) {
|
|
@@ -318,8 +322,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
318
322
|
}))) : item.render);
|
|
319
323
|
}
|
|
320
324
|
/*渲染按钮形式*/
|
|
321
|
-
|
|
322
|
-
|
|
323
325
|
if (type === 'button') {
|
|
324
326
|
return /*#__PURE__*/React.createElement(RenderButtonList, Object.assign({
|
|
325
327
|
key: index
|
|
@@ -328,36 +330,34 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
328
330
|
}));
|
|
329
331
|
}
|
|
330
332
|
/*渲染文本形式*/
|
|
331
|
-
|
|
332
|
-
|
|
333
333
|
return /*#__PURE__*/React.createElement(RenderTextList, Object.assign({
|
|
334
334
|
key: index
|
|
335
335
|
}, item));
|
|
336
336
|
};
|
|
337
|
-
|
|
338
337
|
if (min < 2) min = 2;
|
|
339
|
-
|
|
340
338
|
if (resetList.length === 0) {
|
|
341
339
|
return /*#__PURE__*/React.createElement(React.Fragment, null, type !== 'button' ? '-' : null);
|
|
342
340
|
}
|
|
343
|
-
|
|
341
|
+
// 数量超出时渲染
|
|
344
342
|
if (resetList.length > min) {
|
|
345
|
-
var forGroup = resetList.slice(0, min - 1);
|
|
346
|
-
var forDrop = resetList.slice(min - 1);
|
|
343
|
+
var forGroup = resetList.slice(0, min - 1); // 平铺组合内
|
|
344
|
+
var forDrop = resetList.slice(min - 1); // 下拉组合内
|
|
347
345
|
return /*#__PURE__*/React.createElement("span", {
|
|
348
346
|
className: "spec-button-group"
|
|
349
347
|
}, forGroup.map(function (item, index) {
|
|
350
348
|
return index < min - 1 ? renderDisplayButton(item, index) : null;
|
|
351
349
|
}), type === 'button' ? /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
352
|
-
|
|
350
|
+
menu: {
|
|
351
|
+
items: deepTransButtonMenus(forDrop)
|
|
352
|
+
},
|
|
353
353
|
placement: "bottomRight"
|
|
354
354
|
}, dropdownConfig), /*#__PURE__*/React.createElement(_Button, {
|
|
355
355
|
type: "primary"
|
|
356
|
-
}, "
|
|
356
|
+
}, moreText, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
357
357
|
name: "down"
|
|
358
358
|
}))) : /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
|
|
359
359
|
placement: "topRight",
|
|
360
|
-
|
|
360
|
+
open: popVisibleIndex === rowParams.rowIndex,
|
|
361
361
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
|
|
362
362
|
trigger: "click"
|
|
363
363
|
}, popRow.hasOwnProperty('confirmConfig') ? popRow.confirmConfig : {}, {
|
|
@@ -365,22 +365,20 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
365
365
|
extraRow: rowParams
|
|
366
366
|
})),
|
|
367
367
|
onCancel: function onCancel() {
|
|
368
|
-
setPopVisibleIndex(-1);
|
|
369
|
-
|
|
368
|
+
setPopVisibleIndex(-1);
|
|
369
|
+
// 优先调用其 confirmConfig 配置的 onCancel 事件
|
|
370
370
|
if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onCancel) {
|
|
371
371
|
var _popRow$confirmConfig;
|
|
372
|
-
|
|
373
372
|
(_popRow$confirmConfig = popRow.confirmConfig).onCancel.apply(_popRow$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
374
373
|
return rowParams[pItem];
|
|
375
374
|
})));
|
|
376
375
|
}
|
|
377
376
|
},
|
|
378
377
|
onConfirm: function onConfirm() {
|
|
379
|
-
setPopVisibleIndex(-1);
|
|
380
|
-
|
|
378
|
+
setPopVisibleIndex(-1);
|
|
379
|
+
// 优先调用其 confirmConfig 配置的 onConfirm 事件
|
|
381
380
|
if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onConfirm) {
|
|
382
381
|
var _popRow$confirmConfig2;
|
|
383
|
-
|
|
384
382
|
(_popRow$confirmConfig2 = popRow.confirmConfig).onConfirm.apply(_popRow$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
385
383
|
return rowParams[pItem];
|
|
386
384
|
})));
|
|
@@ -391,18 +389,19 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
391
389
|
}
|
|
392
390
|
}
|
|
393
391
|
}), /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
394
|
-
|
|
392
|
+
menu: {
|
|
393
|
+
items: deepTransTextMenus(forDrop)
|
|
394
|
+
},
|
|
395
395
|
placement: "bottomRight"
|
|
396
396
|
}, dropdownConfig), /*#__PURE__*/React.createElement("a", {
|
|
397
397
|
className: "spec-button-group-text"
|
|
398
|
-
}, "
|
|
398
|
+
}, moreText, " ", /*#__PURE__*/React.createElement(DownOutlined, null)))));
|
|
399
399
|
}
|
|
400
|
-
|
|
400
|
+
// 数量不超出时渲染
|
|
401
401
|
return /*#__PURE__*/React.createElement("span", {
|
|
402
402
|
className: "spec-button-group"
|
|
403
403
|
}, resetList.map(function (item, index) {
|
|
404
404
|
return renderDisplayButton(item, index);
|
|
405
405
|
}));
|
|
406
406
|
};
|
|
407
|
-
|
|
408
407
|
export default ButtonGroup;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import './index.less';
|
|
4
|
-
|
|
5
4
|
var DragBar = function DragBar(props) {
|
|
6
5
|
var direction = props.direction,
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
className = props.className,
|
|
7
|
+
onMouseDown = props.onMouseDown;
|
|
9
8
|
var directionStyle = direction === 'left' ? "spec-grid-dragbar-left-horizontal" : direction === 'right' ? "spec-grid-dragbar-right-horizontal" : direction === 'top' ? "spec-grid-dragbar-up-vertical" : "spec-grid-dragbar-down-vertical";
|
|
10
|
-
|
|
11
9
|
var handleMouseDown = function handleMouseDown(e) {
|
|
12
10
|
onMouseDown(e, direction);
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return /*#__PURE__*/React.createElement("div", {
|
|
16
13
|
className: classNames(directionStyle, className),
|
|
17
14
|
onMouseDown: handleMouseDown
|
|
18
15
|
});
|
|
19
16
|
};
|
|
20
|
-
|
|
21
17
|
export default DragBar;
|