@wordrhyme/auto-crud 1.0.0 → 1.0.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,4 +1,4 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
  import { z } from "zod";
3
3
  import * as _tanstack_react_table0 from "@tanstack/react-table";
4
4
  import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
@@ -314,7 +314,7 @@ declare function AutoTableActionBar<TData>({
314
314
  enableExport,
315
315
  enableDelete,
316
316
  extraActions
317
- }: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
317
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime0.JSX.Element;
318
318
  //#endregion
319
319
  //#region src/lib/schema-bridge/types.d.ts
320
320
  /**
@@ -463,7 +463,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
463
463
  enableExport,
464
464
  onSelectedCountChange,
465
465
  getSelectedRows
466
- }: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
466
+ }: AutoTableProps<T>): react_jsx_runtime0.JSX.Element;
467
467
  //#endregion
468
468
  //#region src/components/auto-crud/auto-crud-table.d.ts
469
469
  /**
@@ -490,6 +490,8 @@ interface FilterConfig {
490
490
  placeholder?: string;
491
491
  /** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
492
492
  hidden?: boolean;
493
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
494
+ modes?: Array<"simple" | "advanced" | "command">;
493
495
  }
494
496
  /**
495
497
  * 统一字段配置
@@ -502,10 +504,16 @@ interface Field {
502
504
  hidden?: boolean;
503
505
  /**
504
506
  * 筛选器独立配置
507
+ * - FilterConfig: 详细配置
508
+ * - false: 禁用筛选(简写,等价于 { enabled: false })
505
509
  * 独立于 table.meta 控制筛选器行为,不影响表格列显示/隐藏
506
510
  */
507
- filter?: FilterConfig;
508
- /** 表格特定配置 */
511
+ filter?: FilterConfig | false;
512
+ /**
513
+ * 表格特定配置
514
+ * - object: 详细配置
515
+ * - false: 隐藏表格列(简写,等价于 { hidden: true })
516
+ */
509
517
  table?: {
510
518
  /** 是否在表格中隐藏 */
511
519
  hidden?: boolean;
@@ -513,8 +521,12 @@ interface Field {
513
521
  meta?: Record<string, unknown>;
514
522
  /** 其他列配置 */
515
523
  [key: string]: unknown;
516
- };
517
- /** 表单特定配置 */
524
+ } | false;
525
+ /**
526
+ * 表单特定配置
527
+ * - object: 详细配置(Formily Schema)
528
+ * - false: 隐藏表单字段(简写,等价于 { "x-hidden": true })
529
+ */
518
530
  form?: {
519
531
  /** 是否在表单中隐藏 */
520
532
  "x-hidden"?: boolean;
@@ -524,7 +536,7 @@ interface Field {
524
536
  "x-component-props"?: Record<string, unknown>;
525
537
  /** 其他表单配置 */
526
538
  [key: string]: unknown;
527
- };
539
+ } | false;
528
540
  }
529
541
  type Fields = Record<string, Field>;
