react-table-edit 0.2.4 → 0.2.5

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) {
@@ -2494,22 +2495,49 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2494
2495
  e.stopPropagation();
2495
2496
  }
2496
2497
  },
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)(
2498
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2499
2499
  "div",
2500
2500
  {
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 }),
2501
+ className: (0, import_classnames9.default)("r-rowcell-div"),
2503
2502
  style: {
2504
- padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2505
- margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2503
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
2506
2504
  },
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
- ]
2505
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2506
+ "div",
2507
+ {
2508
+ id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2509
+ className: (0, import_classnames9.default)("r-rowcell-content", { "r-is-invalid": errorMessage }),
2510
+ style: {
2511
+ padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2512
+ margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2513
+ },
2514
+ children: [
2515
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : col.editType === "numeric" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2516
+ "div",
2517
+ {
2518
+ className: "r-cell-text",
2519
+ style: {
2520
+ maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto"
2521
+ },
2522
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2523
+ }
2524
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2525
+ import_ej2_react_popups.TooltipComponent,
2526
+ {
2527
+ content: typeDis === 2 ? col.template(row, indexRow)?.toString() : value,
2528
+ className: "r-cell-text",
2529
+ style: {
2530
+ maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto"
2531
+ },
2532
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2533
+ }
2534
+ ),
2535
+ /* @__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 }) }) })
2536
+ ]
2537
+ }
2538
+ )
2511
2539
  }
2512
- ) })
2540
+ )
2513
2541
  },
2514
2542
  `col-${indexRow}-${indexCol}`
2515
2543
  ) }, indexCol);
@@ -2527,11 +2555,11 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2527
2555
  { "cell-fixed": col.fixedType }
2528
2556
  ),
2529
2557
  style: {
2530
- width: col.width,
2531
- minWidth: col.minWidth,
2532
2558
  top: `${indexParent * 42}px`,
2533
2559
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2534
2560
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
2561
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2562
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2535
2563
  maxWidth: col.maxWidth
2536
2564
  },
2537
2565
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2619,8 +2647,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2619
2647
  { "cell-fixed": col.fixedType }
2620
2648
  ),
2621
2649
  style: {
2622
- width: col.width,
2623
- minWidth: col.minWidth,
2650
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2651
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2624
2652
  top: `${indexParent * 42}px`,
2625
2653
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2626
2654
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
@@ -2657,8 +2685,8 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
2657
2685
  style: {
2658
2686
  left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2659
2687
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2660
- width: col.width,
2661
- minWidth: col.minWidth,
2688
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2689
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2662
2690
  maxWidth: col.maxWidth,
2663
2691
  textAlign: col.textAlign ? col.textAlign : "left"
2664
2692
  },
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) {
@@ -2468,22 +2469,49 @@ var TableEdit = forwardRef2((props, ref) => {
2468
2469
  e.stopPropagation();
2469
2470
  }
2470
2471
  },
2471
- title: `${value ?? ""}`,
2472
- children: /* @__PURE__ */ jsx12("div", { className: classnames5("r-rowcell-div"), children: /* @__PURE__ */ jsxs11(
2472
+ children: /* @__PURE__ */ jsx12(
2473
2473
  "div",
2474
2474
  {
2475
- id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2476
- className: classnames5("r-rowcell-content", { "r-is-invalid": errorMessage }),
2475
+ className: classnames5("r-rowcell-div"),
2477
2476
  style: {
2478
- padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2479
- margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2477
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
2480
2478
  },
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
- ]
2479
+ children: /* @__PURE__ */ jsxs11(
2480
+ "div",
2481
+ {
2482
+ id: indexFocus === indexRow && typeDis !== 1 ? `${idTable}-col${indexCol + 1}-row${indexRow + 1}` : "",
2483
+ className: classnames5("r-rowcell-content", { "r-is-invalid": errorMessage }),
2484
+ style: {
2485
+ padding: typeDis !== 1 && errorMessage ? "6px 10px" : 0,
2486
+ margin: typeDis !== 1 && !errorMessage ? "6px 10px" : 2
2487
+ },
2488
+ children: [
2489
+ typeDis === 1 && !refreshRow ? renderEdit(row, col, indexRow, indexCol) : col.editType === "numeric" ? /* @__PURE__ */ jsx12(
2490
+ "div",
2491
+ {
2492
+ className: "r-cell-text",
2493
+ style: {
2494
+ maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto"
2495
+ },
2496
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2497
+ }
2498
+ ) : /* @__PURE__ */ jsx12(
2499
+ TooltipComponent,
2500
+ {
2501
+ content: typeDis === 2 ? col.template(row, indexRow)?.toString() : value,
2502
+ className: "r-cell-text",
2503
+ style: {
2504
+ maxWidth: col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto"
2505
+ },
2506
+ children: typeDis === 2 ? col.template(row, indexRow) : value
2507
+ }
2508
+ ),
2509
+ /* @__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 }) }) })
2510
+ ]
2511
+ }
2512
+ )
2485
2513
  }
2486
- ) })
2514
+ )
2487
2515
  },
2488
2516
  `col-${indexRow}-${indexCol}`
2489
2517
  ) }, indexCol);
@@ -2501,11 +2529,11 @@ var TableEdit = forwardRef2((props, ref) => {
2501
2529
  { "cell-fixed": col.fixedType }
2502
2530
  ),
2503
2531
  style: {
2504
- width: col.width,
2505
- minWidth: col.minWidth,
2506
2532
  top: `${indexParent * 42}px`,
2507
2533
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2508
2534
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
2535
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2536
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2509
2537
  maxWidth: col.maxWidth
2510
2538
  },
2511
2539
  children: /* @__PURE__ */ jsx12(
@@ -2593,8 +2621,8 @@ var TableEdit = forwardRef2((props, ref) => {
2593
2621
  { "cell-fixed": col.fixedType }
2594
2622
  ),
2595
2623
  style: {
2596
- width: col.width,
2597
- minWidth: col.minWidth,
2624
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2625
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2598
2626
  top: `${indexParent * 42}px`,
2599
2627
  left: col.fixedType === "left" ? objWidthFix[col.index ?? 0] : void 0,
2600
2628
  right: col.fixedType === "right" ? objWidthFix[col.index ?? 0] : void 0,
@@ -2631,8 +2659,8 @@ var TableEdit = forwardRef2((props, ref) => {
2631
2659
  style: {
2632
2660
  left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
2633
2661
  right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
2634
- width: col.width,
2635
- minWidth: col.minWidth,
2662
+ width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.width,
2663
+ minWidth: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : col.minWidth,
2636
2664
  maxWidth: col.maxWidth,
2637
2665
  textAlign: col.textAlign ? col.textAlign : "left"
2638
2666
  },
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.5",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",