This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<view
class="ant-textarea {{disabled ? 'ant-textarea-disabled' : ''}} {{className ? className : ''}} {{selfFocus ? focusClassName ? focusClassName : '' : ''}}"
style="{{style || ''}};{{focusStyle || ''}}"
>
<view class="ant-textarea-line">
<textarea
enableNative="{{enableNative}}"
name="{{name}}"
class="ant-textarea-content {{allowClear ? 'ant-textarea-content-clear' : ''}}"
disabled="{{disabled}}"
value="{{state.value || ''}}"
placeholder="{{placeholder}}"
placeholderClass="ant-textarea-placeholder {{placeholderClassName ? placeholderClassName : ''}}"
placeholderStyle="{{placeholderStyle ? placeholderStyle : ''}}"
maxlength="{{maxLength}}"
focus="{{focus}}"
confirmType="{{confirmType}}"
confirmHold="{{confirmHold}}"
autoHeight="{{autoHeight}}"
showCount="{{showCount}}"
controlled="{{state.controlled}}"
onInput="onChange"
onConfirm="onConfirm"
onFocus="onFocus"
onBlur="onBlur"
></textarea>
<view
a:if="{{allowClear}}"
class="ant-textarea-clear {{state.value && state.value.length > 0 ? 'ant-textarea-clear-show' : 'ant-textarea-clear-hidden'}}"
onTap="onClear"
>
<icon
className="ant-textarea-clear-icon"
type="CloseCircleFill"
></icon>
</view>
</view>
</view>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,38 @@
import { Component, triggerEvent } from '../../_util/simply';
import { TextareaDefaultProps } from './props';
import mixinValue from '../../mixins/value';
Component(TextareaDefaultProps, {
onChange: function (e) {
var value = e.detail.value;
if (!this.isControlled()) {
this.update(value);
}
triggerEvent(this, 'change', value, e);
},
onFocus: function (e) {
var value = e.detail.value;
this.setData({
selfFocus: true,
});
triggerEvent(this, 'focus', value, e);
},
onBlur: function (e) {
var value = e.detail.value;
this.setData({
selfFocus: false,
});
triggerEvent(this, 'blur', value, e);
},
onConfirm: function (e) {
var value = e.detail.value;
triggerEvent(this, 'confirm', value, e);
},
onClear: function (e) {
if (!this.isControlled()) {
this.update('');
}
triggerEvent(this, 'change', '', e);
},
}, {
selfFocus: false,
}, [mixinValue({ scopeKey: 'state' })]);

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"icon": "../../Icon/index"
}
}

View File

@ -0,0 +1,59 @@
@import (reference) '../variable.less';
@inputItemPrefix: ant-textarea;
.@{inputItemPrefix} {
display: flex;
align-items: center;
background: @COLOR_CARD;
&-disabled {
opacity: 0.4;
}
&-line {
position: relative;
flex: 1;
display: flex;
align-items: center;
overflow: hidden;
}
&-content {
width: 100%;
align-self: center;
padding: 0;
font-size: 34 * @rpx;
text-align: left;
color: @input-item-color;
background: @COLOR_CARD;
&-clear {
padding-right: 34 * @rpx;
}
}
&-clear {
position: absolute;
top: 0;
right: 0;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
border-radius: 16 * @rpx;
margin-left: 8 * @rpx;
&-icon {
color: @COLOR_TEXT_WEAK;
font-size: 34 * @rpx;
}
}
&-clear-show {
display: flex;
}
&-clear-hidden {
display: none;
pointer-events: none;
}
&-placeholder {
font-size: 34 * @rpx;
color: @input-item-placeholder-color;
margin-left: -6 * @rpx;
}
}

View File

@ -0,0 +1,34 @@
import { IBaseProps } from '../../_util/base';
/**
* 有效值return显示“换行”、done显示“完成”、go显示“前往”、next显示“下一个”、search显示“搜索”、send显示“发送”
*/
export type ConfirmType = 'return' | 'done' | 'go' | 'next' | 'search' | 'send';
/**
* @description 输入框。
*/
export interface TextareaProps extends IBaseProps {
value?: string;
defaultValue: string;
placeholder: string;
placeholderClassName: string;
placeholderStyle: string;
autoHeight: boolean;
showCount: boolean;
allowClear: boolean;
controlled: boolean;
enableNative?: boolean;
maxLength?: number;
inputClassName: string;
disabled?: boolean;
inputStyle: string;
focusStyle?: string;
name?: string;
confirmType?: ConfirmType;
focus?: boolean;
confirmHold?: string;
onChange?: (value: string, e: any) => void;
onBlur?: (value: string, e: any) => void;
onFocus?: (value: string, e: any) => void;
onConfirm?: (value: string, e: any) => void;
}
export declare const TextareaDefaultProps: TextareaProps;

View File

@ -0,0 +1,20 @@
export var TextareaDefaultProps = {
value: null,
defaultValue: null,
placeholder: null,
placeholderClassName: null,
placeholderStyle: null,
autoHeight: null,
showCount: null,
allowClear: null,
controlled: null,
enableNative: false,
inputClassName: null,
disabled: null,
inputStyle: null,
focusStyle: null,
name: null,
confirmType: null,
focus: null,
confirmHold: null,
};