impact-ui 4.0.18 → 5.0.0-alpha.2

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 (187) hide show
  1. package/README.md +8 -9
  2. package/dist/_virtual/_commonjsHelpers.js +0 -2
  3. package/dist/_virtual/index7.js +2 -2
  4. package/dist/_virtual/index8.js +2 -2
  5. package/dist/components/Chatbot/Chatbot.types.d.ts +2 -0
  6. package/dist/components/Chatbot/Chatbot.types.d.ts.map +1 -1
  7. package/dist/components/Chatbot/historyPanel.d.ts +1 -1
  8. package/dist/components/Chatbot/historyPanel.d.ts.map +1 -1
  9. package/dist/components/Chatbot/historyPanel.js +146 -90
  10. package/dist/components/Chatbot/index.d.ts +1 -1
  11. package/dist/components/Chatbot/index.d.ts.map +1 -1
  12. package/dist/components/Chatbot/index.js +3 -1
  13. package/dist/components/Input/index.js +2 -2
  14. package/dist/components/KeyboardShortCuts/ShortcutLandingPage.js +1 -1
  15. package/dist/components/KeyboardShortCuts/ShortcutModal.js +1 -1
  16. package/dist/components/KeyboardShortCuts/allSetBox.js +1 -1
  17. package/dist/components/KeyboardShortCuts/index.d.ts.map +1 -1
  18. package/dist/components/KeyboardShortCuts/index.js +38 -112
  19. package/dist/components/KeyboardShortCuts/tutorial.js +1 -1
  20. package/dist/components/OnboardingTour/index.d.ts +61 -0
  21. package/dist/components/OnboardingTour/index.d.ts.map +1 -0
  22. package/dist/components/OnboardingTour/index.js +232 -0
  23. package/dist/components/OnboardingTour/productTourList.d.ts +39 -0
  24. package/dist/components/OnboardingTour/productTourList.d.ts.map +1 -0
  25. package/dist/components/OnboardingTour/productTourList.js +86 -0
  26. package/dist/components/OnboardingTour/tooltipCard.d.ts +45 -0
  27. package/dist/components/OnboardingTour/tooltipCard.d.ts.map +1 -0
  28. package/dist/components/OnboardingTour/tooltipCard.js +96 -0
  29. package/dist/components/OnboardingTour/useTooltipCardPosition.d.ts +29 -0
  30. package/dist/components/OnboardingTour/useTooltipCardPosition.d.ts.map +1 -0
  31. package/dist/components/OnboardingTour/useTooltipCardPosition.js +221 -0
  32. package/dist/components/Select/index.d.ts.map +1 -1
  33. package/dist/components/Select/index.js +14 -5
  34. package/dist/components/{Table → TableV36}/AdvanceSearchModalItem.d.ts +3 -1
  35. package/dist/components/TableV36/AdvanceSearchModalItem.d.ts.map +1 -0
  36. package/dist/components/{Table → TableV36}/AdvanceSortModal.d.ts +3 -1
  37. package/dist/components/TableV36/AdvanceSortModal.d.ts.map +1 -0
  38. package/dist/components/{Table → TableV36}/AdvanceSortModal.js +35 -37
  39. package/dist/components/{Table → TableV36}/AgGridHeader.d.ts +2 -1
  40. package/dist/components/TableV36/AgGridHeader.d.ts.map +1 -0
  41. package/dist/components/{Table → TableV36}/AgGridHeader.js +93 -105
  42. package/dist/components/TableV36/AgGridHeaderGroup.d.ts +3 -0
  43. package/dist/components/TableV36/AgGridHeaderGroup.d.ts.map +1 -0
  44. package/dist/components/TableV36/AgGridHeaderGroup.js +29 -0
  45. package/dist/components/TableV36/CellTooltip.d.ts +14 -0
  46. package/dist/components/TableV36/CellTooltip.d.ts.map +1 -0
  47. package/dist/components/TableV36/CellTooltip.js +11 -0
  48. package/dist/components/{Table → TableV36}/CommentsPortal.d.ts +5 -3
  49. package/dist/components/TableV36/CommentsPortal.d.ts.map +1 -0
  50. package/dist/components/{Table → TableV36}/CommentsPortal.js +6 -10
  51. package/dist/components/TableV36/HighlightedText.d.ts +11 -0
  52. package/dist/components/TableV36/HighlightedText.d.ts.map +1 -0
  53. package/dist/components/TableV36/HighlightedText.js +20 -0
  54. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts.map +1 -0
  55. package/dist/components/{Table → TableV36}/NewAdvanceSearchModal/NewAdvanceSearchModal.js +23 -26
  56. package/dist/components/{Table → TableV36}/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts +5 -4
  57. package/dist/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts.map +1 -0
  58. package/dist/components/{Table → TableV36}/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +19 -43
  59. package/dist/components/{Table → TableV36}/NoComments.d.ts +3 -1
  60. package/dist/components/TableV36/NoComments.d.ts.map +1 -0
  61. package/dist/components/{Table → TableV36}/NoComments.js +3 -5
  62. package/dist/components/TableV36/Table.types.d.ts +127 -0
  63. package/dist/components/TableV36/Table.types.d.ts.map +1 -0
  64. package/dist/components/TableV36/TableSkeletonCell.d.ts +18 -0
  65. package/dist/components/TableV36/TableSkeletonCell.d.ts.map +1 -0
  66. package/dist/components/TableV36/TableSkeletonCell.js +38 -0
  67. package/dist/components/{TableOld → TableV36}/actionBar.d.ts +3 -1
  68. package/dist/components/TableV36/actionBar.d.ts.map +1 -0
  69. package/dist/components/{Table → TableV36}/actionBar.js +1 -5
  70. package/dist/components/{Table → TableV36}/advanceSearchModal.d.ts +3 -1
  71. package/dist/components/TableV36/advanceSearchModal.d.ts.map +1 -0
  72. package/dist/components/{Table → TableV36}/filterUtils.d.ts +2 -56
  73. package/dist/components/TableV36/filterUtils.d.ts.map +1 -0
  74. package/dist/components/{Table → TableV36}/filterUtils.js +17 -100
  75. package/dist/components/TableV36/index.d.ts +3 -0
  76. package/dist/components/TableV36/index.d.ts.map +1 -0
  77. package/dist/components/TableV36/index.js +1767 -0
  78. package/dist/components/TableV36/mockData.d.ts.map +1 -0
  79. package/dist/components/TableV36/resolveTableLoadingOptions.d.ts +62 -0
  80. package/dist/components/TableV36/resolveTableLoadingOptions.d.ts.map +1 -0
  81. package/dist/components/TableV36/resolveTableLoadingOptions.js +52 -0
  82. package/dist/components/TableV36/resolveTableLoadingOptions.test.d.ts +2 -0
  83. package/dist/components/TableV36/resolveTableLoadingOptions.test.d.ts.map +1 -0
  84. package/dist/components/{TableOld → TableV36}/tableFunctions.d.ts +14 -10
  85. package/dist/components/TableV36/tableFunctions.d.ts.map +1 -0
  86. package/dist/components/{shared/tableColumnSettings/columnsTabV36.js → TableV36/tableFunctions.js} +663 -292
  87. package/dist/components/{Table → TableV36}/tableHeader.d.ts +5 -3
  88. package/dist/components/TableV36/tableHeader.d.ts.map +1 -0
  89. package/dist/components/{Table → TableV36}/tableHeader.js +17 -26
  90. package/dist/components/{TableOld → TableV36}/tableIcons.d.ts.map +1 -1
  91. package/dist/components/{Table → TableV36}/tableMoreOptions.d.ts +5 -3
  92. package/dist/components/TableV36/tableMoreOptions.d.ts.map +1 -0
  93. package/dist/components/{Table → TableV36}/tableMoreOptions.js +39 -84
  94. package/dist/components/{Table → TableV36}/tablePagination.d.ts +3 -1
  95. package/dist/components/TableV36/tablePagination.d.ts.map +1 -0
  96. package/dist/components/{Table → TableV36}/tablePagination.js +6 -16
  97. package/dist/components/{Table → TableV36}/tableSettings.d.ts +6 -3
  98. package/dist/components/TableV36/tableSettings.d.ts.map +1 -0
  99. package/dist/components/{shared/tableColumnSettings/tableSettingsV36.js → TableV36/tableSettings.js} +34 -40
  100. package/dist/components/TableV36/tableUtils.d.ts +17 -0
  101. package/dist/components/TableV36/tableUtils.d.ts.map +1 -0
  102. package/dist/components/TableV36/tableUtils.js +60 -0
  103. package/dist/components/TableV36/withCommentIcon.d.ts +13 -0
  104. package/dist/components/TableV36/withCommentIcon.d.ts.map +1 -0
  105. package/dist/components/TableV36/withCommentIcon.js +134 -0
  106. package/dist/components/TextArea/index.js +1 -1
  107. package/dist/components/index.d.ts +3 -2
  108. package/dist/components/index.d.ts.map +1 -1
  109. package/dist/components/index.js +4 -4
  110. package/dist/components/shared/tableColumnSettings/agGridColumnSettingsApi.d.ts +2 -4
  111. package/dist/components/shared/tableColumnSettings/agGridColumnSettingsApi.d.ts.map +1 -1
  112. package/dist/mcp-component-registry.json +274 -337
  113. package/dist/node_modules/@impactsmartsuite/impact-icons/dist/index.js +250 -115
  114. package/dist/node_modules/call-bind/index.js +1 -1
  115. package/dist/node_modules/is-symbol/index.js +1 -1
  116. package/dist/stories/tableStoryDefaults.d.ts +1 -1
  117. package/dist/stories/tableStoryDefaults.d.ts.map +1 -1
  118. package/dist/stories/tableStoryManyColumns.d.ts +1 -1
  119. package/dist/stories/tableV36ChatApiMock.d.ts +420 -0
  120. package/dist/stories/tableV36ChatApiMock.d.ts.map +1 -0
  121. package/dist/utils/helper.js +0 -60
  122. package/package.json +8 -8
  123. package/dist/_virtual/lodash.js +0 -4
  124. package/dist/components/Table/AdvanceSearchModalItem.d.ts.map +0 -1
  125. package/dist/components/Table/AdvanceSearchModalItem.js +0 -313
  126. package/dist/components/Table/AdvanceSortModal.d.ts.map +0 -1
  127. package/dist/components/Table/AgGridHeader.d.ts.map +0 -1
  128. package/dist/components/Table/CommentsPortal.d.ts.map +0 -1
  129. package/dist/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts.map +0 -1
  130. package/dist/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModalItem.d.ts.map +0 -1
  131. package/dist/components/Table/NoComments.d.ts.map +0 -1
  132. package/dist/components/Table/Table.types.d.ts +0 -40
  133. package/dist/components/Table/Table.types.d.ts.map +0 -1
  134. package/dist/components/Table/actionBar.d.ts +0 -7
  135. package/dist/components/Table/actionBar.d.ts.map +0 -1
  136. package/dist/components/Table/advanceSearchModal.d.ts.map +0 -1
  137. package/dist/components/Table/advanceSearchModal.js +0 -601
  138. package/dist/components/Table/agGridLocale.d.ts +0 -33
  139. package/dist/components/Table/agGridLocale.d.ts.map +0 -1
  140. package/dist/components/Table/agGridLocale.js +0 -59
  141. package/dist/components/Table/filterUtils.d.ts.map +0 -1
  142. package/dist/components/Table/filterUtils.test.d.ts +0 -2
  143. package/dist/components/Table/filterUtils.test.d.ts.map +0 -1
  144. package/dist/components/Table/index.d.ts +0 -4
  145. package/dist/components/Table/index.d.ts.map +0 -1
  146. package/dist/components/Table/index.js +0 -1441
  147. package/dist/components/Table/mockData.d.ts.map +0 -1
  148. package/dist/components/Table/tableFunctions.d.ts +0 -57
  149. package/dist/components/Table/tableFunctions.d.ts.map +0 -1
  150. package/dist/components/Table/tableFunctions.js +0 -1317
  151. package/dist/components/Table/tableHeader.d.ts.map +0 -1
  152. package/dist/components/Table/tableIcons.d.ts.map +0 -1
  153. package/dist/components/Table/tableMoreOptions.d.ts.map +0 -1
  154. package/dist/components/Table/tablePagination.d.ts.map +0 -1
  155. package/dist/components/Table/tableSettings.d.ts.map +0 -1
  156. package/dist/components/Table/tableSettings.js +0 -282
  157. package/dist/components/Table/withCommentIcon.d.ts +0 -2
  158. package/dist/components/Table/withCommentIcon.d.ts.map +0 -1
  159. package/dist/components/Table/withCommentIcon.js +0 -88
  160. package/dist/components/TableOld/AgGridHeader.d.ts +0 -14
  161. package/dist/components/TableOld/AgGridHeader.d.ts.map +0 -1
  162. package/dist/components/TableOld/AgGridHeader.js +0 -496
  163. package/dist/components/TableOld/actionBar.d.ts.map +0 -1
  164. package/dist/components/TableOld/actionBar.js +0 -35
  165. package/dist/components/TableOld/index.d.ts +0 -3
  166. package/dist/components/TableOld/index.d.ts.map +0 -1
  167. package/dist/components/TableOld/index.js +0 -645
  168. package/dist/components/TableOld/mockData.d.ts +0 -39
  169. package/dist/components/TableOld/mockData.d.ts.map +0 -1
  170. package/dist/components/TableOld/tableFunctions.d.ts.map +0 -1
  171. package/dist/components/TableOld/tableFunctions.js +0 -1321
  172. package/dist/components/TableOld/tableHeader.d.ts +0 -53
  173. package/dist/components/TableOld/tableHeader.d.ts.map +0 -1
  174. package/dist/components/TableOld/tableHeader.js +0 -229
  175. package/dist/components/TableOld/tableIcons.d.ts +0 -5
  176. package/dist/components/TableOld/tablePagination.d.ts +0 -8
  177. package/dist/components/TableOld/tablePagination.d.ts.map +0 -1
  178. package/dist/components/TableOld/tablePagination.js +0 -80
  179. package/dist/components/TableOld/tableSettings.d.ts +0 -11
  180. package/dist/components/TableOld/tableSettings.d.ts.map +0 -1
  181. package/dist/components/shared/tableColumnSettings/agGridColumnSettingsApi.js +0 -52
  182. package/dist/components/shared/tableColumnSettings/columnsSettingsColumnRow.js +0 -264
  183. package/dist/components/shared/tableColumnSettings/columnsSettingsVirtualList.js +0 -298
  184. package/dist/node_modules/lodash/lodash.js +0 -5486
  185. /package/dist/components/{Table → TableV36}/NewAdvanceSearchModal/NewAdvanceSearchModal.d.ts +0 -0
  186. /package/dist/components/{Table → TableV36}/mockData.d.ts +0 -0
  187. /package/dist/components/{Table → TableV36}/tableIcons.d.ts +0 -0
