fan-standard-comp 3.1.10 → 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 -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 +212 -216
- 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 +215 -239
- 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,140 @@ 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
|
+
// 自定义渲染显示的文本
|
|
169
|
+
var renderCustomLabel = function renderCustomLabel(gItem) {
|
|
170
|
+
return gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
171
|
+
return rowParams[pItem];
|
|
172
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, gItem.icon ? ' ' : '', gItem.exName || gItem.name);
|
|
173
|
+
};
|
|
174
|
+
// 渲染按钮形式 (用于筛选)
|
|
119
175
|
var RenderButtonList = function RenderButtonList(item) {
|
|
120
176
|
var exName = item.exName,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
177
|
+
name = item.name,
|
|
178
|
+
type = item.type,
|
|
179
|
+
icon = item.icon,
|
|
180
|
+
ghost = item.ghost,
|
|
181
|
+
danger = item.danger,
|
|
182
|
+
disabled = item.disabled,
|
|
183
|
+
loading = item.loading,
|
|
184
|
+
fn = item.fn,
|
|
185
|
+
code = item.code,
|
|
186
|
+
rowParams = item.rowParams,
|
|
187
|
+
others = __rest(item, ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams"]);
|
|
133
188
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
189
|
+
// overlay={buttonMenu(item.children)}
|
|
134
190
|
return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
135
|
-
|
|
191
|
+
menu: {
|
|
192
|
+
items: deepTransButtonMenus(item.children)
|
|
193
|
+
},
|
|
136
194
|
placement: "bottomRight"
|
|
137
195
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement(_Button, {
|
|
138
196
|
type: "primary"
|
|
139
|
-
},
|
|
197
|
+
}, item.exName || item.name || item.label, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
140
198
|
name: "down"
|
|
141
199
|
})));
|
|
142
200
|
}
|
|
143
|
-
|
|
144
201
|
return /*#__PURE__*/React.createElement(_Button, Object.assign({
|
|
145
202
|
type: type || 'primary',
|
|
146
203
|
danger: danger,
|
|
@@ -153,99 +210,51 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
153
210
|
icon: icon
|
|
154
211
|
}),
|
|
155
212
|
disabled: btnIsDisabled(disabled, rowParams)
|
|
156
|
-
}), exName || name);
|
|
213
|
+
}), exName || name || others.label);
|
|
157
214
|
};
|
|
158
|
-
|
|
159
|
-
|
|
215
|
+
// 递归转换原来的数组结构
|
|
216
|
+
var deepTransTextMenus = function deepTransTextMenus(groupArray) {
|
|
217
|
+
if (!Array.isArray(groupArray)) {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
return groupArray.map(function (vItem, i) {
|
|
221
|
+
var code = vItem.code,
|
|
222
|
+
fn = vItem.fn,
|
|
223
|
+
exName = vItem.exName,
|
|
224
|
+
name = vItem.name,
|
|
225
|
+
children = vItem.children,
|
|
226
|
+
icon = vItem.icon,
|
|
227
|
+
confirmText = vItem.confirmText,
|
|
228
|
+
confirmConfig = vItem.confirmConfig,
|
|
229
|
+
others = __rest(vItem, ["code", "fn", "exName", "name", "children", "icon", "confirmText", "confirmConfig"]);
|
|
160
230
|
return {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
|
231
|
+
danger: others.danger,
|
|
232
|
+
disabled: btnIsDisabled(others.disabled, rowParams),
|
|
233
|
+
key: code ? code + i : i,
|
|
234
|
+
// icon: <IconNode icon={icon}/>, // 不显示图标
|
|
235
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
236
|
+
onClick: function onClick() {
|
|
237
|
+
// 配置二次确认
|
|
238
|
+
if (vItem.hasOwnProperty('confirmText') || vItem.hasOwnProperty('confirmConfig')) {
|
|
239
|
+
fn ? (setPopVisibleIndex(rowParams.rowIndex), setPopRow(vItem)) : null;
|
|
240
|
+
} else {
|
|
241
|
+
fn && fn(vItem);
|
|
242
|
+
}
|
|
184
243
|
}
|
|
185
|
-
})
|
|
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) {
|
|
206
|
-
return rowParams[pItem];
|
|
207
|
-
})));
|
|
208
|
-
} : null
|
|
209
|
-
}, child.render ? child.render.apply(child, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
210
|
-
return rowParams[pItem];
|
|
211
|
-
}))) : child.exName || child.name));
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return /*#__PURE__*/React.createElement(_Menu.Item, {
|
|
216
|
-
key: gIndex,
|
|
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
|
-
|
|
244
|
+
}, renderCustomLabel(vItem)),
|
|
245
|
+
title: vItem.exName || vItem.name,
|
|
246
|
+
children: children && children.length > 0 ? deepTransTextMenus(children) : undefined
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
// 渲染文本形式 列表(用于表格)
|
|
245
251
|
var RenderTextList = function RenderTextList(item) {
|
|
246
252
|
if (Array.isArray(item.children) && item.children.length > 0) {
|
|
253
|
+
// overlay={textMenu(item.children)}
|
|
247
254
|
return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
248
|
-
|
|
255
|
+
menu: {
|
|
256
|
+
items: deepTransTextMenus(item.children)
|
|
257
|
+
},
|
|
249
258
|
placement: "bottomRight"
|
|
250
259
|
}, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement("a", {
|
|
251
260
|
className: "spec-button-group-text"
|
|
@@ -255,7 +264,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
255
264
|
name: "down"
|
|
256
265
|
})));
|
|
257
266
|
}
|
|
258
|
-
|
|
259
267
|
return /*#__PURE__*/React.createElement(React.Fragment, null, item.hasOwnProperty('confirmText') || item.hasOwnProperty('confirmConfig') ? /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
|
|
260
268
|
placement: "topRight",
|
|
261
269
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)
|
|
@@ -266,7 +274,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
266
274
|
onCancel: function onCancel() {
|
|
267
275
|
if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onCancel) {
|
|
268
276
|
var _item$confirmConfig;
|
|
269
|
-
|
|
270
277
|
(_item$confirmConfig = item.confirmConfig).onCancel.apply(_item$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
271
278
|
return rowParams[pItem];
|
|
272
279
|
})));
|
|
@@ -275,7 +282,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
275
282
|
onConfirm: function onConfirm() {
|
|
276
283
|
if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onConfirm) {
|
|
277
284
|
var _item$confirmConfig2;
|
|
278
|
-
|
|
279
285
|
(_item$confirmConfig2 = item.confirmConfig).onConfirm.apply(_item$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
280
286
|
return rowParams[pItem];
|
|
281
287
|
})));
|
|
@@ -291,9 +297,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
291
297
|
title: item.exName || item.name,
|
|
292
298
|
// @ts-ignore
|
|
293
299
|
disabled: btnIsDisabled(item.disabled, rowParams)
|
|
294
|
-
}, item
|
|
295
|
-
return rowParams[pItem];
|
|
296
|
-
}))) : item.exName || item.name)) : /*#__PURE__*/React.createElement("a", {
|
|
300
|
+
}, renderCustomLabel(item))) : /*#__PURE__*/React.createElement("a", {
|
|
297
301
|
className: "spec-button-group-text",
|
|
298
302
|
title: item.exName || item.name,
|
|
299
303
|
key: item.index,
|
|
@@ -304,12 +308,9 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
304
308
|
return rowParams[pItem];
|
|
305
309
|
})));
|
|
306
310
|
} : null
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}; // 渲染展示的按钮列表
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
}, renderCustomLabel(item)));
|
|
312
|
+
};
|
|
313
|
+
// 渲染展示的按钮列表
|
|
313
314
|
var renderDisplayButton = function renderDisplayButton(item, index) {
|
|
314
315
|
/*渲染自定义*/
|
|
315
316
|
if (item.render) {
|
|
@@ -318,8 +319,6 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
318
319
|
}))) : item.render);
|
|
319
320
|
}
|
|
320
321
|
/*渲染按钮形式*/
|
|
321
|
-
|
|
322
|
-
|
|
323
322
|
if (type === 'button') {
|
|
324
323
|
return /*#__PURE__*/React.createElement(RenderButtonList, Object.assign({
|
|
325
324
|
key: index
|
|
@@ -328,36 +327,34 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
328
327
|
}));
|
|
329
328
|
}
|
|
330
329
|
/*渲染文本形式*/
|
|
331
|
-
|
|
332
|
-
|
|
333
330
|
return /*#__PURE__*/React.createElement(RenderTextList, Object.assign({
|
|
334
331
|
key: index
|
|
335
332
|
}, item));
|
|
336
333
|
};
|
|
337
|
-
|
|
338
334
|
if (min < 2) min = 2;
|
|
339
|
-
|
|
340
335
|
if (resetList.length === 0) {
|
|
341
336
|
return /*#__PURE__*/React.createElement(React.Fragment, null, type !== 'button' ? '-' : null);
|
|
342
337
|
}
|
|
343
|
-
|
|
338
|
+
// 数量超出时渲染
|
|
344
339
|
if (resetList.length > min) {
|
|
345
|
-
var forGroup = resetList.slice(0, min - 1);
|
|
346
|
-
var forDrop = resetList.slice(min - 1);
|
|
340
|
+
var forGroup = resetList.slice(0, min - 1); // 平铺组合内
|
|
341
|
+
var forDrop = resetList.slice(min - 1); // 下拉组合内
|
|
347
342
|
return /*#__PURE__*/React.createElement("span", {
|
|
348
343
|
className: "spec-button-group"
|
|
349
344
|
}, forGroup.map(function (item, index) {
|
|
350
345
|
return index < min - 1 ? renderDisplayButton(item, index) : null;
|
|
351
346
|
}), type === 'button' ? /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
352
|
-
|
|
347
|
+
menu: {
|
|
348
|
+
items: deepTransButtonMenus(forDrop)
|
|
349
|
+
},
|
|
353
350
|
placement: "bottomRight"
|
|
354
351
|
}, dropdownConfig), /*#__PURE__*/React.createElement(_Button, {
|
|
355
352
|
type: "primary"
|
|
356
|
-
}, "
|
|
353
|
+
}, moreText, " ", /*#__PURE__*/React.createElement(SpecIcon, {
|
|
357
354
|
name: "down"
|
|
358
355
|
}))) : /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
|
|
359
356
|
placement: "topRight",
|
|
360
|
-
|
|
357
|
+
open: popVisibleIndex === rowParams.rowIndex,
|
|
361
358
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
|
|
362
359
|
trigger: "click"
|
|
363
360
|
}, popRow.hasOwnProperty('confirmConfig') ? popRow.confirmConfig : {}, {
|
|
@@ -365,22 +362,20 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
365
362
|
extraRow: rowParams
|
|
366
363
|
})),
|
|
367
364
|
onCancel: function onCancel() {
|
|
368
|
-
setPopVisibleIndex(-1);
|
|
369
|
-
|
|
365
|
+
setPopVisibleIndex(-1);
|
|
366
|
+
// 优先调用其 confirmConfig 配置的 onCancel 事件
|
|
370
367
|
if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onCancel) {
|
|
371
368
|
var _popRow$confirmConfig;
|
|
372
|
-
|
|
373
369
|
(_popRow$confirmConfig = popRow.confirmConfig).onCancel.apply(_popRow$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
374
370
|
return rowParams[pItem];
|
|
375
371
|
})));
|
|
376
372
|
}
|
|
377
373
|
},
|
|
378
374
|
onConfirm: function onConfirm() {
|
|
379
|
-
setPopVisibleIndex(-1);
|
|
380
|
-
|
|
375
|
+
setPopVisibleIndex(-1);
|
|
376
|
+
// 优先调用其 confirmConfig 配置的 onConfirm 事件
|
|
381
377
|
if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onConfirm) {
|
|
382
378
|
var _popRow$confirmConfig2;
|
|
383
|
-
|
|
384
379
|
(_popRow$confirmConfig2 = popRow.confirmConfig).onConfirm.apply(_popRow$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
|
|
385
380
|
return rowParams[pItem];
|
|
386
381
|
})));
|
|
@@ -391,18 +386,19 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
391
386
|
}
|
|
392
387
|
}
|
|
393
388
|
}), /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
|
|
394
|
-
|
|
389
|
+
menu: {
|
|
390
|
+
items: deepTransTextMenus(forDrop)
|
|
391
|
+
},
|
|
395
392
|
placement: "bottomRight"
|
|
396
393
|
}, dropdownConfig), /*#__PURE__*/React.createElement("a", {
|
|
397
394
|
className: "spec-button-group-text"
|
|
398
|
-
}, "
|
|
395
|
+
}, moreText, " ", /*#__PURE__*/React.createElement(DownOutlined, null)))));
|
|
399
396
|
}
|
|
400
|
-
|
|
397
|
+
// 数量不超出时渲染
|
|
401
398
|
return /*#__PURE__*/React.createElement("span", {
|
|
402
399
|
className: "spec-button-group"
|
|
403
400
|
}, resetList.map(function (item, index) {
|
|
404
401
|
return renderDisplayButton(item, index);
|
|
405
402
|
}));
|
|
406
403
|
};
|
|
407
|
-
|
|
408
404
|
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;
|