@caspeco/casper-ui-library 8.2.2 → 8.4.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/modal/modal.spec.d.ts +0 -1
- package/dist/components/modal/modal.spec.d.ts.map +1 -1
- package/dist/components/paginator/paginator.composition.d.ts +1 -0
- package/dist/components/paginator/paginator.composition.d.ts.map +1 -1
- package/dist/components/paginator/paginator.d.ts +3 -1
- package/dist/components/paginator/paginator.d.ts.map +1 -1
- package/dist/components/paginator/paginator.js +12 -11
- package/dist/components/table/helper.d.ts +2 -0
- package/dist/components/table/helper.d.ts.map +1 -0
- package/dist/components/table/helper.js +7 -0
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +93 -80
- package/dist/components/table/table-context-provider.d.ts +10 -2
- package/dist/components/table/table-context-provider.d.ts.map +1 -1
- package/dist/components/table/table-context-provider.js +149 -110
- package/dist/components/table/table-header-row.d.ts.map +1 -1
- package/dist/components/table/table-header-row.js +170 -121
- package/dist/components/table/table-row.js +11 -11
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +16 -8
- package/dist/components/table/table.spec.d.ts +0 -1
- package/dist/components/table/table.spec.d.ts.map +1 -1
- package/dist/components/table/types.d.ts +21 -0
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.spec.d.ts +0 -1
- package/dist/components/toggle-button/toggle-button.spec.d.ts.map +1 -1
- package/dist/node_modules/@dnd-kit/abstract/index.js +1142 -0
- package/dist/node_modules/@dnd-kit/collision/dist/index.js +91 -0
- package/dist/node_modules/@dnd-kit/dom/index.js +1554 -0
- package/dist/node_modules/@dnd-kit/dom/sortable.js +631 -0
- package/dist/node_modules/@dnd-kit/dom/utilities.js +943 -0
- package/dist/node_modules/@dnd-kit/geometry/dist/index.js +200 -0
- package/dist/node_modules/@dnd-kit/react/hooks.js +69 -0
- package/dist/node_modules/@dnd-kit/react/index.js +235 -0
- package/dist/node_modules/@dnd-kit/react/sortable.js +129 -0
- package/dist/node_modules/@dnd-kit/react/utilities.js +11 -0
- package/dist/node_modules/@dnd-kit/state/dist/index.js +181 -0
- package/dist/node_modules/@preact/signals-core/dist/signals-core.module.js +265 -0
- package/dist/test-utils/hooks/setup-mock-resize-observer.d.ts +1 -1
- package/dist/test-utils/hooks/setup-mock-resize-observer.d.ts.map +1 -1
- package/dist/theme/theme-config/components/paginator-theme.d.ts +5 -19
- package/dist/theme/theme-config/components/paginator-theme.d.ts.map +1 -1
- package/dist/theme/theme-config/components/paginator-theme.js +34 -18
- package/package.json +3 -1
|
@@ -1,132 +1,171 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useControllableState as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { jsx as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useControllableState as d } from "@chakra-ui/react";
|
|
3
|
+
import { useReactTable as me } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { useState as b, useCallback as n, useEffect as Ce } from "react";
|
|
5
|
+
import { arrayMove as L } from "./helper.js";
|
|
6
|
+
import { TableContext as be } from "./table-context.js";
|
|
7
|
+
import { getFilteredRowModel as we, getSortedRowModel as he, getExpandedRowModel as Re, getCoreRowModel as ve } from "../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
8
|
+
const Ee = ({
|
|
9
|
+
data: w,
|
|
10
|
+
columns: h,
|
|
11
|
+
children: k,
|
|
12
|
+
expandedState: q,
|
|
13
|
+
localeString: z,
|
|
14
|
+
initialExpandedState: R = {},
|
|
15
|
+
initialBreakingContentState: v = {},
|
|
16
|
+
initialColumnVisibilityState: A = {},
|
|
17
|
+
columnVisibilityState: B,
|
|
18
|
+
onColumnVisibilityChange: G,
|
|
19
|
+
onExpandedChange: M,
|
|
20
|
+
getRowId: S,
|
|
21
|
+
getRowActions: I,
|
|
22
|
+
onBreakingContentChange: J,
|
|
23
|
+
id: K,
|
|
24
|
+
customRowIndication: g,
|
|
25
|
+
onSortingChange: p,
|
|
26
|
+
initialSortingState: N = [],
|
|
27
|
+
sortingState: x,
|
|
28
|
+
selectionState: Q,
|
|
29
|
+
initialSelectionState: U = [],
|
|
30
|
+
onSelectionChange: y,
|
|
31
|
+
selectionActions: P,
|
|
32
|
+
disableSelectionCheckbox: u,
|
|
33
|
+
enableColumnReorder: V = !1,
|
|
34
|
+
columnOrderState: W,
|
|
35
|
+
initialColumnOrder: E,
|
|
36
|
+
onColumnOrderChange: X
|
|
32
37
|
}) => {
|
|
33
|
-
const [
|
|
34
|
-
value:
|
|
35
|
-
onChange:
|
|
36
|
-
defaultValue:
|
|
37
|
-
}), [
|
|
38
|
-
value:
|
|
39
|
-
onChange:
|
|
40
|
-
defaultValue:
|
|
41
|
-
}), [
|
|
42
|
-
value:
|
|
43
|
-
onChange:
|
|
44
|
-
defaultValue:
|
|
45
|
-
}), [
|
|
46
|
-
value:
|
|
47
|
-
onChange:
|
|
48
|
-
defaultValue:
|
|
49
|
-
}), [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}), [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
38
|
+
const [r, c] = d({
|
|
39
|
+
value: q,
|
|
40
|
+
onChange: M,
|
|
41
|
+
defaultValue: R
|
|
42
|
+
}), [a, F] = d({
|
|
43
|
+
value: B,
|
|
44
|
+
onChange: G,
|
|
45
|
+
defaultValue: A
|
|
46
|
+
}), [T, O] = d({
|
|
47
|
+
value: x,
|
|
48
|
+
onChange: p,
|
|
49
|
+
defaultValue: N
|
|
50
|
+
}), [Y, Z] = d({
|
|
51
|
+
value: Q,
|
|
52
|
+
onChange: y,
|
|
53
|
+
defaultValue: U
|
|
54
|
+
}), [f, s] = d({
|
|
55
|
+
value: W,
|
|
56
|
+
onChange: X,
|
|
57
|
+
defaultValue: E?.length ? E : h.map((e) => e.id).filter((e) => e !== void 0)
|
|
58
|
+
}), [_, $] = b(
|
|
59
|
+
v || {}
|
|
60
|
+
), [H, m] = b({}), [j, D] = b(null), ee = n((e) => (D(e), () => {
|
|
61
|
+
D(null);
|
|
62
|
+
}), []), te = n(() => j, [j]);
|
|
63
|
+
Ce(() => {
|
|
64
|
+
g && m(g);
|
|
65
|
+
}, [g, m]);
|
|
66
|
+
const oe = n(
|
|
58
67
|
(e) => {
|
|
59
68
|
let t;
|
|
60
|
-
typeof e == "function" ? t = e(
|
|
69
|
+
typeof e == "function" ? t = e(a) : t = e, F(t);
|
|
61
70
|
},
|
|
62
|
-
[
|
|
63
|
-
),
|
|
71
|
+
[a, F]
|
|
72
|
+
), ne = n(
|
|
64
73
|
(e) => {
|
|
65
74
|
let t;
|
|
66
|
-
typeof e == "function" ? t = e(
|
|
75
|
+
typeof e == "function" ? t = e(r) : t = e, c(t);
|
|
67
76
|
},
|
|
68
|
-
[
|
|
69
|
-
),
|
|
77
|
+
[r, c]
|
|
78
|
+
), le = n(
|
|
70
79
|
(e) => {
|
|
71
|
-
|
|
80
|
+
O(e);
|
|
72
81
|
},
|
|
73
|
-
[
|
|
74
|
-
),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
[O]
|
|
83
|
+
), ie = n(
|
|
84
|
+
(e) => {
|
|
85
|
+
const t = typeof e == "function" ? e(f) : e;
|
|
86
|
+
s(t);
|
|
87
|
+
},
|
|
88
|
+
[f, s]
|
|
89
|
+
), o = me({
|
|
90
|
+
columns: h,
|
|
91
|
+
data: w,
|
|
92
|
+
getCoreRowModel: ve(),
|
|
93
|
+
getExpandedRowModel: Re(),
|
|
94
|
+
getSortedRowModel: he(),
|
|
95
|
+
getFilteredRowModel: we(),
|
|
96
|
+
onColumnVisibilityChange: oe,
|
|
97
|
+
onExpandedChange: ne,
|
|
98
|
+
onColumnOrderChange: ie,
|
|
83
99
|
getSubRows: (e) => e.subRows,
|
|
84
|
-
getRowId:
|
|
100
|
+
getRowId: S,
|
|
85
101
|
enableSubRowSelection: !0,
|
|
86
102
|
enableMultiRowSelection: !1,
|
|
87
103
|
enableRowSelection: !0,
|
|
88
104
|
state: {
|
|
89
|
-
sorting:
|
|
90
|
-
columnVisibility:
|
|
91
|
-
expanded:
|
|
92
|
-
rowSelection:
|
|
105
|
+
sorting: T,
|
|
106
|
+
columnVisibility: a,
|
|
107
|
+
expanded: r,
|
|
108
|
+
rowSelection: H,
|
|
109
|
+
columnOrder: V ? f : void 0
|
|
110
|
+
},
|
|
111
|
+
manualSorting: x !== void 0
|
|
112
|
+
}), se = n(
|
|
113
|
+
(e, t) => {
|
|
114
|
+
if (e === t) return;
|
|
115
|
+
const ae = o.getColumn(e).getIsPinned(), fe = o.getColumn(t).getIsPinned();
|
|
116
|
+
if (ae === "left" || fe === "left") {
|
|
117
|
+
const i = o.getAllLeafColumns().filter((l) => l.getIsVisible()), C = i.map((l) => l.id), ge = L(
|
|
118
|
+
C,
|
|
119
|
+
C.indexOf(e),
|
|
120
|
+
C.indexOf(t)
|
|
121
|
+
), ue = i.filter((l) => l.getIsPinned() === "left").length;
|
|
122
|
+
o.setColumnPinning((l) => ({
|
|
123
|
+
...l,
|
|
124
|
+
left: ge.slice(0, ue)
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
s((i) => L(i, i.indexOf(e), i.indexOf(t)));
|
|
93
128
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
data:
|
|
97
|
-
table:
|
|
98
|
-
initialExpandedState:
|
|
99
|
-
initialBreakingContentState:
|
|
100
|
-
localeString:
|
|
101
|
-
onExpandedChange:
|
|
102
|
-
expanded:
|
|
103
|
-
sorting:
|
|
104
|
-
setSorting:
|
|
105
|
-
setExpanded:
|
|
106
|
-
getRowId:
|
|
107
|
-
getRowActions:
|
|
108
|
-
breakingContentState:
|
|
109
|
-
setBreakingContentState:
|
|
110
|
-
onBreakingContentChange:
|
|
111
|
-
id:
|
|
112
|
-
setRowHighlight:
|
|
113
|
-
rowHighlight:
|
|
114
|
-
columnVisibility:
|
|
115
|
-
onSortingChange:
|
|
116
|
-
registerTableFilter:
|
|
117
|
-
getTableFilterMethods:
|
|
118
|
-
canSelectRows:
|
|
119
|
-
setSelectedRowIds:
|
|
120
|
-
selectedRowIds:
|
|
121
|
-
selectionActions:
|
|
122
|
-
disableSelectionCheckbox:
|
|
123
|
-
getSelectableRowIds:
|
|
129
|
+
[s, o]
|
|
130
|
+
), de = n(() => o.getRowModel().flatRows.filter((e) => !u?.(e)).map((e) => e.id), [u, o]), re = {
|
|
131
|
+
data: w,
|
|
132
|
+
table: o,
|
|
133
|
+
initialExpandedState: R,
|
|
134
|
+
initialBreakingContentState: v,
|
|
135
|
+
localeString: z,
|
|
136
|
+
onExpandedChange: M,
|
|
137
|
+
expanded: r,
|
|
138
|
+
sorting: T,
|
|
139
|
+
setSorting: le,
|
|
140
|
+
setExpanded: c,
|
|
141
|
+
getRowId: S,
|
|
142
|
+
getRowActions: I,
|
|
143
|
+
breakingContentState: _,
|
|
144
|
+
setBreakingContentState: $,
|
|
145
|
+
onBreakingContentChange: J,
|
|
146
|
+
id: K,
|
|
147
|
+
setRowHighlight: m,
|
|
148
|
+
rowHighlight: H,
|
|
149
|
+
columnVisibility: a,
|
|
150
|
+
onSortingChange: p,
|
|
151
|
+
registerTableFilter: ee,
|
|
152
|
+
getTableFilterMethods: te,
|
|
153
|
+
canSelectRows: y !== void 0 || P !== void 0,
|
|
154
|
+
setSelectedRowIds: Z,
|
|
155
|
+
selectedRowIds: Y,
|
|
156
|
+
selectionActions: P,
|
|
157
|
+
disableSelectionCheckbox: u,
|
|
158
|
+
getSelectableRowIds: de,
|
|
159
|
+
enableColumnReorder: V,
|
|
160
|
+
columnOrder: f,
|
|
161
|
+
setColumnOrder: s,
|
|
162
|
+
handleDragEnd: se
|
|
124
163
|
};
|
|
125
164
|
return (
|
|
126
165
|
// This is correct but there's no easy way to type the context statically with generics
|
|
127
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ ce(be.Provider, { value: re, children: k })
|
|
128
167
|
);
|
|
129
168
|
};
|
|
130
169
|
export {
|
|
131
|
-
|
|
170
|
+
Ee as TableProvider
|
|
132
171
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA0B/F,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,4CAkD3F,CAAC;AA0TF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
|
|
@@ -1,187 +1,236 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Tr as A, Th as
|
|
1
|
+
import { jsx as t, Fragment as I, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { Tr as A, Th as k, useMediaQuery as H, Portal as P } from "@chakra-ui/react";
|
|
3
3
|
import { flexRender as V } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
-
import { memo as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
import { memo as L, useRef as N, useCallback as B, useLayoutEffect as O, forwardRef as F, useMemo as $ } from "react";
|
|
5
|
+
import { closestCenter as j } from "../../node_modules/@dnd-kit/collision/dist/index.js";
|
|
6
|
+
import { SortableKeyboardPlugin as E } from "../../node_modules/@dnd-kit/dom/sortable.js";
|
|
7
|
+
import { useSortable as W } from "../../node_modules/@dnd-kit/react/sortable.js";
|
|
8
|
+
import { useTableContext as C } from "./table-context.js";
|
|
9
|
+
import { TableHeaderDropdown as K } from "./table-header-dropdown.js";
|
|
10
|
+
import { translations as T } from "./translations.js";
|
|
11
|
+
import { Flex as R } from "../flex/flex.js";
|
|
12
|
+
import { Box as b } from "../box/box.js";
|
|
13
|
+
import { Divider as Q } from "../divider/divider.js";
|
|
14
|
+
import { Menu as X } from "../menu/menu.js";
|
|
15
|
+
import { MenuButton as q } from "../menu/menu-button.js";
|
|
16
|
+
import { Icons as M } from "../icon/types.js";
|
|
17
|
+
import { MenuList as G } from "../menu/menu-list.js";
|
|
18
|
+
import { Checkbox as J } from "../checkbox/checkbox.js";
|
|
19
|
+
import { MenuItem as U } from "../menu/menu-item.js";
|
|
20
|
+
import { IconButton as Y } from "../icon-button/icon-button.js";
|
|
21
|
+
import { Button as Z } from "../button/button.js";
|
|
22
|
+
import { ThemeColorVariable as u, ThemeSpaceVariable as S, ThemeFontSizeVariable as _, ThemeFontVariable as ee } from "../../theme/theme-types.js";
|
|
23
|
+
const te = ({
|
|
24
|
+
headerGroup: n,
|
|
22
25
|
hideTableHeaderDropdown: o,
|
|
23
26
|
portalContainerRef: s
|
|
24
27
|
}) => {
|
|
25
|
-
const i =
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
+
const i = C(), a = !!i.getRowActions, c = (i.selectedRowIds?.length ?? 0) > 0 && (i.selectionActions?.length ?? 0) > 0;
|
|
29
|
+
return /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(A, { children: c ? /* @__PURE__ */ t(
|
|
30
|
+
k,
|
|
28
31
|
{
|
|
29
|
-
colSpan:
|
|
32
|
+
colSpan: n.headers.length,
|
|
30
33
|
sx: {
|
|
31
34
|
cursor: "default",
|
|
32
35
|
"& div:hover": {
|
|
33
36
|
backgroundColor: "transparent !important"
|
|
34
37
|
},
|
|
35
38
|
"div span": {
|
|
36
|
-
color:
|
|
39
|
+
color: u.OnBackground
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
zIndex: 1,
|
|
40
43
|
style: {
|
|
41
|
-
borderBottom: `1px solid ${
|
|
42
|
-
paddingLeft:
|
|
44
|
+
borderBottom: `1px solid ${u.OnBackgroundBorder}`,
|
|
45
|
+
paddingLeft: a ? "24px" : void 0
|
|
43
46
|
},
|
|
44
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ t(z, { showSelectAll: !0, children: /* @__PURE__ */ t(le, {}) })
|
|
45
48
|
}
|
|
46
|
-
) : /* @__PURE__ */
|
|
47
|
-
|
|
49
|
+
) : /* @__PURE__ */ t(I, { children: n.headers.map((r, e) => /* @__PURE__ */ t(
|
|
50
|
+
ne,
|
|
48
51
|
{
|
|
49
|
-
header:
|
|
52
|
+
header: r,
|
|
50
53
|
hideTableHeaderDropdown: o,
|
|
51
|
-
applyActionMenuPadding:
|
|
54
|
+
applyActionMenuPadding: a,
|
|
52
55
|
portalContainerRef: s,
|
|
53
|
-
isFirstColumn:
|
|
56
|
+
isFirstColumn: !r.isPlaceholder && e === 0,
|
|
57
|
+
enableColumnReorder: i.enableColumnReorder
|
|
54
58
|
},
|
|
55
|
-
|
|
56
|
-
)) }) },
|
|
57
|
-
},
|
|
58
|
-
header:
|
|
59
|
+
r.id
|
|
60
|
+
)) }) }, n.id) });
|
|
61
|
+
}, ne = ({
|
|
62
|
+
header: n,
|
|
59
63
|
hideTableHeaderDropdown: o,
|
|
60
64
|
applyActionMenuPadding: s,
|
|
61
65
|
portalContainerRef: i,
|
|
62
|
-
isFirstColumn:
|
|
66
|
+
isFirstColumn: a = !1,
|
|
67
|
+
enableColumnReorder: c = !1
|
|
63
68
|
}) => {
|
|
64
|
-
const
|
|
65
|
-
const
|
|
69
|
+
const r = N(null), e = C(), { column: l } = n, g = B((d) => {
|
|
70
|
+
const h = d.getIsPinned(), p = d.getSize();
|
|
66
71
|
return {
|
|
67
|
-
position:
|
|
68
|
-
left:
|
|
69
|
-
backgroundColor:
|
|
70
|
-
zIndex:
|
|
71
|
-
width:
|
|
72
|
-
maxWidth:
|
|
72
|
+
position: h ? "sticky" : "relative",
|
|
73
|
+
left: h ? `${d.getStart("left")}px` : void 0,
|
|
74
|
+
backgroundColor: h ? u.Background : void 0,
|
|
75
|
+
zIndex: h ? 1 : 0,
|
|
76
|
+
width: p,
|
|
77
|
+
maxWidth: p
|
|
73
78
|
};
|
|
74
79
|
}, []);
|
|
75
|
-
|
|
76
|
-
const d =
|
|
80
|
+
O(() => {
|
|
81
|
+
const d = r.current;
|
|
77
82
|
if (!d) return;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
const w =
|
|
83
|
+
const h = l.id, p = (f) => {
|
|
84
|
+
f > 0 && e.table.getState().columnSizing[h] !== f && e.table.setColumnSizing((w) => ({ ...w, [h]: f }));
|
|
85
|
+
}, v = new ResizeObserver((f) => {
|
|
86
|
+
const w = f[0];
|
|
82
87
|
if (!w) return;
|
|
83
|
-
const
|
|
84
|
-
|
|
88
|
+
const D = w.borderBoxSize?.[0]?.inlineSize ?? d.getBoundingClientRect().width;
|
|
89
|
+
p(D);
|
|
85
90
|
});
|
|
86
|
-
return
|
|
87
|
-
}, [])
|
|
88
|
-
|
|
91
|
+
return v.observe(d), p(d.getBoundingClientRect().width), () => v.disconnect();
|
|
92
|
+
}, []);
|
|
93
|
+
const m = /* @__PURE__ */ t(z, { showSelectAll: e.canSelectRows && a, children: /* @__PURE__ */ t(I, { children: o ? /* @__PURE__ */ t(b, { paddingLeft: S.Small, children: V(n.column.columnDef.header, n.getContext()) }) : /* @__PURE__ */ t(
|
|
94
|
+
K,
|
|
95
|
+
{
|
|
96
|
+
header: n,
|
|
97
|
+
breakingContentState: e.breakingContentState,
|
|
98
|
+
columnVisibility: e.columnVisibility,
|
|
99
|
+
headerGroup: e.table.getHeaderGroups(),
|
|
100
|
+
localeString: e.localeString,
|
|
101
|
+
setBreakingContentState: e.setBreakingContentState,
|
|
102
|
+
setSorting: e.setSorting,
|
|
103
|
+
sorting: e.sorting,
|
|
104
|
+
onBreakingContentChange: e.onBreakingContentChange,
|
|
105
|
+
portalContainerRef: i
|
|
106
|
+
}
|
|
107
|
+
) }) });
|
|
108
|
+
return c ? /* @__PURE__ */ t(
|
|
109
|
+
oe,
|
|
110
|
+
{
|
|
111
|
+
ref: r,
|
|
112
|
+
columnId: l.id,
|
|
113
|
+
columnIndex: l.getIndex(),
|
|
114
|
+
disableColumnReorder: l.columnDef.meta?.disableColumnReorder,
|
|
115
|
+
isNumeric: l.columnDef.meta?.isNumeric,
|
|
116
|
+
zIndex: l.getIsPinned() ? 2 : 1,
|
|
117
|
+
style: {
|
|
118
|
+
...g(l),
|
|
119
|
+
borderBottom: `1px solid ${u.OnBackgroundBorder}`,
|
|
120
|
+
paddingLeft: a && s ? "24px" : void 0
|
|
121
|
+
},
|
|
122
|
+
children: m
|
|
123
|
+
}
|
|
124
|
+
) : /* @__PURE__ */ t(
|
|
125
|
+
k,
|
|
89
126
|
{
|
|
90
|
-
ref:
|
|
127
|
+
ref: r,
|
|
91
128
|
className: "tableHeaderCell",
|
|
92
|
-
isNumeric:
|
|
93
|
-
zIndex:
|
|
129
|
+
isNumeric: l.columnDef.meta?.isNumeric,
|
|
130
|
+
zIndex: l.getIsPinned() ? 2 : 1,
|
|
94
131
|
style: {
|
|
95
|
-
...
|
|
96
|
-
borderBottom: `1px solid ${
|
|
97
|
-
paddingLeft:
|
|
132
|
+
...g(l),
|
|
133
|
+
borderBottom: `1px solid ${u.OnBackgroundBorder}`,
|
|
134
|
+
paddingLeft: a && s ? "24px" : void 0
|
|
98
135
|
},
|
|
99
|
-
children:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
136
|
+
children: m
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}, oe = F(({ columnId: n, columnIndex: o, isNumeric: s, disableColumnReorder: i, zIndex: a, style: c, children: r }, e) => {
|
|
140
|
+
const { ref: l, isDragging: g, isDropTarget: m } = W({
|
|
141
|
+
id: n,
|
|
142
|
+
index: o,
|
|
143
|
+
disabled: i,
|
|
144
|
+
collisionDetector: j,
|
|
145
|
+
plugins: [E]
|
|
146
|
+
});
|
|
147
|
+
return /* @__PURE__ */ t(
|
|
148
|
+
k,
|
|
149
|
+
{
|
|
150
|
+
ref: (d) => {
|
|
151
|
+
l(d), typeof e == "function" ? e(d) : e && (e.current = d);
|
|
152
|
+
},
|
|
153
|
+
className: "tableHeaderCell",
|
|
154
|
+
isNumeric: s,
|
|
155
|
+
zIndex: a,
|
|
156
|
+
style: {
|
|
157
|
+
...c,
|
|
158
|
+
cursor: g ? "grabbing" : "pointer",
|
|
159
|
+
opacity: g ? 0.5 : 1,
|
|
160
|
+
backgroundColor: m ? u.Background : void 0
|
|
161
|
+
},
|
|
162
|
+
children: r
|
|
114
163
|
}
|
|
115
164
|
);
|
|
116
|
-
},
|
|
117
|
-
/* @__PURE__ */
|
|
165
|
+
}), z = ({ showSelectAll: n, children: o }) => n ? /* @__PURE__ */ x(R, { w: "100%", align: "center", children: [
|
|
166
|
+
/* @__PURE__ */ t(b, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(re, {}) }),
|
|
118
167
|
o
|
|
119
|
-
] }) : /* @__PURE__ */
|
|
120
|
-
const
|
|
121
|
-
(
|
|
122
|
-
const
|
|
123
|
-
|
|
168
|
+
] }) : /* @__PURE__ */ t(I, { children: o }), re = () => {
|
|
169
|
+
const n = C(), o = B(
|
|
170
|
+
(a) => {
|
|
171
|
+
const c = a.target.checked, r = n.getSelectableRowIds();
|
|
172
|
+
c ? n.setSelectedRowIds((e) => [.../* @__PURE__ */ new Set([...e, ...r])]) : n.setSelectedRowIds((e) => e.filter((l) => !r.includes(l)));
|
|
124
173
|
},
|
|
125
|
-
[
|
|
126
|
-
), { allIsSelected: s, shouldShowIndeterminateState: i } =
|
|
127
|
-
const
|
|
174
|
+
[n]
|
|
175
|
+
), { allIsSelected: s, shouldShowIndeterminateState: i } = $(() => {
|
|
176
|
+
const c = n.table.getRowModel().flatRows, r = new Set(n.selectedRowIds), e = n.getSelectableRowIds(), l = e.length > 0 && e.every((m) => r.has(m)), g = c.some((m) => r.has(m.id));
|
|
128
177
|
return {
|
|
129
|
-
allIsSelected:
|
|
130
|
-
shouldShowIndeterminateState:
|
|
178
|
+
allIsSelected: l,
|
|
179
|
+
shouldShowIndeterminateState: g && !l
|
|
131
180
|
};
|
|
132
|
-
}, [
|
|
133
|
-
return /* @__PURE__ */
|
|
134
|
-
|
|
181
|
+
}, [n]);
|
|
182
|
+
return /* @__PURE__ */ t(
|
|
183
|
+
J,
|
|
135
184
|
{
|
|
136
185
|
isChecked: s,
|
|
137
186
|
isIndeterminate: i,
|
|
138
187
|
onChange: o
|
|
139
188
|
}
|
|
140
189
|
);
|
|
141
|
-
},
|
|
142
|
-
const { localeString:
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
190
|
+
}, le = () => {
|
|
191
|
+
const { localeString: n, selectedRowIds: o = [], selectionActions: s = [] } = C(), i = T[n], [a] = H("(min-width: 48em)"), c = s.length > 3 || !a, r = o.length === 1 ? i.selectedSingular.replace("{count}", "1") : i.selected.replace("{count}", o.length.toString());
|
|
192
|
+
return /* @__PURE__ */ x(
|
|
193
|
+
R,
|
|
145
194
|
{
|
|
146
|
-
gap:
|
|
195
|
+
gap: S.Medium,
|
|
147
196
|
align: "center",
|
|
148
197
|
alignContent: "center",
|
|
149
|
-
marginBottom:
|
|
198
|
+
marginBottom: S.XSmall,
|
|
150
199
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
-
|
|
200
|
+
/* @__PURE__ */ t(
|
|
201
|
+
b,
|
|
153
202
|
{
|
|
154
|
-
pl:
|
|
155
|
-
color:
|
|
156
|
-
fontFamily:
|
|
157
|
-
fontSize:
|
|
203
|
+
pl: S.Small,
|
|
204
|
+
color: u.OnBackground,
|
|
205
|
+
fontFamily: ee.Body,
|
|
206
|
+
fontSize: _.Medium,
|
|
158
207
|
whiteSpace: "nowrap",
|
|
159
208
|
style: { fontVariantNumeric: "normal" },
|
|
160
|
-
children:
|
|
209
|
+
children: r
|
|
161
210
|
}
|
|
162
211
|
),
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
] }) : s.map((
|
|
212
|
+
/* @__PURE__ */ t(b, { children: /* @__PURE__ */ t(Q, { orientation: "vertical", height: "20px" }) }),
|
|
213
|
+
/* @__PURE__ */ t(R, { gap: S.Small, align: "center", children: c ? /* @__PURE__ */ x(X, { children: [
|
|
214
|
+
/* @__PURE__ */ t(q, { variant: "ghost", rightIcon: M.TreeViewCollapse, children: i.action }),
|
|
215
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(G, { children: s.map((e) => /* @__PURE__ */ t(y, { isMenuItem: !0, action: e }, e.name)) }) })
|
|
216
|
+
] }) : s.map((e) => /* @__PURE__ */ t(y, { isMenuItem: !1, action: e }, e.name)) })
|
|
168
217
|
]
|
|
169
218
|
}
|
|
170
219
|
);
|
|
171
|
-
},
|
|
172
|
-
const { selectedRowIds: s, localeString: i } =
|
|
220
|
+
}, y = ({ isMenuItem: n, action: o }) => {
|
|
221
|
+
const { selectedRowIds: s, localeString: i } = C(), a = T[i], c = B(() => {
|
|
173
222
|
o.onClick(s || []);
|
|
174
223
|
}, [o, s]);
|
|
175
|
-
return
|
|
176
|
-
|
|
224
|
+
return n ? /* @__PURE__ */ t(U, { onClick: c, children: o.variant === "delete" ? /* @__PURE__ */ t(b, { as: "span", color: u.Error, children: o.name }) : o.name }) : o.variant === "delete" ? /* @__PURE__ */ t(
|
|
225
|
+
Y,
|
|
177
226
|
{
|
|
178
|
-
onClick:
|
|
179
|
-
icon:
|
|
180
|
-
"aria-label":
|
|
227
|
+
onClick: c,
|
|
228
|
+
icon: M.Delete,
|
|
229
|
+
"aria-label": a.deleteSelectedRows,
|
|
181
230
|
variant: "ghost"
|
|
182
231
|
}
|
|
183
|
-
) : /* @__PURE__ */
|
|
184
|
-
},
|
|
232
|
+
) : /* @__PURE__ */ t(Z, { onClick: c, variant: "ghost", children: o.name });
|
|
233
|
+
}, Te = L(te);
|
|
185
234
|
export {
|
|
186
|
-
|
|
235
|
+
Te as TableHeaderRow
|
|
187
236
|
};
|