530
542
  /**
@@ -621,7 +633,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
621
633
  form: formConfig,
622
634
  slots,
623
635
  permissions
624
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
636
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
625
637
  //#endregion
626
638
  //#region src/components/auto-crud/auto-form.d.ts
627
639
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -653,7 +665,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
653
665
  labelAlign,
654
666
  labelWidth,
655
667
  showSubmitButton
656
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
668
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
657
669
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
658
670
  ref?: React.Ref<AutoFormRef>;
659
671
  }) => ReturnType<typeof AutoFormInner>;
@@ -908,6 +920,8 @@ declare module "@tanstack/react-table" {
908
920
  range?: [number, number];
909
921
  unit?: string;
910
922
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
923
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
924
+ modes?: Array<"simple" | "advanced" | "command">;
911
925
  }
912
926
  }
913
927
  interface QueryKeys {
@@ -949,7 +963,7 @@ declare function AutoTableSimpleFilters<TData>({
949
963
  shallow,
950
964
  filters: externalFilters,
951
965
  onFiltersChange
952
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
966
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
953
967
  //#endregion
954
968
  //#region src/components/auto-crud/form-modal.d.ts
955
969
  type ModalVariant = "dialog" | "sheet";
@@ -984,7 +998,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
984
998
  title,
985
999
  labelAlign,
986
1000
  labelWidth
987
- }: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
1001
+ }: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
988
1002
  //#endregion
989
1003
  //#region src/components/auto-crud/import-dialog.d.ts
990
1004
  interface ImportDialogProps {
@@ -1003,7 +1017,7 @@ declare function ImportDialog({
1003
1017
  onImport,
1004
1018
  columns,
1005
1019
  title
1006
- }: ImportDialogProps): react_jsx_runtime3.JSX.Element;
1020
+ }: ImportDialogProps): react_jsx_runtime0.JSX.Element;
1007
1021
  //#endregion
1008
1022
  //#region src/components/auto-crud/export-dialog.d.ts
1009
1023
  type ExportMode = "selected" | "filtered";
@@ -1023,7 +1037,7 @@ declare function ExportDialog({
1023
1037
  selectedCount,
1024
1038
  onExport,
1025
1039
  canExportFiltered
1026
- }: ExportDialogProps): react_jsx_runtime3.JSX.Element;
1040
+ }: ExportDialogProps): react_jsx_runtime0.JSX.Element;
1027
1041
  //#endregion
1028
1042
  //#region src/components/data-table/data-table.d.ts
1029
1043
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1036,7 +1050,7 @@ declare function DataTable<TData>({
1036
1050
  children,
1037
1051
  className,
1038
1052
  ...props
1039
- }: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
1053
+ }: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
1040
1054
  //#endregion
1041
1055
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1042
1056
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1047,7 +1061,7 @@ declare function DataTableAdvancedToolbar<TData>({
1047
1061
  children,
1048
1062
  className,
1049
1063
  ...props
1050
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1064
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1051
1065
  //#endregion
1052
1066
  //#region src/components/data-table/data-table-column-header.d.ts
1053
1067
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1059,7 +1073,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1059
1073
  label,
1060
1074
  className,
1061
1075
  ...props
1062
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1076
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1063
1077
  //#endregion
1064
1078
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1065
1079
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1073,7 +1087,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1073
1087
  title,
1074
1088
  options,
1075
1089
  multiple
1076
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
1090
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
1077
1091
  //#endregion
1078
1092
  //#region src/components/data-table/data-table-pagination.d.ts
1079
1093
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1085,7 +1099,7 @@ declare function DataTablePagination<TData>({
1085
1099
  pageSizeOptions,
1086
1100
  className,
1087
1101
  ...props
1088
- }: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
1102
+ }: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
1089
1103
  //#endregion
1090
1104
  //#region src/components/data-table/data-table-toolbar.d.ts
1091
1105
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1096,7 +1110,7 @@ declare function DataTableToolbar<TData>({
1096
1110
  children,
1097
1111
  className,
1098
1112
  ...props
1099
- }: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
1113
+ }: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
1100
1114
  //#endregion
1101
1115
  //#region src/components/data-table/data-table-view-options.d.ts
1102
1116
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1107,7 +1121,7 @@ declare function DataTableViewOptions<TData>({
1107
1121
  table,
1108
1122
  disabled,
1109
1123
  ...props
1110
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
1124
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
1111
1125
  //#endregion
1112
1126
  //#region src/hooks/use-data-table.d.ts
1113
1127
  interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as _tanstack_react_table0 from "@tanstack/react-table";
3
3
  import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
4
4
  import { DropdownMenuTrigger, PopoverContent } from "@pixpilot/shadcn";
5
5
  import { ClassValue } from "clsx";
6
- import * as react_jsx_runtime1 from "react/jsx-runtime";
6
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
7
7
  import { z } from "zod";
8
8
  import { ISchema } from "@formily/json-schema";
9
9
 
@@ -314,7 +314,7 @@ declare function AutoTableActionBar<TData>({
314
314
  enableExport,
315
315
  enableDelete,
316
316
  extraActions
317
- }: AutoTableActionBarProps<TData>): react_jsx_runtime1.JSX.Element;
317
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime13.JSX.Element;
318
318
  //#endregion
319
319
  //#region src/lib/schema-bridge/types.d.ts
320
320
  /**
@@ -463,7 +463,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
463
463
  enableExport,
464
464
  onSelectedCountChange,
465
465
  getSelectedRows
466
- }: AutoTableProps<T>): react_jsx_runtime1.JSX.Element;
466
+ }: AutoTableProps<T>): react_jsx_runtime13.JSX.Element;
467
467
  //#endregion
468
468
  //#region src/components/auto-crud/auto-crud-table.d.ts
469
469
  /**
@@ -490,6 +490,8 @@ interface FilterConfig {
490
490
  placeholder?: string;
491
491
  /** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
492
492
  hidden?: boolean;
493
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
494
+ modes?: Array<"simple" | "advanced" | "command">;
493
495
  }
494
496
  /**
495
497
  * 统一字段配置
@@ -502,10 +504,16 @@ interface Field {
502
504
  hidden?: boolean;
503
505
  /**
504
506
  * 筛选器独立配置
507
+ * - FilterConfig: 详细配置
508
+ * - false: 禁用筛选(简写,等价于 { enabled: false })
505
509
  * 独立于 table.meta 控制筛选器行为,不影响表格列显示/隐藏
506
510
  */
