react-table-edit 1.4.25 → 1.4.27
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/dist/component/table/button-handle.d.ts +1 -1
- package/dist/component/table/key-handlers.d.ts +1 -1
- package/dist/component/utils.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +49 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IFTableEditButton, IFTableEditPaging, IFTableEditToolbar } from "../type";
|
|
2
|
-
export declare const handleAdd: (dataSource: any[], tableElement: any,
|
|
2
|
+
export declare const handleAdd: (dataSource: any[], tableElement: any, indexFirstEdit: any, changeDataSource: (data: any[], numberOfRows?: number) => void, pagingSetting: {
|
|
3
3
|
setCurrentPage?: (page: number) => void;
|
|
4
4
|
pageSize?: number;
|
|
5
5
|
} | undefined, setIndexFocus: (item: number) => void, focusNewElement: (col: number, row: number, onLoad?: boolean) => void, numberOfRows?: number) => void;
|
|
@@ -47,6 +47,6 @@ export declare const calculateTableStructure: (columns: any[]) => {
|
|
|
47
47
|
fisrtObjWidthFixRight: number;
|
|
48
48
|
objHeaderWidthFixRight: Record<string, number>;
|
|
49
49
|
objHeaderWidthFixLeft: Record<string, number>;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
indexFirstEdit: number;
|
|
51
|
+
indexLastEdit: number;
|
|
52
52
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -518,8 +518,8 @@ declare const calculateTableStructure: (columns: any[]) => {
|
|
|
518
518
|
fisrtObjWidthFixRight: number;
|
|
519
519
|
objHeaderWidthFixRight: Record<string, number>;
|
|
520
520
|
objHeaderWidthFixLeft: Record<string, number>;
|
|
521
|
-
|
|
522
|
-
|
|
521
|
+
indexFirstEdit: number;
|
|
522
|
+
indexLastEdit: number;
|
|
523
523
|
};
|
|
524
524
|
|
|
525
525
|
type IFDataProps$1 = {
|
package/dist/index.js
CHANGED
|
@@ -19326,6 +19326,20 @@ const calculateTableStructure = (columns) => {
|
|
|
19326
19326
|
maxDepth = calculateDepth(columns);
|
|
19327
19327
|
let leftTotal = 0;
|
|
19328
19328
|
let rightTotal = 0;
|
|
19329
|
+
// Tính tổng width của các cột cố định phải
|
|
19330
|
+
const calcTotalRightWidth = (cols) => {
|
|
19331
|
+
cols.forEach(col => {
|
|
19332
|
+
if (col.columns?.length) {
|
|
19333
|
+
calcTotalRightWidth(col.columns);
|
|
19334
|
+
}
|
|
19335
|
+
else {
|
|
19336
|
+
if (col.fixedType === 'right' && col.visible !== false) {
|
|
19337
|
+
rightTotal += col.width ?? 40;
|
|
19338
|
+
}
|
|
19339
|
+
}
|
|
19340
|
+
});
|
|
19341
|
+
};
|
|
19342
|
+
calcTotalRightWidth(columns);
|
|
19329
19343
|
const traverse = (cols, level = 0) => {
|
|
19330
19344
|
levels[level] = levels[level] || [];
|
|
19331
19345
|
return cols.reduce((colspanSum, col, indexCol) => {
|
|
@@ -19339,9 +19353,6 @@ const calculateTableStructure = (columns) => {
|
|
|
19339
19353
|
};
|
|
19340
19354
|
levels[level].push(cell);
|
|
19341
19355
|
const headerKey = `${level}-${indexCol}`;
|
|
19342
|
-
if (col.fixedType === 'right' && col.visible !== false) {
|
|
19343
|
-
objHeaderWidthFixRight[headerKey] = rightTotal;
|
|
19344
|
-
}
|
|
19345
19356
|
if (col.fixedType === 'left' && col.visible !== false) {
|
|
19346
19357
|
objHeaderWidthFixLeft[headerKey] = leftTotal;
|
|
19347
19358
|
}
|
|
@@ -19355,10 +19366,13 @@ const calculateTableStructure = (columns) => {
|
|
|
19355
19366
|
leftTotal += width;
|
|
19356
19367
|
}
|
|
19357
19368
|
if (col.fixedType === 'right' && col.visible !== false) {
|
|
19369
|
+
rightTotal -= width;
|
|
19358
19370
|
objWidthFixRight[index] = rightTotal;
|
|
19359
|
-
rightTotal += width;
|
|
19360
19371
|
}
|
|
19361
19372
|
}
|
|
19373
|
+
if (col.fixedType === 'right' && col.visible !== false) {
|
|
19374
|
+
objHeaderWidthFixRight[headerKey] = rightTotal;
|
|
19375
|
+
}
|
|
19362
19376
|
return colspanSum + colspan;
|
|
19363
19377
|
}, 0);
|
|
19364
19378
|
};
|
|
@@ -19366,9 +19380,8 @@ const calculateTableStructure = (columns) => {
|
|
|
19366
19380
|
const flatVisble = flat.filter((e) => e.visible !== false);
|
|
19367
19381
|
const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
|
|
19368
19382
|
const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
|
|
19369
|
-
const
|
|
19370
|
-
const
|
|
19371
|
-
const lastEdit = editableColumns[editableColumns.length - 1];
|
|
19383
|
+
const indexFirstEdit = flat.findIndex((item) => item.editEnable && item.visible !== false && !item.disabledCondition) + 1;
|
|
19384
|
+
const indexLastEdit = flat.findLastIndex((item) => item.editEnable && item.visible !== false && !item.disabledCondition) + 1;
|
|
19372
19385
|
return {
|
|
19373
19386
|
levels,
|
|
19374
19387
|
flat,
|
|
@@ -19379,8 +19392,8 @@ const calculateTableStructure = (columns) => {
|
|
|
19379
19392
|
fisrtObjWidthFixRight,
|
|
19380
19393
|
objHeaderWidthFixRight,
|
|
19381
19394
|
objHeaderWidthFixLeft,
|
|
19382
|
-
|
|
19383
|
-
|
|
19395
|
+
indexFirstEdit,
|
|
19396
|
+
indexLastEdit
|
|
19384
19397
|
};
|
|
19385
19398
|
};
|
|
19386
19399
|
|
|
@@ -41852,7 +41865,6 @@ const HeaderTableCol$1 = (props) => {
|
|
|
41852
41865
|
const checkOverflow = () => {
|
|
41853
41866
|
return headerRef.current && headerRef.current.scrollHeight > headerRef.current.clientHeight;
|
|
41854
41867
|
};
|
|
41855
|
-
console.log(col);
|
|
41856
41868
|
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && (jsxRuntime.jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: false }, children: jsxRuntime.jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : 1, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classNames$1(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
|
|
41857
41869
|
top: `${indexParent * 42}px`,
|
|
41858
41870
|
left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
|
|
@@ -42354,7 +42366,7 @@ const RenderToolbarTop = ({ toolbarTopOption }) => {
|
|
|
42354
42366
|
}) })] }) }));
|
|
42355
42367
|
};
|
|
42356
42368
|
|
|
42357
|
-
const handleAdd = (dataSource, tableElement,
|
|
42369
|
+
const handleAdd = (dataSource, tableElement, indexFirstEdit,
|
|
42358
42370
|
/*eslint-disable*/
|
|
42359
42371
|
changeDataSource, pagingSetting, setIndexFocus, focusNewElement,
|
|
42360
42372
|
/*eslint-enable*/
|
|
@@ -42366,7 +42378,7 @@ numberOfRows) => {
|
|
|
42366
42378
|
}
|
|
42367
42379
|
if (tableElement) {
|
|
42368
42380
|
setIndexFocus(lengthData);
|
|
42369
|
-
focusNewElement(
|
|
42381
|
+
focusNewElement(indexFirstEdit, lengthData + 1, true);
|
|
42370
42382
|
}
|
|
42371
42383
|
};
|
|
42372
42384
|
const handleDuplicate = async (dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey,
|
|
@@ -42564,8 +42576,8 @@ const handleArrowDown = (e, params) => {
|
|
|
42564
42576
|
}
|
|
42565
42577
|
};
|
|
42566
42578
|
const handleTab = (e, params) => {
|
|
42567
|
-
const { indexCol,
|
|
42568
|
-
if (indexCol ===
|
|
42579
|
+
const { indexCol, indexLastEdit, indexRow, totalCount, moveIndexRowToNewPage, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
42580
|
+
if (indexCol === indexLastEdit) {
|
|
42569
42581
|
if (indexRow === totalCount) {
|
|
42570
42582
|
moveIndexRowToNewPage();
|
|
42571
42583
|
}
|
|
@@ -42768,7 +42780,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42768
42780
|
pagingSetting.setCurrentPage(1);
|
|
42769
42781
|
}
|
|
42770
42782
|
}, [dataSource]);
|
|
42771
|
-
const { levels: headerColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight,
|
|
42783
|
+
const { levels: headerColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit: indexFirstEdit, indexLastEdit: indexLastEdit } = React$5.useMemo(() => {
|
|
42772
42784
|
const obj = calculateTableStructure(columns);
|
|
42773
42785
|
setContentColumns(obj.flat);
|
|
42774
42786
|
return obj;
|
|
@@ -43084,10 +43096,10 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43084
43096
|
}
|
|
43085
43097
|
}
|
|
43086
43098
|
if ((tableElement.current?.scrollHeight ?? 0) > 0) {
|
|
43087
|
-
if ((tableElement.current?.scrollTop ?? 0) > ((row - 1) % (pagingSetting?.pageSize ??
|
|
43088
|
-
tableElement.current?.scrollTo({ behavior: 'smooth', top: ((row - 1) % (pagingSetting?.pageSize ??
|
|
43099
|
+
if ((tableElement.current?.scrollTop ?? 0) > ((row - 1) % (pagingSetting?.pageSize ?? 10000)) * 34) {
|
|
43100
|
+
tableElement.current?.scrollTo({ behavior: 'smooth', top: ((row - 1) % (pagingSetting?.pageSize ?? 10000)) * 34 });
|
|
43089
43101
|
}
|
|
43090
|
-
else if (((tableElement.current?.clientHeight ?? 0) - (haveSum ? 30 : 0) - (headerColumns.length * 42)) < (((row % (pagingSetting?.pageSize ??
|
|
43102
|
+
else if (((tableElement.current?.clientHeight ?? 0) - (haveSum ? 30 : 0) - (headerColumns.length * 42)) < (((row % (pagingSetting?.pageSize ?? 10000)) * 34) - (tableElement.current?.scrollTop ?? 0))) {
|
|
43091
43103
|
tableElement.current?.scrollTo({ behavior: 'smooth', top: (tableElement.current?.scrollTop ?? 0) + 34 });
|
|
43092
43104
|
}
|
|
43093
43105
|
}
|
|
@@ -43102,13 +43114,13 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43102
43114
|
}
|
|
43103
43115
|
if (tableElement) {
|
|
43104
43116
|
setIndexFocus(totalCount);
|
|
43105
|
-
focusNewElement(
|
|
43117
|
+
focusNewElement(indexFirstEdit, totalCount + 1, true);
|
|
43106
43118
|
}
|
|
43107
43119
|
};
|
|
43108
43120
|
const checkKeyDown = (e, row, col, indexRow, indexCol) => {
|
|
43109
43121
|
const idElement = `${idTable}-col${indexCol}-row${indexRow}`;
|
|
43110
43122
|
const params = {
|
|
43111
|
-
|
|
43123
|
+
indexLastEdit,
|
|
43112
43124
|
contentColumns,
|
|
43113
43125
|
dataSource,
|
|
43114
43126
|
addDisable,
|
|
@@ -43397,14 +43409,14 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43397
43409
|
}, [selectedItem]);
|
|
43398
43410
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
43399
43411
|
if (col.field === 'command') {
|
|
43400
|
-
return (col.visible !== false && jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43412
|
+
return (col.visible !== false && jsxRuntime.jsx("td", { role: "gridcell", "aria-colindex": indexCol, className: classNames$1(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43401
43413
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43402
43414
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43403
43415
|
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
43404
43416
|
}, children: jsxRuntime.jsx("div", { className: "r-rowcell-div command", children: jsxRuntime.jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row, setIndexFocus: setIndexFocus, indexFocus: indexFocus }) }) }, `col-${indexRow}-${indexCol}`));
|
|
43405
43417
|
}
|
|
43406
43418
|
else if (col.field === '#') {
|
|
43407
|
-
return (col.visible !== false && jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43419
|
+
return (col.visible !== false && jsxRuntime.jsx("td", { role: "gridcell", "aria-colindex": indexCol, className: classNames$1(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43408
43420
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43409
43421
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43410
43422
|
textAlign: 'center',
|
|
@@ -43442,7 +43454,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43442
43454
|
}, children: jsxRuntime.jsx("div", { className: "r-rowcell-div", children: indexRow + 1 }) }, `col-${indexRow}-${indexCol}`));
|
|
43443
43455
|
}
|
|
43444
43456
|
else if (col.field === 'checkbox') {
|
|
43445
|
-
return (jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43457
|
+
return (jsxRuntime.jsx("td", { role: "gridcell", "aria-colindex": indexCol, className: classNames$1(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43446
43458
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43447
43459
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43448
43460
|
}, children: jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
@@ -43482,7 +43494,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43482
43494
|
}
|
|
43483
43495
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
|
|
43484
43496
|
const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
|
|
43485
|
-
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43497
|
+
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && jsxRuntime.jsx("td", { role: "gridcell", "aria-colindex": indexCol, className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43486
43498
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43487
43499
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43488
43500
|
}, onClick: (e) => {
|
|
@@ -43580,22 +43592,12 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43580
43592
|
});
|
|
43581
43593
|
return isFilterMatch && isSearchMatch;
|
|
43582
43594
|
}
|
|
43583
|
-
const renderData = () => {
|
|
43584
|
-
return (dataSource.map((row, indexRow) => {
|
|
43585
|
-
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
43586
|
-
const flagSearch = checkRowMatch(row, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []);
|
|
43587
|
-
if (flagSearch) {
|
|
43588
|
-
const flagDisplay = !pagingClient || ((indexRow + 1) > ((pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1)) && (indexRow + 1) <= ((pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0))));
|
|
43589
|
-
return (flagDisplay && jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("tr", { className: classNames$1('r-row'), children: contentColumns.map((col, indexCol) => renderContentCol(col, row, indexRow, indexCol, isSelected)) }, `row-${indexRow}`) }));
|
|
43590
|
-
}
|
|
43591
|
-
}));
|
|
43592
|
-
};
|
|
43593
43595
|
React$5.useEffect(() => {
|
|
43594
43596
|
if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) {
|
|
43595
43597
|
pagingSetting?.setCurrentPage(1);
|
|
43596
43598
|
}
|
|
43597
43599
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
43598
|
-
return (jsxRuntime.jsxs(React$5.Fragment, { children: [jsxRuntime.jsxs("div", { className: "react-table-edit", children: [jsxRuntime.jsxs("div", { className: 'r-grid', ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsx("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, minHeight: `${minHeight ? `${minHeight}px` : ''}`, maxHeight: `${maxHeight ? `${maxHeight}px` : '400px'}` }, children: jsxRuntime.jsxs("table", { style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', children: headerColumns.map((element, indexParent) => {
|
|
43600
|
+
return (jsxRuntime.jsxs(React$5.Fragment, { children: [jsxRuntime.jsxs("div", { className: "react-table-edit", children: [jsxRuntime.jsxs("div", { className: 'r-grid', ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsx("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, minHeight: `${minHeight ? `${minHeight}px` : ''}`, maxHeight: `${maxHeight ? `${maxHeight}px` : '400px'}` }, children: jsxRuntime.jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((element, indexParent) => {
|
|
43599
43601
|
return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43600
43602
|
return (jsxRuntime.jsx(HeaderTableCol$1, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: tableElement, filterBy: filterBy, orderBy: orderBy, optionsFilter: optionsFilter, allowFilter: allowFilter, allowOrder: allowOrder, formatSetting: formatSetting, changeFilter: (val) => {
|
|
43601
43603
|
setFilterBy([...val]);
|
|
@@ -43603,10 +43605,17 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43603
43605
|
setOrderBy([...val]);
|
|
43604
43606
|
}, columns: contentColumns, setColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: totalCount }, `header-${indexParent}-${index}`));
|
|
43605
43607
|
}) }, `header-${-indexParent}`));
|
|
43606
|
-
}) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent',
|
|
43608
|
+
}) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent', role: "rowgroup", children: dataSource.map((row, indexRow) => {
|
|
43609
|
+
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
43610
|
+
const flagSearch = checkRowMatch(row, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []);
|
|
43611
|
+
if (flagSearch) {
|
|
43612
|
+
const flagDisplay = !pagingClient || ((indexRow + 1) > ((pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1)) && (indexRow + 1) <= ((pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0))));
|
|
43613
|
+
return (flagDisplay && jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row'), children: contentColumns.map((col, indexCol) => renderContentCol(col, row, indexRow, indexCol, isSelected)) }, `row-${indexRow}`) }));
|
|
43614
|
+
}
|
|
43615
|
+
}) }), jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: haveSum == true ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, index) => {
|
|
43607
43616
|
return (renderFooterCol(col, index));
|
|
43608
43617
|
}) }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) })] }) }), toolbarSetting?.showBottomToolbar && jsxRuntime.jsx(ToolbarBottom, { handleAdd: (numberOfRows) => {
|
|
43609
|
-
handleAdd(dataSource, tableElement.current,
|
|
43618
|
+
handleAdd(dataSource, tableElement.current, indexFirstEdit, changeDataSource, pagingSetting, setIndexFocus, focusNewElement, numberOfRows);
|
|
43610
43619
|
}, handleDuplicate: () => {
|
|
43611
43620
|
handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
|
|
43612
43621
|
}, handleInsertAfter: () => {
|
|
@@ -65808,7 +65817,7 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
|
|
|
65808
65817
|
}
|
|
65809
65818
|
}
|
|
65810
65819
|
};
|
|
65811
|
-
return (jsxRuntime.jsxs("div", { className: "react-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", onScroll: handleScroll, style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', children: headerColumns.map((rowColumn, indexParent) => (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsxRuntime.jsx(HeaderTableCol, { idTable: idTable, col: column, dataSource: dataSource, indexCol: indexColumn, indexParent: indexParent, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, columns: contentColumns, setColumns: setColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, orderBy: orderBy, allowFilter: allowFilter, allowOrder: allowOrder, filterBy: filterBy, optionsFilter: optionsFilter, changeFilter: (val) => {
|
|
65820
|
+
return (jsxRuntime.jsxs("div", { className: "react-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", onScroll: handleScroll, style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsxRuntime.jsx(HeaderTableCol, { idTable: idTable, col: column, dataSource: dataSource, indexCol: indexColumn, indexParent: indexParent, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, columns: contentColumns, setColumns: setColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, orderBy: orderBy, allowFilter: allowFilter, allowOrder: allowOrder, filterBy: filterBy, optionsFilter: optionsFilter, changeFilter: (val) => {
|
|
65812
65821
|
setFilterBy([...val]);
|
|
65813
65822
|
if (changeFilter) {
|
|
65814
65823
|
changeFilter(val);
|
|
@@ -65818,10 +65827,10 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
|
|
|
65818
65827
|
if (changeOrder) {
|
|
65819
65828
|
changeOrder(val);
|
|
65820
65829
|
}
|
|
65821
|
-
}, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, indexParent))) }), jsxRuntime.jsxs("tbody", { className: 'r-gridcontent', children: [adjustedStartIndex > 0 && (jsxRuntime.jsx("tr", { style: { height: adjustedStartIndex * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) })), visibleData.map((row, index) => {
|
|
65830
|
+
}, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxRuntime.jsxs("tbody", { className: 'r-gridcontent', role: "rowgroup", children: [adjustedStartIndex > 0 && (jsxRuntime.jsx("tr", { style: { height: adjustedStartIndex * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) })), visibleData.map((row, index) => {
|
|
65822
65831
|
const indexRow = index + startIndex;
|
|
65823
65832
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
65824
|
-
return (jsxRuntime.jsx("tr", { className:
|
|
65833
|
+
return (jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: 'r-row', children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: 'field', objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, handleCommandClick: handleCommandClick, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row }, indexCol))) }, `row-content-${indexRow}`));
|
|
65825
65834
|
}), dataSource.length > adjustedEndIndex && (jsxRuntime.jsx("tr", { style: { height: (dataSource.length - adjustedEndIndex) * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) }))] }), dataSource.length > 0 && jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
|
|
65826
65835
|
const item = columnsAggregate?.find((x) => x.field === col.field);
|
|
65827
65836
|
let sumValue = item?.value;
|