Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyan0205 committed Feb 4, 2020
2 parents bec0637 + 338c803 commit 4758498
Show file tree
Hide file tree
Showing 27 changed files with 211 additions and 68 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ title: Change Log
toc: hidden
---

### 2.5.8

`2020-02-04`

- Feat
- `Captcha` add prop `auto-send`, used to control whether the `send` event is automatically triggered when the captcha popup is first displayed
- `ResultPage` props add dynamic change response

- Fix
- Fix the issue of `Picker` and `DatePicker` that when scrolled multiple columns, the selected item was abnormal[#632](https://github.com/didi/mand-mobile/issues/632)
- Fix the incorrect timing of the refreshActive event in `ScrollViewRefresh`[#642](https://github.com/didi/mand-mobile/issues/642)
- Fix `Amount` displaying wrong numbers with thousands characters[#644](https://github.com/didi/mand-mobile/issues/644)
- Fix the issue that the size calculation of `TextAreaItem` is incorrect when nesting in` Popup`
- Fix the issue that auto-play would not work when sliding up and down in `Swiper`
- Fix `Tip` incorrect placement in ScrollView

### 2.5.7

`2019-12-26`
Expand All @@ -11,8 +27,8 @@ toc: hidden
- `Landscape` add prop `transition`, used to customize the display animation

- Fix
- Fix the reflowing issue that `Tabs` may cause when switching tabs[#627](https://github.com/didi/mand-mobile/issues/614)
- Fix the problem of scrolling accidentally when `NoticeBar` dynamically changed content[#628](https://github.com/didi/mand-mobile/issues/614)
- Fix the reflowing issue that `Tabs` may cause when switching tabs[#627](https://github.com/didi/mand-mobile/issues/627)
- Fix the problem of scrolling accidentally when `NoticeBar` dynamically changed content[#628](https://github.com/didi/mand-mobile/issues/628)
- Fix safe area white space compatible writing of `ActionBar`, `NumberKeyboard`

### 2.5.6
Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ title: 更新日志
toc: hidden
---

### 2.5.8

`2020-02-04`

- Feat
- `Captcha`增加属性`auto-send`,用于控制验证码弹窗第一次展示时是否自动触发`send`事件
- `ResultPage`属性增加动态变更响应

- Fix
- 修复`Picker``DatePicker`快速滑动多列时,选中项异常的问题[#632](https://github.com/didi/mand-mobile/issues/632)
- 修复`ScrollViewRefresh`中的`refreshActive`事件触发错误问题[#642](https://github.com/didi/mand-mobile/issues/642)
- 修复`Amount`使用千分符展示负数错误问题[#644](https://github.com/didi/mand-mobile/issues/644)
- 修复`TextAreaItem``Popup`中嵌套时尺寸计算错误的问题
- 修复`Swiper`上下滑动导致自动播放失效的问题
- 修复`Tip``ScrollView`中展示位置错误的问题

### 2.5.7

`2019-12-26`
Expand All @@ -11,8 +27,8 @@ toc: hidden
- `Landscape`增加属性`transition`,用于自定义展示动效

- Fix
- 修复`Tabs`在切换时可能导致的重绘问题[#627](https://github.com/didi/mand-mobile/issues/614)
- 修复`NoticeBar`动态变化内容时导致误触滚动的问题[#628](https://github.com/didi/mand-mobile/issues/614)
- 修复`Tabs`在切换时可能导致的重绘问题[#627](https://github.com/didi/mand-mobile/issues/627)
- 修复`NoticeBar`动态变化内容时导致误触滚动的问题[#628](https://github.com/didi/mand-mobile/issues/628)
- 修复`ActionBar`, `NumberKeyboard`安全区留白兼容写法

### 2.5.6
Expand Down
6 changes: 6 additions & 0 deletions components/amount/demo/cases/demo1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<md-amount
:value="1234"
has-separator
></md-amount>
<br>
<md-amount
:value="-123456.123"
:precision="3"
has-separator
></md-amount>
</div>
</template>
Expand Down
11 changes: 9 additions & 2 deletions components/amount/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ export default {
}
const numberParts = value.split('.')
const integerValue = numberParts[0]
let integerValue = numberParts[0]
const decimalValue = numberParts[1] || ''
let sign = ''
if (integerValue.startsWith('-')) {
integerValue = integerValue.substring(1)
sign = '-'
}
const formateValue = formatValueByGapStep(3, integerValue, separator, 'right', 0, 1)
return decimalValue ? `${formateValue.value}.${decimalValue}` : `${formateValue.value}`
return decimalValue ? `${sign}${formateValue.value}.${decimalValue}` : `${sign}${formateValue.value}`
},
doCapital(value) {
return numberCapital(value)
Expand Down
2 changes: 1 addition & 1 deletion components/amount/test/__snapshots__/demo.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ exports[`Amount -Demo Basic 1`] = `

exports[`Amount -Demo Disabled unselected 1`] = `<div class="md-example-child md-example-child-amount"><span class="md-amount"> 壹仟贰佰叁拾肆元整 </span> <span class="md-amount"> 壹拾贰元叁角肆分 </span> <span class="md-amount"> 壹仟贰佰元整 </span> <span class="md-amount"> 壹仟贰佰零壹元整 </span></div>`;

exports[`Amount -Demo Thousands Separator 1`] = `<div class="md-example-child md-example-child-amount"><span class="md-amount numerical">1,234.00</span></div>`;
exports[`Amount -Demo Thousands Separator 1`] = `<div class="md-example-child md-example-child-amount"><span class="md-amount numerical">1,234.00</span> <br> <span class="md-amount numerical">-123,456.123</span></div>`;
exports[`Amount -Demo Transition 1`] = `<div class="md-example-child md-example-child-amount"><span class="md-amount numerical">0.00</span></div>`;
6 changes: 6 additions & 0 deletions components/amount/test/cases/demo1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<md-amount
:value="1234"
has-separator
></md-amount>
<br>
<md-amount
:value="-123456.123"
:precision="3"
has-separator
></md-amount>
</div>
</template>
Expand Down
3 changes: 2 additions & 1 deletion components/captcha/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Vue.component(Captcha.name, Captcha)
| maxlength | maxlength of string, set to `-1` as no restriction | Number | 4 |
| mask | whether to mask code or not | Boolean | `false` |
| system | Use system keyboard or simulated keyboard | Boolean | `false` |
| auto-countdown |start the countdown automatically, otherwise need to manually call `countdown`|Boolean|`true`|
| auto-send <sup class="version-after">2.5.8+</sup> |whether the `send` event is triggered during the first display, otherwise you need to manually click the send button|Boolean|`true`|
| auto-countdown |whether to automatically start the countdown after manually clicking the send button, otherwise you need to manually call `countdown`|Boolean|`true`|
| title |-|String|-|
| brief |-|String|-|-|
| append-to | portal node of dialog | HTML Element | `document.body` |
Expand Down
3 changes: 2 additions & 1 deletion components/captcha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Vue.component(Captcha.name, Captcha)
|maxlength|字符最大输入长度, 若为`-1`则不限制输入长度|Number|`4`|
|mask|是否掩码|Boolean|`false`|
|system|是否使用系统默认键盘|Boolean|`false`|
|auto-countdown|是否自动开始倒计时,否则需手动调用`countdown`|Boolean|`true`|
|auto-send <sup class="version-after">2.5.8+</sup> |第一次展示时是否触发`send`事件,否则需手动点击发送按钮|Boolean|`true`|
|auto-countdown|手动点击发送按钮后是否自动开始倒计时,否则需手动调用`countdown`|Boolean|`true`|
|title|标题|String|-|
|brief|描述|String|-|
|append-to|挂载节点|HTMLElement|`document.body`|
Expand Down
11 changes: 9 additions & 2 deletions components/captcha/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ export default {
type: Boolean,
default: false,
},
autoSend: {
type: Boolean,
default: true,
},
autoCountdown: {
type: Boolean,
default: true,
Expand Down Expand Up @@ -156,7 +160,7 @@ export default {
this.code = ''
if (!this.firstShown) {
this.firstShown = true
this.$_onResend()
this.$_emitSend()
}
}
},
Expand All @@ -173,7 +177,7 @@ export default {
}
if (this.value || this.isView) {
this.firstShown = true
this.$_onResend()
this.$_emitSend()
}
},
Expand Down Expand Up @@ -207,6 +211,9 @@ export default {
}
this.$emit('send', this.countdown)
},
$_emitSend() {
this.autoSend && this.$_onResend()
},
// MARK: public methods
countdown() {
if (!this.count) {
Expand Down
19 changes: 19 additions & 0 deletions components/captcha/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ describe('Captcha - Operation', () => {
}, 2500)
})

it('auto send', done => {
wrapper = mount(Captcha, {
propsData: {
autoSend: false,
},
})

const eventStub = sinon.stub(wrapper.vm, '$emit')
wrapper.setProps({
value: true,
})
expect(eventStub.calledWith('send')).toEqual(false)
setTimeout(() => {
wrapper.find('.md-captcha-btn').trigger('click')
expect(eventStub.calledWith('send')).toEqual(true)
done()
}, 2500)
})

it('not countdown', () => {
wrapper = mount(Captcha, {
propsData: {
Expand Down
31 changes: 6 additions & 25 deletions components/date-picker/test/__snapshots__/demo.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ exports[`DatePicker - Demo Custom type and option textual values 1`] = `
<div class="md-picker-column-list">
<div class="md-picker-column-item">
<ul class="column-list" style="padding-top: 100px; margin-top: -100px;">
<li class="column-item" style="height: 45px; line-height: 45px;">1999年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2000年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2001年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2002年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2003年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2004年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2005年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2006年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2007年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2008年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2009年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2010年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2011年</li>
Expand All @@ -29,8 +19,8 @@ exports[`DatePicker - Demo Custom type and option textual values 1`] = `
<li class="column-item" style="height: 45px; line-height: 45px;">2015年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2016年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2017年</li>
<li class="column-item active" style="height: 45px; line-height: 45px;">2018年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2019年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2018年</li>
<li class="column-item active" style="height: 45px; line-height: 45px;">2019年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2020年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2021年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2022年</li>
Expand All @@ -41,16 +31,6 @@ exports[`DatePicker - Demo Custom type and option textual values 1`] = `
<li class="column-item" style="height: 45px; line-height: 45px;">2027年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2028年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2029年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2030年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2031年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2032年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2033年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2034年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2035年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2036年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2037年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2038年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2039年</li>
</ul>
</div>
<div class="md-picker-column-item">
Expand All @@ -70,8 +50,8 @@ exports[`DatePicker - Demo Custom type and option textual values 1`] = `
</ul>
</div>
<div class="md-picker-column-item">
<ul class="column-list" style="padding-top: 100px; margin-top: -100px;">
<li class="column-item" style="height: 45px; line-height: 45px;">*1日</li>
<ul class="column-list" style="padding-top: 100px;">
<li class="column-item active" style="height: 45px; line-height: 45px;">*1日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*2日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*3日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*4日</li>
Expand All @@ -80,7 +60,7 @@ exports[`DatePicker - Demo Custom type and option textual values 1`] = `
<li class="column-item" style="height: 45px; line-height: 45px;">*7日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*8日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*9日</li>
<li class="column-item active" style="height: 45px; line-height: 45px;">*10日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*10日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*11日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*12日</li>
<li class="column-item" style="height: 45px; line-height: 45px;">*13日</li>
Expand Down Expand Up @@ -242,6 +222,7 @@ exports[`DatePicker - Demo Date & Time selection 1`] = `
<li class="column-item" style="height: 45px; line-height: 45px;">2037年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2038年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2039年</li>
<li class="column-item" style="height: 45px; line-height: 45px;">2040年</li>
</ul>
</div>
<div class="md-picker-column-item">
Expand Down
6 changes: 5 additions & 1 deletion components/date-picker/test/cases/demo3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
title="选择出险时间"
:text-render="textRender"
:custom-types="['yyyy', 'MM','dd', 'hh', 'mm']"
:min-date="minDate"
:max-date="maxDate"
:default-date="currentDate"
is-view
></md-date-picker>
Expand All @@ -21,7 +23,9 @@ export default {
},
data() {
return {
currentDate: new Date('2018/10/10'),
currentDate: new Date('2019-10-01 00:00'),
minDate: new Date('2009-10-01'),
maxDate: new Date('2029-10-01'),
}
},
methods: {
Expand Down
3 changes: 2 additions & 1 deletion components/picker/picker-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ export default {
if (isInvalid || activeItemIndex === this.activedIndexs[index]) {
isInvalid && this.$_scrollToValidIndex(scroller, index, activeItemIndex)
activeItemIndex === this.activedIndexs[index] && this.$_scrollToIndex(scroller, index, activeItemIndex)
return false
}
Expand Down Expand Up @@ -557,7 +558,7 @@ export default {
.md-picker-column-list
display flex
height 100%
padding 0 picker-padding-h
// padding 0 picker-padding-h
.md-picker-column-item
position relative
Expand Down
25 changes: 15 additions & 10 deletions components/result-page/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,33 @@ export default {
},
},
data() {
const pre = '//manhattan.didistatic.com/static/manhattan/mand-mobile/result-page/2.1/'
const data = {
actualImgUrl: this.imgUrl || `${pre}${this.type}.png`,
actualText:
computed: {
actualImgUrl() {
const pre = '//manhattan.didistatic.com/static/manhattan/mand-mobile/result-page/2.1/'
return this.imgUrl || `${pre}${this.type}.png`
},
actualText() {
return (
this.text ||
{
// 网络连接异常
network: '\u7f51\u7edc\u8fde\u63a5\u5f02\u5e38',
// 暂无信息
empty: '\u6682\u65e0\u4fe1\u606f',
}[this.type] ||
'',
actualSubText:
''
)
},
actualSubText() {
return (
this.subtext ||
{
// 您要访问的页面已丢失
lost: '\u60a8\u8981\u8bbf\u95ee\u7684\u9875\u9762\u5df2\u4e22\u5931',
}[this.type] ||
'',
}
return data
''
)
},
},
}
</script>
Expand Down
23 changes: 23 additions & 0 deletions components/result-page/test/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Vue from 'vue'
import {ResultPage} from 'mand-mobile'
import {mount} from '@vue/test-utils'

describe('ResultPage - Operation', () => {
let wrapper

afterEach(() => {
wrapper && wrapper.destroy()
})

it('props reactive', () => {
let name = ''
wrapper = mount(ResultPage, {
propsData: {
text: '123',
},
})
expect(wrapper.find('.md-result-text').text()).toBe('123')
wrapper.setProps({text: '456'})
expect(wrapper.find('.md-result-text').text()).toBe('456')
})
})
Loading

0 comments on commit 4758498

Please sign in to comment.