@codezee/sixtify-brahma 0.2.136 → 0.2.138
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 +3 -3
- package/packages/shared-components/dist/AgGrid/AgGrid.d.ts +5 -0
- package/packages/shared-components/dist/AgGrid/AgGrid.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/AgGrid.js +174 -18
- package/packages/shared-components/dist/AgGrid/LoadingOverlay.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/LoadingOverlay.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/LoadingOverlay.js +15 -0
- package/packages/shared-components/dist/AgGrid/NoDataOverlay.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/NoDataOverlay.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/NoDataOverlay.js +14 -0
- package/packages/shared-components/dist/AgGrid/index.d.ts +4 -1
- package/packages/shared-components/dist/AgGrid/index.d.ts.map +1 -1
- package/packages/shared-components/dist/AgGrid/index.js +4 -1
- package/packages/shared-components/dist/AgGrid/registerAgGridModules.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/registerAgGridModules.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/registerAgGridModules.js +4 -0
- package/packages/shared-components/dist/AgGrid/utils/ag-grid-custom-filter.d.ts +36 -0
- package/packages/shared-components/dist/AgGrid/utils/ag-grid-custom-filter.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/utils/ag-grid-custom-filter.js +108 -0
- package/packages/shared-components/dist/AgGrid/utils/index.d.ts +2 -0
- package/packages/shared-components/dist/AgGrid/utils/index.d.ts.map +1 -0
- package/packages/shared-components/dist/AgGrid/utils/index.js +17 -0
- package/packages/shared-components/dist/CellSelectionTable/hook/useOutsideClick.d.ts +2 -1
- package/packages/shared-components/dist/CellSelectionTable/hook/useOutsideClick.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/CellRenderer.d.ts +1 -1
- package/packages/shared-components/dist/utils/CheckboxInput.d.ts +4 -0
- package/packages/shared-components/dist/utils/CheckboxInput.d.ts.map +1 -0
- package/packages/shared-components/dist/utils/CheckboxInput.js +24 -0
- package/packages/shared-components/dist/utils/helper.d.ts +2 -0
- package/packages/shared-components/dist/utils/helper.d.ts.map +1 -0
- package/packages/shared-components/dist/utils/helper.js +8 -0
- package/packages/shared-components/dist/utils/hooks/index.d.ts +5 -0
- package/packages/shared-components/dist/utils/hooks/index.d.ts.map +1 -0
- package/packages/shared-components/dist/utils/hooks/index.js +20 -0
- package/packages/shared-components/dist/utils/hooks/useAgGridCheckBoxSelection.d.ts +20 -0
- package/packages/shared-components/dist/utils/hooks/useAgGridCheckBoxSelection.d.ts.map +1 -0
- package/packages/shared-components/dist/utils/hooks/useAgGridCheckBoxSelection.js +145 -0
- package/packages/shared-components/dist/utils/index.d.ts +3 -3
- package/packages/shared-components/dist/utils/index.d.ts.map +1 -1
- package/packages/shared-components/dist/utils/index.js +3 -3
- 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 +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codezee/sixtify-brahma",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.138",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"@tiptap/starter-kit": "^3.4.4",
|
|
113
113
|
"@tiptap/suggestion": "^3.4.4",
|
|
114
114
|
"@types/file-saver": "^2.0.7",
|
|
115
|
-
"ag-grid-community": "^
|
|
116
|
-
"ag-grid-react": "^
|
|
115
|
+
"ag-grid-community": "^34.3.1",
|
|
116
|
+
"ag-grid-react": "^34.3.1",
|
|
117
117
|
"axios": "^1.7.2",
|
|
118
118
|
"date-fns": "^4.1.0",
|
|
119
119
|
"eslint-plugin-sonarjs": "1.0.4-alpha.1",
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { GridApi } from "ag-grid-community";
|
|
1
2
|
import type { AgGridReactProps } from "ag-grid-react";
|
|
2
3
|
import { AgGridReact } from "ag-grid-react";
|
|
3
4
|
import type { Ref } from "react";
|
|
5
|
+
import "./registerAgGridModules";
|
|
6
|
+
export declare const showNoRowsOverlay: (api: GridApi<unknown>, template?: string) => void;
|
|
4
7
|
export declare const defaultPageSize = 50;
|
|
5
8
|
export declare const pageSizeOptions: number[];
|
|
6
9
|
export type AgGridProps<T = unknown> = AgGridReactProps<T> & {
|
|
@@ -8,9 +11,11 @@ export type AgGridProps<T = unknown> = AgGridReactProps<T> & {
|
|
|
8
11
|
ref?: Ref<AgGridReact<T>>;
|
|
9
12
|
totalRecords?: number;
|
|
10
13
|
overlayNoRowsTemplate?: string;
|
|
14
|
+
loadingOverlayMessage?: string;
|
|
11
15
|
selectedItems?: number;
|
|
12
16
|
enableSecondRowFilter?: boolean;
|
|
13
17
|
disableKeyBoardEvent?: boolean;
|
|
18
|
+
enableFloatingFilter?: boolean;
|
|
14
19
|
};
|
|
15
20
|
type AgGridType = React.ForwardRefExoticComponent<AgGridProps> & (<GenericType>(props: AgGridProps<GenericType>) => JSX.Element);
|
|
16
21
|
export declare const AgGrid: AgGridType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,yBAAyB,CAAC;AA8DjC,eAAO,MAAM,iBAAiB,GAC5B,KAAK,OAAO,CAAC,OAAO,CAAC,EACrB,WAAW,MAAM,KAChB,IA8BF,CAAC;AAEF,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,eAAO,MAAM,eAAe,UAAqB,CAAC;AAGlD,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,GAC5D,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAElE,eAAO,MAAM,MAAM,EAyPd,UAAU,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgGrid = exports.pageSizeOptions = exports.defaultPageSize = void 0;
|
|
3
|
+
exports.AgGrid = exports.pageSizeOptions = exports.defaultPageSize = exports.showNoRowsOverlay = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const ag_grid_react_1 = require("ag-grid-react");
|
|
@@ -8,16 +8,92 @@ const react_1 = require("react");
|
|
|
8
8
|
const PadBox_1 = require("../PadBox");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const AgGridStyleProvider_1 = require("./AgGridStyleProvider");
|
|
11
|
+
const LoadingOverlay_1 = require("./LoadingOverlay");
|
|
12
|
+
const NoDataOverlay_1 = require("./NoDataOverlay");
|
|
13
|
+
require("./registerAgGridModules");
|
|
14
|
+
const getNoRowsText = (template) => {
|
|
15
|
+
const tempDiv = document.createElement("div");
|
|
16
|
+
tempDiv.innerHTML = template;
|
|
17
|
+
return tempDiv.textContent ?? tempDiv.innerText ?? "No Data Found";
|
|
18
|
+
};
|
|
19
|
+
const createOverlayElement = (template) => {
|
|
20
|
+
const overlay = document.createElement("div");
|
|
21
|
+
overlay.className = "ag-overlay-no-rows-wrapper";
|
|
22
|
+
overlay.style.cssText =
|
|
23
|
+
"display: flex; align-items: center; justify-content: center; height: 100%; width: 100%; position: absolute; top: 0; left: 0; pointer-events: none;";
|
|
24
|
+
const content = document.createElement("span");
|
|
25
|
+
content.className = "ag-overlay-no-rows-center";
|
|
26
|
+
content.textContent = template ? getNoRowsText(template) : "No Data Found";
|
|
27
|
+
overlay.appendChild(content);
|
|
28
|
+
return overlay;
|
|
29
|
+
};
|
|
30
|
+
const showOverlayInContainer = (container, template) => {
|
|
31
|
+
const overlayWrapper = container.querySelector(".ag-overlay-no-rows-wrapper");
|
|
32
|
+
if (overlayWrapper) {
|
|
33
|
+
overlayWrapper.style.display = "flex";
|
|
34
|
+
overlayWrapper.style.pointerEvents = "none";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const overlay = createOverlayElement(template);
|
|
38
|
+
container.appendChild(overlay);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const hideNoRowsOverlay = (api) => {
|
|
42
|
+
if (!api) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
api.hideOverlay();
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
const gridBody = document.querySelector(".ag-body.ag-layout-normal");
|
|
48
|
+
const overlayWrapper = gridBody?.querySelector(".ag-overlay-no-rows-wrapper") ||
|
|
49
|
+
document.querySelector(".ag-theme-quartz .ag-overlay-no-rows-wrapper");
|
|
50
|
+
if (overlayWrapper) {
|
|
51
|
+
overlayWrapper.remove();
|
|
52
|
+
}
|
|
53
|
+
}, 0);
|
|
54
|
+
};
|
|
55
|
+
const showNoRowsOverlay = (api, template) => {
|
|
56
|
+
if (!api) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const hasRows = !!api.getDisplayedRowCount() || !!api.getRenderedNodes().length;
|
|
60
|
+
if (!hasRows) {
|
|
61
|
+
api.setGridOption("suppressNoRowsOverlay", false);
|
|
62
|
+
api.hideOverlay();
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
if (!api.getDisplayedRowCount() && !api.getRenderedNodes().length) {
|
|
65
|
+
const gridBody = document.querySelector(".ag-body.ag-layout-normal");
|
|
66
|
+
if (gridBody) {
|
|
67
|
+
showOverlayInContainer(gridBody, template);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const gridContainer = document.querySelector(".ag-theme-quartz");
|
|
71
|
+
if (gridContainer) {
|
|
72
|
+
showOverlayInContainer(gridContainer, template);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, 100);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
hideNoRowsOverlay(api);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.showNoRowsOverlay = showNoRowsOverlay;
|
|
11
83
|
exports.defaultPageSize = 50;
|
|
12
84
|
exports.pageSizeOptions = [20, 50, 100, 200];
|
|
13
85
|
exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
14
86
|
const { layout } = (0, utils_1.useGetDeviceType)();
|
|
15
|
-
const {
|
|
87
|
+
const { height = "597px", rowHeight = 50, rowModelType = "infinite", defaultColDef, rowBuffer = 5,
|
|
16
88
|
// eslint-disable-next-line quotes
|
|
17
|
-
overlayNoRowsTemplate = '<span class="ag-overlay-no-rows-center">No Data Found</span>',
|
|
89
|
+
overlayNoRowsTemplate = '<span class="ag-overlay-no-rows-center">No Data Found</span>', pagination = false, enableSecondRowFilter, disableKeyBoardEvent, onModelUpdated, onFirstDataRendered, onViewportChanged, onFilterChanged, paginationPageSize: paginationPageSizeProp, cacheBlockSize: cacheBlockSizeProp, infiniteInitialRowCount: infiniteInitialRowCountProp, loading: gridLoading = false, ...rest } = props;
|
|
90
|
+
const resolvedPaginationPageSize = paginationPageSizeProp ?? exports.defaultPageSize;
|
|
91
|
+
const cacheBlockSize = cacheBlockSizeProp ?? resolvedPaginationPageSize;
|
|
92
|
+
const infiniteInitialRowCount = infiniteInitialRowCountProp ?? resolvedPaginationPageSize;
|
|
18
93
|
const defaultColumnDef = {
|
|
19
94
|
flex: 1,
|
|
20
95
|
floatingFilter: false,
|
|
96
|
+
filter: true,
|
|
21
97
|
filterParams: {
|
|
22
98
|
closeOnApply: true,
|
|
23
99
|
contains: false,
|
|
@@ -28,20 +104,98 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
28
104
|
wrapHeaderText: true,
|
|
29
105
|
...defaultColDef,
|
|
30
106
|
};
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
107
|
+
const updateNoRowsOverlay = (0, react_1.useCallback)((api, shouldShow) => {
|
|
108
|
+
if (!api) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const normalizedApi = api;
|
|
112
|
+
if (!shouldShow || gridLoading) {
|
|
113
|
+
hideNoRowsOverlay(normalizedApi);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
(0, exports.showNoRowsOverlay)(normalizedApi, overlayNoRowsTemplate);
|
|
117
|
+
}, [gridLoading, overlayNoRowsTemplate]);
|
|
118
|
+
const handleModelUpdated = (0, react_1.useCallback)((params) => {
|
|
119
|
+
onModelUpdated?.(params);
|
|
120
|
+
const api = params.api;
|
|
121
|
+
if (api) {
|
|
122
|
+
if (rowModelType === "infinite") {
|
|
123
|
+
const datasource = api.getGridOption("datasource");
|
|
124
|
+
if (datasource) {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
const displayedCount = api.getDisplayedRowCount();
|
|
127
|
+
const renderedNodes = api.getRenderedNodes().length;
|
|
128
|
+
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
129
|
+
}, 50);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
const displayedCount = api.getDisplayedRowCount();
|
|
135
|
+
const renderedNodes = api.getRenderedNodes().length;
|
|
136
|
+
updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
|
|
137
|
+
}, 50);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, [onModelUpdated, rowModelType, updateNoRowsOverlay]);
|
|
141
|
+
const handleFirstDataRendered = (0, react_1.useCallback)((params) => {
|
|
142
|
+
onFirstDataRendered?.(params);
|
|
143
|
+
const api = params.api;
|
|
144
|
+
if (api) {
|
|
145
|
+
if (rowModelType === "infinite") {
|
|
146
|
+
const datasource = api.getGridOption("datasource");
|
|
147
|
+
if (datasource) {
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount());
|
|
150
|
+
}, 0);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount());
|
|
156
|
+
}, 0);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, [onFirstDataRendered, rowModelType, updateNoRowsOverlay]);
|
|
160
|
+
const handleViewportChanged = (0, react_1.useCallback)((params) => {
|
|
161
|
+
onViewportChanged?.(params);
|
|
162
|
+
const api = params.api;
|
|
163
|
+
if (api) {
|
|
164
|
+
if (rowModelType === "infinite") {
|
|
165
|
+
const datasource = api.getGridOption("datasource");
|
|
166
|
+
if (datasource) {
|
|
167
|
+
setTimeout(() => {
|
|
168
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
|
|
169
|
+
}, 50);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
|
|
175
|
+
}, 50);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, [onViewportChanged, rowModelType, updateNoRowsOverlay]);
|
|
179
|
+
const handleFilterChanged = (0, react_1.useCallback)((params) => {
|
|
180
|
+
onFilterChanged?.(params);
|
|
181
|
+
const api = params.api;
|
|
182
|
+
if (api) {
|
|
183
|
+
if (rowModelType === "infinite") {
|
|
184
|
+
const datasource = api.getGridOption("datasource");
|
|
185
|
+
if (datasource) {
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
|
|
188
|
+
}, 50);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
setTimeout(() => {
|
|
193
|
+
updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
|
|
194
|
+
}, 50);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}, [onFilterChanged, rowModelType, updateNoRowsOverlay]);
|
|
198
|
+
return ((0, jsx_runtime_1.jsxs)(AgGridStyleProvider_1.AgGridStyleProvider, { className: "ag-theme-quartz ", style: { width: "100%", height, position: "relative" }, children: [(0, jsx_runtime_1.jsx)(ag_grid_react_1.AgGridReact, { ref: ref, theme: "legacy", cacheBlockSize: cacheBlockSize, defaultColDef: {
|
|
45
199
|
...defaultColumnDef,
|
|
46
200
|
menuTabs: ["generalMenuTab", "filterMenuTab", "columnsMenuTab"],
|
|
47
201
|
floatingFilter: enableSecondRowFilter,
|
|
@@ -52,6 +206,8 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
|
|
|
52
206
|
? ["apply", "reset"]
|
|
53
207
|
: [],
|
|
54
208
|
},
|
|
55
|
-
}, rowHeight: rowHeight, rowModelType: rowModelType, rowBuffer: rowBuffer, infiniteInitialRowCount: infiniteInitialRowCount, overlayNoRowsTemplate: overlayNoRowsTemplate,
|
|
209
|
+
}, rowHeight: rowHeight, rowModelType: rowModelType, rowBuffer: rowBuffer, infiniteInitialRowCount: infiniteInitialRowCount, overlayNoRowsTemplate: overlayNoRowsTemplate, loadingOverlayComponent: LoadingOverlay_1.LoadingOverlay, loading: gridLoading, noRowsOverlayComponent: NoDataOverlay_1.NoDataOverlay, suppressNoRowsOverlay: rowModelType === "infinite" || gridLoading, pagination: pagination, onModelUpdated: handleModelUpdated, onFirstDataRendered: handleFirstDataRendered, onViewportChanged: handleViewportChanged, onFilterChanged: handleFilterChanged, ...(pagination
|
|
210
|
+
? { paginationPageSize: resolvedPaginationPageSize }
|
|
211
|
+
: {}), paginationPageSizeSelector: pagination ? exports.pageSizeOptions : false, ...rest }), !!props.selectedItems && pagination && ((0, jsx_runtime_1.jsx)(material_1.Box, { position: "absolute", bottom: "15px", children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { paddingLeft: "20px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "body2", children: ["Selected Rows ", props.selectedItems] }) }) }))] }));
|
|
56
212
|
});
|
|
57
213
|
exports.AgGrid.displayName = "AgGrid";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingOverlay.d.ts","sourceRoot":"","sources":["../../src/AgGrid/LoadingOverlay.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,+CAe1B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoadingOverlay = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Loader_1 = require("../Loader");
|
|
6
|
+
const LoadingOverlay = () => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "ag-overlay-loading-wrapper", style: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
height: "100%",
|
|
12
|
+
width: "100%",
|
|
13
|
+
}, children: (0, jsx_runtime_1.jsx)(Loader_1.FacebookCircularProgress, {}) }));
|
|
14
|
+
};
|
|
15
|
+
exports.LoadingOverlay = LoadingOverlay;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoDataOverlay.d.ts","sourceRoot":"","sources":["../../src/AgGrid/NoDataOverlay.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,+CAezB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoDataOverlay = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const NoDataOverlay = () => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "ag-overlay-no-rows-wrapper", style: {
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
height: "100%",
|
|
11
|
+
width: "100%",
|
|
12
|
+
}, children: (0, jsx_runtime_1.jsx)("span", { className: "ag-overlay-no-rows-center", children: "No Data Found" }) }));
|
|
13
|
+
};
|
|
14
|
+
exports.NoDataOverlay = NoDataOverlay;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export * from "./ActionCell/ActionCell";
|
|
1
2
|
export * from "./AgGrid";
|
|
2
3
|
export * from "./LoadingCell";
|
|
3
|
-
export * from "./
|
|
4
|
+
export * from "./LoadingOverlay";
|
|
5
|
+
export * from "./NoDataOverlay";
|
|
6
|
+
export * from "./utils";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgGrid/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,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"}
|
|
@@ -14,6 +14,9 @@ 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("./ActionCell/ActionCell"), exports);
|
|
17
18
|
__exportStar(require("./AgGrid"), exports);
|
|
18
19
|
__exportStar(require("./LoadingCell"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./LoadingOverlay"), exports);
|
|
21
|
+
__exportStar(require("./NoDataOverlay"), exports);
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerAgGridModules.d.ts","sourceRoot":"","sources":["../../src/AgGrid/registerAgGridModules.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IDoesFilterPassParams, IFilterComp, IFilterParams } from "ag-grid-community";
|
|
2
|
+
type FilterOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
filterFunction?: (value: string) => boolean;
|
|
6
|
+
};
|
|
7
|
+
type CustomEnumFilterParams = {
|
|
8
|
+
filterOptions: FilterOption[];
|
|
9
|
+
source: "client" | "server";
|
|
10
|
+
} & IFilterParams;
|
|
11
|
+
export type CustomEnumFilterModel = {
|
|
12
|
+
filterType: string;
|
|
13
|
+
filter: string;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class CustomEnumFilter implements IFilterComp {
|
|
17
|
+
filterParams: CustomEnumFilterParams;
|
|
18
|
+
selectedValue: string;
|
|
19
|
+
filterType: string;
|
|
20
|
+
type: string;
|
|
21
|
+
gui: HTMLDivElement;
|
|
22
|
+
filterOptions: FilterOption[];
|
|
23
|
+
eFilterType: HTMLSelectElement;
|
|
24
|
+
defaultFilterOptions: FilterOption[];
|
|
25
|
+
constructor();
|
|
26
|
+
init(params: CustomEnumFilterParams): void;
|
|
27
|
+
setupGui(): void;
|
|
28
|
+
setupListeners(params: CustomEnumFilterParams): void;
|
|
29
|
+
getGui(): HTMLDivElement;
|
|
30
|
+
doesFilterPass(params: IDoesFilterPassParams): boolean;
|
|
31
|
+
isFilterActive(): boolean;
|
|
32
|
+
getModel(): CustomEnumFilterModel | null;
|
|
33
|
+
setModel(model: CustomEnumFilterModel | null): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=ag-grid-custom-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ag-grid-custom-filter.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/utils/ag-grid-custom-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CAC7C,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B,GAAG,aAAa,CAAC;AAElB,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,gBAAiB,YAAW,WAAW;IAClD,YAAY,EAAG,sBAAsB,CAAC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAG,cAAc,CAAC;IACrB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,WAAW,EAAG,iBAAiB,CAAC;IAEhC,oBAAoB,EAAE,YAAY,EAAE,CAMlC;;IAQF,IAAI,CAAC,MAAM,EAAE,sBAAsB;IAmBnC,QAAQ;IAyBR,cAAc,CAAC,MAAM,EAAE,sBAAsB;IAS7C,MAAM;IAIN,cAAc,CAAC,MAAM,EAAE,qBAAqB;IAsB5C,cAAc;IAId,QAAQ,IAAI,qBAAqB,GAAG,IAAI;IAYxC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI;CAe7C"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomEnumFilter = void 0;
|
|
4
|
+
class CustomEnumFilter {
|
|
5
|
+
filterParams;
|
|
6
|
+
selectedValue;
|
|
7
|
+
filterType;
|
|
8
|
+
type;
|
|
9
|
+
gui;
|
|
10
|
+
filterOptions;
|
|
11
|
+
eFilterType;
|
|
12
|
+
defaultFilterOptions = [
|
|
13
|
+
{
|
|
14
|
+
value: "all",
|
|
15
|
+
label: "All",
|
|
16
|
+
filterFunction: () => true,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
constructor() {
|
|
20
|
+
this.filterOptions = this.defaultFilterOptions;
|
|
21
|
+
this.selectedValue = "all";
|
|
22
|
+
this.type = "equals";
|
|
23
|
+
}
|
|
24
|
+
init(params) {
|
|
25
|
+
this.filterParams = params;
|
|
26
|
+
if (params.filterOptions && params.filterOptions.length > 0) {
|
|
27
|
+
this.filterOptions = [
|
|
28
|
+
{
|
|
29
|
+
value: "all",
|
|
30
|
+
label: "All",
|
|
31
|
+
filterFunction: () => true,
|
|
32
|
+
},
|
|
33
|
+
...params.filterOptions,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
this.filterType = "text";
|
|
37
|
+
this.selectedValue = this.filterOptions[0]?.value ?? "all";
|
|
38
|
+
this.setupGui();
|
|
39
|
+
this.setupListeners(params);
|
|
40
|
+
}
|
|
41
|
+
setupGui() {
|
|
42
|
+
this.gui = document.createElement("div");
|
|
43
|
+
this.gui.innerHTML = `
|
|
44
|
+
<div class="ag-filter-body-wrapper ag-simple-filter-body-wrapper">
|
|
45
|
+
<div class="ag-picker-field ag-labeled ag-label-align-left ag-select ag-filter-select">
|
|
46
|
+
<select id="filterType" class="ag-wrapper ag-picker-field-wrapper ag-picker-collapsed">
|
|
47
|
+
${this.filterOptions
|
|
48
|
+
.map((option) => `<option class="ag-picker-field-display" value="${option.value}">${option.label}</option>`)
|
|
49
|
+
.join("")}
|
|
50
|
+
</select>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`;
|
|
54
|
+
this.eFilterType = this.gui.querySelector("#filterType");
|
|
55
|
+
this.eFilterType.value = this.selectedValue;
|
|
56
|
+
}
|
|
57
|
+
setupListeners(params) {
|
|
58
|
+
this.eFilterType.addEventListener("change", (event) => {
|
|
59
|
+
const select = event.target;
|
|
60
|
+
this.selectedValue = select.value;
|
|
61
|
+
params.filterChangedCallback();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getGui() {
|
|
65
|
+
return this.gui;
|
|
66
|
+
}
|
|
67
|
+
doesFilterPass(params) {
|
|
68
|
+
const { node } = params;
|
|
69
|
+
const value = this.filterParams.getValue(node);
|
|
70
|
+
const cellValue = value ? value.toString().toLowerCase() : "";
|
|
71
|
+
if (this.selectedValue === "all") {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const selectedOption = this.filterOptions.find((opt) => opt.value === this.selectedValue);
|
|
75
|
+
if (selectedOption?.filterFunction) {
|
|
76
|
+
return selectedOption.filterFunction(cellValue);
|
|
77
|
+
}
|
|
78
|
+
return cellValue === this.selectedValue.toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
isFilterActive() {
|
|
81
|
+
return this.selectedValue !== "all";
|
|
82
|
+
}
|
|
83
|
+
getModel() {
|
|
84
|
+
if (this.selectedValue === "all") {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
filterType: this.filterParams.source === "client" ? "customEnum" : "text",
|
|
89
|
+
filter: this.selectedValue,
|
|
90
|
+
type: this.type,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
setModel(model) {
|
|
94
|
+
if (model?.filter) {
|
|
95
|
+
this.selectedValue = model.filter;
|
|
96
|
+
if (this.eFilterType) {
|
|
97
|
+
this.eFilterType.value = model.filter;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.selectedValue = "all";
|
|
102
|
+
if (this.eFilterType) {
|
|
103
|
+
this.eFilterType.value = "all";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.CustomEnumFilter = CustomEnumFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./ag-grid-custom-filter"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
+
import type { OnAction } from "../../utils";
|
|
2
3
|
export declare function isClickInsideAnyOverlay(event: MouseEvent): boolean;
|
|
3
|
-
export declare function useOutsideClick<T extends HTMLElement>(ref: RefObject<T>, onOutsideClick:
|
|
4
|
+
export declare function useOutsideClick<T extends HTMLElement>(ref: RefObject<T>, onOutsideClick: OnAction): void;
|
|
4
5
|
//# sourceMappingURL=useOutsideClick.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOutsideClick.d.ts","sourceRoot":"","sources":["../../../src/CellSelectionTable/hook/useOutsideClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useOutsideClick.d.ts","sourceRoot":"","sources":["../../../src/CellSelectionTable/hook/useOutsideClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAW5C,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAsBlE;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EACnD,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,EACjB,cAAc,EAAE,QAAQ,QAyBzB"}
|
|
@@ -6,6 +6,6 @@ type CellRendererProps<T> = {
|
|
|
6
6
|
row: Row<T>;
|
|
7
7
|
summaryData?: SummaryRecord<T>;
|
|
8
8
|
};
|
|
9
|
-
export declare const CellRenderer: <T>({ cell, isSummaryRow, row, summaryData, }: CellRendererProps<T>) => string | number | bigint | boolean |
|
|
9
|
+
export declare const CellRenderer: <T>({ cell, isSummaryRow, row, summaryData, }: CellRendererProps<T>) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | Promise<import("react").AwaitedReactNode> | null | undefined;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=CellRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/utils/CheckboxInput.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,GAAI;;CAAW,4CAgCxC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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.CheckboxInput = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const CheckBoxRounded_1 = __importDefault(require("@mui/icons-material/CheckBoxRounded"));
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const CheckboxInput = ({ ...rest }) => {
|
|
11
|
+
const theme = (0, material_1.useTheme)();
|
|
12
|
+
const { butterflyBlue, iron } = theme.palette.app.color;
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { disableRipple: true, checkedIcon: (0, jsx_runtime_1.jsx)(CheckBoxRounded_1.default, { fontSize: "small", htmlColor: butterflyBlue[900], sx: {
|
|
14
|
+
borderRadius: 100,
|
|
15
|
+
marginLeft: "-1px",
|
|
16
|
+
} }), icon: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
17
|
+
width: 14,
|
|
18
|
+
height: 14,
|
|
19
|
+
border: "1px solid",
|
|
20
|
+
borderColor: iron[800],
|
|
21
|
+
borderRadius: "4px",
|
|
22
|
+
} }), ...rest }));
|
|
23
|
+
};
|
|
24
|
+
exports.CheckboxInput = CheckboxInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/utils/helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,GAAI,SAAS,WAAW,WAI7C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getZIndex = void 0;
|
|
4
|
+
const getZIndex = (element) => {
|
|
5
|
+
const parsed = parseInt(window.getComputedStyle(element).zIndex ?? "", 10);
|
|
6
|
+
return isNaN(parsed) ? 0 : parsed;
|
|
7
|
+
};
|
|
8
|
+
exports.getZIndex = getZIndex;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./useGetDeviceType"), exports);
|
|
19
|
+
__exportStar(require("./useGlobalKeyboardShortcut"), exports);
|
|
20
|
+
__exportStar(require("./useDialogActions"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgGridReact } from "ag-grid-react";
|
|
2
|
+
import type { ChangeEvent, Dispatch, RefObject, SetStateAction } from "react";
|
|
3
|
+
type useAgGridCheckBoxSelectionArgs<T extends {
|
|
4
|
+
id: string;
|
|
5
|
+
}> = {
|
|
6
|
+
gridRef: RefObject<AgGridReact<T>>;
|
|
7
|
+
setSelectedEmployee: Dispatch<SetStateAction<string[]>>;
|
|
8
|
+
currentPageItems: T[];
|
|
9
|
+
selectedEmployee: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const useAgGridCheckBoxSelection: <T extends {
|
|
12
|
+
id: string;
|
|
13
|
+
}>({ gridRef, setSelectedEmployee, currentPageItems, selectedEmployee, }: useAgGridCheckBoxSelectionArgs<T>) => {
|
|
14
|
+
isChecked: boolean;
|
|
15
|
+
handleSelectAll: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
indeterminate: boolean;
|
|
17
|
+
setIsChecked: Dispatch<SetStateAction<boolean>>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=useAgGridCheckBoxSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAgGridCheckBoxSelection = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const helper_1 = require("../helper");
|
|
6
|
+
const useGlobalKeyboardShortcut_1 = require("./useGlobalKeyboardShortcut");
|
|
7
|
+
const isDialogOnTop = (gridRef) => {
|
|
8
|
+
const dialogs = document.querySelectorAll(
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
'[role="dialog"], .MuiDialog-root, .MuiModal-root');
|
|
11
|
+
if (dialogs.length === 0) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const gridContainer = gridRef.current?.api?.eGridDiv;
|
|
15
|
+
const gridZIndex = gridContainer ? (0, helper_1.getZIndex)(gridContainer) : 0;
|
|
16
|
+
for (const dialog of Array.from(dialogs)) {
|
|
17
|
+
const dialogElement = dialog;
|
|
18
|
+
const isVisible = dialogElement.offsetParent !== null ||
|
|
19
|
+
window.getComputedStyle(dialogElement).display !== "none";
|
|
20
|
+
if (isVisible) {
|
|
21
|
+
const dialogZIndex = (0, helper_1.getZIndex)(dialogElement);
|
|
22
|
+
if (dialogZIndex > gridZIndex) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
};
|
|
29
|
+
const useAgGridCheckBoxSelection = ({ gridRef, setSelectedEmployee, currentPageItems, selectedEmployee, }) => {
|
|
30
|
+
const [isChecked, setIsChecked] = (0, react_1.useState)(false);
|
|
31
|
+
const handleRowCheckBox = (isChecked) => {
|
|
32
|
+
if (!gridRef.current) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const api = gridRef.current.api;
|
|
36
|
+
return currentPageItems.forEach((item) => {
|
|
37
|
+
api.getRowNode(item.id)?.setSelected(isChecked);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const commonCheckBoxMethod = () => {
|
|
41
|
+
const currentPageItemsId = currentPageItems.map((item) => item.id);
|
|
42
|
+
if (!isChecked) {
|
|
43
|
+
handleRowCheckBox(true);
|
|
44
|
+
setIsChecked(true);
|
|
45
|
+
return setSelectedEmployee((prev) => {
|
|
46
|
+
const newArray = [...prev, ...currentPageItemsId];
|
|
47
|
+
return newArray;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
setIsChecked(false);
|
|
51
|
+
handleRowCheckBox(false);
|
|
52
|
+
return setSelectedEmployee((prev) => {
|
|
53
|
+
const newArray = prev.filter((id) => !currentPageItemsId.includes(id));
|
|
54
|
+
return newArray;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const handleSelectAll = (event) => {
|
|
58
|
+
setIsChecked(event.target.checked);
|
|
59
|
+
commonCheckBoxMethod();
|
|
60
|
+
};
|
|
61
|
+
(0, useGlobalKeyboardShortcut_1.useGlobalKeyboardShortcut)({
|
|
62
|
+
key: "a",
|
|
63
|
+
modifierKeys: "ctrl",
|
|
64
|
+
onTrigger: () => {
|
|
65
|
+
if (isDialogOnTop(gridRef)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (!currentPageItems.length) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const currentPageItemsId = currentPageItems.map((item) => item.id);
|
|
72
|
+
if (!gridRef.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const api = gridRef.current.api;
|
|
76
|
+
currentPageItems.forEach((item) => {
|
|
77
|
+
api.getRowNode(item.id)?.setSelected(true);
|
|
78
|
+
});
|
|
79
|
+
setIsChecked(true);
|
|
80
|
+
setSelectedEmployee((prev) => {
|
|
81
|
+
const newArray = [...prev];
|
|
82
|
+
currentPageItemsId.forEach((id) => {
|
|
83
|
+
if (!newArray.includes(id)) {
|
|
84
|
+
newArray.push(id);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return newArray;
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
(0, useGlobalKeyboardShortcut_1.useGlobalKeyboardShortcut)({
|
|
92
|
+
key: "a",
|
|
93
|
+
modifierKeys: ["ctrl", "shift"],
|
|
94
|
+
onTrigger: () => {
|
|
95
|
+
if (isDialogOnTop(gridRef)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (!currentPageItems.length) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const currentPageItemsId = currentPageItems.map((item) => item.id);
|
|
102
|
+
if (!gridRef.current) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const api = gridRef.current.api;
|
|
106
|
+
currentPageItems.forEach((item) => {
|
|
107
|
+
api.getRowNode(item.id)?.setSelected(false);
|
|
108
|
+
});
|
|
109
|
+
setIsChecked(false);
|
|
110
|
+
setSelectedEmployee((prev) => prev.filter((id) => !currentPageItemsId.includes(id)));
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
(0, react_1.useEffect)(() => {
|
|
114
|
+
const isCurrentPageDataChecked = currentPageItems.length > 0 &&
|
|
115
|
+
currentPageItems.every((item) => selectedEmployee.includes(item.id));
|
|
116
|
+
setIsChecked(isCurrentPageDataChecked);
|
|
117
|
+
const handler = (event) => {
|
|
118
|
+
if (event.code !== "Space") {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const target = event.target;
|
|
122
|
+
if (target.classList.contains("ag-floating-filter")) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
commonCheckBoxMethod();
|
|
127
|
+
};
|
|
128
|
+
const header = document.querySelector(".ag-header");
|
|
129
|
+
header?.addEventListener("keydown", handler);
|
|
130
|
+
return () => {
|
|
131
|
+
header?.removeEventListener("keydown", handler);
|
|
132
|
+
};
|
|
133
|
+
}, [currentPageItems, selectedEmployee]);
|
|
134
|
+
const currentPageSelectedItems = currentPageItems.filter((item) => selectedEmployee.includes(item.id)).length;
|
|
135
|
+
const isIndeterminate = (currentPageSelectedItems &&
|
|
136
|
+
currentPageSelectedItems < currentPageItems.length) ||
|
|
137
|
+
false;
|
|
138
|
+
return {
|
|
139
|
+
isChecked,
|
|
140
|
+
handleSelectAll,
|
|
141
|
+
indeterminate: isIndeterminate,
|
|
142
|
+
setIsChecked,
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
exports.useAgGridCheckBoxSelection = useAgGridCheckBoxSelection;
|
|
@@ -3,12 +3,12 @@ export * from "./date";
|
|
|
3
3
|
export * from "./download";
|
|
4
4
|
export * from "./downloadPrintHtml";
|
|
5
5
|
export * from "./file";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./hooks/useGetDeviceType";
|
|
8
|
-
export * from "./hooks/useGlobalKeyboardShortcut";
|
|
6
|
+
export * from "./helper";
|
|
9
7
|
export * from "./regex";
|
|
10
8
|
export * from "./theme/colorPaletteUI";
|
|
11
9
|
export * from "./theme/theme";
|
|
12
10
|
export * from "./types";
|
|
13
11
|
export * from "./urlToNestedObject";
|
|
12
|
+
export * from "./hooks";
|
|
13
|
+
export * from "./CheckboxInput";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
|
|
@@ -19,11 +19,11 @@ __exportStar(require("./date"), exports);
|
|
|
19
19
|
__exportStar(require("./download"), exports);
|
|
20
20
|
__exportStar(require("./downloadPrintHtml"), exports);
|
|
21
21
|
__exportStar(require("./file"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./hooks/useGetDeviceType"), exports);
|
|
24
|
-
__exportStar(require("./hooks/useGlobalKeyboardShortcut"), exports);
|
|
22
|
+
__exportStar(require("./helper"), exports);
|
|
25
23
|
__exportStar(require("./regex"), exports);
|
|
26
24
|
__exportStar(require("./theme/colorPaletteUI"), exports);
|
|
27
25
|
__exportStar(require("./theme/theme"), exports);
|
|
28
26
|
__exportStar(require("./types"), exports);
|
|
29
27
|
__exportStar(require("./urlToNestedObject"), exports);
|
|
28
|
+
__exportStar(require("./hooks"), exports);
|
|
29
|
+
__exportStar(require("./CheckboxInput"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/utils/regex.ts"],"names":[],"mappings":"
|
|
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,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noSpecialCharacterRegex = exports.isoDateRegex = exports.monthYearRegex = void 0;
|
|
3
|
+
exports.emailRegex = exports.noSpecialCharacterRegex = exports.isoDateRegex = exports.monthYearRegex = void 0;
|
|
4
|
+
/* eslint-disable sonarjs/single-character-alternation */
|
|
5
|
+
/* eslint-disable sonarjs/concise-regex */
|
|
6
|
+
/* eslint-disable sonarjs/sonar-no-control-regex */
|
|
7
|
+
/* eslint-disable sonarjs/regex-complexity */
|
|
8
|
+
/* eslint-disable sonarjs/slow-regex */
|
|
9
|
+
/* eslint-disable no-control-regex */
|
|
4
10
|
exports.monthYearRegex = /^\d{4}-\d{2}$/;
|
|
5
11
|
exports.isoDateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
6
12
|
exports.noSpecialCharacterRegex = /^[a-zA-Z0-9 ]*$/;
|
|
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}))\]))$/;
|