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.
Files changed (176) hide show
  1. package/Readme.md +35 -0
  2. package/dist/fan-standard-comp.umd.js +15 -10
  3. package/es/ButtonGroup/ButtonList.js +0 -3
  4. package/es/ButtonGroup/ButtonMenu.js +0 -3
  5. package/es/ButtonGroup/PopConfirmTitle.js +5 -15
  6. package/es/ButtonGroup/index.d.ts +2 -0
  7. package/es/ButtonGroup/index.js +223 -193
  8. package/es/ButtonGroup/style/index.less +1 -1
  9. package/es/DragContent/DragBar.js +2 -6
  10. package/es/DragContent/index.js +44 -75
  11. package/es/FormComp/ChunkUploader/api.js +6 -10
  12. package/es/FormComp/ChunkUploader/index.js +105 -171
  13. package/es/FormComp/ChunkUploader/lib.js +4 -17
  14. package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
  15. package/es/FormComp/ChunkUploader/worker.js +0 -3
  16. package/es/FormComp/EditButton/index.js +24 -49
  17. package/es/FormComp/FieldComponent/ReUpload.js +18 -38
  18. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
  19. package/es/FormComp/FieldComponent/TitleNode.js +1 -3
  20. package/es/FormComp/FieldComponent/index.js +38 -74
  21. package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
  22. package/es/FormComp/FieldComponent/style/index.less +6 -0
  23. package/es/FormComp/RenderItemGroup/index.js +46 -74
  24. package/es/FormComp/Uploader/index.js +36 -77
  25. package/es/FormComp/Uploader/util.js +0 -6
  26. package/es/FormComp/VarTemplate/index.js +58 -96
  27. package/es/NavLeafScroll/index.js +172 -154
  28. package/es/NavLeafScroll/style/index.less +33 -1
  29. package/es/RefactorTree/index.js +36 -53
  30. package/es/RefactorTree/indexTreeNode.js +35 -68
  31. package/es/RefactorTree/util.js +9 -43
  32. package/es/SpecIcon/fonts/iconfont.js +7 -12
  33. package/es/SpecIcon/index.js +16 -25
  34. package/es/SplitterLayout/Pane.js +2 -5
  35. package/es/SplitterLayout/index.js +20 -70
  36. package/es/StandardContent/SplitterLayout/Pane.js +6 -10
  37. package/es/StandardContent/SplitterLayout/index.js +12 -63
  38. package/es/StandardContent/SubfieldContent.js +12 -14
  39. package/es/StandardContent/WrapperContent.js +8 -10
  40. package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  41. package/es/StandardDragModal/ChangeStandardModal.js +493 -0
  42. package/es/StandardDragModal/DraggableModal.d.ts +7 -0
  43. package/es/StandardDragModal/DraggableModal.js +31 -0
  44. package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
  45. package/es/StandardDragModal/DraggableModalContext.js +5 -0
  46. package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
  47. package/es/StandardDragModal/DraggableModalInner.js +114 -0
  48. package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  49. package/es/StandardDragModal/DraggableModalProvider.js +40 -0
  50. package/es/StandardDragModal/Modal.d.ts +11 -0
  51. package/es/StandardDragModal/Modal.js +24 -0
  52. package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
  53. package/es/StandardDragModal/ResizeHandle.js +8 -0
  54. package/es/StandardDragModal/clamp.d.ts +1 -0
  55. package/es/StandardDragModal/clamp.js +3 -0
  56. package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
  57. package/es/StandardDragModal/draggableModalReducer.js +157 -0
  58. package/es/StandardDragModal/getWindowSize.d.ts +4 -0
  59. package/es/StandardDragModal/getWindowSize.js +6 -0
  60. package/es/StandardDragModal/index.d.ts +3 -11
  61. package/es/StandardDragModal/index.js +3 -30
  62. package/es/StandardDragModal/index.less +65 -0
  63. package/es/StandardDragModal/useDrag.d.ts +5 -0
  64. package/es/StandardDragModal/useDrag.js +66 -0
  65. package/es/StandardDragModal/usePrevious.d.ts +1 -0
  66. package/es/StandardDragModal/usePrevious.js +8 -0
  67. package/es/StandardDragModal/useResize.d.ts +7 -0
  68. package/es/StandardDragModal/useResize.js +74 -0
  69. package/es/StandardFilter/index.d.ts +1 -0
  70. package/es/StandardFilter/index.js +32 -70
  71. package/es/StandardForm/ActionList.js +5 -7
  72. package/es/StandardForm/StepForm.js +50 -71
  73. package/es/StandardForm/TabForm.js +58 -70
  74. package/es/StandardForm/index.js +37 -56
  75. package/es/StandardModal/UpdateFormRef.js +1 -4
  76. package/es/StandardModal/index.d.ts +0 -1
  77. package/es/StandardModal/index.js +115 -159
  78. package/es/StandardPanel/index.js +19 -35
  79. package/es/StandardTable/index.js +20 -30
  80. package/es/components/IconNode/index.js +0 -4
  81. package/es/index.d.ts +1 -0
  82. package/es/index.js +15 -14
  83. package/es/utils/ValueFormat.js +0 -9
  84. package/es/utils/dictSelectUtil.js +153 -0
  85. package/es/utils/filterPermission.js +16 -34
  86. package/es/utils/getParentNodes.js +24 -47
  87. package/es/utils/index.js +2 -1
  88. package/lib/ButtonGroup/ButtonList.js +1 -13
  89. package/lib/ButtonGroup/ButtonMenu.js +1 -8
  90. package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
  91. package/lib/ButtonGroup/index.d.ts +2 -0
  92. package/lib/ButtonGroup/index.js +226 -216
  93. package/lib/ButtonGroup/style/index.less +1 -1
  94. package/lib/DragContent/DragBar.js +2 -10
  95. package/lib/DragContent/index.js +47 -85
  96. package/lib/FormComp/ChunkUploader/api.js +6 -15
  97. package/lib/FormComp/ChunkUploader/index.js +107 -185
  98. package/lib/FormComp/ChunkUploader/lib.js +8 -27
  99. package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
  100. package/lib/FormComp/ChunkUploader/worker.js +1 -5
  101. package/lib/FormComp/EditButton/index.js +26 -60
  102. package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
  103. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
  104. package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
  105. package/lib/FormComp/FieldComponent/index.js +38 -110
  106. package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
  107. package/lib/FormComp/FieldComponent/style/index.less +6 -0
  108. package/lib/FormComp/RenderItemGroup/index.js +46 -87
  109. package/lib/FormComp/Uploader/index.js +38 -95
  110. package/lib/FormComp/Uploader/util.js +1 -9
  111. package/lib/FormComp/VarTemplate/index.js +62 -106
  112. package/lib/FormComp/index.js +0 -2
  113. package/lib/NavLeafScroll/index.js +174 -165
  114. package/lib/NavLeafScroll/style/index.less +33 -1
  115. package/lib/RefactorTree/index.js +36 -67
  116. package/lib/RefactorTree/indexTreeNode.js +37 -83
  117. package/lib/RefactorTree/util.js +11 -45
  118. package/lib/SpecIcon/fonts/iconfont.js +7 -12
  119. package/lib/SpecIcon/index.js +16 -30
  120. package/lib/SplitterLayout/Pane.js +0 -7
  121. package/lib/SplitterLayout/index.js +18 -72
  122. package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
  123. package/lib/StandardContent/SplitterLayout/index.js +12 -68
  124. package/lib/StandardContent/SubfieldContent.js +12 -21
  125. package/lib/StandardContent/WrapperContent.js +8 -16
  126. package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  127. package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
  128. package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
  129. package/lib/StandardDragModal/DraggableModal.js +40 -0
  130. package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
  131. package/lib/StandardDragModal/DraggableModalContext.js +15 -0
  132. package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
  133. package/lib/StandardDragModal/DraggableModalInner.js +124 -0
  134. package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  135. package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
  136. package/lib/StandardDragModal/Modal.d.ts +11 -0
  137. package/lib/StandardDragModal/Modal.js +32 -0
  138. package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
  139. package/lib/StandardDragModal/ResizeHandle.js +18 -0
  140. package/lib/StandardDragModal/clamp.d.ts +1 -0
  141. package/lib/StandardDragModal/clamp.js +10 -0
  142. package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
  143. package/lib/StandardDragModal/draggableModalReducer.js +167 -0
  144. package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
  145. package/lib/StandardDragModal/getWindowSize.js +13 -0
  146. package/lib/StandardDragModal/index.d.ts +3 -11
  147. package/lib/StandardDragModal/index.js +33 -38
  148. package/lib/StandardDragModal/index.less +65 -0
  149. package/lib/StandardDragModal/useDrag.d.ts +5 -0
  150. package/lib/StandardDragModal/useDrag.js +73 -0
  151. package/lib/StandardDragModal/usePrevious.d.ts +1 -0
  152. package/lib/StandardDragModal/usePrevious.js +15 -0
  153. package/lib/StandardDragModal/useResize.d.ts +7 -0
  154. package/lib/StandardDragModal/useResize.js +81 -0
  155. package/lib/StandardFilter/index.d.ts +1 -0
  156. package/lib/StandardFilter/index.js +30 -78
  157. package/lib/StandardForm/ActionList.js +5 -12
  158. package/lib/StandardForm/StepForm.js +52 -90
  159. package/lib/StandardForm/TabForm.js +61 -88
  160. package/lib/StandardForm/index.js +40 -75
  161. package/lib/StandardModal/UpdateFormRef.js +4 -12
  162. package/lib/StandardModal/index.d.ts +0 -1
  163. package/lib/StandardModal/index.js +117 -184
  164. package/lib/StandardPanel/index.js +22 -48
  165. package/lib/StandardTable/index.js +20 -39
  166. package/lib/components/IconNode/index.js +0 -7
  167. package/lib/components/index.js +0 -2
  168. package/lib/data/index.js +4 -7
  169. package/lib/index.d.ts +1 -0
  170. package/lib/index.js +50 -68
  171. package/lib/utils/ValueFormat.js +0 -10
  172. package/lib/utils/dictSelectUtil.js +161 -0
  173. package/lib/utils/filterPermission.js +15 -39
  174. package/lib/utils/getParentNodes.js +25 -52
  175. package/lib/utils/index.js +24 -9
  176. package/package.json +6 -5
