impact-nova 0.1.5 → 0.1.8
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/LICENSE +21 -0
- package/dist/components/ui/ag-grid-react/headers/header-search-input.d.ts +3 -1
- package/dist/components/ui/ag-grid-react/headers/header-search-input.js +39 -37
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +4 -1
- package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +199 -195
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/date-picker/date-picker.js +19 -18
- package/dist/components/ui/date-picker/date-range-picker.js +9 -8
- package/dist/components/ui/date-picker/month-picker.js +41 -40
- package/dist/components/ui/date-picker/month-range-picker.js +17 -16
- package/dist/components/ui/date-picker/multi-date-picker.js +38 -37
- package/dist/components/ui/date-picker/multi-month-picker.js +30 -29
- package/dist/components/ui/date-picker/multi-week-picker.js +21 -20
- package/dist/components/ui/date-picker/week-picker.js +26 -25
- package/dist/components/ui/date-picker/week-range-picker.js +17 -16
- package/package.json +56 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Impact Analytics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -18,6 +18,8 @@ export interface HeaderSearchInputProps {
|
|
|
18
18
|
onSelectSearchChange?: (value: string) => void;
|
|
19
19
|
onSelectOpen?: () => void;
|
|
20
20
|
isLoadingSelect?: boolean;
|
|
21
|
+
enableSpaceSplitting?: boolean;
|
|
22
|
+
enableBooleanParsing?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* HeaderSearchInput - A single instance input for column filtering.
|
|
@@ -25,5 +27,5 @@ export interface HeaderSearchInputProps {
|
|
|
25
27
|
* ZERO HOOKS SYNC: This component reads its state directly from AG Grid on mount.
|
|
26
28
|
* It does not use useEffect to sync with external state, as the Grid API is the source of truth.
|
|
27
29
|
*/
|
|
28
|
-
export declare const HeaderSearchInput: ({ column, api, onClose, handleInlineSearch, handleClearSearchInline, onAdvanceSearchClick, toggleAdvanceSearch, advanceSearchEnabled, selectOptions, isMultiSelect, onSelectScrollToBottom, onSelectSearchChange, onSelectOpen, isLoadingSelect, }: HeaderSearchInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const HeaderSearchInput: ({ column, api, onClose, handleInlineSearch, handleClearSearchInline, onAdvanceSearchClick, toggleAdvanceSearch, advanceSearchEnabled, selectOptions, isMultiSelect, onSelectScrollToBottom, onSelectSearchChange, onSelectOpen, isLoadingSelect, enableSpaceSplitting, enableBooleanParsing, }: HeaderSearchInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
31
|
export default HeaderSearchInput;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as y, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Filter as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { useRef as be, useState as I, useEffect as De, useCallback as Ne } from "react";
|
|
3
|
+
import { Filter as Ae } from "lucide-react";
|
|
4
|
+
import { cn as Se } from "../../../../lib/utils.js";
|
|
5
5
|
import { DatePicker as oe } from "../../date-picker/date-picker.js";
|
|
6
6
|
import { Input as ie } from "../../input.js";
|
|
7
7
|
import se from "../../select/select.js";
|
|
8
|
-
import { Popover as
|
|
8
|
+
import { Popover as we, PopoverTrigger as Ie, PopoverContent as Pe, PopoverHeader as qe, PopoverTitle as ze, PopoverBody as Be } from "../../popover.js";
|
|
9
9
|
import { Cross as ae } from "../../../../icons/index.js";
|
|
10
|
-
import { useGridHeader as
|
|
11
|
-
import { getMultiFilterIndices as C, getDisplayStringFromFilterModel as P, parseInputPattern as
|
|
10
|
+
import { useGridHeader as Ee } from "./context/grid-header-context.js";
|
|
11
|
+
import { getMultiFilterIndices as C, getDisplayStringFromFilterModel as P, parseInputPattern as He } from "./utils/filter-utils.js";
|
|
12
12
|
import { deserializeDate as M, serializeDate as ce } from "./utils/date-utils.js";
|
|
13
|
-
const
|
|
13
|
+
const ke = {
|
|
14
14
|
contains: "contains",
|
|
15
15
|
notContains: "notContains",
|
|
16
16
|
equals: "equals",
|
|
@@ -24,7 +24,7 @@ const Ee = {
|
|
|
24
24
|
inRange: "inRange",
|
|
25
25
|
empty: "blank",
|
|
26
26
|
notEmpty: "notBlank"
|
|
27
|
-
},
|
|
27
|
+
}, Ye = ({
|
|
28
28
|
column: D,
|
|
29
29
|
api: d,
|
|
30
30
|
onClose: W,
|
|
@@ -38,9 +38,11 @@ const Ee = {
|
|
|
38
38
|
onSelectScrollToBottom: fe,
|
|
39
39
|
onSelectSearchChange: ue,
|
|
40
40
|
onSelectOpen: V,
|
|
41
|
-
isLoadingSelect: J
|
|
41
|
+
isLoadingSelect: J,
|
|
42
|
+
enableSpaceSplitting: he = !1,
|
|
43
|
+
enableBooleanParsing: me = !1
|
|
42
44
|
}) => {
|
|
43
|
-
const c = D.getColDef(), o = D.getColId(), z = c?.filter || "agTextColumnFilter", p = z === "agDateColumnFilter", B = z === "agSetColumnFilter" || q && q.length > 0 || c?.cellDataType === "boolean", K =
|
|
45
|
+
const c = D.getColDef(), o = D.getColId(), z = c?.filter || "agTextColumnFilter", p = z === "agDateColumnFilter", B = z === "agSetColumnFilter" || q && q.length > 0 || c?.cellDataType === "boolean", K = Ee(), E = be(null), [H, k] = I(() => {
|
|
44
46
|
const t = d.getFilterModel()[o];
|
|
45
47
|
if (!t) return "";
|
|
46
48
|
if (t.filterType === "multi" && t.filterModels) {
|
|
@@ -52,7 +54,7 @@ const Ee = {
|
|
|
52
54
|
return "";
|
|
53
55
|
}
|
|
54
56
|
return p ? "" : P(o, t);
|
|
55
|
-
}), [
|
|
57
|
+
}), [pe, u] = I(!1), [Q, R] = I(() => {
|
|
56
58
|
const t = d.getFilterModel()[o];
|
|
57
59
|
if (t) {
|
|
58
60
|
if (t.filterType === "multi" && t.filterModels) {
|
|
@@ -72,7 +74,7 @@ const Ee = {
|
|
|
72
74
|
}
|
|
73
75
|
return null;
|
|
74
76
|
});
|
|
75
|
-
|
|
77
|
+
De(() => {
|
|
76
78
|
const e = () => {
|
|
77
79
|
const l = d.getFilterModel()[o];
|
|
78
80
|
let r = "";
|
|
@@ -84,7 +86,7 @@ const Ee = {
|
|
|
84
86
|
r = f ? P(o, f) : "";
|
|
85
87
|
}
|
|
86
88
|
} else p || (r = P(o, l));
|
|
87
|
-
|
|
89
|
+
pe || k((n) => n !== r ? r : n);
|
|
88
90
|
let m = null;
|
|
89
91
|
if (l)
|
|
90
92
|
if (l.filterType === "multi" && l.filterModels) {
|
|
@@ -102,14 +104,14 @@ const Ee = {
|
|
|
102
104
|
}, [d, o, p]);
|
|
103
105
|
const U = (e, t) => {
|
|
104
106
|
const r = { ...d.getFilterModel() }, m = (n, a) => {
|
|
105
|
-
const f =
|
|
107
|
+
const f = He(n, he, me);
|
|
106
108
|
if (console.log("[HeaderSearchInput] Pattern Debug:", {
|
|
107
109
|
input: n,
|
|
108
110
|
filterType: a,
|
|
109
111
|
parsed: f
|
|
110
112
|
}), f.conditions.length === 0) return null;
|
|
111
113
|
const b = (s) => {
|
|
112
|
-
let F =
|
|
114
|
+
let F = ke[s.operator] || "contains";
|
|
113
115
|
if (a === "number") {
|
|
114
116
|
const ne = parseFloat(s.value);
|
|
115
117
|
return ["contains", "notContains", "startsWith", "endsWith"].includes(F) && (F = F === "notContains" ? "notEqual" : "equals"), s.operator === "inRange" ? {
|
|
@@ -181,11 +183,11 @@ const Ee = {
|
|
|
181
183
|
k(t), O(t);
|
|
182
184
|
}, Y = (e) => {
|
|
183
185
|
R(e), O(e);
|
|
184
|
-
},
|
|
186
|
+
}, ge = () => {
|
|
185
187
|
k(""), R(null), O(""), G && G();
|
|
186
188
|
}, A = (e) => {
|
|
187
189
|
U(e, "set");
|
|
188
|
-
}, S = q || (c?.cellDataType === "boolean" ? [{ label: "True", value: "true" }, { label: "False", value: "false" }] : []), Z =
|
|
190
|
+
}, S = q || (c?.cellDataType === "boolean" ? [{ label: "True", value: "true" }, { label: "False", value: "false" }] : []), Z = Ne(() => {
|
|
189
191
|
const e = d.getFilterModel()[o];
|
|
190
192
|
if (!e) return [];
|
|
191
193
|
if ("filterType" in e && e.filterType === "multi" && e.filterModels) {
|
|
@@ -211,9 +213,9 @@ const Ee = {
|
|
|
211
213
|
return;
|
|
212
214
|
}
|
|
213
215
|
N(t);
|
|
214
|
-
},
|
|
216
|
+
}, xe = () => {
|
|
215
217
|
A([]), N([]);
|
|
216
|
-
},
|
|
218
|
+
}, ye = (e) => {
|
|
217
219
|
if (v) {
|
|
218
220
|
if (e !== void 0) {
|
|
219
221
|
let t = [];
|
|
@@ -222,14 +224,14 @@ const Ee = {
|
|
|
222
224
|
}
|
|
223
225
|
w !== null && (A(w), N(null));
|
|
224
226
|
}
|
|
225
|
-
},
|
|
227
|
+
}, Fe = () => {
|
|
226
228
|
N(Z()), V && V();
|
|
227
|
-
},
|
|
229
|
+
}, Me = () => de ? /* @__PURE__ */ i("svg", { className: "cursor-pointer text-[#7a8294] hover:text-[#3649C6] shrink-0", fill: "currentColor", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", width: "18", height: "18", onClick: (e) => {
|
|
228
230
|
e.stopPropagation(), E.current && E.current.blur(), L ? L(D) : _ ? _(o) : K && K.openAdvancedFilter(o);
|
|
229
|
-
}, children: /* @__PURE__ */ i("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null,
|
|
231
|
+
}, children: /* @__PURE__ */ i("path", { d: "M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z" }) }) : null, ve = () => /* @__PURE__ */ i("button", { onClick: W, className: "cursor-pointer shrink-0 text-[#4259ee] hover:text-[#0f1c76]", children: /* @__PURE__ */ i(ae, { size: 12 }) }), T = c.filter === "agMultiColumnFilter", g = C(c);
|
|
230
232
|
let x = "text";
|
|
231
233
|
T ? x = g.set !== -1 ? "set" : g.date !== -1 ? "date" : "text" : B ? x = "set" : p && (x = "date");
|
|
232
|
-
const
|
|
234
|
+
const Ce = T ? g.text !== -1 || g.number !== -1 : !p && !B, te = T ? g.set !== -1 : B, le = T ? g.date !== -1 : p, Te = d.getFilterModel()[o], re = T && Te?.filterModels?.some((e, t) => {
|
|
233
235
|
const l = t === g.text || t === g.number ? "text" : t === g.set ? "set" : "date";
|
|
234
236
|
return e !== null && l !== x;
|
|
235
237
|
});
|
|
@@ -247,11 +249,11 @@ const Ee = {
|
|
|
247
249
|
menuWidth: "200px",
|
|
248
250
|
menuPortalTarget: document.body,
|
|
249
251
|
autoFocus: !0,
|
|
250
|
-
onMenuOpen:
|
|
251
|
-
onMenuClose:
|
|
252
|
+
onMenuOpen: Fe,
|
|
253
|
+
onMenuClose: ye,
|
|
252
254
|
onMenuScrollToBottom: fe,
|
|
253
255
|
onInputChange: ue,
|
|
254
|
-
onClearAll:
|
|
256
|
+
onClearAll: xe,
|
|
255
257
|
isLoading: J,
|
|
256
258
|
onFocus: () => u(!0),
|
|
257
259
|
onBlur: () => u(!1)
|
|
@@ -282,20 +284,20 @@ const Ee = {
|
|
|
282
284
|
onFocus: () => u(!0),
|
|
283
285
|
onBlur: () => u(!1),
|
|
284
286
|
suffix: H && /* @__PURE__ */ i("button", { onClick: (e) => {
|
|
285
|
-
e.stopPropagation(),
|
|
287
|
+
e.stopPropagation(), ge();
|
|
286
288
|
}, className: "cursor-pointer text-[#7a8294] hover:text-[#3649C6]", children: /* @__PURE__ */ i(ae, { size: 10 }) })
|
|
287
289
|
}
|
|
288
290
|
),
|
|
289
291
|
/* @__PURE__ */ y("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
290
|
-
T && /* @__PURE__ */ y(
|
|
291
|
-
/* @__PURE__ */ i(
|
|
292
|
-
/* @__PURE__ */ i(
|
|
292
|
+
T && /* @__PURE__ */ y(we, { children: [
|
|
293
|
+
/* @__PURE__ */ i(Ie, { asChild: !0, children: /* @__PURE__ */ y("div", { className: "relative group p-1 hover:bg-[#dbe0fb] rounded-md transition-colors cursor-pointer", children: [
|
|
294
|
+
/* @__PURE__ */ i(Ae, { size: 16, className: Se("text-[#60697D] group-hover:text-[#3649C6]", re && "text-[#3649C6]") }),
|
|
293
295
|
re && /* @__PURE__ */ i("span", { className: "absolute top-0.5 right-0.5 w-2 h-2 rounded-full bg-[#4259ee] border border-white shadow-sm" })
|
|
294
296
|
] }) }),
|
|
295
|
-
/* @__PURE__ */ y(
|
|
296
|
-
/* @__PURE__ */ i(
|
|
297
|
-
/* @__PURE__ */ y(
|
|
298
|
-
x !== "text" &&
|
|
297
|
+
/* @__PURE__ */ y(Pe, { align: "end", className: "w-[300px]", children: [
|
|
298
|
+
/* @__PURE__ */ i(qe, { children: /* @__PURE__ */ i(ze, { children: "Active Filters" }) }),
|
|
299
|
+
/* @__PURE__ */ y(Be, { className: "flex flex-col gap-4", children: [
|
|
300
|
+
x !== "text" && Ce && /* @__PURE__ */ y("div", { className: "flex flex-col gap-1.5", children: [
|
|
299
301
|
/* @__PURE__ */ i("span", { className: "text-xs font-semibold text-[#60697D]", children: "Text Search" }),
|
|
300
302
|
/* @__PURE__ */ i(
|
|
301
303
|
ie,
|
|
@@ -342,11 +344,11 @@ const Ee = {
|
|
|
342
344
|
] })
|
|
343
345
|
] })
|
|
344
346
|
] }),
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
Me(),
|
|
348
|
+
ve()
|
|
347
349
|
] })
|
|
348
350
|
] });
|
|
349
351
|
};
|
|
350
352
|
export {
|
|
351
|
-
|
|
353
|
+
Ye as HeaderSearchInput
|
|
352
354
|
};
|
|
@@ -42,9 +42,12 @@ export declare function getMultiFilterIndices(colDef: ColDef | undefined): {
|
|
|
42
42
|
* - Multiple patterns with AND: `fo+ au` or `fo +au` (plus separated)
|
|
43
43
|
* - Match all: `*` alone
|
|
44
44
|
*
|
|
45
|
+
* @param input - The search input string
|
|
46
|
+
* @param enableSpaceSplitting - If true, spaces split terms into multiple OR conditions. If false (default), preserves phrases like "Pratik Kumar"
|
|
47
|
+
* @param enableBooleanParsing - If true, boolean keywords parsed globally (e.g., "yes" → true). If false (default), only with '=' prefix (e.g., "=yes" → true)
|
|
45
48
|
* @returns ParsedInput with conditions array and logic
|
|
46
49
|
*/
|
|
47
|
-
export declare function parseInputPattern(input: string): ParsedInput;
|
|
50
|
+
export declare function parseInputPattern(input: string, enableSpaceSplitting?: boolean, enableBooleanParsing?: boolean): ParsedInput;
|
|
48
51
|
/**
|
|
49
52
|
* Convert ParsedInput to AdvancedFilterRule array for a specific column.
|
|
50
53
|
* Used to sync inline search input with the advanced filter modal.
|