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,282 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { useForm, useFieldArray } from "react-hook-form";
|
|
4
|
+
import NewAdvanceSearchModalItem from "./NewAdvanceSearchModalItem.js";
|
|
5
|
+
import { convertToOptions } from "../../../utils/helper.js";
|
|
6
|
+
import { Button } from "../../Button/index.js";
|
|
7
|
+
import { ButtonGroup } from "../../ButtonGroup/index.js";
|
|
8
|
+
import { Modal } from "../../Modal/index.js";
|
|
9
|
+
import AddOutlined from "../../../node_modules/@mui/icons-material/esm/AddOutlined.js";
|
|
10
|
+
const filterInitialValues = {
|
|
11
|
+
column: { label: "", value: "", type: "text" },
|
|
12
|
+
operation: null,
|
|
13
|
+
value: null
|
|
14
|
+
};
|
|
15
|
+
const NewAdvanceSearchModal = ({
|
|
16
|
+
isAdvanceSearch,
|
|
17
|
+
actualRef,
|
|
18
|
+
onSearchApplyClick,
|
|
19
|
+
toggleAdvanceSearch,
|
|
20
|
+
initialFilters,
|
|
21
|
+
setInitialFilters,
|
|
22
|
+
colDefs = [],
|
|
23
|
+
currentColumnId,
|
|
24
|
+
...args
|
|
25
|
+
}) => {
|
|
26
|
+
const [activeSearchType, setActiveSearchType] = useState("advanceSearch");
|
|
27
|
+
const onChangeSearchType = (e, val) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
setActiveSearchType(val);
|
|
30
|
+
};
|
|
31
|
+
const formMethods = useForm({
|
|
32
|
+
defaultValues: {
|
|
33
|
+
filters: initialFilters
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
required: true
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const {
|
|
40
|
+
control,
|
|
41
|
+
handleSubmit,
|
|
42
|
+
watch,
|
|
43
|
+
formState: { isValid: isFormValid },
|
|
44
|
+
setValue,
|
|
45
|
+
getValues,
|
|
46
|
+
reset
|
|
47
|
+
} = formMethods;
|
|
48
|
+
const { fields, append, remove } = useFieldArray({
|
|
49
|
+
control,
|
|
50
|
+
name: "filters",
|
|
51
|
+
keyName: "fieldId"
|
|
52
|
+
});
|
|
53
|
+
const formValues = watch();
|
|
54
|
+
const filteredColumnsInitialOptions = useMemo(() => {
|
|
55
|
+
const selectedValues = (formValues.filters || []).map((f) => {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = f == null ? void 0 : f.column) == null ? void 0 : _a.value;
|
|
58
|
+
}).filter(Boolean);
|
|
59
|
+
return convertToOptions(colDefs || []).filter((opt) => !selectedValues.includes(opt.value));
|
|
60
|
+
}, [colDefs, formValues.filters]);
|
|
61
|
+
const [hasInitializedWithColumnId, setHasInitializedWithColumnId] = useState(false);
|
|
62
|
+
const prevIsAdvanceSearchRef = React__default.useRef(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const isOpening = isAdvanceSearch && !prevIsAdvanceSearchRef.current;
|
|
65
|
+
if (isOpening && initialFilters !== void 0) {
|
|
66
|
+
const validInitialFilters = (initialFilters || []).filter((f) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = f == null ? void 0 : f.column) == null ? void 0 : _a.value;
|
|
69
|
+
});
|
|
70
|
+
reset({
|
|
71
|
+
filters: validInitialFilters.length > 0 ? validInitialFilters : [filterInitialValues]
|
|
72
|
+
});
|
|
73
|
+
setHasInitializedWithColumnId(false);
|
|
74
|
+
}
|
|
75
|
+
prevIsAdvanceSearchRef.current = isAdvanceSearch;
|
|
76
|
+
}, [isAdvanceSearch, initialFilters, reset]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
if (isAdvanceSearch && currentColumnId && !hasInitializedWithColumnId && initialFilters) {
|
|
80
|
+
const hasValidFilters = initialFilters.some(
|
|
81
|
+
(f) => {
|
|
82
|
+
var _a2, _b2, _c;
|
|
83
|
+
return ((_a2 = f == null ? void 0 : f.column) == null ? void 0 : _a2.value) && ((_b2 = f == null ? void 0 : f.column) == null ? void 0 : _b2.value) !== null && ((_c = f == null ? void 0 : f.column) == null ? void 0 : _c.value) !== "";
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
if (!hasValidFilters) {
|
|
87
|
+
const formValues2 = getValues();
|
|
88
|
+
const existingFilters = formValues2.filters || [];
|
|
89
|
+
const columnExists = existingFilters.some(
|
|
90
|
+
(filter) => {
|
|
91
|
+
var _a2;
|
|
92
|
+
return ((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) === currentColumnId;
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
if (!columnExists) {
|
|
96
|
+
const columnOption = convertToOptions(colDefs || []).find(
|
|
97
|
+
(opt) => opt.value === currentColumnId
|
|
98
|
+
);
|
|
99
|
+
if (columnOption) {
|
|
100
|
+
if (existingFilters.length > 0 && !((_b = (_a = existingFilters[0]) == null ? void 0 : _a.column) == null ? void 0 : _b.value)) {
|
|
101
|
+
setValue(`filters.0.column`, columnOption);
|
|
102
|
+
} else {
|
|
103
|
+
append({
|
|
104
|
+
column: columnOption,
|
|
105
|
+
operation: null,
|
|
106
|
+
value: null
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
setHasInitializedWithColumnId(true);
|
|
113
|
+
}
|
|
114
|
+
}, [
|
|
115
|
+
isAdvanceSearch,
|
|
116
|
+
currentColumnId,
|
|
117
|
+
colDefs,
|
|
118
|
+
getValues,
|
|
119
|
+
setValue,
|
|
120
|
+
append,
|
|
121
|
+
hasInitializedWithColumnId,
|
|
122
|
+
initialFilters
|
|
123
|
+
]);
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (!isAdvanceSearch) {
|
|
126
|
+
setHasInitializedWithColumnId(false);
|
|
127
|
+
}
|
|
128
|
+
}, [isAdvanceSearch]);
|
|
129
|
+
const onCloseModal = () => {
|
|
130
|
+
toggleAdvanceSearch();
|
|
131
|
+
};
|
|
132
|
+
const handleSearchApplyClick = () => {
|
|
133
|
+
const formValues2 = formMethods.getValues().filters || [];
|
|
134
|
+
const validFilters = formValues2.filter((filter) => {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
136
|
+
const hasColumn = ((_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) !== "";
|
|
137
|
+
if (activeSearchType === "advanceSearch") {
|
|
138
|
+
return hasColumn && ((_d = filter == null ? void 0 : filter.operation) == null ? void 0 : _d.value) && ((_e = filter == null ? void 0 : filter.operation) == null ? void 0 : _e.value) !== null && ((_f = filter == null ? void 0 : filter.operation) == null ? void 0 : _f.value) !== "";
|
|
139
|
+
}
|
|
140
|
+
return hasColumn;
|
|
141
|
+
});
|
|
142
|
+
onSearchApplyClick(validFilters);
|
|
143
|
+
};
|
|
144
|
+
const onClearAttributeValue = () => {
|
|
145
|
+
const updatedFilters = formMethods.getValues().filters.map((filter) => ({ ...filter, value: null }));
|
|
146
|
+
formMethods.reset({
|
|
147
|
+
filters: updatedFilters
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const onClearAll = () => {
|
|
151
|
+
formMethods.reset({
|
|
152
|
+
filters: [filterInitialValues]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
156
|
+
Modal,
|
|
157
|
+
{
|
|
158
|
+
className: "ia-table-search-modal",
|
|
159
|
+
height: 400,
|
|
160
|
+
open: isAdvanceSearch,
|
|
161
|
+
primaryButtonLabel: "Apply",
|
|
162
|
+
primaryButtonProps: {
|
|
163
|
+
type: "submit"
|
|
164
|
+
// disabled: !isFormValid,
|
|
165
|
+
},
|
|
166
|
+
secondaryButtonLabel: args.onSearchSaveClick ? "Save search" : null,
|
|
167
|
+
secondaryButtonProps: {
|
|
168
|
+
disabled: !isFormValid
|
|
169
|
+
},
|
|
170
|
+
size: "small",
|
|
171
|
+
title: "Search",
|
|
172
|
+
width: 850,
|
|
173
|
+
onClose: onCloseModal,
|
|
174
|
+
onPrimaryButtonClick: handleSearchApplyClick,
|
|
175
|
+
onSecondaryButtonClick: (e) => {
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
onCloseModal();
|
|
178
|
+
},
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsxs("div", { className: "ia-table-search-header", children: [
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
ButtonGroup,
|
|
183
|
+
{
|
|
184
|
+
options: [
|
|
185
|
+
{
|
|
186
|
+
label: "Search",
|
|
187
|
+
value: "search"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: "Advance Search",
|
|
191
|
+
value: "advanceSearch"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
selectedOption: activeSearchType,
|
|
195
|
+
onChange: (e, val) => {
|
|
196
|
+
var _a, _b;
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
onChangeSearchType(e, val);
|
|
199
|
+
(_b = (_a = actualRef == null ? void 0 : actualRef.current) == null ? void 0 : _a.api) == null ? void 0 : _b.destroyFilter(null);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
Button,
|
|
205
|
+
{
|
|
206
|
+
size: "small",
|
|
207
|
+
type: "button",
|
|
208
|
+
variant: "url",
|
|
209
|
+
onClick: (e) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
onClearAll();
|
|
212
|
+
},
|
|
213
|
+
children: "Clear all"
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ jsxs(
|
|
218
|
+
"form",
|
|
219
|
+
{
|
|
220
|
+
className: "ia-table-search-content",
|
|
221
|
+
onSubmit: (e) => {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
handleSearchApplyClick();
|
|
224
|
+
},
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsx("div", { className: "ia-table-search-content-title", children: "Match all of the following rules" }),
|
|
227
|
+
/* @__PURE__ */ jsx(Fragment, { children: fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
228
|
+
NewAdvanceSearchModalItem,
|
|
229
|
+
{
|
|
230
|
+
activeSearchType,
|
|
231
|
+
colDefs,
|
|
232
|
+
control,
|
|
233
|
+
currentColumnId,
|
|
234
|
+
field,
|
|
235
|
+
fields,
|
|
236
|
+
filteredColumnsInitialOptions,
|
|
237
|
+
getValues,
|
|
238
|
+
index,
|
|
239
|
+
isLastVisible: fields.length === 1,
|
|
240
|
+
remove
|
|
241
|
+
},
|
|
242
|
+
field.fieldId || field.id
|
|
243
|
+
)) }),
|
|
244
|
+
/* @__PURE__ */ jsxs("div", { className: "ia-table-search-content-footer", children: [
|
|
245
|
+
/* @__PURE__ */ jsx(
|
|
246
|
+
Button,
|
|
247
|
+
{
|
|
248
|
+
size: "large",
|
|
249
|
+
variant: "secondary",
|
|
250
|
+
onClick: onClearAttributeValue,
|
|
251
|
+
type: "button",
|
|
252
|
+
children: "Clear values"
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ jsx(
|
|
256
|
+
Button,
|
|
257
|
+
{
|
|
258
|
+
icon: /* @__PURE__ */ jsx(AddOutlined, {}),
|
|
259
|
+
size: "large",
|
|
260
|
+
type: "button",
|
|
261
|
+
onClick: () => {
|
|
262
|
+
append({
|
|
263
|
+
column: null,
|
|
264
|
+
operation: null,
|
|
265
|
+
value: null
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
variant: "tertiary",
|
|
269
|
+
children: "Add attribute"
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] })
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
export {
|
|
281
|
+
NewAdvanceSearchModal as default
|
|
282
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const NewAdvanceSearchModalItem: ({ colDefs, control, index, field, remove, filteredColumnsInitialOptions, activeSearchType, isLastVisible, currentColumnId, getValues, fields, ...args }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
colDefs: any;
|
|
4
|
+
control: any;
|
|
5
|
+
index: any;
|
|
6
|
+
field: any;
|
|
7
|
+
remove: any;
|
|
8
|
+
filteredColumnsInitialOptions: any;
|
|
9
|
+
activeSearchType: any;
|
|
10
|
+
isLastVisible: any;
|
|
11
|
+
currentColumnId: any;
|
|
12
|
+
getValues: any;
|
|
13
|
+
fields: any;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default NewAdvanceSearchModalItem;
|
|
16
|
+
//# sourceMappingURL=NewAdvanceSearchModalItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewAdvanceSearchModalItem.d.ts","sourceRoot":"","sources":["../../../../src/components/TableV36/NewAdvanceSearchModal/NewAdvanceSearchModalItem.tsx"],"names":[],"mappings":"AAsBA,QAAA,MAAM,yBAAyB,GAAI;;;;;;;;;;;;;CAalC,4CA4ZA,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import default_1 from "../../../node_modules/@mui/icons-material/DeleteOutlineOutlined.js";
|
|
4
|
+
import moment from "moment";
|
|
5
|
+
import { useController } from "react-hook-form";
|
|
6
|
+
import { convertToOptions } from "../../../utils/helper.js";
|
|
7
|
+
import { Button } from "../../Button/index.js";
|
|
8
|
+
import { DatePicker } from "../../DatePicker/index.js";
|
|
9
|
+
import { DateRangePicker } from "../../DateRangePicker/index.js";
|
|
10
|
+
import { Input } from "../../Input/index.js";
|
|
11
|
+
import { Select } from "../../Select/index.js";
|
|
12
|
+
import { findColumnDef, getOperatorListForColumn, getDefaultOperationForColumn } from "../filterUtils.js";
|
|
13
|
+
const NewAdvanceSearchModalItem = ({
|
|
14
|
+
colDefs,
|
|
15
|
+
control,
|
|
16
|
+
index,
|
|
17
|
+
field,
|
|
18
|
+
remove,
|
|
19
|
+
filteredColumnsInitialOptions,
|
|
20
|
+
activeSearchType,
|
|
21
|
+
isLastVisible,
|
|
22
|
+
currentColumnId,
|
|
23
|
+
getValues,
|
|
24
|
+
fields,
|
|
25
|
+
...args
|
|
26
|
+
}) => {
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
const [isColumnOptionsOpen, setIsColumnOptionsOpen] = useState(false);
|
|
29
|
+
const [isOperationOptionsOpen, setIsOperationOptionsOpen] = useState(false);
|
|
30
|
+
const [isThirdOptionDropdownOpen, setIsThirdOptionDropdownOpen] = useState(false);
|
|
31
|
+
const [currentOperationOptions, setCurrentOperationOptions] = useState([]);
|
|
32
|
+
const [currentThirdOptionDropdownOptions, setCurrentThirdOptionDropdownOptions] = useState([]);
|
|
33
|
+
const [currentColumnDef, setCurrentColumnDef] = useState(null);
|
|
34
|
+
const [isSelectAll, setIsSelectAll] = useState(false);
|
|
35
|
+
const { field: columnField } = useController({
|
|
36
|
+
name: `filters.${index}.column`,
|
|
37
|
+
control,
|
|
38
|
+
rules: {
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const { field: operationField } = useController({
|
|
43
|
+
name: `filters.${index}.operation`,
|
|
44
|
+
control,
|
|
45
|
+
rules: { required: activeSearchType !== "advanceSearch" && true }
|
|
46
|
+
});
|
|
47
|
+
const { field: valueField } = useController({
|
|
48
|
+
name: `filters.${index}.value`,
|
|
49
|
+
control,
|
|
50
|
+
rules: {
|
|
51
|
+
required: true
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
var _a2;
|
|
56
|
+
if (!((_a2 = columnField.value) == null ? void 0 : _a2.value)) return;
|
|
57
|
+
const columnDef = findColumnDef(colDefs, columnField.value.value);
|
|
58
|
+
setCurrentColumnDef(columnDef);
|
|
59
|
+
const operatorList = getOperatorListForColumn(columnDef);
|
|
60
|
+
setCurrentOperationOptions(operatorList);
|
|
61
|
+
const shouldAutoSelect = activeSearchType === "advanceSearch" && (operatorList == null ? void 0 : operatorList.length) > 0 && !operationField.value;
|
|
62
|
+
if (shouldAutoSelect) {
|
|
63
|
+
const defaultOperation = getDefaultOperationForColumn(columnDef);
|
|
64
|
+
operationField.onChange(defaultOperation);
|
|
65
|
+
}
|
|
66
|
+
}, [columnField.value, colDefs, activeSearchType]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
var _a2;
|
|
69
|
+
if ((currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDropdown) && operationField.value) {
|
|
70
|
+
if (currentColumnDef.toShowDuplicateColumnInAdvanceSearch) {
|
|
71
|
+
const currentOptions = ((_a2 = currentColumnDef.currentColumnField) == null ? void 0 : _a2.endsWith("1")) ? currentColumnDef.thirdOptionDropdownOptions1 : currentColumnDef.thirdOptionDropdownOptions2;
|
|
72
|
+
setCurrentThirdOptionDropdownOptions(currentOptions);
|
|
73
|
+
} else {
|
|
74
|
+
setCurrentThirdOptionDropdownOptions(currentColumnDef.thirdOptionDropdownOptions);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [currentColumnDef, operationField]);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (activeSearchType === "search" && !operationField.value && columnField.value && currentOperationOptions.length > 0) {
|
|
80
|
+
if (currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDateRangePicker) {
|
|
81
|
+
operationField.onChange({ label: "In range", value: "inRange" });
|
|
82
|
+
} else if ((currentColumnDef == null ? void 0 : currentColumnDef.filter) === "agDateColumnFilter") {
|
|
83
|
+
const equalsOption = currentOperationOptions.find((opt) => opt.value === "equals");
|
|
84
|
+
if (equalsOption) {
|
|
85
|
+
operationField.onChange(equalsOption);
|
|
86
|
+
} else {
|
|
87
|
+
operationField.onChange(currentOperationOptions[0]);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
const containsOption = currentOperationOptions.find((opt) => opt.value === "contains");
|
|
91
|
+
if (containsOption) {
|
|
92
|
+
operationField.onChange(containsOption);
|
|
93
|
+
} else {
|
|
94
|
+
operationField.onChange(currentOperationOptions[0]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, [columnField.value, currentOperationOptions, activeSearchType, currentColumnDef]);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
var _a2;
|
|
101
|
+
if (currentColumnId && index === 0 && // Only auto-select for the first filter
|
|
102
|
+
!columnField.value && ((_a2 = columnField.value) == null ? void 0 : _a2.value) !== currentColumnId) {
|
|
103
|
+
const columnOption = filteredColumnsInitialOptions == null ? void 0 : filteredColumnsInitialOptions.find(
|
|
104
|
+
(opt) => opt.value === currentColumnId
|
|
105
|
+
);
|
|
106
|
+
const allOptions = convertToOptions(colDefs || []);
|
|
107
|
+
const columnOptionFromAll = allOptions.find((opt) => opt.value === currentColumnId);
|
|
108
|
+
const optionToSelect = columnOption || columnOptionFromAll;
|
|
109
|
+
if (optionToSelect) {
|
|
110
|
+
columnField.onChange(optionToSelect);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, [currentColumnId, index, columnField.value, filteredColumnsInitialOptions, colDefs]);
|
|
114
|
+
const handleClickOutside = (event) => {
|
|
115
|
+
if (isColumnOptionsOpen || isThirdOptionDropdownOpen || isOperationOptionsOpen && !event.target.closest(".ia-table-search-content-body")) {
|
|
116
|
+
setIsColumnOptionsOpen(false);
|
|
117
|
+
setIsOperationOptionsOpen(false);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
document.addEventListener("click", handleClickOutside);
|
|
122
|
+
return () => {
|
|
123
|
+
document.removeEventListener("click", handleClickOutside);
|
|
124
|
+
};
|
|
125
|
+
}, [isColumnOptionsOpen, isThirdOptionDropdownOpen, isOperationOptionsOpen]);
|
|
126
|
+
return /* @__PURE__ */ jsxs("div", { className: "ia-table-search-content-body", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", flex: 1 }, children: /* @__PURE__ */ jsx(
|
|
128
|
+
Select,
|
|
129
|
+
{
|
|
130
|
+
currentOptions: filteredColumnsInitialOptions || [],
|
|
131
|
+
initialOptions: filteredColumnsInitialOptions || [],
|
|
132
|
+
isOpen: isColumnOptionsOpen,
|
|
133
|
+
minWidth: activeSearchType !== "advanceSearch" ? 400 : void 0,
|
|
134
|
+
name: `filters.${index}.column`,
|
|
135
|
+
placeholder: "Select",
|
|
136
|
+
selectedOptions: columnField.value || null,
|
|
137
|
+
setCurrentOptions: () => {
|
|
138
|
+
},
|
|
139
|
+
setIsOpen: setIsColumnOptionsOpen,
|
|
140
|
+
setSelectedOptions: (option) => {
|
|
141
|
+
if (option && getValues) {
|
|
142
|
+
const formValues = getValues();
|
|
143
|
+
const existingFilters = (formValues == null ? void 0 : formValues.filters) || [];
|
|
144
|
+
const isDuplicate = existingFilters.some(
|
|
145
|
+
(filter, idx) => {
|
|
146
|
+
var _a2, _b2, _c2;
|
|
147
|
+
return idx !== index && ((_a2 = filter == null ? void 0 : filter.column) == null ? void 0 : _a2.value) === option.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) !== "";
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
if (isDuplicate) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
columnField.onChange(option);
|
|
155
|
+
operationField.onChange(null);
|
|
156
|
+
valueField.onChange("");
|
|
157
|
+
},
|
|
158
|
+
withPortal: true,
|
|
159
|
+
onClick: (e) => {
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
) }),
|
|
165
|
+
activeSearchType === "advanceSearch" && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", flex: 1 }, children: /* @__PURE__ */ jsx(
|
|
166
|
+
Select,
|
|
167
|
+
{
|
|
168
|
+
currentOptions: currentOperationOptions,
|
|
169
|
+
disabled: !columnField.value,
|
|
170
|
+
initialOptions: currentOperationOptions,
|
|
171
|
+
isDisabled: (currentColumnDef == null ? void 0 : currentColumnDef.isThirdOptionDropdownIsBoolean) || (currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDateRangePicker) ? true : !columnField.value,
|
|
172
|
+
isOpen: isOperationOptionsOpen,
|
|
173
|
+
name: `filters.${index}.operation`,
|
|
174
|
+
placeholder: "Select",
|
|
175
|
+
selectedOptions: operationField.value || null,
|
|
176
|
+
setCurrentOptions: setCurrentOperationOptions,
|
|
177
|
+
setIsOpen: setIsOperationOptionsOpen,
|
|
178
|
+
setSelectedOptions: (option) => {
|
|
179
|
+
operationField.onChange(option);
|
|
180
|
+
},
|
|
181
|
+
withPortal: true,
|
|
182
|
+
onClick: (e) => {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
) }),
|
|
188
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", flex: 1 }, children: (currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDropdown) ? /* @__PURE__ */ jsx(
|
|
189
|
+
Select,
|
|
190
|
+
{
|
|
191
|
+
currentOptions: currentThirdOptionDropdownOptions,
|
|
192
|
+
initialOptions: currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionDropdownOptions,
|
|
193
|
+
isDisabled: !operationField.value,
|
|
194
|
+
isMulti: currentColumnDef == null ? void 0 : currentColumnDef.enableMultiSelect,
|
|
195
|
+
isOpen: isThirdOptionDropdownOpen,
|
|
196
|
+
isSelectAll,
|
|
197
|
+
isWithSearch: currentColumnDef == null ? void 0 : currentColumnDef.enableSearch,
|
|
198
|
+
minWidth: activeSearchType !== "advanceSearch" ? 344 : void 0,
|
|
199
|
+
name: `filters.${index}.value`,
|
|
200
|
+
placeholder: "Select value",
|
|
201
|
+
selectedOptions: (valueField == null ? void 0 : valueField.value) || [],
|
|
202
|
+
setCurrentOptions: setCurrentThirdOptionDropdownOptions,
|
|
203
|
+
setIsOpen: setIsThirdOptionDropdownOpen,
|
|
204
|
+
setSelectedOptions: (option) => {
|
|
205
|
+
valueField.onChange(option);
|
|
206
|
+
},
|
|
207
|
+
toggleSelectAll: currentColumnDef == null ? void 0 : currentColumnDef.enableMultiSelect,
|
|
208
|
+
withPortal: true,
|
|
209
|
+
onClick: (e) => {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
},
|
|
213
|
+
setIsSelectAll
|
|
214
|
+
}
|
|
215
|
+
) : (currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDatePicker) || (currentColumnDef == null ? void 0 : currentColumnDef.filter) === "agDateColumnFilter" && !currentColumnDef.thirdOptionAsDateRangePicker ? /* @__PURE__ */ jsx(
|
|
216
|
+
DatePicker,
|
|
217
|
+
{
|
|
218
|
+
fullWidth: true,
|
|
219
|
+
showMonthYearSelect: true,
|
|
220
|
+
displayFormat: currentColumnDef.displayFormat || "MM-DD-YYYY",
|
|
221
|
+
isDisabled: !operationField.value,
|
|
222
|
+
name: `filters.${index}.value`,
|
|
223
|
+
placeholder: "Select date",
|
|
224
|
+
selectedDate: valueField.value ? moment(valueField.value) : void 0,
|
|
225
|
+
setSelectedDate: (date) => {
|
|
226
|
+
valueField.onChange(date);
|
|
227
|
+
},
|
|
228
|
+
withPortal: true,
|
|
229
|
+
...currentColumnDef.thirdOptionAsDatePickerProps
|
|
230
|
+
}
|
|
231
|
+
) : (currentColumnDef == null ? void 0 : currentColumnDef.thirdOptionAsDateRangePicker) ? /* @__PURE__ */ jsx(
|
|
232
|
+
DateRangePicker,
|
|
233
|
+
{
|
|
234
|
+
fullWidth: true,
|
|
235
|
+
endDate: ((_a = valueField.value) == null ? void 0 : _a.endDate) ? moment.isMoment(valueField.value.endDate) ? valueField.value.endDate : moment(valueField.value.endDate) : ((_b = currentColumnDef.thirdOptionAsDateRangePickerProps) == null ? void 0 : _b.endDate) ? moment.isMoment(currentColumnDef.thirdOptionAsDateRangePickerProps.endDate) ? currentColumnDef.thirdOptionAsDateRangePickerProps.endDate : moment(currentColumnDef.thirdOptionAsDateRangePickerProps.endDate) : null,
|
|
236
|
+
handleDatesChange: (startDate, endDate) => {
|
|
237
|
+
const formattedValue = {
|
|
238
|
+
startDate: startDate ? moment.isMoment(startDate) ? startDate : moment(startDate) : null,
|
|
239
|
+
endDate: endDate ? moment.isMoment(endDate) ? endDate : moment(endDate) : null
|
|
240
|
+
};
|
|
241
|
+
valueField.onChange(formattedValue);
|
|
242
|
+
},
|
|
243
|
+
isDisabled: !operationField.value,
|
|
244
|
+
name: `filters.${index}.value`,
|
|
245
|
+
setEndDate: () => {
|
|
246
|
+
},
|
|
247
|
+
setStartDate: () => {
|
|
248
|
+
},
|
|
249
|
+
startDate: ((_c = valueField.value) == null ? void 0 : _c.startDate) ? moment.isMoment(valueField.value.startDate) ? valueField.value.startDate : moment(valueField.value.startDate) : ((_d = currentColumnDef.thirdOptionAsDateRangePickerProps) == null ? void 0 : _d.startDate) ? moment.isMoment(currentColumnDef.thirdOptionAsDateRangePickerProps.startDate) ? currentColumnDef.thirdOptionAsDateRangePickerProps.startDate : moment(currentColumnDef.thirdOptionAsDateRangePickerProps.startDate) : null,
|
|
250
|
+
withPortal: true,
|
|
251
|
+
onResetClick: () => {
|
|
252
|
+
valueField.onChange({ startDate: null, endDate: null });
|
|
253
|
+
},
|
|
254
|
+
...(() => {
|
|
255
|
+
const {
|
|
256
|
+
startDate: _,
|
|
257
|
+
endDate: __,
|
|
258
|
+
...restProps
|
|
259
|
+
} = currentColumnDef.thirdOptionAsDateRangePickerProps || {};
|
|
260
|
+
return restProps;
|
|
261
|
+
})()
|
|
262
|
+
}
|
|
263
|
+
) : /* @__PURE__ */ jsx(
|
|
264
|
+
Input,
|
|
265
|
+
{
|
|
266
|
+
isDisabled: activeSearchType === "advanceSearch" && !operationField.value,
|
|
267
|
+
name: `filters.${index}.value`,
|
|
268
|
+
placeholder: "Enter text",
|
|
269
|
+
value: valueField.value || "",
|
|
270
|
+
onChange: (e) => {
|
|
271
|
+
valueField.onChange(e.target.value);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
) }),
|
|
275
|
+
/* @__PURE__ */ jsx(
|
|
276
|
+
Button,
|
|
277
|
+
{
|
|
278
|
+
disabled: isLastVisible,
|
|
279
|
+
size: "large",
|
|
280
|
+
type: "button",
|
|
281
|
+
variant: "tertiary",
|
|
282
|
+
onClick: (e) => {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
const fieldId = (field == null ? void 0 : field.fieldId) || (field == null ? void 0 : field.id);
|
|
286
|
+
if (fieldId !== void 0) {
|
|
287
|
+
const actualIndex = fields.findIndex((f) => (f.fieldId || f.id) === fieldId);
|
|
288
|
+
if (actualIndex !== -1) {
|
|
289
|
+
remove(actualIndex);
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
remove(index);
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
children: /* @__PURE__ */ jsx(default_1, {})
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
};
|
|
300
|
+
export {
|
|
301
|
+
NewAdvanceSearchModalItem as default
|
|
302
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const NoComments: ({ onAddComment, cellId, position, isInsidePortal, editCommentText, isLoading, error, onClearError, isEditFlow, onUpdateComment, setEditingComment, loadParticipantsAvatar, }: {
|
|
2
|
+
onAddComment: any;
|
|
3
|
+
cellId: any;
|
|
4
|
+
position: any;
|
|
5
|
+
isInsidePortal?: boolean | undefined;
|
|
6
|
+
editCommentText?: string | undefined;
|
|
7
|
+
isLoading?: boolean | undefined;
|
|
8
|
+
error?: null | undefined;
|
|
9
|
+
onClearError: any;
|
|
10
|
+
isEditFlow: any;
|
|
11
|
+
onUpdateComment: any;
|
|
12
|
+
setEditingComment: any;
|
|
13
|
+
loadParticipantsAvatar: any;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default NoComments;
|
|
16
|
+
//# sourceMappingURL=NoComments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoComments.d.ts","sourceRoot":"","sources":["../../../src/components/TableV36/NoComments.tsx"],"names":[],"mappings":"AA4CA,QAAA,MAAM,UAAU,GAAI;;;;;;;;;;;;;CAanB,4CAuOA,CAAC;AAEF,eAAe,UAAU,CAAC"}
|