From c10b3882a1cbf3228ec887c5523a3fed7285579a Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Fri, 12 Jun 2026 16:01:28 +0800 Subject: [PATCH 1/3] feat(image-viewer): support zoom [uniapp] --- db/TDesign.db | Bin 1142784 -> 1142784 bytes .../action-sheet/README.en-US.md | 5 +- .../uniapp-components/action-sheet/README.md | 5 +- .../uniapp-components/action-sheet/props.ts | 9 +- .../uniapp-components/action-sheet/type.ts | 9 +- .../image-viewer/README.en-US.md | 2 +- .../uniapp-components/image-viewer/README.md | 2 +- .../uniapp-components/image-viewer/props.ts | 12 +- .../uniapp-components/image-viewer/type.ts | 6 +- packages/scripts/api.json | 137 ++++++++- .../uniapp-components/common/common.ts | 290 ++++++++++++++++++ .../image-viewer/README.en-US.md | 36 +++ .../uniapp-components/image-viewer/README.md | 36 +++ .../uniapp-components/image-viewer/props.ts | 74 +++++ .../uniapp-components/image-viewer/type.ts | 81 +++++ 15 files changed, 670 insertions(+), 34 deletions(-) create mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/common/common.ts create mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md create mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md create mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts create mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts diff --git a/db/TDesign.db b/db/TDesign.db index a1fa3291d9f1e4de91dbc1250e34bf7abb1c44fa..a0c2c4410c309d48edb38f657e3c8483c82ef2db 100644 GIT binary patch delta 757 zcmZp8;M(xOb%Hcw^F$eE#^%O^)&$1Z1g6#m=GFw3tqH6P`I(q@PG=Ti)nGly=*+~l zS@D4|<9263)-pyX1_lNWAZEy)$Rf$aq|7PJ$j@ubz`<*5%)raQ$-&FP%fP|)nPG=# zZen_BSY~Q@YEf=tMO1!%E|c-o+54V%wom^p#Ht}+rfXoPYiOikXli9(WMyp7ZY<2Y z-B_6IiVh>=b`A$NK5jPN{#Z#S#_2NNY!Zyo)6Klu3fq@?vu$7I&7PP7QnZ1cokPB$ zQyr)X}b`u8y7bZ65dAuAv|F+jT2`DgfaWbpmDp9ufTR8U%{_TAQuM+vaxX% zEK-(a0lHXpdf_QPVb;vo%9A3d8-xkE^1%Yc(9p`zjA46Im|zp9953@f27Y(m<2>uR zA8?p)c5%CK9c8OvJ;bWYvVi&DcEberJIuC#Os|H$Npcr;%}yG28-ZI3roG zrU_^PFsQXs;ij2cnHpM|pjZGE!ft`&A|tQ`ri`MzxzLD&B`8p+Gc-6Rmt^MW1!ttD kPInYy7MuQGk=0xoW}l&nl?gB%Ss-}`Cba!fs-PVg0Ag0Zvj6}9 delta 410 zcmZp8;M(xOb%Hcw*+dy<#}#ZLnA8#Gb>}mc4J}I?Z(1vS9BN|wsSbJ z@o}^9^~XvwF-@28W|LrIxIJAlMbLeEjW?TC`*Lr#?aRH{6H-7*H?XsFC=_<81C@f@ zAT_DU=L|;-oXyU96-zo#9Tnk4a7V^%nQVP+naar*R``V z&ttS;+QBegu8Ch~yNQE<3lkHs(DZ#y0%p@UI0?Mt;$dOn%H&R*AaHv73TJ^h4h}}X zjN1Vm{MV)@^z$#6zRpJ=WcrCNevx)DUxDpnzJec_K+X&hWMiAY*hH{odsCQT6Q=|h o>mdeyci!VX>$x9rm~nP-yKo(4t6)8}-7tZD8SC~#se*P~09EaF!2kdN diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.en-US.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.en-US.md index bd2772211..2c628f332 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.en-US.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.en-US.md @@ -13,12 +13,13 @@ count | Number | 8 | \- | N description | String | - | \- | N items | Array | [] | Typescript: `Array` `interface ActionSheetItem { label: string; description?: string; color?: string; disabled?: boolean; icon?: string \| object; suffixIcon?: string \| object }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/action-sheet/type.ts) | N popup-props | Object | {} | Typescript: `PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/action-sheet/type.ts) | N +prevent-scroll-through | Boolean | true | \- | N show-cancel | Boolean | true | \- | N show-overlay | Boolean | true | \- | N theme | String | list | options: list/grid | N using-custom-navbar | Boolean | false | \- | N -visible | Boolean | false | `v-model:visible` is supported | N -default-visible | Boolean | false | uncontrolled property | N +visible | Boolean | false | `v-model:visible` is supported。Typescript: `boolean \| null` | N +default-visible | Boolean | false | uncontrolled property。Typescript: `boolean \| null` | N ### ActionSheet Events diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.md index b82011cf6..936beff7f 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/README.md @@ -13,12 +13,13 @@ count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有 description | String | - | 动作面板描述文字 | N items | Array | [] | 菜单项。TS 类型:`Array` `interface ActionSheetItem { label: string; description?: string; color?: string; disabled?: boolean; icon?: string \| object; suffixIcon?: string \| object }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/action-sheet/type.ts) | N popup-props | Object | {} | 透传 Popup 组件全部属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/action-sheet/type.ts) | N +prevent-scroll-through | Boolean | true | 防止滚动穿透,即不允许点击和滚动 | N show-cancel | Boolean | true | 是否显示取消按钮 | N show-overlay | Boolean | true | 是否显示遮罩层 | N theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N -visible | Boolean | false | 显示与隐藏。支持语法糖 `v-model:visible` | N -default-visible | Boolean | false | 显示与隐藏。非受控属性 | N +visible | Boolean | false | 显示与隐藏。支持语法糖 `v-model:visible`。TS 类型:`boolean \| null` | N +default-visible | Boolean | false | 显示与隐藏。非受控属性。TS 类型:`boolean \| null` | N ### ActionSheet Events diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/props.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/props.ts index 7cba6413b..aeb173b69 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/props.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/props.ts @@ -40,6 +40,11 @@ export default { type: Object, default: () => ({}), }, + /** 防止滚动穿透,即不允许点击和滚动 */ + preventScrollThrough: { + type: Boolean, + default: true, + }, /** 是否显示取消按钮 */ showCancel: { type: Boolean, @@ -63,8 +68,8 @@ export default { usingCustomNavbar: Boolean, /** 显示与隐藏 */ visible: { - type: Boolean, - default: undefined, + type: [Boolean, null], + default: null as TdActionSheetProps['visible'], }, /** 显示与隐藏,非受控属性 */ defaultVisible: Boolean, diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/type.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/type.ts index 3035087a9..df976d2dd 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/type.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/action-sheet/type.ts @@ -37,6 +37,11 @@ export interface TdActionSheetProps { * @default {} */ popupProps?: PopupProps; + /** + * 防止滚动穿透,即不允许点击和滚动 + * @default true + */ + preventScrollThrough?: boolean; /** * 是否显示取消按钮 * @default true @@ -61,12 +66,12 @@ export interface TdActionSheetProps { * 显示与隐藏 * @default false */ - visible?: boolean; + visible?: boolean | null; /** * 显示与隐藏,非受控属性 * @default false */ - defaultVisible?: boolean; + defaultVisible?: boolean | null; /** * 点击取消按钮时触发 */ diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md index aaacf6bc7..f96626e5c 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md @@ -14,7 +14,7 @@ image-props | Object | - | Typescript: `ImageProps`,[Image API Documents](./im images | Array | [] | Typescript: `Array` | N initial-index | Number | 0 | Typescript: `Number` | N lazy | Boolean | true | \- | N -loop | Boolean | true | \- | N +max-zoom | Number | 3 | \- | N show-index | Boolean | false | \- | N using-custom-navbar | Boolean | false | \- | N visible | Boolean | false | hide or show image viewer。`v-model:visible` is supported | N diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md index 2f534fce7..67832679f 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md @@ -14,7 +14,7 @@ image-props | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[ images | Array | [] | 图片数组。TS 类型:`Array` | N initial-index | Number | 0 | 初始化页码。TS 类型:`Number` | N lazy | Boolean | true | 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 | N -loop | Boolean | true | 是否开启循环滚动 | N +max-zoom | Number | 3 | 图片最大放大比例 | N show-index | Boolean | false | 是否显示页码 | N using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N visible | Boolean | false | 隐藏/显示预览。支持语法糖 `v-model:visible` | N diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts index e69a36bfb..e24fba904 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts @@ -40,10 +40,10 @@ export default { type: Boolean, default: true, }, - /** 是否开启循环滚动 */ - loop: { - type: Boolean, - default: true, + /** 图片最大放大比例 */ + maxZoom: { + type: Number, + default: 3, }, /** 是否显示页码 */ showIndex: Boolean, @@ -51,8 +51,8 @@ export default { usingCustomNavbar: Boolean, /** 隐藏/显示预览 */ visible: { - type: Boolean, - default: undefined, + type: [Boolean, null], + default: null as TdImageViewerProps['visible'], }, /** 隐藏/显示预览,非受控属性 */ defaultVisible: Boolean, diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts index fe0a0d958..2012b3efb 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts @@ -42,10 +42,10 @@ export interface TdImageViewerProps { */ lazy?: boolean; /** - * 是否开启循环滚动 - * @default true + * 图片最大放大比例 + * @default 3 */ - loop?: boolean; + maxZoom?: number; /** * 是否显示页码 * @default false diff --git a/packages/scripts/api.json b/packages/scripts/api.json index 6b4562a18..67bc4bb97 100644 --- a/packages/scripts/api.json +++ b/packages/scripts/api.json @@ -2834,6 +2834,43 @@ "Object" ] }, + { + "id": 1781246514, + "platform_framework": [ + "128" + ], + "component": "ActionSheet", + "field_category": 1, + "field_name": "preventScrollThrough", + "field_type": [ + "4" + ], + "field_default_value": "true", + "field_enum": "", + "field_desc_zh": "防止滚动穿透,即不允许点击和滚动", + "field_desc_en": null, + "field_required": 0, + "event_input": "", + "create_time": "2026-06-12 14:42:38", + "update_time": "2026-06-12 14:42:38", + "event_output": null, + "custom_field_type": null, + "syntactic_sugar": null, + "readonly": 1, + "html_attribute": 0, + "trigger_elements": "", + "deprecated": 0, + "version": "", + "test_description": null, + "support_default_value": 0, + "field_category_text": "Props", + "platform_framework_text": [ + "UniApp" + ], + "field_type_text": [ + "Boolean" + ] + }, { "id": 1611, "platform_framework": [ @@ -3007,8 +3044,7 @@ "platform_framework": [ "8", "16", - "64", - "128" + "64" ], "component": "ActionSheet", "field_category": 1, @@ -3038,7 +3074,43 @@ "platform_framework_text": [ "Vue(Mobile)", "React(Mobile)", - "Miniprogram", + "Miniprogram" + ], + "field_type_text": [ + "Boolean" + ] + }, + { + "id": 1781247106, + "platform_framework": [ + "128" + ], + "component": "ActionSheet", + "field_category": 1, + "field_name": "visible", + "field_type": [ + "4" + ], + "field_default_value": "false", + "field_enum": "", + "field_desc_zh": "显示与隐藏", + "field_desc_en": null, + "field_required": 0, + "event_input": "", + "create_time": "2026-06-12 06:51:46", + "update_time": "2026-06-12 06:51:46", + "event_output": null, + "custom_field_type": "boolean | null", + "syntactic_sugar": "v-model", + "readonly": 1, + "html_attribute": 0, + "trigger_elements": "", + "deprecated": 0, + "version": "", + "test_description": null, + "support_default_value": 1, + "field_category_text": "Props", + "platform_framework_text": [ "UniApp" ], "field_type_text": [ @@ -73812,8 +73884,7 @@ "platform_framework": [ "8", "16", - "64", - "128" + "64" ], "component": "ImageViewer", "field_category": 1, @@ -73828,7 +73899,7 @@ "field_required": 0, "event_input": "", "create_time": "2026-04-24 08:02:26", - "update_time": "2026-04-24 08:02:26", + "update_time": "2026-06-12 15:11:16", "event_output": null, "custom_field_type": null, "syntactic_sugar": null, @@ -73843,8 +73914,7 @@ "platform_framework_text": [ "Vue(Mobile)", "React(Mobile)", - "Miniprogram", - "UniApp" + "Miniprogram" ], "field_type_text": [ "Boolean" @@ -73854,7 +73924,8 @@ "id": 2803, "platform_framework": [ "8", - "16" + "16", + "128" ], "component": "ImageViewer", "field_category": 1, @@ -73864,12 +73935,12 @@ ], "field_default_value": "3", "field_enum": "", - "field_desc_zh": "【开发中】最大放大比例", + "field_desc_zh": "图片最大放大比例", "field_desc_en": null, "field_required": 0, "event_input": "", "create_time": "2022-07-04 12:06:31", - "update_time": "2022-07-04 12:06:31", + "update_time": "2026-06-12 15:02:30", "event_output": null, "custom_field_type": "", "syntactic_sugar": null, @@ -73883,7 +73954,8 @@ "field_category_text": "Props", "platform_framework_text": [ "Vue(Mobile)", - "React(Mobile)" + "React(Mobile)", + "UniApp" ], "field_type_text": [ "Number" @@ -74218,8 +74290,7 @@ "2", "8", "16", - "64", - "128" + "64" ], "component": "ImageViewer", "field_category": 1, @@ -74251,7 +74322,43 @@ "React(PC)", "Vue(Mobile)", "React(Mobile)", - "Miniprogram", + "Miniprogram" + ], + "field_type_text": [ + "Boolean" + ] + }, + { + "id": 1781250866, + "platform_framework": [ + "128" + ], + "component": "ImageViewer", + "field_category": 1, + "field_name": "visible", + "field_type": [ + "4" + ], + "field_default_value": "false", + "field_enum": "", + "field_desc_zh": "隐藏/显示预览", + "field_desc_en": "hide or show image viewer", + "field_required": 0, + "event_input": "", + "create_time": "2026-06-12 07:54:26", + "update_time": "2026-06-12 07:54:26", + "event_output": null, + "custom_field_type": "boolean | null", + "syntactic_sugar": "v-model", + "readonly": 1, + "html_attribute": 0, + "trigger_elements": "", + "deprecated": 0, + "version": "", + "test_description": null, + "support_default_value": 1, + "field_category_text": "Props", + "platform_framework_text": [ "UniApp" ], "field_type_text": [ diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/common/common.ts b/packages/tdesign-miniprogram/packages/uniapp-components/common/common.ts new file mode 100644 index 000000000..66d36a4f3 --- /dev/null +++ b/packages/tdesign-miniprogram/packages/uniapp-components/common/common.ts @@ -0,0 +1,290 @@ +export type Classes = Array; + +export interface Styles { + [css: string]: string | number; +} + +export type ImageEvent = any; + +export type PlainObject = { [key: string]: any }; + +export type OptionData = { + label?: string; + value?: string | number; +} & PlainObject; + +export type TreeOptionData = { + children?: Array> | boolean; + /** option label content */ + label?: string; + /** option search text */ + text?: string; + /** option value */ + value?: T; + /** option node content */ + content?: string; +} & PlainObject; + +export type FormResetEvent = Event; + +export type FormSubmitEvent = Event; + +/** + * 移除 on 前缀并可选地去掉可选修饰符 + * @param T - 原始类型 + * @param MakeRequired - 是否将属性变为必需(默认 false) + */ +export type TransformEventHandlers< + T, + MakeRequired extends boolean = false +> = MakeRequired extends true + ? { + [K in keyof T as K extends `on${infer Event}` + ? Uncapitalize + : never + ]-?: T[K] + } + : { + [K in keyof T as K extends `on${infer Event}` + ? Uncapitalize + : never + ]: T[K] + }; + + +type WrapWithContext any> = + T extends (...args: infer P) => infer R + ? (context: { [K in keyof P]: P[K] }) => R + : never; + + +export type WrapParamsWithContext = { + [K in keyof T]: T[K] extends (...args: any[]) => any + ? WrapWithContext + : T[K]; +}; + + +// 提取非 on 开头的属性 +export type ExtractNonOnProps = { + [K in keyof T as K extends `on${string}` ? never : K]: T[K] +}; + +/** + * 邮箱校验选项 + */ +export interface IsEmailOptions { + /** + * 是否允许显示名称格式,如 `Display Name ` + * @default false + */ + allow_display_name?: boolean; + /** + * 是否要求必须包含显示名称格式 + * @default false + */ + require_display_name?: boolean; + /** + * 是否允许本地部分使用 UTF8 字符 + * @default true + */ + allow_utf8_local_part?: boolean; + /** + * 是否要求域名包含顶级域名 + * @default true + */ + require_tld?: boolean; + /** + * 是否忽略邮箱最大长度限制 + * @default false + */ + ignore_max_length?: boolean; + /** + * 是否允许 IP 地址作为域名部分 + * @default false + */ + allow_ip_domain?: boolean; + /** + * 是否启用特定域名的额外校验(如 GMail 规则) + * @default false + */ + domain_specific_validation?: boolean; + /** + * 是否允许下划线 + * @default false + */ + allow_underscores?: boolean; + /** + * 域名黑名单 + */ + host_blacklist?: Array; + /** + * 域名白名单 + */ + host_whitelist?: Array; + /** + * 拒绝包含指定字符的邮箱名 + */ + blacklisted_chars?: string; +} + +/** + * URL 校验选项 + */ +export interface IsURLOptions { + /** + * 允许的协议 + * @default ['http','https','ftp'] + */ + protocols?: string[]; + /** + * 是否要求顶级域名 + * @default true + */ + require_tld?: boolean; + /** + * 是否要求协议 + * @default false + */ + require_protocol?: boolean; + /** + * 是否要求主机名 + * @default true + */ + require_host?: boolean; + /** + * 是否要求端口 + * @default false + */ + require_port?: boolean; + /** + * 是否要求有效协议 + * @default true + */ + require_valid_protocol?: boolean; + /** + * 是否允许下划线 + * @default false + */ + allow_underscores?: boolean; + /** + * 主机名白名单 + */ + host_whitelist?: Array; + /** + * 主机名黑名单 + */ + host_blacklist?: Array; + /** + * 是否允许末尾的点 + * @default false + */ + allow_trailing_dot?: boolean; + /** + * 是否允许协议相对 URL + * @default false + */ + allow_protocol_relative_urls?: boolean; + /** + * 是否禁止认证信息 + * @default false + */ + disallow_auth?: boolean; + /** + * 是否允许片段(hash) + * @default true + */ + allow_fragments?: boolean; + /** + * 是否允许查询参数 + * @default true + */ + allow_query_components?: boolean; + /** + * 是否校验长度 + * @default true + */ + validate_length?: boolean; + /** + * 最大允许长度 + * @default 2084 + */ + max_allowed_length?: number | false; +} + + +/** + * 通用全局类型 + * */ +export type SizeEnum = 'small' | 'medium' | 'large'; + +export type ShapeEnum = 'circle' | 'round'; + +export type HorizontalAlignEnum = 'left' | 'center' | 'right'; + +export type VerticalAlignEnum = 'top' | 'middle' | 'bottom'; + +export type LayoutEnum = 'vertical' | 'horizontal'; + +export type ClassName = { [className: string]: any } | ClassName[] | string; + +export type CSSSelector = string; + +export interface KeysType { + value?: string; + label?: string; + disabled?: string; +} + +export interface TreeKeysType extends KeysType { + children?: string; +} + +export interface HTMLElementAttributes { + [attribute: string]: string; +} + +export interface TScroll { + /** + * 表示除可视区域外,额外渲染的行数,避免快速滚动过程中,新出现的内容来不及渲染从而出现空白 + * @default 20 + */ + bufferSize?: number; + /** + * 表示每行内容是否同一个固定高度,仅在 `scroll.type` 为 `virtual` 时有效,该属性设置为 `true` 时,可用于简化虚拟滚动内部计算逻辑,提升性能,此时则需要明确指定 `scroll.rowHeight` 属性的值 + * @default false + */ + isFixedRowHeight?: boolean; + /** + * 行高,不会给元素添加样式高度,仅作为滚动时的行高参考。一般情况不需要设置该属性。如果设置,可尽量将该属性设置为每行平均高度,从而使得滚动过程更加平滑 + */ + rowHeight?: number; + /** + * 启动虚拟滚动的阈值。为保证组件收益最大化,当数据量小于阈值 `scroll.threshold` 时,无论虚拟滚动的配置是否存在,组件内部都不会开启虚拟滚动 + * @default 100 + */ + threshold?: number; + /** + * 滚动加载类型,有两种:懒加载和虚拟滚动。
值为 `lazy` ,表示滚动时会进行懒加载,非可视区域内的内容将不会默认渲染,直到该内容可见时,才会进行渲染,并且已渲染的内容滚动到不可见时,不会被销毁;
值为`virtual`时,表示会进行虚拟滚动,无论滚动条滚动到哪个位置,同一时刻,仅渲染该可视区域内的内容,当需要展示的数据量较大时,建议开启该特性 + */ + type: 'lazy' | 'virtual'; +} + +/** + * @deprecated use TScroll instead + */ +export type InfinityScroll = TScroll; + +export interface ScrollToElementParams { + /** 跳转元素下标 */ + index?: number; + /** 跳转元素距离顶部的距离 */ + top?: number; + /** 单个元素高度非固定场景下,即 isFixedRowHeight = false。延迟设置元素位置,一般用于依赖不同高度异步渲染等场景,单位:毫秒 */ + time?: number; + behavior?: 'auto' | 'smooth'; +} + +export interface ComponentScrollToElementParams extends ScrollToElementParams { + key?: string | number; +} diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md new file mode 100644 index 000000000..f96626e5c --- /dev/null +++ b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md @@ -0,0 +1,36 @@ +:: BASE_DOC :: + +## API + +### ImageViewer Props + +name | type | default | description | required +-- | -- | -- | -- | -- +custom-style | Object | - | CSS(Cascading Style Sheets) | N +background-color | String | - | \- | N +close-btn | String / Boolean / Object | false | \- | N +delete-btn | String / Boolean / Object | false | \- | N +image-props | Object | - | Typescript: `ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/image-viewer/type.ts) | N +images | Array | [] | Typescript: `Array` | N +initial-index | Number | 0 | Typescript: `Number` | N +lazy | Boolean | true | \- | N +max-zoom | Number | 3 | \- | N +show-index | Boolean | false | \- | N +using-custom-navbar | Boolean | false | \- | N +visible | Boolean | false | hide or show image viewer。`v-model:visible` is supported | N +default-visible | Boolean | false | hide or show image viewer。uncontrolled property | N + +### ImageViewer Events + +name | params | description +-- | -- | -- +change | `(context: { index: number })` | \- +close | `(context: { trigger: 'overlay' \| 'button', visible: Boolean, index: Number } )` | \- +delete | `(context: { index: number } )` | \- + +### ImageViewer Slots + +name | Description +-- | -- +close-btn | \- +delete-btn | \- diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md new file mode 100644 index 000000000..67832679f --- /dev/null +++ b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md @@ -0,0 +1,36 @@ +:: BASE_DOC :: + +## API + +### ImageViewer Props + +名称 | 类型 | 默认值 | 描述 | 必传 +-- | -- | -- | -- | -- +custom-style | Object | - | 自定义样式 | N +background-color | String | - | 遮罩的背景颜色 | N +close-btn | String / Boolean / Object | false | 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 | N +delete-btn | String / Boolean / Object | false | 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 | N +image-props | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/image-viewer/type.ts) | N +images | Array | [] | 图片数组。TS 类型:`Array` | N +initial-index | Number | 0 | 初始化页码。TS 类型:`Number` | N +lazy | Boolean | true | 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 | N +max-zoom | Number | 3 | 图片最大放大比例 | N +show-index | Boolean | false | 是否显示页码 | N +using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N +visible | Boolean | false | 隐藏/显示预览。支持语法糖 `v-model:visible` | N +default-visible | Boolean | false | 隐藏/显示预览。非受控属性 | N + +### ImageViewer Events + +名称 | 参数 | 描述 +-- | -- | -- +change | `(context: { index: number })` | 翻页时回调 +close | `(context: { trigger: 'overlay' \| 'button', visible: Boolean, index: Number } )` | 点击操作按钮button或者overlay时触发 +delete | `(context: { index: number } )` | 点击删除操作按钮时触发 + +### ImageViewer Slots + +名称 | 描述 +-- | -- +close-btn | 关闭操作 +delete-btn | 删除操作 diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts new file mode 100644 index 000000000..e24fba904 --- /dev/null +++ b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts @@ -0,0 +1,74 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +import type { TdImageViewerProps } from './type'; +export default { + /** 遮罩的背景颜色 */ + backgroundColor: { + type: String, + default: '', + }, + /** 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 */ + closeBtn: { + type: [String, Boolean, Object], + default: false as TdImageViewerProps['closeBtn'], + }, + /** 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 */ + deleteBtn: { + type: [String, Boolean, Object], + default: false as TdImageViewerProps['deleteBtn'], + }, + /** 透传至 Image 组件 */ + imageProps: { + type: Object, + }, + /** 图片数组 */ + images: { + type: Array, + default: (): TdImageViewerProps['images'] => [], + }, + /** 初始化页码 */ + initialIndex: { + type: Number, + default: 0, + }, + /** 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 */ + lazy: { + type: Boolean, + default: true, + }, + /** 图片最大放大比例 */ + maxZoom: { + type: Number, + default: 3, + }, + /** 是否显示页码 */ + showIndex: Boolean, + /** 是否使用了自定义导航栏 */ + usingCustomNavbar: Boolean, + /** 隐藏/显示预览 */ + visible: { + type: [Boolean, null], + default: null as TdImageViewerProps['visible'], + }, + /** 隐藏/显示预览,非受控属性 */ + defaultVisible: Boolean, + /** 翻页时回调 */ + onChange: { + type: Function, + default: () => ({}), + }, + /** 点击操作按钮button或者overlay时触发 */ + onClose: { + type: Function, + default: () => ({}), + }, + /** 点击删除操作按钮时触发 */ + onDelete: { + type: Function, + default: () => ({}), + }, +}; diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts new file mode 100644 index 000000000..2012b3efb --- /dev/null +++ b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts @@ -0,0 +1,81 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +import type { TdImageProps as ImageProps } from '../image/type'; + +export interface TdImageViewerProps { + /** + * 遮罩的背景颜色 + * @default '' + */ + backgroundColor?: string; + /** + * 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 + * @default false + */ + closeBtn?: string | boolean | object; + /** + * 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 + * @default false + */ + deleteBtn?: string | boolean | object; + /** + * 透传至 Image 组件 + */ + imageProps?: ImageProps; + /** + * 图片数组 + * @default [] + */ + images?: Array; + /** + * 初始化页码 + * @default 0 + */ + initialIndex?: Number; + /** + * 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 + * @default true + */ + lazy?: boolean; + /** + * 图片最大放大比例 + * @default 3 + */ + maxZoom?: number; + /** + * 是否显示页码 + * @default false + */ + showIndex?: boolean; + /** + * 是否使用了自定义导航栏 + * @default false + */ + usingCustomNavbar?: boolean; + /** + * 隐藏/显示预览 + * @default false + */ + visible?: boolean; + /** + * 隐藏/显示预览,非受控属性 + * @default false + */ + defaultVisible?: boolean; + /** + * 翻页时回调 + */ + onChange?: (context: { index: number }) => void; + /** + * 点击操作按钮button或者overlay时触发 + */ + onClose?: (context: { trigger: 'overlay' | 'button'; visible: Boolean; index: Number }) => void; + /** + * 点击删除操作按钮时触发 + */ + onDelete?: (context: { index: number }) => void; +} From 3f0a628e9377f357afb47a7c60c5e01983b5d23d Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Fri, 12 Jun 2026 17:00:10 +0800 Subject: [PATCH 2/3] feat: add contentAlign prop --- db/TDesign.db | Bin 1142784 -> 1142784 bytes .../packages/components/form-item/props.ts | 4 ++++ .../packages/components/form-item/type.ts | 7 ++++++ .../packages/components/form/README.en-US.md | 4 +++- .../packages/components/form/README.md | 4 +++- .../packages/components/form/props.ts | 5 ++++ .../packages/components/form/type.ts | 8 +++++++ .../uniapp-components/form-item/props.ts | 8 +++++++ .../uniapp-components/form-item/type.ts | 4 ++++ .../uniapp-components/form/README.en-US.md | 2 ++ .../packages/uniapp-components/form/README.md | 2 ++ .../packages/uniapp-components/form/props.ts | 9 +++++++ .../packages/uniapp-components/form/type.ts | 5 ++++ packages/scripts/api.json | 22 ++++++++++++------ 14 files changed, 75 insertions(+), 9 deletions(-) diff --git a/db/TDesign.db b/db/TDesign.db index a0c2c4410c309d48edb38f657e3c8483c82ef2db..c8e7e6fdea6798547588bbbb3a225b1d8ac8edda 100644 GIT binary patch delta 315 zcmZp8;M(xOb%Hcw`$QRM)^-NH-XD!AttpJHDNL;?%&jRbttqUnDQvAN?5!yrttp(X zDO{~7+^s1*ttq@)Q~2iA>oU({5Mo%y%CL<0HIEH zz`(%C!OOwRz>y|=VLHQ&=?9wmQbf#j4a{^6jT8*ctc)zJjLq117}fzzShc;YmG2!h zi;ffv3*`-*RWPxV$DmI#87=CdU(D14jK8xx3_nF0} oJD%edo~{ta!aDs#3!jnzl7+^GR))syv0Z#X%)dRhOJMO+0N`a<`Tzg` delta 355 zcmZp8;M(xOb%Hcw^F$eE)@BC1HqFMA))dCp6sFb`=GGLJ))dy(6t>nB_SO`R))dax z6t313?$#8Z))d~YDSUJ5by-Xpgcz2wGA!eL&Ev;?ge#GKHoFVkB91exUCi^?1X;p4 zlKEqqrtm#r>}TwsY#3m*J)?oojG4VrXf~rH3*&U37CtFf3Ag;B-0AZgd8DSdweY!x zndlk-k%fYxp_QS5m7yuiF9v047Dh=!eA0{#(;X}LMW)a1)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string; fields?: any }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
+submit | `(detail: SubmitContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string; fields?: any }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
validate | `(result: ValidateResultContext)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
### FormInstanceFunctions 组件实例方法 @@ -47,6 +48,7 @@ name | type | default | description | required style | Object | - | CSS(Cascading Style Sheets) | N custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N arrow | Boolean | false | \- | N +content-align | String | - | options: left/right | N help | String | - | \- | N label | String | '' | \- | N label-align | String | - | options: left/right/top | N diff --git a/packages/products/tdesign-miniprogram/packages/components/form/README.md b/packages/products/tdesign-miniprogram/packages/components/form/README.md index 40e8cd7b4..96c8ca966 100644 --- a/packages/products/tdesign-miniprogram/packages/components/form/README.md +++ b/packages/products/tdesign-miniprogram/packages/components/form/README.md @@ -9,6 +9,7 @@ style | Object | - | 样式 | N custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N colon | Boolean | false | 是否在表单标签字段右侧显示冒号 | N +content-align | String | left | 表单内容对齐方式:左对齐、右对齐。可选项:left/right | N data | Object | {} | 表单数据。TS 类型:`FormData` | N error-message | Object | - | 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }`。TS 类型:`FormErrorMessage` | N label-align | String | right | 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。可选项:left/right/top | N @@ -26,7 +27,7 @@ submit-with-warning-message | Boolean | false | 【讨论中】当校验结果 名称 | 参数 | 描述 -- | -- | -- reset | `(detail: { e?: FormResetEvent })` | 表单重置时触发。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts) -submit | `(context: SubmitContext)` | 表单提交时触发。其中 `context.validateResult` 表示校验结果,`context.firstError` 表示校验不通过的第一个规则提醒。`context.validateResult` 值为 `true` 表示校验通过;如果校验不通过,`context.validateResult` 值为校验结果列表。
【注意】⚠️ 默认情况,输入框按下 Enter 键会自动触发提交事件,如果希望禁用这个默认行为,可以给输入框添加 enter 事件,并在事件中设置 `e.preventDefault()`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string; fields?: any }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
+submit | `(detail: SubmitContext)` | 表单提交时触发。其中 `context.validateResult` 表示校验结果,`context.firstError` 表示校验不通过的第一个规则提醒。`context.validateResult` 值为 `true` 表示校验通过;如果校验不通过,`context.validateResult` 值为校验结果列表。
【注意】⚠️ 默认情况,输入框按下 Enter 键会自动触发提交事件,如果希望禁用这个默认行为,可以给输入框添加 enter 事件,并在事件中设置 `e.preventDefault()`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`interface SubmitContext { e?: FormSubmitEvent; validateResult: FormValidateResult; firstError?: string; fields?: any }`