@@ -1,601 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect } from "react";
3
- import { l as lodashExports } from "../../node_modules/lodash/lodash.js";
4
- import moment from "moment";
5
- import { useForm, useFieldArray } from "react-hook-form";
6
- import { getAllowedColumns, convertToOptions, getNonTextFilterOptions, getTextFilterOptions, hasDuplicateColumns } from "../../utils/helper.js";
7
- import { Button } from "../Button/index.js";
8
- import { ButtonGroup } from "../ButtonGroup/index.js";
9
- import { Modal } from "../Modal/index.js";
10
- import { Toast } from "../Toast/index.js";
11
- import AdvanceSearchModalItem from "./AdvanceSearchModalItem.js";
12
- import { useTranslation } from "../../i18n/useTranslation.js";
13
- import AddOutlined from "../../node_modules/@mui/icons-material/esm/AddOutlined.js";
14
- function AdvanceSearchModal({
15
- isAdvanceSearch,
16
- toggleAdvanceSearch,
17
- colDefs,
18
- actualRef,
19
- currentColumnId,
20
- savedAdvanceSearchConfig,
21
- setInitialFilters,
22
- initialFilters = [{ column: null, operation: null, value: "" }],
23
- selectedThirdOptionDropdownValue,
24
- setSelectedThirdOptionDropdownValue,
25
- draftFilter,
26
- setDraftFilter,
27
- ...args
28
- }) {
29
- const { t } = useTranslation();
30
- const [activeOption, setActiveOption] = useState("advanceSearch");
31
- const [initialDataSet, setInitialDataSet] = useState(false);
32
- const [isFormValid, setIsFormValid] = useState(true);
33
- const [openToast, setOpenToast] = useState(false);
34
- const [isClearAll, setIsClearAll] = useState(false);
35
- const [flag, setFlag] = useState(false);
36
- const [_, forceRender] = useState(false);
37
- const [toShowDuplicateColumnInAdvanceSearch, setToShowDuplicateColumnInAdvanceSearch] = useState(false);
38
- const formMethods = activeOption == "advanceSearch" ? useForm({
39
- defaultValues: {
40
- filters: initialFilters
41
- },
42
- rules: {
43
- required: true
44
- }
45
- }) : useForm({
46
- defaultValues: {
47
- filters: [{ column: null, operation: null, value: null }]
48
- },
49
- rules: {
50
- required: true
51
- }
52
- });
53
- const { control, handleSubmit, reset, getValues, watch, setValue } = formMethods;
54
- const { fields, append, remove } = useFieldArray({
55
- control,
56
- name: "filters",
57
- keyName: "fieldId"
58
- });
59
- const [pendingDeletions, setPendingDeletions] = useState([]);
60
- const [softCleared, setSoftCleared] = useState(false);
61
- const allowedCols = useMemo(() => {
62
- return getAllowedColumns(colDefs);
63
- }, [colDefs]);
64
- const filteredColumnsInitialOptions = useMemo(() => {
65
- const selectedValues = fields.filter((field) => !pendingDeletions.includes(field.fieldId)).map((f) => {
66
- var _a;
67
- return (_a = f.column) == null ? void 0 : _a.value;
68
- }).filter(Boolean);
69
- return convertToOptions(colDefs || []).filter((opt) => !selectedValues.includes(opt.value));
70
- }, [colDefs, fields, flag, pendingDeletions]);
71
- useEffect(() => {
72
- var _a, _b, _c;
73
- if (!initialDataSet && ((_b = (_a = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a.api) == null ? void 0 : _b.getFilterModel())) {
74
- const isEmptyFilter = (filter) => {
75
- var _a2, _b2, _c2, _d;
76
- return !((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) || ((_b2 = filter == null ? void 0 : filter.column) == null ? void 0 : _b2.value) === null || ((_c2 = filter == null ? void 0 : filter.column) == null ? void 0 : _c2.value) === "" || !((_d = filter == null ? void 0 : filter.operation) == null ? void 0 : _d.value) && !(filter == null ? void 0 : filter.value);
77
- };
78
- const validInitialFilters = initialFilters.filter((f) => !isEmptyFilter(f)) || [];
79
- const isIntentionallyCleared = initialFilters.length === 0 || // Empty array means cleared
80
- initialFilters.length > 0 && validInitialFilters.length === 0;
81
- if (isIntentionallyCleared) {
82
- reset({ filters: [{ column: null, operation: null, value: "" }] });
83
- setInitialDataSet(true);
84
- return;
85
- }
86
- const filterModel = (_c = actualRef.current.api) == null ? void 0 : _c.getFilterModel();
87
- if (Object.keys(filterModel).length > 0) {
88
- const formattedFilters = Object.entries(filterModel).map(([field, filterData]) => {
89
- const columnOption = filteredColumnsInitialOptions.find((opt) => opt.value === field);
90
- const columnsOptionsInfo = colDefs == null ? void 0 : colDefs.find((col) => (col == null ? void 0 : col.field) === field);
91
- const isThirdOptionDropdown = columnsOptionsInfo == null ? void 0 : columnsOptionsInfo.thirdOptionAsDropdown;
92
- const getThirdOptionDropdownValue = (filterData2) => {
93
- var _a2;
94
- if (isThirdOptionDropdown) {
95
- return (_a2 = columnsOptionsInfo == null ? void 0 : columnsOptionsInfo.thirdOptionDropdownOptions) == null ? void 0 : _a2.find(
96
- (item) => (item == null ? void 0 : item.value) === filterData2
97
- );
98
- }
99
- return filterData2;
100
- };
101
- const filterValue = getThirdOptionDropdownValue(filterData == null ? void 0 : filterData.filter);
102
- const operationOption = filterData.filterType === "number" ? getNonTextFilterOptions(t).find((opt) => opt.value === (filterData == null ? void 0 : filterData.type)) : getTextFilterOptions(t).find((opt) => opt.value === (filterData == null ? void 0 : filterData.type));
103
- return {
104
- column: columnOption,
105
- operation: operationOption,
106
- value: (filterData == null ? void 0 : filterData.filterType) === "date" ? moment(filterValue) : filterValue,
107
- id: ""
108
- // no uuid for now
109
- };
110
- });
111
- const validInitialFilters2 = initialFilters.filter((f) => !isEmptyFilter(f)) || [];
112
- const updatedInitialFilters = [
113
- // Include valid initial filters, updated with formattedFilters if they match
114
- ...validInitialFilters2.map((filter) => {
115
- const match = formattedFilters.find((f) => {
116
- var _a2, _b2;
117
- return ((_a2 = f.column) == null ? void 0 : _a2.value) === ((_b2 = filter.column) == null ? void 0 : _b2.value);
118
- });
119
- return match || filter;
120
- }),
121
- // Add new filters from formattedFilters that don't exist in initialFilters
122
- ...formattedFilters.filter(
123
- (f) => {
124
- var _a2, _b2;
125
- return ((_a2 = f.column) == null ? void 0 : _a2.value) && // column.value must be there
126
- ((_b2 = f.operation) == null ? void 0 : _b2.value) && // operation must be there
127
- !validInitialFilters2.find((filter) => {
128
- var _a3, _b3;
129
- return ((_a3 = filter.column) == null ? void 0 : _a3.value) === ((_b3 = f.column) == null ? void 0 : _b3.value);
130
- });
131
- }
132
- )
133
- ];
134
- const finalFilters = updatedInitialFilters.length > 0 ? updatedInitialFilters : [{ column: null, operation: null, value: "" }];
135
- reset({ filters: finalFilters });
136
- setInitialDataSet(true);
137
- } else {
138
- const isEmptyFilter2 = (filter) => {
139
- var _a2, _b2, _c2, _d;
140
- return !((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) || ((_b2 = filter == null ? void 0 : filter.column) == null ? void 0 : _b2.value) === null || ((_c2 = filter == null ? void 0 : filter.column) == null ? void 0 : _c2.value) === "" || !((_d = filter == null ? void 0 : filter.operation) == null ? void 0 : _d.value) && !(filter == null ? void 0 : filter.value);
141
- };
142
- const validInitialFilters2 = initialFilters.filter((f) => !isEmptyFilter2(f)) || [];
143
- const finalFilters = validInitialFilters2.length > 0 ? validInitialFilters2 : [{ column: null, operation: null, value: "" }];
144
- reset({ filters: finalFilters });
145
- setInitialDataSet(true);
146
- }
147
- } else if (initialFilters.length > 0 && !initialDataSet) {
148
- const isEmptyFilter = (filter) => {
149
- var _a2, _b2, _c2, _d;
150
- return !((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) || ((_b2 = filter == null ? void 0 : filter.column) == null ? void 0 : _b2.value) === null || ((_c2 = filter == null ? void 0 : filter.column) == null ? void 0 : _c2.value) === "" || !((_d = filter == null ? void 0 : filter.operation) == null ? void 0 : _d.value) && !(filter == null ? void 0 : filter.value);
151
- };
152
- const validInitialFilters = initialFilters.filter((f) => !isEmptyFilter(f)) || [];
153
- const finalFilters = validInitialFilters.length > 0 ? validInitialFilters : [{ column: null, operation: null, value: "" }];
154
- reset({ filters: finalFilters });
155
- setInitialDataSet(true);
156
- } else if (!initialDataSet) {
157
- reset({ filters: [{ column: null, operation: null, value: "" }] });
158
- setInitialDataSet(true);
159
- }
160
- }, [actualRef, filteredColumnsInitialOptions, initialDataSet, initialFilters]);
161
- const softRemove = (index, fieldId) => {
162
- var _a;
163
- const filter = getValues().filters[index];
164
- if (!((_a = filter == null ? void 0 : filter.column) == null ? void 0 : _a.value)) {
165
- remove(index);
166
- } else {
167
- setPendingDeletions((prev) => [...prev, fieldId]);
168
- }
169
- };
170
- useEffect(() => {
171
- var _a, _b, _c, _d, _e;
172
- if (isAdvanceSearch) {
173
- const isEmptyFilter = (filter) => {
174
- var _a2, _b2, _c2, _d2;
175
- return !((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) || ((_b2 = filter == null ? void 0 : filter.column) == null ? void 0 : _b2.value) === null || ((_c2 = filter == null ? void 0 : filter.column) == null ? void 0 : _c2.value) === "" || !((_d2 = filter == null ? void 0 : filter.operation) == null ? void 0 : _d2.value) && !(filter == null ? void 0 : filter.value);
176
- };
177
- const validInitialFilters = initialFilters.filter((f) => !isEmptyFilter(f)) || [];
178
- const isIntentionallyCleared = initialFilters.length === 0 || // Empty array means cleared
179
- initialFilters.length > 0 && validInitialFilters.length === 0;
180
- if (isIntentionallyCleared) {
181
- reset({ filters: [{ column: null, operation: null, value: "" }] });
182
- setIsClearAll(false);
183
- return;
184
- }
185
- const filterModel = ((_b = (_a = args.api) == null ? void 0 : _a.getFilterModel) == null ? void 0 : _b.call(_a)) || {};
186
- const newFilters = [];
187
- Object.keys(filterModel).forEach((colId) => {
188
- var _a2, _b2, _c2, _d2, _e2, _f, _g, _h;
189
- const columnDef = colDefs.find((col) => (col == null ? void 0 : col.colId) === colId || (col == null ? void 0 : col.field) === colId);
190
- if (!columnDef) return;
191
- let value = "";
192
- let operation = "";
193
- if (columnDef.filter === "agDateColumnFilter") {
194
- value = ((_a2 = filterModel[colId]) == null ? void 0 : _a2.dateFrom) || "";
195
- operation = "equals";
196
- } else if (columnDef.filter === "agNumberColumnFilter") {
197
- value = ((_d2 = (_c2 = (_b2 = filterModel[colId]) == null ? void 0 : _b2.filter) == null ? void 0 : _c2.toString) == null ? void 0 : _d2.call(_c2)) || "";
198
- operation = ((_e2 = filterModel[colId]) == null ? void 0 : _e2.type) || "equals";
199
- } else {
200
- value = ((_h = (_g = (_f = filterModel[colId]) == null ? void 0 : _f.filter) == null ? void 0 : _g.toString) == null ? void 0 : _h.call(_g)) || "";
201
- operation = "contains";
202
- }
203
- if (value) {
204
- newFilters.push({
205
- column: {
206
- label: columnDef.headerName,
207
- value: colId
208
- },
209
- operation: {
210
- label: operation.charAt(0).toUpperCase() + operation.slice(1),
211
- value: operation
212
- },
213
- value
214
- });
215
- }
216
- });
217
- if (newFilters.length > 0) {
218
- reset({ filters: newFilters });
219
- } else {
220
- const actualFilters = ((_e = (_d = (_c = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _c.api) == null ? void 0 : _d.getFilterModel) == null ? void 0 : _e.call(_d)) || {};
221
- const fieldOrder = Object.keys(actualFilters);
222
- const tempExtraFilters = fieldOrder.map((colId) => {
223
- var _a2, _b2, _c2;
224
- const filter = actualFilters[colId];
225
- return {
226
- column: {
227
- label: colId.charAt(0).toUpperCase() + colId.slice(1),
228
- value: colId,
229
- type: (filter == null ? void 0 : filter.filterType) || "text"
230
- },
231
- operation: {
232
- label: ((_b2 = (_a2 = filter == null ? void 0 : filter.type) == null ? void 0 : _a2.charAt(0)) == null ? void 0 : _b2.toUpperCase()) + ((_c2 = filter == null ? void 0 : filter.type) == null ? void 0 : _c2.slice(1)) || t("table.search.containsLabel"),
233
- value: (filter == null ? void 0 : filter.type) || "contains"
234
- },
235
- value: (filter == null ? void 0 : filter.dateFrom) || (filter == null ? void 0 : filter.filter) || "",
236
- id: ""
237
- };
238
- });
239
- const merged = [
240
- ...tempExtraFilters,
241
- ...validInitialFilters.filter((f) => {
242
- var _a2;
243
- return !fieldOrder.includes((_a2 = f.column) == null ? void 0 : _a2.value);
244
- })
245
- ];
246
- reset({
247
- filters: merged.length > 0 ? merged : [{ column: null, operation: null, value: "" }]
248
- });
249
- }
250
- setIsClearAll(false);
251
- }
252
- }, [isAdvanceSearch, initialFilters, colDefs, args.api]);
253
- useEffect(() => {
254
- if (!isAdvanceSearch) return;
255
- const isEmptyFilter = (filter) => {
256
- var _a, _b, _c, _d;
257
- return !((_a = filter == null ? void 0 : filter.column) == null ? void 0 : _a.value) || ((_b = filter == null ? void 0 : filter.column) == null ? void 0 : _b.value) === null || ((_c = filter == null ? void 0 : filter.column) == null ? void 0 : _c.value) === "" || !((_d = filter == null ? void 0 : filter.operation) == null ? void 0 : _d.value) && !(filter == null ? void 0 : filter.value);
258
- };
259
- const validInitialFilters = initialFilters.filter((f) => !isEmptyFilter(f)) || [];
260
- const isIntentionallyCleared = initialFilters.length === 0 || // Empty array means cleared
261
- initialFilters.length > 0 && validInitialFilters.length === 0;
262
- if (isIntentionallyCleared) {
263
- reset({ filters: [{ column: null, operation: null, value: "" }] });
264
- setIsClearAll(false);
265
- return;
266
- }
267
- if ((draftFilter == null ? void 0 : draftFilter.length) > 0) {
268
- const draftColumnValues = draftFilter.map((f) => {
269
- var _a;
270
- return (_a = f == null ? void 0 : f.column) == null ? void 0 : _a.value;
271
- }).filter(Boolean);
272
- const newColumnsFromInitial = validInitialFilters.filter(
273
- (f) => {
274
- var _a;
275
- return ((_a = f.column) == null ? void 0 : _a.value) && !draftColumnValues.includes(f.column.value);
276
- }
277
- ) || [];
278
- const mergedFilters = [...draftFilter, ...newColumnsFromInitial];
279
- reset({ filters: mergedFilters });
280
- } else {
281
- reset({
282
- filters: validInitialFilters.length > 0 ? validInitialFilters : [{ column: null, operation: null, value: "" }]
283
- });
284
- }
285
- setIsClearAll(false);
286
- }, [isAdvanceSearch, initialFilters, draftFilter]);
287
- const onSubmit = (data) => {
288
- };
289
- const handleClearAll = () => {
290
- var _a, _b, _c, _d, _e;
291
- const currentFilters = getValues().filters || [];
292
- const clonedFilters = lodashExports.cloneDeep(currentFilters.filter((f) => {
293
- var _a2;
294
- return (_a2 = f.column) == null ? void 0 : _a2.value;
295
- }));
296
- setDraftFilter(clonedFilters);
297
- reset({
298
- filters: [
299
- {
300
- column: null,
301
- operation: null,
302
- value: ""
303
- }
304
- ]
305
- });
306
- setSoftCleared(true);
307
- setIsClearAll(true);
308
- (_b = (_a = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a.api) == null ? void 0 : _b.setFilterModel(null);
309
- const model = typeof ((_d = (_c = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _c.api) == null ? void 0 : _d.getModel) === "function" ? actualRef.current.api.getModel() : null;
310
- if (model == null ? void 0 : model.advancedFilterModel) {
311
- model.advancedFilterModel = {};
312
- }
313
- Promise.resolve().then(() => {
314
- var _a2, _b2;
315
- (_b2 = (_a2 = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.onFilterChanged();
316
- });
317
- setInitialFilters([{ column: null, operation: null, value: "" }]);
318
- setInitialDataSet(false);
319
- (_e = args.onClearAllClick) == null ? void 0 : _e.call(args);
320
- };
321
- const handleClearAllValues = () => {
322
- const allFilters = getValues().filters || [];
323
- const updatedFilters = allFilters.filter((filter, index) => {
324
- var _a;
325
- const fieldId = (_a = fields[index]) == null ? void 0 : _a.fieldId;
326
- return !pendingDeletions.includes(fieldId) && filter.column !== "";
327
- }).map((filter) => ({
328
- ...filter,
329
- value: void 0
330
- }));
331
- reset({
332
- filters: updatedFilters.length > 0 ? updatedFilters : [
333
- {
334
- column: { label: "", value: "", type: "text" },
335
- operation: null,
336
- value: void 0
337
- }
338
- ]
339
- });
340
- };
341
- const watchedFilters = watch("filters");
342
- const watchedColumns = watchedFilters.map((filter) => {
343
- var _a;
344
- return (_a = filter == null ? void 0 : filter.column) == null ? void 0 : _a.value;
345
- });
346
- useEffect(() => {
347
- const nonEmptyColumns = watchedColumns == null ? void 0 : watchedColumns.filter(
348
- (col) => col !== null && col !== void 0 && col !== ""
349
- );
350
- const hasDuplicates = hasDuplicateColumns(nonEmptyColumns);
351
- setIsFormValid(!hasDuplicates);
352
- }, [watchedColumns]);
353
- useEffect(() => {
354
- if (!isFormValid) {
355
- setOpenToast(true);
356
- }
357
- }, [isFormValid]);
358
- const handleApplyFilters = () => {
359
- var _a, _b, _c, _d;
360
- const allFilters = getValues().filters || [];
361
- setDraftFilter([]);
362
- const updatedFilters = allFilters.filter((field, index) => {
363
- var _a2, _b2, _c2;
364
- const fieldId = (_a2 = fields[index]) == null ? void 0 : _a2.fieldId;
365
- return !pendingDeletions.includes(fieldId) && ((_b2 = field.column) == null ? void 0 : _b2.value) && ((_c2 = field.operation) == null ? void 0 : _c2.value);
366
- });
367
- if (softCleared) {
368
- args.onSearchApplyClick([]);
369
- setSoftCleared(false);
370
- setIsClearAll(false);
371
- setPendingDeletions([]);
372
- return;
373
- } else {
374
- setInitialFilters(updatedFilters);
375
- }
376
- args.onSearchApplyClick(updatedFilters);
377
- const finalModel = updatedFilters.reduce((acc, curr) => {
378
- var _a2, _b2, _c2;
379
- if (((_a2 = curr.column) == null ? void 0 : _a2.value) && ((_b2 = curr.operation) == null ? void 0 : _b2.value)) {
380
- let filterValue = ((_c2 = curr.value) == null ? void 0 : _c2.value) || curr.value;
381
- let filterType = "text";
382
- if (moment.isMoment(filterValue)) {
383
- filterType = "date";
384
- filterValue = filterValue.format("YYYY-MM-DD");
385
- }
386
- acc[curr.column.value] = {
387
- filter: filterValue,
388
- filterType,
389
- type: curr.operation.value,
390
- ...filterType === "date" && { dateFrom: filterValue }
391
- };
392
- }
393
- return acc;
394
- }, {});
395
- setSoftCleared(false);
396
- (_b = (_a = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a.api) == null ? void 0 : _b.setFilterModel(finalModel);
397
- Promise.resolve().then(() => {
398
- var _a2, _b2;
399
- (_b2 = (_a2 = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.onFilterChanged();
400
- });
401
- (_d = (_c = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _c.api) == null ? void 0 : _d.setFilterModel(finalModel);
402
- Promise.resolve().then(() => {
403
- var _a2, _b2;
404
- (_b2 = (_a2 = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.onFilterChanged();
405
- });
406
- setIsClearAll(false);
407
- setPendingDeletions([]);
408
- };
409
- const handleAdvanceSearchClose = () => {
410
- const currentFilters = getValues().filters || [];
411
- const cleanedFilters = currentFilters.filter((f) => {
412
- var _a, _b;
413
- const hasColumn = (_a = f.column) == null ? void 0 : _a.value;
414
- const hasOperation = (_b = f.operation) == null ? void 0 : _b.value;
415
- const hasValue = typeof f.value === "string" ? f.value.trim() !== "" : f.value !== null && f.value !== void 0;
416
- return hasColumn && (hasOperation || hasValue);
417
- });
418
- setPendingDeletions([]);
419
- setInitialFilters(cleanedFilters);
420
- };
421
- const visibleFields = fields.filter((field) => !pendingDeletions.includes(field.fieldId));
422
- return /* @__PURE__ */ jsxs(
423
- Modal,
424
- {
425
- className: "ia-table-search-modal",
426
- height: 400,
427
- open: isAdvanceSearch,
428
- primaryButtonLabel: t("common.apply"),
429
- primaryButtonProps: {
430
- type: "submit",
431
- disabled: !isFormValid
432
- },
433
- secondaryButtonLabel: args.onSearchSaveClick ? t("table.search.saveSearch") : null,
434
- secondaryButtonProps: {
435
- disabled: !isFormValid
436
- },
437
- size: "small",
438
- title: t("common.search"),
439
- width: 850,
440
- onClose: () => {
441
- setPendingDeletions([]);
442
- setInitialDataSet(false);
443
- toggleAdvanceSearch();
444
- if (!softCleared) {
445
- handleAdvanceSearchClose();
446
- }
447
- setSoftCleared(false);
448
- setIsClearAll(false);
449
- },
450
- onPrimaryButtonClick: handleApplyFilters,
451
- onSecondaryButtonClick: (e) => {
452
- e.preventDefault();
453
- args.onSearchSaveClick(getValues().filters);
454
- },
455
- children: [
456
- /* @__PURE__ */ jsxs("div", { className: "ia-table-search-header", children: [
457
- /* @__PURE__ */ jsx(
458
- ButtonGroup,
459
- {
460
- options: [
461
- {
462
- label: t("common.search"),
463
- value: "search"
464
- },
465
- {
466
- label: t("table.search.advanceSearch"),
467
- value: "advanceSearch"
468
- }
469
- ],
470
- selectedOption: activeOption,
471
- onChange: (e, val) => {
472
- var _a, _b;
473
- e.preventDefault();
474
- setActiveOption(val);
475
- (_b = (_a = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a.api) == null ? void 0 : _b.destroyFilter(null);
476
- if (val === "advanceSearch") {
477
- const updatedFilters = getValues().filters.map((filter) => {
478
- const shouldResetOp = filter.value === null || filter.value === "" || !filter.value;
479
- return {
480
- ...filter,
481
- operation: shouldResetOp ? null : filter.operation
482
- };
483
- });
484
- reset({ filters: updatedFilters });
485
- }
486
- }
487
- }
488
- ),
489
- /* @__PURE__ */ jsx(
490
- Button,
491
- {
492
- size: "small",
493
- type: "button",
494
- variant: "url",
495
- onClick: (e) => {
496
- e.preventDefault();
497
- handleClearAll();
498
- },
499
- children: t("common.clearAll")
500
- }
501
- )
502
- ] }),
503
- /* @__PURE__ */ jsxs(
504
- "form",
505
- {
506
- className: "ia-table-search-content",
507
- onSubmit: (e) => {
508
- e.preventDefault();
509
- handleSubmit(onSubmit)(e);
510
- },
511
- children: [
512
- /* @__PURE__ */ jsx("div", { className: "ia-table-search-content-title", children: t("table.search.matchAll") }),
513
- /* @__PURE__ */ jsx(Fragment, { children: (savedAdvanceSearchConfig == null ? void 0 : savedAdvanceSearchConfig.length) > 0 ? savedAdvanceSearchConfig : (() => {
514
- return fields.filter((field) => !pendingDeletions.includes(field.fieldId)).map((field, visualIndex) => {
515
- const actualIndex = fields.findIndex((f) => f.fieldId === field.fieldId);
516
- return /* @__PURE__ */ jsx(
517
- AdvanceSearchModalItem,
518
- {
519
- activeOption,
520
- actualIndex,
521
- addNewColumn: append,
522
- colDefs,
523
- control,
524
- currentColumnId,
525
- fields,
526
- filteredColumnsInitialOptions,
527
- flag,
528
- getValues,
529
- index: visualIndex,
530
- isClearAll,
531
- isLastVisible: visibleFields.length === 1,
532
- pendingDeletions,
533
- remove,
534
- selectedThirdOptionDropdownValue,
535
- setFlag,
536
- setPendingDeletions,
537
- setSelectedThirdOptionDropdownValue,
538
- setToShowDuplicateColumnInAdvanceSearch,
539
- totalColumns: fields.length,
540
- onDelete: () => {
541
- softRemove(actualIndex, field.fieldId);
542
- },
543
- ...args
544
- },
545
- field.fieldId
546
- );
547
- });
548
- })() }),
549
- !isFormValid && /* @__PURE__ */ jsx(
550
- Toast,
551
- {
552
- isOpen: openToast,
553
- message: t("table.search.selectUnselectedColumn"),
554
- position: "top-right",
555
- variant: "warning",
556
- onClose: () => {
557
- setOpenToast(!openToast);
558
- }
559
- }
560
- ),
561
- /* @__PURE__ */ jsxs("div", { className: "ia-table-search-content-footer", children: [
562
- /* @__PURE__ */ jsx(
563
- Button,
564
- {
565
- disabled: filteredColumnsInitialOptions.length === 1,
566
- size: "large",
567
- type: "button",
568
- variant: "secondary",
569
- onClick: handleClearAllValues,
570
- children: t("table.search.clearValues")
571
- }
572
- ),
573
- /* @__PURE__ */ jsx(
574
- Button,
575
- {
576
- disabled: visibleFields.length === allowedCols.length,
577
- icon: /* @__PURE__ */ jsx(AddOutlined, {}),
578
- size: "large",
579
- type: "button",
580
- variant: "tertiary",
581
- onClick: () => {
582
- append({
583
- column: "",
584
- operation: "",
585
- value: ""
586
- });
587
- },
588
- children: t("table.search.addAttribute")
589
- }
590
- )
591
- ] })
592
- ]
593
- }
594
- )
595
- ]
596
- }
597
- );
598
- }
599
- export {
600
- AdvanceSearchModal as default
601
- };
@@ -1,33 +0,0 @@
1
- import { MutableRefObject } from 'react';
2
- import { Locale } from '../../i18n/types';
3
-
4
- export type AgGridLocaleText = Record<string, string>;
5
- /**
6
- * AG Grid bakes these pagination labels into the panel HTML at create time.
7
- * Updating localeText/getLocaleText alone will not refresh them — we patch
8
- * these keys into the DOM after setAgGridLocaleText().
9
- */
10
- export declare const AG_GRID_PAGINATION_LOCALE_KEYS: readonly ["page", "to", "of", "firstPage", "previousPage", "nextPage", "lastPage"];
11
- export declare function getAgGridLocaleTextForLocale(locale: Locale): AgGridLocaleText;
12
- /**
13
- * Update the mutable key→value object that getLocaleText reads from.
14
- * Call this when the app locale changes (instead of remounting the grid).
15
- */
16
- export declare function setAgGridLocaleText(localeTextRef: MutableRefObject<AgGridLocaleText>, locale: Locale): AgGridLocaleText;
17
- interface GetLocaleTextParams {
18
- key: string;
19
- defaultValue: string;
20
- variableValues?: string[];
21
- }
22
- /**
23
- * AG Grid getLocaleText callback — looks up one key at a time from the
24
- * object managed by setAgGridLocaleText.
25
- */
26
- export declare function createAgGridGetLocaleText(localeTextRef: MutableRefObject<AgGridLocaleText>): (params: GetLocaleTextParams) => string;
27
- /**
28
- * Apply the pagination keys from the current localeText object onto the
29
- * already-rendered AG Grid paging panel (no grid remount).
30
- */
31
- export declare function syncAgGridPaginationLocale(container: HTMLElement | null, localeText: AgGridLocaleText | null | undefined): void;
32
- export {};
33
- //# sourceMappingURL=agGridLocale.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agGridLocale.d.ts","sourceRoot":"","sources":["../../../src/components/Table/agGridLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,oFAQjC,CAAC;AAEX,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAE7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EACjD,MAAM,EAAE,MAAM,GACb,gBAAgB,CAGlB;AAED,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,IACjF,QAAQ,mBAAmB,KAAG,MAAM,CAuB7C;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,WAAW,GAAG,IAAI,EAC7B,UAAU,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAC9C,IAAI,CA4BN"}