@trackunit/react-table 0.0.207 → 0.0.209
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/index.cjs.js +8 -6
- package/index.esm.js +8 -6
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -345,8 +345,8 @@ const Table = (_a) => {
|
|
|
345
345
|
rowHeight,
|
|
346
346
|
});
|
|
347
347
|
const hasResults = props.getRowModel().rows.length > 0;
|
|
348
|
-
return (jsxRuntime.jsxs(reactComponents.Card, { className: `flex flex-col overflow-hidden ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex", children: props.headerRightActions })] })), jsxRuntime.jsx("div", { className: "
|
|
349
|
-
height:
|
|
348
|
+
return (jsxRuntime.jsxs(reactComponents.Card, { className: `flex flex-col overflow-hidden ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex", children: props.headerRightActions })] })), jsxRuntime.jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-gray-300", ref: tableContainerRef, onScroll: e => fetchMoreOnBottomReached(e.target), children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
|
|
349
|
+
height: hasResults ? "auto" : "100%",
|
|
350
350
|
width: "100%",
|
|
351
351
|
position: "relative",
|
|
352
352
|
}, children: [jsxRuntime.jsx(reactTableBaseComponents.Thead, { className: "z-default", children: props.getHeaderGroups().map(headerGroup => (jsxRuntime.jsx(reactTableBaseComponents.Tr, { className: "flex", children: headerGroup.headers.map(header => {
|
|
@@ -355,10 +355,12 @@ const Table = (_a) => {
|
|
|
355
355
|
width: header.getSize(),
|
|
356
356
|
minWidth: header.column.columnDef.minSize,
|
|
357
357
|
maxWidth: header.column.columnDef.maxSize,
|
|
358
|
-
textAlign: ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left"
|
|
358
|
+
textAlign: ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left",
|
|
359
359
|
}, className: "relative", children: [header.isPlaceholder ? null : (jsxRuntime.jsxs("div", { className: `${header.column.getCanSort() ? "cursor-pointer select-none flex" : ""} items-center gap-2 py-2 overflow-hidden pr-3`,
|
|
360
360
|
onClick: header.column.getToggleSortingHandler(), children: [jsxRuntime.jsxs("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: [reactTable.flexRender(header.column.columnDef.header, header.getContext()), ((_c = (_b = header.column.columnDef) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c.subHeader) ? (jsxRuntime.jsx(reactComponents.Text, { size: "small", subtle: true, children: (_e = (_d = header.column.columnDef) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.subHeader })) : null] }), header.column.getCanSort() ? (jsxRuntime.jsx(reactTableBaseComponents.SortIndicator, { sortingState: header.column.getIsSorted() })) : null] })), header.column.getCanResize() ? (jsxRuntime.jsx(reactTableBaseComponents.ResizeHandle, { isResizing: header.column.getIsResizing(), onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler() })) : null] }, header.id));
|
|
361
|
-
}) }, headerGroup.id))) }), hasResults ? (jsxRuntime.jsx(reactTableBaseComponents.Tbody, { className: "text-sm font-normal",
|
|
361
|
+
}) }, headerGroup.id))) }), hasResults ? (jsxRuntime.jsx(reactTableBaseComponents.Tbody, { className: "text-sm font-normal", style: {
|
|
362
|
+
height: `${getTotalSize()}px`,
|
|
363
|
+
}, children: getVirtualItems().map((virtualRow, index) => {
|
|
362
364
|
const row = props.getRowModel().rows[virtualRow.index];
|
|
363
365
|
if (!row) {
|
|
364
366
|
return null;
|
|
@@ -381,11 +383,11 @@ const Table = (_a) => {
|
|
|
381
383
|
width: cell.column.getSize(),
|
|
382
384
|
minWidth: cell.column.columnDef.minSize,
|
|
383
385
|
maxWidth: cell.column.columnDef.maxSize,
|
|
384
|
-
textAlign: ((_a = cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left"
|
|
386
|
+
textAlign: ((_a = cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left",
|
|
385
387
|
}, children: jsxRuntime.jsx("div", { className: "grid h-full items-center", children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }) }));
|
|
386
388
|
}) }, row.id));
|
|
387
389
|
}
|
|
388
|
-
}) })) : (jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: (props === null || props === void 0 ? void 0 : props.loading) ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : (props === null || props === void 0 ? void 0 : props.noDataMessage) ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { image: "SEARCH_DOCUMENT", description: t("table.noResults"), className: "absolute inset-0" })) }) }) }))] }) }), props.hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex items-center p-2", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
|
|
390
|
+
}) })) : (jsxRuntime.jsx("tbody", { className: "min-h-[400px]", children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: (props === null || props === void 0 ? void 0 : props.loading) ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : (props === null || props === void 0 ? void 0 : props.noDataMessage) ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { image: "SEARCH_DOCUMENT", description: t("table.noResults"), className: "absolute inset-0" })) }) }) }))] }) }), props.hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex items-center p-2", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
|
|
389
391
|
count: props.getRowModel().rows.length,
|
|
390
392
|
total: ((_c = (_b = props.pagination) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.count) || 0,
|
|
391
393
|
}) }), props.pagination.isLoading ? (jsxRuntime.jsx("span", { className: "ml-2", children: jsxRuntime.jsx(reactComponents.Spinner, { size: "small" }) })) : null, props.footerRightActions && jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: props.footerRightActions })] }))] }));
|
package/index.esm.js
CHANGED
|
@@ -320,8 +320,8 @@ const Table = (_a) => {
|
|
|
320
320
|
rowHeight,
|
|
321
321
|
});
|
|
322
322
|
const hasResults = props.getRowModel().rows.length > 0;
|
|
323
|
-
return (jsxs(Card, { className: `flex flex-col overflow-hidden ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex", children: props.headerLeftActions }), jsx("div", { className: "flex", children: props.headerRightActions })] })), jsx("div", { className: "
|
|
324
|
-
height:
|
|
323
|
+
return (jsxs(Card, { className: `flex flex-col overflow-hidden ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex", children: props.headerLeftActions }), jsx("div", { className: "flex", children: props.headerRightActions })] })), jsx("div", { className: "h-full overflow-x-auto overflow-y-scroll border-b border-t border-gray-300", ref: tableContainerRef, onScroll: e => fetchMoreOnBottomReached(e.target), children: jsxs(TableRoot, { style: {
|
|
324
|
+
height: hasResults ? "auto" : "100%",
|
|
325
325
|
width: "100%",
|
|
326
326
|
position: "relative",
|
|
327
327
|
}, children: [jsx(Thead, { className: "z-default", children: props.getHeaderGroups().map(headerGroup => (jsx(Tr, { className: "flex", children: headerGroup.headers.map(header => {
|
|
@@ -330,10 +330,12 @@ const Table = (_a) => {
|
|
|
330
330
|
width: header.getSize(),
|
|
331
331
|
minWidth: header.column.columnDef.minSize,
|
|
332
332
|
maxWidth: header.column.columnDef.maxSize,
|
|
333
|
-
textAlign: ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left"
|
|
333
|
+
textAlign: ((_a = header.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left",
|
|
334
334
|
}, className: "relative", children: [header.isPlaceholder ? null : (jsxs("div", { className: `${header.column.getCanSort() ? "cursor-pointer select-none flex" : ""} items-center gap-2 py-2 overflow-hidden pr-3`,
|
|
335
335
|
onClick: header.column.getToggleSortingHandler(), children: [jsxs("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: [flexRender(header.column.columnDef.header, header.getContext()), ((_c = (_b = header.column.columnDef) === null || _b === void 0 ? void 0 : _b.meta) === null || _c === void 0 ? void 0 : _c.subHeader) ? (jsx(Text, { size: "small", subtle: true, children: (_e = (_d = header.column.columnDef) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.subHeader })) : null] }), header.column.getCanSort() ? (jsx(SortIndicator, { sortingState: header.column.getIsSorted() })) : null] })), header.column.getCanResize() ? (jsx(ResizeHandle, { isResizing: header.column.getIsResizing(), onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler() })) : null] }, header.id));
|
|
336
|
-
}) }, headerGroup.id))) }), hasResults ? (jsx(Tbody, { className: "text-sm font-normal",
|
|
336
|
+
}) }, headerGroup.id))) }), hasResults ? (jsx(Tbody, { className: "text-sm font-normal", style: {
|
|
337
|
+
height: `${getTotalSize()}px`,
|
|
338
|
+
}, children: getVirtualItems().map((virtualRow, index) => {
|
|
337
339
|
const row = props.getRowModel().rows[virtualRow.index];
|
|
338
340
|
if (!row) {
|
|
339
341
|
return null;
|
|
@@ -356,11 +358,11 @@ const Table = (_a) => {
|
|
|
356
358
|
width: cell.column.getSize(),
|
|
357
359
|
minWidth: cell.column.columnDef.minSize,
|
|
358
360
|
maxWidth: cell.column.columnDef.maxSize,
|
|
359
|
-
textAlign: ((_a = cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left"
|
|
361
|
+
textAlign: ((_a = cell.column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.alignment) || "left",
|
|
360
362
|
}, children: jsx("div", { className: "grid h-full items-center", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }) }));
|
|
361
363
|
}) }, row.id));
|
|
362
364
|
}
|
|
363
|
-
}) })) : (jsx("tbody", { children: jsx("tr", { children: jsx("td", { className: "b-0", children: (props === null || props === void 0 ? void 0 : props.loading) ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : (props === null || props === void 0 ? void 0 : props.noDataMessage) ? (props.noDataMessage) : (jsx(EmptyState, { image: "SEARCH_DOCUMENT", description: t("table.noResults"), className: "absolute inset-0" })) }) }) }))] }) }), props.hideFooter ? null : (jsxs("div", { className: "flex items-center p-2", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
|
|
365
|
+
}) })) : (jsx("tbody", { className: "min-h-[400px]", children: jsx("tr", { children: jsx("td", { className: "b-0", children: (props === null || props === void 0 ? void 0 : props.loading) ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0" })) : (props === null || props === void 0 ? void 0 : props.noDataMessage) ? (props.noDataMessage) : (jsx(EmptyState, { image: "SEARCH_DOCUMENT", description: t("table.noResults"), className: "absolute inset-0" })) }) }) }))] }) }), props.hideFooter ? null : (jsxs("div", { className: "flex items-center p-2", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: t("table.pagination.full", {
|
|
364
366
|
count: props.getRowModel().rows.length,
|
|
365
367
|
total: ((_c = (_b = props.pagination) === null || _b === void 0 ? void 0 : _b.pageInfo) === null || _c === void 0 ? void 0 : _c.count) || 0,
|
|
366
368
|
}) }), props.pagination.isLoading ? (jsx("span", { className: "ml-2", children: jsx(Spinner, { size: "small" }) })) : null, props.footerRightActions && jsx("div", { className: "flex flex-1 justify-end", children: props.footerRightActions })] }))] }));
|