@wordrhyme/auto-crud 1.8.2 → 1.10.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.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { a as positionActions, i as matchesPosition, n as actionPositionSchema, r as compareOrder, t as ActionPosition } from "./position-DoBV7yB6.cjs";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
3
3
  import * as React$1 from "react";
4
+ import { ComponentProps, ReactNode } from "react";
4
5
  import * as _tanstack_react_table0 from "@tanstack/react-table";
5
6
  import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
6
7
  import { z } from "zod";
@@ -573,6 +574,8 @@ interface UseAutoCrudResourceParams<TSchema extends z.ZodObject<z.ZodRawShape>,
573
574
  router: CrudRouter;
574
575
  /** Zod schema */
575
576
  schema: TSchema;
577
+ /** Field filter configuration shared with AutoCrudTable. */
578
+ fields?: Fields;
576
579
  /**
577
580
  * 查询参数变换函数
578
581
  *
@@ -599,6 +602,7 @@ declare function useAutoCrudResource<TSchema extends z.ZodObject<z.ZodRawShape>,
599
602
  router,
600
603
  schema,
601
604
  query: queryTransform,
605
+ fields,
602
606
  options
603
607
  }: UseAutoCrudResourceParams<TSchema, TListItem>): UseAutoCrudResourceReturn<TSchema, TListItem>;
604
608
  //#endregion
@@ -648,6 +652,26 @@ interface CrudPermissions {
648
652
  deny?: string[];
649
653
  }
650
654
  //#endregion
655
+ //#region src/components/data-table/data-table.d.ts
656
+ interface DataTableProps<TData> extends ComponentProps<'div'> {
657
+ table: Table<TData>;
658
+ pagination?: TablePaginationOptions;
659
+ classNames?: DataTableClassNames;
660
+ actionBar?: ReactNode;
661
+ /** Content mounted below an expanded row. */
662
+ expandedRow?: (record: TData) => ReactNode;
663
+ }
664
+ declare function DataTable<TData>({
665
+ table,
666
+ actionBar,
667
+ pagination,
668
+ expandedRow,
669
+ children,
670
+ className,
671
+ classNames,
672
+ ...props
673
+ }: DataTableProps<TData>): react_jsx_runtime8.JSX.Element;
674
+ //#endregion
651
675
  //#region src/components/auto-crud/auto-table-action-bar.d.ts
652
676
  /** 批量更新字段配置 */
653
677
  interface BatchUpdateField {
@@ -735,7 +759,7 @@ declare function AutoTableActionBar<TData>({
735
759
  extraActions,
736
760
  actions,
737
761
  deleteConfirmation
738
- }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
762
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime8.JSX.Element;
739
763
  //#endregion
740
764
  //#region src/lib/schema-bridge/types.d.ts
741
765
  /**
@@ -844,9 +868,11 @@ declare function createActionsColumn<T>(items: ActionsColumnConfig<T>): ColumnDe
844
868
  //#region src/components/auto-crud/auto-table.d.ts
845
869
  /** 过滤模式类型 */
846
870
  type FilterMode = 'simple' | 'advanced' | 'command';
847
- interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
871
+ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow'> {
848
872
  schema: T;
849
873
  data: z.infer<T>[];
874
+ /** Stable row identity; required when expandedRow is provided. */
875
+ getRowId?: TableOptions<z.infer<T>>['getRowId'];
850
876
  pageCount?: number;
851
877
  pagination?: TablePaginationOptions;
852
878
  /** Total rows matching the current search and filters. */
@@ -856,6 +882,7 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
856
882
  classNames?: DataTableClassNames;
857
883
  enableRowSelection?: boolean;
858
884
  exclude?: (keyof z.infer<T>)[];
885
+ filterOnly?: string[];
859
886
  actions?: ActionsColumnConfig<z.infer<T>>;
860
887
  /** 自定义固定列配置 */
861
888
  pinnedColumns?: {
@@ -901,6 +928,8 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
901
928
  declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
902
929
  schema,
903
930
  data,
931
+ getRowId,
932
+ expandedRow,
904
933
  pageCount,
905
934
  pagination,
906
935
  total,
@@ -908,6 +937,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
908
937
  classNames,
909
938
  enableRowSelection,
910
939
  exclude,
940
+ filterOnly,
911
941
  actions,
912
942
  pinnedColumns,
913
943
  filterMode,
@@ -924,7 +954,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
924
954
  onSelectedCountChange,
925
955
  onSelectedRowsChange,
926
956
  getSelectedRows
927
- }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
957
+ }: AutoTableProps<T>): react_jsx_runtime8.JSX.Element;
928
958
  //#endregion
