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.
Files changed (170) hide show
  1. package/Readme.md +35 -0
  2. package/dist/fan-standard-comp.umd.js +15 -15
  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.js +212 -216
  7. package/es/ButtonGroup/style/index.less +1 -1
  8. package/es/DragContent/DragBar.js +2 -6
  9. package/es/DragContent/index.js +44 -75
  10. package/es/FormComp/ChunkUploader/api.js +6 -10
  11. package/es/FormComp/ChunkUploader/index.js +105 -171
  12. package/es/FormComp/ChunkUploader/lib.js +4 -17
  13. package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
  14. package/es/FormComp/ChunkUploader/worker.js +0 -3
  15. package/es/FormComp/EditButton/index.js +24 -49
  16. package/es/FormComp/FieldComponent/ReUpload.js +18 -38
  17. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +36 -74
  18. package/es/FormComp/FieldComponent/TitleNode.js +1 -3
  19. package/es/FormComp/FieldComponent/index.js +38 -74
  20. package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
  21. package/es/FormComp/RenderItemGroup/index.js +46 -74
  22. package/es/FormComp/Uploader/index.js +36 -77
  23. package/es/FormComp/Uploader/util.js +0 -6
  24. package/es/FormComp/VarTemplate/index.js +58 -96
  25. package/es/NavLeafScroll/index.js +172 -154
  26. package/es/NavLeafScroll/style/index.less +33 -1
  27. package/es/RefactorTree/index.js +36 -53
  28. package/es/RefactorTree/indexTreeNode.js +35 -68
  29. package/es/RefactorTree/util.js +9 -43
  30. package/es/SpecIcon/fonts/iconfont.js +7 -12
  31. package/es/SpecIcon/index.js +16 -25
  32. package/es/SplitterLayout/Pane.js +2 -5
  33. package/es/SplitterLayout/index.js +20 -70
  34. package/es/StandardContent/SplitterLayout/Pane.js +6 -10
  35. package/es/StandardContent/SplitterLayout/index.js +12 -63
  36. package/es/StandardContent/SubfieldContent.js +12 -14
  37. package/es/StandardContent/WrapperContent.js +8 -10
  38. package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  39. package/es/StandardDragModal/ChangeStandardModal.js +493 -0
  40. package/es/StandardDragModal/DraggableModal.d.ts +7 -0
  41. package/es/StandardDragModal/DraggableModal.js +31 -0
  42. package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
  43. package/es/StandardDragModal/DraggableModalContext.js +5 -0
  44. package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
  45. package/es/StandardDragModal/DraggableModalInner.js +114 -0
  46. package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  47. package/es/StandardDragModal/DraggableModalProvider.js +40 -0
  48. package/es/StandardDragModal/Modal.d.ts +11 -0
  49. package/es/StandardDragModal/Modal.js +24 -0
  50. package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
  51. package/es/StandardDragModal/ResizeHandle.js +8 -0
  52. package/es/StandardDragModal/clamp.d.ts +1 -0
  53. package/es/StandardDragModal/clamp.js +3 -0
  54. package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
  55. package/es/StandardDragModal/draggableModalReducer.js +157 -0
  56. package/es/StandardDragModal/getWindowSize.d.ts +4 -0
  57. package/es/StandardDragModal/getWindowSize.js +6 -0
  58. package/es/StandardDragModal/index.d.ts +3 -11
  59. package/es/StandardDragModal/index.js +3 -30
  60. package/es/StandardDragModal/index.less +65 -0
  61. package/es/StandardDragModal/useDrag.d.ts +5 -0
  62. package/es/StandardDragModal/useDrag.js +66 -0
  63. package/es/StandardDragModal/usePrevious.d.ts +1 -0
  64. package/es/StandardDragModal/usePrevious.js +8 -0
  65. package/es/StandardDragModal/useResize.d.ts +7 -0
  66. package/es/StandardDragModal/useResize.js +74 -0
  67. package/es/StandardFilter/index.js +30 -70
  68. package/es/StandardForm/ActionList.js +5 -7
  69. package/es/StandardForm/StepForm.js +50 -71
  70. package/es/StandardForm/TabForm.js +58 -70
  71. package/es/StandardForm/index.js +37 -56
  72. package/es/StandardModal/UpdateFormRef.js +1 -4
  73. package/es/StandardModal/index.d.ts +0 -1
  74. package/es/StandardModal/index.js +113 -157
  75. package/es/StandardPanel/index.js +19 -35
  76. package/es/StandardTable/index.js +18 -29
  77. package/es/components/IconNode/index.js +0 -4
  78. package/es/index.d.ts +1 -0
  79. package/es/index.js +15 -14
  80. package/es/utils/ValueFormat.js +0 -9
  81. package/es/utils/dictSelectUtil.js +153 -0
  82. package/es/utils/filterPermission.js +16 -34
  83. package/es/utils/getParentNodes.js +24 -47
  84. package/es/utils/index.js +2 -1
  85. package/lib/ButtonGroup/ButtonList.js +1 -13
  86. package/lib/ButtonGroup/ButtonMenu.js +1 -8
  87. package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
  88. package/lib/ButtonGroup/index.js +215 -239
  89. package/lib/ButtonGroup/style/index.less +1 -1
  90. package/lib/DragContent/DragBar.js +2 -10
  91. package/lib/DragContent/index.js +47 -85
  92. package/lib/FormComp/ChunkUploader/api.js +6 -15
  93. package/lib/FormComp/ChunkUploader/index.js +107 -185
  94. package/lib/FormComp/ChunkUploader/lib.js +8 -27
  95. package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
  96. package/lib/FormComp/ChunkUploader/worker.js +1 -5
  97. package/lib/FormComp/EditButton/index.js +26 -60
  98. package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
  99. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +38 -89
  100. package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
  101. package/lib/FormComp/FieldComponent/index.js +38 -110
  102. package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
  103. package/lib/FormComp/RenderItemGroup/index.js +46 -87
  104. package/lib/FormComp/Uploader/index.js +38 -95
  105. package/lib/FormComp/Uploader/util.js +1 -9
  106. package/lib/FormComp/VarTemplate/index.js +62 -106
  107. package/lib/FormComp/index.js +0 -2
  108. package/lib/NavLeafScroll/index.js +174 -165
  109. package/lib/NavLeafScroll/style/index.less +33 -1
  110. package/lib/RefactorTree/index.js +36 -67
  111. package/lib/RefactorTree/indexTreeNode.js +37 -83
  112. package/lib/RefactorTree/util.js +11 -45
  113. package/lib/SpecIcon/fonts/iconfont.js +7 -12
  114. package/lib/SpecIcon/index.js +16 -30
  115. package/lib/SplitterLayout/Pane.js +0 -7
  116. package/lib/SplitterLayout/index.js +18 -72
  117. package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
  118. package/lib/StandardContent/SplitterLayout/index.js +12 -68
  119. package/lib/StandardContent/SubfieldContent.js +12 -21
  120. package/lib/StandardContent/WrapperContent.js +8 -16
  121. package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
  122. package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
  123. package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
  124. package/lib/StandardDragModal/DraggableModal.js +40 -0
  125. package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
  126. package/lib/StandardDragModal/DraggableModalContext.js +15 -0
  127. package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
  128. package/lib/StandardDragModal/DraggableModalInner.js +124 -0
  129. package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
  130. package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
  131. package/lib/StandardDragModal/Modal.d.ts +11 -0
  132. package/lib/StandardDragModal/Modal.js +32 -0
  133. package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
  134. package/lib/StandardDragModal/ResizeHandle.js +18 -0
  135. package/lib/StandardDragModal/clamp.d.ts +1 -0
  136. package/lib/StandardDragModal/clamp.js +10 -0
  137. package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
  138. package/lib/StandardDragModal/draggableModalReducer.js +167 -0
  139. package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
  140. package/lib/StandardDragModal/getWindowSize.js +13 -0
  141. package/lib/StandardDragModal/index.d.ts +3 -11
  142. package/lib/StandardDragModal/index.js +33 -38
  143. package/lib/StandardDragModal/index.less +65 -0
  144. package/lib/StandardDragModal/useDrag.d.ts +5 -0
  145. package/lib/StandardDragModal/useDrag.js +73 -0
  146. package/lib/StandardDragModal/usePrevious.d.ts +1 -0
  147. package/lib/StandardDragModal/usePrevious.js +15 -0
  148. package/lib/StandardDragModal/useResize.d.ts +7 -0
  149. package/lib/StandardDragModal/useResize.js +81 -0
  150. package/lib/StandardFilter/index.js +28 -78
  151. package/lib/StandardForm/ActionList.js +5 -12
  152. package/lib/StandardForm/StepForm.js +52 -90
  153. package/lib/StandardForm/TabForm.js +61 -88
  154. package/lib/StandardForm/index.js +40 -75
  155. package/lib/StandardModal/UpdateFormRef.js +4 -12
  156. package/lib/StandardModal/index.d.ts +0 -1
  157. package/lib/StandardModal/index.js +115 -182
  158. package/lib/StandardPanel/index.js +22 -48
  159. package/lib/StandardTable/index.js +18 -38
  160. package/lib/components/IconNode/index.js +0 -7
  161. package/lib/components/index.js +0 -2
  162. package/lib/data/index.js +4 -7
  163. package/lib/index.d.ts +1 -0
  164. package/lib/index.js +50 -68
  165. package/lib/utils/ValueFormat.js +0 -10
  166. package/lib/utils/dictSelectUtil.js +161 -0
  167. package/lib/utils/filterPermission.js +15 -39
  168. package/lib/utils/getParentNodes.js +25 -52
  169. package/lib/utils/index.js +24 -9
  170. package/package.json +5 -4
