react-table-edit 1.2.35 → 1.2.36

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
@@ -3334,9 +3334,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
3334
3334
  },
3335
3335
  onBlur: () => {
3336
3336
  if (floatValue !== row[col.field]) {
3337
- row[col.field] = floatValue;
3337
+ row[col.field] = !isNaN(floatValue) ? floatValue : 0;
3338
3338
  if (col.callback) {
3339
- col.callback(floatValue, indexRow);
3339
+ col.callback(row[col.field], indexRow);
3340
3340
  }
3341
3341
  handleDataChange(row, col, indexRow);
3342
3342
  }
@@ -3344,9 +3344,9 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
3344
3344
  onKeyDown: (e) => {
3345
3345
  if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
3346
3346
  if (floatValue !== row[col.field]) {
3347
- row[col.field] = floatValue;
3347
+ row[col.field] = !isNaN(floatValue) ? floatValue : 0;
3348
3348
  if (col.callback) {
3349
- col.callback(floatValue, indexRow);
3349
+ col.callback(row[col.field], indexRow);
3350
3350
  }
3351
3351
  handleDataChange(row, col, indexRow);
3352
3352
  }
@@ -4026,7 +4026,7 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
4026
4026
  `${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
4027
4027
  ] }) : value }),
4028
4028
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { id: `error-${indexRow}-${indexCol}`, className: (0, import_classnames14.default)("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_becoxy_icons7.AlertCircle, { fontSize: 15.5 }) }),
4029
- !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
4029
+ !(typeDis === 1 && !refreshRow) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_reactstrap11.UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
4030
4030
  " ",
4031
4031
  `${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
4032
4032
  ] }) : value }),
@@ -4048,10 +4048,6 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
4048
4048
  ) }, indexCol);
4049
4049
  }
4050
4050
  };
4051
- const checkOverflow = (indexRow, indexCol) => {
4052
- const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
4053
- return element && element.scrollWidth > element.clientWidth;
4054
- };
4055
4051
  const renderFooterCol = (col, indexCol) => {
4056
4052
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react16.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4057
4053
  "td",
package/dist/index.mjs CHANGED
@@ -3304,9 +3304,9 @@ var TableEdit = forwardRef4((props, ref) => {
3304
3304
  },
3305
3305
  onBlur: () => {
3306
3306
  if (floatValue !== row[col.field]) {
3307
- row[col.field] = floatValue;
3307
+ row[col.field] = !isNaN(floatValue) ? floatValue : 0;
3308
3308
  if (col.callback) {
3309
- col.callback(floatValue, indexRow);
3309
+ col.callback(row[col.field], indexRow);
3310
3310
  }
3311
3311
  handleDataChange(row, col, indexRow);
3312
3312
  }
@@ -3314,9 +3314,9 @@ var TableEdit = forwardRef4((props, ref) => {
3314
3314
  onKeyDown: (e) => {
3315
3315
  if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
3316
3316
  if (floatValue !== row[col.field]) {
3317
- row[col.field] = floatValue;
3317
+ row[col.field] = !isNaN(floatValue) ? floatValue : 0;
3318
3318
  if (col.callback) {
3319
- col.callback(floatValue, indexRow);
3319
+ col.callback(row[col.field], indexRow);
3320
3320
  }
3321
3321
  handleDataChange(row, col, indexRow);
3322
3322
  }
@@ -3996,7 +3996,7 @@ var TableEdit = forwardRef4((props, ref) => {
3996
3996
  `${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
3997
3997
  ] }) : value }),
3998
3998
  /* @__PURE__ */ jsx16("span", { id: `error-${indexRow}-${indexCol}`, className: classnames9("cursor-pointer text-primary icon-table", { "d-none": !errorMessage }), children: /* @__PURE__ */ jsx16(AlertCircle, { fontSize: 15.5 }) }),
3999
- !(typeDis === 1 && !refreshRow) && checkOverflow(indexRow, indexCol) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs15("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
3999
+ !(typeDis === 1 && !refreshRow) && /* @__PURE__ */ jsx16(UncontrolledTooltip5, { className: "r-tooltip", autohide: false, target: `content-${idTable}-row${indexRow}col-${indexCol}`, children: typeDis === 2 ? col.template(row, indexRow) : col.editType === "numeric" && Number(row[col.field]) < 0 ? /* @__PURE__ */ jsxs15("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: [
4000
4000
  " ",
4001
4001
  `${formatSetting?.prefixNegative ?? "-"}${value}${formatSetting?.suffixNegative ?? ""}`
4002
4002
  ] }) : value }),
@@ -4018,10 +4018,6 @@ var TableEdit = forwardRef4((props, ref) => {
4018
4018
  ) }, indexCol);
4019
4019
  }
4020
4020
  };
4021
- const checkOverflow = (indexRow, indexCol) => {
4022
- const element = document.getElementById(`content-${idTable}-row${indexRow}col-${indexCol}`);
4023
- return element && element.scrollWidth > element.clientWidth;
4024
- };
4025
4021
  const renderFooterCol = (col, indexCol) => {
4026
4022
  return /* @__PURE__ */ jsx16(Fragment20, { children: col.visible !== false && /* @__PURE__ */ jsx16(
4027
4023
  "td",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-table-edit",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",