@osdk/react-components 0.2.0-beta.1 → 0.2.0-beta.2
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/CHANGELOG.md +14 -0
- package/README.md +21 -5
- package/build/browser/base-components/checkbox/Checkbox.js +27 -32
- package/build/browser/base-components/checkbox/Checkbox.module.css +79 -0
- package/build/browser/base-components/checkbox/Checkbox.module.css.js +7 -0
- package/build/browser/object-table/CellContextMenu.js +23 -20
- package/build/browser/object-table/CellContextMenu.module.css +20 -0
- package/build/browser/object-table/CellContextMenu.module.css.js +6 -0
- package/build/browser/object-table/LoadingCell.js +24 -29
- package/build/browser/object-table/LoadingCell.module.css +48 -0
- package/build/browser/object-table/LoadingCell.module.css.js +8 -0
- package/build/browser/object-table/LoadingRow.js +24 -50
- package/build/browser/object-table/LoadingStateTable.js +46 -340
- package/build/browser/object-table/NonIdealState.js +23 -20
- package/build/browser/object-table/NonIdealState.module.css +28 -0
- package/build/browser/object-table/NonIdealState.module.css.js +7 -0
- package/build/browser/object-table/Table.js +51 -933
- package/build/browser/object-table/Table.js.map +1 -1
- package/build/browser/object-table/Table.module.css +22 -0
- package/build/browser/object-table/Table.module.css.js +6 -0
- package/build/browser/object-table/TableBody.js +36 -260
- package/build/browser/object-table/TableBody.module.css +20 -0
- package/build/browser/object-table/TableBody.module.css.js +6 -0
- package/build/browser/object-table/TableCell.js +31 -111
- package/build/browser/object-table/TableCell.module.css +62 -0
- package/build/browser/object-table/TableCell.module.css.js +7 -0
- package/build/browser/object-table/TableHeader.js +38 -215
- package/build/browser/object-table/TableHeader.module.css +101 -0
- package/build/browser/object-table/TableHeader.module.css.js +10 -0
- package/build/browser/object-table/TableHeaderContent.js +21 -18
- package/build/browser/object-table/TableHeaderContent.module.css +30 -0
- package/build/browser/object-table/TableHeaderContent.module.css.js +6 -0
- package/build/browser/object-table/TableHeaderWithPopover.js +66 -80
- package/build/browser/object-table/TableHeaderWithPopover.module.css +110 -0
- package/build/browser/object-table/TableHeaderWithPopover.module.css.js +15 -0
- package/build/browser/object-table/TableRow.js +26 -144
- package/build/browser/object-table/TableRow.module.css +60 -0
- package/build/browser/object-table/TableRow.module.css.js +6 -0
- package/build/browser/styles.css +615 -0
- package/build/cjs/public/experimental.cjs +5 -5
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/esm/object-table/Table.js +5 -5
- package/build/esm/object-table/Table.js.map +1 -1
- package/package.json +9 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.osdkTableCell {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
text-align: left;
|
|
21
|
+
position: relative;
|
|
22
|
+
padding: var(--osdk-table-cell-padding);
|
|
23
|
+
font-size: var(--osdk-table-cell-fontSize);
|
|
24
|
+
color: var(--osdk-table-cell-color);
|
|
25
|
+
background-color: inherit;
|
|
26
|
+
border-right: var(--osdk-table-cell-divider);
|
|
27
|
+
|
|
28
|
+
&:first-child {
|
|
29
|
+
border-left: var(--osdk-table-border);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:last-child {
|
|
33
|
+
border-right: var(--osdk-table-border);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.osdkTableCell[data-pinned="left"],
|
|
38
|
+
.osdkTableCell[data-pinned="right"] {
|
|
39
|
+
position: sticky;
|
|
40
|
+
z-index: var(--osdk-surface-z-index-1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Last left-pinned column - no left-pinned siblings after it */
|
|
44
|
+
.osdkTableCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {
|
|
45
|
+
border-right: var(--osdk-table-pinned-column-border);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* First right-pinned column - no right-pinned siblings before it */
|
|
49
|
+
.osdkTableCell[data-pinned="right"]:not(:has(~ [data-pinned="right"]):nth-child(n+2)) {
|
|
50
|
+
border-left: var(--osdk-table-pinned-column-border);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.osdkTableCell:has([role="checkbox"]) {
|
|
54
|
+
justify-content: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.osdkTableCellContent:not(:has([role="checkbox"])) {
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
text-align: left;
|
|
62
|
+
}
|
|
@@ -1,237 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
3
16
|
|
|
4
|
-
// build/browser/object-table/TableHeader.module.css
|
|
5
|
-
var css = '/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.osdkTableHeader {\n display: grid;\n position: sticky;\n top: 0;\n z-index: var(--osdk-surface-z-index-1);\n background-color: var(--osdk-table-header-bg);\n}\n\n.osdkTableHeader[data-resizing="true"] {\n cursor: col-resize;\n user-select: none;\n}\n\n.osdkTableHeaderRow {\n display: flex;\n}\n\n.osdkTableHeaderCell {\n display: flex;\n align-items: center;\n text-align: left;\n position: relative;\n padding: var(--osdk-table-cell-padding);\n font-weight: var(--osdk-table-header-fontWeight);\n font-size: var(--osdk-table-header-fontSize);\n color: var(--osdk-table-header-color);\n border-top: var(--osdk-table-border);\n border-right: var(--osdk-table-header-divider);\n background-color: inherit;\n\n &:first-child {\n border-left: var(--osdk-table-border);\n }\n\n &:last-child {\n border-right: var(--osdk-table-border);\n }\n}\n\n.osdkTableHeaderCell[data-pinned="left"],\n.osdkTableHeaderCell[data-pinned="right"] {\n position: sticky;\n z-index: var(--osdk-surface-z-index-2);\n}\n\n/* Last left-pinned column - no left-pinned siblings after it */\n.osdkTableHeaderCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {\n border-right: var(--osdk-table-pinned-column-border);\n}\n\n/* First right-pinned column - no right-pinned siblings before it */\n.osdkTableHeaderCell[data-pinned="right"]:not(\n :has(~ [data-pinned="right"]):nth-child(n + 2)\n ) {\n border-left: var(--osdk-table-pinned-column-border);\n}\n\n.osdkTableHeaderCell:has([role="checkbox"]) {\n justify-content: center;\n}\n\n.osdkTableHeaderResizer {\n background: none;\n cursor: col-resize;\n height: 100%;\n position: absolute;\n right: calc(-1 * var(--osdk-table-border-width));\n top: 0;\n touch-action: none;\n width: 3px;\n z-index: var(--osdk-surface-z-index-2);\n\n &:hover {\n background: var(--osdk-intent-primary-hover);\n }\n\n &:active {\n background: var(--osdk-intent-primary-active);\n }\n}\n\n.osdkLoadingHeaderCell {\n height: var(--osdk-table-header-fontSize);\n flex: 1;\n}\n';
|
|
6
|
-
if (typeof document !== "undefined") {
|
|
7
|
-
const style = document.createElement("style");
|
|
8
|
-
style.textContent = css;
|
|
9
|
-
document.head.appendChild(style);
|
|
10
|
-
}
|
|
11
|
-
var TableHeader_default = { "osdkTableHeader": "osdkTableHeader", "osdkTableHeaderRow": "osdkTableHeaderRow", "osdkTableHeaderCell": "osdkTableHeaderCell", "osdkTableHeaderResizer": "osdkTableHeaderResizer", "osdkLoadingHeaderCell": "osdkLoadingHeaderCell" };
|
|
12
|
-
|
|
13
|
-
// build/browser/object-table/TableHeaderContent.js
|
|
14
|
-
import { flexRender } from "@tanstack/react-table";
|
|
15
17
|
import React from "react";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
document.head.appendChild(style);
|
|
23
|
-
}
|
|
24
|
-
var TableHeaderContent_default = { "osdkHeaderContent": "osdkHeaderContent" };
|
|
25
|
-
|
|
26
|
-
// build/browser/object-table/TableHeaderContent.js
|
|
27
|
-
function TableHeaderContent({
|
|
28
|
-
header
|
|
29
|
-
}) {
|
|
30
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
31
|
-
className: TableHeaderContent_default.osdkHeaderContent
|
|
32
|
-
}, flexRender(header.column.columnDef.header, header.getContext()));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// build/browser/object-table/TableHeaderWithPopover.js
|
|
36
|
-
import { Menu } from "@base-ui/react/menu";
|
|
37
|
-
import { ChevronDown, Pin, Remove, SortAlphabetical, SortAlphabeticalDesc, Unpin, VerticalDistribution } from "@blueprintjs/icons";
|
|
38
|
-
import classNames from "classnames";
|
|
39
|
-
import React2, { useCallback, useState } from "react";
|
|
40
|
-
|
|
41
|
-
// build/browser/object-table/TableHeaderWithPopover.module.css
|
|
42
|
-
var css3 = '/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.osdkCenterContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.osdkContentGap {\n display: flex;\n gap: var(--osdk-surface-spacing);\n}\n\n.osdkHeaderContainer {\n justify-content: space-between;\n flex: 1;\n min-width: 0;\n align-self: stretch;\n}\n\n.osdkHeaderContentLeft {\n min-width: 0;\n flex-shrink: 1;\n}\n\n.osdkHeaderContentRight {\n flex-shrink: 0;\n}\n\n.osdkHeaderPopoverTrigger {\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n border: var(--osdk-surface-border-width) solid\n var(--osdk-surface-border-color-default);\n border-radius: var(--osdk-surface-border-radius);\n color: var(--osdk-intent-default-foreground);\n user-select: none;\n outline: none;\n\n &:hover {\n background-color: var(--osdk-intent-default-hover);\n }\n\n &[data-popup-open] {\n background-color: var(--osdk-intent-primary-rest);\n }\n\n &:focus-visible {\n outline: var(--osdk-focus-visible-outline);\n outline-offset: var(--osdk-focus-visible-outline-offset);\n }\n}\n\n.osdkHeaderIcon {\n width: var(--osdk-iconography-size-small);\n height: var(--osdk-iconography-size-small);\n}\n\n.osdkHeaderPopup {\n box-sizing: border-box;\n padding: var(--osdk-surface-spacing);\n border-radius: var(--osdk-surface-border-radius);\n border: var(--osdk-surface-border-width) solid\n var(--osdk-surface-border-color-default);\n background-color: var(--osdk-surface-background-color-default);\n color: var(--osdk-typography-color-default-rest);\n box-shadow: var(--osdk-surface-shadow-2);\n font-size: var(--osdk-typography-size-body-medium);\n outline: none;\n}\n\n.osdkHeaderMenuItem {\n justify-content: flex-start;\n padding: var(--osdk-surface-spacing);\n cursor: pointer;\n}\n\n.osdkHeaderMenuItem:hover {\n outline: none;\n background-color: var(--osdk-surface-background-color-default-hover);\n border-radius: var(--osdk-surface-border-radius);\n}\n\n.osdkHeaderActiveMenuItem {\n background-color: var(--osdk-intent-primary-rest);\n color: var(--osdk-intent-primary-foreground);\n}\n\n.osdkHeaderActiveMenuItem:hover {\n background-color: var(--osdk-intent-primary-hover);\n}\n\n.osdkHeaderActiveMenuItem:active {\n background-color: var(--osdk-intent-primary-active);\n}\n';
|
|
43
|
-
if (typeof document !== "undefined") {
|
|
44
|
-
const style = document.createElement("style");
|
|
45
|
-
style.textContent = css3;
|
|
46
|
-
document.head.appendChild(style);
|
|
47
|
-
}
|
|
48
|
-
var TableHeaderWithPopover_default = { "osdkCenterContainer": "osdkCenterContainer", "osdkContentGap": "osdkContentGap", "osdkHeaderContainer": "osdkHeaderContainer", "osdkHeaderContentLeft": "osdkHeaderContentLeft", "osdkHeaderContentRight": "osdkHeaderContentRight", "osdkHeaderPopoverTrigger": "osdkHeaderPopoverTrigger", "osdkHeaderIcon": "osdkHeaderIcon", "osdkHeaderPopup": "osdkHeaderPopup", "osdkHeaderMenuItem": "osdkHeaderMenuItem", "osdkHeaderActiveMenuItem": "osdkHeaderActiveMenuItem" };
|
|
49
|
-
|
|
50
|
-
// build/browser/object-table/TableHeaderWithPopover.js
|
|
51
|
-
function HeaderMenuItem({
|
|
52
|
-
onClick,
|
|
53
|
-
icon: Icon,
|
|
54
|
-
label,
|
|
55
|
-
active = false
|
|
56
|
-
}) {
|
|
57
|
-
return /* @__PURE__ */ React2.createElement(Menu.Item, {
|
|
58
|
-
closeOnClick: true,
|
|
59
|
-
className: classNames(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderMenuItem, active && TableHeaderWithPopover_default.osdkHeaderActiveMenuItem),
|
|
60
|
-
onClick
|
|
61
|
-
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
62
|
-
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
63
|
-
color: "currentColor"
|
|
64
|
-
}), /* @__PURE__ */ React2.createElement("span", null, label));
|
|
65
|
-
}
|
|
66
|
-
function TableHeaderWithPopover({
|
|
67
|
-
header,
|
|
68
|
-
isColumnPinned,
|
|
69
|
-
setColumnPinning,
|
|
70
|
-
onSortChange,
|
|
71
|
-
onResetSize
|
|
72
|
-
}) {
|
|
73
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
74
|
-
const handlePinLeft = useCallback(() => {
|
|
75
|
-
setColumnPinning((prev) => {
|
|
76
|
-
return {
|
|
77
|
-
left: [...prev.left || [], header.column.id],
|
|
78
|
-
right: prev.right?.filter((id) => id !== header.column.id) || []
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
}, [header.column.id, setColumnPinning]);
|
|
82
|
-
const handleUnpin = useCallback(() => {
|
|
83
|
-
setColumnPinning((prev) => {
|
|
84
|
-
return {
|
|
85
|
-
left: prev.left?.filter((id) => id !== header.column.id) || [],
|
|
86
|
-
right: prev.right?.filter((id) => id !== header.column.id) || []
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
}, [header.column.id, setColumnPinning]);
|
|
90
|
-
const handleSortAscending = useCallback(() => {
|
|
91
|
-
header.column.toggleSorting(false);
|
|
92
|
-
onSortChange?.([{
|
|
93
|
-
id: header.column.id,
|
|
94
|
-
desc: false
|
|
95
|
-
}]);
|
|
96
|
-
}, [header.column, onSortChange]);
|
|
97
|
-
const handleSortDescending = useCallback(() => {
|
|
98
|
-
header.column.toggleSorting(true);
|
|
99
|
-
onSortChange?.([{
|
|
100
|
-
id: header.column.id,
|
|
101
|
-
desc: true
|
|
102
|
-
}]);
|
|
103
|
-
}, [header.column, onSortChange]);
|
|
104
|
-
const handleClearAllSorts = useCallback(() => {
|
|
105
|
-
header.column.clearSorting();
|
|
106
|
-
onSortChange?.([]);
|
|
107
|
-
}, [header.column, onSortChange]);
|
|
108
|
-
const handleResetSize = useCallback(() => {
|
|
109
|
-
header.column.resetSize();
|
|
110
|
-
if (onResetSize) {
|
|
111
|
-
onResetSize();
|
|
112
|
-
}
|
|
113
|
-
}, [header.column, onResetSize]);
|
|
114
|
-
const handleInteraction = useCallback((e) => {
|
|
115
|
-
e.preventDefault();
|
|
116
|
-
setIsOpen((prev) => !prev);
|
|
117
|
-
}, []);
|
|
118
|
-
const isSorted = header.column.getIsSorted();
|
|
119
|
-
const isSortable = header.column.getCanSort();
|
|
120
|
-
return /* @__PURE__ */ React2.createElement(Menu.Root, {
|
|
121
|
-
open: isOpen,
|
|
122
|
-
onOpenChange: setIsOpen
|
|
123
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
124
|
-
className: classNames(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContainer),
|
|
125
|
-
onContextMenu: handleInteraction
|
|
126
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
127
|
-
className: classNames(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContentLeft)
|
|
128
|
-
}, isColumnPinned && /* @__PURE__ */ React2.createElement(Pin, {
|
|
129
|
-
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
130
|
-
color: "currentColor"
|
|
131
|
-
}), /* @__PURE__ */ React2.createElement(TableHeaderContent, {
|
|
132
|
-
header
|
|
133
|
-
})), /* @__PURE__ */ React2.createElement("div", {
|
|
134
|
-
className: classNames(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkContentGap, TableHeaderWithPopover_default.osdkHeaderContentRight)
|
|
135
|
-
}, isSorted && /* @__PURE__ */ React2.createElement("div", {
|
|
136
|
-
className: TableHeaderWithPopover_default.osdkCenterContainer
|
|
137
|
-
}, isSorted === "asc" ? /* @__PURE__ */ React2.createElement(SortAlphabetical, {
|
|
138
|
-
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
139
|
-
color: "currentColor"
|
|
140
|
-
}) : /* @__PURE__ */ React2.createElement(SortAlphabeticalDesc, {
|
|
141
|
-
className: TableHeaderWithPopover_default.osdkHeaderIcon,
|
|
142
|
-
color: "currentColor"
|
|
143
|
-
})), /* @__PURE__ */ React2.createElement(Menu.Trigger, {
|
|
144
|
-
"aria-label": `Open header menu for column with id=${header.column.id}`,
|
|
145
|
-
className: classNames(TableHeaderWithPopover_default.osdkCenterContainer, TableHeaderWithPopover_default.osdkHeaderPopoverTrigger)
|
|
146
|
-
}, /* @__PURE__ */ React2.createElement(ChevronDown, {
|
|
147
|
-
className: TableHeaderWithPopover_default.osdkHeaderIcon
|
|
148
|
-
}))), /* @__PURE__ */ React2.createElement(Menu.Portal, {
|
|
149
|
-
container: document.body
|
|
150
|
-
}, /* @__PURE__ */ React2.createElement(Menu.Positioner, {
|
|
151
|
-
sideOffset: 4
|
|
152
|
-
}, /* @__PURE__ */ React2.createElement(Menu.Popup, {
|
|
153
|
-
className: TableHeaderWithPopover_default.osdkHeaderPopup
|
|
154
|
-
}, !isColumnPinned && /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
155
|
-
onClick: handlePinLeft,
|
|
156
|
-
icon: Pin,
|
|
157
|
-
label: "Pin column"
|
|
158
|
-
}), isColumnPinned && /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
159
|
-
onClick: handleUnpin,
|
|
160
|
-
icon: Unpin,
|
|
161
|
-
label: "Unpin Column",
|
|
162
|
-
active: true
|
|
163
|
-
}), isSortable && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
164
|
-
onClick: handleSortAscending,
|
|
165
|
-
icon: SortAlphabetical,
|
|
166
|
-
label: "Sort ascending",
|
|
167
|
-
active: isSorted === "asc"
|
|
168
|
-
}), /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
169
|
-
onClick: handleSortDescending,
|
|
170
|
-
icon: SortAlphabeticalDesc,
|
|
171
|
-
label: "Sort descending",
|
|
172
|
-
active: isSorted === "desc"
|
|
173
|
-
})), !!isSorted && /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
174
|
-
onClick: handleClearAllSorts,
|
|
175
|
-
icon: Remove,
|
|
176
|
-
label: "Clear all sorts"
|
|
177
|
-
}), /* @__PURE__ */ React2.createElement(HeaderMenuItem, {
|
|
178
|
-
onClick: handleResetSize,
|
|
179
|
-
icon: VerticalDistribution,
|
|
180
|
-
label: "Reset Column Size"
|
|
181
|
-
}))))));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// build/browser/object-table/utils/constants.js
|
|
185
|
-
var SELECTION_COLUMN_ID = "__selection__";
|
|
186
|
-
|
|
187
|
-
// build/browser/object-table/utils/getColumnPinningStyles.js
|
|
188
|
-
function getColumnPinningStyles(column) {
|
|
189
|
-
const isPinned = column.getIsPinned();
|
|
190
|
-
return {
|
|
191
|
-
columnStyles: {
|
|
192
|
-
left: isPinned === "left" ? `${column.getStart("left")}px` : void 0,
|
|
193
|
-
right: isPinned === "right" ? `${column.getAfter("right")}px` : void 0,
|
|
194
|
-
width: column.getSize()
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// build/browser/object-table/TableHeader.js
|
|
200
|
-
function TableHeader({
|
|
18
|
+
import styles from "./TableHeader.module.css.js";
|
|
19
|
+
import { TableHeaderContent } from "./TableHeaderContent.js";
|
|
20
|
+
import { TableHeaderWithPopover } from "./TableHeaderWithPopover.js";
|
|
21
|
+
import { SELECTION_COLUMN_ID } from "./utils/constants.js";
|
|
22
|
+
import { getColumnPinningStyles } from "./utils/getColumnPinningStyles.js";
|
|
23
|
+
export function TableHeader({
|
|
201
24
|
table
|
|
202
25
|
}) {
|
|
26
|
+
// TODO: If value is number type, right align header
|
|
27
|
+
|
|
203
28
|
const isResizing = !!table.getState().columnSizingInfo?.isResizingColumn;
|
|
204
|
-
return
|
|
205
|
-
className:
|
|
29
|
+
return /*#__PURE__*/React.createElement("thead", {
|
|
30
|
+
className: styles.osdkTableHeader,
|
|
206
31
|
"data-resizing": isResizing
|
|
207
|
-
}, table.getHeaderGroups().map(
|
|
32
|
+
}, table.getHeaderGroups().map(headerGroup => /*#__PURE__*/React.createElement("tr", {
|
|
208
33
|
key: headerGroup.id,
|
|
209
|
-
className:
|
|
210
|
-
}, headerGroup.headers.map(
|
|
34
|
+
className: styles.osdkTableHeaderRow
|
|
35
|
+
}, headerGroup.headers.map(header => {
|
|
211
36
|
const {
|
|
212
37
|
columnStyles
|
|
213
38
|
} = getColumnPinningStyles(header.column);
|
|
214
39
|
const isColumnPinned = header.column.getIsPinned();
|
|
215
40
|
const isSelectColumn = header.id === SELECTION_COLUMN_ID;
|
|
216
|
-
return
|
|
41
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
217
42
|
key: header.id,
|
|
218
43
|
"data-pinned": header.column.getIsPinned(),
|
|
219
|
-
className:
|
|
44
|
+
className: styles.osdkTableHeaderCell,
|
|
220
45
|
style: columnStyles
|
|
221
|
-
}, header.isPlaceholder ? null : isSelectColumn ?
|
|
222
|
-
header
|
|
223
|
-
}) :
|
|
224
|
-
header,
|
|
225
|
-
isColumnPinned,
|
|
46
|
+
}, header.isPlaceholder ? null : isSelectColumn ? /*#__PURE__*/React.createElement(TableHeaderContent, {
|
|
47
|
+
header: header
|
|
48
|
+
}) : /*#__PURE__*/React.createElement(TableHeaderWithPopover, {
|
|
49
|
+
header: header,
|
|
50
|
+
isColumnPinned: isColumnPinned,
|
|
226
51
|
setColumnPinning: table.setColumnPinning
|
|
227
|
-
}), header.column.getCanResize() &&
|
|
228
|
-
className:
|
|
52
|
+
}), header.column.getCanResize() && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: styles.osdkTableHeaderResizer,
|
|
229
54
|
onDoubleClick: () => header.column.resetSize(),
|
|
230
55
|
onMouseDown: header.getResizeHandler(),
|
|
231
56
|
onTouchStart: header.getResizeHandler()
|
|
232
57
|
}));
|
|
233
58
|
}))));
|
|
234
59
|
}
|
|
235
|
-
|
|
236
|
-
TableHeader
|
|
237
|
-
};
|
|
60
|
+
//# sourceMappingURL=TableHeader.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.osdkTableHeader {
|
|
18
|
+
display: grid;
|
|
19
|
+
position: sticky;
|
|
20
|
+
top: 0;
|
|
21
|
+
z-index: var(--osdk-surface-z-index-1);
|
|
22
|
+
background-color: var(--osdk-table-header-bg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.osdkTableHeader[data-resizing="true"] {
|
|
26
|
+
cursor: col-resize;
|
|
27
|
+
user-select: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.osdkTableHeaderRow {
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.osdkTableHeaderCell {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
text-align: left;
|
|
38
|
+
position: relative;
|
|
39
|
+
padding: var(--osdk-table-cell-padding);
|
|
40
|
+
font-weight: var(--osdk-table-header-fontWeight);
|
|
41
|
+
font-size: var(--osdk-table-header-fontSize);
|
|
42
|
+
color: var(--osdk-table-header-color);
|
|
43
|
+
border-top: var(--osdk-table-border);
|
|
44
|
+
border-right: var(--osdk-table-header-divider);
|
|
45
|
+
background-color: inherit;
|
|
46
|
+
|
|
47
|
+
&:first-child {
|
|
48
|
+
border-left: var(--osdk-table-border);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:last-child {
|
|
52
|
+
border-right: var(--osdk-table-border);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.osdkTableHeaderCell[data-pinned="left"],
|
|
57
|
+
.osdkTableHeaderCell[data-pinned="right"] {
|
|
58
|
+
position: sticky;
|
|
59
|
+
z-index: var(--osdk-surface-z-index-2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Last left-pinned column - no left-pinned siblings after it */
|
|
63
|
+
.osdkTableHeaderCell[data-pinned="left"]:not(:has(~ [data-pinned="left"])) {
|
|
64
|
+
border-right: var(--osdk-table-pinned-column-border);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* First right-pinned column - no right-pinned siblings before it */
|
|
68
|
+
.osdkTableHeaderCell[data-pinned="right"]:not(
|
|
69
|
+
:has(~ [data-pinned="right"]):nth-child(n + 2)
|
|
70
|
+
) {
|
|
71
|
+
border-left: var(--osdk-table-pinned-column-border);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.osdkTableHeaderCell:has([role="checkbox"]) {
|
|
75
|
+
justify-content: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.osdkTableHeaderResizer {
|
|
79
|
+
background: none;
|
|
80
|
+
cursor: col-resize;
|
|
81
|
+
height: 100%;
|
|
82
|
+
position: absolute;
|
|
83
|
+
right: calc(-1 * var(--osdk-table-border-width));
|
|
84
|
+
top: 0;
|
|
85
|
+
touch-action: none;
|
|
86
|
+
width: 3px;
|
|
87
|
+
z-index: var(--osdk-surface-z-index-2);
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
background: var(--osdk-intent-primary-hover);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:active {
|
|
94
|
+
background: var(--osdk-intent-primary-active);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.osdkLoadingHeaderCell {
|
|
99
|
+
height: var(--osdk-table-header-fontSize);
|
|
100
|
+
flex: 1;
|
|
101
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// CSS Module proxy for TableHeader.module.css
|
|
2
|
+
const styles = {
|
|
3
|
+
"osdkTableHeader": "TableHeader-module__osdkTableHeader___4Wzqkog9",
|
|
4
|
+
"osdkTableHeaderRow": "TableHeader-module__osdkTableHeaderRow___lUjQpm91",
|
|
5
|
+
"osdkTableHeaderCell": "TableHeader-module__osdkTableHeaderCell___iS9lGU8Z",
|
|
6
|
+
"osdkTableHeaderResizer": "TableHeader-module__osdkTableHeaderResizer___qpjGLncF",
|
|
7
|
+
"osdkLoadingHeaderCell": "TableHeader-module__osdkLoadingHeaderCell___gohWQuYX"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default styles;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
2
17
|
import { flexRender } from "@tanstack/react-table";
|
|
3
18
|
import React from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var css = '/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.osdkHeaderContent {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.osdkHeaderContent:has([role="checkbox"]) {\n display: flex;\n justify-content: center;\n}\n';
|
|
7
|
-
if (typeof document !== "undefined") {
|
|
8
|
-
const style = document.createElement("style");
|
|
9
|
-
style.textContent = css;
|
|
10
|
-
document.head.appendChild(style);
|
|
11
|
-
}
|
|
12
|
-
var TableHeaderContent_default = { "osdkHeaderContent": "osdkHeaderContent" };
|
|
13
|
-
|
|
14
|
-
// build/browser/object-table/TableHeaderContent.js
|
|
15
|
-
function TableHeaderContent({
|
|
19
|
+
import styles from "./TableHeaderContent.module.css.js";
|
|
20
|
+
export function TableHeaderContent({
|
|
16
21
|
header
|
|
17
22
|
}) {
|
|
18
|
-
return
|
|
19
|
-
className:
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: styles.osdkHeaderContent
|
|
20
25
|
}, flexRender(header.column.columnDef.header, header.getContext()));
|
|
21
26
|
}
|
|
22
|
-
|
|
23
|
-
TableHeaderContent
|
|
24
|
-
};
|
|
27
|
+
//# sourceMappingURL=TableHeaderContent.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.osdkHeaderContent {
|
|
18
|
+
display: -webkit-box;
|
|
19
|
+
-webkit-box-orient: vertical;
|
|
20
|
+
-webkit-line-clamp: 2;
|
|
21
|
+
line-clamp: 2;
|
|
22
|
+
text-align: left;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.osdkHeaderContent:has([role="checkbox"]) {
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
}
|