lecom-ui 5.4.39 → 5.4.40
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/components/DataTable/DataTable.js +14 -4
- package/dist/index.d.ts +13 -10
- package/package.json +1 -1
|
@@ -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,11 @@ 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,
|
|
58
66
|
state: {
|
|
59
67
|
sorting,
|
|
60
68
|
expanded
|
|
@@ -65,8 +73,10 @@ function DataTable({
|
|
|
65
73
|
memorizedColumns,
|
|
66
74
|
handleExpandedChange,
|
|
67
75
|
sorting,
|
|
76
|
+
setSorting,
|
|
68
77
|
expanded,
|
|
69
|
-
expandedContent
|
|
78
|
+
expandedContent,
|
|
79
|
+
manualSorting
|
|
70
80
|
]
|
|
71
81
|
);
|
|
72
82
|
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
|
};
|
|
@@ -787,9 +790,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
|
|
|
787
790
|
}
|
|
788
791
|
|
|
789
792
|
declare const inputVariants: (props?: ({
|
|
790
|
-
variant?: "
|
|
791
|
-
size?: "
|
|
792
|
-
radius?: "
|
|
793
|
+
variant?: "filled" | "default" | "borderless" | null | undefined;
|
|
794
|
+
size?: "small" | "large" | "default" | null | undefined;
|
|
795
|
+
radius?: "small" | "large" | "default" | "full" | null | undefined;
|
|
793
796
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
794
797
|
interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
|
|
795
798
|
sufix?: React$1.ReactNode;
|
|
@@ -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<
|
|
1001
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLOListElement | HTMLLIElement | HTMLAnchorElement | HTMLSpanElement | HTMLDivElement | HTMLHeadingElement | HTMLParagraphElement | HTMLLabelElement | HTMLInputElement | HTMLUListElement | 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 | HTMLVideoElement>, "id" | "onResize"> & {
|
|
999
1002
|
className?: string;
|
|
1000
1003
|
collapsedSize?: number | undefined;
|
|
1001
1004
|
collapsible?: boolean | undefined;
|
|
@@ -1161,9 +1164,9 @@ declare const TabsTrigger: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.
|
|
|
1161
1164
|
declare const TabsContent: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
1162
1165
|
|
|
1163
1166
|
declare const textareaVariants: (props?: ({
|
|
1164
|
-
variant?: "
|
|
1165
|
-
size?: "
|
|
1166
|
-
radius?: "
|
|
1167
|
+
variant?: "filled" | "default" | "borderless" | null | undefined;
|
|
1168
|
+
size?: "small" | "large" | "default" | null | undefined;
|
|
1169
|
+
radius?: "small" | "large" | "default" | "full" | null | undefined;
|
|
1167
1170
|
resize?: "default" | "both" | "horizontal" | "vertical" | "vertical-limited" | null | undefined;
|
|
1168
1171
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1169
1172
|
interface TextareaProps extends React$1.ComponentProps<'textarea'>, VariantProps<typeof textareaVariants> {
|
|
@@ -1353,7 +1356,7 @@ interface DateInputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputEleme
|
|
|
1353
1356
|
declare const DateInput: React$1.ForwardRefExoticComponent<DateInputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
1354
1357
|
|
|
1355
1358
|
declare const badgeVariants: (props?: ({
|
|
1356
|
-
variant?: "
|
|
1359
|
+
variant?: "destructive" | "default" | "outline" | "secondary" | null | undefined;
|
|
1357
1360
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1358
1361
|
interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
1359
1362
|
}
|