@caspeco/casper-ui-library 7.10.1 → 7.11.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/components/table/table-content.d.ts +5 -1
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +23 -21
- package/dist/components/table/table-header-dropdown.d.ts +3 -1
- package/dist/components/table/table-header-dropdown.d.ts.map +1 -1
- package/dist/components/table/table-header-dropdown.js +22 -21
- package/dist/components/table/table-header-row.d.ts +3 -1
- package/dist/components/table/table-header-row.d.ts.map +1 -1
- package/dist/components/table/table-header-row.js +62 -60
- package/package.json +1 -1
|
@@ -43,8 +43,12 @@ export interface TableContentProps<TData extends TableData = TableData> {
|
|
|
43
43
|
* Enables virtualization for the table rows to improve performance with large datasets.
|
|
44
44
|
*/
|
|
45
45
|
virtualization?: VirtualizationOptions;
|
|
46
|
+
/**
|
|
47
|
+
* Anchor portals to a referenced layer. Defaults to document body.
|
|
48
|
+
*/
|
|
49
|
+
portalContainerRef?: React.RefObject<HTMLElement | null>;
|
|
46
50
|
}
|
|
47
|
-
declare const TableContentInner: <TData extends TableData>({ onClickRow, onRowClickIndication, hideTableHeaderDropdown, showRowHoverStyle, stickyHeaders, virtualization, ...props }: TableContentProps<TData> & ThemeStyleProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare const TableContentInner: <TData extends TableData>({ onClickRow, onRowClickIndication, hideTableHeaderDropdown, showRowHoverStyle, stickyHeaders, virtualization, portalContainerRef, ...props }: TableContentProps<TData> & ThemeStyleProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
52
|
export declare const TableContent: typeof TableContentInner;
|
|
49
53
|
export {};
|
|
50
54
|
//# sourceMappingURL=table-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,e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AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,+IASjD,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,4CAuJ5C,CAAC;AAEF,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsxs as S, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Table as
|
|
3
|
-
import { useVirtualizer as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
import { TableHeaderRow as
|
|
2
|
+
import { Table as E, Thead as M, Box as $, Tbody as y } from "@chakra-ui/react";
|
|
3
|
+
import { useVirtualizer as D } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
4
|
+
import { memo as L, useRef as O, useMemo as u } from "react";
|
|
5
|
+
import { useTableContext as Y } from "./table-context.js";
|
|
6
|
+
import { TableHeaderRow as k } from "./table-header-row.js";
|
|
7
7
|
import { TableRow as v } from "./table-row.js";
|
|
8
|
-
const
|
|
8
|
+
const q = ({
|
|
9
9
|
onClickRow: m,
|
|
10
10
|
onRowClickIndication: b,
|
|
11
11
|
hideTableHeaderDropdown: w,
|
|
12
12
|
showRowHoverStyle: g = !0,
|
|
13
13
|
stickyHeaders: h,
|
|
14
14
|
virtualization: a,
|
|
15
|
-
|
|
15
|
+
portalContainerRef: R,
|
|
16
|
+
...z
|
|
16
17
|
}) => {
|
|
17
|
-
const t =
|
|
18
|
+
const t = Y(), i = O(null), B = u(() => h ? {
|
|
18
19
|
position: "sticky",
|
|
19
20
|
top: 0,
|
|
20
21
|
zIndex: 1
|
|
@@ -29,7 +30,7 @@ const k = ({
|
|
|
29
30
|
t.sorting,
|
|
30
31
|
t.data
|
|
31
32
|
]
|
|
32
|
-
), p = c.length, l = !!a, f = a?.estimateRowHeight ?? 40, x = a?.overscan ?? 5,
|
|
33
|
+
), p = c.length, l = !!a, f = a?.estimateRowHeight ?? 40, x = a?.overscan ?? 5, H = a?.height ?? "600px", I = u(
|
|
33
34
|
() => ({
|
|
34
35
|
count: p,
|
|
35
36
|
getScrollElement: () => i.current,
|
|
@@ -41,7 +42,7 @@ const k = ({
|
|
|
41
42
|
}
|
|
42
43
|
}),
|
|
43
44
|
[l, f, x, p]
|
|
44
|
-
), C =
|
|
45
|
+
), C = D(I), n = l ? C.getVirtualItems() : [], _ = () => {
|
|
45
46
|
if (!l)
|
|
46
47
|
return /* @__PURE__ */ e(y, { children: c.map((s) => {
|
|
47
48
|
const r = s.getVisibleCells();
|
|
@@ -63,12 +64,12 @@ const k = ({
|
|
|
63
64
|
n.map((s) => {
|
|
64
65
|
const r = c[s.index];
|
|
65
66
|
if (!r) return null;
|
|
66
|
-
const
|
|
67
|
+
const j = r.getVisibleCells();
|
|
67
68
|
return /* @__PURE__ */ e(
|
|
68
69
|
v,
|
|
69
70
|
{
|
|
70
71
|
row: r,
|
|
71
|
-
visibleCells:
|
|
72
|
+
visibleCells: j,
|
|
72
73
|
onClickRow: m,
|
|
73
74
|
onRowClickIndication: b,
|
|
74
75
|
showRowHoverStyle: g
|
|
@@ -78,23 +79,24 @@ const k = ({
|
|
|
78
79
|
}),
|
|
79
80
|
d > 0 && /* @__PURE__ */ e("tr", { style: { height: `${d}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) })
|
|
80
81
|
] });
|
|
81
|
-
}, T = /* @__PURE__ */ S(
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
-
|
|
82
|
+
}, T = /* @__PURE__ */ S(E, { ...z, id: t.id, children: [
|
|
83
|
+
/* @__PURE__ */ e(M, { style: B, children: t.table.getHeaderGroups().map((o) => /* @__PURE__ */ e(
|
|
84
|
+
k,
|
|
84
85
|
{
|
|
85
86
|
headerGroup: o,
|
|
86
|
-
hideTableHeaderDropdown: w
|
|
87
|
+
hideTableHeaderDropdown: w,
|
|
88
|
+
portalContainerRef: R
|
|
87
89
|
},
|
|
88
90
|
o.id
|
|
89
91
|
)) }),
|
|
90
|
-
|
|
92
|
+
_()
|
|
91
93
|
] });
|
|
92
94
|
return l ? /* @__PURE__ */ e(
|
|
93
|
-
|
|
95
|
+
$,
|
|
94
96
|
{
|
|
95
97
|
ref: i,
|
|
96
98
|
overflowY: "auto",
|
|
97
|
-
height:
|
|
99
|
+
height: H,
|
|
98
100
|
position: "relative",
|
|
99
101
|
tabIndex: -1,
|
|
100
102
|
outline: "none",
|
|
@@ -103,7 +105,7 @@ const k = ({
|
|
|
103
105
|
children: T
|
|
104
106
|
}
|
|
105
107
|
) : T;
|
|
106
|
-
},
|
|
108
|
+
}, Q = L(q);
|
|
107
109
|
export {
|
|
108
|
-
|
|
110
|
+
Q as TableContent
|
|
109
111
|
};
|
|
@@ -12,7 +12,9 @@ type TableHeaderDropdownProps<TData extends TableData> = {
|
|
|
12
12
|
columnVisibility: VisibilityState;
|
|
13
13
|
localeString: Locales;
|
|
14
14
|
};
|
|
15
|
-
declare const TableHeaderDropdownComponent: <TData extends TableData>({ header, breakingContentState, onBreakingContentChange, setBreakingContentState, headerGroup, sorting, setSorting, localeString, }: TableHeaderDropdownProps<TData>
|
|
15
|
+
declare const TableHeaderDropdownComponent: <TData extends TableData>({ header, breakingContentState, onBreakingContentChange, setBreakingContentState, headerGroup, sorting, setSorting, localeString, portalContainerRef, }: TableHeaderDropdownProps<TData> & {
|
|
16
|
+
portalContainerRef?: React.RefObject<HTMLElement | null>;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export declare const TableHeaderDropdown: typeof TableHeaderDropdownComponent;
|
|
17
19
|
export {};
|
|
18
20
|
//# sourceMappingURL=table-header-dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-header-dropdown.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-dropdown.tsx"],"names":[],"mappings":"AAWA,OAAO,EAGN,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,KAAK,wBAAwB,CAAC,KAAK,SAAS,SAAS,IAAI;IACxD,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClF,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;IACxF,WAAW,EAAE,WAAW,CAAC,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,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,4BAA4B,GAAI,KAAK,SAAS,SAAS,EAAE,yJAU5D,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CA0IhG,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAyC,OAAO,4BAA4B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as d, Fragment as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { Portal as
|
|
3
|
-
import { flexRender as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { useTableContext as
|
|
2
|
+
import { Portal as j } from "@chakra-ui/react";
|
|
3
|
+
import { flexRender as A } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { memo as L, useCallback as D, useMemo as p } from "react";
|
|
5
|
+
import { useTableContext as R } from "./table-context.js";
|
|
6
6
|
import { translations as U } from "./translations.js";
|
|
7
7
|
import { Icon as S } from "../icon/icon.js";
|
|
8
8
|
import { Icons as l } from "../icon/types.js";
|
|
@@ -11,10 +11,10 @@ import { Text as r } from "../text/text.js";
|
|
|
11
11
|
import { MenuDivider as k } from "../menu/menu-divider.js";
|
|
12
12
|
import { Switch as X } from "../switch/switch.js";
|
|
13
13
|
import { Menu as v } from "../menu/menu.js";
|
|
14
|
-
import { MenuBoxButton as
|
|
15
|
-
import { MenuList as
|
|
16
|
-
import { ThemeIconSizeVariable as F, ThemeColorVariable as w, ThemeSpaceVariable as
|
|
17
|
-
const
|
|
14
|
+
import { MenuBoxButton as $ } from "../menu/menu-box-button.js";
|
|
15
|
+
import { MenuList as q } from "../menu/menu-list.js";
|
|
16
|
+
import { ThemeIconSizeVariable as F, ThemeColorVariable as w, ThemeSpaceVariable as J, ThemeFontSizeVariable as z } from "../../theme/theme-types.js";
|
|
17
|
+
const K = ({
|
|
18
18
|
header: o,
|
|
19
19
|
breakingContentState: m,
|
|
20
20
|
onBreakingContentChange: h,
|
|
@@ -22,9 +22,10 @@ const J = ({
|
|
|
22
22
|
headerGroup: g,
|
|
23
23
|
sorting: u,
|
|
24
24
|
setSorting: f,
|
|
25
|
-
localeString: V
|
|
25
|
+
localeString: V,
|
|
26
|
+
portalContainerRef: y
|
|
26
27
|
}) => {
|
|
27
|
-
const e = U[V],
|
|
28
|
+
const e = U[V], H = R(), { getTableFilterMethods: s } = H, T = D(
|
|
28
29
|
(i) => {
|
|
29
30
|
const c = {
|
|
30
31
|
...m,
|
|
@@ -36,18 +37,18 @@ const J = ({
|
|
|
36
37
|
), b = D(
|
|
37
38
|
(i) => {
|
|
38
39
|
const c = i.getIndex();
|
|
39
|
-
g.forEach((
|
|
40
|
-
|
|
41
|
-
const { column: M } =
|
|
40
|
+
g.forEach((E) => {
|
|
41
|
+
E.headers.forEach((O, I) => {
|
|
42
|
+
const { column: M } = O;
|
|
42
43
|
i.getIsPinned() ? I >= c && M.pin(!1) : I <= c && M.pin("left");
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
},
|
|
46
47
|
[g]
|
|
47
|
-
),
|
|
48
|
+
), P = p(() => /* @__PURE__ */ d(a, { children: [
|
|
48
49
|
u.find((i) => i.id === o.column.id) && (u.find((i) => i.desc) ? /* @__PURE__ */ n(S, { icon: l.SortDesc, size: F.XSmall }) : /* @__PURE__ */ n(S, { icon: l.SortAsc, size: F.XSmall })),
|
|
49
50
|
o.column.columnDef.header
|
|
50
|
-
] }), [o.column.columnDef.header, o.column.id, u]), x = p(() => s()?.canFilterOnColumn(o.column.id) ?? !1, [o.column.id, s]),
|
|
51
|
+
] }), [o.column.columnDef.header, o.column.id, u]), x = p(() => s()?.canFilterOnColumn(o.column.id) ?? !1, [o.column.id, s]), B = p(() => /* @__PURE__ */ d(a, { children: [
|
|
51
52
|
/* @__PURE__ */ n(
|
|
52
53
|
t,
|
|
53
54
|
{
|
|
@@ -101,7 +102,7 @@ const J = ({
|
|
|
101
102
|
]);
|
|
102
103
|
return /* @__PURE__ */ n(v, { isLazy: !0, children: ({ isOpen: i }) => /* @__PURE__ */ d(a, { children: [
|
|
103
104
|
/* @__PURE__ */ n(
|
|
104
|
-
|
|
105
|
+
$,
|
|
105
106
|
{
|
|
106
107
|
color: w.OnBackgroundSubdued,
|
|
107
108
|
textTransform: "none",
|
|
@@ -109,15 +110,15 @@ const J = ({
|
|
|
109
110
|
h: "40px",
|
|
110
111
|
display: "flex",
|
|
111
112
|
alignItems: "center",
|
|
112
|
-
padding: `0px 0px 0px ${
|
|
113
|
+
padding: `0px 0px 0px ${J.Small}`,
|
|
113
114
|
backgroundColor: i ? w.BackgroundDisabled : "unset",
|
|
114
115
|
w: "100%",
|
|
115
|
-
children:
|
|
116
|
+
children: A(P, o.getContext())
|
|
116
117
|
}
|
|
117
118
|
),
|
|
118
|
-
/* @__PURE__ */ n(
|
|
119
|
+
/* @__PURE__ */ n(j, { containerRef: y, children: /* @__PURE__ */ n(q, { fontSize: z.Medium, children: B }) })
|
|
119
120
|
] }) });
|
|
120
|
-
},
|
|
121
|
+
}, un = L(K);
|
|
121
122
|
export {
|
|
122
|
-
|
|
123
|
+
un as TableHeaderDropdown
|
|
123
124
|
};
|
|
@@ -4,7 +4,9 @@ type TableHeaderRowProps<TData extends TableData> = {
|
|
|
4
4
|
headerGroup: HeaderGroup<TableRow<TData>>;
|
|
5
5
|
hideTableHeaderDropdown: boolean | undefined;
|
|
6
6
|
};
|
|
7
|
-
declare const TableHeaderRowComponent: <TData extends TableData>({ headerGroup, hideTableHeaderDropdown, }: TableHeaderRowProps<TData>
|
|
7
|
+
declare const TableHeaderRowComponent: <TData extends TableData>({ headerGroup, hideTableHeaderDropdown, portalContainerRef, }: TableHeaderRowProps<TData> & {
|
|
8
|
+
portalContainerRef?: React.RefObject<HTMLElement | null>;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export declare const TableHeaderRow: typeof TableHeaderRowComponent;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=table-header-row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYlF,OAAO,KAAK,EAAmB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpE,KAAK,mBAAmB,CAAC,KAAK,SAAS,SAAS,IAAI;IACnD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,KAAK,SAAS,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYlF,OAAO,KAAK,EAAmB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpE,KAAK,mBAAmB,CAAC,KAAK,SAAS,SAAS,IAAI;IACnD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,KAAK,SAAS,SAAS,EAAE,+DAIvD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CA2F3F,CAAC;AAuJF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { Tr as B, Th as
|
|
1
|
+
import { jsx as e, Fragment as u, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { Tr as B, Th as b, useMediaQuery as v, Portal as M } from "@chakra-ui/react";
|
|
3
3
|
import { flexRender as T } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
-
import { memo as y, useCallback as
|
|
5
|
-
import { useTableContext as
|
|
4
|
+
import { memo as y, useCallback as C, useMemo as A } from "react";
|
|
5
|
+
import { useTableContext as p } from "./table-context.js";
|
|
6
6
|
import { TableHeaderDropdown as V } from "./table-header-dropdown.js";
|
|
7
|
-
import { translations as
|
|
7
|
+
import { translations as x } from "./translations.js";
|
|
8
8
|
import { Box as g } from "../box/box.js";
|
|
9
|
-
import { Flex as
|
|
9
|
+
import { Flex as w } from "../flex/flex.js";
|
|
10
10
|
import { Divider as z } from "../divider/divider.js";
|
|
11
11
|
import { Menu as D } from "../menu/menu.js";
|
|
12
12
|
import { MenuButton as F } from "../menu/menu-button.js";
|
|
13
|
-
import { Icons as
|
|
13
|
+
import { Icons as R } from "../icon/types.js";
|
|
14
14
|
import { MenuList as H } from "../menu/menu-list.js";
|
|
15
15
|
import { Checkbox as P } from "../checkbox/checkbox.js";
|
|
16
16
|
import { MenuItem as L } from "../menu/menu-item.js";
|
|
@@ -19,21 +19,22 @@ import { Button as O } from "../button/button.js";
|
|
|
19
19
|
import { ThemeColorVariable as d, ThemeSpaceVariable as m, ThemeFontSizeVariable as j, ThemeFontVariable as $ } from "../../theme/theme-types.js";
|
|
20
20
|
const W = ({
|
|
21
21
|
headerGroup: o,
|
|
22
|
-
hideTableHeaderDropdown:
|
|
22
|
+
hideTableHeaderDropdown: r,
|
|
23
|
+
portalContainerRef: a
|
|
23
24
|
}) => {
|
|
24
|
-
const n =
|
|
25
|
-
const
|
|
25
|
+
const n = p(), s = !!n.getRowActions, i = C((t) => {
|
|
26
|
+
const l = t.getIsPinned();
|
|
26
27
|
return {
|
|
27
|
-
position:
|
|
28
|
-
left:
|
|
29
|
-
backgroundColor:
|
|
30
|
-
zIndex:
|
|
31
|
-
width:
|
|
32
|
-
maxWidth:
|
|
28
|
+
position: l ? "sticky" : "relative",
|
|
29
|
+
left: l ? `${t.getStart("left")}px` : void 0,
|
|
30
|
+
backgroundColor: l ? d.Background : void 0,
|
|
31
|
+
zIndex: l ? 1 : 0,
|
|
32
|
+
width: t.getSize(),
|
|
33
|
+
maxWidth: t.getSize()
|
|
33
34
|
};
|
|
34
|
-
}, []),
|
|
35
|
-
return /* @__PURE__ */ e(
|
|
36
|
-
|
|
35
|
+
}, []), c = (n.selectedRowIds?.length ?? 0) > 0 && (n.selectionActions?.length ?? 0) > 0;
|
|
36
|
+
return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(B, { children: c ? /* @__PURE__ */ e(
|
|
37
|
+
b,
|
|
37
38
|
{
|
|
38
39
|
colSpan: o.headers.length,
|
|
39
40
|
sx: {
|
|
@@ -48,27 +49,27 @@ const W = ({
|
|
|
48
49
|
zIndex: 1,
|
|
49
50
|
style: {
|
|
50
51
|
borderBottom: `1px solid ${d.OnBackgroundBorder}`,
|
|
51
|
-
paddingLeft:
|
|
52
|
+
paddingLeft: s ? "24px" : void 0
|
|
52
53
|
},
|
|
53
|
-
children: /* @__PURE__ */ e(
|
|
54
|
+
children: /* @__PURE__ */ e(I, { showSelectAll: !0, children: /* @__PURE__ */ e(Q, {}) })
|
|
54
55
|
}
|
|
55
|
-
) : /* @__PURE__ */ e(
|
|
56
|
-
const { column:
|
|
56
|
+
) : /* @__PURE__ */ e(u, { children: o.headers.map((t) => {
|
|
57
|
+
const { column: l } = t, h = l.getIndex() === 0;
|
|
57
58
|
return /* @__PURE__ */ e(
|
|
58
|
-
|
|
59
|
+
b,
|
|
59
60
|
{
|
|
60
61
|
className: "tableHeaderCell",
|
|
61
|
-
isNumeric:
|
|
62
|
-
zIndex:
|
|
62
|
+
isNumeric: l.columnDef.meta?.isNumeric,
|
|
63
|
+
zIndex: l.getIsPinned() ? 2 : 1,
|
|
63
64
|
style: {
|
|
64
|
-
...
|
|
65
|
+
...i(l),
|
|
65
66
|
borderBottom: `1px solid ${d.OnBackgroundBorder}`,
|
|
66
|
-
paddingLeft:
|
|
67
|
+
paddingLeft: h && s ? "24px" : void 0
|
|
67
68
|
},
|
|
68
|
-
children: /* @__PURE__ */ e(
|
|
69
|
+
children: /* @__PURE__ */ e(I, { showSelectAll: n.canSelectRows && h, children: /* @__PURE__ */ e(u, { children: r ? /* @__PURE__ */ e(g, { paddingLeft: m.Small, children: T(t.column.columnDef.header, t.getContext()) }) : /* @__PURE__ */ e(
|
|
69
70
|
V,
|
|
70
71
|
{
|
|
71
|
-
header:
|
|
72
|
+
header: t,
|
|
72
73
|
breakingContentState: n.breakingContentState,
|
|
73
74
|
columnVisibility: n.columnVisibility,
|
|
74
75
|
headerGroup: n.table.getHeaderGroups(),
|
|
@@ -76,42 +77,43 @@ const W = ({
|
|
|
76
77
|
setBreakingContentState: n.setBreakingContentState,
|
|
77
78
|
setSorting: n.setSorting,
|
|
78
79
|
sorting: n.sorting,
|
|
79
|
-
onBreakingContentChange: n.onBreakingContentChange
|
|
80
|
+
onBreakingContentChange: n.onBreakingContentChange,
|
|
81
|
+
portalContainerRef: a
|
|
80
82
|
}
|
|
81
83
|
) }) })
|
|
82
84
|
},
|
|
83
|
-
|
|
85
|
+
t.id
|
|
84
86
|
);
|
|
85
87
|
}) }) }, o.id) });
|
|
86
|
-
},
|
|
88
|
+
}, I = ({ showSelectAll: o, children: r }) => o ? /* @__PURE__ */ f(w, { w: "100%", align: "center", children: [
|
|
87
89
|
/* @__PURE__ */ e(g, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(E, {}) }),
|
|
88
|
-
|
|
89
|
-
] }) : /* @__PURE__ */ e(
|
|
90
|
-
const o =
|
|
90
|
+
r
|
|
91
|
+
] }) : /* @__PURE__ */ e(u, { children: r }), E = () => {
|
|
92
|
+
const o = p(), r = C(
|
|
91
93
|
(s) => {
|
|
92
|
-
const i = s.target.checked,
|
|
93
|
-
i ? o.setSelectedRowIds((t) => [.../* @__PURE__ */ new Set([...t, ...
|
|
94
|
+
const i = s.target.checked, c = o.getSelectableRowIds();
|
|
95
|
+
i ? o.setSelectedRowIds((t) => [.../* @__PURE__ */ new Set([...t, ...c])]) : o.setSelectedRowIds((t) => t.filter((l) => !c.includes(l)));
|
|
94
96
|
},
|
|
95
97
|
[o]
|
|
96
|
-
), { allIsSelected:
|
|
97
|
-
const i = o.table.getRowModel().flatRows,
|
|
98
|
+
), { allIsSelected: a, shouldShowIndeterminateState: n } = A(() => {
|
|
99
|
+
const i = o.table.getRowModel().flatRows, c = new Set(o.selectedRowIds), t = o.getSelectableRowIds(), l = t.length > 0 && t.every((S) => c.has(S)), h = i.some((S) => c.has(S.id));
|
|
98
100
|
return {
|
|
99
|
-
allIsSelected:
|
|
100
|
-
shouldShowIndeterminateState:
|
|
101
|
+
allIsSelected: l,
|
|
102
|
+
shouldShowIndeterminateState: h && !l
|
|
101
103
|
};
|
|
102
104
|
}, [o]);
|
|
103
105
|
return /* @__PURE__ */ e(
|
|
104
106
|
P,
|
|
105
107
|
{
|
|
106
|
-
isChecked:
|
|
107
|
-
isIndeterminate:
|
|
108
|
-
onChange:
|
|
108
|
+
isChecked: a,
|
|
109
|
+
isIndeterminate: n,
|
|
110
|
+
onChange: r
|
|
109
111
|
}
|
|
110
112
|
);
|
|
111
113
|
}, Q = () => {
|
|
112
|
-
const { localeString: o, selectedRowIds:
|
|
113
|
-
return /* @__PURE__ */
|
|
114
|
-
|
|
114
|
+
const { localeString: o, selectedRowIds: r = [], selectionActions: a = [] } = p(), n = x[o], [s] = v("(min-width: 48em)"), i = a.length > 3 || !s, c = r.length === 1 ? n.selectedSingular.replace("{count}", "1") : n.selected.replace("{count}", r.length.toString());
|
|
115
|
+
return /* @__PURE__ */ f(
|
|
116
|
+
w,
|
|
115
117
|
{
|
|
116
118
|
gap: m.Medium,
|
|
117
119
|
align: "center",
|
|
@@ -127,30 +129,30 @@ const W = ({
|
|
|
127
129
|
fontSize: j.Medium,
|
|
128
130
|
whiteSpace: "nowrap",
|
|
129
131
|
style: { fontVariantNumeric: "normal" },
|
|
130
|
-
children:
|
|
132
|
+
children: c
|
|
131
133
|
}
|
|
132
134
|
),
|
|
133
135
|
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(z, { orientation: "vertical", height: "20px" }) }),
|
|
134
|
-
/* @__PURE__ */ e(
|
|
135
|
-
/* @__PURE__ */ e(F, { variant: "ghost", rightIcon:
|
|
136
|
-
/* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(H, { children:
|
|
137
|
-
] }) :
|
|
136
|
+
/* @__PURE__ */ e(w, { gap: m.Small, align: "center", children: i ? /* @__PURE__ */ f(D, { children: [
|
|
137
|
+
/* @__PURE__ */ e(F, { variant: "ghost", rightIcon: R.TreeViewCollapse, children: n.action }),
|
|
138
|
+
/* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(H, { children: a.map((t) => /* @__PURE__ */ e(k, { isMenuItem: !0, action: t }, t.name)) }) })
|
|
139
|
+
] }) : a.map((t) => /* @__PURE__ */ e(k, { isMenuItem: !1, action: t }, t.name)) })
|
|
138
140
|
]
|
|
139
141
|
}
|
|
140
142
|
);
|
|
141
|
-
},
|
|
142
|
-
const { selectedRowIds:
|
|
143
|
-
|
|
144
|
-
}, [
|
|
145
|
-
return o ? /* @__PURE__ */ e(L, { onClick: i, children:
|
|
143
|
+
}, k = ({ isMenuItem: o, action: r }) => {
|
|
144
|
+
const { selectedRowIds: a, localeString: n } = p(), s = x[n], i = C(() => {
|
|
145
|
+
r.onClick(a || []);
|
|
146
|
+
}, [r, a]);
|
|
147
|
+
return o ? /* @__PURE__ */ e(L, { onClick: i, children: r.variant === "delete" ? /* @__PURE__ */ e(g, { as: "span", color: d.Error, children: r.name }) : r.name }) : r.variant === "delete" ? /* @__PURE__ */ e(
|
|
146
148
|
N,
|
|
147
149
|
{
|
|
148
150
|
onClick: i,
|
|
149
|
-
icon:
|
|
151
|
+
icon: R.Delete,
|
|
150
152
|
"aria-label": s.deleteSelectedRows,
|
|
151
153
|
variant: "ghost"
|
|
152
154
|
}
|
|
153
|
-
) : /* @__PURE__ */ e(O, { onClick: i, variant: "ghost", children:
|
|
155
|
+
) : /* @__PURE__ */ e(O, { onClick: i, variant: "ghost", children: r.name });
|
|
154
156
|
}, de = y(W);
|
|
155
157
|
export {
|
|
156
158
|
de as TableHeaderRow
|