@dmsi/wedgekit-react 0.0.28 → 0.0.30
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/{chunk-57WRM337.js → chunk-5POWRPIO.js} +3 -2
- package/dist/{chunk-S5KPS4IQ.js → chunk-HXEPUO5W.js} +189 -95
- package/dist/chunk-KHQX42T7.js +127 -0
- package/dist/{chunk-OUSNH76S.js → chunk-PCCJ7L3N.js} +29 -6
- package/dist/{chunk-PDDZ5PMY.js → chunk-S46RZBT4.js} +3 -2
- package/dist/components/CalendarRange.cjs +28 -5
- package/dist/components/CalendarRange.js +1 -1
- package/dist/components/DataGrid.cjs +490 -217
- package/dist/components/DataGrid.js +303 -122
- package/dist/components/DataGridCell.cjs +192 -96
- package/dist/components/DataGridCell.js +4 -2
- package/dist/components/DateInput.cjs +231 -30
- package/dist/components/DateInput.js +101 -27
- package/dist/components/DateRangeInput.cjs +550 -37
- package/dist/components/DateRangeInput.js +413 -34
- package/dist/components/MenuOption.cjs +3 -2
- package/dist/components/MenuOption.js +1 -1
- package/dist/components/MobileDataGrid.cjs +3 -2
- package/dist/components/MobileDataGrid.js +1 -1
- package/dist/components/NestedMenu.cjs +3 -2
- package/dist/components/NestedMenu.js +1 -1
- package/dist/components/Notification.cjs +3 -2
- package/dist/components/Notification.js +1 -1
- package/dist/components/SideMenuGroup.cjs +3 -2
- package/dist/components/SideMenuGroup.js +1 -1
- package/dist/components/SideMenuItem.cjs +3 -2
- package/dist/components/SideMenuItem.js +1 -1
- package/dist/components/Stack.cjs +3 -2
- package/dist/components/Stack.js +1 -1
- package/dist/components/Swatch.cjs +3 -2
- package/dist/components/Swatch.js +1 -1
- package/dist/components/Time.cjs +3 -2
- package/dist/components/Time.js +1 -1
- package/dist/index.css +9 -0
- package/package.json +1 -1
- package/src/components/CalendarRange.tsx +37 -6
- package/src/components/DataGrid.tsx +284 -48
- package/src/components/DataGridCell.tsx +122 -35
- package/src/components/DateInput.tsx +118 -25
- package/src/components/DateRangeInput.tsx +544 -30
- package/src/components/MenuOption.tsx +18 -14
- package/src/components/Stack.tsx +4 -2
- package/src/utils/date.ts +206 -0
|
@@ -1811,7 +1811,8 @@ var MenuOption = ({
|
|
|
1811
1811
|
);
|
|
1812
1812
|
const actionDisabledStyles = variant === "action" && disabled && (0, import_clsx9.default)("text-text-action-disabled");
|
|
1813
1813
|
const disabledStyles = disabled && (0, import_clsx9.default)("bg-transparent cursor-default pointer-events-none");
|
|
1814
|
-
const
|
|
1814
|
+
const processChildren = typeof children === "string" && highlightMatchingText ? highlightMatch(children, menuValue) : children;
|
|
1815
|
+
const renderChildren = typeof children === "object" ? children : variant === "action" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { padded: true, className: textLabelStyles, children: processChildren }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Paragraph, { padded: true, className: textLabelStyles, children: processChildren });
|
|
1815
1816
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1816
1817
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1817
1818
|
"div",
|
|
@@ -1845,7 +1846,7 @@ var MenuOption = ({
|
|
|
1845
1846
|
"aria-haspopup": subMenu ? "menu" : void 0,
|
|
1846
1847
|
children: [
|
|
1847
1848
|
before && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "shrink-0 flex items-center", children: before }),
|
|
1848
|
-
|
|
1849
|
+
renderChildren,
|
|
1849
1850
|
renderAfterProp()
|
|
1850
1851
|
]
|
|
1851
1852
|
})
|
|
@@ -1998,7 +1999,7 @@ var DataGridCell = (0, import_react8.memo)(
|
|
|
1998
1999
|
lockedHeaderBgStyles,
|
|
1999
2000
|
iconComponentStyles,
|
|
2000
2001
|
className,
|
|
2001
|
-
"flex flex-1 items-center gap-1 whitespace-nowrap
|
|
2002
|
+
"flex flex-1 items-center gap-1 whitespace-nowrap h-10 relative text-text-primary-normal",
|
|
2002
2003
|
"focus-within:!z-10",
|
|
2003
2004
|
component === "input" && "border",
|
|
2004
2005
|
component === "input" && !error && !warning && "border-border-primary-normal",
|
|
@@ -2014,7 +2015,7 @@ var DataGridCell = (0, import_react8.memo)(
|
|
|
2014
2015
|
Element,
|
|
2015
2016
|
__spreadProps(__spreadValues({
|
|
2016
2017
|
id,
|
|
2017
|
-
className: (0, import_clsx10.default)("flex", !width && "flex-1"),
|
|
2018
|
+
className: (0, import_clsx10.default)("flex h-10", !width && "flex-1"),
|
|
2018
2019
|
style: { width }
|
|
2019
2020
|
}, props), {
|
|
2020
2021
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -2037,33 +2038,41 @@ var DataGridCell = (0, import_react8.memo)(
|
|
|
2037
2038
|
}
|
|
2038
2039
|
);
|
|
2039
2040
|
DataGridCell.displayName = "DataGridCell";
|
|
2040
|
-
function
|
|
2041
|
+
function DataCellHeader(_a) {
|
|
2041
2042
|
var _b = _a, {
|
|
2042
2043
|
header,
|
|
2043
2044
|
children,
|
|
2044
|
-
|
|
2045
|
+
setNodeRef,
|
|
2046
|
+
node,
|
|
2045
2047
|
id
|
|
2046
2048
|
} = _b, props = __objRest(_b, [
|
|
2047
2049
|
"header",
|
|
2048
2050
|
"children",
|
|
2049
|
-
"
|
|
2051
|
+
"setNodeRef",
|
|
2052
|
+
"node",
|
|
2050
2053
|
"id"
|
|
2051
2054
|
]);
|
|
2052
2055
|
var _a2;
|
|
2053
|
-
const { attributes, isDragging, listeners, setNodeRef, transform, node } = (0, import_sortable.useSortable)({
|
|
2054
|
-
id: header.column.id
|
|
2055
|
-
});
|
|
2056
2056
|
const [showMenu, setShowMenu] = (0, import_react8.useState)(false);
|
|
2057
2057
|
const [filter, setFilter] = (0, import_react8.useState)(
|
|
2058
2058
|
(_a2 = header.column.getFilterValue()) != null ? _a2 : ""
|
|
2059
2059
|
);
|
|
2060
|
+
const ref = (0, import_react8.useRef)(null);
|
|
2061
|
+
const predeterminedPinned = (0, import_react8.useRef)(false);
|
|
2060
2062
|
const {
|
|
2061
2063
|
menuRootRef,
|
|
2062
2064
|
isMenuActive,
|
|
2063
2065
|
registerSubMenu,
|
|
2064
2066
|
listeners: subMenuListeners,
|
|
2065
2067
|
mobileHide
|
|
2066
|
-
} = useSubMenuSystem(node);
|
|
2068
|
+
} = useSubMenuSystem(node ? node : ref);
|
|
2069
|
+
(0, import_react8.useEffect)(() => {
|
|
2070
|
+
var _a3;
|
|
2071
|
+
const columnPinning = (_a3 = header.getContext().table.options.initialState) == null ? void 0 : _a3.columnPinning;
|
|
2072
|
+
const left = (columnPinning == null ? void 0 : columnPinning.left) ? columnPinning.left : [];
|
|
2073
|
+
const right = (columnPinning == null ? void 0 : columnPinning.right) ? columnPinning.right : [];
|
|
2074
|
+
predeterminedPinned.current = [...left, ...right].includes(header.column.id);
|
|
2075
|
+
}, []);
|
|
2067
2076
|
(0, import_react8.useEffect)(() => {
|
|
2068
2077
|
const handler = setTimeout(() => {
|
|
2069
2078
|
header.column.setFilterValue(filter);
|
|
@@ -2072,107 +2081,160 @@ function DraggableCellHeader(_a) {
|
|
|
2072
2081
|
clearTimeout(handler);
|
|
2073
2082
|
};
|
|
2074
2083
|
}, [filter]);
|
|
2075
|
-
const style = {
|
|
2076
|
-
opacity: isDragging ? 0.8 : 1,
|
|
2084
|
+
const style = __spreadValues({
|
|
2077
2085
|
position: "relative",
|
|
2078
|
-
transform: CSS.Translate.toString(transform),
|
|
2079
|
-
transition: "width transform 0.2s ease-in-out",
|
|
2080
2086
|
whiteSpace: "nowrap",
|
|
2081
2087
|
width: header.column.getSize(),
|
|
2082
|
-
zIndex: isDragging ? 1 : 0,
|
|
2083
2088
|
"--color-text-primary-normal": "var(--color-neutral-000)"
|
|
2084
|
-
};
|
|
2089
|
+
}, props.style);
|
|
2085
2090
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2086
2091
|
DataGridCell,
|
|
2087
|
-
__spreadProps(__spreadValues(
|
|
2092
|
+
__spreadProps(__spreadValues({
|
|
2088
2093
|
id,
|
|
2089
|
-
|
|
2094
|
+
ref: setNodeRef ? setNodeRef : ref,
|
|
2090
2095
|
type: "header",
|
|
2091
2096
|
component: "header",
|
|
2092
|
-
|
|
2093
|
-
colSpan: header.colSpan,
|
|
2094
|
-
style
|
|
2095
|
-
}, props), {
|
|
2097
|
+
style,
|
|
2096
2098
|
onClick: header.column.getToggleSortingHandler(),
|
|
2097
2099
|
onRightClick: () => setShowMenu(!showMenu)
|
|
2098
|
-
}
|
|
2100
|
+
}, props), {
|
|
2099
2101
|
children: [
|
|
2100
2102
|
children,
|
|
2101
|
-
header.column.getCanFilter() && /* @__PURE__ */ (0, import_jsx_runtime10.
|
|
2103
|
+
header.column.getCanFilter() && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2102
2104
|
Menu,
|
|
2103
2105
|
{
|
|
2104
2106
|
id: id ? `${id}-menu` : void 0,
|
|
2105
2107
|
ref: menuRootRef,
|
|
2106
|
-
positionTo: node,
|
|
2108
|
+
positionTo: node ? node : ref,
|
|
2107
2109
|
show: showMenu,
|
|
2108
2110
|
setShow: setShowMenu,
|
|
2109
2111
|
mobileHide,
|
|
2110
|
-
children:
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
event.
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2112
|
+
children: [
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2114
|
+
MenuOption,
|
|
2115
|
+
__spreadProps(__spreadValues({
|
|
2116
|
+
id: id ? `${id}-filter-option` : void 0
|
|
2117
|
+
}, subMenuListeners), {
|
|
2118
|
+
subMenu: (_b2) => {
|
|
2119
|
+
var _c = _b2, { menuId, subMenuLevel } = _c, props2 = __objRest(_c, ["menuId", "subMenuLevel"]);
|
|
2120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2121
|
+
Menu,
|
|
2122
|
+
__spreadProps(__spreadValues({
|
|
2123
|
+
id: id ? `${id}-filter-submenu` : void 0
|
|
2124
|
+
}, props2), {
|
|
2125
|
+
show: isMenuActive(menuId, subMenuLevel),
|
|
2126
|
+
ref: (el) => {
|
|
2127
|
+
registerSubMenu(menuId, el);
|
|
2128
|
+
},
|
|
2129
|
+
children: [
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_clsx10.default)(paddingUsingComponentGap), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2131
|
+
Search,
|
|
2132
|
+
{
|
|
2133
|
+
id: id ? `${id}-filter-search` : void 0,
|
|
2134
|
+
onChange: (event) => {
|
|
2135
|
+
setFilter(event.target.value);
|
|
2136
|
+
},
|
|
2137
|
+
onKeyDown: (event) => {
|
|
2138
|
+
if ([" ", "Space"].includes(event.key)) {
|
|
2139
|
+
event.stopPropagation();
|
|
2140
|
+
}
|
|
2141
|
+
},
|
|
2142
|
+
value: filter != null ? filter : ""
|
|
2143
|
+
}
|
|
2144
|
+
) }),
|
|
2145
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2146
|
+
MenuOption,
|
|
2147
|
+
{
|
|
2148
|
+
id: id ? `${id}-filter-contains` : void 0,
|
|
2149
|
+
onClick: handleFilterFnChange,
|
|
2150
|
+
before: menuOptionIcon("includesString"),
|
|
2151
|
+
children: "Contains"
|
|
2152
|
+
}
|
|
2153
|
+
),
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2155
|
+
MenuOption,
|
|
2156
|
+
{
|
|
2157
|
+
id: id ? `${id}-filter-startswith` : void 0,
|
|
2158
|
+
onClick: handleFilterFnChange,
|
|
2159
|
+
before: menuOptionIcon("startsWith"),
|
|
2160
|
+
children: "Starts with"
|
|
2161
|
+
}
|
|
2162
|
+
),
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2164
|
+
MenuOption,
|
|
2165
|
+
{
|
|
2166
|
+
id: id ? `${id}-filter-endswith` : void 0,
|
|
2167
|
+
onClick: handleFilterFnChange,
|
|
2168
|
+
before: menuOptionIcon("endsWith"),
|
|
2169
|
+
children: "Ends with"
|
|
2170
|
+
}
|
|
2171
|
+
)
|
|
2172
|
+
]
|
|
2173
|
+
})
|
|
2174
|
+
);
|
|
2175
|
+
},
|
|
2176
|
+
children: "Filter"
|
|
2177
|
+
})
|
|
2178
|
+
),
|
|
2179
|
+
!predeterminedPinned.current && header.column.getCanPin() && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2180
|
+
MenuOption,
|
|
2181
|
+
__spreadProps(__spreadValues({
|
|
2182
|
+
onClick: () => {
|
|
2183
|
+
setShowMenu(!showMenu);
|
|
2184
|
+
}
|
|
2185
|
+
}, subMenuListeners), {
|
|
2186
|
+
subMenu: (_d) => {
|
|
2187
|
+
var _e = _d, { menuId, subMenuLevel } = _e, props2 = __objRest(_e, ["menuId", "subMenuLevel"]);
|
|
2188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2189
|
+
Menu,
|
|
2190
|
+
__spreadProps(__spreadValues({}, props2), {
|
|
2191
|
+
show: isMenuActive(menuId, subMenuLevel),
|
|
2192
|
+
ref: (el) => {
|
|
2193
|
+
registerSubMenu(menuId, el);
|
|
2194
|
+
},
|
|
2195
|
+
children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2197
|
+
MenuOption,
|
|
2198
|
+
{
|
|
2199
|
+
selected: header.column.getIsPinned() === "left",
|
|
2200
|
+
onClick: () => {
|
|
2201
|
+
if (header.column.getIsPinned() === "left") {
|
|
2202
|
+
header.column.pin(false);
|
|
2203
|
+
} else {
|
|
2204
|
+
header.column.pin("left");
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
after: header.column.getIsPinned() === "left" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "check" }),
|
|
2208
|
+
children: "Left"
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2212
|
+
MenuOption,
|
|
2213
|
+
{
|
|
2214
|
+
selected: header.column.getIsPinned() === "right",
|
|
2215
|
+
onClick: () => {
|
|
2216
|
+
if (header.column.getIsPinned() === "right") {
|
|
2217
|
+
header.column.pin(false);
|
|
2218
|
+
} else {
|
|
2219
|
+
header.column.pin("right");
|
|
2220
|
+
}
|
|
2221
|
+
},
|
|
2222
|
+
after: header.column.getIsPinned() === "right" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "check" }),
|
|
2223
|
+
children: "Right"
|
|
2224
|
+
}
|
|
2225
|
+
)
|
|
2226
|
+
]
|
|
2227
|
+
})
|
|
2228
|
+
);
|
|
2229
|
+
},
|
|
2230
|
+
children: [
|
|
2231
|
+
"Freeze [",
|
|
2232
|
+
header.column.columnDef.header,
|
|
2233
|
+
"]"
|
|
2234
|
+
]
|
|
2235
|
+
})
|
|
2236
|
+
)
|
|
2237
|
+
]
|
|
2176
2238
|
}
|
|
2177
2239
|
)
|
|
2178
2240
|
]
|
|
@@ -2190,7 +2252,6 @@ function DraggableCellHeader(_a) {
|
|
|
2190
2252
|
);
|
|
2191
2253
|
}
|
|
2192
2254
|
function handleFilterFnChange(_id, value) {
|
|
2193
|
-
var _a3;
|
|
2194
2255
|
let filterFn = "includesString";
|
|
2195
2256
|
const currentFilterFn = header.column.columnDef.filterFn;
|
|
2196
2257
|
if ((value == null ? void 0 : value.toLowerCase()) === "starts with") {
|
|
@@ -2203,9 +2264,43 @@ function DraggableCellHeader(_a) {
|
|
|
2203
2264
|
filterFn = currentFilterFn === "includesString" ? "auto" : "includesString";
|
|
2204
2265
|
}
|
|
2205
2266
|
header.column.columnDef.filterFn = filterFn;
|
|
2206
|
-
header.column.setFilterValue(
|
|
2267
|
+
header.column.setFilterValue(filter);
|
|
2207
2268
|
}
|
|
2208
2269
|
}
|
|
2270
|
+
DataCellHeader.displayName = "DataCellHeader";
|
|
2271
|
+
function DraggableCellHeader(_a) {
|
|
2272
|
+
var _b = _a, {
|
|
2273
|
+
header,
|
|
2274
|
+
children
|
|
2275
|
+
} = _b, props = __objRest(_b, [
|
|
2276
|
+
"header",
|
|
2277
|
+
"children"
|
|
2278
|
+
]);
|
|
2279
|
+
const { attributes, isDragging, listeners, setNodeRef, transform, node } = (0, import_sortable.useSortable)({
|
|
2280
|
+
id: header.column.id
|
|
2281
|
+
});
|
|
2282
|
+
const style = {
|
|
2283
|
+
opacity: isDragging ? 0.8 : 1,
|
|
2284
|
+
position: "relative",
|
|
2285
|
+
transform: CSS.Translate.toString(transform),
|
|
2286
|
+
transition: "width transform 0.2s ease-in-out",
|
|
2287
|
+
whiteSpace: "nowrap",
|
|
2288
|
+
zIndex: isDragging ? 1 : 0,
|
|
2289
|
+
width: header.column.getSize(),
|
|
2290
|
+
"--color-text-primary-normal": "var(--color-neutral-000)"
|
|
2291
|
+
};
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2293
|
+
DataCellHeader,
|
|
2294
|
+
__spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
2295
|
+
header,
|
|
2296
|
+
setNodeRef,
|
|
2297
|
+
node,
|
|
2298
|
+
style
|
|
2299
|
+
}, props), attributes), listeners), {
|
|
2300
|
+
children
|
|
2301
|
+
})
|
|
2302
|
+
);
|
|
2303
|
+
}
|
|
2209
2304
|
DraggableCellHeader.displayName = "DraggableCellHeader";
|
|
2210
2305
|
function DragAlongCell(_a) {
|
|
2211
2306
|
var _b = _a, {
|
|
@@ -2223,9 +2318,8 @@ function DragAlongCell(_a) {
|
|
|
2223
2318
|
position: "relative",
|
|
2224
2319
|
transform: CSS.Translate.toString(transform),
|
|
2225
2320
|
transition: "width transform 0.2s ease-in-out",
|
|
2226
|
-
zIndex: isDragging ? 1 : 0,
|
|
2227
2321
|
width: cell.column.getSize(),
|
|
2228
|
-
|
|
2322
|
+
zIndex: isDragging ? 1 : 0
|
|
2229
2323
|
};
|
|
2230
2324
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DataGridCell, __spreadProps(__spreadValues({ style, ref: setNodeRef }, props), { children }));
|
|
2231
2325
|
}
|
|
@@ -2522,10 +2616,7 @@ function useInfiniteScroll({
|
|
|
2522
2616
|
|
|
2523
2617
|
// src/components/DataGrid.tsx
|
|
2524
2618
|
var import_clsx14 = __toESM(require("clsx"), 1);
|
|
2525
|
-
var import_jsx_runtime14 = (
|
|
2526
|
-
// fake empty column to the left for virtualization scroll padding
|
|
2527
|
-
require("react/jsx-runtime")
|
|
2528
|
-
);
|
|
2619
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2529
2620
|
var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
|
|
2530
2621
|
var NO_RESULTS_HEIGHT = "h-[120px]";
|
|
2531
2622
|
function adaptTableStateSetter(setter) {
|
|
@@ -2555,7 +2646,9 @@ function DataGrid({
|
|
|
2555
2646
|
totalRowCount,
|
|
2556
2647
|
hideStatusBar,
|
|
2557
2648
|
centerHeader,
|
|
2558
|
-
enableColumnSelector
|
|
2649
|
+
enableColumnSelector,
|
|
2650
|
+
predeterminedLeftPins = [],
|
|
2651
|
+
predeterminedRightPins = []
|
|
2559
2652
|
}) {
|
|
2560
2653
|
var _a, _b, _c, _d, _e;
|
|
2561
2654
|
const [columnOrder, setColumnOrder] = (0, import_react12.useState)(
|
|
@@ -2629,18 +2722,30 @@ function DataGrid({
|
|
|
2629
2722
|
rowSelection,
|
|
2630
2723
|
columnVisibility
|
|
2631
2724
|
},
|
|
2725
|
+
initialState: {
|
|
2726
|
+
columnPinning: {
|
|
2727
|
+
left: predeterminedLeftPins,
|
|
2728
|
+
right: predeterminedRightPins
|
|
2729
|
+
}
|
|
2730
|
+
},
|
|
2632
2731
|
onColumnOrderChange: setColumnOrder,
|
|
2633
2732
|
onSortingChange: adaptTableStateSetter(setSortingState),
|
|
2634
2733
|
onColumnFiltersChange: adaptTableStateSetter(setColumnFilterState),
|
|
2635
2734
|
onRowSelectionChange: adaptTableStateSetter(setRowSelection),
|
|
2636
2735
|
filterFns: {
|
|
2637
2736
|
startsWith: (row, columnId, filterValue) => {
|
|
2638
|
-
|
|
2639
|
-
|
|
2737
|
+
const cellValue = row == null ? void 0 : row.getValue(columnId);
|
|
2738
|
+
if (!cellValue || !filterValue) {
|
|
2739
|
+
return true;
|
|
2740
|
+
}
|
|
2741
|
+
return String(cellValue).toLowerCase().startsWith(String(filterValue).toLowerCase());
|
|
2640
2742
|
},
|
|
2641
2743
|
endsWith: (row, columnId, filterValue) => {
|
|
2642
|
-
|
|
2643
|
-
|
|
2744
|
+
const cellValue = row == null ? void 0 : row.getValue(columnId);
|
|
2745
|
+
if (!cellValue || !filterValue) {
|
|
2746
|
+
return true;
|
|
2747
|
+
}
|
|
2748
|
+
return String(cellValue).toLowerCase().endsWith(String(filterValue).toLowerCase());
|
|
2644
2749
|
}
|
|
2645
2750
|
}
|
|
2646
2751
|
});
|
|
@@ -2709,6 +2814,7 @@ function DataGrid({
|
|
|
2709
2814
|
virtualPaddingLeft = (_c = (_b = virtualColumns[0]) == null ? void 0 : _b.start) != null ? _c : 0;
|
|
2710
2815
|
virtualPaddingRight = columnVirtualizer.getTotalSize() - ((_e = (_d = virtualColumns[virtualColumns.length - 1]) == null ? void 0 : _d.end) != null ? _e : 0);
|
|
2711
2816
|
}
|
|
2817
|
+
const empty = table.getRowModel().rows.length === 0;
|
|
2712
2818
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2713
2819
|
import_core.DndContext,
|
|
2714
2820
|
{
|
|
@@ -2728,117 +2834,154 @@ function DataGrid({
|
|
|
2728
2834
|
id,
|
|
2729
2835
|
className: "flex flex-col flex-1 h-full w-full rounded border border-border-primary-normal overflow-hidden text-text-primary-normal",
|
|
2730
2836
|
children: [
|
|
2731
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2732
2838
|
"div",
|
|
2733
2839
|
{
|
|
2734
|
-
className:
|
|
2840
|
+
className: (0, import_clsx14.default)(
|
|
2841
|
+
"flex overflow-auto scrollbar-thin relative contain-paint will-change-transform",
|
|
2842
|
+
empty ? "overflow-y-hidden" : "h-full"
|
|
2843
|
+
),
|
|
2735
2844
|
ref: containerRef,
|
|
2736
|
-
children:
|
|
2737
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2845
|
+
children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2847
|
+
PinnedColumns,
|
|
2848
|
+
{
|
|
2849
|
+
pinDirection: "left",
|
|
2850
|
+
table,
|
|
2851
|
+
tableContainerRef: containerRef,
|
|
2852
|
+
pagination,
|
|
2853
|
+
isLoadingMore,
|
|
2854
|
+
hasMore,
|
|
2855
|
+
showFilterRow,
|
|
2856
|
+
enableColumnSelector
|
|
2857
|
+
}
|
|
2858
|
+
),
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "flex-1 grid min-h-min", children: [
|
|
2860
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: "sticky top-0 z-10 grid", children: table.getCenterHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { className: "flex w-full", children: [
|
|
2861
|
+
virtualPaddingLeft ? (
|
|
2862
|
+
// fake empty column to the left for virtualization scroll padding
|
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2864
|
+
"th",
|
|
2751
2865
|
{
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
true
|
|
2767
|
-
),
|
|
2768
|
-
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
2769
|
-
!((_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.locked) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2770
|
-
"div",
|
|
2771
|
-
{
|
|
2772
|
-
onDoubleClick: (e) => {
|
|
2773
|
-
e.stopPropagation();
|
|
2774
|
-
header.column.resetSize();
|
|
2775
|
-
},
|
|
2776
|
-
onMouseDown: (e) => {
|
|
2777
|
-
e.stopPropagation();
|
|
2778
|
-
header.getResizeHandler()(e);
|
|
2779
|
-
},
|
|
2780
|
-
onTouchStart: (e) => {
|
|
2781
|
-
e.stopPropagation();
|
|
2782
|
-
header.getResizeHandler()(e);
|
|
2783
|
-
},
|
|
2784
|
-
className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
|
|
2785
|
-
}
|
|
2786
|
-
)
|
|
2787
|
-
]
|
|
2788
|
-
},
|
|
2789
|
-
header.id
|
|
2790
|
-
);
|
|
2791
|
-
}
|
|
2792
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react12.default.Fragment, { children: ((_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2793
|
-
DataGridCell,
|
|
2794
|
-
{
|
|
2795
|
-
id: id ? `${id}-header-${header.id}` : void 0,
|
|
2796
|
-
type: "header",
|
|
2797
|
-
component: "checkbox",
|
|
2798
|
-
locked: (_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.locked,
|
|
2799
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2800
|
-
Checkbox,
|
|
2866
|
+
style: { display: "flex", width: virtualPaddingLeft }
|
|
2867
|
+
}
|
|
2868
|
+
)
|
|
2869
|
+
) : null,
|
|
2870
|
+
virtualColumns.map((virtualColumn) => {
|
|
2871
|
+
var _a2, _b2, _c2, _d2;
|
|
2872
|
+
const header = headerGroup.headers[virtualColumn.index];
|
|
2873
|
+
if (!header) {
|
|
2874
|
+
return;
|
|
2875
|
+
}
|
|
2876
|
+
if (typeof header.column.columnDef.header === "string") {
|
|
2877
|
+
const customHeaderWidth = (_a2 = header.column.columnDef.meta) == null ? void 0 : _a2.headerWidth;
|
|
2878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2879
|
+
DraggableCellHeader,
|
|
2801
2880
|
{
|
|
2802
|
-
id: id ? `${id}-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2881
|
+
id: id ? `${id}-header-${header.id}` : void 0,
|
|
2882
|
+
header,
|
|
2883
|
+
locked: (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked,
|
|
2884
|
+
center: centerHeader,
|
|
2885
|
+
width: customHeaderWidth,
|
|
2886
|
+
className: (0, import_clsx14.default)(
|
|
2887
|
+
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
2888
|
+
"group"
|
|
2889
|
+
),
|
|
2890
|
+
children: [
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
2892
|
+
getSortIcon(header.column.getIsSorted()),
|
|
2893
|
+
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
2894
|
+
header.column.getNextSortingOrder(),
|
|
2895
|
+
true
|
|
2896
|
+
),
|
|
2897
|
+
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2899
|
+
"div",
|
|
2900
|
+
{
|
|
2901
|
+
onDoubleClick: (e) => {
|
|
2902
|
+
e.stopPropagation();
|
|
2903
|
+
header.column.resetSize();
|
|
2904
|
+
},
|
|
2905
|
+
onMouseDown: (e) => {
|
|
2906
|
+
e.stopPropagation();
|
|
2907
|
+
header.getResizeHandler()(e);
|
|
2908
|
+
},
|
|
2909
|
+
onTouchStart: (e) => {
|
|
2910
|
+
e.stopPropagation();
|
|
2911
|
+
header.getResizeHandler()(e);
|
|
2912
|
+
},
|
|
2913
|
+
className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
|
|
2914
|
+
}
|
|
2915
|
+
)
|
|
2916
|
+
]
|
|
2917
|
+
},
|
|
2918
|
+
header.id
|
|
2919
|
+
);
|
|
2808
2920
|
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react12.default.Fragment, { children: ((_c2 = header.column.columnDef.meta) == null ? void 0 : _c2.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2922
|
+
DataGridCell,
|
|
2923
|
+
{
|
|
2924
|
+
id: id ? `${id}-header-${header.id}` : void 0,
|
|
2925
|
+
type: "header",
|
|
2926
|
+
component: "checkbox",
|
|
2927
|
+
locked: (_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.locked,
|
|
2928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2929
|
+
Checkbox,
|
|
2930
|
+
{
|
|
2931
|
+
id: id ? `${id}-select-all-checkbox` : void 0,
|
|
2932
|
+
checked: allSelectedAcrossPages,
|
|
2933
|
+
indeterminate: someSelectedAcrossPages,
|
|
2934
|
+
onChange: toggleSelectAllAcrossPages
|
|
2935
|
+
}
|
|
2936
|
+
)
|
|
2937
|
+
}
|
|
2938
|
+
) : (0, import_react_table.flexRender)(
|
|
2939
|
+
header.column.columnDef.header,
|
|
2940
|
+
header.getContext()
|
|
2941
|
+
) }, header.id);
|
|
2942
|
+
}),
|
|
2943
|
+
virtualPaddingRight ? (
|
|
2944
|
+
//fake empty column to the right for virtualization scroll padding
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2946
|
+
"th",
|
|
2947
|
+
{
|
|
2948
|
+
style: { display: "flex", width: virtualPaddingRight }
|
|
2949
|
+
}
|
|
2950
|
+
)
|
|
2951
|
+
) : null,
|
|
2952
|
+
enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2953
|
+
ColumnSelectorHeaderCell,
|
|
2818
2954
|
{
|
|
2819
|
-
|
|
2955
|
+
id: id ? `${id}-column-selector` : void 0,
|
|
2956
|
+
table,
|
|
2957
|
+
toggleColumnVisibility,
|
|
2958
|
+
resetColumnVisibility
|
|
2820
2959
|
}
|
|
2821
2960
|
)
|
|
2822
|
-
)
|
|
2823
|
-
|
|
2824
|
-
|
|
2961
|
+
] }, headerGroup.id)) }),
|
|
2962
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2963
|
+
TableBody,
|
|
2825
2964
|
{
|
|
2826
|
-
id
|
|
2965
|
+
id,
|
|
2966
|
+
columnVirtualizer,
|
|
2827
2967
|
table,
|
|
2828
|
-
|
|
2829
|
-
|
|
2968
|
+
tableContainerRef: containerRef,
|
|
2969
|
+
virtualPaddingLeft,
|
|
2970
|
+
virtualPaddingRight,
|
|
2971
|
+
pagination,
|
|
2972
|
+
isLoadingMore,
|
|
2973
|
+
hasMore,
|
|
2974
|
+
showFilterRow,
|
|
2975
|
+
enableColumnSelector
|
|
2830
2976
|
}
|
|
2831
2977
|
)
|
|
2832
|
-
] }
|
|
2978
|
+
] }),
|
|
2833
2979
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2834
|
-
|
|
2980
|
+
PinnedColumns,
|
|
2835
2981
|
{
|
|
2836
|
-
|
|
2837
|
-
columnVirtualizer,
|
|
2982
|
+
pinDirection: "right",
|
|
2838
2983
|
table,
|
|
2839
2984
|
tableContainerRef: containerRef,
|
|
2840
|
-
virtualPaddingLeft,
|
|
2841
|
-
virtualPaddingRight,
|
|
2842
2985
|
pagination,
|
|
2843
2986
|
isLoadingMore,
|
|
2844
2987
|
hasMore,
|
|
@@ -2846,10 +2989,10 @@ function DataGrid({
|
|
|
2846
2989
|
enableColumnSelector
|
|
2847
2990
|
}
|
|
2848
2991
|
)
|
|
2849
|
-
]
|
|
2992
|
+
]
|
|
2850
2993
|
}
|
|
2851
2994
|
),
|
|
2852
|
-
|
|
2995
|
+
empty && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2853
2996
|
"div",
|
|
2854
2997
|
{
|
|
2855
2998
|
className: (0, import_clsx14.default)(
|
|
@@ -2959,7 +3102,9 @@ function TableBody({
|
|
|
2959
3102
|
isLoadingMore,
|
|
2960
3103
|
hasMore,
|
|
2961
3104
|
showFilterRow,
|
|
2962
|
-
enableColumnSelector = false
|
|
3105
|
+
enableColumnSelector = false,
|
|
3106
|
+
locked,
|
|
3107
|
+
pinDirection
|
|
2963
3108
|
}) {
|
|
2964
3109
|
const { rows } = table.getRowModel();
|
|
2965
3110
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
@@ -2969,9 +3114,19 @@ function TableBody({
|
|
|
2969
3114
|
overscan: 8
|
|
2970
3115
|
});
|
|
2971
3116
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
3117
|
+
const CellElement = locked ? DataGridCell : DragAlongCell;
|
|
3118
|
+
let headerGroups;
|
|
3119
|
+
if (pinDirection === "left") {
|
|
3120
|
+
headerGroups = table.getLeftHeaderGroups();
|
|
3121
|
+
} else if (pinDirection === "right") {
|
|
3122
|
+
headerGroups = table.getRightHeaderGroups();
|
|
3123
|
+
} else {
|
|
3124
|
+
headerGroups = table.getCenterHeaderGroups();
|
|
3125
|
+
}
|
|
2972
3126
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2973
3127
|
"tbody",
|
|
2974
3128
|
{
|
|
3129
|
+
className: (0, import_clsx14.default)(locked ? "shadow-16" : ""),
|
|
2975
3130
|
style: {
|
|
2976
3131
|
display: "grid",
|
|
2977
3132
|
height: `${showFilterRow ? rowVirtualizer.getTotalSize() + 40 : rowVirtualizer.getTotalSize()}px`,
|
|
@@ -2992,16 +3147,16 @@ function TableBody({
|
|
|
2992
3147
|
zIndex: 10
|
|
2993
3148
|
},
|
|
2994
3149
|
className: "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal",
|
|
2995
|
-
children:
|
|
3150
|
+
children: headerGroups.flatMap(
|
|
2996
3151
|
(x) => x.headers.map((header) => {
|
|
2997
3152
|
var _a, _b, _c, _d, _e;
|
|
2998
3153
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2999
|
-
|
|
3154
|
+
CellElement,
|
|
3000
3155
|
{
|
|
3001
3156
|
id: id ? `${id}-filter-cell-${header.id}` : void 0,
|
|
3002
3157
|
noPadding: true,
|
|
3003
3158
|
cell: header,
|
|
3004
|
-
width: (_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth,
|
|
3159
|
+
width: ((_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth) || (locked ? `${header.column.getSize()}px` : ""),
|
|
3005
3160
|
children: header.column.getCanFilter() && ((_e = (_c = (_b = header.column.columnDef.meta) == null ? void 0 : _b.filterRowCell) == null ? void 0 : _c.call(_b, {
|
|
3006
3161
|
header,
|
|
3007
3162
|
table
|
|
@@ -3036,7 +3191,9 @@ function TableBody({
|
|
|
3036
3191
|
virtualPaddingRight,
|
|
3037
3192
|
virtualRow,
|
|
3038
3193
|
showFilterRow,
|
|
3039
|
-
enableColumnSelector
|
|
3194
|
+
enableColumnSelector,
|
|
3195
|
+
locked,
|
|
3196
|
+
pinDirection
|
|
3040
3197
|
},
|
|
3041
3198
|
row.id
|
|
3042
3199
|
);
|
|
@@ -3067,11 +3224,21 @@ function TableBodyRow({
|
|
|
3067
3224
|
virtualPaddingRight,
|
|
3068
3225
|
virtualRow,
|
|
3069
3226
|
showFilterRow,
|
|
3070
|
-
enableColumnSelector = false
|
|
3227
|
+
enableColumnSelector = false,
|
|
3228
|
+
locked,
|
|
3229
|
+
pinDirection
|
|
3071
3230
|
}) {
|
|
3072
|
-
|
|
3073
|
-
|
|
3231
|
+
var _a;
|
|
3232
|
+
let visibleCells;
|
|
3233
|
+
if (locked) {
|
|
3234
|
+
visibleCells = pinDirection === "left" ? row.getLeftVisibleCells() : row.getRightVisibleCells();
|
|
3235
|
+
} else {
|
|
3236
|
+
visibleCells = row.getCenterVisibleCells();
|
|
3237
|
+
}
|
|
3238
|
+
const virtualColumns = (_a = columnVirtualizer == null ? void 0 : columnVirtualizer.getVirtualItems()) != null ? _a : [];
|
|
3239
|
+
const columns = locked ? visibleCells : virtualColumns;
|
|
3074
3240
|
const isError = typeof row.original === "object" && row.original !== null && "rowState" in row.original && row.original.rowState === "error";
|
|
3241
|
+
const CellElement = locked ? DataGridCell : DragAlongCell;
|
|
3075
3242
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3076
3243
|
"tr",
|
|
3077
3244
|
{
|
|
@@ -3088,15 +3255,18 @@ function TableBodyRow({
|
|
|
3088
3255
|
width: "100%"
|
|
3089
3256
|
},
|
|
3090
3257
|
children: [
|
|
3091
|
-
virtualPaddingLeft ? (
|
|
3258
|
+
!locked && virtualPaddingLeft ? (
|
|
3092
3259
|
// fake empty column to the left for virtualization scroll padding
|
|
3093
3260
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { style: { display: "flex", width: virtualPaddingLeft } })
|
|
3094
3261
|
) : null,
|
|
3095
|
-
|
|
3096
|
-
var
|
|
3097
|
-
const cell = visibleCells[
|
|
3098
|
-
|
|
3099
|
-
|
|
3262
|
+
columns.map((column) => {
|
|
3263
|
+
var _a2;
|
|
3264
|
+
const cell = locked ? column : visibleCells[column.index];
|
|
3265
|
+
if (!cell) {
|
|
3266
|
+
return;
|
|
3267
|
+
}
|
|
3268
|
+
return ((_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.useCustomRenderer) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react12.default.Fragment, { children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3269
|
+
CellElement,
|
|
3100
3270
|
{
|
|
3101
3271
|
id: id ? `${id}-cell-${cell.id}` : void 0,
|
|
3102
3272
|
cell,
|
|
@@ -3114,16 +3284,119 @@ function TableBodyRow({
|
|
|
3114
3284
|
cell.id
|
|
3115
3285
|
);
|
|
3116
3286
|
}),
|
|
3117
|
-
virtualPaddingRight ? (
|
|
3287
|
+
!locked && virtualPaddingRight ? (
|
|
3118
3288
|
// fake empty column to the right for virtualization scroll padding
|
|
3119
3289
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { style: { display: "flex", width: virtualPaddingRight } })
|
|
3120
3290
|
) : null,
|
|
3121
|
-
enableColumnSelector && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", {})
|
|
3291
|
+
enableColumnSelector && !locked && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "p-2", style: { width: "48.8px" } })
|
|
3122
3292
|
]
|
|
3123
3293
|
},
|
|
3124
3294
|
row.id
|
|
3125
3295
|
);
|
|
3126
3296
|
}
|
|
3297
|
+
function PinnedColumns(_a) {
|
|
3298
|
+
var _b = _a, {
|
|
3299
|
+
pinDirection = "left",
|
|
3300
|
+
table,
|
|
3301
|
+
centerHeader,
|
|
3302
|
+
allSelectedAcrossPages,
|
|
3303
|
+
someSelectedAcrossPages,
|
|
3304
|
+
toggleSelectAllAcrossPages
|
|
3305
|
+
} = _b, props = __objRest(_b, [
|
|
3306
|
+
"pinDirection",
|
|
3307
|
+
"table",
|
|
3308
|
+
"centerHeader",
|
|
3309
|
+
"allSelectedAcrossPages",
|
|
3310
|
+
"someSelectedAcrossPages",
|
|
3311
|
+
"toggleSelectAllAcrossPages"
|
|
3312
|
+
]);
|
|
3313
|
+
var _a2;
|
|
3314
|
+
const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
|
|
3315
|
+
return ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: (0, import_clsx14.default)(
|
|
3316
|
+
"grid min-h-min sticky z-20 bg-background-grouped-primary-normal",
|
|
3317
|
+
pinDirection === "left" ? "left-0" : "right-0"
|
|
3318
|
+
), children: [
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
|
|
3320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: "flex w-full", children: headerGroup.headers.map((header) => {
|
|
3321
|
+
var _a3, _b2, _c;
|
|
3322
|
+
if (!header) {
|
|
3323
|
+
return;
|
|
3324
|
+
}
|
|
3325
|
+
if (typeof header.column.columnDef.header === "string") {
|
|
3326
|
+
const customHeaderWidth = (_a3 = header.column.columnDef.meta) == null ? void 0 : _a3.headerWidth;
|
|
3327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3328
|
+
DataCellHeader,
|
|
3329
|
+
{
|
|
3330
|
+
locked: true,
|
|
3331
|
+
header,
|
|
3332
|
+
center: centerHeader,
|
|
3333
|
+
width: customHeaderWidth,
|
|
3334
|
+
className: (0, import_clsx14.default)(
|
|
3335
|
+
header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
|
|
3336
|
+
"group"
|
|
3337
|
+
),
|
|
3338
|
+
children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Subheader, { tall: true, children: header.column.columnDef.header }),
|
|
3340
|
+
getSortIcon(header.column.getIsSorted()),
|
|
3341
|
+
!header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
|
|
3342
|
+
header.column.getNextSortingOrder(),
|
|
3343
|
+
true
|
|
3344
|
+
),
|
|
3345
|
+
header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
|
|
3346
|
+
!((_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.locked) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3347
|
+
"div",
|
|
3348
|
+
{
|
|
3349
|
+
onDoubleClick: (e) => {
|
|
3350
|
+
e.stopPropagation();
|
|
3351
|
+
header.column.resetSize();
|
|
3352
|
+
},
|
|
3353
|
+
onMouseDown: (e) => {
|
|
3354
|
+
e.stopPropagation();
|
|
3355
|
+
header.getResizeHandler()(e);
|
|
3356
|
+
},
|
|
3357
|
+
onTouchStart: (e) => {
|
|
3358
|
+
e.stopPropagation();
|
|
3359
|
+
header.getResizeHandler()(e);
|
|
3360
|
+
},
|
|
3361
|
+
className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
|
|
3362
|
+
}
|
|
3363
|
+
)
|
|
3364
|
+
]
|
|
3365
|
+
},
|
|
3366
|
+
header.id
|
|
3367
|
+
);
|
|
3368
|
+
}
|
|
3369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react12.default.Fragment, { children: ((_c = header.column.columnDef.meta) == null ? void 0 : _c.checkbox) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3370
|
+
DataGridCell,
|
|
3371
|
+
{
|
|
3372
|
+
type: "header",
|
|
3373
|
+
component: "checkbox",
|
|
3374
|
+
locked: true,
|
|
3375
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3376
|
+
Checkbox,
|
|
3377
|
+
{
|
|
3378
|
+
checked: allSelectedAcrossPages,
|
|
3379
|
+
indeterminate: someSelectedAcrossPages,
|
|
3380
|
+
onChange: toggleSelectAllAcrossPages
|
|
3381
|
+
}
|
|
3382
|
+
)
|
|
3383
|
+
}
|
|
3384
|
+
) : (0, import_react_table.flexRender)(
|
|
3385
|
+
header.column.columnDef.header,
|
|
3386
|
+
header.getContext()
|
|
3387
|
+
) }, header.id);
|
|
3388
|
+
}) }, headerGroup.id);
|
|
3389
|
+
}) }),
|
|
3390
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3391
|
+
TableBody,
|
|
3392
|
+
__spreadProps(__spreadValues({}, props), {
|
|
3393
|
+
table,
|
|
3394
|
+
locked: true,
|
|
3395
|
+
pinDirection
|
|
3396
|
+
})
|
|
3397
|
+
)
|
|
3398
|
+
] });
|
|
3399
|
+
}
|
|
3127
3400
|
var LoadingCell = ({
|
|
3128
3401
|
id,
|
|
3129
3402
|
column
|