asma-ui-core 3.47.3 → 3.48.0
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/asma-ui-core.css +1 -1
- package/dist/components/data-display/virtualized-list/VirtualizedList.js +33 -0
- package/dist/index.js +193 -191
- package/dist/src/components/data-display/virtualized-list/VirtualizedList.d.ts +34 -0
- package/dist/src/components/data-display/virtualized-list/index.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/table/components/StyledTable.module.js +54 -56
- package/dist/table/components/TableRow.js +73 -74
- package/dist/table/components/columns/action-column/components/TableActions.module.js +4 -4
- package/dist/table/components/table-header/TableHeaderCell.js +29 -29
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Renders only the rows in view, for lists long enough that mounting all of them is the bottleneck.
|
|
4
|
+
*
|
|
5
|
+
* Lives here rather than in each consumer because `@tanstack/react-virtual` is already a dependency
|
|
6
|
+
* of this package (the table's column virtualizer uses it), and because the mechanism is the part
|
|
7
|
+
* that gets copied wrong: the spacer must carry the *full* scroll height or the scrollbar lies, rows
|
|
8
|
+
* must be positioned rather than laid out, and each row needs `measureElement` or variable heights
|
|
9
|
+
* drift. Encapsulating it keeps the virtualizer an implementation detail of this package instead of a
|
|
10
|
+
* dependency every app adds for itself.
|
|
11
|
+
*
|
|
12
|
+
* **This virtualizes RENDERING, not loading.** Every item must already be in memory — `items` is the
|
|
13
|
+
* complete list. A consumer that also wants to fetch lazily needs its own windowing on top, and
|
|
14
|
+
* should think hard about whether partial data still satisfies its own invariants.
|
|
15
|
+
*
|
|
16
|
+
* Variable row heights work without configuration: `estimatedItemHeight` only seeds the first paint,
|
|
17
|
+
* after which real heights are measured.
|
|
18
|
+
*/
|
|
19
|
+
export interface VirtualizedListProps<TItem> {
|
|
20
|
+
items: readonly TItem[];
|
|
21
|
+
/** Stable identity per row. Index-based keys would remount rows on reorder and lose focus. */
|
|
22
|
+
getItemKey: (item: TItem, index: number) => string;
|
|
23
|
+
renderItem: (item: TItem, index: number) => ReactNode;
|
|
24
|
+
/** First-paint estimate only; real heights are measured after mount. Defaults to 48. */
|
|
25
|
+
estimatedItemHeight?: number;
|
|
26
|
+
/** Rows kept mounted beyond the viewport, so scrolling does not reveal blank space. Defaults to 8. */
|
|
27
|
+
overscan?: number;
|
|
28
|
+
/** Applied to the scroll container — give it a bounded height, or nothing can scroll. */
|
|
29
|
+
className?: string;
|
|
30
|
+
dataTest?: string;
|
|
31
|
+
/** Rendered instead of the list when `items` is empty. */
|
|
32
|
+
emptyState?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare function VirtualizedList<TItem>({ className, dataTest, emptyState, estimatedItemHeight, getItemKey, items, overscan, renderItem, }: VirtualizedListProps<TItem>): React.ReactElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VirtualizedList';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/data-display/badge';
|
|
|
3
3
|
export * from './components/data-display/chip';
|
|
4
4
|
export * from './components/data-display/interactive-chip';
|
|
5
5
|
export * from './components/data-display/tooltip';
|
|
6
|
+
export * from './components/data-display/virtualized-list';
|
|
6
7
|
export * from './components/icons';
|
|
7
8
|
export * from './components/data-display/typography';
|
|
8
9
|
export * from './components/data-display/form-label';
|
|
@@ -1,59 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
"asma-ui-table-styled-table": "_asma-ui-table-styled-
|
|
3
|
-
"table-wrapper": "_table-
|
|
4
|
-
"table-shell": "_table-
|
|
5
|
-
"table-wrapper--no-rows": "_table-wrapper--no-
|
|
6
|
-
"table-wrapper--proxy": "_table-wrapper--
|
|
7
|
-
"table-wrapper--proxy-bottom": "_table-wrapper--proxy-
|
|
8
|
-
"table-wrapper-fetching": "_table-wrapper-
|
|
9
|
-
"table-scroll": "_table-
|
|
10
|
-
"table-x--fill-height": "_table-x--fill-
|
|
11
|
-
"table-x": "_table-
|
|
12
|
-
"table-content": "_table-
|
|
13
|
-
"table-header--sticky": "_table-header--
|
|
14
|
-
"table-hscroll": "_table-
|
|
15
|
-
"table-hscroll__content": "_table-
|
|
16
|
-
"no-rows-overlay-container": "_no-rows-overlay-
|
|
17
|
-
"no-rows-overlay-content": "_no-rows-overlay-
|
|
18
|
-
"styled-table": "_styled-
|
|
19
|
-
tbody:
|
|
20
|
-
"loading-icon": "_loading-
|
|
21
|
-
"t-row": "_t-
|
|
22
|
-
"t-cell": "_t-
|
|
23
|
-
"action-cell": "_action-
|
|
24
|
-
"fixed-cell": "_fixed-
|
|
25
|
-
"fixed-right-cell": "_fixed-right-
|
|
26
|
-
expanded_row:
|
|
27
|
-
selected:
|
|
28
|
-
"single-selection": "_single-
|
|
29
|
-
"action-cell--no-shadow": "_action-cell--no-
|
|
30
|
-
|
|
31
|
-
shadowed:
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"fixed-cell-default-background": "_fixed-cell-default-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"t-cell__actions": "_t-
|
|
45
|
-
"t-
|
|
46
|
-
"t-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"table-
|
|
52
|
-
"table-
|
|
53
|
-
"
|
|
54
|
-
"table-bottom--sticky": "_table-bottom--sticky_1bgxx_442",
|
|
55
|
-
"cursor-not-allowed": "_cursor-not-allowed_1bgxx_446"
|
|
1
|
+
var t = "_tbody_tst0a_124", e = "_expanded_row_tst0a_187", a = "_selected_tst0a_205", _ = "_shadowed_tst0a_228", l = "_resizer_tst0a_282", o = "_isResizing_tst0a_294", s = {
|
|
2
|
+
"asma-ui-table-styled-table": "_asma-ui-table-styled-table_tst0a_1",
|
|
3
|
+
"table-wrapper": "_table-wrapper_tst0a_26",
|
|
4
|
+
"table-shell": "_table-shell_tst0a_33",
|
|
5
|
+
"table-wrapper--no-rows": "_table-wrapper--no-rows_tst0a_39",
|
|
6
|
+
"table-wrapper--proxy": "_table-wrapper--proxy_tst0a_42",
|
|
7
|
+
"table-wrapper--proxy-bottom": "_table-wrapper--proxy-bottom_tst0a_43",
|
|
8
|
+
"table-wrapper-fetching": "_table-wrapper-fetching_tst0a_53",
|
|
9
|
+
"table-scroll": "_table-scroll_tst0a_56",
|
|
10
|
+
"table-x--fill-height": "_table-x--fill-height_tst0a_65",
|
|
11
|
+
"table-x": "_table-x_tst0a_65",
|
|
12
|
+
"table-content": "_table-content_tst0a_80",
|
|
13
|
+
"table-header--sticky": "_table-header--sticky_tst0a_85",
|
|
14
|
+
"table-hscroll": "_table-hscroll_tst0a_90",
|
|
15
|
+
"table-hscroll__content": "_table-hscroll__content_tst0a_100",
|
|
16
|
+
"no-rows-overlay-container": "_no-rows-overlay-container_tst0a_103",
|
|
17
|
+
"no-rows-overlay-content": "_no-rows-overlay-content_tst0a_111",
|
|
18
|
+
"styled-table": "_styled-table_tst0a_115",
|
|
19
|
+
tbody: t,
|
|
20
|
+
"loading-icon": "_loading-icon_tst0a_129",
|
|
21
|
+
"t-row": "_t-row_tst0a_136",
|
|
22
|
+
"t-cell": "_t-cell_tst0a_136",
|
|
23
|
+
"action-cell": "_action-cell_tst0a_146",
|
|
24
|
+
"fixed-cell": "_fixed-cell_tst0a_150",
|
|
25
|
+
"fixed-right-cell": "_fixed-right-cell_tst0a_153",
|
|
26
|
+
expanded_row: e,
|
|
27
|
+
selected: a,
|
|
28
|
+
"single-selection": "_single-selection_tst0a_208",
|
|
29
|
+
"action-cell--no-shadow": "_action-cell--no-shadow_tst0a_225",
|
|
30
|
+
shadowed: _,
|
|
31
|
+
"shadowed-right": "_shadowed-right_tst0a_262",
|
|
32
|
+
"is-loading": "_is-loading_tst0a_266",
|
|
33
|
+
"action-cell-default-background": "_action-cell-default-background_tst0a_269",
|
|
34
|
+
"fixed-cell-default-background": "_fixed-cell-default-background_tst0a_272",
|
|
35
|
+
"fixed-right-cell-default-background": "_fixed-right-cell-default-background_tst0a_275",
|
|
36
|
+
"sortable-column": "_sortable-column_tst0a_278",
|
|
37
|
+
resizer: l,
|
|
38
|
+
isResizing: o,
|
|
39
|
+
"hide-table-header": "_hide-table-header_tst0a_306",
|
|
40
|
+
"show-table-header": "_show-table-header_tst0a_310",
|
|
41
|
+
"table-header": "_table-header_tst0a_85",
|
|
42
|
+
"hide-header": "_hide-header_tst0a_346",
|
|
43
|
+
"t-cell__actions": "_t-cell__actions_tst0a_349",
|
|
44
|
+
"t-cell__actions--no-shadow": "_t-cell__actions--no-shadow_tst0a_357",
|
|
45
|
+
"t-cell__fixed": "_t-cell__fixed_tst0a_361",
|
|
46
|
+
"t-cell__fixed-right": "_t-cell__fixed-right_tst0a_368",
|
|
47
|
+
"sort-icon": "_sort-icon_tst0a_375",
|
|
48
|
+
"header-content": "_header-content_tst0a_379",
|
|
49
|
+
"table-footer--sticky": "_table-footer--sticky_tst0a_394",
|
|
50
|
+
"table-footer--inline": "_table-footer--inline_tst0a_405",
|
|
51
|
+
"table-bottom": "_table-bottom_tst0a_416",
|
|
52
|
+
"table-bottom--sticky": "_table-bottom--sticky_tst0a_430",
|
|
53
|
+
"cursor-not-allowed": "_cursor-not-allowed_tst0a_434"
|
|
56
54
|
};
|
|
57
55
|
export {
|
|
58
|
-
|
|
56
|
+
s as default
|
|
59
57
|
};
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as _ } from "../types.js";
|
|
2
|
+
import { useRootContext as me } from "../context/RootContext.js";
|
|
3
3
|
import n from "./StyledTable.module.js";
|
|
4
|
-
import { compact as
|
|
5
|
-
import
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useSortable as
|
|
9
|
-
import { flexRender as
|
|
10
|
-
import { CSS as
|
|
11
|
-
function Me({ styledTableProps:
|
|
12
|
-
const { loading:
|
|
4
|
+
import { compact as ge } from "../../helpers/arrays.js";
|
|
5
|
+
import O from "clsx";
|
|
6
|
+
import { Fragment as fe, useCallback as $, useEffect as ue, useLayoutEffect as he, useMemo as g, useRef as pe, useState as xe } from "react";
|
|
7
|
+
import { Fragment as Re, jsx as l, jsxs as x } from "react/jsx-runtime";
|
|
8
|
+
import { useSortable as Ce } from "@dnd-kit/sortable";
|
|
9
|
+
import { flexRender as Se } from "@tanstack/react-table";
|
|
10
|
+
import { CSS as be } from "@dnd-kit/utilities";
|
|
11
|
+
function Me({ styledTableProps: j, row: t, index: P, columnWindow: { paddingLeft: f, paddingRight: u, indexes: E } }) {
|
|
12
|
+
const { loading: K, getRowClassName: s, rowHeight: h, onRowClick: R, expandArrow: V, enableDnd: v, disableDndForRow: Y, tdClassName: I, customSubRowData: N, renderSubRows: q, defaultExpanded: G, actions: w, textExpandArrow: H, enableMultiRowSelection: J, enableRowSelection: Q, singleSelectionRow: X } = j, C = Y?.(t), { transform: Z, transition: ee, setNodeRef: L, isDragging: M } = Ce({
|
|
13
13
|
id: t.original.id,
|
|
14
|
-
disabled: !
|
|
15
|
-
}),
|
|
16
|
-
transform:
|
|
17
|
-
transition:
|
|
18
|
-
opacity:
|
|
19
|
-
zIndex:
|
|
14
|
+
disabled: !v || C
|
|
15
|
+
}), te = {
|
|
16
|
+
transform: be.Transform.toString(Z),
|
|
17
|
+
transition: ee,
|
|
18
|
+
opacity: M ? 0.8 : 1,
|
|
19
|
+
zIndex: M ? 1 : 0,
|
|
20
20
|
position: "relative"
|
|
21
|
-
}, { isResizing:
|
|
22
|
-
|
|
23
|
-
!
|
|
24
|
-
}, [
|
|
25
|
-
const
|
|
26
|
-
p.current = e,
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
}, { isResizing: ne, disableResizingFlag: ie } = me(), S = t.isExpanded(), p = pe(null), [oe, le] = xe(void 0);
|
|
22
|
+
he(() => {
|
|
23
|
+
!S && p.current && le(p.current.cells[0]?.clientHeight ?? p.current.offsetHeight);
|
|
24
|
+
}, [S]);
|
|
25
|
+
const se = $((e) => {
|
|
26
|
+
p.current = e, C || L(e);
|
|
27
|
+
}, [C, L]), T = S ? oe ?? h : h;
|
|
28
|
+
ue(() => {
|
|
29
|
+
G && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
|
|
30
30
|
}, []);
|
|
31
|
-
const
|
|
32
|
-
t.getCanExpand() && !
|
|
33
|
-
const i = window.getSelection()?.type !== "Range" && !
|
|
34
|
-
!o &&
|
|
35
|
-
},
|
|
36
|
-
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") ||
|
|
31
|
+
const B = (e) => {
|
|
32
|
+
t.getCanExpand() && !V && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
|
|
33
|
+
const i = window.getSelection()?.type !== "Range" && !ne, o = R instanceof Function;
|
|
34
|
+
!o && H && i ? t.toggleExpand() : o && i && R(e, t), ie();
|
|
35
|
+
}, ae = (e) => {
|
|
36
|
+
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || B(e);
|
|
37
37
|
}, r = t.getVisibleCells().map((e, i, o) => ({
|
|
38
38
|
...e,
|
|
39
39
|
left: o.slice(0, i).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
|
|
40
|
-
})),
|
|
40
|
+
})), A = g(() => r.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [r]), a = g(() => r.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
|
|
41
41
|
...e,
|
|
42
42
|
right: o.slice(i + 1).reduce((d, c) => d + (c.column.getSize() ?? 0), 0)
|
|
43
|
-
})), [r]),
|
|
44
|
-
const o = e.column.id ===
|
|
43
|
+
})), [r]), z = g(() => a.some((e) => e.column.id === _), [a]), U = g(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), m = g(() => r.filter((e) => e.column.columnDef.fixedLeft), [r]), b = !J && !Q && X, D = t.getIsSelected() && b, k = R instanceof Function, W = E.length > 0 ? ge(E.map((e) => A[e])) : A, y = $((e, i) => {
|
|
44
|
+
const o = e.column.id === _, d = e.column.columnDef.fixedLeft, c = !!e.column.columnDef.fixedRight, de = e.id === m.at(-1)?.id, ce = e.id === a.at(0)?.id && !o, re = t.isExpanded(), F = i === 0;
|
|
45
45
|
return /* @__PURE__ */ l("td", {
|
|
46
|
-
className:
|
|
46
|
+
className: O(n["t-cell"], k && "cursor-pointer", I, o && n["action-cell"], o && U && n["action-cell--no-shadow"], o && !!w && m.length && n.shadowed, o && (s?.(t) ? s?.(t) : n["action-cell-default-background"]), d && n["fixed-cell"], c && n["fixed-right-cell"], de && n.shadowed, ce && n["shadowed-right"], t.getIsSelected() && n.selected, d && (s?.(t) ? s?.(t) : n["fixed-cell-default-background"]), c && (s?.(t) ? s?.(t) : n["fixed-right-cell-default-background"]), re && n.expanded_row, (!!D || t.isFocused()) && n["single-selection"]),
|
|
47
47
|
style: {
|
|
48
48
|
left: d ? e.left : void 0,
|
|
49
|
-
right: c ? e.right + (
|
|
49
|
+
right: c ? e.right + (z ? -1 : 0) : void 0
|
|
50
50
|
},
|
|
51
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ x("div", {
|
|
52
52
|
style: {
|
|
53
53
|
display: "flex",
|
|
54
54
|
alignItems: "center",
|
|
55
|
-
minWidth:
|
|
56
|
-
minHeight:
|
|
55
|
+
minWidth: F ? 32 : void 0,
|
|
56
|
+
minHeight: T,
|
|
57
57
|
position: "relative"
|
|
58
58
|
},
|
|
59
|
-
children: [
|
|
59
|
+
children: [F && D && /* @__PURE__ */ l("span", {
|
|
60
60
|
style: {
|
|
61
61
|
display: "inline-flex",
|
|
62
62
|
alignItems: "center",
|
|
@@ -65,46 +65,45 @@ function Me({ styledTableProps: P, row: t, index: K, columnWindow: { paddingLeft
|
|
|
65
65
|
top: "50%",
|
|
66
66
|
transform: "translateY(-50%)"
|
|
67
67
|
},
|
|
68
|
-
children: /* @__PURE__ */ l(
|
|
68
|
+
children: /* @__PURE__ */ l(De, {})
|
|
69
69
|
}), /* @__PURE__ */ l("span", {
|
|
70
70
|
style: {
|
|
71
|
-
marginLeft:
|
|
71
|
+
marginLeft: F && b ? 30 : 0,
|
|
72
72
|
width: "100%"
|
|
73
73
|
},
|
|
74
|
-
children:
|
|
74
|
+
children: Se(e.column.columnDef.cell, e.getContext())
|
|
75
75
|
})]
|
|
76
76
|
})
|
|
77
77
|
}, e.id);
|
|
78
78
|
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
D,
|
|
80
|
+
w,
|
|
81
|
+
T,
|
|
82
82
|
s,
|
|
83
|
-
|
|
83
|
+
k,
|
|
84
|
+
z,
|
|
84
85
|
U,
|
|
85
|
-
W,
|
|
86
86
|
m,
|
|
87
87
|
a,
|
|
88
88
|
t,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
w
|
|
89
|
+
b,
|
|
90
|
+
I
|
|
92
91
|
]);
|
|
93
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ x(fe, { children: [/* @__PURE__ */ x("tr", {
|
|
94
93
|
"aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
|
|
95
94
|
tabIndex: t.isFocused() ? 0 : -1,
|
|
96
|
-
"data-index":
|
|
95
|
+
"data-index": P,
|
|
97
96
|
"data-test": t.id,
|
|
98
97
|
id: t.id,
|
|
99
|
-
className:
|
|
98
|
+
className: O(n["t-row"], K && n["is-loading"], s?.(t)),
|
|
100
99
|
style: {
|
|
101
100
|
height: h ? `${h}px` : "inherit",
|
|
102
|
-
...
|
|
101
|
+
...v && te
|
|
103
102
|
},
|
|
104
|
-
ref:
|
|
105
|
-
onMouseUp:
|
|
103
|
+
ref: se,
|
|
104
|
+
onMouseUp: ae,
|
|
106
105
|
onMouseDown: (e) => {
|
|
107
|
-
e.detail > 1 && !
|
|
106
|
+
e.detail > 1 && !k && H && e.preventDefault();
|
|
108
107
|
},
|
|
109
108
|
onKeyDown: (e) => {
|
|
110
109
|
switch (e.key) {
|
|
@@ -116,43 +115,43 @@ function Me({ styledTableProps: P, row: t, index: K, columnWindow: { paddingLeft
|
|
|
116
115
|
t.focusPrevRow(), e.preventDefault();
|
|
117
116
|
break;
|
|
118
117
|
case "Enter":
|
|
119
|
-
|
|
118
|
+
B(e);
|
|
120
119
|
break;
|
|
121
120
|
}
|
|
122
121
|
},
|
|
123
122
|
children: [
|
|
124
|
-
m.map((e, i) =>
|
|
125
|
-
|
|
123
|
+
m.map((e, i) => y(e, i)),
|
|
124
|
+
f > 0 && /* @__PURE__ */ l("td", {
|
|
126
125
|
"aria-hidden": !0,
|
|
127
126
|
className: n["t-cell"],
|
|
128
127
|
style: {
|
|
129
|
-
width: String(
|
|
130
|
-
minWidth: String(
|
|
131
|
-
maxWidth: String(
|
|
128
|
+
width: String(f) + "px",
|
|
129
|
+
minWidth: String(f) + "px",
|
|
130
|
+
maxWidth: String(f) + "px",
|
|
132
131
|
padding: 0,
|
|
133
132
|
border: "none"
|
|
134
133
|
}
|
|
135
134
|
}),
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
W.map((e, i) => y(e, m.length + i)),
|
|
136
|
+
u > 0 && /* @__PURE__ */ l("td", {
|
|
138
137
|
"aria-hidden": !0,
|
|
139
138
|
className: n["t-cell"],
|
|
140
139
|
style: {
|
|
141
|
-
width: String(
|
|
142
|
-
minWidth: String(
|
|
143
|
-
maxWidth: String(
|
|
140
|
+
width: String(u) + "px",
|
|
141
|
+
minWidth: String(u) + "px",
|
|
142
|
+
maxWidth: String(u) + "px",
|
|
144
143
|
padding: 0,
|
|
145
144
|
border: "none"
|
|
146
145
|
}
|
|
147
146
|
}),
|
|
148
|
-
a.map((e, i) =>
|
|
147
|
+
a.map((e, i) => y(e, m.length + W.length + i))
|
|
149
148
|
]
|
|
150
|
-
}), t.getIsExpanded() && /* @__PURE__ */ l(
|
|
151
|
-
rows:
|
|
149
|
+
}), t.getIsExpanded() && /* @__PURE__ */ l(Re, { children: N && q?.({
|
|
150
|
+
rows: N.get(t.original.id.toString()) ?? [],
|
|
152
151
|
row: t.original
|
|
153
152
|
}) })] }, t.id);
|
|
154
153
|
}
|
|
155
|
-
var
|
|
154
|
+
var De = () => /* @__PURE__ */ x("svg", {
|
|
156
155
|
xmlns: "http://www.w3.org/2000/svg",
|
|
157
156
|
width: "20",
|
|
158
157
|
height: "20",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var a = {
|
|
2
|
-
"actions-header-wrapper": "_actions-header-
|
|
3
|
-
"actions-header": "_actions-
|
|
4
|
-
"pin-indicator": "_pin-
|
|
5
|
-
"pin-icon": "_pin-
|
|
2
|
+
"actions-header-wrapper": "_actions-header-wrapper_18ql0_1",
|
|
3
|
+
"actions-header": "_actions-header_18ql0_1",
|
|
4
|
+
"pin-indicator": "_pin-indicator_18ql0_25",
|
|
5
|
+
"pin-icon": "_pin-icon_18ql0_35"
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
a as default
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as R, INTERNAL_COLUMN_IDS as H } from "../../types.js";
|
|
2
|
+
import { useRootContext as v } from "../../context/RootContext.js";
|
|
3
3
|
import n from "../StyledTable.module.js";
|
|
4
|
-
import { DropUpIcon as
|
|
5
|
-
import { DropDownIcon as
|
|
6
|
-
import { getTableHeaderStyle as
|
|
7
|
-
import
|
|
8
|
-
import { useMemo as
|
|
9
|
-
import { jsx as i, jsxs as
|
|
10
|
-
import { flexRender as
|
|
11
|
-
function
|
|
12
|
-
const { hideHeader:
|
|
4
|
+
import { DropUpIcon as T } from "../../shared-components/DropUpIcon.js";
|
|
5
|
+
import { DropDownIcon as y } from "../../shared-components/DropDownIcon.js";
|
|
6
|
+
import { getTableHeaderStyle as G } from "../../helpers/getTableHeaderStyle.js";
|
|
7
|
+
import D from "clsx";
|
|
8
|
+
import { useMemo as l } from "react";
|
|
9
|
+
import { jsx as i, jsxs as w } from "react/jsx-runtime";
|
|
10
|
+
import { flexRender as F } from "@tanstack/react-table";
|
|
11
|
+
function P({ styledTableProps: S, header: o, tableCanResize: C = !1, left: _, right: b, tableWidth: N }) {
|
|
12
|
+
const { hideHeader: c = !1, enableResizing: r = !1 } = S, { isResizing: a, enableResizingFlag: m, disableResizingFlag: u } = v(), d = o.column.columnDef.fixedLeft, g = !!o.column.columnDef.fixedRight, f = o.column.id === R, p = l(() => o.headerGroup.headers.some((e) => e.id === R), [o.headerGroup.headers]), z = l(() => o.headerGroup.headers.some((e) => !!e.column.columnDef.fixedRight), [o.headerGroup.headers]), h = l(() => o.headerGroup.headers[o.headerGroup.headers.length - (p ? 2 : 1)], [o.headerGroup.headers, p]), t = o.column.getCanSort(), x = o.column.getIsSorted(), I = t ? x === "asc" ? "ascending" : x === "desc" ? "descending" : "none" : void 0;
|
|
13
13
|
return /* @__PURE__ */ i("th", {
|
|
14
14
|
colSpan: o.colSpan,
|
|
15
|
-
"aria-sort":
|
|
16
|
-
className:
|
|
15
|
+
"aria-sort": I,
|
|
16
|
+
className: D(n["t-cell"], c && n["hide-header"], f && n["t-cell__actions"], f && z && n["t-cell__actions--no-shadow"], d && n["t-cell__fixed"], g && n["t-cell__fixed-right"]),
|
|
17
17
|
style: {
|
|
18
|
-
...
|
|
19
|
-
enableResizing:
|
|
18
|
+
...G({
|
|
19
|
+
enableResizing: r,
|
|
20
20
|
header: o,
|
|
21
|
-
tableWidth:
|
|
21
|
+
tableWidth: N
|
|
22
22
|
}),
|
|
23
|
-
...
|
|
24
|
-
...
|
|
23
|
+
...d && { left: _ },
|
|
24
|
+
...g && { right: b }
|
|
25
25
|
},
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
className:
|
|
26
|
+
children: /* @__PURE__ */ w("div", {
|
|
27
|
+
className: D("flex items-center justify-start", c ? n["hide-table-header"] : n["show-table-header"], t && n["sortable-column"], o.column.columnDef.className),
|
|
28
28
|
role: t ? "button" : void 0,
|
|
29
29
|
tabIndex: t ? 0 : void 0,
|
|
30
30
|
onClick: (e) => {
|
|
31
31
|
const s = o.column.getToggleSortingHandler();
|
|
32
|
-
!
|
|
32
|
+
!a && s && s(e), u();
|
|
33
33
|
},
|
|
34
34
|
onKeyDown: t ? (e) => {
|
|
35
35
|
if (e.key !== "Enter" && e.key !== " ") return;
|
|
36
36
|
e.preventDefault();
|
|
37
37
|
const s = o.column.getToggleSortingHandler();
|
|
38
|
-
!
|
|
38
|
+
!a && s && s(e), u();
|
|
39
39
|
} : void 0,
|
|
40
40
|
children: [
|
|
41
41
|
/* @__PURE__ */ i("div", {
|
|
42
42
|
className: n["header-content"],
|
|
43
|
-
children:
|
|
43
|
+
children: F(o.column.columnDef.header, o.getContext())
|
|
44
44
|
}),
|
|
45
45
|
{
|
|
46
|
-
asc: /* @__PURE__ */ i(
|
|
47
|
-
desc: /* @__PURE__ */ i(
|
|
46
|
+
asc: /* @__PURE__ */ i(T, { className: n["sort-icon"] }),
|
|
47
|
+
desc: /* @__PURE__ */ i(y, { className: n["sort-icon"] })
|
|
48
48
|
}[o.column.getIsSorted()] ?? null,
|
|
49
|
-
|
|
49
|
+
C && (r ? !0 : o.id !== h?.id) && o.column.getCanResize() && !H.includes(o.column.id) && /* @__PURE__ */ i("div", {
|
|
50
50
|
onDoubleClick: () => o.column.resetSize(),
|
|
51
51
|
onMouseDown: (e) => {
|
|
52
|
-
e.stopPropagation(),
|
|
52
|
+
e.stopPropagation(), m(), o.getResizeHandler()(e);
|
|
53
53
|
},
|
|
54
54
|
onTouchStart: (e) => {
|
|
55
|
-
e.stopPropagation(),
|
|
55
|
+
e.stopPropagation(), m(), o.getResizeHandler()(e);
|
|
56
56
|
},
|
|
57
57
|
className: `${n.resizer} ${o.column.getIsResizing() ? n.isResizing : ""}`
|
|
58
58
|
})
|
|
@@ -61,5 +61,5 @@ function J({ styledTableProps: C, header: o, tableCanResize: D = !1, left: N, ri
|
|
|
61
61
|
}, o.id);
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
P as TableHeaderCell
|
|
65
65
|
};
|