@wordrhyme/auto-crud 1.3.0 → 1.3.1

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.cts CHANGED
@@ -1,11 +1,12 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
2
2
  import { z } from "zod";
3
+ import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
3
4
  import * as _tanstack_react_table0 from "@tanstack/react-table";
4
5
  import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
5
6
  import * as React$1 from "react";
6
- import { ComponentProps, ReactNode } from "react";
7
7
  import { ISchema } from "@formily/json-schema";
8
- import { Command, DropdownMenuTrigger, PopoverContent } from "@pixpilot/shadcn";
8
+ import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
9
+ import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps } from "@wordrhyme/shadcn-ui";
9
10
  import { ClassValue } from "clsx";
10
11
 
11
12
  //#region src/hooks/use-auto-crud-resource.d.ts
@@ -341,6 +342,12 @@ type BatchCustomActionItem<TData> = BatchActionMeta & {
341
342
  };
342
343
  type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
343
344
  type BatchActionConfig<TData> = BatchActionItem<TData>[] | ((defaults: BatchBuiltinActionItem<TData>[]) => BatchActionItem<TData>[]);
345
+ interface BatchDeleteConfirmation {
346
+ title: string;
347
+ description: (count: number) => string;
348
+ cancel: string;
349
+ confirm: string;
350
+ }
344
351
  interface AutoTableActionBarProps<TData> {
345
352
  table: Table<TData>;
346
353
  onDeleteSelected?: (rows: TData[]) => void;
@@ -358,6 +365,8 @@ interface AutoTableActionBarProps<TData> {
358
365
  extraActions?: React$1.ReactNode;
359
366
  /** 批量操作配置,支持和行操作/顶部工具栏一致的顺序接管语义 */
360
367
  actions?: BatchActionConfig<TData>;
368
+ /** 批量删除二次确认文案 */
369
+ deleteConfirmation?: BatchDeleteConfirmation;
361
370
  }
362
371
  declare function AutoTableActionBar<TData>({
363
372
  table,
@@ -368,8 +377,9 @@ declare function AutoTableActionBar<TData>({
368
377
  showDefaultExport,
369
378
  enableDelete,
370
379
  extraActions,
371
- actions
372
- }: AutoTableActionBarProps<TData>): react_jsx_runtime1.JSX.Element;
380
+ actions,
381
+ deleteConfirmation
382
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime5.JSX.Element;
373
383
  //#endregion
374
384
  //#region src/lib/schema-bridge/types.d.ts
375
385
  /**
@@ -507,6 +517,8 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
507
517
  actionBarExtra?: React.ReactNode;
508
518
  /** 批量悬浮操作配置 */
509
519
  actionBarActions?: BatchActionConfig<z.infer<T>>;
520
+ /** 批量删除二次确认文案 */
521
+ deleteConfirmation?: BatchDeleteConfirmation;
510
522
  /** 初始排序 */
511
523
  initialSorting?: any[];
512
524
  /** 是否启用导出功能 (默认 true) */
@@ -536,13 +548,14 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
536
548
  batchUpdateFields,
537
549
  actionBarExtra,
538
550
  actionBarActions,
551
+ deleteConfirmation,
539
552
  initialSorting,
540
553
  enableExport,
541
554
  showDefaultExport,
542
555
  onSelectedCountChange,
543
556
  onSelectedRowsChange,
544
557
  getSelectedRows
545
- }: AutoTableProps<T>): react_jsx_runtime1.JSX.Element;
558
+ }: AutoTableProps<T>): react_jsx_runtime5.JSX.Element;
546
559
  //#endregion
547
560
  //#region src/i18n/locale.d.ts
548
561
  /**
@@ -590,6 +603,12 @@ interface AutoCrudLocale {
590
603
  confirm: string;
591
604
  confirming: string;
592
605
  };
606
+ bulkDeleteModal: {
607
+ title: string;
608
+ description: (count: number) => string;
609
+ cancel: string;
610
+ confirm: string;
611
+ };
593
612
  importDialog: {
594
613
  title: string;
595
614
  uploadDescription: string;
@@ -650,11 +669,14 @@ type AutoCrudOption = {
650
669
  };
651
670
  type AutoCrudDataSourceContext = {
652
671
  field: string;
672
+ page?: number;
673
+ pageSize?: number;
653
674
  search?: string;
654
675
  values?: Record<string, unknown>;
655
676
  signal?: AbortSignal;
656
677
  };
657
678
  type AutoCrudDataSourceResult = AutoCrudOption[] | {
679
+ hasMore?: boolean;
658
680
  options?: AutoCrudOption[];
659
681
  };
660
682
  type AutoCrudDataSourceLoader = (context: AutoCrudDataSourceContext) => AutoCrudDataSourceResult | Promise<AutoCrudDataSourceResult>;
@@ -662,11 +684,19 @@ type AutoCrudDataSourceConfig = string;
662
684
  type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
663
685
  dependencies?: string[];
664
686
  reset?: boolean;
687
+ search?: boolean;
688
+ debounceMs?: number;
689
+ loadMore?: boolean;
690
+ pageSize?: number;
665
691
  load: AutoCrudDataSourceLoader;
666
692
  };
667
693
  type AutoCrudDataSourceEntry = {
668
694
  dependencies: string[];
669
695
  reset: boolean;
696
+ search: boolean;
697
+ debounceMs: number;
698
+ loadMore: boolean;
699
+ pageSize: number;
670
700
  load: AutoCrudDataSourceLoader;
671
701
  };
672
702
  type RegistryListener$1 = () => void;
@@ -925,6 +955,8 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
925
955
  form?: {
926
956
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
927
957
  overrides?: Record<string, any>;
958
+ /** Formily schema expression/reaction scope */
959
+ scope?: JsonSchemaFormScope;
928
960
  /** 表单列数 */
929
961
  columns?: number;
930
962
  /** 弹窗自定义容器类名(支持控制大小、最大高度等) */
@@ -999,14 +1031,19 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
999
1031
  toolbarActions,
1000
1032
  locale: localeProp,
1001
1033
  onCreate
1002
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime1.JSX.Element;
1034
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime5.JSX.Element;
1003
1035
  //#endregion
1004
1036
  //#region src/components/auto-crud/auto-form.d.ts
1005
1037
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
1006
1038
  schema: T;
1007
1039
  initialValues?: Partial<z.infer<T>>;
1008
1040
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
1041
+ /** 统一字段配置,推荐用于描述 auto-crud 字段级表单行为 */
1042
+ fields?: Fields;
1043
+ /** Formily 字段 schema 覆盖配置,保留兼容旧 API */
1009
1044
  overrides?: FormSchemaOverrides;
1045
+ /** Formily schema expression/reaction scope */
1046
+ scope?: JsonSchemaFormScope;
1010
1047
  mode?: 'create' | 'edit';
1011
1048
  loading?: boolean;
1012
1049
  gridColumns?: number;
@@ -1024,14 +1061,16 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1024
1061
  schema: zodSchema,
1025
1062
  initialValues,
1026
1063
  onSubmit,
1064
+ fields,
1027
1065
  overrides,
1066
+ scope: scopeProp,
1028
1067
  mode,
1029
1068
  loading,
1030
1069
  gridColumns,
1031
1070
  labelAlign,
1032
1071
  labelWidth,
1033
1072
  showSubmitButton
1034
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime1.JSX.Element;
1073
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime5.JSX.Element;
1035
1074
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1036
1075
  ref?: React.Ref<AutoFormRef>;
1037
1076
  }) => ReturnType<typeof AutoFormInner>;
@@ -1289,6 +1328,20 @@ declare module '@tanstack/react-table' {
1289
1328
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1290
1329
  /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
1291
1330
  modes?: Array<'simple' | 'advanced' | 'command'>;
1331
+ /** 内部:远程筛选选项搜索值 */
1332
+ autoCrudFilterSearchValue?: string;
1333
+ /** 内部:远程筛选选项搜索回调 */
1334
+ autoCrudFilterOnSearch?: (value: string) => void;
1335
+ /** 内部:是否启用本地选项过滤 */
1336
+ autoCrudFilterShouldFilter?: boolean;
1337
+ /** 内部:远程筛选当前弹窗选项,和稳定标签缓存分离 */
1338
+ autoCrudFilterOptions?: Option[];
1339
+ /** 内部:远程筛选是否还有更多选项 */
1340
+ autoCrudFilterHasMore?: boolean;
1341
+ /** 内部:远程筛选是否正在加载 */
1342
+ autoCrudFilterLoading?: boolean;
1343
+ /** 内部:远程筛选弹窗滚动回调 */
1344
+ autoCrudFilterOnPopupScroll?: React.UIEventHandler<HTMLElement>;
1292
1345
  }
