imean-service-engine-htmx-plugin 2.4.0 → 2.6.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 +50 -106
- package/dist/index.d.ts +50 -106
- package/dist/index.js +287 -580
- package/dist/index.mjs +287 -577
- package/docs/README.md +0 -38
- package/package.json +1 -1
- package/docs/alpinejs-interactive-components.md +0 -653
- package/docs/custom-form-field-renderers.md +0 -541
- package/docs/field-editor-best-practices.md +0 -320
- package/docs/hono-html-best-practices.md +0 -509
package/dist/index.d.mts
CHANGED
|
@@ -3,55 +3,6 @@ import { z } from 'zod';
|
|
|
3
3
|
import { Plugin, PluginPriority, Microservice } from 'imean-service-engine';
|
|
4
4
|
import * as hono_jsx_jsx_dev_runtime from 'hono/jsx/jsx-dev-runtime';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* 组件系统上下文
|
|
8
|
-
* 提供渲染上下文和组件上下文
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare class RenderContext<TProps = any, TState = any> {
|
|
12
|
-
readonly prefix: string;
|
|
13
|
-
readonly instanceId: string;
|
|
14
|
-
readonly componentName: string;
|
|
15
|
-
constructor(prefix: string, instanceId: string, componentName: string);
|
|
16
|
-
$id(): string;
|
|
17
|
-
setState(state: Partial<TState>): void;
|
|
18
|
-
get state(): TState;
|
|
19
|
-
get props(): TProps;
|
|
20
|
-
url(methodName: string, params?: Record<string, any>): string;
|
|
21
|
-
callMethod(methodName: string, params: Record<string, string>): any;
|
|
22
|
-
}
|
|
23
|
-
declare class ComponentContext extends RenderContext {
|
|
24
|
-
readonly ctx: Context;
|
|
25
|
-
constructor(prefix: string, ctx: Context, componentName: string);
|
|
26
|
-
params(): Promise<Record<string, any>>;
|
|
27
|
-
query(): Record<string, string>;
|
|
28
|
-
body(): Promise<any>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 组件系统核心
|
|
33
|
-
* 提供组件基类、方法装饰器和组件注册功能
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
interface MethodConfig {
|
|
37
|
-
method?: "get" | "post" | "put" | "delete";
|
|
38
|
-
path?: string;
|
|
39
|
-
}
|
|
40
|
-
declare function Method(config?: MethodConfig): (target: any, propertyKey: string, _descriptor: PropertyDescriptor) => void;
|
|
41
|
-
declare abstract class HtmxComponent<TProps = any> {
|
|
42
|
-
readonly name: string;
|
|
43
|
-
prefix: string;
|
|
44
|
-
constructor(name: string);
|
|
45
|
-
readonly Component: (props: TProps) => any;
|
|
46
|
-
protected abstract render(ctx: RenderContext, props: TProps): any;
|
|
47
|
-
getScript?(): any;
|
|
48
|
-
static getMethods(component: HtmxComponent<any>): Map<string, {
|
|
49
|
-
method: "get" | "post" | "put" | "delete";
|
|
50
|
-
path?: string;
|
|
51
|
-
handler: (ctx: ComponentContext) => Promise<Response>;
|
|
52
|
-
}>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
6
|
/**
|
|
56
7
|
* Feature 注册表
|
|
57
8
|
*/
|
|
@@ -396,8 +347,6 @@ interface HtmxAdminPluginOptions {
|
|
|
396
347
|
navigation?: NavItemConfig[];
|
|
397
348
|
/** 认证提供者(用于鉴权和权限控制) */
|
|
398
349
|
authProvider?: AuthProvider;
|
|
399
|
-
/** 组件配置(可选,用于注册组件) */
|
|
400
|
-
components?: HtmxComponent<any>[];
|
|
401
350
|
/** 页面配置(可选,用于注册页面) */
|
|
402
351
|
pages: PageModel[];
|
|
403
352
|
}
|
|
@@ -410,7 +359,7 @@ interface HtmxAdminPluginOptions {
|
|
|
410
359
|
* - 让类型系统更准确地反映实际的数据状态
|
|
411
360
|
* - 减少类型错误和运行时检查
|
|
412
361
|
*/
|
|
413
|
-
type ResolvedHtmxAdminPluginOptions = Required<Pick<HtmxAdminPluginOptions, "title" | "prefix" | "navigation" | "pages"
|
|
362
|
+
type ResolvedHtmxAdminPluginOptions = Required<Pick<HtmxAdminPluginOptions, "title" | "prefix" | "navigation" | "pages">> & Pick<HtmxAdminPluginOptions, "logo" | "homePath" | "authProvider" | "pages">;
|
|
414
363
|
/**
|
|
415
364
|
* 导航项配置
|
|
416
365
|
*/
|
|
@@ -443,16 +392,17 @@ interface FormField {
|
|
|
443
392
|
}
|
|
444
393
|
/**
|
|
445
394
|
* 表单字段渲染器属性
|
|
395
|
+
* 统一接口,可在不同 Feature 中复用
|
|
446
396
|
*/
|
|
447
397
|
interface FormFieldRendererProps<T = any> {
|
|
448
398
|
/** 字段定义 */
|
|
449
399
|
field: FormField;
|
|
450
400
|
/** 当前值(已解析的对象/数组,不是 JSON 字符串) */
|
|
451
401
|
value: any;
|
|
452
|
-
/**
|
|
453
|
-
|
|
402
|
+
/** 完整的初始数据项(用于编辑模式,包含所有字段的完整数据) */
|
|
403
|
+
item?: Partial<T>;
|
|
454
404
|
/** 字段名(用于更新隐藏字段) */
|
|
455
|
-
|
|
405
|
+
name: string;
|
|
456
406
|
}
|
|
457
407
|
|
|
458
408
|
/**
|
|
@@ -874,7 +824,6 @@ declare class HtmxAdminPlugin implements Plugin {
|
|
|
874
824
|
readonly options: ResolvedHtmxAdminPluginOptions;
|
|
875
825
|
private serviceName;
|
|
876
826
|
private pages;
|
|
877
|
-
private componentHandler;
|
|
878
827
|
constructor(options?: HtmxAdminPluginOptions);
|
|
879
828
|
private initPages;
|
|
880
829
|
/**
|
|
@@ -955,6 +904,8 @@ interface DialogProps {
|
|
|
955
904
|
/**
|
|
956
905
|
* 对话框组件
|
|
957
906
|
* 用于在模态框中显示内容,支持 HTMX 交互
|
|
907
|
+
* 支持多开:每个对话框都有唯一 ID,可以同时打开多个对话框
|
|
908
|
+
* 使用 Alpine.js 实现关闭逻辑
|
|
958
909
|
*/
|
|
959
910
|
declare function Dialog(props: DialogProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
960
911
|
|
|
@@ -975,6 +926,8 @@ interface ErrorAlertProps {
|
|
|
975
926
|
className?: string;
|
|
976
927
|
/** 自动关闭时间(毫秒),0 表示不自动关闭 */
|
|
977
928
|
autoClose?: number;
|
|
929
|
+
/** HTMX OOB swap 属性 */
|
|
930
|
+
"hx-swap-oob"?: string;
|
|
978
931
|
}
|
|
979
932
|
/**
|
|
980
933
|
* 错误提示组件
|
|
@@ -988,40 +941,13 @@ declare function ErrorAlert(props: ErrorAlertProps): hono_jsx_jsx_dev_runtime.JS
|
|
|
988
941
|
*/
|
|
989
942
|
declare function LoadingBar(): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
990
943
|
|
|
991
|
-
interface ObjectEditorProps {
|
|
992
|
-
/** 字段定义 */
|
|
993
|
-
field: any;
|
|
994
|
-
/** 当前值(对象,已解析) */
|
|
995
|
-
value: Record<string, any> | null;
|
|
996
|
-
/** 完整的初始数据 */
|
|
997
|
-
initialData?: any;
|
|
998
|
-
/** 字段名(用于更新隐藏字段) */
|
|
999
|
-
fieldName: string;
|
|
944
|
+
interface ObjectEditorProps extends FormFieldRendererProps {
|
|
1000
945
|
/** 对象的 Zod schema(用于自动渲染结构) */
|
|
1001
946
|
objectSchema?: z.ZodObject<any>;
|
|
1002
947
|
}
|
|
1003
948
|
declare function ObjectEditor(props: ObjectEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1004
949
|
|
|
1005
|
-
|
|
1006
|
-
* 字符串数组编辑器组件(Alpine.js 版本)
|
|
1007
|
-
* 使用 Alpine.js 实现纯 JSX 交互式组件
|
|
1008
|
-
*
|
|
1009
|
-
* 设计原则:
|
|
1010
|
-
* - 使用 Alpine.js 的 x-data 定义状态
|
|
1011
|
-
* - 尽量使用声明式语法,避免在 HTML 中写方法
|
|
1012
|
-
* - 使用 x-model、x-show、x-for 等 Alpine.js 指令
|
|
1013
|
-
* - 支持拖放排序(使用 SortableList 组件)
|
|
1014
|
-
* - 表单提交:通过 form-data-processor 自动解析嵌套结构和压缩数组索引
|
|
1015
|
-
*/
|
|
1016
|
-
interface StringArrayEditorProps {
|
|
1017
|
-
/** 字段定义 */
|
|
1018
|
-
field: any;
|
|
1019
|
-
/** 当前值(字符串数组,已解析) */
|
|
1020
|
-
value: string[] | null;
|
|
1021
|
-
/** 完整的初始数据 */
|
|
1022
|
-
initialData?: any;
|
|
1023
|
-
/** 字段名(用于更新隐藏字段) */
|
|
1024
|
-
fieldName: string;
|
|
950
|
+
interface StringArrayEditorProps extends FormFieldRendererProps {
|
|
1025
951
|
/** 占位符文本(可选) */
|
|
1026
952
|
placeholder?: string;
|
|
1027
953
|
/** 是否允许空值(默认 false) */
|
|
@@ -1035,26 +961,7 @@ interface StringArrayEditorProps {
|
|
|
1035
961
|
*/
|
|
1036
962
|
declare function StringArrayEditor(props: StringArrayEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1037
963
|
|
|
1038
|
-
|
|
1039
|
-
* 标签编辑器组件(Alpine.js 版本)
|
|
1040
|
-
* 使用 Alpine.js 实现纯 JSX 交互式组件
|
|
1041
|
-
*
|
|
1042
|
-
* 设计原则:
|
|
1043
|
-
* - 使用 Alpine.js 的 x-data 定义状态
|
|
1044
|
-
* - 尽量使用声明式语法,避免在 HTML 中写方法
|
|
1045
|
-
* - 使用 x-model、x-show、x-for 等 Alpine.js 指令
|
|
1046
|
-
* - 支持拖放排序(使用 SortableList 组件)
|
|
1047
|
-
* - 表单提交:通过 form-data-processor 自动解析嵌套结构和压缩数组索引
|
|
1048
|
-
*/
|
|
1049
|
-
interface TagsEditorProps {
|
|
1050
|
-
/** 字段定义 */
|
|
1051
|
-
field: any;
|
|
1052
|
-
/** 当前值(字符串数组,已解析) */
|
|
1053
|
-
value: string[] | null;
|
|
1054
|
-
/** 完整的初始数据 */
|
|
1055
|
-
initialData?: any;
|
|
1056
|
-
/** 字段名(用于更新隐藏字段) */
|
|
1057
|
-
fieldName: string;
|
|
964
|
+
interface TagsEditorProps extends FormFieldRendererProps {
|
|
1058
965
|
/** 占位符文本(可选) */
|
|
1059
966
|
placeholder?: string;
|
|
1060
967
|
/** 是否允许空值(默认 false) */
|
|
@@ -1066,4 +973,41 @@ interface TagsEditorProps {
|
|
|
1066
973
|
*/
|
|
1067
974
|
declare function TagsEditor(props: TagsEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1068
975
|
|
|
1069
|
-
|
|
976
|
+
/**
|
|
977
|
+
* 可拖拽排序列表组件
|
|
978
|
+
* 使用 HTML5 原生拖放 API 实现拖拽排序
|
|
979
|
+
*
|
|
980
|
+
* 设计原则:
|
|
981
|
+
* - 使用 Alpine.js 管理状态和事件处理
|
|
982
|
+
* - 使用 HTML5 原生拖放 API(draggable、x-on:dragstart、x-on:dragover、x-on:drop)
|
|
983
|
+
* - 高阶组件,可以包裹任何子元素
|
|
984
|
+
* - 使用事件委托,在容器上统一处理所有拖拽事件
|
|
985
|
+
* - 所有事件处理使用 Alpine.js 声明式语法
|
|
986
|
+
*/
|
|
987
|
+
interface SortableListProps {
|
|
988
|
+
/** 子元素 */
|
|
989
|
+
children: any;
|
|
990
|
+
/** 自定义类名 */
|
|
991
|
+
className?: string;
|
|
992
|
+
/** 拖拽手柄选择器(可选,如果提供,只有手柄可拖拽) */
|
|
993
|
+
handle?: string;
|
|
994
|
+
/** 拖拽时的样式类名(可选) */
|
|
995
|
+
draggingClass?: string;
|
|
996
|
+
/** 拖拽悬停时的样式类名(可选) */
|
|
997
|
+
dragOverClass?: string;
|
|
998
|
+
/** 排序变化回调(可选) */
|
|
999
|
+
onSortableChange?: (detail: {
|
|
1000
|
+
oldIndex: number;
|
|
1001
|
+
newIndex: number;
|
|
1002
|
+
}) => void;
|
|
1003
|
+
/** 其他属性 */
|
|
1004
|
+
[key: string]: any;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* 可拖拽排序列表组件
|
|
1008
|
+
* 使用 HTML5 原生拖放 API 和 Alpine.js 声明式语法
|
|
1009
|
+
* 使用事件委托在容器上统一处理所有拖拽事件
|
|
1010
|
+
*/
|
|
1011
|
+
declare function SortableList(props: SortableListProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1012
|
+
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,55 +3,6 @@ import { z } from 'zod';
|
|
|
3
3
|
import { Plugin, PluginPriority, Microservice } from 'imean-service-engine';
|
|
4
4
|
import * as hono_jsx_jsx_dev_runtime from 'hono/jsx/jsx-dev-runtime';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* 组件系统上下文
|
|
8
|
-
* 提供渲染上下文和组件上下文
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
declare class RenderContext<TProps = any, TState = any> {
|
|
12
|
-
readonly prefix: string;
|
|
13
|
-
readonly instanceId: string;
|
|
14
|
-
readonly componentName: string;
|
|
15
|
-
constructor(prefix: string, instanceId: string, componentName: string);
|
|
16
|
-
$id(): string;
|
|
17
|
-
setState(state: Partial<TState>): void;
|
|
18
|
-
get state(): TState;
|
|
19
|
-
get props(): TProps;
|
|
20
|
-
url(methodName: string, params?: Record<string, any>): string;
|
|
21
|
-
callMethod(methodName: string, params: Record<string, string>): any;
|
|
22
|
-
}
|
|
23
|
-
declare class ComponentContext extends RenderContext {
|
|
24
|
-
readonly ctx: Context;
|
|
25
|
-
constructor(prefix: string, ctx: Context, componentName: string);
|
|
26
|
-
params(): Promise<Record<string, any>>;
|
|
27
|
-
query(): Record<string, string>;
|
|
28
|
-
body(): Promise<any>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 组件系统核心
|
|
33
|
-
* 提供组件基类、方法装饰器和组件注册功能
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
interface MethodConfig {
|
|
37
|
-
method?: "get" | "post" | "put" | "delete";
|
|
38
|
-
path?: string;
|
|
39
|
-
}
|
|
40
|
-
declare function Method(config?: MethodConfig): (target: any, propertyKey: string, _descriptor: PropertyDescriptor) => void;
|
|
41
|
-
declare abstract class HtmxComponent<TProps = any> {
|
|
42
|
-
readonly name: string;
|
|
43
|
-
prefix: string;
|
|
44
|
-
constructor(name: string);
|
|
45
|
-
readonly Component: (props: TProps) => any;
|
|
46
|
-
protected abstract render(ctx: RenderContext, props: TProps): any;
|
|
47
|
-
getScript?(): any;
|
|
48
|
-
static getMethods(component: HtmxComponent<any>): Map<string, {
|
|
49
|
-
method: "get" | "post" | "put" | "delete";
|
|
50
|
-
path?: string;
|
|
51
|
-
handler: (ctx: ComponentContext) => Promise<Response>;
|
|
52
|
-
}>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
6
|
/**
|
|
56
7
|
* Feature 注册表
|
|
57
8
|
*/
|
|
@@ -396,8 +347,6 @@ interface HtmxAdminPluginOptions {
|
|
|
396
347
|
navigation?: NavItemConfig[];
|
|
397
348
|
/** 认证提供者(用于鉴权和权限控制) */
|
|
398
349
|
authProvider?: AuthProvider;
|
|
399
|
-
/** 组件配置(可选,用于注册组件) */
|
|
400
|
-
components?: HtmxComponent<any>[];
|
|
401
350
|
/** 页面配置(可选,用于注册页面) */
|
|
402
351
|
pages: PageModel[];
|
|
403
352
|
}
|
|
@@ -410,7 +359,7 @@ interface HtmxAdminPluginOptions {
|
|
|
410
359
|
* - 让类型系统更准确地反映实际的数据状态
|
|
411
360
|
* - 减少类型错误和运行时检查
|
|
412
361
|
*/
|
|
413
|
-
type ResolvedHtmxAdminPluginOptions = Required<Pick<HtmxAdminPluginOptions, "title" | "prefix" | "navigation" | "pages"
|
|
362
|
+
type ResolvedHtmxAdminPluginOptions = Required<Pick<HtmxAdminPluginOptions, "title" | "prefix" | "navigation" | "pages">> & Pick<HtmxAdminPluginOptions, "logo" | "homePath" | "authProvider" | "pages">;
|
|
414
363
|
/**
|
|
415
364
|
* 导航项配置
|
|
416
365
|
*/
|
|
@@ -443,16 +392,17 @@ interface FormField {
|
|
|
443
392
|
}
|
|
444
393
|
/**
|
|
445
394
|
* 表单字段渲染器属性
|
|
395
|
+
* 统一接口,可在不同 Feature 中复用
|
|
446
396
|
*/
|
|
447
397
|
interface FormFieldRendererProps<T = any> {
|
|
448
398
|
/** 字段定义 */
|
|
449
399
|
field: FormField;
|
|
450
400
|
/** 当前值(已解析的对象/数组,不是 JSON 字符串) */
|
|
451
401
|
value: any;
|
|
452
|
-
/**
|
|
453
|
-
|
|
402
|
+
/** 完整的初始数据项(用于编辑模式,包含所有字段的完整数据) */
|
|
403
|
+
item?: Partial<T>;
|
|
454
404
|
/** 字段名(用于更新隐藏字段) */
|
|
455
|
-
|
|
405
|
+
name: string;
|
|
456
406
|
}
|
|
457
407
|
|
|
458
408
|
/**
|
|
@@ -874,7 +824,6 @@ declare class HtmxAdminPlugin implements Plugin {
|
|
|
874
824
|
readonly options: ResolvedHtmxAdminPluginOptions;
|
|
875
825
|
private serviceName;
|
|
876
826
|
private pages;
|
|
877
|
-
private componentHandler;
|
|
878
827
|
constructor(options?: HtmxAdminPluginOptions);
|
|
879
828
|
private initPages;
|
|
880
829
|
/**
|
|
@@ -955,6 +904,8 @@ interface DialogProps {
|
|
|
955
904
|
/**
|
|
956
905
|
* 对话框组件
|
|
957
906
|
* 用于在模态框中显示内容,支持 HTMX 交互
|
|
907
|
+
* 支持多开:每个对话框都有唯一 ID,可以同时打开多个对话框
|
|
908
|
+
* 使用 Alpine.js 实现关闭逻辑
|
|
958
909
|
*/
|
|
959
910
|
declare function Dialog(props: DialogProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
960
911
|
|
|
@@ -975,6 +926,8 @@ interface ErrorAlertProps {
|
|
|
975
926
|
className?: string;
|
|
976
927
|
/** 自动关闭时间(毫秒),0 表示不自动关闭 */
|
|
977
928
|
autoClose?: number;
|
|
929
|
+
/** HTMX OOB swap 属性 */
|
|
930
|
+
"hx-swap-oob"?: string;
|
|
978
931
|
}
|
|
979
932
|
/**
|
|
980
933
|
* 错误提示组件
|
|
@@ -988,40 +941,13 @@ declare function ErrorAlert(props: ErrorAlertProps): hono_jsx_jsx_dev_runtime.JS
|
|
|
988
941
|
*/
|
|
989
942
|
declare function LoadingBar(): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
990
943
|
|
|
991
|
-
interface ObjectEditorProps {
|
|
992
|
-
/** 字段定义 */
|
|
993
|
-
field: any;
|
|
994
|
-
/** 当前值(对象,已解析) */
|
|
995
|
-
value: Record<string, any> | null;
|
|
996
|
-
/** 完整的初始数据 */
|
|
997
|
-
initialData?: any;
|
|
998
|
-
/** 字段名(用于更新隐藏字段) */
|
|
999
|
-
fieldName: string;
|
|
944
|
+
interface ObjectEditorProps extends FormFieldRendererProps {
|
|
1000
945
|
/** 对象的 Zod schema(用于自动渲染结构) */
|
|
1001
946
|
objectSchema?: z.ZodObject<any>;
|
|
1002
947
|
}
|
|
1003
948
|
declare function ObjectEditor(props: ObjectEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1004
949
|
|
|
1005
|
-
|
|
1006
|
-
* 字符串数组编辑器组件(Alpine.js 版本)
|
|
1007
|
-
* 使用 Alpine.js 实现纯 JSX 交互式组件
|
|
1008
|
-
*
|
|
1009
|
-
* 设计原则:
|
|
1010
|
-
* - 使用 Alpine.js 的 x-data 定义状态
|
|
1011
|
-
* - 尽量使用声明式语法,避免在 HTML 中写方法
|
|
1012
|
-
* - 使用 x-model、x-show、x-for 等 Alpine.js 指令
|
|
1013
|
-
* - 支持拖放排序(使用 SortableList 组件)
|
|
1014
|
-
* - 表单提交:通过 form-data-processor 自动解析嵌套结构和压缩数组索引
|
|
1015
|
-
*/
|
|
1016
|
-
interface StringArrayEditorProps {
|
|
1017
|
-
/** 字段定义 */
|
|
1018
|
-
field: any;
|
|
1019
|
-
/** 当前值(字符串数组,已解析) */
|
|
1020
|
-
value: string[] | null;
|
|
1021
|
-
/** 完整的初始数据 */
|
|
1022
|
-
initialData?: any;
|
|
1023
|
-
/** 字段名(用于更新隐藏字段) */
|
|
1024
|
-
fieldName: string;
|
|
950
|
+
interface StringArrayEditorProps extends FormFieldRendererProps {
|
|
1025
951
|
/** 占位符文本(可选) */
|
|
1026
952
|
placeholder?: string;
|
|
1027
953
|
/** 是否允许空值(默认 false) */
|
|
@@ -1035,26 +961,7 @@ interface StringArrayEditorProps {
|
|
|
1035
961
|
*/
|
|
1036
962
|
declare function StringArrayEditor(props: StringArrayEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1037
963
|
|
|
1038
|
-
|
|
1039
|
-
* 标签编辑器组件(Alpine.js 版本)
|
|
1040
|
-
* 使用 Alpine.js 实现纯 JSX 交互式组件
|
|
1041
|
-
*
|
|
1042
|
-
* 设计原则:
|
|
1043
|
-
* - 使用 Alpine.js 的 x-data 定义状态
|
|
1044
|
-
* - 尽量使用声明式语法,避免在 HTML 中写方法
|
|
1045
|
-
* - 使用 x-model、x-show、x-for 等 Alpine.js 指令
|
|
1046
|
-
* - 支持拖放排序(使用 SortableList 组件)
|
|
1047
|
-
* - 表单提交:通过 form-data-processor 自动解析嵌套结构和压缩数组索引
|
|
1048
|
-
*/
|
|
1049
|
-
interface TagsEditorProps {
|
|
1050
|
-
/** 字段定义 */
|
|
1051
|
-
field: any;
|
|
1052
|
-
/** 当前值(字符串数组,已解析) */
|
|
1053
|
-
value: string[] | null;
|
|
1054
|
-
/** 完整的初始数据 */
|
|
1055
|
-
initialData?: any;
|
|
1056
|
-
/** 字段名(用于更新隐藏字段) */
|
|
1057
|
-
fieldName: string;
|
|
964
|
+
interface TagsEditorProps extends FormFieldRendererProps {
|
|
1058
965
|
/** 占位符文本(可选) */
|
|
1059
966
|
placeholder?: string;
|
|
1060
967
|
/** 是否允许空值(默认 false) */
|
|
@@ -1066,4 +973,41 @@ interface TagsEditorProps {
|
|
|
1066
973
|
*/
|
|
1067
974
|
declare function TagsEditor(props: TagsEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1068
975
|
|
|
1069
|
-
|
|
976
|
+
/**
|
|
977
|
+
* 可拖拽排序列表组件
|
|
978
|
+
* 使用 HTML5 原生拖放 API 实现拖拽排序
|
|
979
|
+
*
|
|
980
|
+
* 设计原则:
|
|
981
|
+
* - 使用 Alpine.js 管理状态和事件处理
|
|
982
|
+
* - 使用 HTML5 原生拖放 API(draggable、x-on:dragstart、x-on:dragover、x-on:drop)
|
|
983
|
+
* - 高阶组件,可以包裹任何子元素
|
|
984
|
+
* - 使用事件委托,在容器上统一处理所有拖拽事件
|
|
985
|
+
* - 所有事件处理使用 Alpine.js 声明式语法
|
|
986
|
+
*/
|
|
987
|
+
interface SortableListProps {
|
|
988
|
+
/** 子元素 */
|
|
989
|
+
children: any;
|
|
990
|
+
/** 自定义类名 */
|
|
991
|
+
className?: string;
|
|
992
|
+
/** 拖拽手柄选择器(可选,如果提供,只有手柄可拖拽) */
|
|
993
|
+
handle?: string;
|
|
994
|
+
/** 拖拽时的样式类名(可选) */
|
|
995
|
+
draggingClass?: string;
|
|
996
|
+
/** 拖拽悬停时的样式类名(可选) */
|
|
997
|
+
dragOverClass?: string;
|
|
998
|
+
/** 排序变化回调(可选) */
|
|
999
|
+
onSortableChange?: (detail: {
|
|
1000
|
+
oldIndex: number;
|
|
1001
|
+
newIndex: number;
|
|
1002
|
+
}) => void;
|
|
1003
|
+
/** 其他属性 */
|
|
1004
|
+
[key: string]: any;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* 可拖拽排序列表组件
|
|
1008
|
+
* 使用 HTML5 原生拖放 API 和 Alpine.js 声明式语法
|
|
1009
|
+
* 使用事件委托在容器上统一处理所有拖拽事件
|
|
1010
|
+
*/
|
|
1011
|
+
declare function SortableList(props: SortableListProps): hono_jsx_jsx_dev_runtime.JSX.Element;
|
|
1012
|
+
|
|
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 };
|