@wordrhyme/auto-crud 1.1.2 → 1.1.4
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 +266 -63
- package/dist/index.d.cts +51 -20
- package/dist/index.d.ts +51 -20
- package/dist/index.js +266 -64
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
4
4
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
@@ -125,6 +125,10 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
125
125
|
/** 是否正在获取数据(用于显示微妙的加载指示器) */
|
|
126
126
|
isFetching: boolean;
|
|
127
127
|
};
|
|
128
|
+
/** Optional schema override from host metadata. */
|
|
129
|
+
schema?: z.ZodObject<z.ZodRawShape>;
|
|
130
|
+
/** Optional field config override from host metadata. */
|
|
131
|
+
fields?: Fields;
|
|
128
132
|
modal: ModalState<TListItem>;
|
|
129
133
|
mutations: {
|
|
130
134
|
isCreating: boolean;
|
|
@@ -182,6 +186,10 @@ interface CrudRouter {
|
|
|
182
186
|
export?: {
|
|
183
187
|
useQuery: (input?: any, opts?: any) => any;
|
|
184
188
|
};
|
|
189
|
+
/** 元数据路由(query,由 createCrudRouter 自动生成) */
|
|
190
|
+
meta?: {
|
|
191
|
+
useQuery: (input?: any, opts?: any) => any;
|
|
192
|
+
};
|
|
185
193
|
}
|
|
186
194
|
/**
|
|
187
195
|
* 自动生成的查询参数(由内部 URL 状态管理生成)
|
|
@@ -193,6 +201,7 @@ interface AutoQueryParams {
|
|
|
193
201
|
id: string;
|
|
194
202
|
desc: boolean;
|
|
195
203
|
}>;
|
|
204
|
+
search?: string;
|
|
196
205
|
filters: any[];
|
|
197
206
|
joinOperator: "and" | "or";
|
|
198
207
|
}
|
|
@@ -352,7 +361,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
352
361
|
enableDelete,
|
|
353
362
|
extraActions,
|
|
354
363
|
actions
|
|
355
|
-
}: AutoTableActionBarProps<TData>):
|
|
364
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
356
365
|
//#endregion
|
|
357
366
|
//#region src/lib/schema-bridge/types.d.ts
|
|
358
367
|
/**
|
|
@@ -379,6 +388,7 @@ interface ParsedZodField {
|
|
|
379
388
|
type ColumnOverrides<T> = Partial<{ [K in keyof T]: Partial<ColumnDef<T, unknown>> & {
|
|
380
389
|
hidden?: boolean;
|
|
381
390
|
label?: string;
|
|
391
|
+
index?: number;
|
|
382
392
|
} }>;
|
|
383
393
|
/**
|
|
384
394
|
* Formily Schema 覆盖选项
|
|
@@ -473,6 +483,10 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
473
483
|
* 默认: ["simple", "advanced", "command"] (全部显示)
|
|
474
484
|
*/
|
|
475
485
|
filterMode?: FilterMode | FilterMode[];
|
|
486
|
+
/** 全局搜索框 */
|
|
487
|
+
search?: boolean | {
|
|
488
|
+
placeholder?: string;
|
|
489
|
+
};
|
|
476
490
|
/** 批量删除回调 */
|
|
477
491
|
onDeleteSelected?: (rows: z.infer<T>[]) => void;
|
|
478
492
|
/** 批量更新回调 */
|
|
@@ -504,6 +518,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
504
518
|
actions,
|
|
505
519
|
pinnedColumns,
|
|
506
520
|
filterMode,
|
|
521
|
+
search,
|
|
507
522
|
onDeleteSelected,
|
|
508
523
|
onUpdateSelected,
|
|
509
524
|
batchUpdateFields,
|
|
@@ -514,7 +529,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
514
529
|
showDefaultExport,
|
|
515
530
|
onSelectedCountChange,
|
|
516
531
|
getSelectedRows
|
|
517
|
-
}: AutoTableProps<T>):
|
|
532
|
+
}: AutoTableProps<T>): react_jsx_runtime0.JSX.Element;
|
|
518
533
|
//#endregion
|
|
519
534
|
//#region src/i18n/locale.d.ts
|
|
520
535
|
/**
|
|
@@ -629,6 +644,8 @@ interface FilterConfig {
|
|
|
629
644
|
unit?: string;
|
|
630
645
|
/** 过滤器占位符 */
|
|
631
646
|
placeholder?: string;
|
|
647
|
+
/** 排序权重,数值越小越靠前 */
|
|
648
|
+
index?: number;
|
|
632
649
|
/** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
|
|
633
650
|
hidden?: boolean;
|
|
634
651
|
/** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
|
|
@@ -643,6 +660,8 @@ interface Field {
|
|
|
643
660
|
label?: string;
|
|
644
661
|
/** 是否隐藏(表格和表单都隐藏) */
|
|
645
662
|
hidden?: boolean;
|
|
663
|
+
/** 是否参与 AutoCrud 全局搜索 */
|
|
664
|
+
search?: boolean;
|
|
646
665
|
/**
|
|
647
666
|
* 筛选器独立配置
|
|
648
667
|
* - FilterConfig: 详细配置
|
|
@@ -658,6 +677,8 @@ interface Field {
|
|
|
658
677
|
table?: {
|
|
659
678
|
/** 是否在表格中隐藏 */
|
|
660
679
|
hidden?: boolean;
|
|
680
|
+
/** 排序权重,数值越小越靠前 */
|
|
681
|
+
index?: number;
|
|
661
682
|
/** 筛选器配置 */
|
|
662
683
|
meta?: Record<string, unknown>;
|
|
663
684
|
/** 其他列配置 */
|
|
@@ -734,6 +755,8 @@ type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActio
|
|
|
734
755
|
* AutoCrudTable Props 接口
|
|
735
756
|
*/
|
|
736
757
|
interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
758
|
+
/** Public CRUD id. Used by hosts to document the extension target. */
|
|
759
|
+
id?: string;
|
|
737
760
|
/** 页面标题 */
|
|
738
761
|
title?: string;
|
|
739
762
|
/** 页面描述 */
|
|
@@ -759,6 +782,10 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
759
782
|
* - 数组: 第一个为默认值,显示切换按钮
|
|
760
783
|
*/
|
|
761
784
|
filterModes?: FilterMode | FilterMode[];
|
|
785
|
+
/** 全局搜索框;默认在存在 search: true 字段时显示 */
|
|
786
|
+
search?: boolean | {
|
|
787
|
+
placeholder?: string;
|
|
788
|
+
};
|
|
762
789
|
/**
|
|
763
790
|
* 批量更新字段配置
|
|
764
791
|
* - 只需传字段名数组,options 自动从 schema enum 推导
|
|
@@ -847,7 +874,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
847
874
|
toolbarActions,
|
|
848
875
|
locale: localeProp,
|
|
849
876
|
onCreate
|
|
850
|
-
}: AutoCrudTableProps<TSchema>):
|
|
877
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
|
|
851
878
|
//#endregion
|
|
852
879
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
853
880
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -879,7 +906,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
879
906
|
labelAlign,
|
|
880
907
|
labelWidth,
|
|
881
908
|
showSubmitButton
|
|
882
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
909
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
|
|
883
910
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
884
911
|
ref?: React.Ref<AutoFormRef>;
|
|
885
912
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1093,12 +1120,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1093
1120
|
variant: z.ZodEnum<{
|
|
1094
1121
|
number: "number";
|
|
1095
1122
|
boolean: "boolean";
|
|
1096
|
-
date: "date";
|
|
1097
1123
|
text: "text";
|
|
1124
|
+
range: "range";
|
|
1125
|
+
date: "date";
|
|
1126
|
+
dateRange: "dateRange";
|
|
1098
1127
|
select: "select";
|
|
1099
1128
|
multiSelect: "multiSelect";
|
|
1100
|
-
dateRange: "dateRange";
|
|
1101
|
-
range: "range";
|
|
1102
1129
|
}>;
|
|
1103
1130
|
operator: z.ZodEnum<{
|
|
1104
1131
|
iLike: "iLike";
|
|
@@ -1128,6 +1155,7 @@ declare module "@tanstack/react-table" {
|
|
|
1128
1155
|
}
|
|
1129
1156
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
1130
1157
|
label?: string;
|
|
1158
|
+
index?: number;
|
|
1131
1159
|
placeholder?: string;
|
|
1132
1160
|
variant?: FilterVariant$1;
|
|
1133
1161
|
options?: Option[];
|
|
@@ -1171,13 +1199,15 @@ interface AutoTableSimpleFiltersProps<TData> {
|
|
|
1171
1199
|
shallow?: boolean;
|
|
1172
1200
|
filters?: ExtendedColumnFilter<TData>[];
|
|
1173
1201
|
onFiltersChange?: (filters: ExtendedColumnFilter<TData>[]) => void;
|
|
1202
|
+
leading?: React$1.ReactNode;
|
|
1174
1203
|
}
|
|
1175
1204
|
declare function AutoTableSimpleFilters<TData>({
|
|
1176
1205
|
table,
|
|
1177
1206
|
shallow,
|
|
1178
1207
|
filters: externalFilters,
|
|
1179
|
-
onFiltersChange
|
|
1180
|
-
|
|
1208
|
+
onFiltersChange,
|
|
1209
|
+
leading
|
|
1210
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
|
|
1181
1211
|
//#endregion
|
|
1182
1212
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1183
1213
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1219,7 +1249,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1219
1249
|
labelAlign,
|
|
1220
1250
|
labelWidth,
|
|
1221
1251
|
className
|
|
1222
|
-
}: CrudFormModalProps<T>):
|
|
1252
|
+
}: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
|
|
1223
1253
|
//#endregion
|
|
1224
1254
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1225
1255
|
interface ImportDialogProps {
|
|
@@ -1241,7 +1271,7 @@ declare function ImportDialog({
|
|
|
1241
1271
|
columns,
|
|
1242
1272
|
title,
|
|
1243
1273
|
locale
|
|
1244
|
-
}: ImportDialogProps):
|
|
1274
|
+
}: ImportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1245
1275
|
//#endregion
|
|
1246
1276
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1247
1277
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1261,7 +1291,7 @@ declare function ExportDialog({
|
|
|
1261
1291
|
selectedCount,
|
|
1262
1292
|
onExport,
|
|
1263
1293
|
canExportFiltered
|
|
1264
|
-
}: ExportDialogProps):
|
|
1294
|
+
}: ExportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1265
1295
|
//#endregion
|
|
1266
1296
|
//#region src/components/data-table/data-table.d.ts
|
|
1267
1297
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1274,7 +1304,7 @@ declare function DataTable<TData>({
|
|
|
1274
1304
|
children,
|
|
1275
1305
|
className,
|
|
1276
1306
|
...props
|
|
1277
|
-
}: DataTableProps<TData>):
|
|
1307
|
+
}: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1278
1308
|
//#endregion
|
|
1279
1309
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1280
1310
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1285,7 +1315,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1285
1315
|
children,
|
|
1286
1316
|
className,
|
|
1287
1317
|
...props
|
|
1288
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1318
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1289
1319
|
//#endregion
|
|
1290
1320
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1291
1321
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1297,7 +1327,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1297
1327
|
label,
|
|
1298
1328
|
className,
|
|
1299
1329
|
...props
|
|
1300
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1330
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1301
1331
|
//#endregion
|
|
1302
1332
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1303
1333
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1311,7 +1341,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1311
1341
|
title,
|
|
1312
1342
|
options,
|
|
1313
1343
|
multiple
|
|
1314
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1344
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1315
1345
|
//#endregion
|
|
1316
1346
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1317
1347
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1323,7 +1353,7 @@ declare function DataTablePagination<TData>({
|
|
|
1323
1353
|
pageSizeOptions,
|
|
1324
1354
|
className,
|
|
1325
1355
|
...props
|
|
1326
|
-
}: DataTablePaginationProps<TData>):
|
|
1356
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1327
1357
|
//#endregion
|
|
1328
1358
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1329
1359
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1334,7 +1364,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1334
1364
|
children,
|
|
1335
1365
|
className,
|
|
1336
1366
|
...props
|
|
1337
|
-
}: DataTableToolbarProps<TData>):
|
|
1367
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1338
1368
|
//#endregion
|
|
1339
1369
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1340
1370
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1345,7 +1375,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1345
1375
|
table,
|
|
1346
1376
|
disabled,
|
|
1347
1377
|
...props
|
|
1348
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1378
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1349
1379
|
//#endregion
|
|
1350
1380
|
//#region src/hooks/use-data-table.d.ts
|
|
1351
1381
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
|
@@ -1512,6 +1542,7 @@ interface ListParams {
|
|
|
1512
1542
|
id: string;
|
|
1513
1543
|
desc: boolean;
|
|
1514
1544
|
}>;
|
|
1545
|
+
search?: string;
|
|
1515
1546
|
filters?: Array<{
|
|
1516
1547
|
id: string;
|
|
1517
1548
|
value: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
|
3
3
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
4
4
|
import { DropdownMenuTrigger, PopoverContent } from "@pixpilot/shadcn";
|
|
5
5
|
import { ClassValue } from "clsx";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { ISchema } from "@formily/json-schema";
|
|
9
9
|
|
|
@@ -125,6 +125,10 @@ interface UseAutoCrudResourceReturn<TSchema extends z.ZodObject<z.ZodRawShape>,
|
|
|
125
125
|
/** 是否正在获取数据(用于显示微妙的加载指示器) */
|
|
126
126
|
isFetching: boolean;
|
|
127
127
|
};
|
|
128
|
+
/** Optional schema override from host metadata. */
|
|
129
|
+
schema?: z.ZodObject<z.ZodRawShape>;
|
|
130
|
+
/** Optional field config override from host metadata. */
|
|
131
|
+
fields?: Fields;
|
|
128
132
|
modal: ModalState<TListItem>;
|
|
129
133
|
mutations: {
|
|
130
134
|
isCreating: boolean;
|
|
@@ -182,6 +186,10 @@ interface CrudRouter {
|
|
|
182
186
|
export?: {
|
|
183
187
|
useQuery: (input?: any, opts?: any) => any;
|
|
184
188
|
};
|
|
189
|
+
/** 元数据路由(query,由 createCrudRouter 自动生成) */
|
|
190
|
+
meta?: {
|
|
191
|
+
useQuery: (input?: any, opts?: any) => any;
|
|
192
|
+
};
|
|
185
193
|
}
|
|
186
194
|
/**
|
|
187
195
|
* 自动生成的查询参数(由内部 URL 状态管理生成)
|
|
@@ -193,6 +201,7 @@ interface AutoQueryParams {
|
|
|
193
201
|
id: string;
|
|
194
202
|
desc: boolean;
|
|
195
203
|
}>;
|
|
204
|
+
search?: string;
|
|
196
205
|
filters: any[];
|
|
197
206
|
joinOperator: "and" | "or";
|
|
198
207
|
}
|
|
@@ -352,7 +361,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
352
361
|
enableDelete,
|
|
353
362
|
extraActions,
|
|
354
363
|
actions
|
|
355
|
-
}: AutoTableActionBarProps<TData>):
|
|
364
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
356
365
|
//#endregion
|
|
357
366
|
//#region src/lib/schema-bridge/types.d.ts
|
|
358
367
|
/**
|
|
@@ -379,6 +388,7 @@ interface ParsedZodField {
|
|
|
379
388
|
type ColumnOverrides<T> = Partial<{ [K in keyof T]: Partial<ColumnDef<T, unknown>> & {
|
|
380
389
|
hidden?: boolean;
|
|
381
390
|
label?: string;
|
|
391
|
+
index?: number;
|
|
382
392
|
} }>;
|
|
383
393
|
/**
|
|
384
394
|
* Formily Schema 覆盖选项
|
|
@@ -473,6 +483,10 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
473
483
|
* 默认: ["simple", "advanced", "command"] (全部显示)
|
|
474
484
|
*/
|
|
475
485
|
filterMode?: FilterMode | FilterMode[];
|
|
486
|
+
/** 全局搜索框 */
|
|
487
|
+
search?: boolean | {
|
|
488
|
+
placeholder?: string;
|
|
489
|
+
};
|
|
476
490
|
/** 批量删除回调 */
|
|
477
491
|
onDeleteSelected?: (rows: z.infer<T>[]) => void;
|
|
478
492
|
/** 批量更新回调 */
|
|
@@ -504,6 +518,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
504
518
|
actions,
|
|
505
519
|
pinnedColumns,
|
|
506
520
|
filterMode,
|
|
521
|
+
search,
|
|
507
522
|
onDeleteSelected,
|
|
508
523
|
onUpdateSelected,
|
|
509
524
|
batchUpdateFields,
|
|
@@ -514,7 +529,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
514
529
|
showDefaultExport,
|
|
515
530
|
onSelectedCountChange,
|
|
516
531
|
getSelectedRows
|
|
517
|
-
}: AutoTableProps<T>):
|
|
532
|
+
}: AutoTableProps<T>): react_jsx_runtime0.JSX.Element;
|
|
518
533
|
//#endregion
|
|
519
534
|
//#region src/i18n/locale.d.ts
|
|
520
535
|
/**
|
|
@@ -629,6 +644,8 @@ interface FilterConfig {
|
|
|
629
644
|
unit?: string;
|
|
630
645
|
/** 过滤器占位符 */
|
|
631
646
|
placeholder?: string;
|
|
647
|
+
/** 排序权重,数值越小越靠前 */
|
|
648
|
+
index?: number;
|
|
632
649
|
/** 是否在筛选栏中隐藏(隐藏筛选但不影响表格列显示) */
|
|
633
650
|
hidden?: boolean;
|
|
634
651
|
/** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
|
|
@@ -643,6 +660,8 @@ interface Field {
|
|
|
643
660
|
label?: string;
|
|
644
661
|
/** 是否隐藏(表格和表单都隐藏) */
|
|
645
662
|
hidden?: boolean;
|
|
663
|
+
/** 是否参与 AutoCrud 全局搜索 */
|
|
664
|
+
search?: boolean;
|
|
646
665
|
/**
|
|
647
666
|
* 筛选器独立配置
|
|
648
667
|
* - FilterConfig: 详细配置
|
|
@@ -658,6 +677,8 @@ interface Field {
|
|
|
658
677
|
table?: {
|
|
659
678
|
/** 是否在表格中隐藏 */
|
|
660
679
|
hidden?: boolean;
|
|
680
|
+
/** 排序权重,数值越小越靠前 */
|
|
681
|
+
index?: number;
|
|
661
682
|
/** 筛选器配置 */
|
|
662
683
|
meta?: Record<string, unknown>;
|
|
663
684
|
/** 其他列配置 */
|
|
@@ -734,6 +755,8 @@ type ToolbarActionConfig = ToolbarActionItem[] | ((defaults: ToolbarBuiltinActio
|
|
|
734
755
|
* AutoCrudTable Props 接口
|
|
735
756
|
*/
|
|
736
757
|
interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
758
|
+
/** Public CRUD id. Used by hosts to document the extension target. */
|
|
759
|
+
id?: string;
|
|
737
760
|
/** 页面标题 */
|
|
738
761
|
title?: string;
|
|
739
762
|
/** 页面描述 */
|
|
@@ -759,6 +782,10 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
759
782
|
* - 数组: 第一个为默认值,显示切换按钮
|
|
760
783
|
*/
|
|
761
784
|
filterModes?: FilterMode | FilterMode[];
|
|
785
|
+
/** 全局搜索框;默认在存在 search: true 字段时显示 */
|
|
786
|
+
search?: boolean | {
|
|
787
|
+
placeholder?: string;
|
|
788
|
+
};
|
|
762
789
|
/**
|
|
763
790
|
* 批量更新字段配置
|
|
764
791
|
* - 只需传字段名数组,options 自动从 schema enum 推导
|
|
@@ -847,7 +874,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
847
874
|
toolbarActions,
|
|
848
875
|
locale: localeProp,
|
|
849
876
|
onCreate
|
|
850
|
-
}: AutoCrudTableProps<TSchema>):
|
|
877
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime0.JSX.Element;
|
|
851
878
|
//#endregion
|
|
852
879
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
853
880
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -879,7 +906,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
879
906
|
labelAlign,
|
|
880
907
|
labelWidth,
|
|
881
908
|
showSubmitButton
|
|
882
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
909
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime0.JSX.Element;
|
|
883
910
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
884
911
|
ref?: React.Ref<AutoFormRef>;
|
|
885
912
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1093,12 +1120,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1093
1120
|
variant: z.ZodEnum<{
|
|
1094
1121
|
number: "number";
|
|
1095
1122
|
boolean: "boolean";
|
|
1096
|
-
date: "date";
|
|
1097
1123
|
text: "text";
|
|
1124
|
+
range: "range";
|
|
1125
|
+
date: "date";
|
|
1126
|
+
dateRange: "dateRange";
|
|
1098
1127
|
select: "select";
|
|
1099
1128
|
multiSelect: "multiSelect";
|
|
1100
|
-
dateRange: "dateRange";
|
|
1101
|
-
range: "range";
|
|
1102
1129
|
}>;
|
|
1103
1130
|
operator: z.ZodEnum<{
|
|
1104
1131
|
iLike: "iLike";
|
|
@@ -1128,6 +1155,7 @@ declare module "@tanstack/react-table" {
|
|
|
1128
1155
|
}
|
|
1129
1156
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
1130
1157
|
label?: string;
|
|
1158
|
+
index?: number;
|
|
1131
1159
|
placeholder?: string;
|
|
1132
1160
|
variant?: FilterVariant$1;
|
|
1133
1161
|
options?: Option[];
|
|
@@ -1171,13 +1199,15 @@ interface AutoTableSimpleFiltersProps<TData> {
|
|
|
1171
1199
|
shallow?: boolean;
|
|
1172
1200
|
filters?: ExtendedColumnFilter<TData>[];
|
|
1173
1201
|
onFiltersChange?: (filters: ExtendedColumnFilter<TData>[]) => void;
|
|
1202
|
+
leading?: React$1.ReactNode;
|
|
1174
1203
|
}
|
|
1175
1204
|
declare function AutoTableSimpleFilters<TData>({
|
|
1176
1205
|
table,
|
|
1177
1206
|
shallow,
|
|
1178
1207
|
filters: externalFilters,
|
|
1179
|
-
onFiltersChange
|
|
1180
|
-
|
|
1208
|
+
onFiltersChange,
|
|
1209
|
+
leading
|
|
1210
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime0.JSX.Element | null;
|
|
1181
1211
|
//#endregion
|
|
1182
1212
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1183
1213
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1219,7 +1249,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1219
1249
|
labelAlign,
|
|
1220
1250
|
labelWidth,
|
|
1221
1251
|
className
|
|
1222
|
-
}: CrudFormModalProps<T>):
|
|
1252
|
+
}: CrudFormModalProps<T>): react_jsx_runtime0.JSX.Element;
|
|
1223
1253
|
//#endregion
|
|
1224
1254
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1225
1255
|
interface ImportDialogProps {
|
|
@@ -1241,7 +1271,7 @@ declare function ImportDialog({
|
|
|
1241
1271
|
columns,
|
|
1242
1272
|
title,
|
|
1243
1273
|
locale
|
|
1244
|
-
}: ImportDialogProps):
|
|
1274
|
+
}: ImportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1245
1275
|
//#endregion
|
|
1246
1276
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1247
1277
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1261,7 +1291,7 @@ declare function ExportDialog({
|
|
|
1261
1291
|
selectedCount,
|
|
1262
1292
|
onExport,
|
|
1263
1293
|
canExportFiltered
|
|
1264
|
-
}: ExportDialogProps):
|
|
1294
|
+
}: ExportDialogProps): react_jsx_runtime0.JSX.Element;
|
|
1265
1295
|
//#endregion
|
|
1266
1296
|
//#region src/components/data-table/data-table.d.ts
|
|
1267
1297
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1274,7 +1304,7 @@ declare function DataTable<TData>({
|
|
|
1274
1304
|
children,
|
|
1275
1305
|
className,
|
|
1276
1306
|
...props
|
|
1277
|
-
}: DataTableProps<TData>):
|
|
1307
|
+
}: DataTableProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1278
1308
|
//#endregion
|
|
1279
1309
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1280
1310
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1285,7 +1315,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1285
1315
|
children,
|
|
1286
1316
|
className,
|
|
1287
1317
|
...props
|
|
1288
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1318
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1289
1319
|
//#endregion
|
|
1290
1320
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1291
1321
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1297,7 +1327,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1297
1327
|
label,
|
|
1298
1328
|
className,
|
|
1299
1329
|
...props
|
|
1300
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1330
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1301
1331
|
//#endregion
|
|
1302
1332
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1303
1333
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1311,7 +1341,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1311
1341
|
title,
|
|
1312
1342
|
options,
|
|
1313
1343
|
multiple
|
|
1314
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1344
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime0.JSX.Element;
|
|
1315
1345
|
//#endregion
|
|
1316
1346
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1317
1347
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1323,7 +1353,7 @@ declare function DataTablePagination<TData>({
|
|
|
1323
1353
|
pageSizeOptions,
|
|
1324
1354
|
className,
|
|
1325
1355
|
...props
|
|
1326
|
-
}: DataTablePaginationProps<TData>):
|
|
1356
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1327
1357
|
//#endregion
|
|
1328
1358
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1329
1359
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1334,7 +1364,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1334
1364
|
children,
|
|
1335
1365
|
className,
|
|
1336
1366
|
...props
|
|
1337
|
-
}: DataTableToolbarProps<TData>):
|
|
1367
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1338
1368
|
//#endregion
|
|
1339
1369
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1340
1370
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1345,7 +1375,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1345
1375
|
table,
|
|
1346
1376
|
disabled,
|
|
1347
1377
|
...props
|
|
1348
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1378
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime0.JSX.Element;
|
|
1349
1379
|
//#endregion
|
|
1350
1380
|
//#region src/hooks/use-data-table.d.ts
|
|
1351
1381
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
|
@@ -1512,6 +1542,7 @@ interface ListParams {
|
|
|
1512
1542
|
id: string;
|
|
1513
1543
|
desc: boolean;
|
|
1514
1544
|
}>;
|
|
1545
|
+
search?: string;
|
|
1515
1546
|
filters?: Array<{
|
|
1516
1547
|
id: string;
|
|
1517
1548
|
value: any;
|