impact-ui 4.0.1-alpha.21 → 4.0.1-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index15.js +2 -2
- package/dist/_virtual/index16.js +2 -2
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.d.ts.map +1 -0
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +1 -1
- package/dist/components/TableOld/index.js +1 -1
- package/dist/components/TableV36/AdvanceSearchModalItem.d.ts +27 -0
- package/dist/components/TableV36/AdvanceSearchModalItem.d.ts.map +1 -0
- package/dist/components/TableV36/AdvanceSortModal.d.ts +8 -0
- package/dist/components/TableV36/AdvanceSortModal.d.ts.map +1 -0
- package/dist/components/TableV36/AdvanceSortModal.js +297 -0
- package/dist/components/TableV36/AgGridHeader.d.ts +16 -0
- package/dist/components/TableV36/AgGridHeader.d.ts.map +1 -0
- package/dist/components/TableV36/AgGridHeader.js +799 -0
- package/dist/components/TableV36/CommentsPortal.d.ts +31 -0
- package/dist/components/TableV36/CommentsPortal.d.ts.map +1 -0
- package/dist/components/TableV36/CommentsPortal.js +362 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts +13 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts.map +1 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.js +282 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts +16 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts.map +1 -0
- package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +302 -0
- package/dist/components/TableV36/NoComments.d.ts +16 -0
- package/dist/components/TableV36/NoComments.d.ts.map +1 -0
- package/dist/components/TableV36/NoComments.js +237 -0
- package/dist/components/TableV36/Table.types.d.ts +89 -0
- package/dist/components/TableV36/Table.types.d.ts.map +1 -0
- package/dist/components/TableV36/actionBar.d.ts +7 -0
- package/dist/components/TableV36/actionBar.d.ts.map +1 -0
- package/dist/components/TableV36/actionBar.js +31 -0
- package/dist/components/TableV36/advanceSearchModal.d.ts +20 -0
- package/dist/components/TableV36/advanceSearchModal.d.ts.map +1 -0
- package/dist/components/TableV36/filterUtils.d.ts +133 -0
- package/dist/components/TableV36/filterUtils.d.ts.map +1 -0
- package/dist/components/TableV36/filterUtils.js +478 -0
- package/dist/components/TableV36/index.d.ts +3 -0
- package/dist/components/TableV36/index.d.ts.map +1 -0
- package/dist/components/TableV36/index.js +1603 -0
- package/dist/components/TableV36/mockData.d.ts +39 -0
- package/dist/components/TableV36/mockData.d.ts.map +1 -0
- package/dist/components/TableV36/tableFunctions.d.ts +63 -0
- package/dist/components/TableV36/tableFunctions.d.ts.map +1 -0
- package/dist/components/TableV36/tableFunctions.js +1796 -0
- package/dist/components/TableV36/tableHeader.d.ts +80 -0
- package/dist/components/TableV36/tableHeader.d.ts.map +1 -0
- package/dist/components/TableV36/tableHeader.js +396 -0
- package/dist/components/TableV36/tableIcons.d.ts +3 -0
- package/dist/components/TableV36/tableIcons.d.ts.map +1 -0
- package/dist/components/TableV36/tableMoreOptions.d.ts +52 -0
- package/dist/components/TableV36/tableMoreOptions.d.ts.map +1 -0
- package/dist/components/TableV36/tableMoreOptions.js +324 -0
- package/dist/components/TableV36/tablePagination.d.ts +7 -0
- package/dist/components/TableV36/tablePagination.d.ts.map +1 -0
- package/dist/components/TableV36/tablePagination.js +67 -0
- package/dist/components/TableV36/tableSettings.d.ts +41 -0
- package/dist/components/TableV36/tableSettings.d.ts.map +1 -0
- package/dist/components/TableV36/tableSettings.js +317 -0
- package/dist/components/TableV36/withCommentIcon.d.ts +7 -0
- package/dist/components/TableV36/withCommentIcon.d.ts.map +1 -0
- package/dist/components/TableV36/withCommentIcon.js +108 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/mcp-component-registry.json +1 -1
- package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/is-symbol/index.js +1 -1
- package/package.json +5 -5
- package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType /ChatEditedMessageType.d.ts.map +0 -1
- /package/dist/components/TableChat/components/TableChatRightSection/{ChatEditedMessageType → ChatEditedMessageType}/ChatEditedMessageType.d.ts +0 -0
- /package/dist/components/TableChat/components/TableChatRightSection/{ChatEditedMessageType → ChatEditedMessageType}/ChatEditedMessageType.js +0 -0
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { memo, useRef, useState, useCallback, useEffect, Fragment } from "react";
|
|
3
|
+
import default_1$1 from "../../node_modules/@mui/icons-material/Close.js";
|
|
4
|
+
import default_1$2 from "../../node_modules/@mui/icons-material/Search.js";
|
|
5
|
+
import default_1 from "../../node_modules/@mui/icons-material/Tune.js";
|
|
6
|
+
import moment from "moment";
|
|
7
|
+
import { getAssetUrl } from "../../utils/assetBase.js";
|
|
8
|
+
import { debounce } from "../../utils/debounce.js";
|
|
9
|
+
import { DatePicker } from "../DatePicker/index.js";
|
|
10
|
+
import { DateRangePicker } from "../DateRangePicker/index.js";
|
|
11
|
+
import { Input } from "../Input/index.js";
|
|
12
|
+
import { Select } from "../Select/index.js";
|
|
13
|
+
import { syncFiltersWithModal, parseInlineSearchValue, buildFilterModelEntry } from "./filterUtils.js";
|
|
14
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
15
|
+
import Badge from "../../node_modules/@mui/material/Badge/Badge.js";
|
|
16
|
+
const TableSortIcon = getAssetUrl("icons/tableSortIcon.svg");
|
|
17
|
+
const TableSortAscIcon = getAssetUrl("icons/Up.svg");
|
|
18
|
+
const TableSortDescIcon = getAssetUrl("icons/Down.svg");
|
|
19
|
+
function AgGridHeader({
|
|
20
|
+
children,
|
|
21
|
+
sortModel,
|
|
22
|
+
handleInlineSearch,
|
|
23
|
+
handleClearSearchInline,
|
|
24
|
+
handleCloseInputField,
|
|
25
|
+
debounceTime,
|
|
26
|
+
initialFilters,
|
|
27
|
+
enableHeaderTextWrap = true,
|
|
28
|
+
...rest
|
|
29
|
+
}) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta;
|
|
31
|
+
if (!rest.column || !rest.api) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const getLabelFromDropdownValue = (value, columnDef) => {
|
|
35
|
+
if (!(columnDef == null ? void 0 : columnDef.isThirdOptionDropdownIsBoolean) || !(columnDef == null ? void 0 : columnDef.thirdOptionDropdownOptions) || !Array.isArray(columnDef.thirdOptionDropdownOptions)) {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
const option = columnDef.thirdOptionDropdownOptions.find((opt) => {
|
|
39
|
+
const optValue = typeof opt === "object" ? opt.value : opt;
|
|
40
|
+
const filterValue = String(value || "").toLowerCase();
|
|
41
|
+
const optValueStr = String(optValue || "").toLowerCase();
|
|
42
|
+
return optValueStr === filterValue || optValueStr === filterValue.replace(/\s+/g, "");
|
|
43
|
+
});
|
|
44
|
+
if (option) {
|
|
45
|
+
return typeof option === "object" ? option.label : option;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
const getOptionFromDropdownValue = (value, columnDef) => {
|
|
50
|
+
if (!(columnDef == null ? void 0 : columnDef.thirdOptionDropdownOptions) || !Array.isArray(columnDef.thirdOptionDropdownOptions) || !value) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
const valueStr = String(value || "").toLowerCase().trim();
|
|
54
|
+
if (!valueStr) {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
const option = columnDef.thirdOptionDropdownOptions.find((opt) => {
|
|
58
|
+
const optValue = typeof opt === "object" ? opt.value : opt;
|
|
59
|
+
const optValueStr = String(optValue || "").toLowerCase().trim();
|
|
60
|
+
return optValueStr === valueStr;
|
|
61
|
+
});
|
|
62
|
+
if (option) {
|
|
63
|
+
return typeof option === "object" ? option : { label: option, value: option };
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
};
|
|
67
|
+
const menuRef = useRef();
|
|
68
|
+
const inputRef = useRef();
|
|
69
|
+
useRef();
|
|
70
|
+
const originalColumnWidthRef = useRef(null);
|
|
71
|
+
const [showInputField, setShowInputField] = useState(false);
|
|
72
|
+
const [isTextTruncated, setIsTextTruncated] = useState(false);
|
|
73
|
+
const [searchText, setSearchText] = useState("");
|
|
74
|
+
const [menuVisible, setMenuvisible] = useState(false);
|
|
75
|
+
const [currentSort, setCurrentSort] = useState(((_b = (_a = rest.column) == null ? void 0 : _a.getSort) == null ? void 0 : _b.call(_a)) ?? null);
|
|
76
|
+
const [hasActiveSearch, setHasActiveSearch] = useState(false);
|
|
77
|
+
const [selectedDate, setSelectedDate] = useState(null);
|
|
78
|
+
const [showDatePicker, setShowDatePicker] = useState(false);
|
|
79
|
+
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
80
|
+
const originalSuppressHeaderKeyboardEventRef = useRef(
|
|
81
|
+
(_d = (_c = rest.column) == null ? void 0 : _c.colDef) == null ? void 0 : _d.suppressHeaderKeyboardEvent
|
|
82
|
+
);
|
|
83
|
+
const [isOverflowText, setIsOverflowText] = useState(false);
|
|
84
|
+
const headerTextRef = useRef(null);
|
|
85
|
+
const containerRef = useRef(null);
|
|
86
|
+
const [containerHeight, setContainerHeight] = useState(0);
|
|
87
|
+
const onFilterChanged = useCallback(() => {
|
|
88
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
|
|
89
|
+
const newFilterModel = (_a2 = rest.api) == null ? void 0 : _a2.getFilterModel();
|
|
90
|
+
const columnId = ((_b2 = rest.column) == null ? void 0 : _b2.field) || ((_c2 = rest.column) == null ? void 0 : _c2.colId);
|
|
91
|
+
const columnFilter = newFilterModel == null ? void 0 : newFilterModel[columnId];
|
|
92
|
+
let filterValue = "";
|
|
93
|
+
if (columnFilter) {
|
|
94
|
+
if (((_e2 = (_d2 = rest.column) == null ? void 0 : _d2.colDef) == null ? void 0 : _e2.filter) === "agDateColumnFilter") {
|
|
95
|
+
const dateFrom = columnFilter == null ? void 0 : columnFilter.dateFrom;
|
|
96
|
+
const dateTo = columnFilter == null ? void 0 : columnFilter.dateTo;
|
|
97
|
+
if (dateFrom && dateTo) {
|
|
98
|
+
setStartDate(moment(dateFrom));
|
|
99
|
+
setEndDate(moment(dateTo));
|
|
100
|
+
const dateFromStr = dateFrom instanceof Date ? moment(dateFrom).format("YYYY-MM-DD") : typeof dateFrom === "string" ? dateFrom.split(" ")[0] : dateFrom;
|
|
101
|
+
const dateToStr = dateTo instanceof Date ? moment(dateTo).format("YYYY-MM-DD") : typeof dateTo === "string" ? dateTo.split(" ")[0] : dateTo;
|
|
102
|
+
filterValue = `${dateFromStr} - ${dateToStr}`;
|
|
103
|
+
} else if (dateFrom) {
|
|
104
|
+
filterValue = moment(dateFrom);
|
|
105
|
+
setSelectedDate(filterValue);
|
|
106
|
+
if (dateFrom instanceof Date) {
|
|
107
|
+
filterValue = moment(dateFrom).format("YYYY-MM-DD");
|
|
108
|
+
} else if (typeof dateFrom === "string") {
|
|
109
|
+
filterValue = dateFrom.split(" ")[0];
|
|
110
|
+
} else {
|
|
111
|
+
filterValue = dateFrom;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
filterValue = isMultiSelect && (columnFilter == null ? void 0 : columnFilter.conditions) ? (_f2 = columnFilter == null ? void 0 : columnFilter.conditions) == null ? void 0 : _f2.map((condition) => condition.filter) : columnFilter == null ? void 0 : columnFilter.filter;
|
|
116
|
+
if (((_h2 = (_g2 = rest.column) == null ? void 0 : _g2.colDef) == null ? void 0 : _h2.thirdOptionAsDropdown) && filterValue) {
|
|
117
|
+
const initialDropdownOption = (_j2 = (_i2 = rest.column) == null ? void 0 : _i2.colDef) == null ? void 0 : _j2.thirdOptionDropdownOptions;
|
|
118
|
+
let option = null;
|
|
119
|
+
if (isMultiSelect) {
|
|
120
|
+
option = initialDropdownOption == null ? void 0 : initialDropdownOption.filter((option2) => filterValue.includes(option2.value));
|
|
121
|
+
} else {
|
|
122
|
+
option = initialDropdownOption == null ? void 0 : initialDropdownOption.find((option2) => option2.value === filterValue);
|
|
123
|
+
}
|
|
124
|
+
if (option) {
|
|
125
|
+
setSelectedDropdownOption(
|
|
126
|
+
typeof option === "object" ? option : { label: option, value: option }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
const displayValue = getLabelFromDropdownValue(filterValue, (_k2 = rest.column) == null ? void 0 : _k2.colDef);
|
|
131
|
+
setSearchText(displayValue);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!filterValue) {
|
|
136
|
+
setSearchText("");
|
|
137
|
+
setSelectedDropdownOption(isMultiSelect ? [] : null);
|
|
138
|
+
setSelectedDate(null);
|
|
139
|
+
setStartDate(null);
|
|
140
|
+
setEndDate(null);
|
|
141
|
+
setHasActiveSearch(false);
|
|
142
|
+
} else {
|
|
143
|
+
if (!((_m2 = (_l2 = rest.column) == null ? void 0 : _l2.colDef) == null ? void 0 : _m2.thirdOptionAsDropdown)) {
|
|
144
|
+
const displayValue = getLabelFromDropdownValue(filterValue, (_n2 = rest.column) == null ? void 0 : _n2.colDef);
|
|
145
|
+
setSearchText(displayValue);
|
|
146
|
+
}
|
|
147
|
+
setHasActiveSearch(true);
|
|
148
|
+
}
|
|
149
|
+
}, [rest.api]);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
var _a2, _b2, _c2, _d2;
|
|
152
|
+
if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.thirdOptionAsDropdown) {
|
|
153
|
+
const options = ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.thirdOptionDropdownOptions) || [];
|
|
154
|
+
setCurrentDropdownOptions(options);
|
|
155
|
+
}
|
|
156
|
+
}, [(_f = (_e = rest.column) == null ? void 0 : _e.colDef) == null ? void 0 : _f.thirdOptionAsDropdown, (_h = (_g = rest.column) == null ? void 0 : _g.colDef) == null ? void 0 : _h.thirdOptionDropdownOptions]);
|
|
157
|
+
const [startDate, setStartDate] = useState(null);
|
|
158
|
+
const [endDate, setEndDate] = useState(null);
|
|
159
|
+
const isMultiSelect = (_j = (_i = rest.column) == null ? void 0 : _i.colDef) == null ? void 0 : _j.enableMultiSelect;
|
|
160
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
161
|
+
const [selectedDropdownOption, setSelectedDropdownOption] = useState(isMultiSelect ? [] : null);
|
|
162
|
+
const [currentDropdownOptions, setCurrentDropdownOptions] = useState([]);
|
|
163
|
+
const [isSelectAll, setIsSelectAll] = useState(false);
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
166
|
+
const columnId = ((_a2 = rest.column) == null ? void 0 : _a2.field) || ((_b2 = rest.column) == null ? void 0 : _b2.colId);
|
|
167
|
+
const currentFilterModel = ((_d2 = (_c2 = rest.api) == null ? void 0 : _c2.getFilterModel) == null ? void 0 : _d2.call(_c2)) || {};
|
|
168
|
+
const existingFilter = currentFilterModel[columnId] ?? currentFilterModel[(_e2 = rest.column) == null ? void 0 : _e2.colId];
|
|
169
|
+
if (existingFilter) {
|
|
170
|
+
onFilterChanged();
|
|
171
|
+
if ((_g2 = (_f2 = rest.column) == null ? void 0 : _f2.colDef) == null ? void 0 : _g2.isSearchable) {
|
|
172
|
+
if (((_i2 = (_h2 = rest.column) == null ? void 0 : _h2.colDef) == null ? void 0 : _i2.filter) === "agDateColumnFilter") {
|
|
173
|
+
setShowDatePicker(true);
|
|
174
|
+
} else {
|
|
175
|
+
setShowInputField(true);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
rest.api.addEventListener("filterChanged", onFilterChanged);
|
|
180
|
+
return () => {
|
|
181
|
+
rest.api.removeEventListener("filterChanged", onFilterChanged);
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
const prevSearchValueRef = useRef(void 0);
|
|
185
|
+
const handleSearchChange = (value) => {
|
|
186
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
187
|
+
const isEmptyValue = (val) => val === null || val === void 0 || val === "" || Array.isArray(val) && val.length === 0;
|
|
188
|
+
const normalizedValue = isEmptyValue(value) ? null : value;
|
|
189
|
+
const normalizedPrev = isEmptyValue(prevSearchValueRef.current) ? null : prevSearchValueRef.current;
|
|
190
|
+
const currentValue = typeof normalizedValue === "object" && normalizedValue !== null ? JSON.stringify(normalizedValue) : normalizedValue;
|
|
191
|
+
const prevValue = typeof normalizedPrev === "object" && normalizedPrev !== null ? JSON.stringify(normalizedPrev) : normalizedPrev;
|
|
192
|
+
if (currentValue === prevValue) {
|
|
193
|
+
const colId = (_a2 = rest.column) == null ? void 0 : _a2.colId;
|
|
194
|
+
const hasExistingFilter = Boolean(colId && ((_d2 = (_c2 = (_b2 = rest.api) == null ? void 0 : _b2.getFilterModel) == null ? void 0 : _c2.call(_b2)) == null ? void 0 : _d2[colId]));
|
|
195
|
+
if (!(normalizedValue === null && hasExistingFilter)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
prevSearchValueRef.current = value;
|
|
200
|
+
if (handleInlineSearch) {
|
|
201
|
+
handleInlineSearch == null ? void 0 : handleInlineSearch(value);
|
|
202
|
+
(_e2 = rest.onFilterChanged) == null ? void 0 : _e2.call(rest, rest);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
var _a3, _b3, _c3, _d3;
|
|
207
|
+
try {
|
|
208
|
+
const { inputValue, filterType } = parseSearchValue(value);
|
|
209
|
+
applyFilterToGrid(inputValue, filterType);
|
|
210
|
+
syncFiltersWithModal(
|
|
211
|
+
rest.api,
|
|
212
|
+
rest.column.colId,
|
|
213
|
+
inputValue,
|
|
214
|
+
(_a3 = rest.column) == null ? void 0 : _a3.colDef,
|
|
215
|
+
rest.colDefs,
|
|
216
|
+
rest.setValue,
|
|
217
|
+
rest.setInitialFilters,
|
|
218
|
+
getOptionFromDropdownValue
|
|
219
|
+
);
|
|
220
|
+
(_c3 = (_b3 = rest.api) == null ? void 0 : _b3.onFilterChanged) == null ? void 0 : _c3.call(_b3);
|
|
221
|
+
(_d3 = rest.onFilterChanged) == null ? void 0 : _d3.call(rest, rest);
|
|
222
|
+
} catch (error) {
|
|
223
|
+
console.warn("Error during filter operation:", error);
|
|
224
|
+
}
|
|
225
|
+
}, 0);
|
|
226
|
+
};
|
|
227
|
+
const parseSearchValue = (value) => {
|
|
228
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
229
|
+
if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.thirdOptionAsDropdown) {
|
|
230
|
+
const isBoolean = ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.dataType) === "boolean";
|
|
231
|
+
if (Array.isArray(value)) {
|
|
232
|
+
const extractedValues = value.map((opt) => opt);
|
|
233
|
+
return {
|
|
234
|
+
inputValue: extractedValues,
|
|
235
|
+
filterType: isBoolean ? "equals" : "contains"
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
const extractedValue = typeof value === "object" && value !== null ? value.value : value;
|
|
239
|
+
return {
|
|
240
|
+
inputValue: extractedValue,
|
|
241
|
+
filterType: isBoolean ? "equals" : "contains"
|
|
242
|
+
};
|
|
243
|
+
} else {
|
|
244
|
+
const parsed = parseInlineSearchValue(
|
|
245
|
+
value,
|
|
246
|
+
(_e2 = rest.column) == null ? void 0 : _e2.colDef,
|
|
247
|
+
rest.api,
|
|
248
|
+
rest.column.colId
|
|
249
|
+
);
|
|
250
|
+
return {
|
|
251
|
+
inputValue: parsed.parsedValue,
|
|
252
|
+
filterType: parsed.filterType
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const updateEmptyStateOverlay = () => {
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
if (rest.api) {
|
|
259
|
+
const displayedRowCount = rest.api.getDisplayedRowCount();
|
|
260
|
+
if (displayedRowCount === 0) {
|
|
261
|
+
rest.api.showNoRowsOverlay();
|
|
262
|
+
} else {
|
|
263
|
+
rest.api.hideOverlay();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, 0);
|
|
267
|
+
};
|
|
268
|
+
const applyFilterToGrid = (inputValue, filterType) => {
|
|
269
|
+
var _a2;
|
|
270
|
+
const currentFilterModel = rest.sortModel || rest.api.getFilterModel();
|
|
271
|
+
const filterEntry = buildFilterModelEntry(inputValue, filterType, (_a2 = rest.column) == null ? void 0 : _a2.colDef);
|
|
272
|
+
if (filterEntry === void 0) {
|
|
273
|
+
delete currentFilterModel[rest.column.colId];
|
|
274
|
+
} else {
|
|
275
|
+
currentFilterModel[rest.column.colId] = filterEntry;
|
|
276
|
+
}
|
|
277
|
+
rest.api.setFilterModel(currentFilterModel);
|
|
278
|
+
updateEmptyStateOverlay();
|
|
279
|
+
};
|
|
280
|
+
const debouncedHandleSearchChange = useCallback(
|
|
281
|
+
debounce((value) => {
|
|
282
|
+
handleSearchChange(value);
|
|
283
|
+
}, debounceTime),
|
|
284
|
+
[]
|
|
285
|
+
);
|
|
286
|
+
const handleSearch = (e) => {
|
|
287
|
+
var _a2, _b2;
|
|
288
|
+
e.stopPropagation();
|
|
289
|
+
if (((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.filter) === "agDateColumnFilter") {
|
|
290
|
+
setShowDatePicker((prev) => !prev);
|
|
291
|
+
} else {
|
|
292
|
+
setShowInputField((prev) => !prev);
|
|
293
|
+
}
|
|
294
|
+
expandColumnIfNeeded();
|
|
295
|
+
};
|
|
296
|
+
const onCloseIconClick = (colId) => {
|
|
297
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
298
|
+
setSearchText("");
|
|
299
|
+
setSelectedDropdownOption(isMultiSelect ? [] : null);
|
|
300
|
+
setSelectedDate(null);
|
|
301
|
+
setStartDate(null);
|
|
302
|
+
setEndDate(null);
|
|
303
|
+
setHasActiveSearch(false);
|
|
304
|
+
prevSearchValueRef.current = void 0;
|
|
305
|
+
(_a2 = rest.api) == null ? void 0 : _a2.destroyFilter(colId);
|
|
306
|
+
const currentFilterModel = { ...((_b2 = rest.api) == null ? void 0 : _b2.getFilterModel()) || {} };
|
|
307
|
+
delete currentFilterModel[colId];
|
|
308
|
+
(_c2 = rest.api) == null ? void 0 : _c2.setFilterModel(currentFilterModel);
|
|
309
|
+
const currentFilters = ((_e2 = (_d2 = rest.getValues) == null ? void 0 : _d2.call(rest)) == null ? void 0 : _e2.filters) || [];
|
|
310
|
+
const updatedFilters = currentFilters.filter((f) => {
|
|
311
|
+
var _a3;
|
|
312
|
+
return ((_a3 = f == null ? void 0 : f.column) == null ? void 0 : _a3.value) !== colId;
|
|
313
|
+
});
|
|
314
|
+
(_f2 = rest.setValue) == null ? void 0 : _f2.call(rest, "filters", updatedFilters);
|
|
315
|
+
(_g2 = rest.setInitialFilters) == null ? void 0 : _g2.call(rest, updatedFilters);
|
|
316
|
+
(_i2 = (_h2 = rest.api) == null ? void 0 : _h2.onFilterChanged) == null ? void 0 : _i2.call(_h2);
|
|
317
|
+
if (rest.onFilterChanged) {
|
|
318
|
+
rest.onFilterChanged(rest);
|
|
319
|
+
}
|
|
320
|
+
updateEmptyStateOverlay();
|
|
321
|
+
};
|
|
322
|
+
const MIN_SEARCH_WIDTH = 200;
|
|
323
|
+
const expandColumnIfNeeded = () => {
|
|
324
|
+
var _a2;
|
|
325
|
+
const currentWidth = (_a2 = rest.column) == null ? void 0 : _a2.actualWidth;
|
|
326
|
+
if (currentWidth && currentWidth < MIN_SEARCH_WIDTH) {
|
|
327
|
+
originalColumnWidthRef.current = currentWidth;
|
|
328
|
+
rest.api.setColumnWidths([{ key: rest.column.colId, newWidth: MIN_SEARCH_WIDTH }]);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
const restoreColumnWidth = () => {
|
|
332
|
+
if (originalColumnWidthRef.current !== null) {
|
|
333
|
+
rest.api.setColumnWidths([
|
|
334
|
+
{ key: rest.column.colId, newWidth: originalColumnWidthRef.current }
|
|
335
|
+
]);
|
|
336
|
+
originalColumnWidthRef.current = null;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (!menuVisible) return void 0;
|
|
341
|
+
const handleClickOutside = () => {
|
|
342
|
+
setMenuvisible(false);
|
|
343
|
+
};
|
|
344
|
+
document.addEventListener("click", handleClickOutside);
|
|
345
|
+
return () => {
|
|
346
|
+
document.removeEventListener("click", handleClickOutside);
|
|
347
|
+
};
|
|
348
|
+
}, [menuVisible]);
|
|
349
|
+
const onHeaderClick = () => {
|
|
350
|
+
var _a2, _b2;
|
|
351
|
+
if (rest.applySort) {
|
|
352
|
+
rest.applySort(rest.column.colId);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.sortable) {
|
|
356
|
+
const currentSortModel = rest.api.getColumnState();
|
|
357
|
+
const currentSort2 = currentSortModel.find((model) => model.colId === rest.column.colId);
|
|
358
|
+
const newSort = (currentSort2 == null ? void 0 : currentSort2.sort) === null ? "asc" : (currentSort2 == null ? void 0 : currentSort2.sort) === "asc" ? "desc" : null;
|
|
359
|
+
rest.api.applyColumnState({
|
|
360
|
+
state: [{ colId: rest.column.colId, sort: newSort }],
|
|
361
|
+
defaultState: { sort: null }
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
var _a2;
|
|
367
|
+
const onSortChanged = () => {
|
|
368
|
+
var _a3, _b2;
|
|
369
|
+
setCurrentSort(((_b2 = (_a3 = rest.column) == null ? void 0 : _a3.getSort) == null ? void 0 : _b2.call(_a3)) ?? null);
|
|
370
|
+
};
|
|
371
|
+
(_a2 = rest.api) == null ? void 0 : _a2.addEventListener("sortChanged", onSortChanged);
|
|
372
|
+
return () => {
|
|
373
|
+
var _a3;
|
|
374
|
+
return (_a3 = rest.api) == null ? void 0 : _a3.removeEventListener("sortChanged", onSortChanged);
|
|
375
|
+
};
|
|
376
|
+
}, [rest.api, rest.column]);
|
|
377
|
+
const onColumnMoved = useCallback(
|
|
378
|
+
(params) => {
|
|
379
|
+
var _a2, _b2;
|
|
380
|
+
if (((_a2 = params == null ? void 0 : params.column) == null ? void 0 : _a2.colId) && (showInputField || showDatePicker)) {
|
|
381
|
+
(_b2 = rest.api) == null ? void 0 : _b2.applyColumnState({
|
|
382
|
+
state: [
|
|
383
|
+
{
|
|
384
|
+
colId: params.column.colId,
|
|
385
|
+
width: params.column.actualWidth
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
defaultState: { width: null }
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
[rest.api, showInputField, showDatePicker]
|
|
393
|
+
);
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
const api = rest.api;
|
|
396
|
+
if (!api) return void 0;
|
|
397
|
+
api.addEventListener("columnResized", onColumnMoved);
|
|
398
|
+
return () => {
|
|
399
|
+
api.removeEventListener("columnResized", onColumnMoved);
|
|
400
|
+
};
|
|
401
|
+
}, [rest.api, onColumnMoved]);
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
var _a2;
|
|
404
|
+
const colDef = (_a2 = rest.column) == null ? void 0 : _a2.colDef;
|
|
405
|
+
if (!colDef) return;
|
|
406
|
+
if (isInputFocused) {
|
|
407
|
+
if (originalSuppressHeaderKeyboardEventRef.current === void 0) {
|
|
408
|
+
originalSuppressHeaderKeyboardEventRef.current = colDef.suppressHeaderKeyboardEvent;
|
|
409
|
+
}
|
|
410
|
+
colDef.suppressHeaderKeyboardEvent = () => true;
|
|
411
|
+
} else {
|
|
412
|
+
colDef.suppressHeaderKeyboardEvent = originalSuppressHeaderKeyboardEventRef.current;
|
|
413
|
+
}
|
|
414
|
+
return () => {
|
|
415
|
+
if (colDef) {
|
|
416
|
+
colDef.suppressHeaderKeyboardEvent = originalSuppressHeaderKeyboardEventRef.current;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
}, [isInputFocused, (_k = rest.column) == null ? void 0 : _k.colId]);
|
|
420
|
+
useEffect(() => {
|
|
421
|
+
if (containerRef.current) {
|
|
422
|
+
setContainerHeight(containerRef.current.clientHeight);
|
|
423
|
+
}
|
|
424
|
+
}, []);
|
|
425
|
+
return /* @__PURE__ */ jsx(
|
|
426
|
+
"div",
|
|
427
|
+
{
|
|
428
|
+
ref: containerRef,
|
|
429
|
+
className: `custom-ag-header-container ${((_m = (_l = rest.column) == null ? void 0 : _l.colDef) == null ? void 0 : _m.checkboxSelection) ? "checkbox-selection" : ""} ${((_o = (_n = rest.column) == null ? void 0 : _n.colDef) == null ? void 0 : _o.customHeaderIcons) || !(((_q = (_p = rest.column) == null ? void 0 : _p.colDef) == null ? void 0 : _q.suppressHeaderMenuButton) ?? ((_s = (_r = rest.column) == null ? void 0 : _r.colDef) == null ? void 0 : _s.suppressMenu)) || ((_u = (_t = rest.column) == null ? void 0 : _t.colDef) == null ? void 0 : _u.isSearchable) ? "with-icons" : ""}`,
|
|
430
|
+
onClick: () => rest.onClick(),
|
|
431
|
+
children: showDatePicker ? /* @__PURE__ */ jsxs("div", { className: `ia-search-input-field ia-search-input-narrow`, children: [
|
|
432
|
+
((_w = (_v = rest.column) == null ? void 0 : _v.colDef) == null ? void 0 : _w.thirdOptionAsDateRangePicker) ? /* @__PURE__ */ jsx(
|
|
433
|
+
DateRangePicker,
|
|
434
|
+
{
|
|
435
|
+
fullWidth: true,
|
|
436
|
+
withPortal: true,
|
|
437
|
+
customIcon: ((_y = (_x = rest.column) == null ? void 0 : _x.colDef) == null ? void 0 : _y.advanceSearchEnabled) && /* @__PURE__ */ jsx(
|
|
438
|
+
default_1,
|
|
439
|
+
{
|
|
440
|
+
className: "ia-search-input-field-custom-icon",
|
|
441
|
+
onClick: (e) => {
|
|
442
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
443
|
+
e.stopPropagation();
|
|
444
|
+
if (rest.onAdvanceSearchClick) {
|
|
445
|
+
rest.onAdvanceSearchClick(rest.column);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
rest.toggleAdvanceSearch(
|
|
449
|
+
((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.toShowDuplicateColumnInAdvanceSearch) ? ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.columnFieldsInAdvanceSearch) ? (_f2 = (_e2 = rest.column) == null ? void 0 : _e2.colDef) == null ? void 0 : _f2.columnFieldsInAdvanceSearch : rest.column.colId : rest.column.colId
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
displayFormat: ((_A = (_z = rest.column) == null ? void 0 : _z.colDef) == null ? void 0 : _A.displayFormat) || "MM-DD-YYYY",
|
|
455
|
+
endDate,
|
|
456
|
+
handleDatesChange: (start, end) => {
|
|
457
|
+
setStartDate(start);
|
|
458
|
+
setEndDate(end);
|
|
459
|
+
},
|
|
460
|
+
maxDate: /* @__PURE__ */ new Date("2100-12-31"),
|
|
461
|
+
minDate: /* @__PURE__ */ new Date("2000-01-01"),
|
|
462
|
+
setEndDate,
|
|
463
|
+
setStartDate,
|
|
464
|
+
startDate,
|
|
465
|
+
onPrimaryButtonClick: () => {
|
|
466
|
+
if (startDate && endDate) {
|
|
467
|
+
handleSearchChange({ startDate, endDate });
|
|
468
|
+
}
|
|
469
|
+
setShowDatePicker(false);
|
|
470
|
+
},
|
|
471
|
+
onResetClick: () => {
|
|
472
|
+
setStartDate(null);
|
|
473
|
+
setEndDate(null);
|
|
474
|
+
handleSearchChange(null);
|
|
475
|
+
setShowDatePicker(false);
|
|
476
|
+
},
|
|
477
|
+
onSecondaryButtonClick: () => {
|
|
478
|
+
setShowDatePicker(false);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
) : /* @__PURE__ */ jsx(
|
|
482
|
+
DatePicker,
|
|
483
|
+
{
|
|
484
|
+
fullWidth: true,
|
|
485
|
+
showMonthYearSelect: true,
|
|
486
|
+
withPortal: true,
|
|
487
|
+
customIcon: ((_C = (_B = rest.column) == null ? void 0 : _B.colDef) == null ? void 0 : _C.advanceSearchEnabled) && /* @__PURE__ */ jsx(
|
|
488
|
+
default_1,
|
|
489
|
+
{
|
|
490
|
+
className: "ia-search-input-field-custom-icon",
|
|
491
|
+
onClick: () => {
|
|
492
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
493
|
+
if (rest.onAdvanceSearchClick) {
|
|
494
|
+
rest.onAdvanceSearchClick(rest.column);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
rest.toggleAdvanceSearch(
|
|
498
|
+
((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.toShowDuplicateColumnInAdvanceSearch) ? ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.columnFieldsInAdvanceSearch) ? (_f2 = (_e2 = rest.column) == null ? void 0 : _e2.colDef) == null ? void 0 : _f2.columnFieldsInAdvanceSearch : rest.column.colId : rest.column.colId
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
displayFormat: ((_E = (_D = rest.column) == null ? void 0 : _D.colDef) == null ? void 0 : _E.displayFormat) || "MM-DD-YYYY",
|
|
504
|
+
maxDate: /* @__PURE__ */ new Date("2100-12-31"),
|
|
505
|
+
minDate: /* @__PURE__ */ new Date("2000-01-01"),
|
|
506
|
+
placeholder: "Select Date",
|
|
507
|
+
selectedDate,
|
|
508
|
+
setSelectedDate,
|
|
509
|
+
onPrimaryButtonClick: () => {
|
|
510
|
+
handleSearchChange(selectedDate);
|
|
511
|
+
setShowDatePicker(false);
|
|
512
|
+
},
|
|
513
|
+
onSecondaryButtonClick: () => {
|
|
514
|
+
setShowDatePicker(false);
|
|
515
|
+
},
|
|
516
|
+
onTertiaryButtonClick: () => {
|
|
517
|
+
setSelectedDate(null);
|
|
518
|
+
handleSearchChange(null);
|
|
519
|
+
setShowDatePicker(false);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ jsx(
|
|
524
|
+
default_1$1,
|
|
525
|
+
{
|
|
526
|
+
className: "ia-search-input-field-close-icon",
|
|
527
|
+
style: { cursor: "pointer" },
|
|
528
|
+
onClick: () => {
|
|
529
|
+
handleCloseInputField == null ? void 0 : handleCloseInputField();
|
|
530
|
+
setShowDatePicker(false);
|
|
531
|
+
restoreColumnWidth();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
] }) : showInputField ? /* @__PURE__ */ jsxs(
|
|
536
|
+
"div",
|
|
537
|
+
{
|
|
538
|
+
className: `ia-search-input-field ia-search-input-narrow
|
|
539
|
+
${((_G = (_F = rest.column) == null ? void 0 : _F.colDef) == null ? void 0 : _G.thirdOptionAsDropdown) ? "with-dropdown" : ""}`,
|
|
540
|
+
children: [
|
|
541
|
+
((_I = (_H = rest.column) == null ? void 0 : _H.colDef) == null ? void 0 : _I.thirdOptionAsDropdown) && !((_K = (_J = rest.column) == null ? void 0 : _J.colDef) == null ? void 0 : _K.toShowDuplicateColumnInAdvanceSearch) ? /* @__PURE__ */ jsxs(
|
|
542
|
+
"div",
|
|
543
|
+
{
|
|
544
|
+
id: "ia-select-option-dropdown-container",
|
|
545
|
+
style: {
|
|
546
|
+
position: "relative",
|
|
547
|
+
// width: (Array.isArray(selectedDropdownOption) ? selectedDropdownOption.length > 0 : !!selectedDropdownOption) ? "66%" : "100%",
|
|
548
|
+
width: "100%",
|
|
549
|
+
minWidth: 0
|
|
550
|
+
},
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ jsx(
|
|
553
|
+
Select,
|
|
554
|
+
{
|
|
555
|
+
currentOptions: currentDropdownOptions,
|
|
556
|
+
dropDownPortalClassName: "ag-select-dropdown-portal",
|
|
557
|
+
initialOptions: (_M = (_L = rest == null ? void 0 : rest.column) == null ? void 0 : _L.colDef) == null ? void 0 : _M.thirdOptionDropdownOptions,
|
|
558
|
+
isClearable: true,
|
|
559
|
+
isMulti: (_O = (_N = rest == null ? void 0 : rest.column) == null ? void 0 : _N.colDef) == null ? void 0 : _O.enableMultiSelect,
|
|
560
|
+
isOpen: isDropdownOpen,
|
|
561
|
+
isSelectAll,
|
|
562
|
+
isWithSearch: (_Q = (_P = rest == null ? void 0 : rest.column) == null ? void 0 : _P.colDef) == null ? void 0 : _Q.enableSearch,
|
|
563
|
+
placeholder: "Select option",
|
|
564
|
+
selectedOptions: selectedDropdownOption,
|
|
565
|
+
setCurrentOptions: setCurrentDropdownOptions,
|
|
566
|
+
setIsOpen: setIsDropdownOpen,
|
|
567
|
+
setIsSelectAll,
|
|
568
|
+
setSelectedOptions: (option) => {
|
|
569
|
+
setSelectedDropdownOption(option);
|
|
570
|
+
if (!isMultiSelect) {
|
|
571
|
+
if (option) {
|
|
572
|
+
const value = typeof option === "object" ? option.value : option;
|
|
573
|
+
setHasActiveSearch(true);
|
|
574
|
+
handleSearchChange(value);
|
|
575
|
+
} else {
|
|
576
|
+
setHasActiveSearch(false);
|
|
577
|
+
handleSearchChange(null);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
toggleSelectAll: (_S = (_R = rest == null ? void 0 : rest.column) == null ? void 0 : _R.colDef) == null ? void 0 : _S.enableMultiSelect,
|
|
582
|
+
onClearAll: () => {
|
|
583
|
+
setSelectedDropdownOption(isMultiSelect ? [] : null);
|
|
584
|
+
setHasActiveSearch(false);
|
|
585
|
+
handleSearchChange(null);
|
|
586
|
+
setIsSelectAll(false);
|
|
587
|
+
},
|
|
588
|
+
onDropdownClose: () => {
|
|
589
|
+
if (isMultiSelect && (selectedDropdownOption == null ? void 0 : selectedDropdownOption.length) > 0) {
|
|
590
|
+
setHasActiveSearch(true);
|
|
591
|
+
handleSearchChange(selectedDropdownOption);
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
withPortal: true,
|
|
595
|
+
minWidth: "100%",
|
|
596
|
+
...(_U = (_T = rest.column) == null ? void 0 : _T.colDef) == null ? void 0 : _U.selectProps
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
((_W = (_V = rest.column) == null ? void 0 : _V.colDef) == null ? void 0 : _W.advanceSearchEnabled) && /* @__PURE__ */ jsx(
|
|
600
|
+
default_1,
|
|
601
|
+
{
|
|
602
|
+
className: "ia-search-input-field-custom-icon",
|
|
603
|
+
id: "toggle-advance-search-icon",
|
|
604
|
+
style: {
|
|
605
|
+
position: "absolute",
|
|
606
|
+
right: (Array.isArray(selectedDropdownOption) ? selectedDropdownOption.length > 0 : !!selectedDropdownOption) ? "44px" : "28px",
|
|
607
|
+
top: "50%",
|
|
608
|
+
transform: "translateY(-50%)",
|
|
609
|
+
cursor: "pointer",
|
|
610
|
+
zIndex: 1,
|
|
611
|
+
pointerEvents: "auto"
|
|
612
|
+
},
|
|
613
|
+
onClick: (e) => {
|
|
614
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
615
|
+
e.stopPropagation();
|
|
616
|
+
if (rest.onAdvanceSearchClick) {
|
|
617
|
+
rest.onAdvanceSearchClick(rest.column);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
rest.toggleAdvanceSearch(
|
|
621
|
+
((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.toShowDuplicateColumnInAdvanceSearch) ? ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.columnFieldsInAdvanceSearch) ? (_f2 = (_e2 = rest.column) == null ? void 0 : _e2.colDef) == null ? void 0 : _f2.columnFieldsInAdvanceSearch : rest.column.colId : rest.column.colId
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
]
|
|
627
|
+
}
|
|
628
|
+
) : /* @__PURE__ */ jsx(
|
|
629
|
+
Input,
|
|
630
|
+
{
|
|
631
|
+
ref: inputRef,
|
|
632
|
+
iconClickOnDisabled: (_Y = (_X = rest.column) == null ? void 0 : _X.colDef) == null ? void 0 : _Y.toShowDuplicateColumnInAdvanceSearch,
|
|
633
|
+
isDisabled: (__ = (_Z = rest.column) == null ? void 0 : _Z.colDef) == null ? void 0 : __.toShowDuplicateColumnInAdvanceSearch,
|
|
634
|
+
placeholder: "Search",
|
|
635
|
+
rightIcon: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
636
|
+
searchText.toString().length > 0 && /* @__PURE__ */ jsx(
|
|
637
|
+
default_1$1,
|
|
638
|
+
{
|
|
639
|
+
onClick: () => {
|
|
640
|
+
if (handleClearSearchInline) {
|
|
641
|
+
handleClearSearchInline(rest);
|
|
642
|
+
}
|
|
643
|
+
onCloseIconClick(rest.column.colId);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
((_aa = (_$ = rest.column) == null ? void 0 : _$.colDef) == null ? void 0 : _aa.advanceSearchEnabled) && /* @__PURE__ */ jsx(
|
|
648
|
+
default_1,
|
|
649
|
+
{
|
|
650
|
+
onClick: () => {
|
|
651
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
652
|
+
if (rest.onAdvanceSearchClick) {
|
|
653
|
+
rest.onAdvanceSearchClick(rest.column);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
rest.toggleAdvanceSearch(
|
|
657
|
+
((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.toShowDuplicateColumnInAdvanceSearch) ? ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.columnFieldsInAdvanceSearch) ? (_f2 = (_e2 = rest.column) == null ? void 0 : _e2.colDef) == null ? void 0 : _f2.columnFieldsInAdvanceSearch : rest.column.colId : rest.column.colId,
|
|
658
|
+
searchText
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
)
|
|
663
|
+
] }),
|
|
664
|
+
value: searchText,
|
|
665
|
+
onChange: (e) => {
|
|
666
|
+
setSearchText(e.target.value);
|
|
667
|
+
setHasActiveSearch(!!e.target.value);
|
|
668
|
+
debouncedHandleSearchChange(e.target.value);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
/* @__PURE__ */ jsx(
|
|
673
|
+
default_1$1,
|
|
674
|
+
{
|
|
675
|
+
className: "ia-search-input-field-close-icon",
|
|
676
|
+
style: { cursor: "pointer" },
|
|
677
|
+
onClick: () => {
|
|
678
|
+
handleCloseInputField == null ? void 0 : handleCloseInputField();
|
|
679
|
+
setShowInputField(false);
|
|
680
|
+
restoreColumnWidth();
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
)
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
) : (
|
|
687
|
+
// Original simple structure when enableHeaderTextWrap is false
|
|
688
|
+
/* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
689
|
+
/* @__PURE__ */ jsxs(
|
|
690
|
+
"div",
|
|
691
|
+
{
|
|
692
|
+
className: `ag-header-cell-text ${((_ca = (_ba = rest.column) == null ? void 0 : _ba.colDef) == null ? void 0 : _ca.sortable) ? "sortable" : ""} ${enableHeaderTextWrap ? "header-wrap-enabled" : ""}`,
|
|
693
|
+
children: [
|
|
694
|
+
((_ea = (_da = rest.column) == null ? void 0 : _da.colDef) == null ? void 0 : _ea.field) === "Selection" || ((_ga = (_fa = rest.column) == null ? void 0 : _fa.colDef) == null ? void 0 : _ga.checkboxSelection) ? children : /* @__PURE__ */ jsx(
|
|
695
|
+
"div",
|
|
696
|
+
{
|
|
697
|
+
ref: headerTextRef,
|
|
698
|
+
className: "header-text-content",
|
|
699
|
+
style: { WebkitLineClamp: containerHeight > 40 ? 4 : 2 },
|
|
700
|
+
onMouseEnter: () => {
|
|
701
|
+
var _a2, _b2, _c2, _d2;
|
|
702
|
+
setIsOverflowText(
|
|
703
|
+
((_a2 = headerTextRef.current) == null ? void 0 : _a2.scrollWidth) > ((_b2 = headerTextRef.current) == null ? void 0 : _b2.clientWidth) || ((_c2 = headerTextRef.current) == null ? void 0 : _c2.scrollHeight) > ((_d2 = headerTextRef.current) == null ? void 0 : _d2.clientHeight) + 1
|
|
704
|
+
);
|
|
705
|
+
},
|
|
706
|
+
children: /* @__PURE__ */ jsx(
|
|
707
|
+
Tooltip,
|
|
708
|
+
{
|
|
709
|
+
orientation: "top",
|
|
710
|
+
title: isOverflowText && children !== "Selection" ? children : "",
|
|
711
|
+
variant: "tertiary",
|
|
712
|
+
children
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
(_ia = (_ha = rest.column) == null ? void 0 : _ha.colDef) == null ? void 0 : _ia.headerIcons,
|
|
718
|
+
((_ka = (_ja = rest.column) == null ? void 0 : _ja.colDef) == null ? void 0 : _ka.sortable) && /* @__PURE__ */ jsx(
|
|
719
|
+
"img",
|
|
720
|
+
{
|
|
721
|
+
alt: "TableSortIcon",
|
|
722
|
+
className: "ia-table-sort-icon",
|
|
723
|
+
src: currentSort === "asc" ? TableSortAscIcon : currentSort === "desc" ? TableSortDescIcon : TableSortIcon,
|
|
724
|
+
onClick: onHeaderClick
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
/* @__PURE__ */ jsxs(
|
|
731
|
+
"div",
|
|
732
|
+
{
|
|
733
|
+
className: `ia-icon-div ${hasActiveSearch ? "has-active-search" : ""} ${menuVisible ? "menu-visible" : ""}`,
|
|
734
|
+
children: [
|
|
735
|
+
(_na = (_ma = (_la = rest.column) == null ? void 0 : _la.colDef) == null ? void 0 : _ma.customHeaderIcons) == null ? void 0 : _na.map((icon) => {
|
|
736
|
+
return icon;
|
|
737
|
+
}),
|
|
738
|
+
((_pa = (_oa = rest.column) == null ? void 0 : _oa.colDef) == null ? void 0 : _pa.isSearchable) && (hasActiveSearch || !showInputField) && /* @__PURE__ */ jsx(Badge, { invisible: !hasActiveSearch, variant: "dot", children: /* @__PURE__ */ jsx(
|
|
739
|
+
default_1$2,
|
|
740
|
+
{
|
|
741
|
+
fontSize: "small",
|
|
742
|
+
style: {
|
|
743
|
+
color: "#60697D",
|
|
744
|
+
cursor: "pointer",
|
|
745
|
+
backgroundColor: hasActiveSearch && "#ECEEFD",
|
|
746
|
+
display: menuVisible && !hasActiveSearch ? "none" : "block"
|
|
747
|
+
},
|
|
748
|
+
onClick: rest.onColumnSearchClick ? () => {
|
|
749
|
+
var _a2, _b2;
|
|
750
|
+
rest.onColumnSearchClick(rest);
|
|
751
|
+
setShowInputField(true);
|
|
752
|
+
if (((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.filter) === "agDateColumnFilter") {
|
|
753
|
+
setShowDatePicker(true);
|
|
754
|
+
}
|
|
755
|
+
expandColumnIfNeeded();
|
|
756
|
+
} : handleSearch
|
|
757
|
+
}
|
|
758
|
+
) }),
|
|
759
|
+
!(((_ra = (_qa = rest.column) == null ? void 0 : _qa.colDef) == null ? void 0 : _ra.suppressHeaderMenuButton) ?? ((_ta = (_sa = rest.column) == null ? void 0 : _sa.colDef) == null ? void 0 : _ta.suppressMenu)) && /* @__PURE__ */ jsx("div", { className: "custom-ag-header-icons", children: /* @__PURE__ */ jsx(
|
|
760
|
+
"button",
|
|
761
|
+
{
|
|
762
|
+
ref: menuRef,
|
|
763
|
+
className: `custom-ag-menu-icon-button`,
|
|
764
|
+
onClick: (e) => {
|
|
765
|
+
e.stopPropagation();
|
|
766
|
+
rest.showColumnMenu(menuRef.current);
|
|
767
|
+
setMenuvisible(true);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
) })
|
|
771
|
+
]
|
|
772
|
+
}
|
|
773
|
+
)
|
|
774
|
+
] })
|
|
775
|
+
)
|
|
776
|
+
}
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
function areHeaderPropsEqual(prev, next) {
|
|
780
|
+
const prevCol = prev == null ? void 0 : prev.column;
|
|
781
|
+
const nextCol = next == null ? void 0 : next.column;
|
|
782
|
+
if ((prevCol == null ? void 0 : prevCol.colId) !== (nextCol == null ? void 0 : nextCol.colId)) return false;
|
|
783
|
+
if ((prev == null ? void 0 : prev.displayName) !== (next == null ? void 0 : next.displayName)) return false;
|
|
784
|
+
if ((prev == null ? void 0 : prev.enableHeaderTextWrap) !== (next == null ? void 0 : next.enableHeaderTextWrap)) return false;
|
|
785
|
+
if ((prev == null ? void 0 : prev.debounceTime) !== (next == null ? void 0 : next.debounceTime)) return false;
|
|
786
|
+
const prevDef = (prevCol == null ? void 0 : prevCol.colDef) || {};
|
|
787
|
+
const nextDef = (nextCol == null ? void 0 : nextCol.colDef) || {};
|
|
788
|
+
if (prevDef.isSearchable !== nextDef.isSearchable) return false;
|
|
789
|
+
if (prevDef.sortable !== nextDef.sortable) return false;
|
|
790
|
+
if (prevDef.filter !== nextDef.filter) return false;
|
|
791
|
+
if ((prevDef.suppressHeaderMenuButton ?? prevDef.suppressMenu) !== (nextDef.suppressHeaderMenuButton ?? nextDef.suppressMenu)) {
|
|
792
|
+
return false;
|
|
793
|
+
}
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
const AgGridHeader$1 = memo(AgGridHeader, areHeaderPropsEqual);
|
|
797
|
+
export {
|
|
798
|
+
AgGridHeader$1 as default
|
|
799
|
+
};
|