@payfit/unity-components 2.65.28 → 2.67.0
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/esm/components/data-table/DataTable.d.ts +19 -24
- package/dist/esm/components/data-table/DataTable.js +105 -82
- package/dist/esm/components/data-table/DataTablePagination.d.ts +22 -0
- package/dist/esm/components/data-table/DataTablePagination.js +6 -0
- package/dist/esm/components/data-table/mocks/employee-columns-legacy.d.ts +15 -0
- package/dist/esm/components/data-table/mocks/employee-columns.d.ts +138 -3
- package/dist/esm/components/data-table/parts/ColumnSortHeader.d.ts +9 -5
- package/dist/esm/components/data-table/parts/ColumnSortHeader.js +19 -13
- package/dist/esm/components/data-table/parts/DataTableBulkActions.d.ts +12 -4
- package/dist/esm/components/data-table/parts/DataTableBulkActions.js +39 -38
- package/dist/esm/components/data-table/parts/DataTableBulkActionsLegacy.d.ts +13 -0
- package/dist/esm/components/filter-toolbar/utils/filter-adapters.d.ts +16 -2
- package/dist/esm/components/inline-field/parts/InlineFieldEditView.js +4 -4
- package/dist/esm/components/inline-field-group/InlineFieldGroup.js +4 -4
- package/dist/esm/components/table/parts/TableHeader.d.ts +18 -3
- package/dist/esm/components/table/parts/TableHeader.js +21 -6
- package/dist/esm/docs/examples/data/mocks/employee-columns.d.ts +224 -2
- package/dist/esm/index.js +15 -15
- package/package.json +8 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { default as React
|
|
2
|
-
import { Row, RowData,
|
|
1
|
+
import { ReactNode, default as React } from 'react';
|
|
2
|
+
import { ReactTable as TableType, Row, RowData, TableFeatures } from '@tanstack/react-table';
|
|
3
3
|
import { TablePaginationProps } from '../table/parts/TablePagination.js';
|
|
4
4
|
import { TableProps, TableRootProps } from '../table/Table.js';
|
|
5
5
|
declare module '@tanstack/react-table' {
|
|
6
|
-
interface ColumnMeta<TData extends RowData, TValue> {
|
|
6
|
+
interface ColumnMeta<TFeatures, TData extends RowData, TValue> {
|
|
7
7
|
/**
|
|
8
8
|
* Marks the cell as a row header. When true, the cell renders as `<th scope="row">` instead of `<td>`.
|
|
9
9
|
* Use this for the first column that identifies each row (e.g., ID, name). Important for accessibility.
|
|
@@ -100,9 +100,9 @@ export interface DataTablePaginationOptions {
|
|
|
100
100
|
*/
|
|
101
101
|
labels?: DataTablePaginationLabels;
|
|
102
102
|
}
|
|
103
|
-
export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>, Omit<TableProps, 'children'> {
|
|
103
|
+
export interface DataTableProps<TFeatures extends TableFeatures, TData extends RowData> extends Omit<TableRootProps, 'children'>, Omit<TableProps, 'children'> {
|
|
104
104
|
/** The table instance from @tanstack/react-table */
|
|
105
|
-
table: TableType<TData>;
|
|
105
|
+
table: TableType<TFeatures, TData>;
|
|
106
106
|
/**
|
|
107
107
|
* Optional loading state
|
|
108
108
|
* @default false
|
|
@@ -129,18 +129,8 @@ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>,
|
|
|
129
129
|
*/
|
|
130
130
|
errorState?: React.ReactNode;
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* pageSizeOptions: [
|
|
135
|
-
* { value: '10', label: '10' },
|
|
136
|
-
* { value: '50', label: '50' },
|
|
137
|
-
* { value: '100', label: '100' },
|
|
138
|
-
* { value: '200', label: '200' },
|
|
139
|
-
* ],
|
|
140
|
-
* labels: {
|
|
141
|
-
* itemLabel: 'unity:component:table:pagination:item',
|
|
142
|
-
* },
|
|
143
|
-
* }
|
|
132
|
+
* Optional pagination customization options, including page size options and labels.
|
|
133
|
+
* The pagination footer is rendered automatically when the table includes `rowPaginationFeature`.
|
|
144
134
|
*/
|
|
145
135
|
pagination?: DataTablePaginationOptions;
|
|
146
136
|
/**
|
|
@@ -166,7 +156,7 @@ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>,
|
|
|
166
156
|
* Render function for table rows
|
|
167
157
|
* @param row - The row data of a given row in the table
|
|
168
158
|
*/
|
|
169
|
-
children: (row: Row<TData>) => React.ReactNode;
|
|
159
|
+
children: (row: Row<TFeatures, TData>) => React.ReactNode;
|
|
170
160
|
/**
|
|
171
161
|
* Optional callback fired when the button is clicked in the error state.
|
|
172
162
|
* Used to navigate away or retry when data loading fails.
|
|
@@ -228,14 +218,19 @@ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>,
|
|
|
228
218
|
* @example
|
|
229
219
|
* ```tsx
|
|
230
220
|
* import { DataTableRoot, DataTable, DataTableBulkActions, TableRow, TableCell } from '@payfit/unity-components'
|
|
231
|
-
* import { flexRender,
|
|
221
|
+
* import { createColumnHelper, createPaginatedRowModel, flexRender, stockFeatures, tableFeatures, useTable, type StockFeatures } from '@tanstack/react-table'
|
|
232
222
|
* import { useState, useMemo } from 'react'
|
|
233
223
|
*
|
|
224
|
+
* const features = tableFeatures({
|
|
225
|
+
* ...stockFeatures,
|
|
226
|
+
* paginatedRowModel: createPaginatedRowModel(),
|
|
227
|
+
* })
|
|
228
|
+
*
|
|
234
229
|
* function EmployeeTable() {
|
|
235
230
|
* const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 })
|
|
236
231
|
* const [rowSelection, setRowSelection] = useState({})
|
|
237
232
|
*
|
|
238
|
-
* const columnHelper = createColumnHelper<Employee>()
|
|
233
|
+
* const columnHelper = createColumnHelper<StockFeatures, Employee>()
|
|
239
234
|
*
|
|
240
235
|
* // Define columns with optional width control for fixed layout
|
|
241
236
|
* const columns = useMemo(() => [
|
|
@@ -258,15 +253,14 @@ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>,
|
|
|
258
253
|
* })
|
|
259
254
|
* ], [])
|
|
260
255
|
*
|
|
261
|
-
* const table =
|
|
256
|
+
* const table = useTable({
|
|
257
|
+
* features,
|
|
262
258
|
* data: employees,
|
|
263
259
|
* columns,
|
|
264
260
|
* getRowId: (row) => row.id,
|
|
265
261
|
* state: { pagination, rowSelection },
|
|
266
262
|
* onPaginationChange: setPagination,
|
|
267
263
|
* onRowSelectionChange: setRowSelection,
|
|
268
|
-
* getCoreRowModel: getCoreRowModel(),
|
|
269
|
-
* getPaginationRowModel: getPaginationRowModel(),
|
|
270
264
|
* enableRowSelection: true,
|
|
271
265
|
* enableMultiRowSelection: true,
|
|
272
266
|
* })
|
|
@@ -297,12 +291,13 @@ export interface DataTableProps<TData> extends Omit<TableRootProps, 'children'>,
|
|
|
297
291
|
* @remarks
|
|
298
292
|
* - For bulk actions, use DataTableBulkActions component alongside DataTable within DataTableRoot
|
|
299
293
|
* - DataTableBulkActions provides the F6 keyboard shortcut for accessibility
|
|
294
|
+
* - Configure `rowPaginationFeature` on the Tanstack table instance to render the Unity pagination footer automatically; use the `pagination` prop only to customize it
|
|
300
295
|
* - **Layout modes**: Use `layout="auto"` (default) for content-driven columns with scrolling, or `layout="fixed"` for predictable widths that fit the container
|
|
301
296
|
* - **Setting column widths**: Add `headerClassName` to column meta with width classes (e.g., `'uy:w-[200px]'`, `'uy:w-1/3'`)
|
|
302
297
|
* - **Fixed layout best practices**: Set explicit widths on column headers and use truncation for overflow content
|
|
303
298
|
* - [API](https://unity-components.payfit.io/?path=/docs/data-datatable--docs) • [Demo](https://unity-components.payfit.io/?path=/docs/data-datatable--docs)
|
|
304
299
|
*/
|
|
305
|
-
declare function DataTable<TData extends
|
|
300
|
+
declare function DataTable<TFeatures extends TableFeatures, TData extends RowData>({ table, isLoading, error, emptyState, loadingState, errorState, pagination, minRows, maxRows, onPageChange: onPaginationChange, onPageHover: onPaginationPageHover, onPageSizeChange: onPaginationSizeChange, children, enableVirtualization, estimatedRowHeight, overscan, onErrorButtonPress, onNoDataButtonPress, noDataDescription, onNoSearchResultsButtonPress, ...rest }: DataTableProps<TFeatures, TData>): import("react/jsx-runtime").JSX.Element;
|
|
306
301
|
declare namespace DataTable {
|
|
307
302
|
var displayName: string;
|
|
308
303
|
}
|
|
@@ -1,102 +1,125 @@
|
|
|
1
1
|
import { CircularIconButton as e } from "../icon-button/CircularIconButton.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { TablePagination as t } from "../table/parts/TablePagination.js";
|
|
3
|
+
import { Table as n, TableRoot as r } from "../table/Table.js";
|
|
4
|
+
import { TableBody as i } from "../table/parts/TableBody.js";
|
|
5
|
+
import { TableColumnHeader as a } from "../table/parts/TableColumnHeader.js";
|
|
6
|
+
import { TableEmptyStateError as o, TableEmptyStateLoading as s, TableEmptyStateNoData as c, TableNoSearchResults as l } from "../table/parts/TableEmptyState.js";
|
|
7
|
+
import { TableHeader as u } from "../table/parts/TableHeader.js";
|
|
8
|
+
import { getPaginationTable as d } from "./DataTablePagination.js";
|
|
9
|
+
import { ColumnSortHeader as f, isSortableHeader as p } from "./parts/ColumnSortHeader.js";
|
|
10
|
+
import { useMemo as m, useRef as h } from "react";
|
|
11
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
import { useId as y } from "react-aria/useId";
|
|
13
|
+
import { flexRender as b } from "@tanstack/react-table";
|
|
14
|
+
import { useSelector as x } from "@tanstack/react-store";
|
|
13
15
|
//#region src/components/data-table/DataTable.tsx
|
|
14
|
-
var
|
|
16
|
+
var S = ({ children: t, columnNameId: n, helperText: r }) => r === void 0 ? /* @__PURE__ */ _(g, { children: t }) : /* @__PURE__ */ v("div", {
|
|
15
17
|
className: "uy:flex uy:gap-50 uy:items-center",
|
|
16
|
-
children: [t, /* @__PURE__ */
|
|
18
|
+
children: [t, /* @__PURE__ */ _(e, {
|
|
17
19
|
"aria-labelledby": n,
|
|
18
20
|
icon: "QuestionOutlined",
|
|
19
21
|
title: r,
|
|
20
22
|
color: "content.neutral.lowest"
|
|
21
23
|
})]
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
}), C = ({ table: e, tableRef: n, pagination: r, onPageChange: i, onPageHover: a, onPageSizeChange: o }) => {
|
|
25
|
+
let s = e.atoms.pagination, { pageIndex: c, pageSize: l } = x(m(() => ({
|
|
26
|
+
get: () => s.get(),
|
|
27
|
+
subscribe: (e) => s.subscribe((t) => {
|
|
28
|
+
n.current?.scrollToTop(), e(t);
|
|
29
|
+
})
|
|
30
|
+
}), [s, n]));
|
|
31
|
+
return e.getPageCount() <= 0 ? null : /* @__PURE__ */ _(t, {
|
|
32
|
+
pageCount: e.getPageCount(),
|
|
33
|
+
rowCount: e.getRowCount(),
|
|
34
|
+
currentPage: c + 1,
|
|
35
|
+
rowsPerPage: l,
|
|
36
|
+
pageSizeOptions: r.pageSizeOptions,
|
|
37
|
+
onPageChange: (t, n, r) => {
|
|
38
|
+
e.setPageIndex(t - 1), i?.(t - 1, n, r);
|
|
39
|
+
},
|
|
40
|
+
onPageHover: (e) => {
|
|
41
|
+
a?.(e);
|
|
42
|
+
},
|
|
43
|
+
onPageSizeChange: (t) => {
|
|
44
|
+
e.setPageSize(t), o?.(t);
|
|
45
|
+
},
|
|
46
|
+
itemLabel: r.labels?.itemLabel
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
function w({ table: e, isLoading: t, error: m, emptyState: g, loadingState: x, errorState: w, pagination: T, minRows: E, maxRows: D, onPageChange: O, onPageHover: k, onPageSizeChange: A, children: j, enableVirtualization: M, estimatedRowHeight: N, overscan: P, onErrorButtonPress: F, onNoDataButtonPress: I, noDataDescription: L, onNoSearchResultsButtonPress: R, ...z }) {
|
|
50
|
+
let B = h(null), V = y(), H = d(e), U = {
|
|
51
|
+
label: z.label,
|
|
52
|
+
description: z.description,
|
|
53
|
+
isHorizontalScrollEnabled: z.isHorizontalScrollEnabled,
|
|
54
|
+
layout: z.layout
|
|
33
55
|
}, W = () => {
|
|
34
|
-
if (
|
|
35
|
-
if (
|
|
56
|
+
if (t) return x ?? /* @__PURE__ */ _(s, {});
|
|
57
|
+
if (m) return w ?? /* @__PURE__ */ _(o, { onButtonPress: F });
|
|
36
58
|
}, G = () => {
|
|
37
|
-
let t = e.
|
|
59
|
+
let t = e.state, n = t.globalFilter !== void 0 && t.globalFilter !== "", r = t.columnFilters !== void 0 && t.columnFilters.length > 0;
|
|
38
60
|
return n || r;
|
|
39
|
-
}, K = () =>
|
|
40
|
-
onButtonPress:
|
|
41
|
-
description:
|
|
42
|
-
}) :
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
minRows:
|
|
45
|
-
maxRows:
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
-
ref:
|
|
61
|
+
}, K = () => t || m ? W() : e.getRowModel().rows.length === 0 ? G() && R ? /* @__PURE__ */ _(l, { onButtonPress: R }) : g ?? /* @__PURE__ */ _(c, {
|
|
62
|
+
onButtonPress: I,
|
|
63
|
+
description: L
|
|
64
|
+
}) : g;
|
|
65
|
+
return /* @__PURE__ */ v(r, {
|
|
66
|
+
minRows: E,
|
|
67
|
+
maxRows: D,
|
|
68
|
+
children: [/* @__PURE__ */ v(n, {
|
|
69
|
+
ref: B,
|
|
48
70
|
...U,
|
|
49
|
-
enableVirtualization:
|
|
50
|
-
estimatedRowHeight:
|
|
51
|
-
overscan:
|
|
52
|
-
children: [/* @__PURE__ */
|
|
53
|
-
let
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
enableVirtualization: M,
|
|
72
|
+
estimatedRowHeight: N,
|
|
73
|
+
overscan: P,
|
|
74
|
+
children: [/* @__PURE__ */ _(u, { children: e.getHeaderGroups().map((t) => {
|
|
75
|
+
let n = 0;
|
|
76
|
+
return /* @__PURE__ */ _("tr", { children: t.headers.map((r) => {
|
|
77
|
+
let i = n;
|
|
78
|
+
if (n += r.colSpan, r.rowSpan === 0) return null;
|
|
79
|
+
let o = !r.isPlaceholder || r.rowSpan > 1, s = `${V}-column-name-${r.column.id}`, c = r.column.columnDef.meta, l = p(r);
|
|
80
|
+
return /* @__PURE__ */ _(a, {
|
|
81
|
+
colIndex: i,
|
|
82
|
+
rowIndex: t.depth,
|
|
83
|
+
colSpan: r.colSpan,
|
|
84
|
+
rowSpan: r.rowSpan,
|
|
85
|
+
scope: r.colSpan > 1 ? "colgroup" : "col",
|
|
86
|
+
isFocusable: c?.isFocusable,
|
|
87
|
+
className: c?.headerClassName,
|
|
88
|
+
children: o && e.getRowModel().rows.length > 0 && l ? /* @__PURE__ */ _(f, {
|
|
89
|
+
header: r,
|
|
90
|
+
children: /* @__PURE__ */ _(S, {
|
|
91
|
+
columnNameId: s,
|
|
92
|
+
helperText: c?.helperText,
|
|
93
|
+
children: /* @__PURE__ */ _("span", {
|
|
94
|
+
id: s,
|
|
95
|
+
children: b(r.column.columnDef.header, r.getContext())
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
}) : o ? /* @__PURE__ */ _(S, {
|
|
99
|
+
columnNameId: s,
|
|
100
|
+
helperText: c?.helperText,
|
|
101
|
+
children: /* @__PURE__ */ _("span", {
|
|
102
|
+
id: s,
|
|
103
|
+
children: b(r.column.columnDef.header, r.getContext())
|
|
65
104
|
})
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
children: /* @__PURE__ */ h("span", {
|
|
71
|
-
id: r,
|
|
72
|
-
children: v(t.column.columnDef.header, t.getContext())
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
}, t.id);
|
|
76
|
-
})) }), /* @__PURE__ */ h(t, {
|
|
105
|
+
}) : null
|
|
106
|
+
}, r.id);
|
|
107
|
+
}) }, t.id);
|
|
108
|
+
}) }), /* @__PURE__ */ _(i, {
|
|
77
109
|
renderEmptyState: K,
|
|
78
110
|
renderDataState: W,
|
|
79
|
-
children: !
|
|
111
|
+
children: !t && !m && e.getRowModel().rows.map(j)
|
|
80
112
|
})]
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
e.setPageIndex(t - 1), D?.(t - 1, n, r);
|
|
89
|
-
},
|
|
90
|
-
onPageHover: (e) => {
|
|
91
|
-
O?.(e);
|
|
92
|
-
},
|
|
93
|
-
onPageSizeChange: (t) => {
|
|
94
|
-
e.setPageSize(t), k?.(t);
|
|
95
|
-
},
|
|
96
|
-
itemLabel: w?.labels?.itemLabel
|
|
113
|
+
}), H !== void 0 && /* @__PURE__ */ _(C, {
|
|
114
|
+
table: H,
|
|
115
|
+
tableRef: B,
|
|
116
|
+
pagination: T ?? {},
|
|
117
|
+
onPageChange: O,
|
|
118
|
+
onPageHover: k,
|
|
119
|
+
onPageSizeChange: A
|
|
97
120
|
})]
|
|
98
121
|
});
|
|
99
122
|
}
|
|
100
|
-
|
|
123
|
+
w.displayName = "DataTable";
|
|
101
124
|
//#endregion
|
|
102
|
-
export {
|
|
125
|
+
export { w as DataTable };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactTable as TableType, RowData, TableFeatures } from '@tanstack/react-table';
|
|
2
|
+
type SelectionSource<T> = {
|
|
3
|
+
get: () => T;
|
|
4
|
+
subscribe: (listener: (value: T) => void) => {
|
|
5
|
+
unsubscribe: () => void;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type PaginationState = {
|
|
9
|
+
pageIndex: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
};
|
|
12
|
+
export type PaginationCapableTable<TFeatures extends TableFeatures, TData extends RowData> = TableType<TFeatures, TData> & {
|
|
13
|
+
atoms: TableType<TFeatures, TData>['atoms'] & {
|
|
14
|
+
pagination: SelectionSource<PaginationState>;
|
|
15
|
+
};
|
|
16
|
+
getPageCount: () => number;
|
|
17
|
+
getRowCount: () => number;
|
|
18
|
+
setPageIndex: (pageIndex: number) => void;
|
|
19
|
+
setPageSize: (pageSize: number) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const getPaginationTable: <TFeatures extends TableFeatures, TData extends RowData>(table: TableType<TFeatures, TData>) => PaginationCapableTable<TFeatures, TData> | undefined;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Employee } from './employee-data.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates optimized checkbox column with stable handlers to prevent unnecessary re-renders
|
|
4
|
+
*/
|
|
5
|
+
export declare const createCheckboxColumn: () => import('@tanstack/react-table').DisplayColumnDef<import('@tanstack/react-table').StockFeatures, Employee, unknown>;
|
|
6
|
+
export declare const employeeColumns: import('@tanstack/react-table').ColumnDef<import('@tanstack/react-table').StockFeatures, Employee, any>[] & [import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, string>, import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, "Full-time" | "Part-time" | "Freelance" | "Contractor">, import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, {
|
|
7
|
+
name: string;
|
|
8
|
+
position: string;
|
|
9
|
+
team: string;
|
|
10
|
+
} | null>, import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, "active" | "inactive" | "onboarding" | "offboarding" | "retired">];
|
|
11
|
+
export declare const employeeColumnsWithCheckbox: import('@tanstack/react-table').ColumnDef<import('@tanstack/react-table').StockFeatures, Employee, any>[] & [import('@tanstack/react-table').DisplayColumnDef<import('@tanstack/react-table').StockFeatures, Employee, unknown>, ...(import('@tanstack/react-table').ColumnDef<import('@tanstack/react-table').StockFeatures, Employee, any> & (import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, string> | import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, "Full-time" | "Part-time" | "Freelance" | "Contractor"> | import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, {
|
|
12
|
+
name: string;
|
|
13
|
+
position: string;
|
|
14
|
+
team: string;
|
|
15
|
+
} | null> | import('@tanstack/react-table').AccessorKeyColumnDef<import('@tanstack/react-table').StockFeatures, Employee, "active" | "inactive" | "onboarding" | "offboarding" | "retired">))[]];
|
|
@@ -1,7 +1,142 @@
|
|
|
1
1
|
import { Employee } from './employee-data.js';
|
|
2
|
+
export declare const employeeTableFeatures: {
|
|
3
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
4
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
5
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
6
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
7
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
8
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
9
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
10
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
11
|
+
};
|
|
2
12
|
/**
|
|
3
13
|
* Creates optimized checkbox column with stable handlers to prevent unnecessary re-renders
|
|
4
14
|
*/
|
|
5
|
-
export declare const createCheckboxColumn: () => import('@tanstack/react-table').DisplayColumnDef<
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
export declare const createCheckboxColumn: () => import('@tanstack/react-table').DisplayColumnDef<{
|
|
16
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
17
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
18
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
19
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
20
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
21
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
22
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
23
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
24
|
+
}, Employee, unknown>;
|
|
25
|
+
export declare const employeeColumns: import('@tanstack/react-table').ColumnDef<{
|
|
26
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
27
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
28
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
29
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
30
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
31
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
32
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
33
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
34
|
+
}, Employee, any>[] & [import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
35
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
36
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
37
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
38
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
39
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
40
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
41
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
42
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
43
|
+
}, Employee, string>, import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
44
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
45
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
46
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
47
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
48
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
49
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
50
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
51
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
52
|
+
}, Employee, "Full-time" | "Part-time" | "Freelance" | "Contractor">, import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
53
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
54
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
55
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
56
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
57
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
58
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
59
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
60
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
61
|
+
}, Employee, {
|
|
62
|
+
name: string;
|
|
63
|
+
position: string;
|
|
64
|
+
team: string;
|
|
65
|
+
} | null>, import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
66
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
67
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
68
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
69
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
70
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
71
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
72
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
73
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
74
|
+
}, Employee, "active" | "inactive" | "onboarding" | "offboarding" | "retired">];
|
|
75
|
+
export declare const employeeColumnsWithCheckbox: import('@tanstack/react-table').ColumnDef<{
|
|
76
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
77
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
78
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
79
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
80
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
81
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
82
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
83
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
84
|
+
}, Employee, any>[] & [import('@tanstack/react-table').DisplayColumnDef<{
|
|
85
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
86
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
87
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
88
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
89
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
90
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
91
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
92
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
93
|
+
}, Employee, unknown>, ...(import('@tanstack/react-table').ColumnDef<{
|
|
94
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
95
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
96
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
97
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
98
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
99
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
100
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
101
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
102
|
+
}, Employee, any> & (import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
103
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
104
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
105
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
106
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
107
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
108
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
109
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
110
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
111
|
+
}, Employee, string> | import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
112
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
113
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
114
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
115
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
116
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
117
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
118
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
119
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
120
|
+
}, Employee, "Full-time" | "Part-time" | "Freelance" | "Contractor"> | import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
121
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
122
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
123
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
124
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
125
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
126
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
127
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
128
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
129
|
+
}, Employee, {
|
|
130
|
+
name: string;
|
|
131
|
+
position: string;
|
|
132
|
+
team: string;
|
|
133
|
+
} | null> | import('@tanstack/react-table').AccessorKeyColumnDef<{
|
|
134
|
+
columnFilteringFeature: import('@tanstack/react-table').TableFeature;
|
|
135
|
+
columnVisibilityFeature: import('@tanstack/react-table').TableFeature;
|
|
136
|
+
filteredRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
137
|
+
paginatedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
138
|
+
rowPaginationFeature: import('@tanstack/react-table').TableFeature;
|
|
139
|
+
rowSelectionFeature: import('@tanstack/react-table').TableFeature;
|
|
140
|
+
rowSortingFeature: import('@tanstack/react-table').TableFeature;
|
|
141
|
+
sortedRowModel: (table: import('@tanstack/react-table').Table<any, any>) => () => import('@tanstack/react-table').RowModel<any, any>;
|
|
142
|
+
}, Employee, "active" | "inactive" | "onboarding" | "offboarding" | "retired">))[]];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Header } from '@tanstack/react-table';
|
|
1
|
+
import { Column_RowSorting, Header, RowData, TableFeatures } from '@tanstack/react-table';
|
|
2
2
|
import { ActionableProps } from '../../actionable/Actionable.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type SortableHeader<TFeatures extends TableFeatures, TData extends RowData, TValue> = Header<TFeatures, TData, TValue> & {
|
|
4
|
+
column: Header<TFeatures, TData, TValue>['column'] & Pick<Column_RowSorting<TFeatures, TData>, 'getCanSort' | 'getIsSorted' | 'getToggleSortingHandler'>;
|
|
5
|
+
};
|
|
6
|
+
declare function isSortableHeader<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): header is SortableHeader<TFeatures, TData, TValue>;
|
|
7
|
+
export interface ColumnSortHeaderProps<TFeatures extends TableFeatures, TData extends RowData, TValue> extends ActionableProps {
|
|
8
|
+
header: SortableHeader<TFeatures, TData, TValue>;
|
|
5
9
|
}
|
|
6
|
-
declare function ColumnSortHeader<TData, TValue>({ children, header, ...props }: ColumnSortHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function ColumnSortHeader<TFeatures extends TableFeatures, TData extends RowData, TValue>({ children, header, ...props }: ColumnSortHeaderProps<TFeatures, TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
declare namespace ColumnSortHeader {
|
|
8
12
|
var displayName: string;
|
|
9
13
|
}
|
|
10
|
-
export { ColumnSortHeader };
|
|
14
|
+
export { ColumnSortHeader, isSortableHeader };
|
|
@@ -3,23 +3,29 @@ import { Icon as t } from "../../icon/Icon.js";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/data-table/parts/ColumnSortHeader.tsx
|
|
6
|
-
function a(
|
|
6
|
+
function a(e) {
|
|
7
|
+
return "getCanSort" in e.column && typeof e.column.getCanSort == "function" && e.column.getCanSort();
|
|
8
|
+
}
|
|
9
|
+
function o({ children: a, header: o, ...s }) {
|
|
7
10
|
return /* @__PURE__ */ r(e, {
|
|
8
11
|
...s,
|
|
9
12
|
className: "uy:flex uy:items-center uy:gap-50",
|
|
10
|
-
onPress: () => {
|
|
11
|
-
o.column.
|
|
13
|
+
onPress: (e) => {
|
|
14
|
+
o.column.getToggleSortingHandler()?.(e);
|
|
12
15
|
},
|
|
13
|
-
children: ({ isHovered: e }) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
children: ({ isHovered: e }) => {
|
|
17
|
+
let s = o.column.getIsSorted();
|
|
18
|
+
return /* @__PURE__ */ i(n, { children: [a, o.column.getCanSort() && (s || e) ? /* @__PURE__ */ r(t, {
|
|
19
|
+
src: s === "asc" ? "ArrowUpOutlined" : "ArrowDownOutlined",
|
|
20
|
+
role: "presentation",
|
|
21
|
+
size: 20
|
|
22
|
+
}) : /* @__PURE__ */ r("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "uy:size-250 uy:block"
|
|
25
|
+
})] });
|
|
26
|
+
}
|
|
21
27
|
});
|
|
22
28
|
}
|
|
23
|
-
|
|
29
|
+
o.displayName = "ColumnSortHeader";
|
|
24
30
|
//#endregion
|
|
25
|
-
export {
|
|
31
|
+
export { o as ColumnSortHeader, a as isSortableHeader };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactTable as TableType, RowData, TableFeatures } from '@tanstack/react-table';
|
|
2
2
|
import { ActionBarActionItem } from '../../action-bar/ActionBar.js';
|
|
3
|
-
export interface DataTableBulkActionsProps<TData> {
|
|
3
|
+
export interface DataTableBulkActionsProps<TFeatures extends TableFeatures, TData extends RowData> {
|
|
4
4
|
/** The table instance from @tanstack/react-table */
|
|
5
|
-
table: TableType<TData
|
|
5
|
+
table: TableType<TFeatures, TData> & {
|
|
6
|
+
getIsAllPageRowsSelected: () => boolean;
|
|
7
|
+
getIsSomePageRowsSelected: () => boolean;
|
|
8
|
+
getSelectedRowModel: () => {
|
|
9
|
+
rows: unknown[];
|
|
10
|
+
};
|
|
11
|
+
resetRowSelection: () => void;
|
|
12
|
+
};
|
|
6
13
|
/** Bulk actions to perform over the table, rendered in the action bar */
|
|
7
14
|
actions: ActionBarActionItem[];
|
|
8
15
|
/**
|
|
@@ -50,6 +57,7 @@ export interface DataTableBulkActionsProps<TData> {
|
|
|
50
57
|
* }
|
|
51
58
|
* ```
|
|
52
59
|
* @remarks
|
|
60
|
+
* - DataTableBulkActions automatically reserves space when the table includes `rowPaginationFeature`, matching the pagination footer rendered by DataTable
|
|
53
61
|
* - Use F6 keyboard shortcut to focus the action bar when it's visible and has actions
|
|
54
62
|
* - The keyboard shortcut provides quick access to bulk actions for users with disabilities
|
|
55
63
|
* - When triggered, focus moves to the first focusable element in the action bar (typically the first action button)
|
|
@@ -59,7 +67,7 @@ export interface DataTableBulkActionsProps<TData> {
|
|
|
59
67
|
* @see {@link DataTableBulkActionsProps} for all available props
|
|
60
68
|
* @see Source code in [Github](https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/data-table)
|
|
61
69
|
*/
|
|
62
|
-
declare function DataTableBulkActions<TData extends
|
|
70
|
+
declare function DataTableBulkActions<TFeatures extends TableFeatures, TData extends RowData>({ table, actions, renderSelectionText, }: DataTableBulkActionsProps<TFeatures, TData>): import("react/jsx-runtime").JSX.Element;
|
|
63
71
|
declare namespace DataTableBulkActions {
|
|
64
72
|
var displayName: string;
|
|
65
73
|
}
|