@@ -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,43 +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.js';
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
- type = _props$type === void 0 ? 'button' : _props$type,
43
- _props$rowParams = props.rowParams,
44
- rowParams = _props$rowParams === void 0 ? {
45
- text: undefined,
46
- record: undefined,
47
- rowIndex: undefined
48
- } : _props$rowParams,
49
- _props$codes = props.codes,
50
- codes = _props$codes === void 0 ? funcCode.btnFuncCodes : _props$codes,
51
- permissionCodes = props.permissionCodes;
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;
52
40
  var _props$options = props.options,
53
- options = _props$options === void 0 ? [] : _props$options,
54
- _props$min = props.min,
55
- min = _props$min === void 0 ? 3 : _props$min; // 最小展示长度不能小于2
56
-
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 = '更多';
57
45
  if (!options) return null; // 没有配置list返回null
58
-
59
46
  var _useState = useState(-1),
60
- _useState2 = _slicedToArray(_useState, 2),
61
- popVisibleIndex = _useState2[0],
62
- setPopVisibleIndex = _useState2[1];
63
-
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ popVisibleIndex = _useState2[0],
49
+ setPopVisibleIndex = _useState2[1];
64
50
  var _useState3 = useState({}),
65
- _useState4 = _slicedToArray(_useState3, 2),
66
- popRow = _useState4[0],
67
- setPopRow = _useState4[1];
68
-
51
+ _useState4 = _slicedToArray(_useState3, 2),
52
+ popRow = _useState4[0],
53
+ setPopRow = _useState4[1];
69
54
  var _useState5 = useState([]),
