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