impact-ui 4.0.1-alpha.20 → 4.0.1-alpha.21

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.
Files changed (82) hide show
  1. package/dist/_virtual/index13.js +2 -2
  2. package/dist/_virtual/index14.js +2 -2
  3. package/dist/_virtual/index15.js +2 -2
  4. package/dist/_virtual/index16.js +2 -2
  5. package/dist/components/DateRangePicker/index.d.ts.map +1 -1
  6. package/dist/components/DateRangePicker/index.js +4 -0
  7. package/dist/components/Modal/Modal.types.d.ts +1 -1
  8. package/dist/components/Modal/Modal.types.d.ts.map +1 -1
  9. package/dist/components/Modal/index.js +1 -1
  10. package/dist/components/Notification/NotificationBody/NotificationList/NotificationListItem.d.ts.map +1 -1
  11. package/dist/components/Notification/NotificationBody/NotificationList/NotificationListItem.js +4 -1
  12. package/dist/components/Table/index.js +1 -1
  13. package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType /ChatEditedMessageType.d.ts.map +1 -0
  14. package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +1 -1
  15. package/dist/components/TableOld/index.js +1 -1
  16. package/dist/components/index.d.ts +0 -1
  17. package/dist/components/index.d.ts.map +1 -1
  18. package/dist/components/index.js +0 -2
  19. package/dist/mcp-component-registry.json +1 -1
  20. package/dist/node_modules/call-bind/index.js +1 -1
  21. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  22. package/dist/node_modules/is-symbol/index.js +1 -1
  23. package/dist/node_modules/react-with-styles-interface-css/dist/index.js +1 -1
  24. package/package.json +5 -5
  25. package/dist/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.d.ts.map +0 -1
  26. package/dist/components/TableV36/AdvanceSearchModalItem.d.ts +0 -27
  27. package/dist/components/TableV36/AdvanceSearchModalItem.d.ts.map +0 -1
  28. package/dist/components/TableV36/AdvanceSortModal.d.ts +0 -8
  29. package/dist/components/TableV36/AdvanceSortModal.d.ts.map +0 -1
  30. package/dist/components/TableV36/AdvanceSortModal.js +0 -297
  31. package/dist/components/TableV36/AgGridHeader.d.ts +0 -13
  32. package/dist/components/TableV36/AgGridHeader.d.ts.map +0 -1
  33. package/dist/components/TableV36/AgGridHeader.js +0 -781
  34. package/dist/components/TableV36/CommentsPortal.d.ts +0 -31
  35. package/dist/components/TableV36/CommentsPortal.d.ts.map +0 -1
  36. package/dist/components/TableV36/CommentsPortal.js +0 -362
  37. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts +0 -13
  38. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts.map +0 -1
  39. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.js +0 -282
  40. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts +0 -16
  41. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts.map +0 -1
  42. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +0 -302
  43. package/dist/components/TableV36/NoComments.d.ts +0 -16
  44. package/dist/components/TableV36/NoComments.d.ts.map +0 -1
  45. package/dist/components/TableV36/NoComments.js +0 -237
  46. package/dist/components/TableV36/Table.types.d.ts +0 -45
  47. package/dist/components/TableV36/Table.types.d.ts.map +0 -1
  48. package/dist/components/TableV36/actionBar.d.ts +0 -7
  49. package/dist/components/TableV36/actionBar.d.ts.map +0 -1
  50. package/dist/components/TableV36/actionBar.js +0 -31
  51. package/dist/components/TableV36/advanceSearchModal.d.ts +0 -20
  52. package/dist/components/TableV36/advanceSearchModal.d.ts.map +0 -1
  53. package/dist/components/TableV36/filterUtils.d.ts +0 -133
  54. package/dist/components/TableV36/filterUtils.d.ts.map +0 -1
  55. package/dist/components/TableV36/filterUtils.js +0 -478
  56. package/dist/components/TableV36/index.d.ts +0 -3
  57. package/dist/components/TableV36/index.d.ts.map +0 -1
  58. package/dist/components/TableV36/index.js +0 -1430
  59. package/dist/components/TableV36/mockData.d.ts +0 -39
  60. package/dist/components/TableV36/mockData.d.ts.map +0 -1
  61. package/dist/components/TableV36/tableFunctions.d.ts +0 -63
  62. package/dist/components/TableV36/tableFunctions.d.ts.map +0 -1
  63. package/dist/components/TableV36/tableFunctions.js +0 -1384
  64. package/dist/components/TableV36/tableHeader.d.ts +0 -80
  65. package/dist/components/TableV36/tableHeader.d.ts.map +0 -1
  66. package/dist/components/TableV36/tableHeader.js +0 -396
  67. package/dist/components/TableV36/tableIcons.d.ts +0 -3
  68. package/dist/components/TableV36/tableIcons.d.ts.map +0 -1
  69. package/dist/components/TableV36/tableMoreOptions.d.ts +0 -52
  70. package/dist/components/TableV36/tableMoreOptions.d.ts.map +0 -1
  71. package/dist/components/TableV36/tableMoreOptions.js +0 -324
  72. package/dist/components/TableV36/tablePagination.d.ts +0 -7
  73. package/dist/components/TableV36/tablePagination.d.ts.map +0 -1
  74. package/dist/components/TableV36/tablePagination.js +0 -67
  75. package/dist/components/TableV36/tableSettings.d.ts +0 -41
  76. package/dist/components/TableV36/tableSettings.d.ts.map +0 -1
  77. package/dist/components/TableV36/tableSettings.js +0 -278
  78. package/dist/components/TableV36/withCommentIcon.d.ts +0 -2
  79. package/dist/components/TableV36/withCommentIcon.d.ts.map +0 -1
  80. package/dist/components/TableV36/withCommentIcon.js +0 -83
  81. /package/dist/components/TableChat/components/TableChatRightSection/{ChatEditedMessageType → ChatEditedMessageType }/ChatEditedMessageType.d.ts +0 -0
  82. /package/dist/components/TableChat/components/TableChatRightSection/{ChatEditedMessageType → ChatEditedMessageType }/ChatEditedMessageType.js +0 -0