507
- filter?: FilterConfig;
508
- /** 表格特定配置 */
511
+ filter?: FilterConfig | false;
512
+ /**
513
+ * 表格特定配置
514
+ * - object: 详细配置
515
+ * - false: 隐藏表格列(简写,等价于 { hidden: true })
516
+ */
509
517
  table?: {
510
518
  /** 是否在表格中隐藏 */
511
519
  hidden?: boolean;
@@ -513,8 +521,12 @@ interface Field {
513
521
  meta?: Record<string, unknown>;
514
522
  /** 其他列配置 */
515
523
  [key: string]: unknown;
516
- };
517
- /** 表单特定配置 */
524
+ } | false;
525
+ /**
526
+ * 表单特定配置
527
+ * - object: 详细配置(Formily Schema)
528
+ * - false: 隐藏表单字段(简写,等价于 { "x-hidden": true })
529
+ */
518
530
  form?: {
519
531
  /** 是否在表单中隐藏 */
520
532
  "x-hidden"?: boolean;
@@ -524,7 +536,7 @@ interface Field {
524
536
  "x-component-props"?: Record<string, unknown>;
525
537
  /** 其他表单配置 */
526
538
  [key: string]: unknown;
527
- };
539
+ } | false;
528
540
  }
529
541
  type Fields = Record<string, Field>;
