baaz-custom-components 5.2.4 → 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.js +18 -5
- package/dist/index.mjs +18 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2575,11 +2575,12 @@ var CheckboxCell = ({ row, api, column }) => {
|
|
|
2575
2575
|
const selectedRows = useStore(api, "selectedRows");
|
|
2576
2576
|
const isSelected = selectedRows.includes(row.id);
|
|
2577
2577
|
const handleChange = (e) => {
|
|
2578
|
-
var _a, _b;
|
|
2578
|
+
var _a, _b, _c, _d;
|
|
2579
2579
|
e.stopPropagation();
|
|
2580
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);
|
|
2581
2582
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2582
|
-
(
|
|
2583
|
+
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectionChange) == null ? void 0 : _d.call(_c, row.id, row, isChecked);
|
|
2583
2584
|
};
|
|
2584
2585
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2585
2586
|
"div",
|
|
@@ -2649,6 +2650,8 @@ var HeaderCheckbox = ({ api, column }) => {
|
|
|
2649
2650
|
const pageData = (_b = (_a2 = column == null ? void 0 : column.config) == null ? void 0 : _a2.getPageData()) != null ? _b : [];
|
|
2650
2651
|
const dataArray = Array.isArray(pageData) ? pageData : [];
|
|
2651
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);
|
|
2652
2655
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2653
2656
|
});
|
|
2654
2657
|
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectAllPage) == null ? void 0 : _d.call(_c, dataArray, isChecked);
|
|
@@ -2679,13 +2682,15 @@ function buildCheckboxColumn({
|
|
|
2679
2682
|
getPageData,
|
|
2680
2683
|
onSelectionChange,
|
|
2681
2684
|
onSelectAllPage,
|
|
2682
|
-
clearToken
|
|
2685
|
+
clearToken,
|
|
2686
|
+
markCheckboxAction
|
|
2683
2687
|
}) {
|
|
2684
2688
|
const configRef = {
|
|
2685
2689
|
getPageData,
|
|
2686
2690
|
onSelectionChange,
|
|
2687
2691
|
onSelectAllPage,
|
|
2688
|
-
clearToken
|
|
2692
|
+
clearToken,
|
|
2693
|
+
markCheckboxAction
|
|
2689
2694
|
};
|
|
2690
2695
|
return {
|
|
2691
2696
|
id: "__selection__",
|
|
@@ -2765,6 +2770,7 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2765
2770
|
var _a2;
|
|
2766
2771
|
const apiRef = (0, import_react10.useRef)(null);
|
|
2767
2772
|
const containerRef = (0, import_react10.useRef)(null);
|
|
2773
|
+
const isCheckboxActionRef = (0, import_react10.useRef)(false);
|
|
2768
2774
|
const dataRef = (0, import_react10.useRef)(data);
|
|
2769
2775
|
(0, import_react10.useEffect)(() => {
|
|
2770
2776
|
dataRef.current = data;
|
|
@@ -2804,7 +2810,10 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2804
2810
|
var _a3;
|
|
2805
2811
|
(_a3 = onSelectAllPageRef.current) == null ? void 0 : _a3.call(onSelectAllPageRef, pageData, checked);
|
|
2806
2812
|
},
|
|
2807
|
-
clearToken: clearTokenRef.current
|
|
2813
|
+
clearToken: clearTokenRef.current,
|
|
2814
|
+
markCheckboxAction: () => {
|
|
2815
|
+
isCheckboxActionRef.current = true;
|
|
2816
|
+
}
|
|
2808
2817
|
});
|
|
2809
2818
|
return [checkboxCol, ...columns];
|
|
2810
2819
|
}, [selectionEnabled, columns, clearTokenRef.current]);
|
|
@@ -2887,6 +2896,10 @@ var Grid = (0, import_react10.forwardRef)(
|
|
|
2887
2896
|
resizeColumns();
|
|
2888
2897
|
api.intercept("focus-cell", onFocusCell);
|
|
2889
2898
|
api.on("select-row", (ev) => {
|
|
2899
|
+
if (isCheckboxActionRef.current) {
|
|
2900
|
+
isCheckboxActionRef.current = false;
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2890
2903
|
const handler = onRowClickRef.current;
|
|
2891
2904
|
if (!handler) return;
|
|
2892
2905
|
const row = api.getRow(ev.id);
|
package/dist/index.mjs
CHANGED
|
@@ -2544,11 +2544,12 @@ var CheckboxCell = ({ row, api, column }) => {
|
|
|
2544
2544
|
const selectedRows = useStore(api, "selectedRows");
|
|
2545
2545
|
const isSelected = selectedRows.includes(row.id);
|
|
2546
2546
|
const handleChange = (e) => {
|
|
2547
|
-
var _a, _b;
|
|
2547
|
+
var _a, _b, _c, _d;
|
|
2548
2548
|
e.stopPropagation();
|
|
2549
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);
|
|
2550
2551
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2551
|
-
(
|
|
2552
|
+
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectionChange) == null ? void 0 : _d.call(_c, row.id, row, isChecked);
|
|
2552
2553
|
};
|
|
2553
2554
|
return /* @__PURE__ */ jsx26(
|
|
2554
2555
|
"div",
|
|
@@ -2618,6 +2619,8 @@ var HeaderCheckbox = ({ api, column }) => {
|
|
|
2618
2619
|
const pageData = (_b = (_a2 = column == null ? void 0 : column.config) == null ? void 0 : _a2.getPageData()) != null ? _b : [];
|
|
2619
2620
|
const dataArray = Array.isArray(pageData) ? pageData : [];
|
|
2620
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);
|
|
2621
2624
|
api.exec("select-row", { id: row.id, mode: isChecked, toggle: true });
|
|
2622
2625
|
});
|
|
2623
2626
|
(_d = (_c = column == null ? void 0 : column.config) == null ? void 0 : _c.onSelectAllPage) == null ? void 0 : _d.call(_c, dataArray, isChecked);
|
|
@@ -2648,13 +2651,15 @@ function buildCheckboxColumn({
|
|
|
2648
2651
|
getPageData,
|
|
2649
2652
|
onSelectionChange,
|
|
2650
2653
|
onSelectAllPage,
|
|
2651
|
-
clearToken
|
|
2654
|
+
clearToken,
|
|
2655
|
+
markCheckboxAction
|
|
2652
2656
|
}) {
|
|
2653
2657
|
const configRef = {
|
|
2654
2658
|
getPageData,
|
|
2655
2659
|
onSelectionChange,
|
|
2656
2660
|
onSelectAllPage,
|
|
2657
|
-
clearToken
|
|
2661
|
+
clearToken,
|
|
2662
|
+
markCheckboxAction
|
|
2658
2663
|
};
|
|
2659
2664
|
return {
|
|
2660
2665
|
id: "__selection__",
|
|
@@ -2734,6 +2739,7 @@ var Grid = forwardRef(
|
|
|
2734
2739
|
var _a2;
|
|
2735
2740
|
const apiRef = useRef5(null);
|
|
2736
2741
|
const containerRef = useRef5(null);
|
|
2742
|
+
const isCheckboxActionRef = useRef5(false);
|
|
2737
2743
|
const dataRef = useRef5(data);
|
|
2738
2744
|
useEffect9(() => {
|
|
2739
2745
|
dataRef.current = data;
|
|
@@ -2773,7 +2779,10 @@ var Grid = forwardRef(
|
|
|
2773
2779
|
var _a3;
|
|
2774
2780
|
(_a3 = onSelectAllPageRef.current) == null ? void 0 : _a3.call(onSelectAllPageRef, pageData, checked);
|
|
2775
2781
|
},
|
|
2776
|
-
clearToken: clearTokenRef.current
|
|
2782
|
+
clearToken: clearTokenRef.current,
|
|
2783
|
+
markCheckboxAction: () => {
|
|
2784
|
+
isCheckboxActionRef.current = true;
|
|
2785
|
+
}
|
|
2777
2786
|
});
|
|
2778
2787
|
return [checkboxCol, ...columns];
|
|
2779
2788
|
}, [selectionEnabled, columns, clearTokenRef.current]);
|
|
@@ -2856,6 +2865,10 @@ var Grid = forwardRef(
|
|
|
2856
2865
|
resizeColumns();
|
|
2857
2866
|
api.intercept("focus-cell", onFocusCell);
|
|
2858
2867
|
api.on("select-row", (ev) => {
|
|
2868
|
+
if (isCheckboxActionRef.current) {
|
|
2869
|
+
isCheckboxActionRef.current = false;
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2859
2872
|
const handler = onRowClickRef.current;
|
|
2860
2873
|
if (!handler) return;
|
|
2861
2874
|
const row = api.getRow(ev.id);
|