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

fix(Search): fixed disabled style error #3437

Merged
merged 3 commits 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
4 changes: 2 additions & 2 deletions src/search/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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' | Clear icon trigger, effective only when the input has a value. 。options: always/focus | 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,7 +27,7 @@ maxlength | Number | -1 | \- | N
placeholder | String | '' | \- | N
placeholder-class | String | input-placeholder | \- | N
placeholder-style | String | - | required | Y
readonly | Boolean | false | If readonly the input | N
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
4 changes: 2 additions & 2 deletions src/search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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
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 @@ -75,7 +75,7 @@ maxlength | Number | -1 | 用户最多可以输入的文本长度,一个中文
placeholder | String | '' | 占位符 | N
placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
readonly | Boolean | false | 只读模式 | N
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
4 changes: 2 additions & 2 deletions src/search/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ exports[`search Props :base 1`] = `
<wx-input
adjustPosition="{{true}}"
alwaysEmbed="{{false}}"
class="t-input__keyword t-class-input"
class="t-input__keyword t-class-input "
confirmHold="{{false}}"
confirmType="search"
cursor="{{0}}"
cursorSpacing="{{0}}"
disabled="{{false}}"
disabled="{{null}}"
focus="{{false}}"
holdKeyboard="{{false}}"
maxlength="{{-1}}"
Expand Down
13 changes: 4 additions & 9 deletions src/search/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const props: TdSearchProps = {
type: Boolean,
value: false,
},
/** 清空图标触发方式,仅在输入框有值时有效 */
/** 清空图标触发方式,仅在输入框有值时有效 */
clearTrigger: {
type: String,
value: 'always',
Expand Down Expand Up @@ -101,10 +101,10 @@ const props: TdSearchProps = {
value: '',
required: true,
},
/** 只读模式 */
/** 只读状态 */
readonly: {
type: Boolean,
value: false,
type: null,
value: undefined,
},
/** 预览结果列表 */
resultList: {
Expand All @@ -126,11 +126,6 @@ const props: TdSearchProps = {
type: String,
value: 'square',
},
/** 自定义组件样式 */
style: {
type: String,
value: '',
},
/** 拉起键盘的类型 */
type: {
type: String,
Expand Down
8 changes: 8 additions & 0 deletions src/search/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@search-padding: var(--td-search-padding, 16rpx 24rpx);
@search-placeholder-color: var(--td-search-placeholder-color, @text-color-placeholder);
@search-icon-color: var(--td-search-icon-color, @text-color-placeholder);
@search-disabled-text-color: var(--td-search-disabled-text-color, @text-color-disabled); // 输入框禁用态文本颜色
@search-icon-font-size: var(--td-search-icon-font-size, 48rpx);
@search-square-radius: var(--td-search-square-radius, @radius-default);
@search-round-radius: calc(@search-height / 2);
Expand Down Expand Up @@ -62,6 +63,13 @@
line-height: 48rpx;
}

.@{prefix}-input--disabled {
color: @search-disabled-text-color;
cursor: not-allowed;
opacity: 1;
-webkit-text-fill-color: currentColor; // fix disabled color in iOS
}

.@{prefix}-icon {
color: @search-icon-color;
font-size: @search-icon-font-size;
Expand Down
2 changes: 1 addition & 1 deletion src/search/search.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
name="input"
maxlength="{{maxlength}}"
disabled="{{disabled || readonly}}"
class="{{prefix}}-input__keyword {{prefix}}-class-input"
class="{{prefix}}-input__keyword {{prefix}}-class-input {{ disabled ? prefix + '-input--disabled' : ''}}"
focus="{{focus}}"
value="{{value}}"
confirm-type="{{confirmType}}"
Expand Down
15 changes: 3 additions & 12 deletions src/search/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export interface TdSearchProps {
value?: boolean;
};
/**
* 清空图标触发方式,仅在输入框有值时有效
* @default 'always'
* 清空图标触发方式,仅在输入框有值时有效
* @default always
*/
clearTrigger?: {
type: StringConstructor;
Expand Down Expand Up @@ -158,8 +158,7 @@ export interface TdSearchProps {
required?: boolean;
};
/**
* 只读模式
* @default false
* 只读状态
*/
readonly?: {
type: BooleanConstructor;
Expand Down Expand Up @@ -197,14 +196,6 @@ export interface TdSearchProps {
type: StringConstructor;
value?: 'square' | 'round';
};
/**
* 自定义组件样式
* @default ''
*/
style?: {
type: StringConstructor;
value?: string;
};
/**
* 拉起键盘的类型
* @default 'text'
Expand Down
Loading