diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1e8a8ae3 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +# 指定运行环境 +language: node_js +node_js: + - lts/* + +# 仅监控 master 分支 +branches: + except: + - master + +jobs: + include: + - name: "Push Compile" + if: type = push AND branch = develop + install: yarn install + before_script: + - rm -rf dist + - rm -rf examples/dist + script: + - yarn dev + - yarn build + after_success: + - git config --global user.name "Deployment Bot" + - git config --global user.email "deploy@travis-ci.org" + - git add -A + - "git commit -m 'build: Travis CI automatic compilation'" + - git push "https://juzi214032:${GITHUB_TOKEN}@github.com/TaleLin/lin-ui" HEAD:develop + - name: "Check Compile" + if: type = pull_request + install: yarn install + script: + - yarn dev + - yarn build diff --git a/commitlint.config.js b/commitlint.config.js index a3bb25ce..b4a4c8f0 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -61,7 +61,8 @@ module.exports = { 'Price', 'Counter', 'SearchBar', - 'IndexList' + 'IndexList', + 'Behavior' ] ] } diff --git a/config/styles/_base.less b/config/styles/_base.less index 41e47305..3eb499da 100644 --- a/config/styles/_base.less +++ b/config/styles/_base.less @@ -1,37 +1,38 @@ @import "_theme"; // Color -@default-color : @theme-color; -@success-color : #34BFA3; -@warning-color : #FFE57F; -@error-color : #F4516C; -@disabled-color : #DEE2E6; -@selected-color : fade(@default-color, 90%); -@tooltip-color : #fff; -@subsidiary-color : #80848f; -@rate-star-color : #f5a623; +@default-color : @theme-color; +@success-color : #34BFA3; +@warning-color : #FFE57F; +@error-color : #F4516C; +@disabled-color : #DEE2E6; +@selected-color : fade(@default-color, 90%); +@tooltip-color : #fff; +@subsidiary-color : #80848f; +@rate-star-color : #f5a623; +@active-color : #333; // steps -@step-color : #C4C9D2; -@step-active-color : @theme-color; +@step-color : #C4C9D2; +@step-active-color : @theme-color; // Text -@title-color : #333; -@text-color : #888; +@title-color : #333; +@text-color : #888; // Background Color -@background-color-base : #f8f8f8; // base +@background-color-base : #f8f8f8; // base // Border color -@border-color-base : #dddee1; // outside -@border-color-split : #e9eaec; // inside +@border-color-base : #dddee1; // outside +@border-color-split : #e9eaec; // inside // Size -@size-grid-icon : 28rpx; -@size-font-base : 28rpx; -@size-font-mini : 24rpx; -@size-font-large : 32rpx; +@size-grid-icon : 28rpx; +@size-font-base : 28rpx; +@size-font-mini : 24rpx; +@size-font-large : 32rpx; // Button @btn-font-weight : normal; @@ -57,8 +58,8 @@ @btn-width : 180rpx; @btn-height-large : 88rpx; @btn-width-large : 710rpx; -@btn-height-mini : 60rpx; -@btn-width-mini : 140rpx; +@btn-height-mini : 60rpx; +@btn-width-mini : 140rpx; @btn-loading-color : #fff; @btn-circle-size : 40rpx; @btn-circle-size-mini : 30rpx; @@ -66,28 +67,28 @@ // icon -@icon-font-size : 32px; // 图标字体大小 默认 -@icon-font-size-large : 42px; // 图标字体大小 大号 -@icon-font-size-small : 22px; // 图标字体大小 小号 -@icon-font-color : #80848f; +@icon-font-size : 32px; // 图标字体大小 默认 +@icon-font-size-large : 42px; // 图标字体大小 大号 +@icon-font-size-small : 22px; // 图标字体大小 小号 +@icon-font-color : #80848f; // Avatar -@avatar-bg : #ccc; -@avatar-color : #fff; -@avatar-size-base : 32px; -@avatar-size-lg : 40px; -@avatar-size-sm : 24px; -@avatar-font-size-base : 18px; -@avatar-font-size-lg : 24px; -@avatar-font-size-sm : 14px; -@avatar-border-radius : @border-radius-small; -@border-radius-small : 4px; +@avatar-bg : #ccc; +@avatar-color : #fff; +@avatar-size-base : 32px; +@avatar-size-lg : 40px; +@avatar-size-sm : 24px; +@avatar-font-size-base : 18px; +@avatar-font-size-lg : 24px; +@avatar-font-size-sm : 14px; +@avatar-border-radius : @border-radius-small; +@border-radius-small : 4px; // Animation -@animation-time : .3s; -@transition-time : .2s; -@ease-in-out : ease-in-out; +@animation-time : .3s; +@transition-time : .2s; +@ease-in-out : ease-in-out; // Progress @progress-active-color : @theme-color; \ No newline at end of file diff --git a/config/styles/_mixins.less b/config/styles/_mixins.less index bac2dde9..796d15bc 100644 --- a/config/styles/_mixins.less +++ b/config/styles/_mixins.less @@ -12,4 +12,19 @@ pointer-events: none; box-sizing: border-box; border: 0 solid @border-color-split; +} + +.active() { + opacity: 0.15; + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 100%; + border: inherit; + border-radius: inherit; /* inherit parent's border radius */ + transform: translate(-50%, -50%); + content: ' '; + background-color: @active-color; + border-color: @active-color; } \ No newline at end of file diff --git a/dist/behaviors/rules.js b/dist/behaviors/rules.js index e13efe04..200caf39 100644 --- a/dist/behaviors/rules.js +++ b/dist/behaviors/rules.js @@ -1 +1 @@ -import Schema from"../common/async-validator/index";import validator from"../behaviors/validator";export default Behavior({behaviors:[validator],properties:{rules:{type:[Object,Array],value:[]},tipType:{type:String,value:"toast",options:["toast","message","text"]}},data:{schema:"",tipFun:{message:"showMessage",toast:"showToast"},tipContent:{message:"content",toast:"title"},errorText:"",errors:[]},methods:{initRules(){const{rules:t}=this.data;t&&("[object Object]"===Object.prototype.toString.call(t)&&(this.data.rules=[t]),this.data.rules.forEach(t=>{t.trigger?"string"!=typeof t.trigger||(t.trigger=[t.trigger]):t.trigger=[]}))},getNeedValidateRule(t){const e=this.data.name,{rules:a}=this.data;if(!a)return;const r=t?a.filter(e=>e.trigger.indexOf(t)>-1):a,s=new Schema({[e]:r});return this.setData({schema:s}),r},validatorData(t,e){const{tipType:a,tipFun:r,tipContent:s}=this.data;this.getNeedValidateRule(e)&&this.data.schema.validate(t,t=>{if(this.setData({errors:t||[]}),this.triggerEvent("linvalidate",{errors:t,isError:!!t}),t&&a){const e=r[a],i=s[a];return"text"===a?(this.setData({errorText:t[0].message}),t):wx.lin&&wx.lin[e]?(wx.lin[e]&&wx.lin[e]({[i]:t[0].message,duration:1500,mask:!1}),t):(wx.showToast({icon:"none",title:`请在页面内引入${a}组件`}),t)}!t&&a&&this.setData({errorText:""})})}}}); \ No newline at end of file +import Schema from"../common/async-validator/index";import validator from"../behaviors/validator";export default Behavior({behaviors:[validator],properties:{rules:{type:[Object,Array],value:[]},tipType:{type:String,value:"toast",options:["toast","message","text"]}},data:{schema:"",tipFun:{message:"showMessage",toast:"showToast"},tipContent:{message:"content",toast:"title"},errorText:"",errors:[]},methods:{initRules(){const{rules:t}=this.data;t&&("[object Object]"===Object.prototype.toString.call(t)&&(this.data.rules=[t]),this.data.rules.forEach(t=>{t.trigger?"string"!=typeof t.trigger||(t.trigger=[t.trigger]):t.trigger=[]}))},getNeedValidateRule(t){const e=this.data.name,{rules:a}=this.data;if(!a)return;const r=t?a.filter(e=>e.trigger.indexOf(t)>-1):a,s=new Schema({[e]:r});return this.setData({schema:s}),r},validatorData(t,e){const{tipType:a,tipFun:r,tipContent:s}=this.data;this.getNeedValidateRule(e)&&(Object.getOwnPropertyNames(t).forEach(e=>{""===t[e]&&(t[e]=void 0)}),this.data.schema.validate(t,t=>{if(this.setData({errors:t||[]}),this.triggerEvent("linvalidate",{errors:t,isError:!!t}),t&&a){const e=r[a],i=s[a];return"text"===a?(this.setData({errorText:t[0].message}),t):wx.lin&&wx.lin[e]?(wx.lin[e]&&wx.lin[e]({[i]:t[0].message,duration:1500,mask:!1}),t):(wx.showToast({icon:"none",title:`请在页面内引入${a}组件`}),t)}!t&&a&&this.setData({errorText:""})}))}}}); \ No newline at end of file diff --git a/dist/behaviors/validator.js b/dist/behaviors/validator.js index 9b43b561..ae390caf 100644 --- a/dist/behaviors/validator.js +++ b/dist/behaviors/validator.js @@ -1 +1 @@ -export default Behavior({definitionFilter(e){const{properties:o}=e;Object.keys(o).forEach(e=>{const{options:t}=o[e];t&&(o[e].observer=function(o){t.includes(o)||console.error(`${e}: ${o} must be in the [${t}]`)})})}}); \ No newline at end of file +export default Behavior({definitionFilter(e){const{properties:o}=e;Object.keys(o).forEach(e=>{const{options:t}=o[e];t&&(o[e].observer=function(o){!t.includes(o)&&o&&console.error(`${e}: ${o} must be in the [${t}]`)})})}}); \ No newline at end of file diff --git a/dist/button/index.wxml b/dist/button/index.wxml index 81fba9c5..82159c9c 100644 --- a/dist/button/index.wxml +++ b/dist/button/index.wxml @@ -5,7 +5,7 @@ - + diff --git a/dist/button/index.wxss b/dist/button/index.wxss index da04df64..2597fc32 100644 --- a/dist/button/index.wxss +++ b/dist/button/index.wxss @@ -1 +1 @@ -.btn-hover{opacity:.8}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:100%}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8;background-color:#dee2e6}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file +.btn-hover::before{opacity:.15;position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;transform:translate(-50%,-50%);content:' ';background-color:#333;border-color:#333}.special-container{display:flex}.l-btn{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;font-size:28rpx;position:relative;color:#fff;padding:0 12rpx;box-sizing:border-box}.l-btn-img-mini{width:30rpx;height:30rpx}.l-btn-img-medium{width:36rpx;height:36rpx}.l-btn-img-large{height:44rpx;width:44rpx}.l-btn-long{border-radius:0;margin:0;height:88rpx;width:100%}.l-btn-medium{height:72rpx;min-width:180rpx}.l-btn-large{height:88rpx;min-width:710rpx}.l-btn-mini{height:60rpx;min-width:140rpx;font-size:24rpx}.l-btn-default{background-color:#3963bc}.l-btn-success{background-color:#34bfa3}.l-btn-warning{background-color:#ffe57f;color:#333}.l-btn-error{background-color:#f4516c}.l-btn-square{border-radius:0}.l-btn-semicircle{border-radius:40rpx}.l-btn-large.l-btn-semicircle{border-radius:48rpx}.l-btn-mini.l-btn-semicircle{border-radius:30rpx}.l-btn-circle{border-radius:8rpx}.l-btn-large.l-btn-circle{border-radius:9.6rpx}.l-btn-mini.l-btn-circle{border-radius:6rpx}.l-btn-plain{background-color:#fff;color:#3963bc;border:2rpx solid #3963bc}.l-btn-success.l-btn-plain{background-color:#fff;color:#34bfa3;border:2rpx solid #34bfa3}.l-btn-error.l-btn-plain{background-color:#fff;color:#f4516c;border:2rpx solid #f4516c}.l-btn-warning.l-btn-plain{background-color:#fff;color:#ffe57f;border:2rpx solid #ffe57f}.l-btn-loading{opacity:.6;display:inline-block;vertical-align:middle;width:24rpx;height:24rpx;background:0 0;border-radius:50%;border:4rpx solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite}.l-btn-loading-default{border:4rpx solid #3963bc;border-color:#3963bc #3963bc #3963bc transparent}.l-btn-loading-success{border:4rpx solid #34bfa3;border-color:#34bfa3 #34bfa3 #34bfa3 transparent}.l-btn-loading-error{border:4rpx solid #f4516c;border-color:#f4516c #f4516c #f4516c transparent}.l-btn-loading-warning{border:4rpx solid #ffe57f;border-color:#ffe57f #ffe57f #ffe57f transparent}.l-btn-disabled{opacity:.8}.icon{display:flex!important}.margin-mini{margin-right:10rpx}.margin-medium{margin-right:18rpx}.margin-large{margin-right:24rpx}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} \ No newline at end of file diff --git a/dist/card/index.js b/dist/card/index.js index 26ae5f69..f6b45b00 100644 --- a/dist/card/index.js +++ b/dist/card/index.js @@ -1 +1 @@ -import validator from"../behaviors/validator";Component({externalClasses:["l-class","l-img-class","l-title-class"],options:{multipleSlots:!0},behaviors:[validator],properties:{image:String,title:String,describe:String,plaintext:Boolean,full:Boolean,position:{type:String,value:"left",options:["left","right"]},type:{type:String,value:"primary",options:["primary","avatar"]},imageMode:{type:String,value:"scaleToFill"}},data:{},methods:{}}); \ No newline at end of file +import validator from"../behaviors/validator";Component({externalClasses:["l-class","l-img-class","l-title-class"],options:{multipleSlots:!0},behaviors:[validator],properties:{image:String,title:String,describe:String,plaintext:Boolean,full:Boolean,position:{type:String,value:"left",options:["left","right"]},type:{type:String,value:"primary",options:["primary","avatar","cover"]},imageMode:{type:String,value:"scaleToFill"}},data:{},methods:{}}); \ No newline at end of file diff --git a/dist/checkbox-group/index.js b/dist/checkbox-group/index.js index ece05a24..65474516 100644 --- a/dist/checkbox-group/index.js +++ b/dist/checkbox-group/index.js @@ -1 +1 @@ -import eventBus from"../core/utils/event-bus";import rules from"../behaviors/rules";Component({behaviors:["wx://form-field",rules],externalClasses:["l-class","l-error-text","l-error-text-class"],relations:{"../checkbox/index":{type:"child",linked(e){this.init(e)},linkChanged(){},unlinked(){}}},properties:{placement:{type:String,value:"column"},maxSelected:{type:[Number,null],value:null},minSelected:{type:[Number,null],value:null}},data:{},attached(){let{minSelected:e,maxSelected:t}=this.properties;this.checkMax(e,t)},methods:{init(e){void 0===this._keys&&(this._keys={}),void 0===this._selected&&(this._selected={}),this.checkDefaultItem(e),this.checkedKeyRepeat(e)},checkedKeyRepeat(e){let{key:t}=e.properties;if(this._keys[t])throw new Error("keys有重复元素, checkbox的key属性不能重复:"+t);this._keys[t]=!0},checkDefaultItem(e){const{key:t,checked:l,cell:s}=e.properties;l&&(this._selected[t]={...s,checked:!0,value:t})},checkMax(e,t){if(null!==e&&e<0)throw new Error("最小选择个数必须大于等于0");if(null!==t&&t<0)throw new Error("最多选择个数必须大于0");if(null!==t&&null!==e&&e>=t)throw new Error("最多选择个数必须大于最小选择个数")},onEmitEventHandle(e){e.checked?this.addSelect(e):this.removeSelect(e.key),this.validatorData({[this.data.name]:Object.values(this._selected)}),this.triggerEvent("linchange",e,{bubbles:!0,composed:!0}),eventBus.emit("lin-form-change-"+this.id,this.id)},onEmitOverflowHandle(e){this.triggerEvent("linout",e,{bubbles:!0,composed:!0})},removeSelect(e){delete this._selected[e]},addSelect(e){let{key:t,...l}=e;this._selected[t]={...l,value:t}},getValues(){return Object.values(this._selected)},reset(){return this._selected={},this.getRelationNodes("../checkbox/index").forEach(e=>e.setData({checked:!1}))}}}); \ No newline at end of file +import eventBus from"../core/utils/event-bus";import rules from"../behaviors/rules";Component({behaviors:["wx://form-field",rules],externalClasses:["l-class","l-error-text","l-error-text-class"],relations:{"../checkbox/index":{type:"child",linked(e){this.init(e)},linkChanged(){},unlinked(){}}},properties:{placement:{type:String,value:"column"},maxSelected:{type:[Number,null],value:null},minSelected:{type:[Number,null],value:null}},data:{},attached(){let{minSelected:e,maxSelected:t}=this.properties;this.checkMax(e,t)},methods:{init(e){void 0===this._keys&&(this._keys={}),void 0===this._selected&&(this._selected={}),this.checkDefaultItem(e),this.checkedKeyRepeat(e)},checkedKeyRepeat(e){let{key:t}=e.properties;if(this._keys[t])throw new Error("keys有重复元素, checkbox的key属性不能重复:"+t);this._keys[t]=!0},checkDefaultItem(e){const{key:t,checked:l,cell:s}=e.properties;l&&(this._selected[t]={...s,checked:!0,value:t})},checkMax(e,t){if(null!==e&&e<0)throw new Error("最小选择个数必须大于等于0");if(null!==t&&t<0)throw new Error("最多选择个数必须大于0");if(null!==t&&null!==e&&e>=t)throw new Error("最多选择个数必须大于最小选择个数")},onEmitEventHandle(e){e.checked?this.addSelect(e):this.removeSelect(e.key),this.validatorData({[this.data.name]:Object.values(this._selected)}),this.triggerEvent("linchange",e,{bubbles:!0,composed:!0}),eventBus.emit("lin-form-change-"+this.id,this.id)},onEmitOverflowHandle(e){this.triggerEvent("linout",e,{bubbles:!0,composed:!0})},removeSelect(e){delete this._selected[e]},addSelect(e){let{key:t,...l}=e;this._selected[t]={...l,value:t}},getValues(){return Object.values(this._selected)},reset(){this._selected={};return this.getRelationNodes("../checkbox/index").forEach(e=>e.setData({checked:!1}))}}}); \ No newline at end of file diff --git a/dist/index-list/index.wxss b/dist/index-list/index.wxss index 9b5ddd9a..aaecbd06 100644 --- a/dist/index-list/index.wxss +++ b/dist/index-list/index.wxss @@ -1 +1 @@ -.index-list .sidebar{font-size:24rpx;position:fixed;right:30rpx;width:20rpx;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center}.index-list .sidebar-item{width:40rpx;height:40rpx;border-radius:50%;display:flex;justify-content:center;align-items:center;margin-top:8rpx}.index-list .sidebar-item-active{color:#fff;background-color:#3963bc}.index-list .tip{width:90rpx;height:90rpx;background-color:#d8d8d8;border-radius:90px 90px 0;display:flex;justify-content:center;align-items:center;position:absolute;left:-160rpx;transform:rotate(-45deg) translateY(-35%)}.index-list .tip-text{font-size:30rpx;transform:rotate(45deg)} \ No newline at end of file +.index-list .sidebar{font-size:24rpx;position:fixed;right:30rpx;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center}.index-list .sidebar-item{width:40rpx;height:40rpx;border-radius:50%;display:flex;justify-content:center;align-items:center;margin-top:8rpx}.index-list .sidebar-item-active{color:#fff;background-color:#3963bc}.index-list .tip{width:90rpx;height:90rpx;background-color:#d8d8d8;border-radius:90px 90px 0;display:flex;justify-content:center;align-items:center;position:absolute;left:-160rpx;transform:rotate(-45deg) translateY(-35%)}.index-list .tip-text{font-size:30rpx;transform:rotate(45deg)} \ No newline at end of file diff --git a/dist/input/index.js b/dist/input/index.js index cd75c083..9a4f0ede 100644 --- a/dist/input/index.js +++ b/dist/input/index.js @@ -1 +1 @@ -import eventBus from"../core/utils/event-bus.js";import validator from"../behaviors/validator";import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},behaviors:["wx://form-field",validator,rules],externalClasses:["l-class","l-label-class","l-error-text","l-error-text-class"],properties:{label:String,hideLabel:Boolean,labelCustom:Boolean,showRow:{type:Boolean,value:!0},required:Boolean,placeholder:String,type:{type:String,value:"text",options:["text","idcard","digit","password","number"]},value:String,colon:Boolean,focus:Boolean,clear:Boolean,maxlength:{type:Number,value:140},width:{type:Number,value:750},labelWidth:{type:Number,value:200},labelLayout:{type:String,value:"left",options:["left","right"]},disabled:Boolean,placeholderStyle:String},data:{},attached(){},methods:{handleInputChange(e){const{detail:t={}}=e,{value:l=""}=t;this.setData({value:l}),eventBus.emit("lin-form-change-"+this.id,this.id),this.triggerEvent("lininput",e.detail)},handleInputFocus(e){this.triggerEvent("linfocus",e.detail)},handleInputBlur(e){this.validatorData({[this.data.name]:e.detail.value}),eventBus.emit("lin-form-blur-"+this.id,this.id),this.triggerEvent("linblur",e.detail)},handleInputConfirm(e){const{detail:t={}}=e,{value:l=""}=t;this.setData({value:l}),this.triggerEvent("linconfirm",e.detail)},onClearTap(e){this.setData({value:""}),this.triggerEvent("linclear",e.detail)},getValues(){return this.data.value},reset(){this.setData({value:""})}}}); \ No newline at end of file +import eventBus from"../core/utils/event-bus.js";import validator from"../behaviors/validator";import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},behaviors:["wx://form-field",validator,rules],externalClasses:["l-class","l-label-class","l-error-text","l-error-text-class"],properties:{label:String,hideLabel:Boolean,labelCustom:Boolean,showRow:{type:Boolean,value:!0},required:Boolean,placeholder:String,type:{type:String,value:"text",options:["text","idcard","digit","password","number"]},value:String,colon:Boolean,focus:Boolean,clear:Boolean,maxlength:{type:Number,value:140},width:{type:String,value:"auto"},labelWidth:{type:Number,value:200},labelLayout:{type:String,value:"left",options:["left","right"]},disabled:Boolean,placeholderStyle:String},data:{},attached(){},methods:{handleInputChange(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),eventBus.emit("lin-form-change-"+this.id,this.id),this.triggerEvent("lininput",e.detail)},handleInputFocus(e){this.triggerEvent("linfocus",e.detail)},handleInputBlur(e){this.validatorData({[this.data.name]:e.detail.value}),eventBus.emit("lin-form-blur-"+this.id,this.id),this.triggerEvent("linblur",e.detail)},handleInputConfirm(e){const{detail:t={}}=e,{value:a=""}=t;this.setData({value:a}),this.triggerEvent("linconfirm",e.detail)},onClearTap(e){this.setData({value:""}),this.triggerEvent("linclear",e.detail)},getValues(){return this.data.value},reset(){this.setData({value:""})}}}); \ No newline at end of file diff --git a/dist/input/index.wxml b/dist/input/index.wxml index 8bdc67c0..783c49a3 100644 --- a/dist/input/index.wxml +++ b/dist/input/index.wxml @@ -1,5 +1,5 @@ -