react-table-edit 1.4.27 → 1.4.28

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/index.mjs CHANGED
@@ -19278,7 +19278,7 @@ const FindNodeByPath = (tree, path) => {
19278
19278
  * @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
19279
19279
  * @returns {
19280
19280
  * levels: IHeaderColumnTable[][] // Các hàng header theo cấp
19281
- * flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
19281
+ * flat: IColumnTable[] // Danh sách cột phẳng
19282
19282
  * objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
19283
19283
  * objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
19284
19284
  * lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
@@ -23540,7 +23540,7 @@ const SidebarSetColumn = (props) => {
23540
23540
  }) }) }), jsx("tbody", { className: 'r-gridcontent', children: dataSource?.map((row, indexRow) => {
23541
23541
  return (jsx("tr", { className: classNames$1('r-row', { 'last-row': indexRow === dataSource.length - 1 }, { 'fisrt-row': indexRow === 0 }), children: columns.map((col, indexCol) => {
23542
23542
  let value = row[col.field];
23543
- if (col.editType === 'numeric' || (col.editTypeCondition && col.editTypeCondition(row) === 'numeric')) {
23543
+ if (col.type === 'numeric' || (col.typeCondition && col.typeCondition(row) === 'numeric')) {
23544
23544
  value = formartNumberic(row[col.field], ',', '.', col.numericSettings?.fraction, true) ?? 0;
23545
23545
  }
23546
23546
  return (jsx(Fragment, { children: col.visible !== false && jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'r-active': indexFocus === indexRow }), style: {
@@ -41876,7 +41876,7 @@ const HeaderTableCol$1 = (props) => {
41876
41876
  };
41877
41877
  const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy, setOpenFilter, changeFilter, column }) => {
41878
41878
  const { t } = useTranslation();
41879
- const [operator, setOperator] = useState(filter?.ope ?? ((!column.filterType && column.editType === 'numeric') || column.filterType === 'select' ? 'equal' : 'contains'));
41879
+ const [operator, setOperator] = useState(filter?.ope ?? ((!column.filterType && column.type === 'numeric') || column.filterType === 'select' ? 'equal' : 'contains'));
41880
41880
  const [valueFilter, setValueFilter] = useState(filter?.value ?? '');
41881
41881
  const RenderStringFilter = () => {
41882
41882
  const options = [
@@ -41941,7 +41941,7 @@ const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy,
41941
41941
  handleSave();
41942
41942
  e.stopPropagation();
41943
41943
  }
41944
- }, children: [((!column.filterType && column.editType === 'numeric') || column.filterType === 'numeric') ? jsxs(Fragment$1, { children: [RenderNumberFilter(), " "] }) : (column.filterType === 'select' ? jsxs(Fragment$1, { children: [RenderSelectFilter(), " "] }) : RenderStringFilter()), jsxs("div", { className: 'd-flex justify-content-end', children: [jsx(Button$1, { color: 'primary', style: { borderRadius: 3 }, className: 'me-50 py-25 px-50 fw-bold', onClick: handleSave, children: t('Filter') }), jsx(Button$1, { className: 'py-25 px-50 fw-bold', color: 'white', style: { borderRadius: 3, borderWidth: 0 }, onClick: () => {
41944
+ }, children: [((!column.filterType && column.type === 'numeric') || column.filterType === 'numeric') ? jsxs(Fragment$1, { children: [RenderNumberFilter(), " "] }) : (column.filterType === 'select' ? jsxs(Fragment$1, { children: [RenderSelectFilter(), " "] }) : RenderStringFilter()), jsxs("div", { className: 'd-flex justify-content-end', children: [jsx(Button$1, { color: 'primary', style: { borderRadius: 3 }, className: 'me-50 py-25 px-50 fw-bold', onClick: handleSave, children: t('Filter') }), jsx(Button$1, { className: 'py-25 px-50 fw-bold', color: 'white', style: { borderRadius: 3, borderWidth: 0 }, onClick: () => {
41945
41945
  if (filterBy) {
41946
41946
  changeFilter(filterBy.filter((x) => x.key !== column.field));
41947
41947
  }
@@ -42800,7 +42800,7 @@ const TableEdit = forwardRef((props, ref) => {
42800
42800
  }
42801
42801
  const RenderEditCell = (row, col, indexCol, indexRow) => {
42802
42802
  /*eslint-disable */
42803
- switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
42803
+ switch (col?.typeCondition ? col?.typeCondition(row) : col.type) {
42804
42804
  case 'date':
42805
42805
  return (jsx(DateInput, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, className: classNames$1('form-control border-0 rounded-0 input-numeric', { 'is-invalid': col.validate && col.validate(row[col.field], row) }), value: row[col.field], onChange: (date) => {
42806
42806
  row[col.field] = date ? new Date(date.getTime() + 7 * 60 * 60 * 1000) : undefined;
@@ -43213,7 +43213,7 @@ const TableEdit = forwardRef((props, ref) => {
43213
43213
  }
43214
43214
  }
43215
43215
  else {
43216
- if (column.editType === 'date') {
43216
+ if (column.type === 'date') {
43217
43217
  const [day, month, year] = stringData.split('/');
43218
43218
  const date = new Date(`${year}-${month}-${day}`);
43219
43219
  if (!isNaN(date.getTime())) {
@@ -43231,7 +43231,7 @@ const TableEdit = forwardRef((props, ref) => {
43231
43231
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43232
43232
  }
43233
43233
  }
43234
- else if (column.editType === 'datetime') {
43234
+ else if (column.type === 'datetime') {
43235
43235
  const [datePart, timePart] = stringData.split(' ');
43236
43236
  const [day, month, year] = datePart.split('/');
43237
43237
  const [hour, minute] = timePart.split(':');
@@ -43251,7 +43251,7 @@ const TableEdit = forwardRef((props, ref) => {
43251
43251
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43252
43252
  }
43253
43253
  }
43254
- else if (column.editType === 'numeric') {
43254
+ else if (column.type === 'numeric') {
43255
43255
  const number = Number(stringData);
43256
43256
  if (!isNaN(number)) {
43257
43257
  if (column.onPaste) {
@@ -43268,7 +43268,7 @@ const TableEdit = forwardRef((props, ref) => {
43268
43268
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43269
43269
  }
43270
43270
  }
43271
- else if (column.editType === 'select') {
43271
+ else if (column.type === 'select') {
43272
43272
  if (column.selectSettings?.allowCreate) {
43273
43273
  if (column.onPaste) {
43274
43274
  dataRow[column.field] = column.onPaste(dataRow, stringData);
@@ -43455,16 +43455,16 @@ const TableEdit = forwardRef((props, ref) => {
43455
43455
  }
43456
43456
  else {
43457
43457
  let value = row[col.field];
43458
- if (col.editType === 'numeric' || (col.editTypeCondition && col.editTypeCondition(row) === 'numeric')) {
43458
+ if (col.type === 'numeric' || (col.typeCondition && col.typeCondition(row) === 'numeric')) {
43459
43459
  value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
43460
43460
  }
43461
- else if (col.editType === 'date') {
43461
+ else if (col.type === 'date') {
43462
43462
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
43463
43463
  }
43464
- else if (col.editType === 'datetime') {
43464
+ else if (col.type === 'datetime') {
43465
43465
  value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
43466
43466
  }
43467
- const typeDis = !editDisable && (indexFocus === indexRow || col.editType === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
43467
+ const typeDis = !editDisable && (indexFocus === indexRow || col.type === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
43468
43468
  const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
43469
43469
  return (jsx(Fragment, { children: col.visible !== false && 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: {
43470
43470
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
@@ -43506,21 +43506,21 @@ const TableEdit = forwardRef((props, ref) => {
43506
43506
  if (typeDis === 2) {
43507
43507
  const value = col.template?.(row, indexRow) ?? '';
43508
43508
  if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
43509
- return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: value }), (!refreshRow && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43509
+ return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: value }), (!refreshRow && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43510
43510
  }
43511
43511
  else {
43512
43512
  return value;
43513
43513
  }
43514
43514
  }
43515
- return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), (!(typeDis === 1 && !refreshRow) && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43515
+ return (jsxs(Fragment$1, { children: [jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), (!(typeDis === 1 && !refreshRow) && typeDis !== 2) && jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43516
43516
  };
43517
43517
  const renderFooterCol = (col, indexCol) => {
43518
- const sumValue = (col.haveSum === true && col.editType === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
43518
+ const sumValue = (col.haveSum === true && col.type === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
43519
43519
  return (jsx(Fragment, { children: (col.visible !== false) && jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
43520
43520
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43521
43521
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43522
43522
  textAlign: col.textAlign ? col.textAlign : 'left'
43523
- }, 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}`));
43523
+ }, children: jsxs("div", { className: "r-footer-div", children: [col.haveSum === true && col.type === "numeric" && (Number(sumValue) >= 0) && jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), col.haveSum === true && col.type === "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}`));
43524
43524
  };
43525
43525
  /**
43526
43526
  * Kiểm tra row có thỏa mãn tất cả filter và chứa từ khóa tìm kiếm hay không
@@ -46260,7 +46260,7 @@ const ExportExcelComponent = ({ openModal, typeModal, handleModal, windowSize, d
46260
46260
  isPrimarykey: true
46261
46261
  },
46262
46262
  {
46263
- editType: 'text',
46263
+ type: 'text',
46264
46264
  field: "headerText",
46265
46265
  headerText: 'Column name',
46266
46266
  template: (value) => { return t(value.headerText); },
@@ -65349,7 +65349,7 @@ const TabMergeImportExcel = (props) => {
65349
65349
  {
65350
65350
  headerText: 'Required Information',
65351
65351
  field: 'isRequired',
65352
- editType: 'checkbox',
65352
+ type: 'checkbox',
65353
65353
  editEnable: true,
65354
65354
  textAlign: 'center',
65355
65355
  template: (data) => {
@@ -65372,7 +65372,7 @@ const TabMergeImportExcel = (props) => {
65372
65372
  {
65373
65373
  headerText: 'Columns on data files',
65374
65374
  field: 'column',
65375
- editType: 'select',
65375
+ type: 'select',
65376
65376
  editEnable: true,
65377
65377
  selectSettings: {
65378
65378
  options: optionField
@@ -65623,13 +65623,13 @@ const RenderFilterElement = ({ filter, optionsFilter, formatSetting, filterBy, s
65623
65623
  const RenderContentCol = (props) => {
65624
65624
  const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, handleCommandClick, fieldKey, isMulti } = props;
65625
65625
  const RenderElement = () => {
65626
- if (col.type === 'command') {
65626
+ if (col.type === 'command' && !col.field) {
65627
65627
  return jsx("div", { className: "r-rowcell-div command", children: jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row }) });
65628
65628
  }
65629
- else if (col.type === '#') {
65629
+ else if (col.type === '#' && !col.field) {
65630
65630
  jsx("div", { className: "r-rowcell-div", children: indexRow + 1 });
65631
65631
  }
65632
- else if (col.type === 'checkbox') {
65632
+ else if (col.type === 'checkbox' && !col.field) {
65633
65633
  return (jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
65634
65634
  if (selectEnable) {
65635
65635
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
@@ -65703,7 +65703,7 @@ const RenderContentCol = (props) => {
65703
65703
  }, children: RenderElement() }, `col-${indexRow}-${indexCol}`));
65704
65704
  };
65705
65705
 
65706
- const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, columns, isMutil, isLoading, selectEnable, formatSetting, commandClick, allowFilter, allowOrder, setColumns, pagingSetting, changeFilter, changeOrder, searchSetting, columnsAggregate, toolbarSetting, optionsFilter }) => {
65706
+ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns, isMutil = false, isLoading, selectEnable, formatSetting, commandClick, allowFilter, allowOrder, setColumns, pagingSetting, changeFilter, changeOrder, searchSetting, columnsAggregate, toolbarSetting, optionsFilter, selectedItem, setSelectedItem, handleSelect }) => {
65707
65707
  const gridRef = useRef(null);
65708
65708
  const [startIndex, setStartIndex] = useState(0);
65709
65709
  const [selectedRows, setSelectedRows] = useState([]);
@@ -65716,7 +65716,78 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
65716
65716
  const buffer = 10; // số dòng dự phòng phía trên và dưới
65717
65717
  const adjustedStartIndex = Math.max(startIndex - buffer, 0);
65718
65718
  const adjustedEndIndex = Math.min(startIndex + visibleRowCount + buffer, dataSource.length);
65719
- const visibleData = dataSource.slice(adjustedStartIndex, adjustedEndIndex);
65719
+ const visibleData = useMemo(() => {
65720
+ if (!dataSource || dataSource.length === 0) {
65721
+ return [];
65722
+ }
65723
+ let datas = dataSource;
65724
+ if (searchTerm) {
65725
+ datas = datas.filter((row) => {
65726
+ return searchSetting?.keyField?.some((key) => {
65727
+ return row[key]?.toString().toLowerCase().includes(searchTerm.trim().toLowerCase());
65728
+ });
65729
+ });
65730
+ }
65731
+ if (filterBy && filterBy.length > 0) {
65732
+ datas = datas.filter((row) => {
65733
+ return filterBy.every((filter) => {
65734
+ const { key, value, ope } = filter;
65735
+ const rowValue = row[key];
65736
+ if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
65737
+ return false;
65738
+ }
65739
+ const valStr = String(rowValue).toLowerCase();
65740
+ const filterStr = String(value).toLowerCase();
65741
+ /*eslint-disable*/
65742
+ switch (ope) {
65743
+ case 'startswith':
65744
+ return valStr.startsWith(filterStr);
65745
+ case 'endswith':
65746
+ return valStr.endsWith(filterStr);
65747
+ case 'contains':
65748
+ return valStr.includes(filterStr);
65749
+ case 'equal':
65750
+ return rowValue == value;
65751
+ case 'notequal':
65752
+ return rowValue != value;
65753
+ case 'greaterthan':
65754
+ return rowValue > value;
65755
+ case 'greaterthanorequal':
65756
+ return rowValue >= value;
65757
+ case 'lessthan':
65758
+ return rowValue < value;
65759
+ case 'lessthanorequal':
65760
+ return rowValue <= value;
65761
+ default:
65762
+ return false;
65763
+ }
65764
+ /*eslint-enable*/
65765
+ });
65766
+ });
65767
+ }
65768
+ if (orderBy && orderBy.length > 0) {
65769
+ datas = datas.sort((a, b) => {
65770
+ for (const order of orderBy) {
65771
+ const { key, direction } = order;
65772
+ const aValue = a[key];
65773
+ const bValue = b[key];
65774
+ if (aValue < bValue) {
65775
+ return direction === 'asc' ? -1 : 1;
65776
+ }
65777
+ if (aValue > bValue) {
65778
+ return direction === 'asc' ? 1 : -1;
65779
+ }
65780
+ }
65781
+ return 0;
65782
+ });
65783
+ }
65784
+ if (pagingSetting?.allowPaging && pagingSetting?.currentPage && pagingSetting?.pageSize && pagingSetting.pagingClient) {
65785
+ const start = (pagingSetting.currentPage - 1) * pagingSetting.pageSize;
65786
+ const end = start + pagingSetting.pageSize;
65787
+ datas = datas.slice(start, end);
65788
+ }
65789
+ return datas.slice(adjustedStartIndex, adjustedEndIndex);
65790
+ }, [searchTerm, filterBy]);
65720
65791
  const { t } = useTranslation();
65721
65792
  const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => calculateTableStructure(columns), [columns]);
65722
65793
  const scrollTimeoutRef = useRef(null);
@@ -65789,6 +65860,51 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
65789
65860
  }
65790
65861
  }
65791
65862
  };
65863
+ useEffect(() => {
65864
+ if (setSelectedItem) {
65865
+ if (isMutil) {
65866
+ if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
65867
+ setSelectedItem([...selectedRows]);
65868
+ if (handleSelect) {
65869
+ handleSelect([...selectedRows]);
65870
+ }
65871
+ }
65872
+ }
65873
+ else {
65874
+ if (dataSource && selectedRows?.length > 0) {
65875
+ if ((!selectedItem || (selectedItem[fieldKey] !== selectedRows[0][fieldKey]))) {
65876
+ setSelectedItem({ ...selectedRows[0] });
65877
+ if (handleSelect) {
65878
+ handleSelect({ ...selectedRows[0] });
65879
+ }
65880
+ }
65881
+ }
65882
+ else {
65883
+ setSelectedItem(undefined);
65884
+ if (handleSelect) {
65885
+ handleSelect(undefined);
65886
+ }
65887
+ }
65888
+ }
65889
+ }
65890
+ }, [selectedRows]);
65891
+ useEffect(() => {
65892
+ if (!isMutil) {
65893
+ if (dataSource && selectedItem && selectedItem[fieldKey]) {
65894
+ if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
65895
+ setSelectedRows([selectedItem]);
65896
+ }
65897
+ }
65898
+ else {
65899
+ setSelectedRows([]);
65900
+ }
65901
+ }
65902
+ else {
65903
+ if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
65904
+ setSelectedRows(selectedItem ? [...selectedItem] : []);
65905
+ }
65906
+ }
65907
+ }, [selectedItem]);
65792
65908
  return (jsxs("div", { className: "react-table-edit r-virtualized-table", children: [jsxs("div", { className: 'r-grid', children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxs("div", { ref: gridRef, className: "r-gridtable", onScroll: handleScroll, style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: flatVisble }), jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (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) => {
65793
65909
  setFilterBy([...val]);
65794
65910
  if (changeFilter) {
@@ -65817,5 +65933,5 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
65817
65933
  }) }) : jsx(Fragment$1, {}) })] }), (((dataSource.length ?? 0) === 0) && !isLoading) && jsxs("div", { className: "r-no-data", children: [jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }), isLoading && jsx("div", { className: "r-loading-overlay", children: jsxs("div", { className: "r-loading", children: [jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging ? jsx(PagingComponent, { onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: (pagingSetting?.totalItem ?? 0), onChangePageSize: onChangePageSize }) : jsx(Fragment$1, {})] }));
65818
65934
  };
65819
65935
 
65820
- export { ExportExcelComponent, FindNodeByPath, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TabsMenuComponent, VirtualTable, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
65936
+ export { ExportExcelComponent, FindNodeByPath, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined$1 as isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
65821
65937
  //# sourceMappingURL=index.mjs.map