react-table-edit 1.5.48 → 1.5.49

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
@@ -68984,7 +68984,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
68984
68984
  };
68985
68985
 
68986
68986
  const RenderContentCol = React__default.memo((props) => {
68987
- const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, handleCellClick, fieldKey, isMulti } = props;
68987
+ const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, setSelectedRows, handleCloseContext, handleDoubleClick, handleCellClick, fieldKey, isMulti, } = props;
68988
68988
  const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
68989
68989
  const checkOverflow = () => {
68990
68990
  const element = document.getElementById(cellId);
@@ -69006,10 +69006,12 @@ const RenderContentCol = React__default.memo((props) => {
69006
69006
  const RenderElement = () => {
69007
69007
  if (col.field === '#' || col.type === '#') {
69008
69008
  return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', {
69009
- 'r-active-cell': isSelected
69009
+ 'r-active-cell': isSelected,
69010
69010
  }), style: {
69011
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
69012
- fontStyle: row.haveItalicType ? 'italic' : 'normal'
69011
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
69012
+ ? 600
69013
+ : 400,
69014
+ fontStyle: row.haveItalicType ? 'italic' : 'normal',
69013
69015
  }, onDoubleClick: (e) => {
69014
69016
  e.preventDefault();
69015
69017
  handleCloseContext();
@@ -69018,11 +69020,15 @@ const RenderContentCol = React__default.memo((props) => {
69018
69020
  }
69019
69021
  else if (col.type === 'checkbox' || col.field === 'checkbox') {
69020
69022
  return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
69021
- 'r-active-cell': isSelected
69023
+ 'r-active-cell': isSelected,
69022
69024
  }), style: {
69023
69025
  display: 'flex',
69024
- justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
69025
- alignItems: 'center'
69026
+ justifyContent: col.textAlign === 'center'
69027
+ ? 'center'
69028
+ : col.textAlign === 'right'
69029
+ ? 'flex-end'
69030
+ : 'flex-start',
69031
+ alignItems: 'center',
69026
69032
  }, onClick: (e) => {
69027
69033
  setSelectedRows(toggleSelect());
69028
69034
  e.stopPropagation();
@@ -69032,8 +69038,11 @@ const RenderContentCol = React__default.memo((props) => {
69032
69038
  let value = row[col.field];
69033
69039
  // ✅ Format dữ liệu theo loại cột
69034
69040
  if (col.type === 'numeric') {
69035
- value = formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69036
- if (!zeroVisiable && !col.zeroVisiable && !(row?.sortOrder < 0 || row?.sortOrder > 100000) && (value === '0' || value === 0)) {
69041
+ value =
69042
+ formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) ?? 0;
69043
+ if (!zeroVisiable &&
69044
+ !col.zeroVisiable &&
69045
+ (value === '0' || value === 0)) {
69037
69046
  value = '';
69038
69047
  }
69039
69048
  }
@@ -69041,31 +69050,43 @@ const RenderContentCol = React__default.memo((props) => {
69041
69050
  value = value ? formatDateTime(value, formatSetting?.dateFormat) : '';
69042
69051
  }
69043
69052
  else if (col.type === 'datetime') {
69044
- value = value ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm') : '';
69053
+ value = value
69054
+ ? formatDateTime(value, formatSetting?.dateFormat ?? 'DD/MM/yyyy HH:mm')
69055
+ : '';
69045
69056
  }
69046
69057
  if (col.template) {
69047
69058
  value = col.template(row, indexRow) ?? '';
69048
69059
  }
69049
69060
  const isNegative = col.type === 'numeric' && Number(row[col.field]) < 0;
69050
- const textColor = isNegative ? formatSetting?.colorNegative ?? 'red' : undefined;
69051
- const prefix = isNegative ? formatSetting?.prefixNegative ?? '-' : '';
69052
- const suffix = isNegative ? formatSetting?.suffixNegative ?? '' : '';
69053
- const displayText = isNegative ? `${prefix}${value}${suffix}` : value ?? '';
69061
+ const textColor = isNegative
69062
+ ? (formatSetting?.colorNegative ?? 'red')
69063
+ : undefined;
69064
+ const prefix = isNegative ? (formatSetting?.prefixNegative ?? '-') : '';
69065
+ const suffix = isNegative ? (formatSetting?.suffixNegative ?? '') : '';
69066
+ const displayText = isNegative
69067
+ ? `${prefix}${value}${suffix}`
69068
+ : (value ?? '');
69054
69069
  return (jsxs("div", { className: classNames$1('r-rowcell-div cursor-pointer', {
69055
- 'r-active-cell': isSelected
69070
+ 'r-active-cell': isSelected,
69056
69071
  }), style: {
69057
- fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
69058
- fontStyle: row.haveItalicType ? 'italic' : 'normal'
69072
+ fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType
69073
+ ? 600
69074
+ : 400,
69075
+ fontStyle: row.haveItalicType ? 'italic' : 'normal',
69059
69076
  }, children: [jsx("div", { className: "r-cell-text", style: {
69060
69077
  display: 'flex',
69061
- justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start',
69062
- alignItems: 'center'
69078
+ justifyContent: col.textAlign === 'center'
69079
+ ? 'center'
69080
+ : col.textAlign === 'right'
69081
+ ? 'flex-end'
69082
+ : 'flex-start',
69083
+ alignItems: 'center',
69063
69084
  }, children: jsx("div", { id: cellId, style: {
69064
69085
  color: textColor,
69065
69086
  overflow: 'hidden',
69066
69087
  textOverflow: 'ellipsis',
69067
69088
  whiteSpace: 'pre',
69068
- maxWidth: '100%'
69089
+ maxWidth: '100%',
69069
69090
  }, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, onClick: (e) => {
69070
69091
  e.stopPropagation();
69071
69092
  e.preventDefault();
@@ -69074,10 +69095,15 @@ const RenderContentCol = React__default.memo((props) => {
69074
69095
  };
69075
69096
  const clickTimerRef = useRef(null);
69076
69097
  return (jsx(Fragment$1, { children: col.visible !== false && col.isGroup !== true && (jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, {
69077
- 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight)
69098
+ 'fixed-last': (col.fixedType === 'left' &&
69099
+ indexCol === lastObjWidthFixLeft) ||
69100
+ (col.fixedType === 'right' &&
69101
+ indexCol === fisrtObjWidthFixRight),
69078
69102
  }, { 'r-active': isSelected }), style: {
69079
69103
  left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
69080
- right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
69104
+ right: col.fixedType === 'right'
69105
+ ? objWidthFixRight[indexCol]
69106
+ : undefined,
69081
69107
  }, onClick: (e) => {
69082
69108
  const tag = e.target?.nodeName;
69083
69109
  if (tag !== 'DIV' && tag !== 'TD') {