@@ -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.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,
52
- _props$dropdownConfig = props.dropdownConfig,
53
- dropdownConfig = _props$dropdownConfig === void 0 ? {} : _props$dropdownConfig;
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
- options = _props$options === void 0 ? [] : _props$options,
56
- _props$min = props.min,
57
- min = _props$min === void 0 ? 3 : _props$min; // 最小展示长度不能小于2
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
- _useState2 = _slicedToArray(_useState, 2),
63
- popVisibleIndex = _useState2[0],
64
- setPopVisibleIndex = _useState2[1];
65
-
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ popVisibleIndex = _useState2[0],
49
+ setPopVisibleIndex = _useState2[1];
66
50
  var _useState3 = useState({}),
67
- _useState4 = _slicedToArray(_useState3, 2),
68
- popRow = _useState4[0],
69
- setPopRow = _useState4[1];
70
-
51
+ _useState4 = _slicedToArray(_useState3, 2),
52
+ popRow = _useState4[0],
53
+ setPopRow = _useState4[1];
71
54
  var _useState5 = useState([]),
72
- _useState6 = _slicedToArray(_useState5, 2),
73
- resetList = _useState6[0],
74
- setResetList = _useState6[1];
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
- var buttonMenu = function buttonMenu(group) {
88
- return /*#__PURE__*/React.createElement(_Menu, null, group.map(function (item, index) {
89
- if (item.children) {
90
- return /*#__PURE__*/React.createElement(_Menu.SubMenu, {
91
- title: item.exName || item.name,
92
- key: index
93
- }, item.children.map(function (child, childIndex) {
94
- return /*#__PURE__*/React.createElement(_Menu.Item, {
95
- key: childIndex
96
- }, /*#__PURE__*/React.createElement("a", {
97
- onClick: child.fn ? function () {
98
- return child.fn(child);
99
- } : null
100
- }, /*#__PURE__*/React.createElement(IconNode, {
101
- icon: child.icon
102
- }), " ", child.exName || child.name));
103
- }));
104
- }
105
-
106
- return /*#__PURE__*/React.createElement(_Menu.Item, {
107
- key: index
108
- }, /*#__PURE__*/React.createElement("a", {
109
- onClick: item.fn ? function () {
110
- return item.fn(item);
111
- } : null
112
- }, /*#__PURE__*/React.createElement(IconNode, {
113
- icon: item.icon
114
- }), " ", item.exName || item.name));
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
- name = item.name,
122
- type = item.type,
123
- icon = item.icon,
124
- ghost = item.ghost,
125
- danger = item.danger,
126
- disabled = item.disabled,
127
- loading = item.loading,
128
- fn = item.fn,
129
- code = item.code,
130
- rowParams = item.rowParams,
131
- others = __rest(item, ["exName", "name", "type", "icon", "ghost", "danger", "disabled", "loading", "fn", "code", "rowParams"]);
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
- overlay: buttonMenu(item.children),
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
- }, "ss", item.exName || item.name, " ", /*#__PURE__*/React.createElement(SpecIcon, {
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
- /*const textMenuItems = (group) => {
159
- return (group || []).map((gItem: any, gIndex) => {
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
- disabled: btnIsDisabled(gItem.disabled, rowParams),
162
- label: gItem.hasOwnProperty('confirmText') || gItem.hasOwnProperty('confirmConfig') ?
163
- // @ts-ignore
164
- <a disabled={btnIsDisabled(gItem.disabled, rowParams)}
165
- onClick={gItem.fn ? () => {
166
- setPopVisibleIndex(rowParams.rowIndex)
167
- setPopRow(gItem)
168
- } : null}>
169
- {gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
170
- </a>
171
- : <a className="spec-button-group-text"
172
- onClick={gItem.fn ? () => gItem.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}
173
- // @ts-ignore
174
- disabled={btnIsDisabled(gItem.disabled, rowParams)}>
175
- {gItem.render ? gItem.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (gItem.exName || gItem.name)}
176
- </a>,
177
- key: gIndex + (gItem.exName || gItem.name),
178
- children: gItem.children ? (gItem.children || []).map((child: any, childIndex: number) => {
179
- return {
180
- label: <a onClick={child.fn ? () => child.fn(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : null}>
181
- {child.render ? child.render(...Object.keys(rowParams).map((pItem) => rowParams[pItem])) : (child.exName || child.name)}
182
- </a>,
183
- key: childIndex
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
- }) : undefined
186
- }
187
- })
188
- }*/
189
- // 渲染文本形式多级菜单列表(用于表格)
190
-
191
-
192
- var textMenu = function textMenu(group) {
193
- return /*#__PURE__*/React.createElement(_Menu, {
194
- className: "spec-button-text-dropdown"
195
- }, group.map(function (gItem, gIndex) {
196
- if (gItem.children) {
197
- return /*#__PURE__*/React.createElement(_Menu.SubMenu, {
198
- title: gItem.exName || gItem.name,
199
- key: gItem
200
- }, gItem.children.map(function (child, childIndex) {
201
- return /*#__PURE__*/React.createElement(_Menu.Item, {
202
- key: childIndex
203
- }, /*#__PURE__*/React.createElement("a", {
204
- onClick: child.fn ? function () {
205
- return child.fn.apply(child, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
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
- overlay: textMenu(item.children),
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.render ? item.render.apply(item, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
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
- }, item.render ? item.render.apply(item, _toConsumableArray(Object.keys(rowParams).map(function (pItem) {
308
- return rowParams[pItem];
309
- }))) : item.exName || item.name));
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
- overlay: buttonMenu(forDrop),
347
+ menu: {
348
+ items: deepTransButtonMenus(forDrop)
349
+ },
353
350
  placement: "bottomRight"
354
351
  }, dropdownConfig), /*#__PURE__*/React.createElement(_Button, {
355
352
  type: "primary"
356
- }, "\u66F4\u591A ", /*#__PURE__*/React.createElement(SpecIcon, {
353
+ }, moreText, " ", /*#__PURE__*/React.createElement(SpecIcon, {
357
354
  name: "down"
358
355
  }))) : /*#__PURE__*/React.createElement(_Popconfirm, Object.assign({
359
356
  placement: "topRight",
360
- visible: popVisibleIndex === rowParams.rowIndex,
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); // 优先调用其 confirmConfig 配置的 onCancel 事件
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); // 优先调用其 confirmConfig 配置的 onConfirm 事件
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
- overlay: textMenu(forDrop),
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
- }, "\u66F4\u591A ", /*#__PURE__*/React.createElement(DownOutlined, null)))));
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;
@@ -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;