Merge pull request #23 from iview/2.0

update
This commit is contained in:
yangdan8 2019-01-03 16:50:19 +08:00 committed by GitHub
commit e33a0b9838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 935 additions and 830 deletions

View file

@ -26,7 +26,7 @@ iView
<tr>
<td align="center" valign="middle">
<a href="https://segmentfault.com/ls/1650000016424063" target="_blank">
<img width="300" src="https://file.iviewui.com/asd/asd-iview-live2.png">
<img width="300" src="https://file.iviewui.com/asd/asd-i-2.png">
</a>
</td>
<td align="center" valign="middle">

1413
dist/iview.js vendored

File diff suppressed because it is too large Load diff

2
dist/iview.js.map vendored

File diff suppressed because one or more lines are too long

6
dist/iview.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/iview.min.js.gz vendored

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,61 +1,77 @@
<template>
<Cascader :data="data4" :load-data="loadData"></Cascader>
<div>
<Row>
<i-col span="18">
<i-button v-on:click="setValue">setValue</i-button>
</i-col>
<i-col span="4">
<Cascader :data="data" v-model="value1" transfer></Cascader>
</i-col>
</Row>
</div>
</template>
<script>
export default {
data () {
return {
data4: [
{
value: 'beijing',
label: '北京',
children: [],
loading: false
},
{
value: 'hangzhou',
label: '杭州',
children: [],
loading:false
}
]
value1: [],
data: [{
value: '9ecec83c-cf6b-4cfe-aa75-eb3510875331',
label: '北京',
children: [{
value: 'a873a9bd-7d75-4f46-9369-4d25a1feb13c',
label: '故宫'
}, {
value: 'tiantan',
label: '天坛'
}, {
value: 'wangfujing',
label: '王府井'
}]
}, {
value: 'ca7c0fbc-728d-42e8-b111-f5f73cf9171b',
label: '江苏',
children: [{
value: 'a89d891b-5c50-44c0-87b4-d4f934edc921',
label: '南京',
children: [{
value: '44736384-0ede-41ba-bf7a-59c84241851a',
label: '夫子庙中国第一庙来自南京',
children:[{
value: '44736384-0ede-41ba-bf7a-59c84241851c',
label:'自定义产品系统来自黑龙江地区'
}]
}]
}, {
value: 'suzhou',
label: '苏州',
children: [{
value: 'zhuozhengyuan',
label: '拙政园',
}, {
value: 'shizilin',
label: '狮子林',
}]
}],
}]
}
},
methods: {
loadData (item, callback) {
item.loading = true;
setTimeout(() => {
if (item.value === 'beijing') {
item.children = [
{
value: 'talkingdata',
label: 'TalkingData'
},
{
value: 'baidu',
label: '百度'
},
{
value: 'sina',
label: '新浪'
}
];
} else if (item.value === 'hangzhou') {
item.children = [
{
value: 'ali',
label: '阿里巴巴'
},
{
value: '163',
label: '网易'
}
];
}
item.loading = false;
callback();
}, 1000);
setValue() {
var v = "ca7c0fbc-728d-42e8-b111-f5f73cf9171b,a89d891b-5c50-44c0-87b4-d4f934edc921,44736384-0ede-41ba-bf7a-59c84241851a";
var x = v.split(',')
var x1 = x[0].toString();
var x2 = x[1].toString();
var x3 = x[2].toString();
this.value1 = x;
}
},
mounted () {
}
}
</script>
<style>
</style>

View file

@ -25,6 +25,25 @@
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider dashed>iView Developer</Divider>
<p>
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider dashed orientation="left">iView Developer</Divider>
<p>
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider dashed orientation="right">iView Developer</Divider>
<p>
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
iView is a set of UI components and widgets built on Vue.js.
</p>
<Divider dashed/>
<p>
@ -60,6 +79,8 @@
<a href="#">Components</a>
<Divider type="vertical" />
<a href="#">Divider</a>
<Divider type="vertical" dashed />
<a href="#">ABCDE</a>
</div>
</Card>
</i-col>

View file

@ -1,75 +1,47 @@
<template>
<Row>
<Col span="12" style="padding-right:10px">
<Select
v-model="model13"
filterable
remote
:remote-method="remoteMethod1"
:loading="loading1">
<Option v-for="(option, index) in options1" :value="option.value" :key="index">{{option.label}}</Option>
<div style="margin: 200px;">
<Select size="small" v-model="model10" multiple style="width:260px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</Col>
<Col span="12">
<Select
v-model="model14"
multiple
filterable
remote
:remote-method="remoteMethod2"
:loading="loading2">
<Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option>
<Select v-model="model10" multiple style="width:260px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</Col>
</Row>
<Select size="large" v-model="model10" multiple style="width:260px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</div>
</template>
<script>
export default {
data () {
return {
model13: '',
loading1: false,
options1: [],
model14: [],
loading2: false,
options2: [],
list: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New hampshire', 'New jersey', 'New mexico', 'New york', 'North carolina', 'North dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode island', 'South carolina', 'South dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West virginia', 'Wisconsin', 'Wyoming']
}
},
methods: {
remoteMethod1 (query) {
if (query !== '') {
this.loading1 = true;
setTimeout(() => {
this.loading1 = false;
const list = this.list.map(item => {
return {
value: item,
label: item
};
});
this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);
}, 200);
} else {
this.options1 = [];
}
},
remoteMethod2 (query) {
if (query !== '') {
this.loading2 = true;
setTimeout(() => {
this.loading2 = false;
const list = this.list.map(item => {
return {
value: item,
label: item
};
});
this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);
}, 200);
} else {
this.options2 = [];
}
cityList: [
{
value: 'New York',
label: 'New York'
},
{
value: 'London',
label: 'LondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondonLondon'
},
{
value: 'Sydney',
label: 'Sydney'
},
{
value: 'Ottawa',
label: 'Ottawa'
},
{
value: 'Paris',
label: 'Paris'
},
{
value: 'Canberra',
label: 'Canberra'
}
],
model10: ['New York', 'London']
}
}
}

View file

@ -1,6 +1,6 @@
{
"name": "iview",
"version": "3.2.0",
"version": "3.2.1",
"title": "iView",
"description": "A high quality UI components Library with Vue.js",
"homepage": "http://www.iviewui.com",

View file

@ -59,8 +59,8 @@
handleTriggerItem (item, fromInit = false, fromUser = false) {
if (item.disabled) return;
const cascader = findComponentUpward(this, 'Cascader');
if (item.loading !== undefined && !item.children.length) {
const cascader = findComponentUpward(this, 'Cascader');
if (cascader && cascader.loadData) {
cascader.loadData(item, () => {
// todo
@ -110,6 +110,10 @@
fromInit: fromInit
});
}
if (cascader) {
cascader.$refs.drop.update();
}
},
updateResult (item) {
this.result = [this.tmpItem].concat(item);

View file

@ -42,6 +42,7 @@
`${prefixCls}`,
`${prefixCls}-${this.type}`,
{
[`${prefixCls}-with-text`]: this.hasSlot && this.orientation === 'center',
[`${prefixCls}-with-text-${this.orientation}`]: this.hasSlot,
[`${prefixCls}-dashed`]: !!this.dashed
}

View file

@ -30,6 +30,9 @@
@keydown="handleKeydown"
@focus="handleFocus"
@blur="handleBlur"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
@input="handleInput"
@change="handleChange">
<div :class="[prefixCls + '-group-append']" v-if="append" v-show="slotReady"><slot name="append"></slot></div>
@ -62,6 +65,9 @@
@keydown="handleKeydown"
@focus="handleFocus"
@blur="handleBlur"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
@input="handleInput">
</textarea>
</div>
@ -179,7 +185,8 @@
slotReady: false,
textareaStyles: {},
showPrefix: false,
showSuffix: false
showSuffix: false,
isOnComposition: false
};
},
computed: {
@ -244,7 +251,18 @@
this.dispatch('FormItem', 'on-form-blur', this.currentValue);
}
},
handleComposition(event) {
if (event.type === 'compositionstart') {
this.isOnComposition = true;
}
if (event.type === 'compositionend') {
this.isOnComposition = false;
this.handleInput(event);
}
},
handleInput (event) {
if (this.isOnComposition) return;
let value = event.target.value;
if (this.number && value !== '') value = Number.isNaN(Number(value)) ? value : Number(value);
this.$emit('input', value);

View file

@ -761,21 +761,12 @@
},
slotOptions(options, old){
// #4626 Options label v-model
if (options && options.length && this.values.length && !this.multiple) {
this.values = this.values.map(value => {
const option = options.find(option => {
if (!option.componentOptions) return false;
return option.componentOptions.propsData.value === value.value;
});
if(!option) return null;
const label = getOptionLabel(option);
return {
value: value.value,
label: label
};
}).filter(Boolean);
// remote getInitialValue bug
if (!this.remote) {
const values = this.getInitialValue();
if (this.flatOptions && this.flatOptions.length && values.length && !this.multiple) {
this.values = values.map(this.getOptionData).filter(Boolean);
}
}
// dropdown

View file

@ -18,6 +18,7 @@
display: block;
height: 1px;
width: 100%;
min-width: 100%;
margin: 24px 0;
clear: both;
}

View file

@ -112,6 +112,10 @@
&[disabled] {
.disabled();
}
&::placeholder {
color: @input-placeholder-color;
}
}
&-large {

View file

@ -205,9 +205,21 @@
height: 24px;
line-height: 22px;
margin: 3px 4px 3px 0;
//i{
// top: 2px;
//}
max-width: 99%;
position: relative;
span{
display: block;
margin-right: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
i{
display: block;
position: absolute;
right: 4px;
top: 4px;
}
}
&-large&-multiple .@{css-prefix}tag{
@ -215,7 +227,7 @@
line-height: 26px;
font-size: @font-size-base;
i{
top: 1px;
top: 6px;
}
}
@ -225,8 +237,12 @@
font-size: @font-size-small;
padding: 0 6px;
margin: 3px 4px 2px 0;
span{
margin-right: 14px;
}
i{
top: 1px;
right: 2px;
}
}

View file

@ -6,12 +6,21 @@
margin: 0;
padding: 0;
font-size: @font-size-small;
&.@{dropdown-prefix-cls}-menu{
padding: 0;
}
li{
list-style: none;
margin: 8px 0;
padding: 0;
white-space: nowrap;
outline: none;
&.@{dropdown-item-prefix-cls}{
margin: 0;
padding: 7px 16px;
white-space: nowrap;
}
}
}
li{

17
types/tree.d.ts vendored
View file

@ -38,14 +38,19 @@ export declare interface Tree extends Vue {
* @default children
*/
"children-key"?: string;
/**
*
* @default false
*/
"check-strictly"?: boolean;
/**
*
* @default
* @default
*/
$emit(eventName: "on-select-change", value: TreeChild[]): this;
/**
*
* @default
* @default
*/
$emit(eventName: "on-check-change", value: TreeChild[]): this;
/**
@ -56,11 +61,15 @@ export declare interface Tree extends Vue {
/**
*
*/
getCheckedNodes(): void;
getCheckedNodes(): any[];
/**
*
*/
getSelectedNodes(): void;
getSelectedNodes(): any[];
/**
*
*/
getCheckedAndIndeterminateNodes(): any[];
}
export declare interface TreeChild extends Vue {