react-table-edit 0.4.3 → 0.4.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 +43 -10
- package/dist/index.mjs +43 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1534,6 +1534,11 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1534
1534
|
let totalCount = dataSource.length;
|
|
1535
1535
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
1536
1536
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
1537
|
+
(0, import_react12.useEffect)(() => {
|
|
1538
|
+
if (pagingClient && pagingSetting.setCurrentPage && dataSource?.length / (pagingSetting?.pageSize ?? 1) > (pagingSetting.currentPage ?? 1)) {
|
|
1539
|
+
pagingSetting.setCurrentPage(1);
|
|
1540
|
+
}
|
|
1541
|
+
}, [dataSource]);
|
|
1537
1542
|
(0, import_react12.useEffect)(() => {
|
|
1538
1543
|
let indexFirst = -1;
|
|
1539
1544
|
let indexlast = -1;
|
|
@@ -1584,6 +1589,23 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
1584
1589
|
setHeaderColumns(arrHeaderColumns);
|
|
1585
1590
|
setContentColumns(arrContentColumns);
|
|
1586
1591
|
}, [columns]);
|
|
1592
|
+
(0, import_react12.useEffect)(() => {
|
|
1593
|
+
const arrHeaderColumns = [];
|
|
1594
|
+
const arrContentColumns = [];
|
|
1595
|
+
let headerLevelRow = 0;
|
|
1596
|
+
if (levelCol) {
|
|
1597
|
+
headerLevelRow = levelCol;
|
|
1598
|
+
} else {
|
|
1599
|
+
headerLevelRow = stretchColumn(columns, 0);
|
|
1600
|
+
setLevelCol(headerLevelRow);
|
|
1601
|
+
}
|
|
1602
|
+
for (let i = 0; i < headerLevelRow; i++) {
|
|
1603
|
+
arrHeaderColumns.push([]);
|
|
1604
|
+
}
|
|
1605
|
+
getNestedChildren(columns, arrHeaderColumns, arrContentColumns, 0, headerLevelRow);
|
|
1606
|
+
setHeaderColumns(arrHeaderColumns);
|
|
1607
|
+
setContentColumns(arrContentColumns);
|
|
1608
|
+
}, [columns]);
|
|
1587
1609
|
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level, maxLevelRow) => {
|
|
1588
1610
|
array.forEach((item) => {
|
|
1589
1611
|
const ele = { ...item, visible: item.visible, rowspan: 1, index: 0 };
|
|
@@ -2891,22 +2913,26 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2891
2913
|
};
|
|
2892
2914
|
const renderData = () => {
|
|
2893
2915
|
totalCount = 0;
|
|
2916
|
+
let countDisplay = -1;
|
|
2894
2917
|
return dataSource.map((row, indexRow) => {
|
|
2895
2918
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
2896
2919
|
const flagSearch = !searchClient || checkSearch(searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm, row, searchSetting?.keyField ?? []);
|
|
2897
2920
|
if (flagSearch) {
|
|
2898
2921
|
totalCount += 1;
|
|
2899
2922
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2923
|
+
if (flagDisplay) {
|
|
2924
|
+
countDisplay++;
|
|
2925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2926
|
+
"tr",
|
|
2927
|
+
{
|
|
2928
|
+
className: (0, import_classnames10.default)("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
2929
|
+
children: contentColumns.map((col, indexCol) => {
|
|
2930
|
+
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
2931
|
+
})
|
|
2932
|
+
},
|
|
2933
|
+
`row-${indexRow}`
|
|
2934
|
+
);
|
|
2935
|
+
}
|
|
2910
2936
|
}
|
|
2911
2937
|
});
|
|
2912
2938
|
};
|
|
@@ -2956,6 +2982,13 @@ var TableEdit = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
2956
2982
|
});
|
|
2957
2983
|
var table_default = TableEdit;
|
|
2958
2984
|
|
|
2985
|
+
// test-app/src/component/tab-menu/index.tsx
|
|
2986
|
+
var import_becoxy_icons5 = require("becoxy-icons");
|
|
2987
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
2988
|
+
var import_react13 = require("react");
|
|
2989
|
+
var import_reactstrap9 = require("reactstrap");
|
|
2990
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2991
|
+
|
|
2959
2992
|
// index.ts
|
|
2960
2993
|
var Table_edit_default = table_default;
|
|
2961
2994
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -1493,6 +1493,11 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1493
1493
|
let totalCount = dataSource.length;
|
|
1494
1494
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
|
|
1495
1495
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
1496
|
+
useEffect5(() => {
|
|
1497
|
+
if (pagingClient && pagingSetting.setCurrentPage && dataSource?.length / (pagingSetting?.pageSize ?? 1) > (pagingSetting.currentPage ?? 1)) {
|
|
1498
|
+
pagingSetting.setCurrentPage(1);
|
|
1499
|
+
}
|
|
1500
|
+
}, [dataSource]);
|
|
1496
1501
|
useEffect5(() => {
|
|
1497
1502
|
let indexFirst = -1;
|
|
1498
1503
|
let indexlast = -1;
|
|
@@ -1543,6 +1548,23 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
1543
1548
|
setHeaderColumns(arrHeaderColumns);
|
|
1544
1549
|
setContentColumns(arrContentColumns);
|
|
1545
1550
|
}, [columns]);
|
|
1551
|
+
useEffect5(() => {
|
|
1552
|
+
const arrHeaderColumns = [];
|
|
1553
|
+
const arrContentColumns = [];
|
|
1554
|
+
let headerLevelRow = 0;
|
|
1555
|
+
if (levelCol) {
|
|
1556
|
+
headerLevelRow = levelCol;
|
|
1557
|
+
} else {
|
|
1558
|
+
headerLevelRow = stretchColumn(columns, 0);
|
|
1559
|
+
setLevelCol(headerLevelRow);
|
|
1560
|
+
}
|
|
1561
|
+
for (let i = 0; i < headerLevelRow; i++) {
|
|
1562
|
+
arrHeaderColumns.push([]);
|
|
1563
|
+
}
|
|
1564
|
+
getNestedChildren(columns, arrHeaderColumns, arrContentColumns, 0, headerLevelRow);
|
|
1565
|
+
setHeaderColumns(arrHeaderColumns);
|
|
1566
|
+
setContentColumns(arrContentColumns);
|
|
1567
|
+
}, [columns]);
|
|
1546
1568
|
const getNestedChildren = (array, arrHeaderColumns, arrContentColumns, level, maxLevelRow) => {
|
|
1547
1569
|
array.forEach((item) => {
|
|
1548
1570
|
const ele = { ...item, visible: item.visible, rowspan: 1, index: 0 };
|
|
@@ -2850,22 +2872,26 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2850
2872
|
};
|
|
2851
2873
|
const renderData = () => {
|
|
2852
2874
|
totalCount = 0;
|
|
2875
|
+
let countDisplay = -1;
|
|
2853
2876
|
return dataSource.map((row, indexRow) => {
|
|
2854
2877
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
2855
2878
|
const flagSearch = !searchClient || checkSearch(searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm, row, searchSetting?.keyField ?? []);
|
|
2856
2879
|
if (flagSearch) {
|
|
2857
2880
|
totalCount += 1;
|
|
2858
2881
|
const flagDisplay = !pagingClient || totalCount > (pagingSetting.pageSize ?? 0) * ((pagingSetting.currentPage ?? 0) - 1) && totalCount <= (pagingSetting.pageSize ?? 0) * (pagingSetting.currentPage ?? 0);
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2882
|
+
if (flagDisplay) {
|
|
2883
|
+
countDisplay++;
|
|
2884
|
+
return /* @__PURE__ */ jsx12(
|
|
2885
|
+
"tr",
|
|
2886
|
+
{
|
|
2887
|
+
className: classnames6("r-row", { "fisrt-row": countDisplay === 0 }),
|
|
2888
|
+
children: contentColumns.map((col, indexCol) => {
|
|
2889
|
+
return renderContentCol(col, row, indexRow, indexCol, isSelected);
|
|
2890
|
+
})
|
|
2891
|
+
},
|
|
2892
|
+
`row-${indexRow}`
|
|
2893
|
+
);
|
|
2894
|
+
}
|
|
2869
2895
|
}
|
|
2870
2896
|
});
|
|
2871
2897
|
};
|
|
@@ -2915,6 +2941,13 @@ var TableEdit = forwardRef2((props, ref) => {
|
|
|
2915
2941
|
});
|
|
2916
2942
|
var table_default = TableEdit;
|
|
2917
2943
|
|
|
2944
|
+
// test-app/src/component/tab-menu/index.tsx
|
|
2945
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "becoxy-icons";
|
|
2946
|
+
import classNames5 from "classnames";
|
|
2947
|
+
import { Fragment as Fragment14, useEffect as useEffect6, useState as useState6 } from "react";
|
|
2948
|
+
import { DropdownItem as DropdownItem2, DropdownMenu as DropdownMenu3, DropdownToggle as DropdownToggle3, UncontrolledDropdown as UncontrolledDropdown2 } from "reactstrap";
|
|
2949
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2950
|
+
|
|
2918
2951
|
// index.ts
|
|
2919
2952
|
var Table_edit_default = table_default;
|
|
2920
2953
|
export {
|