@cagatayfdn/flora-components 0.0.130 → 0.0.132
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 +194 -152
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/prodivers.css +1 -1
- package/package.json +1 -1
|
@@ -1,215 +1,257 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { c as
|
|
5
|
-
import { s as
|
|
6
|
-
import { ThemeAppearance as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { _ as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { j as t } from "../../jsx-runtime-BcAkpsdy.js";
|
|
2
|
+
import ae, { useState as F, useEffect as se } from "react";
|
|
3
|
+
import ne from "../NoResult/NoResult.js";
|
|
4
|
+
import { c as w } from "../../index-BHf7G3IG.js";
|
|
5
|
+
import { s as f } from "../../Table.module-DUqpZOLt.js";
|
|
6
|
+
import { ThemeAppearance as O, AppearanceSpinner as z } from "../../enums/appearance.js";
|
|
7
|
+
import D from "../Checkbox/Checkbox.js";
|
|
8
|
+
import oe from "../Loading/Loading.js";
|
|
9
|
+
import le from "../ScrollContainer/ScrollContainer.js";
|
|
10
|
+
import G from "./TableHeader.js";
|
|
11
|
+
import ie from "./TableSort.js";
|
|
12
|
+
import de from "../Icon/index.js";
|
|
13
|
+
import { Icons as ce } from "../../assets/icons/icons.js";
|
|
14
|
+
import { i as x } from "../../includes-8YTFrx85.js";
|
|
15
|
+
import { _ as U, k as he } from "../../keys-B0bo5Q7o.js";
|
|
16
|
+
import { _ as V, a as pe, b as fe } from "../../_reduce-DsUCMz4O.js";
|
|
17
|
+
import { _ as xe } from "../../Select-BE_y91ZN.js";
|
|
18
|
+
function ue(o, a) {
|
|
19
|
+
for (var n = 0, d = a.length, u = []; n < d; )
|
|
20
|
+
o(a[n]) && (u[u.length] = a[n]), n += 1;
|
|
21
|
+
return u;
|
|
20
22
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
this.xf =
|
|
23
|
+
var ge = /* @__PURE__ */ function() {
|
|
24
|
+
function o(a, n) {
|
|
25
|
+
this.xf = n, this.f = a;
|
|
24
26
|
}
|
|
25
|
-
return
|
|
26
|
-
return this.f(
|
|
27
|
-
},
|
|
28
|
-
}(),
|
|
29
|
-
return new
|
|
27
|
+
return o.prototype["@@transducer/init"] = V.init, o.prototype["@@transducer/result"] = V.result, o.prototype["@@transducer/step"] = function(a, n) {
|
|
28
|
+
return this.f(n) ? this.xf["@@transducer/step"](a, n) : a;
|
|
29
|
+
}, o;
|
|
30
|
+
}(), je = /* @__PURE__ */ U(function(a, n) {
|
|
31
|
+
return new ge(a, n);
|
|
30
32
|
});
|
|
31
|
-
const
|
|
32
|
-
var
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
return
|
|
35
|
-
return
|
|
36
|
-
}, {},
|
|
33
|
+
const me = je;
|
|
34
|
+
var N = /* @__PURE__ */ U(
|
|
35
|
+
/* @__PURE__ */ pe(["filter"], me, function(o, a) {
|
|
36
|
+
return xe(a) ? fe(function(n, d) {
|
|
37
|
+
return o(a[d]) && (n[d] = a[d]), n;
|
|
38
|
+
}, {}, he(a)) : (
|
|
37
39
|
// else
|
|
38
|
-
|
|
40
|
+
ue(o, a)
|
|
39
41
|
);
|
|
40
42
|
})
|
|
41
43
|
);
|
|
42
|
-
const
|
|
44
|
+
const Oe = (o) => {
|
|
43
45
|
const {
|
|
44
|
-
columns:
|
|
45
|
-
dataSource:
|
|
46
|
-
totalCount:
|
|
47
|
-
currentPage:
|
|
48
|
-
className:
|
|
49
|
-
wrapperClass:
|
|
50
|
-
title:
|
|
51
|
-
rowSelection:
|
|
52
|
-
actionOnChange:
|
|
53
|
-
rowSelectionChange:
|
|
54
|
-
pagerVisible:
|
|
55
|
-
pagerOnChange:
|
|
56
|
-
columnRenderer:
|
|
57
|
-
pageSizeOnChange:
|
|
58
|
-
pageSize:
|
|
59
|
-
headerVisible:
|
|
60
|
-
headerLeftItem:
|
|
61
|
-
customFooterItem:
|
|
62
|
-
isLoading:
|
|
63
|
-
footerAction:
|
|
64
|
-
pageSizeVisible:
|
|
65
|
-
appearance:
|
|
66
|
-
fixedHeader:
|
|
67
|
-
showItemsText:
|
|
68
|
-
customHeader:
|
|
69
|
-
selectedItems:
|
|
70
|
-
scrollClass:
|
|
71
|
-
disabledItems:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
columns: a = [],
|
|
47
|
+
dataSource: n = [],
|
|
48
|
+
totalCount: d,
|
|
49
|
+
currentPage: u,
|
|
50
|
+
className: W,
|
|
51
|
+
wrapperClass: X,
|
|
52
|
+
title: B,
|
|
53
|
+
rowSelection: j = !1,
|
|
54
|
+
actionOnChange: k,
|
|
55
|
+
rowSelectionChange: c,
|
|
56
|
+
pagerVisible: S,
|
|
57
|
+
pagerOnChange: _,
|
|
58
|
+
columnRenderer: R,
|
|
59
|
+
pageSizeOnChange: y,
|
|
60
|
+
pageSize: v,
|
|
61
|
+
headerVisible: K = !0,
|
|
62
|
+
headerLeftItem: P,
|
|
63
|
+
customFooterItem: q,
|
|
64
|
+
isLoading: J = !1,
|
|
65
|
+
footerAction: M = !0,
|
|
66
|
+
pageSizeVisible: Q = !0,
|
|
67
|
+
appearance: m = O.LIGHT,
|
|
68
|
+
fixedHeader: Y,
|
|
69
|
+
showItemsText: L,
|
|
70
|
+
customHeader: H,
|
|
71
|
+
selectedItems: T = [],
|
|
72
|
+
scrollClass: Z,
|
|
73
|
+
disabledItems: g = [],
|
|
74
|
+
expandable: l
|
|
75
|
+
} = o, [h, C] = F(T), [$, A] = F([]), I = (e) => {
|
|
76
|
+
c && (e.target.checked ? (C(
|
|
77
|
+
n.filter((s) => !x(s, g))
|
|
78
|
+
), c(
|
|
79
|
+
n.filter((s) => !x(s, g))
|
|
80
|
+
)) : (C([]), c([])));
|
|
81
|
+
}, ee = (e, s) => {
|
|
82
|
+
c && (e.target.checked ? (C([...h, s]), c([...h, s])) : (C(
|
|
83
|
+
N((r) => r.pk !== s.pk, h)
|
|
84
|
+
), c(
|
|
85
|
+
N((r) => r.pk !== s.pk, h)
|
|
83
86
|
)));
|
|
84
|
-
},
|
|
87
|
+
}, te = (e, s) => {
|
|
88
|
+
var i;
|
|
89
|
+
const r = x(e, $);
|
|
90
|
+
A(r ? (p) => N((b) => b !== e, p) : (p) => [...p, e]), (i = l == null ? void 0 : l.onExpand) == null || i.call(l, !r, s);
|
|
91
|
+
}, re = (e, s) => e == null ? void 0 : e.map((r, i) => /* @__PURE__ */ t.jsx(
|
|
85
92
|
"td",
|
|
86
93
|
{
|
|
87
94
|
width: r.width,
|
|
88
|
-
onClick: (
|
|
89
|
-
r != null && r.onClick && (r == null || r.onClick(
|
|
95
|
+
onClick: (p) => {
|
|
96
|
+
r != null && r.onClick && (r == null || r.onClick(p, s, r, i));
|
|
90
97
|
},
|
|
91
|
-
className:
|
|
92
|
-
children: r.render ? r.render(
|
|
98
|
+
className: w(r.className, r.tdClassName),
|
|
99
|
+
children: r.render ? r.render(s[r.dataIndex], s) : s[r.dataIndex]
|
|
93
100
|
},
|
|
94
|
-
`col-${
|
|
101
|
+
`col-${i}`
|
|
95
102
|
));
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
}, [o, p]), /* @__PURE__ */ s.jsxs(
|
|
103
|
+
return se(() => {
|
|
104
|
+
c && c(T.filter((e) => !x(e, g)));
|
|
105
|
+
}, [h, g]), /* @__PURE__ */ t.jsxs(
|
|
101
106
|
"div",
|
|
102
107
|
{
|
|
103
108
|
"data-testid": "table-container",
|
|
104
|
-
className:
|
|
105
|
-
[
|
|
109
|
+
className: w(f.wrapper, X, {
|
|
110
|
+
[f[`${m}`]]: m
|
|
106
111
|
}),
|
|
107
112
|
children: [
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
K && /* @__PURE__ */ t.jsx(
|
|
114
|
+
G,
|
|
110
115
|
{
|
|
111
|
-
title:
|
|
112
|
-
showItemsText:
|
|
113
|
-
actionOnChange:
|
|
114
|
-
pageSize:
|
|
115
|
-
pageSizeOnChange:
|
|
116
|
-
pagerOnChange:
|
|
117
|
-
pagerVisible:
|
|
118
|
-
totalCount:
|
|
119
|
-
currentPage:
|
|
116
|
+
title: B,
|
|
117
|
+
showItemsText: L,
|
|
118
|
+
actionOnChange: k,
|
|
119
|
+
pageSize: v,
|
|
120
|
+
pageSizeOnChange: y,
|
|
121
|
+
pagerOnChange: _,
|
|
122
|
+
pagerVisible: S,
|
|
123
|
+
totalCount: d,
|
|
124
|
+
currentPage: u
|
|
120
125
|
}
|
|
121
126
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
/* @__PURE__ */ t.jsxs("div", { className: f.tableWrap, children: [
|
|
128
|
+
J && /* @__PURE__ */ t.jsx(
|
|
129
|
+
oe,
|
|
125
130
|
{
|
|
126
|
-
wrapperClass:
|
|
127
|
-
appearance:
|
|
131
|
+
wrapperClass: f.tableLoading,
|
|
132
|
+
appearance: m === O.LIGHT ? z.LIGHT : z.DARK
|
|
128
133
|
}
|
|
129
134
|
),
|
|
130
|
-
|
|
131
|
-
/* @__PURE__ */
|
|
135
|
+
H && H,
|
|
136
|
+
/* @__PURE__ */ t.jsx(le, { className: Z || f.scrollWrap, children: /* @__PURE__ */ t.jsxs(
|
|
132
137
|
"table",
|
|
133
138
|
{
|
|
134
139
|
"data-testid": "table-content",
|
|
135
|
-
className:
|
|
136
|
-
[
|
|
140
|
+
className: w(f.table, W, {
|
|
141
|
+
[f.fixed]: Y
|
|
137
142
|
}),
|
|
138
143
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
/* @__PURE__ */ t.jsx("thead", { "data-testid": "table-head", children: /* @__PURE__ */ t.jsxs("tr", { "data-testid": "table-row", children: [
|
|
145
|
+
l && /* @__PURE__ */ t.jsx("th", { className: "w-[48px]" }),
|
|
146
|
+
j && /* @__PURE__ */ t.jsx("th", { className: "w-[26px]", children: /* @__PURE__ */ t.jsx(
|
|
147
|
+
D,
|
|
142
148
|
{
|
|
143
149
|
name: "selectAll",
|
|
144
|
-
isDisabled:
|
|
145
|
-
checked:
|
|
146
|
-
onChange:
|
|
150
|
+
isDisabled: n.length === 0,
|
|
151
|
+
checked: n.length > 0 && n.length === h.length,
|
|
152
|
+
onChange: I
|
|
147
153
|
}
|
|
148
154
|
) }),
|
|
149
|
-
|
|
150
|
-
var r,
|
|
151
|
-
return e.sortable ? /* @__PURE__ */
|
|
155
|
+
a == null ? void 0 : a.map((e, s) => {
|
|
156
|
+
var r, i;
|
|
157
|
+
return e.sortable ? /* @__PURE__ */ t.jsx(
|
|
152
158
|
"th",
|
|
153
159
|
{
|
|
154
160
|
"data-testid": "table-head-item",
|
|
155
161
|
style: { width: e.width },
|
|
156
162
|
className: e.className,
|
|
157
|
-
children: /* @__PURE__ */
|
|
158
|
-
|
|
163
|
+
children: /* @__PURE__ */ t.jsx(
|
|
164
|
+
ie,
|
|
159
165
|
{
|
|
160
166
|
title: (r = e.title) == null ? void 0 : r.toString().toLocaleUpperCase(),
|
|
161
|
-
onClick: (
|
|
162
|
-
var
|
|
163
|
-
return (
|
|
167
|
+
onClick: (p, b) => {
|
|
168
|
+
var E;
|
|
169
|
+
return (E = e == null ? void 0 : e.onSort) == null ? void 0 : E.call(e, p, b);
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
172
|
)
|
|
167
173
|
},
|
|
168
|
-
`table-header-${
|
|
169
|
-
) : /* @__PURE__ */
|
|
174
|
+
`table-header-${s}`
|
|
175
|
+
) : /* @__PURE__ */ t.jsx(
|
|
170
176
|
"th",
|
|
171
177
|
{
|
|
172
178
|
"data-testid": "table-head-item",
|
|
173
179
|
style: { width: e.width },
|
|
174
180
|
className: e.className,
|
|
175
|
-
children: typeof e.title == "string" || e.title instanceof String ? (
|
|
181
|
+
children: typeof e.title == "string" || e.title instanceof String ? (i = e.title) == null ? void 0 : i.toString().toLocaleUpperCase() : e.title
|
|
176
182
|
},
|
|
177
|
-
`table-header-${
|
|
183
|
+
`table-header-${s}`
|
|
178
184
|
);
|
|
179
185
|
})
|
|
180
186
|
] }) }),
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
187
|
+
/* @__PURE__ */ t.jsx("tbody", { "data-testid": "table-body", children: n.length > 0 ? n.map((e, s) => {
|
|
188
|
+
const r = x(s, $);
|
|
189
|
+
return /* @__PURE__ */ t.jsxs(ae.Fragment, { children: [
|
|
190
|
+
/* @__PURE__ */ t.jsxs("tr", { children: [
|
|
191
|
+
l && /* @__PURE__ */ t.jsx(
|
|
192
|
+
"td",
|
|
193
|
+
{
|
|
194
|
+
className: "text-center cursor-pointer pr-[0]!",
|
|
195
|
+
onClick: () => te(s, e),
|
|
196
|
+
children: /* @__PURE__ */ t.jsx(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: "inline-block transition-transform duration-200",
|
|
200
|
+
style: {
|
|
201
|
+
transform: r ? "rotate(90deg)" : "rotate(0deg)"
|
|
202
|
+
},
|
|
203
|
+
children: /* @__PURE__ */ t.jsx(de, { name: ce.ChevronRight })
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
j && /* @__PURE__ */ t.jsx("td", { children: /* @__PURE__ */ t.jsx(
|
|
209
|
+
D,
|
|
210
|
+
{
|
|
211
|
+
checked: x(e, h),
|
|
212
|
+
name: `select-${s}`,
|
|
213
|
+
onChange: (i) => ee(i, e),
|
|
214
|
+
isDisabled: x(e, g)
|
|
215
|
+
}
|
|
216
|
+
) }),
|
|
217
|
+
R ? R(a, e) : re(a, e)
|
|
218
|
+
] }),
|
|
219
|
+
l && r && /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx(
|
|
220
|
+
"td",
|
|
221
|
+
{
|
|
222
|
+
colSpan: a.length + (j ? 1 : 0) + (l ? 1 : 0),
|
|
223
|
+
className: "p-0 border-0",
|
|
224
|
+
children: l.expandedRowRender(e)
|
|
225
|
+
}
|
|
226
|
+
) })
|
|
227
|
+
] }, `row-${s}`);
|
|
228
|
+
}) : /* @__PURE__ */ t.jsx("tr", { children: /* @__PURE__ */ t.jsx(
|
|
229
|
+
"td",
|
|
230
|
+
{
|
|
231
|
+
colSpan: a.length + (j ? 1 : 0) + (l ? 1 : 0),
|
|
232
|
+
children: /* @__PURE__ */ t.jsx(ne, {})
|
|
233
|
+
}
|
|
234
|
+
) }) })
|
|
193
235
|
]
|
|
194
236
|
}
|
|
195
237
|
) })
|
|
196
238
|
] }),
|
|
197
|
-
|
|
198
|
-
|
|
239
|
+
M && /* @__PURE__ */ t.jsx(
|
|
240
|
+
G,
|
|
199
241
|
{
|
|
200
242
|
className: "mt-0",
|
|
201
|
-
showItemsText:
|
|
202
|
-
actionOnChange:
|
|
203
|
-
pageSize:
|
|
204
|
-
pageSizeOnChange:
|
|
205
|
-
pagerOnChange:
|
|
206
|
-
pagerVisible:
|
|
207
|
-
pageSizeVisible:
|
|
208
|
-
totalCount:
|
|
209
|
-
customItem:
|
|
210
|
-
headerLeftItem:
|
|
211
|
-
currentPage:
|
|
212
|
-
appearance:
|
|
243
|
+
showItemsText: L,
|
|
244
|
+
actionOnChange: k,
|
|
245
|
+
pageSize: v,
|
|
246
|
+
pageSizeOnChange: y,
|
|
247
|
+
pagerOnChange: _,
|
|
248
|
+
pagerVisible: S,
|
|
249
|
+
pageSizeVisible: Q,
|
|
250
|
+
totalCount: d,
|
|
251
|
+
customItem: q,
|
|
252
|
+
headerLeftItem: P,
|
|
253
|
+
currentPage: u,
|
|
254
|
+
appearance: m
|
|
213
255
|
}
|
|
214
256
|
)
|
|
215
257
|
]
|
|
@@ -217,5 +259,5 @@ const Le = (i) => {
|
|
|
217
259
|
);
|
|
218
260
|
};
|
|
219
261
|
export {
|
|
220
|
-
|
|
262
|
+
Oe as default
|
|
221
263
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -496,6 +496,12 @@ export declare interface EventProps<T = HTMLElement> {
|
|
|
496
496
|
onInvalid?: (e: React.FormEvent<T>) => void;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
declare type ExpandableType = {
|
|
500
|
+
expandedRowRender: (record: any) => ReactNode;
|
|
501
|
+
rowExpandable?: (record: any) => boolean;
|
|
502
|
+
onExpand?: (expanded: boolean, record: any) => void;
|
|
503
|
+
};
|
|
504
|
+
|
|
499
505
|
export declare const FileUpload: React_2.ForwardRefExoticComponent<{
|
|
500
506
|
type?: "number" | "email" | "search" | "text" | "url" | "tel" | "password" | "hidden" | undefined;
|
|
501
507
|
id?: string | undefined;
|
|
@@ -1316,6 +1322,7 @@ export declare type TableProps = {
|
|
|
1316
1322
|
fixedHeader?: boolean;
|
|
1317
1323
|
customHeader?: ReactNode;
|
|
1318
1324
|
scrollClass?: string;
|
|
1325
|
+
expandable?: ExpandableType;
|
|
1319
1326
|
} & TableHeaderProps;
|
|
1320
1327
|
|
|
1321
1328
|
export declare const TableSort: (props: TableSortProps) => JSX_2.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -496,6 +496,12 @@ export declare interface EventProps<T = HTMLElement> {
|
|
|
496
496
|
onInvalid?: (e: React.FormEvent<T>) => void;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
declare type ExpandableType = {
|
|
500
|
+
expandedRowRender: (record: any) => ReactNode;
|
|
501
|
+
rowExpandable?: (record: any) => boolean;
|
|
502
|
+
onExpand?: (expanded: boolean, record: any) => void;
|
|
503
|
+
};
|
|
504
|
+
|
|
499
505
|
export declare const FileUpload: React_2.ForwardRefExoticComponent<{
|
|
500
506
|
type?: "number" | "email" | "search" | "text" | "url" | "tel" | "password" | "hidden" | undefined;
|
|
501
507
|
id?: string | undefined;
|
|
@@ -1316,6 +1322,7 @@ export declare type TableProps = {
|
|
|
1316
1322
|
fixedHeader?: boolean;
|
|
1317
1323
|
customHeader?: ReactNode;
|
|
1318
1324
|
scrollClass?: string;
|
|
1325
|
+
expandable?: ExpandableType;
|
|
1319
1326
|
} & TableHeaderProps;
|
|
1320
1327
|
|
|
1321
1328
|
export declare const TableSort: (props: TableSortProps) => JSX_2.Element;
|