@lingxiteam/ebe-utils 0.1.17 → 0.1.19

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 (25) hide show
  1. package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +17 -5
  2. package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +12 -7
  3. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +284 -0
  4. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +37 -1
  5. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +120 -0
  6. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +436 -0
  7. package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +64 -47
  8. package/lib/pcpublic/src/components/pcfactory/src/Table/assets/placeholder.png +0 -0
  9. package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +1 -0
  10. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +17 -3
  11. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +141 -522
  12. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +42 -3
  13. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +3 -2
  14. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +326 -0
  15. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +13 -7
  16. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +9 -4
  17. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +5 -2
  18. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +21 -8
  19. package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +3 -2
  20. package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +38 -0
  21. package/lib/pcpublic/src/components/pcfactory/src/Table/types/bodyCell.d.ts +3 -0
  22. package/lib/pcpublic/src/components/pcfactory/src/Table/types/contentStyle.d.ts +4 -0
  23. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +14 -9
  24. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Table.less +138 -14
  25. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  import React from 'react';
2
3
  import {
3
4
  BODY_CELL_MODE_ED,
@@ -102,17 +103,19 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
102
103
  dataIndex,
103
104
  row: record,
104
105
  children,
106
+ width,
105
107
  colorFormatInfo = [],
106
108
  isCustomRendering,
107
109
  funcExpExecute,
108
110
  engineApis,
109
111
  onTableCellClick,
112
+ index,
110
113
  ...restProps
111
114
  } = props;
112
115
 
113
116
  const commonCellOnClick = () => {
114
117
  if (onTableCellClick) {
115
- onTableCellClick(record, record?.[dataIndex], dataIndex);
118
+ onTableCellClick(record, _.get(record, dataIndex), dataIndex, index);
116
119
  }
117
120
  };
118
121
 
@@ -148,6 +151,10 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
148
151
  // 新窗口预览时,窗口的宽高信息
149
152
  modalWidth,
150
153
  modalHeight,
154
+ // 缩略图
155
+ imgMaxNum,
156
+ imgSize,
157
+ __isExeCondition__, // 判断配置态时是否执行判断条件
151
158
  } = item;
152
159
 
153
160
  // 背景相关
@@ -163,9 +170,9 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
163
170
  */
