react-table-edit 0.2.3 → 0.2.4
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 +11 -7
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1448,6 +1448,10 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1448
1448
|
let letfWidthFix = 0;
|
|
1449
1449
|
let rightWidthFix = 0;
|
|
1450
1450
|
contentColumns.forEach((item, index) => {
|
|
1451
|
+
if (headerColumns.length === 1 && headerColumns[0].length === contentColumns.length) {
|
|
1452
|
+
headerColumns[0][index].visible = item.visible;
|
|
1453
|
+
headerColumns[0][index].fixedType = item.fixedType;
|
|
1454
|
+
}
|
|
1451
1455
|
if (item.fixedType === "left" && item.visible !== false) {
|
|
1452
1456
|
objWidthFix[index] = letfWidthFix;
|
|
1453
1457
|
letfWidthFix += Number(item.minWidth ? item.minWidth : item.field === "#" ? 40 : item.width ? item.width : 0);
|
|
@@ -1463,6 +1467,9 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1463
1467
|
indexlast = index;
|
|
1464
1468
|
}
|
|
1465
1469
|
});
|
|
1470
|
+
if (headerColumns.length === 1 && headerColumns[0].length === contentColumns.length) {
|
|
1471
|
+
setHeaderColumns([...headerColumns]);
|
|
1472
|
+
}
|
|
1466
1473
|
setObjWidthFix(objWidthFix);
|
|
1467
1474
|
setColumnFistEdit(indexFirst + 1);
|
|
1468
1475
|
setColumnlastEdit(indexlast + 1);
|
|
@@ -2622,6 +2629,7 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2622
2629
|
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2623
2630
|
"div",
|
|
2624
2631
|
{
|
|
2632
|
+
role: "textbox",
|
|
2625
2633
|
title: t(col.headerText ?? ""),
|
|
2626
2634
|
style: {
|
|
2627
2635
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
@@ -2643,24 +2651,20 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2643
2651
|
"td",
|
|
2644
2652
|
{
|
|
2645
2653
|
className: (0, import_classnames9.default)(
|
|
2646
|
-
`p-0 px-50 fix-${col.fixedType}`,
|
|
2654
|
+
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
2647
2655
|
{ "cell-fixed": col.fixedType }
|
|
2648
2656
|
),
|
|
2649
2657
|
style: {
|
|
2650
|
-
height: 30,
|
|
2651
|
-
fontSize: 14,
|
|
2652
|
-
fontWeight: 600,
|
|
2653
2658
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
2654
2659
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2655
2660
|
width: col.width,
|
|
2656
2661
|
minWidth: col.minWidth,
|
|
2657
2662
|
maxWidth: col.maxWidth,
|
|
2658
|
-
whiteSpace: "nowrap",
|
|
2659
2663
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2660
2664
|
},
|
|
2661
|
-
children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource?.reduce(function(accumulator, currentValue) {
|
|
2665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource?.reduce(function(accumulator, currentValue) {
|
|
2662
2666
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2663
|
-
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : ""
|
|
2667
|
+
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2664
2668
|
}
|
|
2665
2669
|
) }, `summarycell-${indexCol}`);
|
|
2666
2670
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1422,6 +1422,10 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1422
1422
|
let letfWidthFix = 0;
|
|
1423
1423
|
let rightWidthFix = 0;
|
|
1424
1424
|
contentColumns.forEach((item, index) => {
|
|
1425
|
+
if (headerColumns.length === 1 && headerColumns[0].length === contentColumns.length) {
|
|
1426
|
+
headerColumns[0][index].visible = item.visible;
|
|
1427
|
+
headerColumns[0][index].fixedType = item.fixedType;
|
|
1428
|
+
}
|
|
1425
1429
|
if (item.fixedType === "left" && item.visible !== false) {
|
|
1426
1430
|
objWidthFix[index] = letfWidthFix;
|
|
1427
1431
|
letfWidthFix += Number(item.minWidth ? item.minWidth : item.field === "#" ? 40 : item.width ? item.width : 0);
|
|
@@ -1437,6 +1441,9 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1437
1441
|
indexlast = index;
|
|
1438
1442
|
}
|
|
1439
1443
|
});
|
|
1444
|
+
if (headerColumns.length === 1 && headerColumns[0].length === contentColumns.length) {
|
|
1445
|
+
setHeaderColumns([...headerColumns]);
|
|
1446
|
+
}
|
|
1440
1447
|
setObjWidthFix(objWidthFix);
|
|
1441
1448
|
setColumnFistEdit(indexFirst + 1);
|
|
1442
1449
|
setColumnlastEdit(indexlast + 1);
|
|
@@ -2596,6 +2603,7 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2596
2603
|
children: /* @__PURE__ */ jsx12(
|
|
2597
2604
|
"div",
|
|
2598
2605
|
{
|
|
2606
|
+
role: "textbox",
|
|
2599
2607
|
title: t(col.headerText ?? ""),
|
|
2600
2608
|
style: {
|
|
2601
2609
|
height: `${(col.rowspan ?? 1) * 42}px`,
|
|
@@ -2617,24 +2625,20 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2617
2625
|
"td",
|
|
2618
2626
|
{
|
|
2619
2627
|
className: classnames5(
|
|
2620
|
-
`p-0 px-50 fix-${col.fixedType}`,
|
|
2628
|
+
`p-0 px-50 r-footer fix-${col.fixedType}`,
|
|
2621
2629
|
{ "cell-fixed": col.fixedType }
|
|
2622
2630
|
),
|
|
2623
2631
|
style: {
|
|
2624
|
-
height: 30,
|
|
2625
|
-
fontSize: 14,
|
|
2626
|
-
fontWeight: 600,
|
|
2627
2632
|
left: col.fixedType === "left" ? objWidthFix[indexCol] : void 0,
|
|
2628
2633
|
right: col.fixedType === "right" ? objWidthFix[indexCol] : void 0,
|
|
2629
2634
|
width: col.width,
|
|
2630
2635
|
minWidth: col.minWidth,
|
|
2631
2636
|
maxWidth: col.maxWidth,
|
|
2632
|
-
whiteSpace: "nowrap",
|
|
2633
2637
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
2634
2638
|
},
|
|
2635
|
-
children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource?.reduce(function(accumulator, currentValue) {
|
|
2639
|
+
children: /* @__PURE__ */ jsx12("div", { className: "r-footer-div", children: col.haveSum === true && col.editType === "numeric" ? formartNumberic(dataSource?.reduce(function(accumulator, currentValue) {
|
|
2636
2640
|
return Number(accumulator ?? 0) + Number(currentValue[col.field] ?? 0);
|
|
2637
|
-
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : ""
|
|
2641
|
+
}, 0), decimalSeparator, thousandSeparator, col.numericSettings?.fraction, true) : "" })
|
|
2638
2642
|
}
|
|
2639
2643
|
) }, `summarycell-${indexCol}`);
|
|
2640
2644
|
};
|