70
- _useState6 = _slicedToArray(_useState5, 2),
71
- resetList = _useState6[0],
72
- setResetList = _useState6[1];
73
-
55
+ _useState6 = _slicedToArray(_useState5, 2),
56
+ resetList = _useState6[0],
57
+ setResetList = _useState6[1];
74
58
  useEffect(function () {
75
59
  // 重组选项options集合数据,排除:无权限(有配置code,并且不包含permissionCodes内)的数据及,isHide 为true的数据
76
60
  setResetList(_toConsumableArray(removeNoPermission(options, permissionCodes, codes, rowParams)) || []);
@@ -80,65 +64,140 @@ var ButtonGroup = function ButtonGroup(props) {
80
64
  }, [options, codes, permissionCodes]);
81
65
  useEffect(function () {
82
66
  setPopVisibleIndex(-1);
83
- }, [rowParams]); // 渲染按钮多层级形式 (用于筛选)
84
-
85
- var buttonMenu = function buttonMenu(group) {
86
- return /*#__PURE__*/React.createElement(_Menu, null, group.map(function (item, index) {
87
- if (item.children) {
88
- return /*#__PURE__*/React.createElement(_Menu.SubMenu, {
89
- title: item.exName || item.name,
90
- key: index
91
- }, item.children.map(function (child, childIndex) {
92
- return /*#__PURE__*/React.createElement(_Menu.Item, {
93
- key: childIndex
94
- }, /*#__PURE__*/React.createElement("a", {
95
- onClick: child.fn ? function () {
96
- return child.fn(child);
97
- } : null
98
- }, /*#__PURE__*/React.createElement(IconNode, {
99
- icon: child.icon
100
- }), " ", child.exName || child.name));
101
- }));
102
- }
103
-
104
- return /*#__PURE__*/React.createElement(_Menu.Item, {
105
- key: index
106
- }, /*#__PURE__*/React.createElement("a", {
107
- onClick: item.fn ? function () {
108
- return item.fn(item);
109
- } : null
110
- }, /*#__PURE__*/React.createElement(IconNode, {
111
- icon: item.icon
112
- }), " ", item.exName || item.name));
113
- }));
114
- }; // 渲染按钮形式 (用于筛选)
115
-
116
-
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
+ // 渲染按钮形式 (用于筛选)
117
175
  var RenderButtonList = function RenderButtonList(item) {
118
176
  var exName = item.exName,
119
- name = item.name,
120
- type = item.type,
121
- icon = item.icon,
122
- ghost = item.ghost,
123
- danger = item.danger,
124
- disabled = item.disabled,
125
- loading = item.loading,
126
- fn = item.fn,
127
- code = item.code,
128
- rowParams = item.rowParams,
129
- others = __rest(item, ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams"]);
130
-
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"]);
131
188
  if (Array.isArray(item.children) && item.children.length > 0) {
132
- return /*#__PURE__*/React.createElement(_Dropdown, {
133
- overlay: buttonMenu(item.children),
189
+ // overlay={buttonMenu(item.children)}
190
+ return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
191
+ menu: {
192
+ items: deepTransButtonMenus(item.children)
193
+ },
134
194
  placement: "bottomRight"
135
- }, /*#__PURE__*/React.createElement(_Button, {
195
+ }, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement(_Button, {
136
196
  type: "primary"
137
- }, item.exName || item.name, " ", /*#__PURE__*/React.createElement(SpecIcon, {
197
+ }, item.exName || item.name || item.label, " ", /*#__PURE__*/React.createElement(SpecIcon, {
138
198
  name: "down"
139
199
  })));
140
200
  }
141
-
142
201
  return /*#__PURE__*/React.createElement(_Button, Object.assign({
143
202
  type: type || 'primary',
144
203
  danger: danger,
@@ -151,69 +210,53 @@ var ButtonGroup = function ButtonGroup(props) {
151
210
  icon: icon
152
211
  }),
153
212
  disabled: btnIsDisabled(disabled, rowParams)
154
- }), exName || name);
155
- }; // 渲染文本形式多级菜单列表(用于表格)
156
-
157
-
158
- var textMenu = function textMenu(group) {
159
- return /*#__PURE__*/React.createElement(_Menu, {
160
- className: "spec-button-text-dropdown"
161
- }, group.map(function (gItem, gIndex) {
162
- if (gItem.children) {
163
- return /*#__PURE__*/React.createElement(_Menu.SubMenu, {
164
- title: gItem.exName || gItem.name,
165
- key: gItem
166
- }, gItem.children.map(function (child, childIndex) {
167
- return /*#__PURE__*/React.createElement(_Menu.Item, {
168
- key: childIndex
169
- }, /*#__PURE__*/React.createElement("a", {
170
- onClick: child.fn ? function () {
171
- return child.fn.apply(child, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
172
- return rowParams[pItem];
173
- })));
174
- } : null
175
- }, child.render ? child.render.apply(child, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
176
- return rowParams[pItem];
177
- }))) : child.exName || child.name));
178
- }));
179
- }
180
-
181
- return /*#__PURE__*/React.createElement(_Menu.Item, {
182
- key: gIndex,
183
- disabled: btnIsDisabled(gItem.disabled, rowParams)
184
- }, gItem.hasOwnProperty('confirmText') || gItem.hasOwnProperty('confirmConfig') ?
185
- /*#__PURE__*/
186
- // @ts-ignore
187
- React.createElement("a", {
188
- disabled: btnIsDisabled(gItem.disabled, rowParams),
189
- onClick: gItem.fn ? function () {
190
- setPopVisibleIndex(rowParams.rowIndex);
191
- setPopRow(gItem);
192
- } : null
193
- }, gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
194
- return rowParams[pItem];
195
- }))) : gItem.exName || gItem.name) : /*#__PURE__*/React.createElement("a", {
196
- className: "spec-button-group-text",
197
- onClick: gItem.fn ? function () {
198
- return gItem.fn.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
199
- return rowParams[pItem];
200
- })));
201
- } : null,
202
- // @ts-ignore
203
- disabled: btnIsDisabled(gItem.disabled, rowParams)
204
- }, gItem.render ? gItem.render.apply(gItem, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
205
- return rowParams[pItem];
206
- }))) : gItem.exName || gItem.name));
207
- }));
208
- }; // 渲染文本形式 列表(用于表格)
209
-
210
-
213
+ }), exName || name || others.label);
214
+ };
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"]);
230
+ return {
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
+ }
243
+ }
244
+ }, renderCustomLabel(vItem)),
245
+ title: vItem.exName || vItem.name,
246
+ children: children && children.length > 0 ? deepTransTextMenus(children) : undefined
247
+ };
248
+ });
249
+ };
250
+ // 渲染文本形式 列表(用于表格)
211
251
  var RenderTextList = function RenderTextList(item) {
212
252
  if (Array.isArray(item.children) && item.children.length > 0) {
213
- return /*#__PURE__*/React.createElement(_Dropdown, {
214
- overlay: textMenu(item.children),
253
+ // overlay={textMenu(item.children)}
254
+ return /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
255
+ menu: {
256
+ items: deepTransTextMenus(item.children)
257
+ },
215
258
  placement: "bottomRight"
216
- }, /*#__PURE__*/React.createElement("a", {
259
+ }, (item === null || item === void 0 ? void 0 : item.dropdownConfig) || dropdownConfig || {}), /*#__PURE__*/React.createElement("a", {
217
260
  className: "spec-button-group-text"
218
261
  }, item.render ? item.render.apply(item, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
219
262
  return rowParams[pItem];
@@ -221,7 +264,6 @@ var ButtonGroup = function ButtonGroup(props) {
221
264
  name: "down"
222
265
  })));
223
266
  }
224
-
225
267
  return /*#__PURE__*/React.createElement(React.Fragment, null, item.hasOwnProperty('confirmText') || item.hasOwnProperty('confirmConfig') ? /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
226
268
  placement: "topRight",
227
269
  icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)
@@ -232,7 +274,6 @@ var ButtonGroup = function ButtonGroup(props) {
232
274
  onCancel: function onCancel() {
233
275
  if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onCancel) {
234
276
  var _item$confirmConfig;
235
-
236
277
  (_item$confirmConfig = item.confirmConfig).onCancel.apply(_item$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
237
278
  return rowParams[pItem];
238
279
  })));