@@ -1,781 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import React__default, { 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, _ua;
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 filterModel = rest.api.getFilterModel();
84
- filterModel[(_e = rest.column) == null ? void 0 : _e.colId];
85
- const [isOverflowText, setIsOverflowText] = useState(false);
86
- const headerTextRef = useRef(null);
87
- const containerRef = useRef(null);
88
- const [containerHeight, setContainerHeight] = useState(0);
89
- const onFilterChanged = useCallback(() => {
90
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
91
- const newFilterModel = (_a2 = rest.api) == null ? void 0 : _a2.getFilterModel();
92
- const columnId = ((_b2 = rest.column) == null ? void 0 : _b2.field) || ((_c2 = rest.column) == null ? void 0 : _c2.colId);
93
- const columnFilter = newFilterModel == null ? void 0 : newFilterModel[columnId];
94
- let filterValue = "";
95
- if (columnFilter) {
96
- if (((_e2 = (_d2 = rest.column) == null ? void 0 : _d2.colDef) == null ? void 0 : _e2.filter) === "agDateColumnFilter") {
97
- const dateFrom = columnFilter == null ? void 0 : columnFilter.dateFrom;
98
- const dateTo = columnFilter == null ? void 0 : columnFilter.dateTo;
99
- if (dateFrom && dateTo) {
100
- setStartDate(moment(dateFrom));
101
- setEndDate(moment(dateTo));
102
- const dateFromStr = dateFrom instanceof Date ? moment(dateFrom).format("YYYY-MM-DD") : typeof dateFrom === "string" ? dateFrom.split(" ")[0] : dateFrom;
103
- const dateToStr = dateTo instanceof Date ? moment(dateTo).format("YYYY-MM-DD") : typeof dateTo === "string" ? dateTo.split(" ")[0] : dateTo;
104
- filterValue = `${dateFromStr} - ${dateToStr}`;
105
- } else if (dateFrom) {
106
- filterValue = moment(dateFrom);
107
- setSelectedDate(filterValue);
108
- if (dateFrom instanceof Date) {
109
- filterValue = moment(dateFrom).format("YYYY-MM-DD");
110
- } else if (typeof dateFrom === "string") {
111
- filterValue = dateFrom.split(" ")[0];
112
- } else {
113
- filterValue = dateFrom;
114
- }
115
- }
116
- } else {
117
- 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;
118
- if (((_h2 = (_g2 = rest.column) == null ? void 0 : _g2.colDef) == null ? void 0 : _h2.thirdOptionAsDropdown) && filterValue) {
119
- const initialDropdownOption = (_j2 = (_i2 = rest.column) == null ? void 0 : _i2.colDef) == null ? void 0 : _j2.thirdOptionDropdownOptions;
120
- let option = null;
121
- if (isMultiSelect) {
122
- option = initialDropdownOption == null ? void 0 : initialDropdownOption.filter((option2) => filterValue.includes(option2.value));
123
- } else {
124
- option = initialDropdownOption == null ? void 0 : initialDropdownOption.find((option2) => option2.value === filterValue);
125
- }
126
- if (option) {
127
- setSelectedDropdownOption(
128
- typeof option === "object" ? option : { label: option, value: option }
129
- );
130
- }
131
- } else {
132
- const displayValue = getLabelFromDropdownValue(filterValue, (_k2 = rest.column) == null ? void 0 : _k2.colDef);
133
- setSearchText(displayValue);
134
- }
135
- }
136
- }
137
- if (!filterValue) {
138
- setSearchText("");
139
- setSelectedDropdownOption(isMultiSelect ? [] : null);
140
- setSelectedDate(null);
141
- setStartDate(null);
142
- setEndDate(null);
143
- setHasActiveSearch(false);
144
- } else {
145
- if (!((_m2 = (_l2 = rest.column) == null ? void 0 : _l2.colDef) == null ? void 0 : _m2.thirdOptionAsDropdown)) {
146
- const displayValue = getLabelFromDropdownValue(filterValue, (_n2 = rest.column) == null ? void 0 : _n2.colDef);
147
- setSearchText(displayValue);
148
- }
149
- setHasActiveSearch(true);
150
- }
151
- }, [rest.api]);
152
- useEffect(() => {
153
- var _a2, _b2, _c2, _d2;
154
- if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.thirdOptionAsDropdown) {
155
- const options = ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.thirdOptionDropdownOptions) || [];
156
- setCurrentDropdownOptions(options);
157
- }
158
- }, [(_g = (_f = rest.column) == null ? void 0 : _f.colDef) == null ? void 0 : _g.thirdOptionAsDropdown, (_i = (_h = rest.column) == null ? void 0 : _h.colDef) == null ? void 0 : _i.thirdOptionDropdownOptions]);
159
- const [startDate, setStartDate] = useState(null);
160
- const [endDate, setEndDate] = useState(null);
161
- const isMultiSelect = (_k = (_j = rest.column) == null ? void 0 : _j.colDef) == null ? void 0 : _k.enableMultiSelect;
162
- const [isDropdownOpen, setIsDropdownOpen] = useState(false);
163
- const [selectedDropdownOption, setSelectedDropdownOption] = useState(isMultiSelect ? [] : null);
164
- const [currentDropdownOptions, setCurrentDropdownOptions] = useState([]);
165
- const [isSelectAll, setIsSelectAll] = useState(false);
166
- useEffect(() => {
167
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
168
- const columnId = ((_a2 = rest.column) == null ? void 0 : _a2.field) || ((_b2 = rest.column) == null ? void 0 : _b2.colId);
169
- const currentFilterModel = ((_d2 = (_c2 = rest.api) == null ? void 0 : _c2.getFilterModel) == null ? void 0 : _d2.call(_c2)) || {};
170
- const existingFilter = currentFilterModel[columnId] ?? currentFilterModel[(_e2 = rest.column) == null ? void 0 : _e2.colId];
171
- if (existingFilter) {
172
- onFilterChanged();
173
- if ((_g2 = (_f2 = rest.column) == null ? void 0 : _f2.colDef) == null ? void 0 : _g2.isSearchable) {
174
- if (((_i2 = (_h2 = rest.column) == null ? void 0 : _h2.colDef) == null ? void 0 : _i2.filter) === "agDateColumnFilter") {
175
- setShowDatePicker(true);
176
- } else {
177
- setShowInputField(true);
178
- }
179
- }
180
- }
181
- rest.api.addEventListener("filterChanged", onFilterChanged);
182
- return () => {
183
- rest.api.removeEventListener("filterChanged", onFilterChanged);
184
- };
185
- }, []);
186
- const prevSearchValueRef = useRef(void 0);
187
- const handleSearchChange = (value) => {
188
- var _a2, _b2, _c2, _d2, _e2;
189
- const isEmptyValue = (val) => val === null || val === void 0 || val === "" || Array.isArray(val) && val.length === 0;
190
- const normalizedValue = isEmptyValue(value) ? null : value;
191
- const normalizedPrev = isEmptyValue(prevSearchValueRef.current) ? null : prevSearchValueRef.current;
192
- const currentValue = typeof normalizedValue === "object" && normalizedValue !== null ? JSON.stringify(normalizedValue) : normalizedValue;
193
- const prevValue = typeof normalizedPrev === "object" && normalizedPrev !== null ? JSON.stringify(normalizedPrev) : normalizedPrev;
194
- if (currentValue === prevValue) {
195
- const colId = (_a2 = rest.column) == null ? void 0 : _a2.colId;
196
- 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]));
197
- if (!(normalizedValue === null && hasExistingFilter)) {
198
- return;
199
- }
200
- }
201
- prevSearchValueRef.current = value;
202
- if (handleInlineSearch) {
203
- handleInlineSearch == null ? void 0 : handleInlineSearch(value);
204
- (_e2 = rest.onFilterChanged) == null ? void 0 : _e2.call(rest, rest);
205
- return;
206
- }
207
- setTimeout(() => {
208
- var _a3, _b3, _c3, _d3;
209
- try {
210
- const { inputValue, filterType } = parseSearchValue(value);
211
- applyFilterToGrid(inputValue, filterType);
212
- syncFiltersWithModal(
213
- rest.api,
214
- rest.column.colId,
215
- inputValue,
216
- (_a3 = rest.column) == null ? void 0 : _a3.colDef,
217
- rest.colDefs,
218
- rest.setValue,
219
- rest.setInitialFilters,
220
- getOptionFromDropdownValue
221
- );
222
- (_c3 = (_b3 = rest.api) == null ? void 0 : _b3.onFilterChanged) == null ? void 0 : _c3.call(_b3);
223
- (_d3 = rest.onFilterChanged) == null ? void 0 : _d3.call(rest, rest);
224
- } catch (error) {
225
- console.warn("Error during filter operation:", error);
226
- }
227
- }, 0);
228
- };
229
- const parseSearchValue = (value) => {
230
- var _a2, _b2, _c2, _d2, _e2;
231
- if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.thirdOptionAsDropdown) {
232
- const isBoolean = ((_d2 = (_c2 = rest.column) == null ? void 0 : _c2.colDef) == null ? void 0 : _d2.dataType) === "boolean";
233
- if (Array.isArray(value)) {
234
- const extractedValues = value.map((opt) => opt);
235
- return {
236
- inputValue: extractedValues,
237
- filterType: isBoolean ? "equals" : "contains"
238
- };
239
- }
240
- const extractedValue = typeof value === "object" && value !== null ? value.value : value;
241
- return {
242
- inputValue: extractedValue,
243
- filterType: isBoolean ? "equals" : "contains"
244
- };
245
- } else {
246
- const parsed = parseInlineSearchValue(
247
- value,
248
- (_e2 = rest.column) == null ? void 0 : _e2.colDef,
249
- rest.api,
250
- rest.column.colId
251
- );
252
- return {
253
- inputValue: parsed.parsedValue,
254
- filterType: parsed.filterType
255
- };
256
- }
257
- };
258
- const updateEmptyStateOverlay = () => {
259
- setTimeout(() => {
260
- if (rest.api) {
261
- const displayedRowCount = rest.api.getDisplayedRowCount();
262
- if (displayedRowCount === 0) {
263
- rest.api.showNoRowsOverlay();
264
- } else {
265
- rest.api.hideOverlay();
266
- }
267
- }
268
- }, 0);
269
- };
270
- const applyFilterToGrid = (inputValue, filterType) => {
271
- var _a2;
272
- const currentFilterModel = rest.sortModel || rest.api.getFilterModel();
273
- const filterEntry = buildFilterModelEntry(inputValue, filterType, (_a2 = rest.column) == null ? void 0 : _a2.colDef);
274
- if (filterEntry === void 0) {
275
- delete currentFilterModel[rest.column.colId];
276
- } else {
277
- currentFilterModel[rest.column.colId] = filterEntry;
278
- }
279
- rest.api.setFilterModel(currentFilterModel);
280
- updateEmptyStateOverlay();
281
- };
282
- const debouncedHandleSearchChange = useCallback(
283
- debounce((value) => {
284
- handleSearchChange(value);
285
- }, debounceTime),
286
- []
287
- );
288
- const handleSearch = (e) => {
289
- var _a2, _b2;
290
- e.stopPropagation();
291
- if (((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.filter) === "agDateColumnFilter") {
292
- setShowDatePicker((prev) => !prev);
293
- } else {
294
- setShowInputField((prev) => !prev);
295
- }
296
- expandColumnIfNeeded();
297
- };
298
- const onCloseIconClick = (colId) => {
299
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
300
- setSearchText("");
301
- setSelectedDropdownOption(isMultiSelect ? [] : null);
302
- setSelectedDate(null);
303
- setStartDate(null);
304
- setEndDate(null);
305
- setHasActiveSearch(false);
306
- prevSearchValueRef.current = void 0;
307
- (_a2 = rest.api) == null ? void 0 : _a2.destroyFilter(colId);
308
- const currentFilterModel = { ...((_b2 = rest.api) == null ? void 0 : _b2.getFilterModel()) || {} };
309
- delete currentFilterModel[colId];
310
- (_c2 = rest.api) == null ? void 0 : _c2.setFilterModel(currentFilterModel);
311
- const currentFilters = ((_e2 = (_d2 = rest.getValues) == null ? void 0 : _d2.call(rest)) == null ? void 0 : _e2.filters) || [];
312
- const updatedFilters = currentFilters.filter((f) => {
313
- var _a3;
314
- return ((_a3 = f == null ? void 0 : f.column) == null ? void 0 : _a3.value) !== colId;
315
- });
316
- (_f2 = rest.setValue) == null ? void 0 : _f2.call(rest, "filters", updatedFilters);
317
- (_g2 = rest.setInitialFilters) == null ? void 0 : _g2.call(rest, updatedFilters);
318
- (_i2 = (_h2 = rest.api) == null ? void 0 : _h2.onFilterChanged) == null ? void 0 : _i2.call(_h2);
319
- if (rest.onFilterChanged) {
320
- rest.onFilterChanged(rest);
321
- }
322
- updateEmptyStateOverlay();
323
- };
324
- const MIN_SEARCH_WIDTH = 200;
325
- const expandColumnIfNeeded = () => {
326
- var _a2;
327
- const currentWidth = (_a2 = rest.column) == null ? void 0 : _a2.actualWidth;
328
- if (currentWidth && currentWidth < MIN_SEARCH_WIDTH) {
329
- originalColumnWidthRef.current = currentWidth;
330
- rest.api.setColumnWidths([{ key: rest.column.colId, newWidth: MIN_SEARCH_WIDTH }]);
331
- }
332
- };
333
- const restoreColumnWidth = () => {
334
- if (originalColumnWidthRef.current !== null) {
335
- rest.api.setColumnWidths([
336
- { key: rest.column.colId, newWidth: originalColumnWidthRef.current }
337
- ]);
338
- originalColumnWidthRef.current = null;
339
- }
340
- };
341
- const handleClickOutside = (event) => {
342
- setMenuvisible(false);
343
- };
344
- useEffect(() => {
345
- document.addEventListener("click", handleClickOutside);
346
- return () => {
347
- document.removeEventListener("click", handleClickOutside);
348
- };
349
- }, [menuVisible]);
350
- const onHeaderClick = () => {
351
- var _a2, _b2;
352
- if (rest.applySort) {
353
- rest.applySort(rest.column.colId);
354
- return;
355
- }
356
- if ((_b2 = (_a2 = rest.column) == null ? void 0 : _a2.colDef) == null ? void 0 : _b2.sortable) {
357
- const currentSortModel = rest.api.getColumnState();
358
- const currentSort2 = currentSortModel.find((model) => model.colId === rest.column.colId);
359
- const newSort = (currentSort2 == null ? void 0 : currentSort2.sort) === null ? "asc" : (currentSort2 == null ? void 0 : currentSort2.sort) === "asc" ? "desc" : null;
360
- rest.api.applyColumnState({
361
- state: [{ colId: rest.column.colId, sort: newSort }],
362
- defaultState: { sort: null }
363
- });
364
- }
365
- };
366
- useEffect(() => {
367
- var _a2;
368
- const onSortChanged = () => {
369
- var _a3, _b2;
370
- setCurrentSort(((_b2 = (_a3 = rest.column) == null ? void 0 : _a3.getSort) == null ? void 0 : _b2.call(_a3)) ?? null);
371
- };
372
- (_a2 = rest.api) == null ? void 0 : _a2.addEventListener("sortChanged", onSortChanged);
373
- return () => {
374
- var _a3;
375
- return (_a3 = rest.api) == null ? void 0 : _a3.removeEventListener("sortChanged", onSortChanged);
376
- };
377
- }, [rest.api, rest.column]);
378
- const onColumnMoved = (params) => {
379
- var _a2;
380
- if (((_a2 = params == null ? void 0 : params.column) == null ? void 0 : _a2.colId) && (showInputField || showDatePicker)) {
381
- rest.api.applyColumnState({
382
- state: [
383
- {
384
- colId: params.column.colId,
385
- width: params.column.actualWidth
386
- }
387
- ],
388
- defaultState: { width: null }
389
- });
390
- }
391
- };
392
- useEffect(() => {
393
- var _a2;
394
- if (rest) {
395
- (_a2 = rest.api) == null ? void 0 : _a2.addEventListener("columnResized", onColumnMoved);
396
- }
397
- return () => {
398
- var _a3;
399
- (_a3 = rest.api) == null ? void 0 : _a3.removeEventListener("columnResized", onColumnMoved);
400
- };
401
- }, [rest]);
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, (_l = rest.column) == null ? void 0 : _l.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 ${((_n = (_m = rest.column) == null ? void 0 : _m.colDef) == null ? void 0 : _n.checkboxSelection) ? "checkbox-selection" : ""} ${((_p = (_o = rest.column) == null ? void 0 : _o.colDef) == null ? void 0 : _p.customHeaderIcons) || !(((_r = (_q = rest.column) == null ? void 0 : _q.colDef) == null ? void 0 : _r.suppressHeaderMenuButton) ?? ((_t = (_s = rest.column) == null ? void 0 : _s.colDef) == null ? void 0 : _t.suppressMenu)) || ((_v = (_u = rest.column) == null ? void 0 : _u.colDef) == null ? void 0 : _v.isSearchable) ? "with-icons" : ""}`,
430
- onClick: () => rest.onClick(),
431
- children: showDatePicker ? /* @__PURE__ */ jsxs("div", { className: `ia-search-input-field ia-search-input-narrow`, children: [
432
- ((_x = (_w = rest.column) == null ? void 0 : _w.colDef) == null ? void 0 : _x.thirdOptionAsDateRangePicker) ? /* @__PURE__ */ jsx(
433
- DateRangePicker,
434
- {
435
- fullWidth: true,
436
- withPortal: true,
437
- customIcon: ((_z = (_y = rest.column) == null ? void 0 : _y.colDef) == null ? void 0 : _z.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: ((_B = (_A = rest.column) == null ? void 0 : _A.colDef) == null ? void 0 : _B.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: ((_D = (_C = rest.column) == null ? void 0 : _C.colDef) == null ? void 0 : _D.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: ((_F = (_E = rest.column) == null ? void 0 : _E.colDef) == null ? void 0 : _F.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
- ${((_H = (_G = rest.column) == null ? void 0 : _G.colDef) == null ? void 0 : _H.thirdOptionAsDropdown) ? "with-dropdown" : ""}`,
540
- children: [
541
- ((_J = (_I = rest.column) == null ? void 0 : _I.colDef) == null ? void 0 : _J.thirdOptionAsDropdown) && !((_L = (_K = rest.column) == null ? void 0 : _K.colDef) == null ? void 0 : _L.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: (_N = (_M = rest == null ? void 0 : rest.column) == null ? void 0 : _M.colDef) == null ? void 0 : _N.thirdOptionDropdownOptions,
558
- isClearable: true,
559
- isMulti: (_P = (_O = rest == null ? void 0 : rest.column) == null ? void 0 : _O.colDef) == null ? void 0 : _P.enableMultiSelect,
560
- isOpen: isDropdownOpen,
561
- isSelectAll,
562
- isWithSearch: (_R = (_Q = rest == null ? void 0 : rest.column) == null ? void 0 : _Q.colDef) == null ? void 0 : _R.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: (_T = (_S = rest == null ? void 0 : rest.column) == null ? void 0 : _S.colDef) == null ? void 0 : _T.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
- ...(_V = (_U = rest.column) == null ? void 0 : _U.colDef) == null ? void 0 : _V.selectProps
597
- }
598
- ),
599
- ((_X = (_W = rest.column) == null ? void 0 : _W.colDef) == null ? void 0 : _X.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: (_Z = (_Y = rest.column) == null ? void 0 : _Y.colDef) == null ? void 0 : _Z.toShowDuplicateColumnInAdvanceSearch,
633
- isDisabled: (_$ = (__ = rest.column) == null ? void 0 : __.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
- ((_ba = (_aa = rest.column) == null ? void 0 : _aa.colDef) == null ? void 0 : _ba.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 ${((_da = (_ca = rest.column) == null ? void 0 : _ca.colDef) == null ? void 0 : _da.sortable) ? "sortable" : ""} ${enableHeaderTextWrap ? "header-wrap-enabled" : ""}`,
693
- children: [
694
- ((_fa = (_ea = rest.column) == null ? void 0 : _ea.colDef) == null ? void 0 : _fa.field) === "Selection" || ((_ha = (_ga = rest.column) == null ? void 0 : _ga.colDef) == null ? void 0 : _ha.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
- (_ja = (_ia = rest.column) == null ? void 0 : _ia.colDef) == null ? void 0 : _ja.headerIcons,
718
- ((_la = (_ka = rest.column) == null ? void 0 : _ka.colDef) == null ? void 0 : _la.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
- (_oa = (_na = (_ma = rest.column) == null ? void 0 : _ma.colDef) == null ? void 0 : _na.customHeaderIcons) == null ? void 0 : _oa.map((icon) => {
736
- return icon;
737
- }),
738
- ((_qa = (_pa = rest.column) == null ? void 0 : _pa.colDef) == null ? void 0 : _qa.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
- !(((_sa = (_ra = rest.column) == null ? void 0 : _ra.colDef) == null ? void 0 : _sa.suppressHeaderMenuButton) ?? ((_ua = (_ta = rest.column) == null ? void 0 : _ta.colDef) == null ? void 0 : _ua.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
- export {
780
- AgGridHeader as default
781
- };