alepha 0.11.5 → 0.11.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/ui.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  import * as _alepha_core0 from "alepha";
2
- import { Async, TObject } from "alepha";
2
+ import { Async, Page, PageMetadata, TObject, TProperties } from "alepha";
3
3
  import { FormModel, InputField } from "alepha/react/form";
4
4
  import * as _alepha_react0 from "alepha/react";
5
5
  import { RouterGoOptions, UseActionReturn, UseActiveOptions } from "alepha/react";
6
6
  import { ModalsProviderProps } from "@mantine/modals";
7
- import { AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarProps, AppShellProps, AutocompleteProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, FileInputProps, Flex, FlexProps, MantineBreakpoint, MantineProviderProps, MenuProps, MenuTargetProps, ModalProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SwitchProps, TableProps, TableTrProps, TagsInputProps, Text, TextInputProps, TextareaProps, ThemeIconProps, TooltipProps } from "@mantine/core";
8
- import * as react_jsx_runtime9 from "react/jsx-runtime";
7
+ import { AppShellFooterProps, AppShellHeaderProps, AppShellMainProps, AppShellNavbarProps, AppShellProps, AutocompleteProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, FileInputProps, Flex, FlexProps, MantineBreakpoint, MantineProviderProps, MenuProps, MenuTargetProps, ModalProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SliderProps, SwitchProps, TableProps, TableTrProps, TagsInputProps, Text, TextInputProps, TextareaProps, ThemeIconProps, TooltipProps } from "@mantine/core";
8
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
9
9
  import { ComponentType, ReactNode } from "react";
10
10
  import * as _mantine_notifications0 from "@mantine/notifications";
11
11
  import { NotificationData, NotificationsProps } from "@mantine/notifications";
12
12
  import { DateInputProps, DateTimePickerProps, TimeInputProps } from "@mantine/dates";
13
13
  import { NavigationProgressProps } from "@mantine/nprogress";
14
+ import { DurationLike } from "alepha/datetime";
14
15
 
15
16
  //#region src/utils/parseInput.d.ts
