Merge remote-tracking branch 'upstream/master'

This commit is contained in:
jingsam 2016-10-28 18:51:01 +08:00
commit 072cd25b16
10 changed files with 171 additions and 53 deletions

View file

@ -1,7 +1,7 @@
import Vue from 'vue'; import Vue from 'vue';
import Modal from './modal.vue'; import Modal from './modal.vue';
import Icon from '../icon/icon.vue'; import Icon from '../icon/icon.vue';
import Button from '../button/button.vue'; import iButton from '../button/button.vue';
import { camelcaseToHyphen } from '../../utils/assist'; import { camelcaseToHyphen } from '../../utils/assist';
const prefixCls = 'ivu-modal-confirm'; const prefixCls = 'ivu-modal-confirm';
@ -26,8 +26,8 @@ Modal.newInstance = properties => {
{{{ body }}} {{{ body }}}
</div> </div>
<div class="${prefixCls}-footer"> <div class="${prefixCls}-footer">
<Button type="ghost" size="large" v-if="showCancel" @click="cancel">{{ cancelText }}</Button> <i-button type="ghost" size="large" v-if="showCancel" @click="cancel">{{ cancelText }}</i-button>
<Button type="primary" size="large" :loading="buttonLoading" @click="ok">{{ okText }}</Button> <i-button type="primary" size="large" :loading="buttonLoading" @click="ok">{{ okText }}</i-button>
</div> </div>
</div> </div>
</Modal> </Modal>
@ -36,7 +36,7 @@ Modal.newInstance = properties => {
const modal = new Vue({ const modal = new Vue({
el: div, el: div,
components: { Modal, Button, Icon }, components: { Modal, iButton, Icon },
data: Object.assign(_props, { data: Object.assign(_props, {
visible: false, visible: false,
width: 416, width: 416,

View file

@ -12,8 +12,8 @@
<div :class="[prefixCls + '-body']"><slot></slot></div> <div :class="[prefixCls + '-body']"><slot></slot></div>
<div :class="[prefixCls + '-footer']" v-if="!footerHide"> <div :class="[prefixCls + '-footer']" v-if="!footerHide">
<slot name="footer"> <slot name="footer">
<Button type="ghost" size="large" @click="cancel">{{ cancelText }}</Button> <i-button type="ghost" size="large" @click="cancel">{{ cancelText }}</i-button>
<Button type="primary" size="large" :loading="buttonLoading" @click="ok">{{ okText }}</Button> <i-button type="primary" size="large" :loading="buttonLoading" @click="ok">{{ okText }}</i-button>
</slot> </slot>
</div> </div>
</div> </div>
@ -22,13 +22,13 @@
</template> </template>
<script> <script>
import Icon from '../icon'; import Icon from '../icon';
import Button from '../button'; import iButton from '../button/button.vue';
import { getScrollBarSize } from '../../utils/assist'; import { getScrollBarSize } from '../../utils/assist';
const prefixCls = 'ivu-modal'; const prefixCls = 'ivu-modal';
export default { export default {
components: { Icon, Button }, components: { Icon, iButton },
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,

View file

@ -145,7 +145,7 @@
return [ return [
`${prefixCls}-prev`, `${prefixCls}-prev`,
{ {
[`${prefixCls}-disabled`]: this.current == 1 [`${prefixCls}-disabled`]: this.current === 1
} }
] ]
}, },
@ -153,7 +153,7 @@
return [ return [
`${prefixCls}-next`, `${prefixCls}-next`,
{ {
[`${prefixCls}-disabled`]: this.current == this.allPages [`${prefixCls}-disabled`]: this.current === this.allPages
} }
] ]
}, },
@ -161,7 +161,7 @@
return [ return [
`${prefixCls}-item`, `${prefixCls}-item`,
{ {
[`${prefixCls}-item-active`]: this.current == 1 [`${prefixCls}-item-active`]: this.current === 1
} }
] ]
}, },
@ -169,7 +169,7 @@
return [ return [
`${prefixCls}-item`, `${prefixCls}-item`,
{ {
[`${prefixCls}-item-active`]: this.current == this.allPages [`${prefixCls}-item-active`]: this.current === this.allPages
} }
] ]
} }

View file

@ -37,7 +37,7 @@
</template> </template>
<script> <script>
import Popper from '../base/popper'; import Popper from '../base/popper';
import Button from '../button/button.vue'; import iButton from '../button/button.vue';
import clickoutside from '../../directives/clickoutside'; import clickoutside from '../../directives/clickoutside';
import { oneOf } from '../../utils/assist'; import { oneOf } from '../../utils/assist';
@ -46,7 +46,7 @@
export default { export default {
mixins: [Popper], mixins: [Popper],
directives: { clickoutside }, directives: { clickoutside },
components: { iButton: Button }, components: { iButton },
props: { props: {
trigger: { trigger: {
validator (value) { validator (value) {
@ -92,9 +92,9 @@
computed: { computed: {
classes () { classes () {
return [ return [
prefixCls + '', `${prefixCls}`,
{ {
[prefixCls + '-confirm']: this.confirm [`${prefixCls}-confirm`]: this.confirm
} }
] ]
}, },
@ -102,7 +102,7 @@
let style = {}; let style = {};
if (!!this.width) { if (!!this.width) {
style.width = '${this.width}px'; style.width = `${this.width}px`;
} }
return style; return style;
} }

View file

@ -100,14 +100,14 @@
computed: { computed: {
classes () { classes () {
return [ return [
prefixCls + '', `${prefixCls}`,
{ {
[prefixCls + '-visible']: this.visible, [`${prefixCls}-visible`]: this.visible,
[prefixCls + '-disabled']: this.disabled, [`${prefixCls}-disabled`]: this.disabled,
[prefixCls + '-multiple']: this.multiple, [`${prefixCls}-multiple`]: this.multiple,
[prefixCls + '-single']: !this.multiple, [`${prefixCls}-single`]: !this.multiple,
[prefixCls + '-show-clear']: this.showCloseIcon, [`${prefixCls}-show-clear`]: this.showCloseIcon,
[prefixCls + '-${this.size}']: !!this.size [`${prefixCls}-${this.size}`]: !!this.size
} }
] ]
}, },
@ -136,7 +136,7 @@
if (this.showPlaceholder) { if (this.showPlaceholder) {
style.width = '100%'; style.width = '100%';
} else { } else {
style.width = '${this.inputLength}px'; style.width = `${this.inputLength}px`;
} }
} }

View file

@ -0,0 +1,3 @@
import Slider from './slider.vue';
export default Slider;

View file

@ -0,0 +1,116 @@
<template>
<div :class="classes">
<Input-number v-if="!range && showInput" :min="min" :max="max" :step="step" :value.sync="value" :disabled="disabled"></Input-number>
<div :class="[prefixCls + '-wrap']" @click="sliderClick">
<template v-if="showStops">
<div :class="[prefixCls + '-stop']" v-for="item in stops" :style="{ 'left': item + '%' }"></div>
</template>
<div :class="[prefixCls + '-bar']" :style="barStyle"></div>
<div :class="[prefixCls + '-button-wrap']" v-if="!range">
<Tooltip placement="top" :content="tipFormat(value)">
<div :class="[prefixCls + '-button']"></div>
</Tooltip>
</div>
</div>
</div>
</template>
<script>
import InputNumber from '../../components/input-number/input-number.vue';
import Tooltip from '../../components/tooltip/tooltip.vue';
const prefixCls = 'ivu-slider';
export default {
components: { InputNumber, Tooltip },
props: {
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
range: {
type: Boolean,
default: false
},
value: {
type: [Number, Array],
default: 0
},
disabled: {
type: Boolean,
default: false
},
showInput: {
type: Boolean,
default: false
},
showStops: {
type: Boolean,
default: false
},
tipFormat: {
type: Function,
default (val) {
return val;
}
}
},
data () {
return {
prefixCls: prefixCls
}
},
computed: {
classes () {
return [
`${prefixCls}`,
{
[`${prefixCls}-input`]: this.showInput,
[`${prefixCls}-range`]: this.range,
[`${prefixCls}-disabled`]: this.disabled
}
]
},
barStyle () {
let style;
if (this.range) {
style = {
width: (this.value[1] - this.value[0]) / (this.max - this.min) * 100 + '%',
left: (this.value[0] - this.min) / (this.max - this.min) * 100 + '%'
}
} else {
style = {
width: (this.value - this.min) / (this.max - this.min) * 100 + '%'
}
}
return style;
},
stops() {
return this.max / this.step;
}
},
methods: {
sliderClick () {
}
},
ready () {
if (this.range) {
const isArray = Array.isArray(this.value);
if (!isArray || (isArray && this.value.length != 2) || (isArray && (!isNaN(this.value[0]) || !isNaN(this.value[1])))) {
this.value = [0, 0];
}
}
}
}
</script>

View file

@ -1,12 +1,12 @@
<template> <template>
<div :class="[prefix]" @mouseenter="handleShowPopper" @mouseleave="handleClosePopper"> <div :class="[prefixCls]" @mouseenter="handleShowPopper" @mouseleave="handleClosePopper">
<div :class="[prefix + '-rel']" v-el:reference> <div :class="[prefixCls + '-rel']" v-el:reference>
<slot></slot> <slot></slot>
</div> </div>
<div :class="[prefix + '-popper']" transition="fade" v-el:popper v-show="!disabled && visible"> <div :class="[prefixCls + '-popper']" transition="fade" v-el:popper v-show="!disabled && visible">
<div :class="[prefix + '-content']"> <div :class="[prefixCls + '-content']">
<div :class="[prefix + '-arrow']"></div> <div :class="[prefixCls + '-arrow']"></div>
<div :class="[prefix + '-inner']"><slot name="content">{{ content }}</slot></div> <div :class="[prefixCls + '-inner']"><slot name="content">{{ content }}</slot></div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -27,9 +27,11 @@ import Modal from './components/modal';
import { Select, Option, OptionGroup } from './components/select'; import { Select, Option, OptionGroup } from './components/select';
import Tooltip from './components/tooltip'; import Tooltip from './components/tooltip';
import Poptip from './components/poptip'; import Poptip from './components/poptip';
import Slider from './components/slider';
const iview = { const iview = {
Button, Button,
iButton: Button,
ButtonGroup: Button.Group, ButtonGroup: Button.Group,
Icon, Icon,
Input, Input,
@ -67,7 +69,8 @@ const iview = {
iOption: Option, iOption: Option,
iOptionGroup: OptionGroup, iOptionGroup: OptionGroup,
Tooltip, Tooltip,
Poptip Poptip,
Slider
}; };
module.exports = iview; module.exports = iview;

View file

@ -1,29 +1,25 @@
<style>
body{
padding: 50px;
}
</style>
<template> <template>
<Collapse active-key="1"> <Slider :value="10" :tip-format="format">
<Panel key="1">
史蒂夫·乔布斯 </Slider>
<p slot="content">史蒂夫·乔布斯Steve Jobs1955年2月24日生于美国加利福尼亚州旧金山美国发明家企业家美国苹果公司联合创办人</p>
</Panel>
<Panel key="2">
斯蒂夫·盖瑞·沃兹尼亚克
<p slot="content">斯蒂夫·盖瑞·沃兹尼亚克Stephen Gary Wozniak美国电脑工程师曾与史蒂夫·乔布斯合伙创立苹果电脑今之苹果公司斯蒂夫·盖瑞·沃兹尼亚克曾就读于美国科罗拉多大学后转学入美国著名高等学府加州大学伯克利分校UC Berkeley并获得电机工程及计算机EECS本科学位1987</p>
</Panel>
<Panel key="3">
乔纳森·伊夫
<p slot="content">乔纳森·伊夫是一位工业设计师现任Apple公司设计师兼资深副总裁英国爵士他曾参与设计了iPodiMaciPhoneiPad等众多苹果产品除了乔布斯他是对苹果那些著名的产品最有影响力的人</p>
</Panel>
</Collapse>
<Input-number :max="10" :min="1" :value="1" @on-change="change"></Input-number>
<Input-number :max="10" :min="1" :step="1.2" :value="1"></Input-number>
</template> </template>
<script> <script>
import { Collapse, InputNumber } from 'iview'; import { Slider } from 'iview';
const Panel = Collapse.Panel;
export default { export default {
components: { Collapse, Panel, InputNumber }, components: { Slider },
data () {
return {
}
},
methods: { methods: {
change (data) { format (val) {
console.log(data); return `进度:${val}%`
} }
} }
} }