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,26 @@
<input
enableNative="{{enableNative}}"
name="{{name}}"
class="{{className}}"
style="{{style}}"
disabled="{{disabled}}"
value="{{state.value}}"
type="{{type}}"
password="{{password}}"
placeholder="{{placeholder}}"
placeholderClass="ant-input-item-placeholder-base {{placeholderClassName ? placeholderClassName : ''}}"
placeholderStyle="{{placeholderStyle ? placeholderStyle : ''}}"
maxlength="{{maxLength}}"
focus="{{focus}}"
confirmType="{{confirmType}}"
confirmHold="{{confirmHold}}"
alwaysSystem="{{alwaysSystem}}"
cursor="{{cursor}}"
selectionStart="{{selectionStart}}"
selectionEnd="{{selectionEnd}}"
randomNumber="{{randomNumber}}"
onInput="onChange"
onConfirm="onConfirm"
onFocus="onFocus"
onBlur="onBlur"
></input>

View File

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

View File

@ -0,0 +1,46 @@
import { Component, triggerEvent } from '../../_util/simply';
import { InputBlurDefaultProps } from './props';
import mixinValue from '../../mixins/value';
Component(InputBlurDefaultProps, {
onChange: function (e) {
var value = e.detail.value;
if (this.isControlled()) {
this.update(value, {}, true);
}
triggerEvent(this, 'change', value, e);
},
onFocus: function (e) {
var value = e.detail.value;
this.focus = true;
triggerEvent(this, 'focus', value, e);
},
onBlur: function (e) {
var value = e.detail.value;
this.focus = false;
if (this.isControlled()) {
this.update(this.props.value);
}
triggerEvent(this, 'blur', value, e);
},
onConfirm: function (e) {
var value = e.detail.value;
triggerEvent(this, 'confirm', value, e);
},
}, undefined, [
mixinValue({
scopeKey: 'state',
transformValue: function (value, extra, updateWithoutFocusCheck) {
if (value === null || (!updateWithoutFocusCheck && this.focus)) {
return {
needUpdate: false,
};
}
return {
needUpdate: true,
value: value,
};
},
}),
], {
focus: false,
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1,41 @@
import { IBaseProps } from '../../_util/base';
export type InputType = 'text' | 'number' | 'idcard' | 'digit' | 'numberpad' | 'digitpad' | 'idcardpad';
/**
* @description 输入框。
*/
export interface InputBlurProps extends IBaseProps {
value: string;
defaultValue: string;
placeholder: string;
placeholderClassName: string;
placeholderStyle: string;
enableNative: boolean;
confirmType: string;
confirmHold: string;
alwaysSystem: boolean;
selectionStart: number;
selectionEnd: number;
cursor: number;
controlled: boolean;
maxLength?: number;
inputClassName: string;
inputStyle: string;
focus?: boolean;
password: boolean;
disabled?: boolean;
/**
* @description 组件名字,用于表单提交获取数据。
*/
name?: string;
type?: InputType;
/**
* @description 当 type 为 number, digit, idcard 数字键盘是否随机排列。
* @default false
*/
randomNumber?: boolean;
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 InputBlurDefaultProps: Partial<InputBlurProps>;

View File

@ -0,0 +1,23 @@
export var InputBlurDefaultProps = {
value: null,
defaultValue: null,
placeholder: null,
placeholderClassName: '',
placeholderStyle: '',
enableNative: null,
confirmType: null,
confirmHold: null,
alwaysSystem: null,
selectionStart: null,
selectionEnd: null,
cursor: null,
controlled: null,
inputClassName: null,
inputStyle: null,
focus: null,
password: null,
disabled: null,
name: null,
type: null,
randomNumber: null,
};

View File

@ -0,0 +1 @@
.ant-textarea{display:flex;align-items:center;background:#fff}.ant-textarea-disabled{opacity:.4}.ant-textarea-line{position:relative;flex:1;display:flex;align-items:center;overflow:hidden}.ant-textarea-content{width:100%;align-self:center;padding:0;font-size:17px;text-align:left;color:#333;background:#fff}.ant-textarea-content-clear{padding-right:17px}.ant-textarea-clear{position:absolute;top:0;right:0;z-index:2;display:flex;justify-content:center;align-items:center;border-radius:8px;margin-left:4px}.ant-textarea-clear-icon{color:#ccc;font-size:17px}.ant-textarea-clear-show{display:flex}.ant-textarea-clear-hidden{display:none;pointer-events:none}.ant-textarea-placeholder{font-size:17px;color:#ccc;margin-left:-3px}

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,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,
};

View File

@ -0,0 +1 @@
.ant-input{display:flex;align-items:center;background:#fff}.ant-input-disabled{opacity:.4}.ant-input-line{position:relative;flex:1;display:flex;align-items:center;overflow:hidden}.ant-input-prefix{color:#ccc;font-size:17px;margin:0 4px 0 4px}.ant-input-prefix:empty{display:none}.ant-input-suffix{color:#ccc;font-size:17px;margin:0 4px 0 4px}.ant-input-suffix:empty{display:none}.ant-input-content{width:100%;align-self:center;padding:0;font-size:17px;text-align:left;color:#333;background:#fff}.ant-input-clear{display:flex;justify-content:center;align-items:center;border-radius:8px}.ant-input-clear-icon{color:#ccc;font-size:17px;padding:4px 0 4px 8px}.ant-input-clear-show{opacity:1}.ant-input-clear-hidden{opacity:0;pointer-events:none}.ant-input-placeholder{font-size:17px;color:#ccc;margin-left:-3px}

View File

@ -0,0 +1,50 @@
<view
class="ant-input {{disabled ? 'ant-input-disabled' : ''}} {{className ? className : ''}} {{selfFocus ? focusClassName ? focusClassName : '' : ''}}"
style="{{style || ''}};{{focusStyle || ''}}"
>
<view class="ant-input-prefix">
<slot name="prefix">{{prefix}}</slot>
</view>
<view class="ant-input-line">
<input
enableNative="{{enableNative}}"
name="{{name}}"
class="ant-input-content"
disabled="{{disabled}}"
value="{{state.value}}"
type="{{type}}"
adjustPosition="{{adjustPosition}}"
password="{{password}}"
placeholder="{{placeholder}}"
placeholderClass="ant-input-placeholder {{placeholderClassName ? placeholderClassName : ''}}"
placeholderStyle="{{placeholderStyle ? placeholderStyle : ''}}"
maxlength="{{maxLength}}"
focus="{{focus}}"
confirmType="{{confirmType}}"
confirmHold="{{confirmHold}}"
alwaysSystem="{{alwaysSystem}}"
controlled="{{state.controlled}}"
cursor="{{cursor}}"
selectionStart="{{selectionStart}}"
selectionEnd="{{selectionEnd}}"
randomNumber="{{randomNumber}}"
onInput="onChange"
onConfirm="onConfirm"
onFocus="onFocus"
onBlur="onBlur"
></input>
<view
a:if="{{allowClear}}"
class="ant-input-clear {{state.value && state.value.length > 0 ? 'ant-input-clear-show' : 'ant-input-clear-hidden'}}"
onTap="onClear"
>
<icon
className="ant-input-clear-icon"
type="CloseCircleFill"
></icon>
</view>
</view>
<view class="ant-input-suffix">
<slot name="suffix">{{suffix}}</slot>
</view>
</view>

View File

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

View File

@ -0,0 +1,38 @@
import { Component, triggerEvent } from '../_util/simply';
import { InputDefaultProps } from './props';
import mixinValue from '../mixins/value';
Component(InputDefaultProps, {
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,54 @@
import { IBaseProps } from '../_util/base';
export type InputType = 'text' | 'number' | 'idcard' | 'digit'
/**
* 支付宝
*/
| 'numberpad' | 'digitpad' | 'idcardpad'
/**
* 只支持微信
*/
| 'safe-password' | 'nickname';
/**
* @description 输入框。
*/
export interface InputProps extends IBaseProps {
type?: InputType;
value?: string;
defaultValue: string;
placeholder: string;
placeholderClassName: string;
placeholderStyle: string;
allowClear: boolean;
enableNative: boolean;
confirmType: string;
confirmHold: string;
controlled: boolean;
alwaysSystem: boolean;
selectionStart: number;
selectionEnd: number;
cursor: number;
maxLength?: number;
inputClassName?: string;
inputStyle: string;
password?: boolean;
prefix?: string;
disabled?: boolean;
focusClassName?: string;
suffix?: string;
focus?: boolean;
/**
* @description 组件名字,用于表单提交获取数据。
*/
name?: string;
focusStyle?: string;
/**
* @description 当 type 为 number, digit, idcard 数字键盘是否随机排列。
* @default false
*/
randomNumber?: boolean;
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 InputDefaultProps: InputProps;

View File

@ -0,0 +1,28 @@
export var InputDefaultProps = {
type: null,
value: null,
defaultValue: null,
placeholder: null,
placeholderClassName: null,
placeholderStyle: null,
allowClear: null,
enableNative: null,
confirmType: null,
confirmHold: null,
controlled: null,
alwaysSystem: null,
selectionStart: null,
selectionEnd: null,
cursor: null,
inputClassName: null,
inputStyle: null,
password: null,
prefix: null,
disabled: null,
focusClassName: null,
suffix: null,
focus: null,
name: null,
focusStyle: null,
randomNumber: null,
};