react-table-edit 0.2.4 → 0.2.6

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
@@ -1454,11 +1454,12 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
1454
1454
  }
1455
1455
  if (item.fixedType === "left" && item.visible !== false) {
1456
1456
  objWidthFix[index] = letfWidthFix;
1457
- letfWidthFix += Number(item.minWidth ? item.minWidth : item.field === "#" ? 40 : item.width ? item.width : 0);
1457
+ letfWidthFix += Number(item.maxWidth ? item.maxWidth : item.width ? item.width : item.minWidth ?? 40);
1458
1458
  }
1459
- if (contentColumns[contentColumns.length - 1 - index].fixedType === "right" && contentColumns[contentColumns.length - 1 - index].visible !== false) {
1459
+ const lasColumn = contentColumns[contentColumns.length - 1 - index];
1460
+ if (lasColumn.fixedType === "right" && lasColumn.visible !== false) {
1460
1461
  objWidthFix[contentColumns.length - 1 - index] = rightWidthFix;
1461
- rightWidthFix += Number(contentColumns[contentColumns.length - 1 - index].minWidth ? contentColumns[contentColumns.length - 1 - index].minWidth : contentColumns[contentColumns.length - 1 - index].field === "#" ? 40 : contentColumns[contentColumns.length - 1 - index].width ? contentColumns[contentColumns.length - 1 - index].width : 0);
1462
+ rightWidthFix += Number(lasColumn.maxWidth ? lasColumn.maxWidth : lasColumn.width ? lasColumn.width : lasColumn.minWidth ?? 40);
1462
1463
  }
1463
1464
  if (item.editEnable && item.visible !== false && !item.disabledCondition) {
1464
1465
  if (indexFirst === -1) {
@@ -1573,6 +1574,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
1573
1574
  const handleKeyPress = (e) => {
1574
1575
  if (e.code === "Enter" || e.code === "NumpadEnter") {
1575
1576
  setSearchTerm(e.target.value);
1577
+ e.stopPropagation();
1576
1578
  }
1577
1579
  };
1578
1580
  const searchTemplate = () => {
@@ -2494,22 +2496,41 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2494
2496
  e.stopPropagation();
2495
2497
  }
2496
2498
  },
2497
- title: `${value ?? ""}`,
2498
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_classnames9.default)("r-rowcell-div"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2499
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2499
2500
  "div",
2500
2501
  {
2501
- id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2502
- className: (0, import_classnames9.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
2502
+ className: (0, import_classnames9.default)("r-rowcell-div"),
2503
2503
  style: {
2504
- padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2505
- margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2504
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
2506
2505
  },
2507
- children: [
2508
- typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : typeDis === 2 ? col.template(row, indexRow) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "r-cell-text", style: { maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth }, children: value }),
2509
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "icon-table", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ej2_react_popups.TooltipComponent, { className: (0, import_classnames9.default)("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage?.toString() ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.AlertCircle, { fontSize: 16.5 }) }) })
2510
- ]
2506
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2507
+ "div",
2508
+ {
2509
+ id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2510
+ className: (0, import_classnames9.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
2511
+ style: {
2512
+ padding: typeDis === 1 ? 2 : !errorMessage ? "6px 10px" : 0,
2513
+ width: typeDis === 1 ? "calc(100% - 4px)" : !errorMessage ? "calc(100% - 20px)" : "0"
2514
+ },
2515
+ children: [
2516
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : col.editType === "numeric" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2517
+ import_ej2_react_popups.TooltipComponent,
2518
+ {
2519
+ content: typeDis === 2 ? col.template(row, indexRow)?.toString() : value,
2520
+ className: "r-cell-text",
2521
+ style: {
2522
+ display: "block",
2523
+ maxWidth: (col.editType ?? "text") === "text" ? col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto" : "auto"
2524
+ },
2525
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2526
+ }
2527
+ ),
2528
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "icon-table", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ej2_react_popups.TooltipComponent, { className: (0, import_classnames9.default)("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage?.toString() ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_becoxy_icons4.AlertCircle, { fontSize: 16.5 }) }) })
2529
+ ]
2530
+ }
2531
+ )
2511
2532
  }
2512
- ) })
2533
+ )
2513
2534
  },