1293
1346
  }
1294
1347
  interface QueryKeys {
@@ -1333,7 +1386,7 @@ declare function AutoTableSimpleFilters<TData>({
1333
1386
  filters: externalFilters,
1334
1387
  onFiltersChange,
1335
1388
  leading
1336
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime1.JSX.Element | null;
1389
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime5.JSX.Element | null;
1337
1390
  //#endregion
1338
1391
  //#region src/components/auto-crud/form-modal.d.ts
1339
1392
  type ModalVariant = "dialog" | "sheet";
@@ -1342,18 +1395,19 @@ type ModalVariant = "dialog" | "sheet";
1342
1395
  interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
1343
1396
  open: boolean;
1344
1397
  onOpenChange: (open: boolean) => void;
1345
- mode: "create" | "edit";
1398
+ mode: 'create' | 'edit';
1346
1399
  schema: T;
1347
1400
  initialValues?: Partial<z.infer<T>>;
1348
1401
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
1349
1402
  loading?: boolean;
1350
1403
  variant?: ModalVariant;
1351
1404
  overrides?: FormSchemaOverrides;
1405
+ scope?: JsonSchemaFormScope;
1352
1406
  title?: string;
1353
- locale?: AutoCrudLocale["formModal"];
1407
+ locale?: AutoCrudLocale['formModal'];
1354
1408
  gridColumns?: number;
1355
1409
  /** Label 对齐方式 */
1356
- labelAlign?: "left" | "top" | "right";
1410
+ labelAlign?: 'left' | 'top' | 'right';
1357
1411
  /** Label 宽度(labelAlign 为 left 时有效) */
1358
1412
  labelWidth?: number | string;
1359
1413
  /** 弹窗自定义样式 */
@@ -1369,13 +1423,14 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1369
1423
  loading,
1370
1424
  variant,
1371
1425
  overrides,
1426
+ scope,
1372
1427
  title,
1373
1428
  locale,
1374
1429
  gridColumns,
1375
1430
  labelAlign,
1376
1431
  labelWidth,
1377
1432
  className
1378
- }: CrudFormModalProps<T>): react_jsx_runtime1.JSX.Element;
1433
+ }: CrudFormModalProps<T>): react_jsx_runtime5.JSX.Element;
1379
1434
  //#endregion
1380
1435
  //#region src/components/auto-crud/import-dialog.d.ts
1381
1436
  interface ImportDialogProps {
@@ -1388,7 +1443,7 @@ interface ImportDialogProps {
1388
1443
  /** 对话框标题(优先于 locale.title) */
1389
1444
  title?: string;
1390
1445
  /** 语言包,默认 zh-CN */
1391
- locale?: AutoCrudLocale["importDialog"];
1446
+ locale?: AutoCrudLocale['importDialog'];
1392
1447
  }
1393
1448
  declare function ImportDialog({
1394
1449
  open,
@@ -1397,7 +1452,7 @@ declare function ImportDialog({
1397
1452
  columns,
1398
1453
  title,
1399
1454
  locale
1400
- }: ImportDialogProps): react_jsx_runtime1.JSX.Element;
1455
+ }: ImportDialogProps): react_jsx_runtime5.JSX.Element;
1401
1456
  //#endregion
1402
1457
  //#region src/components/auto-crud/export-dialog.d.ts
1403
1458
  type ExportMode = "selected" | "filtered";
@@ -1417,7 +1472,7 @@ declare function ExportDialog({
1417
1472
  selectedCount,
1418
1473
  onExport,
1419
1474
  canExportFiltered
1420
- }: ExportDialogProps): react_jsx_runtime1.JSX.Element;
1475
+ }: ExportDialogProps): react_jsx_runtime5.JSX.Element;
1421
1476
  //#endregion
