@wordrhyme/auto-crud 1.8.1 → 1.9.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 +57 -2
- package/dist/index.cjs +140 -88
- package/dist/index.d.cts +34 -24
- package/dist/index.d.ts +18 -8
- package/dist/index.js +121 -50
- package/dist/position--p6kJnYA.js +56 -0
- package/dist/position-BlO0bPw6.cjs +109 -0
- package/dist/position-DoBV7yB6.d.cts +29 -0
- package/dist/position-mYekVBBH.d.ts +29 -0
- package/dist/position.cjs +6 -0
- package/dist/position.d.cts +2 -0
- package/dist/position.d.ts +2 -0
- package/dist/position.js +3 -0
- package/package.json +12 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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_runtime4 from "react/jsx-runtime";
|
|
2
3
|
import * as React$1 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";
|
|
@@ -219,9 +220,9 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
219
220
|
variant: z.ZodEnum<{
|
|
220
221
|
number: "number";
|
|
221
222
|
boolean: "boolean";
|
|
223
|
+
date: "date";
|
|
222
224
|
text: "text";
|
|
223
225
|
range: "range";
|
|
224
|
-
date: "date";
|
|
225
226
|
dateRange: "dateRange";
|
|
226
227
|
select: "select";
|
|
227
228
|
multiSelect: "multiSelect";
|
|
@@ -572,6 +573,8 @@ interface UseAutoCrudResourceParams<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
572
573
|
router: CrudRouter;
|
|
573
574
|
/** Zod schema */
|
|
574
575
|
schema: TSchema;
|
|
576
|
+
/** Field filter configuration shared with AutoCrudTable. */
|
|
577
|
+
fields?: Fields;
|
|
575
578
|
/**
|
|
576
579
|
* 查询参数变换函数
|
|
577
580
|
*
|
|
@@ -598,6 +601,7 @@ declare function useAutoCrudResource<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
598
601
|
router,
|
|
599
602
|
schema,
|
|
600
603
|
query: queryTransform,
|
|
604
|
+
fields,
|
|
601
605
|
options
|
|
602
606
|
}: UseAutoCrudResourceParams<TSchema, TListItem>): UseAutoCrudResourceReturn<TSchema, TListItem>;
|
|
603
607
|
//#endregion
|
|
@@ -691,8 +695,8 @@ type BatchCustomActionItem<TData> = BatchActionMeta & {
|
|
|
691
695
|
onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
692
696
|
/** 渲染自定义内容 */
|
|
693
697
|
component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
|
|
694
|
-
/**
|
|
695
|
-
position?:
|
|
698
|
+
/** start/end 仅在无内置项时生效(默认 end);也可指定锚点的 before/after。 */
|
|
699
|
+
position?: ActionPosition;
|
|
696
700
|
variant?: 'default' | 'destructive';
|
|
697
701
|
};
|
|
698
702
|
type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
|
|
@@ -734,7 +738,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
734
738
|
extraActions,
|
|
735
739
|
actions,
|
|
736
740
|
deleteConfirmation
|
|
737
|
-
}: AutoTableActionBarProps<TData>):
|
|
741
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
738
742
|
//#endregion
|
|
739
743
|
//#region src/lib/schema-bridge/types.d.ts
|
|
740
744
|
/**
|
|
@@ -855,6 +859,7 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
855
859
|
classNames?: DataTableClassNames;
|
|
856
860
|
enableRowSelection?: boolean;
|
|
857
861
|
exclude?: (keyof z.infer<T>)[];
|
|
862
|
+
filterOnly?: string[];
|
|
858
863
|
actions?: ActionsColumnConfig<z.infer<T>>;
|
|
859
864
|
/** 自定义固定列配置 */
|
|
860
865
|
pinnedColumns?: {
|
|
@@ -907,6 +912,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
907
912
|
classNames,
|
|
908
913
|
enableRowSelection,
|
|
909
914
|
exclude,
|
|
915
|
+
filterOnly,
|
|
910
916
|
actions,
|
|
911
917
|
pinnedColumns,
|
|
912
918
|
filterMode,
|
|
@@ -923,7 +929,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
923
929
|
onSelectedCountChange,
|
|
924
930
|
onSelectedRowsChange,
|
|
925
931
|
getSelectedRows
|
|
926
|
-
}: AutoTableProps<T>):
|
|
932
|
+
}: AutoTableProps<T>): react_jsx_runtime4.JSX.Element;
|
|
927
933
|
//#endregion
|
|
928
934
|
//#region src/lib/row-action-dialog.d.ts
|
|
929
935
|
interface RowActionDialogProps {
|
|
@@ -1270,7 +1276,9 @@ type RowCustomActionItem<T> = ActionMeta & {
|
|
|
1270
1276
|
label?: string;
|
|
1271
1277
|
onClick?: (row: T) => void;
|
|
1272
1278
|
component?: ActionComponent<AutoCrudRowActionContext<T>>;
|
|
1273
|
-
position?:
|
|
1279
|
+
position?: ActionPosition;
|
|
1280
|
+
/** Place a registered custom action before the named builtin, when present. */
|
|
1281
|
+
before?: RowBuiltinActionType;
|
|
1274
1282
|
separator?: boolean;
|
|
1275
1283
|
variant?: 'default' | 'destructive';
|
|
1276
1284
|
};
|
|
@@ -1312,8 +1320,8 @@ type ToolbarCustomActionItem = ActionMeta & {
|
|
|
1312
1320
|
type: 'custom';
|
|
1313
1321
|
/** 渲染自定义内容 */
|
|
1314
1322
|
component: ActionComponent<AutoCrudToolbarContext>;
|
|
1315
|
-
/**
|
|
1316
|
-
position?:
|
|
1323
|
+
/** start/end 仅在无内置项时生效(默认 end);也可指定锚点的 before/after。 */
|
|
1324
|
+
position?: ActionPosition;
|
|
1317
1325
|
};
|
|
1318
1326
|
type ToolbarActionItem = ToolbarBuiltinActionItem | ToolbarCustomActionItem;
|
|
1319
1327
|
type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActionItem[]) => ToolbarActionItem[]);
|
|
@@ -1475,7 +1483,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1475
1483
|
toolbarActions,
|
|
1476
1484
|
locale: localeProp,
|
|
1477
1485
|
onCreate
|
|
1478
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1486
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime4.JSX.Element;
|
|
1479
1487
|
//#endregion
|
|
1480
1488
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1481
1489
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1514,7 +1522,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1514
1522
|
labelAlign,
|
|
1515
1523
|
labelWidth,
|
|
1516
1524
|
showSubmitButton
|
|
1517
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1525
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime4.JSX.Element;
|
|
1518
1526
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1519
1527
|
ref?: React.Ref<AutoFormRef>;
|
|
1520
1528
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1533,7 +1541,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1533
1541
|
filters: externalFilters,
|
|
1534
1542
|
onFiltersChange,
|
|
1535
1543
|
leading
|
|
1536
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1544
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime4.JSX.Element | null;
|
|
1537
1545
|
//#endregion
|
|
1538
1546
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1539
1547
|
type ModalVariant = 'dialog' | 'sheet';
|
|
@@ -1577,7 +1585,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1577
1585
|
labelAlign,
|
|
1578
1586
|
labelWidth,
|
|
1579
1587
|
className
|
|
1580
|
-
}: CrudFormModalProps<T>):
|
|
1588
|
+
}: CrudFormModalProps<T>): react_jsx_runtime4.JSX.Element;
|
|
1581
1589
|
//#endregion
|
|
1582
1590
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1583
1591
|
interface ImportDialogProps {
|
|
@@ -1599,7 +1607,7 @@ declare function ImportDialog({
|
|
|
1599
1607
|
columns,
|
|
1600
1608
|
title,
|
|
1601
1609
|
locale
|
|
1602
|
-
}: ImportDialogProps):
|
|
1610
|
+
}: ImportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1603
1611
|
//#endregion
|
|
1604
1612
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1605
1613
|
type ExportMode = 'selected' | 'filtered';
|
|
@@ -1619,7 +1627,7 @@ declare function ExportDialog({
|
|
|
1619
1627
|
selectedCount,
|
|
1620
1628
|
onExport,
|
|
1621
1629
|
canExportFiltered
|
|
1622
|
-
}: ExportDialogProps):
|
|
1630
|
+
}: ExportDialogProps): react_jsx_runtime4.JSX.Element;
|
|
1623
1631
|
//#endregion
|
|
1624
1632
|
//#region src/components/data-table/data-table.d.ts
|
|
1625
1633
|
interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1636,7 +1644,7 @@ declare function DataTable<TData>({
|
|
|
1636
1644
|
className,
|
|
1637
1645
|
classNames,
|
|
1638
1646
|
...props
|
|
1639
|
-
}: DataTableProps<TData>):
|
|
1647
|
+
}: DataTableProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1640
1648
|
//#endregion
|
|
1641
1649
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1642
1650
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1647,7 +1655,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1647
1655
|
children,
|
|
1648
1656
|
className,
|
|
1649
1657
|
...props
|
|
1650
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1658
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1651
1659
|
//#endregion
|
|
1652
1660
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1653
1661
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1659,7 +1667,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1659
1667
|
label,
|
|
1660
1668
|
className,
|
|
1661
1669
|
...props
|
|
1662
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1670
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1663
1671
|
//#endregion
|
|
1664
1672
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1665
1673
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1673,7 +1681,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1673
1681
|
title,
|
|
1674
1682
|
options,
|
|
1675
1683
|
multiple
|
|
1676
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1684
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime4.JSX.Element;
|
|
1677
1685
|
//#endregion
|
|
1678
1686
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1679
1687
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'>, TablePaginationOptions {
|
|
@@ -1689,7 +1697,7 @@ declare function DataTablePagination<TData>({
|
|
|
1689
1697
|
pageJumpLabel,
|
|
1690
1698
|
className,
|
|
1691
1699
|
...props
|
|
1692
|
-
}: DataTablePaginationProps<TData>):
|
|
1700
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1693
1701
|
//#endregion
|
|
1694
1702
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1695
1703
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1700,7 +1708,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1700
1708
|
children,
|
|
1701
1709
|
className,
|
|
1702
1710
|
...props
|
|
1703
|
-
}: DataTableToolbarProps<TData>):
|
|
1711
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1704
1712
|
//#endregion
|
|
1705
1713
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1706
1714
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1711,7 +1719,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1711
1719
|
table,
|
|
1712
1720
|
disabled,
|
|
1713
1721
|
...props
|
|
1714
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1722
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime4.JSX.Element;
|
|
1715
1723
|
//#endregion
|
|
1716
1724
|
//#region src/lib/crud-actions.d.ts
|
|
1717
1725
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
@@ -1720,7 +1728,9 @@ type CrudActionBase = {
|
|
|
1720
1728
|
id?: string;
|
|
1721
1729
|
order?: number;
|
|
1722
1730
|
hidden?: boolean;
|
|
1723
|
-
position?:
|
|
1731
|
+
position?: ActionPosition;
|
|
1732
|
+
/** Insert a custom action before a builtin action type, if present. */
|
|
1733
|
+
before?: string;
|
|
1724
1734
|
};
|
|
1725
1735
|
type CrudActionEntry<TAction extends CrudActionBase = CrudActionBase> = {
|
|
1726
1736
|
targetId: string;
|
|
@@ -2103,4 +2113,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
|
|
|
2103
2113
|
*/
|
|
2104
2114
|
declare function downloadCSVTemplate(headers: string[], filename?: string): void;
|
|
2105
2115
|
//#endregion
|
|
2106
|
-
export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, type AutoCrudRowOpenOptions, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableClassNames, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type DateFormatPreset, type DateFormatter, type DateLocaleOptions, type EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, type FieldTableDisplay, type FieldType, type Fields, type FilterConfig, FilterOperator, type FilterVariant, type FormSchemaOverrides, ImportDialog, type ImportDialogProps, type ImportResult, type JSONSchema, type JSONSchemaProperty, JoinOperator, type ListParams, type ListResult, type LocaleProp, MultiCombobox, type MultiComboboxOption, type MultiComboboxProps, type MultiComboboxTriggerRenderProps, Option, type ParsedImportData, type ParsedZodField, type Parser, QueryKeys, type RowActionConfig, type RowActionDialogProps, type RowActionItem, type RowBuiltinActionItem, type RowBuiltinActionType, type RowCustomActionItem, SchemaAdapter, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type 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, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|
|
2116
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as positionActions, i as matchesPosition, n as actionPositionSchema, r as compareOrder, t as ActionPosition } from "./position-mYekVBBH.js";
|
|
1
2
|
import * as React$1 from "react";
|
|
2
3
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
3
4
|
import { Column, ColumnDef, ColumnMeta, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
@@ -219,9 +220,9 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
219
220
|
variant: z.ZodEnum<{
|
|
220
221
|
number: "number";
|
|
221
222
|
boolean: "boolean";
|
|
223
|
+
date: "date";
|
|
222
224
|
text: "text";
|
|
223
225
|
range: "range";
|
|
224
|
-
date: "date";
|
|
225
226
|
dateRange: "dateRange";
|
|
226
227
|
select: "select";
|
|
227
228
|
multiSelect: "multiSelect";
|
|
@@ -572,6 +573,8 @@ interface UseAutoCrudResourceParams<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
572
573
|
router: CrudRouter;
|
|
573
574
|
/** Zod schema */
|
|
574
575
|
schema: TSchema;
|
|
576
|
+
/** Field filter configuration shared with AutoCrudTable. */
|
|
577
|
+
fields?: Fields;
|
|
575
578
|
/**
|
|
576
579
|
* 查询参数变换函数
|
|
577
580
|
*
|
|
@@ -598,6 +601,7 @@ declare function useAutoCrudResource<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
598
601
|
router,
|
|
599
602
|
schema,
|
|
600
603
|
query: queryTransform,
|
|
604
|
+
fields,
|
|
601
605
|
options
|
|
602
606
|
}: UseAutoCrudResourceParams<TSchema, TListItem>): UseAutoCrudResourceReturn<TSchema, TListItem>;
|
|
603
607
|
//#endregion
|
|
@@ -691,8 +695,8 @@ type BatchCustomActionItem<TData> = BatchActionMeta & {
|
|
|
691
695
|
onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
692
696
|
/** 渲染自定义内容 */
|
|
693
697
|
component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
|
|
694
|
-
/**
|
|
695
|
-
position?:
|
|
698
|
+
/** start/end 仅在无内置项时生效(默认 end);也可指定锚点的 before/after。 */
|
|
699
|
+
position?: ActionPosition;
|
|
696
700
|
variant?: 'default' | 'destructive';
|
|
697
701
|
};
|
|
698
702
|
type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
|
|
@@ -855,6 +859,7 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
855
859
|
classNames?: DataTableClassNames;
|
|
856
860
|
enableRowSelection?: boolean;
|
|
857
861
|
exclude?: (keyof z.infer<T>)[];
|
|
862
|
+
filterOnly?: string[];
|
|
858
863
|
actions?: ActionsColumnConfig<z.infer<T>>;
|
|
859
864
|
/** 自定义固定列配置 */
|
|
860
865
|
pinnedColumns?: {
|
|
@@ -907,6 +912,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
907
912
|
classNames,
|
|
908
913
|
enableRowSelection,
|
|
909
914
|
exclude,
|
|
915
|
+
filterOnly,
|
|
910
916
|
actions,
|
|
911
917
|
pinnedColumns,
|
|
912
918
|
filterMode,
|
|
@@ -1270,7 +1276,9 @@ type RowCustomActionItem<T> = ActionMeta & {
|
|
|
1270
1276
|
label?: string;
|
|
1271
1277
|
onClick?: (row: T) => void;
|
|
1272
1278
|
component?: ActionComponent<AutoCrudRowActionContext<T>>;
|
|
1273
|
-
position?:
|
|
1279
|
+
position?: ActionPosition;
|
|
1280
|
+
/** Place a registered custom action before the named builtin, when present. */
|
|
1281
|
+
before?: RowBuiltinActionType;
|
|
1274
1282
|
separator?: boolean;
|
|
1275
1283
|
variant?: 'default' | 'destructive';
|
|
1276
1284
|
};
|
|
@@ -1312,8 +1320,8 @@ type ToolbarCustomActionItem = ActionMeta & {
|
|
|
1312
1320
|
type: 'custom';
|
|
1313
1321
|
/** 渲染自定义内容 */
|
|
1314
1322
|
component: ActionComponent<AutoCrudToolbarContext>;
|
|
1315
|
-
/**
|
|
1316
|
-
position?:
|
|
1323
|
+
/** start/end 仅在无内置项时生效(默认 end);也可指定锚点的 before/after。 */
|
|
1324
|
+
position?: ActionPosition;
|
|
1317
1325
|
};
|
|
1318
1326
|
type ToolbarActionItem = ToolbarBuiltinActionItem | ToolbarCustomActionItem;
|
|
1319
1327
|
type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActionItem[]) => ToolbarActionItem[]);
|
|
@@ -1720,7 +1728,9 @@ type CrudActionBase = {
|
|
|
1720
1728
|
id?: string;
|
|
1721
1729
|
order?: number;
|
|
1722
1730
|
hidden?: boolean;
|
|
1723
|
-
position?:
|
|
1731
|
+
position?: ActionPosition;
|
|
1732
|
+
/** Insert a custom action before a builtin action type, if present. */
|
|
1733
|
+
before?: string;
|
|
1724
1734
|
};
|
|
1725
1735
|
type CrudActionEntry<TAction extends CrudActionBase = CrudActionBase> = {
|
|
1726
1736
|
targetId: string;
|
|
@@ -2103,4 +2113,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
|
|
|
2103
2113
|
*/
|
|
2104
2114
|
declare function downloadCSVTemplate(headers: string[], filename?: string): void;
|
|
2105
2115
|
//#endregion
|
|
2106
|
-
export { type ActionConfig, type ActionItem, type ActionsColumnConfig, type AutoCrudActionConfig, type AutoCrudActionsConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, type AutoCrudQueryCapabilities, type AutoCrudRowActionContext, type AutoCrudRowOpenOptions, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, type AutoFormProps, type AutoQueryParams, AutoTable, AutoTableActionBar, AutoTableSimpleFilters, type BatchActionConfig, type BatchActionContext, type BatchActionItem, type BatchBuiltinActionItem, type BatchBuiltinActionType, type BatchCustomActionItem, type BatchUpdateField, type ColumnOverrides, type CreateFormSchemaOptions, type CreateTableSchemaOptions, type CrudActionBase, type CrudActionEntry, type CrudActionRegistration, type CrudActionZone, CrudFormModal, type CrudHooks, type CrudOperationPermissions, type CrudPermissions, type DataSource, DataTable, DataTableAdvancedToolbar, DataTableClassNames, DataTableColumnHeader, DataTableFacetedFilter, DataTablePagination, DataTableRowAction, DataTableToolbar, DataTableViewOptions, type DateFormatPreset, type DateFormatter, type DateLocaleOptions, type EnumOption, ExportDialog, type ExportDialogProps, type ExportMode, ExtendedColumnFilter, ExtendedColumnSort, type Field, type FieldOption, type FieldTableDisplay, type FieldType, type Fields, type FilterConfig, FilterOperator, type FilterVariant, type FormSchemaOverrides, ImportDialog, type ImportDialogProps, type ImportResult, type JSONSchema, type JSONSchemaProperty, JoinOperator, type ListParams, type ListResult, type LocaleProp, MultiCombobox, type MultiComboboxOption, type MultiComboboxProps, type MultiComboboxTriggerRenderProps, Option, type ParsedImportData, type ParsedZodField, type Parser, QueryKeys, type RowActionConfig, type RowActionDialogProps, type RowActionItem, type RowBuiltinActionItem, type RowBuiltinActionType, type RowCustomActionItem, SchemaAdapter, Select, type SelectMode, type SelectOption, type SelectProps, type SelectSearchableDynamicProps, type SelectSearchableMultipleProps, type SelectSearchableProps, type SelectSearchableSingleProps, type SelectSimpleProps, type SelectTriggerRenderProps, type SimpleFieldConfig, type SimpleFieldsConfig, type 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, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, crudActions, dataSources, dataToCSV, deDE, downloadCSVTemplate, enUS, esES, exportAllToCSV, exportTableToCSV, formComponents, formatDate, frFR, generateCSVTemplate, getUrlParams, humanize, jaJP, koKR, noopToastAdapter, normalizeDataSourceConfig, normalizeOptions, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum, parseCSV, parseImportFile, parseJSON, parseZodField, resolveLocale, setDateFormatter, setSearchParams, setToolbarResolver, tablePagination, useAutoCrudResource, useDataTable, useQueryState, useQueryStates, useReadableFilters, useUrlState, useUrlStates, zhCN };
|
|
2116
|
+
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 };
|