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