Skip to content

Commit

Permalink
Merge branch 'dev' into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Dec 28, 2016
2 parents 7eb8a19 + b569b31 commit d2f02b8
Show file tree
Hide file tree
Showing 65 changed files with 1,770 additions and 749 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.en-US.md
@@ -1,5 +1,22 @@
## Changelog

### 1.0.9

*2016-12-27*

- Fixed DatePicker incorrectly triggering input event, #1834
- Fixed Tree reporting `event is undefined` error in Firefox, #1945
- Added `change` event for DatePicker, whose parameter is the formatted value, #1841
- Added `header-align` attribute for Table, #1424
- Fixed single select Table's highlight style not removing when data is removed, #1890
- Fixed filterable Select lagging issue with more options, #1933
- Fixed multiple disabled Select not disabling removing selected options issue, #2001
- Fixed Col style not working in `xs`, #2011
- Added `value` attribute for Tab, #2008
- Fixed InputNumber `change` event incorrectly firing multiple times in some conditions, #1999
- Added `clearable` attribute for DatePicker, #1994
- Fixed Form always passing validation in async mode, #1936

### 1.0.8

*2016-12-20*
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.zh-CN.md
@@ -1,5 +1,21 @@
## 更新日志

### 1.0.9
*2016-12-27*

- 修复 DatePicker 不能正确触发 input 事件的问题,现在只有当日期改变时才触发,#1834
- 修复 Tree 在 Firefox 下会提示 event is undefined 的问题,#1945
- 新增 DatePicker 的 `change` 事件,返回和输入框一致的格式化后的值,#1841
- 新增 Table 的 `header-align` 属性,#1424
- 修复单选的 Table 在数据移除时,高亮状态仍然存在的问题,#1890
- 修复可搜索的 Select 在选项较多时的卡顿问题,#1933
- 修复多选的 Select 在禁用状态下仍然能够手动删除选中项的问题,#2001
- 修复 Col `xs` 分辨率下样式无效的问题,#2011
- 新增 Tab 组件的 `value` 属性并支持 `v-model` 用法,#2008
- 修复 Input Number 在某些条件下 change 事件被触发多次的问题,#1999
- 新增 DatePicker 的 `clearable` 属性,#1994
- 修复 Form 异步验证时某些条件下总是验证通过的问题,#1936

### 1.0.8
*2016-12-20*

Expand Down
4 changes: 4 additions & 0 deletions build/cooking.demo.js
@@ -1,6 +1,7 @@
var cooking = require('cooking');
var config = require('./config');
var md = require('markdown-it')();
var CopyWebpackPlugin = require('copy-webpack-plugin');
var striptags = require('./strip-tags');
var slugify = require('transliteration').slugify;
var isProd = process.env.NODE_ENV === 'production';
Expand Down Expand Up @@ -113,5 +114,8 @@ if (isProd) {
cooking.add('externals.vue-router', 'VueRouter');
}

cooking.add('plugin.CopyWebpackPlugin', new CopyWebpackPlugin([
{ from: 'examples/versions.json' }
]));
cooking.add('vue.preserveWhitespace', false);
module.exports = cooking.resolve();
9 changes: 8 additions & 1 deletion examples/components/footer.vue
Expand Up @@ -2,7 +2,7 @@
<footer class="footer">
<div class="container">
<div class="footer-main">
<p class="footer-main-title">Element 1.0 Hydrogen</p>
<p class="footer-main-title">Element {{ version }} Hydrogen</p>
<a href="https://github.com/ElemeFE/element/issues" class="footer-main-link" target="_blank">{{ langConfig.feedback }}</a>
<a href="https://github.com/ElemeFE/element/blob/master/.github/CONTRIBUTING.md" class="footer-main-link" target="_blank">{{ langConfig.contribution }}</a>
</div>
Expand Down Expand Up @@ -134,8 +134,15 @@

