@cagatayfdn/flora-components 0.0.163 → 0.0.164
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 +48 -48
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as r } from "../../jsx-runtime-BcAkpsdy.js";
|
|
2
2
|
import se, { useState as F, useEffect as O } from "react";
|
|
3
3
|
import ne from "../NoResult/NoResult.js";
|
|
4
|
-
import { c as
|
|
4
|
+
import { c as C } from "../../index-BHf7G3IG.js";
|
|
5
5
|
import { s as x } from "../../Table.module-rFa4-NE2.js";
|
|
6
6
|
import { ThemeAppearance as z, AppearanceSpinner as D } from "../../enums/appearance.js";
|
|
7
7
|
import G from "../Checkbox/Checkbox.js";
|
|
@@ -16,25 +16,25 @@ import { _ as W, k as pe } from "../../keys-B0bo5Q7o.js";
|
|
|
16
16
|
import { _ as U, a as he, b as fe } from "../../_reduce-DsUCMz4O.js";
|
|
17
17
|
import { _ as xe } from "../../Select-nhp2PiJK.js";
|
|
18
18
|
function ue(l, t) {
|
|
19
|
-
for (var
|
|
20
|
-
l(t[
|
|
19
|
+
for (var o = 0, i = t.length, p = []; o < i; )
|
|
20
|
+
l(t[o]) && (p[p.length] = t[o]), o += 1;
|
|
21
21
|
return p;
|
|
22
22
|
}
|
|
23
23
|
var ge = /* @__PURE__ */ function() {
|
|
24
|
-
function l(t,
|
|
25
|
-
this.xf =
|
|
24
|
+
function l(t, o) {
|
|
25
|
+
this.xf = o, this.f = t;
|
|
26
26
|
}
|
|
27
|
-
return l.prototype["@@transducer/init"] = U.init, l.prototype["@@transducer/result"] = U.result, l.prototype["@@transducer/step"] = function(t,
|
|
28
|
-
return this.f(
|
|
27
|
+
return l.prototype["@@transducer/init"] = U.init, l.prototype["@@transducer/result"] = U.result, l.prototype["@@transducer/step"] = function(t, o) {
|
|
28
|
+
return this.f(o) ? this.xf["@@transducer/step"](t, o) : t;
|
|
29
29
|
}, l;
|
|
30
|
-
}(),
|
|
31
|
-
return new ge(t,
|
|
30
|
+
}(), je = /* @__PURE__ */ W(function(t, o) {
|
|
31
|
+
return new ge(t, o);
|
|
32
32
|
});
|
|
33
|
-
const
|
|
33
|
+
const be = je;
|
|
34
34
|
var k = /* @__PURE__ */ W(
|
|
35
|
-
/* @__PURE__ */ he(["filter"],
|
|
36
|
-
return xe(t) ? fe(function(
|
|
37
|
-
return l(t[i]) && (
|
|
35
|
+
/* @__PURE__ */ he(["filter"], be, function(l, t) {
|
|
36
|
+
return xe(t) ? fe(function(o, i) {
|
|
37
|
+
return l(t[i]) && (o[i] = t[i]), o;
|
|
38
38
|
}, {}, pe(t)) : (
|
|
39
39
|
// else
|
|
40
40
|
ue(l, t)
|
|
@@ -44,7 +44,7 @@ var k = /* @__PURE__ */ W(
|
|
|
44
44
|
const Oe = (l) => {
|
|
45
45
|
const {
|
|
46
46
|
columns: t = [],
|
|
47
|
-
dataSource:
|
|
47
|
+
dataSource: o = [],
|
|
48
48
|
totalCount: i,
|
|
49
49
|
currentPage: p,
|
|
50
50
|
className: X,
|
|
@@ -55,8 +55,8 @@ const Oe = (l) => {
|
|
|
55
55
|
rowSelectionChange: c,
|
|
56
56
|
pagerVisible: _,
|
|
57
57
|
pagerOnChange: E,
|
|
58
|
-
columnRenderer:
|
|
59
|
-
pageSizeOnChange:
|
|
58
|
+
columnRenderer: y,
|
|
59
|
+
pageSizeOnChange: R,
|
|
60
60
|
pageSize: v,
|
|
61
61
|
headerVisible: P = !0,
|
|
62
62
|
headerLeftItem: q,
|
|
@@ -64,22 +64,22 @@ const Oe = (l) => {
|
|
|
64
64
|
isLoading: M = !1,
|
|
65
65
|
footerAction: Q = !0,
|
|
66
66
|
pageSizeVisible: Y = !0,
|
|
67
|
-
appearance:
|
|
67
|
+
appearance: w = z.LIGHT,
|
|
68
68
|
fixedHeader: Z,
|
|
69
69
|
showItemsText: L,
|
|
70
70
|
customHeader: H,
|
|
71
71
|
selectedItems: T = [],
|
|
72
72
|
scrollClass: I,
|
|
73
73
|
disabledItems: g = [],
|
|
74
|
-
expandable:
|
|
75
|
-
} = l, [h,
|
|
76
|
-
c && (e.target.checked ? (
|
|
77
|
-
|
|
74
|
+
expandable: n
|
|
75
|
+
} = l, [h, m] = F(T), [$, j] = F([]), ee = (e) => {
|
|
76
|
+
c && (e.target.checked ? (m(
|
|
77
|
+
o.filter((s) => !u(s, g))
|
|
78
78
|
), c(
|
|
79
|
-
|
|
80
|
-
)) : (
|
|
79
|
+
o.filter((s) => !u(s, g))
|
|
80
|
+
)) : (m([]), c([])));
|
|
81
81
|
}, re = (e, s) => {
|
|
82
|
-
c && (e.target.checked ? (
|
|
82
|
+
c && (e.target.checked ? (m([...h, s]), c([...h, s])) : (m(
|
|
83
83
|
k((a) => a.pk !== s.pk, h)
|
|
84
84
|
), c(
|
|
85
85
|
k((a) => a.pk !== s.pk, h)
|
|
@@ -87,7 +87,7 @@ const Oe = (l) => {
|
|
|
87
87
|
}, ae = (e, s) => {
|
|
88
88
|
var d;
|
|
89
89
|
const a = u(e, $);
|
|
90
|
-
|
|
90
|
+
(n == null ? void 0 : n.expandStrategy) === "single" ? j(a ? [] : [e]) : j(a ? (f) => k((N) => N !== e, f) : (f) => [...f, e]), (d = n == null ? void 0 : n.onExpand) == null || d.call(n, !a, s);
|
|
91
91
|
}, te = (e, s) => e == null ? void 0 : e.map((a, d) => /* @__PURE__ */ r.jsx(
|
|
92
92
|
"td",
|
|
93
93
|
{
|
|
@@ -95,7 +95,7 @@ const Oe = (l) => {
|
|
|
95
95
|
onClick: (f) => {
|
|
96
96
|
a != null && a.onClick && (a == null || a.onClick(f, s, a, d));
|
|
97
97
|
},
|
|
98
|
-
className:
|
|
98
|
+
className: C(a.className, a.tdClassName),
|
|
99
99
|
children: a.render ? a.render(s[a.dataIndex], s) : s[a.dataIndex]
|
|
100
100
|
},
|
|
101
101
|
`col-${d}`
|
|
@@ -103,13 +103,13 @@ const Oe = (l) => {
|
|
|
103
103
|
return O(() => {
|
|
104
104
|
c && c(T.filter((e) => !u(e, g)));
|
|
105
105
|
}, [h, g]), O(() => {
|
|
106
|
-
|
|
106
|
+
j([]);
|
|
107
107
|
}, [p]), /* @__PURE__ */ r.jsxs(
|
|
108
108
|
"div",
|
|
109
109
|
{
|
|
110
110
|
"data-testid": "table-container",
|
|
111
|
-
className:
|
|
112
|
-
[x[`${
|
|
111
|
+
className: C(x.wrapper, B, {
|
|
112
|
+
[x[`${w}`]]: w
|
|
113
113
|
}),
|
|
114
114
|
children: [
|
|
115
115
|
P && /* @__PURE__ */ r.jsx(
|
|
@@ -119,7 +119,7 @@ const Oe = (l) => {
|
|
|
119
119
|
showItemsText: L,
|
|
120
120
|
actionOnChange: S,
|
|
121
121
|
pageSize: v,
|
|
122
|
-
pageSizeOnChange:
|
|
122
|
+
pageSizeOnChange: R,
|
|
123
123
|
pagerOnChange: E,
|
|
124
124
|
pagerVisible: _,
|
|
125
125
|
totalCount: i,
|
|
@@ -131,7 +131,7 @@ const Oe = (l) => {
|
|
|
131
131
|
oe,
|
|
132
132
|
{
|
|
133
133
|
wrapperClass: x.tableLoading,
|
|
134
|
-
appearance:
|
|
134
|
+
appearance: w === z.LIGHT ? D.LIGHT : D.DARK
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
137
|
H && H,
|
|
@@ -139,18 +139,18 @@ const Oe = (l) => {
|
|
|
139
139
|
"table",
|
|
140
140
|
{
|
|
141
141
|
"data-testid": "table-content",
|
|
142
|
-
className:
|
|
142
|
+
className: C(x.table, X, {
|
|
143
143
|
[x.fixed]: Z
|
|
144
144
|
}),
|
|
145
145
|
children: [
|
|
146
146
|
/* @__PURE__ */ r.jsx("thead", { "data-testid": "table-head", children: /* @__PURE__ */ r.jsxs("tr", { "data-testid": "table-row", children: [
|
|
147
|
-
|
|
147
|
+
n && /* @__PURE__ */ r.jsx("th", { className: "w-[48px]" }),
|
|
148
148
|
b && /* @__PURE__ */ r.jsx("th", { className: "w-[26px]", children: /* @__PURE__ */ r.jsx(
|
|
149
149
|
G,
|
|
150
150
|
{
|
|
151
151
|
name: "selectAll",
|
|
152
|
-
isDisabled:
|
|
153
|
-
checked:
|
|
152
|
+
isDisabled: o.length === 0,
|
|
153
|
+
checked: o.length > 0 && o.length === h.length,
|
|
154
154
|
onChange: ee
|
|
155
155
|
}
|
|
156
156
|
) }),
|
|
@@ -186,7 +186,7 @@ const Oe = (l) => {
|
|
|
186
186
|
);
|
|
187
187
|
})
|
|
188
188
|
] }) }),
|
|
189
|
-
/* @__PURE__ */ r.jsx("tbody", { "data-testid": "table-body", children:
|
|
189
|
+
/* @__PURE__ */ r.jsx("tbody", { "data-testid": "table-body", children: o.length > 0 ? o.map((e, s) => {
|
|
190
190
|
const a = u(s, $);
|
|
191
191
|
return /* @__PURE__ */ r.jsxs(se.Fragment, { children: [
|
|
192
192
|
/* @__PURE__ */ r.jsxs(
|
|
@@ -194,20 +194,20 @@ const Oe = (l) => {
|
|
|
194
194
|
{
|
|
195
195
|
"data-testid": "table-row",
|
|
196
196
|
onClick: () => {
|
|
197
|
-
|
|
197
|
+
n && n.rowExpandable && n.rowExpandable(e) && ae(s, e);
|
|
198
198
|
},
|
|
199
|
-
className:
|
|
200
|
-
"cursor-pointer":
|
|
199
|
+
className: C({
|
|
200
|
+
"cursor-pointer": n && n.rowExpandable ? n.rowExpandable(e) : n
|
|
201
201
|
}),
|
|
202
202
|
children: [
|
|
203
|
-
|
|
203
|
+
n && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
|
|
204
204
|
"span",
|
|
205
205
|
{
|
|
206
206
|
className: "inline-block transition-transform duration-200",
|
|
207
207
|
style: {
|
|
208
208
|
transform: a ? "rotate(90deg)" : "rotate(0deg)"
|
|
209
209
|
},
|
|
210
|
-
children:
|
|
210
|
+
children: n.rowExpandable && n.rowExpandable(e) ? /* @__PURE__ */ r.jsx(ie, { name: ce.ChevronRight }) : null
|
|
211
211
|
}
|
|
212
212
|
) }),
|
|
213
213
|
b && /* @__PURE__ */ r.jsx("td", { children: /* @__PURE__ */ r.jsx(
|
|
@@ -219,24 +219,24 @@ const Oe = (l) => {
|
|
|
219
219
|
isDisabled: u(e, g)
|
|
220
220
|
}
|
|
221
221
|
) }),
|
|
222
|
-
|
|
222
|
+
y ? y(t, e) : te(t, e)
|
|
223
223
|
]
|
|
224
224
|
},
|
|
225
225
|
`table-row-${s}`
|
|
226
226
|
),
|
|
227
|
-
|
|
227
|
+
n && a && /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
|
|
228
228
|
"td",
|
|
229
229
|
{
|
|
230
|
-
colSpan: t.length + (b ? 1 : 0) + (
|
|
230
|
+
colSpan: t.length + (b ? 1 : 0) + (n ? 1 : 0),
|
|
231
231
|
className: "p-0 border-0",
|
|
232
|
-
children:
|
|
232
|
+
children: n.expandedRowRender(e)
|
|
233
233
|
}
|
|
234
234
|
) })
|
|
235
235
|
] }, `row-${s}`);
|
|
236
236
|
}) : /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
|
|
237
237
|
"td",
|
|
238
238
|
{
|
|
239
|
-
colSpan: t.length + (b ? 1 : 0) + (
|
|
239
|
+
colSpan: t.length + (b ? 1 : 0) + (n ? 1 : 0),
|
|
240
240
|
children: /* @__PURE__ */ r.jsx(ne, {})
|
|
241
241
|
}
|
|
242
242
|
) }) })
|
|
@@ -251,7 +251,7 @@ const Oe = (l) => {
|
|
|
251
251
|
showItemsText: L,
|
|
252
252
|
actionOnChange: S,
|
|
253
253
|
pageSize: v,
|
|
254
|
-
pageSizeOnChange:
|
|
254
|
+
pageSizeOnChange: R,
|
|
255
255
|
pagerOnChange: E,
|
|
256
256
|
pagerVisible: _,
|
|
257
257
|
pageSizeVisible: Y,
|
|
@@ -259,7 +259,7 @@ const Oe = (l) => {
|
|
|
259
259
|
customItem: J,
|
|
260
260
|
headerLeftItem: q,
|
|
261
261
|
currentPage: p,
|
|
262
|
-
appearance:
|
|
262
|
+
appearance: w
|
|
263
263
|
}
|
|
264
264
|
)
|
|
265
265
|
]
|
package/dist/index.d.mts
CHANGED
|
@@ -525,6 +525,7 @@ declare type ExpandableType = {
|
|
|
525
525
|
expandedRowRender: (record: any) => ReactNode;
|
|
526
526
|
rowExpandable?: (record: any) => boolean;
|
|
527
527
|
onExpand?: (expanded: boolean, record: any) => void;
|
|
528
|
+
expandStrategy?: 'single' | 'multiple';
|
|
528
529
|
};
|
|
529
530
|
|
|
530
531
|
export declare type FetcherReturnType = {
|
package/dist/index.d.ts
CHANGED
|
@@ -525,6 +525,7 @@ declare type ExpandableType = {
|
|
|
525
525
|
expandedRowRender: (record: any) => ReactNode;
|
|
526
526
|
rowExpandable?: (record: any) => boolean;
|
|
527
527
|
onExpand?: (expanded: boolean, record: any) => void;
|
|
528
|
+
expandStrategy?: 'single' | 'multiple';
|
|
528
529
|
};
|
|
529
530
|
|
|
530
531
|
export declare type FetcherReturnType = {
|