929
959
  //#region src/lib/row-action-dialog.d.ts
930
960
  interface RowActionDialogProps {
@@ -1272,6 +1302,8 @@ type RowCustomActionItem<T> = ActionMeta & {
1272
1302
  onClick?: (row: T) => void;
1273
1303
  component?: ActionComponent<AutoCrudRowActionContext<T>>;
1274
1304
  position?: ActionPosition;
1305
+ /** Place a registered custom action before the named builtin, when present. */
1306
+ before?: RowBuiltinActionType;
1275
1307
  separator?: boolean;
1276
1308
  variant?: 'default' | 'destructive';
1277
1309
  };
@@ -1394,7 +1426,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
1394
1426
  batchActions?: BatchActionConfig<z.output<TSchema>>;
1395
1427
  /** 默认排序 */
1396
1428
  defaultSort?: any[];
1397
- };
1429
+ } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow'>;
1398
1430
  /** 表单配置 */
1399
1431
  form?: {
1400
1432
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
@@ -1476,7 +1508,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1476
1508
  toolbarActions,
1477
1509
  locale: localeProp,
1478
1510
  onCreate
1479
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
1511
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime8.JSX.Element;
1480
1512
  //#endregion
1481
1513
  //#region src/components/auto-crud/auto-form.d.ts
1482
1514
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -1515,7 +1547,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1515
1547
  labelAlign,
1516
1548
  labelWidth,
1517
1549
  showSubmitButton
1518
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
1550
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime8.JSX.Element;
1519
1551
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1520
1552
  ref?: React.Ref<AutoFormRef>;
1521
1553
  }) => ReturnType<typeof AutoFormInner>;
@@ -1534,7 +1566,7 @@ declare function AutoTableSimpleFilters<TData>({
1534
1566
  filters: externalFilters,
1535
1567
  onFiltersChange,
1536
1568
  leading
1537
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
1569
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime8.JSX.Element | null;
1538
1570
  //#endregion
1539
1571
  //#region src/components/auto-crud/form-modal.d.ts
1540
1572
  type ModalVariant = 'dialog' | 'sheet';
@@ -1578,7 +1610,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1578
1610
  labelAlign,
1579
1611
  labelWidth,
1580
1612
  className
1581
- }: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
1613
+ }: CrudFormModalProps<T>): react_jsx_runtime8.JSX.Element;
1582
1614
  //#endregion
1583
1615
  //#region src/components/auto-crud/import-dialog.d.ts
1584
1616
  interface ImportDialogProps {
@@ -1600,7 +1632,7 @@ declare function ImportDialog({
1600
1632
  columns,
1601
1633
  title,
1602
1634
  locale
1603
- }: ImportDialogProps): react_jsx_runtime2.JSX.Element;
1635
+ }: ImportDialogProps): react_jsx_runtime8.JSX.Element;
1604
1636
  //#endregion
1605
1637
  //#region src/components/auto-crud/export-dialog.d.ts
1606
1638
  type ExportMode = 'selected' | 'filtered';
@@ -1620,24 +1652,7 @@ declare function ExportDialog({
1620
1652
  selectedCount,
1621
1653
  onExport,
1622
1654
  canExportFiltered
1623
- }: ExportDialogProps): react_jsx_runtime2.JSX.Element;
1624
- //#endregion
1625
- //#region src/components/data-table/data-table.d.ts
1626
- interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
1627
- table: Table<TData>;
1628
- pagination?: TablePaginationOptions;
1629
- classNames?: DataTableClassNames;
1630
- actionBar?: React$1.ReactNode;
1631
- }
1632
- declare function DataTable<TData>({
1633
- table,
1634
- actionBar,
1635
- pagination,
1636
- children,
1637
- className,
1638
- classNames,
1639
- ...props
1640
- }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1655
+ }: ExportDialogProps): react_jsx_runtime8.JSX.Element;
1641
1656
  //#endregion
