@codezee/sixtify-brahma 0.2.139 → 0.2.141
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/index.d.ts +7 -0
- package/packages/shared-components/dist/AgGrid/hooks/index.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/index.js +22 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridCheckBoxSelection.d.ts.map +1 -0
- package/packages/shared-components/dist/{utils → AgGrid}/hooks/useAgGridCheckBoxSelection.js +5 -6
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridFilteredData.d.ts +10 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridFilteredData.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridFilteredData.js +22 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridKeyboardShortcuts.d.ts +8 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridKeyboardShortcuts.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridKeyboardShortcuts.js +37 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.d.ts +31 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.js +52 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRow.d.ts +11 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRow.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRow.js +159 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRowUpdate.d.ts +14 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRowUpdate.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/hooks/useAgGridSummaryRowUpdate.js +33 -0
- package/packages/shared-components/dist/AgGrid/index.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/index.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/index.js +2 -0
- package/packages/shared-components/dist/AgGrid/types/agGrid.d.ts +19 -0
- package/packages/shared-components/dist/AgGrid/types/agGrid.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/types/agGrid.js +2 -0
- package/packages/shared-components/dist/AgGrid/types/agSummaryTypes.d.ts +27 -0
- package/packages/shared-components/dist/AgGrid/types/agSummaryTypes.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/types/agSummaryTypes.js +2 -0
- package/packages/shared-components/dist/AgGrid/types/index.d.ts +3 -0
- package/packages/shared-components/dist/AgGrid/types/index.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/types/index.js +18 -0
- package/packages/shared-components/dist/AgGrid/utils/extractPrefixedValue.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/utils/extractPrefixedValue.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/utils/extractPrefixedValue.js +15 -0
- package/packages/shared-components/dist/AgGrid/utils/index.d.ts +1 -0
- package/packages/shared-components/dist/AgGrid/utils/index.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/utils/index.js +1 -0
- package/packages/shared-components/dist/utils/date.d.ts +1 -0
- package/packages/shared-components/dist/utils/date.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/date.js +33 -1
- package/packages/shared-components/dist/utils/hooks/index.d.ts +0 -1
- package/packages/shared-components/dist/utils/hooks/index.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/hooks/index.js +0 -1
- package/packages/shared-components/dist/utils/regex.d.ts +1 -0
- package/packages/shared-components/dist/utils/regex.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/regex.js +2 -1
- package/packages/shared-components/dist/utils/hooks/useAgGridCheckBoxSelection.d.ts.map +0 -1
- /package/packages/shared-components/dist/{utils → AgGrid}/hooks/useAgGridCheckBoxSelection.d.ts +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./useAgGridCheckBoxSelection";
|
|
2
|
+
export * from "./useAgGridSummaryRow";
|
|
3
|
+
export * from "./useAgGridSummaryRowUpdate";
|
|
4
|
+
export * from "./useAgGridRowSelectionConfig";
|
|
5
|
+
export * from "./useAgGridFilteredData";
|
|
6
|
+
export * from "./useAgGridKeyboardShortcuts";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useAgGridCheckBoxSelection"), exports);
|
|
18
|
+
__exportStar(require("./useAgGridSummaryRow"), exports);
|
|
19
|
+
__exportStar(require("./useAgGridSummaryRowUpdate"), exports);
|
|
20
|
+
__exportStar(require("./useAgGridRowSelectionConfig"), exports);
|
|
21
|
+
__exportStar(require("./useAgGridFilteredData"), exports);
|
|
22
|
+
__exportStar(require("./useAgGridKeyboardShortcuts"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridCheckBoxSelection.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridCheckBoxSelection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI9E,KAAK,8BAA8B,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IAC9D,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAgB,EAAE,CAAC,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAqCF,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,uEAKlE,8BAA8B,CAAC,CAAC,CAAC;;6BAyCF,WAAW,CAAC,gBAAgB,CAAC;;;CA4H9D,CAAC"}
|
package/packages/shared-components/dist/{utils → AgGrid}/hooks/useAgGridCheckBoxSelection.js
RENAMED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAgGridCheckBoxSelection = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const useGlobalKeyboardShortcut_1 = require("./useGlobalKeyboardShortcut");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
7
6
|
const isDialogOnTop = (gridRef) => {
|
|
8
7
|
const dialogs = document.querySelectorAll(
|
|
9
8
|
// eslint-disable-next-line quotes
|
|
@@ -12,13 +11,13 @@ const isDialogOnTop = (gridRef) => {
|
|
|
12
11
|
return false;
|
|
13
12
|
}
|
|
14
13
|
const gridContainer = gridRef.current?.api?.eGridDiv;
|
|
15
|
-
const gridZIndex = gridContainer ? (0,
|
|
14
|
+
const gridZIndex = gridContainer ? (0, utils_1.getZIndex)(gridContainer) : 0;
|
|
16
15
|
for (const dialog of Array.from(dialogs)) {
|
|
17
16
|
const dialogElement = dialog;
|
|
18
17
|
const isVisible = dialogElement.offsetParent !== null ||
|
|
19
18
|
window.getComputedStyle(dialogElement).display !== "none";
|
|
20
19
|
if (isVisible) {
|
|
21
|
-
const dialogZIndex = (0,
|
|
20
|
+
const dialogZIndex = (0, utils_1.getZIndex)(dialogElement);
|
|
22
21
|
if (dialogZIndex > gridZIndex) {
|
|
23
22
|
return true;
|
|
24
23
|
}
|
|
@@ -58,7 +57,7 @@ const useAgGridCheckBoxSelection = ({ gridRef, setSelectedEmployee, currentPageI
|
|
|
58
57
|
setIsChecked(event.target.checked);
|
|
59
58
|
commonCheckBoxMethod();
|
|
60
59
|
};
|
|
61
|
-
(0,
|
|
60
|
+
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
62
61
|
key: "a",
|
|
63
62
|
modifierKeys: "ctrl",
|
|
64
63
|
onTrigger: () => {
|
|
@@ -88,7 +87,7 @@ const useAgGridCheckBoxSelection = ({ gridRef, setSelectedEmployee, currentPageI
|
|
|
88
87
|
});
|
|
89
88
|
},
|
|
90
89
|
});
|
|
91
|
-
(0,
|
|
90
|
+
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
92
91
|
key: "a",
|
|
93
92
|
modifierKeys: ["ctrl", "shift"],
|
|
94
93
|
onTrigger: () => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgGridReact } from "ag-grid-react";
|
|
2
|
+
import { type RefObject } from "react";
|
|
3
|
+
type UseAgGridFilteredDataOptions<T> = {
|
|
4
|
+
gridRef: RefObject<AgGridReact<T>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useAgGridFilteredData: <T>({ gridRef, }: UseAgGridFilteredDataOptions<T>) => {
|
|
7
|
+
getFilteredData: () => T[];
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=useAgGridFilteredData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridFilteredData.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridFilteredData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,KAAK,4BAA4B,CAAC,CAAC,IAAI;IACrC,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,cAEtC,4BAA4B,CAAC,CAAC,CAAC;2BACQ,CAAC,EAAE;CAqB5C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridFilteredData = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAgGridFilteredData = ({ gridRef, }) => {
|
|
6
|
+
const getFilteredData = (0, react_1.useCallback)(() => {
|
|
7
|
+
const api = gridRef.current?.api;
|
|
8
|
+
if (!api) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const filtered = [];
|
|
12
|
+
api.forEachNodeAfterFilter((node) => {
|
|
13
|
+
const data = node.data;
|
|
14
|
+
if (data) {
|
|
15
|
+
filtered.push(data);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return filtered;
|
|
19
|
+
}, [gridRef]);
|
|
20
|
+
return { getFilteredData };
|
|
21
|
+
};
|
|
22
|
+
exports.useAgGridFilteredData = useAgGridFilteredData;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgGridReact } from "ag-grid-react";
|
|
2
|
+
import type { RefObject } from "react";
|
|
3
|
+
type UseAgGridKeyboardShortcutsArgs<T = unknown> = {
|
|
4
|
+
gridRef: RefObject<AgGridReact<T>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useAgGridKeyboardShortcuts: <T = unknown>({ gridRef, }: UseAgGridKeyboardShortcutsArgs<T>) => void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=useAgGridKeyboardShortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridKeyboardShortcuts.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridKeyboardShortcuts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,8BAA8B,CAAC,CAAC,GAAG,OAAO,IAAI;IACjD,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,CAAC,GAAG,OAAO,EAAE,cAErD,8BAA8B,CAAC,CAAC,CAAC,SAoCnC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridKeyboardShortcuts = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const useAgGridKeyboardShortcuts = ({ gridRef, }) => {
|
|
6
|
+
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
7
|
+
key: "a",
|
|
8
|
+
modifierKeys: "ctrl",
|
|
9
|
+
onTrigger: () => {
|
|
10
|
+
if (!gridRef.current?.api) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const api = gridRef.current.api;
|
|
14
|
+
api.forEachNodeAfterFilterAndSort((node) => {
|
|
15
|
+
if (node.displayed && node.data) {
|
|
16
|
+
node.setSelected(true);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
(0, utils_1.useGlobalKeyboardShortcut)({
|
|
22
|
+
key: "a",
|
|
23
|
+
modifierKeys: ["ctrl", "shift"],
|
|
24
|
+
onTrigger: () => {
|
|
25
|
+
if (!gridRef.current?.api) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const api = gridRef.current.api;
|
|
29
|
+
api.forEachNodeAfterFilterAndSort((node) => {
|
|
30
|
+
if (node.displayed && node.data) {
|
|
31
|
+
node.setSelected(false);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.useAgGridKeyboardShortcuts = useAgGridKeyboardShortcuts;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ColDef, RowSelectionOptions } from "ag-grid-community";
|
|
2
|
+
type UseAgGridRowSelectionConfigArgs = {
|
|
3
|
+
columnDefs: ColDef[];
|
|
4
|
+
enableClickSelection?: boolean;
|
|
5
|
+
isRowSelectable?: RowSelectionOptions["isRowSelectable"];
|
|
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;
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=useAgGridRowSelectionConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridRowSelectionConfig.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridRowSelectionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGrE,KAAK,+BAA+B,GAAG;IACrC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,wDAIzC,+BAA+B;;;;;;;;;;;;;;;;;;;;;;CAmDjC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridRowSelectionConfig = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAgGridRowSelectionConfig = ({ columnDefs, enableClickSelection = false, isRowSelectable, }) => {
|
|
6
|
+
const hasCustomCheckboxColumn = (0, react_1.useMemo)(() => {
|
|
7
|
+
return columnDefs.some((col) => {
|
|
8
|
+
return !!col["checkboxSelection"];
|
|
9
|
+
});
|
|
10
|
+
}, [columnDefs]);
|
|
11
|
+
const rowSelection = (0, react_1.useMemo)(() => {
|
|
12
|
+
if (!hasCustomCheckboxColumn) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
mode: "multiRow",
|
|
17
|
+
enableClickSelection,
|
|
18
|
+
checkboxes: false,
|
|
19
|
+
...(isRowSelectable && { isRowSelectable }),
|
|
20
|
+
};
|
|
21
|
+
}, [hasCustomCheckboxColumn, enableClickSelection, isRowSelectable]);
|
|
22
|
+
const selectionColumnDef = (0, react_1.useMemo)(() => {
|
|
23
|
+
if (!hasCustomCheckboxColumn) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
headerName: "",
|
|
28
|
+
width: 1,
|
|
29
|
+
minWidth: 1,
|
|
30
|
+
maxWidth: 1,
|
|
31
|
+
pinned: "left",
|
|
32
|
+
lockPinned: true,
|
|
33
|
+
lockPosition: true,
|
|
34
|
+
suppressMovable: true,
|
|
35
|
+
suppressHeaderMenuButton: true,
|
|
36
|
+
suppressHeaderContextMenu: true,
|
|
37
|
+
suppressSizeToFit: true,
|
|
38
|
+
resizable: false,
|
|
39
|
+
sortable: false,
|
|
40
|
+
filter: false,
|
|
41
|
+
suppressHeaderKeyboardEvent: () => true,
|
|
42
|
+
suppressKeyboardEvent: () => true,
|
|
43
|
+
headerComponent: () => null,
|
|
44
|
+
cellRenderer: () => null,
|
|
45
|
+
};
|
|
46
|
+
}, [hasCustomCheckboxColumn]);
|
|
47
|
+
return {
|
|
48
|
+
rowSelection,
|
|
49
|
+
selectionColumnDef,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.useAgGridRowSelectionConfig = useAgGridRowSelectionConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SummaryRowResult, UseAgGridSummaryRowHookOptions, UseAgGridSummaryRowOptions } from "../types/agSummaryTypes";
|
|
2
|
+
import type { ColDef, ColGroupDef } from "ag-grid-community";
|
|
3
|
+
import type { FieldValues } from "react-hook-form";
|
|
4
|
+
export declare function flattenColumns<T>(columns: (ColDef<T> | ColGroupDef<T>)[]): ColDef<T>[];
|
|
5
|
+
export declare function calculateSummaryRow<T extends FieldValues>({ data, columns, exemptFields, summaryLabel, }: UseAgGridSummaryRowOptions<T>): SummaryRowResult | null;
|
|
6
|
+
export declare function useAgGridSummaryRow<T extends FieldValues>({ data, columns, exemptFields, summaryLabel, }: UseAgGridSummaryRowHookOptions<T>): {
|
|
7
|
+
summaryRow: Record<string, string | number | null> | undefined;
|
|
8
|
+
pinnedBottomRowData: Record<string, string | number | null>[] | undefined;
|
|
9
|
+
formattedSummary: Record<string, string> | undefined;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useAgGridSummaryRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridSummaryRow.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridSummaryRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAyBnD,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,GACtC,MAAM,CAAC,CAAC,CAAC,EAAE,CAMb;AAwJD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAAE,EACzD,IAAI,EACJ,OAAO,EACP,YAAiB,EACjB,YAAsB,GACvB,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAsBzD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAAE,EACzD,IAAI,EACJ,OAAO,EACP,YAAiB,EACjB,YAAsB,GACvB,EAAE,8BAA8B,CAAC,CAAC,CAAC;;;;EAmBnC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.flattenColumns = flattenColumns;
|
|
7
|
+
exports.calculateSummaryRow = calculateSummaryRow;
|
|
8
|
+
exports.useAgGridSummaryRow = useAgGridSummaryRow;
|
|
9
|
+
const date_1 = require("../../utils/date");
|
|
10
|
+
const regex_1 = require("../../utils/regex");
|
|
11
|
+
const flattenDeep_1 = __importDefault(require("lodash/flattenDeep"));
|
|
12
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
13
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
14
|
+
const isNaN_1 = __importDefault(require("lodash/isNaN"));
|
|
15
|
+
const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
16
|
+
const isString_1 = __importDefault(require("lodash/isString"));
|
|
17
|
+
const sumBy_1 = __importDefault(require("lodash/sumBy"));
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const defaultParams = (item, col) => ({
|
|
20
|
+
data: item,
|
|
21
|
+
node: null,
|
|
22
|
+
api: undefined,
|
|
23
|
+
columnApi: undefined,
|
|
24
|
+
context: undefined,
|
|
25
|
+
getValue: () => undefined,
|
|
26
|
+
colDef: col,
|
|
27
|
+
column: undefined,
|
|
28
|
+
});
|
|
29
|
+
const defaultFormatterParams = (rawValue, rawSummary, col) => ({
|
|
30
|
+
value: rawValue,
|
|
31
|
+
data: rawSummary ?? {},
|
|
32
|
+
colDef: col ?? {},
|
|
33
|
+
});
|
|
34
|
+
function flattenColumns(columns) {
|
|
35
|
+
return (0, flattenDeep_1.default)(columns.map((col) => "children" in col && col.children ? flattenColumns(col.children) : col)).filter((col) => "field" in col || "colId" in col);
|
|
36
|
+
}
|
|
37
|
+
function isTimeString(value) {
|
|
38
|
+
return (0, isString_1.default)(value) && regex_1.timeRegex.test(value.trim());
|
|
39
|
+
}
|
|
40
|
+
function parseNumericValue(value) {
|
|
41
|
+
if ((0, isNumber_1.default)(value) && !(0, isNaN_1.default)(value)) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
if (!(0, isString_1.default)(value)) {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
if (isTimeString(value)) {
|
|
48
|
+
return Number((0, date_1.formatHours)(value) ?? "0h 0m");
|
|
49
|
+
}
|
|
50
|
+
const cleaned = String(value).replace(/,/g, "").trim();
|
|
51
|
+
const num = parseFloat(cleaned);
|
|
52
|
+
return (0, isNaN_1.default)(num) ? 0 : num;
|
|
53
|
+
}
|
|
54
|
+
function isSummableValue(value) {
|
|
55
|
+
return ((0, isNumber_1.default)(value) && !(0, isNaN_1.default)(value)) || isTimeString(value);
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line sonarjs/function-return-type
|
|
58
|
+
function getValueFromItem(item, col, key) {
|
|
59
|
+
const { valueGetter } = col;
|
|
60
|
+
if (typeof valueGetter === "function") {
|
|
61
|
+
const params = defaultParams(item, col);
|
|
62
|
+
return valueGetter(params) ?? undefined;
|
|
63
|
+
}
|
|
64
|
+
return (0, get_1.default)(item, key);
|
|
65
|
+
}
|
|
66
|
+
function shouldSumColumn(data, col, key) {
|
|
67
|
+
for (const item of data) {
|
|
68
|
+
if (isSummableValue(getValueFromItem(item, col, key))) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
function calculateTotalForColumn(data, col, key) {
|
|
75
|
+
const { valueGetter } = col;
|
|
76
|
+
if (typeof valueGetter === "function") {
|
|
77
|
+
return (0, sumBy_1.default)(data, (item) => {
|
|
78
|
+
const params = defaultParams(item, col);
|
|
79
|
+
return parseNumericValue(valueGetter(params) ?? undefined);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return (0, sumBy_1.default)(data, (item) => parseNumericValue((0, get_1.default)(item, key)));
|
|
83
|
+
}
|
|
84
|
+
function createSummaryRow(data, columns, exemptFields, summaryLabel) {
|
|
85
|
+
const summary = {};
|
|
86
|
+
for (const col of columns) {
|
|
87
|
+
const { colId, field } = col;
|
|
88
|
+
const key = colId ?? field;
|
|
89
|
+
if (!key) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const keyString = String(key);
|
|
93
|
+
if (exemptFields.has(keyString) || !shouldSumColumn(data, col, keyString)) {
|
|
94
|
+
summary[keyString] = null;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const total = calculateTotalForColumn(data, col, keyString);
|
|
98
|
+
if (colId) {
|
|
99
|
+
summary[colId] = total;
|
|
100
|
+
}
|
|
101
|
+
if (field && field !== colId) {
|
|
102
|
+
summary[field] = total;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const firstField = columns[0]?.field ?? columns[0]?.colId;
|
|
106
|
+
if (firstField) {
|
|
107
|
+
summary[String(firstField)] = summaryLabel;
|
|
108
|
+
}
|
|
109
|
+
return summary;
|
|
110
|
+
}
|
|
111
|
+
function formatSummaryRow(rawSummary, columns) {
|
|
112
|
+
const formatted = {};
|
|
113
|
+
for (const col of columns) {
|
|
114
|
+
const { field, colId, hide, valueFormatter } = col;
|
|
115
|
+
const key = colId ?? field;
|
|
116
|
+
if (!key || hide === true) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const rawValue = rawSummary[key];
|
|
120
|
+
if (valueFormatter && typeof valueFormatter === "function") {
|
|
121
|
+
const params = defaultFormatterParams(rawValue, rawSummary, col);
|
|
122
|
+
formatted[key] = valueFormatter(params) ?? "-";
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
formatted[key] = rawValue != null ? String(rawValue) : "-";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return formatted;
|
|
129
|
+
}
|
|
130
|
+
function calculateSummaryRow({ data, columns, exemptFields = [], summaryLabel = "Total", }) {
|
|
131
|
+
if ((0, isEmpty_1.default)(data)) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const flattenedColumns = flattenColumns(columns);
|
|
135
|
+
const exemptFieldsSet = new Set(exemptFields.map(String));
|
|
136
|
+
const rawSummary = createSummaryRow(data, flattenedColumns, exemptFieldsSet, summaryLabel);
|
|
137
|
+
const formattedSummary = formatSummaryRow(rawSummary, flattenedColumns);
|
|
138
|
+
return {
|
|
139
|
+
rawSummary,
|
|
140
|
+
formattedSummary,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function useAgGridSummaryRow({ data, columns, exemptFields = [], summaryLabel = "Total", }) {
|
|
144
|
+
const result = (0, react_1.useMemo)(() => {
|
|
145
|
+
const dataArray = typeof data === "function" ? data() : data;
|
|
146
|
+
return calculateSummaryRow({
|
|
147
|
+
data: dataArray,
|
|
148
|
+
columns,
|
|
149
|
+
exemptFields,
|
|
150
|
+
summaryLabel,
|
|
151
|
+
});
|
|
152
|
+
}, [data, columns, exemptFields, summaryLabel]);
|
|
153
|
+
const { rawSummary, formattedSummary } = result ?? {};
|
|
154
|
+
return {
|
|
155
|
+
summaryRow: rawSummary,
|
|
156
|
+
pinnedBottomRowData: rawSummary && [rawSummary],
|
|
157
|
+
formattedSummary,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ColDef, ColGroupDef } from "ag-grid-community";
|
|
2
|
+
import type { AgGridReact } from "ag-grid-react";
|
|
3
|
+
import type { FieldValues } from "react-hook-form";
|
|
4
|
+
type UseAgGridSummaryRowUpdateOptions<T extends FieldValues> = {
|
|
5
|
+
gridRef: React.RefObject<AgGridReact<T>>;
|
|
6
|
+
columns: (ColDef<T> | ColGroupDef<T>)[];
|
|
7
|
+
exemptFields?: (keyof T)[];
|
|
8
|
+
summaryLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function useAgGridSummaryRowUpdate<T extends FieldValues>({ gridRef, columns, exemptFields, summaryLabel, }: UseAgGridSummaryRowUpdateOptions<T>): {
|
|
11
|
+
updateSummaryRow: () => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useAgGridSummaryRowUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgGridSummaryRowUpdate.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridSummaryRowUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,KAAK,gCAAgC,CAAC,CAAC,SAAS,WAAW,IAAI;IAC7D,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,WAAW,EAAE,EAC/D,OAAO,EACP,OAAO,EACP,YAAiB,EACjB,YAAsB,GACvB,EAAE,gCAAgC,CAAC,CAAC,CAAC;;EAiCrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridSummaryRowUpdate = useAgGridSummaryRowUpdate;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAgGridSummaryRow_1 = require("./useAgGridSummaryRow");
|
|
6
|
+
function useAgGridSummaryRowUpdate({ gridRef, columns, exemptFields = [], summaryLabel = "Total", }) {
|
|
7
|
+
const updateSummaryRow = (0, react_1.useCallback)(() => {
|
|
8
|
+
const api = gridRef.current?.api;
|
|
9
|
+
if (!api) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const filteredData = [];
|
|
13
|
+
api.forEachNodeAfterFilter((node) => {
|
|
14
|
+
const data = node.data;
|
|
15
|
+
if (data) {
|
|
16
|
+
filteredData.push(data);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const summaryResult = (0, useAgGridSummaryRow_1.calculateSummaryRow)({
|
|
20
|
+
data: filteredData,
|
|
21
|
+
columns,
|
|
22
|
+
exemptFields: exemptFields,
|
|
23
|
+
summaryLabel,
|
|
24
|
+
});
|
|
25
|
+
if (summaryResult?.rawSummary) {
|
|
26
|
+
api.setGridOption("pinnedBottomRowData", [summaryResult.rawSummary]);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
api.setGridOption("pinnedBottomRowData", []);
|
|
30
|
+
}
|
|
31
|
+
}, [gridRef, columns, exemptFields, summaryLabel]);
|
|
32
|
+
return { updateSummaryRow };
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgGrid/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgGrid/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -20,3 +20,5 @@ __exportStar(require("./LoadingCell"), exports);
|
|
|
20
20
|
__exportStar(require("./LoadingOverlay"), exports);
|
|
21
21
|
__exportStar(require("./NoDataOverlay"), exports);
|
|
22
22
|
__exportStar(require("./utils"), exports);
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ColDef, IGetRowsParams } from "ag-grid-community";
|
|
2
|
+
type Action = {
|
|
3
|
+
action?: string;
|
|
4
|
+
};
|
|
5
|
+
export type AgDataWithActions<TData> = TData & Action;
|
|
6
|
+
export type AgColumnsWithActions<TData> = ColDef<AgDataWithActions<TData>>[];
|
|
7
|
+
export type AgColumnsArgs<TData> = TData & {
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type QuickFilter = {
|
|
11
|
+
quickFilter: {
|
|
12
|
+
search: {
|
|
13
|
+
filter?: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type AGgrid = IGetRowsParams;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=agGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agGrid.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/types/agGrid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEhE,KAAK,MAAM,GAAG;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,KAAK,GAAG,MAAM,CAAC;AAEtD,MAAM,MAAM,oBAAoB,CAAC,KAAK,IAAI,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAE7E,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,KAAK,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE;QACX,MAAM,EAAE;YACN,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ColDef, ColGroupDef } from "ag-grid-community";
|
|
2
|
+
import type { FieldValues } from "react-hook-form";
|
|
3
|
+
export type UseAgGridSummaryRowOptions<T extends FieldValues> = {
|
|
4
|
+
data: T[];
|
|
5
|
+
columns: (ColDef<T> | ColGroupDef<T>)[];
|
|
6
|
+
exemptFields?: (keyof T)[];
|
|
7
|
+
summaryLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
export type UseAgGridSummaryRowHookOptions<T extends FieldValues> = {
|
|
10
|
+
data: T[] | (() => T[]);
|
|
11
|
+
columns: (ColDef<T> | ColGroupDef<T>)[];
|
|
12
|
+
exemptFields?: (keyof T)[];
|
|
13
|
+
summaryLabel?: string;
|
|
14
|
+
};
|
|
15
|
+
export type SummaryRowResult = {
|
|
16
|
+
rawSummary: Record<string, string | number | null>;
|
|
17
|
+
formattedSummary: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
export type SummaryRowData = Record<string, string | number | null>;
|
|
20
|
+
export type SummableValue = string | number | null | undefined;
|
|
21
|
+
export type SummaryRowParams<T extends FieldValues> = {
|
|
22
|
+
value: string | number | null;
|
|
23
|
+
data: Record<string, string | number | null>;
|
|
24
|
+
colDef: ColDef<T>;
|
|
25
|
+
};
|
|
26
|
+
export type ExportDataType = Record<string, string | number>;
|
|
27
|
+
//# sourceMappingURL=agSummaryTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agSummaryTypes.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/types/agSummaryTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,WAAW,IAAI;IAC9D,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,WAAW,IAAI;IAClE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;IACnD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/D,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,IAAI;IACpD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agGrid"), exports);
|
|
18
|
+
__exportStar(require("./agSummaryTypes"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractPrefixedValue.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/utils/extractPrefixedValue.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,GAAG,IAAI,KAAG,MAe5D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPrefixedValue = void 0;
|
|
4
|
+
const extractPrefixedValue = (value) => {
|
|
5
|
+
if (!value) {
|
|
6
|
+
return "-";
|
|
7
|
+
}
|
|
8
|
+
const valueStr = String(value);
|
|
9
|
+
const parts = valueStr.split(".");
|
|
10
|
+
const extracted = parts.length > 1
|
|
11
|
+
? (parts[parts.length - 1] ?? valueStr ?? "")
|
|
12
|
+
: (valueStr ?? "");
|
|
13
|
+
return extracted === "null" || extracted === "" ? "-" : extracted;
|
|
14
|
+
};
|
|
15
|
+
exports.extractPrefixedValue = extractPrefixedValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const formatDate: (date: string, format?: string) => string;
|
|
2
2
|
export declare const getTimeInHHmm: (date: string, format?: string) => string;
|
|
3
3
|
export declare const getDifferenceInHHmmss: (startTime: string, endTime: string) => string;
|
|
4
|
+
export declare const formatHours: (timeString?: string | number | null) => string;
|
|
4
5
|
//# sourceMappingURL=date.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,SAAQ,MAAqB,WAErE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,SAAQ,MAAgB,WAQnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,SAAS,MAAM,WAUvE,CAAC"}
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,SAAQ,MAAqB,WAErE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,SAAQ,MAAgB,WAQnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,SAAS,MAAM,WAUvE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,aAAa,MAAM,GAAG,MAAM,GAAG,IAAI,WA4C9D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDifferenceInHHmmss = exports.getTimeInHHmm = exports.formatDate = void 0;
|
|
3
|
+
exports.formatHours = exports.getDifferenceInHHmmss = exports.getTimeInHHmm = exports.formatDate = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const formatDate = (date, format = "dd-MM-yyyy") => {
|
|
6
6
|
return luxon_1.DateTime.fromISO(date).toFormat(format);
|
|
@@ -22,3 +22,35 @@ const getDifferenceInHHmmss = (startTime, endTime) => {
|
|
|
22
22
|
return luxon_1.Duration.fromObject(diff.toObject()).toFormat("hh:mm:ss");
|
|
23
23
|
};
|
|
24
24
|
exports.getDifferenceInHHmmss = getDifferenceInHHmmss;
|
|
25
|
+
const formatHours = (timeString) => {
|
|
26
|
+
if (!timeString) {
|
|
27
|
+
return "0h 0m";
|
|
28
|
+
}
|
|
29
|
+
if (typeof timeString === "number") {
|
|
30
|
+
const duration = luxon_1.Duration.fromObject({ hours: timeString });
|
|
31
|
+
if (!duration.isValid) {
|
|
32
|
+
return "0h 0m";
|
|
33
|
+
}
|
|
34
|
+
const totalHours = Math.floor(duration.as("hours"));
|
|
35
|
+
const totalMinutes = Math.floor(duration.as("minutes")) % 60;
|
|
36
|
+
return `${totalHours}h ${totalMinutes}m`;
|
|
37
|
+
}
|
|
38
|
+
if (typeof timeString !== "string") {
|
|
39
|
+
return "0h 0m";
|
|
40
|
+
}
|
|
41
|
+
const trimmed = timeString.trim();
|
|
42
|
+
if (!trimmed) {
|
|
43
|
+
return "0h 0m";
|
|
44
|
+
}
|
|
45
|
+
const parts = trimmed.split(":");
|
|
46
|
+
if (!Array.isArray(parts) || parts.length < 2) {
|
|
47
|
+
return "0h 0m";
|
|
48
|
+
}
|
|
49
|
+
const hours = parts[0] ? parseInt(parts[0], 10) : 0;
|
|
50
|
+
const minutes = parts[1] ? parseInt(parts[1], 10) : 0;
|
|
51
|
+
if (Number.isNaN(hours) || Number.isNaN(minutes)) {
|
|
52
|
+
return "0h 0m";
|
|
53
|
+
}
|
|
54
|
+
return `${hours}h ${minutes}m`;
|
|
55
|
+
};
|
|
56
|
+
exports.formatHours = formatHours;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useAgGridCheckBoxSelection"), exports);
|
|
18
17
|
__exportStar(require("./useGetDeviceType"), exports);
|
|
19
18
|
__exportStar(require("./useGlobalKeyboardShortcut"), exports);
|
|
20
19
|
__exportStar(require("./useDialogActions"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/utils/regex.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,QAAkB,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAwB,CAAC;AAElD,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AAEzD,eAAO,MAAM,UAAU,QACmvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/utils/regex.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,QAAkB,CAAC;AAE9C,eAAO,MAAM,YAAY,QAAwB,CAAC;AAElD,eAAO,MAAM,uBAAuB,QAAoB,CAAC;AAEzD,eAAO,MAAM,UAAU,QACmvB,CAAC;AAE3wB,eAAO,MAAM,SAAS,QAA6B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emailRegex = exports.noSpecialCharacterRegex = exports.isoDateRegex = exports.monthYearRegex = void 0;
|
|
3
|
+
exports.timeRegex = exports.emailRegex = exports.noSpecialCharacterRegex = exports.isoDateRegex = exports.monthYearRegex = void 0;
|
|
4
4
|
/* eslint-disable sonarjs/single-character-alternation */
|
|
5
5
|
/* eslint-disable sonarjs/concise-regex */
|
|
6
6
|
/* eslint-disable sonarjs/sonar-no-control-regex */
|
|
@@ -11,3 +11,4 @@ exports.monthYearRegex = /^\d{4}-\d{2}$/;
|
|
|
11
11
|
exports.isoDateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
12
12
|
exports.noSpecialCharacterRegex = /^[a-zA-Z0-9 ]*$/;
|
|
13
13
|
exports.emailRegex = /^(((?!.*[^\x00-\x7F])[^<>()[\]\\.,;:\s@"](\.[^<>()[\]\\.,;:\s@"])*){1,64}|(".{1,64}"))@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-zA-Z\-0-9]+(?:-[a-zA-Z\-0-9]+)*([.]{1,1}))){1,4}([a-zA-Z][a-zA-Z0-9]{1,}))|(?:\[(?:(?:(i|I)(p|P)(v)6:(?:(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){7})|(?:(?!(?:.*[a-zA-Z\-0-9][:\]]){7,})(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){0,5})?::(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){0,5})?)))|(?:(?:(i|I)(p|P)(v)6:(?:(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){5}:)|(?:(?!(?:.*[a-zA-Z\-0-9]:){5,})(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){0,3})?::(?:[a-zA-Z\-0-9]{1,4}(?::[a-zA-Z\-0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/;
|
|
14
|
+
exports.timeRegex = /^\d{1,3}:\d{2}(:\d{2})?$/;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAgGridCheckBoxSelection.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAgGridCheckBoxSelection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK9E,KAAK,8BAA8B,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;IAC9D,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAgB,EAAE,CAAC,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAqCF,eAAO,MAAM,0BAA0B,GAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,uEAKlE,8BAA8B,CAAC,CAAC,CAAC;;6BAyCF,WAAW,CAAC,gBAAgB,CAAC;;;CA4H9D,CAAC"}
|
/package/packages/shared-components/dist/{utils → AgGrid}/hooks/useAgGridCheckBoxSelection.d.ts
RENAMED
|
File without changes
|