<script type="text/babel">
import compoLang from '../i18n/component.json';
import { version } from 'main/index.js';
export default {
data() {
return {
version
};
},
computed: {
lang() {
return this.$route.path.split('/')[1];
Expand Down
94 changes: 93 additions & 1 deletion examples/components/side-nav.vue
Expand Up @@ -12,6 +12,41 @@
margin: 0;
overflow: hidden;
}
.nav-dropdown {
margin-bottom: 6px;
width: 100%;
span {
display: block;
width: 100%;
font-size: 16px;
color: #5e6d82;
line-height: 40px;
transition: .2s;
border-bottom: 1px solid #eaeefb;
&:hover {
cursor: pointer;
}
}
i {
transition: .2s;
font-size: 12px;
color: #d3dce6;
}
@when active {
span, i {
color: #20a0ff;
}
i {
transform: rotateZ(180deg) translateY(2px);
}
}
&:hover {
span, i {
color: #20a0ff;
}
}
}
.nav-item {
a {
Expand Down Expand Up @@ -53,9 +88,37 @@
margin-top: 10px;
}
}
.nav-dropdown-list {
width: 120px;
margin-top: -8px;
li {
font-size: 14px;
}
}
</style>
<template>
<div class="side-nav" :style="navStyle">
<el-dropdown
v-show="isComponentPage"
trigger="click"
class="nav-dropdown"
:class="{ 'is-active': dropdownVisible }">
<span>
{{ langConfig.dropdown }}{{ version }}
<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu
slot="dropdown"
:offset="-80"
class="nav-dropdown-list"
@input="handleDropdownToggle">
<el-dropdown-item
v-for="item in Object.keys(versions)"
@click.native="switchVersion(item)">
{{ item }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<ul>
<li class="nav-item" v-for="item in data">
<a v-if="!item.path" @click="expandMenu">{{item.name}}</a>
Expand Down Expand Up @@ -99,6 +162,9 @@
</div>
</template>
<script>
import compoLang from '../i18n/component.json';
import { version } from 'main/index.js';
export default {
props: {
data: Array,
Expand All @@ -111,7 +177,10 @@
return {
highlights: [],
navState: [],
isSmallScreen: false
isSmallScreen: false,
versions: [],
version,
dropdownVisible: false
};
},
watch: {
Expand All @@ -122,9 +191,19 @@
computed: {
navStyle() {
return this.isSmallScreen ? { 'padding-bottom': '60px' } : {};
},
isComponentPage() {
return /^component-/.test(this.$route.name);
},
langConfig() {
return compoLang.filter(config => config.lang === this.$route.meta.lang)[0]['nav'];
}
},
methods: {
switchVersion(version) {
if (version === this.version) return;
location.href = `${ location.origin }/${ this.versions[version] }/${ location.hash } `;
},
handleResize() {
this.isSmallScreen = document.documentElement.clientWidth < 768;
this.handlePathChange();
Expand Down Expand Up @@ -160,8 +239,21 @@
if (!target.nextElementSibling || target.nextElementSibling.tagName !== 'UL') return;
this.hideAllMenu();
event.currentTarget.nextElementSibling.style.height = 'auto';
},
handleDropdownToggle(visible) {
this.dropdownVisible = visible;
}
},
created() {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = _ => {
if (xhr.readyState === 4 && xhr.status === 200) {
this.versions = JSON.parse(xhr.responseText);
}
};
xhr.open('GET', '/versions.json');
xhr.send();
},
mounted() {
this.handleResize();
window.addEventListener('resize', this.handleResize);
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/en-US/custom-theme.md
Expand Up @@ -51,7 +51,7 @@ Just edit `element-variables.css`, e.g. changing the theme color to red:
```

### Build theme
After saving the variable file, use `et` to build your theme. You can activate `watch` mode by adding a parameter `-w`:
After saving the variable file, use `et` to build your theme. You can activate `watch` mode by adding a parameter `-w`. And if you customized the variable file's output, you need to add a parameter `-c` and variable file's name:
```shell
et

Expand Down
9 changes: 8 additions & 1 deletion examples/docs/en-US/date-picker.md
Expand Up @@ -256,6 +256,7 @@ Picking a date range is supported.
| disabled | whether DatePicker is disabled | boolean | - | false |
|size | size of Input | string | large/small/mini ||
| editable | whether the input is editable | boolean | - | true |
| clearable | Whether to show clear button | boolean | - | true |
| placeholder | placeholder | string |||
| type | type of the picker | string | year/month/date/datetime/ week/datetimerange/daterange | date |
| format | format of the picker | string | year `yyyy` month `MM` day `dd`, hour `HH`, minute `mm`, second `ss` | yyyy-MM-dd |
Expand All @@ -274,4 +275,10 @@ Picking a date range is supported.
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- |
| text | title of the shortcut | string |||
| onClick | callback function, triggers when the shortcut is clicked, with the `vm` as its parameter. You can change the picker value by emitting the `pick` event. Example: `vm.$emit('pick', new Date())`| function |||
| onClick | callback function, triggers when the shortcut is clicked, with the `vm` as its parameter. You can change the picker value by emitting the `pick` event. Example: `vm.$emit('pick', new Date())`| function |||


### Events
| Event Name | Description | Parameters |
|---------|--------|---------|
| change | triggers when input value changes | formatted value |
8 changes: 8 additions & 0 deletions examples/docs/en-US/datetime-picker.md
Expand Up @@ -210,6 +210,7 @@ Select date and time in one picker.
| readonly | whether DatePicker is read only | boolean || false |
| disabled | whether DatePicker is disabled | boolean | - | false |
| editable | whether the input is editable | boolean | - | true |
| clearable | Whether to show clear button | boolean | - | true |
|size | size of Input | string | large/small/mini ||
| placeholder | placeholder | string |||
| type | type of the picker | string | year/month/date/datetime/ week/datetimerange/daterange | date |
Expand All @@ -229,3 +230,10 @@ Select date and time in one picker.
|---------- |-------------- |---------- |-------------------------------- |-------- |
| text | title of the shortcut | string |||
| onClick | callback function, triggers when the shortcut is clicked, with the `vm` as its parameter. You can change the picker value by emitting the `pick` event. Example: `vm.$emit('pick', new Date())`| function |||


### Events
| Event Name | Description | Parameters |
|---------|--------|---------|
| change | triggers when input value changes | formatted value |

33 changes: 33 additions & 0 deletions examples/docs/en-US/dropdown.md
Expand Up @@ -3,6 +3,9 @@
methods: {
handleClick() {
alert('button click');
},
handleCommand(command) {
this.$message('click on item ' + command);
}
}
}
Expand Down Expand Up @@ -126,6 +129,36 @@ Use `hide-on-click` to define if menu closes on clicking.
```
:::

### Command event

Clicking each dropdown item fires an event whose parameter is assigned by each item.

:::demo
```html
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link">
Dropdown List<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">Action 1</el-dropdown-item>
<el-dropdown-item command="b">Action 2</el-dropdown-item>
<el-dropdown-item command="c">Action 3</el-dropdown-item>
<el-dropdown-item command="d" disabled>Action 4</el-dropdown-item>
<el-dropdown-item command="e" divided>Action 5</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<script>
export default {
methods: {
handleCommand(command) {
this.$message('click on item ' + command);
}
}
}
</script>
```
:::


### Dropdown Attributes
| Attribute | Description | Type | Accepted Values | Default |
Expand Down
5 changes: 4 additions & 1 deletion examples/docs/en-US/input.md
Expand Up @@ -591,7 +591,10 @@ Search data from server-side.

| Event Name | Description | Parameters |
|----| ----| ----|
|click | triggers when the icon inside Input is clicked | event object |
|click | triggers when the icon inside Input is clicked | (event: Event) |
| blur | triggers when the icon inside Input is blur | (event: Event) |
| focus | triggers when the icon inside Input is focus | (event: Event) |
| change | triggers when the icon inside Input value change | (value: string \| number) |

### Autocomplete Attributes

Expand Down

0 comments on commit d2f02b8

Please sign in to comment.