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.js
CHANGED
|
@@ -41736,7 +41736,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
|
|
|
41736
41736
|
styleInject(css_248z$1);
|
|
41737
41737
|
|
|
41738
41738
|
const HeaderTableCol = (props) => {
|
|
41739
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent,
|
|
41739
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, column, setColumn, isMulti } = props;
|
|
41740
41740
|
const { t } = reactI18next.useTranslation();
|
|
41741
41741
|
const handleResize = (e, { size }) => {
|
|
41742
41742
|
// Update the column width here
|
|
@@ -41755,8 +41755,8 @@ const HeaderTableCol = (props) => {
|
|
|
41755
41755
|
};
|
|
41756
41756
|
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 : undefined, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classnames(`r-headercell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
41757
41757
|
top: `${indexParent * 42}px`,
|
|
41758
|
-
left: col.fixedType === 'left' ?
|
|
41759
|
-
right: col.fixedType === 'right' ?
|
|
41758
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[col.index ?? 0] : undefined,
|
|
41759
|
+
right: col.fixedType === 'right' ? objWidthFixRight[col.index ?? 0] : undefined,
|
|
41760
41760
|
width: col.width ? typeof col.width === 'number' ? col.width : col.width?.includes('px') || col.width?.includes('%') ? col.width : `${col.width}px` : 'auto',
|
|
41761
41761
|
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',
|
|
41762
41762
|
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'
|
|
@@ -42264,7 +42264,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
|
|
|
42264
42264
|
return ((item.align === 'center') ? jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
|
|
42265
42265
|
}) }), jsxRuntime.jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42266
42266
|
return ((item.align === 'right') ? jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
|
|
42267
|
-
}), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.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" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.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" }), jsxRuntime.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" })] }) })] }) })] })] }) }));
|
|
42267
|
+
}), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.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" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.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" }), jsxRuntime.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" }), jsxRuntime.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" })] }) })] }) })] })] }) }));
|
|
42268
42268
|
};
|
|
42269
42269
|
|
|
42270
42270
|
const handleArrowRight = (e, params) => {
|
|
@@ -42316,17 +42316,38 @@ const handleArrowUp = (e, params) => {
|
|
|
42316
42316
|
}
|
|
42317
42317
|
};
|
|
42318
42318
|
const handleArrowDown = (e, params) => {
|
|
42319
|
-
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
42320
|
-
|
|
42321
|
-
|
|
42322
|
-
|
|
42323
|
-
|
|
42319
|
+
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
|
|
42320
|
+
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
42321
|
+
if (indexRow < totalCount) {
|
|
42322
|
+
const column = contentColumns[indexCol - 1];
|
|
42323
|
+
for (let index = indexRow; index < totalCount; index++) {
|
|
42324
|
+
const element = dataSource[index];
|
|
42325
|
+
element[column.field ?? ''] = row[column.field ?? ''];
|
|
42326
|
+
if (column.callback && column.callbackValue) {
|
|
42327
|
+
const value = column.callbackValue(row);
|
|
42328
|
+
column.callback(value, index, element);
|
|
42329
|
+
}
|
|
42330
|
+
if (rowChange) {
|
|
42331
|
+
rowChange(element, indexRow, column.field);
|
|
42332
|
+
}
|
|
42333
|
+
}
|
|
42334
|
+
changeDataSource(dataSource);
|
|
42324
42335
|
}
|
|
42325
|
-
setIndexFocus(indexRow);
|
|
42326
|
-
focusNewElement(indexCol, indexRow + 1, true);
|
|
42327
42336
|
e.preventDefault();
|
|
42328
42337
|
return e.code;
|
|
42329
42338
|
}
|
|
42339
|
+
else {
|
|
42340
|
+
const element = document.getElementById(idElement);
|
|
42341
|
+
if (!isSelectMenuOpen(element) && indexRow < totalCount) {
|
|
42342
|
+
if (pagingClient && (indexRow % (pagingSetting?.pageSize ?? 0)) === 0 && pagingSetting?.setCurrentPage) {
|
|
42343
|
+
pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) + 1);
|
|
42344
|
+
}
|
|
42345
|
+
setIndexFocus(indexRow);
|
|
42346
|
+
focusNewElement(indexCol, indexRow + 1, true);
|
|
42347
|
+
e.preventDefault();
|
|
42348
|
+
return e.code;
|
|
42349
|
+
}
|
|
42350
|
+
}
|
|
42330
42351
|
};
|
|
42331
42352
|
const handleTab = (e, params) => {
|
|
42332
42353
|
const { indexCol, columnLastEdit, indexRow, totalCount, moveIndexRowToNewPage, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
@@ -42515,7 +42536,10 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42515
42536
|
const [levelCol, setLevelCol] = React$5.useState(0);
|
|
42516
42537
|
const [columnFistEdit, setColumnFistEdit] = React$5.useState(0);
|
|
42517
42538
|
const [columnLastEdit, setColumnlastEdit] = React$5.useState(0);
|
|
42518
|
-
const [
|
|
42539
|
+
const [objWidthFixRight, setObjWidthFixRight] = React$5.useState({});
|
|
42540
|
+
const [objWidthFixLeft, setObjWidthFixLeft] = React$5.useState({});
|
|
42541
|
+
const [lastObjWidthFixLeft, setLastObjWidthFixLeft] = React$5.useState(0);
|
|
42542
|
+
const [fisrtObjWidthFixRight, setFisrtObjWidthFixRight] = React$5.useState(0);
|
|
42519
42543
|
const [openPopupSetupColumn, setOpenPopupSetupColumn] = React$5.useState(false);
|
|
42520
42544
|
const [searchTerm, setSearchTerm] = React$5.useState('');
|
|
42521
42545
|
const tableElement = React$5.useRef(null);
|
|
@@ -42542,12 +42566,14 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42542
42566
|
headerColumns[0][index].fixedType = item.fixedType;
|
|
42543
42567
|
}
|
|
42544
42568
|
if (item.fixedType === 'left' && item.visible !== false) {
|
|
42545
|
-
|
|
42569
|
+
setLastObjWidthFixLeft(index);
|
|
42570
|
+
objWidthFixLeft[index] = letfWidthFix;
|
|
42546
42571
|
letfWidthFix += Number(item.width ?? 40);
|
|
42547
42572
|
}
|
|
42548
42573
|
const lasColumn = contentColumns[contentColumns.length - 1 - index];
|
|
42549
42574
|
if (lasColumn.fixedType === 'right' && lasColumn.visible !== false) {
|
|
42550
|
-
|
|
42575
|
+
setFisrtObjWidthFixRight(contentColumns.length - 1 - index);
|
|
42576
|
+
objWidthFixRight[contentColumns.length - 1 - index] = rightWidthFix;
|
|
42551
42577
|
rightWidthFix += Number(lasColumn.width ?? 40);
|
|
42552
42578
|
}
|
|
42553
42579
|
if (item.editEnable && (item.visible !== false) && (!item.disabledCondition)) {
|
|
@@ -42560,7 +42586,8 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42560
42586
|
if (levelCol === 1) {
|
|
42561
42587
|
setHeaderColumns([...headerColumns]);
|
|
42562
42588
|
}
|
|
42563
|
-
|
|
42589
|
+
setObjWidthFixLeft(objWidthFixLeft);
|
|
42590
|
+
setObjWidthFixRight(objWidthFixRight);
|
|
42564
42591
|
setColumnFistEdit(indexFirst + 1);
|
|
42565
42592
|
setColumnlastEdit(indexlast + 1);
|
|
42566
42593
|
}, [contentColumns]);
|
|
@@ -42698,9 +42725,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42698
42725
|
}
|
|
42699
42726
|
handleDataChange(row, col, indexRow);
|
|
42700
42727
|
}, dateFormat: "dd/MM/yyyy HH:mm", onKeyDown: (e) => {
|
|
42701
|
-
|
|
42702
|
-
return true;
|
|
42703
|
-
}
|
|
42728
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42704
42729
|
} }));
|
|
42705
42730
|
case 'select':
|
|
42706
42731
|
let valueSelect;
|
|
@@ -42746,7 +42771,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42746
42771
|
}
|
|
42747
42772
|
handleDataChange(row, col, indexRow);
|
|
42748
42773
|
}, 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) => {
|
|
42749
|
-
|
|
42774
|
+
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42750
42775
|
}, onOpenMenu: () => {
|
|
42751
42776
|
if (col.selectSettings?.onOpenMenu) {
|
|
42752
42777
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
@@ -42802,7 +42827,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42802
42827
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
42803
42828
|
}
|
|
42804
42829
|
}, 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) => {
|
|
42805
|
-
|
|
42830
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42806
42831
|
}, onPaste: (e) => {
|
|
42807
42832
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42808
42833
|
pasteDataFromExcel(indexRow, indexCol, e);
|
|
@@ -42817,7 +42842,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42817
42842
|
}
|
|
42818
42843
|
handleDataChange(row, col, indexRow);
|
|
42819
42844
|
}, onKeyDown: (e) => {
|
|
42820
|
-
|
|
42845
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42821
42846
|
} }));
|
|
42822
42847
|
case 'numeric':
|
|
42823
42848
|
const numericFormatProps = {
|
|
@@ -42967,6 +42992,8 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
42967
42992
|
addDisable,
|
|
42968
42993
|
editDisable,
|
|
42969
42994
|
focusNewElement,
|
|
42995
|
+
changeDataSource,
|
|
42996
|
+
rowChange,
|
|
42970
42997
|
handleDuplicate: () => handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate),
|
|
42971
42998
|
idElement,
|
|
42972
42999
|
indexCol,
|
|
@@ -43236,16 +43263,16 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43236
43263
|
}, [selectedItem]);
|
|
43237
43264
|
const renderContentCol = (col, row, indexRow, indexCol, isSelected) => {
|
|
43238
43265
|
if (col.field === 'command') {
|
|
43239
|
-
return (col.visible !== false && jsxRuntime.jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43240
|
-
left: col.fixedType === 'left' ?
|
|
43241
|
-
right: col.fixedType === 'right' ?
|
|
43266
|
+
return (col.visible !== false && jsxRuntime.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: {
|
|
43267
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43268
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43242
43269
|
textAlign: col.textAlign ? col.textAlign : 'left',
|
|
43243
43270
|
}, 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}`));
|
|
43244
43271
|
}
|
|
43245
43272
|
else if (col.field === '#') {
|
|
43246
|
-
return (col.visible !== false && jsxRuntime.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: {
|
|
43247
|
-
left: col.fixedType === 'left' ?
|
|
43248
|
-
right: col.fixedType === 'right' ?
|
|
43273
|
+
return (col.visible !== false && jsxRuntime.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: {
|
|
43274
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43275
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43249
43276
|
textAlign: 'center',
|
|
43250
43277
|
}, onCopy: (e) => {
|
|
43251
43278
|
if (!editDisable && (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD')) {
|
|
@@ -43281,9 +43308,9 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43281
43308
|
}, children: jsxRuntime.jsx("div", { className: "r-rowcell-div", children: indexRow + 1 }) }, `col-${indexRow}-${indexCol}`));
|
|
43282
43309
|
}
|
|
43283
43310
|
else if (col.field === 'checkbox') {
|
|
43284
|
-
return (jsxRuntime.jsx("td", { className: classnames(`r-rowcell p-0 fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43285
|
-
left: col.fixedType === 'left' ?
|
|
43286
|
-
right: col.fixedType === 'right' ?
|
|
43311
|
+
return (jsxRuntime.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: {
|
|
43312
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43313
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43287
43314
|
}, children: jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
43288
43315
|
if (selectEnable) {
|
|
43289
43316
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
@@ -43321,9 +43348,9 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43321
43348
|
}
|
|
43322
43349
|
const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
|
|
43323
43350
|
const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
|
|
43324
|
-
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && jsxRuntime.jsx("td", { className: classnames(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': (isSelected && editDisable) || indexFocus === indexRow }), style: {
|
|
43325
|
-
left: col.fixedType === 'left' ?
|
|
43326
|
-
right: col.fixedType === 'right' ?
|
|
43351
|
+
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && jsxRuntime.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: {
|
|
43352
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43353
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43327
43354
|
}, onClick: (e) => {
|
|
43328
43355
|
if (e.target.nodeName === 'DIV' || e.target.nodeName === 'TD') {
|
|
43329
43356
|
if (!editDisable && indexRow != indexFocus) {
|
|
@@ -43372,8 +43399,8 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43372
43399
|
const renderFooterCol = (col, indexCol) => {
|
|
43373
43400
|
const sumValue = (col.haveSum === true && col.editType === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
|
|
43374
43401
|
return (jsxRuntime.jsx(React$5.Fragment, { children: (col.visible !== false) && jsxRuntime.jsx("td", { className: classnames(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
43375
|
-
left: col.fixedType === 'left' ?
|
|
43376
|
-
right: col.fixedType === 'right' ?
|
|
43402
|
+
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
43403
|
+
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
43377
43404
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
43378
43405
|
}, children: jsxRuntime.jsxs("div", { className: "r-footer-div", children: [col.haveSum === true && col.editType === "numeric" && (Number(sumValue) >= 0) && jsxRuntime.jsx(jsxRuntime.Fragment, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), col.haveSum === true && col.editType === "numeric" && (Number(sumValue) < 0) && jsxRuntime.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}`));
|
|
43379
43406
|
};
|
|
@@ -43406,7 +43433,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43406
43433
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
43407
43434
|
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("thead", { className: 'r-gridheader', children: headerColumns.map((element, indexParent) => {
|
|
43408
43435
|
return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43409
|
-
return (jsxRuntime.jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false,
|
|
43436
|
+
return (jsxRuntime.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}`));
|
|
43410
43437
|
}) }, `header-${-indexParent}`));
|
|
43411
43438
|
}) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent', children: renderData() }), jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: haveSum == true ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, index) => {
|
|
43412
43439
|
return (renderFooterCol(col, index));
|