es-grid-template 0.1.2-1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid-component/InternalTable.js +3 -1
- package/es/grid-component/TableGrid.js +37 -28
- package/es/grid-component/hooks/useColumns/index.js +4 -3
- package/es/grid-component/styles.scss +13 -0
- package/es/grid-component/table/Grid.js +4 -3
- package/es/grid-component/table/GridEdit.js +2 -1
- package/es/grid-component/type.d.ts +2 -1
- package/lib/grid-component/InternalTable.js +3 -1
- package/lib/grid-component/TableGrid.js +37 -28
- package/lib/grid-component/hooks/useColumns/index.js +4 -3
- package/lib/grid-component/styles.scss +13 -0
- package/lib/grid-component/table/Grid.js +4 -3
- package/lib/grid-component/table/GridEdit.js +2 -1
- package/lib/grid-component/type.d.ts +2 -1
- package/package.json +1 -1
|
@@ -236,6 +236,7 @@ const InternalTable = props => {
|
|
|
236
236
|
const transformedColumn = {
|
|
237
237
|
...col,
|
|
238
238
|
dataIndex: col.field ?? col.dataIndex,
|
|
239
|
+
key: col.field ?? col.dataIndex ?? col.key,
|
|
239
240
|
title: t ? t(col.headerText ?? col.title) : col.headerText ?? col.title,
|
|
240
241
|
ellipsis: col.ellipsis !== false,
|
|
241
242
|
align: col.textAlign ?? col.align,
|
|
@@ -247,7 +248,7 @@ const InternalTable = props => {
|
|
|
247
248
|
children: transformColumns(col.children, currentPath)
|
|
248
249
|
};
|
|
249
250
|
}
|
|
250
|
-
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.
|
|
251
|
+
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false) {
|
|
251
252
|
return {
|
|
252
253
|
...transformedColumn
|
|
253
254
|
};
|
|
@@ -286,6 +287,7 @@ const InternalTable = props => {
|
|
|
286
287
|
};
|
|
287
288
|
const TableComponent = editAble ? GridEdit : Grid;
|
|
288
289
|
return /*#__PURE__*/React.createElement(TableComponent, _extends({}, rest, {
|
|
290
|
+
t: t,
|
|
289
291
|
tableRef: tableRef,
|
|
290
292
|
dataSource: data,
|
|
291
293
|
components: {
|
|
@@ -97,6 +97,7 @@ const TableGrid = props => {
|
|
|
97
97
|
t,
|
|
98
98
|
lang,
|
|
99
99
|
contextMenuOpen,
|
|
100
|
+
className,
|
|
100
101
|
contextMenuItems: propContextMenuItems,
|
|
101
102
|
contextMenuHidden,
|
|
102
103
|
contextMenuClick,
|
|
@@ -114,6 +115,7 @@ const TableGrid = props => {
|
|
|
114
115
|
dataSourceFilter: propDataSourceFilter,
|
|
115
116
|
loading,
|
|
116
117
|
triggerChangeColumns,
|
|
118
|
+
summary,
|
|
117
119
|
...rest
|
|
118
120
|
} = props;
|
|
119
121
|
const {
|
|
@@ -322,7 +324,7 @@ const TableGrid = props => {
|
|
|
322
324
|
dataSource: dataSource
|
|
323
325
|
// className={styles.customTable}
|
|
324
326
|
,
|
|
325
|
-
className: classNames(
|
|
327
|
+
className: classNames(className, {
|
|
326
328
|
'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
|
|
327
329
|
}, styles.customTable),
|
|
328
330
|
bordered: true,
|
|
@@ -356,29 +358,37 @@ const TableGrid = props => {
|
|
|
356
358
|
onScroll: () => {
|
|
357
359
|
setMenuVisible(false);
|
|
358
360
|
},
|
|
359
|
-
summary: () =>
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
thousandSeparator:
|
|
370
|
-
decimalSeparator
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
361
|
+
summary: () => {
|
|
362
|
+
if (typeof summary === 'function') {
|
|
363
|
+
return summary(dataSource);
|
|
364
|
+
}
|
|
365
|
+
if (!summary) {
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
return /*#__PURE__*/React.createElement(Table.Summary, {
|
|
369
|
+
fixed: true
|
|
370
|
+
}, /*#__PURE__*/React.createElement(Table.Summary.Row, null, flatColumns(columns).filter(col => col.hidden !== true).map((col, index) => {
|
|
371
|
+
const thousandSeparator = col.format?.thousandSeparator ? col.format?.thousandSeparator : format?.thousandSeparator;
|
|
372
|
+
const decimalSeparator = col.format?.decimalSeparator ? col.format?.decimalSeparator : format?.decimalSeparator;
|
|
373
|
+
const dec = col.format?.decimalScale || col.format?.decimalScale === 0 ? col.format?.decimalScale : format?.decimalScale;
|
|
374
|
+
const sumValue = col.type === 'number' ? sumDataByField(dataSource, col?.key) : 0;
|
|
375
|
+
const value = !isEmpty(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
|
|
376
|
+
const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
|
|
377
|
+
const numericFormatProps = {
|
|
378
|
+
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
379
|
+
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
380
|
+
allowNegative: (col.format?.allowNegative ? col.format?.allowNegative : format?.allowNegative) ?? false,
|
|
381
|
+
prefix: col.format?.prefix ? col.format?.prefix : format?.prefix,
|
|
382
|
+
suffix: col.format?.suffix ? col.format?.suffix : format?.suffix,
|
|
383
|
+
decimalScale: dec,
|
|
384
|
+
fixedDecimalScale: (col.format?.fixedDecimalScale ? col.format?.fixedDecimalScale : format?.fixedDecimalScale) ?? false
|
|
385
|
+
};
|
|
386
|
+
return /*#__PURE__*/React.createElement(Table.Summary.Cell, {
|
|
387
|
+
key: col.key,
|
|
388
|
+
index: index
|
|
389
|
+
}, col.summaryTemplate ? col.summaryTemplate(cellValue, col.key) : numericFormatter(cellValue, numericFormatProps));
|
|
390
|
+
})));
|
|
391
|
+
},
|
|
382
392
|
pagination: pagination && pagination.onChange ? false : {
|
|
383
393
|
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} items`,
|
|
384
394
|
...pagination
|
|
@@ -400,10 +410,9 @@ const TableGrid = props => {
|
|
|
400
410
|
items: toolbarItems ?? [],
|
|
401
411
|
mode: 'responsive'
|
|
402
412
|
// mode={'scroll'}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
413
|
+
// onClick={(val: any) => {
|
|
414
|
+
// console.log(val)
|
|
415
|
+
// }}
|
|
407
416
|
}), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
408
417
|
columns: columns,
|
|
409
418
|
triggerChangeColumns: triggerChangeColumns
|
|
@@ -166,8 +166,9 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
166
166
|
height: '100%'
|
|
167
167
|
},
|
|
168
168
|
value: dateValue,
|
|
169
|
-
defaultValue: dateValue
|
|
170
|
-
placeholder: column?.placeholder
|
|
169
|
+
defaultValue: dateValue
|
|
170
|
+
// placeholder={t ? t(column?.placeholder) : column?.placeholder}
|
|
171
|
+
,
|
|
171
172
|
onChange: (date, dateString) => {
|
|
172
173
|
const newDateValue = dateString ? moment(convertDayjsToDate(dateString, dateFormat)).format() : null;
|
|
173
174
|
setSelectedKeys(newDateValue ? [newDateValue] : []);
|
|
@@ -413,7 +414,7 @@ export const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, vis
|
|
|
413
414
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
414
415
|
className: 'mb-1'
|
|
415
416
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
416
|
-
placeholder: `Search
|
|
417
|
+
placeholder: `Search`,
|
|
417
418
|
value: selectedKeys[0],
|
|
418
419
|
onChange: e => setSelectedKeys(e.target.value ? [e.target.value] : [])
|
|
419
420
|
// onPressEnter={() => handleSearch(selectedKeys as string[], confirm)}
|
|
@@ -29,6 +29,18 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
29
29
|
|
|
30
30
|
.#{$prefix}-table-wrapper {
|
|
31
31
|
|
|
32
|
+
&.table-none-column-select {
|
|
33
|
+
.#{$prefix}-table-cell {
|
|
34
|
+
&.#{$prefix}-table-selection-column {
|
|
35
|
+
padding: 0 !important;
|
|
36
|
+
overflow: hidden !important;
|
|
37
|
+
border-inline-end: 0 !important;
|
|
38
|
+
//flex: 0 0 0 !important;
|
|
39
|
+
//width: 0 !important;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
.#{$prefix}-table-tbody-virtual {
|
|
33
45
|
.#{$prefix}-table-cell {
|
|
34
46
|
border-bottom: 1px solid $tableBorderColor;
|
|
@@ -94,6 +106,7 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
94
106
|
.#{$prefix}-table-summary {
|
|
95
107
|
.#{$prefix}-table-cell {
|
|
96
108
|
background-color: #fafafa;
|
|
109
|
+
height: 32px;
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
> tr > td {
|
|
@@ -6,10 +6,10 @@ import Command from "../Command";
|
|
|
6
6
|
import { renderContent } from "../hooks/useColumns";
|
|
7
7
|
const Grid = props => {
|
|
8
8
|
const {
|
|
9
|
+
t,
|
|
9
10
|
columns,
|
|
10
11
|
height,
|
|
11
12
|
tableRef,
|
|
12
|
-
className,
|
|
13
13
|
components,
|
|
14
14
|
style,
|
|
15
15
|
format,
|
|
@@ -32,7 +32,7 @@ const Grid = props => {
|
|
|
32
32
|
const transformedColumn = {
|
|
33
33
|
...column,
|
|
34
34
|
dataIndex: column.field ?? column.dataIndex,
|
|
35
|
-
title: column.headerText ?? column.title,
|
|
35
|
+
title: t ? t(column.headerText ?? column.title) : column.headerText ?? column.title,
|
|
36
36
|
ellipsis: column.ellipsis !== false,
|
|
37
37
|
align: column.textAlign ?? column.align,
|
|
38
38
|
fixed: column.frozen ? column.frozen.toLowerCase() : column.fixed
|
|
@@ -64,7 +64,7 @@ const Grid = props => {
|
|
|
64
64
|
render: (value, record, rowIndex) => renderContent(column, value, record, rowIndex, format)
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
|
-
}, []);
|
|
67
|
+
}, [format, t]);
|
|
68
68
|
const mergedColumns = useMemo(() => transformColumns(columns ?? []), [transformColumns, columns]);
|
|
69
69
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
|
|
70
70
|
heightTable: height,
|
|
@@ -72,6 +72,7 @@ const Grid = props => {
|
|
|
72
72
|
position: 'relative'
|
|
73
73
|
}
|
|
74
74
|
}, /*#__PURE__*/React.createElement(TableGrid, _extends({}, rest, {
|
|
75
|
+
t: t,
|
|
75
76
|
tableRef: tableRef,
|
|
76
77
|
components: {
|
|
77
78
|
...components
|
|
@@ -36,6 +36,7 @@ const GridEdit = props => {
|
|
|
36
36
|
onCellChange,
|
|
37
37
|
style,
|
|
38
38
|
getRowKey,
|
|
39
|
+
className,
|
|
39
40
|
...rest
|
|
40
41
|
} = props;
|
|
41
42
|
|
|
@@ -767,7 +768,7 @@ const GridEdit = props => {
|
|
|
767
768
|
cell: EditableCell
|
|
768
769
|
}
|
|
769
770
|
},
|
|
770
|
-
className: 'grid-editable',
|
|
771
|
+
className: classNames(className, 'grid-editable'),
|
|
771
772
|
rowKey: rowKey,
|
|
772
773
|
columns: resizableColumns,
|
|
773
774
|
showSorterTooltip: {
|
|
@@ -118,7 +118,7 @@ export type ColumnsType<RecordType = AnyObject> = ColumnType<RecordType>[];
|
|
|
118
118
|
export type ColumnsEditType<RecordType = AnyObject> = ColumnEditType<RecordType>[];
|
|
119
119
|
export type ColumnTable<RecordType = AnyObject> = ColumnEditType<RecordType> | ColumnType<RecordType>;
|
|
120
120
|
export type ColumnsTable<RecordType = AnyObject> = (ColumnType<RecordType> | ColumnEditType<RecordType>)[];
|
|
121
|
-
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource'> {
|
|
121
|
+
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
122
122
|
editAble?: boolean;
|
|
123
123
|
dataSource: RecordType[];
|
|
124
124
|
columns: ColumnsTable<RecordType>;
|
|
@@ -159,6 +159,7 @@ export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, '
|
|
|
159
159
|
loading?: boolean;
|
|
160
160
|
allowResizing?: boolean;
|
|
161
161
|
onDataChange?: (data: RecordType[]) => void;
|
|
162
|
+
summary?: boolean | ((data: readonly RecordType[]) => React.ReactNode);
|
|
162
163
|
}
|
|
163
164
|
export interface TableEditProps<RecordType = AnyObject> extends Omit<TableProps<RecordType>, 'columns'> {
|
|
164
165
|
columns: ColumnsTable<RecordType>;
|
|
@@ -245,6 +245,7 @@ const InternalTable = props => {
|
|
|
245
245
|
const transformedColumn = {
|
|
246
246
|
...col,
|
|
247
247
|
dataIndex: col.field ?? col.dataIndex,
|
|
248
|
+
key: col.field ?? col.dataIndex ?? col.key,
|
|
248
249
|
title: t ? t(col.headerText ?? col.title) : col.headerText ?? col.title,
|
|
249
250
|
ellipsis: col.ellipsis !== false,
|
|
250
251
|
align: col.textAlign ?? col.align,
|
|
@@ -256,7 +257,7 @@ const InternalTable = props => {
|
|
|
256
257
|
children: transformColumns(col.children, currentPath)
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
|
-
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.
|
|
260
|
+
if (col.dataIndex === 'index' || col.field === 'index' || col.dataIndex === '#' || col.field === '#' || col.allowFiltering === false) {
|
|
260
261
|
return {
|
|
261
262
|
...transformedColumn
|
|
262
263
|
};
|
|
@@ -295,6 +296,7 @@ const InternalTable = props => {
|
|
|
295
296
|
};
|
|
296
297
|
const TableComponent = editAble ? _GridEdit.default : _Grid.default;
|
|
297
298
|
return /*#__PURE__*/_react.default.createElement(TableComponent, (0, _extends2.default)({}, rest, {
|
|
299
|
+
t: t,
|
|
298
300
|
tableRef: tableRef,
|
|
299
301
|
dataSource: data,
|
|
300
302
|
components: {
|
|
@@ -104,6 +104,7 @@ const TableGrid = props => {
|
|
|
104
104
|
t,
|
|
105
105
|
lang,
|
|
106
106
|
contextMenuOpen,
|
|
107
|
+
className,
|
|
107
108
|
contextMenuItems: propContextMenuItems,
|
|
108
109
|
contextMenuHidden,
|
|
109
110
|
contextMenuClick,
|
|
@@ -121,6 +122,7 @@ const TableGrid = props => {
|
|
|
121
122
|
dataSourceFilter: propDataSourceFilter,
|
|
122
123
|
loading,
|
|
123
124
|
triggerChangeColumns,
|
|
125
|
+
summary,
|
|
124
126
|
...rest
|
|
125
127
|
} = props;
|
|
126
128
|
const {
|
|
@@ -329,7 +331,7 @@ const TableGrid = props => {
|
|
|
329
331
|
dataSource: dataSource
|
|
330
332
|
// className={styles.customTable}
|
|
331
333
|
,
|
|
332
|
-
className: (0, _classnames.default)(
|
|
334
|
+
className: (0, _classnames.default)(className, {
|
|
333
335
|
'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
|
|
334
336
|
}, styles.customTable),
|
|
335
337
|
bordered: true,
|
|
@@ -363,29 +365,37 @@ const TableGrid = props => {
|
|
|
363
365
|
onScroll: () => {
|
|
364
366
|
setMenuVisible(false);
|
|
365
367
|
},
|
|
366
|
-
summary: () =>
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
thousandSeparator
|
|
377
|
-
decimalSeparator
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
368
|
+
summary: () => {
|
|
369
|
+
if (typeof summary === 'function') {
|
|
370
|
+
return summary(dataSource);
|
|
371
|
+
}
|
|
372
|
+
if (!summary) {
|
|
373
|
+
return undefined;
|
|
374
|
+
}
|
|
375
|
+
return /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary, {
|
|
376
|
+
fixed: true
|
|
377
|
+
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary.Row, null, (0, _useColumns.flatColumns)(columns).filter(col => col.hidden !== true).map((col, index) => {
|
|
378
|
+
const thousandSeparator = col.format?.thousandSeparator ? col.format?.thousandSeparator : format?.thousandSeparator;
|
|
379
|
+
const decimalSeparator = col.format?.decimalSeparator ? col.format?.decimalSeparator : format?.decimalSeparator;
|
|
380
|
+
const dec = col.format?.decimalScale || col.format?.decimalScale === 0 ? col.format?.decimalScale : format?.decimalScale;
|
|
381
|
+
const sumValue = col.type === 'number' ? (0, _hooks.sumDataByField)(dataSource, col?.key) : 0;
|
|
382
|
+
const value = !(0, _hooks.isEmpty)(sumValue) ? dec || dec === 0 ? parseFloat(Number(sumValue).toFixed(dec)).toString() : sumValue.toString() : '0';
|
|
383
|
+
const cellValue = col.type === 'number' && col.isSummary !== false ? value : '';
|
|
384
|
+
const numericFormatProps = {
|
|
385
|
+
thousandSeparator: (0, _hooks.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
386
|
+
decimalSeparator: (0, _hooks.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
387
|
+
allowNegative: (col.format?.allowNegative ? col.format?.allowNegative : format?.allowNegative) ?? false,
|
|
388
|
+
prefix: col.format?.prefix ? col.format?.prefix : format?.prefix,
|
|
389
|
+
suffix: col.format?.suffix ? col.format?.suffix : format?.suffix,
|
|
390
|
+
decimalScale: dec,
|
|
391
|
+
fixedDecimalScale: (col.format?.fixedDecimalScale ? col.format?.fixedDecimalScale : format?.fixedDecimalScale) ?? false
|
|
392
|
+
};
|
|
393
|
+
return /*#__PURE__*/_react.default.createElement(_rcMasterUi.Table.Summary.Cell, {
|
|
394
|
+
key: col.key,
|
|
395
|
+
index: index
|
|
396
|
+
}, col.summaryTemplate ? col.summaryTemplate(cellValue, col.key) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps));
|
|
397
|
+
})));
|
|
398
|
+
},
|
|
389
399
|
pagination: pagination && pagination.onChange ? false : {
|
|
390
400
|
showTotal: (total, range) => `${range[0]}-${range[1]} / ${total} items`,
|
|
391
401
|
...pagination
|
|
@@ -407,10 +417,9 @@ const TableGrid = props => {
|
|
|
407
417
|
items: toolbarItems ?? [],
|
|
408
418
|
mode: 'responsive'
|
|
409
419
|
// mode={'scroll'}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
420
|
+
// onClick={(val: any) => {
|
|
421
|
+
// console.log(val)
|
|
422
|
+
// }}
|
|
414
423
|
}), showColumnChoose && /*#__PURE__*/_react.default.createElement(_ColumnsChoose.ColumnsChoose, {
|
|
415
424
|
columns: columns,
|
|
416
425
|
triggerChangeColumns: triggerChangeColumns
|
|
@@ -178,8 +178,9 @@ const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, s
|
|
|
178
178
|
height: '100%'
|
|
179
179
|
},
|
|
180
180
|
value: dateValue,
|
|
181
|
-
defaultValue: dateValue
|
|
182
|
-
placeholder: column?.placeholder
|
|
181
|
+
defaultValue: dateValue
|
|
182
|
+
// placeholder={t ? t(column?.placeholder) : column?.placeholder}
|
|
183
|
+
,
|
|
183
184
|
onChange: (date, dateString) => {
|
|
184
185
|
const newDateValue = dateString ? (0, _moment.default)((0, _utils.convertDayjsToDate)(dateString, dateFormat)).format() : null;
|
|
185
186
|
setSelectedKeys(newDateValue ? [newDateValue] : []);
|
|
@@ -425,7 +426,7 @@ const renderFilter = (column, selectedKeys, setSelectedKeys, confirm, visible, s
|
|
|
425
426
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
426
427
|
className: 'mb-1'
|
|
427
428
|
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Input, {
|
|
428
|
-
placeholder: `Search
|
|
429
|
+
placeholder: `Search`,
|
|
429
430
|
value: selectedKeys[0],
|
|
430
431
|
onChange: e => setSelectedKeys(e.target.value ? [e.target.value] : [])
|
|
431
432
|
// onPressEnter={() => handleSearch(selectedKeys as string[], confirm)}
|
|
@@ -29,6 +29,18 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
29
29
|
|
|
30
30
|
.#{$prefix}-table-wrapper {
|
|
31
31
|
|
|
32
|
+
&.table-none-column-select {
|
|
33
|
+
.#{$prefix}-table-cell {
|
|
34
|
+
&.#{$prefix}-table-selection-column {
|
|
35
|
+
padding: 0 !important;
|
|
36
|
+
overflow: hidden !important;
|
|
37
|
+
border-inline-end: 0 !important;
|
|
38
|
+
//flex: 0 0 0 !important;
|
|
39
|
+
//width: 0 !important;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
.#{$prefix}-table-tbody-virtual {
|
|
33
45
|
.#{$prefix}-table-cell {
|
|
34
46
|
border-bottom: 1px solid $tableBorderColor;
|
|
@@ -94,6 +106,7 @@ $rowSelectedHoverBg: 'ui-rc' !default;
|
|
|
94
106
|
.#{$prefix}-table-summary {
|
|
95
107
|
.#{$prefix}-table-cell {
|
|
96
108
|
background-color: #fafafa;
|
|
109
|
+
height: 32px;
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
> tr > td {
|
|
@@ -15,10 +15,10 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const Grid = props => {
|
|
17
17
|
const {
|
|
18
|
+
t,
|
|
18
19
|
columns,
|
|
19
20
|
height,
|
|
20
21
|
tableRef,
|
|
21
|
-
className,
|
|
22
22
|
components,
|
|
23
23
|
style,
|
|
24
24
|
format,
|
|
@@ -41,7 +41,7 @@ const Grid = props => {
|
|
|
41
41
|
const transformedColumn = {
|
|
42
42
|
...column,
|
|
43
43
|
dataIndex: column.field ?? column.dataIndex,
|
|
44
|
-
title: column.headerText ?? column.title,
|
|
44
|
+
title: t ? t(column.headerText ?? column.title) : column.headerText ?? column.title,
|
|
45
45
|
ellipsis: column.ellipsis !== false,
|
|
46
46
|
align: column.textAlign ?? column.align,
|
|
47
47
|
fixed: column.frozen ? column.frozen.toLowerCase() : column.fixed
|
|
@@ -73,7 +73,7 @@ const Grid = props => {
|
|
|
73
73
|
render: (value, record, rowIndex) => (0, _useColumns.renderContent)(column, value, record, rowIndex, format)
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
|
-
}, []);
|
|
76
|
+
}, [format, t]);
|
|
77
77
|
const mergedColumns = (0, _react.useMemo)(() => transformColumns(columns ?? []), [transformColumns, columns]);
|
|
78
78
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_GridStyle.GridStyle, {
|
|
79
79
|
heightTable: height,
|
|
@@ -81,6 +81,7 @@ const Grid = props => {
|
|
|
81
81
|
position: 'relative'
|
|
82
82
|
}
|
|
83
83
|
}, /*#__PURE__*/_react.default.createElement(_TableGrid.default, (0, _extends2.default)({}, rest, {
|
|
84
|
+
t: t,
|
|
84
85
|
tableRef: tableRef,
|
|
85
86
|
components: {
|
|
86
87
|
...components
|
|
@@ -45,6 +45,7 @@ const GridEdit = props => {
|
|
|
45
45
|
onCellChange,
|
|
46
46
|
style,
|
|
47
47
|
getRowKey,
|
|
48
|
+
className,
|
|
48
49
|
...rest
|
|
49
50
|
} = props;
|
|
50
51
|
|
|
@@ -776,7 +777,7 @@ const GridEdit = props => {
|
|
|
776
777
|
cell: _EditableCell.default
|
|
777
778
|
}
|
|
778
779
|
},
|
|
779
|
-
className: 'grid-editable',
|
|
780
|
+
className: (0, _classnames.default)(className, 'grid-editable'),
|
|
780
781
|
rowKey: rowKey,
|
|
781
782
|
columns: resizableColumns,
|
|
782
783
|
showSorterTooltip: {
|
|
@@ -118,7 +118,7 @@ export type ColumnsType<RecordType = AnyObject> = ColumnType<RecordType>[];
|
|
|
118
118
|
export type ColumnsEditType<RecordType = AnyObject> = ColumnEditType<RecordType>[];
|
|
119
119
|
export type ColumnTable<RecordType = AnyObject> = ColumnEditType<RecordType> | ColumnType<RecordType>;
|
|
120
120
|
export type ColumnsTable<RecordType = AnyObject> = (ColumnType<RecordType> | ColumnEditType<RecordType>)[];
|
|
121
|
-
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource'> {
|
|
121
|
+
export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary'> {
|
|
122
122
|
editAble?: boolean;
|
|
123
123
|
dataSource: RecordType[];
|
|
124
124
|
columns: ColumnsTable<RecordType>;
|
|
@@ -159,6 +159,7 @@ export interface TableProps<RecordType> extends Omit<RcTableProps<RecordType>, '
|
|
|
159
159
|
loading?: boolean;
|
|
160
160
|
allowResizing?: boolean;
|
|
161
161
|
onDataChange?: (data: RecordType[]) => void;
|
|
162
|
+
summary?: boolean | ((data: readonly RecordType[]) => React.ReactNode);
|
|
162
163
|
}
|
|
163
164
|
export interface TableEditProps<RecordType = AnyObject> extends Omit<TableProps<RecordType>, 'columns'> {
|
|
164
165
|
columns: ColumnsTable<RecordType>;
|