@codezee/sixtify-brahma 0.2.141 → 0.2.142
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/package.json +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.d.ts +6 -25
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.js +13 -4
package/package.json
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
1
|
import type { ColDef, RowSelectionOptions } from "ag-grid-community";
|
|
2
|
-
type UseAgGridRowSelectionConfigArgs = {
|
|
3
|
-
columnDefs: ColDef[];
|
|
2
|
+
type UseAgGridRowSelectionConfigArgs<TData> = {
|
|
3
|
+
columnDefs: ColDef<TData>[];
|
|
4
4
|
enableClickSelection?: boolean;
|
|
5
|
-
isRowSelectable?: RowSelectionOptions["isRowSelectable"];
|
|
5
|
+
isRowSelectable?: RowSelectionOptions<TData>["isRowSelectable"];
|
|
6
6
|
};
|
|
7
|
-
export declare const useAgGridRowSelectionConfig: ({ columnDefs, enableClickSelection, isRowSelectable, }: UseAgGridRowSelectionConfigArgs) => {
|
|
8
|
-
rowSelection: RowSelectionOptions | undefined;
|
|
9
|
-
selectionColumnDef:
|
|
10
|
-
headerName: string;
|
|
11
|
-
width: number;
|
|
12
|
-
minWidth: number;
|
|
13
|
-
maxWidth: number;
|
|
14
|
-
pinned: "left";
|
|
15
|
-
lockPinned: boolean;
|
|
16
|
-
lockPosition: boolean;
|
|
17
|
-
suppressMovable: boolean;
|
|
18
|
-
suppressHeaderMenuButton: boolean;
|
|
19
|
-
suppressHeaderContextMenu: boolean;
|
|
20
|
-
suppressSizeToFit: boolean;
|
|
21
|
-
resizable: boolean;
|
|
22
|
-
sortable: boolean;
|
|
23
|
-
filter: boolean;
|
|
24
|
-
suppressHeaderKeyboardEvent: () => true;
|
|
25
|
-
suppressKeyboardEvent: () => true;
|
|
26
|
-
headerComponent: () => null;
|
|
27
|
-
cellRenderer: () => null;
|
|
28
|
-
} | undefined;
|
|
7
|
+
export declare const useAgGridRowSelectionConfig: <TData>({ columnDefs, enableClickSelection, isRowSelectable, }: UseAgGridRowSelectionConfigArgs<TData>) => {
|
|
8
|
+
rowSelection: RowSelectionOptions<TData> | undefined;
|
|
9
|
+
selectionColumnDef: import("ag-grid-community").SelectionColumnDef | undefined;
|
|
29
10
|
};
|
|
30
11
|
export {};
|
|
31
12
|
//# sourceMappingURL=useAgGridRowSelectionConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgGridRowSelectionConfig.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridRowSelectionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useAgGridRowSelectionConfig.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridRowSelectionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAEN,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAG3B,KAAK,+BAA+B,CAAC,KAAK,IAAI;IAC5C,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,CAAC;CACjE,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,KAAK,EAAE,wDAIhD,+BAA+B,CAAC,KAAK,CAAC;;;CAsExC,CAAC"}
|
|
@@ -4,19 +4,28 @@ exports.useAgGridRowSelectionConfig = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useAgGridRowSelectionConfig = ({ columnDefs, enableClickSelection = false, isRowSelectable, }) => {
|
|
6
6
|
const hasCustomCheckboxColumn = (0, react_1.useMemo)(() => {
|
|
7
|
-
return columnDefs.some((
|
|
8
|
-
|
|
7
|
+
return columnDefs.some((colDef) => {
|
|
8
|
+
const checkboxSelection = colDef["checkboxSelection"];
|
|
9
|
+
const hasCheckboxSelection = !!checkboxSelection;
|
|
10
|
+
const hasCustomHeaderOnId = colDef.field != null &&
|
|
11
|
+
String(colDef.field) === "id" &&
|
|
12
|
+
colDef.headerComponent != null;
|
|
13
|
+
return hasCheckboxSelection || hasCustomHeaderOnId;
|
|
9
14
|
});
|
|
10
15
|
}, [columnDefs]);
|
|
11
16
|
const rowSelection = (0, react_1.useMemo)(() => {
|
|
12
17
|
if (!hasCustomCheckboxColumn) {
|
|
13
18
|
return undefined;
|
|
14
19
|
}
|
|
20
|
+
const hasSelectableRows = Boolean(isRowSelectable);
|
|
15
21
|
return {
|
|
16
22
|
mode: "multiRow",
|
|
17
23
|
enableClickSelection,
|
|
18
|
-
checkboxes:
|
|
19
|
-
...(isRowSelectable && {
|
|
24
|
+
checkboxes: hasSelectableRows,
|
|
25
|
+
...(isRowSelectable && {
|
|
26
|
+
isRowSelectable,
|
|
27
|
+
hideDisabledCheckboxes: true,
|
|
28
|
+
}),
|
|
20
29
|
};
|
|
21
30
|
}, [hasCustomCheckboxColumn, enableClickSelection, isRowSelectable]);
|
|
22
31
|
const selectionColumnDef = (0, react_1.useMemo)(() => {
|