@lingxiteam/ebe-utils 0.4.5 → 0.4.6

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.
@@ -10,11 +10,7 @@ import BodyCell from './BodyCell';
10
10
  import HeaderCell from './HeaderCell';
11
11
  import TableHead from './TableHead';
12
12
  import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
13
- import {
14
- useColumns,
15
- useRowMerge,
16
- useScroll,
17
- } from './hooks';
13
+ import { useColumns, useRowMerge, useScroll } from './hooks';
18
14
  import type { MyTableProps, WrapperTablePropsTypes } from './types/prop';
19
15
  import EmptyComp from '../utils/Empty';
20
16
  import { usePrintMode, PrintContainer } from '../utils';
@@ -74,7 +70,6 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
74
70
  form,
75
71
  ...restProps
76
72
  } = props;
77
-
78
73
 
79
74
  const { uid: compId } = $$componentItem;
80
75
  const { size, sortDirections, sticky, summary, tableLayout, title, rowClassName, showHeader = true } = restProps || {};
@@ -91,11 +86,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
91
86
  const engineApis = getEngineApis?.();
92
87
  const { backgroundStyle } = useBackgroundStyle({ backgroundType, engineApis, appId: $$componentItem?.appId, mode: 'engine' });
93
88
 
94
- const {
95
- sandBoxSafeRun,
96
- dataState,
97
- } = engineApis || {};
98
-
89
+ const { sandBoxSafeRun, dataState } = engineApis || {};
99
90
 
100
91
  const { getLocale } = useLocale(engineApis || {});
101
92
 
@@ -104,11 +95,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
104
95
  const appId = props?.appId || $$componentItem?.appId;
105
96
  const pageId = props?.pageId || $$componentItem?.pageId;
106
97
 
107
- const {
108
- rowSpanColMap,
109
- rowSpanMap,
110
- rowClassMap,
111
- } = useRowMerge({
98
+ const { rowSpanColMap, rowSpanMap, rowClassMap } = useRowMerge({
112
99
  ...props,
113
100
  currentPageDataSource,
114
101
  nowInlineEditKey,
@@ -211,12 +198,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
211
198
  innerTableStyle.overflowY = styles.overflowY;
212
199
  }
213
200
 
214
- const handleTableChange = (
215
- newPagination: any,
216
- newFilters: any,
217
- newSorter: any,
218
- newExtra: any,
219
- ) => {
201
+ const handleTableChange = (newPagination: any, newFilters: any, newSorter: any, newExtra: any) => {
220
202
  if (typeof onChange === 'function') {
221
203
  onChange(newPagination, newFilters, newSorter, newExtra);
222
204
  }
@@ -227,7 +209,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
227
209
  newPagination?.current,
228
210
  newPagination?.pageSize,
229
211
  newSorter?.order === 'ascend' ? newSorter?.field : undefined,
230
- newSorter?.order === 'descend' ? newSorter?.field : undefined,
212
+ newSorter?.order === 'descend' ? newSorter?.field : undefined
231
213
  );
232
214
  return;
233
215
  }
@@ -266,13 +248,15 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
266
248
  // }, [columnWidth]);
267
249
 
268
250
  const InnerHeaderCell = useMemo(() => {
269
- return (info: any) => <HeaderCell
270
- {...info}
271
- key={info.columnIndex}
272
- tableData={sortDataSource}
273
- hasExpandContent={hasExpandContent}
274
- childrenColumnName={realExpandable.childrenColumnName}
275
- />;
251
+ return (info: any) => (
252
+ <HeaderCell
253
+ {...info}
254
+ key={info.columnIndex}
255
+ tableData={sortDataSource}
256
+ hasExpandContent={hasExpandContent}
257
+ childrenColumnName={realExpandable.childrenColumnName}
258
+ />
259
+ );
276
260
  }, [sortDataSource, hasExpandContent, realExpandable.childrenColumnName]);
277
261
  const eleProps = {
278
262
  appId,
@@ -284,15 +268,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
284
268
 
285
269
  return visible ? (
286
270
  <>
287
- <div
288
- {...eleProps}
289
- style={{ ...backgroundStyle, ...styles }}
290
- className={classnames(
291
- 'ued-table-wrap',
292
- className,
293
- )}
294
- ref={tableWrapRef}
295
- >
271
+ <div {...eleProps} style={{ ...backgroundStyle, ...styles }} className={classnames('ued-table-wrap', className)} ref={tableWrapRef}>
296
272
  <TableHead
297
273
  {...restProps}
298
274
  source="engine"
@@ -305,14 +281,14 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
305
281
  />
306
282
  <Form form={form}>
307
283
  <Table
308
- // {...restProps} // TODO: 不要这么透传,需要什么传什么,先注释,之后缺什么再补
284
+ // {...restProps} // TODO: 不要这么透传,需要什么传什么,先注释,之后缺什么再补
309
285
  {...tableProps}
310
286
  showHeader={showHeader}
311
287
  locale={{
312
288
  emptyText: <EmptyComp dataState={dataState} getLocale={getLocale} />,
313
289
  }}
314
290
  ref={tableRef}
315
- // loading={loading}
291
+ // loading={loading}
316
292
  bordered={isBordered}
317
293
  className={innerClassName}
318
294
  style={innerTableStyle}
@@ -336,7 +312,7 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
336
312
  scroll={scroll}
337
313
  onChange={handleTableChange}
338
314
  onRow={(record) => {
339
- return ({
315
+ return {
340
316
  onClick: (event) => {
341
317
  const hasOnRowClick = onRowClick(event, record, getRealIndexById(record[currentRowKey]));
342
318
  !hasOnRowClick && onRowSelectClick(record, getRealIndexById(record[currentRowKey]));
@@ -344,13 +320,13 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
344
320
  onDoubleClick: (event) => {
345
321
  onRowDoubleClick(event, record, getRealIndexById(record[currentRowKey]));
346
322
  },
347
- onContextMenu: (event) => { },
348
- onMouseEnter: (event) => { }, // 鼠标移入行
349
- onMouseLeave: (event) => { },
350
- });
323
+ onContextMenu: (event) => {},
324
+ onMouseEnter: (event) => {}, // 鼠标移入行
325
+ onMouseLeave: (event) => {},
326
+ };
351
327
  }}
352
- rowSelection={rowSelection}
353
- // loading没有数据的时候模拟3个数据,当数据为空时依然展示骨架屏
328
+ rowSelection={rowSelection && rowSelection?.type ? rowSelection : false}
329
+ // loading没有数据的时候模拟3个数据,当数据为空时依然展示骨架屏
354
330
  dataSource={isEmptyLoading ? [{}, {}, {}] : sortDataSource}
355
331
  expandable={realExpandable}
356
332
  pagination={isEmptyLoading ? false : page && pagination}
@@ -401,12 +377,14 @@ const MyTable = LingxiForwardRef<any, Omit<MyTableProps, keyof WrapperTableProps
401
377
  cell: BodyCell,
402
378
  },
403
379
  header: {
404
- cell: (info: any) => <HeaderCell
405
- {...info}
406
- tableData={printData?.dataSource?.length > 0 ? printData.dataSource : sortDataSource}
407
- childrenColumnName={realExpandable.childrenColumnName}
408
- hasExpandContent={hasExpandContent}
409
- />,
380
+ cell: (info: any) => (
381
+ <HeaderCell
382
+ {...info}
383
+ tableData={printData?.dataSource?.length > 0 ? printData.dataSource : sortDataSource}
384
+ childrenColumnName={realExpandable.childrenColumnName}
385
+ hasExpandContent={hasExpandContent}
386
+ />
387
+ ),
410
388
  },
411
389
  }}
412
390
  columns={printColumns.map((item, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/ebe-utils",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -19,7 +19,7 @@
19
19
  "@babel/types": "^7.12.12",
20
20
  "cac": "^6.7.14",
21
21
  "fs-extra": "9.x",
22
- "@lingxiteam/ebe": "0.4.5"
22
+ "@lingxiteam/ebe": "0.4.6"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"