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(Search): add clearTrigger and readonly props #521

Merged
merged 1 commit into from
Jan 8, 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.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ action | String / Slot | '' | [see more ts definition](https://github.com/Tencen
adjust-position | Boolean | true | \- | N
always-embed | Boolean | false | \- | N
center | Boolean | false | \- | N
clear-trigger | String | always | show clear icon, clicked to clear input value。options: always / focus | N
clearable | Boolean | true | \- | N
confirm-hold | Boolean | false | \- | N
confirm-type | String | search | options: send/search/next/go/done | N
Expand All @@ -27,6 +28,7 @@ maxlength | Number | -1 | \- | N
placeholder | String | '' | \- | N
placeholder-class | String | input-placeholder | \- | N
placeholder-style | String | - | required | Y
readonly | Boolean | undefined | \- | N
result-list | Array | [] | Typescript:`Array<string>` | N
right-icon | String / Slot | 'close-circle-filled' | `deprecated`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
selection-end | Number | -1 | \- | N
Expand Down
2 changes: 2 additions & 0 deletions packages/products/tdesign-miniprogram/src/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ action | String / Slot | '' | 自定义右侧操作按钮文字。[通用类型
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
always-embed | Boolean | false | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | N
center | Boolean | false | 是否居中 | N
clear-trigger | String | always | 清空图标触发方式,仅在输入框有值时有效。可选项:always / focus | N
clearable | Boolean | true | 是否启用清除控件 | N
confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N
confirm-type | String | search | 设置键盘右下角按钮的文字,仅在type='text'时生效。<br />具体释义:<br />`send` 右下角按钮为“发送”;<br />`search` 右下角按钮为“搜索”;<br />`next` 右下角按钮为“下一个”;<br />`go` 右下角按钮为“前往”;<br />`done` 右下角按钮为“完成”。<br />[小程序官方文档](https://developers.weixin.qq.com/miniprogram/dev/component/input.html)。可选项:send/search/next/go/done | N
Expand All @@ -27,6 +28,7 @@ maxlength | Number | -1 | 用户最多可以输入的文本长度,一个中文
placeholder | String | '' | 占位符 | N
placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
readonly | Boolean | undefined | 只读状态 | N
result-list | Array | [] | 预览结果列表。TS 类型:`Array<string>` | N
right-icon | String / Slot | 'close-circle-filled' | 已废弃。右侧图标。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与 selection-start 搭配使用 | N
Expand Down
10 changes: 10 additions & 0 deletions packages/products/tdesign-miniprogram/src/search/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ const props: TdSearchProps = {
type: Boolean,
value: false,
},
/** 清空图标触发方式,仅在输入框有值时有效 */
clearTrigger: {
type: String,
value: 'always',
},
/** 是否启用清除控件 */
clearable: {
type: Boolean,
Expand Down Expand Up @@ -96,6 +101,11 @@ const props: TdSearchProps = {
value: '',
required: true,
},
/** 只读状态 */
readonly: {
type: null,
value: undefined,
},
/** 预览结果列表 */
resultList: {
type: Array,
Expand Down
15 changes: 15 additions & 0 deletions packages/products/tdesign-miniprogram/src/search/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export interface TdSearchProps {
type: BooleanConstructor;
value?: boolean;
};
/**
* 清空图标触发方式,仅在输入框有值时有效
* @default always
*/
clearTrigger?: {
type: StringConstructor;
value?: 'always' | 'focus';
};
/**
* 是否启用清除控件
* @default true
Expand Down Expand Up @@ -149,6 +157,13 @@ export interface TdSearchProps {
value?: string;
required?: boolean;
};
/**
* 只读状态
*/
readonly?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 预览结果列表
* @default []
Expand Down
47 changes: 45 additions & 2 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -94007,6 +94007,47 @@
"Boolean"
]
},
{
"id": 1736333588,
"platform_framework": [
"8",
"16",
"64"
],
"component": "Search",
"field_category": 1,
"field_name": "clearTrigger",
"field_type": [
"1"
],
"field_default_value": "always",
"field_enum": "always / focus",
"field_desc_zh": "清空图标触发方式,仅在输入框有值时有效",
"field_desc_en": "show clear icon, clicked to clear input value",
"field_required": 0,
"event_input": "",
"create_time": "2025-01-08 10:53:08",
"update_time": "2025-01-08 10:53:08",
"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": [
"Vue(Mobile)",
"React(Mobile)",
"Miniprogram"
],
"field_type_text": [
"String"
]
},
{
"id": 2780,
"platform_framework": [
Expand Down Expand Up @@ -95090,7 +95131,8 @@
"4",
"8",
"16",
"32"
"32",
"64"
],
"component": "Search",
"field_category": 1,
Expand Down Expand Up @@ -95123,7 +95165,8 @@
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
"Angular(Mobile)",
"Miniprogram"
],
"field_type_text": [
"Boolean"
Expand Down
Loading