@wordrhyme/auto-crud 1.3.8 → 1.4.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/README.md +29 -5
- package/dist/index.cjs +294 -52
- package/dist/index.d.cts +47 -19
- package/dist/index.d.ts +47 -19
- package/dist/index.js +294 -52
- package/package.json +5 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
4
4
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
@@ -28,6 +28,20 @@ interface ToastAdapter {
|
|
|
28
28
|
}
|
|
29
29
|
/** 空 toast 适配器(禁用通知) */
|
|
30
30
|
declare const noopToastAdapter: ToastAdapter;
|
|
31
|
+
interface AutoCrudQueryCapabilities {
|
|
32
|
+
search?: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
fields: string[];
|
|
35
|
+
};
|
|
36
|
+
filters?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
fields: string[] | null;
|
|
39
|
+
};
|
|
40
|
+
sort?: {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
fields: string[] | null;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
/**
|
|
32
46
|
* Modal 状态类型
|
|
33
47
|
*/
|
|
@@ -145,6 +159,8 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
145
159
|
schema?: z.ZodObject<z.ZodRawShape>;
|
|
146
160
|
/** Optional field config override from host metadata. */
|
|
147
161
|
fields?: Fields;
|
|
162
|
+
/** Query capabilities reported by auto-crud-server metadata. */
|
|
163
|
+
capabilities?: AutoCrudQueryCapabilities;
|
|
148
164
|
/** Default sorting used by this resource's list query. */
|
|
149
165
|
defaultSort?: AutoCrudSorting;
|
|
150
166
|
modal: ModalState<TListItem>;
|
|
@@ -395,7 +411,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
395
411
|
extraActions,
|
|
396
412
|
actions,
|
|
397
413
|
deleteConfirmation
|
|
398
|
-
}: AutoTableActionBarProps<TData>):
|
|
414
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
399
415
|
//#endregion
|
|
400
416
|
//#region src/lib/schema-bridge/types.d.ts
|
|
401
417
|
/**
|
|
@@ -571,7 +587,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
571
587
|
onSelectedCountChange,
|
|
572
588
|
onSelectedRowsChange,
|
|
573
589
|
getSelectedRows
|
|
574
|
-
}: AutoTableProps<T>):
|
|
590
|
+
}: AutoTableProps<T>): react_jsx_runtime12.JSX.Element;
|
|
575
591
|
//#endregion
|
|
576
592
|
//#region src/i18n/locale.d.ts
|
|
577
593
|
/**
|
|
@@ -684,12 +700,19 @@ type AutoCrudOption = {
|
|
|
684
700
|
count?: number;
|
|
685
701
|
disabled?: boolean;
|
|
686
702
|
};
|
|
703
|
+
type AutoCrudDataSourceContextType = 'form' | 'filter' | 'resolve';
|
|
704
|
+
type AutoCrudDataSourceResolveFields = readonly string[] | ((context: {
|
|
705
|
+
field: string;
|
|
706
|
+
}) => readonly string[]);
|
|
687
707
|
type AutoCrudDataSourceContext = {
|
|
688
708
|
field: string;
|
|
709
|
+
type: AutoCrudDataSourceContextType;
|
|
689
710
|
page?: number;
|
|
690
711
|
pageSize?: number;
|
|
712
|
+
query?: string;
|
|
713
|
+
/** @deprecated Use `query` instead. */
|
|
691
714
|
search?: string;
|
|
692
|
-
values?: Record<string, unknown
|
|
715
|
+
values?: Record<string, unknown> | Record<string, unknown>[];
|
|
693
716
|
signal?: AbortSignal;
|
|
694
717
|
};
|
|
695
718
|
type AutoCrudDataSourceResult = AutoCrudOption[] | {
|
|
@@ -705,6 +728,7 @@ type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
|
|
|
705
728
|
debounceMs?: number;
|
|
706
729
|
loadMore?: boolean;
|
|
707
730
|
pageSize?: number;
|
|
731
|
+
resolveFields?: AutoCrudDataSourceResolveFields;
|
|
708
732
|
load: AutoCrudDataSourceLoader;
|
|
709
733
|
};
|
|
710
734
|
type AutoCrudDataSourceEntry = {
|
|
@@ -714,6 +738,7 @@ type AutoCrudDataSourceEntry = {
|
|
|
714
738
|
debounceMs: number;
|
|
715
739
|
loadMore: boolean;
|
|
716
740
|
pageSize: number;
|
|
741
|
+
resolveFields?: AutoCrudDataSourceResolveFields;
|
|
717
742
|
load: AutoCrudDataSourceLoader;
|
|
718
743
|
};
|
|
719
744
|
type RegistryListener$1 = () => void;
|
|
@@ -915,8 +940,11 @@ interface AutoCrudToolbarContext {
|
|
|
915
940
|
selectedRowIds: string[];
|
|
916
941
|
selectedCount: number;
|
|
917
942
|
refresh?: () => Promise<unknown>;
|
|
918
|
-
|
|
943
|
+
openImport?: () => void;
|
|
944
|
+
exportData?: () => Promise<void>;
|
|
919
945
|
openCreate?: () => void;
|
|
946
|
+
isRefreshing: boolean;
|
|
947
|
+
isExporting: boolean;
|
|
920
948
|
}
|
|
921
949
|
type AutoCrudToolbarResolver = (targetId: string, ownerActions: readonly ToolbarActionItem[], context: AutoCrudToolbarContext) => ToolbarActionItem[];
|
|
922
950
|
declare function setToolbarResolver(resolver: AutoCrudToolbarResolver | null): void;
|
|
@@ -1051,7 +1079,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1051
1079
|
toolbarActions,
|
|
1052
1080
|
locale: localeProp,
|
|
1053
1081
|
onCreate
|
|
1054
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1082
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime12.JSX.Element;
|
|
1055
1083
|
//#endregion
|
|
1056
1084
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1057
1085
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1090,7 +1118,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1090
1118
|
labelAlign,
|
|
1091
1119
|
labelWidth,
|
|
1092
1120
|
showSubmitButton
|
|
1093
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1121
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime12.JSX.Element;
|
|
1094
1122
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1095
1123
|
ref?: React.Ref<AutoFormRef>;
|
|
1096
1124
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1406,7 +1434,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1406
1434
|
filters: externalFilters,
|
|
1407
1435
|
onFiltersChange,
|
|
1408
1436
|
leading
|
|
1409
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1437
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime12.JSX.Element | null;
|
|
1410
1438
|
//#endregion
|
|
1411
1439
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1412
1440
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1450,7 +1478,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1450
1478
|
labelAlign,
|
|
1451
1479
|
labelWidth,
|
|
1452
1480
|
className
|
|
1453
|
-
}: CrudFormModalProps<T>):
|
|
1481
|
+
}: CrudFormModalProps<T>): react_jsx_runtime12.JSX.Element;
|
|
1454
1482
|
//#endregion
|
|
1455
1483
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1456
1484
|
interface ImportDialogProps {
|
|
@@ -1472,7 +1500,7 @@ declare function ImportDialog({
|
|
|
1472
1500
|
columns,
|
|
1473
1501
|
title,
|
|
1474
1502
|
locale
|
|
1475
|
-
}: ImportDialogProps):
|
|
1503
|
+
}: ImportDialogProps): react_jsx_runtime12.JSX.Element;
|
|
1476
1504
|
//#endregion
|
|
1477
1505
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1478
1506
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1492,7 +1520,7 @@ declare function ExportDialog({
|
|
|
1492
1520
|
selectedCount,
|
|
1493
1521
|
onExport,
|
|
1494
1522
|
canExportFiltered
|
|
1495
|
-
}: ExportDialogProps):
|
|
1523
|
+
}: ExportDialogProps): react_jsx_runtime12.JSX.Element;
|
|
1496
1524
|
//#endregion
|
|
1497
1525
|
//#region src/components/data-table/data-table.d.ts
|
|
1498
1526
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1505,7 +1533,7 @@ declare function DataTable<TData>({
|
|
|
1505
1533
|
children,
|
|
1506
1534
|
className,
|
|
1507
1535
|
...props
|
|
1508
|
-
}: DataTableProps<TData>):
|
|
1536
|
+
}: DataTableProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
1509
1537
|
//#endregion
|
|
1510
1538
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1511
1539
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1516,7 +1544,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1516
1544
|
children,
|
|
1517
1545
|
className,
|
|
1518
1546
|
...props
|
|
1519
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1547
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
1520
1548
|
//#endregion
|
|
1521
1549
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1522
1550
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1528,7 +1556,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1528
1556
|
label,
|
|
1529
1557
|
className,
|
|
1530
1558
|
...props
|
|
1531
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1559
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime12.JSX.Element;
|
|
1532
1560
|
//#endregion
|
|
1533
1561
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1534
1562
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1542,7 +1570,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1542
1570
|
title,
|
|
1543
1571
|
options,
|
|
1544
1572
|
multiple
|
|
1545
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1573
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime12.JSX.Element;
|
|
1546
1574
|
//#endregion
|
|
1547
1575
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1548
1576
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1554,7 +1582,7 @@ declare function DataTablePagination<TData>({
|
|
|
1554
1582
|
pageSizeOptions,
|
|
1555
1583
|
className,
|
|
1556
1584
|
...props
|
|
1557
|
-
}: DataTablePaginationProps<TData>):
|
|
1585
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
1558
1586
|
//#endregion
|
|
1559
1587
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1560
1588
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1565,7 +1593,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1565
1593
|
children,
|
|
1566
1594
|
className,
|
|
1567
1595
|
...props
|
|
1568
|
-
}: DataTableToolbarProps<TData>):
|
|
1596
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
1569
1597
|
//#endregion
|
|
1570
1598
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1571
1599
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1576,7 +1604,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1576
1604
|
table,
|
|
1577
1605
|
disabled,
|
|
1578
1606
|
...props
|
|
1579
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1607
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime12.JSX.Element;
|
|
1580
1608
|
//#endregion
|
|
1581
1609
|
//#region src/lib/crud-actions.d.ts
|
|
1582
1610
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
@@ -1951,4 +1979,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
|
|
|
1951
1979
|
*/
|
|
1952
1980
|
declare function downloadCSVTemplate(headers: string[], filename?: string): void;
|
|
1953
1981
|
//#endregion
|
|
1954
|
-
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, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|
|
1982
|
+
export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type 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, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|
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 "@wordrhyme/shadcn";
|
|
5
5
|
import { ClassValue } from "clsx";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
7
7
|
import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
@@ -28,6 +28,20 @@ interface ToastAdapter {
|
|
|
28
28
|
}
|
|
29
29
|
/** 空 toast 适配器(禁用通知) */
|
|
30
30
|
declare const noopToastAdapter: ToastAdapter;
|
|
31
|
+
interface AutoCrudQueryCapabilities {
|
|
32
|
+
search?: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
fields: string[];
|
|
35
|
+
};
|
|
36
|
+
filters?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
fields: string[] | null;
|
|
39
|
+
};
|
|
40
|
+
sort?: {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
fields: string[] | null;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
/**
|
|
32
46
|
* Modal 状态类型
|
|
33
47
|
*/
|
|
@@ -145,6 +159,8 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
145
159
|
schema?: z.ZodObject<z.ZodRawShape>;
|
|
146
160
|
/** Optional field config override from host metadata. */
|
|
147
161
|
fields?: Fields;
|
|
162
|
+
/** Query capabilities reported by auto-crud-server metadata. */
|
|
163
|
+
capabilities?: AutoCrudQueryCapabilities;
|
|
148
164
|
/** Default sorting used by this resource's list query. */
|
|
149
165
|
defaultSort?: AutoCrudSorting;
|
|
150
166
|
modal: ModalState<TListItem>;
|
|
@@ -395,7 +411,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
395
411
|
extraActions,
|
|
396
412
|
actions,
|
|
397
413
|
deleteConfirmation
|
|
398
|
-
}: AutoTableActionBarProps<TData>):
|
|
414
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
399
415
|
//#endregion
|
|
400
416
|
//#region src/lib/schema-bridge/types.d.ts
|
|
401
417
|
/**
|
|
@@ -571,7 +587,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
571
587
|
onSelectedCountChange,
|
|
572
588
|
onSelectedRowsChange,
|
|
573
589
|
getSelectedRows
|
|
574
|
-
}: AutoTableProps<T>):
|
|
590
|
+
}: AutoTableProps<T>): react_jsx_runtime4.JSX.Element;
|
|
575
591
|
//#endregion
|
|
576
592
|
//#region src/i18n/locale.d.ts
|
|
577
593
|
/**
|
|
@@ -684,12 +700,19 @@ type AutoCrudOption = {
|
|
|
684
700
|
count?: number;
|
|
685
701
|
disabled?: boolean;
|
|
686
702
|
};
|
|
703
|
+
type AutoCrudDataSourceContextType = 'form' | 'filter' | 'resolve';
|
|
704
|
+
type AutoCrudDataSourceResolveFields = readonly string[] | ((context: {
|
|
705
|
+
field: string;
|
|
706
|
+
}) => readonly string[]);
|
|
687
707
|
type AutoCrudDataSourceContext = {
|
|
688
708
|
field: string;
|
|
709
|
+
type: AutoCrudDataSourceContextType;
|
|
689
710
|
page?: number;
|
|
690
711
|
pageSize?: number;
|
|
712
|
+
query?: string;
|
|
713
|
+
/** @deprecated Use `query` instead. */
|
|
691
714
|
search?: string;
|
|
692
|
-
values?: Record<string, unknown
|
|
715
|
+
values?: Record<string, unknown> | Record<string, unknown>[];
|
|
693
716
|
signal?: AbortSignal;
|
|
694
717
|
};
|
|
695
718
|
type AutoCrudDataSourceResult = AutoCrudOption[] | {
|
|
@@ -705,6 +728,7 @@ type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
|
|
|
705
728
|
debounceMs?: number;
|
|
706
729
|
loadMore?: boolean;
|
|
707
730
|
pageSize?: number;
|
|
731
|
+
resolveFields?: AutoCrudDataSourceResolveFields;
|
|
708
732
|
load: AutoCrudDataSourceLoader;
|
|
709
733
|
};
|
|
710
734
|
type AutoCrudDataSourceEntry = {
|
|
@@ -714,6 +738,7 @@ type AutoCrudDataSourceEntry = {
|
|
|
714
738
|
debounceMs: number;
|
|
715
739
|
loadMore: boolean;
|
|
716
740
|
pageSize: number;
|
|
741
|
+
resolveFields?: AutoCrudDataSourceResolveFields;
|
|
717
742
|
load: AutoCrudDataSourceLoader;
|
|
718
743
|
};
|
|
719
744
|
type RegistryListener$1 = () => void;
|
|
@@ -915,8 +940,11 @@ interface AutoCrudToolbarContext {
|
|
|
915
940
|
selectedRowIds: string[];
|
|
916
941
|
selectedCount: number;
|
|
917
942
|
refresh?: () => Promise<unknown>;
|
|
918
|
-
|
|
943
|
+
openImport?: () => void;
|
|
944
|
+
exportData?: () => Promise<void>;
|
|
919
945
|
openCreate?: () => void;
|
|
946
|
+
isRefreshing: boolean;
|
|
947
|
+
isExporting: boolean;
|
|
920
948
|
}
|
|
921
949
|
type AutoCrudToolbarResolver = (targetId: string, ownerActions: readonly ToolbarActionItem[], context: AutoCrudToolbarContext) => ToolbarActionItem[];
|
|
922
950
|
declare function setToolbarResolver(resolver: AutoCrudToolbarResolver | null): void;
|
|
@@ -1051,7 +1079,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1051
1079
|
toolbarActions,
|
|
1052
1080
|
locale: localeProp,
|
|
1053
1081
|
onCreate
|
|
1054
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1082
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime4.JSX.Element;
|
|
1055
1083
|
//#endregion
|
|
1056
1084
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1057
1085
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1090,7 +1118,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1090
1118
|
labelAlign,
|
|
1091
1119
|
labelWidth,
|
|
1092
1120
|
showSubmitButton
|
|
1093
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1121
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime4.JSX.Element;
|
|
1094
1122
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1095
1123
|
ref?: React.Ref<AutoFormRef>;
|
|
1096
1124
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1406,7 +1434,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1406
1434
|
filters: externalFilters,
|
|
1407
1435
|
onFiltersChange,
|
|
1408
1436
|
leading
|
|
1409
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1437
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime4.JSX.Element | null;
|
|
1410
1438
|
//#endregion
|
|
1411
1439
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1412
1440
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1450,7 +1478,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1450
1478
|
labelAlign,
|
|
1451
1479
|
labelWidth,
|
|
1452
1480
|
className
|
|
1453
|
-
}: CrudFormModalProps<T>):
|
|
1481
|
+
}: CrudFormModalProps<T>): react_jsx_runtime4.JSX.Element;
|
|
1454
1482
|
//#endregion
|
|
1455
1483
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1456
1484
|
interface ImportDialogProps {
|
|
@@ -1472,7 +1500,7 @@ declare function ImportDialog({
|
|
|
1472
1500
|
columns,
|
|
1473
1501
|
title,
|
|
1474
1502
|
locale
|
|
1475
|
-
}: ImportDialogProps):
|
|
1503
|
+
}: ImportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1476
1504
|
//#endregion
|
|
1477
1505
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1478
1506
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1492,7 +1520,7 @@ declare function ExportDialog({
|
|
|
1492
1520
|
selectedCount,
|
|
1493
1521
|
onExport,
|
|
1494
1522
|
canExportFiltered
|
|
1495
|
-
}: ExportDialogProps):
|
|
1523
|
+
}: ExportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1496
1524
|
//#endregion
|
|
1497
1525
|
//#region src/components/data-table/data-table.d.ts
|
|
1498
1526
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1505,7 +1533,7 @@ declare function DataTable<TData>({
|
|
|
1505
1533
|
children,
|
|
1506
1534
|
className,
|
|
1507
1535
|
...props
|
|
1508
|
-
}: DataTableProps<TData>):
|
|
1536
|
+
}: DataTableProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1509
1537
|
//#endregion
|
|
1510
1538
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1511
1539
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1516,7 +1544,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1516
1544
|
children,
|
|
1517
1545
|
className,
|
|
1518
1546
|
...props
|
|
1519
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1547
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1520
1548
|
//#endregion
|
|
1521
1549
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1522
1550
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1528,7 +1556,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1528
1556
|
label,
|
|
1529
1557
|
className,
|
|
1530
1558
|
...props
|
|
1531
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1559
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1532
1560
|
//#endregion
|
|
1533
1561
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1534
1562
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1542,7 +1570,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1542
1570
|
title,
|
|
1543
1571
|
options,
|
|
1544
1572
|
multiple
|
|
1545
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1573
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1546
1574
|
//#endregion
|
|
1547
1575
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1548
1576
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1554,7 +1582,7 @@ declare function DataTablePagination<TData>({
|
|
|
1554
1582
|
pageSizeOptions,
|
|
1555
1583
|
className,
|
|
1556
1584
|
...props
|
|
1557
|
-
}: DataTablePaginationProps<TData>):
|
|
1585
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1558
1586
|
//#endregion
|
|
1559
1587
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1560
1588
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1565,7 +1593,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1565
1593
|
children,
|
|
1566
1594
|
className,
|
|
1567
1595
|
...props
|
|
1568
|
-
}: DataTableToolbarProps<TData>):
|
|
1596
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1569
1597
|
//#endregion
|
|
1570
1598
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1571
1599
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1576,7 +1604,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1576
1604
|
table,
|
|
1577
1605
|
disabled,
|
|
1578
1606
|
...props
|
|
1579
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1607
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1580
1608
|
//#endregion
|
|
1581
1609
|
//#region src/lib/crud-actions.d.ts
|
|
1582
1610
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
@@ -1951,4 +1979,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
|
|
|
1951
1979
|
*/
|
|
1952
1980
|
declare function downloadCSVTemplate(headers: string[], filename?: string): void;
|
|
1953
1981
|
//#endregion
|
|
1954
|
-
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, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|
|
1982
|
+
export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type 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, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarBuiltinActionType, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setSearchParams, setToolbarResolver, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|