1422
1477
  //#region src/components/data-table/data-table.d.ts
1423
1478
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1430,7 +1485,7 @@ declare function DataTable<TData>({
1430
1485
  children,
1431
1486
  className,
1432
1487
  ...props
1433
- }: DataTableProps<TData>): react_jsx_runtime1.JSX.Element;
1488
+ }: DataTableProps<TData>): react_jsx_runtime5.JSX.Element;
1434
1489
  //#endregion
1435
1490
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1436
1491
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1441,7 +1496,7 @@ declare function DataTableAdvancedToolbar<TData>({
1441
1496
  children,
1442
1497
  className,
1443
1498
  ...props
1444
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime1.JSX.Element;
1499
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
1445
1500
  //#endregion
1446
1501
  //#region src/components/data-table/data-table-column-header.d.ts
1447
1502
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1453,7 +1508,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1453
1508
  label,
1454
1509
  className,
1455
1510
  ...props
1456
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime1.JSX.Element;
1511
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
1457
1512
  //#endregion
1458
1513
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1459
1514
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1467,7 +1522,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1467
1522
  title,
1468
1523
  options,
1469
1524
  multiple
1470
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime1.JSX.Element;
1525
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
1471
1526
  //#endregion
1472
1527
  //#region src/components/data-table/data-table-pagination.d.ts
1473
1528
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1479,7 +1534,7 @@ declare function DataTablePagination<TData>({
1479
1534
  pageSizeOptions,
1480
1535
  className,
1481
1536
  ...props
1482
- }: DataTablePaginationProps<TData>): react_jsx_runtime1.JSX.Element;
1537
+ }: DataTablePaginationProps<TData>): react_jsx_runtime5.JSX.Element;
1483
1538
  //#endregion
1484
1539
  //#region src/components/data-table/data-table-toolbar.d.ts
1485
1540
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1490,7 +1545,7 @@ declare function DataTableToolbar<TData>({
1490
1545
  children,
1491
1546
  className,
1492
1547
  ...props
1493
- }: DataTableToolbarProps<TData>): react_jsx_runtime1.JSX.Element;
1548
+ }: DataTableToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
1494
1549
  //#endregion
1495
1550
  //#region src/components/data-table/data-table-view-options.d.ts
