@trackunit/react-table 0.0.36 → 0.0.37
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 +6 -8
- package/index.esm.js +6 -8
- package/package.json +3 -3
- package/src/Table.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -3945,13 +3945,13 @@ const Table = (props) => {
|
|
|
3945
3945
|
return (jsxRuntime.jsxs(reactComponents.Card, { className: `overflow-hidden flex flex-col ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxRuntime.jsxs("div", { className: "flex gap-2 p-2 justify-between z-default", children: [jsxRuntime.jsx("div", { className: "flex", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex", children: props.headerRightActions })] })), jsxRuntime.jsx("div", { className: "overflow-y-scroll overflow-x-auto h-full min-h[500px] border-b border-t border-gray-300", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
|
|
3946
3946
|
width: props.getCenterTotalSize(),
|
|
3947
3947
|
}, children: [jsxRuntime.jsx(reactTableBaseComponents.Thead, { className: "z-default", children: props.getHeaderGroups().map(headerGroup => (jsxRuntime.jsx(reactTableBaseComponents.Tr, { className: "flex", children: headerGroup.headers.map(header => {
|
|
3948
|
-
var _a, _b, _c, _d
|
|
3948
|
+
var _a, _b, _c, _d;
|
|
3949
3949
|
return (jsxRuntime.jsxs(reactTableBaseComponents.Th, { style: {
|
|
3950
3950
|
width: header.getSize(),
|
|
3951
3951
|
minWidth: header.column.columnDef.minSize,
|
|
3952
3952
|
maxWidth: header.column.columnDef.maxSize,
|
|
3953
|
-
}, className: "relative", children: [header.isPlaceholder ? null :
|
|
3954
|
-
onClick: header.column.getToggleSortingHandler(), children: [jsxRuntime.jsxs("span", { className: "whitespace-nowrap text-ellipsis overflow-hidden", children: [flexRender(header.column.columnDef.header, header.getContext()), ((
|
|
3953
|
+
}, 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`,
|
|
3954
|
+
onClick: header.column.getToggleSortingHandler(), children: [jsxRuntime.jsxs("span", { className: "whitespace-nowrap text-ellipsis overflow-hidden", children: [flexRender(header.column.columnDef.header, header.getContext()), ((_b = (_a = header.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.subHeader) ? (jsxRuntime.jsx(reactComponents.Text, { size: "small", subtle: true, children: (_d = (_c = header.column.columnDef) === null || _c === void 0 ? void 0 : _c.meta) === null || _d === void 0 ? void 0 : _d.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));
|
|
3955
3955
|
}) }, headerGroup.id))) }), hasResults ? (jsxRuntime.jsxs(reactTableBaseComponents.Tbody, { className: "text-sm font-normal", children: [paddingTop > 0 && (jsxRuntime.jsx(reactTableBaseComponents.Tr, { layout: "flex", children: jsxRuntime.jsx(reactTableBaseComponents.Td, { style: { height: `${paddingTop}px` } }) })), virtualRows.map(virtualRow => {
|
|
3956
3956
|
const row = props.getRowModel().rows[virtualRow.index];
|
|
3957
3957
|
if (!row) {
|
|
@@ -9231,7 +9231,8 @@ const useTable = (_a) => {
|
|
|
9231
9231
|
* @returns {TanStackSortingState} The sorting state in TanStack format.
|
|
9232
9232
|
*/
|
|
9233
9233
|
const fromTUSortToTanStack = (input) => {
|
|
9234
|
-
|
|
9234
|
+
var _a;
|
|
9235
|
+
return [{ id: (_a = input.customFieldDefinitionId) !== null && _a !== void 0 ? _a : input.sortBy, desc: input.order === reactCoreContextsApi.SortOrder.Desc }];
|
|
9235
9236
|
};
|
|
9236
9237
|
/**
|
|
9237
9238
|
* Convert a sorting state from the TanStack format to the TUSort format.
|
|
@@ -9240,10 +9241,7 @@ const fromTUSortToTanStack = (input) => {
|
|
|
9240
9241
|
* @returns {SortingState} The sorting state in TUSort format.
|
|
9241
9242
|
*/
|
|
9242
9243
|
const fromTanStackToTUSort = (input) => {
|
|
9243
|
-
return {
|
|
9244
|
-
sortBy: reactCoreContextsApi.validateStringAsAssetSortByProperty(input[0].id),
|
|
9245
|
-
order: input[0].desc ? reactCoreContextsApi.SortOrder.Desc : reactCoreContextsApi.SortOrder.Asc,
|
|
9246
|
-
};
|
|
9244
|
+
return Object.assign(Object.assign({}, reactCoreContextsApi.validateStringAsAssetSortByProperty(input[0].id)), { order: input[0].desc ? reactCoreContextsApi.SortOrder.Desc : reactCoreContextsApi.SortOrder.Asc });
|
|
9247
9245
|
};
|
|
9248
9246
|
|
|
9249
9247
|
/*
|
package/index.esm.js
CHANGED
|
@@ -3919,13 +3919,13 @@ const Table = (props) => {
|
|
|
3919
3919
|
return (jsxs(Card, { className: `overflow-hidden flex flex-col ${props.className || ""}`, dataTestId: props.dataTestId, children: [(props.headerLeftActions || props.headerRightActions) && (jsxs("div", { className: "flex gap-2 p-2 justify-between z-default", children: [jsx("div", { className: "flex", children: props.headerLeftActions }), jsx("div", { className: "flex", children: props.headerRightActions })] })), jsx("div", { className: "overflow-y-scroll overflow-x-auto h-full min-h[500px] border-b border-t border-gray-300", onScroll: e => fetchMoreOnBottomReached(e.target), ref: tableContainerRef, children: jsxs(TableRoot, { style: {
|
|
3920
3920
|
width: props.getCenterTotalSize(),
|
|
3921
3921
|
}, children: [jsx(Thead, { className: "z-default", children: props.getHeaderGroups().map(headerGroup => (jsx(Tr, { className: "flex", children: headerGroup.headers.map(header => {
|
|
3922
|
-
var _a, _b, _c, _d
|
|
3922
|
+
var _a, _b, _c, _d;
|
|
3923
3923
|
return (jsxs(Th, { style: {
|
|
3924
3924
|
width: header.getSize(),
|
|
3925
3925
|
minWidth: header.column.columnDef.minSize,
|
|
3926
3926
|
maxWidth: header.column.columnDef.maxSize,
|
|
3927
|
-
}, className: "relative", children: [header.isPlaceholder ? null :
|
|
3928
|
-
onClick: header.column.getToggleSortingHandler(), children: [jsxs("span", { className: "whitespace-nowrap text-ellipsis overflow-hidden", children: [flexRender(header.column.columnDef.header, header.getContext()), ((
|
|
3927
|
+
}, 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`,
|
|
3928
|
+
onClick: header.column.getToggleSortingHandler(), children: [jsxs("span", { className: "whitespace-nowrap text-ellipsis overflow-hidden", children: [flexRender(header.column.columnDef.header, header.getContext()), ((_b = (_a = header.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.subHeader) ? (jsx(Text, { size: "small", subtle: true, children: (_d = (_c = header.column.columnDef) === null || _c === void 0 ? void 0 : _c.meta) === null || _d === void 0 ? void 0 : _d.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));
|
|
3929
3929
|
}) }, headerGroup.id))) }), hasResults ? (jsxs(Tbody, { className: "text-sm font-normal", children: [paddingTop > 0 && (jsx(Tr, { layout: "flex", children: jsx(Td, { style: { height: `${paddingTop}px` } }) })), virtualRows.map(virtualRow => {
|
|
3930
3930
|
const row = props.getRowModel().rows[virtualRow.index];
|
|
3931
3931
|
if (!row) {
|
|
@@ -9205,7 +9205,8 @@ const useTable = (_a) => {
|
|
|
9205
9205
|
* @returns {TanStackSortingState} The sorting state in TanStack format.
|
|
9206
9206
|
*/
|
|
9207
9207
|
const fromTUSortToTanStack = (input) => {
|
|
9208
|
-
|
|
9208
|
+
var _a;
|
|
9209
|
+
return [{ id: (_a = input.customFieldDefinitionId) !== null && _a !== void 0 ? _a : input.sortBy, desc: input.order === SortOrder.Desc }];
|
|
9209
9210
|
};
|
|
9210
9211
|
/**
|
|
9211
9212
|
* Convert a sorting state from the TanStack format to the TUSort format.
|
|
@@ -9214,10 +9215,7 @@ const fromTUSortToTanStack = (input) => {
|
|
|
9214
9215
|
* @returns {SortingState} The sorting state in TUSort format.
|
|
9215
9216
|
*/
|
|
9216
9217
|
const fromTanStackToTUSort = (input) => {
|
|
9217
|
-
return {
|
|
9218
|
-
sortBy: validateStringAsAssetSortByProperty(input[0].id),
|
|
9219
|
-
order: input[0].desc ? SortOrder.Desc : SortOrder.Asc,
|
|
9220
|
-
};
|
|
9218
|
+
return Object.assign(Object.assign({}, validateStringAsAssetSortByProperty(input[0].id)), { order: input[0].desc ? SortOrder.Desc : SortOrder.Asc });
|
|
9221
9219
|
};
|
|
9222
9220
|
|
|
9223
9221
|
/*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-table",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"@trackunit/i18n-library-translation": "0.0.79",
|
|
15
15
|
"@trackunit/iris-app-api": "0.0.117",
|
|
16
16
|
"@trackunit/react-components": "0.1.164",
|
|
17
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
18
|
-
"@trackunit/react-core-contexts-test": "0.1.
|
|
17
|
+
"@trackunit/react-core-contexts-api": "0.2.60",
|
|
18
|
+
"@trackunit/react-core-contexts-test": "0.1.113",
|
|
19
19
|
"@trackunit/react-form-components": "0.0.151",
|
|
20
20
|
"@trackunit/react-table-base-components": "0.0.24",
|
|
21
21
|
"@trackunit/shared-utils": "0.0.9",
|
package/src/Table.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
|
|
|
8
8
|
headerRightActions?: React.ReactNode;
|
|
9
9
|
footerRightActions?: React.ReactNode;
|
|
10
10
|
onRowClick?: (row: Row<TData>) => void;
|
|
11
|
-
disableHeaderSorting?: boolean;
|
|
12
11
|
noDataMessage?: JSX.Element | string;
|
|
13
12
|
loading?: boolean;
|
|
14
13
|
}
|