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