imean-service-engine-htmx-plugin 2.6.0 → 2.8.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/dist/index.d.mts +397 -27
- package/dist/index.d.ts +397 -27
- package/dist/index.js +878 -625
- package/dist/index.mjs +866 -626
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
2
|
-
import { z } from '
|
|
3
|
-
import {
|
|
2
|
+
import { z, Plugin, PluginPriority, Microservice } from 'imean-service-engine';
|
|
3
|
+
import { z as z$1 } from 'zod';
|
|
4
4
|
import * as hono_jsx_jsx_dev_runtime from 'hono/jsx/jsx-dev-runtime';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -84,6 +84,39 @@ declare abstract class PageModel {
|
|
|
84
84
|
* HtmxAdminPlugin 核心类型定义
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 操作按钮配置
|
|
89
|
+
*/
|
|
90
|
+
interface ActionButton {
|
|
91
|
+
/** 按钮文本 */
|
|
92
|
+
label: string;
|
|
93
|
+
/** 链接地址(页面模式使用) */
|
|
94
|
+
href?: string;
|
|
95
|
+
/** HTTP 方法 */
|
|
96
|
+
method?: "get" | "post" | "put" | "delete";
|
|
97
|
+
/** 按钮样式 */
|
|
98
|
+
variant?: "primary" | "secondary" | "danger" | "ghost";
|
|
99
|
+
/** HTMX GET 请求(弹窗模式使用) */
|
|
100
|
+
hxGet?: string;
|
|
101
|
+
/** HTMX POST 请求 */
|
|
102
|
+
hxPost?: string;
|
|
103
|
+
/** HTMX PUT 请求 */
|
|
104
|
+
hxPut?: string;
|
|
105
|
+
/** HTMX DELETE 请求 */
|
|
106
|
+
hxDelete?: string;
|
|
107
|
+
/** 确认提示 */
|
|
108
|
+
confirm?: string;
|
|
109
|
+
/** 是否关闭弹窗(设置为 true 时,点击按钮会自动关闭弹窗,无需写代码) */
|
|
110
|
+
close?: boolean;
|
|
111
|
+
/** 是否提交表单(设置为 true 时,按钮会提交指定的表单,需要配合 formId 使用) */
|
|
112
|
+
submit?: boolean;
|
|
113
|
+
/** 表单 ID(当 submit 为 true 时,指定要提交的表单 ID) */
|
|
114
|
+
formId?: string;
|
|
115
|
+
/** 自定义类名 */
|
|
116
|
+
className?: string;
|
|
117
|
+
/** 链接目标(如 "_blank" 表示新窗口打开) */
|
|
118
|
+
target?: string;
|
|
119
|
+
}
|
|
87
120
|
/**
|
|
88
121
|
* 对话框大小类型
|
|
89
122
|
*/
|
|
@@ -167,6 +200,17 @@ interface FieldGroup {
|
|
|
167
200
|
/** 该分组包含的字段名列表 */
|
|
168
201
|
fields: string[];
|
|
169
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* 表单分组配置
|
|
205
|
+
*/
|
|
206
|
+
interface FormGroup {
|
|
207
|
+
/** 分组标签 */
|
|
208
|
+
label: string;
|
|
209
|
+
/** 该分组包含的字段名列表 */
|
|
210
|
+
fields: ModelField[];
|
|
211
|
+
/** 该分组对应的 Zod Schema */
|
|
212
|
+
schema: z.ZodObject<any>;
|
|
213
|
+
}
|
|
170
214
|
/**
|
|
171
215
|
* Feature 类型
|
|
172
216
|
*/
|
|
@@ -390,20 +434,101 @@ interface FormField {
|
|
|
390
434
|
/** HTML input step 属性(用于 number 类型,支持小数) */
|
|
391
435
|
step?: string | number;
|
|
392
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* 字段渲染器属性
|
|
439
|
+
* 统一接口,可在不同 Feature 中复用
|
|
440
|
+
*/
|
|
441
|
+
interface FieldRendererProps<T = any, K extends keyof T = keyof T> {
|
|
442
|
+
/** 字段值 */
|
|
443
|
+
value: T[K];
|
|
444
|
+
/** 完整的初始数据项 */
|
|
445
|
+
item: Partial<T>;
|
|
446
|
+
/** 字段名 */
|
|
447
|
+
name: string;
|
|
448
|
+
/** 字段标签(没有会使用name的值作为标签) */
|
|
449
|
+
label: string;
|
|
450
|
+
}
|
|
393
451
|
/**
|
|
394
452
|
* 表单字段渲染器属性
|
|
395
453
|
* 统一接口,可在不同 Feature 中复用
|
|
396
454
|
*/
|
|
397
|
-
interface FormFieldRendererProps<T = any> {
|
|
455
|
+
interface FormFieldRendererProps<T = any, K extends keyof T = keyof T> extends FieldRendererProps<T, K> {
|
|
398
456
|
/** 字段定义 */
|
|
399
457
|
field: FormField;
|
|
400
|
-
/** 当前值(已解析的对象/数组,不是 JSON 字符串) */
|
|
401
|
-
value: any;
|
|
402
|
-
/** 完整的初始数据项(用于编辑模式,包含所有字段的完整数据) */
|
|
403
|
-
item?: Partial<T>;
|
|
404
|
-
/** 字段名(用于更新隐藏字段) */
|
|
405
|
-
name: string;
|
|
406
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* 字段渲染器
|
|
461
|
+
* 用于渲染字段,可用于自定义渲染器
|
|
462
|
+
*/
|
|
463
|
+
interface FieldRenderer<T extends FieldRendererProps = FieldRendererProps> {
|
|
464
|
+
(props: T): any;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* 表单字段渲染器类型别名
|
|
468
|
+
* 用于统一表单字段渲染器的类型定义
|
|
469
|
+
* 支持字段名泛型,可以根据字段名推导出对应的值类型
|
|
470
|
+
*/
|
|
471
|
+
type FormFieldRenderer<T = any, K extends keyof T = keyof T> = FieldRenderer<FormFieldRendererProps<T, K>>;
|
|
472
|
+
/**
|
|
473
|
+
* 表单字段渲染器映射类型
|
|
474
|
+
* 根据字段名自动推导对应的值类型,并严格约束 key 只能是 T 的字段名
|
|
475
|
+
*
|
|
476
|
+
* 使用方式:
|
|
477
|
+
* ```typescript
|
|
478
|
+
* formFieldRenderers: {
|
|
479
|
+
* banners: (props) => {
|
|
480
|
+
* // props.value 自动推导为 T["banners"] 类型
|
|
481
|
+
* return <BannerEditor {...props} value={props.value} />;
|
|
482
|
+
* }
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*
|
|
486
|
+
* TypeScript 会根据字段名自动推导对应的值类型,无需手动添加类型注解
|
|
487
|
+
* key 约束:只能使用 T 中存在的字段名,拼写错误会被 TypeScript 检查出来
|
|
488
|
+
* 例如:如果写成了 "tgas" 而不是 "tags",TypeScript 会报错
|
|
489
|
+
*
|
|
490
|
+
* 注意:为了支持类型推导,移除了索引签名,运行时访问字符串键时需要使用类型断言
|
|
491
|
+
*/
|
|
492
|
+
/**
|
|
493
|
+
* 表单字段渲染器映射类型
|
|
494
|
+
* 根据字段名自动推导对应的值类型,并严格约束 key 只能是 T 的字段名
|
|
495
|
+
*
|
|
496
|
+
* 使用方式:
|
|
497
|
+
* ```typescript
|
|
498
|
+
* formFieldRenderers: {
|
|
499
|
+
* banners: (props) => {
|
|
500
|
+
* // props.value 自动推导为 T["banners"] 类型
|
|
501
|
+
* return <BannerEditor {...props} value={props.value} />;
|
|
502
|
+
* }
|
|
503
|
+
* }
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* TypeScript 会根据字段名自动推导对应的值类型,无需手动添加类型注解
|
|
507
|
+
* key 约束:只能使用 T 中存在的字段名,拼写错误会被 TypeScript 检查出来
|
|
508
|
+
* 例如:如果写成了 "tgas" 而不是 "tags",TypeScript 会报错
|
|
509
|
+
*
|
|
510
|
+
* 注意:为了支持类型推导,移除了索引签名,运行时访问字符串键时需要使用类型断言
|
|
511
|
+
*/
|
|
512
|
+
type FormFieldRendererMap<T = any> = {
|
|
513
|
+
[K in keyof T]?: FormFieldRenderer<T, K>;
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* 字段渲染器类型别名(用于详情页等非表单场景)
|
|
517
|
+
* 用于统一字段渲染器的类型定义
|
|
518
|
+
* 支持字段名泛型,可以根据字段名推导出对应的值类型
|
|
519
|
+
*/
|
|
520
|
+
type FieldRendererType<T = any, K extends keyof T = keyof T> = FieldRenderer<FieldRendererProps<T, K>>;
|
|
521
|
+
/**
|
|
522
|
+
* 字段渲染器映射类型
|
|
523
|
+
* 根据字段名自动推导对应的值类型
|
|
524
|
+
* 使用 Record 类型保持兼容性,但在使用时可以通过类型断言获得字段级别的类型推导
|
|
525
|
+
*
|
|
526
|
+
* 注意:在使用时,TypeScript 会根据字段名自动推导对应的值类型
|
|
527
|
+
* 例如:fieldRenderers.banners 的类型会被推导为 FieldRendererType<T, "banners">
|
|
528
|
+
*/
|
|
529
|
+
type FieldRendererTypeMap<T = any> = {
|
|
530
|
+
[K in keyof T]?: FieldRendererType<T, K>;
|
|
531
|
+
} & Record<string, FieldRendererType<T, any> | undefined> & Partial<Record<keyof T, FieldRendererType<T, keyof T>>>;
|
|
407
532
|
|
|
408
533
|
/**
|
|
409
534
|
* Feature 基类
|
|
@@ -426,15 +551,16 @@ declare abstract class BaseFeature implements Feature {
|
|
|
426
551
|
/** 是否允许点击遮罩区域关闭弹窗(默认 true,设置为 false 时只能通过关闭按钮关闭) */
|
|
427
552
|
closeOnBackdropClick?: boolean;
|
|
428
553
|
/** Schema(可选,由子类在构造函数中设置) */
|
|
429
|
-
protected schema
|
|
554
|
+
protected schema: z$1.ZodObject<any>;
|
|
430
555
|
/** 解析后的字段列表(可选,由子类在构造函数中设置) */
|
|
431
|
-
protected fields
|
|
556
|
+
protected fields: ModelField[];
|
|
432
557
|
constructor(options: {
|
|
433
558
|
name: string;
|
|
434
559
|
type: FeatureType;
|
|
435
560
|
permission: string | null;
|
|
436
561
|
dialogSize?: DialogSize;
|
|
437
562
|
closeOnBackdropClick?: boolean;
|
|
563
|
+
schema?: z$1.ZodObject<any>;
|
|
438
564
|
});
|
|
439
565
|
/**
|
|
440
566
|
* 获取动态标题(默认实现:返回 PageMetadata 的 title)
|
|
@@ -468,6 +594,11 @@ declare abstract class BaseFeature implements Feature {
|
|
|
468
594
|
render?(context: FeatureContext): Promise<any>;
|
|
469
595
|
}
|
|
470
596
|
|
|
597
|
+
/**
|
|
598
|
+
* 表单 Feature 基类
|
|
599
|
+
* 提供创建和编辑 Feature 的公共逻辑
|
|
600
|
+
*/
|
|
601
|
+
|
|
471
602
|
/**
|
|
472
603
|
* 表单操作类型
|
|
473
604
|
*/
|
|
@@ -484,7 +615,9 @@ declare abstract class BaseFormFeature<T extends {
|
|
|
484
615
|
/** 当前请求的表单 ID(用于在 render 和 getActions 之间共享) */
|
|
485
616
|
private currentFormId?;
|
|
486
617
|
/** 自定义表单字段渲染器 */
|
|
487
|
-
protected formFieldRenderers?:
|
|
618
|
+
protected formFieldRenderers?: {
|
|
619
|
+
[K in keyof T]?: FormFieldRenderer<T, K>;
|
|
620
|
+
};
|
|
488
621
|
/**
|
|
489
622
|
* 获取或生成表单 ID(确保在同一个请求中保持一致)
|
|
490
623
|
*/
|
|
@@ -497,6 +630,7 @@ declare abstract class BaseFormFeature<T extends {
|
|
|
497
630
|
closeOnBackdropClick?: boolean;
|
|
498
631
|
getTitle?: (context: FeatureContext, item?: T) => string | Promise<string>;
|
|
499
632
|
getDescription?: (context: FeatureContext, item?: T) => string | Promise<string> | undefined;
|
|
633
|
+
schema?: z.ZodObject<any>;
|
|
500
634
|
});
|
|
501
635
|
/**
|
|
502
636
|
* 获取表单操作类型
|
|
@@ -591,6 +725,10 @@ declare class CustomFeature extends BaseFeature {
|
|
|
591
725
|
render(context: FeatureContext): Promise<any>;
|
|
592
726
|
}
|
|
593
727
|
|
|
728
|
+
/**
|
|
729
|
+
* 默认创建 Feature
|
|
730
|
+
*/
|
|
731
|
+
|
|
594
732
|
/**
|
|
595
733
|
* 默认创建 Feature
|
|
596
734
|
* 类型通过 schema 的 z.infer 推断
|
|
@@ -601,7 +739,7 @@ declare class DefaultCreateFeature<T extends {
|
|
|
601
739
|
private createItem;
|
|
602
740
|
constructor(options: {
|
|
603
741
|
/** 表单数据的 Schema(用于验证和字段推断) */
|
|
604
|
-
schema: z.ZodObject<any>;
|
|
742
|
+
schema: z$1.ZodObject<any>;
|
|
605
743
|
createItem: (data: Partial<T>) => Promise<T>;
|
|
606
744
|
permissionPrefix: string;
|
|
607
745
|
permission?: string;
|
|
@@ -616,7 +754,7 @@ declare class DefaultCreateFeature<T extends {
|
|
|
616
754
|
/** 字段分组配置(可选,用于将字段分组展示为 Tab) */
|
|
617
755
|
groups?: FieldGroup[];
|
|
618
756
|
/** 自定义表单字段渲染器 */
|
|
619
|
-
formFieldRenderers?:
|
|
757
|
+
formFieldRenderers?: FormFieldRendererMap<T>;
|
|
620
758
|
});
|
|
621
759
|
getFormAction(): "create";
|
|
622
760
|
getRoutes(): ({
|
|
@@ -676,7 +814,7 @@ declare class DefaultDetailFeature<T extends {
|
|
|
676
814
|
private groups?;
|
|
677
815
|
constructor(options: {
|
|
678
816
|
/** 详情数据的 Schema(用于字段推断和显示) */
|
|
679
|
-
schema: z.ZodObject<any>;
|
|
817
|
+
schema: z$1.ZodObject<any>;
|
|
680
818
|
getItem: (id: string | number) => Promise<T | null>;
|
|
681
819
|
permissionPrefix: string;
|
|
682
820
|
permission?: string;
|
|
@@ -689,7 +827,7 @@ declare class DefaultDetailFeature<T extends {
|
|
|
689
827
|
/** 详情显示字段名(可选,不提供则显示 schema 中的所有字段) */
|
|
690
828
|
detailFieldNames?: string[];
|
|
691
829
|
/** 自定义字段渲染函数(可选,key 为字段名,value 为渲染函数) */
|
|
692
|
-
fieldRenderers?:
|
|
830
|
+
fieldRenderers?: FieldRendererTypeMap<T>;
|
|
693
831
|
/** 字段分组配置(可选,用于将字段分组展示为卡片) */
|
|
694
832
|
groups?: FieldGroup[];
|
|
695
833
|
});
|
|
@@ -703,6 +841,10 @@ declare class DefaultDetailFeature<T extends {
|
|
|
703
841
|
getActions(context: FeatureContext): Promise<any>;
|
|
704
842
|
}
|
|
705
843
|
|
|
844
|
+
/**
|
|
845
|
+
* 默认编辑 Feature
|
|
846
|
+
*/
|
|
847
|
+
|
|
706
848
|
/**
|
|
707
849
|
* 默认编辑 Feature
|
|
708
850
|
* 类型通过 schema 的 z.infer 推断
|
|
@@ -714,7 +856,7 @@ declare class DefaultEditFeature<T extends {
|
|
|
714
856
|
private updateItem;
|
|
715
857
|
constructor(options: {
|
|
716
858
|
/** 表单数据的 Schema(用于验证和字段推断) */
|
|
717
|
-
schema: z.ZodObject<any>;
|
|
859
|
+
schema: z$1.ZodObject<any>;
|
|
718
860
|
getItem: (id: string | number) => Promise<T | null>;
|
|
719
861
|
updateItem: (id: string | number, data: Partial<T>) => Promise<T | null>;
|
|
720
862
|
permissionPrefix: string;
|
|
@@ -730,7 +872,7 @@ declare class DefaultEditFeature<T extends {
|
|
|
730
872
|
/** 字段分组配置(可选,用于将字段分组展示为 Tab) */
|
|
731
873
|
groups?: FieldGroup[];
|
|
732
874
|
/** 自定义表单字段渲染器 */
|
|
733
|
-
formFieldRenderers?:
|
|
875
|
+
formFieldRenderers?: FormFieldRendererMap<T>;
|
|
734
876
|
});
|
|
735
877
|
getFormAction(): "edit";
|
|
736
878
|
getRoutes(): ({
|
|
@@ -770,7 +912,7 @@ declare class DefaultListFeature<T extends {
|
|
|
770
912
|
private openMode?;
|
|
771
913
|
constructor(options: {
|
|
772
914
|
/** 列表数据的 Schema(用于字段推断和显示) */
|
|
773
|
-
schema: z.ZodObject<any>;
|
|
915
|
+
schema: z$1.ZodObject<any>;
|
|
774
916
|
/** 获取列表数据的函数 */
|
|
775
917
|
getList: (params: ListParams) => Promise<ListResult<T>>;
|
|
776
918
|
/** 删除数据的函数(可选,不提供则列表不显示删除操作) */
|
|
@@ -786,9 +928,9 @@ declare class DefaultListFeature<T extends {
|
|
|
786
928
|
/** 列表显示字段名(可选,不提供则显示 schema 中的所有字段) */
|
|
787
929
|
listFieldNames?: string[];
|
|
788
930
|
/** 筛选表单的 Schema(可选,不提供则不显示筛选表单) */
|
|
789
|
-
filterSchema?: z.ZodObject<any>;
|
|
790
|
-
/**
|
|
791
|
-
columnRenderers?:
|
|
931
|
+
filterSchema?: z$1.ZodObject<any>;
|
|
932
|
+
/** 自定义列渲染器(可选,使用统一的 FieldRendererTypeMap 接口) */
|
|
933
|
+
columnRenderers?: FieldRendererTypeMap<T>;
|
|
792
934
|
/** 打开方式配置(可选,默认为 dialog)
|
|
793
935
|
* - create: 新建按钮的打开方式(默认 "dialog")
|
|
794
936
|
* - detail: 查看按钮的打开方式(默认 "dialog")
|
|
@@ -935,17 +1077,213 @@ interface ErrorAlertProps {
|
|
|
935
1077
|
*/
|
|
936
1078
|
declare function ErrorAlert(props: ErrorAlertProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
937
1079
|
|
|
1080
|
+
interface FilterFormProps {
|
|
1081
|
+
/** 筛选字段 */
|
|
1082
|
+
fields: FormField[];
|
|
1083
|
+
/** 列表路径(用于提交筛选表单) */
|
|
1084
|
+
listPath: string;
|
|
1085
|
+
/** 当前筛选参数 */
|
|
1086
|
+
currentFilters?: Record<string, any>;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* 筛选表单组件
|
|
1090
|
+
*/
|
|
1091
|
+
declare function FilterForm(props: FilterFormProps): hono_jsx_jsx_dev_runtime.JSX.Element | null;
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* 面包屑组件
|
|
1095
|
+
*/
|
|
1096
|
+
interface BreadcrumbItem {
|
|
1097
|
+
label: string;
|
|
1098
|
+
href?: string;
|
|
1099
|
+
}
|
|
1100
|
+
interface BreadcrumbProps {
|
|
1101
|
+
items: BreadcrumbItem[];
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* 面包屑组件
|
|
1105
|
+
*/
|
|
1106
|
+
declare function Breadcrumb(props: BreadcrumbProps): hono_jsx_jsx_dev_runtime.JSX.Element | null;
|
|
1107
|
+
|
|
1108
|
+
interface HeaderProps {
|
|
1109
|
+
/** 面包屑项 */
|
|
1110
|
+
breadcrumbs?: BreadcrumbItem[];
|
|
1111
|
+
/** 用户信息 */
|
|
1112
|
+
userInfo?: UserInfo | null;
|
|
1113
|
+
/** 退出登录的URL */
|
|
1114
|
+
logoutUrl?: string;
|
|
1115
|
+
/** 页面标题(当没有面包屑时显示) */
|
|
1116
|
+
title?: string;
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* 头部组件
|
|
1120
|
+
*/
|
|
1121
|
+
declare function Header(props: HeaderProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1122
|
+
|
|
938
1123
|
/**
|
|
939
1124
|
* 加载条组件
|
|
940
1125
|
* 用于显示 HTMX 请求的加载状态
|
|
941
1126
|
*/
|
|
942
1127
|
declare function LoadingBar(): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
943
1128
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1129
|
+
/**
|
|
1130
|
+
* 表格组件
|
|
1131
|
+
*/
|
|
1132
|
+
/**
|
|
1133
|
+
* 表格组件 Props
|
|
1134
|
+
*/
|
|
1135
|
+
interface TableProps<T = any> {
|
|
1136
|
+
/** 数据列表 */
|
|
1137
|
+
items: T[];
|
|
1138
|
+
/** 列定义 */
|
|
1139
|
+
columns: Array<{
|
|
1140
|
+
key: string;
|
|
1141
|
+
label: string;
|
|
1142
|
+
render?: (value: any, item: T) => any;
|
|
1143
|
+
}>;
|
|
1144
|
+
/** 操作列 */
|
|
1145
|
+
actions?: Array<{
|
|
1146
|
+
label: string;
|
|
1147
|
+
href: (item: T) => string;
|
|
1148
|
+
method?: string;
|
|
1149
|
+
class?: string;
|
|
1150
|
+
target?: string;
|
|
1151
|
+
}>;
|
|
1152
|
+
/** 分页信息 */
|
|
1153
|
+
pagination?: {
|
|
1154
|
+
page: number;
|
|
1155
|
+
pageSize: number;
|
|
1156
|
+
total: number;
|
|
1157
|
+
totalPages: number;
|
|
1158
|
+
baseUrl: string;
|
|
1159
|
+
currentParams?: Record<string, string | number | undefined>;
|
|
1160
|
+
};
|
|
1161
|
+
/** 表格标题 */
|
|
1162
|
+
title?: string;
|
|
1163
|
+
/** 表格操作按钮(如导出、清空、刷新等) */
|
|
1164
|
+
tableActions?: Array<{
|
|
1165
|
+
label: string;
|
|
1166
|
+
href?: string;
|
|
1167
|
+
hxGet?: string;
|
|
1168
|
+
hxPost?: string;
|
|
1169
|
+
hxDelete?: string;
|
|
1170
|
+
variant?: "primary" | "secondary" | "danger" | "ghost";
|
|
1171
|
+
hxConfirm?: string;
|
|
1172
|
+
}>;
|
|
1173
|
+
/** 操作列样式(link 或 button) */
|
|
1174
|
+
actionStyle?: "link" | "button";
|
|
947
1175
|
}
|
|
948
|
-
|
|
1176
|
+
/**
|
|
1177
|
+
* 表格组件
|
|
1178
|
+
*/
|
|
1179
|
+
declare function Table<T extends {
|
|
1180
|
+
id: string | number;
|
|
1181
|
+
}>(props: TableProps<T>): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* 分页组件
|
|
1185
|
+
*/
|
|
1186
|
+
interface PaginationProps {
|
|
1187
|
+
/** 当前页码 */
|
|
1188
|
+
page: number;
|
|
1189
|
+
/** 每页数量 */
|
|
1190
|
+
pageSize: number;
|
|
1191
|
+
/** 总记录数 */
|
|
1192
|
+
total: number;
|
|
1193
|
+
/** 总页数 */
|
|
1194
|
+
totalPages: number;
|
|
1195
|
+
/** 基础 URL */
|
|
1196
|
+
baseUrl: string;
|
|
1197
|
+
/** 当前查询参数(用于保留筛选条件等) */
|
|
1198
|
+
currentParams?: Record<string, string | number | undefined>;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* 分页组件
|
|
1202
|
+
*/
|
|
1203
|
+
declare function Pagination(props: PaginationProps): hono_jsx_jsx_dev_runtime.JSX.Element | null;
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* 卡片组件
|
|
1207
|
+
*/
|
|
1208
|
+
interface CardProps {
|
|
1209
|
+
/** 卡片内容 */
|
|
1210
|
+
children: any;
|
|
1211
|
+
/** 卡片标题 */
|
|
1212
|
+
title?: string;
|
|
1213
|
+
/** 自定义类名 */
|
|
1214
|
+
className?: string;
|
|
1215
|
+
/** 是否显示阴影 */
|
|
1216
|
+
shadow?: boolean;
|
|
1217
|
+
/** 是否显示边框 */
|
|
1218
|
+
bordered?: boolean;
|
|
1219
|
+
/** 是否去掉内边距 */
|
|
1220
|
+
noPadding?: boolean;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* 卡片组件
|
|
1224
|
+
*/
|
|
1225
|
+
declare function Card(props: CardProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* 空状态组件
|
|
1229
|
+
*/
|
|
1230
|
+
interface EmptyStateProps {
|
|
1231
|
+
/** 提示文本 */
|
|
1232
|
+
message?: string;
|
|
1233
|
+
/** 自定义内容 */
|
|
1234
|
+
children?: any;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* 空状态组件
|
|
1238
|
+
*/
|
|
1239
|
+
declare function EmptyState(props: EmptyStateProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* 按钮组件
|
|
1243
|
+
* 只负责样式,其他属性(如 HTMX 属性)通过解构动态传递
|
|
1244
|
+
*/
|
|
1245
|
+
interface ButtonProps {
|
|
1246
|
+
/** 按钮文本 */
|
|
1247
|
+
children: any;
|
|
1248
|
+
/** 按钮类型 */
|
|
1249
|
+
variant?: "primary" | "secondary" | "danger" | "ghost";
|
|
1250
|
+
/** 按钮大小 */
|
|
1251
|
+
size?: "sm" | "md" | "lg";
|
|
1252
|
+
/** 是否禁用 */
|
|
1253
|
+
disabled?: boolean;
|
|
1254
|
+
/** 自定义类名 */
|
|
1255
|
+
className?: string;
|
|
1256
|
+
/** 其他属性(包括 HTMX 属性、href 等) */
|
|
1257
|
+
[key: string]: any;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* 按钮组件
|
|
1261
|
+
* 只负责样式,其他属性通过解构动态传递
|
|
1262
|
+
*/
|
|
1263
|
+
declare function Button(props: ButtonProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1264
|
+
|
|
1265
|
+
interface PermissionDeniedContentProps {
|
|
1266
|
+
/** 操作ID(权限标识) */
|
|
1267
|
+
operationId?: string;
|
|
1268
|
+
/** 请求路径 */
|
|
1269
|
+
fromPath?: string;
|
|
1270
|
+
/** 错误消息 */
|
|
1271
|
+
message?: string;
|
|
1272
|
+
/** 用户信息 */
|
|
1273
|
+
userInfo?: UserInfo | null;
|
|
1274
|
+
/** 插件选项 */
|
|
1275
|
+
pluginOptions?: HtmxAdminPluginOptions;
|
|
1276
|
+
/** 是否在弹框中显示(用于 HTMX 请求) */
|
|
1277
|
+
isDialog?: boolean;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* 权限提示内容组件(用于弹框或页面)
|
|
1281
|
+
*/
|
|
1282
|
+
declare function PermissionDeniedContent(props: PermissionDeniedContentProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1283
|
+
/**
|
|
1284
|
+
* 权限提示页面组件(完整页面,用于整页加载)
|
|
1285
|
+
*/
|
|
1286
|
+
declare function PermissionDeniedPage(props: PermissionDeniedContentProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
949
1287
|
|
|
950
1288
|
interface StringArrayEditorProps extends FormFieldRendererProps {
|
|
951
1289
|
/** 占位符文本(可选) */
|
|
@@ -973,6 +1311,38 @@ interface TagsEditorProps extends FormFieldRendererProps {
|
|
|
973
1311
|
*/
|
|
974
1312
|
declare function TagsEditor(props: TagsEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
975
1313
|
|
|
1314
|
+
interface ObjectEditorProps extends FormFieldRendererProps {
|
|
1315
|
+
/** 对象的 Zod schema(用于自动渲染结构) */
|
|
1316
|
+
objectSchema?: z$1.ZodObject<any>;
|
|
1317
|
+
}
|
|
1318
|
+
declare function ObjectEditor(props: ObjectEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* 详情页字段渲染器
|
|
1322
|
+
* 根据字段类型和值类型智能渲染字段值
|
|
1323
|
+
*/
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* 默认详情字段渲染器
|
|
1327
|
+
* 根据字段类型和值类型选择渲染方式
|
|
1328
|
+
*/
|
|
1329
|
+
declare function DetailFieldRenderer<T = any, K extends keyof T = keyof T>(props: FieldRendererProps<T, K> & {
|
|
1330
|
+
/** 字段定义(可选,用于根据字段类型渲染) */
|
|
1331
|
+
field?: ModelField;
|
|
1332
|
+
}): any;
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* 列表列渲染器
|
|
1336
|
+
* 根据字段类型和值类型智能渲染列值
|
|
1337
|
+
* 列表列渲染通常比详情页更简洁
|
|
1338
|
+
*/
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* 默认列渲染器
|
|
1342
|
+
* 根据字段类型和值类型选择渲染方式
|
|
1343
|
+
*/
|
|
1344
|
+
declare function ColumnRenderer(value: any, field?: ModelField): any;
|
|
1345
|
+
|
|
976
1346
|
/**
|
|
977
1347
|
* 可拖拽排序列表组件
|
|
978
1348
|
* 使用 HTML5 原生拖放 API 实现拖拽排序
|
|
@@ -1010,4 +1380,4 @@ interface SortableListProps {
|
|
|
1010
1380
|
*/
|
|
1011
1381
|
declare function SortableList(props: SortableListProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1012
1382
|
|
|
1013
|
-
export { type AuthProvider, BaseFeature, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, type DialogProps, type DialogSize, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldMetadata, HtmxAdminPlugin, type HtmxAdminPluginOptions, type ListParams, type ListResult, LoadingBar, type NavItemConfig, type Notification, type NotificationType, ObjectEditor, type ObjectEditorProps, type PageMetadata, PageModel, type PermissionResult, SortableList, StringArrayEditor, type StringArrayEditorProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
|
|
1383
|
+
export { type ActionButton, type AuthProvider, BaseFeature, BaseFormFeature, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Card, type CardProps, ColumnRenderer, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, DetailFieldRenderer, Dialog, type DialogProps, type DialogSize, EmptyState, type EmptyStateProps, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldGroup, type FieldMetadata, type FieldRenderer, type FieldRendererProps, type FieldRendererType, type FieldRendererTypeMap, FilterForm, type FormAction, type FormField, type FormFieldRenderer, type FormFieldRendererMap, type FormFieldRendererProps, type FormGroup, Header, type HeaderProps, HtmxAdminPlugin, type HtmxAdminPluginOptions, type ListParams, type ListResult, LoadingBar, type ModelField, type NavItemConfig, type Notification, type NotificationType$1 as NotificationType, ObjectEditor, type ObjectEditorProps, type OpenMode, type PageMetadata, PageModel, Pagination, type PaginationProps, PermissionDeniedContent, type PermissionDeniedContentProps, PermissionDeniedPage, type PermissionResult, type ResolvedHtmxAdminPluginOptions, SortableList, type SortableListProps, StringArrayEditor, type StringArrayEditorProps, Table, type TableProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
|