@t3q-ui/design-system 1.59.2 → 1.59.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.
@@ -3067,7 +3067,7 @@ var Table = React12.forwardRef(
3067
3067
  "table",
3068
3068
  {
3069
3069
  ref,
3070
- className: cn("w-full table-fixed border-collapse border-spacing-0 border-0", className),
3070
+ className: cn("w-full table-auto border-collapse border-spacing-0 border-0", className),
3071
3071
  ...props
3072
3072
  }
3073
3073
  ) })
@@ -3976,6 +3976,8 @@ function AgGridContent() {
3976
3976
  columnTypes: userColumnTypes,
3977
3977
  onCellKeyDown,
3978
3978
  onRowClicked,
3979
+ onFirstDataRendered,
3980
+ fitColumnsToContent: fitToContent = true,
3979
3981
  ...restTableProps
3980
3982
  } = tableProps;
3981
3983
  const handleCellKeyDown = (e) => {
@@ -3986,6 +3988,10 @@ function AgGridContent() {
3986
3988
  if (!target?.matches(".ag-cell, .ag-full-width-row")) return;
3987
3989
  onRowClicked({ ...e, type: "rowClicked" });
3988
3990
  };
3991
+ const handleFirstDataRendered = (e) => {
3992
+ onFirstDataRendered?.(e);
3993
+ if (fitToContent && !restTableProps.autoSizeStrategy) fitColumnsToContent(e.api);
3994
+ };
3989
3995
  const mergedDefaultColDef = {
3990
3996
  ...userDefaultColDef,
3991
3997
  cellStyle: {
@@ -4004,12 +4010,14 @@ function AgGridContent() {
4004
4010
  );
4005
4011
  const columnDefs = useMemo(
4006
4012
  () => withTypeClasses(
4007
- withHeaderMinWidth(
4008
- withSortIconOffset(
4009
- // 남는 폭 분배(2026-11-08 홀드아웃 21 뒤 결정 1): 글자 열이 하나뿐이면 ID·날짜 같은 넓은 고정 열도 flex 를 받는다 — 그 뒤 withFlexFill 이
4010
- // 상한 있는 flex 열만 남았는지 본다(분배된 열은 상한이 없으므로 글자 열의 maxWidth 는 살아남는다)
4011
- withExplicitSortIcons(
4012
- withFlexFill(withBalancedFill(withNumberColumnWidth(restTableProps.columnDefs)))
4013
+ withWidthFloor(
4014
+ withHeaderMinWidth(
4015
+ withSortIconOffset(
4016
+ // 남는 폭 분배(2026-11-08 홀드아웃 21 뒤 결정 1): 글자 열이 하나뿐이면 ID·날짜 같은 넓은 고정 열도 flex 를 받는다 — 그 뒤 withFlexFill 이
4017
+ // 상한 있는 flex 열만 남았는지 본다(분배된 열은 상한이 없으므로 글자 열의 maxWidth 는 살아남는다)
4018
+ withExplicitSortIcons(
4019
+ withFlexFill(withBalancedFill(withNumberColumnWidth(restTableProps.columnDefs)))
4020
+ )
4013
4021
  )
4014
4022
  )
4015
4023
  ),
@@ -4029,6 +4037,7 @@ function AgGridContent() {
4029
4037
  columnDefs,
4030
4038
  onRowClicked,
4031
4039
  onCellKeyDown: handleCellKeyDown,
4040
+ onFirstDataRendered: handleFirstDataRendered,
4032
4041
  theme,
4033
4042
  className,
4034
4043
  domLayout: "normal"
@@ -4049,6 +4058,7 @@ function AgGridContent() {
4049
4058
  columnDefs,
4050
4059
  onRowClicked,
4051
4060
  onCellKeyDown: handleCellKeyDown,
4061
+ onFirstDataRendered: handleFirstDataRendered,
4052
4062
  theme,
4053
4063
  className,
4054
4064
  rowClass: `${onRowClicked ? "ag-row-clickable" : ""} ${tableProps.rowClass || ""}`,
@@ -4279,6 +4289,44 @@ function withHeaderMinWidth(defs) {
4279
4289
  return { ...d, minWidth, ...raiseWidth ? { width: minWidth } : {} };
4280
4290
  });
4281
4291
  }
4292
+ function withWidthFloor(defs) {
4293
+ if (!Array.isArray(defs)) return defs;
4294
+ let changed = false;
4295
+ const out = defs.map((d) => {
4296
+ if (!d || typeof d !== "object") return d;
4297
+ if (Array.isArray(d.children)) {
4298
+ const children = withWidthFloor(d.children);
4299
+ if (children === d.children) return d;
4300
+ changed = true;
4301
+ return { ...d, children };
4302
+ }
4303
+ if (typeof d.width !== "number" || d.flex != null) return d;
4304
+ if (typeof d.minWidth === "number" && d.minWidth >= d.width) return d;
4305
+ changed = true;
4306
+ return { ...d, minWidth: d.width };
4307
+ });
4308
+ return changed ? out : defs;
4309
+ }
4310
+ function isFittable(col) {
4311
+ const def = col.getColDef();
4312
+ return col.isVisible() && !col.isPinned() && !col.getColId().startsWith("ag-Grid-") && !def.suppressAutoSize && !def.suppressSizeToFit;
4313
+ }
4314
+ function fitColumnsToContent(api) {
4315
+ const onAutosized = (e) => {
4316
+ if (e.source !== "autosizeColumns" || !e.finished) return;
4317
+ api.removeEventListener("columnResized", onAutosized);
4318
+ const cols = (api.getColumns() ?? []).filter(isFittable);
4319
+ if (cols.length === 0) return;
4320
+ api.applyColumnState({
4321
+ state: cols.map((c) => ({
4322
+ colId: c.getColId(),
4323
+ flex: Math.max(1, Math.round(c.getActualWidth()))
4324
+ }))
4325
+ });
4326
+ };
4327
+ api.addEventListener("columnResized", onAutosized);
4328
+ api.autoSizeAllColumns();
4329
+ }
4282
4330
  function getByPath(data, path) {
4283
4331
  return path.split(".").reduce((o, k) => o == null ? void 0 : o[k], data);
4284
4332
  }
@@ -4305,6 +4353,6 @@ function TwoLineCellRenderer(params) {
4305
4353
  ] });
4306
4354
  }
4307
4355
 
4308
- export { AG_GRID_LOCALE_KR, AgGridContext, AgGridTable, Alert, AlertActions, AlertDescription, AlertTitle, BADGE_OUTLINE_ACCENT, BALANCED_FILL_MIN_WIDTH, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardThumbnail, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyBoxIllustration, Form, FormControl, FormDescription, FormField, FormFooter, FormHeader, FormItem, FormLabel, FormMessage, FormSection, FormSectionLevelContext, FormValidMessage, HeaderCheckboxRenderer, IconButton, LucideIcon, NUMBER_COLUMN_CLASS, NUMBER_COLUMN_WIDTH, PageHeader, PageHeaderProvider, Pagination, PaginationContent, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, PaginationWrapper, Panel, RowCheckboxRenderer, SORT_ICON_OFFSET_CLASS, Separator, Skeleton, SortIcon, Spinner, Stack, Table, TableBody, TableCell, TableHead, TableHeader, TablePagination, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoLineCellRenderer, alignFromClassName, badgeVariants, buttonVariants, cn, estimateHeaderTextWidth, getPaginationRange, getSortedColumnState, sanitizeUserText, useFormControlContext, useFormField, usePageHeader, useRestoreFocusToOpener, withBalancedFill, withExplicitSortIcons, withFlexFill, withHeaderMinWidth, withNumberColumnWidth, withSortIconOffset, withTypeClasses };
4309
- //# sourceMappingURL=chunk-AIMWERAR.js.map
4310
- //# sourceMappingURL=chunk-AIMWERAR.js.map
4356
+ export { AG_GRID_LOCALE_KR, AgGridContext, AgGridTable, Alert, AlertActions, AlertDescription, AlertTitle, BADGE_OUTLINE_ACCENT, BALANCED_FILL_MIN_WIDTH, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardThumbnail, CardTitle, Checkbox, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyBoxIllustration, Form, FormControl, FormDescription, FormField, FormFooter, FormHeader, FormItem, FormLabel, FormMessage, FormSection, FormSectionLevelContext, FormValidMessage, HeaderCheckboxRenderer, IconButton, LucideIcon, NUMBER_COLUMN_CLASS, NUMBER_COLUMN_WIDTH, PageHeader, PageHeaderProvider, Pagination, PaginationContent, PaginationFirst, PaginationItem, PaginationLast, PaginationLink, PaginationNext, PaginationPrevious, PaginationWrapper, Panel, RowCheckboxRenderer, SORT_ICON_OFFSET_CLASS, Separator, Skeleton, SortIcon, Spinner, Stack, Table, TableBody, TableCell, TableHead, TableHeader, TablePagination, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwoLineCellRenderer, alignFromClassName, badgeVariants, buttonVariants, cn, estimateHeaderTextWidth, fitColumnsToContent, getPaginationRange, getSortedColumnState, sanitizeUserText, useFormControlContext, useFormField, usePageHeader, useRestoreFocusToOpener, withBalancedFill, withExplicitSortIcons, withFlexFill, withHeaderMinWidth, withNumberColumnWidth, withSortIconOffset, withTypeClasses, withWidthFloor };
4357
+ //# sourceMappingURL=chunk-GOY465GH.js.map
4358
+ //# sourceMappingURL=chunk-GOY465GH.js.map