Skip to content

Commit

Permalink
fix: fix cr
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Nov 28, 2022
1 parent 9e65166 commit 2b428cc
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ isComponent: true
-- | -- | -- | -- | --
align | String | left | 文本内容位置,居左/居中/居右。可选项:left/center/right | N
layout | String | horizontal | 标题输入框布局方式。可选项:vertical/horizontal | N
bordered | Boolean | false | 是否显示外边框 | N
borderless | Boolean | true | 是否开启无边框模式 | N
clearable | Boolean | false | 是否可清空 | N
clearable-icon-props | Object | {} | 透传至组件清楚图标 `icon` | N
custom-style `v0.25.0` | String | - | 自定义组件样式 | N
Expand All @@ -86,7 +86,7 @@ suffix | String / Slot | - | 后置图标前的后置内容 | N
suffix-icon | String / Slot | - | 后置文本内容,值为字符串则表示图标名称 | N
suffix-icon-props | Object | {} | 透传至组件后缀图标 `suffix-icon` | N
tips | String / Slot | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式 | N
type | String | text | 输入框类型。可选项:text/number/idcard/digit/safe-password/password | N
type | String | text | 输入框类型。可选项:text/number/idcard/digit/safe-password/password/nickname | N
value | String / Number | - | 输入框的值。TS 类型:`InputValue` `type InputValue = string | number`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
default-value | String / Number | undefined | 输入框的值。非受控属性。TS 类型:`InputValue` `type InputValue = string | number`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
password | Boolean | false | 是否是密码类型(已废弃,请更为使用 type 指定输入框类型) | N
Expand Down
8 changes: 4 additions & 4 deletions src/input/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,21 @@ exports[`Input Input base demo works fine 1`] = `
exports[`Input Input bordered demo works fine 1`] = `
<bordered>
<t-input
bordered="{{true}}"
borderless="{{false}}"
placeholder="请输入文字"
/>
<t-input
bordered="{{true}}"
borderless="{{false}}"
placeholder="请输入文字"
status="success"
/>
<t-input
bordered="{{true}}"
borderless="{{false}}"
placeholder="请输入文字"
status="warning"
/>
<t-input
bordered="{{true}}"
borderless="{{false}}"
placeholder="请输入文字"
status="error"
suffixIcon="error-circle-filled"
Expand Down
4 changes: 2 additions & 2 deletions src/input/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`input props : clearable && label && suffix 1`] = `
class="t-input__wrap"
>
<wx-view
class="t-input__content t-is-default "
class="t-input__content t-is-default "
>
<wx-input
adjustPosition="{{true}}"
Expand Down Expand Up @@ -133,7 +133,7 @@ exports[`input slots : label 1`] = `
class="t-input__wrap"
>
<wx-view
class="t-input__content t-is-default "
class="t-input__content t-is-default "
>
<wx-input
adjustPosition="{{true}}"
Expand Down
6 changes: 3 additions & 3 deletions src/input/__test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ describe('input', () => {
class="base"
align="{{align}}"
size="{{size}}"
bordered="{{bordered}}"
borderless="{{borderless}}"
></t-input>`,
data: {
bordered: true,
borderless: false,
align: 'center',
size: 'small',
},
Expand All @@ -78,7 +78,7 @@ describe('input', () => {
comp.attach(document.createElement('parent-wrapper'));

const component = comp.querySelector('.base >>> .t-input__content');
expect(component.dom.getAttribute('class').includes('t-is-border')).toBeTruthy();
expect(component.dom.getAttribute('class').includes('t-input--border')).toBeTruthy();

expect(
comp.querySelector('.base >>> .t-input').dom.getAttribute('class').includes('t-input--size-small'),
Expand Down
14 changes: 10 additions & 4 deletions src/input/_example/bordered/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<t-input placeholder="请输入文字" bordered />
<t-input placeholder="请输入文字" status="success" bordered />
<t-input placeholder="请输入文字" status="warning" bordered />
<t-input placeholder="请输入文字" suffixIcon="error-circle-filled" status="error" tips="错误提示文字" bordered />
<t-input placeholder="请输入文字" borderless="{{false}}" />
<t-input placeholder="请输入文字" status="success" borderless="{{false}}" />
<t-input placeholder="请输入文字" status="warning" borderless="{{false}}" />
<t-input
placeholder="请输入文字"
suffixIcon="error-circle-filled"
status="error"
tips="错误提示文字"
borderless="{{false}}"
/>
14 changes: 7 additions & 7 deletions src/input/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,25 @@
line-height: 40rpx;
padding-top: (@spacer / 2);
}
}

.@{prefix}-is-border {
padding: 24rpx 32rpx;
border-radius: @input-border-radius;
border: 3rpx solid @input-default-border-color;
&--border {
padding: 24rpx 32rpx;
border-radius: @input-border-radius;
border: 3rpx solid @input-default-border-color;
}
}

&.@{prefix}-is-focus {
border-color: @input-default-focus-border-color;
box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.05), 0 4px 5px 0 rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
box-shadow: @shadow-1;
}

.input-status(@status) {
.@{prefix}-is-@{status} {
@borderColor: 'input-@{status}-border-color';
@tipsColor: 'input-@{status}-tips-color';

&.@{prefix}-is-border {
&.@{prefix}-input--border {
border-color: @@borderColor;
}

Expand Down
2 changes: 1 addition & 1 deletion src/input/input.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<view class="{{classPrefix}}__wrap">
<view
class="{{classPrefix}}__content {{prefix}}-is-{{status}} {{bordered ? prefix + '-is-border' : ''}} {{ focus ? prefix + '-is-focus' : ''}}"
class="{{classPrefix}}__content {{prefix}}-is-{{status}} {{borderless ? '' : classPrefix + '--border'}} {{ focus ? prefix + '-is-focus' : ''}}"
>
<input
disabled="{{disabled}}"
Expand Down
6 changes: 3 additions & 3 deletions src/input/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const props: TdInputProps = {
type: String,
value: 'horizontal',
},
/** 是否显示外边框 */
bordered: {
/** 是否开启无边框模式 */
borderless: {
type: Boolean,
value: false,
value: true,
},
/** 是否可清空 */
clearable: {
Expand Down
7 changes: 4 additions & 3 deletions src/input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export interface TdInputProps {
type: StringConstructor;
value?: 'horizontal' | 'vertical';
};
/** 是否显示外边框
* @default false
/**
* 是否开启无边框模式
* @default true
*/
bordered: {
borderless?: {
type: BooleanConstructor;
value?: boolean;
};
Expand Down

0 comments on commit 2b428cc

Please sign in to comment.