`type FormValidateResult = boolean \| ValidateResultObj`

`type ValidateResultObj = { [key in keyof T]: boolean \| ValidateResultList }`

`type ValidateResultList = Array`

`type AllValidateResult = CustomValidateObj \| ValidateResultType`

`interface ValidateResultType extends FormRule { result: boolean }`

`type ValidateResult = { [key in keyof T]: boolean \| ErrorList }`

`type ErrorList = Array`
validate | `(result: ValidateResultContext)` | 校验结束后触发,result 值为 true 表示校验通过;如果校验不通过,result 值为校验结果列表。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts)。
`type ValidateResultContext = Omit, 'e'>`
### FormInstanceFunctions 组件实例方法 @@ -47,6 +48,7 @@ validate | `(params?: FormValidateParams)` | `Promise { type: BooleanConstructor; value?: boolean; }; + /** + * 表单内容对齐方式:左对齐、右对齐 + * @default left + */ + contentAlign?: { + type: StringConstructor; + value?: 'left' | 'right'; + }; /** * 表单数据 * @default {} diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/props.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/props.ts index 1c308369a..2ac275328 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/props.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/props.ts @@ -8,6 +8,14 @@ import type { TdFormItemProps } from './type'; export default { /** 是否显示右侧箭头 */ arrow: Boolean, + /** 表单内容对齐方式:左对齐、右对齐,优先级高于 Form.contentAlign */ + contentAlign: { + type: String, + validator(val: TdFormItemProps['contentAlign']): boolean { + if (!val) return true; + return ['left', 'right'].includes(val); + }, + }, /** 表单项说明内容 */ help: { type: String, diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/type.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/type.ts index 59bcb013b..8daab2458 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/type.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/form-item/type.ts @@ -12,6 +12,10 @@ export interface TdFormItemProps { * @default false */ arrow?: boolean; + /** + * 表单内容对齐方式:左对齐、右对齐,优先级高于 Form.contentAlign + */ + contentAlign?: 'left' | 'right'; /** * 表单项说明内容 */ diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.en-US.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.en-US.md index c6e16f252..891502bf0 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.en-US.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.en-US.md @@ -8,6 +8,7 @@ name | type | default | description | required -- | -- | -- | -- | -- custom-style | Object | - | CSS(Cascading Style Sheets) | N colon | Boolean | false | \- | N +content-align | String | left | options: left/right | N data | Object | {} | Typescript: `FormData` | N error-message | Object | - | Typescript: `FormErrorMessage` | N label-align | String | right | options: left/right/top | N @@ -45,6 +46,7 @@ name | type | default | description | required -- | -- | -- | -- | -- custom-style | Object | - | CSS(Cascading Style Sheets) | N arrow | Boolean | false | \- | N +content-align | String | - | options: left/right | N help | String | - | \- | N label | String | '' | \- | N label-align | String | - | options: left/right/top | N diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.md b/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.md index cfb5d45eb..cef380653 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.md +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/form/README.md @@ -8,6 +8,7 @@ -- | -- | -- | -- | -- custom-style | Object | - | 自定义样式 | N colon | Boolean | false | 是否在表单标签字段右侧显示冒号 | N +content-align | String | left | 表单内容对齐方式:左对齐、右对齐。可选项:left/right | N data | Object | {} | 表单数据。TS 类型:`FormData` | N error-message | Object | - | 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }`。TS 类型:`FormErrorMessage` | N label-align | String | right | 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。可选项:left/right/top | N @@ -45,6 +46,7 @@ validate | `(params?: FormValidateParams)` | `Promise { * @default false */ colon?: boolean; + /** + * 表单内容对齐方式:左对齐、右对齐 + * @default left + */ + contentAlign?: 'left' | 'right'; /** * 表单数据 * @default {} diff --git a/packages/scripts/api.json b/packages/scripts/api.json index 67bc4bb97..39db6712b 100644 --- a/packages/scripts/api.json +++ b/packages/scripts/api.json @@ -59822,7 +59822,9 @@ "id": 1712574615, "platform_framework": [ "8", - "16" + "16", + "64", + "128" ], "component": "Form", "field_category": 1, @@ -59837,7 +59839,7 @@ "field_required": 0, "event_input": "", "create_time": "2024-04-08 11:10:15", - "update_time": "2024-04-08 11:10:15", + "update_time": "2026-06-12 16:29:36", "event_output": null, "custom_field_type": null, "syntactic_sugar": null, @@ -59851,7 +59853,9 @@ "field_category_text": "Props", "platform_framework_text": [ "Vue(Mobile)", - "React(Mobile)" + "React(Mobile)", + "Miniprogram", + "UniApp" ], "field_type_text": [ "String" @@ -62471,7 +62475,9 @@ "id": 1712574874, "platform_framework": [ "8", - "16" + "16", + "64", + "128" ], "component": "FormItem", "field_category": 1, @@ -62481,12 +62487,12 @@ ], "field_default_value": "", "field_enum": "left/right", - "field_desc_zh": "表单内容对齐方式,优先级高于 Form.contentAlign", + "field_desc_zh": "表单内容对齐方式:左对齐、右对齐,优先级高于 Form.contentAlign", "field_desc_en": null, "field_required": 0, "event_input": "", "create_time": "2024-04-08 11:14:34", - "update_time": "2024-04-08 11:14:34", + "update_time": "2026-06-12 16:31:13", "event_output": null, "custom_field_type": null, "syntactic_sugar": null, @@ -62500,7 +62506,9 @@ "field_category_text": "Props", "platform_framework_text": [ "Vue(Mobile)", - "React(Mobile)" + "React(Mobile)", + "Miniprogram", + "UniApp" ], "field_type_text": [ "String" From a6049a50958bd5ad160ac4d067459d596a603a1e Mon Sep 17 00:00:00 2001 From: novlan1 <1576271227@qq.com> Date: Fri, 12 Jun 2026 17:09:35 +0800 Subject: [PATCH 3/3] chore: fix compile error --- .../uniapp-components/image-viewer/type.ts | 2 +- .../image-viewer/README.en-US.md | 36 --------- .../uniapp-components/image-viewer/README.md | 36 --------- .../uniapp-components/image-viewer/props.ts | 74 ----------------- .../uniapp-components/image-viewer/type.ts | 81 ------------------- 5 files changed, 1 insertion(+), 228 deletions(-) delete mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md delete mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md delete mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts delete mode 100644 packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts diff --git a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts index 2012b3efb..99e74038e 100644 --- a/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts +++ b/packages/products/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts @@ -60,7 +60,7 @@ export interface TdImageViewerProps { * 隐藏/显示预览 * @default false */ - visible?: boolean; + visible?: boolean | null; /** * 隐藏/显示预览,非受控属性 * @default false diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md deleted file mode 100644 index f96626e5c..000000000 --- a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.en-US.md +++ /dev/null @@ -1,36 +0,0 @@ -:: BASE_DOC :: - -## API - -### ImageViewer Props - -name | type | default | description | required --- | -- | -- | -- | -- -custom-style | Object | - | CSS(Cascading Style Sheets) | N -background-color | String | - | \- | N -close-btn | String / Boolean / Object | false | \- | N -delete-btn | String / Boolean / Object | false | \- | N -image-props | Object | - | Typescript: `ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/image-viewer/type.ts) | N -images | Array | [] | Typescript: `Array` | N -initial-index | Number | 0 | Typescript: `Number` | N -lazy | Boolean | true | \- | N -max-zoom | Number | 3 | \- | N -show-index | Boolean | false | \- | N -using-custom-navbar | Boolean | false | \- | N -visible | Boolean | false | hide or show image viewer。`v-model:visible` is supported | N -default-visible | Boolean | false | hide or show image viewer。uncontrolled property | N - -### ImageViewer Events - -name | params | description --- | -- | -- -change | `(context: { index: number })` | \- -close | `(context: { trigger: 'overlay' \| 'button', visible: Boolean, index: Number } )` | \- -delete | `(context: { index: number } )` | \- - -### ImageViewer Slots - -name | Description --- | -- -close-btn | \- -delete-btn | \- diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md deleted file mode 100644 index 67832679f..000000000 --- a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/README.md +++ /dev/null @@ -1,36 +0,0 @@ -:: BASE_DOC :: - -## API - -### ImageViewer Props - -名称 | 类型 | 默认值 | 描述 | 必传 --- | -- | -- | -- | -- -custom-style | Object | - | 自定义样式 | N -background-color | String | - | 遮罩的背景颜色 | N -close-btn | String / Boolean / Object | false | 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 | N -delete-btn | String / Boolean / Object | false | 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 | N -image-props | Object | - | 透传至 Image 组件。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/image-viewer/type.ts) | N -images | Array | [] | 图片数组。TS 类型:`Array` | N -initial-index | Number | 0 | 初始化页码。TS 类型:`Number` | N -lazy | Boolean | true | 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 | N -max-zoom | Number | 3 | 图片最大放大比例 | N -show-index | Boolean | false | 是否显示页码 | N -using-custom-navbar | Boolean | false | 是否使用了自定义导航栏 | N -visible | Boolean | false | 隐藏/显示预览。支持语法糖 `v-model:visible` | N -default-visible | Boolean | false | 隐藏/显示预览。非受控属性 | N - -### ImageViewer Events - -名称 | 参数 | 描述 --- | -- | -- -change | `(context: { index: number })` | 翻页时回调 -close | `(context: { trigger: 'overlay' \| 'button', visible: Boolean, index: Number } )` | 点击操作按钮button或者overlay时触发 -delete | `(context: { index: number } )` | 点击删除操作按钮时触发 - -### ImageViewer Slots - -名称 | 描述 --- | -- -close-btn | 关闭操作 -delete-btn | 删除操作 diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts deleted file mode 100644 index e24fba904..000000000 --- a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/props.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable */ - -/** - * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * */ - -import type { TdImageViewerProps } from './type'; -export default { - /** 遮罩的背景颜色 */ - backgroundColor: { - type: String, - default: '', - }, - /** 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 */ - closeBtn: { - type: [String, Boolean, Object], - default: false as TdImageViewerProps['closeBtn'], - }, - /** 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 */ - deleteBtn: { - type: [String, Boolean, Object], - default: false as TdImageViewerProps['deleteBtn'], - }, - /** 透传至 Image 组件 */ - imageProps: { - type: Object, - }, - /** 图片数组 */ - images: { - type: Array, - default: (): TdImageViewerProps['images'] => [], - }, - /** 初始化页码 */ - initialIndex: { - type: Number, - default: 0, - }, - /** 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 */ - lazy: { - type: Boolean, - default: true, - }, - /** 图片最大放大比例 */ - maxZoom: { - type: Number, - default: 3, - }, - /** 是否显示页码 */ - showIndex: Boolean, - /** 是否使用了自定义导航栏 */ - usingCustomNavbar: Boolean, - /** 隐藏/显示预览 */ - visible: { - type: [Boolean, null], - default: null as TdImageViewerProps['visible'], - }, - /** 隐藏/显示预览,非受控属性 */ - defaultVisible: Boolean, - /** 翻页时回调 */ - onChange: { - type: Function, - default: () => ({}), - }, - /** 点击操作按钮button或者overlay时触发 */ - onClose: { - type: Function, - default: () => ({}), - }, - /** 点击删除操作按钮时触发 */ - onDelete: { - type: Function, - default: () => ({}), - }, -}; diff --git a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts b/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts deleted file mode 100644 index 2012b3efb..000000000 --- a/packages/tdesign-miniprogram/packages/uniapp-components/image-viewer/type.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* eslint-disable */ - -/** - * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC - * */ - -import type { TdImageProps as ImageProps } from '../image/type'; - -export interface TdImageViewerProps { - /** - * 遮罩的背景颜色 - * @default '' - */ - backgroundColor?: string; - /** - * 是否显示关闭操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `close`,值为 `Object` 类型,表示透传至 `icon` ,不传表示不显示图标 - * @default false - */ - closeBtn?: string | boolean | object; - /** - * 是否显示删除操作,前提需要开启页码。值为字符串表示图标名称,值为 `true` 表示使用默认图标 `delete`,值为 `Object` 类型,表示透传至 `icon`,不传表示不显示图标 - * @default false - */ - deleteBtn?: string | boolean | object; - /** - * 透传至 Image 组件 - */ - imageProps?: ImageProps; - /** - * 图片数组 - * @default [] - */ - images?: Array; - /** - * 初始化页码 - * @default 0 - */ - initialIndex?: Number; - /** - * 是否开启图片懒加载。开启后会预加载当前图片、相邻图片 - * @default true - */ - lazy?: boolean; - /** - * 图片最大放大比例 - * @default 3 - */ - maxZoom?: number; - /** - * 是否显示页码 - * @default false - */ - showIndex?: boolean; - /** - * 是否使用了自定义导航栏 - * @default false - */ - usingCustomNavbar?: boolean; - /** - * 隐藏/显示预览 - * @default false - */ - visible?: boolean; - /** - * 隐藏/显示预览,非受控属性 - * @default false - */ - defaultVisible?: boolean; - /** - * 翻页时回调 - */ - onChange?: (context: { index: number }) => void; - /** - * 点击操作按钮button或者overlay时触发 - */ - onClose?: (context: { trigger: 'overlay' | 'button'; visible: Boolean; index: Number }) => void; - /** - * 点击删除操作按钮时触发 - */ - onDelete?: (context: { index: number }) => void; -}