@@ -241,7 +282,6 @@ var ButtonGroup = function ButtonGroup(props) {
241
282
  onConfirm: function onConfirm() {
242
283
  if (item.hasOwnProperty('confirmConfig') && item.confirmConfig.onConfirm) {
243
284
  var _item$confirmConfig2;
244
-
245
285
  (_item$confirmConfig2 = item.confirmConfig).onConfirm.apply(_item$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
246
286
  return rowParams[pItem];
247
287
  })));
@@ -257,9 +297,7 @@ var ButtonGroup = function ButtonGroup(props) {
257
297
  title: item.exName || item.name,
258
298
  // @ts-ignore
259
299
  disabled: btnIsDisabled(item.disabled, rowParams)
260
- }, item.render ? item.render.apply(item, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
261
- return rowParams[pItem];
262
- }))) : item.exName || item.name)) : /*#__PURE__*/React.createElement("a", {
300
+ }, renderCustomLabel(item))) : /*#__PURE__*/React.createElement("a", {
263
301
  className: "spec-button-group-text",
264
302
  title: item.exName || item.name,
265
303
  key: item.index,
@@ -270,12 +308,9 @@ var ButtonGroup = function ButtonGroup(props) {
270
308
  return rowParams[pItem];
271
309
  })));
272
310
  } : null
273
- }, item.render ? item.render.apply(item, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
274
- return rowParams[pItem];
275
- }))) : item.exName || item.name));
276
- }; // 渲染展示的按钮列表
277
-
278
-
311
+ }, renderCustomLabel(item)));
312
+ };
313
+ // 渲染展示的按钮列表
279
314
  var renderDisplayButton = function renderDisplayButton(item, index) {
280
315
  /*渲染自定义*/
281
316
  if (item.render) {
@@ -284,8 +319,6 @@ var ButtonGroup = function ButtonGroup(props) {
284
319
  }))) : item.render);
285
320
  }
286
321
  /*渲染按钮形式*/
287
-
288
-
289
322
  if (type === 'button') {
290
323
  return /*#__PURE__*/React.createElement(RenderButtonList, Object.assign({
291
324
  key: index
@@ -294,36 +327,34 @@ var ButtonGroup = function ButtonGroup(props) {
294
327
  }));
295
328
  }
296
329
  /*渲染文本形式*/
297
-
298
-
299
330
  return /*#__PURE__*/React.createElement(RenderTextList, Object.assign({
300
331
  key: index
301
332
  }, item));
302
333
  };
303
-
304
334
  if (min < 2) min = 2;
305
-
306
335
  if (resetList.length === 0) {
307
336
  return /*#__PURE__*/React.createElement(React.Fragment, null, type !== 'button' ? '-' : null);
308
337
  }
