first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1 @@
d66f7272-f86f-4cdb-bbe7-ee5a92200cfe

View File

@@ -0,0 +1 @@
"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames2=_interopRequireDefault(require("../helpers/classNames")),_eventsMixin=_interopRequireDefault(require("../helpers/eventsMixin")),_styleToCssString=_interopRequireDefault(require("../helpers/styleToCssString"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var defaultEvents={onChange:function(){},onFocus:function(){},onBlur:function(){},onConfirm:function(){},onClear:function(){},onError:function(){},onLineChange:function(){}};(0,_baseComponent.default)({behaviors:[(0,_eventsMixin.default)({defaultEvents:defaultEvents})],relations:{"../field/index":{type:"ancestor"}},properties:{prefixCls:{type:String,value:"wux-textarea"},label:{type:String,value:""},extra:{type:String,value:""},defaultValue:{type:String,value:""},value:{type:String,value:"",observer:function(e){this.data.controlled&&this.updated(e)}},controlled:{type:Boolean,value:!1},placeholder:{type:String,value:""},placeholderStyle:{type:[String,Object],value:"",observer:function(e){this.setData({extStyle:(0,_styleToCssString.default)(e)})}},placeholderClass:{type:String,value:"textarea-placeholder"},disabled:{type:Boolean,value:!1},maxlength:{type:Number,value:140},autoHeight:{type:Boolean,value:!1},cursorSpacing:{type:Number,value:11},focus:{type:Boolean,value:!1},cursor:{type:Number,value:-1},showConfirmBar:{type:Boolean,value:!0},selectionStart:{type:Number,value:-1},selectionEnd:{type:Number,value:-1},adjustPosition:{type:Boolean,value:!0},rows:{type:Number,value:1,observer:"updateHeight"},hasCount:{type:Boolean,value:!1},clear:{type:Boolean,value:!1},error:{type:Boolean,value:!1}},data:{inputValue:"",inputFocus:!1,inputRows:1,inputHeight:"",extStyle:""},computed:{classes:["prefixCls, disabled, inputFocus, error, hasCount",function(e,t,n,a,r){var i;return{wrap:(0,_classNames2.default)(e,(_defineProperty(i={},"".concat(e,"--focus"),n),_defineProperty(i,"".concat(e,"--disabled"),t),_defineProperty(i,"".concat(e,"--error"),a),_defineProperty(i,"".concat(e,"--has-count"),r),i)),label:"".concat(e,"__label"),control:"".concat(e,"__control"),item:"".concat(e,"__item"),clear:"".concat(e,"__clear"),error:"".concat(e,"__error"),extra:"".concat(e,"__extra"),count:"".concat(e,"__count"),current:"".concat(e,"__current")}}]},methods:{updateHeight:function(e){var n=this,t=0<arguments.length&&void 0!==e?e:this.data.rows,a=Math.max(1,parseInt(t)),r=this.data,i=r.prefixCls,o=r.inputRows;o!==a&&wx.createSelectorQuery().in(this).select(".".concat(i,"__item")).boundingClientRect(function(e){if(e){var t=(1<o?e.height/o:e.height)*a;n.setData({inputRows:a,inputHeight:t})}}).exec()},updated:function(e){this.hasFieldDecorator||this.data.inputValue!==e&&this.setData({inputValue:e})},onChange:function(e){var t=e.detail.value;this.data.controlled||this.updated(t),this.triggerEvent("change",e.detail)},onFocus:function(e){this.clearTimer(),this.setData({inputFocus:!0}),this.triggerEvent("focus",e.detail)},onBlur:function(e){this.setTimer(),this.triggerEvent("blur",e.detail)},onConfirm:function(e){this.triggerEvent("confirm",e.detail)},onClear:function(e){var t={value:""};this.data.controlled||this.updated(t.value),this.triggerEvent("change",t),this.triggerEvent("clear",t)},onError:function(){var e=this.data.inputValue;this.triggerEvent("error",{value:e})},onLineChange:function(e){this.triggerEvent("linechange",e.detail)},setTimer:function(){var e=this;this.clearTimer(),this.timeout=setTimeout(function(){e.setData({inputFocus:!1})},200)},clearTimer:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null)}},attached:function(){var e=this.data,t=e.defaultValue,n=e.value,a=e.controlled?n:t;this.updated(a)},ready:function(){this.updateHeight()}});

View File

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

View File

@@ -0,0 +1,45 @@
<view class="wux-class {{ classes.wrap }}">
<view class="{{ classes.label }}" wx:if="{{ label }}">{{ label }}</view>
<block wx:else>
<slot></slot>
</block>
<view class="{{ classes.control }}">
<textarea
class="{{ classes.item }}"
value="{{ inputValue }}"
placeholder="{{ placeholder }}"
placeholder-style="{{ extStyle }}"
placeholder-class="{{ placeholderClass }}"
disabled="{{ disabled }}"
maxlength="{{ maxlength }}"
auto-height="{{ autoHeight }}"
fixed="{{ fixed }}"
cursor-spacing="{{ cursorSpacing }}"
focus="{{ focus }}"
cursor="{{ cursor }}"
show-confirm-bar="{{ showConfirmBar }}"
selection-start="{{ selectionStart }}"
selection-end="{{ selectionEnd }}"
adjust-position="{{ adjustPosition }}"
bindlinechange="onLineChange"
bindinput="onChange"
bindfocus="onFocus"
bindblur="onBlur"
bindconfirm="onConfirm"
style="{{ inputRows > 1 && !!inputHeight ? 'height: ' + inputHeight + 'px' : '' }}"
/>
</view>
<view class="{{ classes.clear }}" bindtap="onClear" wx:if="{{ clear && !disabled && inputValue && inputValue.length > 0 }}">
<icon type="clear" color="#B2B2B2" size="14" />
</view>
<view class="{{ classes.error }}" bindtap="onError" wx:if="{{ error }}">
<icon type="warn" color="#ef473a" size="14" />
</view>
<view class="{{ classes.extra }}" wx:if="{{ extra }}">{{ extra }}</view>
<block wx:else>
<slot name="footer"></slot>
</block>
<view class="{{ classes.count }}" wx:if="{{ hasCount }}">
<text class="{{ classes.current }}">{{ inputValue.length }}</text>/{{ maxlength === -1 ? '∞' : maxlength }}
</view>
</view>

View File

@@ -0,0 +1 @@
.wux-textarea{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.wux-textarea__label{margin-left:0;margin-right:10rpx;text-align:left;white-space:nowrap;overflow:hidden;width:210rpx;-ms-flex-item-align:start;align-self:flex-start}.wux-textarea__control{-ms-flex:1;flex:1}.wux-textarea__item{width:100%;border:0;outline:0;-webkit-appearance:none;background-color:transparent;font-size:inherit;color:inherit;height:1.47058824em;min-height:1.47058824em;line-height:1.47058824}.wux-textarea__extra{color:rgba(0,0,0,.45);margin-left:10rpx}.wux-textarea__error{margin-left:10rpx}.wux-textarea__clear{display:none}.wux-textarea--focus .wux-textarea__clear{display:block}.wux-textarea--disabled{opacity:.3}.wux-textarea--error .wux-textarea__control{color:#ef473a}.wux-textarea__count{position:absolute;bottom:-12rpx;right:0;color:rgba(0,0,0,.45);font-size:28rpx;line-height:1.47058824}.wux-textarea__current{color:rgba(0,0,0,.85)}.wux-textarea--has-count .wux-textarea__control{padding-bottom:20rpx}