lecom-ui 4.8.2 → 4.8.3

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.
@@ -49,7 +49,7 @@ function buildColumns({
49
49
  if (!externalColumn.title) {
50
50
  return null;
51
51
  }
52
- const hasSort = !!externalColumn.onSort;
52
+ const hasSort = !!externalColumn.onSort || !!externalColumn.onSortClient;
53
53
  const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
54
54
  return /* @__PURE__ */ React.createElement(
55
55
  "div",
@@ -110,6 +110,13 @@ function buildColumns({
110
110
  width: externalColumn.width,
111
111
  fixed: externalColumn.fixed,
112
112
  truncate: !!externalColumn.truncate
113
+ },
114
+ sortingFn: (rowA, rowB, columnId) => {
115
+ if (externalColumn.onSortClient) {
116
+ return externalColumn.onSortClient({ rowA, rowB, columnId });
117
+ } else {
118
+ return 0;
119
+ }
113
120
  }
114
121
  }));
115
122
  return mappedColumns;
@@ -46,7 +46,8 @@ function Table({
46
46
  ),
47
47
  "data-header": header.id,
48
48
  "data-fixed": getFixed(header.column.columnDef.meta),
49
- style: styleColumn(header.column.columnDef.meta, "th")
49
+ style: styleColumn(header.column.columnDef.meta, "th"),
50
+ onClick: header.column.getToggleSortingHandler()
50
51
  },
51
52
  header.isPlaceholder ? null : flexRender(
52
53
  header.column.columnDef.header,
package/dist/index.d.ts CHANGED
@@ -331,6 +331,11 @@ interface ColumnSort<TData, TValue> {
331
331
  table: Table<TData>;
332
332
  column: Column$1<TData, TValue>;
333
333
  }
334
+ interface ColumnSortClient<TData> {
335
+ rowA: Row<TData>['row'];
336
+ rowB: Row<TData>['row'];
337
+ columnId: string;
338
+ }
334
339
  type ColumnTitle<TData, TValue> = ColumnSort<TData, TValue>;
335
340
  interface CheckedHeader<TData, TValue> {
336
341
  table: Table<TData>;
@@ -357,6 +362,7 @@ interface Column<TData, TValue> {
357
362
  truncate?: boolean;
358
363
  render?: (({ value, row }: ColumnRender<TData, TValue>) => React.ReactNode) | React.ReactNode;
359
364
  onSort?: ({ table, column }: ColumnSort<TData, TValue>) => void;
365
+ onSortClient?: ({ rowA, rowB, columnId }: ColumnSortClient<TData>) => number;
360
366
  checkedHeader?: ({ table, column }: CheckedHeader<TData, TValue>) => boolean;
361
367
  checkedCell?: ({ row }: CheckedCell<TData>) => boolean;
362
368
  onCheckedHeaderChange?: ({ table, column, value, }: CheckedHeaderChange<TData, TValue>) => void;
@@ -563,9 +569,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
563
569
  }
564
570
 
565
571
  declare const inputVariants: (props?: ({
566
- variant?: "filled" | "default" | "borderless" | null | undefined;
567
- size?: "small" | "large" | "default" | null | undefined;
568
- radius?: "small" | "large" | "default" | null | undefined;
572
+ variant?: "default" | "filled" | "borderless" | null | undefined;
573
+ size?: "default" | "small" | "large" | null | undefined;
574
+ radius?: "default" | "small" | "large" | null | undefined;
569
575
  } & class_variance_authority_types.ClassProp) | undefined) => string;
570
576
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
571
577
  sufix?: React$1.ReactNode;
@@ -822,4 +828,4 @@ declare const fonts: {
822
828
  };
823
829
 
824
830
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, Rpa, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tag, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, getPositionClass, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, toast, typographyVariants, useIsMobile, useNotificationToast, usePagination, useSidebar };
825
- export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnTitle, CustomStyles$1 as CustomStyles, DataTableProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagProps, TextColor, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
831
+ export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, CustomStyles$1 as CustomStyles, DataTableProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagProps, TextColor, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@radix-ui/react-slot": "^1.1.1",
37
37
  "@radix-ui/react-switch": "^1.1.2",
38
38
  "@radix-ui/react-tooltip": "^1.1.6",
39
- "@tanstack/react-table": "^8.20.6",
39
+ "@tanstack/react-table": "^8.21.2",
40
40
  "class-variance-authority": "^0.7.1",
41
41
  "clsx": "^2.1.1",
42
42
  "hex-color-opacity": "^0.4.2",