react-table-edit 1.4.26 → 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.js CHANGED
@@ -19306,7 +19306,7 @@ const FindNodeByPath = (tree, path) => {
19306
19306
  * @param columns Mảng cấu trúc cây đại diện cho các cột của bảng
19307
19307
  * @returns {
19308
19308
  * levels: IHeaderColumnTable[][] // Các hàng header theo cấp
19309
- * flat: IColumnVirtualizedTable[] // Danh sách cột phẳng
19309
+ * flat: IColumnTable[] // Danh sách cột phẳng
19310
19310
  * objWidthFixLeft: Record<number, number> // Offset trái cho cột fixed left
19311
19311
  * objWidthFixRight: Record<number, number> // Offset phải cho cột fixed right
19312
19312
  * lastObjWidthFixLeft: number // Chỉ số cột cuối cùng fixed left
@@ -23568,7 +23568,7 @@ const SidebarSetColumn = (props) => {
23568
23568
  }) }) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent', children: dataSource?.map((row, indexRow) => {
23569
23569
  return (jsxRuntime.jsx("tr", { className: classNames$1('r-row', { 'last-row': indexRow === dataSource.length - 1 }, { 'fisrt-row': indexRow === 0 }), children: columns.map((col, indexCol) => {
23570
23570
  let value = row[col.field];
23571
- if (col.editType === 'numeric' || (col.editTypeCondition && col.editTypeCondition(row) === 'numeric')) {
23571
+ if (col.type === 'numeric' || (col.typeCondition && col.typeCondition(row) === 'numeric')) {
23572
23572
  value = formartNumberic(row[col.field], ',', '.', col.numericSettings?.fraction, true) ?? 0;
23573
23573
  }
23574
23574
  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 }, { 'r-active': indexFocus === indexRow }), style: {
@@ -41904,7 +41904,7 @@ const HeaderTableCol$1 = (props) => {
41904
41904
  };
41905
41905
  const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy, setOpenFilter, changeFilter, column }) => {
41906
41906
  const { t } = reactI18next.useTranslation();
41907
- const [operator, setOperator] = React$5.useState(filter?.ope ?? ((!column.filterType && column.editType === 'numeric') || column.filterType === 'select' ? 'equal' : 'contains'));
41907
+ const [operator, setOperator] = React$5.useState(filter?.ope ?? ((!column.filterType && column.type === 'numeric') || column.filterType === 'select' ? 'equal' : 'contains'));
41908
41908
  const [valueFilter, setValueFilter] = React$5.useState(filter?.value ?? '');
41909
41909
  const RenderStringFilter = () => {
41910
41910
  const options = [
@@ -41969,7 +41969,7 @@ const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy,
41969
41969
  handleSave();
41970
41970
  e.stopPropagation();
41971
41971
  }
41972
- }, children: [((!column.filterType && column.editType === 'numeric') || column.filterType === 'numeric') ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [RenderNumberFilter(), " "] }) : (column.filterType === 'select' ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [RenderSelectFilter(), " "] }) : RenderStringFilter()), jsxRuntime.jsxs("div", { className: 'd-flex justify-content-end', children: [jsxRuntime.jsx(Button$1, { color: 'primary', style: { borderRadius: 3 }, className: 'me-50 py-25 px-50 fw-bold', onClick: handleSave, children: t('Filter') }), jsxRuntime.jsx(Button$1, { className: 'py-25 px-50 fw-bold', color: 'white', style: { borderRadius: 3, borderWidth: 0 }, onClick: () => {
41972
+ }, children: [((!column.filterType && column.type === 'numeric') || column.filterType === 'numeric') ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [RenderNumberFilter(), " "] }) : (column.filterType === 'select' ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [RenderSelectFilter(), " "] }) : RenderStringFilter()), jsxRuntime.jsxs("div", { className: 'd-flex justify-content-end', children: [jsxRuntime.jsx(Button$1, { color: 'primary', style: { borderRadius: 3 }, className: 'me-50 py-25 px-50 fw-bold', onClick: handleSave, children: t('Filter') }), jsxRuntime.jsx(Button$1, { className: 'py-25 px-50 fw-bold', color: 'white', style: { borderRadius: 3, borderWidth: 0 }, onClick: () => {
41973
41973
  if (filterBy) {
41974
41974
  changeFilter(filterBy.filter((x) => x.key !== column.field));
41975
41975
  }
@@ -42828,7 +42828,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
42828
42828
  }
42829
42829
  const RenderEditCell = (row, col, indexCol, indexRow) => {
42830
42830
  /*eslint-disable */
42831
- switch (col?.editTypeCondition ? col?.editTypeCondition(row) : col.editType) {
42831
+ switch (col?.typeCondition ? col?.typeCondition(row) : col.type) {
42832
42832
  case 'date':
42833
42833
  return (jsxRuntime.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) => {
42834
42834
  row[col.field] = date ? new Date(date.getTime() + 7 * 60 * 60 * 1000) : undefined;
@@ -43096,10 +43096,10 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43096
43096
  }
43097
43097
  }
43098
43098
  if ((tableElement.current?.scrollHeight ?? 0) > 0) {
43099
- if ((tableElement.current?.scrollTop ?? 0) > ((row - 1) % (pagingSetting?.pageSize ?? 1)) * 34) {
43100
- tableElement.current?.scrollTo({ behavior: 'smooth', top: ((row - 1) % (pagingSetting?.pageSize ?? 1)) * 34 });
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 });
43101
43101
  }
43102
- else if (((tableElement.current?.clientHeight ?? 0) - (haveSum ? 30 : 0) - (headerColumns.length * 42)) < (((row % (pagingSetting?.pageSize ?? 1)) * 34) - (tableElement.current?.scrollTop ?? 0))) {
43102
+ else if (((tableElement.current?.clientHeight ?? 0) - (haveSum ? 30 : 0) - (headerColumns.length * 42)) < (((row % (pagingSetting?.pageSize ?? 10000)) * 34) - (tableElement.current?.scrollTop ?? 0))) {
43103
43103
  tableElement.current?.scrollTo({ behavior: 'smooth', top: (tableElement.current?.scrollTop ?? 0) + 34 });
43104
43104
  }
43105
43105
  }
@@ -43241,7 +43241,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43241
43241
  }
43242
43242
  }
43243
43243
  else {
43244
- if (column.editType === 'date') {
43244
+ if (column.type === 'date') {
43245
43245
  const [day, month, year] = stringData.split('/');
43246
43246
  const date = new Date(`${year}-${month}-${day}`);
43247
43247
  if (!isNaN(date.getTime())) {
@@ -43259,7 +43259,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43259
43259
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43260
43260
  }
43261
43261
  }
43262
- else if (column.editType === 'datetime') {
43262
+ else if (column.type === 'datetime') {
43263
43263
  const [datePart, timePart] = stringData.split(' ');
43264
43264
  const [day, month, year] = datePart.split('/');
43265
43265
  const [hour, minute] = timePart.split(':');
@@ -43279,7 +43279,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43279
43279
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43280
43280
  }
43281
43281
  }
43282
- else if (column.editType === 'numeric') {
43282
+ else if (column.type === 'numeric') {
43283
43283
  const number = Number(stringData);
43284
43284
  if (!isNaN(number)) {
43285
43285
  if (column.onPaste) {
@@ -43296,7 +43296,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43296
43296
  notificationError(t('PasteExcelIncorrectFormat', { index: (currenRowIndex + indexRow + 1), field: t(column.headerText ?? ''), value: stringData }));
43297
43297
  }
43298
43298
  }
43299
- else if (column.editType === 'select') {
43299
+ else if (column.type === 'select') {
43300
43300
  if (column.selectSettings?.allowCreate) {
43301
43301
  if (column.onPaste) {
43302
43302
  dataRow[column.field] = column.onPaste(dataRow, stringData);
@@ -43483,16 +43483,16 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43483
43483
  }
43484
43484
  else {
43485
43485
  let value = row[col.field];
43486
- if (col.editType === 'numeric' || (col.editTypeCondition && col.editTypeCondition(row) === 'numeric')) {
43486
+ if (col.type === 'numeric' || (col.typeCondition && col.typeCondition(row) === 'numeric')) {
43487
43487
  value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
43488
43488
  }
43489
- else if (col.editType === 'date') {
43489
+ else if (col.type === 'date') {
43490
43490
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
43491
43491
  }
43492
- else if (col.editType === 'datetime') {
43492
+ else if (col.type === 'datetime') {
43493
43493
  value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
43494
43494
  }
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);
43495
+ const typeDis = !editDisable && (indexFocus === indexRow || col.type === 'checkbox') && (!col.disabledCondition || !col.disabledCondition(row)) ? (col.editEnable ? 1 : (col.template ? 2 : 3)) : (col.template ? 2 : 3);
43496
43496
  const errorMessage = typeDis === 1 || col.field === '' || !col.validate ? '' : col.validate(row[col.field], row);
43497
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: {
43498
43498
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
@@ -43534,21 +43534,21 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43534
43534
  if (typeDis === 2) {
43535
43535
  const value = col.template?.(row, indexRow) ?? '';
43536
43536
  if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
43537
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: value }), (!refreshRow && typeDis !== 2) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43537
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: value }), (!refreshRow && typeDis !== 2) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43538
43538
  }
43539
43539
  else {
43540
43540
  return value;
43541
43541
  }
43542
43542
  }
43543
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), (!(typeDis === 1 && !refreshRow) && typeDis !== 2) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.editType === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43543
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: `content-${idTable}-row${indexRow}col-${indexCol}`, className: "r-cell-text", children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) }), (!(typeDis === 1 && !refreshRow) && typeDis !== 2) && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: (col.type === 'numeric' && Number(row[col.field]) < 0 ? jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${value}${formatSetting?.suffixNegative ?? ''}`] }) : value) })] }));
43544
43544
  };
43545
43545
  const renderFooterCol = (col, indexCol) => {
43546
- const sumValue = (col.haveSum === true && col.editType === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
43546
+ const sumValue = (col.haveSum === true && col.type === "numeric") ? dataSource.reduce(function (accumulator, currentValue) { return (Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0)); }, 0) : 0;
43547
43547
  return (jsxRuntime.jsx(React$5.Fragment, { children: (col.visible !== false) && jsxRuntime.jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
43548
43548
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
43549
43549
  right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
43550
43550
  textAlign: col.textAlign ? col.textAlign : 'left'
43551
- }, 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}`));
43551
+ }, children: jsxRuntime.jsxs("div", { className: "r-footer-div", children: [col.haveSum === true && col.type === "numeric" && (Number(sumValue) >= 0) && jsxRuntime.jsx(jsxRuntime.Fragment, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), col.haveSum === true && col.type === "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}`));
43552
43552
  };
43553
43553
  /**
43554
43554
  * 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
@@ -46288,7 +46288,7 @@ const ExportExcelComponent = ({ openModal, typeModal, handleModal, windowSize, d
46288
46288
  isPrimarykey: true
46289
46289
  },
46290
46290
  {
46291
- editType: 'text',
46291
+ type: 'text',
46292
46292
  field: "headerText",
46293
46293
  headerText: 'Column name',
46294
46294
  template: (value) => { return t(value.headerText); },
@@ -65377,7 +65377,7 @@ const TabMergeImportExcel = (props) => {
65377
65377
  {
65378
65378
  headerText: 'Required Information',
65379
65379
  field: 'isRequired',
65380
- editType: 'checkbox',
65380
+ type: 'checkbox',
65381
65381
  editEnable: true,
65382
65382
  textAlign: 'center',
65383
65383
  template: (data) => {
@@ -65400,7 +65400,7 @@ const TabMergeImportExcel = (props) => {
65400
65400
  {
65401
65401
  headerText: 'Columns on data files',
65402
65402
  field: 'column',
65403
- editType: 'select',
65403
+ type: 'select',
65404
65404
  editEnable: true,
65405
65405
  selectSettings: {
65406
65406
  options: optionField
@@ -65651,13 +65651,13 @@ const RenderFilterElement = ({ filter, optionsFilter, formatSetting, filterBy, s
65651
65651
  const RenderContentCol = (props) => {
65652
65652
  const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, handleCommandClick, fieldKey, isMulti } = props;
65653
65653
  const RenderElement = () => {
65654
- if (col.type === 'command') {
65654
+ if (col.type === 'command' && !col.field) {
65655
65655
  return jsxRuntime.jsx("div", { className: "r-rowcell-div command", children: jsxRuntime.jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row }) });
65656
65656
  }
65657
- else if (col.type === '#') {
65657
+ else if (col.type === '#' && !col.field) {
65658
65658
  jsxRuntime.jsx("div", { className: "r-rowcell-div", children: indexRow + 1 });
65659
65659
  }
65660
- else if (col.type === 'checkbox') {
65660
+ else if (col.type === 'checkbox' && !col.field) {
65661
65661
  return (jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
65662
65662
  if (selectEnable) {
65663
65663
  const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
@@ -65731,7 +65731,7 @@ const RenderContentCol = (props) => {
65731
65731
  }, children: RenderElement() }, `col-${indexRow}-${indexCol}`));
65732
65732
  };
65733
65733
 
65734
- const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, columns, isMutil, isLoading, selectEnable, formatSetting, commandClick, allowFilter, allowOrder, setColumns, pagingSetting, changeFilter, changeOrder, searchSetting, columnsAggregate, toolbarSetting, optionsFilter }) => {
65734
+ 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 }) => {
65735
65735
  const gridRef = React$5.useRef(null);
65736
65736
  const [startIndex, setStartIndex] = React$5.useState(0);
65737
65737
  const [selectedRows, setSelectedRows] = React$5.useState([]);
@@ -65744,7 +65744,78 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
65744
65744
  const buffer = 10; // số dòng dự phòng phía trên và dưới
65745
65745
  const adjustedStartIndex = Math.max(startIndex - buffer, 0);
65746
65746
  const adjustedEndIndex = Math.min(startIndex + visibleRowCount + buffer, dataSource.length);
65747
- const visibleData = dataSource.slice(adjustedStartIndex, adjustedEndIndex);
65747
+ const visibleData = React$5.useMemo(() => {
65748
+ if (!dataSource || dataSource.length === 0) {
65749
+ return [];
65750
+ }
65751
+ let datas = dataSource;
65752
+ if (searchTerm) {
65753
+ datas = datas.filter((row) => {
65754
+ return searchSetting?.keyField?.some((key) => {
65755
+ return row[key]?.toString().toLowerCase().includes(searchTerm.trim().toLowerCase());
65756
+ });
65757
+ });
65758
+ }
65759
+ if (filterBy && filterBy.length > 0) {
65760
+ datas = datas.filter((row) => {
65761
+ return filterBy.every((filter) => {
65762
+ const { key, value, ope } = filter;
65763
+ const rowValue = row[key];
65764
+ if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
65765
+ return false;
65766
+ }
65767
+ const valStr = String(rowValue).toLowerCase();
65768
+ const filterStr = String(value).toLowerCase();
65769
+ /*eslint-disable*/
65770
+ switch (ope) {
65771
+ case 'startswith':
65772
+ return valStr.startsWith(filterStr);
65773
+ case 'endswith':
65774
+ return valStr.endsWith(filterStr);
65775
+ case 'contains':
65776
+ return valStr.includes(filterStr);
65777
+ case 'equal':
65778
+ return rowValue == value;
65779
+ case 'notequal':
65780
+ return rowValue != value;
65781
+ case 'greaterthan':
65782
+ return rowValue > value;
65783
+ case 'greaterthanorequal':
65784
+ return rowValue >= value;
65785
+ case 'lessthan':
65786
+ return rowValue < value;
65787
+ case 'lessthanorequal':
65788
+ return rowValue <= value;
65789
+ default:
65790
+ return false;
65791
+ }
65792
+ /*eslint-enable*/
65793
+ });
65794
+ });
65795
+ }
65796
+ if (orderBy && orderBy.length > 0) {
65797
+ datas = datas.sort((a, b) => {
65798
+ for (const order of orderBy) {
65799
+ const { key, direction } = order;
65800
+ const aValue = a[key];
65801
+ const bValue = b[key];
65802
+ if (aValue < bValue) {
65803
+ return direction === 'asc' ? -1 : 1;
65804
+ }
65805
+ if (aValue > bValue) {
65806
+ return direction === 'asc' ? 1 : -1;
65807
+ }
65808
+ }
65809
+ return 0;
65810
+ });
65811
+ }
65812
+ if (pagingSetting?.allowPaging && pagingSetting?.currentPage && pagingSetting?.pageSize && pagingSetting.pagingClient) {
65813
+ const start = (pagingSetting.currentPage - 1) * pagingSetting.pageSize;
65814
+ const end = start + pagingSetting.pageSize;
65815
+ datas = datas.slice(start, end);
65816
+ }
65817
+ return datas.slice(adjustedStartIndex, adjustedEndIndex);
65818
+ }, [searchTerm, filterBy]);
65748
65819
  const { t } = reactI18next.useTranslation();
65749
65820
  const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = React$5.useMemo(() => calculateTableStructure(columns), [columns]);
65750
65821
  const scrollTimeoutRef = React$5.useRef(null);
@@ -65817,6 +65888,51 @@ const VirtualTable = ({ idTable, dataSource, rowHeight = 33, height = 400, colum
65817
65888
  }
65818
65889
  }
65819
65890
  };
65891
+ React$5.useEffect(() => {
65892
+ if (setSelectedItem) {
65893
+ if (isMutil) {
65894
+ if (dataSource && selectedRows && selectedRows?.length !== selectedItem?.length) {
65895
+ setSelectedItem([...selectedRows]);
65896
+ if (handleSelect) {
65897
+ handleSelect([...selectedRows]);
65898
+ }
65899
+ }
65900
+ }
65901
+ else {
65902
+ if (dataSource && selectedRows?.length > 0) {
65903
+ if ((!selectedItem || (selectedItem[fieldKey] !== selectedRows[0][fieldKey]))) {
65904
+ setSelectedItem({ ...selectedRows[0] });
65905
+ if (handleSelect) {
65906
+ handleSelect({ ...selectedRows[0] });
65907
+ }
65908
+ }
65909
+ }
65910
+ else {
65911
+ setSelectedItem(undefined);
65912
+ if (handleSelect) {
65913
+ handleSelect(undefined);
65914
+ }
65915
+ }
65916
+ }
65917
+ }
65918
+ }, [selectedRows]);
65919
+ React$5.useEffect(() => {
65920
+ if (!isMutil) {
65921
+ if (dataSource && selectedItem && selectedItem[fieldKey]) {
65922
+ if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
65923
+ setSelectedRows([selectedItem]);
65924
+ }
65925
+ }
65926
+ else {
65927
+ setSelectedRows([]);
65928
+ }
65929
+ }
65930
+ else {
65931
+ if (dataSource && selectedItem && selectedRows?.length !== selectedItem.length) {
65932
+ setSelectedRows(selectedItem ? [...selectedItem] : []);
65933
+ }
65934
+ }
65935
+ }, [selectedItem]);
65820
65936
  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) => {
65821
65937
  setFilterBy([...val]);
65822
65938
  if (changeFilter) {
@@ -65851,8 +65967,8 @@ exports.ImportExcelComponent = ImportExcelComponent;
65851
65967
  exports.InputStyleComponent = InputStyleComponent;
65852
65968
  exports.SelectTable = SelectTable;
65853
65969
  exports.SelectTableTree = SelectTableTree;
65970
+ exports.TableView = TableView;
65854
65971
  exports.TabsMenuComponent = TabsMenuComponent;
65855
- exports.VirtualTable = VirtualTable;
65856
65972
  exports.Wizard = Wizard;
65857
65973
  exports.calculateTableStructure = calculateTableStructure;
65858
65974
  exports.checkDecimalSeparator = checkDecimalSeparator;