@wordrhyme/auto-crud 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -4
- package/dist/index.d.cts +33 -33
- package/dist/index.d.ts +33 -33
- package/dist/index.js +2 -4
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -108,8 +108,7 @@ function DataTablePagination({ table, pageSizeOptions = [
|
|
|
108
108
|
children: [
|
|
109
109
|
"Page ",
|
|
110
110
|
table.getState().pagination.pageIndex + 1,
|
|
111
|
-
" of",
|
|
112
|
-
" ",
|
|
111
|
+
" of ",
|
|
113
112
|
table.getPageCount()
|
|
114
113
|
]
|
|
115
114
|
}),
|
|
@@ -7548,8 +7547,7 @@ function DataTableSliderFilter({ column, title }) {
|
|
|
7548
7547
|
className: "mx-0.5 data-[orientation=vertical]:h-4"
|
|
7549
7548
|
}),
|
|
7550
7549
|
formatValue(columnFilterValue[0]),
|
|
7551
|
-
" -",
|
|
7552
|
-
" ",
|
|
7550
|
+
" - ",
|
|
7553
7551
|
formatValue(columnFilterValue[1]),
|
|
7554
7552
|
unit ? ` ${unit}` : ""
|
|
7555
7553
|
] }) : null
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime2 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";
|
|
@@ -411,7 +411,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
411
411
|
extraActions,
|
|
412
412
|
actions,
|
|
413
413
|
deleteConfirmation
|
|
414
|
-
}: AutoTableActionBarProps<TData>):
|
|
414
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
415
415
|
//#endregion
|
|
416
416
|
//#region src/lib/schema-bridge/types.d.ts
|
|
417
417
|
/**
|
|
@@ -587,7 +587,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
587
587
|
onSelectedCountChange,
|
|
588
588
|
onSelectedRowsChange,
|
|
589
589
|
getSelectedRows
|
|
590
|
-
}: AutoTableProps<T>):
|
|
590
|
+
}: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
|
|
591
591
|
//#endregion
|
|
592
592
|
//#region src/i18n/locale.d.ts
|
|
593
593
|
/**
|
|
@@ -1079,7 +1079,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1079
1079
|
toolbarActions,
|
|
1080
1080
|
locale: localeProp,
|
|
1081
1081
|
onCreate
|
|
1082
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1082
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
|
|
1083
1083
|
//#endregion
|
|
1084
1084
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1085
1085
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1118,7 +1118,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1118
1118
|
labelAlign,
|
|
1119
1119
|
labelWidth,
|
|
1120
1120
|
showSubmitButton
|
|
1121
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1121
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
|
|
1122
1122
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1123
1123
|
ref?: React.Ref<AutoFormRef>;
|
|
1124
1124
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1134,7 +1134,7 @@ declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormPr
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
interface UrlStateOptions {
|
|
1136
1136
|
/** 历史记录模式: push 添加新记录, replace 替换当前记录 */
|
|
1137
|
-
history?:
|
|
1137
|
+
history?: 'push' | 'replace';
|
|
1138
1138
|
/** 是否浅层更新(不触发页面刷新) */
|
|
1139
1139
|
shallow?: boolean;
|
|
1140
1140
|
/** 节流时间(毫秒) */
|
|
@@ -1173,7 +1173,7 @@ declare function parseAsArrayOf<T>(itemParser: Parser<T>, separator?: string): P
|
|
|
1173
1173
|
};
|
|
1174
1174
|
};
|
|
1175
1175
|
declare function getUrlParams(): URLSearchParams;
|
|
1176
|
-
declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions,
|
|
1176
|
+
declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions, 'history' | 'scroll'>): void;
|
|
1177
1177
|
/**
|
|
1178
1178
|
* 单个 URL 状态参数
|
|
1179
1179
|
*/
|
|
@@ -1434,10 +1434,10 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1434
1434
|
filters: externalFilters,
|
|
1435
1435
|
onFiltersChange,
|
|
1436
1436
|
leading
|
|
1437
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1437
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
|
|
1438
1438
|
//#endregion
|
|
1439
1439
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1440
|
-
type ModalVariant =
|
|
1440
|
+
type ModalVariant = 'dialog' | 'sheet';
|
|
1441
1441
|
//#endregion
|
|
1442
1442
|
//#region src/components/auto-crud/crud-form-modal.d.ts
|
|
1443
1443
|
interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1478,7 +1478,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1478
1478
|
labelAlign,
|
|
1479
1479
|
labelWidth,
|
|
1480
1480
|
className
|
|
1481
|
-
}: CrudFormModalProps<T>):
|
|
1481
|
+
}: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
|
|
1482
1482
|
//#endregion
|
|
1483
1483
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1484
1484
|
interface ImportDialogProps {
|
|
@@ -1500,10 +1500,10 @@ declare function ImportDialog({
|
|
|
1500
1500
|
columns,
|
|
1501
1501
|
title,
|
|
1502
1502
|
locale
|
|
1503
|
-
}: ImportDialogProps):
|
|
1503
|
+
}: ImportDialogProps): react_jsx_runtime2.JSX.Element;
|
|
1504
1504
|
//#endregion
|
|
1505
1505
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1506
|
-
type ExportMode =
|
|
1506
|
+
type ExportMode = 'selected' | 'filtered';
|
|
1507
1507
|
interface ExportDialogProps {
|
|
1508
1508
|
open: boolean;
|
|
1509
1509
|
onOpenChange: (open: boolean) => void;
|
|
@@ -1520,10 +1520,10 @@ declare function ExportDialog({
|
|
|
1520
1520
|
selectedCount,
|
|
1521
1521
|
onExport,
|
|
1522
1522
|
canExportFiltered
|
|
1523
|
-
}: ExportDialogProps):
|
|
1523
|
+
}: ExportDialogProps): react_jsx_runtime2.JSX.Element;
|
|
1524
1524
|
//#endregion
|
|
1525
1525
|
//#region src/components/data-table/data-table.d.ts
|
|
1526
|
-
interface DataTableProps<TData> extends React$1.ComponentProps<
|
|
1526
|
+
interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1527
1527
|
table: Table<TData>;
|
|
1528
1528
|
actionBar?: React$1.ReactNode;
|
|
1529
1529
|
}
|
|
@@ -1533,10 +1533,10 @@ declare function DataTable<TData>({
|
|
|
1533
1533
|
children,
|
|
1534
1534
|
className,
|
|
1535
1535
|
...props
|
|
1536
|
-
}: DataTableProps<TData>):
|
|
1536
|
+
}: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1537
1537
|
//#endregion
|
|
1538
1538
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1539
|
-
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<
|
|
1539
|
+
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1540
1540
|
table: Table<TData>;
|
|
1541
1541
|
}
|
|
1542
1542
|
declare function DataTableAdvancedToolbar<TData>({
|
|
@@ -1544,7 +1544,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1544
1544
|
children,
|
|
1545
1545
|
className,
|
|
1546
1546
|
...props
|
|
1547
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1547
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1548
1548
|
//#endregion
|
|
1549
1549
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1550
1550
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1556,7 +1556,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1556
1556
|
label,
|
|
1557
1557
|
className,
|
|
1558
1558
|
...props
|
|
1559
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1559
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
|
|
1560
1560
|
//#endregion
|
|
1561
1561
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1562
1562
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1570,10 +1570,10 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1570
1570
|
title,
|
|
1571
1571
|
options,
|
|
1572
1572
|
multiple
|
|
1573
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1573
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
|
|
1574
1574
|
//#endregion
|
|
1575
1575
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1576
|
-
interface DataTablePaginationProps<TData> extends React.ComponentProps<
|
|
1576
|
+
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'> {
|
|
1577
1577
|
table: Table<TData>;
|
|
1578
1578
|
pageSizeOptions?: number[];
|
|
1579
1579
|
}
|
|
@@ -1582,10 +1582,10 @@ declare function DataTablePagination<TData>({
|
|
|
1582
1582
|
pageSizeOptions,
|
|
1583
1583
|
className,
|
|
1584
1584
|
...props
|
|
1585
|
-
}: DataTablePaginationProps<TData>):
|
|
1585
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1586
1586
|
//#endregion
|
|
1587
1587
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1588
|
-
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<
|
|
1588
|
+
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1589
1589
|
table: Table<TData>;
|
|
1590
1590
|
}
|
|
1591
1591
|
declare function DataTableToolbar<TData>({
|
|
@@ -1593,7 +1593,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1593
1593
|
children,
|
|
1594
1594
|
className,
|
|
1595
1595
|
...props
|
|
1596
|
-
}: DataTableToolbarProps<TData>):
|
|
1596
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1597
1597
|
//#endregion
|
|
1598
1598
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1599
1599
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1604,7 +1604,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1604
1604
|
table,
|
|
1605
1605
|
disabled,
|
|
1606
1606
|
...props
|
|
1607
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1607
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1608
1608
|
//#endregion
|
|
1609
1609
|
//#region src/lib/crud-actions.d.ts
|
|
1610
1610
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
@@ -1646,12 +1646,12 @@ declare const crudActions: {
|
|
|
1646
1646
|
};
|
|
1647
1647
|
//#endregion
|
|
1648
1648
|
//#region src/hooks/use-data-table.d.ts
|
|
1649
|
-
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>,
|
|
1650
|
-
initialState?: Omit<Partial<TableState>,
|
|
1649
|
+
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, 'state' | 'pageCount' | 'getCoreRowModel' | 'manualFiltering' | 'manualPagination' | 'manualSorting'>, Required<Pick<TableOptions<TData>, 'pageCount'>> {
|
|
1650
|
+
initialState?: Omit<Partial<TableState>, 'sorting'> & {
|
|
1651
1651
|
sorting?: ExtendedColumnSort<TData>[];
|
|
1652
1652
|
};
|
|
1653
1653
|
queryKeys?: Partial<QueryKeys>;
|
|
1654
|
-
history?:
|
|
1654
|
+
history?: 'push' | 'replace';
|
|
1655
1655
|
debounceMs?: number;
|
|
1656
1656
|
throttleMs?: number;
|
|
1657
1657
|
clearOnDefault?: boolean;
|
|
@@ -1699,12 +1699,12 @@ type UnifiedSchema = z.ZodObject<any> | JSONSchema | SimpleFieldsConfig;
|
|
|
1699
1699
|
* JSON Schema 类型
|
|
1700
1700
|
*/
|
|
1701
1701
|
interface JSONSchema {
|
|
1702
|
-
type:
|
|
1702
|
+
type: 'object';
|
|
1703
1703
|
properties: Record<string, JSONSchemaProperty>;
|
|
1704
1704
|
required?: string[];
|
|
1705
1705
|
}
|
|
1706
1706
|
interface JSONSchemaProperty {
|
|
1707
|
-
type:
|
|
1707
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
1708
1708
|
title?: string;
|
|
1709
1709
|
description?: string;
|
|
1710
1710
|
enum?: any[];
|
|
@@ -1723,7 +1723,7 @@ interface SimpleFieldsConfig {
|
|
|
1723
1723
|
[key: string]: SimpleFieldConfig;
|
|
1724
1724
|
}
|
|
1725
1725
|
interface SimpleFieldConfig {
|
|
1726
|
-
type:
|
|
1726
|
+
type: 'string' | 'number' | 'boolean' | 'select' | 'multiselect' | 'date' | 'datetime' | 'textarea' | 'email' | 'url';
|
|
1727
1727
|
label?: string;
|
|
1728
1728
|
description?: string;
|
|
1729
1729
|
required?: boolean;
|
|
@@ -1764,7 +1764,7 @@ declare class SchemaAdapter {
|
|
|
1764
1764
|
/**
|
|
1765
1765
|
* 检测 Schema 类型
|
|
1766
1766
|
*/
|
|
1767
|
-
static detectType(schema: UnifiedSchema):
|
|
1767
|
+
static detectType(schema: UnifiedSchema): 'zod' | 'json' | 'simple';
|
|
1768
1768
|
/**
|
|
1769
1769
|
* 转换为统一格式
|
|
1770
1770
|
*/
|
|
@@ -1919,7 +1919,7 @@ declare function humanize(str: string): string;
|
|
|
1919
1919
|
interface ParsedImportData {
|
|
1920
1920
|
headers: string[];
|
|
1921
1921
|
rows: Record<string, unknown>[];
|
|
1922
|
-
format:
|
|
1922
|
+
format: 'csv' | 'json';
|
|
1923
1923
|
}
|
|
1924
1924
|
/**
|
|
1925
1925
|
* 解析 CSV 字符串为对象数组
|
|
@@ -1963,7 +1963,7 @@ declare function coerceRowValues<T extends z.ZodObject<z.ZodRawShape>>(rows: Rec
|
|
|
1963
1963
|
//#region src/lib/export.d.ts
|
|
1964
1964
|
declare function exportTableToCSV<TData>(table: Table<TData>, opts?: {
|
|
1965
1965
|
filename?: string;
|
|
1966
|
-
excludeColumns?: (keyof TData |
|
|
1966
|
+
excludeColumns?: (keyof TData | 'select' | 'actions')[];
|
|
1967
1967
|
onlySelected?: boolean;
|
|
1968
1968
|
}): void;
|
|
1969
1969
|
/**
|
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_runtime2 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";
|
|
@@ -411,7 +411,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
411
411
|
extraActions,
|
|
412
412
|
actions,
|
|
413
413
|
deleteConfirmation
|
|
414
|
-
}: AutoTableActionBarProps<TData>):
|
|
414
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
415
415
|
//#endregion
|
|
416
416
|
//#region src/lib/schema-bridge/types.d.ts
|
|
417
417
|
/**
|
|
@@ -587,7 +587,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
587
587
|
onSelectedCountChange,
|
|
588
588
|
onSelectedRowsChange,
|
|
589
589
|
getSelectedRows
|
|
590
|
-
}: AutoTableProps<T>):
|
|
590
|
+
}: AutoTableProps<T>): react_jsx_runtime2.JSX.Element;
|
|
591
591
|
//#endregion
|
|
592
592
|
//#region src/i18n/locale.d.ts
|
|
593
593
|
/**
|
|
@@ -1079,7 +1079,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1079
1079
|
toolbarActions,
|
|
1080
1080
|
locale: localeProp,
|
|
1081
1081
|
onCreate
|
|
1082
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1082
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime2.JSX.Element;
|
|
1083
1083
|
//#endregion
|
|
1084
1084
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1085
1085
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1118,7 +1118,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1118
1118
|
labelAlign,
|
|
1119
1119
|
labelWidth,
|
|
1120
1120
|
showSubmitButton
|
|
1121
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1121
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime2.JSX.Element;
|
|
1122
1122
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1123
1123
|
ref?: React.Ref<AutoFormRef>;
|
|
1124
1124
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1134,7 +1134,7 @@ declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormPr
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
interface UrlStateOptions {
|
|
1136
1136
|
/** 历史记录模式: push 添加新记录, replace 替换当前记录 */
|
|
1137
|
-
history?:
|
|
1137
|
+
history?: 'push' | 'replace';
|
|
1138
1138
|
/** 是否浅层更新(不触发页面刷新) */
|
|
1139
1139
|
shallow?: boolean;
|
|
1140
1140
|
/** 节流时间(毫秒) */
|
|
@@ -1173,7 +1173,7 @@ declare function parseAsArrayOf<T>(itemParser: Parser<T>, separator?: string): P
|
|
|
1173
1173
|
};
|
|
1174
1174
|
};
|
|
1175
1175
|
declare function getUrlParams(): URLSearchParams;
|
|
1176
|
-
declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions,
|
|
1176
|
+
declare function setSearchParams(params: URLSearchParams, options?: Pick<UrlStateOptions, 'history' | 'scroll'>): void;
|
|
1177
1177
|
/**
|
|
1178
1178
|
* 单个 URL 状态参数
|
|
1179
1179
|
*/
|
|
@@ -1434,10 +1434,10 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1434
1434
|
filters: externalFilters,
|
|
1435
1435
|
onFiltersChange,
|
|
1436
1436
|
leading
|
|
1437
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1437
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime2.JSX.Element | null;
|
|
1438
1438
|
//#endregion
|
|
1439
1439
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1440
|
-
type ModalVariant =
|
|
1440
|
+
type ModalVariant = 'dialog' | 'sheet';
|
|
1441
1441
|
//#endregion
|
|
1442
1442
|
//#region src/components/auto-crud/crud-form-modal.d.ts
|
|
1443
1443
|
interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1478,7 +1478,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1478
1478
|
labelAlign,
|
|
1479
1479
|
labelWidth,
|
|
1480
1480
|
className
|
|
1481
|
-
}: CrudFormModalProps<T>):
|
|
1481
|
+
}: CrudFormModalProps<T>): react_jsx_runtime2.JSX.Element;
|
|
1482
1482
|
//#endregion
|
|
1483
1483
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1484
1484
|
interface ImportDialogProps {
|
|
@@ -1500,10 +1500,10 @@ declare function ImportDialog({
|
|
|
1500
1500
|
columns,
|
|
1501
1501
|
title,
|
|
1502
1502
|
locale
|
|
1503
|
-
}: ImportDialogProps):
|
|
1503
|
+
}: ImportDialogProps): react_jsx_runtime2.JSX.Element;
|
|
1504
1504
|
//#endregion
|
|
1505
1505
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1506
|
-
type ExportMode =
|
|
1506
|
+
type ExportMode = 'selected' | 'filtered';
|
|
1507
1507
|
interface ExportDialogProps {
|
|
1508
1508
|
open: boolean;
|
|
1509
1509
|
onOpenChange: (open: boolean) => void;
|
|
@@ -1520,10 +1520,10 @@ declare function ExportDialog({
|
|
|
1520
1520
|
selectedCount,
|
|
1521
1521
|
onExport,
|
|
1522
1522
|
canExportFiltered
|
|
1523
|
-
}: ExportDialogProps):
|
|
1523
|
+
}: ExportDialogProps): react_jsx_runtime2.JSX.Element;
|
|
1524
1524
|
//#endregion
|
|
1525
1525
|
//#region src/components/data-table/data-table.d.ts
|
|
1526
|
-
interface DataTableProps<TData> extends React$1.ComponentProps<
|
|
1526
|
+
interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1527
1527
|
table: Table<TData>;
|
|
1528
1528
|
actionBar?: React$1.ReactNode;
|
|
1529
1529
|
}
|
|
@@ -1533,10 +1533,10 @@ declare function DataTable<TData>({
|
|
|
1533
1533
|
children,
|
|
1534
1534
|
className,
|
|
1535
1535
|
...props
|
|
1536
|
-
}: DataTableProps<TData>):
|
|
1536
|
+
}: DataTableProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1537
1537
|
//#endregion
|
|
1538
1538
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1539
|
-
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<
|
|
1539
|
+
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1540
1540
|
table: Table<TData>;
|
|
1541
1541
|
}
|
|
1542
1542
|
declare function DataTableAdvancedToolbar<TData>({
|
|
@@ -1544,7 +1544,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1544
1544
|
children,
|
|
1545
1545
|
className,
|
|
1546
1546
|
...props
|
|
1547
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1547
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1548
1548
|
//#endregion
|
|
1549
1549
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1550
1550
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1556,7 +1556,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1556
1556
|
label,
|
|
1557
1557
|
className,
|
|
1558
1558
|
...props
|
|
1559
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1559
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
|
|
1560
1560
|
//#endregion
|
|
1561
1561
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1562
1562
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1570,10 +1570,10 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1570
1570
|
title,
|
|
1571
1571
|
options,
|
|
1572
1572
|
multiple
|
|
1573
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1573
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime2.JSX.Element;
|
|
1574
1574
|
//#endregion
|
|
1575
1575
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1576
|
-
interface DataTablePaginationProps<TData> extends React.ComponentProps<
|
|
1576
|
+
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'> {
|
|
1577
1577
|
table: Table<TData>;
|
|
1578
1578
|
pageSizeOptions?: number[];
|
|
1579
1579
|
}
|
|
@@ -1582,10 +1582,10 @@ declare function DataTablePagination<TData>({
|
|
|
1582
1582
|
pageSizeOptions,
|
|
1583
1583
|
className,
|
|
1584
1584
|
...props
|
|
1585
|
-
}: DataTablePaginationProps<TData>):
|
|
1585
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1586
1586
|
//#endregion
|
|
1587
1587
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1588
|
-
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<
|
|
1588
|
+
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
1589
1589
|
table: Table<TData>;
|
|
1590
1590
|
}
|
|
1591
1591
|
declare function DataTableToolbar<TData>({
|
|
@@ -1593,7 +1593,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1593
1593
|
children,
|
|
1594
1594
|
className,
|
|
1595
1595
|
...props
|
|
1596
|
-
}: DataTableToolbarProps<TData>):
|
|
1596
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1597
1597
|
//#endregion
|
|
1598
1598
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1599
1599
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1604,7 +1604,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1604
1604
|
table,
|
|
1605
1605
|
disabled,
|
|
1606
1606
|
...props
|
|
1607
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1607
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime2.JSX.Element;
|
|
1608
1608
|
//#endregion
|
|
1609
1609
|
//#region src/lib/crud-actions.d.ts
|
|
1610
1610
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
@@ -1646,12 +1646,12 @@ declare const crudActions: {
|
|
|
1646
1646
|
};
|
|
1647
1647
|
//#endregion
|
|
1648
1648
|
//#region src/hooks/use-data-table.d.ts
|
|
1649
|
-
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>,
|
|
1650
|
-
initialState?: Omit<Partial<TableState>,
|
|
1649
|
+
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, 'state' | 'pageCount' | 'getCoreRowModel' | 'manualFiltering' | 'manualPagination' | 'manualSorting'>, Required<Pick<TableOptions<TData>, 'pageCount'>> {
|
|
1650
|
+
initialState?: Omit<Partial<TableState>, 'sorting'> & {
|
|
1651
1651
|
sorting?: ExtendedColumnSort<TData>[];
|
|
1652
1652
|
};
|
|
1653
1653
|
queryKeys?: Partial<QueryKeys>;
|
|
1654
|
-
history?:
|
|
1654
|
+
history?: 'push' | 'replace';
|
|
1655
1655
|
debounceMs?: number;
|
|
1656
1656
|
throttleMs?: number;
|
|
1657
1657
|
clearOnDefault?: boolean;
|
|
@@ -1699,12 +1699,12 @@ type UnifiedSchema = z.ZodObject<any> | JSONSchema | SimpleFieldsConfig;
|
|
|
1699
1699
|
* JSON Schema 类型
|
|
1700
1700
|
*/
|
|
1701
1701
|
interface JSONSchema {
|
|
1702
|
-
type:
|
|
1702
|
+
type: 'object';
|
|
1703
1703
|
properties: Record<string, JSONSchemaProperty>;
|
|
1704
1704
|
required?: string[];
|
|
1705
1705
|
}
|
|
1706
1706
|
interface JSONSchemaProperty {
|
|
1707
|
-
type:
|
|
1707
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
1708
1708
|
title?: string;
|
|
1709
1709
|
description?: string;
|
|
1710
1710
|
enum?: any[];
|
|
@@ -1723,7 +1723,7 @@ interface SimpleFieldsConfig {
|
|
|
1723
1723
|
[key: string]: SimpleFieldConfig;
|
|
1724
1724
|
}
|
|
1725
1725
|
interface SimpleFieldConfig {
|
|
1726
|
-
type:
|
|
1726
|
+
type: 'string' | 'number' | 'boolean' | 'select' | 'multiselect' | 'date' | 'datetime' | 'textarea' | 'email' | 'url';
|
|
1727
1727
|
label?: string;
|
|
1728
1728
|
description?: string;
|
|
1729
1729
|
required?: boolean;
|
|
@@ -1764,7 +1764,7 @@ declare class SchemaAdapter {
|
|
|
1764
1764
|
/**
|
|
1765
1765
|
* 检测 Schema 类型
|
|
1766
1766
|
*/
|
|
1767
|
-
static detectType(schema: UnifiedSchema):
|
|
1767
|
+
static detectType(schema: UnifiedSchema): 'zod' | 'json' | 'simple';
|
|
1768
1768
|
/**
|
|
1769
1769
|
* 转换为统一格式
|
|
1770
1770
|
*/
|
|
@@ -1919,7 +1919,7 @@ declare function humanize(str: string): string;
|
|
|
1919
1919
|
interface ParsedImportData {
|
|
1920
1920
|
headers: string[];
|
|
1921
1921
|
rows: Record<string, unknown>[];
|
|
1922
|
-
format:
|
|
1922
|
+
format: 'csv' | 'json';
|
|
1923
1923
|
}
|
|
1924
1924
|
/**
|
|
1925
1925
|
* 解析 CSV 字符串为对象数组
|
|
@@ -1963,7 +1963,7 @@ declare function coerceRowValues<T extends z.ZodObject<z.ZodRawShape>>(rows: Rec
|
|
|
1963
1963
|
//#region src/lib/export.d.ts
|
|
1964
1964
|
declare function exportTableToCSV<TData>(table: Table<TData>, opts?: {
|
|
1965
1965
|
filename?: string;
|
|
1966
|
-
excludeColumns?: (keyof TData |
|
|
1966
|
+
excludeColumns?: (keyof TData | 'select' | 'actions')[];
|
|
1967
1967
|
onlySelected?: boolean;
|
|
1968
1968
|
}): void;
|
|
1969
1969
|
/**
|
package/dist/index.js
CHANGED
|
@@ -71,8 +71,7 @@ function DataTablePagination({ table, pageSizeOptions = [
|
|
|
71
71
|
children: [
|
|
72
72
|
"Page ",
|
|
73
73
|
table.getState().pagination.pageIndex + 1,
|
|
74
|
-
" of",
|
|
75
|
-
" ",
|
|
74
|
+
" of ",
|
|
76
75
|
table.getPageCount()
|
|
77
76
|
]
|
|
78
77
|
}),
|
|
@@ -7511,8 +7510,7 @@ function DataTableSliderFilter({ column, title }) {
|
|
|
7511
7510
|
className: "mx-0.5 data-[orientation=vertical]:h-4"
|
|
7512
7511
|
}),
|
|
7513
7512
|
formatValue(columnFilterValue[0]),
|
|
7514
|
-
" -",
|
|
7515
|
-
" ",
|
|
7513
|
+
" - ",
|
|
7516
7514
|
formatValue(columnFilterValue[1]),
|
|
7517
7515
|
unit ? ` ${unit}` : ""
|
|
7518
7516
|
] }) : null
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordrhyme/auto-crud",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"description": "Schema-first CRUD components with auto-generated tables and forms",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"nanoid": "^5.1.6",
|
|
63
63
|
"tailwind-merge": "^3.5.0",
|
|
64
64
|
"vaul": "^1.1.2",
|
|
65
|
-
"@wordrhyme/formily-shadcn": "1.
|
|
65
|
+
"@wordrhyme/formily-shadcn": "1.13.0",
|
|
66
66
|
"@wordrhyme/shadcn": "1.3.2",
|
|
67
|
-
"@wordrhyme/shadcn-ui": "1.32.
|
|
67
|
+
"@wordrhyme/shadcn-ui": "1.32.5"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@storybook/react": "^8.6.18",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"vitest": "^3.2.4",
|
|
87
87
|
"@internal/eslint-config": "0.3.0",
|
|
88
88
|
"@internal/prettier-config": "0.0.1",
|
|
89
|
-
"@internal/vitest-config": "0.1.0",
|
|
90
89
|
"@internal/tsconfig": "0.1.0",
|
|
91
|
-
"@internal/tsdown-config": "0.1.0"
|
|
90
|
+
"@internal/tsdown-config": "0.1.0",
|
|
91
|
+
"@internal/vitest-config": "0.1.0"
|
|
92
92
|
},
|
|
93
93
|
"prettier": "@internal/prettier-config",
|
|
94
94
|
"scripts": {
|