@ztwoint/z-ui 0.1.72 → 0.1.74
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 +10 -10
- package/dist/components/table-card/table-card.js +133 -129
- package/dist/components/table-card/table-card.type.d.ts +1 -0
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/table-card/table-card.type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,23 +3,23 @@ import * as y from "react";
|
|
|
3
3
|
import { DEFAULT_EMPTY_MESSAGE as S, TABLE_CSS_CLASSES as n } from "./table.const.js";
|
|
4
4
|
import { TableHeader as g } 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
|
|
6
|
+
import { TableEmptyState as v } from "./components/table-empty-state.js";
|
|
7
|
+
import { TableContext as w } from "./table.context.js";
|
|
8
8
|
import { cn as m } from "../../lib/utils.js";
|
|
9
9
|
const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c = !1, ...f }) => {
|
|
10
|
-
const
|
|
10
|
+
const u = y.useContext(w), {
|
|
11
11
|
dataSource: t = [],
|
|
12
12
|
schema: o = [],
|
|
13
13
|
loading: r = !1,
|
|
14
|
-
emptyMessage:
|
|
15
|
-
customCells:
|
|
16
|
-
} =
|
|
14
|
+
emptyMessage: p = S,
|
|
15
|
+
customCells: b
|
|
16
|
+
} = u || f, h = () => !t || t.length === 0 && !r ? /* @__PURE__ */ e(v, { 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
|
|
@@ -28,16 +28,16 @@ const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c
|
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
30
|
className: m(
|
|
31
|
-
r ? "overflow-y-hidden" : "overflow-y-auto",
|
|
31
|
+
r ? "overflow-y-hidden relative" : "overflow-y-auto",
|
|
32
32
|
n.bordered[a.hasBorder && !r && t.length > 0 ? "true" : "false"],
|
|
33
33
|
i
|
|
34
34
|
),
|
|
35
35
|
children: [
|
|
36
36
|
/* @__PURE__ */ l("table", { className: m(n.table, "w-full"), children: [
|
|
37
|
-
|
|
37
|
+
h(),
|
|
38
38
|
/* @__PURE__ */ e(g, { schema: o, sort: d, 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
|
};
|