lecom-ui 5.4.39 → 5.4.41
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.
|
@@ -21,12 +21,19 @@ function DataTable({
|
|
|
21
21
|
onIsSelected,
|
|
22
22
|
expandedContent,
|
|
23
23
|
initialExpanded,
|
|
24
|
-
onExpandedChange
|
|
24
|
+
onExpandedChange,
|
|
25
|
+
sorting: controlledSorting,
|
|
26
|
+
onSortingChange: controlledOnSortingChange,
|
|
27
|
+
manualSorting = false
|
|
25
28
|
}) {
|
|
26
|
-
const [
|
|
29
|
+
const [internalSorting, setInternalSorting] = React.useState(
|
|
30
|
+
[]
|
|
31
|
+
);
|
|
27
32
|
const [expanded, setExpanded] = React.useState(
|
|
28
33
|
initialExpanded || {}
|
|
29
34
|
);
|
|
35
|
+
const sorting = controlledSorting ?? internalSorting;
|
|
36
|
+
const setSorting = controlledOnSortingChange ?? setInternalSorting;
|
|
30
37
|
const memorizedColumns = React.useMemo(
|
|
31
38
|
() => buildColumns({
|
|
32
39
|
columns,
|
|
@@ -51,10 +58,13 @@ function DataTable({
|
|
|
51
58
|
columns: memorizedColumns,
|
|
52
59
|
getCoreRowModel: getCoreRowModel(),
|
|
53
60
|
onSortingChange: setSorting,
|
|
54
|
-
getSortedRowModel: getSortedRowModel(),
|
|
61
|
+
...manualSorting ? {} : { getSortedRowModel: getSortedRowModel() },
|
|
55
62
|
getExpandedRowModel: getExpandedRowModel(),
|
|
56
63
|
enableExpanding: !!expandedContent,
|
|
57
64
|
onExpandedChange: handleExpandedChange,
|
|
65
|
+
manualSorting,
|
|
66
|
+
enableSortingRemoval: true,
|
|
67
|
+
enableMultiSort: false,
|
|
58
68
|
state: {
|
|
59
69
|
sorting,
|
|
60
70
|
expanded
|
|
@@ -65,8 +75,10 @@ function DataTable({
|
|
|
65
75
|
memorizedColumns,
|
|
66
76
|
handleExpandedChange,
|
|
67
77
|
sorting,
|
|
78
|
+
setSorting,
|
|
68
79
|
expanded,
|
|
69
|
-
expandedContent
|
|
80
|
+
expandedContent,
|
|
81
|
+
manualSorting
|
|
70
82
|
]
|
|
71
83
|
);
|
|
72
84
|
const table = useReactTable(tableConfig);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { Bar, BarChart, BarProps, CartesianGrid, Label, LabelList, LegendType, X
|
|
|
13
13
|
import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
|
|
14
14
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
15
15
|
import { FillColor as FillColor$1, BgColor as BgColor$1 } from '@/tokens/colors';
|
|
16
|
-
import { Table, Column as Column$1, Row as Row$1, ExpandedState } from '@tanstack/react-table';
|
|
16
|
+
import { Table, Column as Column$1, Row as Row$1, ExpandedState, SortingState, OnChangeFn } from '@tanstack/react-table';
|
|
17
17
|
export { ColumnDef } from '@tanstack/react-table';
|
|
18
18
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
19
19
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -412,6 +412,9 @@ interface DataTableProps<TData, TValue> {
|
|
|
412
412
|
expandedContent?: (row: Row$1<TData>) => React.ReactNode;
|
|
413
413
|
initialExpanded?: ExpandedState;
|
|
414
414
|
onExpandedChange?: (expanded: ExpandedState) => void;
|
|
415
|
+
sorting?: SortingState;
|
|
416
|
+
onSortingChange?: OnChangeFn<SortingState>;
|
|
417
|
+
manualSorting?: boolean;
|
|
415
418
|
}
|
|
416
419
|
interface Row<TData> {
|
|
417
420
|
row: Row$1<TData>;
|
|
@@ -457,7 +460,7 @@ interface TableProps<TData, TValue> {
|
|
|
457
460
|
expandedContent?: (row: Row$1<TData>) => React.ReactNode;
|
|
458
461
|
}
|
|
459
462
|
|
|
460
|
-
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, expandedContent, initialExpanded, onExpandedChange, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
463
|
+
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, expandedContent, initialExpanded, onExpandedChange, sorting: controlledSorting, onSortingChange: controlledOnSortingChange, manualSorting, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
461
464
|
declare const MemoizedDataTable: typeof DataTable & {
|
|
462
465
|
displayName?: string;
|
|
463
466
|
};
|
|
@@ -995,7 +998,7 @@ declare const RadioGroup: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimi
|
|
|
995
998
|
declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
996
999
|
|
|
997
1000
|
declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
|
|
998
|
-
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement |
|
|
1001
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLObjectElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableCaptionElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLLegendElement | HTMLLinkElement | HTMLMapElement | HTMLMenuElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPictureElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement>, "id" | "onResize"> & {
|
|
999
1002
|
className?: string;
|
|
1000
1003
|
collapsedSize?: number | undefined;
|
|
1001
1004
|
collapsible?: boolean | undefined;
|