530
542
  /**
@@ -621,7 +633,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
621
633
  form: formConfig,
622
634
  slots,
623
635
  permissions
624
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime1.JSX.Element;
636
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime13.JSX.Element;
625
637
  //#endregion
626
638
  //#region src/components/auto-crud/auto-form.d.ts
627
639
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -653,7 +665,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
653
665
  labelAlign,
654
666
  labelWidth,
655
667
  showSubmitButton
656
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime1.JSX.Element;
668
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime13.JSX.Element;
657
669
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
658
670
  ref?: React.Ref<AutoFormRef>;
659
671
  }) => ReturnType<typeof AutoFormInner>;
@@ -908,6 +920,8 @@ declare module "@tanstack/react-table" {
908
920
  range?: [number, number];
909
921
  unit?: string;
910
922
  icon?: React.FC<React.SVGProps<SVGSVGElement>>;
923
+ /** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
924
+ modes?: Array<"simple" | "advanced" | "command">;
911
925
  }
912
926
  }
913
927
  interface QueryKeys {
@@ -949,7 +963,7 @@ declare function AutoTableSimpleFilters<TData>({
949
963
  shallow,
950
964
  filters: externalFilters,
951
965
  onFiltersChange
952
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime1.JSX.Element | null;
966
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime13.JSX.Element | null;
953
967
  //#endregion
954
968
  //#region src/components/auto-crud/form-modal.d.ts
955
969
  type ModalVariant = "dialog" | "sheet";
@@ -984,7 +998,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
984
998
  title,
985
999
  labelAlign,
986
1000
  labelWidth
987
- }: CrudFormModalProps<T>): react_jsx_runtime1.JSX.Element;
1001
+ }: CrudFormModalProps<T>): react_jsx_runtime13.JSX.Element;
988
1002
  //#endregion
989
1003
  //#region src/components/auto-crud/import-dialog.d.ts
990
1004
  interface ImportDialogProps {
@@ -1003,7 +1017,7 @@ declare function ImportDialog({
1003
1017
  onImport,
1004
1018
  columns,
1005
1019
  title
1006
- }: ImportDialogProps): react_jsx_runtime1.JSX.Element;
1020
+ }: ImportDialogProps): react_jsx_runtime13.JSX.Element;
1007
1021
  //#endregion
1008
1022
  //#region src/components/auto-crud/export-dialog.d.ts
1009
1023
  type ExportMode = "selected" | "filtered";
@@ -1023,7 +1037,7 @@ declare function ExportDialog({
1023
1037
  selectedCount,
1024
1038
  onExport,
1025
1039
  canExportFiltered
1026
- }: ExportDialogProps): react_jsx_runtime1.JSX.Element;
1040
+ }: ExportDialogProps): react_jsx_runtime13.JSX.Element;
1027
1041
  //#endregion
1028
1042
  //#region src/components/data-table/data-table.d.ts
1029
1043
  interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1036,7 +1050,7 @@ declare function DataTable<TData>({
1036
1050
  children,
1037
1051
  className,
1038
1052
  ...props
1039
- }: DataTableProps<TData>): react_jsx_runtime1.JSX.Element;
1053
+ }: DataTableProps<TData>): react_jsx_runtime13.JSX.Element;
1040
1054
  //#endregion
1041
1055
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1042
1056
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1047,7 +1061,7 @@ declare function DataTableAdvancedToolbar<TData>({
1047
1061
  children,
1048
1062
  className,
1049
1063
  ...props
1050
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime1.JSX.Element;
1064
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1051
1065
  //#endregion
1052
1066
  //#region src/components/data-table/data-table-column-header.d.ts
1053
1067
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1059,7 +1073,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1059
1073
  label,
1060
1074
  className,
1061
1075
  ...props
1062
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime1.JSX.Element;
1076
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1063
1077
  //#endregion
1064
1078
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1065
1079
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1073,7 +1087,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1073
1087
  title,
1074
1088
  options,
1075
1089
  multiple
1076
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime1.JSX.Element;
1090
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime13.JSX.Element;
1077
1091
  //#endregion
1078
1092
  //#region src/components/data-table/data-table-pagination.d.ts
1079
1093
  interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
@@ -1085,7 +1099,7 @@ declare function DataTablePagination<TData>({
1085
1099
  pageSizeOptions,
1086
1100
  className,
1087
1101
  ...props
1088
- }: DataTablePaginationProps<TData>): react_jsx_runtime1.JSX.Element;
1102
+ }: DataTablePaginationProps<TData>): react_jsx_runtime13.JSX.Element;
1089
1103
  //#endregion
1090
1104
  //#region src/components/data-table/data-table-toolbar.d.ts
1091
1105
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
@@ -1096,7 +1110,7 @@ declare function DataTableToolbar<TData>({
1096
1110
  children,
1097
1111
  className,
1098
1112
  ...props
1099
- }: DataTableToolbarProps<TData>): react_jsx_runtime1.JSX.Element;
1113
+ }: DataTableToolbarProps<TData>): react_jsx_runtime13.JSX.Element;
1100
1114
  //#endregion
1101
1115
  //#region src/components/data-table/data-table-view-options.d.ts
1102
1116
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1107,7 +1121,7 @@ declare function DataTableViewOptions<TData>({
1107
1121
  table,
1108
1122
  disabled,
1109
1123
  ...props
1110
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime1.JSX.Element;
1124
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime13.JSX.Element;
1111
1125
  //#endregion
1112
1126
  //#region src/hooks/use-data-table.d.ts
1113
1127
  interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {