react-table-edit 1.5.45 → 1.5.46

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
@@ -69642,7 +69642,7 @@ const RenderContentCol = React__default.memo((props) => {
69642
69642
  });
69643
69643
 
69644
69644
  const TableElement = React__default.memo((props) => {
69645
- const { contentColumns, dataSource, fieldKey, filterBy, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, orderBy, selectedRows, setContentColumns, setSelectedRows, formatSetting, gridRef, idTable, headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, isMulti, querySetting, searchSetting, searchTerm, columnsAggregate, haveSum, expandsAll, zeroVisiable, setFilterBy, setOrderBy, setExpandsAll, handleDoubleClick, handleCellClick, contextMenuItems, handleContextMenuClick, isLoading } = props;
69645
+ const { contentColumns, dataSource, fieldKey, filterBy, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, orderBy, selectedRows, setContentColumns, setSelectedRows, formatSetting, gridRef, idTable, headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, isMulti, querySetting, searchSetting, searchTerm, columnsAggregate, haveSum, expandsAll, zeroVisiable, setFilterBy, setOrderBy, setExpandsAll, handleDoubleClick, handleCellClick, contextMenuItems, handleContextMenuClick, isLoading, } = props;
69646
69646
  const { t } = useTranslation();
69647
69647
  const [context, setContext] = useState(null);
69648
69648
  const virtualDivRef = useRef(null);
@@ -69688,7 +69688,10 @@ const TableElement = React__default.memo((props) => {
69688
69688
  if (searchTerm) {
69689
69689
  datas = datas.filter((row) => {
69690
69690
  return searchSetting?.keyField?.some((key) => {
69691
- return row[key]?.toString().toLowerCase().includes(searchTerm.trim().toLowerCase());
69691
+ return row[key]
69692
+ ?.toString()
69693
+ .toLowerCase()
69694
+ .includes(searchTerm.trim().toLowerCase());
69692
69695
  });
69693
69696
  });
69694
69697
  }
@@ -69697,7 +69700,10 @@ const TableElement = React__default.memo((props) => {
69697
69700
  return filterBy.every((filter) => {
69698
69701
  const { key, value, ope } = filter;
69699
69702
  const rowValue = row[key];
69700
- if (rowValue === undefined || rowValue === null || value === undefined || value === null) {
69703
+ if (rowValue === undefined ||
69704
+ rowValue === null ||
69705
+ value === undefined ||
69706
+ value === null) {
69701
69707
  return false;
69702
69708
  }
69703
69709
  const valStr = String(rowValue).toLowerCase();
@@ -69763,52 +69769,68 @@ const TableElement = React__default.memo((props) => {
69763
69769
  }
69764
69770
  let value = row[col.field];
69765
69771
  if (col.type === 'numeric') {
69766
- value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69772
+ value =
69773
+ formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69767
69774
  }
69768
69775
  else if (col.type === 'date') {
69769
- value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
69776
+ value = value
69777
+ ? formatDateTime(value, formatSetting?.dateFormat)
69778
+ : '';
69770
69779
  }
69771
69780
  else if (col.type === 'datetime') {
69772
- value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
69781
+ value = value
69782
+ ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
69783
+ : '';
69773
69784
  }
69774
69785
  if (col.template) {
69775
69786
  value = col.template(row, indexRow) ?? '';
69776
69787
  }
69777
69788
  return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: {
69778
69789
  marginLeft: level * 20,
69779
- transform: expand ? 'rotate(90deg)' : 'rotate(0deg)'
69790
+ transform: expand ? 'rotate(90deg)' : 'rotate(0deg)',
69780
69791
  }, fontSize: 15, onClick: () => {
69781
69792
  setExpand(!expand);
69782
69793
  setExpandsAll(undefined);
69783
69794
  row.expand = !expand;
69784
69795
  } }), t(col.headerDisplay ?? col.headerText ?? ''), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
69785
- if (indexCol <= firstColSpan || colSum.visible === false || colSum.isGroup === true) {
69796
+ if (indexCol <= firstColSpan ||
69797
+ colSum.visible === false ||
69798
+ colSum.isGroup === true) {
69786
69799
  return;
69787
69800
  }
69788
69801
  let sumValue = row[colSum.field];
69789
- const haveSum = row[colSum.field] !== undefined && row[colSum.field] !== null;
69790
- if (!haveSum && colSum.haveSum === true && colSum.type === 'numeric') {
69802
+ const haveSum = row[colSum.field] !== undefined &&
69803
+ row[colSum.field] !== null;
69804
+ if (!haveSum &&
69805
+ colSum.haveSum === true &&
69806
+ colSum.type === 'numeric') {
69791
69807
  sumValue = row.children.reduce(function (accumulator, currentValue) {
69792
- return Number(accumulator ?? 0) + Number(currentValue[colSum.field] ?? 0);
69808
+ return (Number(accumulator ?? 0) +
69809
+ Number(currentValue[colSum.field] ?? 0));
69793
69810
  }, 0);
69794
69811
  }
69795
69812
  if (colSum.type === 'numeric') {
69796
69813
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', colSum.numericSettings?.fraction, true, false);
69797
- if (!zeroVisiable && !col.zeroVisiable && (sumValue === '0' || sumValue === 0)) {
69814
+ if (!zeroVisiable &&
69815
+ !col.zeroVisiable &&
69816
+ (sumValue === '0' || sumValue === 0)) {
69798
69817
  sumValue = '';
69799
69818
  }
69800
69819
  }
69801
69820
  return (jsx("td", { className: "r-rowcell r-cell-sum-group", children: jsx("div", { className: "r-rowcell-div", style: {
69802
- justifyContent: colSum.textAlign ? colSum.textAlign : 'left'
69803
- }, children: (haveSum || colSum.haveSum === true) && Number(row[colSum.field] ?? '0') < 0 ? (jsxs("div", { style: {
69804
- color: formatSetting?.colorNegative ?? 'red'
69805
- }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69806
- })] }), expand && jsx(RenderContent, { datas: row.children, level: level + 1 })] }, `row-${level}-${indexRow}`));
69821
+ justifyContent: colSum.textAlign
69822
+ ? colSum.textAlign
69823
+ : 'left',
69824
+ }, children: (haveSum || colSum.haveSum === true) &&
69825
+ Number(row[colSum.field] ?? '0') < 0 ? (jsx("div", { style: {
69826
+ color: formatSetting?.colorNegative ?? 'red',
69827
+ }, children: `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}` })) : (sumValue) }) }, `group-sum-cell-${level}-${indexRow}-${indexCol}`));
69828
+ })] }), expand && (jsx(RenderContent, { datas: row.children, level: level + 1 }))] }, `row-${level}-${indexRow}`));
69807
69829
  }
69808
69830
  else {
69809
69831
  const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
69810
69832
  return (jsx("tr", { id: `row-content-${indexRow}`, "aria-rowindex": indexRow + 1, role: "row", className: classNames$1('r-row', {
69811
- 'r-last-row': level === 0 && indexRow === viewData.length - 1
69833
+ 'r-last-row': level === 0 && indexRow === viewData.length - 1,
69812
69834
  }), onContextMenu: (e) => {
69813
69835
  e.preventDefault();
69814
69836
  handleContextMenu(e, row);
@@ -69824,7 +69846,7 @@ const TableElement = React__default.memo((props) => {
69824
69846
  x: e.clientX,
69825
69847
  y: e.clientY,
69826
69848
  row,
69827
- show: true
69849
+ show: true,
69828
69850
  });
69829
69851
  }, 100);
69830
69852
  };
@@ -69848,20 +69870,28 @@ const TableElement = React__default.memo((props) => {
69848
69870
  let sumValue = item?.value;
69849
69871
  if (!item && col.haveSum === true && col.type === 'numeric') {
69850
69872
  sumValue = viewData.reduce(function (accumulator, currentValue) {
69851
- return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
69873
+ return (Number(accumulator ?? 0) +
69874
+ Number(currentValue[col.field] ?? 0));
69852
69875
  }, 0);
69853
69876
  }
69854
69877
  if (col.type === 'numeric') {
69855
69878
  sumValue = formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false);
69856
69879
  }
69857
69880
  return (jsx("td", { className: classNames$1(`p-0 px-50 r-footer fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
69858
- left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
69859
- right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
69860
- textAlign: col.textAlign ? col.textAlign : 'left'
69861
- }, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) && Number(item?.value ?? '0') < 0 ? (jsxs("div", { style: {
69862
- color: formatSetting?.colorNegative ?? 'red'
69881
+ left: col.fixedType === 'left'
69882
+ ? objWidthFixLeft[indexCol]
69883
+ : undefined,
69884
+ right: col.fixedType === 'right'
69885
+ ? objWidthFixRight[indexCol]
69886
+ : undefined,
69887
+ textAlign: col.textAlign ? col.textAlign : 'left',
69888
+ }, children: jsx("div", { className: "r-footer-div", children: (item || col.haveSum === true) &&
69889
+ Number(item?.value ?? '0') < 0 ? (jsxs("div", { style: {
69890
+ color: formatSetting?.colorNegative ?? 'red',
69863
69891
  }, children: [' ', `${formatSetting?.prefixNegative ?? '-'}${sumValue}${formatSetting?.suffixNegative ?? ''}`] })) : (sumValue) }) }, `summarycell-${indexCol}`));
69864
- }) })) })] }), jsx("div", { ref: virtualDivRef }), context && (contextMenuItems?.length ?? 0) > 0 && handleContextMenuClick && (jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69892
+ }) })) })] }), jsx("div", { ref: virtualDivRef }), context &&
69893
+ (contextMenuItems?.length ?? 0) > 0 &&
69894
+ handleContextMenuClick && (jsx(Popover$1, { className: "r-context-popover", placement: "right-start", isOpen: context.show, target: virtualDivRef.current, toggle: handleCloseContext, fade: false, children: jsx(PopoverBody$1, { children: contextMenuItems?.map((item, index) => {
69865
69895
  return (jsxs("div", { className: "r-context-item", onClick: () => {
69866
69896
  handleCloseContext();
69867
69897
  handleContextMenuClick?.(item, context.row);