309
-
338
+ // 数量超出时渲染
310
339
  if (resetList.length > min) {
311
- var forGroup = resetList.slice(0, min - 1);
312
- var forDrop = resetList.slice(min - 1);
340
+ var forGroup = resetList.slice(0, min - 1); // 平铺组合内
341
+ var forDrop = resetList.slice(min - 1); // 下拉组合内
313
342
  return /*#__PURE__*/React.createElement("span", {
314
343
  className: "spec-button-group"
315
344
  }, forGroup.map(function (item, index) {
316
345
  return index < min - 1 ? renderDisplayButton(item, index) : null;
317
- }), type === 'button' ? /*#__PURE__*/React.createElement(_Dropdown, {
318
- overlay: buttonMenu(forDrop),
346
+ }), type === 'button' ? /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
347
+ menu: {
348
+ items: deepTransButtonMenus(forDrop)
349
+ },
319
350
  placement: "bottomRight"
320
- }, /*#__PURE__*/React.createElement(_Button, {
351
+ }, dropdownConfig), /*#__PURE__*/React.createElement(_Button, {
321
352
  type: "primary"
322
- }, "\u66F4\u591A ", /*#__PURE__*/React.createElement(SpecIcon, {
353
+ }, moreText, " ", /*#__PURE__*/React.createElement(SpecIcon, {
323
354
  name: "down"
324
355
  }))) : /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
325
356
  placement: "topRight",
326
- visible: popVisibleIndex === rowParams.rowIndex,
357
+ open: popVisibleIndex === rowParams.rowIndex,
327
358
  icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
328
359
  trigger: "click"
329
360
  }, popRow.hasOwnProperty('confirmConfig') ? popRow.confirmConfig : {}, {
@@ -331,22 +362,20 @@ var ButtonGroup = function ButtonGroup(props) {
331
362
  extraRow: rowParams
332
363
  })),
