Skip to content

Commit 74081b3

Browse files
authored
feat: supplementary slots (#3617)
* feat(Cascader): support header slot * docs(Input): generate api docs * test: update snapshots
1 parent 3bb36a9 commit 74081b3

File tree

8 files changed

+17
-22
lines changed

8 files changed

+17
-22
lines changed

src/cascader/README.en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
1010
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
1111
check-strictly | Boolean | false | \- | N
1212
close-btn | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
13+
header | Slot | - | `1.9.1`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
1314
keys | Object | - | Typescript:`KeysType`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
1415
options | Array | [] | Typescript:`Array<CascaderOption>` | N
1516
placeholder | String | 选择选项 | \- | N

src/cascader/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ style | Object | - | 样式 | N
6262
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
6363
check-strictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
6464
close-btn | Boolean / Slot | true | 关闭按钮。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
65+
header | Slot | - | `1.9.1`。头部。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
6566
keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
6667
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
6768
placeholder | String | 选择选项 | 未选中时的提示文案 | N

src/cascader/cascader.wxml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<slot name="close-btn" />
1111
<t-icon wx:if="{{closeBtn}}" size="48rpx" name="close" />
1212
</view>
13+
14+
<slot name="header" />
15+
1316
<view class="{{name}}__content">
1417
<block wx:if="{{steps && steps.length}}">
1518
<view wx:if="{{theme == 'step'}}" class="{{name}}__steps">

src/input/README.en-US.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
1010
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
1111
adjust-position | Boolean | true | \- | N
1212
align | String | left | text align type。options: left/center/right | N
13-
allow-input-over-max | Boolean | false | `1.8.6`. allow to continue input on value length is over `maxlength` or `maxcharacter` | N
13+
allow-input-over-max | Boolean | false | `1.8.6`allow to continue input on value length is over `maxlength` or `maxcharacter` | N
1414
always-embed | Boolean | false | \- | N
1515
auto-focus | Boolean | false | \- | N
1616
borderless | Boolean | false | input without border | N
@@ -23,6 +23,7 @@ cursor-color | String | #0052d9 | \- | N
2323
cursor-spacing | Number | 0 | \- | N
2424
disabled | Boolean | undefined | make input to be disabled | N
2525
error-message | String | - | `deprecated` | N
26+
extra | Slot | - | `1.9.1`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
2627
focus | Boolean | false | \- | N
2728
format | Function | - | input value formatter, `type=number` does not work. if you need to format number, `InputNumber` Component might be better。Typescript:`InputFormatType` `type InputFormatType = (value: InputValue) => string`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
2829
hold-keyboard | Boolean | false | \- | N
@@ -35,7 +36,7 @@ placeholder | String | undefined | \- | N
3536
placeholder-class | String | input-placeholder | \- | N
3637
placeholder-style | String | - | required | Y
3738
prefix-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
38-
readonly | Boolean | undefined | \- | N
39+
readonly | Boolean | undefined | `1.8.6` | N
3940
safe-password-cert-path | String | - | \- | N
4041
safe-password-custom-hash | String | - | \- | N
4142
safe-password-length | Number | - | \- | N
@@ -108,4 +109,4 @@ Name | Default Value | Description
108109
--td-input-suffix-text-color | @text-color-primary | -
109110
--td-input-vertical-padding | 32rpx | -
110111
--td-input-warning-text-color | @warning-color | -
111-
--td-input-warning-tips-color | @warning-color | -
112+
--td-input-warning-tips-color | @warning-color | -

src/input/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ cursor-color | String | #0052d9 | 光标颜色。iOS 下的格式为十六进制
102102
cursor-spacing | Number | 0 | 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 | N
103103
disabled | Boolean | undefined | 是否禁用输入框 | N
104104
error-message | String | - | 已废弃。错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips) | N
105+
extra | Slot | - | `1.9.1`。右侧额外内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
105106
focus | Boolean | false | 获取焦点 | N
106107
format | Function | - | 指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => string`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
107108
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
@@ -114,7 +115,7 @@ placeholder | String | undefined | 占位符 | N
114115
placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
115116
placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
116117
prefix-icon | String / Object / Slot | - | 组件前置图标。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon`[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
117-
readonly | Boolean | undefined | 只读状态 | N
118+
readonly | Boolean | undefined | `1.8.6`只读状态 | N
118119
safe-password-cert-path | String | - | 安全键盘加密公钥的路径,只支持包内路径 | N
119120
safe-password-custom-hash | String | - | 安全键盘计算 hash 的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` | N
120121
safe-password-length | Number | - | 安全键盘输入密码长度 | N
@@ -187,4 +188,4 @@ t-class-tips | 提示样式类
187188
--td-input-suffix-text-color | @text-color-primary | -
188189
--td-input-vertical-padding | 32rpx | -
189190
--td-input-warning-text-color | @warning-color | -
190-
--td-input-warning-tips-color | @warning-color | -
191+
--td-input-warning-tips-color | @warning-color | -

src/input/__test__/__snapshots__/demo.test.js.snap

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,18 +273,7 @@ exports[`Input Input suffix demo works fine 1`] = `
273273
bind:click="click"
274274
/>
275275
<t-input
276-
label="标签文字"
277-
placeholder="请输入文字"
278-
>
279-
<t-button
280-
size="extra-small"
281-
slot="suffix"
282-
theme="primary"
283-
>
284-
操作按钮
285-
</t-button>
286-
</t-input>
287-
<t-input
276+
class="extra"
288277
label="标签文字"
289278
placeholder="请输入文字"
290279
tips="最多十个字"

src/input/_example/suffix/index.wxml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
bind:click="click"
66
/>
77

8-
<t-input label="标签文字" placeholder="请输入文字">
9-
<t-button slot="suffix" theme="primary" size="extra-small"> 操作按钮 </t-button>
10-
</t-input>
11-
12-
<t-input label="标签文字" placeholder="请输入文字" tips="最多十个字">
8+
<t-input class="extra" label="标签文字" placeholder="请输入文字" tips="最多十个字">
139
<t-button slot="extra" theme="primary" maxcharacter="{{10}}" size="extra-small"> 操作按钮 </t-button>
1410
</t-input>
1511

src/input/_example/suffix/index.wxss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.extra {
2+
--td-input-align-items: start;
3+
}

0 commit comments

Comments
 (0)