16
17
  interface GenericControlProps {
@@ -20,6 +21,12 @@ interface GenericControlProps {
20
21
  icon?: ReactNode;
21
22
  }
22
23
  //#endregion
24
+ //#region src/components/form/ControlNumber.d.ts
25
+ interface ControlNumberProps extends GenericControlProps {
26
+ numberInputProps?: Partial<NumberInputProps>;
27
+ sliderProps?: Partial<SliderProps>;
28
+ }
29
+ //#endregion
23
30
  //#region src/components/form/ControlSelect.d.ts
24
31
  type SelectValueLabel = string | {
25
32
  value: string;
@@ -47,7 +54,7 @@ interface ControlSelectProps extends GenericControlProps {
47
54
  *
48
55
  * Automatically detects enum values and array types from schema.
49
56
  */
50
- declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime9.JSX.Element | null;
57
+ declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime5.JSX.Element | null;
51
58
  //#endregion
52
59
  //#region src/components/form/Control.d.ts
53
60
  interface ControlProps extends GenericControlProps {
@@ -56,12 +63,13 @@ interface ControlProps extends GenericControlProps {
56
63
  select?: boolean | Partial<ControlSelectProps>;
57
64
  password?: boolean | PasswordInputProps;
58
65
  switch?: boolean | SwitchProps;
59
- number?: boolean | NumberInputProps;
66
+ number?: boolean | Partial<ControlNumberProps>;
60
67
  file?: boolean | FileInputProps;
61
68
  color?: boolean | ColorInputProps;
62
69
  date?: boolean | DateInputProps;
63
70
  datetime?: boolean | DateTimePickerProps;
64
71
  time?: boolean | TimeInputProps;
72
+ query?: any;
65
73
  custom?: ComponentType<CustomControlProps>;
66
74
  }
67
75
  /**
@@ -81,11 +89,12 @@ interface ControlProps extends GenericControlProps {
81
89
  * - DateInput (for date format)
82
90
  * - DateTimePicker (for date-time format)
83
91
  * - TimeInput (for time format)
92
+ * - QueryBuilder (for building type-safe queries with autocomplete)
84
93
  * - Custom component
85
94
  *
86
95
  * Automatically handles labels, descriptions, error messages, required state, and default icons.
87
96
  */
88
- declare const Control: (_props: ControlProps) => react_jsx_runtime9.JSX.Element | null;
97
+ declare const Control: (_props: ControlProps) => react_jsx_runtime5.JSX.Element | null;
89
98
  type CustomControlProps = {
90
99
  defaultValue: any;
91
100
  onChange: (value: any) => void;
@@ -180,9 +189,10 @@ interface ActionCommonProps extends ButtonProps {
180
189
  themeIconProps?: ThemeIconProps;
181
190
  }
182
191
  type ActionProps = ActionCommonProps & (ActionNavigationButtonProps | ActionClickButtonProps | ActionSubmitButtonProps | ActionHookButtonProps | {});
183
- declare const ActionButton: (_props: ActionProps) => react_jsx_runtime9.JSX.Element;
192
+ declare const ActionButton: (_props: ActionProps) => react_jsx_runtime5.JSX.Element;
184
193
  interface ActionSubmitButtonProps extends ButtonProps {
185
194
  form: FormModel<any>;
195
+ type?: "submit" | "reset";
186
196
  }
187
197
  interface ActionHookButtonProps extends ButtonProps {
188
198
  action: UseActionReturn<any[], any>;
@@ -208,14 +218,14 @@ interface DarkModeButtonProps {
208
218
  segmentedProps?: Partial<SegmentedControlProps>;
209
219
  actionProps?: Partial<ActionProps>;
210
220
  }
211
- declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime9.JSX.Element;
221
+ declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime5.JSX.Element;
212
222
  //#endregion
213
223
  //#region src/components/buttons/OmnibarButton.d.ts
214
224
  interface OmnibarButtonProps {
215
225
  actionProps?: ActionProps;
216
226
  collapsed?: boolean;
217
227
  }
218
- declare const OmnibarButton: (props: OmnibarButtonProps) => react_jsx_runtime9.JSX.Element;
228
+ declare const OmnibarButton: (props: OmnibarButtonProps) => react_jsx_runtime5.JSX.Element;
219
229
  //#endregion
220
230
  //#region src/services/DialogService.d.ts
221
231
  interface BaseDialogOptions extends Partial<ModalProps> {
@@ -300,19 +310,19 @@ declare class DialogService {
300
310
  declare const AlertDialog: ({
301
311
  options,
302
312
  onClose
303
- }: AlertDialogProps) => react_jsx_runtime9.JSX.Element;
313
+ }: AlertDialogProps) => react_jsx_runtime5.JSX.Element;
304
314
  //#endregion
305
315
  //#region src/components/dialogs/ConfirmDialog.d.ts
306
316
  declare const ConfirmDialog: ({
307
317
  options,
308
318
  onConfirm
309
- }: ConfirmDialogProps) => react_jsx_runtime9.JSX.Element;
319
+ }: ConfirmDialogProps) => react_jsx_runtime5.JSX.Element;
310
320
  //#endregion
311
321
  //#region src/components/dialogs/PromptDialog.d.ts
312
322
  declare const PromptDialog: ({
313
323
  options,
314
324
  onSubmit
315
- }: PromptDialogProps) => react_jsx_runtime9.JSX.Element;
325
+ }: PromptDialogProps) => react_jsx_runtime5.JSX.Element;
316
326
  //#endregion
317
327
  //#region src/components/form/ControlDate.d.ts
318
328
  interface ControlDateProps extends GenericControlProps {
@@ -330,7 +340,26 @@ interface ControlDateProps extends GenericControlProps {
330
340
  *
331
341
  * Automatically detects date formats from schema and renders appropriate picker.
332
342
  */
333
- declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime9.JSX.Element | null;
343
+ declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime5.JSX.Element | null;
344
+ //#endregion
345
+ //#region src/components/form/ControlQueryBuilder.d.ts
346
+ interface ControlQueryBuilderProps extends Omit<TextInputProps, "value" | "onChange"> {
347
+ schema?: TObject;
348
+ value?: string;
349
+ onChange?: (value: string) => void;
350
+ placeholder?: string;
351
+ }
352
+ /**
353
+ * Query builder with text input and help popover.
354
+ * Generates query strings for parseQueryString syntax.
355
+ */
356
+ declare const ControlQueryBuilder: ({
357
+ schema,
358
+ value,
359
+ onChange,
360
+ placeholder,
361
+ ...textInputProps
362
+ }: ControlQueryBuilderProps) => react_jsx_runtime5.JSX.Element;
334
363
  //#endregion
335
364
  //#region src/components/form/TypeForm.d.ts
336
365
  interface TypeFormProps<T extends TObject> {
@@ -343,6 +372,7 @@ interface TypeFormProps<T extends TObject> {
343
372
  lg?: number;
344
373
  xl?: number;
345
374
  };
375
+ schema?: TObject;
346
376
  children?: (input: FormModel<T>["input"]) => ReactNode;
347
377
  controlProps?: Partial<Omit<ControlProps, "input">>;
348
378
  skipFormElement?: boolean;
@@ -375,7 +405,7 @@ interface TypeFormProps<T extends TObject> {
375
405
  * return <TypeForm form={form} columns={2} />;
376
406
  * ```
377
407
  */
378
- declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime9.JSX.Element | null;
408
+ declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime5.JSX.Element | null;
379
409
  //#endregion
380
410
  //#region src/components/buttons/LanguageButton.d.ts
381
411
  interface LanguageButtonProps {
@@ -420,7 +450,7 @@ interface AppBarProps {
420
450
  flexProps?: FlexProps;
421
451
  items?: AppBarItem[];
422
452
  }
423
- declare const AppBar: (props: AppBarProps) => react_jsx_runtime9.JSX.Element;
453
+ declare const AppBar: (props: AppBarProps) => react_jsx_runtime5.JSX.Element;
424
454
  //#endregion
425
455
  //#region src/components/layout/Sidebar.d.ts
426
456
  interface SidebarProps {
@@ -434,7 +464,7 @@ interface SidebarProps {
434
464
  collapsed?: boolean;
435
465
  gap?: MantineBreakpoint;
436
466
  }
437
- declare const Sidebar: (props: SidebarProps) => react_jsx_runtime9.JSX.Element;
467
+ declare const Sidebar: (props: SidebarProps) => react_jsx_runtime5.JSX.Element;
438
468
  interface SidebarItemProps {
439
469
  item: SidebarMenuItem;
440
470
  level: number;
@@ -466,12 +496,14 @@ interface SidebarSearch extends SidebarAbstractItem {
466
496
  interface SidebarSection extends SidebarAbstractItem {
467
497
  type: "section";
468
498
  label: string;
499
+ icon?: ReactNode;
469
500
  }
470
501
  interface SidebarMenuItem extends SidebarAbstractItem {
471
502
  label: string | ReactNode;
472
503
  description?: string;
473
504
  icon?: ReactNode;
474
505
  href?: string;
506
+ target?: "_blank" | "_self" | "_parent" | "_top";
475
507
  activeStartsWith?: boolean;
476
508
  onClick?: () => void;
477
509
  children?: SidebarMenuItem[];
@@ -503,11 +535,17 @@ interface AdminShellProps {
503
535
  }
504
536
  declare module "alepha" {
505
537
  interface State {
538
+ /**
539
+ * Whether the sidebar is opened or closed.
540
+ */
506
541
  "alepha.ui.sidebar.opened"?: boolean;
542
+ /**
543
+ * Whether the sidebar is collapsed (narrow) or expanded (wide).
544
+ */
507
545
  "alepha.ui.sidebar.collapsed"?: boolean;
508
546
  }
509
547
  }
510
- declare const AdminShell: (props: AdminShellProps) => react_jsx_runtime9.JSX.Element;
548
+ declare const AdminShell: (props: AdminShellProps) => react_jsx_runtime5.JSX.Element;
511
549
  //#endregion
512
550
  //#region src/components/layout/Omnibar.d.ts
513
551
  interface OmnibarProps {
@@ -515,7 +553,7 @@ interface OmnibarProps {
515
553
  searchPlaceholder?: string;
516
554
  nothingFound?: ReactNode;
517
555
  }
518
- declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime9.JSX.Element;
556
+ declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime5.JSX.Element;
519
557
  //#endregion
520
558
  //#region src/components/layout/AlephaMantineProvider.d.ts
521
559
  interface AlephaMantineProviderProps {
@@ -527,22 +565,58 @@ interface AlephaMantineProviderProps {
527
565
  modals?: ModalsProviderProps;
528
566
  omnibar?: OmnibarProps;
529
567
  }
530
- declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime9.JSX.Element;
568
+ declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime5.JSX.Element;
531
569
  //#endregion
532
570
  //#region src/components/table/DataTable.d.ts
533
571
  interface DataTableColumn<T extends object> {
534
572
  label: string;
535
- value: (item: T) => ReactNode;
573
+ value: (item: T, index: number) => ReactNode;
536
574
  }
575
+ type MaybePage<T> = Omit<Page<T>, "page"> & {
576
+ page?: Partial<PageMetadata>;
577
+ };
537
578
  interface DataTableProps<T extends object> {
538
- items: T[] | (() => Async<T[]>);
579
+ /**
580
+ * The items to display in the table. Can be a static page of items or a function that returns a promise resolving to a page of items.
581
+ */
582
+ items: MaybePage<T> | ((filters: Record<string, string> & {
583
+ page: number;
584
+ size: number;
585
+ sort?: string;
586
+ }) => Async<MaybePage<T>>);
587
+ /**
588
+ * The columns to display in the table. Each column is defined by a key and a DataTableColumn object.
589
+ */
539
590
  columns: {
540
591
  [key: string]: DataTableColumn<T>;
541
592
  };
593
+ defaultSize?: number;
594
+ /**
595
+ * Optional filters to apply to the data.
596
+ */
597
+ filters?: TObject;
598
+ panel?: (item: T) => ReactNode;
599
+ canPanel?: (item: T) => boolean;
600
+ submitOnInit?: boolean;
601
+ submitEvery?: DurationLike;
602
+ withLineNumbers?: boolean;
603
+ withCheckbox?: boolean;
604
+ checkboxActions?: any[];
605
+ actions?: any[];
606
+ /**
607
+ * Enable infinity scroll mode. When true, pagination controls are hidden and new items are loaded automatically when scrolling to the bottom.
608
+ */
609
+ infinityScroll?: boolean;
610
+ /**
611
+ * Props to pass to the Mantine Table component.
612
+ */
542
613
  tableProps?: TableProps;
614
+ /**
615
+ * Function to generate props for each table row based on the item.
616
+ */
543
617
  tableTrProps?: (item: T) => TableTrProps;
544
618
  }
545
- declare const DataTable: <T extends object>(props: DataTableProps<T>) => react_jsx_runtime9.JSX.Element;
619
+ declare const DataTable: <T extends object>(props: DataTableProps<T>) => react_jsx_runtime5.JSX.Element;
546
620
  //#endregion
547
621
  //#region src/constants/ui.d.ts
548
622
  declare const ui: {
@@ -551,6 +625,7 @@ declare const ui: {
551
625
  background: string;
552
626
  surface: string;
553
627
  elevated: string;
628
+ border: string;
554
629
  };
555
630
  };
556
631
  //#endregion
@@ -603,6 +678,34 @@ declare class RootRouter {
603
678
  readonly root: _alepha_react0.PageDescriptor<_alepha_react0.PageConfigSchema, any, _alepha_react0.TPropsParentDefault>;
604
679
  }
605
680
  //#endregion
681
+ //#region src/utils/extractSchemaFields.d.ts
682
+ interface SchemaField {
683
+ name: string;
684
+ path: string;
685
+ type: string;
686
+ enum?: readonly any[];
687
+ format?: string;
688
+ description?: string;
689
+ nested?: SchemaField[];
690
+ }
691
+ /**
692
+ * Extract field information from a TypeBox schema for query building.
693
+ * Supports nested objects and provides field metadata for autocomplete.
694
+ */
695
+ declare function extractSchemaFields(schema: TObject | TProperties, prefix?: string): SchemaField[];
696
+ /**
697
+ * Get suggested operators based on field type
698
+ */
699
+ declare function getOperatorsForField(field: SchemaField): string[];
700
+ /**
701
+ * Get operator symbol and description
702
+ */
703
+ declare const OPERATOR_INFO: Record<string, {
704
+ symbol: string;
705
+ label: string;
706
+ example: string;
707
+ }>;
708
+ //#endregion
606
709
  //#region src/utils/icons.d.ts
607
710
  /**
608
711
  * Icon size presets following Mantine's size conventions
@@ -677,7 +780,7 @@ declare module "alepha/react" {
677
780
  *
678
781
  * @module alepha.ui
679
782
  */
680
- declare const AlephaUI: _alepha_core0.Service<_alepha_core0.Module<{}>>;
783
+ declare const AlephaUI: _alepha_core0.Service<_alepha_core0.Module>;
681
784
  //#endregion
682
- export { ActionButton, type ActionClickButtonProps, type ActionCommonProps, type ActionMenuConfig, type ActionMenuItem, type ActionNavigationButtonProps, type ActionProps, type ActionSubmitButtonProps, AdminShell, AlephaMantineProvider, AlephaUI, AlertDialog, type AlertDialogOptions, type AlertDialogProps, AppBar, type AppBarBurger, type AppBarDark, type AppBarDivider, type AppBarElement, type AppBarItem, type AppBarLang, type AppBarProps, type AppBarSearch, type AppBarSpacer, type BaseDialogOptions, ConfirmDialog, type ConfirmDialogOptions, type ConfirmDialogProps, Control, ControlDate, ControlSelect, DarkModeButton, DataTable, type DataTableColumn, type DataTableProps, DialogService, Flex, ICON_SIZES, IconSize, Omnibar, OmnibarButton, PromptDialog, type PromptDialogOptions, type PromptDialogProps, RootRouter, Sidebar, type SidebarAbstractItem, type SidebarButtonTheme, type SidebarDivider, type SidebarElement, type SidebarItemProps, type SidebarMenuItem, type SidebarNode, type SidebarProps, type SidebarSearch, type SidebarSection, type SidebarSpacer, type SidebarTheme, Text, ToastService, TypeForm, capitalize, getDefaultIcon, prettyName, ui, useDialog, useToast };
785
+ export { ActionButton, type ActionClickButtonProps, type ActionCommonProps, type ActionMenuConfig, type ActionMenuItem, type ActionNavigationButtonProps, type ActionProps, type ActionSubmitButtonProps, AdminShell, AlephaMantineProvider, AlephaUI, AlertDialog, type AlertDialogOptions, type AlertDialogProps, AppBar, type AppBarBurger, type AppBarDark, type AppBarDivider, type AppBarElement, type AppBarItem, type AppBarLang, type AppBarProps, type AppBarSearch, type AppBarSpacer, type BaseDialogOptions, ConfirmDialog, type ConfirmDialogOptions, type ConfirmDialogProps, Control, ControlDate, ControlQueryBuilder, ControlSelect, DarkModeButton, DataTable, type DataTableColumn, type DataTableProps, DialogService, Flex, ICON_SIZES, IconSize, OPERATOR_INFO, Omnibar, OmnibarButton, PromptDialog, type PromptDialogOptions, type PromptDialogProps, RootRouter, SchemaField, Sidebar, type SidebarAbstractItem, type SidebarButtonTheme, type SidebarDivider, type SidebarElement, type SidebarItemProps, type SidebarMenuItem, type SidebarNode, type SidebarProps, type SidebarSearch, type SidebarSection, type SidebarSpacer, type SidebarTheme, Text, ToastService, TypeForm, capitalize, extractSchemaFields, getDefaultIcon, getOperatorsForField, prettyName, ui, useDialog, useToast };
683
786
  //# sourceMappingURL=index.d.ts.map