333
364
  onCancel: function onCancel() {
334
- setPopVisibleIndex(-1); // 优先调用其 confirmConfig 配置的 onCancel 事件
335
-
365
+ setPopVisibleIndex(-1);
366
+ // 优先调用其 confirmConfig 配置的 onCancel 事件
336
367
  if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onCancel) {
337
368
  var _popRow$confirmConfig;
338
-
339
369
  (_popRow$confirmConfig = popRow.confirmConfig).onCancel.apply(_popRow$confirmConfig, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
340
370
  return rowParams[pItem];
341
371
  })));
342
372
  }
343
373
  },
344
374
  onConfirm: function onConfirm() {
345
- setPopVisibleIndex(-1); // 优先调用其 confirmConfig 配置的 onConfirm 事件
346
-
375
+ setPopVisibleIndex(-1);
376
+ // 优先调用其 confirmConfig 配置的 onConfirm 事件
347
377
  if (popRow.hasOwnProperty('confirmConfig') && popRow.confirmConfig.onConfirm) {
348
378
  var _popRow$confirmConfig2;
349
-
350
379
  (_popRow$confirmConfig2 = popRow.confirmConfig).onConfirm.apply(_popRow$confirmConfig2, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
351
380
  return rowParams[pItem];
352
381
  })));
@@ -356,19 +385,20 @@ var ButtonGroup = function ButtonGroup(props) {
356
385
  })));
357
386
  }
358
387
  }
359
- }), /*#__PURE__*/React.createElement(_Dropdown, {
360
- overlay: textMenu(forDrop),
388
+ }), /*#__PURE__*/React.createElement(_Dropdown, Object.assign({
389
+ menu: {
390
+ items: deepTransTextMenus(forDrop)
391
+ },
361
392
  placement: "bottomRight"
362
- }, /*#__PURE__*/React.createElement("a", {
393
+ }, dropdownConfig), /*#__PURE__*/React.createElement("a", {
363
394
  className: "spec-button-group-text"
364
- }, "\u66F4\u591A ", /*#__PURE__*/React.createElement(DownOutlined, null)))));
395
+ }, moreText, " ", /*#__PURE__*/React.createElement(DownOutlined, null)))));
365
396
  }
366
-
397
+ // 数量不超出时渲染
367
398
  return /*#__PURE__*/React.createElement("span", {
368
399
  className: "spec-button-group"
369
400
  }, resetList.map(function (item, index) {
370
401
  return renderDisplayButton(item, index);
371
402
  }));
372
403
  };
373
-
374
404
  export default ButtonGroup;
@@ -15,7 +15,7 @@
15
15
  position: absolute;
16
16
  content: '';
17
17
  top: 50%;
18
- left: -@padding-sm/2;
18
+ left: -(@padding-sm/2);
19
19
  transform: translate(0, -50%);
20
20
  display: inline-block;
21
21
  height: .9em;
@@ -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
- className = props.className,
8
- onMouseDown = props.onMouseDown;
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;