2514
2535
  `col-${indexRow}-${indexCol}`
2515
2536
  ) }, indexCol);
@@ -2527,11 +2548,11 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2527
2548
  { "cell-fixed": col.fixedType }
2528
2549
  ),
2529
2550
  style: {
2530
- width: col.width,
2531
- minWidth: col.minWidth,
2532
2551
  top: `${indexParent * 42}px`,
2533
2552
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2534
2553
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
2554
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2555
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2535
2556
  maxWidth: col.maxWidth
2536
2557
  },
2537
2558
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2619,8 +2640,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2619
2640
  { "cell-fixed": col.fixedType }
2620
2641
  ),
2621
2642
  style: {
2622
- width: col.width,
2623
- minWidth: col.minWidth,
2643
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2644
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2624
2645
  top: `${indexParent * 42}px`,
2625
2646
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2626
2647
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
@@ -2657,8 +2678,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2657
2678
  style: {
2658
2679
  left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2659
2680
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2660
- width: col.width,
2661
- minWidth: col.minWidth,
2681
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2682
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2662
2683
  maxWidth: col.maxWidth,
2663
2684
  textAlign: col.textAlign ? col.textAlign : "left"
2664
2685
  },
package/dist/index.mjs CHANGED
@@ -1428,11 +1428,12 @@ var TableEdit = forwardRef2((props, ref) => {
1428
1428
  }
1429
1429
  if (item.fixedType === "left" && item.visible !== false) {
1430
1430
  objWidthFix[index] = letfWidthFix;
1431
- letfWidthFix += Number(item.minWidth ? item.minWidth : item.field === "#" ? 40 : item.width ? item.width : 0);
1431
+ letfWidthFix += Number(item.maxWidth ? item.maxWidth : item.width ? item.width : item.minWidth ?? 40);
1432
1432
  }
1433
- if (contentColumns[contentColumns.length - 1 - index].fixedType === "right" && contentColumns[contentColumns.length - 1 - index].visible !== false) {
1433
+ const lasColumn = contentColumns[contentColumns.length - 1 - index];
1434
+ if (lasColumn.fixedType === "right" && lasColumn.visible !== false) {
1434
1435
  objWidthFix[contentColumns.length - 1 - index] = rightWidthFix;
1435
- rightWidthFix += Number(contentColumns[contentColumns.length - 1 - index].minWidth ? contentColumns[contentColumns.length - 1 - index].minWidth : contentColumns[contentColumns.length - 1 - index].field === "#" ? 40 : contentColumns[contentColumns.length - 1 - index].width ? contentColumns[contentColumns.length - 1 - index].width : 0);
1436
+ rightWidthFix += Number(lasColumn.maxWidth ? lasColumn.maxWidth : lasColumn.width ? lasColumn.width : lasColumn.minWidth ?? 40);
1436
1437
  }
1437
1438
  if (item.editEnable && item.visible !== false && !item.disabledCondition) {
1438
1439
  if (indexFirst === -1) {
@@ -1547,6 +1548,7 @@ var TableEdit = forwardRef2((props, ref) => {
1547
1548
  const handleKeyPress = (e) => {
1548
1549
  if (e.code === "Enter" || e.code === "NumpadEnter") {
1549
1550
  setSearchTerm(e.target.value);
1551
+ e.stopPropagation();
1550
1552
  }
1551
1553
  };
1552
1554
  const searchTemplate = () => {
@@ -2468,22 +2470,41 @@ var TableEdit = forwardRef2((props, ref) => {
2468
2470
  e.stopPropagation();
2469
2471
  }
2470
2472
  },
2471
- title: `${value ?? ""}`,
2472
- children: /* @__PURE__ */ jsx12("div", { className: classnames5("r-rowcell-div"), children: /* @__PURE__ */ jsxs11(
2473
+ children: /* @__PURE__ */ jsx12(
2473
2474
  "div",
2474
2475
  {
2475
- id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2476
- className: classnames5("r-rowcell-content", { "r-is-invalid": errorMessage }),
2476
+ className: classnames5("r-rowcell-div"),
2477
2477
  style: {
2478
- padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2479
- margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2478
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
2480
2479
  },
2481
- children: [
2482
- typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : typeDis === 2 ? col.template(row, indexRow) : /* @__PURE__ */ jsx12("div", { className: "r-cell-text", style: { maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth }, children: value }),
2483
- /* @__PURE__ */ jsx12("span", { className: "icon-table", children: /* @__PURE__ */ jsx12(TooltipComponent, { className: classnames5("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage?.toString() ?? "", children: /* @__PURE__ */ jsx12(AlertCircle, { fontSize: 16.5 }) }) })
2484
- ]
2480
+ children: /* @__PURE__ */ jsxs11(
2481
+ "div",
2482
+ {
2483
+ id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2484
+ className: classnames5("r-rowcell-content", { "r-is-invalid": errorMessage }),
2485
+ style: {
2486
+ padding: typeDis === 1 ? 2 : !errorMessage ? "6px 10px" : 0,
2487
+ width: typeDis === 1 ? "calc(100% - 4px)" : !errorMessage ? "calc(100% - 20px)" : "0"
2488
+ },
2489
+ children: [
2490
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : col.editType === "numeric" ? /* @__PURE__ */ jsx12("div", { className: "r-cell-text", children: typeDis === 2 ? col.template(row, indexRow) : value }) : /* @__PURE__ */ jsx12(
2491
+ TooltipComponent,
2492
+ {
2493
+ content: typeDis === 2 ? col.template(row, indexRow)?.toString() : value,
2494
+ className: "r-cell-text",
2495
+ style: {
2496
+ display: "block",
2497
+ maxWidth: (col.editType ?? "text") === "text" ? col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto" : "auto"
2498
+ },
2499
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2500
+ }
2501
+ ),
2502
+ /* @__PURE__ */ jsx12("span", { className: "icon-table", children: /* @__PURE__ */ jsx12(TooltipComponent, { className: classnames5("cursor-pointer text-primary", { "d-none": !errorMessage }), content: errorMessage?.toString() ?? "", children: /* @__PURE__ */ jsx12(AlertCircle, { fontSize: 16.5 }) }) })
2503
+ ]
2504
+ }
2505
+ )
2485
2506
  }
2486
- ) })
2507
+ )
2487
2508
  },
2488
2509
  `col-${indexRow}-${indexCol}`
2489
2510
  ) }, indexCol);
@@ -2501,11 +2522,11 @@ var TableEdit = forwardRef2((props, ref) => {
2501
2522
  { "cell-fixed": col.fixedType }
2502
2523
  ),
2503
2524
  style: {
2504
- width: col.width,
2505
- minWidth: col.minWidth,
2506
2525
  top: `${indexParent * 42}px`,
2507
2526
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2508
2527
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
2528
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2529
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2509
2530
  maxWidth: col.maxWidth
2510
2531
  },
2511
2532
  children: /* @__PURE__ */ jsx12(
@@ -2593,8 +2614,8 @@ var TableEdit = forwardRef2((props, ref) => {
2593
2614
  { "cell-fixed": col.fixedType }
2594
2615
  ),
2595
2616
  style: {
2596
- width: col.width,
2597
- minWidth: col.minWidth,
2617
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2618
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2598
2619
  top: `${indexParent * 42}px`,
2599
2620
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2600
2621
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
@@ -2631,8 +2652,8 @@ var TableEdit = forwardRef2((props, ref) => {
2631
2652
  style: {
2632
2653
  left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2633
2654
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2634
- width: col.width,
2635
- minWidth: col.minWidth,
2655
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2656
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2636
2657
  maxWidth: col.maxWidth,
2637
2658
  textAlign: col.textAlign ? col.textAlign : "left"
2638
2659
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-table-edit",
3
3
  "license": "MIT",
4
- "version": "0.2.4",
4
+ "version": "0.2.6",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",