@juv/codego-react-ui 3.3.3 → 3.3.6
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 +144 -16
- package/dist/index.d.cts +120 -2
- package/dist/index.d.ts +120 -2
- package/dist/index.global.js +496 -130
- package/dist/index.js +142 -16
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import { AxiosRequestConfig } from 'axios';
|
|
5
|
+
import { UseBoundStore, StoreApi } from 'zustand';
|
|
4
6
|
|
|
5
7
|
type AuthView = "login" | "register" | "resetPassword";
|
|
6
8
|
interface AuthField {
|
|
@@ -248,6 +250,16 @@ interface UseServerTableOptions {
|
|
|
248
250
|
* Example: { status: { type: "badge" }, enabled: { type: "toggle", onChange: (item, v) => patch(item.id, v) } }
|
|
249
251
|
*/
|
|
250
252
|
columnOverrides?: Record<string, Partial<Column<any>>>;
|
|
253
|
+
/** Debounce delay for search in milliseconds. Default 300ms */
|
|
254
|
+
debounce?: number;
|
|
255
|
+
/** Transform API response to T[]. Default: (res) => res.data */
|
|
256
|
+
transform?: (response: any) => any[];
|
|
257
|
+
/** If true, hook won't fetch automatically. Call reload() manually */
|
|
258
|
+
manual?: boolean;
|
|
259
|
+
/** Called after successful data fetch */
|
|
260
|
+
onSuccess?: (data: any[]) => void;
|
|
261
|
+
/** Called on fetch error */
|
|
262
|
+
onError?: (error: Error) => void;
|
|
251
263
|
}
|
|
252
264
|
/**
|
|
253
265
|
* Return type from the useServerTable hook
|
|
@@ -264,6 +276,8 @@ interface UseServerTableReturn<T> {
|
|
|
264
276
|
error: string | null;
|
|
265
277
|
goToPage: (page: number) => void;
|
|
266
278
|
reload: () => void;
|
|
279
|
+
searchValue?: string;
|
|
280
|
+
onSearchChange?: (value: string) => void;
|
|
267
281
|
}
|
|
268
282
|
/**
|
|
269
283
|
* Server-side pagination prop passed to the Table component
|
|
@@ -290,7 +304,7 @@ interface ServerPaginationProp {
|
|
|
290
304
|
* })
|
|
291
305
|
* ```
|
|
292
306
|
*/
|
|
293
|
-
declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides }: UseServerTableOptions): UseServerTableReturn<T>;
|
|
307
|
+
declare function useServerTable<T extends Record<string, any>>({ url, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce, transform, manual, onSuccess, onError }: UseServerTableOptions): UseServerTableReturn<T>;
|
|
294
308
|
/**
|
|
295
309
|
* Available field types for action forms (edit/view modals)
|
|
296
310
|
* @type {ActionFieldType}
|
|
@@ -331,6 +345,8 @@ interface ActionField {
|
|
|
331
345
|
rowSpan?: number;
|
|
332
346
|
/** Custom render — overrides built-in field renderer */
|
|
333
347
|
render?: (value: any, onChange: (v: any) => void) => React.ReactNode;
|
|
348
|
+
/** Hide this field from view/edit forms */
|
|
349
|
+
hidden?: boolean;
|
|
334
350
|
}
|
|
335
351
|
/**
|
|
336
352
|
* Configuration for customizing the appearance of action buttons (View/Edit/Delete)
|
|
@@ -415,6 +431,21 @@ interface DefaultActionsConfig<T> {
|
|
|
415
431
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
416
432
|
/** Show a toast or notification banner on successful edit/delete */
|
|
417
433
|
onSuccessNotif?: ActionSuccessNotif;
|
|
434
|
+
/** Delete confirmation dialog config */
|
|
435
|
+
deleteConfirm?: {
|
|
436
|
+
title: string;
|
|
437
|
+
message: string;
|
|
438
|
+
};
|
|
439
|
+
/** Role/permission-based visibility for actions */
|
|
440
|
+
permissions?: (item: T) => {
|
|
441
|
+
view?: boolean;
|
|
442
|
+
edit?: boolean;
|
|
443
|
+
delete?: boolean;
|
|
444
|
+
};
|
|
445
|
+
/** Hook called before edit — return false to cancel */
|
|
446
|
+
beforeEdit?: (item: T) => Promise<boolean>;
|
|
447
|
+
/** Hook called before delete — return false to cancel */
|
|
448
|
+
beforeDelete?: (item: T) => Promise<boolean>;
|
|
418
449
|
/** Customize the View button appearance */
|
|
419
450
|
viewButton?: ActionButtonConfig;
|
|
420
451
|
/** Customize the Edit button appearance */
|
|
@@ -500,6 +531,20 @@ interface Column<T> {
|
|
|
500
531
|
sortable?: boolean;
|
|
501
532
|
/** Called when a cell value changes (select, toggle, color, checkbox) */
|
|
502
533
|
onChange?: (item: T, value: any) => void;
|
|
534
|
+
/** Column width in px or CSS string */
|
|
535
|
+
width?: number | string;
|
|
536
|
+
/** Text alignment: left, center, right */
|
|
537
|
+
align?: "left" | "center" | "right";
|
|
538
|
+
/** Enable column-level filtering */
|
|
539
|
+
filterable?: boolean;
|
|
540
|
+
/** Filter type: text, select, date, range */
|
|
541
|
+
filterType?: "text" | "select" | "date" | "range";
|
|
542
|
+
/** Hide this column */
|
|
543
|
+
hidden?: boolean;
|
|
544
|
+
/** Tooltip text generator */
|
|
545
|
+
tooltip?: (item: T) => string;
|
|
546
|
+
/** Allow copying cell content */
|
|
547
|
+
copyable?: boolean;
|
|
503
548
|
}
|
|
504
549
|
/**
|
|
505
550
|
* Props for the Table component
|
|
@@ -509,6 +554,37 @@ interface Column<T> {
|
|
|
509
554
|
interface TableProps<T> {
|
|
510
555
|
data: T[];
|
|
511
556
|
columns: Column<T>[];
|
|
557
|
+
loading?: boolean;
|
|
558
|
+
emptyState?: React.ReactNode;
|
|
559
|
+
error?: string | null;
|
|
560
|
+
searchValue?: string;
|
|
561
|
+
onSearchChange?: (value: string) => void;
|
|
562
|
+
page?: number;
|
|
563
|
+
onPageChange?: (page: number) => void;
|
|
564
|
+
sort?: {
|
|
565
|
+
key: string;
|
|
566
|
+
direction: "asc" | "desc";
|
|
567
|
+
}[];
|
|
568
|
+
onSortChange?: (sort: {
|
|
569
|
+
key: string;
|
|
570
|
+
direction: "asc" | "desc";
|
|
571
|
+
}[]) => void;
|
|
572
|
+
onRowClick?: (item: T) => void;
|
|
573
|
+
onRowDoubleClick?: (item: T) => void;
|
|
574
|
+
rowClassName?: (item: T) => string;
|
|
575
|
+
expandable?: boolean;
|
|
576
|
+
renderExpanded?: (item: T) => React.ReactNode;
|
|
577
|
+
columnVisibility?: Record<string, boolean>;
|
|
578
|
+
onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;
|
|
579
|
+
exportable?: boolean;
|
|
580
|
+
onExport?: (type: "csv" | "excel" | "pdf") => void;
|
|
581
|
+
virtualized?: boolean;
|
|
582
|
+
draggable?: boolean;
|
|
583
|
+
onRowReorder?: (data: T[]) => void;
|
|
584
|
+
keyboardNavigation?: boolean;
|
|
585
|
+
theme?: "light" | "dark" | "auto";
|
|
586
|
+
meta?: Record<string, any>;
|
|
587
|
+
actions?: Record<string, (item: T) => void>;
|
|
512
588
|
searchable?: boolean;
|
|
513
589
|
searchPlaceholder?: string;
|
|
514
590
|
pagination?: boolean;
|
|
@@ -2300,4 +2376,46 @@ interface WizardProps {
|
|
|
2300
2376
|
}
|
|
2301
2377
|
declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
|
|
2302
2378
|
|
|
2303
|
-
|
|
2379
|
+
interface NotificationConfig {
|
|
2380
|
+
/** Show success notification */
|
|
2381
|
+
onSuccessNotification?: boolean;
|
|
2382
|
+
/** Success notification title */
|
|
2383
|
+
successNotifTitle?: string;
|
|
2384
|
+
/** Success notification content/message */
|
|
2385
|
+
successNotifContent?: string;
|
|
2386
|
+
/** Show error notification */
|
|
2387
|
+
onErrorNotification?: boolean;
|
|
2388
|
+
/** Error notification title */
|
|
2389
|
+
errorNotifTitle?: string;
|
|
2390
|
+
/** Error notification content/message */
|
|
2391
|
+
errorNotifContent?: string;
|
|
2392
|
+
}
|
|
2393
|
+
interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig {
|
|
2394
|
+
data?: T;
|
|
2395
|
+
skipAuth?: boolean;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
declare const api: {
|
|
2399
|
+
get: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
|
|
2400
|
+
post: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2401
|
+
put: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2402
|
+
patch: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
|
|
2403
|
+
delete: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
type StoreWrapper<T extends object> = {
|
|
2407
|
+
store: UseBoundStore<StoreApi<T & {
|
|
2408
|
+
set: (val: Partial<T>) => void;
|
|
2409
|
+
}>>;
|
|
2410
|
+
getStore: () => string;
|
|
2411
|
+
};
|
|
2412
|
+
/**
|
|
2413
|
+
* Create a universal Zustand store with optional auto-expire
|
|
2414
|
+
*
|
|
2415
|
+
* @param initialValue - Initial state object
|
|
2416
|
+
* @param sessionName - Key for localStorage persistence
|
|
2417
|
+
* @param expireInterval - Optional expiration in milliseconds
|
|
2418
|
+
*/
|
|
2419
|
+
declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
|
|
2420
|
+
|
|
2421
|
+
export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
|