@wordrhyme/auto-crud 1.2.5 → 1.3.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/README.md +116 -46
- package/dist/index.cjs +1475 -1723
- package/dist/index.d.cts +184 -97
- package/dist/index.d.ts +168 -81
- package/dist/index.js +1256 -1504
- package/package.json +5 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
3
4
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
4
5
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
5
6
|
import * as React$1 from "react";
|
|
6
|
-
import { ComponentProps, ReactNode } from "react";
|
|
7
7
|
import { ISchema } from "@formily/json-schema";
|
|
8
|
-
import {
|
|
8
|
+
import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
|
|
9
|
+
import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps } from "@wordrhyme/shadcn-ui";
|
|
9
10
|
import { ClassValue } from "clsx";
|
|
10
11
|
|
|
11
12
|
//#region src/hooks/use-auto-crud-resource.d.ts
|
|
@@ -313,7 +314,12 @@ interface BatchActionContext<TData> {
|
|
|
313
314
|
clearSelection: () => void;
|
|
314
315
|
}
|
|
315
316
|
type BatchBuiltinActionType = 'batchUpdate' | 'export' | 'delete';
|
|
316
|
-
type
|
|
317
|
+
type BatchActionMeta = {
|
|
318
|
+
id?: string;
|
|
319
|
+
order?: number;
|
|
320
|
+
hidden?: boolean;
|
|
321
|
+
};
|
|
322
|
+
type BatchBuiltinActionItem<TData> = BatchActionMeta & {
|
|
317
323
|
type: BatchBuiltinActionType;
|
|
318
324
|
/** 替代默认行为 */
|
|
319
325
|
onClick?: (rows: TData[], context: BatchActionContext<TData>, event: React$1.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -322,7 +328,7 @@ type BatchBuiltinActionItem<TData> = {
|
|
|
322
328
|
/** 替代整个内置操作的渲染 */
|
|
323
329
|
component?: React$1.ReactNode | ((context: BatchActionContext<TData>) => React$1.ReactNode);
|
|
324
330
|
};
|
|
325
|
-
type BatchCustomActionItem<TData> = {
|
|
331
|
+
type BatchCustomActionItem<TData> = BatchActionMeta & {
|
|
326
332
|
type: 'custom';
|
|
327
333
|
/** 操作文本。传 component 时可省略 */
|
|
328
334
|
label?: string;
|
|
@@ -336,6 +342,12 @@ type BatchCustomActionItem<TData> = {
|
|
|
336
342
|
};
|
|
337
343
|
type BatchActionItem<TData> = BatchBuiltinActionItem<TData> | BatchCustomActionItem<TData>;
|
|
338
344
|
type BatchActionConfig<TData> = BatchActionItem<TData>[] | ((defaults: BatchBuiltinActionItem<TData>[]) => BatchActionItem<TData>[]);
|
|
345
|
+
interface BatchDeleteConfirmation {
|
|
346
|
+
title: string;
|
|
347
|
+
description: (count: number) => string;
|
|
348
|
+
cancel: string;
|
|
349
|
+
confirm: string;
|
|
350
|
+
}
|
|
339
351
|
interface AutoTableActionBarProps<TData> {
|
|
340
352
|
table: Table<TData>;
|
|
341
353
|
onDeleteSelected?: (rows: TData[]) => void;
|
|
@@ -353,6 +365,8 @@ interface AutoTableActionBarProps<TData> {
|
|
|
353
365
|
extraActions?: React$1.ReactNode;
|
|
354
366
|
/** 批量操作配置,支持和行操作/顶部工具栏一致的顺序接管语义 */
|
|
355
367
|
actions?: BatchActionConfig<TData>;
|
|
368
|
+
/** 批量删除二次确认文案 */
|
|
369
|
+
deleteConfirmation?: BatchDeleteConfirmation;
|
|
356
370
|
}
|
|
357
371
|
declare function AutoTableActionBar<TData>({
|
|
358
372
|
table,
|
|
@@ -363,8 +377,9 @@ declare function AutoTableActionBar<TData>({
|
|
|
363
377
|
showDefaultExport,
|
|
364
378
|
enableDelete,
|
|
365
379
|
extraActions,
|
|
366
|
-
actions
|
|
367
|
-
|
|
380
|
+
actions,
|
|
381
|
+
deleteConfirmation
|
|
382
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
368
383
|
//#endregion
|
|
369
384
|
//#region src/lib/schema-bridge/types.d.ts
|
|
370
385
|
/**
|
|
@@ -448,16 +463,18 @@ declare function createSelectColumn<T>(): ColumnDef<T>;
|
|
|
448
463
|
/**
|
|
449
464
|
* 已解析的操作项(渲染层使用)
|
|
450
465
|
*/
|
|
451
|
-
interface ResolvedActionItem<T> {
|
|
452
|
-
label
|
|
453
|
-
onClick
|
|
466
|
+
interface ResolvedActionItem<T, TContext = any> {
|
|
467
|
+
label?: string;
|
|
468
|
+
onClick?: (row: T) => void;
|
|
469
|
+
component?: React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
|
|
470
|
+
getContext?: (row: T) => TContext;
|
|
454
471
|
separator?: boolean;
|
|
455
472
|
variant?: 'default' | 'destructive';
|
|
456
473
|
}
|
|
457
474
|
/**
|
|
458
475
|
* 操作列配置(ResolvedActionItem 数组)
|
|
459
476
|
*/
|
|
460
|
-
type ActionsColumnConfig<T> = ResolvedActionItem<T>[];
|
|
477
|
+
type ActionsColumnConfig<T> = ResolvedActionItem<T, any>[];
|
|
461
478
|
/**
|
|
462
479
|
* 创建操作列
|
|
463
480
|
*/
|
|
@@ -500,6 +517,8 @@ interface AutoTableProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
|
500
517
|
actionBarExtra?: React.ReactNode;
|
|
501
518
|
/** 批量悬浮操作配置 */
|
|
502
519
|
actionBarActions?: BatchActionConfig<z.infer<T>>;
|
|
520
|
+
/** 批量删除二次确认文案 */
|
|
521
|
+
deleteConfirmation?: BatchDeleteConfirmation;
|
|
503
522
|
/** 初始排序 */
|
|
504
523
|
initialSorting?: any[];
|
|
505
524
|
/** 是否启用导出功能 (默认 true) */
|
|
@@ -529,13 +548,14 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
529
548
|
batchUpdateFields,
|
|
530
549
|
actionBarExtra,
|
|
531
550
|
actionBarActions,
|
|
551
|
+
deleteConfirmation,
|
|
532
552
|
initialSorting,
|
|
533
553
|
enableExport,
|
|
534
554
|
showDefaultExport,
|
|
535
555
|
onSelectedCountChange,
|
|
536
556
|
onSelectedRowsChange,
|
|
537
557
|
getSelectedRows
|
|
538
|
-
}: AutoTableProps<T>):
|
|
558
|
+
}: AutoTableProps<T>): react_jsx_runtime5.JSX.Element;
|
|
539
559
|
//#endregion
|
|
540
560
|
//#region src/i18n/locale.d.ts
|
|
541
561
|
/**
|
|
@@ -583,6 +603,12 @@ interface AutoCrudLocale {
|
|
|
583
603
|
confirm: string;
|
|
584
604
|
confirming: string;
|
|
585
605
|
};
|
|
606
|
+
bulkDeleteModal: {
|
|
607
|
+
title: string;
|
|
608
|
+
description: (count: number) => string;
|
|
609
|
+
cancel: string;
|
|
610
|
+
confirm: string;
|
|
611
|
+
};
|
|
586
612
|
importDialog: {
|
|
587
613
|
title: string;
|
|
588
614
|
uploadDescription: string;
|
|
@@ -643,11 +669,14 @@ type AutoCrudOption = {
|
|
|
643
669
|
};
|
|
644
670
|
type AutoCrudDataSourceContext = {
|
|
645
671
|
field: string;
|
|
672
|
+
page?: number;
|
|
673
|
+
pageSize?: number;
|
|
646
674
|
search?: string;
|
|
647
675
|
values?: Record<string, unknown>;
|
|
648
676
|
signal?: AbortSignal;
|
|
649
677
|
};
|
|
650
678
|
type AutoCrudDataSourceResult = AutoCrudOption[] | {
|
|
679
|
+
hasMore?: boolean;
|
|
651
680
|
options?: AutoCrudOption[];
|
|
652
681
|
};
|
|
653
682
|
type AutoCrudDataSourceLoader = (context: AutoCrudDataSourceContext) => AutoCrudDataSourceResult | Promise<AutoCrudDataSourceResult>;
|
|
@@ -655,34 +684,42 @@ type AutoCrudDataSourceConfig = string;
|
|
|
655
684
|
type AutoCrudDataSourceRegistration = AutoCrudDataSourceLoader | {
|
|
656
685
|
dependencies?: string[];
|
|
657
686
|
reset?: boolean;
|
|
687
|
+
search?: boolean;
|
|
688
|
+
debounceMs?: number;
|
|
689
|
+
loadMore?: boolean;
|
|
690
|
+
pageSize?: number;
|
|
658
691
|
load: AutoCrudDataSourceLoader;
|
|
659
692
|
};
|
|
660
693
|
type AutoCrudDataSourceEntry = {
|
|
661
694
|
dependencies: string[];
|
|
662
695
|
reset: boolean;
|
|
696
|
+
search: boolean;
|
|
697
|
+
debounceMs: number;
|
|
698
|
+
loadMore: boolean;
|
|
699
|
+
pageSize: number;
|
|
663
700
|
load: AutoCrudDataSourceLoader;
|
|
664
701
|
};
|
|
665
|
-
type RegistryListener = () => void;
|
|
702
|
+
type RegistryListener$1 = () => void;
|
|
666
703
|
declare const formComponents: {
|
|
667
704
|
register(name: string, value: AutoCrudFormComponentConfig): void;
|
|
668
705
|
unregister(name: string): void;
|
|
669
706
|
get(name: string): AutoCrudFormComponentConfig | undefined;
|
|
670
707
|
all(): Record<string, AutoCrudFormComponentConfig>;
|
|
671
|
-
subscribe(listener: RegistryListener): () => void;
|
|
708
|
+
subscribe(listener: RegistryListener$1): () => void;
|
|
672
709
|
};
|
|
673
710
|
declare const components: {
|
|
674
711
|
register(name: string, value: AutoCrudFormComponentConfig): void;
|
|
675
712
|
unregister(name: string): void;
|
|
676
713
|
get(name: string): AutoCrudFormComponentConfig | undefined;
|
|
677
714
|
all(): Record<string, AutoCrudFormComponentConfig>;
|
|
678
|
-
subscribe(listener: RegistryListener): () => void;
|
|
715
|
+
subscribe(listener: RegistryListener$1): () => void;
|
|
679
716
|
};
|
|
680
717
|
declare const dataSources: {
|
|
681
718
|
register(name: string, registration: AutoCrudDataSourceRegistration): void;
|
|
682
719
|
unregister: (name: string) => void;
|
|
683
720
|
get: (name: string) => AutoCrudDataSourceEntry | undefined;
|
|
684
721
|
all: () => Record<string, AutoCrudDataSourceEntry>;
|
|
685
|
-
subscribe: (listener: RegistryListener) => () => void;
|
|
722
|
+
subscribe: (listener: RegistryListener$1) => () => void;
|
|
686
723
|
};
|
|
687
724
|
declare function normalizeDataSourceConfig(config: AutoCrudDataSourceConfig | undefined): {
|
|
688
725
|
key: string;
|
|
@@ -778,51 +815,76 @@ interface Field {
|
|
|
778
815
|
} | false;
|
|
779
816
|
}
|
|
780
817
|
type Fields = Record<string, Field>;
|
|
781
|
-
type BuiltinType = 'view' | 'edit' | 'copy' | 'delete';
|
|
782
818
|
/** 内置操作项(覆盖默认行为或调整位置) */
|
|
783
|
-
type
|
|
784
|
-
|
|
819
|
+
type ActionMeta = {
|
|
820
|
+
id?: string;
|
|
821
|
+
order?: number;
|
|
822
|
+
hidden?: boolean;
|
|
823
|
+
};
|
|
824
|
+
interface AutoCrudRowActionContext<T> {
|
|
825
|
+
crudId: string;
|
|
826
|
+
idKey: string;
|
|
827
|
+
row: T;
|
|
828
|
+
rowId?: string;
|
|
829
|
+
openView: (row: T) => void;
|
|
830
|
+
openEdit?: (row: T) => void;
|
|
831
|
+
copyRow?: (row: T) => void;
|
|
832
|
+
openDelete?: (row: T) => void;
|
|
833
|
+
}
|
|
834
|
+
type ActionComponent<TContext> = React$1.ReactNode | ((context: TContext) => React$1.ReactNode);
|
|
835
|
+
type RowBuiltinActionType = 'view' | 'edit' | 'copy' | 'delete';
|
|
836
|
+
type RowBuiltinActionItem<T> = ActionMeta & {
|
|
837
|
+
type: RowBuiltinActionType;
|
|
785
838
|
onClick?: (row: T) => void;
|
|
786
839
|
label?: string;
|
|
787
840
|
separator?: boolean;
|
|
788
841
|
};
|
|
789
|
-
|
|
790
|
-
type CustomActionItem<T> = {
|
|
842
|
+
type RowCustomActionItem<T> = ActionMeta & {
|
|
791
843
|
type: 'custom';
|
|
792
|
-
label
|
|
793
|
-
onClick
|
|
794
|
-
|
|
844
|
+
label?: string;
|
|
845
|
+
onClick?: (row: T) => void;
|
|
846
|
+
component?: ActionComponent<AutoCrudRowActionContext<T>>;
|
|
795
847
|
position?: 'start' | 'end';
|
|
796
848
|
separator?: boolean;
|
|
797
849
|
variant?: 'default' | 'destructive';
|
|
798
850
|
};
|
|
799
851
|
/**
|
|
800
|
-
*
|
|
852
|
+
* Row action item.
|
|
801
853
|
*
|
|
802
|
-
* -
|
|
803
|
-
* -
|
|
804
|
-
*/
|
|
805
|
-
type
|
|
806
|
-
type
|
|
854
|
+
* - Custom-only config keeps builtin row actions and appends custom actions.
|
|
855
|
+
* - Including any builtin type takes over builtin ordering.
|
|
856
|
+
*/
|
|
857
|
+
type RowActionItem<T> = RowBuiltinActionItem<T> | RowCustomActionItem<T>;
|
|
858
|
+
type RowActionConfig<T> = RowActionItem<T>[] | ((defaults: RowBuiltinActionItem<T>[]) => RowActionItem<T>[]);
|
|
859
|
+
/** @deprecated Use RowActionItem instead. */
|
|
860
|
+
type ActionItem<T> = RowActionItem<T>;
|
|
861
|
+
/** @deprecated Use RowActionConfig instead. */
|
|
862
|
+
type ActionConfig<T> = RowActionConfig<T>;
|
|
863
|
+
type AutoCrudActionsConfig<T> = {
|
|
864
|
+
toolbar?: ToolbarActionConfig;
|
|
865
|
+
row?: RowActionConfig<T>;
|
|
866
|
+
batch?: BatchActionConfig<T>;
|
|
867
|
+
};
|
|
868
|
+
type AutoCrudActionConfig<T> = RowActionConfig<T> | AutoCrudActionsConfig<T>;
|
|
807
869
|
/**
|
|
808
870
|
* 顶部工具栏内置操作项
|
|
809
871
|
*/
|
|
810
|
-
type ToolbarBuiltinActionItem = {
|
|
872
|
+
type ToolbarBuiltinActionItem = ActionMeta & {
|
|
811
873
|
type: 'create' | 'import' | 'export';
|
|
812
874
|
/** 替代默认的行为 */
|
|
813
875
|
onClick?: () => void;
|
|
814
876
|
/** 替代默认的标签文本 */
|
|
815
877
|
label?: string;
|
|
816
878
|
/** 替代整个按钮的渲染 */
|
|
817
|
-
component?:
|
|
879
|
+
component?: ActionComponent<AutoCrudToolbarContext>;
|
|
818
880
|
};
|
|
819
881
|
/**
|
|
820
882
|
* 顶部工具栏自定义操作项
|
|
821
883
|
*/
|
|
822
|
-
type ToolbarCustomActionItem = {
|
|
884
|
+
type ToolbarCustomActionItem = ActionMeta & {
|
|
823
885
|
type: 'custom';
|
|
824
886
|
/** 渲染自定义内容 */
|
|
825
|
-
component:
|
|
887
|
+
component: ActionComponent<AutoCrudToolbarContext>;
|
|
826
888
|
/** 仅在无内置项时生效:插入到首部还是尾部(默认 end) */
|
|
827
889
|
position?: 'start' | 'end';
|
|
828
890
|
};
|
|
@@ -883,6 +945,7 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
883
945
|
* 多选后悬浮批量操作栏配置
|
|
884
946
|
* 用法类同 `actions` 行操作和 `toolbar` 顶部工具栏。
|
|
885
947
|
* 只传 custom 时保留默认批量操作;包含任意内置 type 时完全接管顺序。
|
|
948
|
+
* @deprecated Use actions.batch instead.
|
|
886
949
|
*/
|
|
887
950
|
batchActions?: BatchActionConfig<z.output<TSchema>>;
|
|
888
951
|
/** 默认排序 */
|
|
@@ -892,16 +955,19 @@ interface AutoCrudTableProps<TSchema extends z.ZodObject<z.ZodRawShape>> {
|
|
|
892
955
|
form?: {
|
|
893
956
|
/** 表单覆盖配置(兼容旧 API,优先级低于 fieldOverrides) */
|
|
894
957
|
overrides?: Record<string, any>;
|
|
958
|
+
/** Formily schema expression/reaction scope */
|
|
959
|
+
scope?: JsonSchemaFormScope;
|
|
895
960
|
/** 表单列数 */
|
|
896
961
|
columns?: number;
|
|
897
962
|
/** 弹窗自定义容器类名(支持控制大小、最大高度等) */
|
|
898
963
|
className?: string;
|
|
899
964
|
};
|
|
900
|
-
/**
|
|
901
|
-
actions?:
|
|
965
|
+
/** 行操作配置,或统一的 toolbar/row/batch 操作配置。 */
|
|
966
|
+
actions?: AutoCrudActionConfig<z.output<TSchema>>;
|
|
902
967
|
/**
|
|
903
968
|
* 顶层工具栏操作配置
|
|
904
969
|
* 用法类同 `actions` 行操作。一旦配置了包含内置 `type` 的数组,它将完全接管右侧工具栏!
|
|
970
|
+
* @deprecated Use actions.toolbar instead.
|
|
905
971
|
*/
|
|
906
972
|
toolbar?: ToolbarActionConfig;
|
|
907
973
|
/** @deprecated Use toolbar instead. */
|
|
@@ -965,14 +1031,19 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
965
1031
|
toolbarActions,
|
|
966
1032
|
locale: localeProp,
|
|
967
1033
|
onCreate
|
|
968
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1034
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime5.JSX.Element;
|
|
969
1035
|
//#endregion
|
|
970
1036
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
971
1037
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
972
1038
|
schema: T;
|
|
973
1039
|
initialValues?: Partial<z.infer<T>>;
|
|
974
1040
|
onSubmit: (values: z.infer<T>) => void | Promise<void>;
|
|
1041
|
+
/** 统一字段配置,推荐用于描述 auto-crud 字段级表单行为 */
|
|
1042
|
+
fields?: Fields;
|
|
1043
|
+
/** Formily 字段 schema 覆盖配置,保留兼容旧 API */
|
|
975
1044
|
overrides?: FormSchemaOverrides;
|
|
1045
|
+
/** Formily schema expression/reaction scope */
|
|
1046
|
+
scope?: JsonSchemaFormScope;
|
|
976
1047
|
mode?: 'create' | 'edit';
|
|
977
1048
|
loading?: boolean;
|
|
978
1049
|
gridColumns?: number;
|
|
@@ -990,14 +1061,16 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
990
1061
|
schema: zodSchema,
|
|
991
1062
|
initialValues,
|
|
992
1063
|
onSubmit,
|
|
1064
|
+
fields,
|
|
993
1065
|
overrides,
|
|
1066
|
+
scope: scopeProp,
|
|
994
1067
|
mode,
|
|
995
1068
|
loading,
|
|
996
1069
|
gridColumns,
|
|
997
1070
|
labelAlign,
|
|
998
1071
|
labelWidth,
|
|
999
1072
|
showSubmitButton
|
|
1000
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1073
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime5.JSX.Element;
|
|
1001
1074
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1002
1075
|
ref?: React.Ref<AutoFormRef>;
|
|
1003
1076
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1211,12 +1284,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1211
1284
|
variant: z.ZodEnum<{
|
|
1212
1285
|
number: "number";
|
|
1213
1286
|
boolean: "boolean";
|
|
1214
|
-
date: "date";
|
|
1215
1287
|
text: "text";
|
|
1288
|
+
range: "range";
|
|
1289
|
+
date: "date";
|
|
1290
|
+
dateRange: "dateRange";
|
|
1216
1291
|
select: "select";
|
|
1217
1292
|
multiSelect: "multiSelect";
|
|
1218
|
-
dateRange: "dateRange";
|
|
1219
|
-
range: "range";
|
|
1220
1293
|
}>;
|
|
1221
1294
|
operator: z.ZodEnum<{
|
|
1222
1295
|
iLike: "iLike";
|
|
@@ -1255,6 +1328,20 @@ declare module '@tanstack/react-table' {
|
|
|
1255
1328
|
icon?: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
1256
1329
|
/** 控制在哪些筛选模式下显示(未设置则在所有模式显示) */
|
|
1257
1330
|
modes?: Array<'simple' | 'advanced' | 'command'>;
|
|
1331
|
+
/** 内部:远程筛选选项搜索值 */
|
|
1332
|
+
autoCrudFilterSearchValue?: string;
|
|
1333
|
+
/** 内部:远程筛选选项搜索回调 */
|
|
1334
|
+
autoCrudFilterOnSearch?: (value: string) => void;
|
|
1335
|
+
/** 内部:是否启用本地选项过滤 */
|
|
1336
|
+
autoCrudFilterShouldFilter?: boolean;
|
|
1337
|
+
/** 内部:远程筛选当前弹窗选项,和稳定标签缓存分离 */
|
|
1338
|
+
autoCrudFilterOptions?: Option[];
|
|
1339
|
+
/** 内部:远程筛选是否还有更多选项 */
|
|
1340
|
+
autoCrudFilterHasMore?: boolean;
|
|
1341
|
+
/** 内部:远程筛选是否正在加载 */
|
|
1342
|
+
autoCrudFilterLoading?: boolean;
|
|
1343
|
+
/** 内部:远程筛选弹窗滚动回调 */
|
|
1344
|
+
autoCrudFilterOnPopupScroll?: React.UIEventHandler<HTMLElement>;
|
|
1258
1345
|
}
|
|
1259
1346
|
}
|
|
1260
1347
|
interface QueryKeys {
|
|
@@ -1299,7 +1386,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1299
1386
|
filters: externalFilters,
|
|
1300
1387
|
onFiltersChange,
|
|
1301
1388
|
leading
|
|
1302
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1389
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime5.JSX.Element | null;
|
|
1303
1390
|
//#endregion
|
|
1304
1391
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1305
1392
|
type ModalVariant = "dialog" | "sheet";
|
|
@@ -1308,18 +1395,19 @@ type ModalVariant = "dialog" | "sheet";
|
|
|
1308
1395
|
interface CrudFormModalProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
1309
1396
|
open: boolean;
|
|
1310
1397
|
onOpenChange: (open: boolean) => void;
|
|
1311
|
-
mode:
|
|
1398
|
+
mode: 'create' | 'edit';
|
|
1312
1399
|
schema: T;
|
|
1313
1400
|
initialValues?: Partial<z.infer<T>>;
|
|
1314
1401
|
onSubmit: (values: z.infer<T>) => void | Promise<void>;
|
|
1315
1402
|
loading?: boolean;
|
|
1316
1403
|
variant?: ModalVariant;
|
|
1317
1404
|
overrides?: FormSchemaOverrides;
|
|
1405
|
+
scope?: JsonSchemaFormScope;
|
|
1318
1406
|
title?: string;
|
|
1319
|
-
locale?: AutoCrudLocale[
|
|
1407
|
+
locale?: AutoCrudLocale['formModal'];
|
|
1320
1408
|
gridColumns?: number;
|
|
1321
1409
|
/** Label 对齐方式 */
|
|
1322
|
-
labelAlign?:
|
|
1410
|
+
labelAlign?: 'left' | 'top' | 'right';
|
|
1323
1411
|
/** Label 宽度(labelAlign 为 left 时有效) */
|
|
1324
1412
|
labelWidth?: number | string;
|
|
1325
1413
|
/** 弹窗自定义样式 */
|
|
@@ -1335,13 +1423,14 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1335
1423
|
loading,
|
|
1336
1424
|
variant,
|
|
1337
1425
|
overrides,
|
|
1426
|
+
scope,
|
|
1338
1427
|
title,
|
|
1339
1428
|
locale,
|
|
1340
1429
|
gridColumns,
|
|
1341
1430
|
labelAlign,
|
|
1342
1431
|
labelWidth,
|
|
1343
1432
|
className
|
|
1344
|
-
}: CrudFormModalProps<T>):
|
|
1433
|
+
}: CrudFormModalProps<T>): react_jsx_runtime5.JSX.Element;
|
|
1345
1434
|
//#endregion
|
|
1346
1435
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1347
1436
|
interface ImportDialogProps {
|
|
@@ -1354,7 +1443,7 @@ interface ImportDialogProps {
|
|
|
1354
1443
|
/** 对话框标题(优先于 locale.title) */
|
|
1355
1444
|
title?: string;
|
|
1356
1445
|
/** 语言包,默认 zh-CN */
|
|
1357
|
-
locale?: AutoCrudLocale[
|
|
1446
|
+
locale?: AutoCrudLocale['importDialog'];
|
|
1358
1447
|
}
|
|
1359
1448
|
declare function ImportDialog({
|
|
1360
1449
|
open,
|
|
@@ -1363,7 +1452,7 @@ declare function ImportDialog({
|
|
|
1363
1452
|
columns,
|
|
1364
1453
|
title,
|
|
1365
1454
|
locale
|
|
1366
|
-
}: ImportDialogProps):
|
|
1455
|
+
}: ImportDialogProps): react_jsx_runtime5.JSX.Element;
|
|
1367
1456
|
//#endregion
|
|
1368
1457
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1369
1458
|
type ExportMode = "selected" | "filtered";
|
|
@@ -1383,7 +1472,7 @@ declare function ExportDialog({
|
|
|
1383
1472
|
selectedCount,
|
|
1384
1473
|
onExport,
|
|
1385
1474
|
canExportFiltered
|
|
1386
|
-
}: ExportDialogProps):
|
|
1475
|
+
}: ExportDialogProps): react_jsx_runtime5.JSX.Element;
|
|
1387
1476
|
//#endregion
|
|
1388
1477
|
//#region src/components/data-table/data-table.d.ts
|
|
1389
1478
|
interface DataTableProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1396,7 +1485,7 @@ declare function DataTable<TData>({
|
|
|
1396
1485
|
children,
|
|
1397
1486
|
className,
|
|
1398
1487
|
...props
|
|
1399
|
-
}: DataTableProps<TData>):
|
|
1488
|
+
}: DataTableProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1400
1489
|
//#endregion
|
|
1401
1490
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1402
1491
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1407,7 +1496,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1407
1496
|
children,
|
|
1408
1497
|
className,
|
|
1409
1498
|
...props
|
|
1410
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1499
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1411
1500
|
//#endregion
|
|
1412
1501
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1413
1502
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1419,7 +1508,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1419
1508
|
label,
|
|
1420
1509
|
className,
|
|
1421
1510
|
...props
|
|
1422
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1511
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
|
|
1423
1512
|
//#endregion
|
|
1424
1513
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1425
1514
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1433,7 +1522,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1433
1522
|
title,
|
|
1434
1523
|
options,
|
|
1435
1524
|
multiple
|
|
1436
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1525
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime5.JSX.Element;
|
|
1437
1526
|
//#endregion
|
|
1438
1527
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1439
1528
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
@@ -1445,7 +1534,7 @@ declare function DataTablePagination<TData>({
|
|
|
1445
1534
|
pageSizeOptions,
|
|
1446
1535
|
className,
|
|
1447
1536
|
...props
|
|
1448
|
-
}: DataTablePaginationProps<TData>):
|
|
1537
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1449
1538
|
//#endregion
|
|
1450
1539
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1451
1540
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<"div"> {
|
|
@@ -1456,7 +1545,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1456
1545
|
children,
|
|
1457
1546
|
className,
|
|
1458
1547
|
...props
|
|
1459
|
-
}: DataTableToolbarProps<TData>):
|
|
1548
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1460
1549
|
//#endregion
|
|
1461
1550
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1462
1551
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1467,48 +1556,46 @@ declare function DataTableViewOptions<TData>({
|
|
|
1467
1556
|
table,
|
|
1468
1557
|
disabled,
|
|
1469
1558
|
...props
|
|
1470
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1559
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime5.JSX.Element;
|
|
1471
1560
|
//#endregion
|
|
1472
|
-
//#region src/
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
}
|
|
1511
|
-
declare const MultiCombobox: React$1.FC<MultiComboboxProps>;
|
|
1561
|
+
//#region src/lib/crud-actions.d.ts
|
|
1562
|
+
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
|
1563
|
+
type CrudActionBase = {
|
|
1564
|
+
type: string;
|
|
1565
|
+
id?: string;
|
|
1566
|
+
order?: number;
|
|
1567
|
+
hidden?: boolean;
|
|
1568
|
+
position?: 'start' | 'end';
|
|
1569
|
+
};
|
|
1570
|
+
type CrudActionEntry<TAction extends CrudActionBase = CrudActionBase> = {
|
|
1571
|
+
targetId: string;
|
|
1572
|
+
zone: CrudActionZone;
|
|
1573
|
+
ownerId: string;
|
|
1574
|
+
action: TAction;
|
|
1575
|
+
order: number;
|
|
1576
|
+
seq: number;
|
|
1577
|
+
};
|
|
1578
|
+
type CrudActionRegistration<TAction extends CrudActionBase = CrudActionBase> = {
|
|
1579
|
+
targetId: string;
|
|
1580
|
+
zone: CrudActionZone;
|
|
1581
|
+
ownerId: string;
|
|
1582
|
+
actions: readonly TAction[];
|
|
1583
|
+
};
|
|
1584
|
+
type RegistryListener = () => void;
|
|
1585
|
+
declare function unregisterOwnerActions(ownerId: string, options?: {
|
|
1586
|
+
targetId?: string;
|
|
1587
|
+
zone?: CrudActionZone;
|
|
1588
|
+
}, shouldNotify?: boolean): void;
|
|
1589
|
+
declare function resolveActions<TAction extends CrudActionBase>(targetId: string | undefined, zone: CrudActionZone, ownerActions: readonly TAction[]): TAction[];
|
|
1590
|
+
declare const crudActions: {
|
|
1591
|
+
register<TAction extends CrudActionBase>(registration: CrudActionRegistration<TAction>): void;
|
|
1592
|
+
unregister: typeof unregisterOwnerActions;
|
|
1593
|
+
clear(): void;
|
|
1594
|
+
get<TAction extends CrudActionBase>(targetId: string, zone: CrudActionZone): CrudActionEntry<TAction>[];
|
|
1595
|
+
resolve: typeof resolveActions;
|
|
1596
|
+
subscribe(listener: RegistryListener): () => void;
|
|
1597
|
+
getSnapshot(): number;
|
|
1598
|
+
};
|
|
1512
1599
|
//#endregion
|
|
1513
1600
|
//#region src/hooks/use-data-table.d.ts
|
|
1514
1601
|
interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
|
@@ -1844,4 +1931,4 @@ declare function exportAllToCSV<T extends Record<string, unknown>>(data: T[], op
|
|
|
1844
1931
|
*/
|
|
1845
1932
|
declare function downloadCSVTemplate(headers: string[], filename?: string): void;
|
|
1846
1933
|
//#endregion
|
|
1847
|
-
export { type ActionItem, type ActionsColumnConfig, type AutoCrudDataSourceConfig, type AutoCrudDataSourceContext, type AutoCrudDataSourceEntry, type AutoCrudDataSourceLoader, type AutoCrudDataSourceRegistration, type AutoCrudFormComponentConfig, type AutoCrudLocale, type AutoCrudOption, AutoCrudTable, type AutoCrudTableProps, type AutoCrudToolbarContext, type AutoCrudToolbarResolver, AutoForm, 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, 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, SchemaAdapter, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, type ToolbarCustomActionItem, type UnifiedField, type UnifiedSchema, type UrlStateOptions, type UseAutoCrudResourceOptions, type UseAutoCrudResourceParams, type UseAutoCrudResourceReturn, cn, coerceRowValues, components, createActionsColumn, createEditFormSchema, createFormSchema, createMemoryDataSource, createSelectColumn, createTRPCDataSource, createTableSchema, 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 };
|
|
1934
|
+
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, type SimpleFieldConfig, type SimpleFieldsConfig, type ToastAdapter, type ToolbarActionConfig, type ToolbarActionItem, type ToolbarBuiltinActionItem, 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 };
|