From bd6439ca14e1a4a250dff91b030717a12d63a8d2 Mon Sep 17 00:00:00 2001 From: TickKiwi <> Date: Sun, 15 Dec 2024 15:32:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E8=AF=B4=E6=98=8EREADME.md?= =?UTF-8?q?=E3=80=81Reference.md=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Reference.md | 14 ++++++------ hadss_dialog/README.md | 48 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/docs/Reference.md b/docs/Reference.md index e80de0e..f62f8f8 100644 --- a/docs/Reference.md +++ b/docs/Reference.md @@ -59,7 +59,7 @@ | 接口原型 | 类型 | 接口描述 | |----------------------|-----------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **CustomBuilder** | 设置参数内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **CustomBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **CustomBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setLayerIndex | (index: number) => **CustomBuilder** | 设置弹窗的层级 | | setStyle | (style: **DialogStyle**) => **CustomBuilder** | 设置弹窗样式 | | setConfig | (config: **DialogConfig**) => **CustomBuilder** | 设置弹窗行为 | @@ -148,7 +148,7 @@ |--------------------|----------------------------------------------------------------------------------------------------------------------|---------------------------------------------| | setDuration | (time: number) => **ToastBuilder** | 设置弹窗的持续时间,单位毫秒,时间到达后自动关闭弹窗 | | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **ToastBuilder** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **ToastBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **ToastBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setTextContent | (text: string) => **ToastBuilder** | 提供默认的纯文本用法 | | **build** | **(customParam?: T) => InfToast** | **构造对应的弹窗实例** | #### ToastTemplate类 @@ -156,13 +156,13 @@ |--------------------|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------| | setDuration | (time: number) => **ToastTemplate** | 设置弹窗的持续时间,单位毫秒,时间到达后自动关闭弹窗 | | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **ToastTemplate** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **ToastTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **ToastTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setTextContent | (text: string) => **ToastTemplate** | 提供默认的纯文本用法 | ### PopupBuilder类 继承自 CustomBuilder类 | 接口原型 | 类型 | 接口描述 | |----------------------|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------| | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **PopupBuilder** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **PopupBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **PopupBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setTextContent | (text: string) => **PopupBuilder** | 提供默认的纯文本用法 | | setStyle | (style: **PopupStyle**) => **PopupBuilder** | 设置弹窗样式 | | setConfig | (config: **PopupConfig**) => **PopupBuilder** | 设置弹窗行为 | @@ -172,7 +172,7 @@ | 接口原型 | 类型 | 接口描述 | |----|-----------------------------------------------------------------------------------------------------------------------|----| | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **PopupTemplate** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **PopupTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **PopupTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setTextContent | (text: string) => **PopupTemplate** | 提供默认的纯文本用法 | | setStyle | (style: **PopupStyle**) => **PopupTemplate** | 设置弹窗样式 | | setConfig | (config: **PopupConfig**) => **PopupTemplate** | 设置弹窗行为 | @@ -198,7 +198,7 @@ | 接口原型 | 类型 | 接口描述 | |----------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **SheetBuilder** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **SheetBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **SheetBuilder** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setStyle | (style: **PopupStyle**) => **SheetBuilder** | 设置弹窗样式 直接覆写父类定义 | | setConfig | (config: **PopupConfig**) => **SheetBuilder** | 设置弹窗行为(此处Sheet支持的配置行为相对较少) | | setComponentTargetId | (id: string, uniqueId?: string) => **SheetBuilder** | 绑定组件的id,从id找不到uniqueId就报错 | @@ -208,7 +208,7 @@ | 接口原型 | 类型 | 接口描述 | |----------------------|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------| | setContent | (customContent: WrappedBuilder<[param: T]>, customParam?: T) => **SheetTemplate** | 设置自定义内容 | -| setCallBackContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **SheetTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | +| setOperableContent | (customContent: WrappedBuilder<[param: T]>, interactiveParam: (dialogAction: DialogAction) => T) => **SheetTemplate** | 设置参数内容,允许开发者通过interactiveParam设置可以操作当前弹窗的参数 | | setStyle | (style: **PopupStyle**) => **SheetTemplate** | 设置弹窗样式 直接覆写父类定义 | | setConfig | (config: **PopupConfig**) => **SheetTemplate** | 设置弹窗行为(此处Sheet支持的配置行为相对较少) | | setComponentTargetId | (id: string, uniqueId?: string) => **SheetTemplate** | 绑定组件的id,从id找不到uniqueId就报错 | diff --git a/hadss_dialog/README.md b/hadss_dialog/README.md index 530920a..95a8c63 100644 --- a/hadss_dialog/README.md +++ b/hadss_dialog/README.md @@ -1,9 +1,55 @@ # DialogHub简介 +作为通用弹窗库的入口模块,提供弹窗模板获取的能力,以及全局的弹窗管理能力 # 特性 +- 统一的弹窗入口; +- 与UI解耦的调用方式; +- 提供易用的页面级弹窗使用方式; +- 自定义弹窗模板的注册与获取能力; +- 提供全局的弹窗管理能力。 # 依赖系统版本 +- HarmonyOS 5.0.0 Release及以上 +- 手机版本: Next.0.0.71及以上 # 下载安装 +``` +ohpm install @hadss/dialoghub +``` ## 使用ohpm安装依赖 +``` +{ + "dependencies": { + "@hadss/dialoghub": "^1.0.0-rc.1" + } +} +``` # 快速开始 +### 关联上下文,获取弹窗构造器 +``` +DialogHub.init(uiContext); +let customDialog = DialogHub.getCustomDialog(); +``` +### 设置弹窗内容、交互、动画、样式、行为等 +``` +customDialog +.setContent(wrapBuilder(CustomDialogBuilder), params) // 设置自定义弹窗内容。若弹窗内容涉及弹窗行为,如点击按钮、图标关闭弹窗,可使用setOperableContent方法 +.setAnimation(dialogAnimation) // 设置弹窗弹出、消失动画 +.setStyle(dialogStyle) // 设置弹窗样式 +.setConfig(dialogConfig) // 设置弹窗行为,如键盘避让模式、是否开启蒙层、点击蒙层是否关闭弹窗等 +``` +### (可选)注册弹窗生命周期监听事件 +``` +customDialog.addLifeCycleListener({ + onWillShow: () => {}, + onWillDismiss: () => {}, + onShow: () => {} +}) +``` +### 显示弹窗 +``` +customDialog.show(); +``` # Dialog接口和属性列表 +[查看详情](https://gitee.com/hadss/dialoghub/blon/master/docs/Reference.md) # SampleCode -# FAQ \ No newline at end of file +本项目包含[Sample](https://gitee.com/hadss/dialoghub/tree/master/sample/DialogHubSample)示例代码,开发者可参考Sample实现某些常用场景。 +# FAQ +[查看详情](https://gitee.com/hadss/dialoghub/blob/master/docs/FAQ.md) \ No newline at end of file -- Gitee