1496
1551
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1501,48 +1556,7 @@ declare function DataTableViewOptions<TData>({
1501
1556
  table,
1502
1557
  disabled,
1503
1558
  ...props
1504
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime1.JSX.Element;
1505
- //#endregion
1506
- //#region src/components/ui/multi-combobox.d.ts
1507
- interface MultiComboboxOption {
1508
- value: string;
1509
- label: ReactNode;
1510
- searchText?: string | string[];
1511
- keywords?: string[];
1512
- count?: number;
1513
- disabled?: boolean;
1514
- icon?: React$1.ComponentType<{
1515
- className?: string;
1516
- }>;
1517
- }
1518
- interface MultiComboboxTriggerRenderProps {
1519
- open: boolean;
1520
- selectedOptions: MultiComboboxOption[];
1521
- selectedValues: string[];
1522
- clearSelection: (event?: React$1.MouseEvent) => void;
1523
- disabled?: boolean;
1524
- readOnly?: boolean;
1525
- }
1526
- interface MultiComboboxProps extends Omit<ComponentProps<typeof Command>, 'value' | 'defaultValue' | 'onChange' | 'onValueChange'> {
1527
- value?: string[];
1528
- defaultValue?: string[];
1529
- onChange?: (value: string[]) => void;
1530
- options?: MultiComboboxOption[];
1531
- placeholder?: string;
1532
- searchPlaceholder?: string;
1533
- emptyText?: string;
1534
- clearText?: string;
1535
- selectedText?: string;
1536
- selectionMode?: 'single' | 'multiple';
1537
- disabled?: boolean;
1538
- readOnly?: boolean;
1539
- className?: string;
1540
- contentClassName?: string;
1541
- triggerClassName?: string;
1542
- matchTriggerWidth?: boolean;
1543
- renderTrigger?: (props: MultiComboboxTriggerRenderProps) => ReactNode;
1544
- }
1545
- declare const MultiCombobox: React$1.FC<MultiComboboxProps>;
1559
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime5.JSX.Element;
1546
1560
  //#endregion
1547
1561
  //#region src/lib/crud-actions.d.ts
1548
1562
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
@@ -1917,4 +1931,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
1917
1931
  */
1918
1932
  declare function downloadCSVTemplate(headers: string[], filename?: string): void;
1919
1933
  //#endregion
1920
- 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 AutoCrudRowActionContext, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, 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 EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, 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, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, 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, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
1934
+ 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 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 EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, 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, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, 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, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as React$1 from "react";
2
- import { ComponentProps, ReactNode } from "react";
3
2
  import * as _tanstack_react_table0 from "@tanstack/react-table";
4
3
  import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
5
- import { Command, DropdownMenuTrigger, PopoverContent } from "@pixpilot/shadcn";
4
+ import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
6
5
  import { ClassValue } from "clsx";
7
6
  import * as react_jsx_runtime2 from "react/jsx-runtime";
7
+ import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps } from "@wordrhyme/shadcn-ui";
8
8
  import { z } from "zod";
9
+ import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
9
10
  import { ISchema } from "@formily/json-schema";
10
11
 
11
12
  //#region src/hooks/use-auto-crud-resource.d.ts
@@ -341,6 +342,12 @@ type BatchCustomActionItem<TData> = BatchActionMeta & {
341
342
  };
342
343
  type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
343
344
  type BatchActionConfig<TData> = BatchActionItem<TData>[] | ((defaults: BatchBuiltinActionItem<TData>[]) => BatchActionItem<TData>[]);
345
+ interface BatchDeleteConfirmation {
346
+ title: string;
347
+ description: (count: number) => string;
348
+ cancel: string;
349
+ confirm: string;
350
+ }
344
351
  interface AutoTableActionBarProps<TData> {
345
352
  table: Table<TData>;
346
353
  onDeleteSelected?: (rows: TData[]) => void;
@@ -358,6 +365,8 @@ interface AutoTableActionBarProps<TData> {
358
365
  extraActions?: React$1.ReactNode;
359
366
  /** 批量操作配置,支持和行操作/顶部工具栏一致的顺序接管语义 */
360
367
  actions?: BatchActionConfig<TData>;
368
+ /** 批量删除二次确认文案 */
369
+ deleteConfirmation?: BatchDeleteConfirmation;
361
370
  }
362
371
  declare function AutoTableActionBar<TData>({
363
372
  table,
@@ -368,7 +377,8 @@ declare function AutoTableActionBar<TData>({
368
377
  showDefaultExport,
369
378
  enableDelete,
370
379
  extraActions,
371
- actions
380
+ actions,
381
+ deleteConfirmation
372
382
  }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
373
383
  //#endregion
374
384
  //#region src/lib/schema-bridge/types.d.ts
@@ -507,6 +517,8 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
507
517
  actionBarExtra?: React.ReactNode;
508
518
  /** 批量悬浮操作配置 */
509
519
  actionBarActions?: BatchActionConfig<z.infer<T>>;
520
+ /** 批量删除二次确认文案 */
521
+ deleteConfirmation?: BatchDeleteConfirmation;
510
522
  /** 初始排序 */
511
523
  initialSorting?: any[];
512
524
  /** 是否启用导出功能 (默认 true) */
@@ -536,6 +548,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
536
548
  batchUpdateFields,
537
549
  actionBarExtra,
538
550
  actionBarActions,
551
+ deleteConfirmation,
539
552
  initialSorting,
540
553
  enableExport,
541
554
  showDefaultExport,
@@ -590,6 +603,12 @@ interface AutoCrudLocale {
590
603
  confirm: string;
591
604
  confirming: string;
592
605
  };
606
+ bulkDeleteModal: {
607
+ title: string;
608
+ description: (count: number) => string;
609
+ cancel: string;
610
+ confirm: string;
611
+ };
593
612
  importDialog: {
594
613
  title: string;
595
614
  uploadDescription: string;
@@ -650,11 +669,14 @@ type AutoCrudOption = {
650
669
  };
651
670
  type AutoCrudDataSourceContext = {
652
671
  field: string;
672
+ page?: number;
673
+ pageSize?: number;
653
674
  search?: string;
654
675
  values?: Record<string, unknown>;
655
676
  signal?: AbortSignal;
656
677
  };
657
678
  type AutoCrudDataSourceResult = AutoCrudOption[] | {
679
+ hasMore?: boolean;
658
680
  options?: AutoCrudOption[];
659
681
  };
660
682
  type AutoCrudDataSourceLoader = (context: AutoCrudDataSourceContext) => AutoCrudDataSourceResult | Promise<AutoCrudDataSourceResult>;
@@ -662,11 +684,19 @@ type AutoCrudDataSourceConfig = string;
662
684
  type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
663
685
  dependencies?: string[];
664
686
  reset?: boolean;
687
+ search?: boolean;
688
+ debounceMs?: number;
689
+ loadMore?: boolean;
690
+ pageSize?: number;
665
691
  load: AutoCrudDataSourceLoader;
666
692
  };
667
693
  type AutoCrudDataSourceEntry = {
668
694
  dependencies: string[];
669
695
  reset: boolean;
696
+ search: boolean;
697
+ debounceMs: number;
698
+ loadMore: boolean;
699
+ pageSize: number;
670
700
  load: AutoCrudDataSourceLoader;
671
701
  };
672
702
  type RegistryListener$1 = () => void;
@@ -925,6 +955,8 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
925
955
  form?: {
926
956
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
927
957
  overrides?: Record<string, any>;
958
+ /** Formily schema expression/reaction scope */
959
+ scope?: JsonSchemaFormScope;
928
960
  /** 表单列数 */
929
961
  columns?: number;
930
962
  /** 弹窗自定义容器类名(支持控制大小、最大高度等) */
@@ -1006,7 +1038,12 @@ interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
1006
1038
  schema: T;
1007
1039
  initialValues?: Partial<z.infer<T>>;
1008
1040
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
1041
+ /** 统一字段配置,推荐用于描述 auto-crud 字段级表单行为 */
1042
+ fields?: Fields;
1043
+ /** Formily 字段 schema 覆盖配置,保留兼容旧 API */
1009
1044
  overrides?: FormSchemaOverrides;
1045
+ /** Formily schema expression/reaction scope */
1046
+ scope?: JsonSchemaFormScope;
1010
1047
  mode?: 'create' | 'edit';
1011
1048
  loading?: boolean;
1012
1049
  gridColumns?: number;
@@ -1024,7 +1061,9 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1024
1061
  schema: zodSchema,
1025
1062
  initialValues,
1026
1063
  onSubmit,
1064
+ fields,
1027
1065
  overrides,
1066
+ scope: scopeProp,
1028
1067
  mode,
1029
1068
  loading,
1030
1069
  gridColumns,
@@ -1289,6 +1328,20 @@ declare module '@tanstack/react-table' {
1289
1328
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
1290
1329
  /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
1291
1330
  modes?: Array<'simple' | 'advanced' | 'command'>;
1331
+ /** 内部:远程筛选选项搜索值 */
1332
+ autoCrudFilterSearchValue?: string;
1333
+ /** 内部:远程筛选选项搜索回调 */
1334
+ autoCrudFilterOnSearch?: (value: string) => void;
1335
+ /** 内部:是否启用本地选项过滤 */
1336
+ autoCrudFilterShouldFilter?: boolean;
1337
+ /** 内部:远程筛选当前弹窗选项,和稳定标签缓存分离 */
1338
+ autoCrudFilterOptions?: Option[];
1339
+ /** 内部:远程筛选是否还有更多选项 */
1340
+ autoCrudFilterHasMore?: boolean;
1341
+ /** 内部:远程筛选是否正在加载 */
1342
+ autoCrudFilterLoading?: boolean;
1343
+ /** 内部:远程筛选弹窗滚动回调 */
1344
+ autoCrudFilterOnPopupScroll?: React.UIEventHandler<HTMLElement>;
1292
1345
  }
1293
1346
  }
1294
1347
  interface QueryKeys {
@@ -1342,18 +1395,19 @@ type ModalVariant = "dialog" | "sheet";
1342
1395
  interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
1343
1396
  open: boolean;
1344
1397
  onOpenChange: (open: boolean) => void;
1345
- mode: "create" | "edit";
1398
+ mode: 'create' | 'edit';
1346
1399
  schema: T;
1347
1400
  initialValues?: Partial<z.infer<T>>;
1348
1401
  onSubmit: (values: z.infer<T>) => void | Promise<void>;
1349
1402
  loading?: boolean;
1350
1403
  variant?: ModalVariant;
1351
1404
  overrides?: FormSchemaOverrides;
1405
+ scope?: JsonSchemaFormScope;
1352
1406
  title?: string;
1353
- locale?: AutoCrudLocale["formModal"];
1407
+ locale?: AutoCrudLocale['formModal'];
1354
1408
  gridColumns?: number;
1355
1409
  /** Label 对齐方式 */
1356
- labelAlign?: "left" | "top" | "right";
1410
+ labelAlign?: 'left' | 'top' | 'right';
1357
1411
  /** Label 宽度(labelAlign 为 left 时有效) */
1358
1412
  labelWidth?: number | string;
1359
1413
  /** 弹窗自定义样式 */
@@ -1369,6 +1423,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1369
1423
  loading,
1370
1424
  variant,
1371
1425
  overrides,
1426
+ scope,
1372
1427
  title,
1373
1428
  locale,
1374
1429
  gridColumns,
@@ -1388,7 +1443,7 @@ interface ImportDialogProps {
1388
1443
  /** 对话框标题(优先于 locale.title) */
1389
1444
  title?: string;
1390
1445
  /** 语言包,默认 zh-CN */
1391
- locale?: AutoCrudLocale["importDialog"];
1446
+ locale?: AutoCrudLocale['importDialog'];
1392
1447
  }
1393
1448
  declare function ImportDialog({
1394
1449
  open,
@@ -1503,47 +1558,6 @@ declare function DataTableViewOptions<TData>({
1503
1558
  ...props
1504
1559
  }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1505
1560
  //#endregion
1506
- //#region src/components/ui/multi-combobox.d.ts
1507
- interface MultiComboboxOption {
1508
- value: string;
1509
- label: ReactNode;
1510
- searchText?: string | string[];
1511
- keywords?: string[];
1512
- count?: number;
1513
- disabled?: boolean;
1514
- icon?: React$1.ComponentType<{
1515
- className?: string;
1516
- }>;
1517
- }
1518
- interface MultiComboboxTriggerRenderProps {
1519
- open: boolean;
1520
- selectedOptions: MultiComboboxOption[];
1521
- selectedValues: string[];
1522
- clearSelection: (event?: React$1.MouseEvent) => void;
1523
- disabled?: boolean;
1524
- readOnly?: boolean;
1525
- }
1526
- interface MultiComboboxProps extends Omit<ComponentProps<typeof Command>, 'value' | 'defaultValue' | 'onChange' | 'onValueChange'> {
1527
- value?: string[];
1528
- defaultValue?: string[];
1529
- onChange?: (value: string[]) => void;
1530
- options?: MultiComboboxOption[];
1531
- placeholder?: string;
1532
- searchPlaceholder?: string;
1533
- emptyText?: string;
1534
- clearText?: string;
1535
- selectedText?: string;
1536
- selectionMode?: 'single' | 'multiple';
1537
- disabled?: boolean;
1538
- readOnly?: boolean;
1539
- className?: string;
1540
- contentClassName?: string;
1541
- triggerClassName?: string;
1542
- matchTriggerWidth?: boolean;
1543
- renderTrigger?: (props: MultiComboboxTriggerRenderProps) => ReactNode;
1544
- }
1545
- declare const MultiCombobox: React$1.FC<MultiComboboxProps>;
1546
- //#endregion
1547
1561
  //#region src/lib/crud-actions.d.ts
1548
1562
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
1549
1563
  type CrudActionBase = {
@@ -1917,4 +1931,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
1917
1931
  */
1918
1932
  declare function downloadCSVTemplate(headers: string[], filename?: string): void;
1919
1933
  //#endregion
1920
- 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 AutoCrudRowActionContext, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, 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 EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, 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, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, 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, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
1934
+ 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 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 EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, 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, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, 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, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };