es-grid-template 1.9.52 → 1.9.53
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/group-component/hook/utils.d.ts +8 -8
- package/es/table-component/hook/useColumns.js +0 -1
- package/es/table-component/hook/utils.js +7 -2
- package/es/table-virtuoso/InternalTable.js +2 -0
- package/es/table-virtuoso/body/TableBodyCell.js +11 -6
- package/lib/table-component/hook/useColumns.js +0 -1
- package/lib/table-component/hook/utils.js +7 -2
- package/lib/table-virtuoso/InternalTable.js +2 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +10 -5
- package/package.json +1 -1
|
@@ -166,7 +166,7 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
166
166
|
haveSum?: boolean;
|
|
167
167
|
isSummary?: boolean;
|
|
168
168
|
sumGroup?: boolean;
|
|
169
|
-
summaryTemplate?: (data: number, key: string) => import("react").
|
|
169
|
+
summaryTemplate?: (data: number, key: string) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode;
|
|
170
170
|
sorter?: boolean;
|
|
171
171
|
allowFiltering?: boolean;
|
|
172
172
|
allowSortering?: boolean;
|
|
@@ -178,26 +178,26 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
178
178
|
showFilterSearch?: boolean;
|
|
179
179
|
hidden?: boolean;
|
|
180
180
|
visible?: boolean;
|
|
181
|
-
headerTooltip?: string | boolean | (() => import("react").
|
|
181
|
+
headerTooltip?: string | boolean | (() => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
182
182
|
columnGroupText?: string;
|
|
183
183
|
headerTextAlign?: import("./../../grid-component/type").ITextAlign;
|
|
184
|
-
headerTemplate?: import("react").
|
|
184
|
+
headerTemplate?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((column: ColumnTable<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
185
185
|
fixedType?: import("./../../grid-component/type").FixedType;
|
|
186
186
|
headerTextWrap?: boolean;
|
|
187
187
|
ellipsis?: boolean;
|
|
188
188
|
allowResizing?: boolean;
|
|
189
189
|
align?: import("./../../grid-component/type").ITextAlign;
|
|
190
190
|
textAlign?: import("./../../grid-component/type").ITextAlign;
|
|
191
|
-
template?: import("react").
|
|
191
|
+
template?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
192
192
|
showTooltip?: boolean;
|
|
193
193
|
tooltipDescription?: string | ((args: {
|
|
194
194
|
value: any;
|
|
195
195
|
rowData: RecordType;
|
|
196
|
-
}) => import("react").
|
|
197
|
-
onCellStyles?: Omit<CSSProperties, "
|
|
198
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
196
|
+
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
197
|
+
onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
198
|
+
onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
199
199
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
200
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
200
|
+
onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
|
|
201
201
|
getValue?: (row: any, rowIndex: number) => any;
|
|
202
202
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
203
203
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -39,7 +39,6 @@ export const renderValueCell = (column, value, record, rowIndex, colIndex, forma
|
|
|
39
39
|
return value ? dayjs(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
40
40
|
case 'time':
|
|
41
41
|
const timeFormat = format?.timeFormat;
|
|
42
|
-
console.log('timeFormat', timeFormat);
|
|
43
42
|
const abc = convertToDate(value, timeFormat);
|
|
44
43
|
const timeValue = value ? dayjs(abc).format(timeFormat ?? 'HH:mm') : '';
|
|
45
44
|
return timeValue ?? '';
|
|
@@ -620,7 +620,9 @@ export function getColIdsBetween(table, a, b) {
|
|
|
620
620
|
}
|
|
621
621
|
export function getRowIdsBetween(table, a, b) {
|
|
622
622
|
// const ids = table.getRowModel().rows.map(r => r.id);
|
|
623
|
-
const
|
|
623
|
+
const flatRows = table.getRowModel().flatRows;
|
|
624
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
625
|
+
const ids = allRows.map(r => r.id);
|
|
624
626
|
const [start, end] = [ids.indexOf(a), ids.indexOf(b)].sort((x, y) => x - y);
|
|
625
627
|
return ids.slice(start, end + 1);
|
|
626
628
|
}
|
|
@@ -1366,7 +1368,10 @@ export const getSelectedCellMatrix = (table, startCell, endCell) => {
|
|
|
1366
1368
|
};
|
|
1367
1369
|
|
|
1368
1370
|
// const rowIds = table.getRowModel().rows.map(r => r.id);
|
|
1369
|
-
|
|
1371
|
+
|
|
1372
|
+
const flatRows = table.getRowModel().flatRows;
|
|
1373
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
1374
|
+
const rowIds = allRows.map(r => r.id);
|
|
1370
1375
|
const colIds = table.getVisibleLeafColumns().map(c => c.id);
|
|
1371
1376
|
|
|
1372
1377
|
// const colIds = table.getAllLeafColumns().map(c => c.id);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Space from "rc-master-ui/es/space";
|
|
2
|
-
import { getCommonPinningStyles } from "../hook/utils";
|
|
2
|
+
import { getCommonPinningStyles, getFormat } from "../hook/utils";
|
|
3
3
|
import Checkbox from "rc-master-ui/es/checkbox/Checkbox";
|
|
4
4
|
import classNames from "classnames";
|
|
5
5
|
import React from "react";
|
|
@@ -9,9 +9,10 @@ import { renderValueCell, toggleRowSelection } from "../../table-component/hook/
|
|
|
9
9
|
const renderCellIndex = props => {
|
|
10
10
|
const {
|
|
11
11
|
cell,
|
|
12
|
-
pagination
|
|
12
|
+
pagination,
|
|
13
|
+
isDataTree
|
|
13
14
|
} = props;
|
|
14
|
-
const parrents = cell.row.getParentRows();
|
|
15
|
+
const parrents = cell.row.parentId && isDataTree ? cell.row.getParentRows?.() : undefined;
|
|
15
16
|
if (parrents && parrents.length > 0) {
|
|
16
17
|
return /*#__PURE__*/React.createElement("span", {
|
|
17
18
|
className: "ui-rc_cell-content"
|
|
@@ -250,10 +251,12 @@ const TableBodyCell = props => {
|
|
|
250
251
|
className: "ui-rc_cell-content"
|
|
251
252
|
}, renderCellIndex({
|
|
252
253
|
cell,
|
|
253
|
-
pagination
|
|
254
|
+
pagination,
|
|
255
|
+
isDataTree
|
|
254
256
|
})) : renderCellIndex({
|
|
255
257
|
cell,
|
|
256
|
-
pagination
|
|
258
|
+
pagination,
|
|
259
|
+
isDataTree
|
|
257
260
|
}));
|
|
258
261
|
}
|
|
259
262
|
if (cell.column.id === "command") {
|
|
@@ -313,8 +316,10 @@ const TableBodyCell = props => {
|
|
|
313
316
|
})));
|
|
314
317
|
}
|
|
315
318
|
const cellValue = cell.getValue();
|
|
319
|
+
const colFormat = typeof columnMeta.format === 'function' ? columnMeta.format(record) : columnMeta.format;
|
|
320
|
+
const cellFormat = getFormat(colFormat, format);
|
|
316
321
|
const rowIndex = cell.row.index;
|
|
317
|
-
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex,
|
|
322
|
+
const fomatedValue = renderValueCell(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, false);
|
|
318
323
|
const cellContent = columnMeta.template ? typeof columnMeta.template === 'function' ? columnMeta.template({
|
|
319
324
|
field: columnMeta.field,
|
|
320
325
|
index: cell.row.index,
|
|
@@ -49,7 +49,6 @@ const renderValueCell = (column, value, record, rowIndex, colIndex, format, edit
|
|
|
49
49
|
return value ? (0, _dayjs.default)(value).format(format?.dateFormat ?? 'DD/MM/YYYY') : '';
|
|
50
50
|
case 'time':
|
|
51
51
|
const timeFormat = format?.timeFormat;
|
|
52
|
-
console.log('timeFormat', timeFormat);
|
|
53
52
|
const abc = (0, _utils.convertToDate)(value, timeFormat);
|
|
54
53
|
const timeValue = value ? (0, _dayjs.default)(abc).format(timeFormat ?? 'HH:mm') : '';
|
|
55
54
|
return timeValue ?? '';
|
|
@@ -715,7 +715,9 @@ function getColIdsBetween(table, a, b) {
|
|
|
715
715
|
}
|
|
716
716
|
function getRowIdsBetween(table, a, b) {
|
|
717
717
|
// const ids = table.getRowModel().rows.map(r => r.id);
|
|
718
|
-
const
|
|
718
|
+
const flatRows = table.getRowModel().flatRows;
|
|
719
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
720
|
+
const ids = allRows.map(r => r.id);
|
|
719
721
|
const [start, end] = [ids.indexOf(a), ids.indexOf(b)].sort((x, y) => x - y);
|
|
720
722
|
return ids.slice(start, end + 1);
|
|
721
723
|
}
|
|
@@ -1487,7 +1489,10 @@ const getSelectedCellMatrix = (table, startCell, endCell) => {
|
|
|
1487
1489
|
};
|
|
1488
1490
|
|
|
1489
1491
|
// const rowIds = table.getRowModel().rows.map(r => r.id);
|
|
1490
|
-
|
|
1492
|
+
|
|
1493
|
+
const flatRows = table.getRowModel().flatRows;
|
|
1494
|
+
const allRows = flatRows.filter((item, index, self) => index === self.findIndex(x => x.id === item.id));
|
|
1495
|
+
const rowIds = allRows.map(r => r.id);
|
|
1491
1496
|
const colIds = table.getVisibleLeafColumns().map(c => c.id);
|
|
1492
1497
|
|
|
1493
1498
|
// const colIds = table.getAllLeafColumns().map(c => c.id);
|
|
@@ -207,6 +207,8 @@ const InternalTable = props => {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
|
+
console.log('tableData', tableData);
|
|
211
|
+
console.log('isDataTree', isDataTree);
|
|
210
212
|
const table = (0, _reactTable.useReactTable)({
|
|
211
213
|
_features: [_operator.OperatorFeature],
|
|
212
214
|
data: tableData,
|
|
@@ -16,9 +16,10 @@ var _useColumns = require("../../table-component/hook/useColumns");
|
|
|
16
16
|
const renderCellIndex = props => {
|
|
17
17
|
const {
|
|
18
18
|
cell,
|
|
19
|
-
pagination
|
|
19
|
+
pagination,
|
|
20
|
+
isDataTree
|
|
20
21
|
} = props;
|
|
21
|
-
const parrents = cell.row.getParentRows();
|
|
22
|
+
const parrents = cell.row.parentId && isDataTree ? cell.row.getParentRows?.() : undefined;
|
|
22
23
|
if (parrents && parrents.length > 0) {
|
|
23
24
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
24
25
|
className: "ui-rc_cell-content"
|
|
@@ -257,10 +258,12 @@ const TableBodyCell = props => {
|
|
|
257
258
|
className: "ui-rc_cell-content"
|
|
258
259
|
}, renderCellIndex({
|
|
259
260
|
cell,
|
|
260
|
-
pagination
|
|
261
|
+
pagination,
|
|
262
|
+
isDataTree
|
|
261
263
|
})) : renderCellIndex({
|
|
262
264
|
cell,
|
|
263
|
-
pagination
|
|
265
|
+
pagination,
|
|
266
|
+
isDataTree
|
|
264
267
|
}));
|
|
265
268
|
}
|
|
266
269
|
if (cell.column.id === "command") {
|
|
@@ -320,8 +323,10 @@ const TableBodyCell = props => {
|
|
|
320
323
|
})));
|
|
321
324
|
}
|
|
322
325
|
const cellValue = cell.getValue();
|
|
326
|
+
const colFormat = typeof columnMeta.format === 'function' ? columnMeta.format(record) : columnMeta.format;
|
|
327
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
323
328
|
const rowIndex = cell.row.index;
|
|
324
|
-
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex,
|
|
329
|
+
const fomatedValue = (0, _useColumns.renderValueCell)(columnMeta, cellValue, record, rowIndex, colIndex, cellFormat, false);
|
|
325
330
|
const cellContent = columnMeta.template ? typeof columnMeta.template === 'function' ? columnMeta.template({
|
|
326
331
|
field: columnMeta.field,
|
|
327
332
|
index: cell.row.index,
|