@onesaz/ui 0.3.12 → 0.3.13
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/index.d.ts +25 -20
- package/dist/index.js +179 -23
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -752,17 +752,13 @@ interface ComboboxOption {
|
|
|
752
752
|
type ComboboxPrimitiveOption = string;
|
|
753
753
|
type ComboboxObjectOption = object;
|
|
754
754
|
type ComboboxOptionInput = ComboboxPrimitiveOption | ComboboxObjectOption;
|
|
755
|
-
interface
|
|
755
|
+
interface ComboboxSharedProps<T extends ComboboxOptionInput = ComboboxOptionInput> {
|
|
756
756
|
options: T[];
|
|
757
|
-
value?: T | null;
|
|
758
|
-
defaultValue?: T | null;
|
|
759
|
-
onChange?: (value: T | null) => void;
|
|
760
757
|
placeholder?: string;
|
|
761
758
|
searchPlaceholder?: string;
|
|
762
759
|
emptyMessage?: string;
|
|
763
760
|
disabled?: boolean;
|
|
764
761
|
className?: string;
|
|
765
|
-
multiple?: false;
|
|
766
762
|
clearable?: boolean;
|
|
767
763
|
openOnFocus?: boolean;
|
|
768
764
|
inputValue?: string;
|
|
@@ -770,29 +766,30 @@ interface ComboboxSingleProps<T extends ComboboxOptionInput = ComboboxOptionInpu
|
|
|
770
766
|
simpleOptions?: boolean;
|
|
771
767
|
labelKey?: string;
|
|
772
768
|
valueKey?: string;
|
|
769
|
+
/** Node rendered at the start (left) of the trigger button */
|
|
770
|
+
startAdornment?: React.ReactNode;
|
|
771
|
+
/** Click handler for the start adornment — renders it as a button when provided */
|
|
772
|
+
onStartAdornmentClick?: (e: React.MouseEvent) => void;
|
|
773
|
+
/** Node rendered at the end (right) of the trigger button, before the chevron */
|
|
774
|
+
endAdornment?: React.ReactNode;
|
|
775
|
+
/** Click handler for the end adornment — renders it as a button when provided */
|
|
776
|
+
onEndAdornmentClick?: (e: React.MouseEvent) => void;
|
|
773
777
|
}
|
|
774
|
-
interface
|
|
775
|
-
|
|
778
|
+
interface ComboboxSingleProps<T extends ComboboxOptionInput = ComboboxOptionInput> extends ComboboxSharedProps<T> {
|
|
779
|
+
value?: T | null;
|
|
780
|
+
defaultValue?: T | null;
|
|
781
|
+
onChange?: (value: T | null) => void;
|
|
782
|
+
multiple?: false;
|
|
783
|
+
}
|
|
784
|
+
interface ComboboxMultipleProps<T extends ComboboxOptionInput = ComboboxOptionInput> extends ComboboxSharedProps<T> {
|
|
776
785
|
value?: T[];
|
|
777
786
|
defaultValue?: T[];
|
|
778
787
|
onChange?: (value: T[]) => void;
|
|
779
|
-
placeholder?: string;
|
|
780
|
-
searchPlaceholder?: string;
|
|
781
|
-
emptyMessage?: string;
|
|
782
|
-
disabled?: boolean;
|
|
783
|
-
className?: string;
|
|
784
788
|
multiple: true;
|
|
785
|
-
clearable?: boolean;
|
|
786
|
-
openOnFocus?: boolean;
|
|
787
|
-
inputValue?: string;
|
|
788
|
-
onInputChange?: (value: string) => void;
|
|
789
789
|
/** Show select-all option */
|
|
790
790
|
selectAll?: boolean;
|
|
791
791
|
/** Label for select-all option */
|
|
792
792
|
selectAllLabel?: string;
|
|
793
|
-
simpleOptions?: boolean;
|
|
794
|
-
labelKey?: string;
|
|
795
|
-
valueKey?: string;
|
|
796
793
|
/** Maximum number of items to display as chips before showing "+N more" */
|
|
797
794
|
maxDisplayItems?: number;
|
|
798
795
|
}
|
|
@@ -822,6 +819,8 @@ interface GridColDef<TData = any> {
|
|
|
822
819
|
scrollable?: boolean;
|
|
823
820
|
maxCellHeight?: number;
|
|
824
821
|
cellClassName?: string;
|
|
822
|
+
colSpan?: number | ((params: GridSpanParams<TData>) => number | undefined);
|
|
823
|
+
rowSpan?: boolean | ((params: GridSpanParams<TData>) => number | undefined);
|
|
825
824
|
export?: boolean;
|
|
826
825
|
hideExport?: boolean;
|
|
827
826
|
disableExport?: boolean;
|
|
@@ -843,6 +842,12 @@ interface GridValueGetterParams<TData = any> {
|
|
|
843
842
|
interface GridValueFormatterParams {
|
|
844
843
|
value: any;
|
|
845
844
|
}
|
|
845
|
+
interface GridSpanParams<TData = any> {
|
|
846
|
+
row: TData;
|
|
847
|
+
value: any;
|
|
848
|
+
field: string;
|
|
849
|
+
rowIndex: number;
|
|
850
|
+
}
|
|
846
851
|
interface PaginationModel {
|
|
847
852
|
page: number;
|
|
848
853
|
pageSize: number;
|
|
@@ -1722,4 +1727,4 @@ declare const RailPanelItem: React.ForwardRefExoticComponent<RailPanelItemProps
|
|
|
1722
1727
|
|
|
1723
1728
|
declare const Playground: () => react_jsx_runtime.JSX.Element;
|
|
1724
1729
|
|
|
1725
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, AreaChart, type AreaChartProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartProps, Box, type BoxProps, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbPage, type BreadcrumbPageProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Caption, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, type CircularProgressProps, type ColumnGroupModel, type ColumnVisibilityModel, Combobox, type ComboboxMultipleProps, type ComboboxOption, type ComboboxProps, type ComboboxSingleProps, DataGrid, type DataGridProps, DataGrid as DataGridV0, DialogNamespace as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DonutChart, type DonutChartProps, Drawer, DrawerBody, type DrawerBodyProps, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, type DrawerFooterProps, DrawerHeader, type DrawerHeaderProps, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, FormControl, type FormControlProps, FormGroup, type FormGroupProps, FormHelperText, type FormHelperTextProps, FormLabel, type FormLabelProps, Grid, type GridColDef, type GridProps, type GridRenderCellParams, type GridRenderHeaderParams, type GridRowSelectionModel, type GridValueFormatterParams, type GridValueGetterParams, H1, H2, H3, H4, H5, H6, HStack, IconButton, type IconButtonProps, IconRail, IconRailContent, type IconRailContentProps, IconRailFooter, type IconRailFooterProps, IconRailHeader, type IconRailHeaderProps, IconRailItem, type IconRailItemProps, type IconRailProps, Input, InputAdornment, type InputAdornmentProps, type InputProps, Label, type LabelProps, LineChart, type LineChartProps, LinearProgress, type LinearProgressProps, List, ListDivider, type ListDividerProps, ListItem, ListItemAvatar, type ListItemAvatarProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MultiProgressDonut, type MultiProgressDonutProps, NativeSelect, NativeSelectOption, type NativeSelectOptionProps, type NativeSelectProps, PaginationNamespace as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, type PaginationLinkProps, type PaginationModel, PaginationNext, PaginationPrevious, type PaginationProps, PieChart, type PieChartProps, type PinnedColumnsModel, type PinnedRowsModel, Playground, Progress, ProgressCard, type ProgressCardProps, ProgressDonut, type ProgressDonutProps, type ProgressProps, RadarChart, type RadarChartProps, Radio, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, type RadioProps, RailPanel, RailPanelGroup, type RailPanelGroupProps, RailPanelItem, type RailPanelItemProps, type RailPanelProps, ScatterChart, type ScatterChartProps, SelectNamespace as Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarRail, type SidebarRailProps, SidebarSubMenu, type SidebarSubMenuProps, SidebarToggle, type SidebarToggleProps, Skeleton, SkeletonAvatar, type SkeletonAvatarProps, SkeletonCard, type SkeletonCardProps, type SkeletonProps, SkeletonTableRow, type SkeletonTableRowProps, SkeletonText, type SkeletonTextProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stack, type StackProps, Switch, type SwitchProps, TableNamespace as Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, TextField, type TextFieldProps, Textarea, type TextareaProps, ThemeContext, type ThemeContextValue, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipArrow, TooltipContent, type TooltipContentProps, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, TopBar, TopBarBrand, type TopBarBrandProps, TopBarDivider, type TopBarDividerProps, TopBarNav, TopBarNavItem, type TopBarNavItemProps, type TopBarNavProps, type TopBarProps, TopBarSection, type TopBarSectionProps, Typography, type TypographyProps, UnderlineTabsContent, UnderlineTabsList, UnderlineTabsTrigger, type UnderlineTabsTriggerProps, VStack, VerticalTabs, VerticalTabsContent, VerticalTabsGroupLabel, type VerticalTabsGroupLabelProps, VerticalTabsList, VerticalTabsTrigger, type VerticalTabsTriggerProps, cn, useFormControl, useSidebar, useSidebarRail, useTheme };
|
|
1730
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, type AlertDescriptionProps, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTitleProps, AreaChart, type AreaChartProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartProps, Box, type BoxProps, BreadcrumbEllipsis, type BreadcrumbEllipsisProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbPage, type BreadcrumbPageProps, BreadcrumbSeparator, type BreadcrumbSeparatorProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Caption, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, type CircularProgressProps, type ColumnGroupModel, type ColumnVisibilityModel, Combobox, type ComboboxMultipleProps, type ComboboxOption, type ComboboxProps, type ComboboxSingleProps, DataGrid, type DataGridProps, DataGrid as DataGridV0, DialogNamespace as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DonutChart, type DonutChartProps, Drawer, DrawerBody, type DrawerBodyProps, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, type DrawerFooterProps, DrawerHeader, type DrawerHeaderProps, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, FormControl, type FormControlProps, FormGroup, type FormGroupProps, FormHelperText, type FormHelperTextProps, FormLabel, type FormLabelProps, Grid, type GridColDef, type GridProps, type GridRenderCellParams, type GridRenderHeaderParams, type GridRowSelectionModel, type GridSpanParams, type GridValueFormatterParams, type GridValueGetterParams, H1, H2, H3, H4, H5, H6, HStack, IconButton, type IconButtonProps, IconRail, IconRailContent, type IconRailContentProps, IconRailFooter, type IconRailFooterProps, IconRailHeader, type IconRailHeaderProps, IconRailItem, type IconRailItemProps, type IconRailProps, Input, InputAdornment, type InputAdornmentProps, type InputProps, Label, type LabelProps, LineChart, type LineChartProps, LinearProgress, type LinearProgressProps, List, ListDivider, type ListDividerProps, ListItem, ListItemAvatar, type ListItemAvatarProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, MultiProgressDonut, type MultiProgressDonutProps, NativeSelect, NativeSelectOption, type NativeSelectOptionProps, type NativeSelectProps, PaginationNamespace as Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, type PaginationLinkProps, type PaginationModel, PaginationNext, PaginationPrevious, type PaginationProps, PieChart, type PieChartProps, type PinnedColumnsModel, type PinnedRowsModel, Playground, Progress, ProgressCard, type ProgressCardProps, ProgressDonut, type ProgressDonutProps, type ProgressProps, RadarChart, type RadarChartProps, Radio, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, type RadioProps, RailPanel, RailPanelGroup, type RailPanelGroupProps, RailPanelItem, type RailPanelItemProps, type RailPanelProps, ScatterChart, type ScatterChartProps, SelectNamespace as Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SeparatorProps, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarRail, type SidebarRailProps, SidebarSubMenu, type SidebarSubMenuProps, SidebarToggle, type SidebarToggleProps, Skeleton, SkeletonAvatar, type SkeletonAvatarProps, SkeletonCard, type SkeletonCardProps, type SkeletonProps, SkeletonTableRow, type SkeletonTableRowProps, SkeletonText, type SkeletonTextProps, Slider, type SliderProps, Spinner, type SpinnerProps, Stack, type StackProps, Switch, type SwitchProps, TableNamespace as Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Text, TextField, type TextFieldProps, Textarea, type TextareaProps, ThemeContext, type ThemeContextValue, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipArrow, TooltipContent, type TooltipContentProps, TooltipPortal, type TooltipProps, TooltipProvider, TooltipRoot, TooltipTrigger, TopBar, TopBarBrand, type TopBarBrandProps, TopBarDivider, type TopBarDividerProps, TopBarNav, TopBarNavItem, type TopBarNavItemProps, type TopBarNavProps, type TopBarProps, TopBarSection, type TopBarSectionProps, Typography, type TypographyProps, UnderlineTabsContent, UnderlineTabsList, UnderlineTabsTrigger, type UnderlineTabsTriggerProps, VStack, VerticalTabs, VerticalTabsContent, VerticalTabsGroupLabel, type VerticalTabsGroupLabelProps, VerticalTabsList, VerticalTabsTrigger, type VerticalTabsTriggerProps, cn, useFormControl, useSidebar, useSidebarRail, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -3474,6 +3474,27 @@ import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs19 } from "react/jsx-r
|
|
|
3474
3474
|
function isMultipleProps(props) {
|
|
3475
3475
|
return props.multiple === true;
|
|
3476
3476
|
}
|
|
3477
|
+
function Adornment({
|
|
3478
|
+
children,
|
|
3479
|
+
onClick,
|
|
3480
|
+
className
|
|
3481
|
+
}) {
|
|
3482
|
+
if (onClick) {
|
|
3483
|
+
return /* @__PURE__ */ jsx34(
|
|
3484
|
+
"button",
|
|
3485
|
+
{
|
|
3486
|
+
type: "button",
|
|
3487
|
+
onClick: (e) => {
|
|
3488
|
+
e.stopPropagation();
|
|
3489
|
+
onClick(e);
|
|
3490
|
+
},
|
|
3491
|
+
className: cn("shrink-0 rounded p-0.5 hover:bg-muted", className),
|
|
3492
|
+
children
|
|
3493
|
+
}
|
|
3494
|
+
);
|
|
3495
|
+
}
|
|
3496
|
+
return /* @__PURE__ */ jsx34("span", { className: cn("shrink-0 pointer-events-none opacity-50", className), children });
|
|
3497
|
+
}
|
|
3477
3498
|
var Combobox = React34.forwardRef(
|
|
3478
3499
|
(props, ref) => {
|
|
3479
3500
|
const {
|
|
@@ -3484,7 +3505,11 @@ var Combobox = React34.forwardRef(
|
|
|
3484
3505
|
disabled = false,
|
|
3485
3506
|
clearable = true,
|
|
3486
3507
|
openOnFocus = true,
|
|
3487
|
-
className
|
|
3508
|
+
className,
|
|
3509
|
+
startAdornment,
|
|
3510
|
+
onStartAdornmentClick,
|
|
3511
|
+
endAdornment,
|
|
3512
|
+
onEndAdornmentClick
|
|
3488
3513
|
} = props;
|
|
3489
3514
|
const labelKey = props.labelKey ?? "label";
|
|
3490
3515
|
const valueKey = props.valueKey ?? "value";
|
|
@@ -3653,6 +3678,7 @@ var Combobox = React34.forwardRef(
|
|
|
3653
3678
|
className
|
|
3654
3679
|
),
|
|
3655
3680
|
children: [
|
|
3681
|
+
startAdornment && /* @__PURE__ */ jsx34(Adornment, { onClick: onStartAdornmentClick, className: "mr-1.5", children: startAdornment }),
|
|
3656
3682
|
isMultiple ? /* @__PURE__ */ jsx34("div", { className: "flex flex-1 flex-wrap items-center gap-1", children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx34("span", { className: "text-muted-foreground", children: placeholder }) : /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3657
3683
|
displayedOptions.map((option) => /* @__PURE__ */ jsxs19(
|
|
3658
3684
|
"span",
|
|
@@ -3692,7 +3718,7 @@ var Combobox = React34.forwardRef(
|
|
|
3692
3718
|
remainingCount,
|
|
3693
3719
|
" more"
|
|
3694
3720
|
] })
|
|
3695
|
-
] }) }) : /* @__PURE__ */ jsx34("span", { className: cn(!singleValue && "text-muted-foreground"), children: singleValue ? getOptionLabel(singleValue) : placeholder }),
|
|
3721
|
+
] }) }) : /* @__PURE__ */ jsx34("span", { className: cn("flex-1", !singleValue && "text-muted-foreground"), children: singleValue ? getOptionLabel(singleValue) : placeholder }),
|
|
3696
3722
|
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-1", children: [
|
|
3697
3723
|
isMultiple && selectedOptions.length > 0 && /* @__PURE__ */ jsx34(
|
|
3698
3724
|
"button",
|
|
@@ -3743,6 +3769,7 @@ var Combobox = React34.forwardRef(
|
|
|
3743
3769
|
)
|
|
3744
3770
|
}
|
|
3745
3771
|
),
|
|
3772
|
+
endAdornment && /* @__PURE__ */ jsx34(Adornment, { onClick: onEndAdornmentClick, children: endAdornment }),
|
|
3746
3773
|
/* @__PURE__ */ jsx34(
|
|
3747
3774
|
"svg",
|
|
3748
3775
|
{
|
|
@@ -4001,7 +4028,9 @@ function convertColumns(columns, checkboxSelection) {
|
|
|
4001
4028
|
wrapText: col.wrapText,
|
|
4002
4029
|
scrollable: col.scrollable,
|
|
4003
4030
|
maxCellHeight: col.maxCellHeight,
|
|
4004
|
-
cellClassName: col.cellClassName
|
|
4031
|
+
cellClassName: col.cellClassName,
|
|
4032
|
+
colSpan: col.colSpan,
|
|
4033
|
+
rowSpan: col.rowSpan
|
|
4005
4034
|
}
|
|
4006
4035
|
};
|
|
4007
4036
|
tanstackColumns.push(tanstackCol);
|
|
@@ -4490,6 +4519,59 @@ var DataGridToolbar = ({
|
|
|
4490
4519
|
] })
|
|
4491
4520
|
] });
|
|
4492
4521
|
};
|
|
4522
|
+
function computeRowSpanMap(rows, columns) {
|
|
4523
|
+
const rowSpanColumns = columns.filter((col) => col.rowSpan);
|
|
4524
|
+
if (rowSpanColumns.length === 0) return void 0;
|
|
4525
|
+
const map = /* @__PURE__ */ new Map();
|
|
4526
|
+
rowSpanColumns.forEach((col) => {
|
|
4527
|
+
const colMap = /* @__PURE__ */ new Map();
|
|
4528
|
+
const field = col.field;
|
|
4529
|
+
if (typeof col.rowSpan === "function") {
|
|
4530
|
+
const rowSpanFn = col.rowSpan;
|
|
4531
|
+
let i = 0;
|
|
4532
|
+
while (i < rows.length) {
|
|
4533
|
+
const row = rows[i];
|
|
4534
|
+
const value = row.original ? row.original[field] : row[field];
|
|
4535
|
+
const span = rowSpanFn({ row: row.original || row, value, field, rowIndex: i });
|
|
4536
|
+
if (span && span > 1) {
|
|
4537
|
+
colMap.set(i, span);
|
|
4538
|
+
for (let j = 1; j < span && i + j < rows.length; j++) {
|
|
4539
|
+
colMap.set(i + j, 0);
|
|
4540
|
+
}
|
|
4541
|
+
i += span;
|
|
4542
|
+
} else {
|
|
4543
|
+
colMap.set(i, 1);
|
|
4544
|
+
i++;
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
} else if (col.rowSpan === true) {
|
|
4548
|
+
let i = 0;
|
|
4549
|
+
while (i < rows.length) {
|
|
4550
|
+
const row = rows[i];
|
|
4551
|
+
const value = row.original ? row.original[field] : row[field];
|
|
4552
|
+
let span = 1;
|
|
4553
|
+
while (i + span < rows.length) {
|
|
4554
|
+
const nextRow = rows[i + span];
|
|
4555
|
+
const nextValue = nextRow.original ? nextRow.original[field] : nextRow[field];
|
|
4556
|
+
if (nextValue === value) {
|
|
4557
|
+
span++;
|
|
4558
|
+
} else {
|
|
4559
|
+
break;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
colMap.set(i, span);
|
|
4563
|
+
for (let j = 1; j < span; j++) {
|
|
4564
|
+
colMap.set(i + j, 0);
|
|
4565
|
+
}
|
|
4566
|
+
i += span;
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
if (colMap.size > 0) {
|
|
4570
|
+
map.set(field, colMap);
|
|
4571
|
+
}
|
|
4572
|
+
});
|
|
4573
|
+
return map.size > 0 ? map : void 0;
|
|
4574
|
+
}
|
|
4493
4575
|
var RowRenderer = ({
|
|
4494
4576
|
row,
|
|
4495
4577
|
rowIndex,
|
|
@@ -4502,9 +4584,36 @@ var RowRenderer = ({
|
|
|
4502
4584
|
globalWrapText = false,
|
|
4503
4585
|
columnWidths,
|
|
4504
4586
|
pinnedColumnOffsets,
|
|
4505
|
-
isPinnedRow = false
|
|
4587
|
+
isPinnedRow = false,
|
|
4588
|
+
rowSpanMap,
|
|
4589
|
+
gridColumns
|
|
4506
4590
|
}) => {
|
|
4507
4591
|
const customClassName = getRowClassName?.({ row: row.original, rowIndex });
|
|
4592
|
+
const visibleCells = row.getVisibleCells();
|
|
4593
|
+
const colSpanSkipSet = /* @__PURE__ */ new Set();
|
|
4594
|
+
const colSpanValues = /* @__PURE__ */ new Map();
|
|
4595
|
+
if (gridColumns) {
|
|
4596
|
+
visibleCells.forEach((cell, cellIndex) => {
|
|
4597
|
+
if (colSpanSkipSet.has(cellIndex)) return;
|
|
4598
|
+
const meta = cell.column.columnDef.meta;
|
|
4599
|
+
const colSpanDef = meta?.colSpan;
|
|
4600
|
+
if (colSpanDef) {
|
|
4601
|
+
const value = cell.getValue();
|
|
4602
|
+
let span;
|
|
4603
|
+
if (typeof colSpanDef === "function") {
|
|
4604
|
+
span = colSpanDef({ row: row.original, value, field: cell.column.id, rowIndex });
|
|
4605
|
+
} else if (typeof colSpanDef === "number") {
|
|
4606
|
+
span = colSpanDef;
|
|
4607
|
+
}
|
|
4608
|
+
if (span && span > 1) {
|
|
4609
|
+
colSpanValues.set(cellIndex, span);
|
|
4610
|
+
for (let j = 1; j < span && cellIndex + j < visibleCells.length; j++) {
|
|
4611
|
+
colSpanSkipSet.add(cellIndex + j);
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4508
4617
|
return /* @__PURE__ */ jsx35(
|
|
4509
4618
|
"tr",
|
|
4510
4619
|
{
|
|
@@ -4521,7 +4630,16 @@ var RowRenderer = ({
|
|
|
4521
4630
|
row.toggleSelected();
|
|
4522
4631
|
}
|
|
4523
4632
|
},
|
|
4524
|
-
children:
|
|
4633
|
+
children: visibleCells.map((cell, cellIndex) => {
|
|
4634
|
+
if (colSpanSkipSet.has(cellIndex)) return null;
|
|
4635
|
+
const colId = cell.column.id;
|
|
4636
|
+
if (rowSpanMap) {
|
|
4637
|
+
const colRowSpan = rowSpanMap.get(colId);
|
|
4638
|
+
if (colRowSpan) {
|
|
4639
|
+
const spanValue = colRowSpan.get(rowIndex);
|
|
4640
|
+
if (spanValue === 0) return null;
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4525
4643
|
const meta = cell.column.columnDef.meta;
|
|
4526
4644
|
const align = meta?.align || "left";
|
|
4527
4645
|
const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
|
|
@@ -4531,23 +4649,46 @@ var RowRenderer = ({
|
|
|
4531
4649
|
const colWidth = columnWidths.get(cell.column.id);
|
|
4532
4650
|
const width = colWidth?.width || cell.column.getSize();
|
|
4533
4651
|
const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
|
|
4652
|
+
const htmlColSpan = colSpanValues.get(cellIndex);
|
|
4653
|
+
let htmlRowSpan;
|
|
4654
|
+
if (rowSpanMap) {
|
|
4655
|
+
const colRowSpan = rowSpanMap.get(colId);
|
|
4656
|
+
if (colRowSpan) {
|
|
4657
|
+
const spanValue = colRowSpan.get(rowIndex);
|
|
4658
|
+
if (spanValue && spanValue > 1) {
|
|
4659
|
+
htmlRowSpan = spanValue;
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4662
|
+
}
|
|
4663
|
+
let totalWidth = width;
|
|
4664
|
+
if (htmlColSpan && htmlColSpan > 1) {
|
|
4665
|
+
for (let j = 1; j < htmlColSpan && cellIndex + j < visibleCells.length; j++) {
|
|
4666
|
+
const spannedCell = visibleCells[cellIndex + j];
|
|
4667
|
+
const spannedColWidth = columnWidths.get(spannedCell.column.id);
|
|
4668
|
+
totalWidth += spannedColWidth?.width || spannedCell.column.getSize();
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4534
4671
|
return /* @__PURE__ */ jsx35(
|
|
4535
4672
|
"td",
|
|
4536
4673
|
{
|
|
4674
|
+
colSpan: htmlColSpan,
|
|
4675
|
+
rowSpan: htmlRowSpan,
|
|
4537
4676
|
className: cn(
|
|
4538
|
-
"px-4 overflow-hidden",
|
|
4539
|
-
showCellVerticalBorder && "border-r
|
|
4677
|
+
"px-4 overflow-hidden border-b border-border",
|
|
4678
|
+
showCellVerticalBorder && "border-r border-border",
|
|
4540
4679
|
pinnedInfo && "sticky z-[1] bg-background",
|
|
4541
4680
|
pinnedInfo?.side === "left" && "border-r border-border",
|
|
4542
|
-
pinnedInfo?.side === "right" && "border-l border-border"
|
|
4681
|
+
pinnedInfo?.side === "right" && "border-l border-border",
|
|
4682
|
+
htmlRowSpan && htmlRowSpan > 1 && "align-middle"
|
|
4543
4683
|
),
|
|
4544
4684
|
style: {
|
|
4545
|
-
height: wrapText || scrollable ?
|
|
4685
|
+
height: htmlRowSpan && htmlRowSpan > 1 ? rowHeight * htmlRowSpan : wrapText || scrollable ? void 0 : rowHeight,
|
|
4546
4686
|
minHeight: rowHeight,
|
|
4547
4687
|
textAlign: align,
|
|
4548
|
-
width,
|
|
4549
|
-
maxWidth: colWidth?.maxWidth || width,
|
|
4688
|
+
width: htmlColSpan && htmlColSpan > 1 ? totalWidth : width,
|
|
4689
|
+
maxWidth: htmlColSpan && htmlColSpan > 1 ? void 0 : colWidth?.maxWidth || width,
|
|
4550
4690
|
minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
|
|
4691
|
+
verticalAlign: htmlRowSpan && htmlRowSpan > 1 ? "middle" : void 0,
|
|
4551
4692
|
...pinnedInfo ? {
|
|
4552
4693
|
position: "sticky",
|
|
4553
4694
|
[pinnedInfo.side]: pinnedInfo.offset,
|
|
@@ -4565,10 +4706,7 @@ var RowRenderer = ({
|
|
|
4565
4706
|
style: {
|
|
4566
4707
|
maxHeight: scrollable ? `${maxCellHeight}px` : void 0
|
|
4567
4708
|
},
|
|
4568
|
-
title: (
|
|
4569
|
-
// Show tooltip for truncated simple text values (not for scrollable or wrapped content)
|
|
4570
|
-
!wrapText && !scrollable && (typeof cell.getValue() === "string" || typeof cell.getValue() === "number") ? String(cell.getValue()) : void 0
|
|
4571
|
-
),
|
|
4709
|
+
title: !wrapText && !scrollable && (typeof cell.getValue() === "string" || typeof cell.getValue() === "number") ? String(cell.getValue()) : void 0,
|
|
4572
4710
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
4573
4711
|
}
|
|
4574
4712
|
)
|
|
@@ -4591,7 +4729,9 @@ var VirtualizedTableBody = ({
|
|
|
4591
4729
|
parentRef,
|
|
4592
4730
|
globalWrapText = false,
|
|
4593
4731
|
columnWidths,
|
|
4594
|
-
pinnedColumnOffsets
|
|
4732
|
+
pinnedColumnOffsets,
|
|
4733
|
+
rowSpanMap,
|
|
4734
|
+
gridColumns
|
|
4595
4735
|
}) => {
|
|
4596
4736
|
const rows = table.getRowModel().rows;
|
|
4597
4737
|
const virtualizer = useVirtualizer({
|
|
@@ -4635,7 +4775,9 @@ var VirtualizedTableBody = ({
|
|
|
4635
4775
|
getRowClassName,
|
|
4636
4776
|
globalWrapText,
|
|
4637
4777
|
columnWidths,
|
|
4638
|
-
pinnedColumnOffsets
|
|
4778
|
+
pinnedColumnOffsets,
|
|
4779
|
+
rowSpanMap,
|
|
4780
|
+
gridColumns
|
|
4639
4781
|
},
|
|
4640
4782
|
row.id
|
|
4641
4783
|
);
|
|
@@ -4658,7 +4800,9 @@ var StandardTableBody = ({
|
|
|
4658
4800
|
getRowClassName,
|
|
4659
4801
|
globalWrapText = false,
|
|
4660
4802
|
columnWidths,
|
|
4661
|
-
pinnedColumnOffsets
|
|
4803
|
+
pinnedColumnOffsets,
|
|
4804
|
+
rowSpanMap,
|
|
4805
|
+
gridColumns
|
|
4662
4806
|
}) => {
|
|
4663
4807
|
const rows = table.getRowModel().rows;
|
|
4664
4808
|
if (rows.length === 0) {
|
|
@@ -4683,7 +4827,9 @@ var StandardTableBody = ({
|
|
|
4683
4827
|
getRowClassName,
|
|
4684
4828
|
globalWrapText,
|
|
4685
4829
|
columnWidths,
|
|
4686
|
-
pinnedColumnOffsets
|
|
4830
|
+
pinnedColumnOffsets,
|
|
4831
|
+
rowSpanMap,
|
|
4832
|
+
gridColumns
|
|
4687
4833
|
},
|
|
4688
4834
|
row.id
|
|
4689
4835
|
)) });
|
|
@@ -4742,8 +4888,8 @@ var PinnedRowsRenderer = ({
|
|
|
4742
4888
|
"td",
|
|
4743
4889
|
{
|
|
4744
4890
|
className: cn(
|
|
4745
|
-
"px-4 overflow-hidden bg-muted/60",
|
|
4746
|
-
showCellVerticalBorder && "border-r
|
|
4891
|
+
"px-4 overflow-hidden bg-muted/60 border-b border-border",
|
|
4892
|
+
showCellVerticalBorder && "border-r border-border",
|
|
4747
4893
|
pinnedInfo && "sticky z-[3]",
|
|
4748
4894
|
pinnedInfo?.side === "left" && "border-r border-border",
|
|
4749
4895
|
pinnedInfo?.side === "right" && "border-l border-border"
|
|
@@ -5061,6 +5207,12 @@ function DataGrid({
|
|
|
5061
5207
|
const showExport = slotProps?.toolbar?.showExport !== false;
|
|
5062
5208
|
const customButtons = slotProps?.toolbar?.customButtons;
|
|
5063
5209
|
const moreOptions = slotProps?.toolbar?.moreOptions || [];
|
|
5210
|
+
const rowSpanMap = React35.useMemo(() => {
|
|
5211
|
+
const hasRowSpan = columns.some((col) => col.rowSpan);
|
|
5212
|
+
if (!hasRowSpan) return void 0;
|
|
5213
|
+
return computeRowSpanMap(table.getRowModel().rows, columns);
|
|
5214
|
+
}, [table.getRowModel().rows, columns]);
|
|
5215
|
+
const hasColSpan = React35.useMemo(() => columns.some((col) => col.colSpan), [columns]);
|
|
5064
5216
|
const containerStyle = {
|
|
5065
5217
|
...sx
|
|
5066
5218
|
};
|
|
@@ -5215,7 +5367,9 @@ function DataGrid({
|
|
|
5215
5367
|
parentRef: tableContainerRef,
|
|
5216
5368
|
globalWrapText: wrapText,
|
|
5217
5369
|
columnWidths,
|
|
5218
|
-
pinnedColumnOffsets
|
|
5370
|
+
pinnedColumnOffsets,
|
|
5371
|
+
rowSpanMap,
|
|
5372
|
+
gridColumns: hasColSpan ? columns : void 0
|
|
5219
5373
|
}
|
|
5220
5374
|
) : /* @__PURE__ */ jsx35(
|
|
5221
5375
|
StandardTableBody,
|
|
@@ -5228,7 +5382,9 @@ function DataGrid({
|
|
|
5228
5382
|
getRowClassName,
|
|
5229
5383
|
globalWrapText: wrapText,
|
|
5230
5384
|
columnWidths,
|
|
5231
|
-
pinnedColumnOffsets
|
|
5385
|
+
pinnedColumnOffsets,
|
|
5386
|
+
rowSpanMap,
|
|
5387
|
+
gridColumns: hasColSpan ? columns : void 0
|
|
5232
5388
|
}
|
|
5233
5389
|
),
|
|
5234
5390
|
pinnedBottomTable && pinnedBottomTable.length > 0 && /* @__PURE__ */ jsx35(
|