@pibit.ai/cure-design-system 0.6.36 → 0.6.38
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +311 -288
- package/dist/patterns/condition-builder/condition-builder.d.ts.map +1 -1
- package/dist/patterns/condition-builder/condition-builder.js +47 -47
- package/dist/patterns/condition-builder/utils.d.ts.map +1 -1
- package/dist/patterns/filter-group/date-adapter.d.ts +20 -0
- package/dist/patterns/filter-group/date-adapter.d.ts.map +1 -0
- package/dist/patterns/filter-group/date-adapter.js +38 -0
- package/dist/patterns/filter-group/document-fields-to-tree.d.ts +33 -0
- package/dist/patterns/filter-group/document-fields-to-tree.d.ts.map +1 -0
- package/dist/patterns/filter-group/document-fields-to-tree.js +53 -0
- package/dist/patterns/filter-group/filter-condition-row.d.ts +47 -0
- package/dist/patterns/filter-group/filter-condition-row.d.ts.map +1 -0
- package/dist/patterns/filter-group/filter-condition-row.js +642 -0
- package/dist/patterns/filter-group/filter-group-builder.d.ts +42 -0
- package/dist/patterns/filter-group/filter-group-builder.d.ts.map +1 -0
- package/dist/patterns/filter-group/filter-group-builder.js +92 -0
- package/dist/patterns/filter-group/filter-group-card.d.ts +25 -0
- package/dist/patterns/filter-group/filter-group-card.d.ts.map +1 -0
- package/dist/patterns/filter-group/filter-group-card.js +266 -0
- package/dist/patterns/filter-group/index.d.ts +11 -0
- package/dist/patterns/filter-group/index.d.ts.map +1 -0
- package/dist/patterns/filter-group/nested-field-select.d.ts +68 -0
- package/dist/patterns/filter-group/nested-field-select.d.ts.map +1 -0
- package/dist/patterns/filter-group/nested-field-select.js +431 -0
- package/dist/patterns/filter-group/types.d.ts +105 -0
- package/dist/patterns/filter-group/types.d.ts.map +1 -0
- package/dist/patterns/filter-group/types.js +222 -0
- package/dist/patterns/filter-group/use-filter-group.d.ts +38 -0
- package/dist/patterns/filter-group/use-filter-group.d.ts.map +1 -0
- package/dist/patterns/filter-group/use-filter-group.js +81 -0
- package/dist/patterns/filter-group/validation.d.ts +13 -0
- package/dist/patterns/filter-group/validation.d.ts.map +1 -0
- package/dist/patterns/filter-group/validation.js +19 -0
- package/dist/styles/components.css +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-builder.d.ts","sourceRoot":"","sources":["../../../src/patterns/condition-builder/condition-builder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"condition-builder.d.ts","sourceRoot":"","sources":["../../../src/patterns/condition-builder/condition-builder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAwB5F,wBAAgB,gBAAgB,CAC5B,UAAU,EACV,KAAK,SAAS,UAAU,GAAG,iBAAiB,EAC5C,MAAM,SAAS,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,EAC5D,EACE,UAAU,EACV,YAAY,EACZ,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,kBAA0B,EAC1B,YAAkC,EAClC,eAAe,EACf,QAAY,EACZ,IAAW,EACX,eAA8B,EAC9B,cAA6B,EAC7B,mBAAwC,EACxC,kBAA0D,EAC1D,wBAAwB,EACxB,cAAsB,EACtB,kBAAkB,EAClB,SAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAA0B,EAC1B,gBAAgB,GACnB,EAAE,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,2CA6FlD;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as q } from "react";
|
|
3
3
|
import { Plus as x } from "@untitledui/icons";
|
|
4
|
-
import { ConditionGroup as
|
|
4
|
+
import { ConditionGroup as J } from "./condition-group.js";
|
|
5
5
|
import { AddActionButton as v } from "./add-action-button.js";
|
|
6
|
-
import { cx as
|
|
6
|
+
import { cx as N } from "../../utils/cn.js";
|
|
7
7
|
const o = {
|
|
8
8
|
sm: "text-xs",
|
|
9
9
|
md: "text-sm",
|
|
10
10
|
lg: "text-md"
|
|
11
|
-
},
|
|
11
|
+
}, S = {
|
|
12
12
|
sm: "size-4",
|
|
13
13
|
md: "size-5",
|
|
14
14
|
lg: "size-6"
|
|
15
|
-
};
|
|
15
|
+
}, g = /* @__PURE__ */ new Set();
|
|
16
16
|
function Z({
|
|
17
17
|
conditions: l,
|
|
18
18
|
rootOperator: m,
|
|
19
|
-
config:
|
|
19
|
+
config: y,
|
|
20
20
|
onAddCondition: s,
|
|
21
|
-
onUpdateCondition:
|
|
22
|
-
onDeleteCondition:
|
|
21
|
+
onUpdateCondition: P,
|
|
22
|
+
onDeleteCondition: z,
|
|
23
23
|
onAddGroup: c,
|
|
24
|
-
onUpdateGroupOperator:
|
|
25
|
-
onDeleteGroup:
|
|
26
|
-
onDuplicateCondition:
|
|
27
|
-
onReorder:
|
|
28
|
-
onUpdateRootOperator:
|
|
29
|
-
renderLeafRow:
|
|
30
|
-
hideOperatorColumn:
|
|
31
|
-
invalidPaths:
|
|
32
|
-
getErrorMessage:
|
|
24
|
+
onUpdateGroupOperator: F,
|
|
25
|
+
onDeleteGroup: G,
|
|
26
|
+
onDuplicateCondition: w,
|
|
27
|
+
onReorder: b,
|
|
28
|
+
onUpdateRootOperator: j,
|
|
29
|
+
renderLeafRow: k,
|
|
30
|
+
hideOperatorColumn: B = !1,
|
|
31
|
+
invalidPaths: I = g,
|
|
32
|
+
getErrorMessage: M,
|
|
33
33
|
maxDepth: f = 2,
|
|
34
34
|
size: e = "sm",
|
|
35
|
-
emptyStateLabel:
|
|
35
|
+
emptyStateLabel: T = "conditions",
|
|
36
36
|
addFilterLabel: a = "Add Filter",
|
|
37
37
|
addFilterGroupLabel: d = "Add Filter Group",
|
|
38
38
|
addActionClassName: i = "text-brand-600 hover:text-brand-700",
|
|
39
|
-
nestedAddActionClassName:
|
|
39
|
+
nestedAddActionClassName: _,
|
|
40
40
|
hideAddActions: p = !1,
|
|
41
|
-
getOperatorOptions:
|
|
41
|
+
getOperatorOptions: C,
|
|
42
42
|
className: D = "py-2",
|
|
43
43
|
reorderGroupClassName: E,
|
|
44
44
|
extraAddActions: r,
|
|
45
45
|
renderCustomNode: H,
|
|
46
|
-
isDeleteDisabled:
|
|
47
|
-
showRootClearGroup:
|
|
48
|
-
onRootClearGroup:
|
|
46
|
+
isDeleteDisabled: L,
|
|
47
|
+
showRootClearGroup: U = !1,
|
|
48
|
+
onRootClearGroup: V
|
|
49
49
|
}) {
|
|
50
|
-
const
|
|
50
|
+
const Y = q(
|
|
51
51
|
() => ({
|
|
52
52
|
operator: m,
|
|
53
53
|
conditions: l
|
|
54
54
|
}),
|
|
55
55
|
[m, l]
|
|
56
56
|
);
|
|
57
|
-
return l.length === 0 ? /* @__PURE__ */ t("div", { className: "py-4", children: /* @__PURE__ */ n("div", { className:
|
|
57
|
+
return l.length === 0 ? /* @__PURE__ */ t("div", { className: "py-4", children: /* @__PURE__ */ n("div", { className: N("text-center py-8 text-tertiary", o[e]), children: [
|
|
58
58
|
/* @__PURE__ */ n("p", { className: "mb-4", children: [
|
|
59
59
|
"No ",
|
|
60
|
-
|
|
60
|
+
T,
|
|
61
61
|
" defined yet."
|
|
62
62
|
] }),
|
|
63
63
|
p ? null : /* @__PURE__ */ n("div", { className: "flex items-center justify-center gap-3", children: [
|
|
@@ -66,7 +66,7 @@ function Z({
|
|
|
66
66
|
{
|
|
67
67
|
icon: x,
|
|
68
68
|
fontSize: o[e],
|
|
69
|
-
iconSize:
|
|
69
|
+
iconSize: S[e],
|
|
70
70
|
className: i,
|
|
71
71
|
onClick: () => s([]),
|
|
72
72
|
children: a
|
|
@@ -77,7 +77,7 @@ function Z({
|
|
|
77
77
|
{
|
|
78
78
|
icon: x,
|
|
79
79
|
fontSize: o[e],
|
|
80
|
-
iconSize:
|
|
80
|
+
iconSize: S[e],
|
|
81
81
|
className: i,
|
|
82
82
|
onClick: () => c([]),
|
|
83
83
|
children: d
|
|
@@ -89,42 +89,42 @@ function Z({
|
|
|
89
89
|
canAddNestedGroup: 0 < f
|
|
90
90
|
})
|
|
91
91
|
] })
|
|
92
|
-
] }) }) : /* @__PURE__ */ t("div", { className:
|
|
93
|
-
|
|
92
|
+
] }) }) : /* @__PURE__ */ t("div", { className: N(D, "min-w-0 max-w-full overflow-x-hidden"), children: /* @__PURE__ */ t(
|
|
93
|
+
J,
|
|
94
94
|
{
|
|
95
|
-
group:
|
|
95
|
+
group: Y,
|
|
96
96
|
nodePath: [],
|
|
97
97
|
level: 0,
|
|
98
98
|
maxDepth: f ?? 2,
|
|
99
99
|
isFirst: !0,
|
|
100
|
-
config:
|
|
100
|
+
config: y,
|
|
101
101
|
onAddCondition: s,
|
|
102
|
-
onUpdateCondition:
|
|
103
|
-
onDeleteCondition:
|
|
102
|
+
onUpdateCondition: P,
|
|
103
|
+
onDeleteCondition: z,
|
|
104
104
|
onAddGroup: c,
|
|
105
105
|
onUpdateGroupOperator: (u, h) => {
|
|
106
|
-
u.length === 0 ?
|
|
106
|
+
u.length === 0 ? j(h) : F(u, h);
|
|
107
107
|
},
|
|
108
|
-
onDeleteGroup:
|
|
109
|
-
onDuplicateCondition:
|
|
110
|
-
onReorder:
|
|
111
|
-
renderLeafRow:
|
|
112
|
-
hideOperatorColumn:
|
|
113
|
-
invalidPaths:
|
|
114
|
-
getErrorMessage:
|
|
108
|
+
onDeleteGroup: G,
|
|
109
|
+
onDuplicateCondition: w,
|
|
110
|
+
onReorder: b,
|
|
111
|
+
renderLeafRow: k,
|
|
112
|
+
hideOperatorColumn: B,
|
|
113
|
+
invalidPaths: I ?? g,
|
|
114
|
+
getErrorMessage: M,
|
|
115
115
|
size: e ?? "sm",
|
|
116
116
|
addFilterLabel: a ?? "Add Filter",
|
|
117
117
|
addFilterGroupLabel: d ?? "Add Filter Group",
|
|
118
118
|
addActionClassName: i,
|
|
119
|
-
nestedAddActionClassName:
|
|
119
|
+
nestedAddActionClassName: _,
|
|
120
120
|
hideAddActions: p,
|
|
121
|
-
getOperatorOptions:
|
|
121
|
+
getOperatorOptions: C,
|
|
122
122
|
reorderGroupClassName: E,
|
|
123
123
|
extraAddActions: r,
|
|
124
124
|
renderCustomNode: H,
|
|
125
|
-
isDeleteDisabled:
|
|
126
|
-
showRootClearGroup:
|
|
127
|
-
onRootClearGroup:
|
|
125
|
+
isDeleteDisabled: L,
|
|
126
|
+
showRootClearGroup: U,
|
|
127
|
+
onRootClearGroup: V
|
|
128
128
|
}
|
|
129
129
|
) });
|
|
130
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/patterns/condition-builder/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EAC3B,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,QAAQ,KAAG,MAAwB,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,KAAG,QAGjD,CAAC;AAMF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EACzC,UAAU,EAAE,UAAU,EAAE,EACxB,IAAI,EAAE,QAAQ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UAAU,KAAK,OAAO,GACnC,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAClC,UAAU,EAAE,UAAU,EAAE,EACxB,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,IAAI,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,GAC7E,MAAM,CAQR;AAMD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAC5C,UAAU,EAAE,UAAU,EAAE,EACxB,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,IAAI,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,EAC5E,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,IAAI,UAAU,GAAG,iBAAiB,EAC9D,QAAQ,GAAE,QAAa,GACxB,wBAAwB,EAAE,CA4C5B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,wBAAwB,EAAE,KAAG,GAAG,CAAC,MAAM,CAE9E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CalendarDate, CalendarDateTime } from '@internationalized/date';
|
|
2
|
+
import { DateValue } from 'react-aria-components';
|
|
3
|
+
export interface FilterDateAdapter {
|
|
4
|
+
/** A condition's date string as a calendar date; today when empty or unparseable. */
|
|
5
|
+
parseDate: (value?: string) => CalendarDate;
|
|
6
|
+
/** A condition's timestamp string as a date-time, or null when empty. */
|
|
7
|
+
parseTimestamp: (value: unknown) => CalendarDateTime | null;
|
|
8
|
+
/** A picked date-time back to the condition's string; a cleared picker becomes "". */
|
|
9
|
+
formatTimestamp: (value: DateValue | null) => string;
|
|
10
|
+
}
|
|
11
|
+
export declare const parseFilterDate: (dateString?: string) => CalendarDate;
|
|
12
|
+
/**
|
|
13
|
+
* The form's timestamp string as a date-time, or null when empty. A string with no
|
|
14
|
+
* time part reads as midnight.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseFilterTimestamp: (value: unknown) => CalendarDateTime | null;
|
|
17
|
+
/** A picked date-time back to the form's string. A date without a time is midnight. */
|
|
18
|
+
export declare const formatFilterTimestamp: (value: DateValue | null) => string;
|
|
19
|
+
export declare const defaultFilterDateAdapter: FilterDateAdapter;
|
|
20
|
+
//# sourceMappingURL=date-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-adapter.d.ts","sourceRoot":"","sources":["../../../src/patterns/filter-group/date-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD,MAAM,WAAW,iBAAiB;IAC9B,qFAAqF;IACrF,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC5C,yEAAyE;IACzE,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,GAAG,IAAI,CAAC;IAC5D,sFAAsF;IACtF,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC;CACxD;AAID,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,KAAG,YAoCrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,gBAAgB,GAAG,IAQxE,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,GAAI,OAAO,SAAS,GAAG,IAAI,KAAG,MAI/D,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAItC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Time as i, toCalendarDateTime as h, CalendarDate as o, today as y, getLocalTimeZone as l } from "@internationalized/date";
|
|
2
|
+
const m = (t) => String(t).padStart(2, "0"), p = (t) => {
|
|
3
|
+
if (typeof t == "string" && t) {
|
|
4
|
+
const n = /^(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{2}|\d{4})$/, a = t.match(n);
|
|
5
|
+
if (a) {
|
|
6
|
+
const [, r, d, c] = a, f = parseInt(r, 10), u = parseInt(d, 10);
|
|
7
|
+
let s = parseInt(c, 10);
|
|
8
|
+
return c.length === 2 && (s += s >= 50 ? 1900 : 2e3), new o(s, f, u);
|
|
9
|
+
}
|
|
10
|
+
const e = t.match(/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/);
|
|
11
|
+
if (e)
|
|
12
|
+
return new o(parseInt(e[1]), parseInt(e[2]), parseInt(e[3]));
|
|
13
|
+
if (/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2},\s*\d{4}$/i.test(t)) {
|
|
14
|
+
const r = new Date(t);
|
|
15
|
+
if (!Number.isNaN(r.getTime()))
|
|
16
|
+
return new o(r.getFullYear(), r.getMonth() + 1, r.getDate());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return y(l());
|
|
20
|
+
}, D = (t) => {
|
|
21
|
+
if (!t || typeof t != "string") return null;
|
|
22
|
+
const [n = "", a = "00:00:00"] = t.split(" "), e = a.match(/(\d{1,2}):(\d{2})(?::(\d{2}))?/), r = e ? new i(Number(e[1]), Number(e[2]), e[3] ? Number(e[3]) : 0) : new i();
|
|
23
|
+
return h(p(n), r);
|
|
24
|
+
}, T = (t) => {
|
|
25
|
+
if (!t) return "";
|
|
26
|
+
const n = "hour" in t ? t : new i();
|
|
27
|
+
return `${t.month}/${t.day}/${t.year} ${m(n.hour)}:${m(n.minute)}:${m(n.second)}`;
|
|
28
|
+
}, w = {
|
|
29
|
+
parseDate: p,
|
|
30
|
+
parseTimestamp: D,
|
|
31
|
+
formatTimestamp: T
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
w as defaultFilterDateAdapter,
|
|
35
|
+
T as formatFilterTimestamp,
|
|
36
|
+
p as parseFilterDate,
|
|
37
|
+
D as parseFilterTimestamp
|
|
38
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DocumentFieldsConfig } from './types';
|
|
2
|
+
import { TreeViewBuildConfig } from '../tree-view';
|
|
3
|
+
export declare const TREE_CONFIG: TreeViewBuildConfig;
|
|
4
|
+
export interface DocumentFieldTreeNode {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
type: string;
|
|
8
|
+
children: DocumentFieldTreeNode[];
|
|
9
|
+
icon?: DocumentFieldsConfig[string]["icon"];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert DocumentFieldsConfig to a root-level array of nodes for TreeView, read with TREE_CONFIG.
|
|
13
|
+
*/
|
|
14
|
+
export declare function documentFieldsToTreeData(documentFields: DocumentFieldsConfig): DocumentFieldTreeNode[];
|
|
15
|
+
/**
|
|
16
|
+
* Collect ids of all nodes that have children in the given tree. Used to expand those nodes
|
|
17
|
+
* by default so that search results (or selected path) are visible. TreeView builds full path
|
|
18
|
+
* ids (e.g. "ACORD.location.city") from the segment ids of the raw tree this works on, so this
|
|
19
|
+
* walks the same raw tree and joins the segments the same way to get matching ids.
|
|
20
|
+
* We do a recursive walk and build path as we go, adding to expanded set when node has children.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getExpandedIdsForTree(nodes: DocumentFieldTreeNode[], parentPath?: string): Set<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Given a selected field id (e.g. "ACORD.location.city"), return the set of parent path ids
|
|
25
|
+
* that should be expanded so the selected node is visible: ["ACORD", "ACORD.location"].
|
|
26
|
+
*/
|
|
27
|
+
export declare function getExpandedIdsForSelectedField(selectedFieldId: string): Set<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Filter tree data by search query: keep nodes whose label (or any descendant) matches.
|
|
30
|
+
* Returns new tree with only matching nodes and their ancestors.
|
|
31
|
+
*/
|
|
32
|
+
export declare function filterTreeBySearch(nodes: DocumentFieldTreeNode[], query: string): DocumentFieldTreeNode[];
|
|
33
|
+
//# sourceMappingURL=document-fields-to-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-fields-to-tree.d.ts","sourceRoot":"","sources":["../../../src/patterns/filter-group/document-fields-to-tree.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAA2B,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,eAAO,MAAM,WAAW,EAAE,mBAAiF,CAAC;AAE5G,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;CAC/C;AAWD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,oBAAoB,GAAG,qBAAqB,EAAE,CAQtG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,EAAE,EAAE,UAAU,GAAE,MAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAa1G;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,eAAe,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAQnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAmBzG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const a = { labelKey: "label", childrenKey: "children", idKey: "id" };
|
|
2
|
+
function d(n) {
|
|
3
|
+
return n.map((e) => ({
|
|
4
|
+
id: e.key,
|
|
5
|
+
label: e.label,
|
|
6
|
+
type: e.type ?? "object",
|
|
7
|
+
children: e.children ? d(e.children) : []
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
function s(n) {
|
|
11
|
+
return Object.entries(n).map(([e, t]) => ({
|
|
12
|
+
id: e,
|
|
13
|
+
label: t.label,
|
|
14
|
+
type: "document",
|
|
15
|
+
children: d(t.fields),
|
|
16
|
+
icon: t.icon
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
function u(n, e = "") {
|
|
20
|
+
const t = /* @__PURE__ */ new Set();
|
|
21
|
+
function r(c, l) {
|
|
22
|
+
for (const i of c) {
|
|
23
|
+
const o = l ? `${l}.${i.id}` : i.id;
|
|
24
|
+
i.children.length > 0 && (t.add(o), r(i.children, o));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return r(n, e), t;
|
|
28
|
+
}
|
|
29
|
+
function h(n) {
|
|
30
|
+
if (!n.trim()) return /* @__PURE__ */ new Set();
|
|
31
|
+
const e = n.split("."), t = /* @__PURE__ */ new Set();
|
|
32
|
+
for (let r = 1; r < e.length; r++)
|
|
33
|
+
t.add(e.slice(0, r).join("."));
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
function f(n, e) {
|
|
37
|
+
if (!e.trim()) return n;
|
|
38
|
+
const t = e.toLowerCase();
|
|
39
|
+
function r(c) {
|
|
40
|
+
return c.map((l) => {
|
|
41
|
+
const i = r(l.children);
|
|
42
|
+
return l.label.toLowerCase().includes(t) || i.length > 0 ? { ...l, children: i.length > 0 ? i : l.children } : null;
|
|
43
|
+
}).filter((l) => l !== null);
|
|
44
|
+
}
|
|
45
|
+
return r(n);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
a as TREE_CONFIG,
|
|
49
|
+
s as documentFieldsToTreeData,
|
|
50
|
+
f as filterTreeBySearch,
|
|
51
|
+
h as getExpandedIdsForSelectedField,
|
|
52
|
+
u as getExpandedIdsForTree
|
|
53
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterDateAdapter } from './date-adapter';
|
|
3
|
+
import { FilterCondition, FilterField, FilterOperator, FilterLogicalOperator, DocumentFieldsConfig } from './types';
|
|
4
|
+
interface FilterConditionRowProps {
|
|
5
|
+
condition: FilterCondition;
|
|
6
|
+
fields: FilterField[];
|
|
7
|
+
operators?: FilterOperator[];
|
|
8
|
+
logicalOperator?: FilterLogicalOperator;
|
|
9
|
+
isFirst: boolean;
|
|
10
|
+
showLogicalOperator: boolean;
|
|
11
|
+
onUpdate: (updates: Partial<FilterCondition>) => void;
|
|
12
|
+
onDelete: () => void;
|
|
13
|
+
onLogicalOperatorChange?: (operator: FilterLogicalOperator) => void;
|
|
14
|
+
size?: "sm" | "md" | "lg";
|
|
15
|
+
/** Whether drag is enabled */
|
|
16
|
+
dragEnabled?: boolean;
|
|
17
|
+
/** Document fields for nested field selection (optional, uses standard select if not provided) */
|
|
18
|
+
documentFields?: DocumentFieldsConfig;
|
|
19
|
+
/** Whether to use fixed positioning for the dropdown */
|
|
20
|
+
useFixedPositioning?: boolean;
|
|
21
|
+
/** Whether this condition is invalid */
|
|
22
|
+
isInvalid?: boolean;
|
|
23
|
+
allowFlexCol?: boolean;
|
|
24
|
+
/** Whether to force text input for all value fields (date/timestamp will use text input instead of date picker) */
|
|
25
|
+
forceTextInput?: boolean;
|
|
26
|
+
/** Whether to hide the logical operator / Where label column entirely */
|
|
27
|
+
hideLabels?: boolean;
|
|
28
|
+
/** Options for multiselect value input when operator requires multiple values (e.g. "in", "not in"). If not provided, options are derived from the selected field when it is a select type. */
|
|
29
|
+
multiselectOptions?: {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}[];
|
|
33
|
+
/** When true, value inputs (single select and multi-select) support searching/filtering options. Default false. */
|
|
34
|
+
searchable?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Optional test-id prefix. When set, the row emits `${prefix}-row`, `-field-select`, `-operator-select`,
|
|
37
|
+
* `-value-input`, `-remove-button` and `-drag-handle` test ids. No attributes are emitted when undefined.
|
|
38
|
+
*/
|
|
39
|
+
testIdPrefix?: string;
|
|
40
|
+
/** Optional row index, emitted as `data-row-index` only when `testIdPrefix` is set. */
|
|
41
|
+
rowIndex?: number;
|
|
42
|
+
/** Date/timestamp string plumbing; defaults to the platform formats (M/D/YYYY, M/D/YYYY HH:MM:SS). */
|
|
43
|
+
dateAdapter?: FilterDateAdapter;
|
|
44
|
+
}
|
|
45
|
+
export declare const FilterConditionRow: React.FC<FilterConditionRowProps>;
|
|
46
|
+
export default FilterConditionRow;
|
|
47
|
+
//# sourceMappingURL=filter-condition-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-condition-row.d.ts","sourceRoot":"","sources":["../../../src/patterns/filter-group/filter-condition-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,KAAK,EACR,eAAe,EACf,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EAEvB,MAAM,SAAS,CAAC;AAUjB,UAAU,uBAAuB;IAC7B,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,C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