164
171
  if (
165
172
  (SET_ROW_SPECIAL_CELL_BACKGROUND_COLOR === formatStyle
166
- ? dataIndex === field
173
+ ? `${dataIndex}` === `${field}`
167
174
  : true) &&
168
- (mode === BODY_CELL_MODE_ED
175
+ (mode === BODY_CELL_MODE_ED && !__isExeCondition__
169
176
  ? true
170
177
  : collectCondition(conditions, record))
171
178
  ) {
@@ -205,9 +212,9 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
205
212
  */
206
213
  if (
207
214
  (SET_ROW_SPECIAL_CELL_CONTENT_STYLE === formatStyle
208
- ? dataIndex === field
215
+ ? `${dataIndex}` === `${field}`
209
216
  : true) &&
210
- (mode === BODY_CELL_MODE_ED
217
+ (mode === BODY_CELL_MODE_ED && !__isExeCondition__
211
218
  ? true
212
219
  : collectCondition(conditions, record))
213
220
  ) {
@@ -228,6 +235,9 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
228
235
  downloadUrl,
229
236
  modalWidth,
230
237
  modalHeight,
238
+ imgMaxNum,
239
+ imgSize,
240
+ field,
231
241
  };
232
242
 
233
243
  /**
@@ -262,6 +272,8 @@ const MyBodyCell: React.FC<MyBodyCellProps> = (props) => {
262
272
  funcExpExecute={funcExpExecute}
263
273
  engineApis={engineApis}
264
274
  commonCellClick={commonCellOnClick}
275
+ mode={mode}
276
+ width={width}
265
277
  >
266
278
  {children}
267
279
  </FormatCell>
@@ -7,7 +7,7 @@ import {
7
7
  Select,
8
8
  Switch,
9
9
  } from 'antd';
10
- import { cloneDeep } from 'lodash';
10
+ import _, { cloneDeep } from 'lodash';
11
11
  import moment, { Moment } from 'moment';
12
12
  import React, { useCallback, useMemo, useState } from 'react';
13
13
  import ModalSelect from '../../ModalSelect';
@@ -125,7 +125,7 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
125
125
  return res;
126
126
  }, [startTime, endTime, format, timeMode]);
127
127
 
128
- const initValue = rowData[dataIndex];
128
+ const initValue = _.get(rowData, dataIndex);
129
129
 
130
130
  const initialValue = useMemo(() => {
131
131
  switch (edittype) {
@@ -468,7 +468,14 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
468
468
  />
469
469
  // </WrapperInput>
470
470
  );
471
- case 'SuperSelect':
471
+ case 'SuperSelect': {
472
+ let showLabel = rowData[`${c.dataIndex}_introduce`];
473
+ if (Array.isArray(c.dataIndex)) {
474
+ // 兼容层级字段情况
475
+ const pre = c.dataIndex.slice(0, c.dataIndex.length - 1);
476
+ const last = c.dataIndex[c.dataIndex.length - 1];
477
+ showLabel = _.get(rowData, [...pre, `${last}_introduce`]);
478
+ }
472
479
  return (
473
480
  <ComSelect
474
481
  {...c}
@@ -481,7 +488,7 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
481
488
  selectWidth="auto"
482
489
  ignoreValueType
483
490
  labelInValue
484
- showLabel={rowData[`${c.dataIndex}_introduce`]}
491
+ showLabel={showLabel}
485
492
  label={c.title}
486
493
  value={initialValue}
487
494
  engineApis={engineApis}
@@ -496,6 +503,7 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
496
503
  }}
497
504
  />
498
505
  );
506
+ }
499
507
  case 'ModalSelect':
500
508
  return (
501
509
  <ModalSelect
@@ -532,9 +540,6 @@ const EditComponent: React.FC<MyEditComponent> = (props) => {
532
540
  };
533
541
 
534
542
  if (supportEditComponents.includes(edittype) && validateRules) {
535
- // const fieldName = `${compId}_${currentRowKey}_${
536
- // rowData[currentRowKey] || rowId
537
- // }_${dataIndex}`;
538
543
  const fieldName = getFormItemFieldName({
539
544
  compId,
540
545
  currentRowKey,
@@ -0,0 +1,284 @@
1
+ import { Popover } from 'antd';
2
+ import React, { useEffect, useMemo, useState } from 'react';
3
+ import CommIcon from '../../../Icon';
4
+ import IconPlaceholder from '../../assets/placeholder.png';
5
+ import { BODY_CELL_MODE_ED } from '../../constant';
6
+
7
+ export interface PureFadeColorTagProps {
8
+ row: any;
9
+ imgMaxNum?: number;
10
+ imgSize?: number;
11
+ field?: string;
12
+ engineApis?: any;
13
+ mode?: string;
14
+ width?: number;
15
+ appId: string;
16
+ pageId: string;
17
+ }
18
+
19
+ const thumbnailClassName = 'ued-table-cell-thumbnail';
20
+
21
+ const Thumbnail: React.FC<PureFadeColorTagProps> = (props) => {
22
+ const {
23
+ row,
24
+ field,
25
+ imgSize: defaultImgSize,
26
+ imgMaxNum,
27
+ engineApis,
28
+ mode,
29
+ width, // 列宽度
30
+ appId,
31
+ pageId,
32
+ } = props;
33
+ const [splitNum, setSplitNum] = useState(0);
34
+ const [visible, setVisible] = useState(false);
35
+ const [imgs, setImgs] = useState<any[]>([]);
36
+
37
+ const imgSize = useMemo(() => defaultImgSize || 40, [defaultImgSize]);
38
+
39
+ const getImgs = async (datas: any) => {
40
+ let imgsData = datas;
41
+ try {
42
+ if (typeof datas === 'string') {
43
+ imgsData = JSON.parse(datas);
44
+ }
45
+ } catch {
46
+ imgsData = [];
47
+ }
48
+ if (!Array.isArray(imgsData) && imgsData) {
49
+ imgsData = [imgsData];
50
+ }
51
+ if (imgsData) {
52
+ imgsData = await Promise.all(
53
+ imgsData?.map?.(async (img: any) => {
54
+ let src = img.url || img.data;
55
+ if (img.fileId) {
56
+ src = engineApis?.getAppFileUrlById(img.fileId);
57
+ } else {
58
+ // 对回填url地址重新进行加密加签处理
59
+ src = engineApis?.securityWithUrl(src);
60
+ }
61
+ return {
62
+ ...img,
63
+ downloadUrl: src,
64
+ src: src || IconPlaceholder,
65
+ };
66
+ }),
67
+ );
68
+
69
+ setImgs(imgsData);
70
+ }
71
+ };
72
+
73
+ useEffect(() => {
74
+ getImgs(row?.[field || '']);
75
+ }, [row?.[field || '']]);
76
+
77
+ useEffect(() => {
78
+ const defaultImgMaxNum = imgMaxNum ?? imgs?.length ?? 0; // 没设置最大展示数量时展示全部
79
+ if (!width || !imgs?.length) {
80
+ // 比较图片数量 跟 最大展示数
81
+ setSplitNum(Math.min(imgs?.length || 0, defaultImgMaxNum));
82
+ return;
83
+ }
84
+
85
+ // 设置列宽时 判断图片数量是否足够展示
86
+ let restWidth = width;
87
+ let splitNum = 0;
88
+
89
+ for (let i = 0; i < imgs.length; i += 1) {
90
+ const lastWidth = restWidth;
91
+ restWidth = restWidth - imgSize - 2;
92
+ if (restWidth > 0 && splitNum < defaultImgMaxNum) {
93
+ splitNum = i + 1;
94
+ } else {
95
+ restWidth = lastWidth;
96
+ break;
97
+ }
98
+ }
99
+ if (splitNum < imgs?.length && splitNum > 0 && restWidth < imgSize) {
100
+ // 剩余宽度不能展示更多按钮
101
+ splitNum -= 1;
102
+ }
103
+ setSplitNum(splitNum);
104
+ }, [width, imgSize, imgMaxNum, imgs?.length]);
105
+
106
+ const download = (file: any) => {
107
+ const a = document.createElement('a');
108
+ a.href = file.downloadUrl;
109
+ a.download = file.fileName || file.name;
110
+ document.body.appendChild(a);
111
+ a.click();
112
+ document.body.removeChild(a);
113
+ };
114
+
115
+ const onPreview = (fileIndex: number) => {
116
+ if (typeof engineApis?.BannerModal?.open === 'function') {
117
+ // 弹窗预览
118
+ const fileList = imgs?.map?.((file: any) => {
119
+ const fileId = file?.fileId || file?.url || file?.data || file?.src;
120
+ return {
121
+ fileId,
122
+ showDownLoad: true,
123
+ downloadClick: () => download(file),
124
+ file: {
125
+ fileId,
126
+ },
127
+ appId,
128
+ pageId,
129
+ };
130
+ });
131
+ engineApis.BannerModal.open({
132
+ fileIndex,
133
+ fileList,
134
+ previewIsShowPage: true,
135
+ viewMode: 'popUp',
136
+ });
137
+ }
138
+ };
139
+
140
+ const renderIcon = (
141
+ file: any,
142
+ fileIndex: number,
143
+ isShowDownload: boolean,
144
+ ) => {
145
+ return (
146
+ <div className={`${thumbnailClassName}-icons`}>
147
+ {isShowDownload && (
148
+ <CommIcon
149
+ onClick={() => {
150
+ if (mode !== BODY_CELL_MODE_ED) {
151
+ download(file);
152
+ }
153
+ }}
154
+ icon={{
155
+ type: 'download',
156
+ theme: 'outlined',
157
+ isIconFont: false,
158
+ }}
159
+ engineApis={engineApis}
160
+ $$componentItem={null as any}
161
+ className=""
162
+ getEngineApis={null as any}
163
+ />
164
+ )}
165
+ <CommIcon
166
+ onClick={() => {
167
+ if (mode !== BODY_CELL_MODE_ED) {
168
+ onPreview(fileIndex);
169
+ setVisible(false);
170
+ }
171
+ }}
172
+ icon={{
173
+ type: 'eye',
174
+ theme: 'outlined',
175
+ isIconFont: false,
176
+ }}
177
+ engineApis={engineApis}
178
+ $$componentItem={null as any}
179
+ className=""
180
+ getEngineApis={null as any}
181
+ />
182
+ </div>
183
+ );
184
+ };
185
+
186
+ // 加载错误时展示默认图片
187
+ const handleImgError = (index: number) => {
188
+ setImgs((pre) =>
189
+ pre.map((v, i) => {
190
+ if (i === index) {
191
+ return {
192
+ ...v,
193
+ src: IconPlaceholder,
194
+ };
195
+ }
196
+ return v;
197
+ }),
198
+ );
199
+ };
200
+
201
+ const renderPopoverContent = () => {
202
+ return (
203
+ <div className={`${thumbnailClassName}-popover-content`}>
204
+ {imgs?.map?.((c: any, index: number) => {
205
+ return (
206
+ <div
207
+ key={index}
208
+ className={`${thumbnailClassName}-popover-item`}
209
+ title={c.fileName || c.name}
210
+ >
211
+ <div className={`${thumbnailClassName}-popover-imgItem`}>
212
+ <img
213
+ alt={IconPlaceholder}
214
+ src={c.src}
215
+ onError={() => handleImgError(index)}
216
+ />
217
+ {renderIcon(c, index, true)}
218
+ </div>
219
+ <span className={`${thumbnailClassName}-popover-imgName`}>
220
+ {c.fileName || c.name}
221
+ </span>
222
+ </div>
223
+ );
224
+ })}
225
+ </div>
226
+ );
227
+ };
228
+
229
+ const renderImg = () => {
230
+ const isShowDownload = imgSize >= 28;
231
+ if (Array.isArray(imgs)) {
232
+ const showImgs: any[] = imgs.slice(0, splitNum);
233
+ const resNum = imgs.length - splitNum;
234
+ const resSize = width && width < imgSize ? width : imgSize;
235
+ return (
236
+ <>
237
+ {showImgs.map((c: any, index: number) => {
238
+ return (
239
+ <div
240
+ key={index}
241
+ className={`${thumbnailClassName}-item`}
242
+ style={{ width: imgSize, height: imgSize }}
243
+ title={c.fileName || c.name}
244
+ >
245
+ <img alt="" src={c.src} onError={() => handleImgError(index)} />
246
+ {renderIcon(c, index, isShowDownload)}
247
+ </div>
248
+ );
249
+ })}
250
+ {!!resNum && (
251
+ <Popover
252
+ placement="leftTop"
253
+ overlayClassName={`${thumbnailClassName}-popover`}
254
+ content={renderPopoverContent()}
255
+ visible={visible}
256
+ mouseEnterDelay={0.5}
257
+ onVisibleChange={(v) => {
258
+ if (mode !== BODY_CELL_MODE_ED) {
259
+ setVisible(v);
260
+ }
261
+ }}
262
+ >
263
+ <div
264
+ className={`${thumbnailClassName}-moreItem`}
265
+ style={{ width: resSize, height: resSize }}
266
+ >
267
+ +{resNum}
268
+ </div>
269
+ </Popover>
270
+ )}
271
+ </>
272
+ );
273
+ }
274
+ return null;
275
+ };
276
+
277
+ return (
278
+ <span className={thumbnailClassName} title="">
279
+ {renderImg()}
280
+ </span>
281
+ );
282
+ };
283
+
284
+ export default Thumbnail;
@@ -8,6 +8,7 @@ import {
8
8
  POINT_TAG,
9
9
  PURE_COLOUR_FILL,
10
10
  PURE_COLOUR_TAG,
11
+ THUMBNAIL,
11
12
  } from '../constant';
12
13
  import { useFormatCell } from '../hooks';
13
14
  import type { ContentStyle } from '../types/contentStyle';
@@ -16,6 +17,7 @@ import Hyperlink from './Hyperlink';
16
17
  import PointTag from './PointTag';
17
18
  import PureColourFill from './PureColourFill';
18
19
  import PureFadeColourTag from './PureFadeColourTag';
20
+ import Thumbnail from './Thumbnail';
19
21
 
20
22
  export interface MyFormatCell {
21
23
  contentStyle: ContentStyle | undefined | {};
@@ -30,6 +32,8 @@ export interface MyFormatCell {
30
32
  funcExpExecute?: FuncExpExeCuteType;
31
33
  engineApis: any;
32
34
  commonCellClick?: () => void;
35
+ mode?: string;
36
+ width?: number;
33
37
  }
34
38
 
35
39
  export interface CellContentProps {
@@ -43,6 +47,10 @@ export interface CellContentProps {
43
47
  contentStyle: ContentStyle;
44
48
  funcExpExecute?: FuncExpExeCuteType;
45
49
  controllLineStyle?: CSSProperties | null;
50
+ mode?: string;
51
+ width?: number;
52
+ rowText?: any;
53
+ $$componentItemId: string;
46
54
  }
47
55
 
48
56
  const CellContent = (props: CellContentProps) => {
@@ -56,8 +64,13 @@ const CellContent = (props: CellContentProps) => {
56
64
  contentStyle,
57
65
  funcExpExecute,
58
66
  controllLineStyle,
67
+ mode,
68
+ width,
69
+ rowText,
70
+ $$componentItemId,
59
71
  } = props;
60
72
  const {
73
+ field,
61
74
  contentType,
62
75
  fontColor,
63
76
  borderColor,
@@ -73,6 +86,8 @@ const CellContent = (props: CellContentProps) => {
73
86
  downloadUrl,
74
87
  modalWidth,
75
88
  modalHeight,
89
+ imgMaxNum,
90
+ imgSize,
76
91
  } = contentStyle;
77
92
 
78
93
  let { children } = props;
@@ -94,9 +109,10 @@ const CellContent = (props: CellContentProps) => {
94
109
  downloadUrl,
95
110
  modalWidth,
96
111
  modalHeight,
112
+ $$componentItemId,
97
113
  });
98
114
 
99
- children = content ? handleCellContent(row, rowIndex) : children;
115
+ children = content ? handleCellContent(row, rowIndex, rowText) : children;
100
116
 
101
117
  if (content && controllLineStyle) {
102
118
  children = (
@@ -174,6 +190,20 @@ const CellContent = (props: CellContentProps) => {
174
190
  );
175
191
  case HYPER_LINK:
176
192
  return <Hyperlink content={children} onClick={onClick} />;
193
+ case THUMBNAIL:
194
+ return (
195
+ <Thumbnail
196
+ imgMaxNum={imgMaxNum}
197
+ imgSize={imgSize}
198
+ row={row}
199
+ field={field}
200
+ engineApis={engineApis}
201
+ mode={mode}
202
+ width={width}
203
+ appId={appId}
204
+ pageId={pageId}
205
+ />
206
+ );
177
207
  default:
178
208
  break;
179
209
  }
@@ -190,6 +220,8 @@ const FormatCell: React.FC<MyFormatCell> = (props) => {
190
220
  funcExpExecute,
191
221
  engineApis,
192
222
  commonCellClick,
223
+ mode,
224
+ width,
193
225
  } = props;
194
226
 
195
227
  const { history, appId, pageId, row, rowId, rowIndex, ...restTdProps } =
@@ -225,6 +257,10 @@ const FormatCell: React.FC<MyFormatCell> = (props) => {
225
257
  rowId={rowId}
226
258
  rowIndex={rowIndex}
227
259
  controllLineStyle={props.tdProps?.controllLineStyle}
260
+ mode={mode}
261
+ width={width}
262
+ rowText={restTdProps?.title}
263
+ $$componentItemId={restTdProps?.$$componentItemId}
228
264
  >
229
265
  {children}
230
266
  </CellContent>
@@ -0,0 +1,120 @@
1
+ import { Icon as LegacyIcon } from '@lingxiteam/icons';
2
+ import { Button, Divider, Popconfirm, Tooltip } from 'antd';
3
+ import classnames from 'classnames';
4
+ import { Fragment, useState } from 'react';
5
+ import type { SingleBtnProps } from '../types/OperationCell';
6
+
7
+ // 操作项单个按钮
8
+ const SingleBtn = (props: SingleBtnProps) => {
9
+ const {
10
+ onDeleteClick,
11
+ onBtnClick,
12
+ getLocale,
13
+ actionsMap,
14
+ setMorePopVisible,
15
+ BtnIcon,
16
+ c,
17
+ idx,
18
+ defaultBtnList,
19
+ isPopover = false,
20
+ popconfirmPlacement,
21
+ } = props;
22
+ const [popVisible, setPopVisible] = useState(false);
23
+
24
+ const renderBtn = () => {
25
+ const { visible: buttonVisible = true } = c;
26
+
27
+ const type = typeof c === 'string' ? c : c?.type;
28
+
29
+ let buildInBtn = (
30
+ <Button
31
+ type="link"
32
+ disabled={c.disabled}
33
+ className={classnames(
34
+ 'ued-table-actions-antBtn',
35
+ type ? `ued-table-actions-${type}` : undefined,
36
+ )}
37
+ key={typeof c === 'string' ? c : c.type}
38
+ onClick={(e) => {
39
+ onBtnClick(e);
40
+ setPopVisible(false);
41
+ if (
42
+ isPopover &&
43
+ !(typeof c === 'string' ? c === 'delete' : c.type === 'delete')
44
+ ) {
45
+ setMorePopVisible(false);
46
+ }
47
+ }}
48
+ onDoubleClick={(e) => {
49
+ e.stopPropagation();
50
+ }}
51
+ >
52
+ {typeof c === 'string' ? (
53
+ <div className="ued-table-actions-extendBtn">
54
+ <LegacyIcon className="actIcon-left" type={actionsMap[c][1]} />
55
+ {actionsMap[c][0]}
56
+ </div>
57
+ ) : (
58
+ <div className="ued-table-actions-extendBtn">
59
+ {c.iconPos && c.iconPos === 'left' && BtnIcon}
60
+ {!c.isIcon && c.title}
61
+ {c.iconPos && c.iconPos === 'right' && BtnIcon}
62
+ </div>
63
+ )}
64
+ </Button>
65
+ );
66
+ buildInBtn = c.isIcon ? (
67
+ <Tooltip
68
+ title={c.title}
69
+ // @ts-ignore
70
+ visible={popVisible}
71
+ onVisibleChange={(v) => setPopVisible(v)}
72
+ >
73
+ {buildInBtn}
74
+ </Tooltip>
75
+ ) : (
76
+ buildInBtn
77
+ );
78
+
79
+ const btn = buttonVisible ? (
80
+ <Fragment key={idx}>
81
+ {(typeof c === 'string' ? c === 'delete' : c.type === 'delete') &&
82
+ !c.disabled ? (
83
+ <span
84
+ style={{ lineHeight: '0px' }}
85
+ onClick={(e) => {
86
+ e.stopPropagation();
87
+ }}
88
+ onDoubleClick={(e) => {
89
+ e.stopPropagation();
90
+ }}
91
+ >
92
+ <Popconfirm
93
+ onVisibleChange={(v) => v && setPopVisible(false)}
94
+ placement={popconfirmPlacement}
95
+ title={getLocale('deleteConfirm')}
96
+ onConfirm={(e: any) => {
97
+ onDeleteClick(e);
98
+ if (isPopover) {
99
+ setMorePopVisible(false);
100
+ }
101
+ }}
102
+ >
103
+ {buildInBtn}
104
+ </Popconfirm>
105
+ </span>
106
+ ) : (
107
+ buildInBtn
108
+ )}
109
+ {!isPopover && idx !== defaultBtnList.length - 1 && (
110
+ <Divider type="vertical" />
111
+ )}
112
+ </Fragment>
113
+ ) : null;
114
+ return isPopover ? <div>{btn}</div> : btn;
115
+ };
116
+
117
+ return renderBtn();
118
+ };
119
+
120
+ export default SingleBtn;