react-table-edit 1.4.11 → 1.4.13
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/edit-form/index.d.ts +1 -10
- package/dist/component/select-table/index.d.ts +1 -22
- package/dist/component/table/header.d.ts +2 -1
- package/dist/component/table/key-handlers.d.ts +6 -4
- package/dist/component/type/index.d.ts +194 -2
- package/dist/index.d.ts +228 -67
- package/dist/index.js +63 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -41708,7 +41708,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
|
|
|
41708
41708
|
styleInject(css_248z$1);
|
|
41709
41709
|
|
|
41710
41710
|
const HeaderTableCol = (props) => {
|
|
41711
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent,
|
|
41711
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, column, setColumn, isMulti } = props;
|
|
41712
41712
|
const { t } = useTranslation();
|
|
41713
41713
|
const handleResize = (e, { size }) => {
|
|
41714
41714
|
// Update the column width here
|
|
@@ -41727,8 +41727,8 @@ const HeaderTableCol = (props) => {
|
|
|
41727
41727
|
};
|
|
41728
41728
|
return (jsx(Fragment, { children: col.visible !== false && (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: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : undefined, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classnames(`r-headercell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
41729
41729
|
top: `${indexParent * 42}px`,
|
|
41730
|
-
left: col.fixedType === 'left' ?
|
|
41731
|
-
right: col.fixedType === 'right' ?
|
|
41730
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[col.index ?? 0] : undefined,
|
|
41731
|
+
right: col.fixedType === 'right' ? objWidthFixRight[col.index ?? 0] : undefined,
|
|
41732
41732
|
width: col.width ? typeof col.width === 'number' ? col.width : col.width?.includes('px') || col.width?.includes('%') ? col.width : `${col.width}px` : 'auto',
|
|
41733
41733
|
minWidth: col.fixedType ? col.width : col.minWidth ? typeof col.minWidth === 'number' ? col.minWidth : col.minWidth?.includes('px') || col.minWidth?.includes('%') ? col.minWidth : `${col.minWidth}px` : 'auto',
|
|
41734
41734
|
maxWidth: col.fixedType ? col.width : col.maxWidth ? typeof col.maxWidth === 'number' ? col.maxWidth : col.maxWidth?.includes('px') || col.maxWidth?.includes('%') ? col.maxWidth : `${col.maxWidth}px` : 'auto'
|
|
@@ -42236,7 +42236,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
|
|
|
42236
42236
|
return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
|
|
42237
42237
|
}) }), jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42238
42238
|
return ((item.align === 'right') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
|
|
42239
|
-
}), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" })] }) })] }) })] })] }) }));
|
|
42239
|
+
}), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" })] }) })] }) })] })] }) }));
|
|
42240
42240
|
};
|
|
42241
42241
|
|
|
42242
42242
|
const handleArrowRight = (e, params) => {
|
|
@@ -42288,17 +42288,38 @@ const handleArrowUp = (e, params) => {
|
|
|
42288
42288
|
}
|
|
42289
42289
|
};
|
|
42290
42290
|
const handleArrowDown = (e, params) => {
|
|
42291
|
-
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
42292
|
-
|
|
42293
|
-
|
|
42294
|
-
|
|
42295
|
-
|
|
42291
|
+
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
|
|
42292
|
+
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
42293
|
+
if (indexRow < totalCount) {
|
|
42294
|
+
const column = contentColumns[indexCol - 1];
|
|
42295
|
+
for (let index = indexRow; index < totalCount; index++) {
|
|
42296
|
+
const element = dataSource[index];
|
|
42297
|
+
element[column.field ?? ''] = row[column.field ?? ''];
|
|
42298
|
+
if (column.callback && column.callbackValue) {
|
|
42299
|
+
const value = column.callbackValue(row);
|
|
42300
|
+
column.callback(value, index, element);
|
|
42301
|
+
}
|
|
42302
|
+
if (rowChange) {
|
|
42303
|
+
rowChange(element, indexRow, column.field);
|
|
42304
|
+
}
|
|
42305
|
+
}
|
|
42306
|
+
changeDataSource(dataSource);
|
|
42296
42307
|
}
|
|
42297
|
-
setIndexFocus(indexRow);
|
|
42298
|
-
focusNewElement(indexCol, indexRow + 1, true);
|
|
42299
42308
|
e.preventDefault();
|
|
42300
42309
|
return e.code;
|
|
42301
42310
|
}
|
|
42311
|
+
else {
|
|
42312
|
+
const element = document.getElementById(idElement);
|
|
42313
|
+
if (!isSelectMenuOpen(element) && indexRow < totalCount) {
|
|
42314
|
+
if (pagingClient && (indexRow % (pagingSetting?.pageSize ?? 0)) === 0 && pagingSetting?.setCurrentPage) {
|
|
42315
|
+
pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) + 1);
|
|
42316
|
+
}
|
|
42317
|
+
setIndexFocus(indexRow);
|
|
42318
|
+
focusNewElement(indexCol, indexRow + 1, true);
|
|
42319
|
+
e.preventDefault();
|
|
42320
|
+
return e.code;
|
|
42321
|
+
}
|
|
42322
|
+
}
|
|
42302
42323
|
};
|
|
42303
42324
|
const handleTab = (e, params) => {
|
|
42304
42325
|
const { indexCol, columnLastEdit, indexRow, totalCount, moveIndexRowToNewPage, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
@@ -42487,7 +42508,10 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42487
42508
|
const [levelCol, setLevelCol] = useState(0);
|
|
42488
42509
|
const [columnFistEdit, setColumnFistEdit] = useState(0);
|
|
42489
42510
|
const [columnLastEdit, setColumnlastEdit] = useState(0);
|
|
42490
|
-
const [
|
|
42511
|
+
const [objWidthFixRight, setObjWidthFixRight] = useState({});
|
|
42512
|
+
const [objWidthFixLeft, setObjWidthFixLeft] = useState({});
|
|
42513
|
+
const [lastObjWidthFixLeft, setLastObjWidthFixLeft] = useState(0);
|
|
42514
|
+
const [fisrtObjWidthFixRight, setFisrtObjWidthFixRight] = useState(0);
|
|
42491
42515
|
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
|
|
42492
42516
|
const [searchTerm, setSearchTerm] = useState('');
|
|
42493
42517
|
const tableElement = useRef(null);
|
|
@@ -42514,12 +42538,14 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42514
42538
|
headerColumns[0][index].fixedType = item.fixedType;
|
|
42515
42539
|
}
|
|
42516
42540
|
if (item.fixedType === 'left' && item.visible !== false) {
|
|
42517
|
-
|
|
42541
|
+
setLastObjWidthFixLeft(index);
|
|
42542
|
+
objWidthFixLeft[index] = letfWidthFix;
|
|
42518
42543
|
letfWidthFix += Number(item.width ?? 40);
|
|
42519
42544
|
}
|
|
42520
42545
|
const lasColumn = contentColumns[contentColumns.length - 1 - index];
|
|
42521
42546
|
if (lasColumn.fixedType === 'right' && lasColumn.visible !== false) {
|
|
42522
|
-
|
|
42547
|
+
setFisrtObjWidthFixRight(contentColumns.length - 1 - index);
|
|
42548
|
+
objWidthFixRight[contentColumns.length - 1 - index] = rightWidthFix;
|
|
42523
42549
|
rightWidthFix += Number(lasColumn.width ?? 40);
|
|
42524
42550
|
}
|
|
42525
42551
|
if (item.editEnable && (item.visible !== false) && (!item.disabledCondition)) {
|
|
@@ -42532,7 +42558,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42532
42558
|
if (levelCol === 1) {
|
|
42533
42559
|
setHeaderColumns([...headerColumns]);
|
|
42534
42560
|
}
|
|
42535
|
-
|
|
42561
|
+
setObjWidthFixLeft(objWidthFixLeft);
|
|
42562
|
+
setObjWidthFixRight(objWidthFixRight);
|
|
42536
42563
|
setColumnFistEdit(indexFirst + 1);
|
|
42537
42564
|
setColumnlastEdit(indexlast + 1);
|
|
42538
42565
|
}, [contentColumns]);
|
|
@@ -42670,9 +42697,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42670
42697
|
}
|
|
42671
42698
|
handleDataChange(row, col, indexRow);
|
|
42672
42699
|
}, dateFormat: "dd/MM/yyyy HH:mm", onKeyDown: (e) => {
|
|
42673
|
-
|
|
42674
|
-
return true;
|
|
42675
|
-
}
|
|
42700
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42676
42701
|
} }));
|
|
42677
42702
|
case 'select':
|
|
42678
42703
|
let valueSelect;
|
|
@@ -42718,7 +42743,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42718
42743
|
}
|
|
42719
42744
|
handleDataChange(row, col, indexRow);
|
|
42720
42745
|
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, invalid: (col.validate && !isNullOrUndefined$1(col.validate(row[col.field], row))), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', allowCreate: col.selectSettings?.allowCreate, onKeyDown: (e) => {
|
|
42721
|
-
|
|
42746
|
+
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42722
42747
|
}, onOpenMenu: () => {
|
|
42723
42748
|
if (col.selectSettings?.onOpenMenu) {
|
|
42724
42749
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
@@ -42774,7 +42799,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42774
42799
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
42775
42800
|
}
|
|
42776
42801
|
}, loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, fieldChildren: col.selectSettings?.fieldChild ?? 'children', selectChilds: col.selectSettings?.selectChilds, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, invalid: col.validate && col.validate(row[col.field], row), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', onKeyDown: (e) => {
|
|
42777
|
-
|
|
42802
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42778
42803
|
}, onPaste: (e) => {
|
|
42779
42804
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42780
42805
|
pasteDataFromExcel(indexRow, indexCol, e);
|
|
@@ -42789,7 +42814,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42789
42814
|
}
|
|
42790
42815
|
handleDataChange(row, col, indexRow);
|
|
42791
42816
|
}, onKeyDown: (e) => {
|
|
42792
|
-
|
|
42817
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42793
42818
|
} }));
|
|
42794
42819
|
case 'numeric':
|
|
42795
42820
|
const numericFormatProps = {
|
|
@@ -42939,6 +42964,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42939
42964
|
addDisable,
|
|
42940
42965
|
editDisable,
|
|
42941
42966
|
focusNewElement,
|
|
42967
|
+
changeDataSource,
|
|
42968
|
+
rowChange,
|
|
42942
42969
|
handleDuplicate: () => handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate),
|
|
42943
42970
|
idElement,
|
|
42944
42971
|
indexCol,
|
|
@@ -43208,16 +43235,16 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43208
43235
|
}, [selectedItem]);
|
|
43209
43236
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
43210
43237
|
if (col.field === 'command') {
|
|
43211
|
-
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43212
|
-
left: col.fixedType === 'left' ?
|
|
43213
|
-
right: col.fixedType === 'right' ?
|
|
43238
|
+
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43239
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43240
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43214
43241
|
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
43215
43242
|
}, children: jsx("div", { className: "r-rowcell-div command", children: jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row, setIndexFocus: setIndexFocus, indexFocus: indexFocus }) }) }, `col-${indexRow}-${indexCol}`));
|
|
43216
43243
|
}
|
|
43217
43244
|
else if (col.field === '#') {
|
|
43218
|
-
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43219
|
-
left: col.fixedType === 'left' ?
|
|
43220
|
-
right: col.fixedType === 'right' ?
|
|
43245
|
+
return (col.visible !== false && jsx("td", { className: classnames(`r-rowcell p-0 cursor-pointer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), tabIndex: Number(`${indexRow}${indexCol}`), style: {
|
|
43246
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43247
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43221
43248
|
textAlign: 'center',
|
|
43222
43249
|
}, onCopy: (e) => {
|
|
43223
43250
|
if (!editDisable && (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD')) {
|
|
@@ -43253,9 +43280,9 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43253
43280
|
}, children: jsx("div", { className: "r-rowcell-div", children: indexRow + 1 }) }, `col-${indexRow}-${indexCol}`));
|
|
43254
43281
|
}
|
|
43255
43282
|
else if (col.field === 'checkbox') {
|
|
43256
|
-
return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43257
|
-
left: col.fixedType === 'left' ?
|
|
43258
|
-
right: col.fixedType === 'right' ?
|
|
43283
|
+
return (jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43284
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43285
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43259
43286
|
}, children: jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
43260
43287
|
if (selectEnable) {
|
|
43261
43288
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
@@ -43293,9 +43320,9 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43293
43320
|
}
|
|
43294
43321
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
|
|
43295
43322
|
const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
|
|
43296
|
-
return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43297
|
-
left: col.fixedType === 'left' ?
|
|
43298
|
-
right: col.fixedType === 'right' ?
|
|
43323
|
+
return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'cell-fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43324
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43325
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43299
43326
|
}, onClick: (e) => {
|
|
43300
43327
|
if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
|
|
43301
43328
|
if (!editDisable && indexRow != indexFocus) {
|
|
@@ -43344,8 +43371,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43344
43371
|
const renderFooterCol = (col, indexCol) => {
|
|
43345
43372
|
const sumValue = (col.haveSum === true && col.editType === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
|
|
43346
43373
|
return (jsx(Fragment, { children: (col.visible !== false) && jsx("td", { className: classnames(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
43347
|
-
left: col.fixedType === 'left' ?
|
|
43348
|
-
right: col.fixedType === 'right' ?
|
|
43374
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43375
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43349
43376
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43350
43377
|
}, children: jsxs("div", { className: "r-footer-div", children: [col.haveSum === true && col.editType === "numeric" && (Number(sumValue) >= 0) && jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), col.haveSum === true && col.editType === "numeric" && (Number(sumValue) < 0) && jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ''}`] })] }) }) }, `summarycell-${indexCol}`));
|
|
43351
43378
|
};
|
|
@@ -43378,7 +43405,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43378
43405
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
43379
43406
|
return (jsxs(Fragment, { children: [jsxs("div", { className: "react-table-edit", children: [jsxs("div", { className: 'r-grid', ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, minHeight: `${minHeight ? `${minHeight}px` : ''}`, maxHeight: `${maxHeight ? `${maxHeight}px` : '400px'}` }, children: jsxs("table", { style: { width: '100%' }, children: [jsx("thead", { className: 'r-gridheader', children: headerColumns.map((element, indexParent) => {
|
|
43380
43407
|
return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43381
|
-
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false,
|
|
43408
|
+
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, column: contentColumns, setColumn: setContentColumns, totalCount: totalCount }, `header-${indexParent}-${index}`));
|
|
43382
43409
|
}) }, `header-${-indexParent}`));
|
|
43383
43410
|
}) }), jsx("tbody", { className: 'r-gridcontent', children: renderData() }), jsx("tfoot", { className: "r-gridfoot", children: haveSum == true ? jsx("tr", { className: 'r-row', children: contentColumns.map((col, index) => {
|
|
43384
43411
|
return (renderFooterCol(col, index));
|