@wordrhyme/auto-crud 1.5.7 → 1.7.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.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as React$1 from "react";
2
2
  import * as _tanstack_react_table0 from "@tanstack/react-table";
3
- import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
3
+ import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
4
4
  import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
5
5
  import { ClassValue } from "clsx";
6
6
  import * as react_jsx_runtime2 from "react/jsx-runtime";
7
7
  import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
8
+ import { DropdownMenuItem as DropdownMenuItem$1 } from "@wordrhyme/ui";
8
9
  import { z } from "zod";
9
10
  import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
10
11
  import { ISchema } from "@formily/json-schema";
@@ -326,1113 +327,1164 @@ interface CrudPermissions {
326
327
  deny?: string[];
327
328
  }
328
329
  //#endregion
329
- //#region src/components/auto-crud/auto-table-action-bar.d.ts
330
- /** 批量更新字段配置 */
331
- interface BatchUpdateField {
332
- /** 字段名 */
333
- field: string;
334
- /** 显示标签 */
335
- label: string;
336
- /** 可选值 */
337
- options: Array<{
338
- label: string;
339
- value: string;
340
- }>;
330
+ //#region src/hooks/use-url-state.d.ts
331
+ /**
332
+ * URL 状态管理 Hook - 替代 nuqs
333
+ * 将 React 状态同步到 URL query string
334
+ *
335
+ * 架构说明:
336
+ * - 使用 queueMicrotask 延迟 URL 更新,确保在渲染完成后执行
337
+ * - 符合 React 渲染规则,不会触发 "Cannot update a component while rendering" 错误
338
+ */
339
+ interface UrlStateOptions {
340
+ /** 历史记录模式: push 添加新记录, replace 替换当前记录 */
341
+ history?: 'push' | 'replace';
342
+ /** 是否浅层更新(不触发页面刷新) */
343
+ shallow?: boolean;
344
+ /** 节流时间(毫秒) */
345
+ throttleMs?: number;
346
+ /** 防抖时间(毫秒) */
347
+ debounceMs?: number;
348
+ /** 当值等于默认值时是否清除 URL 参数 */
349
+ clearOnDefault?: boolean;
350
+ /** 滚动到顶部 */
351
+ scroll?: boolean;
352
+ /** React transition */
353
+ startTransition?: React$1.TransitionStartFunction;
341
354
  }
342
- interface BatchActionContext<TData> {
343
- /** 选中的原始行数据 */
344
- rows: TData[];
345
- /** TanStack Table 实例 */
346
- table: Table<TData>;
347
- /** 清空当前选择 */
348
- clearSelection: () => void;
355
+ interface Parser<T> {
356
+ parse: (value: string) => T;
357
+ serialize: (value: T) => string;
349
358
  }
350
- type BatchBuiltinActionType = 'batchUpdate' | 'export' | 'delete';
351
- type BatchActionMeta = {
352
- id?: string;
353
- order?: number;
354
- hidden?: boolean;
359
+ declare const parseAsInteger: Parser<number> & {
360
+ withDefault: (defaultValue: number) => Parser<number> & {
361
+ defaultValue: number;
362
+ };
355
363
  };
356
- type BatchBuiltinActionItem<TData> = BatchActionMeta & {
357
- type: BatchBuiltinActionType;
358
- /** 替代默认行为 */
359
- onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
360
- /** 替代默认标签,仅对 export/delete 生效 */
361
- label?: string;
362
- /** 替代整个内置操作的渲染 */
363
- component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
364
+ declare const parseAsString: Parser<string> & {
365
+ withDefault: (defaultValue: string) => Parser<string> & {
366
+ defaultValue: string;
367
+ };
364
368
  };
365
- type BatchCustomActionItem<TData> = BatchActionMeta & {
366
- type: 'custom';
367
- /** 操作文本。传 component 时可省略 */
368
- label?: string;
369
- /** 自定义点击行为。传 component 时可省略 */
370
- onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
371
- /** 渲染自定义内容 */
372
- component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
373
- /** 仅在无内置项时生效:插入到首部还是尾部(默认 end) */
374
- position?: 'start' | 'end';
375
- variant?: 'default' | 'destructive';
369
+ declare function parseAsStringEnum<T extends string>(validValues: readonly T[]): Parser<T | null> & {
370
+ withDefault: (defaultValue: T) => Parser<T> & {
371
+ defaultValue: T;
372
+ };
376
373
  };
377
- type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
378
- type BatchActionConfig<TData> = BatchActionItem<TData>[] | ((defaults: BatchBuiltinActionItem<TData>[]) => BatchActionItem<TData>[]);
379
- interface BatchDeleteConfirmation {
380
- title: string;
381
- description: (count: number) => string;
382
- cancel: string;
383
- confirm: string;
384
- }
385
- interface AutoTableActionBarProps<TData> {
386
- table: Table<TData>;
387
- onDeleteSelected?: (rows: TData[]) => void;
388
- /** 批量更新回调 */
389
- onUpdateSelected?: (rows: TData[], data: Record<string, unknown>) => void;
390
- /** 批量更新字段配置 */
391
- batchUpdateFields?: BatchUpdateField[];
392
- /** 是否启用导出功能 */
393
- enableExport?: boolean;
394
- /** 未配置 actions / 只配置 custom actions 时,是否展示默认导出按钮 */
395
- showDefaultExport?: boolean;
396
- /** 是否启用删除功能 */
397
- enableDelete?: boolean;
398
- /** 额外的操作按钮 */
399
- extraActions?: React$1.ReactNode;
400
- /** 批量操作配置,支持和行操作/顶部工具栏一致的顺序接管语义 */
401
- actions?: BatchActionConfig<TData>;
402
- /** 批量删除二次确认文案 */
403
- deleteConfirmation?: BatchDeleteConfirmation;
404
- }
405
- declare function AutoTableActionBar<TData>({
406
- table,
407
- onDeleteSelected,
408
- onUpdateSelected,
409
- batchUpdateFields,
410
- enableExport,
411
- showDefaultExport,
412
- enableDelete,
413
- extraActions,
414
- actions,
415
- deleteConfirmation
416
- }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
417
- //#endregion
418
- //#region src/lib/schema-bridge/types.d.ts
419
- /**
420
- * 字段类型映射
421
- */
422
- type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'array' | 'object';
423
- /**
424
- * DataTable Filter Variant
425
- */
426
- type FilterVariant = 'text' | 'number' | 'boolean' | 'select' | 'multiSelect' | 'date' | 'dateRange' | 'range';
427
- /**
428
- * 解析后的 Zod 字段信息
429
- */
430
- interface ParsedZodField {
431
- type: FieldType;
432
- required: boolean;
433
- enumValues?: string[];
434
- description?: string;
435
- defaultValue?: unknown;
436
- }
437
- /**
438
- * 列定义覆盖选项
439
- */
440
- type ColumnOverrides<T> = Partial<{ [K in keyof T]: Partial<ColumnDef<T, unknown>> & {
441
- hidden?: boolean;
442
- label?: string;
443
- index?: number;
444
- } }>;
445
- /**
446
- * Formily Schema 覆盖选项
447
- */
448
- type FormSchemaOverrides = Record<string, Partial<ISchema>>;
449
- /**
450
- * createTableSchema 选项
451
- */
452
- interface CreateTableSchemaOptions<T> {
453
- overrides?: ColumnOverrides<T>;
454
- exclude?: (keyof T)[];
455
- }
456
- /**
457
- * createFormSchema 选项
458
- */
459
- interface CreateFormSchemaOptions {
460
- overrides?: FormSchemaOverrides;
461
- exclude?: string[];
462
- layout?: 'vertical' | 'horizontal' | 'grid';
463
- gridColumns?: number;
464
- /** Label 对齐方式 */
465
- labelAlign?: 'left' | 'top' | 'right';
466
- /** Label 宽度(labelAlign 为 left 时有效) */
467
- labelWidth?: number | string;
468
- /** Label 栅格占位 */
469
- labelCol?: number;
470
- /** 输入框栅格占位 */
471
- wrapperCol?: number;
472
- }
473
- /**
474
- * Enum 选项类型
475
- */
476
- interface EnumOption {
477
- label: string;
478
- value: string;
479
- }
480
- //#endregion
481
- //#region src/lib/schema-bridge/zod-to-columns.d.ts
482
- /**
483
- * 解析 Zod 字段类型
484
- */
485
- declare function parseZodField(schema: z.ZodType): ParsedZodField;
486
- /**
487
- * 从 Zod Schema 创建 Table Schema (ColumnDef 数组)
488
- */
489
- declare function createTableSchema<T extends z.ZodObject<z.ZodRawShape>>(schema: T, options?: CreateTableSchemaOptions<z.infer<T>>): ColumnDef<z.infer<T>>[];
490
- /**
491
- * 创建选择列
492
- */
493
- declare function createSelectColumn<T>(): ColumnDef<T>;
374
+ declare function parseAsArrayOf<T>(itemParser: Parser<T>, separator?: string): Parser<T[]> & {
375
+ withDefault: (defaultValue: T[]) => Parser<T[]> & {
376
+ defaultValue: T[];
377
+ };
378
+ };
379
+ declare function getUrlParams(): URLSearchParams;
380
+ declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions, 'history' | 'scroll'>): void;
494
381
  /**
495
- * 操作列配置
382
+ * 单个 URL 状态参数
496
383
  */
384
+ declare function useUrlState<T>(key: string, parser: Parser<T> & {
385
+ defaultValue?: T;
386
+ }, options?: UrlStateOptions): [T, (value: T | ((prev: T) => T)) => void];
497
387
  /**
498
- * 已解析的操作项(渲染层使用)
388
+ * 多个 URL 状态参数
499
389
  */
500
- interface ResolvedActionItem<T, TContext = any> {
501
- label?: string;
502
- onClick?: (row: T) => void;
503
- component?: React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
504
- getContext?: (row: T) => TContext;
505
- separator?: boolean;
506
- variant?: 'default' | 'destructive';
507
- }
390
+ declare function useUrlStates<T extends Record<string, unknown>>(parsers: { [K in keyof T]: Parser<T[K]> & {
391
+ defaultValue?: T[K];
392
+ } }, options?: UrlStateOptions): [T, (values: Partial<T>) => void];
508
393
  /**
509
- * 操作列配置(ResolvedActionItem 数组)
394
+ * nuqs 兼容层 - useQueryState
510
395
  */
511
- type ActionsColumnConfig<T> = ResolvedActionItem<T, any>[];
396
+ declare function useQueryState<T>(key: string, parser: Parser<T> & {
397
+ defaultValue?: T;
398
+ }, options?: UrlStateOptions): [T, (value: T | ((prev: T) => T)) => Promise<URLSearchParams>];
512
399
  /**
513
- * 创建操作列
400
+ * nuqs 兼容层 - useQueryStates
514
401
  */
515
- declare function createActionsColumn<T>(items: ActionsColumnConfig<T>): ColumnDef<T>;
402
+ declare function useQueryStates<T extends Record<string, unknown>>(parsers: { [K in keyof T]: Parser<T[K]> & {
403
+ defaultValue?: T[K];
404
+ } }, options?: UrlStateOptions): [T, (values: Partial<T>) => Promise<URLSearchParams>];
516
405
  //#endregion
517
- //#region src/components/auto-crud/auto-table.d.ts
518
- /** 过滤模式类型 */
519
- type FilterMode = 'simple' | 'advanced' | 'command';
520
- interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
521
- schema: T;
522
- data: z.infer<T>[];
523
- pageCount?: number;
524
- /** Total rows matching the current search and filters. */
525
- total?: number;
526
- overrides?: ColumnOverrides<z.infer<T>>;
527
- enableRowSelection?: boolean;
528
- exclude?: (keyof z.infer<T>)[];
529
- actions?: ActionsColumnConfig<z.infer<T>>;
530
- /** 自定义固定列配置 */
531
- pinnedColumns?: {
532
- left?: string[];
533
- right?: string[];
534
- };
535
- /**
536
- * 过滤模式配置
537
- * - 单个值: 只使用该模式,不显示切换按钮
538
- * - 数组: 第一个为默认值,显示切换按钮
539
- * 默认: ["simple", "advanced", "command"] (全部显示)
540
- */
541
- filterMode?: FilterMode | FilterMode[];
542
- /** 全局搜索框 */
543
- search?: boolean | {
544
- placeholder?: string;
545
- };
546
- /** 批量删除回调 */
547
- onDeleteSelected?: (rows: z.infer<T>[]) => void;
548
- /** 批量更新回调 */
549
- onUpdateSelected?: (rows: z.infer<T>[], data: Record<string, unknown>) => void;
550
- /** 批量更新字段配置 */
551
- batchUpdateFields?: BatchUpdateField[];
552
- /** 批量操作栏额外按钮 */
553
- actionBarExtra?: React.ReactNode;
554
- /** 批量悬浮操作配置 */
555
- actionBarActions?: BatchActionConfig<z.infer<T>>;
556
- /** 批量删除二次确认文案 */
557
- deleteConfirmation?: BatchDeleteConfirmation;
558
- /** 初始排序 */
559
- initialSorting?: any[];
560
- /** 是否启用导出功能 (默认 true) */
561
- enableExport?: boolean;
562
- /** 未配置批量 actions / 只配置 custom actions 时,是否展示默认导出按钮 */
563
- showDefaultExport?: boolean;
564
- /** 选中行数变化回调(用于外层组件获知选中状态) */
565
- onSelectedCountChange?: (count: number) => void;
566
- /** 选中行数据变化回调(用于外层组件获知选中行身份变化) */
567
- onSelectedRowsChange?: (rows: z.infer<T>[]) => void;
568
- /** 获取选中行数据的回调(由外层组件调用) */
569
- getSelectedRows?: React.MutableRefObject<(() => z.infer<T>[]) | null>;
570
- }
571
- declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
572
- schema,
573
- data,
574
- pageCount,
575
- total,
576
- overrides,
577
- enableRowSelection,
578
- exclude,
579
- actions,
580
- pinnedColumns,
581
- filterMode,
582
- search,
583
- onDeleteSelected,
584
- onUpdateSelected,
585
- batchUpdateFields,
586
- actionBarExtra,
587
- actionBarActions,
588
- deleteConfirmation,
589
- initialSorting,
590
- enableExport,
591
- showDefaultExport,
592
- onSelectedCountChange,
593
- onSelectedRowsChange,
594
- getSelectedRows
595
- }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
596
- //#endregion
597
- //#region src/i18n/locale.d.ts
598
- /**
599
- * AutoCrud 国际化接口及内置语言包
600
- *
601
- * 使用方式:
602
- * // 内置语言
603
- * <AutoCrudTable locale="en-US" ... />
604
- *
605
- * // 部分覆盖(以 zh-CN 为基础深合并)
606
- * <AutoCrudTable locale={{ toolbar: { create: "Add" } }} ... />
607
- */
608
- interface AutoCrudLocale {
609
- toolbar: {
610
- refresh: string;
611
- create: string;
612
- import: string;
613
- export: string;
614
- exportSelected: (count: number) => string;
615
- };
616
- rowActions: {
617
- view: string;
618
- edit: string;
619
- copy: string;
620
- delete: string;
621
- };
622
- viewModal: {
623
- title: string;
624
- };
625
- boolean: {
626
- true: string;
627
- false: string;
628
- };
629
- formModal: {
630
- createTitle: string;
631
- editTitle: string;
632
- cancel: string;
633
- create: string;
634
- save: string;
635
- submitting: string;
636
- };
637
- deleteModal: {
638
- title: string;
639
- description: string;
640
- cancel: string;
641
- confirm: string;
642
- confirming: string;
643
- };
644
- bulkDeleteModal: {
645
- title: string;
646
- description: (count: number) => string;
647
- cancel: string;
648
- confirm: string;
649
- };
650
- importDialog: {
651
- title: string;
652
- uploadDescription: string;
653
- previewDescription: (count: number) => string;
654
- importingDescription: string;
655
- doneDescription: string;
656
- dragHint: string;
657
- formatHint: string;
658
- downloadTemplate: string;
659
- moreColumns: (count: number) => string;
660
- previewSummary: (rows: number, fields: number, format: string, previewLimit?: number) => string;
661
- reselect: string;
662
- confirmImport: string;
663
- importingRows: (count: number) => string;
664
- resultCreated: string;
665
- resultUpdated: string;
666
- resultSkipped: string;
667
- resultFailed: string;
668
- failedRowHeader: string;
669
- failedErrorHeader: string;
670
- close: string;
671
- continueImport: string;
672
- errorNoData: string;
673
- errorParseFailed: string;
674
- errorImportFailed: string;
675
- };
676
- }
677
- declare const zhCN: AutoCrudLocale;
678
- declare const enUS: AutoCrudLocale;
679
- declare const jaJP: AutoCrudLocale;
680
- declare const koKR: AutoCrudLocale;
681
- declare const frFR: AutoCrudLocale;
682
- declare const deDE: AutoCrudLocale;
683
- declare const esES: AutoCrudLocale;
684
- type DeepPartial<T> = { [P in keyof T]?: T[P] extends ((...args: unknown[]) => unknown) ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P] };
685
- /** locale prop 类型:内置语言 key 或部分覆盖对象 */
686
- type LocaleProp = string | DeepPartial<AutoCrudLocale>;
687
- /**
688
- * 解析 locale prop 为完整的 AutoCrudLocale
689
- * - string → 内置语言(fallback: zh-CN)
690
- * - object → 以 zh-CN 为基础深合并
691
- */
692
- declare function resolveLocale(localeProp?: LocaleProp): AutoCrudLocale;
693
- //#endregion
694
- //#region src/lib/registries.d.ts
695
- type AutoCrudFormComponentConfig = {
696
- component: React$1.ComponentType<any>;
697
- decorator?: string | React$1.ComponentType<any>;
698
- [key: string]: unknown;
699
- };
700
- type AutoCrudOption = {
701
- value: string;
702
- label: string;
703
- searchText?: string | string[];
704
- keywords?: string[];
705
- count?: number;
706
- disabled?: boolean;
707
- };
708
- type AutoCrudDataSourceContextType = 'form' | 'filter' | 'resolve';
709
- type AutoCrudDataSourceResolveFields = readonly string[] | ((context: {
710
- field: string;
711
- }) => readonly string[]);
712
- type AutoCrudDataSourceContext = {
713
- field: string;
714
- type: AutoCrudDataSourceContextType;
715
- page?: number;
716
- pageSize?: number;
717
- query?: string;
718
- /** @deprecated Use `query` instead. */
719
- search?: string;
720
- values?: Record<string, unknown> | Record<string, unknown>[];
721
- signal?: AbortSignal;
722
- };
723
- type AutoCrudDataSourceResult = AutoCrudOption[] | {
724
- hasMore?: boolean;
725
- options?: AutoCrudOption[];
726
- };
727
- type AutoCrudDataSourceLoader = (context: AutoCrudDataSourceContext) => AutoCrudDataSourceResult | Promise<AutoCrudDataSourceResult>;
728
- type AutoCrudDataSourceConfig = string;
729
- type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
730
- dependencies?: string[];
731
- reset?: boolean;
732
- search?: boolean;
733
- debounceMs?: number;
734
- loadMore?: boolean;
735
- pageSize?: number;
736
- resolveFields?: AutoCrudDataSourceResolveFields;
737
- load: AutoCrudDataSourceLoader;
738
- };
739
- type AutoCrudDataSourceEntry = {
740
- dependencies: string[];
741
- reset: boolean;
742
- search: boolean;
743
- debounceMs: number;
744
- loadMore: boolean;
745
- pageSize: number;
746
- resolveFields?: AutoCrudDataSourceResolveFields;
747
- load: AutoCrudDataSourceLoader;
748
- };
749
- type RegistryListener$1 = () => void;
750
- declare const formComponents: {
751
- register(name: string, value: AutoCrudFormComponentConfig): void;
752
- unregister(name: string): void;
753
- get(name: string): AutoCrudFormComponentConfig | undefined;
754
- all(): Record<string, AutoCrudFormComponentConfig>;
755
- subscribe(listener: RegistryListener$1): () => void;
756
- };
757
- declare const components: {
758
- register(name: string, value: AutoCrudFormComponentConfig): void;
759
- unregister(name: string): void;
760
- get(name: string): AutoCrudFormComponentConfig | undefined;
761
- all(): Record<string, AutoCrudFormComponentConfig>;
762
- subscribe(listener: RegistryListener$1): () => void;
763
- };
764
- declare const dataSources: {
765
- register(name: string, registration: AutoCrudDataSourceRegistration): void;
766
- unregister: (name: string) => void;
767
- get: (name: string) => AutoCrudDataSourceEntry | undefined;
768
- all: () => Record<string, AutoCrudDataSourceEntry>;
769
- subscribe: (listener: RegistryListener$1) => () => void;
406
+ //#region src/config/data-table.d.ts
407
+ type DataTableConfig = typeof dataTableConfig;
408
+ declare const dataTableConfig: {
409
+ textOperators: ({
410
+ label: string;
411
+ value: "iLike";
412
+ } | {
413
+ label: string;
414
+ value: "notILike";
415
+ } | {
416
+ label: string;
417
+ value: "eq";
418
+ } | {
419
+ label: string;
420
+ value: "ne";
421
+ } | {
422
+ label: string;
423
+ value: "isEmpty";
424
+ } | {
425
+ label: string;
426
+ value: "isNotEmpty";
427
+ })[];
428
+ numericOperators: ({
429
+ label: string;
430
+ value: "eq";
431
+ } | {
432
+ label: string;
433
+ value: "ne";
434
+ } | {
435
+ label: string;
436
+ value: "lt";
437
+ } | {
438
+ label: string;
439
+ value: "lte";
440
+ } | {
441
+ label: string;
442
+ value: "gt";
443
+ } | {
444
+ label: string;
445
+ value: "gte";
446
+ } | {
447
+ label: string;
448
+ value: "isBetween";
449
+ } | {
450
+ label: string;
451
+ value: "isEmpty";
452
+ } | {
453
+ label: string;
454
+ value: "isNotEmpty";
455
+ })[];
456
+ dateOperators: ({
457
+ label: string;
458
+ value: "eq";
459
+ } | {
460
+ label: string;
461
+ value: "ne";
462
+ } | {
463
+ label: string;
464
+ value: "lt";
465
+ } | {
466
+ label: string;
467
+ value: "gt";
468
+ } | {
469
+ label: string;
470
+ value: "lte";
471
+ } | {
472
+ label: string;
473
+ value: "gte";
474
+ } | {
475
+ label: string;
476
+ value: "isBetween";
477
+ } | {
478
+ label: string;
479
+ value: "isRelativeToToday";
480
+ } | {
481
+ label: string;
482
+ value: "isEmpty";
483
+ } | {
484
+ label: string;
485
+ value: "isNotEmpty";
486
+ })[];
487
+ selectOperators: ({
488
+ label: string;
489
+ value: "eq";
490
+ } | {
491
+ label: string;
492
+ value: "ne";
493
+ } | {
494
+ label: string;
495
+ value: "isEmpty";
496
+ } | {
497
+ label: string;
498
+ value: "isNotEmpty";
499
+ })[];
500
+ multiSelectOperators: ({
501
+ label: string;
502
+ value: "inArray";
503
+ } | {
504
+ label: string;
505
+ value: "notInArray";
506
+ } | {
507
+ label: string;
508
+ value: "isEmpty";
509
+ } | {
510
+ label: string;
511
+ value: "isNotEmpty";
512
+ })[];
513
+ booleanOperators: ({
514
+ label: string;
515
+ value: "eq";
516
+ } | {
517
+ label: string;
518
+ value: "ne";
519
+ })[];
520
+ sortOrders: ({
521
+ label: string;
522
+ value: "asc";
523
+ } | {
524
+ label: string;
525
+ value: "desc";
526
+ })[];
527
+ filterVariants: readonly ["text", "number", "range", "date", "dateRange", "boolean", "select", "multiSelect"];
528
+ operators: readonly ["iLike", "notILike", "eq", "ne", "inArray", "notInArray", "isEmpty", "isNotEmpty", "lt", "lte", "gt", "gte", "isBetween", "isRelativeToToday"];
529
+ joinOperators: readonly ["and", "or"];
770
530
  };
771
- declare function normalizeDataSourceConfig(config: AutoCrudDataSourceConfig | undefined): {
772
- key: string;
773
- } | undefined;
774
- declare function normalizeOptions(result: AutoCrudDataSourceResult | undefined): AutoCrudOption[];
775
531
  //#endregion
776
- //#region src/components/auto-crud/auto-crud-table.d.ts
777
- /**
778
- * 筛选器独立配置
779
- * 可独立于 table.meta 配置筛选器行为
780
- */
781
- interface FilterConfig {
782
- /** 是否启用筛选(默认跟随 table.meta.variant 推断) */
783
- enabled?: boolean;
784
- /** 筛选器类型 */
785
- variant?: 'text' | 'number' | 'range' | 'date' | 'dateRange' | 'boolean' | 'select' | 'multiSelect';
786
- /** select/multiSelect 的选项列表 */
787
- options?: FieldOption[];
788
- /** select/multiSelect 的动态选项源 */
789
- dataSource?: AutoCrudDataSourceConfig;
790
- /** range 的最小/最大值 */
791
- range?: [number, number];
792
- /** number 的单位 */
793
- unit?: string;
794
- /** 过滤器占位符 */
795
- placeholder?: string;
796
- /** 排序权重,数值越小越靠前 */
797
- index?: number;
798
- /** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
799
- hidden?: boolean;
800
- /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
801
- modes?: Array<'simple' | 'advanced' | 'command'>;
532
+ //#region src/lib/parsers.d.ts
533
+ declare const filterItemSchema: z.ZodObject<{
534
+ id: z.ZodString;
535
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
536
+ variant: z.ZodEnum<{
537
+ number: "number";
538
+ boolean: "boolean";
539
+ text: "text";
540
+ range: "range";
541
+ date: "date";
542
+ dateRange: "dateRange";
543
+ select: "select";
544
+ multiSelect: "multiSelect";
545
+ }>;
546
+ operator: z.ZodEnum<{
547
+ iLike: "iLike";
548
+ notILike: "notILike";
549
+ eq: "eq";
550
+ ne: "ne";
551
+ isEmpty: "isEmpty";
552
+ isNotEmpty: "isNotEmpty";
553
+ lt: "lt";
554
+ lte: "lte";
555
+ gt: "gt";
556
+ gte: "gte";
557
+ isBetween: "isBetween";
558
+ isRelativeToToday: "isRelativeToToday";
559
+ inArray: "inArray";
560
+ notInArray: "notInArray";
561
+ }>;
562
+ filterId: z.ZodString;
563
+ }, z.core.$strip>;
564
+ type FilterItemSchema = z.infer<typeof filterItemSchema>;
565
+ //#endregion
566
+ //#region src/types/data-table.d.ts
567
+ interface DataTableClassNames {
568
+ table?: string;
569
+ thead?: string;
570
+ tbody?: string;
571
+ /** 应用于表头行、正文行和空状态行 */
572
+ tr?: string;
573
+ th?: string;
574
+ td?: string;
802
575
  }
803
- interface FieldOption {
576
+ declare module '@tanstack/react-table' {
577
+ interface TableMeta<TData extends RowData> {
578
+ queryKeys?: QueryKeys;
579
+ queryStateOptions?: UrlStateOptions;
580
+ }
581
+ interface ColumnMeta<TData extends RowData, TValue> {
582
+ label?: string;
583
+ index?: number;
584
+ /** 按元素分组的列类名,优先于全局单元格类名 */
585
+ classNames?: Pick<DataTableClassNames, 'th' | 'td'>;
586
+ placeholder?: string;
587
+ variant?: FilterVariant$1;
588
+ options?: Option[];
589
+ range?: [number, number];
590
+ unit?: string;
591
+ icon?: React.FC<React.SVGProps<SVGSVGElement>>;
592
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
593
+ modes?: Array<'simple' | 'advanced' | 'command'>;
594
+ /** 内部:远程筛选选项搜索值 */
595
+ autoCrudFilterSearchValue?: string;
596
+ /** 内部:远程筛选选项搜索回调 */
597
+ autoCrudFilterOnSearch?: (value: string) => void;
598
+ /** 内部:是否启用本地选项过滤 */
599
+ autoCrudFilterShouldFilter?: boolean;
600
+ /** 内部:远程筛选当前弹窗选项,和稳定标签缓存分离 */
601
+ autoCrudFilterOptions?: Option[];
602
+ /** 内部:远程筛选是否还有更多选项 */
603
+ autoCrudFilterHasMore?: boolean;
604
+ /** 内部:远程筛选是否正在加载 */
605
+ autoCrudFilterLoading?: boolean;
606
+ /** 内部:远程筛选弹窗滚动回调 */
607
+ autoCrudFilterOnPopupScroll?: React.UIEventHandler<HTMLElement>;
608
+ }
609
+ }
610
+ interface QueryKeys {
611
+ page: string;
612
+ perPage: string;
613
+ sort: string;
614
+ filters: string;
615
+ joinOperator: string;
616
+ }
617
+ interface Option {
804
618
  label: string;
805
619
  value: string;
806
- searchText?: string | string[];
620
+ searchText?: string;
807
621
  count?: number;
808
- icon?: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
809
- disabled?: boolean;
622
+ icon?: React.FC<React.SVGProps<SVGSVGElement>>;
810
623
  }
811
- type FieldTableDisplay = 'auto' | 'text' | 'badge' | 'date' | 'datetime';
812
- /**
813
- * 统一字段配置
814
- * 支持共用配置 + 表格/表单特定配置
815
- */
816
- interface Field {
817
- /** 字段标签(表格和表单共用) */
818
- label?: string;
819
- /** 字段级静态选项(表单、筛选、展示共用) */
820
- enum?: FieldOption[];
821
- /** 字段级动态选项源(表单、筛选、展示共用) */
822
- dataSource?: AutoCrudDataSourceConfig;
823
- /** 是否隐藏(表格和表单都隐藏) */
824
- hidden?: boolean;
825
- /** 是否参与 AutoCrud 全局搜索 */
826
- search?: boolean;
827
- /**
828
- * 筛选器独立配置
829
- * - FilterConfig: 详细配置
830
- * - false: 禁用筛选(简写,等价于 { enabled: false })
831
- * 独立于 table.meta 控制筛选器行为,不影响表格列显示/隐藏
832
- */
833
- filter?: FilterConfig | false;
834
- /**
835
- * 表格特定配置
836
- * - object: 详细配置
837
- * - false: 隐藏表格列(简写,等价于 { hidden: true })
838
- */
839
- table?: {
840
- /** 是否在表格中隐藏 */
841
- hidden?: boolean;
842
- /** 表格列标签 */
843
- label?: string;
844
- /** 排序权重,数值越小越靠前 */
845
- index?: number;
846
- /** 仅用于表格展示的静态值标签;与 dataSource 同时配置时覆盖同值的动态标签 */
847
- options?: FieldOption[];
848
- /** 仅用于表格展示的动态值标签源 */
849
- dataSource?: AutoCrudDataSourceConfig;
850
- /** 声明式单元格展示模式;非 auto 模式会覆盖拥有方自定义 cell */
851
- display?: FieldTableDisplay;
852
- /** 筛选器配置 */
853
- meta?: Record<string, unknown>;
854
- /** 其他列配置 */
855
- [key: string]: unknown;
856
- } | false;
857
- /**
858
- * 表单特定配置
859
- * - object: 详细配置(Formily Schema)
860
- * - false: 隐藏表单字段(简写,等价于 { "x-hidden": true })
861
- */
862
- form?: {
863
- /** 是否在表单中隐藏 */
864
- 'x-hidden'?: boolean;
865
- /** 组件类型 */
866
- 'x-component'?: string;
867
- /** 组件属性 */
868
- 'x-component-props'?: Record<string, unknown>;
869
- /** 其他表单配置 */
870
- [key: string]: unknown;
871
- } | false;
624
+ type FilterOperator = DataTableConfig['operators'][number];
625
+ type FilterVariant$1 = DataTableConfig['filterVariants'][number];
626
+ type JoinOperator = DataTableConfig['joinOperators'][number];
627
+ interface ExtendedColumnSort<TData> extends Omit<ColumnSort, 'id'> {
628
+ id: Extract<keyof TData, string>;
629
+ }
630
+ interface ExtendedColumnFilter<TData> extends FilterItemSchema {
631
+ id: Extract<keyof TData, string>;
632
+ }
633
+ interface DataTableRowAction<TData> {
634
+ row: Row<TData>;
635
+ variant: 'update' | 'delete';
636
+ }
637
+ //#endregion
638
+ //#region src/components/auto-crud/auto-table-action-bar.d.ts
639
+ /** 批量更新字段配置 */
640
+ interface BatchUpdateField {
641
+ /** 字段名 */
642
+ field: string;
643
+ /** 显示标签 */
644
+ label: string;
645
+ /** 可选值 */
646
+ options: Array<{
647
+ label: string;
648
+ value: string;
649
+ }>;
872
650
  }
873
- type Fields = Record<string, Field>;
874
- /** 内置操作项(覆盖默认行为或调整位置) */
875
- type ActionMeta = {
651
+ interface BatchActionContext<TData> {
652
+ /** 选中的原始行数据 */
653
+ rows: TData[];
654
+ /** TanStack Table 实例 */
655
+ table: Table<TData>;
656
+ /** 清空当前选择 */
657
+ clearSelection: () => void;
658
+ }
659
+ type BatchBuiltinActionType = 'batchUpdate' | 'export' | 'delete';
660
+ type BatchActionMeta = {
876
661
  id?: string;
877
662
  order?: number;
878
663
  hidden?: boolean;
879
664
  };
880
- interface AutoCrudRowActionContext<T> {
881
- crudId: string;
882
- idKey: string;
883
- row: T;
884
- rowId?: string;
885
- openView: (row: T) => void;
886
- openEdit?: (row: T) => void;
887
- copyRow?: (row: T) => void;
888
- openDelete?: (row: T) => void;
889
- }
890
- type ActionComponent<TContext> = React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
891
- type RowBuiltinActionType = 'view' | 'edit' | 'copy' | 'delete';
892
- type RowBuiltinActionItem<T> = ActionMeta & {
893
- type: RowBuiltinActionType;
894
- onClick?: (row: T) => void;
665
+ type BatchBuiltinActionItem<TData> = BatchActionMeta & {
666
+ type: BatchBuiltinActionType;
667
+ /** 替代默认行为 */
668
+ onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
669
+ /** 替代默认标签,仅对 export/delete 生效 */
895
670
  label?: string;
896
- separator?: boolean;
671
+ /** 替代整个内置操作的渲染 */
672
+ component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
897
673
  };
898
- type RowCustomActionItem<T> = ActionMeta & {
674
+ type BatchCustomActionItem<TData> = BatchActionMeta & {
899
675
  type: 'custom';
676
+ /** 操作文本。传 component 时可省略 */
900
677
  label?: string;
901
- onClick?: (row: T) => void;
902
- component?: ActionComponent<AutoCrudRowActionContext<T>>;
903
- position?: 'start' | 'end';
904
- separator?: boolean;
905
- variant?: 'default' | 'destructive';
906
- };
907
- /**
908
- * Row action item.
909
- *
910
- * - Custom-only config keeps builtin row actions and appends custom actions.
911
- * - Including any builtin type takes over builtin ordering.
912
- */
913
- type RowActionItem<T> = RowBuiltinActionItem<T> | RowCustomActionItem<T>;
914
- type RowActionConfig<T> = RowActionItem<T>[] | ((defaults: RowBuiltinActionItem<T>[]) => RowActionItem<T>[]);
915
- /** @deprecated Use RowActionItem instead. */
916
- type ActionItem<T> = RowActionItem<T>;
917
- /** @deprecated Use RowActionConfig instead. */
918
- type ActionConfig<T> = RowActionConfig<T>;
919
- type AutoCrudActionsConfig<T> = {
920
- toolbar?: ToolbarActionConfig;
921
- row?: RowActionConfig<T>;
922
- batch?: BatchActionConfig<T>;
923
- };
924
- type AutoCrudActionConfig<T> = RowActionConfig<T> | AutoCrudActionsConfig<T>;
925
- /**
926
- * 顶部工具栏内置操作项
927
- */
928
- type ToolbarBuiltinActionType = 'refresh' | 'create' | 'import' | 'export';
929
- type ToolbarBuiltinActionItem = ActionMeta & {
930
- type: ToolbarBuiltinActionType;
931
- /** 替代默认的行为 */
932
- onClick?: () => void;
933
- /** 替代默认的标签文本 */
934
- label?: string;
935
- /** 替代整个按钮的渲染 */
936
- component?: ActionComponent<AutoCrudToolbarContext>;
937
- };
938
- /**
939
- * 顶部工具栏自定义操作项
940
- */
941
- type ToolbarCustomActionItem = ActionMeta & {
942
- type: 'custom';
678
+ /** 自定义点击行为。传 component 时可省略 */
679
+ onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
943
680
  /** 渲染自定义内容 */
944
- component: ActionComponent<AutoCrudToolbarContext>;
681
+ component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
945
682
  /** 仅在无内置项时生效:插入到首部还是尾部(默认 end) */
946
683
  position?: 'start' | 'end';
684
+ variant?: 'default' | 'destructive';
947
685
  };
948
- type ToolbarActionItem = ToolbarBuiltinActionItem | ToolbarCustomActionItem;
949
- type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActionItem[]) => ToolbarActionItem[]);
950
- interface AutoCrudToolbarContext {
951
- crudId: string;
952
- idKey: string;
953
- rowIds: string[];
954
- selectedRowIds: string[];
955
- selectedCount: number;
956
- refresh?: () => Promise<unknown>;
957
- openImport?: () => void;
958
- exportData?: () => Promise<void>;
959
- openCreate?: () => void;
960
- isRefreshing: boolean;
961
- isExporting: boolean;
686
+ type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
687
+ type BatchActionConfig<TData> = BatchActionItem<TData>[] | ((defaults: BatchBuiltinActionItem<TData>[]) => BatchActionItem<TData>[]);
688
+ interface BatchDeleteConfirmation {
689
+ title: string;
690
+ description: (count: number) => string;
691
+ cancel: string;
692
+ confirm: string;
962
693
  }
963
- type AutoCrudToolbarResolver = (targetId: string, ownerActions: readonly ToolbarActionItem[], context: AutoCrudToolbarContext) => ToolbarActionItem[];
964
- declare function setToolbarResolver(resolver: AutoCrudToolbarResolver | null): void;
694
+ interface AutoTableActionBarProps<TData> {
695
+ table: Table<TData>;
696
+ onDeleteSelected?: (rows: TData[]) => void;
697
+ /** 批量更新回调 */
698
+ onUpdateSelected?: (rows: TData[], data: Record<string, unknown>) => void;
699
+ /** 批量更新字段配置 */
700
+ batchUpdateFields?: BatchUpdateField[];
701
+ /** 是否启用导出功能 */
702
+ enableExport?: boolean;
703
+ /** 未配置 actions / 只配置 custom actions 时,是否展示默认导出按钮 */
704
+ showDefaultExport?: boolean;
705
+ /** 是否启用删除功能 */
706
+ enableDelete?: boolean;
707
+ /** 额外的操作按钮 */
708
+ extraActions?: React$1.ReactNode;
709
+ /** 批量操作配置,支持和行操作/顶部工具栏一致的顺序接管语义 */
710
+ actions?: BatchActionConfig<TData>;
711
+ /** 批量删除二次确认文案 */
712
+ deleteConfirmation?: BatchDeleteConfirmation;
713
+ }
714
+ declare function AutoTableActionBar<TData>({
715
+ table,
716
+ onDeleteSelected,
717
+ onUpdateSelected,
718
+ batchUpdateFields,
719
+ enableExport,
720
+ showDefaultExport,
721
+ enableDelete,
722
+ extraActions,
723
+ actions,
724
+ deleteConfirmation
725
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
726
+ //#endregion
727
+ //#region src/lib/schema-bridge/types.d.ts
965
728
  /**
966
- * AutoCrudTable Props 接口
729
+ * 字段类型映射
967
730
  */
968
- interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
969
- /** Public CRUD id. Used by hosts to document the extension target. */
970
- id?: string;
971
- /** 页面标题 */
972
- title?: string;
973
- /** 页面描述 */
974
- description?: string;
975
- /** Zod schema */
976
- schema: TSchema;
977
- /** useAutoCrudResource hook 返回值 */
978
- resource: UseAutoCrudResourceReturn<TSchema, z.output<TSchema>>;
979
- /**
980
- * 统一字段配置
981
- * 支持共用配置(label, hidden)+ 表格/表单特定配置
982
- */
983
- fields?: Fields;
984
- /** 表格配置 */
985
- table?: {
986
- /** 隐藏的列 */
987
- hidden?: string[];
988
- /** 列覆盖配置 */
989
- overrides?: Record<string, any>;
990
- /**
991
- * 过滤模式配置
992
- * - 单个值: 只使用该模式,不显示切换按钮
993
- * - 数组: 第一个为默认值,显示切换按钮
994
- */
995
- filterModes?: FilterMode | FilterMode[];
996
- /** 全局搜索框;默认在存在 search: true 字段时显示 */
997
- search?: boolean | {
998
- placeholder?: string;
999
- };
1000
- /**
1001
- * 批量更新字段配置
1002
- * - 只需传字段名数组,options 自动从 schema enum 推导
1003
- * - 也可以传完整配置覆盖 label 或 options
1004
- */
1005
- batchFields?: (string | BatchUpdateField)[];
1006
- /**
1007
- * 多选后悬浮批量操作栏配置
1008
- * 用法类同 `actions` 行操作和 `toolbar` 顶部工具栏。
1009
- * 只传 custom 时保留默认批量操作;包含任意内置 type 时完全接管顺序。
1010
- * @deprecated Use actions.batch instead.
1011
- */
1012
- batchActions?: BatchActionConfig<z.output<TSchema>>;
1013
- /** 默认排序 */
1014
- defaultSort?: any[];
1015
- };
1016
- /** 表单配置 */
1017
- form?: {
1018
- /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
1019
- overrides?: Record<string, any>;
1020
- /** Formily schema expression/reaction scope */
1021
- scope?: JsonSchemaFormScope;
1022
- /** 表单列数 */
1023
- columns?: number;
1024
- /** 弹窗自定义容器类名(支持控制大小、最大高度等) */
1025
- className?: string;
1026
- };
1027
- /** 行操作配置,或统一的 toolbar/row/batch 操作配置。 */
1028
- actions?: AutoCrudActionConfig<z.output<TSchema>>;
1029
- /**
1030
- * 顶层工具栏操作配置
1031
- * 用法类同 `actions` 行操作。一旦配置了包含内置 `type` 的数组,它将完全接管右侧工具栏!
1032
- * @deprecated Use actions.toolbar instead.
1033
- */
1034
- toolbar?: ToolbarActionConfig;
1035
- /** @deprecated Use toolbar instead. */
1036
- toolbarActions?: ToolbarActionConfig;
1037
- /**
1038
- * 权限配置
1039
- * 控制按钮显示和字段访问
1040
- *
1041
- * @example
1042
- * ```tsx
1043
- * const permissions = useMemo(() => ({
1044
- * can: {
1045
- * create: user.role === 'admin',
1046
- * update: user.role === 'admin' || user.role === 'editor',
1047
- * delete: user.role === 'admin',
1048
- * export: true,
1049
- * import: true,
1050
- * },
1051
- * deny: user.role === 'user' ? ['salary', 'ssn'] : [],
1052
- * }), [user.role]);
1053
- *
1054
- * <AutoCrudTable permissions={permissions} ... />
1055
- * ```
1056
- */
1057
- permissions?: CrudPermissions;
1058
- /**
1059
- * 语言配置
1060
- * - 内置语言 key:`"zh-CN"`(默认)、`"en-US"`
1061
- * - 部分覆盖对象:以 zh-CN 为基础深合并
1062
- *
1063
- * @example
1064
- * ```tsx
1065
- * <AutoCrudTable locale="en-US" ... />
1066
- * <AutoCrudTable locale={{ toolbar: { create: "Add New" } }} ... />
1067
- * ```
1068
- */
1069
- locale?: LocaleProp;
1070
- /**
1071
- * 自定义新建按钮点击事件
1072
- * 如果提供,将覆盖默认的打开新建弹窗行为
1073
- */
1074
- onCreate?: () => void;
731
+ type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'array' | 'object';
732
+ /**
733
+ * DataTable Filter Variant
734
+ */
735
+ type FilterVariant = 'text' | 'number' | 'boolean' | 'select' | 'multiSelect' | 'date' | 'dateRange' | 'range';
736
+ /**
737
+ * 解析后的 Zod 字段信息
738
+ */
739
+ interface ParsedZodField {
740
+ type: FieldType;
741
+ required: boolean;
742
+ enumValues?: string[];
743
+ description?: string;
744
+ defaultValue?: unknown;
1075
745
  }
1076
746
  /**
1077
- * AutoCrudTable 组件
1078
- *
1079
- * 高级 CRUD 表格组件,封装了完整的增删改查流程
747
+ * 列定义覆盖选项
1080
748
  */
1081
- declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1082
- id,
1083
- title,
1084
- description,
1085
- schema,
1086
- resource,
1087
- fields,
1088
- table: tableConfig,
1089
- form: formConfig,
1090
- permissions,
1091
- actions: actionItems,
1092
- toolbar,
1093
- toolbarActions,
1094
- locale: localeProp,
1095
- onCreate
1096
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
1097
- //#endregion
1098
- //#region src/components/auto-crud/auto-form.d.ts
1099
- interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
1100
- schema: T;
1101
- initialValues?: Partial<z.infer<T>>;
1102
- onSubmit: (values: z.infer<T>) => void | Promise<void>;
1103
- /** 统一字段配置,推荐用于描述 auto-crud 字段级表单行为 */
1104
- fields?: Fields;
1105
- /** Formily 字段 schema 覆盖配置,保留兼容旧 API */
749
+ type ColumnOverrides<T> = Partial<{ [K in keyof T]: Partial<ColumnDef<T, unknown>> & {
750
+ hidden?: boolean;
751
+ label?: string;
752
+ index?: number;
753
+ } }>;
754
+ /**
755
+ * Formily Schema 覆盖选项
756
+ */
757
+ type FormSchemaOverrides = Record<string, Partial<ISchema>>;
758
+ /**
759
+ * createTableSchema 选项
760
+ */
761
+ interface CreateTableSchemaOptions<T> {
762
+ overrides?: ColumnOverrides<T>;
763
+ exclude?: (keyof T)[];
764
+ }
765
+ /**
766
+ * createFormSchema 选项
767
+ */
768
+ interface CreateFormSchemaOptions {
1106
769
  overrides?: FormSchemaOverrides;
1107
- /** Formily schema expression/reaction scope */
1108
- scope?: JsonSchemaFormScope;
1109
- mode?: 'create' | 'edit';
1110
- loading?: boolean;
770
+ exclude?: string[];
771
+ layout?: 'vertical' | 'horizontal' | 'grid';
1111
772
  gridColumns?: number;
1112
773
  /** Label 对齐方式 */
1113
774
  labelAlign?: 'left' | 'top' | 'right';
1114
775
  /** Label 宽度(labelAlign 为 left 时有效) */
1115
776
  labelWidth?: number | string;
1116
- /** 是否显示提交按钮(默认 true) */
1117
- showSubmitButton?: boolean;
777
+ /** Label 栅格占位 */
778
+ labelCol?: number;
779
+ /** 输入框栅格占位 */
780
+ wrapperCol?: number;
1118
781
  }
1119
- interface AutoFormRef {
1120
- submit: () => Promise<void>;
782
+ /**
783
+ * Enum 选项类型
784
+ */
785
+ interface EnumOption {
786
+ label: string;
787
+ value: string;
1121
788
  }
1122
- declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1123
- schema: zodSchema,
1124
- initialValues,
1125
- onSubmit,
1126
- fields,
1127
- overrides,
1128
- scope: scopeProp,
1129
- mode,
1130
- loading,
1131
- gridColumns,
1132
- labelAlign,
1133
- labelWidth,
1134
- showSubmitButton
1135
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
1136
- declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1137
- ref?: React.Ref<AutoFormRef>;
1138
- }) => ReturnType<typeof AutoFormInner>;
1139
789
  //#endregion
1140
- //#region src/hooks/use-url-state.d.ts
790
+ //#region src/lib/schema-bridge/zod-to-columns.d.ts
1141
791
  /**
1142
- * URL 状态管理 Hook - 替代 nuqs
1143
- * 将 React 状态同步到 URL query string
1144
- *
1145
- * 架构说明:
1146
- * - 使用 queueMicrotask 延迟 URL 更新,确保在渲染完成后执行
1147
- * - 符合 React 渲染规则,不会触发 "Cannot update a component while rendering" 错误
792
+ * 解析 Zod 字段类型
1148
793
  */
1149
- interface UrlStateOptions {
1150
- /** 历史记录模式: push 添加新记录, replace 替换当前记录 */
1151
- history?: 'push' | 'replace';
1152
- /** 是否浅层更新(不触发页面刷新) */
1153
- shallow?: boolean;
1154
- /** 节流时间(毫秒) */
1155
- throttleMs?: number;
1156
- /** 防抖时间(毫秒) */
1157
- debounceMs?: number;
1158
- /** 当值等于默认值时是否清除 URL 参数 */
1159
- clearOnDefault?: boolean;
1160
- /** 滚动到顶部 */
1161
- scroll?: boolean;
1162
- /** React transition */
1163
- startTransition?: React$1.TransitionStartFunction;
794
+ declare function parseZodField(schema: z.ZodType): ParsedZodField;
795
+ /**
796
+ * 从 Zod Schema 创建 Table Schema (ColumnDef 数组)
797
+ */
798
+ declare function createTableSchema<T extends z.ZodObject<z.ZodRawShape>>(schema: T, options?: CreateTableSchemaOptions<z.infer<T>>): ColumnDef<z.infer<T>>[];
799
+ /**
800
+ * 创建选择列
801
+ */
802
+ declare function createSelectColumn<T>(): ColumnDef<T>;
803
+ /**
804
+ * 操作列配置
805
+ */
806
+ /**
807
+ * 已解析的操作项(渲染层使用)
808
+ */
809
+ interface ResolvedActionItem<T, TContext = any> {
810
+ label?: string;
811
+ onClick?: (row: T) => void;
812
+ component?: React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
813
+ getContext?: (row: T) => TContext;
814
+ separator?: boolean;
815
+ variant?: 'default' | 'destructive';
1164
816
  }
1165
- interface Parser<T> {
1166
- parse: (value: string) => T;
1167
- serialize: (value: T) => string;
817
+ /**
818
+ * 操作列配置(ResolvedActionItem 数组)
819
+ */
820
+ type ActionsColumnConfig<T> = ResolvedActionItem<T, any>[];
821
+ declare module '@tanstack/react-table' {
822
+ interface ColumnMeta<TData extends RowData, TValue> {
823
+ rowActions?: ActionsColumnConfig<TData>;
824
+ }
1168
825
  }
1169
- declare const parseAsInteger: Parser<number> & {
1170
- withDefault: (defaultValue: number) => Parser<number> & {
1171
- defaultValue: number;
826
+ /**
827
+ * 创建操作列
828
+ */
829
+ declare function createActionsColumn<T>(items: ActionsColumnConfig<T>): ColumnDef<T>;
830
+ //#endregion
831
+ //#region src/components/auto-crud/auto-table.d.ts
832
+ /** 过滤模式类型 */
833
+ type FilterMode = 'simple' | 'advanced' | 'command';
834
+ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
835
+ schema: T;
836
+ data: z.infer<T>[];
837
+ pageCount?: number;
838
+ /** Total rows matching the current search and filters. */
839
+ total?: number;
840
+ overrides?: ColumnOverrides<z.infer<T>>;
841
+ /** 按元素分组的全局表格类名 */
842
+ classNames?: DataTableClassNames;
843
+ enableRowSelection?: boolean;
844
+ exclude?: (keyof z.infer<T>)[];
845
+ actions?: ActionsColumnConfig<z.infer<T>>;
846
+ /** 自定义固定列配置 */
847
+ pinnedColumns?: {
848
+ left?: string[];
849
+ right?: string[];
850
+ };
851
+ /**
852
+ * 过滤模式配置
853
+ * - 单个值: 只使用该模式,不显示切换按钮
854
+ * - 数组: 第一个为默认值,显示切换按钮
855
+ * 默认: ["simple", "advanced", "command"] (全部显示)
856
+ */
857
+ filterMode?: FilterMode | FilterMode[];
858
+ /** 全局搜索框 */
859
+ search?: boolean | {
860
+ placeholder?: string;
861
+ };
862
+ /** 批量删除回调 */
863
+ onDeleteSelected?: (rows: z.infer<T>[]) => void;
864
+ /** 批量更新回调 */
865
+ onUpdateSelected?: (rows: z.infer<T>[], data: Record<string, unknown>) => void;
866
+ /** 批量更新字段配置 */
867
+ batchUpdateFields?: BatchUpdateField[];
868
+ /** 批量操作栏额外按钮 */
869
+ actionBarExtra?: React.ReactNode;
870
+ /** 批量悬浮操作配置 */
871
+ actionBarActions?: BatchActionConfig<z.infer<T>>;
872
+ /** 批量删除二次确认文案 */
873
+ deleteConfirmation?: BatchDeleteConfirmation;
874
+ /** 初始排序 */
875
+ initialSorting?: any[];
876
+ /** 是否启用导出功能 (默认 true) */
877
+ enableExport?: boolean;
878
+ /** 未配置批量 actions / 只配置 custom actions 时,是否展示默认导出按钮 */
879
+ showDefaultExport?: boolean;
880
+ /** 选中行数变化回调(用于外层组件获知选中状态) */
881
+ onSelectedCountChange?: (count: number) => void;
882
+ /** 选中行数据变化回调(用于外层组件获知选中行身份变化) */
883
+ onSelectedRowsChange?: (rows: z.infer<T>[]) => void;
884
+ /** 获取选中行数据的回调(由外层组件调用) */
885
+ getSelectedRows?: React.MutableRefObject<(() => z.infer<T>[]) | null>;
886
+ }
887
+ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
888
+ schema,
889
+ data,
890
+ pageCount,
891
+ total,
892
+ overrides,
893
+ classNames,
894
+ enableRowSelection,
895
+ exclude,
896
+ actions,
897
+ pinnedColumns,
898
+ filterMode,
899
+ search,
900
+ onDeleteSelected,
901
+ onUpdateSelected,
902
+ batchUpdateFields,
903
+ actionBarExtra,
904
+ actionBarActions,
905
+ deleteConfirmation,
906
+ initialSorting,
907
+ enableExport,
908
+ showDefaultExport,
909
+ onSelectedCountChange,
910
+ onSelectedRowsChange,
911
+ getSelectedRows
912
+ }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
913
+ //#endregion
914
+ //#region src/lib/row-action-dialog.d.ts
915
+ interface RowActionDialogProps {
916
+ open: boolean;
917
+ onOpenChange: (open: boolean) => void;
918
+ onDismiss?: () => void;
919
+ }
920
+ //#endregion
921
+ //#region src/i18n/locale.d.ts
922
+ /**
923
+ * AutoCrud 国际化接口及内置语言包
924
+ *
925
+ * 使用方式:
926
+ * // 内置语言
927
+ * <AutoCrudTable locale="en-US" ... />
928
+ *
929
+ * // 部分覆盖(以 zh-CN 为基础深合并)
930
+ * <AutoCrudTable locale={{ toolbar: { create: "Add" } }} ... />
931
+ */
932
+ interface AutoCrudLocale {
933
+ toolbar: {
934
+ refresh: string;
935
+ create: string;
936
+ import: string;
937
+ export: string;
938
+ exportSelected: (count: number) => string;
1172
939
  };
1173
- };
1174
- declare const parseAsString: Parser<string> & {
1175
- withDefault: (defaultValue: string) => Parser<string> & {
1176
- defaultValue: string;
940
+ rowActions: {
941
+ view: string;
942
+ edit: string;
943
+ copy: string;
944
+ delete: string;
1177
945
  };
1178
- };
1179
- declare function parseAsStringEnum<T extends string>(validValues: readonly T[]): Parser<T | null> & {
1180
- withDefault: (defaultValue: T) => Parser<T> & {
1181
- defaultValue: T;
946
+ viewModal: {
947
+ title: string;
1182
948
  };
1183
- };
1184
- declare function parseAsArrayOf<T>(itemParser: Parser<T>, separator?: string): Parser<T[]> & {
1185
- withDefault: (defaultValue: T[]) => Parser<T[]> & {
1186
- defaultValue: T[];
949
+ boolean: {
950
+ true: string;
951
+ false: string;
1187
952
  };
1188
- };
1189
- declare function getUrlParams(): URLSearchParams;
1190
- declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions, 'history' | 'scroll'>): void;
1191
- /**
1192
- * 单个 URL 状态参数
1193
- */
1194
- declare function useUrlState<T>(key: string, parser: Parser<T> & {
1195
- defaultValue?: T;
1196
- }, options?: UrlStateOptions): [T, (value: T | ((prev: T) => T)) => void];
1197
- /**
1198
- * 多个 URL 状态参数
1199
- */
1200
- declare function useUrlStates<T extends Record<string, unknown>>(parsers: { [K in keyof T]: Parser<T[K]> & {
1201
- defaultValue?: T[K];
1202
- } }, options?: UrlStateOptions): [T, (values: Partial<T>) => void];
1203
- /**
1204
- * nuqs 兼容层 - useQueryState
1205
- */
1206
- declare function useQueryState<T>(key: string, parser: Parser<T> & {
1207
- defaultValue?: T;
1208
- }, options?: UrlStateOptions): [T, (value: T | ((prev: T) => T)) => Promise<URLSearchParams>];
953
+ formModal: {
954
+ createTitle: string;
955
+ editTitle: string;
956
+ cancel: string;
957
+ create: string;
958
+ save: string;
959
+ submitting: string;
960
+ };
961
+ deleteModal: {
962
+ title: string;
963
+ description: string;
964
+ cancel: string;
965
+ confirm: string;
966
+ confirming: string;
967
+ };
968
+ bulkDeleteModal: {
969
+ title: string;
970
+ description: (count: number) => string;
971
+ cancel: string;
972
+ confirm: string;
973
+ };
974
+ importDialog: {
975
+ title: string;
976
+ uploadDescription: string;
977
+ previewDescription: (count: number) => string;
978
+ importingDescription: string;
979
+ doneDescription: string;
980
+ dragHint: string;
981
+ formatHint: string;
982
+ downloadTemplate: string;
983
+ moreColumns: (count: number) => string;
984
+ previewSummary: (rows: number, fields: number, format: string, previewLimit?: number) => string;
985
+ reselect: string;
986
+ confirmImport: string;
987
+ importingRows: (count: number) => string;
988
+ resultCreated: string;
989
+ resultUpdated: string;
990
+ resultSkipped: string;
991
+ resultFailed: string;
992
+ failedRowHeader: string;
993
+ failedErrorHeader: string;
994
+ close: string;
995
+ continueImport: string;
996
+ errorNoData: string;
997
+ errorParseFailed: string;
998
+ errorImportFailed: string;
999
+ };
1000
+ }
1001
+ declare const zhCN: AutoCrudLocale;
1002
+ declare const enUS: AutoCrudLocale;
1003
+ declare const jaJP: AutoCrudLocale;
1004
+ declare const koKR: AutoCrudLocale;
1005
+ declare const frFR: AutoCrudLocale;
1006
+ declare const deDE: AutoCrudLocale;
1007
+ declare const esES: AutoCrudLocale;
1008
+ type DeepPartial<T> = { [P in keyof T]?: T[P] extends ((...args: unknown[]) => unknown) ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P] };
1009
+ /** locale prop 类型:内置语言 key 或部分覆盖对象 */
1010
+ type LocaleProp = string | DeepPartial<AutoCrudLocale>;
1209
1011
  /**
1210
- * nuqs 兼容层 - useQueryStates
1012
+ * 解析 locale prop 为完整的 AutoCrudLocale
1013
+ * - string → 内置语言(fallback: zh-CN)
1014
+ * - object → 以 zh-CN 为基础深合并
1211
1015
  */
1212
- declare function useQueryStates<T extends Record<string, unknown>>(parsers: { [K in keyof T]: Parser<T[K]> & {
1213
- defaultValue?: T[K];
1214
- } }, options?: UrlStateOptions): [T, (values: Partial<T>) => Promise<URLSearchParams>];
1016
+ declare function resolveLocale(localeProp?: LocaleProp): AutoCrudLocale;
1215
1017
  //#endregion
1216
- //#region src/config/data-table.d.ts
1217
- type DataTableConfig = typeof dataTableConfig;
1218
- declare const dataTableConfig: {
1219
- textOperators: ({
1220
- label: string;
1221
- value: "iLike";
1222
- } | {
1223
- label: string;
1224
- value: "notILike";
1225
- } | {
1226
- label: string;
1227
- value: "eq";
1228
- } | {
1229
- label: string;
1230
- value: "ne";
1231
- } | {
1232
- label: string;
1233
- value: "isEmpty";
1234
- } | {
1235
- label: string;
1236
- value: "isNotEmpty";
1237
- })[];
1238
- numericOperators: ({
1239
- label: string;
1240
- value: "eq";
1241
- } | {
1242
- label: string;
1243
- value: "ne";
1244
- } | {
1245
- label: string;
1246
- value: "lt";
1247
- } | {
1248
- label: string;
1249
- value: "lte";
1250
- } | {
1251
- label: string;
1252
- value: "gt";
1253
- } | {
1254
- label: string;
1255
- value: "gte";
1256
- } | {
1257
- label: string;
1258
- value: "isBetween";
1259
- } | {
1260
- label: string;
1261
- value: "isEmpty";
1262
- } | {
1263
- label: string;
1264
- value: "isNotEmpty";
1265
- })[];
1266
- dateOperators: ({
1267
- label: string;
1268
- value: "eq";
1269
- } | {
1270
- label: string;
1271
- value: "ne";
1272
- } | {
1273
- label: string;
1274
- value: "lt";
1275
- } | {
1276
- label: string;
1277
- value: "gt";
1278
- } | {
1279
- label: string;
1280
- value: "lte";
1281
- } | {
1282
- label: string;
1283
- value: "gte";
1284
- } | {
1285
- label: string;
1286
- value: "isBetween";
1287
- } | {
1288
- label: string;
1289
- value: "isRelativeToToday";
1290
- } | {
1291
- label: string;
1292
- value: "isEmpty";
1293
- } | {
1294
- label: string;
1295
- value: "isNotEmpty";
1296
- })[];
1297
- selectOperators: ({
1298
- label: string;
1299
- value: "eq";
1300
- } | {
1301
- label: string;
1302
- value: "ne";
1303
- } | {
1304
- label: string;
1305
- value: "isEmpty";
1306
- } | {
1307
- label: string;
1308
- value: "isNotEmpty";
1309
- })[];
1310
- multiSelectOperators: ({
1311
- label: string;
1312
- value: "inArray";
1313
- } | {
1314
- label: string;
1315
- value: "notInArray";
1316
- } | {
1317
- label: string;
1318
- value: "isEmpty";
1319
- } | {
1320
- label: string;
1321
- value: "isNotEmpty";
1322
- })[];
1323
- booleanOperators: ({
1324
- label: string;
1325
- value: "eq";
1326
- } | {
1327
- label: string;
1328
- value: "ne";
1329
- })[];
1330
- sortOrders: ({
1331
- label: string;
1332
- value: "asc";
1333
- } | {
1334
- label: string;
1335
- value: "desc";
1336
- })[];
1337
- filterVariants: readonly ["text", "number", "range", "date", "dateRange", "boolean", "select", "multiSelect"];
1338
- operators: readonly ["iLike", "notILike", "eq", "ne", "inArray", "notInArray", "isEmpty", "isNotEmpty", "lt", "lte", "gt", "gte", "isBetween", "isRelativeToToday"];
1339
- joinOperators: readonly ["and", "or"];
1018
+ //#region src/lib/registries.d.ts
1019
+ type AutoCrudFormComponentConfig = {
1020
+ component: React$1.ComponentType<any>;
1021
+ decorator?: string | React$1.ComponentType<any>;
1022
+ [key: string]: unknown;
1023
+ };
1024
+ type AutoCrudOption = {
1025
+ value: string;
1026
+ label: string;
1027
+ searchText?: string | string[];
1028
+ keywords?: string[];
1029
+ count?: number;
1030
+ disabled?: boolean;
1031
+ };
1032
+ type AutoCrudDataSourceContextType = 'form' | 'filter' | 'resolve';
1033
+ type AutoCrudDataSourceResolveFields = readonly string[] | ((context: {
1034
+ field: string;
1035
+ }) => readonly string[]);
1036
+ type AutoCrudDataSourceContext = {
1037
+ field: string;
1038
+ type: AutoCrudDataSourceContextType;
1039
+ page?: number;
1040
+ pageSize?: number;
1041
+ query?: string;
1042
+ /** @deprecated Use `query` instead. */
1043
+ search?: string;
1044
+ values?: Record<string, unknown> | Record<string, unknown>[];
1045
+ signal?: AbortSignal;
1340
1046
  };
1047
+ type AutoCrudDataSourceResult = AutoCrudOption[] | {
1048
+ hasMore?: boolean;
1049
+ options?: AutoCrudOption[];
1050
+ };
1051
+ type AutoCrudDataSourceLoader = (context: AutoCrudDataSourceContext) => AutoCrudDataSourceResult | Promise<AutoCrudDataSourceResult>;
1052
+ type AutoCrudDataSourceConfig = string;
1053
+ type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
1054
+ dependencies?: string[];
1055
+ reset?: boolean;
1056
+ search?: boolean;
1057
+ debounceMs?: number;
1058
+ loadMore?: boolean;
1059
+ pageSize?: number;
1060
+ resolveFields?: AutoCrudDataSourceResolveFields;
1061
+ load: AutoCrudDataSourceLoader;
1062
+ };
1063
+ type AutoCrudDataSourceEntry = {
1064
+ dependencies: string[];
1065
+ reset: boolean;
1066
+ search: boolean;
1067
+ debounceMs: number;
1068
+ loadMore: boolean;
1069
+ pageSize: number;
1070
+ resolveFields?: AutoCrudDataSourceResolveFields;
1071
+ load: AutoCrudDataSourceLoader;
1072
+ };
1073
+ type RegistryListener$1 = () => void;
1074
+ declare const formComponents: {
1075
+ register(name: string, value: AutoCrudFormComponentConfig): void;
1076
+ unregister(name: string): void;
1077
+ get(name: string): AutoCrudFormComponentConfig | undefined;
1078
+ all(): Record<string, AutoCrudFormComponentConfig>;
1079
+ subscribe(listener: RegistryListener$1): () => void;
1080
+ };
1081
+ declare const components: {
1082
+ register(name: string, value: AutoCrudFormComponentConfig): void;
1083
+ unregister(name: string): void;
1084
+ get(name: string): AutoCrudFormComponentConfig | undefined;
1085
+ all(): Record<string, AutoCrudFormComponentConfig>;
1086
+ subscribe(listener: RegistryListener$1): () => void;
1087
+ };
1088
+ declare const dataSources: {
1089
+ register(name: string, registration: AutoCrudDataSourceRegistration): void;
1090
+ unregister: (name: string) => void;
1091
+ get: (name: string) => AutoCrudDataSourceEntry | undefined;
1092
+ all: () => Record<string, AutoCrudDataSourceEntry>;
1093
+ subscribe: (listener: RegistryListener$1) => () => void;
1094
+ };
1095
+ declare function normalizeDataSourceConfig(config: AutoCrudDataSourceConfig | undefined): {
1096
+ key: string;
1097
+ } | undefined;
1098
+ declare function normalizeOptions(result: AutoCrudDataSourceResult | undefined): AutoCrudOption[];
1341
1099
  //#endregion
1342
- //#region src/lib/parsers.d.ts
1343
- declare const filterItemSchema: z.ZodObject<{
1344
- id: z.ZodString;
1345
- value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
1346
- variant: z.ZodEnum<{
1347
- number: "number";
1348
- boolean: "boolean";
1349
- text: "text";
1350
- range: "range";
1351
- date: "date";
1352
- dateRange: "dateRange";
1353
- select: "select";
1354
- multiSelect: "multiSelect";
1355
- }>;
1356
- operator: z.ZodEnum<{
1357
- iLike: "iLike";
1358
- notILike: "notILike";
1359
- eq: "eq";
1360
- ne: "ne";
1361
- isEmpty: "isEmpty";
1362
- isNotEmpty: "isNotEmpty";
1363
- lt: "lt";
1364
- lte: "lte";
1365
- gt: "gt";
1366
- gte: "gte";
1367
- isBetween: "isBetween";
1368
- isRelativeToToday: "isRelativeToToday";
1369
- inArray: "inArray";
1370
- notInArray: "notInArray";
1371
- }>;
1372
- filterId: z.ZodString;
1373
- }, z.core.$strip>;
1374
- type FilterItemSchema = z.infer<typeof filterItemSchema>;
1375
- //#endregion
1376
- //#region src/types/data-table.d.ts
1377
- declare module '@tanstack/react-table' {
1378
- interface TableMeta<TData extends RowData> {
1379
- queryKeys?: QueryKeys;
1380
- queryStateOptions?: UrlStateOptions;
1381
- }
1382
- interface ColumnMeta<TData extends RowData, TValue> {
1383
- label?: string;
1384
- index?: number;
1385
- placeholder?: string;
1386
- variant?: FilterVariant$1;
1387
- options?: Option[];
1388
- range?: [number, number];
1389
- unit?: string;
1390
- icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1391
- /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
1392
- modes?: Array<'simple' | 'advanced' | 'command'>;
1393
- /** 内部:远程筛选选项搜索值 */
1394
- autoCrudFilterSearchValue?: string;
1395
- /** 内部:远程筛选选项搜索回调 */
1396
- autoCrudFilterOnSearch?: (value: string) => void;
1397
- /** 内部:是否启用本地选项过滤 */
1398
- autoCrudFilterShouldFilter?: boolean;
1399
- /** 内部:远程筛选当前弹窗选项,和稳定标签缓存分离 */
1400
- autoCrudFilterOptions?: Option[];
1401
- /** 内部:远程筛选是否还有更多选项 */
1402
- autoCrudFilterHasMore?: boolean;
1403
- /** 内部:远程筛选是否正在加载 */
1404
- autoCrudFilterLoading?: boolean;
1405
- /** 内部:远程筛选弹窗滚动回调 */
1406
- autoCrudFilterOnPopupScroll?: React.UIEventHandler<HTMLElement>;
1407
- }
1408
- }
1409
- interface QueryKeys {
1410
- page: string;
1411
- perPage: string;
1412
- sort: string;
1413
- filters: string;
1414
- joinOperator: string;
1100
+ //#region src/components/auto-crud/auto-crud-table.d.ts
1101
+ /**
1102
+ * 筛选器独立配置
1103
+ * 可独立于 table.meta 配置筛选器行为
1104
+ */
1105
+ interface FilterConfig {
1106
+ /** 是否启用筛选(默认跟随 table.meta.variant 推断) */
1107
+ enabled?: boolean;
1108
+ /** 筛选器类型 */
1109
+ variant?: 'text' | 'number' | 'range' | 'date' | 'dateRange' | 'boolean' | 'select' | 'multiSelect';
1110
+ /** select/multiSelect 的选项列表 */
1111
+ options?: FieldOption[];
1112
+ /** select/multiSelect 的动态选项源 */
1113
+ dataSource?: AutoCrudDataSourceConfig;
1114
+ /** range 的最小/最大值 */
1115
+ range?: [number, number];
1116
+ /** number 的单位 */
1117
+ unit?: string;
1118
+ /** 过滤器占位符 */
1119
+ placeholder?: string;
1120
+ /** 排序权重,数值越小越靠前 */
1121
+ index?: number;
1122
+ /** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
1123
+ hidden?: boolean;
1124
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
1125
+ modes?: Array<'simple' | 'advanced' | 'command'>;
1415
1126
  }
1416
- interface Option {
1127
+ interface FieldOption {
1128
+ /** Optional semantic color and dot for status badges. */
1129
+ badgeTone?: 'neutral' | 'success' | 'warning' | 'info';
1417
1130
  label: string;
1418
1131
  value: string;
1419
- searchText?: string;
1132
+ searchText?: string | string[];
1420
1133
  count?: number;
1421
- icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1134
+ icon?: React$1.FC<React$1.SVGProps<SVGSVGElement>>;
1135
+ disabled?: boolean;
1136
+ }
1137
+ type FieldTableDisplay = 'auto' | 'text' | 'badge' | 'date' | 'datetime';
1138
+ /**
1139
+ * 统一字段配置
1140
+ * 支持共用配置 + 表格/表单特定配置
1141
+ */
1142
+ interface Field {
1143
+ /** 字段标签(表格和表单共用) */
1144
+ label?: string;
1145
+ /** 字段级静态选项(表单、筛选、展示共用) */
1146
+ enum?: FieldOption[];
1147
+ /** 字段级动态选项源(表单、筛选、展示共用) */
1148
+ dataSource?: AutoCrudDataSourceConfig;
1149
+ /** 是否隐藏(表格和表单都隐藏) */
1150
+ hidden?: boolean;
1151
+ /** 是否参与 AutoCrud 全局搜索 */
1152
+ search?: boolean;
1153
+ /**
1154
+ * 筛选器独立配置
1155
+ * - FilterConfig: 详细配置
1156
+ * - false: 禁用筛选(简写,等价于 { enabled: false })
1157
+ * 独立于 table.meta 控制筛选器行为,不影响表格列显示/隐藏
1158
+ */
1159
+ filter?: FilterConfig | false;
1160
+ /**
1161
+ * 表格特定配置
1162
+ * - object: 详细配置
1163
+ * - false: 隐藏表格列(简写,等价于 { hidden: true })
1164
+ */
1165
+ table?: {
1166
+ /** 是否在表格中隐藏 */
1167
+ hidden?: boolean;
1168
+ /** 表格列标签 */
1169
+ label?: string;
1170
+ /** 排序权重,数值越小越靠前 */
1171
+ index?: number;
1172
+ /** 仅用于表格展示的静态值标签;与 dataSource 同时配置时覆盖同值的动态标签 */
1173
+ options?: FieldOption[];
1174
+ /** 仅用于表格展示的动态值标签源 */
1175
+ dataSource?: AutoCrudDataSourceConfig;
1176
+ /** 声明式单元格展示模式;非 auto 模式会覆盖拥有方自定义 cell */
1177
+ display?: FieldTableDisplay;
1178
+ /** 该列的类名;th 应用于表头,td 应用于正文单元格 */
1179
+ classNames?: ColumnMeta<unknown, unknown>['classNames'];
1180
+ /** 列元数据 */
1181
+ meta?: Record<string, unknown>;
1182
+ /** 其他列配置 */
1183
+ [key: string]: unknown;
1184
+ } | false;
1185
+ /**
1186
+ * 表单特定配置
1187
+ * - object: 详细配置(Formily Schema)
1188
+ * - false: 隐藏表单字段(简写,等价于 { "x-hidden": true })
1189
+ */
1190
+ form?: {
1191
+ /** 是否在表单中隐藏 */
1192
+ 'x-hidden'?: boolean;
1193
+ /** 组件类型 */
1194
+ 'x-component'?: string;
1195
+ /** 组件属性 */
1196
+ 'x-component-props'?: Record<string, unknown>;
1197
+ /** 其他表单配置 */
1198
+ [key: string]: unknown;
1199
+ } | false;
1200
+ }
1201
+ type Fields = Record<string, Field>;
1202
+ /** 内置操作项(覆盖默认行为或调整位置) */
1203
+ type ActionMeta = {
1204
+ id?: string;
1205
+ order?: number;
1206
+ hidden?: boolean;
1207
+ };
1208
+ type AutoCrudRowOpenOptions<T> = {
1209
+ type: 'view' | 'edit' | 'copy' | 'delete';
1210
+ row: T;
1211
+ } | {
1212
+ type: 'custom';
1213
+ component: React$1.ReactElement<RowActionDialogProps>;
1214
+ };
1215
+ interface AutoCrudRowActionContext<T> {
1216
+ /** Unified entry point. Unavailable built-in operations are ignored. */
1217
+ open: (options: AutoCrudRowOpenOptions<T>) => void;
1218
+ /** Menu primitive from the same runtime instance as the owning menu. */
1219
+ MenuItem: typeof DropdownMenuItem$1;
1220
+ crudId: string;
1221
+ idKey: string;
1222
+ row: T;
1223
+ rowId?: string;
1224
+ openView: (row: T) => void;
1225
+ openEdit?: (row: T) => void;
1226
+ copyRow?: (row: T) => void;
1227
+ openDelete?: (row: T) => void;
1228
+ }
1229
+ type ActionComponent<TContext> = React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
1230
+ type RowBuiltinActionType = 'view' | 'edit' | 'copy' | 'delete';
1231
+ type RowBuiltinActionItem<T> = ActionMeta & {
1232
+ type: RowBuiltinActionType;
1233
+ onClick?: (row: T) => void;
1234
+ label?: string;
1235
+ separator?: boolean;
1236
+ };
1237
+ type RowCustomActionItem<T> = ActionMeta & {
1238
+ type: 'custom';
1239
+ label?: string;
1240
+ onClick?: (row: T) => void;
1241
+ component?: ActionComponent<AutoCrudRowActionContext<T>>;
1242
+ position?: 'start' | 'end';
1243
+ separator?: boolean;
1244
+ variant?: 'default' | 'destructive';
1245
+ };
1246
+ /**
1247
+ * Row action item.
1248
+ *
1249
+ * - Custom-only config keeps builtin row actions and appends custom actions.
1250
+ * - Including any builtin type takes over builtin ordering.
1251
+ */
1252
+ type RowActionItem<T> = RowBuiltinActionItem<T> | RowCustomActionItem<T>;
1253
+ type RowActionConfig<T> = RowActionItem<T>[] | ((defaults: RowBuiltinActionItem<T>[]) => RowActionItem<T>[]);
1254
+ /** @deprecated Use RowActionItem instead. */
1255
+ type ActionItem<T> = RowActionItem<T>;
1256
+ /** @deprecated Use RowActionConfig instead. */
1257
+ type ActionConfig<T> = RowActionConfig<T>;
1258
+ type AutoCrudActionsConfig<T> = {
1259
+ toolbar?: ToolbarActionConfig;
1260
+ row?: RowActionConfig<T>;
1261
+ batch?: BatchActionConfig<T>;
1262
+ };
1263
+ type AutoCrudActionConfig<T> = RowActionConfig<T> | AutoCrudActionsConfig<T>;
1264
+ /**
1265
+ * 顶部工具栏内置操作项
1266
+ */
1267
+ type ToolbarBuiltinActionType = 'refresh' | 'create' | 'import' | 'export';
1268
+ type ToolbarBuiltinActionItem = ActionMeta & {
1269
+ type: ToolbarBuiltinActionType;
1270
+ /** 替代默认的行为 */
1271
+ onClick?: () => void;
1272
+ /** 替代默认的标签文本 */
1273
+ label?: string;
1274
+ /** 替代整个按钮的渲染 */
1275
+ component?: ActionComponent<AutoCrudToolbarContext>;
1276
+ };
1277
+ /**
1278
+ * 顶部工具栏自定义操作项
1279
+ */
1280
+ type ToolbarCustomActionItem = ActionMeta & {
1281
+ type: 'custom';
1282
+ /** 渲染自定义内容 */
1283
+ component: ActionComponent<AutoCrudToolbarContext>;
1284
+ /** 仅在无内置项时生效:插入到首部还是尾部(默认 end) */
1285
+ position?: 'start' | 'end';
1286
+ };
1287
+ type ToolbarActionItem = ToolbarBuiltinActionItem | ToolbarCustomActionItem;
1288
+ type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActionItem[]) => ToolbarActionItem[]);
1289
+ interface AutoCrudToolbarContext {
1290
+ crudId: string;
1291
+ idKey: string;
1292
+ rowIds: string[];
1293
+ selectedRowIds: string[];
1294
+ selectedCount: number;
1295
+ refresh?: () => Promise<unknown>;
1296
+ openImport?: () => void;
1297
+ exportData?: () => Promise<void>;
1298
+ openCreate?: () => void;
1299
+ isRefreshing: boolean;
1300
+ isExporting: boolean;
1422
1301
  }
1423
- type FilterOperator = DataTableConfig['operators'][number];
1424
- type FilterVariant$1 = DataTableConfig['filterVariants'][number];
1425
- type JoinOperator = DataTableConfig['joinOperators'][number];
1426
- interface ExtendedColumnSort<TData> extends Omit<ColumnSort, 'id'> {
1427
- id: Extract<keyof TData, string>;
1302
+ type AutoCrudToolbarResolver = (targetId: string, ownerActions: readonly ToolbarActionItem[], context: AutoCrudToolbarContext) => ToolbarActionItem[];
1303
+ declare function setToolbarResolver(resolver: AutoCrudToolbarResolver | null): void;
1304
+ /**
1305
+ * AutoCrudTable Props 接口
1306
+ */
1307
+ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
1308
+ /** Public CRUD id. Used by hosts to document the extension target. */
1309
+ id?: string;
1310
+ /** 页面标题 */
1311
+ title?: string;
1312
+ /** 页面描述 */
1313
+ description?: string;
1314
+ /** Zod schema */
1315
+ schema: TSchema;
1316
+ /** useAutoCrudResource hook 返回值 */
1317
+ resource: UseAutoCrudResourceReturn<TSchema, z.output<TSchema>>;
1318
+ /**
1319
+ * 统一字段配置
1320
+ * 支持共用配置(label, hidden)+ 表格/表单特定配置
1321
+ */
1322
+ fields?: Fields;
1323
+ /** Detail presentation shares field formatting by default. */
1324
+ view?: {
1325
+ /** Explicitly reuse custom list cells with a separate, single-row table context. */
1326
+ presentation?: 'table';
1327
+ /** Detail-only column overrides; the list presentation is unchanged. */
1328
+ overrides?: NonNullable<Parameters<typeof createTableSchema<TSchema>>[1]>['overrides'];
1329
+ };
1330
+ /** 表格配置 */
1331
+ table?: {
1332
+ /** 按元素分组的全局表格类名;列级 th/td 类名优先 */
1333
+ classNames?: DataTableClassNames;
1334
+ /** 隐藏的列 */
1335
+ hidden?: string[];
1336
+ /** 列覆盖配置 */
1337
+ overrides?: Record<string, any>;
1338
+ /**
1339
+ * 过滤模式配置
1340
+ * - 单个值: 只使用该模式,不显示切换按钮
1341
+ * - 数组: 第一个为默认值,显示切换按钮
1342
+ */
1343
+ filterModes?: FilterMode | FilterMode[];
1344
+ /** 全局搜索框;默认在存在 search: true 字段时显示 */
1345
+ search?: boolean | {
1346
+ placeholder?: string;
1347
+ };
1348
+ /**
1349
+ * 批量更新字段配置
1350
+ * - 只需传字段名数组,options 自动从 schema enum 推导
1351
+ * - 也可以传完整配置覆盖 label 或 options
1352
+ */
1353
+ batchFields?: (string | BatchUpdateField)[];
1354
+ /**
1355
+ * 多选后悬浮批量操作栏配置
1356
+ * 用法类同 `actions` 行操作和 `toolbar` 顶部工具栏。
1357
+ * 只传 custom 时保留默认批量操作;包含任意内置 type 时完全接管顺序。
1358
+ * @deprecated Use actions.batch instead.
1359
+ */
1360
+ batchActions?: BatchActionConfig<z.output<TSchema>>;
1361
+ /** 默认排序 */
1362
+ defaultSort?: any[];
1363
+ };
1364
+ /** 表单配置 */
1365
+ form?: {
1366
+ /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
1367
+ overrides?: Record<string, any>;
1368
+ /** Formily schema expression/reaction scope */
1369
+ scope?: JsonSchemaFormScope;
1370
+ /** 表单列数 */
1371
+ columns?: number;
1372
+ /** 弹窗自定义容器类名(支持控制大小、最大高度等) */
1373
+ className?: string;
1374
+ };
1375
+ /** 行操作配置,或统一的 toolbar/row/batch 操作配置。 */
1376
+ actions?: AutoCrudActionConfig<z.output<TSchema>>;
1377
+ /**
1378
+ * 顶层工具栏操作配置
1379
+ * 用法类同 `actions` 行操作。一旦配置了包含内置 `type` 的数组,它将完全接管右侧工具栏!
1380
+ * @deprecated Use actions.toolbar instead.
1381
+ */
1382
+ toolbar?: ToolbarActionConfig;
1383
+ /** @deprecated Use toolbar instead. */
1384
+ toolbarActions?: ToolbarActionConfig;
1385
+ /**
1386
+ * 权限配置
1387
+ * 控制按钮显示和字段访问
1388
+ *
1389
+ * @example
1390
+ * ```tsx
1391
+ * const permissions = useMemo(() => ({
1392
+ * can: {
1393
+ * create: user.role === 'admin',
1394
+ * update: user.role === 'admin' || user.role === 'editor',
1395
+ * delete: user.role === 'admin',
1396
+ * export: true,
1397
+ * import: true,
1398
+ * },
1399
+ * deny: user.role === 'user' ? ['salary', 'ssn'] : [],
1400
+ * }), [user.role]);
1401
+ *
1402
+ * <AutoCrudTable permissions={permissions} ... />
1403
+ * ```
1404
+ */
1405
+ permissions?: CrudPermissions;
1406
+ /**
1407
+ * 语言配置
1408
+ * - 内置语言 key:`"zh-CN"`(默认)、`"en-US"`
1409
+ * - 部分覆盖对象:以 zh-CN 为基础深合并
1410
+ *
1411
+ * @example
1412
+ * ```tsx
1413
+ * <AutoCrudTable locale="en-US" ... />
1414
+ * <AutoCrudTable locale={{ toolbar: { create: "Add New" } }} ... />
1415
+ * ```
1416
+ */
1417
+ locale?: LocaleProp;
1418
+ /**
1419
+ * 自定义新建按钮点击事件
1420
+ * 如果提供,将覆盖默认的打开新建弹窗行为
1421
+ */
1422
+ onCreate?: () => void;
1428
1423
  }
1429
- interface ExtendedColumnFilter<TData> extends FilterItemSchema {
1430
- id: Extract<keyof TData, string>;
1424
+ /**
1425
+ * AutoCrudTable 组件
1426
+ *
1427
+ * 高级 CRUD 表格组件,封装了完整的增删改查流程
1428
+ */
1429
+ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1430
+ id,
1431
+ title,
1432
+ description,
1433
+ schema,
1434
+ resource,
1435
+ fields,
1436
+ table: tableConfig,
1437
+ form: formConfig,
1438
+ view: viewConfig,
1439
+ permissions,
1440
+ actions: actionItems,
1441
+ toolbar,
1442
+ toolbarActions,
1443
+ locale: localeProp,
1444
+ onCreate
1445
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
1446
+ //#endregion
1447
+ //#region src/components/auto-crud/auto-form.d.ts
1448
+ interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
1449
+ schema: T;
1450
+ initialValues?: Partial<z.infer<T>>;
1451
+ onSubmit: (values: z.infer<T>) => void | Promise<void>;
1452
+ /** 统一字段配置,推荐用于描述 auto-crud 字段级表单行为 */
1453
+ fields?: Fields;
1454
+ /** Formily 字段 schema 覆盖配置,保留兼容旧 API */
1455
+ overrides?: FormSchemaOverrides;
1456
+ /** Formily schema expression/reaction scope */
1457
+ scope?: JsonSchemaFormScope;
1458
+ mode?: 'create' | 'edit';
1459
+ loading?: boolean;
1460
+ gridColumns?: number;
1461
+ /** Label 对齐方式 */
1462
+ labelAlign?: 'left' | 'top' | 'right';
1463
+ /** Label 宽度(labelAlign 为 left 时有效) */
1464
+ labelWidth?: number | string;
1465
+ /** 是否显示提交按钮(默认 true) */
1466
+ showSubmitButton?: boolean;
1431
1467
  }
1432
- interface DataTableRowAction<TData> {
1433
- row: Row<TData>;
1434
- variant: 'update' | 'delete';
1468
+ interface AutoFormRef {
1469
+ submit: () => Promise<void>;
1435
1470
  }
1471
+ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1472
+ schema: zodSchema,
1473
+ initialValues,
1474
+ onSubmit,
1475
+ fields,
1476
+ overrides,
1477
+ scope: scopeProp,
1478
+ mode,
1479
+ loading,
1480
+ gridColumns,
1481
+ labelAlign,
1482
+ labelWidth,
1483
+ showSubmitButton
1484
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
1485
+ declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1486
+ ref?: React.Ref<AutoFormRef>;
1487
+ }) => ReturnType<typeof AutoFormInner>;
1436
1488
  //#endregion
1437
1489
  //#region src/components/auto-crud/auto-table-simple-filters.d.ts
1438
1490
  interface AutoTableSimpleFiltersProps<TData> {
@@ -1539,6 +1591,7 @@ declare function ExportDialog({
1539
1591
  //#region src/components/data-table/data-table.d.ts
1540
1592
  interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
1541
1593
  table: Table<TData>;
1594
+ classNames?: DataTableClassNames;
1542
1595
  actionBar?: React$1.ReactNode;
1543
1596
  }
1544
1597
  declare function DataTable<TData>({
@@ -1546,6 +1599,7 @@ declare function DataTable<TData>({
1546
1599
  actionBar,
1547
1600
  children,
1548
1601
  className,
1602
+ classNames,
1549
1603
  ...props
1550
1604
  }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1551
1605
  //#endregion
@@ -1917,13 +1971,19 @@ declare function createMemoryDataSource<T extends {
1917
1971
  //#region src/lib/format.d.ts
1918
1972
  type DateFormatPreset = 'date' | 'datetime';
1919
1973
  type DateFormatter = (date: Date, options: Intl.DateTimeFormatOptions, preset?: DateFormatPreset) => string;
1974
+ interface DateLocaleOptions {
1975
+ locale: string;
1976
+ /** Host policy metadata; calendar days are not shifted into this zone.
1977
+ * Configure the server's resolveDateRange separately for query boundaries.
1978
+ */
1979
+ timeZone: string;
1980
+ }
1920
1981
  /**
1921
- * Register the host's process-wide date presentation policy without coupling
1922
- * AutoCrud to locale or timezone selection. The returned cleanup removes only
1923
- * this registration, so overlapping registrations may be disposed out of order.
1982
+ * Register the host's date formatter and optional calendar locale policy.
1983
+ * Cleanup removes only this registration, including out-of-order cleanup.
1924
1984
  * Passing undefined clears every registration.
1925
1985
  */
1926
- declare function setDateFormatter(formatter?: DateFormatter): () => void;
1986
+ declare function setDateFormatter(formatter?: DateFormatter, options?: DateLocaleOptions): () => void;
1927
1987
  declare function formatDate(date: Date | string | number | undefined, opts?: Intl.DateTimeFormatOptions, preset?: DateFormatPreset): string;
1928
1988
  //#endregion
1929
1989
  //#region src/lib/humanize.d.ts
@@ -2004,4 +2064,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
2004
2064
  */
2005
2065
  declare function downloadCSVTemplate(headers: string[], filename?: string): void;
2006
2066
  //#endregion
2007
- export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type DateFormatPreset, type DateFormatter, type EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, type FieldTableDisplay, type FieldType, type Fields, type FilterConfig, FilterOperator, type FilterVariant, type FormSchemaOverrides, ImportDialog, type ImportDialogProps, type ImportResult, type JSONSchema, type JSONSchemaProperty, JoinOperator, type ListParams, type ListResult, type LocaleProp, MultiCombobox, type MultiComboboxOption, type MultiComboboxProps, type MultiComboboxTriggerRenderProps, Option, type ParsedImportData, type ParsedZodField, type Parser, QueryKeys, type RowActionConfig, type RowActionItem, type RowBuiltinActionItem, type RowBuiltinActionType, type RowCustomActionItem, SchemaAdapter, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
2067
+ export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, type AutoCrudRowOpenOptions, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableClassNames, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type DateFormatPreset, type DateFormatter, type DateLocaleOptions, type EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, type FieldTableDisplay, type FieldType, type Fields, type FilterConfig, FilterOperator, type FilterVariant, type FormSchemaOverrides, ImportDialog, type ImportDialogProps, type ImportResult, type JSONSchema, type JSONSchemaProperty, JoinOperator, type ListParams, type ListResult, type LocaleProp, MultiCombobox, type MultiComboboxOption, type MultiComboboxProps, type MultiComboboxTriggerRenderProps, Option, type ParsedImportData, type ParsedZodField, type Parser, QueryKeys, type RowActionConfig, type RowActionDialogProps, type RowActionItem, type RowBuiltinActionItem, type RowBuiltinActionType, type RowCustomActionItem, SchemaAdapter, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };