@reportportal/ui-kit 0.0.1-alpha.103 → 0.0.1-alpha.105
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/{arrowUp-4a5caee7.js → chevronDownDropdown-66f5b1af.js} +4 -3
- package/dist/common/utils/index.d.ts +1 -0
- package/dist/common/utils/isString.d.ts +1 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/table/constants.d.ts +3 -0
- package/dist/components/table/hooks/index.d.ts +4 -0
- package/dist/components/table/hooks/useColumnWidths.d.ts +8 -0
- package/dist/components/table/hooks/useTableColumns.d.ts +13 -0
- package/dist/components/table/hooks/useTableExpansion.d.ts +15 -0
- package/dist/components/table/hooks/useTableHover.d.ts +10 -0
- package/dist/components/table/types.d.ts +14 -2
- package/dist/components/table/utils.d.ts +7 -1
- package/dist/icons.js +44 -43
- package/dist/index.js +46 -45
- package/dist/style.css +1 -1
- package/dist/table-0ca84375.js +476 -0
- package/dist/table.js +2 -2
- package/package.json +1 -1
- package/dist/table-920fdad9.js +0 -142
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { jsxs as x, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as Q, useState as L, useCallback as g, useEffect as ue, useRef as be } from "react";
|
|
3
|
+
import { c as fe } from "./bind-06a7ff84.js";
|
|
4
|
+
import { b as K, a as Y, S as ve } from "./chevronDownDropdown-66f5b1af.js";
|
|
5
|
+
import { C as q } from "./checkbox-ed6cc375.js";
|
|
6
|
+
const V = (l) => typeof l == "string", Ce = "_table_1kj69_1", ge = "_selectable_1kj69_56", je = "_expanded_1kj69_52", xe = "_label_1kj69_266", Ne = {
|
|
7
|
+
table: Ce,
|
|
8
|
+
"fixed-header": "_fixed-header_1kj69_8",
|
|
9
|
+
"horizontally-scrollable-container": "_horizontally-scrollable-container_1kj69_14",
|
|
10
|
+
"table-header": "_table-header_1kj69_19",
|
|
11
|
+
"sticky-header": "_sticky-header_1kj69_25",
|
|
12
|
+
"horizontally-scrollable": "_horizontally-scrollable_1kj69_14",
|
|
13
|
+
"table-row": "_table-row_1kj69_47",
|
|
14
|
+
"expanded-cell": "_expanded-cell_1kj69_52",
|
|
15
|
+
selectable: ge,
|
|
16
|
+
"row-content-wrapper": "_row-content-wrapper_1kj69_60",
|
|
17
|
+
"table-row-content": "_table-row-content_1kj69_65",
|
|
18
|
+
"expand-cell": "_expand-cell_1kj69_81",
|
|
19
|
+
"size-small": "_size-small_1kj69_84",
|
|
20
|
+
"size-large": "_size-large_1kj69_95",
|
|
21
|
+
"table-body": "_table-body_1kj69_110",
|
|
22
|
+
"scrollable-body": "_scrollable-body_1kj69_116",
|
|
23
|
+
"table-header-cell": "_table-header-cell_1kj69_162",
|
|
24
|
+
"table-cell": "_table-cell_1kj69_163",
|
|
25
|
+
"action-menu-cell": "_action-menu-cell_1kj69_170",
|
|
26
|
+
"checkbox-cell": "_checkbox-cell_1kj69_195",
|
|
27
|
+
"expand-icon": "_expand-icon_1kj69_238",
|
|
28
|
+
expanded: je,
|
|
29
|
+
"primary-cell": "_primary-cell_1kj69_247",
|
|
30
|
+
label: xe,
|
|
31
|
+
"sortable-cell": "_sortable-cell_1kj69_270",
|
|
32
|
+
"align-right": "_align-right_1kj69_273",
|
|
33
|
+
"align-center": "_align-center_1kj69_279",
|
|
34
|
+
"pinned-column": "_pinned-column_1kj69_282"
|
|
35
|
+
}, Z = "asc", N = 32, F = 100, we = 48, me = (l) => l.toLowerCase() === Z, Ee = (l) => l.map((a) => a.key), j = (l) => "primary" in l && l.primary === !0, Me = (l) => {
|
|
36
|
+
var t;
|
|
37
|
+
return `size-${((t = l.rowConfigs) == null ? void 0 : t.size) ?? "default"}`;
|
|
38
|
+
}, $e = (l, a, t, c, i) => {
|
|
39
|
+
let o = 0;
|
|
40
|
+
c && (o += N), i && (o += N);
|
|
41
|
+
for (let h = 0; h < l; h++) {
|
|
42
|
+
const r = a[h];
|
|
43
|
+
if (j(r)) {
|
|
44
|
+
const n = t.current.get(r.key) || F;
|
|
45
|
+
o += n;
|
|
46
|
+
} else {
|
|
47
|
+
const n = r, _ = V(n.width) ? parseInt(n.width, 10) || 0 : n.width;
|
|
48
|
+
o += _;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return o;
|
|
52
|
+
}, z = (l, a, t, c, i, o, h) => {
|
|
53
|
+
const r = {};
|
|
54
|
+
if (!j(l)) {
|
|
55
|
+
const n = l;
|
|
56
|
+
r.textAlign = n.align;
|
|
57
|
+
}
|
|
58
|
+
if (a && t !== void 0) {
|
|
59
|
+
const n = $e(
|
|
60
|
+
t,
|
|
61
|
+
c,
|
|
62
|
+
i,
|
|
63
|
+
o,
|
|
64
|
+
h
|
|
65
|
+
);
|
|
66
|
+
r.left = `${n}px`;
|
|
67
|
+
}
|
|
68
|
+
return r;
|
|
69
|
+
}, J = (l, a, t, c, i, o = !1) => {
|
|
70
|
+
const h = [];
|
|
71
|
+
t && h.push(`${N}px`), o && c && h.push(`${N}px`);
|
|
72
|
+
const r = (n) => {
|
|
73
|
+
if (j(n))
|
|
74
|
+
h.push(`minmax(${F}px, 1fr)`);
|
|
75
|
+
else {
|
|
76
|
+
const _ = n, k = V(_.width) ? _.width : `${_.width}px`;
|
|
77
|
+
h.push(k);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return l.forEach(r), a.forEach(r), i && h.push(`${we}px`), h.join(" ");
|
|
81
|
+
}, Se = ({
|
|
82
|
+
primaryColumns: l,
|
|
83
|
+
fixedColumns: a,
|
|
84
|
+
pinnedColumnKeys: t
|
|
85
|
+
}) => Q(() => {
|
|
86
|
+
const c = [], i = [];
|
|
87
|
+
return l.forEach((o) => {
|
|
88
|
+
const h = { ...o, primary: !0 };
|
|
89
|
+
t.includes(o.key) ? c.push(h) : i.push(h);
|
|
90
|
+
}), a.forEach((o) => {
|
|
91
|
+
t.includes(o.key) ? c.push(o) : i.push(o);
|
|
92
|
+
}), {
|
|
93
|
+
pinnedColumns: c,
|
|
94
|
+
scrollableColumns: i
|
|
95
|
+
};
|
|
96
|
+
}, [l, a, t]), Te = () => {
|
|
97
|
+
const [l, a] = L(null), [t, c] = L(null), i = g((n) => {
|
|
98
|
+
a(n);
|
|
99
|
+
}, []), o = g(() => {
|
|
100
|
+
a(null);
|
|
101
|
+
}, []), h = g((n) => {
|
|
102
|
+
c(n);
|
|
103
|
+
}, []), r = g(() => {
|
|
104
|
+
c(null);
|
|
105
|
+
}, []);
|
|
106
|
+
return {
|
|
107
|
+
hoveredColumn: l,
|
|
108
|
+
hoveredRow: t,
|
|
109
|
+
handleColumnMouseEnter: i,
|
|
110
|
+
handleColumnMouseLeave: o,
|
|
111
|
+
handleRowMouseEnter: h,
|
|
112
|
+
handleRowMouseLeave: r
|
|
113
|
+
};
|
|
114
|
+
}, ze = ({
|
|
115
|
+
primaryColumns: l,
|
|
116
|
+
fixedColumns: a,
|
|
117
|
+
expandedRowIds: t,
|
|
118
|
+
onToggleRowExpansion: c
|
|
119
|
+
}) => {
|
|
120
|
+
const [i, o] = L(/* @__PURE__ */ new Set());
|
|
121
|
+
ue(() => {
|
|
122
|
+
const n = [
|
|
123
|
+
...l.map((k) => k.key),
|
|
124
|
+
...a.map((k) => k.key)
|
|
125
|
+
], _ = /* @__PURE__ */ new Set();
|
|
126
|
+
t.forEach((k) => {
|
|
127
|
+
n.forEach((b) => {
|
|
128
|
+
_.add(`${k}-${b}`);
|
|
129
|
+
});
|
|
130
|
+
}), o((k) => {
|
|
131
|
+
if (k.size === _.size) {
|
|
132
|
+
let b = !0;
|
|
133
|
+
if (k.forEach((p) => {
|
|
134
|
+
_.has(p) || (b = !1);
|
|
135
|
+
}), b)
|
|
136
|
+
return k;
|
|
137
|
+
}
|
|
138
|
+
return _;
|
|
139
|
+
});
|
|
140
|
+
}, [t, l, a]);
|
|
141
|
+
const h = g(
|
|
142
|
+
(n) => {
|
|
143
|
+
const _ = new Set(i), k = t.includes(n), b = [
|
|
144
|
+
...l.map((p) => p.key),
|
|
145
|
+
...a.map((p) => p.key)
|
|
146
|
+
];
|
|
147
|
+
k ? b.forEach((p) => {
|
|
148
|
+
const C = `${n}-${p}`;
|
|
149
|
+
_.delete(C);
|
|
150
|
+
}) : b.forEach((p) => {
|
|
151
|
+
const C = `${n}-${p}`;
|
|
152
|
+
_.add(C);
|
|
153
|
+
}), o(_), c(n);
|
|
154
|
+
},
|
|
155
|
+
[i, t, l, a, c]
|
|
156
|
+
), r = g(
|
|
157
|
+
(n, _) => {
|
|
158
|
+
const k = `${n}-${_}`;
|
|
159
|
+
return i.has(k);
|
|
160
|
+
},
|
|
161
|
+
[i]
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
expandedCells: i,
|
|
165
|
+
handleToggleRowExpansion: h,
|
|
166
|
+
isCellExpanded: r
|
|
167
|
+
};
|
|
168
|
+
}, Ae = () => {
|
|
169
|
+
const l = be(/* @__PURE__ */ new Map()), a = g(
|
|
170
|
+
(t) => (c) => {
|
|
171
|
+
if (!c)
|
|
172
|
+
return;
|
|
173
|
+
const i = c.getBoundingClientRect().width;
|
|
174
|
+
i > 0 && l.current.set(t, i);
|
|
175
|
+
},
|
|
176
|
+
[]
|
|
177
|
+
);
|
|
178
|
+
return {
|
|
179
|
+
columnWidthsRef: l,
|
|
180
|
+
setCellRef: a
|
|
181
|
+
};
|
|
182
|
+
}, d = fe.bind(Ne), Oe = ({
|
|
183
|
+
data: l,
|
|
184
|
+
primaryColumn: a,
|
|
185
|
+
fixedColumns: t,
|
|
186
|
+
renderRowActions: c,
|
|
187
|
+
className: i = "",
|
|
188
|
+
rowClassName: o = "",
|
|
189
|
+
headerClassName: h = "",
|
|
190
|
+
selectable: r = !1,
|
|
191
|
+
selectedRowIds: n = [],
|
|
192
|
+
sortingDirection: _ = Z,
|
|
193
|
+
sortingColumn: k,
|
|
194
|
+
sortableColumns: b,
|
|
195
|
+
isHeaderFixed: p = !1,
|
|
196
|
+
isHorizontallyScrollable: C = !1,
|
|
197
|
+
pinnedColumnKeys: R = [],
|
|
198
|
+
isRowsExpandable: u = !1,
|
|
199
|
+
expandedRowIds: w = [],
|
|
200
|
+
onChangeSorting: I = () => {
|
|
201
|
+
},
|
|
202
|
+
onToggleRowSelection: ee = () => {
|
|
203
|
+
},
|
|
204
|
+
onToggleAllRowsSelection: le = () => {
|
|
205
|
+
},
|
|
206
|
+
onToggleRowExpansion: ne = () => {
|
|
207
|
+
},
|
|
208
|
+
onToggleAllRowsExpansion: ae = () => {
|
|
209
|
+
}
|
|
210
|
+
}) => {
|
|
211
|
+
const m = Q(
|
|
212
|
+
() => Array.isArray(a) ? a : [a],
|
|
213
|
+
[a]
|
|
214
|
+
), f = k ?? m[0], E = b ?? Ee([...m, ...t]), { pinnedColumns: v, scrollableColumns: M } = Se({
|
|
215
|
+
primaryColumns: m,
|
|
216
|
+
fixedColumns: t,
|
|
217
|
+
pinnedColumnKeys: R
|
|
218
|
+
}), {
|
|
219
|
+
hoveredColumn: D,
|
|
220
|
+
hoveredRow: te,
|
|
221
|
+
handleColumnMouseEnter: P,
|
|
222
|
+
handleColumnMouseLeave: W,
|
|
223
|
+
handleRowMouseEnter: se,
|
|
224
|
+
handleRowMouseLeave: ce
|
|
225
|
+
} = Te(), { columnWidthsRef: $, setCellRef: U } = Ae(), { handleToggleRowExpansion: re, isCellExpanded: O } = ze({
|
|
226
|
+
primaryColumns: m,
|
|
227
|
+
fixedColumns: t,
|
|
228
|
+
expandedRowIds: w,
|
|
229
|
+
onToggleRowExpansion: ne
|
|
230
|
+
}), B = (e) => {
|
|
231
|
+
E.includes(e) && I({ key: e, direction: _ });
|
|
232
|
+
}, oe = (e) => {
|
|
233
|
+
ee(e);
|
|
234
|
+
}, ie = () => {
|
|
235
|
+
le();
|
|
236
|
+
}, de = () => {
|
|
237
|
+
ae();
|
|
238
|
+
}, G = (e) => E.includes(e) ? (f == null ? void 0 : f.key) === e ? me(_) ? /* @__PURE__ */ s(Y, {}) : /* @__PURE__ */ s(ve, {}) : /* @__PURE__ */ s(Y, {}) : null, he = l.every((e) => n.includes(e.id)), _e = l.some((e) => n.includes(e.id)), H = (n == null ? void 0 : n.length) > 0, ke = l.every((e) => w.includes(e.id)), ye = J(
|
|
239
|
+
v,
|
|
240
|
+
M,
|
|
241
|
+
u,
|
|
242
|
+
r,
|
|
243
|
+
!!c,
|
|
244
|
+
!1
|
|
245
|
+
), pe = J(
|
|
246
|
+
v,
|
|
247
|
+
M,
|
|
248
|
+
u,
|
|
249
|
+
r,
|
|
250
|
+
!!c,
|
|
251
|
+
!0
|
|
252
|
+
);
|
|
253
|
+
return /* @__PURE__ */ x(
|
|
254
|
+
"div",
|
|
255
|
+
{
|
|
256
|
+
className: d(
|
|
257
|
+
"table",
|
|
258
|
+
{
|
|
259
|
+
"fixed-header": p,
|
|
260
|
+
"horizontally-scrollable-container": p && C
|
|
261
|
+
},
|
|
262
|
+
i
|
|
263
|
+
),
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ x(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: d(
|
|
269
|
+
"table-header",
|
|
270
|
+
{
|
|
271
|
+
"sticky-header": p,
|
|
272
|
+
"horizontally-scrollable": C
|
|
273
|
+
},
|
|
274
|
+
h
|
|
275
|
+
),
|
|
276
|
+
style: { gridTemplateColumns: pe },
|
|
277
|
+
children: [
|
|
278
|
+
r && /* @__PURE__ */ s(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
className: d("table-header-cell", "checkbox-cell"),
|
|
282
|
+
style: { left: u ? `${N}px` : "0" },
|
|
283
|
+
children: H && /* @__PURE__ */ s(
|
|
284
|
+
q,
|
|
285
|
+
{
|
|
286
|
+
value: he,
|
|
287
|
+
partiallyChecked: _e,
|
|
288
|
+
onChange: ie,
|
|
289
|
+
className: d("checkbox-cell")
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
u && /* @__PURE__ */ s("div", { className: d("table-header-cell", "expand-cell"), style: { left: "0" }, children: /* @__PURE__ */ s("button", { onClick: de, "aria-label": "Toggle all rows expansion", children: /* @__PURE__ */ s("span", { className: d("expand-icon", { expanded: ke }), children: /* @__PURE__ */ s(K, {}) }) }) }),
|
|
295
|
+
v.map((e, S) => /* @__PURE__ */ s(
|
|
296
|
+
"button",
|
|
297
|
+
{
|
|
298
|
+
className: d("table-header-cell", "pinned-column", {
|
|
299
|
+
[`align-${e.align}`]: "align" in e,
|
|
300
|
+
"primary-cell": j(e),
|
|
301
|
+
"sortable-cell": E.includes(e.key)
|
|
302
|
+
}),
|
|
303
|
+
style: z(
|
|
304
|
+
e,
|
|
305
|
+
!0,
|
|
306
|
+
S,
|
|
307
|
+
v,
|
|
308
|
+
$,
|
|
309
|
+
u,
|
|
310
|
+
r
|
|
311
|
+
),
|
|
312
|
+
children: /* @__PURE__ */ x(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
className: d("label"),
|
|
316
|
+
onClick: () => B(e.key),
|
|
317
|
+
onMouseEnter: () => P(e.key),
|
|
318
|
+
onMouseLeave: W,
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ s("span", { children: e.header }),
|
|
321
|
+
(D === e.key || (f == null ? void 0 : f.key) === e.key) && G(e.key)
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
},
|
|
326
|
+
e.key
|
|
327
|
+
)),
|
|
328
|
+
M.map((e) => /* @__PURE__ */ s(
|
|
329
|
+
"button",
|
|
330
|
+
{
|
|
331
|
+
className: d("table-header-cell", {
|
|
332
|
+
[`align-${e.align}`]: "align" in e,
|
|
333
|
+
"primary-cell": j(e),
|
|
334
|
+
"sortable-cell": E.includes(e.key)
|
|
335
|
+
}),
|
|
336
|
+
style: z(
|
|
337
|
+
e,
|
|
338
|
+
!1,
|
|
339
|
+
void 0,
|
|
340
|
+
v,
|
|
341
|
+
$,
|
|
342
|
+
u,
|
|
343
|
+
r
|
|
344
|
+
),
|
|
345
|
+
children: /* @__PURE__ */ x(
|
|
346
|
+
"div",
|
|
347
|
+
{
|
|
348
|
+
className: d("label"),
|
|
349
|
+
onClick: () => B(e.key),
|
|
350
|
+
onMouseEnter: () => P(e.key),
|
|
351
|
+
onMouseLeave: W,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ s("span", { children: e.header }),
|
|
354
|
+
(D === e.key || (f == null ? void 0 : f.key) === e.key) && G(e.key)
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
},
|
|
359
|
+
e.key
|
|
360
|
+
)),
|
|
361
|
+
c && /* @__PURE__ */ s("div", { className: d("table-header-cell", "action-menu-cell") })
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ s(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
className: d("table-body", {
|
|
369
|
+
"scrollable-body": p,
|
|
370
|
+
"horizontally-scrollable": C
|
|
371
|
+
}),
|
|
372
|
+
children: l.map((e, S) => /* @__PURE__ */ x(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
className: d("table-row", Me(e), o, {
|
|
376
|
+
selectable: r
|
|
377
|
+
}),
|
|
378
|
+
onMouseEnter: () => se(S),
|
|
379
|
+
onMouseLeave: ce,
|
|
380
|
+
children: [
|
|
381
|
+
r && /* @__PURE__ */ s(
|
|
382
|
+
"div",
|
|
383
|
+
{
|
|
384
|
+
className: d("table-cell", "checkbox-cell"),
|
|
385
|
+
style: { left: u ? `${N}px` : "0" },
|
|
386
|
+
children: (H || te === S) && /* @__PURE__ */ s(
|
|
387
|
+
q,
|
|
388
|
+
{
|
|
389
|
+
value: n.includes(e.id),
|
|
390
|
+
onChange: () => oe(e.id),
|
|
391
|
+
className: d("checkbox-cell")
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ s("div", { className: d("row-content-wrapper"), children: /* @__PURE__ */ x("div", { className: d("table-row-content"), style: { gridTemplateColumns: ye }, children: [
|
|
397
|
+
u && /* @__PURE__ */ s("div", { className: d("table-cell", "expand-cell"), style: { left: "0" }, children: /* @__PURE__ */ s(
|
|
398
|
+
"button",
|
|
399
|
+
{
|
|
400
|
+
onClick: () => re(e.id),
|
|
401
|
+
"aria-label": w.includes(e.id) ? "Collapse row" : "Expand row",
|
|
402
|
+
"aria-expanded": w.includes(e.id),
|
|
403
|
+
children: /* @__PURE__ */ s(
|
|
404
|
+
"span",
|
|
405
|
+
{
|
|
406
|
+
className: d("expand-icon", {
|
|
407
|
+
expanded: w.includes(e.id)
|
|
408
|
+
}),
|
|
409
|
+
children: /* @__PURE__ */ s(K, {})
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
) }),
|
|
414
|
+
v.map((y, A) => {
|
|
415
|
+
const T = O(e.id, y.key), X = j(y);
|
|
416
|
+
return /* @__PURE__ */ s(
|
|
417
|
+
"div",
|
|
418
|
+
{
|
|
419
|
+
ref: X ? U(y.key) : void 0,
|
|
420
|
+
className: d("table-cell", "pinned-column", {
|
|
421
|
+
"primary-cell": X,
|
|
422
|
+
"expanded-cell": T
|
|
423
|
+
}),
|
|
424
|
+
style: z(
|
|
425
|
+
y,
|
|
426
|
+
!0,
|
|
427
|
+
A,
|
|
428
|
+
v,
|
|
429
|
+
$,
|
|
430
|
+
u,
|
|
431
|
+
r
|
|
432
|
+
),
|
|
433
|
+
children: e[y.key].component || e[y.key].content || e[y.key]
|
|
434
|
+
},
|
|
435
|
+
y.key
|
|
436
|
+
);
|
|
437
|
+
}),
|
|
438
|
+
M.map((y) => {
|
|
439
|
+
const A = O(e.id, y.key), T = j(y);
|
|
440
|
+
return /* @__PURE__ */ s(
|
|
441
|
+
"div",
|
|
442
|
+
{
|
|
443
|
+
ref: T ? U(y.key) : void 0,
|
|
444
|
+
className: d("table-cell", {
|
|
445
|
+
"primary-cell": T,
|
|
446
|
+
"expanded-cell": A
|
|
447
|
+
}),
|
|
448
|
+
style: z(
|
|
449
|
+
y,
|
|
450
|
+
!1,
|
|
451
|
+
void 0,
|
|
452
|
+
v,
|
|
453
|
+
$,
|
|
454
|
+
u,
|
|
455
|
+
r
|
|
456
|
+
),
|
|
457
|
+
children: e[y.key].component || e[y.key].content || e[y.key]
|
|
458
|
+
},
|
|
459
|
+
y.key
|
|
460
|
+
);
|
|
461
|
+
}),
|
|
462
|
+
c && /* @__PURE__ */ s("div", { className: d("table-cell", "action-menu-cell"), children: c(e.metaData) })
|
|
463
|
+
] }) })
|
|
464
|
+
]
|
|
465
|
+
},
|
|
466
|
+
e.id
|
|
467
|
+
))
|
|
468
|
+
}
|
|
469
|
+
)
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
};
|
|
474
|
+
export {
|
|
475
|
+
Oe as T
|
|
476
|
+
};
|
package/dist/table.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as r } from "./table-
|
|
1
|
+
import { T as r } from "./table-0ca84375.js";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./bind-06a7ff84.js";
|
|
5
|
-
import "./
|
|
5
|
+
import "./chevronDownDropdown-66f5b1af.js";
|
|
6
6
|
import "./checkbox-ed6cc375.js";
|
|
7
7
|
import "./keyCodes-f63c0e11.js";
|
|
8
8
|
export {
|
package/package.json
CHANGED
package/dist/table-920fdad9.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsxs as o, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useState as N, useMemo as K } from "react";
|
|
3
|
-
import { c as O } from "./bind-06a7ff84.js";
|
|
4
|
-
import { a as g, S as P } from "./arrowUp-4a5caee7.js";
|
|
5
|
-
import { C as w } from "./checkbox-ed6cc375.js";
|
|
6
|
-
const Q = "_table_1qo1m_1", V = "_label_1qo1m_96", W = {
|
|
7
|
-
table: Q,
|
|
8
|
-
"table-header": "_table-header_1qo1m_9",
|
|
9
|
-
"table-row": "_table-row_1qo1m_17",
|
|
10
|
-
"table-row-content": "_table-row-content_1qo1m_23",
|
|
11
|
-
"size-small": "_size-small_1qo1m_33",
|
|
12
|
-
"size-large": "_size-large_1qo1m_36",
|
|
13
|
-
"table-body": "_table-body_1qo1m_40",
|
|
14
|
-
"table-header-cell": "_table-header-cell_1qo1m_47",
|
|
15
|
-
"table-cell": "_table-cell_1qo1m_48",
|
|
16
|
-
"action-menu-cell": "_action-menu-cell_1qo1m_53",
|
|
17
|
-
"checkbox-cell": "_checkbox-cell_1qo1m_65",
|
|
18
|
-
"primary-cell": "_primary-cell_1qo1m_79",
|
|
19
|
-
label: V,
|
|
20
|
-
"sortable-cell": "_sortable-cell_1qo1m_100",
|
|
21
|
-
"align-right": "_align-right_1qo1m_103",
|
|
22
|
-
"align-center": "_align-center_1qo1m_109"
|
|
23
|
-
}, S = "asc", X = (t) => t.toLowerCase() === S, Y = (t) => t.map((r) => r.key), l = O.bind(W), ae = ({
|
|
24
|
-
data: t,
|
|
25
|
-
primaryColumn: r,
|
|
26
|
-
fixedColumns: i,
|
|
27
|
-
renderRowActions: h,
|
|
28
|
-
className: f = "",
|
|
29
|
-
rowClassName: x = "",
|
|
30
|
-
headerClassName: z = "",
|
|
31
|
-
selectable: b = !1,
|
|
32
|
-
selectedRowIds: s = [],
|
|
33
|
-
sortingDirection: y = S,
|
|
34
|
-
sortingColumn: n = r,
|
|
35
|
-
sortableColumns: _ = Y([r, ...i]),
|
|
36
|
-
onChangeSorting: M = () => {
|
|
37
|
-
},
|
|
38
|
-
onToggleRowSelection: u = () => {
|
|
39
|
-
},
|
|
40
|
-
onToggleAllRowsSelection: A = () => {
|
|
41
|
-
}
|
|
42
|
-
}) => {
|
|
43
|
-
const [L, k] = N(null), [E, v] = N(null), m = K(() => [{ ...r, primary: !0 }, ...i], [r, i]), j = (e) => {
|
|
44
|
-
_.includes(e) && M({ key: e, direction: y });
|
|
45
|
-
}, p = (e) => ({
|
|
46
|
-
width: e.width,
|
|
47
|
-
textAlign: e.align
|
|
48
|
-
}), C = (e) => {
|
|
49
|
-
k(e);
|
|
50
|
-
}, H = () => {
|
|
51
|
-
k(null);
|
|
52
|
-
}, T = (e) => {
|
|
53
|
-
v(e);
|
|
54
|
-
}, $ = () => {
|
|
55
|
-
v(null);
|
|
56
|
-
}, D = (e) => {
|
|
57
|
-
u(e);
|
|
58
|
-
}, U = () => {
|
|
59
|
-
A();
|
|
60
|
-
}, B = t.every((e) => s.includes(e.id)), F = t.some((e) => s.includes(e.id)), q = (s == null ? void 0 : s.length) > 0, G = (e) => {
|
|
61
|
-
var c;
|
|
62
|
-
return `size-${((c = e.rowConfigs) == null ? void 0 : c.size) ?? "default"}`;
|
|
63
|
-
}, J = (e) => {
|
|
64
|
-
if (_.includes(e))
|
|
65
|
-
return (n == null ? void 0 : n.key) === e ? X(y) ? /* @__PURE__ */ a(g, {}) : /* @__PURE__ */ a(P, {}) : /* @__PURE__ */ a(g, {});
|
|
66
|
-
};
|
|
67
|
-
return /* @__PURE__ */ o("div", { className: l("table", f), children: [
|
|
68
|
-
/* @__PURE__ */ o("div", { className: l("table-header", z), children: [
|
|
69
|
-
b && /* @__PURE__ */ a("div", { className: l("table-header-cell", "checkbox-cell"), children: q && /* @__PURE__ */ a(
|
|
70
|
-
w,
|
|
71
|
-
{
|
|
72
|
-
value: B,
|
|
73
|
-
partiallyChecked: F,
|
|
74
|
-
onChange: U,
|
|
75
|
-
className: l("checkbox-cell")
|
|
76
|
-
}
|
|
77
|
-
) }),
|
|
78
|
-
m.map((e) => /* @__PURE__ */ a(
|
|
79
|
-
"button",
|
|
80
|
-
{
|
|
81
|
-
className: l("table-header-cell", {
|
|
82
|
-
[`align-${e.align}`]: "align" in e,
|
|
83
|
-
"primary-cell": "primary" in e && e.primary,
|
|
84
|
-
"sortable-cell": _.includes(e.key)
|
|
85
|
-
}),
|
|
86
|
-
style: p(e),
|
|
87
|
-
children: /* @__PURE__ */ o(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
className: l("label"),
|
|
91
|
-
onClick: () => j(e.key),
|
|
92
|
-
onMouseEnter: () => C(e.key),
|
|
93
|
-
onMouseLeave: H,
|
|
94
|
-
children: [
|
|
95
|
-
/* @__PURE__ */ a("span", { children: e.header }),
|
|
96
|
-
(L === e.key || (n == null ? void 0 : n.key) === e.key) && J(e.key)
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
},
|
|
101
|
-
e.key
|
|
102
|
-
)),
|
|
103
|
-
h && /* @__PURE__ */ a("div", { className: l("table-header-cell", "action-menu-cell") })
|
|
104
|
-
] }),
|
|
105
|
-
/* @__PURE__ */ a("div", { className: l("table-body"), children: t.map((e, d) => /* @__PURE__ */ o(
|
|
106
|
-
"div",
|
|
107
|
-
{
|
|
108
|
-
className: l("table-row", G(e), x),
|
|
109
|
-
onMouseEnter: () => T(d),
|
|
110
|
-
onMouseLeave: $,
|
|
111
|
-
children: [
|
|
112
|
-
b && /* @__PURE__ */ a("div", { className: l("table-cell", "checkbox-cell"), children: (q || E === d) && /* @__PURE__ */ a(
|
|
113
|
-
w,
|
|
114
|
-
{
|
|
115
|
-
value: s.includes(e.id),
|
|
116
|
-
onChange: () => D(e.id),
|
|
117
|
-
className: l("checkbox-cell")
|
|
118
|
-
}
|
|
119
|
-
) }),
|
|
120
|
-
/* @__PURE__ */ o("div", { className: l("table-row-content"), children: [
|
|
121
|
-
m.map((c) => /* @__PURE__ */ a(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
className: l("table-cell", {
|
|
125
|
-
"primary-cell": "primary" in c && c.primary
|
|
126
|
-
}),
|
|
127
|
-
style: p(c),
|
|
128
|
-
children: e[c.key].component || e[c.key].content || e[c.key]
|
|
129
|
-
},
|
|
130
|
-
c.key
|
|
131
|
-
)),
|
|
132
|
-
h && /* @__PURE__ */ a("div", { className: l("table-cell", "action-menu-cell"), children: h(e.metaData) })
|
|
133
|
-
] })
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
e.id
|
|
137
|
-
)) })
|
|
138
|
-
] });
|
|
139
|
-
};
|
|
140
|
-
export {
|
|
141
|
-
ae as T
|
|
142
|
-
};
|