@ztwoint/z-ui 0.1.71 → 0.1.73
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/table/table.js +20 -20
- package/dist/components/table-card/table-card.js +133 -129
- package/dist/components/table-card/table-card.type.d.ts +1 -0
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.d.ts +0 -1
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.js +18 -19
- package/dist/components/table-filter/table-filter-button.js +28 -29
- package/dist/components/table-filter/table-filter-column-button.js +28 -33
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/table-card/table-card.type.d.ts +1 -0
- package/dist/types/components/table-filter/close-filter-confirm/filter-confirmation-dialog.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { DEFAULT_EMPTY_MESSAGE as
|
|
4
|
-
import { TableHeader as
|
|
2
|
+
import * as S from "react";
|
|
3
|
+
import { DEFAULT_EMPTY_MESSAGE as g, TABLE_CSS_CLASSES as m } from "./table.const.js";
|
|
4
|
+
import { TableHeader as y } from "./components/table-header/table-header.js";
|
|
5
5
|
import { TableRow as T } from "./components/table-row.js";
|
|
6
|
-
import { TableEmptyState as
|
|
7
|
-
import { TableContext as
|
|
8
|
-
import { cn as
|
|
9
|
-
const j = ({ cell: a = { hasBorder: !0 }, sort:
|
|
10
|
-
const
|
|
6
|
+
import { TableEmptyState as E } from "./components/table-empty-state.js";
|
|
7
|
+
import { TableContext as v } from "./table.context.js";
|
|
8
|
+
import { cn as n } from "../../lib/utils.js";
|
|
9
|
+
const j = ({ cell: a = { hasBorder: !0 }, sort: i, className: d, stickyHeader: c = !1, ...f }) => {
|
|
10
|
+
const u = S.useContext(v), {
|
|
11
11
|
dataSource: t = [],
|
|
12
12
|
schema: o = [],
|
|
13
13
|
loading: r = !1,
|
|
14
|
-
emptyMessage:
|
|
15
|
-
customCells:
|
|
16
|
-
} =
|
|
14
|
+
emptyMessage: p = g,
|
|
15
|
+
customCells: b
|
|
16
|
+
} = u || f, h = () => !t || t.length === 0 && !r ? /* @__PURE__ */ e(E, { colSpan: o.length, message: p }) : /* @__PURE__ */ e("tbody", { children: t.map((x, s) => /* @__PURE__ */ e(
|
|
17
17
|
T,
|
|
18
18
|
{
|
|
19
19
|
record: x,
|
|
20
20
|
index: s,
|
|
21
21
|
schema: o,
|
|
22
|
-
customCells:
|
|
22
|
+
customCells: b,
|
|
23
23
|
cell: a
|
|
24
24
|
},
|
|
25
25
|
s
|
|
@@ -27,17 +27,17 @@ const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c
|
|
|
27
27
|
return /* @__PURE__ */ l(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
|
-
className:
|
|
31
|
-
r ? "
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
className: n(
|
|
31
|
+
r ? "relative" : "overflow-y-auto",
|
|
32
|
+
m.bordered[a.hasBorder && !r && t.length > 0 ? "true" : "false"],
|
|
33
|
+
d
|
|
34
34
|
),
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */ l("table", { className: m
|
|
37
|
-
|
|
38
|
-
/* @__PURE__ */ e(
|
|
36
|
+
/* @__PURE__ */ l("table", { className: n(m.table, "w-full"), children: [
|
|
37
|
+
h(),
|
|
38
|
+
/* @__PURE__ */ e(y, { schema: o, sort: i, cell: a, stickyHeader: c })
|
|
39
39
|
] }),
|
|
40
|
-
r && /* @__PURE__ */ e("div", { className: "
|
|
40
|
+
r && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
|
|
41
41
|
/* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
|
|
42
42
|
/* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
|
|
43
43
|
] }) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx 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
|
-
import { cn as
|
|
4
|
+
import { cn as d } from "../../lib/utils.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import "../alert/alert.const.js";
|
|
7
7
|
import "../button/button.js";
|
|
@@ -30,8 +30,8 @@ import "../stepper/stepper.js";
|
|
|
30
30
|
import "../stepper-item/stepper-item.js";
|
|
31
31
|
import "@radix-ui/react-tabs";
|
|
32
32
|
import "../tooltip/tooltip.js";
|
|
33
|
-
import { Filter as
|
|
34
|
-
import
|
|
33
|
+
import { Filter as p } from "../table-filter/index.js";
|
|
34
|
+
import b from "../assets/icons/octagon-warning-Copy.js";
|
|
35
35
|
import "../badge/badge.js";
|
|
36
36
|
import "../avatar/avatar.js";
|
|
37
37
|
import "../text-preset/text-preset.js";
|
|
@@ -39,18 +39,18 @@ import "react-dom";
|
|
|
39
39
|
import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
|
|
40
40
|
import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
|
|
41
41
|
import "../table/table.context.js";
|
|
42
|
-
const
|
|
43
|
-
dataSource:
|
|
44
|
-
schema:
|
|
45
|
-
loading:
|
|
46
|
-
emptyMessage:
|
|
47
|
-
className:
|
|
48
|
-
rounded:
|
|
42
|
+
const Fe = ({
|
|
43
|
+
dataSource: B,
|
|
44
|
+
schema: f,
|
|
45
|
+
loading: H,
|
|
46
|
+
emptyMessage: k,
|
|
47
|
+
className: T,
|
|
48
|
+
rounded: i = !0,
|
|
49
49
|
bordered: n = !0,
|
|
50
|
-
showHeader:
|
|
51
|
-
headerClassName:
|
|
52
|
-
search:
|
|
53
|
-
filter:
|
|
50
|
+
showHeader: P = !0,
|
|
51
|
+
headerClassName: _,
|
|
52
|
+
search: m,
|
|
53
|
+
filter: t,
|
|
54
54
|
headerLeftContent: h,
|
|
55
55
|
headerActions: u,
|
|
56
56
|
body: l = {
|
|
@@ -63,127 +63,131 @@ const vt = ({
|
|
|
63
63
|
pagination: o,
|
|
64
64
|
paginationInfo: c,
|
|
65
65
|
paginationQuickJumper: s,
|
|
66
|
-
error: x = !1
|
|
66
|
+
error: x = !1,
|
|
67
|
+
freeze: R = !1
|
|
67
68
|
}) => {
|
|
68
69
|
var F;
|
|
69
70
|
if (x)
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
typeof x == "string" && /* @__PURE__ */
|
|
71
|
+
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: [
|
|
72
|
+
/* @__PURE__ */ e(b, { className: "mt-1.5" }),
|
|
73
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
|
|
74
|
+
/* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
|
|
75
|
+
/* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
|
|
76
|
+
typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
|
|
76
77
|
] })
|
|
77
78
|
] }) });
|
|
78
|
-
const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v =
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v = m || t || h || u, S = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
|
|
80
|
+
return /* @__PURE__ */ a("div", { className: d("flex flex-col overflow-hidden relative", T), children: [
|
|
81
|
+
R && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full cursor-not-allowed bg-white/50" }),
|
|
82
|
+
/* @__PURE__ */ a(r, { dataSource: B, schema: f, loading: H, emptyMessage: k, children: [
|
|
83
|
+
P && v && /* @__PURE__ */ a(
|
|
84
|
+
r.Header,
|
|
85
|
+
{
|
|
86
|
+
className: d(
|
|
87
|
+
"flex-shrink-0",
|
|
88
|
+
n && "border-stroke-solid-medium border-1 border-b-0",
|
|
89
|
+
i && "rounded-t-xl",
|
|
90
|
+
_
|
|
91
|
+
),
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ a(r.HeaderContent, { children: [
|
|
94
|
+
h && h,
|
|
95
|
+
m && /* @__PURE__ */ e(
|
|
96
|
+
r.Search,
|
|
97
|
+
{
|
|
98
|
+
search: {
|
|
99
|
+
value: m.value || "",
|
|
100
|
+
onChange: m.onChange || (() => {
|
|
101
|
+
}),
|
|
102
|
+
placeholder: m.placeholder
|
|
103
|
+
},
|
|
104
|
+
className: m.className
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
t && /* @__PURE__ */ a(
|
|
108
|
+
p,
|
|
109
|
+
{
|
|
110
|
+
filterSchema: t.filterSchema,
|
|
111
|
+
filter: {
|
|
112
|
+
value: t.value || [],
|
|
113
|
+
onChange: t.onChange || (() => {
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
children: [
|
|
117
|
+
S && /* @__PURE__ */ e(p.FilterButton, {}),
|
|
118
|
+
(F = t == null ? void 0 : t.quickFilters) == null ? void 0 : F.map((w) => /* @__PURE__ */ e(p.FilterColumnButton, { filterName: w }, w))
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] }),
|
|
123
|
+
u && /* @__PURE__ */ e(r.HeaderContent, { children: u })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
r.Body,
|
|
129
|
+
{
|
|
130
|
+
cell: l == null ? void 0 : l.cell,
|
|
131
|
+
sort: l == null ? void 0 : l.sort,
|
|
132
|
+
className: d(
|
|
133
|
+
"flex-1 min-h-0",
|
|
134
|
+
n && "border-stroke-solid-light border-1",
|
|
135
|
+
i && !(P && v) && "rounded-t-xl",
|
|
136
|
+
i && !(g && N) && "rounded-b-xl",
|
|
137
|
+
n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
|
|
138
|
+
n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
|
|
139
|
+
l == null ? void 0 : l.className
|
|
140
|
+
),
|
|
141
|
+
stickyHeader: l == null ? void 0 : l.stickyHeader
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
g && N && /* @__PURE__ */ a(
|
|
145
|
+
r.Footer,
|
|
146
|
+
{
|
|
147
|
+
className: d(
|
|
148
|
+
"flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
|
|
149
|
+
n && "border",
|
|
150
|
+
i && "rounded-b-xl",
|
|
151
|
+
j
|
|
152
|
+
),
|
|
153
|
+
children: [
|
|
154
|
+
c ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
|
|
155
|
+
r.PaginationInfo,
|
|
94
156
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
placeholder: a.placeholder
|
|
100
|
-
},
|
|
101
|
-
className: a.className
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
e && /* @__PURE__ */ m(
|
|
105
|
-
P,
|
|
106
|
-
{
|
|
107
|
-
filterSchema: e.filterSchema,
|
|
108
|
-
filter: {
|
|
109
|
-
value: e.value || [],
|
|
110
|
-
onChange: e.onChange || (() => {
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
children: [
|
|
114
|
-
R && /* @__PURE__ */ t(P.FilterButton, {}),
|
|
115
|
-
(F = e == null ? void 0 : e.quickFilters) == null ? void 0 : F.map((B) => /* @__PURE__ */ t(P.FilterColumnButton, { filterName: B }, B))
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
] }),
|
|
120
|
-
u && /* @__PURE__ */ t(r.HeaderContent, { children: u })
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
/* @__PURE__ */ t(
|
|
125
|
-
r.Body,
|
|
126
|
-
{
|
|
127
|
-
cell: l == null ? void 0 : l.cell,
|
|
128
|
-
sort: l == null ? void 0 : l.sort,
|
|
129
|
-
className: i(
|
|
130
|
-
"flex-1 min-h-0",
|
|
131
|
-
n && "border-stroke-solid-light border-1",
|
|
132
|
-
d && !(p && v) && "rounded-t-xl",
|
|
133
|
-
d && !(g && N) && "rounded-b-xl",
|
|
134
|
-
n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
|
|
135
|
-
n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
|
|
136
|
-
l == null ? void 0 : l.className
|
|
137
|
-
),
|
|
138
|
-
stickyHeader: l == null ? void 0 : l.stickyHeader
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
g && N && /* @__PURE__ */ m(
|
|
142
|
-
r.Footer,
|
|
143
|
-
{
|
|
144
|
-
className: i(
|
|
145
|
-
"flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
|
|
146
|
-
n && "border",
|
|
147
|
-
d && "rounded-b-xl",
|
|
148
|
-
j
|
|
149
|
-
),
|
|
150
|
-
children: [
|
|
151
|
-
c ? /* @__PURE__ */ t(r.FooterContent, { children: /* @__PURE__ */ t(
|
|
152
|
-
r.PaginationInfo,
|
|
153
|
-
{
|
|
154
|
-
showTotal: c.showTotal,
|
|
155
|
-
totalItems: c.totalItems,
|
|
156
|
-
currentPage: c.currentPage,
|
|
157
|
-
itemsPerPage: c.itemsPerPage
|
|
158
|
-
}
|
|
159
|
-
) }) : s || o ? /* @__PURE__ */ t(r.FooterContent, { children: null }) : null,
|
|
160
|
-
(s || o) && /* @__PURE__ */ m(r.FooterContent, { children: [
|
|
161
|
-
C && /* @__PURE__ */ t(
|
|
162
|
-
r.PaginationQuickJumper,
|
|
163
|
-
{
|
|
164
|
-
currentPage: s.currentPage,
|
|
165
|
-
totalPage: s.totalPage,
|
|
166
|
-
onChange: s.onChange || (() => {
|
|
167
|
-
}),
|
|
168
|
-
disabled: s.disabled
|
|
157
|
+
showTotal: c.showTotal,
|
|
158
|
+
totalItems: c.totalItems,
|
|
159
|
+
currentPage: c.currentPage,
|
|
160
|
+
itemsPerPage: c.itemsPerPage
|
|
169
161
|
}
|
|
170
|
-
),
|
|
171
|
-
o && /* @__PURE__ */
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
162
|
+
) }) : s || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
|
|
163
|
+
(s || o) && /* @__PURE__ */ a(r.FooterContent, { children: [
|
|
164
|
+
C && /* @__PURE__ */ e(
|
|
165
|
+
r.PaginationQuickJumper,
|
|
166
|
+
{
|
|
167
|
+
currentPage: s.currentPage,
|
|
168
|
+
totalPage: s.totalPage,
|
|
169
|
+
onChange: s.onChange || (() => {
|
|
170
|
+
}),
|
|
171
|
+
disabled: s.disabled
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
o && /* @__PURE__ */ e(
|
|
175
|
+
r.Pagination,
|
|
176
|
+
{
|
|
177
|
+
currentPage: o.currentPage,
|
|
178
|
+
totalPage: o.totalPage,
|
|
179
|
+
onChange: o.onChange || (() => {
|
|
180
|
+
}),
|
|
181
|
+
totalItems: o.totalItems
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
] })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] })
|
|
189
|
+
] });
|
|
186
190
|
};
|
|
187
191
|
export {
|
|
188
|
-
|
|
192
|
+
Fe as default
|
|
189
193
|
};
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { Button as
|
|
3
|
-
import { Z2Dialog as
|
|
4
|
-
const
|
|
5
|
-
onClose:
|
|
6
|
-
onKeepChanges:
|
|
7
|
-
onRevertChanges:
|
|
8
|
-
onApplyChanges: a
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/* @__PURE__ */ n(h, { children: [
|
|
2
|
+
import { Button as i } from "../../button/button.js";
|
|
3
|
+
import { Z2Dialog as t, Z2DialogContent as s, Z2DialogHeader as d, Z2DialogTitle as h, Z2DialogDescription as c, Z2DialogFooter as g } from "../../dialog/dialog.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
onClose: l,
|
|
6
|
+
onKeepChanges: o,
|
|
7
|
+
onRevertChanges: r,
|
|
8
|
+
onApplyChanges: a
|
|
9
|
+
}) => /* @__PURE__ */ e(t, { open: !0, onOpenChange: l, children: /* @__PURE__ */ n(s, { className: "max-w-md p-4 rounded-2xl", children: [
|
|
10
|
+
/* @__PURE__ */ n(d, { children: [
|
|
12
11
|
/* @__PURE__ */ n("div", { className: "flex justify-between", children: [
|
|
13
|
-
/* @__PURE__ */ e(
|
|
12
|
+
/* @__PURE__ */ e(h, { children: "Unsaved Filter Changes" }),
|
|
14
13
|
/* @__PURE__ */ e(
|
|
15
|
-
|
|
14
|
+
i,
|
|
16
15
|
{
|
|
17
16
|
"aria-label": "Close",
|
|
18
17
|
className: "ml-4 p-2 text-xl leading-none font-bold bg-transparent border-none shadow-none hover:bg-gray-100 min-w-0 min-h-0",
|
|
19
|
-
onClick:
|
|
18
|
+
onClick: o,
|
|
20
19
|
children: "×"
|
|
21
20
|
}
|
|
22
21
|
)
|
|
23
22
|
] }),
|
|
24
|
-
/* @__PURE__ */ e(
|
|
23
|
+
/* @__PURE__ */ e(c, { children: "You have unsaved filter changes. Would you like to keep these changes or revert to the previous state?" })
|
|
25
24
|
] }),
|
|
26
|
-
/* @__PURE__ */ n(
|
|
27
|
-
/* @__PURE__ */ e(
|
|
28
|
-
/* @__PURE__ */ e(
|
|
25
|
+
/* @__PURE__ */ n(g, { children: [
|
|
26
|
+
/* @__PURE__ */ e(i, { onClick: r, variant: "stroke", shade: "danger", size: "small", children: "Discard" }),
|
|
27
|
+
/* @__PURE__ */ e(i, { onClick: a, variant: "filled", shade: "brand", size: "small", children: "Apply Changes" })
|
|
29
28
|
] })
|
|
30
|
-
] }) })
|
|
29
|
+
] }) });
|
|
31
30
|
export {
|
|
32
|
-
|
|
31
|
+
f as FilterConfirmationDialog
|
|
33
32
|
};
|
|
@@ -2,8 +2,8 @@ import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import * as y from "react";
|
|
3
3
|
import * as m from "@radix-ui/react-popover";
|
|
4
4
|
import { Button as u } from "../button/button.js";
|
|
5
|
-
import { useTableFilterContext as
|
|
6
|
-
import
|
|
5
|
+
import { useTableFilterContext as H } from "./table-filter.context.js";
|
|
6
|
+
import U from "./filters/text.js";
|
|
7
7
|
import V from "./filters/boolean.js";
|
|
8
8
|
import q from "./filters/number/number.js";
|
|
9
9
|
import E from "./filters/checkbox.js";
|
|
@@ -12,7 +12,7 @@ import { SelectedFiltersDisplay as J } from "./selected-filters-display/selected
|
|
|
12
12
|
import { createFilterDisplayItems as L, calculateTotalCount as M } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
13
13
|
import { FilterConfirmationDialog as Q } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
14
14
|
import { hasUnsavedFilterChanges as C } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
15
|
-
const
|
|
15
|
+
const ne = () => {
|
|
16
16
|
const [F, a] = y.useState(!1), [x, n] = y.useState(!1), {
|
|
17
17
|
selectedColumn: r,
|
|
18
18
|
setSelectedColumn: N,
|
|
@@ -25,43 +25,43 @@ const ae = () => {
|
|
|
25
25
|
hasActiveFilters: d,
|
|
26
26
|
tempFilters: i,
|
|
27
27
|
filterSchema: c,
|
|
28
|
-
filter:
|
|
29
|
-
filterComponents:
|
|
30
|
-
} =
|
|
31
|
-
!e && x ?
|
|
32
|
-
},
|
|
33
|
-
D(), n(!1);
|
|
28
|
+
filter: h,
|
|
29
|
+
filterComponents: p = {}
|
|
30
|
+
} = H(), O = (e) => {
|
|
31
|
+
!e && x ? C(i, h.value) ? a(!0) : n(!1) : n(e);
|
|
32
|
+
}, g = () => {
|
|
33
|
+
D(), a(!1), n(!1);
|
|
34
34
|
}, P = () => {
|
|
35
35
|
a(!1), n(!1);
|
|
36
36
|
}, S = () => {
|
|
37
37
|
A(), a(!1), n(!1);
|
|
38
38
|
}, T = () => {
|
|
39
39
|
a(!1);
|
|
40
|
-
}, $ = L(i, c),
|
|
40
|
+
}, $ = C(i, h.value), R = L(i, c), z = M(R), B = () => {
|
|
41
41
|
if (!r) return null;
|
|
42
|
-
const e = c.find((
|
|
42
|
+
const e = c.find((o) => o.filterKey === r), v = {
|
|
43
43
|
boolean: V,
|
|
44
|
-
string:
|
|
44
|
+
string: U,
|
|
45
45
|
number: q,
|
|
46
46
|
checkbox: E
|
|
47
|
-
}, b = (e == null ? void 0 : e.type) && (
|
|
47
|
+
}, b = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || v[(e == null ? void 0 : e.type) ?? "string"];
|
|
48
48
|
if (!b)
|
|
49
49
|
return console.warn(
|
|
50
50
|
`No filter component found for column "${e == null ? void 0 : e.filterKey}" with type "${e == null ? void 0 : e.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
|
|
51
51
|
), null;
|
|
52
|
-
const
|
|
53
|
-
condition: (
|
|
54
|
-
value: (
|
|
52
|
+
const s = w(r), I = {
|
|
53
|
+
condition: (s == null ? void 0 : s.condition) || "",
|
|
54
|
+
value: (s == null ? void 0 : s.value) || ""
|
|
55
55
|
};
|
|
56
56
|
return /* @__PURE__ */ t("div", { className: "flex-1 h-full", children: /* @__PURE__ */ t("div", { className: "mb-4 h-full", children: /* @__PURE__ */ t(
|
|
57
57
|
b,
|
|
58
58
|
{
|
|
59
59
|
value: I,
|
|
60
|
-
onChange: ({ condition:
|
|
61
|
-
filterOptions: e != null && e.options ? Object.entries(e.options).map(([
|
|
62
|
-
label:
|
|
63
|
-
value:
|
|
64
|
-
total:
|
|
60
|
+
onChange: ({ condition: o, value: f }) => K(r, o, f),
|
|
61
|
+
filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, f]) => ({
|
|
62
|
+
label: o,
|
|
63
|
+
value: o,
|
|
64
|
+
total: f
|
|
65
65
|
})) : void 0
|
|
66
66
|
},
|
|
67
67
|
r
|
|
@@ -76,7 +76,7 @@ const ae = () => {
|
|
|
76
76
|
size: "small",
|
|
77
77
|
children: [
|
|
78
78
|
"Filter ",
|
|
79
|
-
d && `(${
|
|
79
|
+
d && `(${h.value.length})`
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
82
|
) }),
|
|
@@ -103,21 +103,21 @@ const ae = () => {
|
|
|
103
103
|
e.filterKey
|
|
104
104
|
))
|
|
105
105
|
] }),
|
|
106
|
-
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ?
|
|
106
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? B() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
|
|
107
107
|
] }),
|
|
108
|
-
|
|
108
|
+
$ && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[73px]", children: [
|
|
109
109
|
/* @__PURE__ */ t(J, { selectedFilters: i, schema: c }),
|
|
110
110
|
/* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
|
|
111
111
|
/* @__PURE__ */ t(u, { onClick: j, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
|
|
112
112
|
/* @__PURE__ */ t(
|
|
113
113
|
u,
|
|
114
114
|
{
|
|
115
|
-
onClick:
|
|
115
|
+
onClick: g,
|
|
116
116
|
variant: "filled",
|
|
117
117
|
shade: "neutral",
|
|
118
118
|
size: "small",
|
|
119
119
|
className: "min-w-20",
|
|
120
|
-
children: `Apply ${
|
|
120
|
+
children: `Apply ${z || ""}`
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
] })
|
|
@@ -131,12 +131,11 @@ const ae = () => {
|
|
|
131
131
|
onClose: T,
|
|
132
132
|
onKeepChanges: P,
|
|
133
133
|
onRevertChanges: S,
|
|
134
|
-
onApplyChanges:
|
|
135
|
-
hasUnsavedChanges: C(i, p.value)
|
|
134
|
+
onApplyChanges: g
|
|
136
135
|
}
|
|
137
136
|
)
|
|
138
137
|
] });
|
|
139
138
|
};
|
|
140
139
|
export {
|
|
141
|
-
|
|
140
|
+
ne as TableFilterButton
|
|
142
141
|
};
|