1642
1657
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1643
1658
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
@@ -1648,7 +1663,7 @@ declare function DataTableAdvancedToolbar<TData>({
1648
1663
  children,
1649
1664
  className,
1650
1665
  ...props
1651
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1666
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
1652
1667
  //#endregion
1653
1668
  //#region src/components/data-table/data-table-column-header.d.ts
1654
1669
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1660,7 +1675,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1660
1675
  label,
1661
1676
  className,
1662
1677
  ...props
1663
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1678
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
1664
1679
  //#endregion
1665
1680
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1666
1681
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1674,7 +1689,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1674
1689
  title,
1675
1690
  options,
1676
1691
  multiple
1677
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1692
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
1678
1693
  //#endregion
1679
1694
  //#region src/components/data-table/data-table-pagination.d.ts
1680
1695
  interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'>, TablePaginationOptions {
@@ -1690,7 +1705,7 @@ declare function DataTablePagination<TData>({
1690
1705
  pageJumpLabel,
1691
1706
  className,
1692
1707
  ...props
1693
- }: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
1708
+ }: DataTablePaginationProps<TData>): react_jsx_runtime8.JSX.Element;
1694
1709
  //#endregion
1695
1710
  //#region src/components/data-table/data-table-toolbar.d.ts
1696
1711
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
@@ -1701,7 +1716,7 @@ declare function DataTableToolbar<TData>({
1701
1716
  children,
1702
1717
  className,
1703
1718
  ...props
1704
- }: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1719
+ }: DataTableToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
1705
1720
  //#endregion
1706
1721
  //#region src/components/data-table/data-table-view-options.d.ts
1707
1722
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1712,7 +1727,7 @@ declare function DataTableViewOptions<TData>({
1712
1727
  table,
1713
1728
  disabled,
1714
1729
  ...props
1715
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1730
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime8.JSX.Element;
1716
1731
  //#endregion
1717
1732
  //#region src/lib/crud-actions.d.ts
1718
1733
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
@@ -1722,6 +1737,8 @@ type CrudActionBase = {
1722
1737
  order?: number;
1723
1738
  hidden?: boolean;
1724
1739
  position?: ActionPosition;
1740
+ /** Insert a custom action before a builtin action type, if present. */
1741
+ before?: string;
1725
1742
  };
1726
1743
  type CrudActionEntry<TAction extends CrudActionBase = CrudActionBase> = {
1727
1744
  targetId: string;
@@ -2104,4 +2121,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
2104
2121
  */
2105
2122
  declare function downloadCSVTemplate(headers: string[], filename?: string): void;
2106
2123
  //#endregion
2107
- export { type ActionConfig, type ActionItem, type ActionPosition, 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 TablePaginationOptions, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, actionPositionSchema, cn, coerceRowValues, compareOrder, 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, matchesPosition, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, positionActions, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
2124
+ export { type ActionConfig, type ActionItem, type ActionPosition, 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, type AutoTableProps, 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, type DataTableProps, 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 TablePaginationOptions, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, actionPositionSchema, cn, coerceRowValues, compareOrder, 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, matchesPosition, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, positionActions, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { a as positionActions, i as matchesPosition, n as actionPositionSchema, r as compareOrder, t as ActionPosition } from "./position-mYekVBBH.js";
2
2
  import * as React$1 from "react";
3
+ import { ComponentProps, ReactNode } from "react";
3
4
  import * as _tanstack_react_table0 from "@tanstack/react-table";
4
5
  import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
5
6
  import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
6
7
  import { ClassValue } from "clsx";
7
- import * as react_jsx_runtime2 from "react/jsx-runtime";
8
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
8
9
  import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
9
10
  import { DropdownMenuItem as DropdownMenuItem$1 } from "@wordrhyme/ui";
10
11
  import { z } from "zod";
@@ -573,6 +574,8 @@ interface UseAutoCrudResourceParams<TSchema extends z.ZodObject<z.ZodRawShape>,
573
574
  router: CrudRouter;
574
575
  /** Zod schema */
575
576
  schema: TSchema;
577
+ /** Field filter configuration shared with AutoCrudTable. */
578
+ fields?: Fields;
576
579
  /**
577
580
  * 查询参数变换函数
578
581
  *
@@ -599,6 +602,7 @@ declare function useAutoCrudResource<TSchema extends z.ZodObject<z.ZodRawShape>,
599
602
  router,
600
603
  schema,
601
604
  query: queryTransform,
605
+ fields,
602
606
  options
603
607
  }: UseAutoCrudResourceParams<TSchema, TListItem>): UseAutoCrudResourceReturn<TSchema, TListItem>;
604
608
  //#endregion
@@ -648,6 +652,26 @@ interface CrudPermissions {
648
652
  deny?: string[];
649
653
  }
650
654
  //#endregion
655
+ //#region src/components/data-table/data-table.d.ts
656
+ interface DataTableProps<TData> extends ComponentProps<'div'> {
657
+ table: Table<TData>;
658
+ pagination?: TablePaginationOptions;
659
+ classNames?: DataTableClassNames;
660
+ actionBar?: ReactNode;
661
+ /** Content mounted below an expanded row. */
662
+ expandedRow?: (record: TData) => ReactNode;
663
+ }
664
+ declare function DataTable<TData>({
665
+ table,
666
+ actionBar,
667
+ pagination,
668
+ expandedRow,
669
+ children,
670
+ className,
671
+ classNames,
672
+ ...props
673
+ }: DataTableProps<TData>): react_jsx_runtime8.JSX.Element;
674
+ //#endregion
651
675
  //#region src/components/auto-crud/auto-table-action-bar.d.ts
652
676
  /** 批量更新字段配置 */
653
677
  interface BatchUpdateField {
@@ -735,7 +759,7 @@ declare function AutoTableActionBar<TData>({
735
759
  extraActions,
736
760
  actions,
737
761
  deleteConfirmation
738
- }: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
762
+ }: AutoTableActionBarProps<TData>): react_jsx_runtime8.JSX.Element;
739
763
  //#endregion
740
764
  //#region src/lib/schema-bridge/types.d.ts
741
765
  /**
@@ -844,9 +868,11 @@ declare function createActionsColumn<T>(items: ActionsColumnConfig<T>): ColumnDe
844
868
  //#region src/components/auto-crud/auto-table.d.ts
845
869
  /** 过滤模式类型 */
846
870
  type FilterMode = 'simple' | 'advanced' | 'command';
847
- interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
871
+ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> extends Pick<DataTableProps<z.infer<T>>, 'expandedRow'> {
848
872
  schema: T;
849
873
  data: z.infer<T>[];
874
+ /** Stable row identity; required when expandedRow is provided. */
875
+ getRowId?: TableOptions<z.infer<T>>['getRowId'];
850
876
  pageCount?: number;
851
877
  pagination?: TablePaginationOptions;
852
878
  /** Total rows matching the current search and filters. */
@@ -856,6 +882,7 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
856
882
  classNames?: DataTableClassNames;
857
883
  enableRowSelection?: boolean;
858
884
  exclude?: (keyof z.infer<T>)[];
885
+ filterOnly?: string[];
859
886
  actions?: ActionsColumnConfig<z.infer<T>>;
860
887
  /** 自定义固定列配置 */
861
888
  pinnedColumns?: {
@@ -901,6 +928,8 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
901
928
  declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
902
929
  schema,
903
930
  data,
931
+ getRowId,
932
+ expandedRow,
904
933
  pageCount,
905
934
  pagination,
906
935
  total,
@@ -908,6 +937,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
908
937
  classNames,
909
938
  enableRowSelection,
910
939
  exclude,
940
+ filterOnly,
911
941
  actions,
912
942
  pinnedColumns,
913
943
  filterMode,
@@ -924,7 +954,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
924
954
  onSelectedCountChange,
925
955
  onSelectedRowsChange,
926
956
  getSelectedRows
927
- }: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
957
+ }: AutoTableProps<T>): react_jsx_runtime8.JSX.Element;
928
958
  //#endregion
929
959
  //#region src/lib/row-action-dialog.d.ts
930
960
  interface RowActionDialogProps {
@@ -1272,6 +1302,8 @@ type RowCustomActionItem<T> = ActionMeta & {
1272
1302
  onClick?: (row: T) => void;
1273
1303
  component?: ActionComponent<AutoCrudRowActionContext<T>>;
1274
1304
  position?: ActionPosition;
1305
+ /** Place a registered custom action before the named builtin, when present. */
1306
+ before?: RowBuiltinActionType;
1275
1307
  separator?: boolean;
1276
1308
  variant?: 'default' | 'destructive';
1277
1309
  };
@@ -1394,7 +1426,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
1394
1426
  batchActions?: BatchActionConfig<z.output<TSchema>>;
1395
1427
  /** 默认排序 */
1396
1428
  defaultSort?: any[];
1397
- };
1429
+ } & Pick<AutoTableProps<TSchema>, 'getRowId' | 'expandedRow'>;
1398
1430
  /** 表单配置 */
1399
1431
  form?: {
1400
1432
  /** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
@@ -1476,7 +1508,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
1476
1508
  toolbarActions,
1477
1509
  locale: localeProp,
1478
1510
  onCreate
1479
- }: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
1511
+ }: AutoCrudTableProps<TSchema>): react_jsx_runtime8.JSX.Element;
1480
1512
  //#endregion
1481
1513
  //#region src/components/auto-crud/auto-form.d.ts
1482
1514
  interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
@@ -1515,7 +1547,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
1515
1547
  labelAlign,
1516
1548
  labelWidth,
1517
1549
  showSubmitButton
1518
- }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
1550
+ }: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime8.JSX.Element;
1519
1551
  declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
1520
1552
  ref?: React.Ref<AutoFormRef>;
1521
1553
  }) => ReturnType<typeof AutoFormInner>;
@@ -1534,7 +1566,7 @@ declare function AutoTableSimpleFilters<TData>({
1534
1566
  filters: externalFilters,
1535
1567
  onFiltersChange,
1536
1568
  leading
1537
- }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
1569
+ }: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime8.JSX.Element | null;
1538
1570
  //#endregion
1539
1571
  //#region src/components/auto-crud/form-modal.d.ts
1540
1572
  type ModalVariant = 'dialog' | 'sheet';
@@ -1578,7 +1610,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
1578
1610
  labelAlign,
1579
1611
  labelWidth,
1580
1612
  className
1581
- }: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
1613
+ }: CrudFormModalProps<T>): react_jsx_runtime8.JSX.Element;
1582
1614
  //#endregion
1583
1615
  //#region src/components/auto-crud/import-dialog.d.ts
1584
1616
  interface ImportDialogProps {
@@ -1600,7 +1632,7 @@ declare function ImportDialog({
1600
1632
  columns,
1601
1633
  title,
1602
1634
  locale
1603
- }: ImportDialogProps): react_jsx_runtime2.JSX.Element;
1635
+ }: ImportDialogProps): react_jsx_runtime8.JSX.Element;
1604
1636
  //#endregion
1605
1637
  //#region src/components/auto-crud/export-dialog.d.ts
1606
1638
  type ExportMode = 'selected' | 'filtered';
@@ -1620,24 +1652,7 @@ declare function ExportDialog({
1620
1652
  selectedCount,
1621
1653
  onExport,
1622
1654
  canExportFiltered
1623
- }: ExportDialogProps): react_jsx_runtime2.JSX.Element;
1624
- //#endregion
1625
- //#region src/components/data-table/data-table.d.ts
1626
- interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
1627
- table: Table<TData>;
1628
- pagination?: TablePaginationOptions;
1629
- classNames?: DataTableClassNames;
1630
- actionBar?: React$1.ReactNode;
1631
- }
1632
- declare function DataTable<TData>({
1633
- table,
1634
- actionBar,
1635
- pagination,
1636
- children,
1637
- className,
1638
- classNames,
1639
- ...props
1640
- }: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
1655
+ }: ExportDialogProps): react_jsx_runtime8.JSX.Element;
1641
1656
  //#endregion
1642
1657
  //#region src/components/data-table/data-table-advanced-toolbar.d.ts
1643
1658
  interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
@@ -1648,7 +1663,7 @@ declare function DataTableAdvancedToolbar<TData>({
1648
1663
  children,
1649
1664
  className,
1650
1665
  ...props
1651
- }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1666
+ }: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
1652
1667
  //#endregion
1653
1668
  //#region src/components/data-table/data-table-column-header.d.ts
1654
1669
  interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
@@ -1660,7 +1675,7 @@ declare function DataTableColumnHeader<TData, TValue>({
1660
1675
  label,
1661
1676
  className,
1662
1677
  ...props
1663
- }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1678
+ }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
1664
1679
  //#endregion
1665
1680
  //#region src/components/data-table/data-table-faceted-filter.d.ts
1666
1681
  interface DataTableFacetedFilterProps<TData, TValue> {
@@ -1674,7 +1689,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
1674
1689
  title,
1675
1690
  options,
1676
1691
  multiple
1677
- }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
1692
+ }: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime8.JSX.Element;
1678
1693
  //#endregion
1679
1694
  //#region src/components/data-table/data-table-pagination.d.ts
1680
1695
  interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'>, TablePaginationOptions {
@@ -1690,7 +1705,7 @@ declare function DataTablePagination<TData>({
1690
1705
  pageJumpLabel,
1691
1706
  className,
1692
1707
  ...props
1693
- }: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
1708
+ }: DataTablePaginationProps<TData>): react_jsx_runtime8.JSX.Element;
1694
1709
  //#endregion
1695
1710
  //#region src/components/data-table/data-table-toolbar.d.ts
1696
1711
  interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
@@ -1701,7 +1716,7 @@ declare function DataTableToolbar<TData>({
1701
1716
  children,
1702
1717
  className,
1703
1718
  ...props
1704
- }: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
1719
+ }: DataTableToolbarProps<TData>): react_jsx_runtime8.JSX.Element;
1705
1720
  //#endregion
1706
1721
  //#region src/components/data-table/data-table-view-options.d.ts
1707
1722
  interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
@@ -1712,7 +1727,7 @@ declare function DataTableViewOptions<TData>({
1712
1727
  table,
1713
1728
  disabled,
1714
1729
  ...props
1715
- }: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
1730
+ }: DataTableViewOptionsProps<TData>): react_jsx_runtime8.JSX.Element;
1716
1731
  //#endregion
1717
1732
  //#region src/lib/crud-actions.d.ts
1718
1733
  type CrudActionZone = 'toolbar' | 'row' | 'batch';
@@ -1722,6 +1737,8 @@ type CrudActionBase = {
1722
1737
  order?: number;
1723
1738
  hidden?: boolean;
1724
1739
  position?: ActionPosition;
1740
+ /** Insert a custom action before a builtin action type, if present. */
1741
+ before?: string;
1725
1742
  };
1726
1743
  type CrudActionEntry<TAction extends CrudActionBase = CrudActionBase> = {
1727
1744
  targetId: string;
@@ -2104,4 +2121,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
2104
2121
  */
2105
2122
  declare function downloadCSVTemplate(headers: string[], filename?: string): void;
2106
2123
  //#endregion
2107
- export { type ActionConfig, type ActionItem, type ActionPosition, 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 TablePaginationOptions, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, actionPositionSchema, cn, coerceRowValues, compareOrder, 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, matchesPosition, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, positionActions, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
2124
+ export { type ActionConfig, type ActionItem, type ActionPosition, 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, type AutoTableProps, 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, type DataTableProps, 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 TablePaginationOptions, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, actionPositionSchema, cn, coerceRowValues, compareOrder, 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, matchesPosition, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, positionActions, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };