Skip to content

feat: supplementary slots #3617

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

Merged
merged 3 commits into from
Apr 27, 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
1 change: 1 addition & 0 deletions src/cascader/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
check-strictly | Boolean | false | \- | N
close-btn | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header | Slot | - | `1.9.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
keys | Object | - | Typescript:`KeysType`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | Typescript:`Array<CascaderOption>` | N
placeholder | String | 选择选项 | \- | N
Expand Down
1 change: 1 addition & 0 deletions src/cascader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
check-strictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N
close-btn | Boolean / Slot | true | 关闭按钮。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
header | Slot | - | `1.9.1`。头部。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
placeholder | String | 选择选项 | 未选中时的提示文案 | N
Expand Down
3 changes: 3 additions & 0 deletions src/cascader/cascader.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<slot name="close-btn" />
<t-icon wx:if="{{closeBtn}}" size="48rpx" name="close" />
</view>

<slot name="header" />

<view class="{{name}}__content">
<block wx:if="{{steps && steps.length}}">
<view wx:if="{{theme == 'step'}}" class="{{name}}__steps">
Expand Down
7 changes: 4 additions & 3 deletions src/input/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
adjust-position | Boolean | true | \- | N
align | String | left | text align type。options: left/center/right | N
allow-input-over-max | Boolean | false | `1.8.6`. allow to continue input on value length is over `maxlength` or `maxcharacter` | N
allow-input-over-max | Boolean | false | `1.8.6`allow to continue input on value length is over `maxlength` or `maxcharacter` | N
always-embed | Boolean | false | \- | N
auto-focus | Boolean | false | \- | N
borderless | Boolean | false | input without border | N
Expand All @@ -23,6 +23,7 @@ cursor-color | String | #0052d9 | \- | N
cursor-spacing | Number | 0 | \- | N
disabled | Boolean | undefined | make input to be disabled | N
error-message | String | - | `deprecated` | N
extra | Slot | - | `1.9.1`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
focus | Boolean | false | \- | N
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
hold-keyboard | Boolean | false | \- | N
Expand All @@ -35,7 +36,7 @@ placeholder | String | undefined | \- | N
placeholder-class | String | input-placeholder | \- | N
placeholder-style | String | - | required | Y
prefix-icon | String / Object / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
readonly | Boolean | undefined | \- | N
readonly | Boolean | undefined | `1.8.6` | N
safe-password-cert-path | String | - | \- | N
safe-password-custom-hash | String | - | \- | N
safe-password-length | Number | - | \- | N
Expand Down Expand Up @@ -108,4 +109,4 @@ Name | Default Value | Description
--td-input-suffix-text-color | @text-color-primary | -
--td-input-vertical-padding | 32rpx | -
--td-input-warning-text-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
5 changes: 3 additions & 2 deletions src/input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ cursor-color | String | #0052d9 | 光标颜色。iOS 下的格式为十六进制
cursor-spacing | Number | 0 | 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 | N
disabled | Boolean | undefined | 是否禁用输入框 | N
error-message | String | - | 已废弃。错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips) | N
extra | Slot | - | `1.9.1`。右侧额外内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
focus | Boolean | false | 获取焦点 | N
format | Function | - | 指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => string`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
Expand All @@ -114,7 +115,7 @@ placeholder | String | undefined | 占位符 | N
placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
prefix-icon | String / Object / Slot | - | 组件前置图标。值为字符串表示图标名称,值为 `Object` 类型,表示透传至 `icon`。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
readonly | Boolean | undefined | 只读状态 | N
readonly | Boolean | undefined | `1.8.6`。只读状态 | N
safe-password-cert-path | String | - | 安全键盘加密公钥的路径,只支持包内路径 | N
safe-password-custom-hash | String | - | 安全键盘计算 hash 的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` | N
safe-password-length | Number | - | 安全键盘输入密码长度 | N
Expand Down Expand Up @@ -187,4 +188,4 @@ t-class-tips | 提示样式类
--td-input-suffix-text-color | @text-color-primary | -
--td-input-vertical-padding | 32rpx | -
--td-input-warning-text-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
--td-input-warning-tips-color | @warning-color | -
13 changes: 1 addition & 12 deletions src/input/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,7 @@ exports[`Input Input suffix demo works fine 1`] = `
bind:click="click"
/>
<t-input
label="标签文字"
placeholder="请输入文字"
>
<t-button
size="extra-small"
slot="suffix"
theme="primary"
>
操作按钮
</t-button>
</t-input>
<t-input
class="extra"
label="标签文字"
placeholder="请输入文字"
tips="最多十个字"
Expand Down
6 changes: 1 addition & 5 deletions src/input/_example/suffix/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
bind:click="click"
/>

<t-input label="标签文字" placeholder="请输入文字">
<t-button slot="suffix" theme="primary" size="extra-small"> 操作按钮 </t-button>
</t-input>

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

Expand Down
3 changes: 3 additions & 0 deletions src/input/_example/suffix/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.extra {
--td-input-align-items: start;
}