From 13254e51bbeb018ef829d18ce33393939d4719b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Wed, 25 Nov 2020 20:58:55 +0800 Subject: [PATCH 01/28] =?UTF-8?q?feat(Button):=20=E6=96=B0=E5=A2=9E=20disa?= =?UTF-8?q?bled-hover=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit disabled-hover 属性用于禁用按钮 hover 效果 close #1112 --- src/button/index.js | 6 +++++- src/button/index.wxml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/button/index.js b/src/button/index.js index e5e45aa4..8258369b 100644 --- a/src/button/index.js +++ b/src/button/index.js @@ -71,7 +71,11 @@ Component({ sendMessagePath: String, sendMessageImg: String, showMessageCard: Boolean, - formType: String + formType: String, + disabledHover: { + type: Boolean, + value: false + } }, methods: { // button点击事件 diff --git a/src/button/index.wxml b/src/button/index.wxml index 51d7dc3d..f81facf9 100644 --- a/src/button/index.wxml +++ b/src/button/index.wxml @@ -6,7 +6,7 @@ Date: Wed, 25 Nov 2020 20:45:32 +0800 Subject: [PATCH 02/28] =?UTF-8?q?fix(Steps):=20=E4=BF=AE=E5=A4=8D=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=20commit=20=E9=80=A0=E6=88=90=E7=9A=84=20reverse=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #1111 --- src/step/index.wxml | 142 ++++++++++++++++++++------------------ src/steps/index.js | 161 ++++++++++++++++++++++--------------------- src/steps/index.less | 32 +++++---- src/steps/index.wxml | 6 +- 4 files changed, 179 insertions(+), 162 deletions(-) diff --git a/src/step/index.wxml b/src/step/index.wxml index 3a2a517a..006d2851 100755 --- a/src/step/index.wxml +++ b/src/step/index.wxml @@ -1,67 +1,75 @@ - - - - - - - - - - {{index+1}} - - - - - - {{title}} - - - {{describe}} - - - - - - - - -var setStatus = function(activeIndex,index,status){ - if(activeIndex===index){ - return status || 'process' - } else if(activeIndex>index){ - return 'finish' - }else{ - return 'wait' - } -} - -var statusStyle = function(activeIndex,index,color,status){ - if(activeIndex===index){ - return status==='error'?'':('background-color:' + color) - } else if(activeIndex>index){ - return ('border-color:' + color + ';color:' + color) - }else{ - return '' - } -} - -var dotStyle = function(activeIndex,index,color){ - if(activeIndex>=index){ - return ('background-color:' + color) - } else{ - return '' - } -} - -module.exports = { - setStatus:setStatus, - statusStyle:statusStyle, - dotStyle:dotStyle -} - \ No newline at end of file + + + + + + + + + + {{index+1}} + + + + + + {{title}} + + + {{describe}} + + + + + + + + +var setStatus = function(activeIndex,index,status){ + if(activeIndex===index){ + return status || 'process' + } else if(activeIndex>index){ + return 'finish' + }else{ + return 'wait' + } +} + +var statusStyle = function(activeIndex,index,color,status){ + if(activeIndex===index){ + return status==='error'?'':('background-color:' + color) + } else if(activeIndex>index){ + return ('border-color:' + color + ';color:' + color) + }else{ + return '' + } +} + +var dotStyle = function(activeIndex,index,color){ + if(activeIndex>=index){ + return ('background-color:' + color) + } else{ + return '' + } +} + +var isReverse = function(reverse,activeIndex,index) { + if(reverse){ + return (activeIndex>=index) + } + return (activeIndex>index) +} + +module.exports = { + setStatus:setStatus, + statusStyle:statusStyle, + dotStyle:dotStyle, + isReverse:isReverse +} + diff --git a/src/steps/index.js b/src/steps/index.js index d288f41b..f1353097 100755 --- a/src/steps/index.js +++ b/src/steps/index.js @@ -1,80 +1,81 @@ -import validator from '../behaviors/validator'; - -Component({ - externalClasses: [ - 'l-class' - ], - behaviors: [validator], - options: { - multipleSlots: true // 在组件定义时的选项中启用多slot支持 - }, - relations: { - '../step/index': { - type: 'child', - linked() { - this._initSteps(); - }, - unlinked() { - this._initSteps(); - } - }, - }, - - properties: { - direction: { - type: String, - value: 'row', - options: ['row', 'column'] - }, - activeIndex: { - type: Number, - value: 0 - }, - color: String, - stepMinHeight: { - type: String, - value: '120' - }, - status: { - type: String, - value: 'process', - options: ['process', 'error'] - }, - dot: Boolean - }, - - observers: { - 'activeIndex': function () { - this._initSteps(); - } - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - _initSteps() { - const query = wx.createSelectorQuery().in(this); - query.select('.steps-container').boundingClientRect().exec(res => { - let steps = this.getRelationNodes('../step/index'); - this.data.length = steps.length; - if (this.data.length > 0) { - steps.forEach((step, index) => { - step.updateDataChange({ - index, - ...this.data, - stepsWidth: res[0].width - }); - }); - } - }); - } - } -}); +import validator from '../behaviors/validator'; + +Component({ + externalClasses: [ + 'l-class' + ], + behaviors: [validator], + options: { + multipleSlots: true // 在组件定义时的选项中启用多slot支持 + }, + relations: { + '../step/index': { + type: 'child', + linked() { + this._initSteps(); + }, + unlinked() { + this._initSteps(); + } + }, + }, + + properties: { + direction: { + type: String, + value: 'row', + options: ['row', 'column'] + }, + activeIndex: { + type: Number, + value: 0 + }, + color: String, + stepMinHeight: { + type: String, + value: '120' + }, + status: { + type: String, + value: 'process', + options: ['process', 'error'] + }, + dot: Boolean, + reverse: Boolean + }, + + observers: { + 'activeIndex': function () { + this._initSteps(); + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + _initSteps() { + const query = wx.createSelectorQuery().in(this); + query.select('.steps-container').boundingClientRect().exec(res => { + let steps = this.getRelationNodes('../step/index'); + this.data.length = steps.length; + if (this.data.length > 0) { + steps.forEach((step, index) => { + step.updateDataChange({ + index, + ...this.data, + stepsWidth: res[0].width + }); + }); + } + }); + } + } +}); diff --git a/src/steps/index.less b/src/steps/index.less index 8a0e80be..1ecdc1f4 100755 --- a/src/steps/index.less +++ b/src/steps/index.less @@ -1,12 +1,20 @@ -.steps-container { - display: flex; - width: 100%; - - &-row { - flex-direction: row; - } - - &-column { - flex-direction: column - } -} \ No newline at end of file +.steps-container { + display: flex; + width: 100%; + + &-row { + flex-direction: row; + + &-reverse { + flex-direction: row-reverse; + } + } + + &-column { + flex-direction: column; + + &-reverse { + flex-direction: column-reverse; + } + } +} diff --git a/src/steps/index.wxml b/src/steps/index.wxml index fc103a0b..3ea01701 100755 --- a/src/steps/index.wxml +++ b/src/steps/index.wxml @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + From 79ef9eabe7a37e12122fbdb532ce1784c7250596 Mon Sep 17 00:00:00 2001 From: Juzi Date: Thu, 26 Nov 2020 20:22:33 +0800 Subject: [PATCH 03/28] build: Travis CI automatic compilation --- dist/button/index.js | 2 +- dist/button/index.wxml | 2 +- examples/dist/button/index.js | 6 +++++- examples/dist/button/index.wxml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/button/index.js b/dist/button/index.js index c37033f6..ec788348 100644 --- a/dist/button/index.js +++ b/dist/button/index.js @@ -1 +1 @@ -import validator from"../behaviors/validator";Component({externalClasses:["l-class","l-label-class","l-hover-class","l-img-class","l-icon-class"],behaviors:[validator],properties:{name:{type:String,value:"lin"},type:{type:String,value:"default",options:["warning","success","error","default"]},plain:Boolean,size:{type:String,value:"medium",options:["medium","large","mini","long"]},shape:{type:String,value:"circle",options:["square","circle","semicircle"]},disabled:{type:Boolean,value:!1},special:{type:Boolean,value:!1},loading:{type:Boolean,value:!1},width:Number,height:Number,icon:String,image:String,bgColor:String,iconColor:String,iconSize:String,openType:String,appParameter:String,lang:String,hoverStopPropagation:Boolean,hoverStartTime:{type:Number,value:20},hoverStayTime:{type:Number,value:70},sessionFrom:{type:String,value:""},sendMessageTitle:String,sendMessagePath:String,sendMessageImg:String,showMessageCard:Boolean,formType:String},methods:{handleTap(){if(this.data.disabled||this.data.loading)return!1;this.triggerEvent("lintap",{},{bubbles:!0,composed:!0})},openTypeEvent(e){this.triggerEvent(e.type,e.detail,{})}}}); \ No newline at end of file +import validator from"../behaviors/validator";Component({externalClasses:["l-class","l-label-class","l-hover-class","l-img-class","l-icon-class"],behaviors:[validator],properties:{name:{type:String,value:"lin"},type:{type:String,value:"default",options:["warning","success","error","default"]},plain:Boolean,size:{type:String,value:"medium",options:["medium","large","mini","long"]},shape:{type:String,value:"circle",options:["square","circle","semicircle"]},disabled:{type:Boolean,value:!1},special:{type:Boolean,value:!1},loading:{type:Boolean,value:!1},width:Number,height:Number,icon:String,image:String,bgColor:String,iconColor:String,iconSize:String,openType:String,appParameter:String,lang:String,hoverStopPropagation:Boolean,hoverStartTime:{type:Number,value:20},hoverStayTime:{type:Number,value:70},sessionFrom:{type:String,value:""},sendMessageTitle:String,sendMessagePath:String,sendMessageImg:String,showMessageCard:Boolean,formType:String,disabledHover:{type:Boolean,value:!1}},methods:{handleTap(){if(this.data.disabled||this.data.loading)return!1;this.triggerEvent("lintap",{},{bubbles:!0,composed:!0})},openTypeEvent(e){this.triggerEvent(e.type,e.detail,{})}}}); \ No newline at end of file diff --git a/dist/button/index.wxml b/dist/button/index.wxml index 1021e64b..27c9b93c 100644 --- a/dist/button/index.wxml +++ b/dist/button/index.wxml @@ -5,7 +5,7 @@ - + diff --git a/examples/dist/button/index.js b/examples/dist/button/index.js index e5e45aa4..8258369b 100644 --- a/examples/dist/button/index.js +++ b/examples/dist/button/index.js @@ -71,7 +71,11 @@ Component({ sendMessagePath: String, sendMessageImg: String, showMessageCard: Boolean, - formType: String + formType: String, + disabledHover: { + type: Boolean, + value: false + } }, methods: { // button点击事件 diff --git a/examples/dist/button/index.wxml b/examples/dist/button/index.wxml index 51d7dc3d..f81facf9 100644 --- a/examples/dist/button/index.wxml +++ b/examples/dist/button/index.wxml @@ -6,7 +6,7 @@ Date: Thu, 26 Nov 2020 20:24:00 +0800 Subject: [PATCH 04/28] build: Travis CI automatic compilation --- dist/step/index.wxml | 130 +++++++++++++------------- dist/steps/index.js | 2 +- dist/steps/index.wxml | 6 +- dist/steps/index.wxss | 2 +- examples/dist/step/index.wxml | 142 +++++++++++++++-------------- examples/dist/steps/index.js | 161 +++++++++++++++++---------------- examples/dist/steps/index.wxml | 6 +- examples/dist/steps/index.wxss | 2 +- 8 files changed, 234 insertions(+), 217 deletions(-) diff --git a/dist/step/index.wxml b/dist/step/index.wxml index 2a3b9870..315fc8e3 100755 --- a/dist/step/index.wxml +++ b/dist/step/index.wxml @@ -1,61 +1,69 @@ - - - - - - - - - - {{index+1}} - - - - - - {{title}} - - - {{describe}} - - - - - - - - -var setStatus = function(activeIndex,index,status){ - if(activeIndex===index){ - return status || 'process' - } else if(activeIndex>index){ - return 'finish' - }else{ - return 'wait' - } -} - -var statusStyle = function(activeIndex,index,color,status){ - if(activeIndex===index){ - return status==='error'?'':('background-color:' + color) - } else if(activeIndex>index){ - return ('border-color:' + color + ';color:' + color) - }else{ - return '' - } -} - -var dotStyle = function(activeIndex,index,color){ - if(activeIndex>=index){ - return ('background-color:' + color) - } else{ - return '' - } -} - -module.exports = { - setStatus:setStatus, - statusStyle:statusStyle, - dotStyle:dotStyle -} - \ No newline at end of file + + + + + + + + + + {{index+1}} + + + + + + {{title}} + + + {{describe}} + + + + + + + + +var setStatus = function(activeIndex,index,status){ + if(activeIndex===index){ + return status || 'process' + } else if(activeIndex>index){ + return 'finish' + }else{ + return 'wait' + } +} + +var statusStyle = function(activeIndex,index,color,status){ + if(activeIndex===index){ + return status==='error'?'':('background-color:' + color) + } else if(activeIndex>index){ + return ('border-color:' + color + ';color:' + color) + }else{ + return '' + } +} + +var dotStyle = function(activeIndex,index,color){ + if(activeIndex>=index){ + return ('background-color:' + color) + } else{ + return '' + } +} + +var isReverse = function(reverse,activeIndex,index) { + if(reverse){ + return (activeIndex>=index) + } + return (activeIndex>index) +} + +module.exports = { + setStatus:setStatus, + statusStyle:statusStyle, + dotStyle:dotStyle, + isReverse:isReverse +} + diff --git a/dist/steps/index.js b/dist/steps/index.js index bb37aa05..46145f85 100755 --- a/dist/steps/index.js +++ b/dist/steps/index.js @@ -1 +1 @@ -import validator from"../behaviors/validator";Component({externalClasses:["l-class"],behaviors:[validator],options:{multipleSlots:!0},relations:{"../step/index":{type:"child",linked(){this._initSteps()},unlinked(){this._initSteps()}}},properties:{direction:{type:String,value:"row",options:["row","column"]},activeIndex:{type:Number,value:0},color:String,stepMinHeight:{type:String,value:"120"},status:{type:String,value:"process",options:["process","error"]},dot:Boolean},observers:{activeIndex:function(){this._initSteps()}},data:{},methods:{_initSteps(){wx.createSelectorQuery().in(this).select(".steps-container").boundingClientRect().exec(t=>{let e=this.getRelationNodes("../step/index");this.data.length=e.length,this.data.length>0&&e.forEach((e,i)=>{e.updateDataChange({index:i,...this.data,stepsWidth:t[0].width})})})}}}); \ No newline at end of file +import validator from"../behaviors/validator";Component({externalClasses:["l-class"],behaviors:[validator],options:{multipleSlots:!0},relations:{"../step/index":{type:"child",linked(){this._initSteps()},unlinked(){this._initSteps()}}},properties:{direction:{type:String,value:"row",options:["row","column"]},activeIndex:{type:Number,value:0},color:String,stepMinHeight:{type:String,value:"120"},status:{type:String,value:"process",options:["process","error"]},dot:Boolean,reverse:Boolean},observers:{activeIndex:function(){this._initSteps()}},data:{},methods:{_initSteps(){wx.createSelectorQuery().in(this).select(".steps-container").boundingClientRect().exec(e=>{let t=this.getRelationNodes("../step/index");this.data.length=t.length,this.data.length>0&&t.forEach((t,i)=>{t.updateDataChange({index:i,...this.data,stepsWidth:e[0].width})})})}}}); \ No newline at end of file diff --git a/dist/steps/index.wxml b/dist/steps/index.wxml index 6c5688c0..7cdb05f7 100755 --- a/dist/steps/index.wxml +++ b/dist/steps/index.wxml @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + diff --git a/dist/steps/index.wxss b/dist/steps/index.wxss index b4df18c0..c05d83e2 100755 --- a/dist/steps/index.wxss +++ b/dist/steps/index.wxss @@ -1 +1 @@ -.steps-container{display:flex;width:100%}.steps-container-row{flex-direction:row}.steps-container-column{flex-direction:column} \ No newline at end of file +.steps-container{display:flex;width:100%}.steps-container-row{flex-direction:row}.steps-container-row-reverse{flex-direction:row-reverse}.steps-container-column{flex-direction:column}.steps-container-column-reverse{flex-direction:column-reverse} \ No newline at end of file diff --git a/examples/dist/step/index.wxml b/examples/dist/step/index.wxml index 3a2a517a..006d2851 100755 --- a/examples/dist/step/index.wxml +++ b/examples/dist/step/index.wxml @@ -1,67 +1,75 @@ - - - - - - - - - - {{index+1}} - - - - - - {{title}} - - - {{describe}} - - - - - - - - -var setStatus = function(activeIndex,index,status){ - if(activeIndex===index){ - return status || 'process' - } else if(activeIndex>index){ - return 'finish' - }else{ - return 'wait' - } -} - -var statusStyle = function(activeIndex,index,color,status){ - if(activeIndex===index){ - return status==='error'?'':('background-color:' + color) - } else if(activeIndex>index){ - return ('border-color:' + color + ';color:' + color) - }else{ - return '' - } -} - -var dotStyle = function(activeIndex,index,color){ - if(activeIndex>=index){ - return ('background-color:' + color) - } else{ - return '' - } -} - -module.exports = { - setStatus:setStatus, - statusStyle:statusStyle, - dotStyle:dotStyle -} - \ No newline at end of file + + + + + + + + + + {{index+1}} + + + + + + {{title}} + + + {{describe}} + + + + + + + + +var setStatus = function(activeIndex,index,status){ + if(activeIndex===index){ + return status || 'process' + } else if(activeIndex>index){ + return 'finish' + }else{ + return 'wait' + } +} + +var statusStyle = function(activeIndex,index,color,status){ + if(activeIndex===index){ + return status==='error'?'':('background-color:' + color) + } else if(activeIndex>index){ + return ('border-color:' + color + ';color:' + color) + }else{ + return '' + } +} + +var dotStyle = function(activeIndex,index,color){ + if(activeIndex>=index){ + return ('background-color:' + color) + } else{ + return '' + } +} + +var isReverse = function(reverse,activeIndex,index) { + if(reverse){ + return (activeIndex>=index) + } + return (activeIndex>index) +} + +module.exports = { + setStatus:setStatus, + statusStyle:statusStyle, + dotStyle:dotStyle, + isReverse:isReverse +} + diff --git a/examples/dist/steps/index.js b/examples/dist/steps/index.js index d288f41b..f1353097 100755 --- a/examples/dist/steps/index.js +++ b/examples/dist/steps/index.js @@ -1,80 +1,81 @@ -import validator from '../behaviors/validator'; - -Component({ - externalClasses: [ - 'l-class' - ], - behaviors: [validator], - options: { - multipleSlots: true // 在组件定义时的选项中启用多slot支持 - }, - relations: { - '../step/index': { - type: 'child', - linked() { - this._initSteps(); - }, - unlinked() { - this._initSteps(); - } - }, - }, - - properties: { - direction: { - type: String, - value: 'row', - options: ['row', 'column'] - }, - activeIndex: { - type: Number, - value: 0 - }, - color: String, - stepMinHeight: { - type: String, - value: '120' - }, - status: { - type: String, - value: 'process', - options: ['process', 'error'] - }, - dot: Boolean - }, - - observers: { - 'activeIndex': function () { - this._initSteps(); - } - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - _initSteps() { - const query = wx.createSelectorQuery().in(this); - query.select('.steps-container').boundingClientRect().exec(res => { - let steps = this.getRelationNodes('../step/index'); - this.data.length = steps.length; - if (this.data.length > 0) { - steps.forEach((step, index) => { - step.updateDataChange({ - index, - ...this.data, - stepsWidth: res[0].width - }); - }); - } - }); - } - } -}); +import validator from '../behaviors/validator'; + +Component({ + externalClasses: [ + 'l-class' + ], + behaviors: [validator], + options: { + multipleSlots: true // 在组件定义时的选项中启用多slot支持 + }, + relations: { + '../step/index': { + type: 'child', + linked() { + this._initSteps(); + }, + unlinked() { + this._initSteps(); + } + }, + }, + + properties: { + direction: { + type: String, + value: 'row', + options: ['row', 'column'] + }, + activeIndex: { + type: Number, + value: 0 + }, + color: String, + stepMinHeight: { + type: String, + value: '120' + }, + status: { + type: String, + value: 'process', + options: ['process', 'error'] + }, + dot: Boolean, + reverse: Boolean + }, + + observers: { + 'activeIndex': function () { + this._initSteps(); + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + _initSteps() { + const query = wx.createSelectorQuery().in(this); + query.select('.steps-container').boundingClientRect().exec(res => { + let steps = this.getRelationNodes('../step/index'); + this.data.length = steps.length; + if (this.data.length > 0) { + steps.forEach((step, index) => { + step.updateDataChange({ + index, + ...this.data, + stepsWidth: res[0].width + }); + }); + } + }); + } + } +}); diff --git a/examples/dist/steps/index.wxml b/examples/dist/steps/index.wxml index fc103a0b..3ea01701 100755 --- a/examples/dist/steps/index.wxml +++ b/examples/dist/steps/index.wxml @@ -1,3 +1,3 @@ - - - \ No newline at end of file + + + diff --git a/examples/dist/steps/index.wxss b/examples/dist/steps/index.wxss index b4df18c0..c05d83e2 100755 --- a/examples/dist/steps/index.wxss +++ b/examples/dist/steps/index.wxss @@ -1 +1 @@ -.steps-container{display:flex;width:100%}.steps-container-row{flex-direction:row}.steps-container-column{flex-direction:column} \ No newline at end of file +.steps-container{display:flex;width:100%}.steps-container-row{flex-direction:row}.steps-container-row-reverse{flex-direction:row-reverse}.steps-container-column{flex-direction:column}.steps-container-column-reverse{flex-direction:column-reverse} \ No newline at end of file From 084d1c3bae6c04cf24e8d721e4cf6c250832639c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=8D=A3?= <372638156@qq.com> Date: Sat, 28 Nov 2020 11:43:52 +0800 Subject: [PATCH 05/28] =?UTF-8?q?fix(ImageClipper):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=BC=82=E5=B8=B8=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #1129 --- src/image-clipper/index.js | 4 ++++ src/image-clipper/index.wxml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/image-clipper/index.js b/src/image-clipper/index.js index 55fa2629..5549dd3f 100644 --- a/src/image-clipper/index.js +++ b/src/image-clipper/index.js @@ -784,6 +784,10 @@ Component({ close() { this.setData({ show: false }); }, + /** + * 空方法,占位用 + */ + doNothing() {} }, /** diff --git a/src/image-clipper/index.wxml b/src/image-clipper/index.wxml index 7bc12fd6..3a0ebaca 100644 --- a/src/image-clipper/index.wxml +++ b/src/image-clipper/index.wxml @@ -1,5 +1,5 @@ - + From 03013de5b0c082e93250ed695cb622ad992b406f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Thu, 26 Nov 2020 21:22:10 +0800 Subject: [PATCH 06/28] =?UTF-8?q?refactor(FormItem):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20label-width=20=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改原因:label-width 默认值太大 修改结果:label-width 默认值:200 px => auto BREAKING CHANGE: label-width 默认值由 200 px 改为 auto --- commitlint.config.js | 1 + src/form-item/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/commitlint.config.js b/commitlint.config.js index d1593f7d..489bd647 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -63,6 +63,7 @@ module.exports = { 'Rules', 'Rate', 'Form', + 'FormItem', 'Price', 'Counter', 'SearchBar', diff --git a/src/form-item/index.js b/src/form-item/index.js index e72eb344..25f36ea9 100644 --- a/src/form-item/index.js +++ b/src/form-item/index.js @@ -36,7 +36,7 @@ Component({ // label宽度 labelWidth: { type: String, - value: '200rpx' + value: 'auto' }, labelSlot: { type: Boolean, From f35ba3b06e23d869ea0538b79ab3dcd6370f86a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=94=E5=AD=90?= Date: Thu, 26 Nov 2020 21:35:35 +0800 Subject: [PATCH 07/28] =?UTF-8?q?fix(FormItem):=20=E4=BF=AE=E5=A4=8D=20lab?= =?UTF-8?q?el-placement=20=E4=B8=BA=20column=20=E6=97=B6=E6=9C=AA=E5=B7=A6?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #1120 --- src/form-item/index.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/form-item/index.less b/src/form-item/index.less index 8a1b5161..9638868e 100644 --- a/src/form-item/index.less +++ b/src/form-item/index.less @@ -2,7 +2,6 @@ .form-item-container{ display: flex; - align-items: center; border-bottom: 1px solid #eeeeee; color: #777; padding: 0 20rpx ; @@ -11,12 +10,14 @@ margin-bottom: 44rpx; } &.label-column{ + align-items: left; flex-direction: column; .label-text{ line-height: 44rpx; } } &.label-row{ + align-items: center; flex-direction: row; .label-text{ line-height: 88rpx; From 438ffcf8ea3ed91d9225a7e10cb81bb03eac25db Mon Sep 17 00:00:00 2001 From: Juzi Date: Sat, 28 Nov 2020 12:00:18 +0800 Subject: [PATCH 08/28] build: Travis CI automatic compilation --- dist/image-clipper/index.js | 2 +- dist/image-clipper/index.wxml | 2 +- examples/dist/image-clipper/index.js | 4 ++++ examples/dist/image-clipper/index.wxml | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dist/image-clipper/index.js b/dist/image-clipper/index.js index 151b873a..aafc032e 100644 --- a/dist/image-clipper/index.js +++ b/dist/image-clipper/index.js @@ -1 +1 @@ -import dataUtil from"../core/utils/data-util";import eventUtil from"../core/utils/event-util";import{determineDirection,calcImageOffset,calcImageScale,calcImageSize,calcPythagoreanTheorem,clipTouchMoveOfCalculate,imageTouchMoveOfCalcOffset}from"./calculate";const detail=!0,IMAGE_TYPE={base64:"base64",url:"url"};Component({externalClasses:["l-class"],relations:{"../image-clipper-tools/index":{type:"child"}},options:{pureDataPattern:/^_/},properties:{show:{type:Boolean,value:!1},zIndex:{type:Number,value:99},imageUrl:{type:String},type:{type:String,options:["url","base64"],value:"url"},quality:{type:Number,value:1},width:{type:Number,value:400},height:{type:Number,value:400},minWidth:{type:Number,value:200},maxWidth:{type:Number,value:600},minHeight:{type:Number,value:200},maxHeight:{type:Number,value:600},lockWidth:{type:Boolean,value:!1},lockHeight:{type:Boolean,value:!1},lockRatio:{type:Boolean,value:!0},scaleRatio:{type:Number,value:1},minRatio:{type:Number,value:.5},maxRatio:{type:Number,value:2},disableScale:{type:Number,value:!1},disableRotate:{type:Number,value:!1},limitMove:{type:Boolean,value:!1},checkImage:{type:Boolean,value:!0},checkImageIcon:{type:String,value:"./images/photo.png"},rotateAlong:{type:Boolean,value:!0},rotateAlongIcon:{type:String,value:"./images/rotate-along.png"},rotateInverse:{type:Boolean,value:!0},rotateInverseIcon:{type:String,value:"./images/rotate-inverse.png"},sure:{type:Boolean,value:!0},sureIcon:{type:String,value:"./images/sure.png"},close:{type:Boolean,value:!0},closeIcon:{type:String,value:"./images/close.png"},rotateAngle:{type:Number,value:90}},data:{CANVAS_WIDTH:0,CANVAS_HEIGHT:0,cutX:0,cutY:0,clipWidth:0,clipHeight:0,cutAnimation:!1,imageWidth:0,imageHeight:0,imageTop:0,imageLeft:0,scale:1,angle:0,_SYS_INFO:{},_MOVE_THROTTLE:null,_MOVE_THROTTLE_FLAG:!0,_TIME_CUT_CENTER:null,_flagCutTouch:!1,_flagEndTouch:!1,_CUT_START:{},_cutAnimationTime:null,_touchRelative:[{x:0,y:0}],_hypotenuseLength:0,_ctx:null},observers:{imageUrl(t){t&&(this.imageReset(),wx.showLoading({title:"请稍候...",mask:!0}),wx.getImageInfo({src:t,success:t=>{this.imgComputeSize(t.width,t.height),this.properties.limitMove&&(this.imgMarginDetectionScale(),eventUtil.emit(this,"linimageready",t))},fail:()=>{this.imgComputeSize(),this.properties.limitMove&&this.imgMarginDetectionScale()}}))},"clipWidth, clipHeight"(t,e){let{minWidth:i,minHeight:a}=this.data;i/=2,a/=2,t{dataUtil.setDiffData(this,{cutAnimation:!1})},260);dataUtil.setDiffData(this,{_cutAnimationTime:t})}},limitMove(t){t&&(this.data.angle%90&&dataUtil.setDiffData(this,{angle:90*Math.round(this.data.angle/90)}),this.imgMarginDetectionScale())},"cutY, cutX"(){this.cutDetectionPosition()},"width, height"(t,e){t!==this.width&&dataUtil.setDiffData(this,{clipWidth:t/2}),e!==this.height&&dataUtil.setDiffData(this,{clipHeight:e/2})}},methods:{setCutInfo(){const{width:t,height:e}=this.properties,{_SYS_INFO:i}=this.data,a=t/2,s=e/2,o=(i.windowHeight-s)/2,h=(i.windowWidth-a)/2,l=i.windowWidth/2,n=i.windowHeight/2,c=wx.createCanvasContext("image-clipper",this);this.setData({clipWidth:a,clipHeight:s,cutX:h,cutY:o,CANVAS_HEIGHT:s,CANVAS_WIDTH:a,_ctx:c,imageLeft:l,imageTop:n})},setCutCenter(){const{sysInfo:t,clipHeight:e,clipWidth:i,imageTop:a,imageLeft:s}=this.data;let o=t||wx.getSystemInfoSync(),h=.5*(o.windowHeight-e),l=.5*(o.windowWidth-i);this.setData({imageTop:a-this.data.cutY+h,imageLeft:s-this.data.cutX+l,cutY:h,cutX:l})},clipTouchStart(t){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const e=t.touches[0].clientX,i=t.touches[0].clientY,{cutX:a,cutY:s,clipWidth:o,clipHeight:h}=this.data,l=determineDirection(a,s,o,h,e,i);this.moveDuring();const n={width:o,height:h,x:e,y:i,cutY:s,cutX:a,corner:l};this.setData({_flagCutTouch:!0,_flagEndTouch:!0,_CUT_START:n})},clipTouchMove(t){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const{_flagCutTouch:e,_MOVE_THROTTLE_FLAG:i}=this.data;if(e&&i){const{lockRatio:e,lockHeight:i,lockWidth:a}=this.properties;if(e&&(a||i))return;dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!1}),this.moveThrottle();const{width:s,height:o,cutX:h,cutY:l}=clipTouchMoveOfCalculate(this.data,t);a||i?a?i||dataUtil.setDiffData(this,{clipHeight:o,cutY:l}):dataUtil.setDiffData(this,{clipWidth:s,cutX:h}):dataUtil.setDiffData(this,{clipWidth:s,clipHeight:o,cutX:h,cutY:l}),this.imgMarginDetectionScale()}},clipTouchEnd(){this.moveStop(),this.setData({_flagCutTouch:!1})},moveDuring(){clearTimeout(this.data._TIME_CUT_CENTER)},moveStop(){clearTimeout(this.data._TIME_CUT_CENTER);const t=setTimeout(()=>{this.data.cutAnimation||dataUtil.setDiffData(this,{cutAnimation:!0}),this.setCutCenter()},800);dataUtil.setDiffData(this,{_TIME_CUT_CENTER:t})},moveThrottle(){if("android"===this.data._SYS_INFO.platform){clearTimeout(this.data._MOVE_THROTTLE);const t=setTimeout(()=>{dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!0})},20);dataUtil.setDiffData(this,{_MOVE_THROTTLE:t})}else dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!0})},imageReset(){const t=this.data._SYS_INFO||wx.getSystemInfoSync();this.setData({scale:1,angle:0,imageTop:t.windowHeight/2,imageLeft:t.windowWidth/2})},imageLoad(){this.imageReset(),wx.hideLoading(),eventUtil.emit(this,"linimageload",!0)},imgComputeSize(t,e){const{imageWidth:i,imageHeight:a}=calcImageSize(t,e,this.data);this.setData({imageWidth:i,imageHeight:a})},imgMarginDetectionScale(t){if(!this.properties.limitMove)return;const e=calcImageScale(this.data,t);this.imgMarginDetectionPosition(e)},imgMarginDetectionPosition(t){if(!this.properties.limitMove)return;const{scale:e,left:i,top:a}=calcImageOffset(this.data,t);dataUtil.setDiffData(this,{imageLeft:i,imageTop:a,scale:e})},imageTouchStart(t){this.setData({_flagEndTouch:!1});const{imageLeft:e,imageTop:i}=this.data,a=t.touches[0].clientX,s=t.touches[0].clientY;let o=[];if(1===t.touches.length)o[0]={x:a-e,y:s-i},this.setData({_touchRelative:o});else{const h=t.touches[1].clientX,l=t.touches[1].clientY;let n=Math.abs(a-h),c=Math.abs(s-l);const u=calcPythagoreanTheorem(n,c);o=[{x:a-e,y:s-i},{x:h-e,y:l-i}],this.setData({_touchRelative:o,_hypotenuseLength:u})}},imageTouchMove(t){const{_flagEndTouch:e,_MOVE_THROTTLE_FLAG:i}=this.data;if(e||!i)return;const a=t.touches[0].clientX,s=t.touches[0].clientY;if(dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!1}),this.moveThrottle(),this.moveDuring(),1===t.touches.length){const{left:t,top:e}=imageTouchMoveOfCalcOffset(this.data,a,s);dataUtil.setDiffData(this,{imageLeft:t,imageTop:e}),this.imgMarginDetectionPosition()}else{const e=t.touches[1].clientX,i=t.touches[1].clientY;let o=Math.abs(a-e),h=Math.abs(s-i),l=calcPythagoreanTheorem(o,h),n=this.data.scale*(l/this.data._hypotenuseLength);this.properties.disableScale?n=1:(n=n<=this.properties.minRatio?this.properties.minRatio:n,n=n>=this.properties.maxRatio?this.properties.maxRatio:n,eventUtil.emit(this,"linsizechange",{imageWidth:this.data.imageWidth*n,imageHeight:this.data.imageHeight*n})),this.imgMarginDetectionScale(n),dataUtil.setDiffData(this,{_hypotenuseLength:Math.sqrt(Math.pow(o,2)+Math.pow(h,2)),scale:n})}},imageTouchEnd(){dataUtil.setDiffData(this,{_flagEndTouch:!0}),this.moveStop()},cutDetectionPosition(){const{cutX:t,cutY:e,_SYS_INFO:i,clipHeight:a,clipWidth:s}=this.data;let o=()=>{e<0&&dataUtil.setDiffData(this,{cutY:0}),e>i.windowHeight-a&&dataUtil.setDiffData(this,{cutY:i.windowHeight-a})},h=()=>{t<0&&dataUtil.setDiffData(this,{cutX:0}),t>i.windowWidth-s&&dataUtil.setDiffData(this,{cutX:i.windowWidth-s})};if(null===e&&null===t){let t=.5*(i.windowHeight-a),e=.5*(i.windowWidth-s);dataUtil.setDiffData(this,{cutX:e,cutY:t})}else null!==e&&null!==t?(o(),h()):null!==e&&null===t?(o(),dataUtil.setDiffData(this,{cutX:(i.windowWidth-s)/2})):null===e&&null!==t&&(h(),dataUtil.setDiffData(this,{cutY:(i.windowHeight-a)/2}))},computeCutSize(){const{clipHeight:t,clipWidth:e,_SYS_INFO:i,cutX:a,cutY:s}=this.data;e>i.windowWidth?dataUtil.setDiffData(this,{clipWidth:i.windowWidth}):e+a>i.windowWidth&&dataUtil.setDiffData(this,{cutX:i.windowWidth-a}),t>i.windowHeight?dataUtil.setDiffData(this,{clipHeight:i.windowHeight}):t+s>i.windowHeight&&dataUtil.setDiffData(this,{cutY:i.windowHeight-s})},getImageData(){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});wx.showLoading({title:"加载中"});const{clipHeight:t,clipWidth:e,_ctx:i,scale:a,imageLeft:s,imageTop:o,cutX:h,cutY:l,angle:n}=this.data;let{CANVAS_HEIGHT:c,CANVAS_WIDTH:u}=this.data;const{scaleRatio:g,imageUrl:r,quality:d,type:m}=this.properties,p=()=>{const c=this.data.imageWidth*a*g,u=this.data.imageHeight*a*g,p=s-h,f=o-l;i.translate(p*g,f*g),i.rotate(n*Math.PI/180),i.drawImage(r,-c/2,-u/2,c,u),i.draw(!1,()=>{let i={width:e*g,height:Math.round(t*g),destWidth:e*g,destHeight:Math.round(t)*g,fileType:"png",quality:d},a={url:"",base64:"",width:e*g,height:t*g};IMAGE_TYPE.base64===m?wx.canvasGetImageData({canvasId:"image-clipper",x:0,y:0,width:e*g,height:Math.round(t*g),success:t=>{const e=new Uint8Array(t.data),i=wx.arrayBufferToBase64(e);a.url=i,a.base64=i,wx.hideLoading(),eventUtil.emit(this,"linclip",a)}}):wx.canvasToTempFilePath({...i,canvasId:"image-clipper",success:t=>{a.url=t.tempFilePath,a.base64=t.tempFilePath,wx.hideLoading(),eventUtil.emit(this,"linclip",a)},fail(t){throw t}},this)})};u!==e||c!==t?(u=e,c=t,i.draw(),setTimeout(()=>{p()},100)):p()},uploadImage(){wx.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:t=>{const e=t.tempFilePaths;this.setData({imageUrl:e})}})},rotate(t){if(this.properties.disableRotate)return;if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const{rotateAngle:e}=this.properties,i=this.data.angle;"along"===t.currentTarget.dataset.type?this.setData({angle:i+e}):this.setData({angle:i-e}),eventUtil.emit(this,"linrotate",{currentDeg:this.data.angle})},close(){this.setData({show:!1})}},lifetimes:{ready(){const t=wx.getSystemInfoSync();this.setData({_SYS_INFO:t}),this.setCutInfo(),this.setCutCenter(),this.computeCutSize(),this.cutDetectionPosition()}}}); \ No newline at end of file +import dataUtil from"../core/utils/data-util";import eventUtil from"../core/utils/event-util";import{determineDirection,calcImageOffset,calcImageScale,calcImageSize,calcPythagoreanTheorem,clipTouchMoveOfCalculate,imageTouchMoveOfCalcOffset}from"./calculate";const detail=!0,IMAGE_TYPE={base64:"base64",url:"url"};Component({externalClasses:["l-class"],relations:{"../image-clipper-tools/index":{type:"child"}},options:{pureDataPattern:/^_/},properties:{show:{type:Boolean,value:!1},zIndex:{type:Number,value:99},imageUrl:{type:String},type:{type:String,options:["url","base64"],value:"url"},quality:{type:Number,value:1},width:{type:Number,value:400},height:{type:Number,value:400},minWidth:{type:Number,value:200},maxWidth:{type:Number,value:600},minHeight:{type:Number,value:200},maxHeight:{type:Number,value:600},lockWidth:{type:Boolean,value:!1},lockHeight:{type:Boolean,value:!1},lockRatio:{type:Boolean,value:!0},scaleRatio:{type:Number,value:1},minRatio:{type:Number,value:.5},maxRatio:{type:Number,value:2},disableScale:{type:Number,value:!1},disableRotate:{type:Number,value:!1},limitMove:{type:Boolean,value:!1},checkImage:{type:Boolean,value:!0},checkImageIcon:{type:String,value:"./images/photo.png"},rotateAlong:{type:Boolean,value:!0},rotateAlongIcon:{type:String,value:"./images/rotate-along.png"},rotateInverse:{type:Boolean,value:!0},rotateInverseIcon:{type:String,value:"./images/rotate-inverse.png"},sure:{type:Boolean,value:!0},sureIcon:{type:String,value:"./images/sure.png"},close:{type:Boolean,value:!0},closeIcon:{type:String,value:"./images/close.png"},rotateAngle:{type:Number,value:90}},data:{CANVAS_WIDTH:0,CANVAS_HEIGHT:0,cutX:0,cutY:0,clipWidth:0,clipHeight:0,cutAnimation:!1,imageWidth:0,imageHeight:0,imageTop:0,imageLeft:0,scale:1,angle:0,_SYS_INFO:{},_MOVE_THROTTLE:null,_MOVE_THROTTLE_FLAG:!0,_TIME_CUT_CENTER:null,_flagCutTouch:!1,_flagEndTouch:!1,_CUT_START:{},_cutAnimationTime:null,_touchRelative:[{x:0,y:0}],_hypotenuseLength:0,_ctx:null},observers:{imageUrl(t){t&&(this.imageReset(),wx.showLoading({title:"请稍候...",mask:!0}),wx.getImageInfo({src:t,success:t=>{this.imgComputeSize(t.width,t.height),this.properties.limitMove&&(this.imgMarginDetectionScale(),eventUtil.emit(this,"linimageready",t))},fail:()=>{this.imgComputeSize(),this.properties.limitMove&&this.imgMarginDetectionScale()}}))},"clipWidth, clipHeight"(t,e){let{minWidth:i,minHeight:a}=this.data;i/=2,a/=2,t{dataUtil.setDiffData(this,{cutAnimation:!1})},260);dataUtil.setDiffData(this,{_cutAnimationTime:t})}},limitMove(t){t&&(this.data.angle%90&&dataUtil.setDiffData(this,{angle:90*Math.round(this.data.angle/90)}),this.imgMarginDetectionScale())},"cutY, cutX"(){this.cutDetectionPosition()},"width, height"(t,e){t!==this.width&&dataUtil.setDiffData(this,{clipWidth:t/2}),e!==this.height&&dataUtil.setDiffData(this,{clipHeight:e/2})}},methods:{setCutInfo(){const{width:t,height:e}=this.properties,{_SYS_INFO:i}=this.data,a=t/2,s=e/2,o=(i.windowHeight-s)/2,h=(i.windowWidth-a)/2,l=i.windowWidth/2,n=i.windowHeight/2,c=wx.createCanvasContext("image-clipper",this);this.setData({clipWidth:a,clipHeight:s,cutX:h,cutY:o,CANVAS_HEIGHT:s,CANVAS_WIDTH:a,_ctx:c,imageLeft:l,imageTop:n})},setCutCenter(){const{sysInfo:t,clipHeight:e,clipWidth:i,imageTop:a,imageLeft:s}=this.data;let o=t||wx.getSystemInfoSync(),h=.5*(o.windowHeight-e),l=.5*(o.windowWidth-i);this.setData({imageTop:a-this.data.cutY+h,imageLeft:s-this.data.cutX+l,cutY:h,cutX:l})},clipTouchStart(t){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const e=t.touches[0].clientX,i=t.touches[0].clientY,{cutX:a,cutY:s,clipWidth:o,clipHeight:h}=this.data,l=determineDirection(a,s,o,h,e,i);this.moveDuring();const n={width:o,height:h,x:e,y:i,cutY:s,cutX:a,corner:l};this.setData({_flagCutTouch:!0,_flagEndTouch:!0,_CUT_START:n})},clipTouchMove(t){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const{_flagCutTouch:e,_MOVE_THROTTLE_FLAG:i}=this.data;if(e&&i){const{lockRatio:e,lockHeight:i,lockWidth:a}=this.properties;if(e&&(a||i))return;dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!1}),this.moveThrottle();const{width:s,height:o,cutX:h,cutY:l}=clipTouchMoveOfCalculate(this.data,t);a||i?a?i||dataUtil.setDiffData(this,{clipHeight:o,cutY:l}):dataUtil.setDiffData(this,{clipWidth:s,cutX:h}):dataUtil.setDiffData(this,{clipWidth:s,clipHeight:o,cutX:h,cutY:l}),this.imgMarginDetectionScale()}},clipTouchEnd(){this.moveStop(),this.setData({_flagCutTouch:!1})},moveDuring(){clearTimeout(this.data._TIME_CUT_CENTER)},moveStop(){clearTimeout(this.data._TIME_CUT_CENTER);const t=setTimeout(()=>{this.data.cutAnimation||dataUtil.setDiffData(this,{cutAnimation:!0}),this.setCutCenter()},800);dataUtil.setDiffData(this,{_TIME_CUT_CENTER:t})},moveThrottle(){if("android"===this.data._SYS_INFO.platform){clearTimeout(this.data._MOVE_THROTTLE);const t=setTimeout(()=>{dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!0})},20);dataUtil.setDiffData(this,{_MOVE_THROTTLE:t})}else dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!0})},imageReset(){const t=this.data._SYS_INFO||wx.getSystemInfoSync();this.setData({scale:1,angle:0,imageTop:t.windowHeight/2,imageLeft:t.windowWidth/2})},imageLoad(){this.imageReset(),wx.hideLoading(),eventUtil.emit(this,"linimageload",!0)},imgComputeSize(t,e){const{imageWidth:i,imageHeight:a}=calcImageSize(t,e,this.data);this.setData({imageWidth:i,imageHeight:a})},imgMarginDetectionScale(t){if(!this.properties.limitMove)return;const e=calcImageScale(this.data,t);this.imgMarginDetectionPosition(e)},imgMarginDetectionPosition(t){if(!this.properties.limitMove)return;const{scale:e,left:i,top:a}=calcImageOffset(this.data,t);dataUtil.setDiffData(this,{imageLeft:i,imageTop:a,scale:e})},imageTouchStart(t){this.setData({_flagEndTouch:!1});const{imageLeft:e,imageTop:i}=this.data,a=t.touches[0].clientX,s=t.touches[0].clientY;let o=[];if(1===t.touches.length)o[0]={x:a-e,y:s-i},this.setData({_touchRelative:o});else{const h=t.touches[1].clientX,l=t.touches[1].clientY;let n=Math.abs(a-h),c=Math.abs(s-l);const u=calcPythagoreanTheorem(n,c);o=[{x:a-e,y:s-i},{x:h-e,y:l-i}],this.setData({_touchRelative:o,_hypotenuseLength:u})}},imageTouchMove(t){const{_flagEndTouch:e,_MOVE_THROTTLE_FLAG:i}=this.data;if(e||!i)return;const a=t.touches[0].clientX,s=t.touches[0].clientY;if(dataUtil.setDiffData(this,{_MOVE_THROTTLE_FLAG:!1}),this.moveThrottle(),this.moveDuring(),1===t.touches.length){const{left:t,top:e}=imageTouchMoveOfCalcOffset(this.data,a,s);dataUtil.setDiffData(this,{imageLeft:t,imageTop:e}),this.imgMarginDetectionPosition()}else{const e=t.touches[1].clientX,i=t.touches[1].clientY;let o=Math.abs(a-e),h=Math.abs(s-i),l=calcPythagoreanTheorem(o,h),n=this.data.scale*(l/this.data._hypotenuseLength);this.properties.disableScale?n=1:(n=n<=this.properties.minRatio?this.properties.minRatio:n,n=n>=this.properties.maxRatio?this.properties.maxRatio:n,eventUtil.emit(this,"linsizechange",{imageWidth:this.data.imageWidth*n,imageHeight:this.data.imageHeight*n})),this.imgMarginDetectionScale(n),dataUtil.setDiffData(this,{_hypotenuseLength:Math.sqrt(Math.pow(o,2)+Math.pow(h,2)),scale:n})}},imageTouchEnd(){dataUtil.setDiffData(this,{_flagEndTouch:!0}),this.moveStop()},cutDetectionPosition(){const{cutX:t,cutY:e,_SYS_INFO:i,clipHeight:a,clipWidth:s}=this.data;let o=()=>{e<0&&dataUtil.setDiffData(this,{cutY:0}),e>i.windowHeight-a&&dataUtil.setDiffData(this,{cutY:i.windowHeight-a})},h=()=>{t<0&&dataUtil.setDiffData(this,{cutX:0}),t>i.windowWidth-s&&dataUtil.setDiffData(this,{cutX:i.windowWidth-s})};if(null===e&&null===t){let t=.5*(i.windowHeight-a),e=.5*(i.windowWidth-s);dataUtil.setDiffData(this,{cutX:e,cutY:t})}else null!==e&&null!==t?(o(),h()):null!==e&&null===t?(o(),dataUtil.setDiffData(this,{cutX:(i.windowWidth-s)/2})):null===e&&null!==t&&(h(),dataUtil.setDiffData(this,{cutY:(i.windowHeight-a)/2}))},computeCutSize(){const{clipHeight:t,clipWidth:e,_SYS_INFO:i,cutX:a,cutY:s}=this.data;e>i.windowWidth?dataUtil.setDiffData(this,{clipWidth:i.windowWidth}):e+a>i.windowWidth&&dataUtil.setDiffData(this,{cutX:i.windowWidth-a}),t>i.windowHeight?dataUtil.setDiffData(this,{clipHeight:i.windowHeight}):t+s>i.windowHeight&&dataUtil.setDiffData(this,{cutY:i.windowHeight-s})},getImageData(){if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});wx.showLoading({title:"加载中"});const{clipHeight:t,clipWidth:e,_ctx:i,scale:a,imageLeft:s,imageTop:o,cutX:h,cutY:l,angle:n}=this.data;let{CANVAS_HEIGHT:c,CANVAS_WIDTH:u}=this.data;const{scaleRatio:g,imageUrl:r,quality:d,type:m}=this.properties,p=()=>{const c=this.data.imageWidth*a*g,u=this.data.imageHeight*a*g,p=s-h,f=o-l;i.translate(p*g,f*g),i.rotate(n*Math.PI/180),i.drawImage(r,-c/2,-u/2,c,u),i.draw(!1,()=>{let i={width:e*g,height:Math.round(t*g),destWidth:e*g,destHeight:Math.round(t)*g,fileType:"png",quality:d},a={url:"",base64:"",width:e*g,height:t*g};IMAGE_TYPE.base64===m?wx.canvasGetImageData({canvasId:"image-clipper",x:0,y:0,width:e*g,height:Math.round(t*g),success:t=>{const e=new Uint8Array(t.data),i=wx.arrayBufferToBase64(e);a.url=i,a.base64=i,wx.hideLoading(),eventUtil.emit(this,"linclip",a)}}):wx.canvasToTempFilePath({...i,canvasId:"image-clipper",success:t=>{a.url=t.tempFilePath,a.base64=t.tempFilePath,wx.hideLoading(),eventUtil.emit(this,"linclip",a)},fail(t){throw t}},this)})};u!==e||c!==t?(u=e,c=t,i.draw(),setTimeout(()=>{p()},100)):p()},uploadImage(){wx.chooseImage({count:1,sizeType:["original","compressed"],sourceType:["album","camera"],success:t=>{const e=t.tempFilePaths;this.setData({imageUrl:e})}})},rotate(t){if(this.properties.disableRotate)return;if(!this.properties.imageUrl)return void wx.showToast({title:"请选择图片",icon:"none"});const{rotateAngle:e}=this.properties,i=this.data.angle;"along"===t.currentTarget.dataset.type?this.setData({angle:i+e}):this.setData({angle:i-e}),eventUtil.emit(this,"linrotate",{currentDeg:this.data.angle})},close(){this.setData({show:!1})},doNothing(){}},lifetimes:{ready(){const t=wx.getSystemInfoSync();this.setData({_SYS_INFO:t}),this.setCutInfo(),this.setCutCenter(),this.computeCutSize(),this.cutDetectionPosition()}}}); \ No newline at end of file diff --git a/dist/image-clipper/index.wxml b/dist/image-clipper/index.wxml index b7c48546..1969c5c6 100644 --- a/dist/image-clipper/index.wxml +++ b/dist/image-clipper/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/examples/dist/image-clipper/index.js b/examples/dist/image-clipper/index.js index 55fa2629..5549dd3f 100644 --- a/examples/dist/image-clipper/index.js +++ b/examples/dist/image-clipper/index.js @@ -784,6 +784,10 @@ Component({ close() { this.setData({ show: false }); }, + /** + * 空方法,占位用 + */ + doNothing() {} }, /** diff --git a/examples/dist/image-clipper/index.wxml b/examples/dist/image-clipper/index.wxml index 7bc12fd6..3a0ebaca 100644 --- a/examples/dist/image-clipper/index.wxml +++ b/examples/dist/image-clipper/index.wxml @@ -1,5 +1,5 @@ - + From 70c96a72ad4a5950cb39fedca83b1ba77944b71c Mon Sep 17 00:00:00 2001 From: Juzi Date: Sat, 28 Nov 2020 12:01:49 +0800 Subject: [PATCH 09/28] build: Travis CI automatic compilation --- dist/form-item/index.js | 2 +- examples/dist/form-item/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/form-item/index.js b/dist/form-item/index.js index 7bcacd09..d549925d 100644 --- a/dist/form-item/index.js +++ b/dist/form-item/index.js @@ -1 +1 @@ -import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},externalClasses:["l-form-item-class","l-form-label-class","l-form-content-class","l-error-text-class"],behaviors:[rules],relations:{"../form/index":{type:"parent",linked:function(){},linkChanged:function(){},unlinked:function(){}}},properties:{label:String,labelPlacement:{type:String,value:"row"},alignItems:{type:String,value:"start"},labelWidth:{type:String,value:"200rpx"},labelSlot:{type:Boolean,value:!1},name:{type:String,value:""}},data:{isRequired:!1},attached(){this.initRules(),this.isRequired()},methods:{isRequired(){this.data.rules.forEach(e=>{e.required&&this.setData({isRequired:!0})})}}}); \ No newline at end of file +import rules from"../behaviors/rules";Component({options:{multipleSlots:!0},externalClasses:["l-form-item-class","l-form-label-class","l-form-content-class","l-error-text-class"],behaviors:[rules],relations:{"../form/index":{type:"parent",linked:function(){},linkChanged:function(){},unlinked:function(){}}},properties:{label:String,labelPlacement:{type:String,value:"row"},alignItems:{type:String,value:"start"},labelWidth:{type:String,value:"auto"},labelSlot:{type:Boolean,value:!1},name:{type:String,value:""}},data:{isRequired:!1},attached(){this.initRules(),this.isRequired()},methods:{isRequired(){this.data.rules.forEach(e=>{e.required&&this.setData({isRequired:!0})})}}}); \ No newline at end of file diff --git a/examples/dist/form-item/index.js b/examples/dist/form-item/index.js index e72eb344..25f36ea9 100644 --- a/examples/dist/form-item/index.js +++ b/examples/dist/form-item/index.js @@ -36,7 +36,7 @@ Component({ // label宽度 labelWidth: { type: String, - value: '200rpx' + value: 'auto' }, labelSlot: { type: Boolean, From bf485418f5ab01e02e68658fd1b2cc73733e60ff Mon Sep 17 00:00:00 2001 From: Juzi Date: Sat, 28 Nov 2020 12:03:39 +0800 Subject: [PATCH 10/28] build: Travis CI automatic compilation --- dist/form-item/index.wxss | 2 +- examples/dist/form-item/index.wxss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/form-item/index.wxss b/dist/form-item/index.wxss index df081e1f..ac803205 100644 --- a/dist/form-item/index.wxss +++ b/dist/form-item/index.wxss @@ -1 +1 @@ -.form-item-container{display:flex;align-items:center;border-bottom:1px solid #eee;color:#777;padding:0 20rpx;position:relative}.form-item-container.textHeight{margin-bottom:44rpx}.form-item-container.label-column{flex-direction:column}.form-item-container.label-column .label-text{line-height:44rpx}.form-item-container.label-row{flex-direction:row}.form-item-container.label-row .label-text{line-height:88rpx}.form-item-container .label-text{display:flex;line-height:88rpx}.form-item-container .label-text-column-start{justify-content:flex-start}.form-item-container .label-text-column-end{justify-content:flex-end}.form-item-container .label-text-column-center{justify-content:center}.form-item-container .label-text-row-start{justify-content:flex-start}.form-item-container .label-text-row-end{justify-content:flex-end}.form-item-container .label-text-row-center{justify-content:center}.form-item-container .label-content{flex:1}.form-item-container .label-text-required::before{display:inline-block;margin-right:4px;color:#f5222d;font-family:SimSun,sans-serif;content:'*'}.error-text{text-align:right;line-height:44rpx;color:#f56c6c;font-size:12px;position:absolute;top:100%;left:0;padding-left:24rpx}.row{display:none!important} \ No newline at end of file +.form-item-container{display:flex;border-bottom:1px solid #eee;color:#777;padding:0 20rpx;position:relative}.form-item-container.textHeight{margin-bottom:44rpx}.form-item-container.label-column{align-items:left;flex-direction:column}.form-item-container.label-column .label-text{line-height:44rpx}.form-item-container.label-row{align-items:center;flex-direction:row}.form-item-container.label-row .label-text{line-height:88rpx}.form-item-container .label-text{display:flex;line-height:88rpx}.form-item-container .label-text-column-start{justify-content:flex-start}.form-item-container .label-text-column-end{justify-content:flex-end}.form-item-container .label-text-column-center{justify-content:center}.form-item-container .label-text-row-start{justify-content:flex-start}.form-item-container .label-text-row-end{justify-content:flex-end}.form-item-container .label-text-row-center{justify-content:center}.form-item-container .label-content{flex:1}.form-item-container .label-text-required::before{display:inline-block;margin-right:4px;color:#f5222d;font-family:SimSun,sans-serif;content:'*'}.error-text{text-align:right;line-height:44rpx;color:#f56c6c;font-size:12px;position:absolute;top:100%;left:0;padding-left:24rpx}.row{display:none!important} \ No newline at end of file diff --git a/examples/dist/form-item/index.wxss b/examples/dist/form-item/index.wxss index df081e1f..ac803205 100644 --- a/examples/dist/form-item/index.wxss +++ b/examples/dist/form-item/index.wxss @@ -1 +1 @@ -.form-item-container{display:flex;align-items:center;border-bottom:1px solid #eee;color:#777;padding:0 20rpx;position:relative}.form-item-container.textHeight{margin-bottom:44rpx}.form-item-container.label-column{flex-direction:column}.form-item-container.label-column .label-text{line-height:44rpx}.form-item-container.label-row{flex-direction:row}.form-item-container.label-row .label-text{line-height:88rpx}.form-item-container .label-text{display:flex;line-height:88rpx}.form-item-container .label-text-column-start{justify-content:flex-start}.form-item-container .label-text-column-end{justify-content:flex-end}.form-item-container .label-text-column-center{justify-content:center}.form-item-container .label-text-row-start{justify-content:flex-start}.form-item-container .label-text-row-end{justify-content:flex-end}.form-item-container .label-text-row-center{justify-content:center}.form-item-container .label-content{flex:1}.form-item-container .label-text-required::before{display:inline-block;margin-right:4px;color:#f5222d;font-family:SimSun,sans-serif;content:'*'}.error-text{text-align:right;line-height:44rpx;color:#f56c6c;font-size:12px;position:absolute;top:100%;left:0;padding-left:24rpx}.row{display:none!important} \ No newline at end of file +.form-item-container{display:flex;border-bottom:1px solid #eee;color:#777;padding:0 20rpx;position:relative}.form-item-container.textHeight{margin-bottom:44rpx}.form-item-container.label-column{align-items:left;flex-direction:column}.form-item-container.label-column .label-text{line-height:44rpx}.form-item-container.label-row{align-items:center;flex-direction:row}.form-item-container.label-row .label-text{line-height:88rpx}.form-item-container .label-text{display:flex;line-height:88rpx}.form-item-container .label-text-column-start{justify-content:flex-start}.form-item-container .label-text-column-end{justify-content:flex-end}.form-item-container .label-text-column-center{justify-content:center}.form-item-container .label-text-row-start{justify-content:flex-start}.form-item-container .label-text-row-end{justify-content:flex-end}.form-item-container .label-text-row-center{justify-content:center}.form-item-container .label-content{flex:1}.form-item-container .label-text-required::before{display:inline-block;margin-right:4px;color:#f5222d;font-family:SimSun,sans-serif;content:'*'}.error-text{text-align:right;line-height:44rpx;color:#f56c6c;font-size:12px;position:absolute;top:100%;left:0;padding-left:24rpx}.row{display:none!important} \ No newline at end of file From c3363d5b06a5e2f0060c45cd4d0d9fec31fe8ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=8D=A3?= <372638156@qq.com> Date: Sat, 28 Nov 2020 14:53:41 +0800 Subject: [PATCH 11/28] =?UTF-8?q?refactor(ImageClipper):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20CSS=20=E9=80=89=E6=8B=A9=E5=99=A8=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决 Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors. 警告。 --- src/image-clipper-tools/index.less | 2 +- src/image-clipper-tools/index.wxml | 12 ++++++------ src/image-clipper/index.less | 2 +- src/image-clipper/index.wxml | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/image-clipper-tools/index.less b/src/image-clipper-tools/index.less index 893bf57c..68132ff5 100644 --- a/src/image-clipper-tools/index.less +++ b/src/image-clipper-tools/index.less @@ -12,7 +12,7 @@ display: flex; align-items: center; } - switch { + .tools-switch { transform: scale(0.7); } } diff --git a/src/image-clipper-tools/index.wxml b/src/image-clipper-tools/index.wxml index 35f37ef2..68de7a61 100644 --- a/src/image-clipper-tools/index.wxml +++ b/src/image-clipper-tools/index.wxml @@ -2,27 +2,27 @@ 锁定裁剪框宽 - + 锁定裁剪框高 - + 锁定裁剪框比例 - + 限制移动范围 - + 禁止缩放 - + 禁止旋转 - + \ No newline at end of file diff --git a/src/image-clipper/index.less b/src/image-clipper/index.less index ac8fa2ad..9193dc69 100644 --- a/src/image-clipper/index.less +++ b/src/image-clipper/index.less @@ -120,7 +120,7 @@ padding: 20rpx 40rpx; box-sizing: border-box; - image { + &-image { display: block; width: 50rpx; height: 50rpx; diff --git a/src/image-clipper/index.wxml b/src/image-clipper/index.wxml index 3a0ebaca..6c3ab472 100644 --- a/src/image-clipper/index.wxml +++ b/src/image-clipper/index.wxml @@ -56,11 +56,11 @@ - - - - - + + + + + From ea3bbae7be29cb086bcf7d82b8edd30c7475698c Mon Sep 17 00:00:00 2001 From: Juzi Date: Sat, 28 Nov 2020 15:01:10 +0800 Subject: [PATCH 12/28] build: Travis CI automatic compilation --- dist/image-clipper-tools/index.wxml | 12 ++++++------ dist/image-clipper-tools/index.wxss | 2 +- dist/image-clipper/index.wxml | 10 +++++----- dist/image-clipper/index.wxss | 2 +- examples/dist/image-clipper-tools/index.wxml | 12 ++++++------ examples/dist/image-clipper-tools/index.wxss | 2 +- examples/dist/image-clipper/index.wxml | 10 +++++----- examples/dist/image-clipper/index.wxss | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dist/image-clipper-tools/index.wxml b/dist/image-clipper-tools/index.wxml index 0add6c56..f05a22fb 100644 --- a/dist/image-clipper-tools/index.wxml +++ b/dist/image-clipper-tools/index.wxml @@ -2,27 +2,27 @@ 锁定裁剪框宽 - + 锁定裁剪框高 - + 锁定裁剪框比例 - + 限制移动范围 - + 禁止缩放 - + 禁止旋转 - + \ No newline at end of file diff --git a/dist/image-clipper-tools/index.wxss b/dist/image-clipper-tools/index.wxss index f072ec77..4ccdd4ed 100644 --- a/dist/image-clipper-tools/index.wxss +++ b/dist/image-clipper-tools/index.wxss @@ -1 +1 @@ -.tools-container{width:100%;padding:20rpx 40rpx;box-sizing:border-box}.tools-container .tools-form{margin-top:20rpx;display:flex;flex-wrap:wrap;color:#fff}.tools-container .tools-form .slider-wrapper{display:flex;align-items:center}.tools-container .tools-form switch{transform:scale(.7)} \ No newline at end of file +.tools-container{width:100%;padding:20rpx 40rpx;box-sizing:border-box}.tools-container .tools-form{margin-top:20rpx;display:flex;flex-wrap:wrap;color:#fff}.tools-container .tools-form .slider-wrapper{display:flex;align-items:center}.tools-container .tools-form .tools-switch{transform:scale(.7)} \ No newline at end of file diff --git a/dist/image-clipper/index.wxml b/dist/image-clipper/index.wxml index 1969c5c6..44fa6001 100644 --- a/dist/image-clipper/index.wxml +++ b/dist/image-clipper/index.wxml @@ -33,11 +33,11 @@ - - - - - + + + + + diff --git a/dist/image-clipper/index.wxss b/dist/image-clipper/index.wxss index cf1b26bc..bed0533e 100644 --- a/dist/image-clipper/index.wxss +++ b/dist/image-clipper/index.wxss @@ -1 +1 @@ -.container{width:100vw;height:100vh;background-color:rgba(0,0,0,.6);position:fixed;top:0;left:0;z-index:1}.container .clip-wrapper{position:absolute;width:100vw;height:100vh}.container .clip-wrapper .clip-content{width:100vw;height:100vh;position:absolute;z-index:99;display:flex;flex-direction:column;pointer-events:none}.container .clip-wrapper .clip-content .flex-auto{flex:auto}.container .clip-wrapper .clip-content .clip-content-footer,.container .clip-wrapper .clip-content .clip-content-top{width:100%;pointer-events:none}.container .clip-wrapper .clip-content .clip-content-middle{width:100%;height:400rpx;display:flex;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-left,.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-right{height:100%}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center{position:relative;border:1px solid;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge{position:absolute;left:6rpx;width:34rpx;height:34rpx;border:2rpx solid #fff;pointer-events:auto;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-left{border-bottom-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-right{border-bottom-width:0!important;border-left-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-left{border-top-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-right{border-top-width:0!important;border-left-width:0!important}.container .clip-wrapper .bg-transparent{background-color:rgba(0,0,0,.6);transition-duration:.35s}.container .cropper-image{width:100%;border-style:none;position:absolute;top:0;left:0;z-index:2;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:center}.container .clipper-canvas{position:fixed;z-index:10;left:-2000px;top:-2000px;pointer-events:none}.container .footer-tools{position:absolute;left:0;bottom:0;width:100%;z-index:99}.container .footer-tools .tools-icon{display:flex;align-items:center;justify-content:space-between;width:100%;padding:20rpx 40rpx;box-sizing:border-box}.container .footer-tools .tools-icon image{display:block;width:50rpx;height:50rpx} \ No newline at end of file +.container{width:100vw;height:100vh;background-color:rgba(0,0,0,.6);position:fixed;top:0;left:0;z-index:1}.container .clip-wrapper{position:absolute;width:100vw;height:100vh}.container .clip-wrapper .clip-content{width:100vw;height:100vh;position:absolute;z-index:99;display:flex;flex-direction:column;pointer-events:none}.container .clip-wrapper .clip-content .flex-auto{flex:auto}.container .clip-wrapper .clip-content .clip-content-footer,.container .clip-wrapper .clip-content .clip-content-top{width:100%;pointer-events:none}.container .clip-wrapper .clip-content .clip-content-middle{width:100%;height:400rpx;display:flex;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-left,.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-right{height:100%}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center{position:relative;border:1px solid;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge{position:absolute;left:6rpx;width:34rpx;height:34rpx;border:2rpx solid #fff;pointer-events:auto;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-left{border-bottom-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-right{border-bottom-width:0!important;border-left-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-left{border-top-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-right{border-top-width:0!important;border-left-width:0!important}.container .clip-wrapper .bg-transparent{background-color:rgba(0,0,0,.6);transition-duration:.35s}.container .cropper-image{width:100%;border-style:none;position:absolute;top:0;left:0;z-index:2;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:center}.container .clipper-canvas{position:fixed;z-index:10;left:-2000px;top:-2000px;pointer-events:none}.container .footer-tools{position:absolute;left:0;bottom:0;width:100%;z-index:99}.container .footer-tools .tools-icon{display:flex;align-items:center;justify-content:space-between;width:100%;padding:20rpx 40rpx;box-sizing:border-box}.container .footer-tools .tools-icon-image{display:block;width:50rpx;height:50rpx} \ No newline at end of file diff --git a/examples/dist/image-clipper-tools/index.wxml b/examples/dist/image-clipper-tools/index.wxml index 35f37ef2..68de7a61 100644 --- a/examples/dist/image-clipper-tools/index.wxml +++ b/examples/dist/image-clipper-tools/index.wxml @@ -2,27 +2,27 @@ 锁定裁剪框宽 - + 锁定裁剪框高 - + 锁定裁剪框比例 - + 限制移动范围 - + 禁止缩放 - + 禁止旋转 - + \ No newline at end of file diff --git a/examples/dist/image-clipper-tools/index.wxss b/examples/dist/image-clipper-tools/index.wxss index f072ec77..4ccdd4ed 100644 --- a/examples/dist/image-clipper-tools/index.wxss +++ b/examples/dist/image-clipper-tools/index.wxss @@ -1 +1 @@ -.tools-container{width:100%;padding:20rpx 40rpx;box-sizing:border-box}.tools-container .tools-form{margin-top:20rpx;display:flex;flex-wrap:wrap;color:#fff}.tools-container .tools-form .slider-wrapper{display:flex;align-items:center}.tools-container .tools-form switch{transform:scale(.7)} \ No newline at end of file +.tools-container{width:100%;padding:20rpx 40rpx;box-sizing:border-box}.tools-container .tools-form{margin-top:20rpx;display:flex;flex-wrap:wrap;color:#fff}.tools-container .tools-form .slider-wrapper{display:flex;align-items:center}.tools-container .tools-form .tools-switch{transform:scale(.7)} \ No newline at end of file diff --git a/examples/dist/image-clipper/index.wxml b/examples/dist/image-clipper/index.wxml index 3a0ebaca..6c3ab472 100644 --- a/examples/dist/image-clipper/index.wxml +++ b/examples/dist/image-clipper/index.wxml @@ -56,11 +56,11 @@ - - - - - + + + + + diff --git a/examples/dist/image-clipper/index.wxss b/examples/dist/image-clipper/index.wxss index cf1b26bc..bed0533e 100644 --- a/examples/dist/image-clipper/index.wxss +++ b/examples/dist/image-clipper/index.wxss @@ -1 +1 @@ -.container{width:100vw;height:100vh;background-color:rgba(0,0,0,.6);position:fixed;top:0;left:0;z-index:1}.container .clip-wrapper{position:absolute;width:100vw;height:100vh}.container .clip-wrapper .clip-content{width:100vw;height:100vh;position:absolute;z-index:99;display:flex;flex-direction:column;pointer-events:none}.container .clip-wrapper .clip-content .flex-auto{flex:auto}.container .clip-wrapper .clip-content .clip-content-footer,.container .clip-wrapper .clip-content .clip-content-top{width:100%;pointer-events:none}.container .clip-wrapper .clip-content .clip-content-middle{width:100%;height:400rpx;display:flex;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-left,.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-right{height:100%}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center{position:relative;border:1px solid;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge{position:absolute;left:6rpx;width:34rpx;height:34rpx;border:2rpx solid #fff;pointer-events:auto;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-left{border-bottom-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-right{border-bottom-width:0!important;border-left-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-left{border-top-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-right{border-top-width:0!important;border-left-width:0!important}.container .clip-wrapper .bg-transparent{background-color:rgba(0,0,0,.6);transition-duration:.35s}.container .cropper-image{width:100%;border-style:none;position:absolute;top:0;left:0;z-index:2;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:center}.container .clipper-canvas{position:fixed;z-index:10;left:-2000px;top:-2000px;pointer-events:none}.container .footer-tools{position:absolute;left:0;bottom:0;width:100%;z-index:99}.container .footer-tools .tools-icon{display:flex;align-items:center;justify-content:space-between;width:100%;padding:20rpx 40rpx;box-sizing:border-box}.container .footer-tools .tools-icon image{display:block;width:50rpx;height:50rpx} \ No newline at end of file +.container{width:100vw;height:100vh;background-color:rgba(0,0,0,.6);position:fixed;top:0;left:0;z-index:1}.container .clip-wrapper{position:absolute;width:100vw;height:100vh}.container .clip-wrapper .clip-content{width:100vw;height:100vh;position:absolute;z-index:99;display:flex;flex-direction:column;pointer-events:none}.container .clip-wrapper .clip-content .flex-auto{flex:auto}.container .clip-wrapper .clip-content .clip-content-footer,.container .clip-wrapper .clip-content .clip-content-top{width:100%;pointer-events:none}.container .clip-wrapper .clip-content .clip-content-middle{width:100%;height:400rpx;display:flex;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-left,.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-right{height:100%}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center{position:relative;border:1px solid;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge{position:absolute;left:6rpx;width:34rpx;height:34rpx;border:2rpx solid #fff;pointer-events:auto;box-sizing:border-box}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-left{border-bottom-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-top-right{border-bottom-width:0!important;border-left-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-left{border-top-width:0!important;border-right-width:0!important}.container .clip-wrapper .clip-content .clip-content-middle .clip-content-middle-center .clip-edge.clip-edge-bottom-right{border-top-width:0!important;border-left-width:0!important}.container .clip-wrapper .bg-transparent{background-color:rgba(0,0,0,.6);transition-duration:.35s}.container .cropper-image{width:100%;border-style:none;position:absolute;top:0;left:0;z-index:2;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:center}.container .clipper-canvas{position:fixed;z-index:10;left:-2000px;top:-2000px;pointer-events:none}.container .footer-tools{position:absolute;left:0;bottom:0;width:100%;z-index:99}.container .footer-tools .tools-icon{display:flex;align-items:center;justify-content:space-between;width:100%;padding:20rpx 40rpx;box-sizing:border-box}.container .footer-tools .tools-icon-image{display:block;width:50rpx;height:50rpx} \ No newline at end of file From 46162b5cf32c21ba5d91afbaa2b49eab54d0aef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E8=8D=A3?= <372638156@qq.com> Date: Sat, 28 Nov 2020 15:01:57 +0800 Subject: [PATCH 13/28] =?UTF-8?q?refactor(ImageClipper):=20=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=20canvas=20type=20=E4=B8=BA=202d=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/image-clipper/index.wxml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/image-clipper/index.wxml b/src/image-clipper/index.wxml index 6c3ab472..744c9b20 100644 --- a/src/image-clipper/index.wxml +++ b/src/image-clipper/index.wxml @@ -46,7 +46,13 @@ style="width: {{imageWidth ? imageWidth + 'px' : 'auto'}};height: {{imageHeight ? imageHeight + 'px' : 'auto'}};transform: translate3d({{imageLeft - imageWidth / 2}}px, {{imageTop - imageHeight / 2}}px,0) scale({{scale}}) rotate({{angle}}deg); transition-duration: {{cutAnimation ? 0.35 : 0}}s;" /> + Date: Sat, 28 Nov 2020 23:05:25 +0800 Subject: [PATCH 14/28] build: Travis CI automatic compilation --- dist/image-clipper/index.wxml | 3 ++- examples/dist/image-clipper/index.wxml | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/image-clipper/index.wxml b/dist/image-clipper/index.wxml index 44fa6001..81aad22a 100644 --- a/dist/image-clipper/index.wxml +++ b/dist/image-clipper/index.wxml @@ -29,7 +29,8 @@ - + + diff --git a/examples/dist/image-clipper/index.wxml b/examples/dist/image-clipper/index.wxml index 6c3ab472..744c9b20 100644 --- a/examples/dist/image-clipper/index.wxml +++ b/examples/dist/image-clipper/index.wxml @@ -46,7 +46,13 @@ style="width: {{imageWidth ? imageWidth + 'px' : 'auto'}};height: {{imageHeight ? imageHeight + 'px' : 'auto'}};transform: translate3d({{imageLeft - imageWidth / 2}}px, {{imageTop - imageHeight / 2}}px,0) scale({{scale}}) rotate({{angle}}deg); transition-duration: {{cutAnimation ? 0.35 : 0}}s;" /> + Date: Sun, 29 Nov 2020 01:15:07 +0800 Subject: [PATCH 15/28] =?UTF-8?q?feat(Tabs):=20=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BE=BD=E6=A0=87=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增外部样式类: l-badge-clss tabpanel 新增属性: dot-badge badge-count badge-max-count badge-count-type 详见 Tabs 文档 close #1070 --- src/tabpanel/index.js | 23 +++++++++++++++++++---- src/tabs/index.js | 22 ++++++++-------------- src/tabs/index.less | 3 +++ src/tabs/index.wxml | 28 ++++++++++++++++++---------- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/tabpanel/index.js b/src/tabpanel/index.js index a650f963..44d55815 100644 --- a/src/tabpanel/index.js +++ b/src/tabpanel/index.js @@ -3,7 +3,7 @@ Component({ relations: { '../tabs/index': { type: 'parent', - linked: function(target) { + linked: function (target) { !this.data.parent && this.setData({ parent: target }); @@ -12,7 +12,7 @@ Component({ }, '../combined-tabs/index': { type: 'parent', - linked: function(target) { + linked: function (target) { !this.data.parent && this.setData({ parent: target }); @@ -37,11 +37,26 @@ Component({ picPlacement: { type: String, value: 'top' - } + }, + dotBadge: { + type: Boolean, + value: false + }, + badgeCount: { + type: Number, + }, + badgeMaxCount: { + type: Number, + value: 99 + }, + badgeCountType: { + type: String, + value: 'overflow' + }, }, observers: { - '**': function(filed) { + '**': function (filed) { this.updateData(filed); } }, diff --git a/src/tabs/index.js b/src/tabs/index.js index 8a1926c6..55449cb3 100644 --- a/src/tabs/index.js +++ b/src/tabs/index.js @@ -20,7 +20,8 @@ Component({ 'l-tabimage-class', 'l-header-line-class', 'l-icon-class', - 'l-tabpanel-class' + 'l-tabpanel-class', + 'l-badge-class' ], relations: { '../tabpanel/index': { @@ -68,7 +69,7 @@ Component({ value: true }, // 内容区域高度 - contentHeight:Number + contentHeight: Number }, data: { @@ -79,11 +80,11 @@ Component({ }, observers: { 'activeKey': function (newKey) { - if(!newKey) return; - const index = this.data.tabList.findIndex(tab=>tab.key===newKey); + if (!newKey) return; + const index = this.data.tabList.findIndex(tab => tab.key === newKey); this.setData({ - currentIndex:index - },() => { + currentIndex: index + }, () => { if (this.data.scrollable) { this.queryMultipleNodes(); } @@ -109,14 +110,7 @@ Component({ activeKey = !val && index === 0 ? item.data.key : activeKey; currentIndex = item.data.key === activeKey ? index : currentIndex; - return { - tab: item.data.tab, - key: item.data.key, - icon: item.data.icon, - iconSize: item.data.iconSize, - image: item.data.image, - picPlacement: item.data.picPlacement, - }; + return { ...item.data }; }); this.setData({ tabList: tab, diff --git a/src/tabs/index.less b/src/tabs/index.less index 1f68329b..d62bbafd 100644 --- a/src/tabs/index.less +++ b/src/tabs/index.less @@ -325,3 +325,6 @@ .l-tab-image-placement-right { flex-direction: row-reverse; } +.l-tabs-header .badge-view { + top: -20rpx +} diff --git a/src/tabs/index.wxml b/src/tabs/index.wxml index acaefa3f..99ae1651 100644 --- a/src/tabs/index.wxml +++ b/src/tabs/index.wxml @@ -1,4 +1,16 @@ - + + + - - - {{item.tab}} - + +