Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mobile-vue): support yBounds #547

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified db/TDesign.db
Binary file not shown.
2 changes: 2 additions & 0 deletions packages/products/tdesign-mobile-vue/src/fab/fab.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
name | type | default | description | required
-- | -- | -- | -- | --
buttonProps | Object | - | Typescript:`ButtonProps`,[Button API Documents](./button?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/fab/type.ts) | N
draggable | String / Boolean | false | Typescript:`boolean \| FabDirectionEnum ` `type FabDirectionEnum = 'all' \| 'vertical' \| 'horizontal'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/fab/type.ts) | N
icon | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
style | String | right: 16px; bottom: 32px; | \- | N
text | String | - | \- | N
yBounds | Array | - | Typescript:`Array<string \| number>` | N
onClick | Function | | Typescript:`(context: {e: MouseEvent}) => void`<br/> | N
onDragEnd | Function | | Typescript:`(e: TouchEvent) => void`<br/> | N
onDragStart | Function | | Typescript:`(e: TouchEvent) => void`<br/> | N
Expand Down
2 changes: 2 additions & 0 deletions packages/products/tdesign-mobile-vue/src/fab/fab.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
buttonProps | Object | - | 透传至 Button 组件。TS 类型:`ButtonProps`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/fab/type.ts) | N
draggable | String / Boolean | false | 是否可拖拽。`true` / `'all'`可拖动<br>`'vertical'`可垂直拖动<br>`'horizontal'`可水平拖动<br>`false`禁止拖动。TS 类型:`boolean \| FabDirectionEnum ` `type FabDirectionEnum = 'all' \| 'vertical' \| 'horizontal'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/fab/type.ts) | N
icon | Slot / Function | - | 图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
style | String | right: 16px; bottom: 32px; | 悬浮按钮的样式,常用于调整位置 | N
text | String | - | 文本内容 | N
yBounds | Array | - | 设置垂直方向边界限制,示例:[48, 48] 或 ['96px', 80]。TS 类型:`Array<string \| number>` | N
onClick | Function | | TS 类型:`(context: {e: MouseEvent}) => void`<br/>悬浮按钮点击事件 | N
onDragEnd | Function | | TS 类型:`(e: TouchEvent) => void`<br/>结束拖拽时触发 | N
onDragStart | Function | | TS 类型:`(e: TouchEvent) => void`<br/>开始拖拽时触发 | N
Expand Down
9 changes: 9 additions & 0 deletions packages/products/tdesign-mobile-vue/src/fab/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export default {
buttonProps: {
type: Object as PropType<TdFabProps['buttonProps']>,
},
/** 是否可拖拽。`true` / `'all'`可拖动<br>`'vertical'`可垂直拖动<br>`'horizontal'`可水平拖动<br>`false`禁止拖动 */
draggable: {
type: [String, Boolean] as PropType<TdFabProps['draggable']>,
default: false,
},
/** 图标 */
icon: {
type: Function as PropType<TdFabProps['icon']>,
Expand All @@ -26,6 +31,10 @@ export default {
type: String,
default: '',
},
/** 设置垂直方向边界限制,示例:[48, 48] 或 ['96px', 80] */
yBounds: {
type: Array as PropType<TdFabProps['yBounds']>,
},
/** 悬浮按钮点击事件 */
onClick: Function as PropType<TdFabProps['onClick']>,
/** 结束拖拽时触发 */
Expand Down
11 changes: 11 additions & 0 deletions packages/products/tdesign-mobile-vue/src/fab/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export interface TdFabProps {
* 透传至 Button 组件
*/
buttonProps?: ButtonProps;
/**
* 是否可拖拽。`true` / `'all'`可拖动<br>`'vertical'`可垂直拖动<br>`'horizontal'`可水平拖动<br>`false`禁止拖动
* @default false
*/
draggable?: boolean | FabDirectionEnum;
/**
* 图标
*/
Expand All @@ -26,6 +31,10 @@ export interface TdFabProps {
* @default ''
*/
text?: string;
/**
* 设置垂直方向边界限制,示例:[48, 48] 或 ['96px', 80]
*/
yBounds?: Array<string | number>;
/**
* 悬浮按钮点击事件
*/
Expand All @@ -39,3 +48,5 @@ export interface TdFabProps {
*/
onDragStart?: (e: TouchEvent) => void;
}

export type FabDirectionEnum = 'all' | 'vertical' | 'horizontal';
39 changes: 39 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -47904,6 +47904,7 @@
{
"id": 1711969167,
"platform_framework": [
"8",
"64"
],
"component": "Fab",
Expand Down Expand Up @@ -47933,6 +47934,7 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"Miniprogram"
],
"field_type_text": [
Expand Down Expand Up @@ -48211,6 +48213,43 @@
"Array"
]
},
{
"id": 1739415473,
"platform_framework": [
"8"
],
"component": "Fab",
"field_category": 1,
"field_name": "yBounds",
"field_type": [
"16"
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "设置垂直方向边界限制,示例:[48, 48] 或 ['96px', 80]",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2025-02-13 02:57:53",
"update_time": "2025-02-13 02:57:53",
"event_output": null,
"custom_field_type": "Array<string | number>",
"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": [
"Vue(Mobile)"
],
"field_type_text": [
"Array"
]
},
{
"id": 2505,
"platform_framework": [
Expand Down