@trackunit/react-table 1.3.28 → 1.3.34
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 +12 -9
- package/index.esm.js +12 -9
- package/package.json +14 -14
- package/src/ActionSheet/ActionSheet.d.ts +1 -1
- package/src/ActionSheet/ActionSheetElementUtils.d.ts +4 -4
- package/src/Table.d.ts +9 -5
- package/src/menus/ColumnFilter.d.ts +1 -1
- package/src/menus/RowSpacing.d.ts +1 -1
- package/src/menus/Sorting.d.ts +3 -2
package/index.cjs.js
CHANGED
|
@@ -156,7 +156,7 @@ const cvaMoreContainer = cssClassVarianceUtilities.cvaMerge([
|
|
|
156
156
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
157
157
|
* @param {string} [props.id] - The optional ID for the button.
|
|
158
158
|
* @param {...any} [props.rest] - Any additional button properties.
|
|
159
|
-
* @returns {
|
|
159
|
+
* @returns {ReactElement} - The action button component.
|
|
160
160
|
*/
|
|
161
161
|
const ActionButton = ({ action, id, ...rest }) => {
|
|
162
162
|
if (action.type === "route") {
|
|
@@ -175,7 +175,7 @@ const ActionButton = ({ action, id, ...rest }) => {
|
|
|
175
175
|
*
|
|
176
176
|
* @param {ActionModel} action - The action model to convert.
|
|
177
177
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
178
|
-
* @returns {
|
|
178
|
+
* @returns {ReactElement} - The MenuItem component for the given action.
|
|
179
179
|
*/
|
|
180
180
|
const actionDataToMenuItem = (action, dataTestId) => {
|
|
181
181
|
const props = "url" in action
|
|
@@ -200,7 +200,7 @@ const actionDataToMenuItem = (action, dataTestId) => {
|
|
|
200
200
|
*
|
|
201
201
|
* @param {ActionModel} action - The action model to convert.
|
|
202
202
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
203
|
-
* @returns {
|
|
203
|
+
* @returns {ReactElement} - The ActionButton component for the given action.
|
|
204
204
|
*/
|
|
205
205
|
const actionDataToActionButton = (action) => (jsxRuntime.jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.dataTestId || action.id, disabled: action.loading, id: action.id }, action.id));
|
|
206
206
|
/**
|
|
@@ -209,7 +209,7 @@ const actionDataToActionButton = (action) => (jsxRuntime.jsx(ActionButton, { act
|
|
|
209
209
|
*
|
|
210
210
|
* @param {InnerActionButtonProps} props - The properties for the action icon.
|
|
211
211
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
212
|
-
* @returns {
|
|
212
|
+
* @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
|
|
213
213
|
*/
|
|
214
214
|
const ActionIcon = ({ action }) => {
|
|
215
215
|
return action.icon ? (jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: "small", style: action.style })) : null;
|
|
@@ -260,7 +260,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, dat
|
|
|
260
260
|
* If the page supports more than 3 actions, the ones that are performed less often can be placed in a contextual menu, represented by the ‘three dots’ icon.
|
|
261
261
|
*
|
|
262
262
|
* @param {ActionSheetProps} props - The props for the ActionSheet component
|
|
263
|
-
* @returns {
|
|
263
|
+
* @returns {ReactElement} ActionSheet component
|
|
264
264
|
*/
|
|
265
265
|
const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, dataTestId, }) => {
|
|
266
266
|
const [t] = useTranslation();
|
|
@@ -285,7 +285,7 @@ const cvaColumnFilterGrabbable = cssClassVarianceUtilities.cvaMerge(["flex", "it
|
|
|
285
285
|
* @template TColumnFilter - The type representing the data model associated with the columns.
|
|
286
286
|
* @template TColumnFilterValue - The type representing the value of columns.
|
|
287
287
|
* @param {ColumnFilterProps<TColumnFilter, TColumnFilterValue>} props - The props object containing necessary properties.
|
|
288
|
-
* @returns {
|
|
288
|
+
* @returns {ReactElement | null} A React JSX element representing the ColumnFilter component or null if columns are not provided.
|
|
289
289
|
*/
|
|
290
290
|
const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], columnOrder, onUserEvent, }) => {
|
|
291
291
|
const [t] = useTranslation();
|
|
@@ -420,7 +420,7 @@ const ColumnFilterItem = ({ name, onToggle, toggled, disabled, index, moveColumn
|
|
|
420
420
|
* RowSpacing component for managing the density of table rows.
|
|
421
421
|
*
|
|
422
422
|
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
423
|
-
* @returns {
|
|
423
|
+
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
424
424
|
*/
|
|
425
425
|
const RowSpacing = ({ density, setRowDensity, onUserEvent }) => {
|
|
426
426
|
const [t] = useTranslation();
|
|
@@ -448,7 +448,7 @@ const CompactIcon = () => {
|
|
|
448
448
|
* @template TSorting - The type representing the data model associated with the columns.
|
|
449
449
|
* @template TSortingValue - The type representing the value of columns.
|
|
450
450
|
* @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
|
|
451
|
-
* @returns {
|
|
451
|
+
* @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
|
|
452
452
|
*/
|
|
453
453
|
const Sorting = ({ columns, }) => {
|
|
454
454
|
const [t] = useTranslation();
|
|
@@ -475,7 +475,10 @@ const Sorting = ({ columns, }) => {
|
|
|
475
475
|
* Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
|
|
476
476
|
*
|
|
477
477
|
* @param {ReactTable} props - The props for the Table component
|
|
478
|
-
* @returns {
|
|
478
|
+
* @returns {ReactElement} Table component
|
|
479
|
+
*/
|
|
480
|
+
/**
|
|
481
|
+
*
|
|
479
482
|
*/
|
|
480
483
|
const Table = ({ rowHeight = 75, ...props }) => {
|
|
481
484
|
//we need a reference to the scrolling element for logic down below
|
package/index.esm.js
CHANGED
|
@@ -155,7 +155,7 @@ const cvaMoreContainer = cvaMerge([
|
|
|
155
155
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
156
156
|
* @param {string} [props.id] - The optional ID for the button.
|
|
157
157
|
* @param {...any} [props.rest] - Any additional button properties.
|
|
158
|
-
* @returns {
|
|
158
|
+
* @returns {ReactElement} - The action button component.
|
|
159
159
|
*/
|
|
160
160
|
const ActionButton = ({ action, id, ...rest }) => {
|
|
161
161
|
if (action.type === "route") {
|
|
@@ -174,7 +174,7 @@ const ActionButton = ({ action, id, ...rest }) => {
|
|
|
174
174
|
*
|
|
175
175
|
* @param {ActionModel} action - The action model to convert.
|
|
176
176
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
177
|
-
* @returns {
|
|
177
|
+
* @returns {ReactElement} - The MenuItem component for the given action.
|
|
178
178
|
*/
|
|
179
179
|
const actionDataToMenuItem = (action, dataTestId) => {
|
|
180
180
|
const props = "url" in action
|
|
@@ -199,7 +199,7 @@ const actionDataToMenuItem = (action, dataTestId) => {
|
|
|
199
199
|
*
|
|
200
200
|
* @param {ActionModel} action - The action model to convert.
|
|
201
201
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
202
|
-
* @returns {
|
|
202
|
+
* @returns {ReactElement} - The ActionButton component for the given action.
|
|
203
203
|
*/
|
|
204
204
|
const actionDataToActionButton = (action) => (jsx(ActionButton, { action: action, className: "max-w-max flex-shrink-0", dataTestId: action.dataTestId || action.id, disabled: action.loading, id: action.id }, action.id));
|
|
205
205
|
/**
|
|
@@ -208,7 +208,7 @@ const actionDataToActionButton = (action) => (jsx(ActionButton, { action: action
|
|
|
208
208
|
*
|
|
209
209
|
* @param {InnerActionButtonProps} props - The properties for the action icon.
|
|
210
210
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
211
|
-
* @returns {
|
|
211
|
+
* @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
|
|
212
212
|
*/
|
|
213
213
|
const ActionIcon = ({ action }) => {
|
|
214
214
|
return action.icon ? (jsx(Icon, { color: "white", "data-testid": "action-icon", forwardedRef: action.forwardedRef, name: action.icon, size: "small", style: action.style })) : null;
|
|
@@ -259,7 +259,7 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, dat
|
|
|
259
259
|
* If the page supports more than 3 actions, the ones that are performed less often can be placed in a contextual menu, represented by the ‘three dots’ icon.
|
|
260
260
|
*
|
|
261
261
|
* @param {ActionSheetProps} props - The props for the ActionSheet component
|
|
262
|
-
* @returns {
|
|
262
|
+
* @returns {ReactElement} ActionSheet component
|
|
263
263
|
*/
|
|
264
264
|
const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, dataTestId, }) => {
|
|
265
265
|
const [t] = useTranslation();
|
|
@@ -284,7 +284,7 @@ const cvaColumnFilterGrabbable = cvaMerge(["flex", "items-center", "justify-cent
|
|
|
284
284
|
* @template TColumnFilter - The type representing the data model associated with the columns.
|
|
285
285
|
* @template TColumnFilterValue - The type representing the value of columns.
|
|
286
286
|
* @param {ColumnFilterProps<TColumnFilter, TColumnFilterValue>} props - The props object containing necessary properties.
|
|
287
|
-
* @returns {
|
|
287
|
+
* @returns {ReactElement | null} A React JSX element representing the ColumnFilter component or null if columns are not provided.
|
|
288
288
|
*/
|
|
289
289
|
const ColumnFilter = ({ columns, setColumnOrder, defaultColumnOrder = [], columnOrder, onUserEvent, }) => {
|
|
290
290
|
const [t] = useTranslation();
|
|
@@ -419,7 +419,7 @@ const ColumnFilterItem = ({ name, onToggle, toggled, disabled, index, moveColumn
|
|
|
419
419
|
* RowSpacing component for managing the density of table rows.
|
|
420
420
|
*
|
|
421
421
|
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
422
|
-
* @returns {
|
|
422
|
+
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
423
423
|
*/
|
|
424
424
|
const RowSpacing = ({ density, setRowDensity, onUserEvent }) => {
|
|
425
425
|
const [t] = useTranslation();
|
|
@@ -447,7 +447,7 @@ const CompactIcon = () => {
|
|
|
447
447
|
* @template TSorting - The type representing the data model associated with the columns.
|
|
448
448
|
* @template TSortingValue - The type representing the value of columns.
|
|
449
449
|
* @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
|
|
450
|
-
* @returns {
|
|
450
|
+
* @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
|
|
451
451
|
*/
|
|
452
452
|
const Sorting = ({ columns, }) => {
|
|
453
453
|
const [t] = useTranslation();
|
|
@@ -474,7 +474,10 @@ const Sorting = ({ columns, }) => {
|
|
|
474
474
|
* Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
|
|
475
475
|
*
|
|
476
476
|
* @param {ReactTable} props - The props for the Table component
|
|
477
|
-
* @returns {
|
|
477
|
+
* @returns {ReactElement} Table component
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
*
|
|
478
481
|
*/
|
|
479
482
|
const Table = ({ rowHeight = 75, ...props }) => {
|
|
480
483
|
//we need a reference to the scrolling element for logic down below
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-table",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.34",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"react": "
|
|
11
|
-
"@tanstack/react-table": "^8.
|
|
10
|
+
"react": "19.0.0",
|
|
11
|
+
"@tanstack/react-table": "^8.20.6",
|
|
12
12
|
"immutability-helper": "^3.1.1",
|
|
13
|
-
"react-dnd": "
|
|
14
|
-
"react-dnd-html5-backend": "
|
|
13
|
+
"react-dnd": "16.0.1",
|
|
14
|
+
"react-dnd-html5-backend": "16.0.1",
|
|
15
15
|
"jest-fetch-mock": "^3.0.3",
|
|
16
16
|
"@tanstack/react-router": "1.47.1",
|
|
17
17
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/react-components": "1.4.
|
|
19
|
-
"@trackunit/shared-utils": "1.5.
|
|
20
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
21
|
-
"@trackunit/ui-icons": "1.3.
|
|
22
|
-
"@trackunit/react-table-base-components": "1.3.
|
|
23
|
-
"@trackunit/react-table-pagination": "1.3.
|
|
24
|
-
"@trackunit/react-form-components": "1.3.
|
|
25
|
-
"@trackunit/i18n-library-translation": "1.3.
|
|
26
|
-
"@trackunit/react-core-contexts-api": "1.4.
|
|
18
|
+
"@trackunit/react-components": "1.4.27",
|
|
19
|
+
"@trackunit/shared-utils": "1.5.27",
|
|
20
|
+
"@trackunit/css-class-variance-utilities": "1.3.27",
|
|
21
|
+
"@trackunit/ui-icons": "1.3.27",
|
|
22
|
+
"@trackunit/react-table-base-components": "1.3.32",
|
|
23
|
+
"@trackunit/react-table-pagination": "1.3.27",
|
|
24
|
+
"@trackunit/react-form-components": "1.3.32",
|
|
25
|
+
"@trackunit/i18n-library-translation": "1.3.28",
|
|
26
|
+
"@trackunit/react-core-contexts-api": "1.4.28"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
29
29
|
"main": "./index.cjs.js",
|
|
@@ -28,6 +28,6 @@ export interface ActionSheetProps extends CommonProps {
|
|
|
28
28
|
* If the page supports more than 3 actions, the ones that are performed less often can be placed in a contextual menu, represented by the ‘three dots’ icon.
|
|
29
29
|
*
|
|
30
30
|
* @param {ActionSheetProps} props - The props for the ActionSheet component
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {ReactElement} ActionSheet component
|
|
32
32
|
*/
|
|
33
33
|
export declare const ActionSheet: ({ actions, dropdownActions, moreActions, selections, resetSelection, className, dataTestId, }: ActionSheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ interface ActionButtonProps extends ButtonCommonProps {
|
|
|
14
14
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
15
15
|
* @param {string} [props.id] - The optional ID for the button.
|
|
16
16
|
* @param {...any} [props.rest] - Any additional button properties.
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {ReactElement} - The action button component.
|
|
18
18
|
*/
|
|
19
19
|
export declare const ActionButton: ({ action, id, ...rest }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export declare const ActionButton: ({ action, id, ...rest }: ActionButtonProps)
|
|
|
24
24
|
*
|
|
25
25
|
* @param {ActionModel} action - The action model to convert.
|
|
26
26
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {ReactElement} - The MenuItem component for the given action.
|
|
28
28
|
*/
|
|
29
29
|
export declare const actionDataToMenuItem: (action: ActionModel, dataTestId?: string) => import("react/jsx-runtime").JSX.Element;
|
|
30
30
|
/**
|
|
@@ -34,7 +34,7 @@ export declare const actionDataToMenuItem: (action: ActionModel, dataTestId?: st
|
|
|
34
34
|
*
|
|
35
35
|
* @param {ActionModel} action - The action model to convert.
|
|
36
36
|
* @param {string} [dataTestId] - Optional data test ID.
|
|
37
|
-
* @returns {
|
|
37
|
+
* @returns {ReactElement} - The ActionButton component for the given action.
|
|
38
38
|
*/
|
|
39
39
|
export declare const actionDataToActionButton: (action: ActionModel) => import("react/jsx-runtime").JSX.Element;
|
|
40
40
|
interface InnerActionButtonProps {
|
|
@@ -46,7 +46,7 @@ interface InnerActionButtonProps {
|
|
|
46
46
|
*
|
|
47
47
|
* @param {InnerActionButtonProps} props - The properties for the action icon.
|
|
48
48
|
* @param {ActionModel} props.action - The action model defining what action to perform.
|
|
49
|
-
* @returns {
|
|
49
|
+
* @returns {ReactElement | null} - The icon for the action button, or null if no icon is defined.
|
|
50
50
|
*/
|
|
51
51
|
export declare const ActionIcon: ({ action }: InnerActionButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
52
52
|
export {};
|
package/src/Table.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Table as ReactTable, Row } from "@tanstack/react-table";
|
|
2
2
|
import { CommonProps, EmptyStateProps } from "@trackunit/react-components";
|
|
3
3
|
import { RelayPagination } from "@trackunit/react-table-pagination";
|
|
4
|
+
import { ReactElement, ReactNode } from "react";
|
|
4
5
|
export interface TableProps<TData extends object> extends ReactTable<TData>, CommonProps {
|
|
5
6
|
pagination?: RelayPagination;
|
|
6
|
-
headerLeftActions?:
|
|
7
|
-
headerRightActions?:
|
|
8
|
-
footerRightActions?:
|
|
7
|
+
headerLeftActions?: ReactNode;
|
|
8
|
+
headerRightActions?: ReactNode;
|
|
9
|
+
footerRightActions?: ReactNode;
|
|
9
10
|
onRowClick?: (row: Row<TData>) => void;
|
|
10
|
-
noDataMessage?:
|
|
11
|
+
noDataMessage?: ReactElement | string;
|
|
11
12
|
loading?: boolean;
|
|
12
13
|
rowHeight?: number;
|
|
13
14
|
hideFooter?: boolean;
|
|
@@ -19,6 +20,9 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
|
|
|
19
20
|
* Table component for displaying large sets of data in tables with infinite scroll, sorting, filtering and others.
|
|
20
21
|
*
|
|
21
22
|
* @param {ReactTable} props - The props for the Table component
|
|
22
|
-
* @returns {
|
|
23
|
+
* @returns {ReactElement} Table component
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
23
27
|
*/
|
|
24
28
|
export declare const Table: <TData extends object>({ rowHeight, ...props }: TableProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,7 +12,7 @@ export interface ColumnFilterProps<TColumnFilter extends object, TColumnFilterVa
|
|
|
12
12
|
* @template TColumnFilter - The type representing the data model associated with the columns.
|
|
13
13
|
* @template TColumnFilterValue - The type representing the value of columns.
|
|
14
14
|
* @param {ColumnFilterProps<TColumnFilter, TColumnFilterValue>} props - The props object containing necessary properties.
|
|
15
|
-
* @returns {
|
|
15
|
+
* @returns {ReactElement | null} A React JSX element representing the ColumnFilter component or null if columns are not provided.
|
|
16
16
|
*/
|
|
17
17
|
export declare const ColumnFilter: <TColumnFilter extends object, TColumnFilterValue>({ columns, setColumnOrder, defaultColumnOrder, columnOrder, onUserEvent, }: ColumnFilterProps<TColumnFilter, TColumnFilterValue>) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export interface ColumnFiltersDragAndDropProps<TColumnFiltersDragAndDrop extends object, TColumnFiltersDragAndDropValue> {
|
|
@@ -8,7 +8,7 @@ interface RowDensityProps {
|
|
|
8
8
|
* RowSpacing component for managing the density of table rows.
|
|
9
9
|
*
|
|
10
10
|
* @param {RowDensityProps} props - The props object containing row density properties.
|
|
11
|
-
* @returns {
|
|
11
|
+
* @returns {ReactElement} A React JSX element representing the RowSpacing component.
|
|
12
12
|
*/
|
|
13
13
|
export declare const RowSpacing: ({ density, setRowDensity, onUserEvent }: RowDensityProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
package/src/menus/Sorting.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Column } from "@tanstack/react-table";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
interface SortingProps<TSorting extends object, TSortingValue> {
|
|
3
4
|
columns: Column<TSorting, TSortingValue>[];
|
|
4
5
|
}
|
|
@@ -8,7 +9,7 @@ interface SortingProps<TSorting extends object, TSortingValue> {
|
|
|
8
9
|
* @template TSorting - The type representing the data model associated with the columns.
|
|
9
10
|
* @template TSortingValue - The type representing the value of columns.
|
|
10
11
|
* @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
|
|
11
|
-
* @returns {
|
|
12
|
+
* @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
|
|
12
13
|
*/
|
|
13
|
-
export declare const Sorting: <TSorting extends object, TSortingValue>({ columns, }: SortingProps<TSorting, TSortingValue>) =>
|
|
14
|
+
export declare const Sorting: <TSorting extends object, TSortingValue>({ columns, }: SortingProps<TSorting, TSortingValue>) => ReactElement | null;
|
|
14
15
|
export {};
|