baaz-custom-components 5.2.3 → 5.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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +57 -13
- package/dist/index.mjs +57 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -105,6 +105,7 @@ type GridProps = {
|
|
|
105
105
|
filterList: Filters[];
|
|
106
106
|
initialFilters?: any[];
|
|
107
107
|
children?: React.ReactNode;
|
|
108
|
+
onRowClick?: (row: AnyRow) => void;
|
|
108
109
|
onSortChange?: (key: string, order: SortOrder) => void;
|
|
109
110
|
onExportPdf?: () => void;
|
|
110
111
|
onExportExcel?: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ type GridProps = {
|
|
|
105
105
|
filterList: Filters[];
|
|
106
106
|
initialFilters?: any[];
|
|
107
107
|
children?: React.ReactNode;
|
|
108
|
+
onRowClick?: (row: AnyRow) => void;
|
|
108
109
|
onSortChange?: (key: string, order: SortOrder) => void;
|
|
109
110
|
onExportPdf?: () => void;
|
|
110
111
|
onExportExcel?: () => void;
|
package/dist/index.js
CHANGED
|
@@ -2412,7 +2412,6 @@ function GridHeader({
|
|
|
2412
2412
|
onSelectionAction,
|
|
2413
2413
|
onClearSelection
|
|
2414
2414
|
}) {
|
|
2415
|
-
console.log("GridHeader rendered");
|
|
2416
2415
|
const [downloadMenu, setDownloadMenu] = (0, import_react6.useState)(false);
|
|
2417
2416
|
const [searchOpen, setSearchOpen] = (0, import_react6.useState)(false);
|
|
2418
2417
|
const downloadRef = (0, import_react6.useRef)(null);
|
|
@@ -2573,15 +2572,15 @@ function useStore(store, name) {
|
|
|
2573
2572
|
// src/components/custom/grid/checkboxCell/checkBoxCell.tsx
|
|
2574
2573
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2575
2574
|
var CheckboxCell = ({ row, api, column }) => {
|
|
2576
|
-
console.log("CheckboxCell rendered");
|
|
2577
2575
|
const selectedRows = useStore(api, "selectedRows");
|
|
2578
2576
|
const isSelected = selectedRows.includes(row.id);
|
|
2579
2577
|
const handleChange = (e) => {
|
|
2580
|
-
var _a, _b;
|
|
2578
|
+
var _a, _b, _c, _d;
|
|
2581
2579
|
e.stopPropagation();
|
|
2582
2580
|
const isChecked = e.target.checked;
|
|
2581
|
+
(_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.markCheckboxAction) == null ? void 0 : _b.call(_a);
|
|
2583
2582
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2584
|
-
(
|
|
2583
|
+
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectionChange) == null ? void 0 : _d.call(_c, row.id, row, isChecked);
|
|
2585
2584
|
};
|
|
2586
2585
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2587
2586
|
"div",
|
|
@@ -2651,6 +2650,8 @@ var HeaderCheckbox = ({ api, column }) => {
|
|
|
2651
2650
|
const pageData = (_b = (_a2 = column == null ? void 0 : column.config) == null ? void 0 : _a2.getPageData()) != null ? _b : [];
|
|
2652
2651
|
const dataArray = Array.isArray(pageData) ? pageData : [];
|
|
2653
2652
|
dataArray.forEach((row) => {
|
|
2653
|
+
var _a3, _b2;
|
|
2654
|
+
(_b2 = (_a3 = column == null ? void 0 : column.config) == null ? void 0 : _a3.markCheckboxAction) == null ? void 0 : _b2.call(_a3);
|
|
2654
2655
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2655
2656
|
});
|
|
2656
2657
|
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectAllPage) == null ? void 0 : _d.call(_c, dataArray, isChecked);
|
|
@@ -2681,13 +2682,15 @@ function buildCheckboxColumn({
|
|
|
2681
2682
|
getPageData,
|
|
2682
2683
|
onSelectionChange,
|
|
2683
2684
|
onSelectAllPage,
|
|
2684
|
-
clearToken
|
|
2685
|
+
clearToken,
|
|
2686
|
+
markCheckboxAction
|
|
2685
2687
|
}) {
|
|
2686
2688
|
const configRef = {
|
|
2687
2689
|
getPageData,
|
|
2688
2690
|
onSelectionChange,
|
|
2689
2691
|
onSelectAllPage,
|
|
2690
|
-
clearToken
|
|
2692
|
+
clearToken,
|
|
2693
|
+
markCheckboxAction
|
|
2691
2694
|
};
|
|
2692
2695
|
return {
|
|
2693
2696
|
id: "__selection__",
|
|
@@ -2702,6 +2705,15 @@ function buildCheckboxColumn({
|
|
|
2702
2705
|
|
|
2703
2706
|
// src/components/custom/grid/index.tsx
|
|
2704
2707
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2708
|
+
var _measureCanvas = typeof window !== "undefined" ? document.createElement("canvas") : null;
|
|
2709
|
+
function measureHeaderTextWidth(text) {
|
|
2710
|
+
if (!_measureCanvas) return 0;
|
|
2711
|
+
const ctx = _measureCanvas.getContext("2d");
|
|
2712
|
+
if (!ctx) return 0;
|
|
2713
|
+
ctx.font = "500 13px Inter, ui-sans-serif, system-ui, sans-serif";
|
|
2714
|
+
const textWidth = ctx.measureText(text).width;
|
|
2715
|
+
return Math.ceil(textWidth) + 64;
|
|
2716
|
+
}
|
|
2705
2717
|
var Grid = (0, import_react10.forwardRef)(
|
|
2706
2718
|
(_a, ref) => {
|
|
2707
2719
|
var _b = _a, {
|
|
@@ -2727,7 +2739,8 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2727
2739
|
selectedData,
|
|
2728
2740
|
selectionActions,
|
|
2729
2741
|
onSelectionAction,
|
|
2730
|
-
onClearSelection
|
|
2742
|
+
onClearSelection,
|
|
2743
|
+
onRowClick
|
|
2731
2744
|
} = _b, rest = __objRest(_b, [
|
|
2732
2745
|
"data",
|
|
2733
2746
|
"columns",
|
|
@@ -2751,12 +2764,13 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2751
2764
|
"selectedData",
|
|
2752
2765
|
"selectionActions",
|
|
2753
2766
|
"onSelectionAction",
|
|
2754
|
-
"onClearSelection"
|
|
2767
|
+
"onClearSelection",
|
|
2768
|
+
"onRowClick"
|
|
2755
2769
|
]);
|
|
2756
2770
|
var _a2;
|
|
2757
|
-
console.log("Grid rendered");
|
|
2758
2771
|
const apiRef = (0, import_react10.useRef)(null);
|
|
2759
2772
|
const containerRef = (0, import_react10.useRef)(null);
|
|
2773
|
+
const isCheckboxActionRef = (0, import_react10.useRef)(false);
|
|
2760
2774
|
const dataRef = (0, import_react10.useRef)(data);
|
|
2761
2775
|
(0, import_react10.useEffect)(() => {
|
|
2762
2776
|
dataRef.current = data;
|
|
@@ -2769,6 +2783,10 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2769
2783
|
(0, import_react10.useEffect)(() => {
|
|
2770
2784
|
onSelectAllPageRef.current = onSelectAllPage;
|
|
2771
2785
|
}, [onSelectAllPage]);
|
|
2786
|
+
const onRowClickRef = (0, import_react10.useRef)(onRowClick);
|
|
2787
|
+
(0, import_react10.useEffect)(() => {
|
|
2788
|
+
onRowClickRef.current = onRowClick;
|
|
2789
|
+
}, [onRowClick]);
|
|
2772
2790
|
(0, import_react10.useImperativeHandle)(ref, () => apiRef.current, []);
|
|
2773
2791
|
const clearTokenRef = (0, import_react10.useRef)(0);
|
|
2774
2792
|
const prevSelectedCountRef = (0, import_react10.useRef)(selectedCount != null ? selectedCount : 0);
|
|
@@ -2792,7 +2810,10 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2792
2810
|
var _a3;
|
|
2793
2811
|
(_a3 = onSelectAllPageRef.current) == null ? void 0 : _a3.call(onSelectAllPageRef, pageData, checked);
|
|
2794
2812
|
},
|
|
2795
|
-
clearToken: clearTokenRef.current
|
|
2813
|
+
clearToken: clearTokenRef.current,
|
|
2814
|
+
markCheckboxAction: () => {
|
|
2815
|
+
isCheckboxActionRef.current = true;
|
|
2816
|
+
}
|
|
2796
2817
|
});
|
|
2797
2818
|
return [checkboxCol, ...columns];
|
|
2798
2819
|
}, [selectionEnabled, columns, clearTokenRef.current]);
|
|
@@ -2819,6 +2840,17 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2819
2840
|
resizableColumns.forEach((col) => {
|
|
2820
2841
|
api.exec("resize-column", { id: col.id, auto: "data" });
|
|
2821
2842
|
});
|
|
2843
|
+
resizableColumns.forEach((col) => {
|
|
2844
|
+
var _a3, _b2, _c, _d, _e, _f, _g;
|
|
2845
|
+
const headerText = (_f = (_e = (_d = (_a3 = col == null ? void 0 : col.header) == null ? void 0 : _a3.text) != null ? _d : (_c = (_b2 = col == null ? void 0 : col.header) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) != null ? _e : col == null ? void 0 : col.text) != null ? _f : "";
|
|
2846
|
+
if (!headerText) return;
|
|
2847
|
+
const minWidth = measureHeaderTextWidth(headerText);
|
|
2848
|
+
const column = api.getColumn(col.id);
|
|
2849
|
+
const currentWidth = (_g = column == null ? void 0 : column.width) != null ? _g : 0;
|
|
2850
|
+
if (!isNaN(currentWidth) && currentWidth < minWidth) {
|
|
2851
|
+
api.exec("resize-column", { id: col.id, width: minWidth });
|
|
2852
|
+
}
|
|
2853
|
+
});
|
|
2822
2854
|
const totalAutoWidth = resizableColumns.reduce((sum, col) => {
|
|
2823
2855
|
var _a3;
|
|
2824
2856
|
const column = api.getColumn(col.id);
|
|
@@ -2842,9 +2874,12 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2842
2874
|
} else {
|
|
2843
2875
|
const equalWidth = resizableColumns.length > 0 ? availableWidth / resizableColumns.length : 0;
|
|
2844
2876
|
resizableColumns.forEach((col) => {
|
|
2877
|
+
var _a3, _b2, _c, _d, _e, _f;
|
|
2878
|
+
const headerText = (_f = (_e = (_d = (_a3 = col == null ? void 0 : col.header) == null ? void 0 : _a3.text) != null ? _d : (_c = (_b2 = col == null ? void 0 : col.header) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) != null ? _e : col == null ? void 0 : col.text) != null ? _f : "";
|
|
2879
|
+
const minWidth = headerText ? measureHeaderTextWidth(headerText) : 0;
|
|
2845
2880
|
api.exec("resize-column", {
|
|
2846
2881
|
id: col.id,
|
|
2847
|
-
width: equalWidth
|
|
2882
|
+
width: Math.max(equalWidth, minWidth)
|
|
2848
2883
|
});
|
|
2849
2884
|
});
|
|
2850
2885
|
}
|
|
@@ -2860,6 +2895,16 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2860
2895
|
apiRef.current = api;
|
|
2861
2896
|
resizeColumns();
|
|
2862
2897
|
api.intercept("focus-cell", onFocusCell);
|
|
2898
|
+
api.on("select-row", (ev) => {
|
|
2899
|
+
if (isCheckboxActionRef.current) {
|
|
2900
|
+
isCheckboxActionRef.current = false;
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2903
|
+
const handler = onRowClickRef.current;
|
|
2904
|
+
if (!handler) return;
|
|
2905
|
+
const row = api.getRow(ev.id);
|
|
2906
|
+
handler(row);
|
|
2907
|
+
});
|
|
2863
2908
|
},
|
|
2864
2909
|
[resizeColumns, onFocusCell]
|
|
2865
2910
|
);
|
|
@@ -2911,8 +2956,7 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2911
2956
|
data,
|
|
2912
2957
|
columns: resolvedColumns,
|
|
2913
2958
|
init,
|
|
2914
|
-
selectedRows: selectionEnabled ? selectedIds : void 0
|
|
2915
|
-
select: selectionEnabled ? false : rest.select
|
|
2959
|
+
selectedRows: selectionEnabled ? selectedIds : void 0
|
|
2916
2960
|
})
|
|
2917
2961
|
) }) })
|
|
2918
2962
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2381,7 +2381,6 @@ function GridHeader({
|
|
|
2381
2381
|
onSelectionAction,
|
|
2382
2382
|
onClearSelection
|
|
2383
2383
|
}) {
|
|
2384
|
-
console.log("GridHeader rendered");
|
|
2385
2384
|
const [downloadMenu, setDownloadMenu] = useState7(false);
|
|
2386
2385
|
const [searchOpen, setSearchOpen] = useState7(false);
|
|
2387
2386
|
const downloadRef = useRef2(null);
|
|
@@ -2542,15 +2541,15 @@ function useStore(store, name) {
|
|
|
2542
2541
|
// src/components/custom/grid/checkboxCell/checkBoxCell.tsx
|
|
2543
2542
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2544
2543
|
var CheckboxCell = ({ row, api, column }) => {
|
|
2545
|
-
console.log("CheckboxCell rendered");
|
|
2546
2544
|
const selectedRows = useStore(api, "selectedRows");
|
|
2547
2545
|
const isSelected = selectedRows.includes(row.id);
|
|
2548
2546
|
const handleChange = (e) => {
|
|
2549
|
-
var _a, _b;
|
|
2547
|
+
var _a, _b, _c, _d;
|
|
2550
2548
|
e.stopPropagation();
|
|
2551
2549
|
const isChecked = e.target.checked;
|
|
2550
|
+
(_b = (_a = column == null ? void 0 : column.config) == null ? void 0 : _a.markCheckboxAction) == null ? void 0 : _b.call(_a);
|
|
2552
2551
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2553
|
-
(
|
|
2552
|
+
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectionChange) == null ? void 0 : _d.call(_c, row.id, row, isChecked);
|
|
2554
2553
|
};
|
|
2555
2554
|
return /* @__PURE__ */ jsx26(
|
|
2556
2555
|
"div",
|
|
@@ -2620,6 +2619,8 @@ var HeaderCheckbox = ({ api, column }) => {
|
|
|
2620
2619
|
const pageData = (_b = (_a2 = column == null ? void 0 : column.config) == null ? void 0 : _a2.getPageData()) != null ? _b : [];
|
|
2621
2620
|
const dataArray = Array.isArray(pageData) ? pageData : [];
|
|
2622
2621
|
dataArray.forEach((row) => {
|
|
2622
|
+
var _a3, _b2;
|
|
2623
|
+
(_b2 = (_a3 = column == null ? void 0 : column.config) == null ? void 0 : _a3.markCheckboxAction) == null ? void 0 : _b2.call(_a3);
|
|
2623
2624
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2624
2625
|
});
|
|
2625
2626
|
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectAllPage) == null ? void 0 : _d.call(_c, dataArray, isChecked);
|
|
@@ -2650,13 +2651,15 @@ function buildCheckboxColumn({
|
|
|
2650
2651
|
getPageData,
|
|
2651
2652
|
onSelectionChange,
|
|
2652
2653
|
onSelectAllPage,
|
|
2653
|
-
clearToken
|
|
2654
|
+
clearToken,
|
|
2655
|
+
markCheckboxAction
|
|
2654
2656
|
}) {
|
|
2655
2657
|
const configRef = {
|
|
2656
2658
|
getPageData,
|
|
2657
2659
|
onSelectionChange,
|
|
2658
2660
|
onSelectAllPage,
|
|
2659
|
-
clearToken
|
|
2661
|
+
clearToken,
|
|
2662
|
+
markCheckboxAction
|
|
2660
2663
|
};
|
|
2661
2664
|
return {
|
|
2662
2665
|
id: "__selection__",
|
|
@@ -2671,6 +2674,15 @@ function buildCheckboxColumn({
|
|
|
2671
2674
|
|
|
2672
2675
|
// src/components/custom/grid/index.tsx
|
|
2673
2676
|
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2677
|
+
var _measureCanvas = typeof window !== "undefined" ? document.createElement("canvas") : null;
|
|
2678
|
+
function measureHeaderTextWidth(text) {
|
|
2679
|
+
if (!_measureCanvas) return 0;
|
|
2680
|
+
const ctx = _measureCanvas.getContext("2d");
|
|
2681
|
+
if (!ctx) return 0;
|
|
2682
|
+
ctx.font = "500 13px Inter, ui-sans-serif, system-ui, sans-serif";
|
|
2683
|
+
const textWidth = ctx.measureText(text).width;
|
|
2684
|
+
return Math.ceil(textWidth) + 64;
|
|
2685
|
+
}
|
|
2674
2686
|
var Grid = forwardRef(
|
|
2675
2687
|
(_a, ref) => {
|
|
2676
2688
|
var _b = _a, {
|
|
@@ -2696,7 +2708,8 @@ var Grid = forwardRef(
|
|
|
2696
2708
|
selectedData,
|
|
2697
2709
|
selectionActions,
|
|
2698
2710
|
onSelectionAction,
|
|
2699
|
-
onClearSelection
|
|
2711
|
+
onClearSelection,
|
|
2712
|
+
onRowClick
|
|
2700
2713
|
} = _b, rest = __objRest(_b, [
|
|
2701
2714
|
"data",
|
|
2702
2715
|
"columns",
|
|
@@ -2720,12 +2733,13 @@ var Grid = forwardRef(
|
|
|
2720
2733
|
"selectedData",
|
|
2721
2734
|
"selectionActions",
|
|
2722
2735
|
"onSelectionAction",
|
|
2723
|
-
"onClearSelection"
|
|
2736
|
+
"onClearSelection",
|
|
2737
|
+
"onRowClick"
|
|
2724
2738
|
]);
|
|
2725
2739
|
var _a2;
|
|
2726
|
-
console.log("Grid rendered");
|
|
2727
2740
|
const apiRef = useRef5(null);
|
|
2728
2741
|
const containerRef = useRef5(null);
|
|
2742
|
+
const isCheckboxActionRef = useRef5(false);
|
|
2729
2743
|
const dataRef = useRef5(data);
|
|
2730
2744
|
useEffect9(() => {
|
|
2731
2745
|
dataRef.current = data;
|
|
@@ -2738,6 +2752,10 @@ var Grid = forwardRef(
|
|
|
2738
2752
|
useEffect9(() => {
|
|
2739
2753
|
onSelectAllPageRef.current = onSelectAllPage;
|
|
2740
2754
|
}, [onSelectAllPage]);
|
|
2755
|
+
const onRowClickRef = useRef5(onRowClick);
|
|
2756
|
+
useEffect9(() => {
|
|
2757
|
+
onRowClickRef.current = onRowClick;
|
|
2758
|
+
}, [onRowClick]);
|
|
2741
2759
|
useImperativeHandle(ref, () => apiRef.current, []);
|
|
2742
2760
|
const clearTokenRef = useRef5(0);
|
|
2743
2761
|
const prevSelectedCountRef = useRef5(selectedCount != null ? selectedCount : 0);
|
|
@@ -2761,7 +2779,10 @@ var Grid = forwardRef(
|
|
|
2761
2779
|
var _a3;
|
|
2762
2780
|
(_a3 = onSelectAllPageRef.current) == null ? void 0 : _a3.call(onSelectAllPageRef, pageData, checked);
|
|
2763
2781
|
},
|
|
2764
|
-
clearToken: clearTokenRef.current
|
|
2782
|
+
clearToken: clearTokenRef.current,
|
|
2783
|
+
markCheckboxAction: () => {
|
|
2784
|
+
isCheckboxActionRef.current = true;
|
|
2785
|
+
}
|
|
2765
2786
|
});
|
|
2766
2787
|
return [checkboxCol, ...columns];
|
|
2767
2788
|
}, [selectionEnabled, columns, clearTokenRef.current]);
|
|
@@ -2788,6 +2809,17 @@ var Grid = forwardRef(
|
|
|
2788
2809
|
resizableColumns.forEach((col) => {
|
|
2789
2810
|
api.exec("resize-column", { id: col.id, auto: "data" });
|
|
2790
2811
|
});
|
|
2812
|
+
resizableColumns.forEach((col) => {
|
|
2813
|
+
var _a3, _b2, _c, _d, _e, _f, _g;
|
|
2814
|
+
const headerText = (_f = (_e = (_d = (_a3 = col == null ? void 0 : col.header) == null ? void 0 : _a3.text) != null ? _d : (_c = (_b2 = col == null ? void 0 : col.header) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) != null ? _e : col == null ? void 0 : col.text) != null ? _f : "";
|
|
2815
|
+
if (!headerText) return;
|
|
2816
|
+
const minWidth = measureHeaderTextWidth(headerText);
|
|
2817
|
+
const column = api.getColumn(col.id);
|
|
2818
|
+
const currentWidth = (_g = column == null ? void 0 : column.width) != null ? _g : 0;
|
|
2819
|
+
if (!isNaN(currentWidth) && currentWidth < minWidth) {
|
|
2820
|
+
api.exec("resize-column", { id: col.id, width: minWidth });
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2791
2823
|
const totalAutoWidth = resizableColumns.reduce((sum, col) => {
|
|
2792
2824
|
var _a3;
|
|
2793
2825
|
const column = api.getColumn(col.id);
|
|
@@ -2811,9 +2843,12 @@ var Grid = forwardRef(
|
|
|
2811
2843
|
} else {
|
|
2812
2844
|
const equalWidth = resizableColumns.length > 0 ? availableWidth / resizableColumns.length : 0;
|
|
2813
2845
|
resizableColumns.forEach((col) => {
|
|
2846
|
+
var _a3, _b2, _c, _d, _e, _f;
|
|
2847
|
+
const headerText = (_f = (_e = (_d = (_a3 = col == null ? void 0 : col.header) == null ? void 0 : _a3.text) != null ? _d : (_c = (_b2 = col == null ? void 0 : col.header) == null ? void 0 : _b2[0]) == null ? void 0 : _c.text) != null ? _e : col == null ? void 0 : col.text) != null ? _f : "";
|
|
2848
|
+
const minWidth = headerText ? measureHeaderTextWidth(headerText) : 0;
|
|
2814
2849
|
api.exec("resize-column", {
|
|
2815
2850
|
id: col.id,
|
|
2816
|
-
width: equalWidth
|
|
2851
|
+
width: Math.max(equalWidth, minWidth)
|
|
2817
2852
|
});
|
|
2818
2853
|
});
|
|
2819
2854
|
}
|
|
@@ -2829,6 +2864,16 @@ var Grid = forwardRef(
|
|
|
2829
2864
|
apiRef.current = api;
|
|
2830
2865
|
resizeColumns();
|
|
2831
2866
|
api.intercept("focus-cell", onFocusCell);
|
|
2867
|
+
api.on("select-row", (ev) => {
|
|
2868
|
+
if (isCheckboxActionRef.current) {
|
|
2869
|
+
isCheckboxActionRef.current = false;
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
const handler = onRowClickRef.current;
|
|
2873
|
+
if (!handler) return;
|
|
2874
|
+
const row = api.getRow(ev.id);
|
|
2875
|
+
handler(row);
|
|
2876
|
+
});
|
|
2832
2877
|
},
|
|
2833
2878
|
[resizeColumns, onFocusCell]
|
|
2834
2879
|
);
|
|
@@ -2880,8 +2925,7 @@ var Grid = forwardRef(
|
|
|
2880
2925
|
data,
|
|
2881
2926
|
columns: resolvedColumns,
|
|
2882
2927
|
init,
|
|
2883
|
-
selectedRows: selectionEnabled ? selectedIds : void 0
|
|
2884
|
-
select: selectionEnabled ? false : rest.select
|
|
2928
|
+
selectedRows: selectionEnabled ? selectedIds : void 0
|
|
2885
2929
|
})
|
|
2886
2930
|
) }) })
|
|
2887
2931
|
}
|