diff --git a/db/TDesign.db b/db/TDesign.db index 432830c9f..07a9a269b 100644 Binary files a/db/TDesign.db and b/db/TDesign.db differ diff --git a/packages/products/tdesign-mobile-vue/src/search/props.ts b/packages/products/tdesign-mobile-vue/src/search/props.ts new file mode 100644 index 000000000..d9dba579b --- /dev/null +++ b/packages/products/tdesign-mobile-vue/src/search/props.ts @@ -0,0 +1,96 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +import { TdSearchProps } from './type'; +import { PropType } from 'vue'; + +export default { + /** 自定义右侧操作按钮文字,如:“取消” */ + action: { + type: [String, Function] as PropType, + default: '', + }, + /** 【讨论中】联想词列表,如果不存在或长度为 0 则不显示联想框。可以使用函数 `label` 自定义联想词为任意内容;也可使用插槽 `option` 定义联想词内容,插槽参数为 `{ option: AutocompleteOption; index: number }`。如果 `group` 值为 `true` 则表示当前项为分组标题 */ + autocompleteOptions: { + type: Array as PropType, + }, + /** 是否居中 */ + center: Boolean, + /** 是否可清空 */ + clearable: { + type: Boolean, + default: true, + }, + /** 禁用状态 */ + disabled: Boolean, + /** 是否聚焦 */ + focus: Boolean, + /** 左侧图标 */ + leftIcon: { + type: [String, Function] as PropType, + default: 'search', + }, + /** 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 */ + maxcharacter: { + type: Number, + }, + /** 用户最多可以输入的文本长度,一个中文等于一个计数长度。默认为空,不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 */ + maxlength: { + type: [String, Number] as PropType, + }, + /** 占位符 */ + placeholder: { + type: String, + default: '', + }, + /** 只读状态 */ + readonly: { + type: Boolean, + default: undefined, + }, + /** 预览结果列表 */ + resultList: { + type: Array as PropType, + default: (): TdSearchProps['resultList'] => [], + }, + /** 搜索框形状 */ + shape: { + type: String as PropType, + default: 'square' as TdSearchProps['shape'], + validator(val: TdSearchProps['shape']): boolean { + if (!val) return true; + return ['square', 'round'].includes(val); + }, + }, + /** 值,搜索关键词 */ + value: { + type: String, + default: undefined, + }, + modelValue: { + type: String, + default: undefined, + }, + /** 值,搜索关键词,非受控属性 */ + defaultValue: { + type: String, + default: '', + }, + /** 点击搜索框右侧操作内容时触发 */ + onActionClick: Function as PropType, + /** 失去焦点时触发 */ + onBlur: Function as PropType, + /** 搜索关键词发生变化时触发,可能场景有:搜索框内容发生变化、点击联想词 */ + onChange: Function as PropType, + /** 点击清除时触发 */ + onClear: Function as PropType, + /** 获得焦点时触发 */ + onFocus: Function as PropType, + /** 【讨论中】搜索触发,包含:手机键盘提交健、联想关键词点击、清空按钮点击等 */ + onSearch: Function as PropType, + /** 提交时触发,如:手机键盘提交按钮点击 */ + onSubmit: Function as PropType, +}; diff --git a/packages/products/tdesign-mobile-vue/src/search/search.en-US.md b/packages/products/tdesign-mobile-vue/src/search/search.en-US.md index a9a555eea..b001dc078 100644 --- a/packages/products/tdesign-mobile-vue/src/search/search.en-US.md +++ b/packages/products/tdesign-mobile-vue/src/search/search.en-US.md @@ -1,7 +1,6 @@ :: BASE_DOC :: ## API - ### Search Props name | type | default | description | required @@ -13,8 +12,11 @@ clearable | Boolean | true | \- | N disabled | Boolean | - | \- | N focus | Boolean | false | \- | N leftIcon | String / Slot / Function | 'search' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +maxcharacter | Number | - | The maximum number of characters that the user can enter. One Chinese character represents two characters in length. Use either `maxcharacter` or `maxlength` | N +maxlength | String / Number | - | The maximum length of text that the user can enter. One Chinese character is equal to one count length. By default, it is empty, and the input length is not limited. Use either `maxcharacter` or `maxlength` | N placeholder | String | '' | \- | N -readonly | Boolean | false | \- | N +readonly | Boolean | undefined | \- | N +resultList | Array | [] | Typescript:`Array` | N shape | String | 'square' | options: square/round | N value | String | - | `v-model` and `v-model:value` is supported | N defaultValue | String | - | uncontrolled property | N diff --git a/packages/products/tdesign-mobile-vue/src/search/search.md b/packages/products/tdesign-mobile-vue/src/search/search.md index 1edaf11d9..8ce6c6aa5 100644 --- a/packages/products/tdesign-mobile-vue/src/search/search.md +++ b/packages/products/tdesign-mobile-vue/src/search/search.md @@ -1,7 +1,6 @@ :: BASE_DOC :: ## API - ### Search Props 名称 | 类型 | 默认值 | 描述 | 必传 @@ -13,8 +12,11 @@ clearable | Boolean | true | 是否可清空 | N disabled | Boolean | - | 禁用状态 | N focus | Boolean | false | 是否聚焦 | N leftIcon | String / Slot / Function | 'search' | 左侧图标。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N +maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 | N +maxlength | String / Number | - | 用户最多可以输入的文本长度,一个中文等于一个计数长度。默认为空,不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 | N placeholder | String | '' | 占位符 | N -readonly | Boolean | false | 只读状态 | N +readonly | Boolean | undefined | 只读状态 | N +resultList | Array | [] | 预览结果列表。TS 类型:`Array` | N shape | String | 'square' | 搜索框形状。可选项:square/round | N value | String | - | 值,搜索关键词。支持语法糖 `v-model` 或 `v-model:value` | N defaultValue | String | - | 值,搜索关键词。非受控属性 | N diff --git a/packages/products/tdesign-mobile-vue/src/search/type.ts b/packages/products/tdesign-mobile-vue/src/search/type.ts new file mode 100644 index 000000000..08334196c --- /dev/null +++ b/packages/products/tdesign-mobile-vue/src/search/type.ts @@ -0,0 +1,126 @@ +/* eslint-disable */ + +/** + * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC + * */ + +import { TNode } from '../common'; + +export interface TdSearchProps { + /** + * 自定义右侧操作按钮文字,如:“取消” + * @default '' + */ + action?: string | TNode; + /** + * 【讨论中】联想词列表,如果不存在或长度为 0 则不显示联想框。可以使用函数 `label` 自定义联想词为任意内容;也可使用插槽 `option` 定义联想词内容,插槽参数为 `{ option: AutocompleteOption; index: number }`。如果 `group` 值为 `true` 则表示当前项为分组标题 + */ + autocompleteOptions?: Array; + /** + * 是否居中 + * @default false + */ + center?: boolean; + /** + * 是否可清空 + * @default true + */ + clearable?: boolean; + /** + * 禁用状态 + */ + disabled?: boolean; + /** + * 是否聚焦 + * @default false + */ + focus?: boolean; + /** + * 左侧图标 + * @default 'search' + */ + leftIcon?: string | TNode; + /** + * 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 + */ + maxcharacter?: number; + /** + * 用户最多可以输入的文本长度,一个中文等于一个计数长度。默认为空,不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 + */ + maxlength?: string | number; + /** + * 占位符 + * @default '' + */ + placeholder?: string; + /** + * 只读状态 + */ + readonly?: boolean; + /** + * 预览结果列表 + * @default [] + */ + resultList?: Array; + /** + * 搜索框形状 + * @default 'square' + */ + shape?: 'square' | 'round'; + /** + * 值,搜索关键词 + * @default '' + */ + value?: string; + /** + * 值,搜索关键词,非受控属性 + * @default '' + */ + defaultValue?: string; + /** + * 值,搜索关键词 + * @default '' + */ + modelValue?: string; + /** + * 点击搜索框右侧操作内容时触发 + * @default '' + */ + onActionClick?: (context: { e: MouseEvent }) => void; + /** + * 失去焦点时触发 + * @default '' + */ + onBlur?: (context: { value: string; e: FocusEvent }) => void; + /** + * 搜索关键词发生变化时触发,可能场景有:搜索框内容发生变化、点击联想词 + * @default '' + */ + onChange?: (value: string, context: { e?: InputEvent | MouseEvent }) => void; + /** + * 点击清除时触发 + * @default '' + */ + onClear?: (context: { e: MouseEvent }) => void; + /** + * 获得焦点时触发 + * @default '' + */ + onFocus?: (context: { value: string; e: FocusEvent }) => void; + /** + * 【讨论中】搜索触发,包含:手机键盘提交健、联想关键词点击、清空按钮点击等 + * @default '' + */ + onSearch?: (context?: { + value: string; + trigger: 'submit' | 'option-click' | 'clear'; + e?: InputEvent | MouseEvent; + }) => void; + /** + * 提交时触发,如:手机键盘提交按钮点击 + * @default '' + */ + onSubmit?: (context: { value: string; e: KeyboardEvent }) => void; +} + +export type AutocompleteOption = string | { label: string | TNode; group?: boolean }; diff --git a/packages/scripts/api.json b/packages/scripts/api.json index c4749e671..0f6db7b06 100644 --- a/packages/scripts/api.json +++ b/packages/scripts/api.json @@ -94958,6 +94958,7 @@ { "id": 1712030157, "platform_framework": [ + "8", "64" ], "component": "Search", @@ -94969,7 +94970,7 @@ "field_default_value": "", "field_enum": "", "field_desc_zh": "用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用", - "field_desc_en": null, + "field_desc_en": "The maximum number of characters that the user can enter. One Chinese character represents two characters in length. Use either `maxcharacter` or `maxlength`", "field_required": 0, "event_input": "", "create_time": "2024-04-02 03:55:57", @@ -94986,6 +94987,7 @@ "support_default_value": 0, "field_category_text": "Props", "platform_framework_text": [ + "Vue(Mobile)", "Miniprogram" ], "field_type_text": [ @@ -95029,6 +95031,45 @@ "Number" ] }, + { + "id": 1733883439, + "platform_framework": [ + "8" + ], + "component": "Search", + "field_category": 1, + "field_name": "maxlength", + "field_type": [ + "1", + "2" + ], + "field_default_value": "", + "field_enum": "", + "field_desc_zh": "用户最多可以输入的文本长度,一个中文等于一个计数长度。默认为空,不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用", + "field_desc_en": "The maximum length of text that the user can enter. One Chinese character is equal to one count length. By default, it is empty, and the input length is not limited. Use either `maxcharacter` or `maxlength`", + "field_required": 0, + "event_input": "", + "create_time": "2024-12-11 02:17:19", + "update_time": "2024-12-11 02:17:19", + "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)" + ], + "field_type_text": [ + "String", + "Number" + ] + }, { "id": 2841, "platform_framework": [ @@ -95399,6 +95440,7 @@ { "id": 1719488506, "platform_framework": [ + "8", "64" ], "component": "Search", @@ -95427,6 +95469,7 @@ "support_default_value": 0, "field_category_text": "Props", "platform_framework_text": [ + "Vue(Mobile)", "Miniprogram" ], "field_type_text": [