Skip to content

Commit 057bfa8

Browse files
authored
feat(Search): add cursor-color prop (#794)
* feat(Search): add cursor-color prop * docs(Search): add version info
1 parent 8e7ae42 commit 057bfa8

File tree

14 files changed

+137
-26
lines changed

14 files changed

+137
-26
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-miniprogram/packages/components/search/README.en-US.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ clearable | Boolean | true | \- | N
1717
confirm-hold | Boolean | false | \- | N
1818
confirm-type | String | search | options: send/search/next/go/done | N
1919
cursor | Number | -1 | required | Y
20+
cursor-color | String | #0052d9 | `1.12.1` | N
2021
cursor-spacing | Number | 0 | \- | N
2122
disabled | Boolean | false | \- | N
2223
focus | Boolean | false | \- | N
@@ -29,7 +30,7 @@ placeholder | String | '' | \- | N
2930
placeholder-class | String | input-placeholder | \- | N
3031
placeholder-style | String | - | required | Y
3132
readonly | Boolean | undefined | \- | N
32-
result-list | Array | [] | Typescript`Array<string>` | N
33+
result-list | Array | [] | Typescript: `Array<string>` | N
3334
right-icon | String | 'close-circle-filled' | `deprecated` | N
3435
selection-end | Number | -1 | \- | N
3536
selection-start | Number | -1 | \- | N

packages/products/tdesign-miniprogram/packages/components/search/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ clearable | Boolean | true | 是否启用清除控件 | N
1717
confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N
1818
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
1919
cursor | Number | -1 | 必需。指定 focus 时的光标位置 | Y
20+
cursor-color | String | #0052d9 | `1.12.1`。光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 | N
2021
cursor-spacing | Number | 0 | 搜索框聚焦时底部与键盘的距离 | N
2122
disabled | Boolean | false | 是否禁用 | N
2223
focus | Boolean | false | 是否聚焦 | N

packages/products/tdesign-miniprogram/packages/components/search/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ const props: TdSearchProps = {
5252
value: -1,
5353
required: true,
5454
},
55+
/** 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 */
56+
cursorColor: {
57+
type: String,
58+
value: '#0052d9',
59+
},
5560
/** 搜索框聚焦时底部与键盘的距离 */
5661
cursorSpacing: {
5762
type: Number,

packages/products/tdesign-miniprogram/packages/components/search/type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ export interface TdSearchProps {
7878
value?: number;
7979
required?: boolean;
8080
};
81+
/**
82+
* 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制
83+
* @default #0052d9
84+
*/
85+
cursorColor?: {
86+
type: StringConstructor;
87+
value?: string;
88+
};
8189
/**
8290
* 搜索框聚焦时底部与键盘的距离
8391
* @default 0

packages/products/tdesign-mobile-react/src/search/defaultProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const searchDefaultProps: TdSearchProps = {
99
center: false,
1010
clearTrigger: 'always',
1111
clearable: true,
12+
cursorColor: '#0052d9',
1213
disabled: false,
1314
focus: false,
1415
leftIcon: 'search',

packages/products/tdesign-mobile-react/src/search/search.en-US.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,27 @@
77
name | type | default | description | required
88
-- | -- | -- | -- | --
99
className | String | - | className of component | N
10-
style | Object | - | CSS(Cascading Style Sheets),Typescript`React.CSSProperties` | N
11-
action | TNode | '' | Typescript`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
12-
autocompleteOptions | Array | - | autocomplete words list。Typescript`Array<AutocompleteOption>` `type AutocompleteOption = string \| { label: string \| TNode; group?: boolean }`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/search/type.ts) | N
10+
style | Object | - | CSS(Cascading Style Sheets),Typescript: `React.CSSProperties` | N
11+
action | TNode | '' | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
12+
autocompleteOptions | Array | - | autocomplete words list。Typescript: `Array<AutocompleteOption>` `type AutocompleteOption = string \| { label: string \| TNode; group?: boolean }`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/search/type.ts) | N
1313
center | Boolean | false | \- | N
1414
clearTrigger | String | always | show clear icon, clicked to clear input value。options: always / focus | N
1515
clearable | Boolean | true | \- | N
16+
cursorColor | String | #0052d9 | `0.21.2` | N
1617
disabled | Boolean | false | \- | N
1718
focus | Boolean | false | \- | N
18-
leftIcon | TNode | 'search' | Typescript`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
19+
leftIcon | TNode | 'search' | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1920
placeholder | String | '' | \- | N
20-
prefixIcon | TElement | - | `deprecated`。Typescript`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
21+
prefixIcon | TElement | - | `deprecated`。Typescript: `TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2122
readonly | Boolean | undefined | \- | N
2223
shape | String | 'square' | options: square/round | N
23-
suffixIcon | TElement | - | `deprecated`。Typescript`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
24+
suffixIcon | TElement | - | `deprecated`。Typescript: `TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2425
value | String | - | \- | N
2526
defaultValue | String | - | uncontrolled property | N
26-
onActionClick | Function | | Typescript`({}) => void`<br/> | N
27-
onBlur | Function | | Typescript`(context: { value: string; e: FocusEvent }) => void`<br/> | N
28-
onChange | Function | | Typescript`(value: string, context: { trigger: 'input-change' \| 'option-click'; e?: InputEvent \| MouseEvent }) => void`<br/> | N
29-
onClear | Function | | Typescript`(context: { e: MouseEvent }) => void`<br/> | N
30-
onFocus | Function | | Typescript`(context: { value: string; e: FocusEvent }) => void`<br/> | N
31-
onSearch | Function | | Typescript`(context?: { value: string; trigger: 'submit' \| 'option-click' \| 'clear'; e?: InputEvent \| MouseEvent }) => void`<br/> | N
32-
onSubmit | Function | | Typescript`(context: { value: string; e: KeyboardEvent }) => void`<br/> | N
27+
onActionClick | Function | | Typescript: `({}) => void`<br/> | N
28+
onBlur | Function | | Typescript: `(context: { value: string; e: FocusEvent }) => void`<br/> | N
29+
onChange | Function | | Typescript: `(value: string, context: { trigger: 'input-change' \| 'option-click'; e?: InputEvent \| MouseEvent }) => void`<br/> | N
30+
onClear | Function | | Typescript: `(context: { e: MouseEvent }) => void`<br/> | N
31+
onFocus | Function | | Typescript: `(context: { value: string; e: FocusEvent }) => void`<br/> | N
32+
onSearch | Function | | Typescript: `(context?: { value: string; trigger: 'submit' \| 'option-click' \| 'clear'; e?: InputEvent \| MouseEvent }) => void`<br/> | N
33+
onSubmit | Function | | Typescript: `(context: { value: string; e: KeyboardEvent }) => void`<br/> | N

packages/products/tdesign-mobile-react/src/search/search.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ autocompleteOptions | Array | - | 【讨论中】联想词列表,如果不存
1313
center | Boolean | false | 是否居中 | N
1414
clearTrigger | String | always | 清空图标触发方式,仅在输入框有值时有效。可选项:always / focus | N
1515
clearable | Boolean | true | 是否启用清除控件 | N
16+
cursorColor | String | #0052d9 | `0.21.2`。光标颜色 | N
1617
disabled | Boolean | false | 是否禁用 | N
1718
focus | Boolean | false | 是否聚焦 | N
1819
leftIcon | TNode | 'search' | 左侧图标。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-react/src/search/type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export interface TdSearchProps {
3232
* @default true
3333
*/
3434
clearable?: boolean;
35+
/**
36+
* 光标颜色
37+
* @default #0052d9
38+
*/
39+
cursorColor?: string;
3540
/**
3641
* 是否禁用
3742
* @default false

packages/products/tdesign-mobile-vue/src/search/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export default {
3333
type: Boolean,
3434
default: true,
3535
},
36+
/** 光标颜色 */
37+
cursorColor: {
38+
type: String,
39+
default: '#0052d9',
40+
},
3641
/** 禁用状态 */
3742
disabled: Boolean,
3843
/** 是否聚焦 */

0 commit comments

Comments
 (0)