UNPKG

capacitor-native-input-dialog

Version:

Capacitor plugin for native input dialogs with enhanced text input experience on mobile devices

151 lines (150 loc) 2.83 kB
export interface NativeInputPlugin { /** * 显示原生输入对话框 */ showNativeInput(options: NativeInputOptions): Promise<NativeInputResult>; /** * 创建原生输入框覆盖层 */ createNativeOverlay(options: NativeOverlayOptions): Promise<{ id: string; }>; /** * 更新原生输入框覆盖层 */ updateNativeOverlay(options: UpdateOverlayOptions): Promise<void>; /** * 移除原生输入框覆盖层 */ removeNativeOverlay(options: { id: string; }): Promise<void>; /** * 检查原生输入功能是否可用 */ isAvailable(): Promise<{ available: boolean; }>; } export interface NativeInputOptions { /** * 输入框标题 */ title?: string; /** * 输入框提示文本 */ placeholder?: string; /** * 初始值 */ initialValue?: string; /** * 输入类型 */ inputType?: 'text' | 'email' | 'password' | 'number' | 'multiline'; /** * 确认按钮文本 */ confirmButtonText?: string; /** * 取消按钮文本 */ cancelButtonText?: string; /** * 最大字符数限制 */ maxLength?: number; /** * 是否允许多行输入 */ multiline?: boolean; /** * 多行输入时的最大行数 */ maxLines?: number; } export interface NativeInputResult { /** * 用户输入的文本 */ value: string; /** * 是否被取消 */ cancelled: boolean; } export interface NativeOverlayOptions { /** * 输入框位置和尺寸 */ x: number; y: number; width: number; height: number; /** * 输入框提示文本 */ placeholder?: string; /** * 初始值 */ initialValue?: string; /** * 输入类型 */ inputType?: 'text' | 'email' | 'password' | 'number' | 'multiline'; /** * 最大字符数限制 */ maxLength?: number; /** * 是否允许多行输入 */ multiline?: boolean; /** * 多行输入时的最大行数 */ maxLines?: number; /** * 字体大小 */ fontSize?: number; /** * 背景颜色 */ backgroundColor?: string; /** * 文字颜色 */ textColor?: string; /** * 边框颜色 */ borderColor?: string; /** * 边框圆角 */ borderRadius?: number; } export interface UpdateOverlayOptions { /** * 覆盖层ID */ id: string; /** * 新的文本值 */ value?: string; /** * 新的位置和尺寸 */ x?: number; y?: number; width?: number; height?: number; /** * 新的占位符 */ placeholder?: string; }