任务明细页面
This commit is contained in:
129
components/input/README.md
Normal file
129
components/input/README.md
Normal file
@@ -0,0 +1,129 @@
|
||||
---
|
||||
title: Input 输入框
|
||||
description: 用于单行文本信息输入。
|
||||
spline: form
|
||||
isComponent: true
|
||||
---
|
||||
|
||||
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-97%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-88%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-97%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-92%25-blue" /></span>
|
||||
## 引入
|
||||
|
||||
全局引入,在 miniprogram 根目录下的`app.json`中配置,局部引入,在需要引入的页面或组件的`index.json`中配置。
|
||||
|
||||
```json
|
||||
"usingComponents": {
|
||||
"t-input": "tdesign-miniprogram/input/input"
|
||||
}
|
||||
```
|
||||
### 主题定制
|
||||
CSS 变量名|说明
|
||||
--|--
|
||||
--td-input-bg-color | 输入框背景颜色
|
||||
--td-input-text-color | 输入框文本颜色
|
||||
--td-input-placeholder-text-color | 输入框placeholder占位符颜色
|
||||
--td-input-error-text-color | 输入错误时文本颜色
|
||||
--td-input-disabled-text-color | 禁用输入框颜色
|
||||
--td-input-border-color | 输入框边框颜色
|
||||
--td-input-error-msg-color | 错误提示文本颜色
|
||||
--td-input-icon-color | 图标颜色
|
||||
--td-input-suffix-text-color | 后置文本内容颜色
|
||||
|
||||
## 代码演示
|
||||
|
||||
## 类型
|
||||
### 基础文本框
|
||||
|
||||
<img src="https://tdesign.gtimg.com/miniprogram/readme/input-1.png" width="375px" height="50%">
|
||||
|
||||
{{ base }}
|
||||
|
||||
### 必填、选填文本框
|
||||
|
||||
{{ require }}
|
||||
|
||||
### 带提示信息文本框
|
||||
|
||||
{{ suffix }}
|
||||
|
||||
## 状态
|
||||
### 文本框状态
|
||||
|
||||
{{ status }}
|
||||
|
||||
## 特殊类型
|
||||
### 特殊文本类型
|
||||
|
||||
{{ special }}
|
||||
|
||||
## 规格
|
||||
### 文本框尺寸规格
|
||||
|
||||
{{ size }}
|
||||
|
||||
## 内容位置
|
||||
### 文本框内容位置
|
||||
|
||||
{{ align }}
|
||||
|
||||
## 字数限制
|
||||
### 文本框字数限制
|
||||
|
||||
{{ maxlength }}
|
||||
|
||||
## API
|
||||
### Input Props
|
||||
|
||||
名称 | 类型 | 默认值 | 说明 | 必传
|
||||
-- | -- | -- | -- | --
|
||||
align | String | left | 文本内容位置,居左/居中/居右。可选项:left/center/right | N
|
||||
borderless | Boolean | true | 是否开启无边框模式 | N
|
||||
clearable | Boolean | false | 是否可清空 | N
|
||||
disabled | Boolean | false | 是否禁用输入框 | N
|
||||
error-message | String | - | 错误提示文本,值为空不显示(废弃属性,如果需要,请更为使用 status 和 tips) | N
|
||||
external-classes | Array | - | 组件类名,用于设置组件外层元素、输入框、占位符、错误信息等元素类名。`['t-class','t-class-icon', 't-class-label', 't-class-input', 't-class-clearable', 't-class-suffix', 't-class-suffix-icon', 't-class-error-msg']` | N
|
||||
format | Function | - | 【开发中】指定输入框展示值的格式。TS 类型:`InputFormatType` `type InputFormatType = (value: InputValue) => number | string`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/input/type.ts) | N
|
||||
label | String / Slot | - | 左侧文本 | N
|
||||
maxcharacter | Number | - | 用户最多可以输入的字符个数,一个中文汉字表示两个字符长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
|
||||
maxlength | Number | - | 用户最多可以输入的文本长度,一个中文等于一个计数长度。值小于等于 0 的时候,则表示不限制输入长度。`maxcharacter` 和 `maxlength` 二选一使用 | N
|
||||
placeholder | String | undefined | 占位符 | N
|
||||
prefix-icon | String / Slot | - | 组件前置图标,值为字符串则表示图标名称 | N
|
||||
readonly | Boolean | false | 【开发中】只读状态 | N
|
||||
size | String | small | 输入框尺寸。可选项:small/medium。TS 类型:`'medium' | 'small'` | N
|
||||
status | String | - | 【开发中】输入框状态。可选项:success/warning/error | N
|
||||
suffix | String / Slot | - | 后置图标前的后置内容 | N
|
||||
suffix-icon | String / Slot | - | 后置文本内容,值为字符串则表示图标名称 | N
|
||||
tips | String / Slot | - | 【开发中】输入框下方提示文本,会根据不同的 `status` 呈现不同的样式 | N
|
||||
type | String | text | 输入框类型。可选项:text/number/idcard/digit/safe-password/password | 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
|
||||
placeholder-style | String | - | 必需。指定 placeholder 的样式 | Y
|
||||
placeholder-class | String | input-placeholder | 指定 placeholder 的样式类 | N
|
||||
cursor-spacing | Number | 0 | 指定光标与键盘的距离,取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 | N
|
||||
auto-focus | Boolean | false | (即将废弃,请直接使用 focus )自动聚焦,拉起键盘 | N
|
||||
focus | Boolean | false | 获取焦点 | N
|
||||
confirm-type | String | done | 设置键盘右下角按钮的文字,仅在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
|
||||
always-embed | Boolean | false | 强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效) | N
|
||||
confirm-hold | Boolean | false | 点击键盘右下角按钮时是否保持键盘不收起 | N
|
||||
cursor | Number | - | 必需。指定focus时的光标位置 | Y
|
||||
selection-start | Number | -1 | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 | N
|
||||
selection-end | Number | -1 | 光标结束位置,自动聚集时有效,需与selection-start搭配使用 | N
|
||||
adjust-position | Boolean | true | 键盘弹起时,是否自动上推页面 | N
|
||||
hold-keyboard | Boolean | false | focus时,点击页面的时候不收起键盘 | N
|
||||
safe-password-cert-path | String | - | 安全键盘加密公钥的路径,只支持包内路径 | N
|
||||
safe-password-length | Number | - | 安全键盘输入密码长度 | N
|
||||
safe-password-time-stamp | Number | - | 安全键盘加密时间戳 | N
|
||||
safe-password-nonce | String | - | 安全键盘加密盐值 | N
|
||||
safe-password-salt | String | - | 安全键盘计算hash盐值,若指定custom-hash 则无效 | N
|
||||
safe-password-custom-hash | String | - | 安全键盘计算hash的算法表达式,如 `md5(sha1('foo' + sha256(sm3(password + 'bar'))))` | N
|
||||
|
||||
### Input Events
|
||||
|
||||
名称 | 参数 | 描述
|
||||
-- | -- | --
|
||||
blur | `(value: InputValue)` | 失去焦点时触发
|
||||
change | `(value: InputValue, cursor: number, keyCode: number)` | 输入框值发生变化时触发;cursor 为光标位置;keyCode 为键值
|
||||
clear | - | 清空按钮点击时触发
|
||||
enter | `(value: InputValue)` | 回车键按下时触发
|
||||
focus | `(value: InputValue)` | 获得焦点时触发
|
||||
keyboardheightchange | `(height: number, duration: number)` | 键盘高度发生变化的时候触发此事件
|
||||
26
components/input/input.d.ts
vendored
Normal file
26
components/input/input.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { SuperComponent } from '../common/src/index';
|
||||
export default class Input extends SuperComponent {
|
||||
options: {
|
||||
multipleSlots: boolean;
|
||||
};
|
||||
externalClasses: string[];
|
||||
behaviors: string[];
|
||||
properties: import("./type").TdInputProps;
|
||||
data: {
|
||||
prefix: string;
|
||||
classPrefix: string;
|
||||
classBasePrefix: string;
|
||||
};
|
||||
lifetimes: {
|
||||
ready(): void;
|
||||
};
|
||||
methods: {
|
||||
updateValue(value: any): void;
|
||||
onInput(e: any): void;
|
||||
onFocus(e: any): void;
|
||||
onBlur(e: any): void;
|
||||
onConfirm(e: any): void;
|
||||
clearInput(e: any): void;
|
||||
onKeyboardHeightChange(e: any): void;
|
||||
};
|
||||
}
|
||||
93
components/input/input.js
Normal file
93
components/input/input.js
Normal file
@@ -0,0 +1,93 @@
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
import { SuperComponent, wxComponent } from '../common/src/index';
|
||||
import config from '../common/config';
|
||||
import props from './props';
|
||||
import { getCharacterLength } from '../common/utils';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-input`;
|
||||
let Input = class Input extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.options = {
|
||||
multipleSlots: true,
|
||||
};
|
||||
this.externalClasses = [
|
||||
`${prefix}-class`,
|
||||
`${prefix}-class-icon`,
|
||||
`${prefix}-class-label`,
|
||||
`${prefix}-class-input`,
|
||||
`${prefix}-class-clearable`,
|
||||
`${prefix}-class-suffix`,
|
||||
`${prefix}-class-suffix-icon`,
|
||||
`${prefix}-class-error-msg`,
|
||||
];
|
||||
this.behaviors = ['wx://form-field'];
|
||||
this.properties = props;
|
||||
this.data = {
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
classBasePrefix: prefix,
|
||||
};
|
||||
this.lifetimes = {
|
||||
ready() {
|
||||
const { value } = this.properties;
|
||||
this.updateValue(value);
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
updateValue(value) {
|
||||
const { maxcharacter, maxlength } = this.properties;
|
||||
if (maxcharacter && maxcharacter > 0 && !Number.isNaN(maxcharacter)) {
|
||||
const { length, characters } = getCharacterLength('maxcharacter', value, maxcharacter);
|
||||
this.setData({
|
||||
value: characters,
|
||||
count: length,
|
||||
});
|
||||
}
|
||||
else if (maxlength > 0 && !Number.isNaN(maxlength)) {
|
||||
const { length, characters } = getCharacterLength('maxlength', value, maxlength);
|
||||
this.setData({
|
||||
value: characters,
|
||||
count: length,
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.setData({
|
||||
value,
|
||||
count: value ? String(value).length : 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
onInput(e) {
|
||||
const { value, cursor, keyCode } = e.detail;
|
||||
this.updateValue(value);
|
||||
this.triggerEvent('change', { value: this.data.value, cursor, keyCode });
|
||||
},
|
||||
onFocus(e) {
|
||||
this.triggerEvent('focus', e.detail);
|
||||
},
|
||||
onBlur(e) {
|
||||
this.triggerEvent('blur', e.detail);
|
||||
},
|
||||
onConfirm(e) {
|
||||
this.triggerEvent('enter', e.detail);
|
||||
},
|
||||
clearInput(e) {
|
||||
this.triggerEvent('clear', e.detail);
|
||||
this.setData({ value: '' });
|
||||
},
|
||||
onKeyboardHeightChange(e) {
|
||||
this.triggerEvent('keyboardheightchange', e.detail);
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
Input = __decorate([
|
||||
wxComponent()
|
||||
], Input);
|
||||
export default Input;
|
||||
6
components/input/input.json
Normal file
6
components/input/input.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "../icon/icon"
|
||||
}
|
||||
}
|
||||
66
components/input/input.wxml
Normal file
66
components/input/input.wxml
Normal file
@@ -0,0 +1,66 @@
|
||||
<view
|
||||
class="{{classPrefix}} {{!!errorMessage ? classBasePrefix + '-is-error' : ''}} {{classPrefix}}--size-{{size}} {{classPrefix + (borderless ? '' : '--bordered')}} {{prefix}}-class"
|
||||
>
|
||||
<view wx:if="{{prefixIcon}}" class="{{classPrefix}}__icon-wrap">
|
||||
<slot name="prefixIcon" wx:if="{{prefixIcon === 'slot'}}" />
|
||||
<t-icon wx:else class="{{classPrefix}}__icon--prefix {{prefix}}-class-icon" name="{{prefixIcon}}" />
|
||||
</view>
|
||||
<view wx:if="{{label}}" class="{{classPrefix}}__label">
|
||||
<slot name="label" wx:if="{{label === 'slot'}}" />
|
||||
<text wx:else class="{{prefix}}-class-label">{{label}}</text>
|
||||
</view>
|
||||
|
||||
<view class="{{classPrefix}}__wrap">
|
||||
<view class="{{classPrefix}}__content">
|
||||
<input
|
||||
disabled="{{disabled}}"
|
||||
placeholder="{{placeholder}}"
|
||||
placeholderStyle="{{placeholderStyle}}"
|
||||
placeholder-class="{{classPrefix}}__placeholder"
|
||||
value="{{value}}"
|
||||
bindinput="onInput"
|
||||
bindfocus="onFocus"
|
||||
bindblur="onBlur"
|
||||
bindconfirm="onConfirm"
|
||||
bind:keyboardheightchange="onKeyboardHeightChange"
|
||||
password="{{type === 'password'}}"
|
||||
type="{{type === 'password' ? 'text' : type}}"
|
||||
focus="{{focus}}"
|
||||
confirm-type="{{confirmType}}"
|
||||
confirm-hold="{{confirmHold}}"
|
||||
cursor="{{cursor}}"
|
||||
cursor-spacing="{{cursorSpacing}}"
|
||||
adjust-position="{{adjustPosition}}"
|
||||
auto-focus="{{autoFocus}}"
|
||||
always-embed="{{alwaysEmbed}}"
|
||||
selection-start="{{selectionStart}}"
|
||||
selection-end="{{selectionEnd}}"
|
||||
hold-keyboard="{{holdKeyboard}}"
|
||||
safe-password-cert-path="{{safePasswordCertPath}}"
|
||||
safe-password-length="{{safePasswordLength}}"
|
||||
safe-password-time-stamp="{{safePasswordTimeStamp}}"
|
||||
safe-password-nonce="{{safePasswordNonce}}"
|
||||
safe-password-salt="{{safePasswordSalt}}"
|
||||
safe-password-custom-hash="{{safePasswordCustomHash}}"
|
||||
class="{{classPrefix}}__control {{suffix || align ==='right' ? classPrefix + '__control--right':''}} {{align === 'center' ? classPrefix + '__control--center':''}} {{prefix}}-class-input"
|
||||
/>
|
||||
<view wx:if="{{ clearable && value.length > 0}}" class="{{classPrefix}}__wrap--icon" bind:tap="clearInput">
|
||||
<t-icon name="close-circle-filled" size="48rpx" class="{{prefix}}-class-clearable" />
|
||||
</view>
|
||||
<view class="{{classPrefix}}__wrap--suffix">
|
||||
<slot name="suffix" />
|
||||
</view>
|
||||
<view wx:if="{{suffix}}" class="{{classPrefix}}__wrap--suffix-text {{prefix}}-class-suffix">
|
||||
<text>{{suffix}}</text>
|
||||
</view>
|
||||
<view wx:if="{{suffixIcon}}" class="{{classPrefix}}__wrap--icon">
|
||||
<t-icon name="{{suffixIcon}}" size="48rpx" class="{{prefix}}-class-suffix-icon" />
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
wx:if="{{errorMessage && errorMessage.length > 0}}"
|
||||
class="{{classPrefix}}__error-msg {{prefix}}-class-error-msg"
|
||||
>{{errorMessage}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
180
components/input/input.wxss
Normal file
180
components/input/input.wxss
Normal file
@@ -0,0 +1,180 @@
|
||||
.t-float-left {
|
||||
float: left;
|
||||
}
|
||||
.t-float-right {
|
||||
float: right;
|
||||
}
|
||||
@keyframes tdesign-fade-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.hotspot-expanded.relative {
|
||||
position: relative;
|
||||
}
|
||||
.hotspot-expanded::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transform: scale(1.5);
|
||||
}
|
||||
page {
|
||||
--td-input-bg-color: #fff;
|
||||
--td-input-text-color: #000000;
|
||||
--td-input-placeholder-text-color: rgba(0, 0, 0, 0.4);
|
||||
--td-input-error-msg-color: rgba(0, 0, 0, 0.4);
|
||||
--td-input-disabled-text-color: #000000;
|
||||
--td-input-label-color: #000;
|
||||
--td-input-icon-color: #bbbbbb;
|
||||
--td-input-error-text-color: #e34d59;
|
||||
--td-input-suffix-text-color: #000000;
|
||||
--td-input-border-color: #e7e7e7;
|
||||
}
|
||||
.t-input--bordered::after {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-bottom: 1px solid var(--td-input-border-color);
|
||||
transform: scaleY(0.5);
|
||||
left: 32rpx;
|
||||
}
|
||||
.t-input {
|
||||
position: relative;
|
||||
display: flex;
|
||||
padding: 24rpx 32rpx;
|
||||
background: var(--td-input-bg-color);
|
||||
}
|
||||
.t-input__label {
|
||||
width: 164rpx;
|
||||
color: var(--td-input-label-color);
|
||||
margin-right: 32rpx;
|
||||
flex: none;
|
||||
font-size: 35rpx;
|
||||
}
|
||||
.t-input__icon-wrap,
|
||||
.t-input__icon--prefix,
|
||||
.t-input__icon--suffix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.t-input__icon--prefix {
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.t-input__content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.t-input__wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex: auto;
|
||||
}
|
||||
.t-input__wrap--suffix,
|
||||
.t-input__wrap--icon {
|
||||
flex: 0 0 auto;
|
||||
margin-left: 24rpx;
|
||||
color: var(--td-input-icon-color);
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.t-input__wrap--suffix:empty,
|
||||
.t-input__wrap--icon:empty {
|
||||
display: none;
|
||||
}
|
||||
.t-input__wrap--suffix {
|
||||
position: relative;
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
.t-input__wrap--suffix::after {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-left: 1px solid #e6e6e6;
|
||||
transform: scaleX(0.5);
|
||||
}
|
||||
.t-input__wrap--suffix-text {
|
||||
position: relative;
|
||||
padding-left: 24rpx;
|
||||
color: var(--td-input-suffix-text-color);
|
||||
}
|
||||
.t-input__control {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: var(--td-input-text-color);
|
||||
line-height: inherit;
|
||||
text-align: left;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
resize: none;
|
||||
font-size: inherit;
|
||||
}
|
||||
.t-input__control::placeholder {
|
||||
color: var(--td-input-placeholder-text-color);
|
||||
}
|
||||
.t-input__control:disabled {
|
||||
color: var(--td-input-disabled-text-color);
|
||||
background-color: transparent;
|
||||
cursor: not-allowed;
|
||||
opacity: 1;
|
||||
-webkit-text-fill-color: currentColor;
|
||||
}
|
||||
.t-input__control:read-only {
|
||||
cursor: default;
|
||||
}
|
||||
.t-input__control--right {
|
||||
text-align: right;
|
||||
}
|
||||
.t-input__control--center {
|
||||
text-align: center;
|
||||
}
|
||||
.t-input__placeholder {
|
||||
color: var(--td-input-placeholder-text-color);
|
||||
}
|
||||
.t-input.t-is-error {
|
||||
align-items: flex-start;
|
||||
}
|
||||
.t-input.t-is-error .t-input__control {
|
||||
color: var(--td-input-error-text-color);
|
||||
}
|
||||
.t-input.t-is-error .t-input__control::placeholder {
|
||||
color: var(--td-input-error-text-color);
|
||||
}
|
||||
.t-input.t-is-error .t-input__placeholder {
|
||||
color: var(--td-input-error-text-color);
|
||||
}
|
||||
.t-input.t-is-error .t-input__error-msg {
|
||||
text-align: left;
|
||||
padding-top: 24rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1;
|
||||
color: var(--td-input-error-msg-color);
|
||||
width: 100%;
|
||||
}
|
||||
.t-input--size-medium {
|
||||
padding-top: 32rpx;
|
||||
padding-bottom: 32rpx;
|
||||
}
|
||||
.t-input--size-small {
|
||||
padding-top: 24rpx;
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
3
components/input/props.d.ts
vendored
Normal file
3
components/input/props.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { TdInputProps } from './type';
|
||||
declare const props: TdInputProps;
|
||||
export default props;
|
||||
152
components/input/props.js
Normal file
152
components/input/props.js
Normal file
@@ -0,0 +1,152 @@
|
||||
const props = {
|
||||
align: {
|
||||
type: String,
|
||||
value: 'left',
|
||||
},
|
||||
borderless: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
errorMessage: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
externalClasses: {
|
||||
type: Array,
|
||||
},
|
||||
format: {
|
||||
type: null,
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
},
|
||||
maxcharacter: {
|
||||
type: Number,
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
value: undefined,
|
||||
},
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'small',
|
||||
},
|
||||
status: {
|
||||
type: String,
|
||||
value: 'default',
|
||||
},
|
||||
suffix: {
|
||||
type: String,
|
||||
},
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
},
|
||||
tips: {
|
||||
type: String,
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
optionalTypes: [Number],
|
||||
value: null,
|
||||
},
|
||||
defaultValue: {
|
||||
type: String,
|
||||
optionalTypes: [Number],
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'text',
|
||||
},
|
||||
placeholderStyle: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
placeholderClass: {
|
||||
type: String,
|
||||
value: 'input-placeholder',
|
||||
},
|
||||
cursorSpacing: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
},
|
||||
autoFocus: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
focus: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
confirmType: {
|
||||
type: String,
|
||||
value: 'done',
|
||||
},
|
||||
alwaysEmbed: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
confirmHold: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
cursor: {
|
||||
type: Number,
|
||||
},
|
||||
selectionStart: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
selectionEnd: {
|
||||
type: Number,
|
||||
value: -1,
|
||||
},
|
||||
adjustPosition: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
holdKeyboard: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
safePasswordCertPath: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
safePasswordLength: {
|
||||
type: Number,
|
||||
},
|
||||
safePasswordTimeStamp: {
|
||||
type: Number,
|
||||
},
|
||||
safePasswordNonce: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
safePasswordSalt: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
safePasswordCustomHash: {
|
||||
type: String,
|
||||
value: '',
|
||||
},
|
||||
};
|
||||
export default props;
|
||||
166
components/input/type.d.ts
vendored
Normal file
166
components/input/type.d.ts
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
export interface TdInputProps {
|
||||
align?: {
|
||||
type: StringConstructor;
|
||||
value?: 'left' | 'center' | 'right';
|
||||
};
|
||||
borderless?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
clearable?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
disabled?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
errorMessage?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
externalClasses?: {
|
||||
type: ArrayConstructor;
|
||||
value?: ['t-class', 't-class-input', 't-class-placeholder', 't-class-error-msg'];
|
||||
};
|
||||
format?: {
|
||||
type: null;
|
||||
value?: InputFormatType;
|
||||
};
|
||||
label?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
maxcharacter?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
maxlength?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
placeholder?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
prefixIcon?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
readonly?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
size?: {
|
||||
type: StringConstructor;
|
||||
value?: 'medium' | 'small';
|
||||
};
|
||||
status?: {
|
||||
type: StringConstructor;
|
||||
value?: 'default' | 'success' | 'warning' | 'error';
|
||||
};
|
||||
suffix?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
suffixIcon?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
tips?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
type?: {
|
||||
type: StringConstructor;
|
||||
value?: 'text' | 'number' | 'idcard' | 'digit' | 'safe-password' | 'password';
|
||||
};
|
||||
value?: {
|
||||
type: StringConstructor;
|
||||
optionalTypes: Array<NumberConstructor>;
|
||||
value?: InputValue;
|
||||
};
|
||||
defaultValue?: {
|
||||
type: StringConstructor;
|
||||
optionalTypes: Array<NumberConstructor>;
|
||||
value?: InputValue;
|
||||
};
|
||||
placeholderStyle: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
placeholderClass?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
cursorSpacing?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
autoFocus?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
focus?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
confirmType?: {
|
||||
type: StringConstructor;
|
||||
value?: 'send' | 'search' | 'next' | 'go' | 'done';
|
||||
};
|
||||
alwaysEmbed?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
confirmHold?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
cursor: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
selectionStart?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
selectionEnd?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
adjustPosition?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
holdKeyboard?: {
|
||||
type: BooleanConstructor;
|
||||
value?: boolean;
|
||||
};
|
||||
safePasswordCertPath?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
safePasswordLength?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
safePasswordTimeStamp?: {
|
||||
type: NumberConstructor;
|
||||
value?: number;
|
||||
};
|
||||
safePasswordNonce?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
safePasswordSalt?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
safePasswordCustomHash?: {
|
||||
type: StringConstructor;
|
||||
value?: string;
|
||||
};
|
||||
}
|
||||
export declare type InputFormatType = (value: InputValue) => number | string;
|
||||
export declare type InputValue = string | number;
|
||||
1
components/input/type.js
Normal file
1
components/input/type.js
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
Reference in New Issue
Block a user