@ztwoint/z-ui 0.1.85 → 0.1.87
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/components/assets/icons/index.d.ts +2 -0
- package/dist/components/assets/icons/table-cols-2.d.ts +8 -0
- package/dist/components/assets/icons/table-cols-2.js +60 -0
- package/dist/components/assets/icons/vector_3.d.ts +6 -0
- package/dist/components/assets/icons/vector_3.js +34 -0
- package/dist/components/table-card/table-card.js +38 -37
- package/dist/components/table-card/table-card.type.d.ts +2 -1
- package/dist/components/table-filter/filters/boolean.js +28 -32
- package/dist/components/table-filter/filters/checkbox.js +24 -26
- package/dist/components/table-filter/filters/number/number.hook.d.ts +2 -12
- package/dist/components/table-filter/filters/number/number.hook.js +18 -18
- package/dist/components/table-filter/filters/text.js +25 -28
- package/dist/components/table-filter/table-filter-column-button.js +36 -39
- package/dist/components/table-filter/table-filter-provider.js +10 -10
- package/dist/components/table-filter/table-filter.hook.js +46 -42
- package/dist/components/table-filter/table-filter.type.d.ts +3 -2
- package/dist/index.js +33 -29
- package/dist/types/components/assets/icons/index.d.ts +2 -0
- package/dist/types/components/assets/icons/table-cols-2.d.ts +8 -0
- package/dist/types/components/assets/icons/vector_3.d.ts +6 -0
- package/dist/types/components/table-card/table-card.type.d.ts +2 -1
- package/dist/types/components/table-filter/filters/number/number.hook.d.ts +2 -12
- package/dist/types/components/table-filter/table-filter.type.d.ts +3 -2
- package/package.json +1 -1
|
@@ -34,3 +34,5 @@ export { default as XIcon } from './x';
|
|
|
34
34
|
export { default as Z2Icon } from './z2-icon';
|
|
35
35
|
export { default as Z2SlashIcon } from './z2-slash';
|
|
36
36
|
export { default as Z2DataIcon } from './z2data';
|
|
37
|
+
export { default as Vector3Icon } from './vector_3';
|
|
38
|
+
export { default as TableCols2Icon } from './table-cols-2';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
type IconProps = SVGProps<SVGSVGElement> & {
|
|
3
|
+
secondaryfill?: string;
|
|
4
|
+
strokewidth?: number;
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function TableCols2({ fill, secondaryfill, strokewidth, width, height, title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TableCols2;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
function a({
|
|
3
|
+
fill: e = "currentColor",
|
|
4
|
+
secondaryfill: r,
|
|
5
|
+
strokewidth: n = 1,
|
|
6
|
+
width: i = "1em",
|
|
7
|
+
height: s = "1em",
|
|
8
|
+
title: d = "badge 13",
|
|
9
|
+
...h
|
|
10
|
+
}) {
|
|
11
|
+
return r = r || e, /* @__PURE__ */ o(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
height: s,
|
|
15
|
+
width: i,
|
|
16
|
+
viewBox: "0 0 20 20",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
...h,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ t("title", { children: d }),
|
|
21
|
+
/* @__PURE__ */ o("g", { fill: e, children: [
|
|
22
|
+
/* @__PURE__ */ t(
|
|
23
|
+
"line",
|
|
24
|
+
{
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: r,
|
|
27
|
+
strokeLinecap: "round",
|
|
28
|
+
strokeLinejoin: "round",
|
|
29
|
+
strokeWidth: n,
|
|
30
|
+
x1: "10",
|
|
31
|
+
x2: "10",
|
|
32
|
+
y1: "17",
|
|
33
|
+
y2: "3"
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ t(
|
|
37
|
+
"rect",
|
|
38
|
+
{
|
|
39
|
+
height: "14",
|
|
40
|
+
width: "14",
|
|
41
|
+
fill: "none",
|
|
42
|
+
rx: "3",
|
|
43
|
+
ry: "3",
|
|
44
|
+
stroke: e,
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round",
|
|
47
|
+
strokeWidth: "2",
|
|
48
|
+
transform: "translate(0 20) rotate(-90)",
|
|
49
|
+
x: "3",
|
|
50
|
+
y: "3"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
a as default
|
|
60
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function l({
|
|
3
|
+
fill: r = "currentColor",
|
|
4
|
+
width: t = "1em",
|
|
5
|
+
height: o = "1em",
|
|
6
|
+
title: n = "Vector",
|
|
7
|
+
...i
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ s(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
height: o,
|
|
13
|
+
width: t,
|
|
14
|
+
viewBox: "0 0 9 9",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
...i,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ e("title", { children: n }),
|
|
19
|
+
/* @__PURE__ */ e("g", { fill: "none", children: /* @__PURE__ */ e(
|
|
20
|
+
"path",
|
|
21
|
+
{
|
|
22
|
+
d: "M1 1V1C1 4.86599 4.13401 8 8 8V8",
|
|
23
|
+
stroke: r,
|
|
24
|
+
strokeLinecap: "round",
|
|
25
|
+
strokeOpacity: "1"
|
|
26
|
+
}
|
|
27
|
+
) })
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
l as default
|
|
34
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { Table as r } from "../table/table-provider.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { cn as d } from "../../lib/utils.js";
|
|
@@ -47,8 +47,8 @@ const we = ({
|
|
|
47
47
|
loading: b,
|
|
48
48
|
emptyMessage: H,
|
|
49
49
|
className: j,
|
|
50
|
-
rounded:
|
|
51
|
-
bordered:
|
|
50
|
+
rounded: i = !0,
|
|
51
|
+
bordered: c = !0,
|
|
52
52
|
showHeader: g = !0,
|
|
53
53
|
headerClassName: k,
|
|
54
54
|
search: m,
|
|
@@ -63,35 +63,35 @@ const we = ({
|
|
|
63
63
|
showFooter: P = !0,
|
|
64
64
|
footerClassName: T,
|
|
65
65
|
pagination: o,
|
|
66
|
-
paginationInfo:
|
|
67
|
-
paginationQuickJumper:
|
|
66
|
+
paginationInfo: n,
|
|
67
|
+
paginationQuickJumper: s,
|
|
68
68
|
error: x = !1,
|
|
69
69
|
dataSourceError: _ = !1
|
|
70
70
|
}) => {
|
|
71
71
|
var f;
|
|
72
72
|
if (x)
|
|
73
|
-
return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
|
|
74
74
|
/* @__PURE__ */ e(S, { className: "mt-1.5" }),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
|
|
76
76
|
/* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
|
|
77
77
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
|
|
78
78
|
typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
|
|
79
79
|
] })
|
|
80
80
|
] }) });
|
|
81
|
-
const
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
g &&
|
|
81
|
+
const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!n || C, v = m || t || h || u, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
|
|
82
|
+
return /* @__PURE__ */ a("div", { className: d("flex flex-col overflow-hidden relative", j), children: [
|
|
83
|
+
/* @__PURE__ */ a(r, { dataSource: w, schema: B, emptyMessage: H, children: [
|
|
84
|
+
g && v && /* @__PURE__ */ a(
|
|
85
85
|
r.Header,
|
|
86
86
|
{
|
|
87
87
|
className: d(
|
|
88
88
|
"flex-shrink-0",
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
c && "border-stroke-solid-medium border-1 border-b-0",
|
|
90
|
+
i && "rounded-t-xl",
|
|
91
91
|
k
|
|
92
92
|
),
|
|
93
93
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ a(r.HeaderContent, { children: [
|
|
95
95
|
h && h,
|
|
96
96
|
m && /* @__PURE__ */ e(
|
|
97
97
|
r.Search,
|
|
@@ -105,14 +105,15 @@ const we = ({
|
|
|
105
105
|
className: m.className
|
|
106
106
|
}
|
|
107
107
|
),
|
|
108
|
-
t && /* @__PURE__ */
|
|
108
|
+
t && /* @__PURE__ */ a(
|
|
109
109
|
p,
|
|
110
110
|
{
|
|
111
111
|
filterSchema: t.filterSchema,
|
|
112
112
|
filter: {
|
|
113
113
|
value: t.value || [],
|
|
114
114
|
onChange: t.onChange || (() => {
|
|
115
|
-
})
|
|
115
|
+
}),
|
|
116
|
+
onDynamicChange: t.onDynamicChange
|
|
116
117
|
},
|
|
117
118
|
children: [
|
|
118
119
|
R && /* @__PURE__ */ e(p.FilterButton, {}),
|
|
@@ -133,44 +134,44 @@ const we = ({
|
|
|
133
134
|
sort: l == null ? void 0 : l.sort,
|
|
134
135
|
className: d(
|
|
135
136
|
"flex-1 min-h-0",
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
c && "border-stroke-solid-light border-1",
|
|
138
|
+
i && !(g && v) && "rounded-t-xl",
|
|
139
|
+
i && !(P && N) && "rounded-b-xl",
|
|
140
|
+
c && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
|
|
141
|
+
c && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
|
|
141
142
|
l == null ? void 0 : l.className
|
|
142
143
|
),
|
|
143
144
|
stickyHeader: l == null ? void 0 : l.stickyHeader
|
|
144
145
|
}
|
|
145
146
|
),
|
|
146
|
-
P &&
|
|
147
|
+
P && N && /* @__PURE__ */ a(
|
|
147
148
|
r.Footer,
|
|
148
149
|
{
|
|
149
150
|
className: d(
|
|
150
151
|
"flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
c && "border",
|
|
153
|
+
i && "rounded-b-xl",
|
|
153
154
|
T
|
|
154
155
|
),
|
|
155
156
|
children: [
|
|
156
|
-
|
|
157
|
+
n ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
|
|
157
158
|
r.PaginationInfo,
|
|
158
159
|
{
|
|
159
|
-
showTotal:
|
|
160
|
-
totalItems:
|
|
161
|
-
currentPage:
|
|
162
|
-
itemsPerPage:
|
|
160
|
+
showTotal: n.showTotal,
|
|
161
|
+
totalItems: n.totalItems,
|
|
162
|
+
currentPage: n.currentPage,
|
|
163
|
+
itemsPerPage: n.itemsPerPage
|
|
163
164
|
}
|
|
164
|
-
) }) :
|
|
165
|
-
(
|
|
166
|
-
|
|
165
|
+
) }) : s || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
|
|
166
|
+
(s || o) && /* @__PURE__ */ a(r.FooterContent, { children: [
|
|
167
|
+
C && /* @__PURE__ */ e(
|
|
167
168
|
r.PaginationQuickJumper,
|
|
168
169
|
{
|
|
169
|
-
currentPage:
|
|
170
|
-
totalPage:
|
|
171
|
-
onChange:
|
|
170
|
+
currentPage: s.currentPage,
|
|
171
|
+
totalPage: s.totalPage,
|
|
172
|
+
onChange: s.onChange || (() => {
|
|
172
173
|
}),
|
|
173
|
-
disabled:
|
|
174
|
+
disabled: s.disabled
|
|
174
175
|
}
|
|
175
176
|
),
|
|
176
177
|
o && /* @__PURE__ */ e(
|
|
@@ -188,7 +189,7 @@ const we = ({
|
|
|
188
189
|
}
|
|
189
190
|
)
|
|
190
191
|
] }),
|
|
191
|
-
b && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */
|
|
192
|
+
b && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-3", children: [
|
|
192
193
|
/* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
|
|
193
194
|
/* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
|
|
194
195
|
] }) })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { TableProps, TableSchema, TableSearch, TableSort } from '../table/table.type';
|
|
3
|
-
import { TableFilter, FilterSchema } from '../table-filter/table-filter.type';
|
|
3
|
+
import { TableFilter, FilterRule, FilterSchema } from '../table-filter/table-filter.type';
|
|
4
4
|
import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '../table/components/pagination/pagination.type';
|
|
5
5
|
export interface TableCardProps {
|
|
6
6
|
dataSource: Record<string, unknown>[];
|
|
@@ -17,6 +17,7 @@ export interface TableCardProps {
|
|
|
17
17
|
quickFilters?: string[];
|
|
18
18
|
showFilterButton?: boolean;
|
|
19
19
|
filterSchema: FilterSchema;
|
|
20
|
+
onDynamicChange?: (filters: FilterRule[]) => void;
|
|
20
21
|
};
|
|
21
22
|
headerLeftContent?: React.ReactNode;
|
|
22
23
|
headerActions?: React.ReactNode;
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
t.condition || s({ condition: d[0] });
|
|
6
|
-
}, []);
|
|
7
|
-
const i = (r, a) => {
|
|
8
|
-
s(a ? { value: r } : { value: "" });
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
const c = ({ value: e, onChange: l }) => {
|
|
3
|
+
const i = (s, d) => {
|
|
4
|
+
l(d ? { value: s } : { value: "" });
|
|
9
5
|
};
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: /* @__PURE__ */ t("div", { className: "p-4 space-y-3", children: [
|
|
7
|
+
/* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
|
|
8
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
9
|
+
/* @__PURE__ */ r(
|
|
14
10
|
"input",
|
|
15
11
|
{
|
|
16
12
|
type: "checkbox",
|
|
17
|
-
checked:
|
|
18
|
-
onChange: (
|
|
13
|
+
checked: (e == null ? void 0 : e.value) === "true",
|
|
14
|
+
onChange: (s) => i("true", s.target.checked),
|
|
19
15
|
className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
|
|
20
16
|
}
|
|
21
17
|
),
|
|
22
|
-
|
|
18
|
+
(e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
|
|
23
19
|
"path",
|
|
24
20
|
{
|
|
25
21
|
fillRule: "evenodd",
|
|
@@ -28,26 +24,26 @@ const d = ["equals", "notEqual"], u = ({ value: t, onChange: s }) => {
|
|
|
28
24
|
}
|
|
29
25
|
) }) })
|
|
30
26
|
] }),
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
27
|
+
/* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
|
|
28
|
+
/* @__PURE__ */ t("div", { className: "flex items-center", children: [
|
|
29
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "True" }),
|
|
30
|
+
(e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800", children: "Selected" })
|
|
35
31
|
] }),
|
|
36
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with true values" })
|
|
37
33
|
] })
|
|
38
34
|
] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
|
|
36
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
37
|
+
/* @__PURE__ */ r(
|
|
42
38
|
"input",
|
|
43
39
|
{
|
|
44
40
|
type: "checkbox",
|
|
45
|
-
checked:
|
|
46
|
-
onChange: (
|
|
41
|
+
checked: (e == null ? void 0 : e.value) === "false",
|
|
42
|
+
onChange: (s) => i("false", s.target.checked),
|
|
47
43
|
className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
|
|
48
44
|
}
|
|
49
45
|
),
|
|
50
|
-
|
|
46
|
+
(e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
|
|
51
47
|
"path",
|
|
52
48
|
{
|
|
53
49
|
fillRule: "evenodd",
|
|
@@ -56,16 +52,16 @@ const d = ["equals", "notEqual"], u = ({ value: t, onChange: s }) => {
|
|
|
56
52
|
}
|
|
57
53
|
) }) })
|
|
58
54
|
] }),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
55
|
+
/* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
|
|
56
|
+
/* @__PURE__ */ t("div", { className: "flex items-center", children: [
|
|
57
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "False" }),
|
|
58
|
+
(e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800", children: "Selected" })
|
|
63
59
|
] }),
|
|
64
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with false values" })
|
|
65
61
|
] })
|
|
66
62
|
] })
|
|
67
63
|
] }) });
|
|
68
64
|
};
|
|
69
65
|
export {
|
|
70
|
-
|
|
66
|
+
c as default
|
|
71
67
|
};
|
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as i, useEffect as
|
|
1
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useEffect as N } from "react";
|
|
3
3
|
import { Virtuoso as k } from "react-virtuoso";
|
|
4
4
|
import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
|
|
5
5
|
import S from "../../assets/icons/x.js";
|
|
6
6
|
import { Z2Checkbox as w } from "../../checkbox/checkbox.js";
|
|
7
|
-
const
|
|
8
|
-
const [
|
|
7
|
+
const E = ({ value: s, onChange: h, filterOptions: n = [] }) => {
|
|
8
|
+
const [o, c] = i([]), [d, m] = i(""), [f, u] = i(n), x = (l) => {
|
|
9
9
|
m(l.target.value);
|
|
10
10
|
const e = n.filter(
|
|
11
11
|
(a) => a.label.toLowerCase().includes(l.target.value.toLowerCase())
|
|
12
12
|
);
|
|
13
|
-
|
|
13
|
+
u(e);
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, [])
|
|
18
|
-
|
|
19
|
-
}, [r.value]);
|
|
20
|
-
const b = (l, e) => {
|
|
15
|
+
N(() => {
|
|
16
|
+
s && Array.isArray(s.value) ? c(s.value.filter(Boolean) ?? []) : c([]);
|
|
17
|
+
}, [s]);
|
|
18
|
+
const p = (l, e) => {
|
|
21
19
|
let a;
|
|
22
|
-
e ? a = [...
|
|
23
|
-
},
|
|
24
|
-
m(""),
|
|
25
|
-
}, C = (l) =>
|
|
26
|
-
/* @__PURE__ */
|
|
20
|
+
e ? a = [...o, l] : a = o.filter((v) => v !== l), c(a), h({ value: a });
|
|
21
|
+
}, b = () => {
|
|
22
|
+
m(""), u(n);
|
|
23
|
+
}, C = (l) => o.includes(l), g = (l, e) => /* @__PURE__ */ r("div", { className: "flex justify-between items-center py-2 px-3", children: [
|
|
24
|
+
/* @__PURE__ */ r("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
27
25
|
/* @__PURE__ */ t(
|
|
28
26
|
w,
|
|
29
27
|
{
|
|
30
28
|
checked: C(e.value),
|
|
31
|
-
onCheckedChange: (a) =>
|
|
29
|
+
onCheckedChange: (a) => p(e.value, a === !0)
|
|
32
30
|
}
|
|
33
31
|
),
|
|
34
32
|
/* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
|
|
35
33
|
] }),
|
|
36
|
-
e.total && /* @__PURE__ */
|
|
34
|
+
e.total && /* @__PURE__ */ r("span", { className: "text-text-neutral-muted text-sm", children: [
|
|
37
35
|
"[",
|
|
38
36
|
e.total,
|
|
39
37
|
"]"
|
|
40
38
|
] })
|
|
41
39
|
] });
|
|
42
|
-
return n.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
40
|
+
return n.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ r("div", { className: "flex flex-col h-full", children: [
|
|
41
|
+
/* @__PURE__ */ r("div", { className: "relative border-b border-stroke-solid-medium", children: [
|
|
44
42
|
/* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
|
|
45
43
|
/* @__PURE__ */ t(
|
|
46
44
|
"input",
|
|
47
45
|
{
|
|
48
46
|
placeholder: "Search options",
|
|
49
|
-
value:
|
|
50
|
-
onChange:
|
|
47
|
+
value: d,
|
|
48
|
+
onChange: x,
|
|
51
49
|
className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
|
|
52
50
|
}
|
|
53
51
|
),
|
|
54
|
-
|
|
52
|
+
d && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: b, children: /* @__PURE__ */ t(S, {}) })
|
|
55
53
|
] }),
|
|
56
54
|
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
|
|
57
55
|
k,
|
|
58
56
|
{
|
|
59
|
-
data:
|
|
60
|
-
itemContent:
|
|
57
|
+
data: f,
|
|
58
|
+
itemContent: g,
|
|
61
59
|
className: "h-full min-h-60",
|
|
62
60
|
style: { height: "100%" },
|
|
63
61
|
overscan: 5
|
|
@@ -66,5 +64,5 @@ const V = ["includesAny", "includesAll", "excludes"], I = ({ value: r, onChange:
|
|
|
66
64
|
] });
|
|
67
65
|
};
|
|
68
66
|
export {
|
|
69
|
-
|
|
67
|
+
E as default
|
|
70
68
|
};
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
condition: string;
|
|
4
|
-
value: string;
|
|
5
|
-
};
|
|
6
|
-
onChange: (update: {
|
|
7
|
-
condition?: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
}) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps) => {
|
|
1
|
+
import { FilterComponentProps } from '../../table-filter.type';
|
|
2
|
+
export declare const useNumberFilter: ({ value, onChange }: FilterComponentProps) => {
|
|
12
3
|
specificAmount: string;
|
|
13
4
|
atLeast: string;
|
|
14
5
|
noMoreThan: string;
|
|
@@ -20,4 +11,3 @@ export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps
|
|
|
20
11
|
resetAtLeast: () => void;
|
|
21
12
|
resetNoMoreThan: () => void;
|
|
22
13
|
};
|
|
23
|
-
export {};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
3
|
-
const [r,
|
|
4
|
-
return
|
|
5
|
-
t.condition === "=" && t.value ? (
|
|
6
|
-
}, [t.condition, t.value]), {
|
|
1
|
+
import { useState as e, useEffect as h } from "react";
|
|
2
|
+
const b = ({ value: t, onChange: o }) => {
|
|
3
|
+
const [r, n] = e(""), [d, c] = e(""), [f, s] = e(""), A = r ? "specific" : d ? "atLeast" : f ? "noMoreThan" : null;
|
|
4
|
+
return h(() => {
|
|
5
|
+
(t == null ? void 0 : t.condition) === "=" && (t != null && t.value) ? (n(t == null ? void 0 : t.value), c(""), s("")) : (t == null ? void 0 : t.condition) === ">" && (t != null && t.value) ? (c(t.value), n(""), s("")) : (t == null ? void 0 : t.condition) === "<" && (t != null && t.value) && (s(t.value), n(""), c(""));
|
|
6
|
+
}, [t == null ? void 0 : t.condition, t == null ? void 0 : t.value]), {
|
|
7
7
|
specificAmount: r,
|
|
8
8
|
atLeast: d,
|
|
9
|
-
noMoreThan:
|
|
10
|
-
activeField:
|
|
11
|
-
handleSpecificAmountChange: (
|
|
12
|
-
|
|
9
|
+
noMoreThan: f,
|
|
10
|
+
activeField: A,
|
|
11
|
+
handleSpecificAmountChange: (i) => {
|
|
12
|
+
n(i), i ? (c(""), s(""), o({ condition: "=", value: i })) : o({ condition: "", value: "" });
|
|
13
13
|
},
|
|
14
|
-
handleAtLeastChange: (
|
|
15
|
-
|
|
14
|
+
handleAtLeastChange: (i) => {
|
|
15
|
+
c(i), i ? (n(""), s(""), o({ condition: ">", value: i })) : o({ condition: "", value: "" });
|
|
16
16
|
},
|
|
17
|
-
handleNoMoreThanChange: (
|
|
18
|
-
|
|
17
|
+
handleNoMoreThanChange: (i) => {
|
|
18
|
+
s(i), i ? (n(""), c(""), o({ condition: "<", value: i })) : o({ condition: "", value: "" });
|
|
19
19
|
},
|
|
20
20
|
resetSpecificAmount: () => {
|
|
21
|
-
|
|
21
|
+
n(""), o({ condition: "", value: "" });
|
|
22
22
|
},
|
|
23
23
|
resetAtLeast: () => {
|
|
24
|
-
|
|
24
|
+
c(""), o({ condition: "", value: "" });
|
|
25
25
|
},
|
|
26
26
|
resetNoMoreThan: () => {
|
|
27
|
-
|
|
27
|
+
s(""), o({ condition: "", value: "" });
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
b as useNumberFilter
|
|
33
33
|
};
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const o = [
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import i from "../../assets/icons/x.js";
|
|
3
|
+
import { MagnifierIcon as o } from "../../assets/icons/magnifier-icon.js";
|
|
4
|
+
import { Input as c } from "../../input/input.js";
|
|
5
|
+
const d = [
|
|
7
6
|
{ label: "Contains", value: "contains" },
|
|
8
7
|
{ label: "Does not equal", value: "notEqual" },
|
|
9
8
|
{ label: "Equals", value: "equals" }
|
|
10
|
-
],
|
|
11
|
-
var
|
|
12
|
-
const
|
|
13
|
-
|
|
9
|
+
], x = ({ value: e, onChange: n }) => {
|
|
10
|
+
var a;
|
|
11
|
+
const s = () => {
|
|
12
|
+
n({ value: "" });
|
|
14
13
|
};
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */ e("div", { className: "p-4 relative", children: /* @__PURE__ */ e(
|
|
19
|
-
d,
|
|
14
|
+
return /* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
15
|
+
/* @__PURE__ */ t("div", { className: "p-4 relative", children: /* @__PURE__ */ t(
|
|
16
|
+
c,
|
|
20
17
|
{
|
|
21
|
-
leftIcon: /* @__PURE__ */
|
|
18
|
+
leftIcon: /* @__PURE__ */ t(o, {}),
|
|
22
19
|
size: "large",
|
|
23
20
|
placeholder: "Search options",
|
|
24
|
-
value:
|
|
25
|
-
rightIcon:
|
|
26
|
-
onChange: (
|
|
21
|
+
value: e == null ? void 0 : e.value,
|
|
22
|
+
rightIcon: e != null && e.value ? /* @__PURE__ */ t(i, { onClick: s }) : null,
|
|
23
|
+
onChange: (l) => n({ value: l.target.value }),
|
|
27
24
|
className: ""
|
|
28
25
|
}
|
|
29
26
|
) }),
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-2 p-3", children: !!(e != null && e.value) && /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2 px-3 py-2", children: [
|
|
28
|
+
/* @__PURE__ */ t("span", { className: "text-text-neutral-muted text-xs font-medium uppercase tracking-wide", children: (a = d.find((l) => l.value === (e == null ? void 0 : e.condition))) == null ? void 0 : a.label }),
|
|
29
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
30
|
+
/* @__PURE__ */ r("span", { className: "text-text-neutral-primary text-sm font-medium px-2 py-1 bg-surface-neutral-default rounded border border-stroke-solid-medium", children: [
|
|
34
31
|
"“",
|
|
35
|
-
|
|
32
|
+
e.value,
|
|
36
33
|
"”"
|
|
37
34
|
] }),
|
|
38
|
-
/* @__PURE__ */
|
|
35
|
+
/* @__PURE__ */ t(
|
|
39
36
|
"button",
|
|
40
37
|
{
|
|
41
|
-
onClick:
|
|
38
|
+
onClick: s,
|
|
42
39
|
className: "flex items-center justify-center w-5 h-5 rounded-full bg-surface-neutral-hovered hover:bg-surface-neutral-pressed transition-colors",
|
|
43
40
|
title: "Remove filter",
|
|
44
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ t(i, { className: "w-3 h-3 text-text-neutral-muted" })
|
|
45
42
|
}
|
|
46
43
|
)
|
|
47
44
|
] })
|
|
@@ -49,5 +46,5 @@ const o = [
|
|
|
49
46
|
] });
|
|
50
47
|
};
|
|
51
48
|
export {
|
|
52
|
-
|
|
49
|
+
x as default
|
|
53
50
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as x from "react";
|
|
3
3
|
import * as p from "@radix-ui/react-popover";
|
|
4
|
-
import { Button as
|
|
5
|
-
import { useTableFilterContext as
|
|
4
|
+
import { Button as d } from "../button/button.js";
|
|
5
|
+
import { useTableFilterContext as U } from "./table-filter.context.js";
|
|
6
6
|
import q from "./filters/text.js";
|
|
7
7
|
import E from "./filters/boolean.js";
|
|
8
8
|
import G from "./filters/number/number.js";
|
|
@@ -11,63 +11,60 @@ import J from "../assets/icons/circle-check-filled.js";
|
|
|
11
11
|
import { getFilterCount as L } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
12
12
|
import { FilterConfirmationDialog as M } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
13
13
|
import { hasUnsavedFilterChangesForColumn as w } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
14
|
-
const
|
|
15
|
-
const [k,
|
|
14
|
+
const ne = ({ filterName: t }) => {
|
|
15
|
+
const [k, s] = x.useState(!1), [f, r] = x.useState(!1), {
|
|
16
16
|
getFilterForColumn: A,
|
|
17
17
|
hasAppliedFilterForColumn: O,
|
|
18
18
|
updateColumnFilter: u,
|
|
19
19
|
applyFilters: c,
|
|
20
20
|
resetToAppliedFilters: P,
|
|
21
21
|
filterSchema: T,
|
|
22
|
-
filterComponents:
|
|
22
|
+
filterComponents: m = {},
|
|
23
23
|
tempFilters: C,
|
|
24
24
|
filter: g
|
|
25
|
-
} =
|
|
26
|
-
!
|
|
25
|
+
} = U(), $ = (e) => {
|
|
26
|
+
!e && f ? w(t, C, g.value) ? s(!0) : r(!1) : r(e);
|
|
27
27
|
}, j = () => {
|
|
28
|
-
c(),
|
|
28
|
+
c(), s(!1), r(!1);
|
|
29
29
|
}, D = () => {
|
|
30
|
-
|
|
30
|
+
s(!1), r(!1);
|
|
31
31
|
}, K = () => {
|
|
32
|
-
P(),
|
|
32
|
+
P(), s(!1), r(!1);
|
|
33
33
|
}, R = () => {
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
if (!
|
|
37
|
-
return console.warn(`Column "${
|
|
34
|
+
s(!1);
|
|
35
|
+
}, F = w(t, C, g.value), o = T.find((e) => e.filterKey === t);
|
|
36
|
+
if (!o)
|
|
37
|
+
return console.warn(`Column "${t}" not found in schema`), null;
|
|
38
38
|
const S = {
|
|
39
39
|
boolean: E,
|
|
40
40
|
string: q,
|
|
41
41
|
number: G,
|
|
42
42
|
checkbox: H
|
|
43
|
-
},
|
|
44
|
-
if (!
|
|
43
|
+
}, v = o.type && (m == null ? void 0 : m[o.type]) || S[o.type ?? "string"];
|
|
44
|
+
if (!v)
|
|
45
45
|
return console.warn(
|
|
46
|
-
`No filter component found for column "${
|
|
46
|
+
`No filter component found for column "${o.filterKey}" with type "${o.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
|
|
47
47
|
), null;
|
|
48
|
-
const
|
|
49
|
-
label:
|
|
50
|
-
value:
|
|
48
|
+
const n = A(t), h = O(t), b = o.options ? Object.entries(o.options).map(([e, i]) => ({
|
|
49
|
+
label: e,
|
|
50
|
+
value: e,
|
|
51
51
|
total: i
|
|
52
|
-
})) : void 0, y =
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
})) : void 0, y = n ? L(n, b) : void 0, z = n != null && n.value ? Array.isArray(n.value) ? n.value.length : 1 : 0, B = () => {
|
|
53
|
+
const e = u(t, "", "");
|
|
54
|
+
c(e), r(!1);
|
|
55
55
|
}, I = () => {
|
|
56
|
-
|
|
57
|
-
c(o), s(!1);
|
|
58
|
-
}, U = () => {
|
|
59
|
-
c(), s(!1);
|
|
56
|
+
c(), r(!1);
|
|
60
57
|
};
|
|
61
58
|
return /* @__PURE__ */ a(p.Root, { open: f, onOpenChange: $, children: [
|
|
62
59
|
/* @__PURE__ */ l(p.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
|
|
63
|
-
|
|
60
|
+
d,
|
|
64
61
|
{
|
|
65
|
-
variant:
|
|
66
|
-
shade:
|
|
62
|
+
variant: h ? "filled" : "stroke",
|
|
63
|
+
shade: h ? "brand" : "neutral",
|
|
67
64
|
size: "small",
|
|
68
65
|
children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
o.title,
|
|
67
|
+
h && /* @__PURE__ */ l(J, { className: "w-4 h-4 text-white flex-shrink-0" })
|
|
71
68
|
] })
|
|
72
69
|
}
|
|
73
70
|
) }),
|
|
@@ -79,16 +76,16 @@ const le = ({ filterName: n }) => {
|
|
|
79
76
|
align: "start",
|
|
80
77
|
children: [
|
|
81
78
|
/* @__PURE__ */ l(
|
|
82
|
-
|
|
79
|
+
v,
|
|
83
80
|
{
|
|
84
|
-
value:
|
|
85
|
-
onChange: ({ condition:
|
|
81
|
+
value: n,
|
|
82
|
+
onChange: ({ condition: e, value: i }) => u(t, e, i),
|
|
86
83
|
filterOptions: b
|
|
87
84
|
}
|
|
88
85
|
),
|
|
89
|
-
(
|
|
90
|
-
/* @__PURE__ */ l(
|
|
91
|
-
|
|
86
|
+
(F || !!z) && /* @__PURE__ */ a("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
|
|
87
|
+
/* @__PURE__ */ l(d, { onClick: B, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
|
|
88
|
+
F && /* @__PURE__ */ l(d, { onClick: I, variant: "filled", shade: "neutral", size: "small", children: `Apply${y !== void 0 ? ` ${y}` : ""}` })
|
|
92
89
|
] })
|
|
93
90
|
]
|
|
94
91
|
}
|
|
@@ -105,5 +102,5 @@ const le = ({ filterName: n }) => {
|
|
|
105
102
|
] });
|
|
106
103
|
};
|
|
107
104
|
export {
|
|
108
|
-
|
|
105
|
+
ne as TableFilterColumnButton
|
|
109
106
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { TableFilterContext as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import a from "./table-filter.hook.js";
|
|
3
|
+
import { TableFilterContext as u } from "./table-filter.context.js";
|
|
4
|
+
const c = ({
|
|
5
5
|
children: r,
|
|
6
6
|
filterComponents: t = {},
|
|
7
7
|
filterSchema: e,
|
|
8
8
|
filter: o
|
|
9
9
|
}) => {
|
|
10
|
-
const
|
|
10
|
+
const n = a({
|
|
11
11
|
filterSchema: e,
|
|
12
12
|
filter: o || { value: [], onChange: () => {
|
|
13
|
-
} }
|
|
13
|
+
}, onDynamicChange: void 0 }
|
|
14
14
|
});
|
|
15
15
|
if (!o)
|
|
16
16
|
return null;
|
|
17
|
-
const
|
|
18
|
-
...
|
|
17
|
+
const l = {
|
|
18
|
+
...n,
|
|
19
19
|
filterSchema: e,
|
|
20
20
|
filter: o,
|
|
21
21
|
filterComponents: t
|
|
22
22
|
};
|
|
23
|
-
return /* @__PURE__ */ u
|
|
23
|
+
return /* @__PURE__ */ i(u.Provider, { value: l, children: r });
|
|
24
24
|
};
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
c as TableFilterProvider
|
|
27
27
|
};
|
|
@@ -1,59 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const [
|
|
4
|
-
|
|
5
|
-
!
|
|
6
|
-
}, [
|
|
7
|
-
const
|
|
8
|
-
const e =
|
|
1
|
+
import o from "react";
|
|
2
|
+
const w = ({ filter: n, filterSchema: c }) => {
|
|
3
|
+
const [v, d] = o.useState(null), [l, i] = o.useState(n.value);
|
|
4
|
+
o.useEffect(() => {
|
|
5
|
+
!v && c.length > 0 && d(c[0].filterKey);
|
|
6
|
+
}, [v, c]);
|
|
7
|
+
const F = (t) => l.find((e) => e.field === t), p = (t) => {
|
|
8
|
+
const e = F(t);
|
|
9
9
|
return e ? Array.isArray(e.value) ? e.value.length > 0 : e.value !== "" : !1;
|
|
10
|
-
},
|
|
11
|
-
const e =
|
|
10
|
+
}, g = (t) => n.value.find((e) => e.field === t), m = (t) => {
|
|
11
|
+
const e = g(t);
|
|
12
12
|
return e ? Array.isArray(e.value) ? e.value.length > 0 : e.value !== "" : !1;
|
|
13
|
-
},
|
|
14
|
-
const
|
|
13
|
+
}, y = (t, e, a) => {
|
|
14
|
+
const f = l.findIndex((r) => r.field === t);
|
|
15
15
|
let u = [];
|
|
16
|
-
if (
|
|
17
|
-
u =
|
|
18
|
-
(
|
|
19
|
-
...
|
|
16
|
+
if (f >= 0)
|
|
17
|
+
u = l.map(
|
|
18
|
+
(s, x) => x === f ? {
|
|
19
|
+
...s,
|
|
20
20
|
...e !== void 0 ? { condition: e } : {},
|
|
21
|
-
...
|
|
22
|
-
} :
|
|
21
|
+
...a !== void 0 ? { value: a } : {}
|
|
22
|
+
} : s
|
|
23
23
|
);
|
|
24
24
|
else {
|
|
25
|
-
const
|
|
25
|
+
const r = {
|
|
26
26
|
field: t,
|
|
27
27
|
...e ? { condition: e } : {},
|
|
28
|
-
value:
|
|
28
|
+
value: a || ""
|
|
29
29
|
};
|
|
30
|
-
u = [...
|
|
30
|
+
u = [...l, r];
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (i(u), n.onDynamicChange) {
|
|
33
|
+
const r = u.filter((s) => Array.isArray(s.value) ? s.value.length > 0 : s.value !== "");
|
|
34
|
+
n.onDynamicChange(r);
|
|
35
|
+
}
|
|
36
|
+
return u;
|
|
35
37
|
}, h = () => {
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
i([]), n.onDynamicChange && n.onDynamicChange([]);
|
|
39
|
+
}, C = () => {
|
|
40
|
+
i(n.value), n.onDynamicChange && n.onDynamicChange(n.value);
|
|
41
|
+
}, A = (t) => {
|
|
42
|
+
const e = (t || l).filter((a) => Array.isArray(a.value) ? a.value.length > 0 : a.value !== "");
|
|
43
|
+
n.onChange(e);
|
|
44
|
+
}, D = n.value.length > 0;
|
|
45
|
+
return o.useEffect(() => {
|
|
46
|
+
i(n.value);
|
|
47
|
+
}, [n.value]), {
|
|
48
|
+
selectedColumn: v,
|
|
49
|
+
setSelectedColumn: d,
|
|
50
|
+
getFilterForColumn: F,
|
|
47
51
|
hasFilterForColumn: p,
|
|
48
52
|
hasAppliedFilterForColumn: m,
|
|
49
|
-
updateColumnFilter:
|
|
50
|
-
clearAllFilters:
|
|
51
|
-
resetToAppliedFilters:
|
|
52
|
-
applyFilters:
|
|
53
|
-
hasActiveFilters:
|
|
54
|
-
tempFilters:
|
|
53
|
+
updateColumnFilter: y,
|
|
54
|
+
clearAllFilters: h,
|
|
55
|
+
resetToAppliedFilters: C,
|
|
56
|
+
applyFilters: A,
|
|
57
|
+
hasActiveFilters: D,
|
|
58
|
+
tempFilters: l
|
|
55
59
|
};
|
|
56
60
|
};
|
|
57
61
|
export {
|
|
58
|
-
|
|
62
|
+
w as default
|
|
59
63
|
};
|
|
@@ -21,6 +21,7 @@ export type FilterSchema = FilterSchemaField[];
|
|
|
21
21
|
export type TableFilter = {
|
|
22
22
|
value: FilterRule[];
|
|
23
23
|
onChange: (filters: FilterRule[]) => void;
|
|
24
|
+
onDynamicChange?: (filters: FilterRule[]) => void;
|
|
24
25
|
};
|
|
25
26
|
export interface TableFilterProps {
|
|
26
27
|
filterSchema: FilterSchema;
|
|
@@ -32,9 +33,9 @@ export type FilterComponentProps = {
|
|
|
32
33
|
condition?: string;
|
|
33
34
|
value?: string | string[];
|
|
34
35
|
}) => void;
|
|
35
|
-
value
|
|
36
|
+
value?: {
|
|
36
37
|
condition?: string;
|
|
37
|
-
value
|
|
38
|
+
value?: string | string[];
|
|
38
39
|
};
|
|
39
40
|
filterOptions?: FilterOption[];
|
|
40
41
|
};
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Z2SideNavBarProvider as c } from "./components/collapsible-side-nav-bar
|
|
|
6
6
|
import { Z2SideNavBar as s, Z2SidebarVariants as I } from "./components/collapsible-side-nav-bar/side-nav-bar.js";
|
|
7
7
|
import { Z2SideNavBarHeader as b } from "./components/collapsible-side-nav-bar/side-nav-bar-header.js";
|
|
8
8
|
import { Z2SideNavBarContent as D } from "./components/collapsible-side-nav-bar/side-nav-bar-content.js";
|
|
9
|
-
import { Z2SideNavBarFooter as
|
|
9
|
+
import { Z2SideNavBarFooter as g } from "./components/collapsible-side-nav-bar/side-nav-bar-footer.js";
|
|
10
10
|
import { Z2SideNavBarGroup as v } from "./components/collapsible-side-nav-bar/side-nav-bar-group.js";
|
|
11
11
|
import { Z2SideNavBarItem as L } from "./components/collapsible-side-nav-bar/side-nav-bar-item.js";
|
|
12
12
|
import { Z2SideNavBarSeparator as h } from "./components/collapsible-side-nav-bar/side-nav-bar-separator.js";
|
|
@@ -15,17 +15,17 @@ import { Z2Popover as k } from "./components/collapsible-side-nav-bar/popover/po
|
|
|
15
15
|
import "react/jsx-runtime";
|
|
16
16
|
import { default as R, default as H } from "./components/assets/icons/sub-nav-indicator.js";
|
|
17
17
|
import { default as F } from "./components/assets/icons/circles-icon.js";
|
|
18
|
-
import { default as _, default as
|
|
18
|
+
import { default as _, default as V } from "./components/assets/icons/database-copy.js";
|
|
19
19
|
import { default as U, default as O } from "./components/assets/icons/window-left-copy.js";
|
|
20
20
|
import { default as J, default as Q } from "./components/assets/icons/sidebar-left-show-copy.js";
|
|
21
21
|
import { SIDEBAR_WIDTH as j, SIDEBAR_WIDTH_COLLAPSED as q } from "./components/collapsible-side-nav-bar/constants.js";
|
|
22
22
|
import { CountryFlags as K } from "./components/country-flags/country-flags.js";
|
|
23
23
|
import { Z2Checkbox as oo } from "./components/checkbox/checkbox.js";
|
|
24
24
|
import { Z2Dialog as ro, Z2DialogClose as to, Z2DialogContent as ao, Z2DialogDescription as po, Z2DialogFooter as no, Z2DialogHeader as fo, Z2DialogOverlay as lo, Z2DialogPortal as mo, Z2DialogTitle as xo, Z2DialogTrigger as uo } from "./components/dialog/dialog.js";
|
|
25
|
-
import { DropdownContext as co, Z2Dropdown as Zo, Z2DropdownContent as so, Z2DropdownInput as Io, Z2DropdownItem as So, Z2DropdownSub as bo, Z2DropdownSubContent as Co, Z2DropdownSubItem as Do, Z2DropdownSubTrigger as
|
|
25
|
+
import { DropdownContext as co, Z2Dropdown as Zo, Z2DropdownContent as so, Z2DropdownInput as Io, Z2DropdownItem as So, Z2DropdownSub as bo, Z2DropdownSubContent as Co, Z2DropdownSubItem as Do, Z2DropdownSubTrigger as To } from "./components/dropdown/z2-dropdown.js";
|
|
26
26
|
import { Z2DropdownMenu as wo, Z2DropdownMenuCheckboxItem as vo, Z2DropdownMenuContent as Bo, Z2DropdownMenuGroup as Lo, Z2DropdownMenuItem as Mo, Z2DropdownMenuLabel as ho, Z2DropdownMenuPortal as Ao, Z2DropdownMenuRadioGroup as Po, Z2DropdownMenuRadioItem as No, Z2DropdownMenuSeparator as ko, Z2DropdownMenuShortcut as Eo, Z2DropdownMenuSub as Ro, Z2DropdownMenuSubContent as Ho, Z2DropdownMenuSubTrigger as yo, Z2DropdownMenuTrigger as Fo } from "./components/dropdown-menu/z2-dropdown-menu.js";
|
|
27
27
|
import { FileUploadArea as _o } from "./components/file-upload-area/file-upload-area.js";
|
|
28
|
-
import { DEFAULT_ACCEPT as
|
|
28
|
+
import { DEFAULT_ACCEPT as Wo } from "./components/file-upload-area/file-upload-area.const.js";
|
|
29
29
|
import { Input as Oo } from "./components/input/input.js";
|
|
30
30
|
import { NavHeader as Jo } from "./components/nav-header/nav-header.js";
|
|
31
31
|
import { NavItem as Yo } from "./components/nav-header/nav-item/nav-item.js";
|
|
@@ -36,7 +36,7 @@ import { Z2Tabs as xe, Z2TabsContent as ue, Z2TabsList as ie, Z2TabsTrigger as c
|
|
|
36
36
|
import { Table as se, TableProvider as Ie } from "./components/table/table-provider.js";
|
|
37
37
|
import { TableBody as be } from "./components/table/table.js";
|
|
38
38
|
import { extractCellValue as De } from "./components/table/table.utils.js";
|
|
39
|
-
import { DEFAULT_EMPTY_MESSAGE as
|
|
39
|
+
import { DEFAULT_EMPTY_MESSAGE as ge, TABLE_CSS_CLASSES as we } from "./components/table/table.const.js";
|
|
40
40
|
import { TableContext as Be, useTableContext as Le } from "./components/table/table.context.js";
|
|
41
41
|
import { TableCell as he } from "./components/table/components/table-cell.js";
|
|
42
42
|
import { NumberCell as Pe } from "./components/table/components/cell/number-cell.js";
|
|
@@ -44,7 +44,7 @@ import { BooleanCell as ke } from "./components/table/components/cell/boolean-ce
|
|
|
44
44
|
import { LinkCell as Re } from "./components/table/components/cell/link-cell.js";
|
|
45
45
|
import { DescriptionCell as ye } from "./components/table/components/cell/description-cell.js";
|
|
46
46
|
import { AvatarCell as Ge } from "./components/table/components/cell/avatar-cell.js";
|
|
47
|
-
import { LabelCell as
|
|
47
|
+
import { LabelCell as Ve } from "./components/table/components/cell/label-cell.js";
|
|
48
48
|
import { TableHeader as Ue } from "./components/table/components/table-header/table-header.js";
|
|
49
49
|
import { default as Xe } from "./components/assets/icons/chevron-down.js";
|
|
50
50
|
import { TableRow as Qe } from "./components/table/components/table-row.js";
|
|
@@ -62,12 +62,12 @@ import "react";
|
|
|
62
62
|
import { Z2Tooltip as Zr } from "./components/tooltip/tooltip.js";
|
|
63
63
|
import { default as Ir } from "./components/table-card/table-card.js";
|
|
64
64
|
import { Badge as br, badgeVariants as Cr } from "./components/badge/badge.js";
|
|
65
|
-
import { Avatar as
|
|
65
|
+
import { Avatar as Tr, AvatarWithLabel as gr } from "./components/avatar/avatar.js";
|
|
66
66
|
import { Z2TextPreset as vr } from "./components/text-preset/text-preset.js";
|
|
67
67
|
import { ColumnReOrder as Lr } from "./components/column-reorder/column-reorder.js";
|
|
68
68
|
import { default as hr } from "./components/tree-checkbox-select/TreeCheckboxSelect.js";
|
|
69
69
|
import { Z2Breadcrumb as Pr, Z2BreadcrumbEllipsis as Nr, Z2BreadcrumbItem as kr, Z2BreadcrumbLink as Er, Z2BreadcrumbList as Rr, Z2BreadcrumbPage as Hr, Z2BreadcrumbSeparator as yr } from "./components/breadcrumb/z2-breadcrumb.js";
|
|
70
|
-
import { Z2RadioGroup as Gr, Z2RadioGroupIndicator as _r, Z2RadioGroupItem as
|
|
70
|
+
import { Z2RadioGroup as Gr, Z2RadioGroupIndicator as _r, Z2RadioGroupItem as Vr } from "./components/radio/z2-radio.js";
|
|
71
71
|
import { default as Ur } from "./components/assets/icons/apartment-building.js";
|
|
72
72
|
import { Check as Xr } from "./components/assets/icons/check.js";
|
|
73
73
|
import { default as Qr } from "./components/assets/icons/chevron-left.js";
|
|
@@ -85,7 +85,7 @@ import { default as Zt } from "./components/assets/icons/link.js";
|
|
|
85
85
|
import { default as It } from "./components/assets/icons/list-tree.js";
|
|
86
86
|
import { default as bt } from "./components/assets/icons/media-record.js";
|
|
87
87
|
import { Minus as Dt } from "./components/assets/icons/minus.js";
|
|
88
|
-
import { default as
|
|
88
|
+
import { default as gt } from "./components/assets/icons/octagon-warning-Copy.js";
|
|
89
89
|
import { default as vt } from "./components/assets/icons/pin.js";
|
|
90
90
|
import { default as Lt } from "./components/assets/icons/sitemap.js";
|
|
91
91
|
import { default as ht } from "./components/assets/icons/slider.js";
|
|
@@ -94,21 +94,23 @@ import { default as kt } from "./components/assets/icons/vector.js";
|
|
|
94
94
|
import { XMark as Rt } from "./components/assets/icons/x-mark.js";
|
|
95
95
|
import { default as yt } from "./components/assets/icons/x.js";
|
|
96
96
|
import { default as Gt } from "./components/assets/icons/z2-icon.js";
|
|
97
|
-
import { default as
|
|
97
|
+
import { default as Vt } from "./components/assets/icons/z2-slash.js";
|
|
98
98
|
import { default as Ut } from "./components/assets/icons/z2data.js";
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
99
|
+
import { default as Xt } from "./components/assets/icons/vector_3.js";
|
|
100
|
+
import { default as Qt } from "./components/assets/icons/table-cols-2.js";
|
|
101
|
+
import { useTheme as jt } from "./lib/theme.hook.js";
|
|
102
|
+
import { cn as zt } from "./lib/utils.js";
|
|
103
|
+
import { Z2PopoverTrigger as $t } from "./components/collapsible-side-nav-bar/popover/popover-trigger.js";
|
|
104
|
+
import { Z2PopoverContent as ea } from "./components/collapsible-side-nav-bar/popover/popover-content.js";
|
|
103
105
|
export {
|
|
104
106
|
p as Alert,
|
|
105
107
|
m as AlertCirclesIcon,
|
|
106
108
|
n as AlertDescription,
|
|
107
109
|
f as AlertTitle,
|
|
108
110
|
Ur as ApartmentBuildingIcon,
|
|
109
|
-
|
|
111
|
+
Tr as Avatar,
|
|
110
112
|
Ge as AvatarCell,
|
|
111
|
-
|
|
113
|
+
gr as AvatarWithLabel,
|
|
112
114
|
br as Badge,
|
|
113
115
|
ke as BooleanCell,
|
|
114
116
|
x as Button,
|
|
@@ -121,10 +123,10 @@ export {
|
|
|
121
123
|
F as CirclesIcon,
|
|
122
124
|
Lr as ColumnReOrder,
|
|
123
125
|
K as CountryFlags,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
Wo as DEFAULT_ACCEPT,
|
|
127
|
+
ge as DEFAULT_EMPTY_MESSAGE,
|
|
126
128
|
_ as DatabaseCopy,
|
|
127
|
-
|
|
129
|
+
V as DatabaseCopyIcon,
|
|
128
130
|
ye as DescriptionCell,
|
|
129
131
|
et as DotsIcon,
|
|
130
132
|
tt as DoubleChevronLeftIcon,
|
|
@@ -135,7 +137,7 @@ export {
|
|
|
135
137
|
mt as HomeIcon,
|
|
136
138
|
xt as InfoIcon,
|
|
137
139
|
Oo as Input,
|
|
138
|
-
|
|
140
|
+
Ve as LabelCell,
|
|
139
141
|
it as LeftArrowIcon,
|
|
140
142
|
Re as LinkCell,
|
|
141
143
|
Zt as LinkIcon,
|
|
@@ -146,7 +148,7 @@ export {
|
|
|
146
148
|
Jo as NavHeader,
|
|
147
149
|
Yo as NavItem,
|
|
148
150
|
Pe as NumberCell,
|
|
149
|
-
|
|
151
|
+
gt as OctagonWarningIcon,
|
|
150
152
|
xr as PaginationInfo,
|
|
151
153
|
ir as PaginationQuickJumper,
|
|
152
154
|
vt as PinIcon,
|
|
@@ -163,6 +165,7 @@ export {
|
|
|
163
165
|
be as TableBody,
|
|
164
166
|
Ir as TableCard,
|
|
165
167
|
he as TableCell,
|
|
168
|
+
Qt as TableCols2Icon,
|
|
166
169
|
Be as TableContext,
|
|
167
170
|
pr as TableFooter,
|
|
168
171
|
fr as TableFooterContent,
|
|
@@ -176,6 +179,7 @@ export {
|
|
|
176
179
|
Qe as TableRow,
|
|
177
180
|
hr as TreeCheckboxSelect,
|
|
178
181
|
Pt as UploadIcon,
|
|
182
|
+
Xt as Vector3Icon,
|
|
179
183
|
kt as VectorIcon,
|
|
180
184
|
U as WindowLeftCopy,
|
|
181
185
|
O as WindowLeftCopyIcon,
|
|
@@ -222,14 +226,14 @@ export {
|
|
|
222
226
|
bo as Z2DropdownSub,
|
|
223
227
|
Co as Z2DropdownSubContent,
|
|
224
228
|
Do as Z2DropdownSubItem,
|
|
225
|
-
|
|
229
|
+
To as Z2DropdownSubTrigger,
|
|
226
230
|
Gt as Z2Icon,
|
|
227
231
|
k as Z2Popover,
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
ea as Z2PopoverContent,
|
|
233
|
+
$t as Z2PopoverTrigger,
|
|
230
234
|
Gr as Z2RadioGroup,
|
|
231
235
|
_r as Z2RadioGroupIndicator,
|
|
232
|
-
|
|
236
|
+
Vr as Z2RadioGroupItem,
|
|
233
237
|
qo as Z2Select,
|
|
234
238
|
zo as Z2SelectContent,
|
|
235
239
|
Ko as Z2SelectGroup,
|
|
@@ -242,14 +246,14 @@ export {
|
|
|
242
246
|
pe as Z2SelectValue,
|
|
243
247
|
s as Z2SideNavBar,
|
|
244
248
|
D as Z2SideNavBarContent,
|
|
245
|
-
|
|
249
|
+
g as Z2SideNavBarFooter,
|
|
246
250
|
v as Z2SideNavBarGroup,
|
|
247
251
|
b as Z2SideNavBarHeader,
|
|
248
252
|
L as Z2SideNavBarItem,
|
|
249
253
|
c as Z2SideNavBarProvider,
|
|
250
254
|
h as Z2SideNavBarSeparator,
|
|
251
255
|
I as Z2SidebarVariants,
|
|
252
|
-
|
|
256
|
+
Vt as Z2SlashIcon,
|
|
253
257
|
fe as Z2Stepper,
|
|
254
258
|
me as Z2StepperItem,
|
|
255
259
|
xe as Z2Tabs,
|
|
@@ -260,9 +264,9 @@ export {
|
|
|
260
264
|
Zr as Z2Tooltip,
|
|
261
265
|
Cr as badgeVariants,
|
|
262
266
|
u as buttonVariants,
|
|
263
|
-
|
|
267
|
+
zt as cn,
|
|
264
268
|
De as extractCellValue,
|
|
265
269
|
Le as useTableContext,
|
|
266
|
-
|
|
270
|
+
jt as useTheme,
|
|
267
271
|
P as useZ2SideNavBar
|
|
268
272
|
};
|
|
@@ -34,3 +34,5 @@ export { default as XIcon } from './x';
|
|
|
34
34
|
export { default as Z2Icon } from './z2-icon';
|
|
35
35
|
export { default as Z2SlashIcon } from './z2-slash';
|
|
36
36
|
export { default as Z2DataIcon } from './z2data';
|
|
37
|
+
export { default as Vector3Icon } from './vector_3';
|
|
38
|
+
export { default as TableCols2Icon } from './table-cols-2';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
type IconProps = SVGProps<SVGSVGElement> & {
|
|
3
|
+
secondaryfill?: string;
|
|
4
|
+
strokewidth?: number;
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function TableCols2({ fill, secondaryfill, strokewidth, width, height, title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TableCols2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableProps, TableSchema, TableSearch, TableSort } from '../table/table.type';
|
|
3
|
-
import { TableFilter } from '../table-filter/table-filter.type';
|
|
3
|
+
import { TableFilter, FilterRule } from '../table-filter/table-filter.type';
|
|
4
4
|
import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '../table/components/pagination/pagination.type';
|
|
5
5
|
import { FilterSchema } from '../table-filter/table-filter.type';
|
|
6
6
|
export interface TableCardProps {
|
|
@@ -18,6 +18,7 @@ export interface TableCardProps {
|
|
|
18
18
|
quickFilters?: string[];
|
|
19
19
|
showFilterButton?: boolean;
|
|
20
20
|
filterSchema: FilterSchema;
|
|
21
|
+
onDynamicChange?: (filters: FilterRule[]) => void;
|
|
21
22
|
};
|
|
22
23
|
headerLeftContent?: React.ReactNode;
|
|
23
24
|
headerActions?: React.ReactNode;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
condition: string;
|
|
4
|
-
value: string;
|
|
5
|
-
};
|
|
6
|
-
onChange: (update: {
|
|
7
|
-
condition?: string;
|
|
8
|
-
value?: string;
|
|
9
|
-
}) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps) => {
|
|
1
|
+
import { FilterComponentProps } from '../../table-filter.type';
|
|
2
|
+
export declare const useNumberFilter: ({ value, onChange }: FilterComponentProps) => {
|
|
12
3
|
specificAmount: string;
|
|
13
4
|
atLeast: string;
|
|
14
5
|
noMoreThan: string;
|
|
@@ -20,4 +11,3 @@ export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps
|
|
|
20
11
|
resetAtLeast: () => void;
|
|
21
12
|
resetNoMoreThan: () => void;
|
|
22
13
|
};
|
|
23
|
-
export {};
|
|
@@ -21,6 +21,7 @@ export type FilterSchema = FilterSchemaField[];
|
|
|
21
21
|
export type TableFilter = {
|
|
22
22
|
value: FilterRule[];
|
|
23
23
|
onChange: (filters: FilterRule[]) => void;
|
|
24
|
+
onDynamicChange?: (filters: FilterRule[]) => void;
|
|
24
25
|
};
|
|
25
26
|
export interface TableFilterProps {
|
|
26
27
|
filterSchema: FilterSchema;
|
|
@@ -32,9 +33,9 @@ export type FilterComponentProps = {
|
|
|
32
33
|
condition?: string;
|
|
33
34
|
value?: string | string[];
|
|
34
35
|
}) => void;
|
|
35
|
-
value
|
|
36
|
+
value?: {
|
|
36
37
|
condition?: string;
|
|
37
|
-
value
|
|
38
|
+
value?: string | string[];
|
|
38
39
|
};
|
|
39
40
|
filterOptions?: FilterOption[];
|
|
40
41
|
};
|