@geomak/ui 7.14.0 → 7.16.0
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.cjs +221 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +220 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2769,6 +2769,8 @@ interface DataGridProps {
|
|
|
2769
2769
|
onDeleteRow?: (index: number) => void;
|
|
2770
2770
|
/** Insert a column at `index` (from the column-header right-click menu). */
|
|
2771
2771
|
onInsertColumn?: (index: number) => void;
|
|
2772
|
+
/** Rename a column. When set, headers become editable (double-click / Rename menu). */
|
|
2773
|
+
onHeaderEdit?: (index: number, label: string) => void;
|
|
2772
2774
|
className?: string;
|
|
2773
2775
|
style?: react__default.CSSProperties;
|
|
2774
2776
|
/** Shown when there are no rows. */
|
|
@@ -2785,7 +2787,7 @@ interface DataGridProps {
|
|
|
2785
2787
|
* `onCellEdit` on commit. Wrap it with {@link Spreadsheet} for multi-sheet
|
|
2786
2788
|
* switching, file parsing and export.
|
|
2787
2789
|
*/
|
|
2788
|
-
declare function DataGrid({ columns, rows, rowHeight, headerHeight, height, width, editable, sortable, sort: sortProp, onSortChange, virtualize, overscan, rowNumbers, trailingRows, trailingCols, onCellEdit, contextMenu, onInsertRow, onDeleteRow, onInsertColumn, className, style, emptyState, }: DataGridProps): react_jsx_runtime.JSX.Element;
|
|
2790
|
+
declare function DataGrid({ columns, rows, rowHeight, headerHeight, height, width, editable, sortable, sort: sortProp, onSortChange, virtualize, overscan, rowNumbers, trailingRows, trailingCols, onCellEdit, contextMenu, onInsertRow, onDeleteRow, onInsertColumn, onHeaderEdit, className, style, emptyState, }: DataGridProps): react_jsx_runtime.JSX.Element;
|
|
2789
2791
|
|
|
2790
2792
|
interface Cell {
|
|
2791
2793
|
value: CellValue;
|
|
@@ -5305,6 +5307,43 @@ interface JwtResult<T> {
|
|
|
5305
5307
|
*/
|
|
5306
5308
|
declare function useJwt<T = Record<string, unknown>>(token: string | null | undefined): JwtResult<T>;
|
|
5307
5309
|
|
|
5310
|
+
interface ExportSaveOptions {
|
|
5311
|
+
/** File name WITHOUT extension. Default: 'export' (Excel) / 'report' (PDF). */
|
|
5312
|
+
fileName?: string;
|
|
5313
|
+
/** Receive the finished Blob instead of triggering a browser download. */
|
|
5314
|
+
onSave?: (blob: Blob, fileName: string) => void | Promise<void>;
|
|
5315
|
+
}
|
|
5316
|
+
interface ExcelSheetInput {
|
|
5317
|
+
name: string;
|
|
5318
|
+
/** Explicit header row. Omit to derive from row-object keys. */
|
|
5319
|
+
columns?: string[];
|
|
5320
|
+
rows: Array<CellValue[] | Record<string, CellValue>>;
|
|
5321
|
+
}
|
|
5322
|
+
interface ParsedSheet {
|
|
5323
|
+
name: string;
|
|
5324
|
+
rows: Record<string, CellValue>[];
|
|
5325
|
+
}
|
|
5326
|
+
interface UseExcelReturn {
|
|
5327
|
+
exportSheets: (sheets: ExcelSheetInput[], options?: ExportSaveOptions) => Promise<void>;
|
|
5328
|
+
readWorkbook: (source: File | Blob | ArrayBuffer | Uint8Array) => Promise<ParsedSheet[]>;
|
|
5329
|
+
isExporting: boolean;
|
|
5330
|
+
}
|
|
5331
|
+
declare function useExcel(): UseExcelReturn;
|
|
5332
|
+
|
|
5333
|
+
interface PdfPage {
|
|
5334
|
+
canvas: HTMLCanvasElement;
|
|
5335
|
+
title?: string;
|
|
5336
|
+
}
|
|
5337
|
+
interface PdfExportOptions extends ExportSaveOptions {
|
|
5338
|
+
/** Orientation of every page. Default 'landscape'. */
|
|
5339
|
+
orientation?: 'portrait' | 'landscape';
|
|
5340
|
+
}
|
|
5341
|
+
interface UsePdfReturn {
|
|
5342
|
+
exportCanvases: (pages: PdfPage[], options?: PdfExportOptions) => Promise<void>;
|
|
5343
|
+
isExporting: boolean;
|
|
5344
|
+
}
|
|
5345
|
+
declare function usePdf(): UsePdfReturn;
|
|
5346
|
+
|
|
5308
5347
|
type JumbotronLayout = 'centered' | 'split';
|
|
5309
5348
|
type JumbotronBackground = 'none' | 'surface' | 'gradient';
|
|
5310
5349
|
interface JumbotronProps {
|
|
@@ -5755,4 +5794,4 @@ declare function expiryError(value: string, now?: Date): string | undefined;
|
|
|
5755
5794
|
/** Validate the CVV against the detected brand's expected length. */
|
|
5756
5795
|
declare function cvvError(value: string, cardNumber: string): string | undefined;
|
|
5757
5796
|
|
|
5758
|
-
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Banner, type BannerProps, type BannerTone, Blog, type BlogPost, type BlogProps, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, type Cell, type CellEditInfo, type CellValue, Chat, type ChatMessage, type ChatProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, type ClassValue, ColorPicker, type ColorPickerProps, type ConsentChoice, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CookieConsent, type CookieConsentProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, DataGrid, type DataGridProps, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, type EditorArgs, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, type Feature, FeatureGrid, type FeatureGridProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, type FileSource, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridColumn, type GridProps, type GridSortDirection, type GridSortState, type GridSource, IconButton, type IconButtonProps, Jumbotron, type JumbotronBackground, type JumbotronLayout, type JumbotronProps, type JwtResult, Kbd, type KbdProps, type KbdSize, LeadCapture, type LeadCaptureProps, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Parallax, type ParallaxProps, Password, type PasswordProps, type PasswordRule, type PasswordScore, PasswordStrength, type PasswordStrengthProps, type PasswordStrengthResult, PdfViewer, type PdfViewerProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, type PricingPlan, PricingPlans, type PricingPlansProps, RadioGroup, type RadioGroupProps, type RadioOption, RadioTile, type RadioTileOption, type RadioTileProps, Rating, type RatingProps, type RemoteSourceOptions, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, type SearchOptions, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, type SheetData, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, type Slide, SlideShow, type SlideShowProps, Slider, type SliderMark, type SliderProps, type SliderValue, type SocialLink, type SocialPlatform, Socials, type SocialsProps, type SortDirection, type SortState, type Spacing, Spreadsheet, type SpreadsheetProps, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, type Testimonial, Testimonials, type TestimonialsProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Video, type VideoProps, VirtualList, type VirtualListProps, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
|
5797
|
+
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Banner, type BannerProps, type BannerTone, Blog, type BlogPost, type BlogProps, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, type Cell, type CellEditInfo, type CellValue, Chat, type ChatMessage, type ChatProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, type ClassValue, ColorPicker, type ColorPickerProps, type ConsentChoice, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CookieConsent, type CookieConsentProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, DataGrid, type DataGridProps, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, type EditorArgs, EmptyCart, type EmptyCartProps, type ErrorMap, type ExcelSheetInput, type ExpandRowOptions, type ExportSaveOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, type Feature, FeatureGrid, type FeatureGridProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, type FileSource, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridColumn, type GridProps, type GridSortDirection, type GridSortState, type GridSource, IconButton, type IconButtonProps, Jumbotron, type JumbotronBackground, type JumbotronLayout, type JumbotronProps, type JwtResult, Kbd, type KbdProps, type KbdSize, LeadCapture, type LeadCaptureProps, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Parallax, type ParallaxProps, type ParsedSheet, Password, type PasswordProps, type PasswordRule, type PasswordScore, PasswordStrength, type PasswordStrengthProps, type PasswordStrengthResult, type PdfExportOptions, type PdfPage, PdfViewer, type PdfViewerProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, type PricingPlan, PricingPlans, type PricingPlansProps, RadioGroup, type RadioGroupProps, type RadioOption, RadioTile, type RadioTileOption, type RadioTileProps, Rating, type RatingProps, type RemoteSourceOptions, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, type SearchOptions, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, type SheetData, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, type Slide, SlideShow, type SlideShowProps, Slider, type SliderMark, type SliderProps, type SliderValue, type SocialLink, type SocialPlatform, Socials, type SocialsProps, type SortDirection, type SortState, type Spacing, Spreadsheet, type SpreadsheetProps, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, type Testimonial, Testimonials, type TestimonialsProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseExcelReturn, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type UsePdfReturn, type ValidateTrigger, Video, type VideoProps, VirtualList, type VirtualListProps, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useExcel, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification, usePdf };
|
package/dist/index.d.ts
CHANGED
|
@@ -2769,6 +2769,8 @@ interface DataGridProps {
|
|
|
2769
2769
|
onDeleteRow?: (index: number) => void;
|
|
2770
2770
|
/** Insert a column at `index` (from the column-header right-click menu). */
|
|
2771
2771
|
onInsertColumn?: (index: number) => void;
|
|
2772
|
+
/** Rename a column. When set, headers become editable (double-click / Rename menu). */
|
|
2773
|
+
onHeaderEdit?: (index: number, label: string) => void;
|
|
2772
2774
|
className?: string;
|
|
2773
2775
|
style?: react__default.CSSProperties;
|
|
2774
2776
|
/** Shown when there are no rows. */
|
|
@@ -2785,7 +2787,7 @@ interface DataGridProps {
|
|
|
2785
2787
|
* `onCellEdit` on commit. Wrap it with {@link Spreadsheet} for multi-sheet
|
|
2786
2788
|
* switching, file parsing and export.
|
|
2787
2789
|
*/
|
|
2788
|
-
declare function DataGrid({ columns, rows, rowHeight, headerHeight, height, width, editable, sortable, sort: sortProp, onSortChange, virtualize, overscan, rowNumbers, trailingRows, trailingCols, onCellEdit, contextMenu, onInsertRow, onDeleteRow, onInsertColumn, className, style, emptyState, }: DataGridProps): react_jsx_runtime.JSX.Element;
|
|
2790
|
+
declare function DataGrid({ columns, rows, rowHeight, headerHeight, height, width, editable, sortable, sort: sortProp, onSortChange, virtualize, overscan, rowNumbers, trailingRows, trailingCols, onCellEdit, contextMenu, onInsertRow, onDeleteRow, onInsertColumn, onHeaderEdit, className, style, emptyState, }: DataGridProps): react_jsx_runtime.JSX.Element;
|
|
2789
2791
|
|
|
2790
2792
|
interface Cell {
|
|
2791
2793
|
value: CellValue;
|
|
@@ -5305,6 +5307,43 @@ interface JwtResult<T> {
|
|
|
5305
5307
|
*/
|
|
5306
5308
|
declare function useJwt<T = Record<string, unknown>>(token: string | null | undefined): JwtResult<T>;
|
|
5307
5309
|
|
|
5310
|
+
interface ExportSaveOptions {
|
|
5311
|
+
/** File name WITHOUT extension. Default: 'export' (Excel) / 'report' (PDF). */
|
|
5312
|
+
fileName?: string;
|
|
5313
|
+
/** Receive the finished Blob instead of triggering a browser download. */
|
|
5314
|
+
onSave?: (blob: Blob, fileName: string) => void | Promise<void>;
|
|
5315
|
+
}
|
|
5316
|
+
interface ExcelSheetInput {
|
|
5317
|
+
name: string;
|
|
5318
|
+
/** Explicit header row. Omit to derive from row-object keys. */
|
|
5319
|
+
columns?: string[];
|
|
5320
|
+
rows: Array<CellValue[] | Record<string, CellValue>>;
|
|
5321
|
+
}
|
|
5322
|
+
interface ParsedSheet {
|
|
5323
|
+
name: string;
|
|
5324
|
+
rows: Record<string, CellValue>[];
|
|
5325
|
+
}
|
|
5326
|
+
interface UseExcelReturn {
|
|
5327
|
+
exportSheets: (sheets: ExcelSheetInput[], options?: ExportSaveOptions) => Promise<void>;
|
|
5328
|
+
readWorkbook: (source: File | Blob | ArrayBuffer | Uint8Array) => Promise<ParsedSheet[]>;
|
|
5329
|
+
isExporting: boolean;
|
|
5330
|
+
}
|
|
5331
|
+
declare function useExcel(): UseExcelReturn;
|
|
5332
|
+
|
|
5333
|
+
interface PdfPage {
|
|
5334
|
+
canvas: HTMLCanvasElement;
|
|
5335
|
+
title?: string;
|
|
5336
|
+
}
|
|
5337
|
+
interface PdfExportOptions extends ExportSaveOptions {
|
|
5338
|
+
/** Orientation of every page. Default 'landscape'. */
|
|
5339
|
+
orientation?: 'portrait' | 'landscape';
|
|
5340
|
+
}
|
|
5341
|
+
interface UsePdfReturn {
|
|
5342
|
+
exportCanvases: (pages: PdfPage[], options?: PdfExportOptions) => Promise<void>;
|
|
5343
|
+
isExporting: boolean;
|
|
5344
|
+
}
|
|
5345
|
+
declare function usePdf(): UsePdfReturn;
|
|
5346
|
+
|
|
5308
5347
|
type JumbotronLayout = 'centered' | 'split';
|
|
5309
5348
|
type JumbotronBackground = 'none' | 'surface' | 'gradient';
|
|
5310
5349
|
interface JumbotronProps {
|
|
@@ -5755,4 +5794,4 @@ declare function expiryError(value: string, now?: Date): string | undefined;
|
|
|
5755
5794
|
/** Validate the CVV against the detected brand's expected length. */
|
|
5756
5795
|
declare function cvvError(value: string, cardNumber: string): string | undefined;
|
|
5757
5796
|
|
|
5758
|
-
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Banner, type BannerProps, type BannerTone, Blog, type BlogPost, type BlogProps, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, type Cell, type CellEditInfo, type CellValue, Chat, type ChatMessage, type ChatProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, type ClassValue, ColorPicker, type ColorPickerProps, type ConsentChoice, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CookieConsent, type CookieConsentProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, DataGrid, type DataGridProps, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, type EditorArgs, EmptyCart, type EmptyCartProps, type ErrorMap, type ExpandRowOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, type Feature, FeatureGrid, type FeatureGridProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, type FileSource, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridColumn, type GridProps, type GridSortDirection, type GridSortState, type GridSource, IconButton, type IconButtonProps, Jumbotron, type JumbotronBackground, type JumbotronLayout, type JumbotronProps, type JwtResult, Kbd, type KbdProps, type KbdSize, LeadCapture, type LeadCaptureProps, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Parallax, type ParallaxProps, Password, type PasswordProps, type PasswordRule, type PasswordScore, PasswordStrength, type PasswordStrengthProps, type PasswordStrengthResult, PdfViewer, type PdfViewerProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, type PricingPlan, PricingPlans, type PricingPlansProps, RadioGroup, type RadioGroupProps, type RadioOption, RadioTile, type RadioTileOption, type RadioTileProps, Rating, type RatingProps, type RemoteSourceOptions, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, type SearchOptions, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, type SheetData, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, type Slide, SlideShow, type SlideShowProps, Slider, type SliderMark, type SliderProps, type SliderValue, type SocialLink, type SocialPlatform, Socials, type SocialsProps, type SortDirection, type SortState, type Spacing, Spreadsheet, type SpreadsheetProps, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, type Testimonial, Testimonials, type TestimonialsProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type ValidateTrigger, Video, type VideoProps, VirtualList, type VirtualListProps, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
|
5797
|
+
export { Accordion, type AccordionItemProps, type AccordionProps, AppShell, type AppShellProps, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, type AvatarShape, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeSize, type BadgeTone, type BadgeVariant, Banner, type BannerProps, type BannerTone, Blog, type BlogPost, type BlogProps, Box, type BoxBackground, type BoxBorder, type BoxProps, type BoxRadius, type BoxShadow, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, type Breakpoint, type BreakpointState, Button, type ButtonProps, CARD_BRANDS, Card, type CardBodyProps, type CardBrand, CardCarousel, type CardCarouselProps, type CardFooterProps, type CardHeaderProps, type CardMediaProps, type CardProps, Cart, CartButton, type CartButtonProps, type CartContextValue, type CartItemInput, type CartLineItem, type CartProps, CartProvider, type CartProviderProps, type CartSummaryRow, Catalog, CatalogCarousel, type CatalogCarouselProps, CatalogGrid, type CatalogGridProps, type CatalogProps, type Cell, type CellEditInfo, type CellValue, Chat, type ChatMessage, type ChatProps, Checkbox, type CheckboxProps, Checkout, type CheckoutProps, type ClassValue, ColorPicker, type ColorPickerProps, type ConsentChoice, ContextMenu, type ContextMenuActionItem, type ContextMenuPosition, type ContextMenuProps, CookieConsent, type CookieConsentProps, CreditCardForm, type CreditCardFormProps, type CreditCardValue, DataGrid, type DataGridProps, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DateRangePreset, type DeltaDirection, Drawer, type DrawerProps, type DrawerSize, Dropdown, type DropdownItem, type DropdownProps, type EditorArgs, EmptyCart, type EmptyCartProps, type ErrorMap, type ExcelSheetInput, type ExpandRowOptions, type ExportSaveOptions, FAB, type FABAction, type FABPosition, type FABProps, type FABSize, type FABTone, FadingBase, type FadingBaseProps, type Feature, FeatureGrid, type FeatureGridProps, Field, type FieldArrayItem, type FieldBindings, FieldHelpIcon, type FieldKind, FieldLabel, type FieldLabelProps, type FieldProps, type FieldRule, type FieldRules, type FieldShellOptions, type FieldSize, type FieldSnapshot, FileInput, type FileInputProps, type FileSource, Flex, type FlexAlign, type FlexDirection, type FlexJustify, type FlexProps, type FlexWrap, Form, FormContext, FormField, type FormFieldProps, type FormProps, FormStore, type FormStoreOptions, type FormValues, Grid, GridCard, type GridCardItem, type GridCardProps, type GridColumn, type GridProps, type GridSortDirection, type GridSortState, type GridSource, IconButton, type IconButtonProps, Jumbotron, type JumbotronBackground, type JumbotronLayout, type JumbotronProps, type JwtResult, Kbd, type KbdProps, type KbdSize, LeadCapture, type LeadCaptureProps, List, type ListItem, type ListProps, LoadingSpinner, type LoadingSpinnerProps, LogoutTimer, type LogoutTimerProps, MegaMenu, type MegaMenuFeaturedProps, type MegaMenuItemProps, type MegaMenuLinkProps, type MegaMenuPanelProps, type MegaMenuProps, type MegaMenuSectionProps, MenuButton, type MenuButtonItem, type MenuButtonProps, Modal, type ModalProps, type ModalSize, type NotificationPayload, NotificationProvider, NumberInput, type NumberInputProps, OpaqueGridCard, type OpaqueGridCardProps, OtpInput, type OtpInputProps, type PaginationOptions, Parallax, type ParallaxProps, type ParsedSheet, Password, type PasswordProps, type PasswordRule, type PasswordScore, PasswordStrength, type PasswordStrengthProps, type PasswordStrengthResult, type PdfExportOptions, type PdfPage, PdfViewer, type PdfViewerProps, PopConfirm, type PopConfirmProps, type PopConfirmTone, Portal, type PortalProps, type PricingPlan, PricingPlans, type PricingPlansProps, RadioGroup, type RadioGroupProps, type RadioOption, RadioTile, type RadioTileOption, type RadioTileProps, Rating, type RatingProps, type RemoteSourceOptions, type RulesMap, ScalableContainer, type ScalableContainerProps, Scheduler, type SchedulerEvent, type SchedulerProps, type SchedulerRange, type SchedulerView, SearchInput, type SearchInputProps, type SearchOptions, SecureLayout, type SecureLayoutProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, type SheetData, Sidebar, type SidebarItem, type SidebarProps, type SidebarSection, SkeletonBox, type SkeletonBoxProps, SkeletonCard, type SkeletonCardProps, SkeletonCircle, type SkeletonCircleProps, SkeletonText, type SkeletonTextProps, type Slide, SlideShow, type SlideShowProps, Slider, type SliderMark, type SliderProps, type SliderValue, type SocialLink, type SocialPlatform, Socials, type SocialsProps, type SortDirection, type SortState, type Spacing, Spreadsheet, type SpreadsheetProps, Statistic, type StatisticDelta, type StatisticProps, type StatisticSize, Stepper, type StepperActiveStatus, type StepperProps, type StepperStep, Switch, type SwitchInputProps, Table, type TableColumn, type TableProps, Tabs, type TabsAddProps, type TabsListProps, type TabsOrientation, type TabsPanelProps, type TabsProps, type TabsSize, type TabsTriggerProps, type TabsVariant, TagsInput, type TagsInputProps, DatePicker as Temporal, type TemporalPickerProps, type Testimonial, Testimonials, type TestimonialsProps, TextArea, type TextAreaProps, TextInput, type TextInputProps, type ThemeColors, type ThemeConfig, type ThemeDensity, type ThemeMotion, ThemeProvider, type ThemeProviderProps, type ThemeRadius, type ThemeShadows, ThemeSwitch, type ThemeSwitchProps, type ThemeTypography, TimePicker, type TimePickerProps, Timeline, type TimelineEvent, type TimelineProps, type TimelineStatus, Tooltip, type TooltipProps, TooltipProvider, TopBar, type TopBarProps, Tree, type TreeItemClickPayload, type TreeNode, type TreeProps, TreeSelect, type TreeSelectProps, Typography, type TypographyAlign, type TypographyColor, type TypographyProps, type TypographyVariant, type TypographyWeight, type UseExcelReturn, type UseFieldArrayReturn, type UseFormFieldOptions, type UseFormReturn, type UsePdfReturn, type ValidateTrigger, Video, type VideoProps, VirtualList, type VirtualListProps, Wizard, type WizardProps, type WizardStep, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useExcel, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification, usePdf };
|
package/dist/index.js
CHANGED
|
@@ -6501,6 +6501,7 @@ function DataGrid({
|
|
|
6501
6501
|
onInsertRow,
|
|
6502
6502
|
onDeleteRow,
|
|
6503
6503
|
onInsertColumn,
|
|
6504
|
+
onHeaderEdit,
|
|
6504
6505
|
className = "",
|
|
6505
6506
|
style,
|
|
6506
6507
|
emptyState = "No data"
|
|
@@ -6513,6 +6514,8 @@ function DataGrid({
|
|
|
6513
6514
|
const [ctxTarget, setCtxTarget] = useState(null);
|
|
6514
6515
|
const [editing, setEditing] = useState(null);
|
|
6515
6516
|
const [draft, setDraft] = useState("");
|
|
6517
|
+
const [editingHeader, setEditingHeader] = useState(null);
|
|
6518
|
+
const [headerDraft, setHeaderDraft] = useState("");
|
|
6516
6519
|
const [internalSort, setInternalSort] = useState(null);
|
|
6517
6520
|
const sort = sortProp !== void 0 ? sortProp : internalSort;
|
|
6518
6521
|
const gutter = rowNumbers ? GUTTER : 0;
|
|
@@ -6589,6 +6592,17 @@ function DataGrid({
|
|
|
6589
6592
|
setDraft(displayValue(rows[rowIndexForDisp(disp)]?.[c.key] ?? ""));
|
|
6590
6593
|
setEditing({ disp, col });
|
|
6591
6594
|
};
|
|
6595
|
+
const startHeaderEdit = (col) => {
|
|
6596
|
+
if (!onHeaderEdit) return;
|
|
6597
|
+
const c = cols[col];
|
|
6598
|
+
setHeaderDraft(typeof c.label === "string" ? c.label : String(c.key));
|
|
6599
|
+
setEditingHeader(col);
|
|
6600
|
+
};
|
|
6601
|
+
const commitHeader = () => {
|
|
6602
|
+
if (editingHeader == null) return;
|
|
6603
|
+
onHeaderEdit?.(editingHeader, headerDraft);
|
|
6604
|
+
setEditingHeader(null);
|
|
6605
|
+
};
|
|
6592
6606
|
const cellText = (sel) => displayValue(rows[rowIndexForDisp(sel.disp)]?.[cols[sel.col].key] ?? "");
|
|
6593
6607
|
const copyCell = useCallback(async () => {
|
|
6594
6608
|
if (!selected) return;
|
|
@@ -6616,7 +6630,8 @@ function DataGrid({
|
|
|
6616
6630
|
if (ctxTarget?.kind === "header") {
|
|
6617
6631
|
const ci = ctxTarget.col;
|
|
6618
6632
|
return [
|
|
6619
|
-
{ key: "
|
|
6633
|
+
{ key: "rename", value: "Rename column", disabled: !onHeaderEdit, onClick: () => startHeaderEdit(ci) },
|
|
6634
|
+
{ key: "left", value: "Add column to the left", disabled: !onInsertColumn, separatorBefore: true, onClick: () => onInsertColumn?.(ci) },
|
|
6620
6635
|
{ key: "right", value: "Add column to the right", disabled: !onInsertColumn, onClick: () => onInsertColumn?.(ci + 1) }
|
|
6621
6636
|
];
|
|
6622
6637
|
}
|
|
@@ -6634,7 +6649,7 @@ function DataGrid({
|
|
|
6634
6649
|
{ key: "cut", value: "Cut", disabled: !editable, onClick: () => void cutCell() },
|
|
6635
6650
|
{ key: "paste", value: "Paste", disabled: !editable, onClick: () => void pasteCell() }
|
|
6636
6651
|
];
|
|
6637
|
-
}, [ctxTarget, rows.length, editable, onInsertRow, onDeleteRow, onInsertColumn, copyCell, cutCell, pasteCell, order]);
|
|
6652
|
+
}, [ctxTarget, rows.length, editable, onInsertRow, onDeleteRow, onInsertColumn, onHeaderEdit, copyCell, cutCell, pasteCell, order]);
|
|
6638
6653
|
const rowHighlighted = (disp) => hoveredRow === disp || selected?.disp === disp;
|
|
6639
6654
|
const gridInner = /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: gutter + totalWidth + END_PAD, height: headerHeight + totalHeight + END_PAD }, children: [
|
|
6640
6655
|
rowNumbers && /* @__PURE__ */ jsx(
|
|
@@ -6648,16 +6663,20 @@ function DataGrid({
|
|
|
6648
6663
|
const c = cols[ci];
|
|
6649
6664
|
const sortDir = sort?.key === c.key ? sort.dir : null;
|
|
6650
6665
|
const canSort = colSortable(c);
|
|
6651
|
-
|
|
6666
|
+
const renamable = !!onHeaderEdit;
|
|
6667
|
+
const isEditingHeader = editingHeader === ci;
|
|
6668
|
+
return /* @__PURE__ */ jsx(
|
|
6652
6669
|
"div",
|
|
6653
6670
|
{
|
|
6654
6671
|
role: "columnheader",
|
|
6655
6672
|
"aria-sort": sortDir ? sortDir === "asc" ? "ascending" : "descending" : void 0,
|
|
6656
|
-
onClick: canSort ? () => toggleSort(c.key) : void 0,
|
|
6673
|
+
onClick: canSort && !renamable ? () => toggleSort(c.key) : void 0,
|
|
6674
|
+
onDoubleClick: renamable ? () => startHeaderEdit(ci) : void 0,
|
|
6657
6675
|
onContextMenu: contextMenu ? () => setCtxTarget({ kind: "header", col: ci }) : void 0,
|
|
6658
6676
|
className: cx(
|
|
6659
6677
|
"flex items-center gap-1 border-b border-r border-border bg-surface px-3 font-medium text-foreground-secondary",
|
|
6660
|
-
canSort && "cursor-pointer select-none hover:text-foreground"
|
|
6678
|
+
canSort && !renamable && "cursor-pointer select-none hover:text-foreground",
|
|
6679
|
+
renamable && "cursor-default select-none"
|
|
6661
6680
|
),
|
|
6662
6681
|
style: {
|
|
6663
6682
|
position: "absolute",
|
|
@@ -6668,10 +6687,27 @@ function DataGrid({
|
|
|
6668
6687
|
zIndex: 2,
|
|
6669
6688
|
justifyContent: c.align === "right" ? "flex-end" : c.align === "center" ? "center" : "flex-start"
|
|
6670
6689
|
},
|
|
6671
|
-
children:
|
|
6690
|
+
children: isEditingHeader ? /* @__PURE__ */ jsx(
|
|
6691
|
+
"input",
|
|
6692
|
+
{
|
|
6693
|
+
autoFocus: true,
|
|
6694
|
+
value: headerDraft,
|
|
6695
|
+
onChange: (e) => setHeaderDraft(e.target.value),
|
|
6696
|
+
onBlur: commitHeader,
|
|
6697
|
+
onClick: (e) => e.stopPropagation(),
|
|
6698
|
+
onKeyDown: (e) => {
|
|
6699
|
+
if (e.key === "Enter") commitHeader();
|
|
6700
|
+
else if (e.key === "Escape") setEditingHeader(null);
|
|
6701
|
+
},
|
|
6702
|
+
className: "h-full w-full bg-transparent font-medium text-foreground outline-none"
|
|
6703
|
+
}
|
|
6704
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6672
6705
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: c.label ?? c.key }),
|
|
6673
|
-
canSort && /* @__PURE__ */ jsx(
|
|
6674
|
-
|
|
6706
|
+
canSort && (renamable ? /* @__PURE__ */ jsx("button", { type: "button", title: "Sort", onClick: (e) => {
|
|
6707
|
+
e.stopPropagation();
|
|
6708
|
+
toggleSort(c.key);
|
|
6709
|
+
}, className: "flex-shrink-0 rounded hover:text-foreground", children: /* @__PURE__ */ jsx(SortCaret, { dir: sortDir }) }) : /* @__PURE__ */ jsx(SortCaret, { dir: sortDir }))
|
|
6710
|
+
] })
|
|
6675
6711
|
},
|
|
6676
6712
|
`h-${c.key}`
|
|
6677
6713
|
);
|
|
@@ -6908,12 +6944,21 @@ function Spreadsheet({
|
|
|
6908
6944
|
const sheet = sheets?.[active];
|
|
6909
6945
|
const columns = useMemo(() => sheet ? toColumns(sheet.columns) : [], [sheet]);
|
|
6910
6946
|
const plainRows = useMemo(() => sheet ? toPlainRows(sheet, columns) : [], [sheet, columns]);
|
|
6947
|
+
const displayColumns = useMemo(
|
|
6948
|
+
() => [...columns, ...makeColumns(columns, Math.max(0, emptyCols)).map((c) => ({ ...c, sortable: false }))],
|
|
6949
|
+
[columns, emptyCols]
|
|
6950
|
+
);
|
|
6951
|
+
const isSlackKey = (key) => !columns.some((c) => c.key === key);
|
|
6911
6952
|
const handleCellEdit = useCallback(({ row, column, value }) => {
|
|
6912
6953
|
let coerced = value;
|
|
6913
6954
|
setSheets((prev) => {
|
|
6914
6955
|
if (!prev) return prev;
|
|
6915
|
-
const next = prev.map((s, i) => i === active ? { ...s, rows: s.rows.map((r) => ({ ...r })) } : s);
|
|
6956
|
+
const next = prev.map((s, i) => i === active ? { ...s, columns: toColumns(s.columns), rows: s.rows.map((r) => ({ ...r })) } : s);
|
|
6916
6957
|
const target = next[active];
|
|
6958
|
+
if (isSlackKey(column)) {
|
|
6959
|
+
const j = displayColumns.findIndex((c) => c.key === column);
|
|
6960
|
+
if (j >= 0) target.columns = displayColumns.slice(0, j + 1).map((c) => ({ key: c.key, label: c.label }));
|
|
6961
|
+
}
|
|
6917
6962
|
while (target.rows.length <= row) target.rows.push({});
|
|
6918
6963
|
const existing = target.rows[row]?.[column];
|
|
6919
6964
|
const prevValue = cellValue(existing);
|
|
@@ -6927,7 +6972,22 @@ function Spreadsheet({
|
|
|
6927
6972
|
return next;
|
|
6928
6973
|
});
|
|
6929
6974
|
onCellEdit?.({ sheet: sheets?.[active]?.name ?? "", row, column, value: coerced });
|
|
6930
|
-
}, [active, onCellEdit, onChange, sheets]);
|
|
6975
|
+
}, [active, onCellEdit, onChange, sheets, displayColumns, columns]);
|
|
6976
|
+
const renameColumn = useCallback((index, label) => {
|
|
6977
|
+
setSheets((prev) => {
|
|
6978
|
+
if (!prev) return prev;
|
|
6979
|
+
const next = prev.map((s, i) => i === active ? { ...s, columns: toColumns(s.columns) } : s);
|
|
6980
|
+
const target = next[active];
|
|
6981
|
+
let tcols = target.columns;
|
|
6982
|
+
if (index >= tcols.length) {
|
|
6983
|
+
tcols = displayColumns.slice(0, index + 1).map((c) => ({ key: c.key, label: c.label }));
|
|
6984
|
+
target.columns = tcols;
|
|
6985
|
+
}
|
|
6986
|
+
if (tcols[index]) tcols[index] = { ...tcols[index], label };
|
|
6987
|
+
onChange?.(next);
|
|
6988
|
+
return next;
|
|
6989
|
+
});
|
|
6990
|
+
}, [active, onChange, displayColumns]);
|
|
6931
6991
|
const addSheet = useCallback(() => {
|
|
6932
6992
|
setSheets((prev) => {
|
|
6933
6993
|
const list = prev ?? [];
|
|
@@ -7145,17 +7205,17 @@ function Spreadsheet({
|
|
|
7145
7205
|
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx(
|
|
7146
7206
|
DataGrid,
|
|
7147
7207
|
{
|
|
7148
|
-
columns,
|
|
7208
|
+
columns: displayColumns,
|
|
7149
7209
|
rows: plainRows,
|
|
7150
7210
|
editable,
|
|
7151
7211
|
sortable,
|
|
7152
7212
|
virtualize,
|
|
7153
7213
|
trailingRows: emptyRows,
|
|
7154
|
-
trailingCols: emptyCols,
|
|
7155
7214
|
contextMenu: true,
|
|
7156
7215
|
onInsertRow: editable ? insertRow : void 0,
|
|
7157
7216
|
onDeleteRow: editable ? deleteRow : void 0,
|
|
7158
7217
|
onInsertColumn: editable ? insertColumn : void 0,
|
|
7218
|
+
onHeaderEdit: editable ? renameColumn : void 0,
|
|
7159
7219
|
onCellEdit: handleCellEdit,
|
|
7160
7220
|
height: "100%",
|
|
7161
7221
|
className: "!rounded-none !border-0"
|
|
@@ -11085,6 +11145,153 @@ function useJwt(token) {
|
|
|
11085
11145
|
const isValid = decoded.payload != null && !isExpired;
|
|
11086
11146
|
return { payload: decoded.payload, header: decoded.header, expiresAt, isExpired, isValid, raw: token ?? null };
|
|
11087
11147
|
}
|
|
11148
|
+
var INVALID_WS_CHARS = /[:\\/?\*[\]]/g;
|
|
11149
|
+
function sanitizeName(name) {
|
|
11150
|
+
return name.replace(INVALID_WS_CHARS, "_").slice(0, 31) || "Sheet";
|
|
11151
|
+
}
|
|
11152
|
+
var xlsxPromise2 = null;
|
|
11153
|
+
var loadXlsx2 = () => xlsxPromise2 ??= import('xlsx');
|
|
11154
|
+
function useExcel() {
|
|
11155
|
+
const [isExporting, setIsExporting] = useState(false);
|
|
11156
|
+
const exportSheets = useCallback(async (sheets, options = {}) => {
|
|
11157
|
+
const { fileName = "export", onSave } = options;
|
|
11158
|
+
setIsExporting(true);
|
|
11159
|
+
try {
|
|
11160
|
+
const XLSX = await loadXlsx2();
|
|
11161
|
+
const wb = XLSX.utils.book_new();
|
|
11162
|
+
for (const sheet of sheets) {
|
|
11163
|
+
let headers;
|
|
11164
|
+
if (sheet.columns) {
|
|
11165
|
+
headers = sheet.columns;
|
|
11166
|
+
} else {
|
|
11167
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11168
|
+
for (const row of sheet.rows) {
|
|
11169
|
+
if (!Array.isArray(row)) {
|
|
11170
|
+
for (const k of Object.keys(row)) seen.add(k);
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
headers = Array.from(seen);
|
|
11174
|
+
}
|
|
11175
|
+
const aoa = [];
|
|
11176
|
+
if (headers.length > 0) aoa.push(headers);
|
|
11177
|
+
for (const row of sheet.rows) {
|
|
11178
|
+
if (Array.isArray(row)) {
|
|
11179
|
+
aoa.push(row);
|
|
11180
|
+
} else {
|
|
11181
|
+
aoa.push(headers.map((h) => row[h] ?? null));
|
|
11182
|
+
}
|
|
11183
|
+
}
|
|
11184
|
+
const ws = XLSX.utils.aoa_to_sheet(aoa);
|
|
11185
|
+
if (headers.length > 0) {
|
|
11186
|
+
for (let ci = 0; ci < headers.length; ci++) {
|
|
11187
|
+
const addr = XLSX.utils.encode_cell({ r: 0, c: ci });
|
|
11188
|
+
if (ws[addr]) ws[addr].s = { font: { bold: true } };
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
const colWidths = headers.map((h) => Math.min(h.length, 40));
|
|
11192
|
+
for (const row of aoa.slice(1)) {
|
|
11193
|
+
row.forEach((cell, ci) => {
|
|
11194
|
+
const len = cell == null ? 0 : String(cell).length;
|
|
11195
|
+
if (len > (colWidths[ci] ?? 0)) colWidths[ci] = Math.min(len, 40);
|
|
11196
|
+
});
|
|
11197
|
+
}
|
|
11198
|
+
ws["!cols"] = colWidths.map((w) => ({ wch: w + 2 }));
|
|
11199
|
+
XLSX.utils.book_append_sheet(wb, ws, sanitizeName(sheet.name));
|
|
11200
|
+
}
|
|
11201
|
+
const out = XLSX.write(wb, { bookType: "xlsx", type: "array" });
|
|
11202
|
+
const blob = new Blob([out], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
11203
|
+
const name = `${fileName}.xlsx`;
|
|
11204
|
+
if (onSave) {
|
|
11205
|
+
await onSave(blob, name);
|
|
11206
|
+
} else {
|
|
11207
|
+
downloadBlob(blob, name);
|
|
11208
|
+
}
|
|
11209
|
+
} finally {
|
|
11210
|
+
setIsExporting(false);
|
|
11211
|
+
}
|
|
11212
|
+
}, []);
|
|
11213
|
+
const readWorkbook = useCallback(async (source) => {
|
|
11214
|
+
const XLSX = await loadXlsx2();
|
|
11215
|
+
let bytes;
|
|
11216
|
+
if (source instanceof Uint8Array) {
|
|
11217
|
+
bytes = source;
|
|
11218
|
+
} else if (source instanceof ArrayBuffer) {
|
|
11219
|
+
bytes = new Uint8Array(source);
|
|
11220
|
+
} else {
|
|
11221
|
+
bytes = new Uint8Array(await source.arrayBuffer());
|
|
11222
|
+
}
|
|
11223
|
+
const wb = XLSX.read(bytes, { type: "array" });
|
|
11224
|
+
return wb.SheetNames.map((name) => {
|
|
11225
|
+
const ws = wb.Sheets[name];
|
|
11226
|
+
const aoa = XLSX.utils.sheet_to_json(ws, { header: 1, blankrows: false, defval: null });
|
|
11227
|
+
if (aoa.length === 0) return { name, rows: [] };
|
|
11228
|
+
const headerRow = aoa[0] ?? [];
|
|
11229
|
+
const headers = headerRow.map(
|
|
11230
|
+
(h, i) => h != null && String(h).length ? String(h) : `col_${i}`
|
|
11231
|
+
);
|
|
11232
|
+
const rows = aoa.slice(1).map((row) => {
|
|
11233
|
+
const rec = {};
|
|
11234
|
+
headers.forEach((h, i) => {
|
|
11235
|
+
rec[h] = row[i] ?? null;
|
|
11236
|
+
});
|
|
11237
|
+
return rec;
|
|
11238
|
+
});
|
|
11239
|
+
return { name, rows };
|
|
11240
|
+
});
|
|
11241
|
+
}, []);
|
|
11242
|
+
return { exportSheets, readWorkbook, isExporting };
|
|
11243
|
+
}
|
|
11244
|
+
var jspdfPromise2 = null;
|
|
11245
|
+
var loadJspdf2 = () => jspdfPromise2 ??= import('jspdf');
|
|
11246
|
+
function usePdf() {
|
|
11247
|
+
const [isExporting, setIsExporting] = useState(false);
|
|
11248
|
+
const exportCanvases = useCallback(async (pages, options = {}) => {
|
|
11249
|
+
const { fileName = "report", onSave, orientation = "landscape" } = options;
|
|
11250
|
+
const validPages = pages.filter((p) => p.canvas.width !== 0 && p.canvas.height !== 0);
|
|
11251
|
+
if (validPages.length === 0) return;
|
|
11252
|
+
setIsExporting(true);
|
|
11253
|
+
try {
|
|
11254
|
+
const { jsPDF } = await loadJspdf2();
|
|
11255
|
+
const pdf = new jsPDF({ orientation, unit: "px", compress: true });
|
|
11256
|
+
const pageW = pdf.internal.pageSize.getWidth();
|
|
11257
|
+
const pageH = pdf.internal.pageSize.getHeight();
|
|
11258
|
+
const TITLE_H = 28;
|
|
11259
|
+
for (let i = 0; i < validPages.length; i++) {
|
|
11260
|
+
const { canvas, title } = validPages[i];
|
|
11261
|
+
if (i > 0) pdf.addPage();
|
|
11262
|
+
let contentY = 0;
|
|
11263
|
+
const contentH = title ? pageH - TITLE_H : pageH;
|
|
11264
|
+
if (title) {
|
|
11265
|
+
pdf.setFontSize(12);
|
|
11266
|
+
pdf.setFont("helvetica", "bold");
|
|
11267
|
+
pdf.text(title, pageW / 2, TITLE_H / 2 + 6, { align: "center" });
|
|
11268
|
+
contentY = TITLE_H;
|
|
11269
|
+
}
|
|
11270
|
+
const scale = Math.min(pageW / canvas.width, contentH / canvas.height);
|
|
11271
|
+
const w = canvas.width * scale;
|
|
11272
|
+
const h = canvas.height * scale;
|
|
11273
|
+
const x = (pageW - w) / 2;
|
|
11274
|
+
const y = contentY + (contentH - h) / 2;
|
|
11275
|
+
pdf.addImage(canvas.toDataURL("image/png", 1), "PNG", x, y, w, h);
|
|
11276
|
+
}
|
|
11277
|
+
const blob = pdf.output("blob");
|
|
11278
|
+
const name = `${fileName}.pdf`;
|
|
11279
|
+
if (onSave) {
|
|
11280
|
+
await onSave(blob, name);
|
|
11281
|
+
} else {
|
|
11282
|
+
const url = URL.createObjectURL(blob);
|
|
11283
|
+
const a = document.createElement("a");
|
|
11284
|
+
a.href = url;
|
|
11285
|
+
a.download = name;
|
|
11286
|
+
a.click();
|
|
11287
|
+
URL.revokeObjectURL(url);
|
|
11288
|
+
}
|
|
11289
|
+
} finally {
|
|
11290
|
+
setIsExporting(false);
|
|
11291
|
+
}
|
|
11292
|
+
}, []);
|
|
11293
|
+
return { exportCanvases, isExporting };
|
|
11294
|
+
}
|
|
11088
11295
|
var GRADIENT = "radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in oklab, var(--color-accent) 12%, transparent), transparent 70%)";
|
|
11089
11296
|
function Jumbotron({
|
|
11090
11297
|
eyebrow,
|
|
@@ -11625,6 +11832,6 @@ function LeadCapture({
|
|
|
11625
11832
|
);
|
|
11626
11833
|
}
|
|
11627
11834
|
|
|
11628
|
-
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Banner, Blog, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Chat, Checkbox, Checkout, ColorPicker, ContextMenu, CookieConsent, CreditCardForm, DataGrid, DateRangePicker, Drawer, Dropdown, EmptyCart, FAB, FadingBase, FeatureGrid, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid, GridCard, IconButton_default as IconButton, Jumbotron, Kbd, LeadCapture, List2 as List, LoadingSpinner, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Parallax, Password, PasswordStrength, PdfViewer, PopConfirm, Portal, PricingPlans, RadioGroup, RadioTile, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, SlideShow, Slider, Socials, Spreadsheet, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, Testimonials, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Video, VirtualList, Wizard, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification };
|
|
11835
|
+
export { Accordion_default as Accordion, AppShell, AutoComplete, Avatar, Badge, Banner, Blog, Box, Breadcrumbs, Button_default as Button, CARD_BRANDS, Card_default as Card, CardCarousel, Cart, CartButton, CartProvider, Catalog, CatalogCarousel, CatalogGrid, Chat, Checkbox, Checkout, ColorPicker, ContextMenu, CookieConsent, CreditCardForm, DataGrid, DateRangePicker, Drawer, Dropdown, EmptyCart, FAB, FadingBase, FeatureGrid, Field, FieldHelpIcon, FieldLabel, FileInput, Flex, Form, FormContext, FormField, FormStore, Grid, GridCard, IconButton_default as IconButton, Jumbotron, Kbd, LeadCapture, List2 as List, LoadingSpinner, LogoutTimer, MegaMenu_default as MegaMenu, MenuButton, Modal, NotificationProvider, NumberInput, OpaqueGridCard, OtpInput, Parallax, Password, PasswordStrength, PdfViewer, PopConfirm, Portal, PricingPlans, RadioGroup, RadioTile, Rating, ScalableContainer, Scheduler, SearchInput_default as SearchInput, SecureLayout, SegmentedControl, Sidebar, SkeletonBox, SkeletonCard, SkeletonCircle, SkeletonText, SlideShow, Slider, Socials, Spreadsheet, Statistic, Stepper, Switch, Table, Tabs_default as Tabs, TagsInput, DatePicker as Temporal, Testimonials, TextArea, TextInput, ThemeProvider, ThemeSwitch, TimePicker, Timeline, Tooltip, TooltipProvider, TopBar, Tree, TreeSelect, Typography, Video, VirtualList, Wizard, cardNumberError, cvvError, cx, defaultPasswordRules, detectBrand, expiryError, fieldShell, formatCardNumber, formatExpiry, isRequired, luhnValid, onlyDigits, patterns, runFieldRules, scorePassword, useBreakpoint, useCart, useExcel, useFieldArray, useForm, useFormField, useFormStore, useJwt, useLocalStorage, useMediaQuery, useNotification, usePdf };
|
|
11629
11836
|
//# sourceMappingURL=index.js.map
|
|
11630
11837
|
//# sourceMappingURL=index.js.map
|