diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 2dc53fe1c..c67b655c3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,5 +1,19 @@ ## Changelog +### 1.1.3 + +*2017-01-09* + +- Fixed DatePicker not firing change event when cleared for the first time upon page load, #2167 +- Fixed DatePicker year calculating error when choosing the next year, #2152 +- Added `default-sort-prop` and `default-sort-order` attributes for Table, #2182 (by @njleonzhang) +- Fixed filterable Select filtering other options with initial value, #2196 +- Added custom i18n processing, making Element compatible with i18n plugins other than `vue-i18n`, #2129 +- Added `resize` attribute for Input, #2263 (by @Kingwl) +- Fixed Autocomplete not hiding dropdown when blurred, #2247 +- Fixed style issues with nested Tabs, #2212 (by @Kingwl) +- Fixed Tabs' tab bar locating error when non-first item is initially activated, #2192 + ### 1.1.2 *2016-12-30* diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 650d901ce..8f54ef259 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,5 +1,18 @@ ## 更新日志 +### 1.1.3 +*2017-01-09* + +- 修复 DatePicker 页面加载后首次清空不会触发 `change` 事件,#2167 +- 修复 DatePicker 选择下一年时,年份计算错误,#2152 +- 新增 Table 的 `default-sort-prop` 和 `default-sort-order` 属性,#2182(by @njleonzhang) +- 修复有默认值的可搜索 Select 其他数据被过滤的问题,#2196 +- 新增自定义 i18n 处理方法,方便和除了 `vue-i18n` 之外的插件使用,#2129 +- 新增 Input `resize` 属性,#2263(by @Kingwl) +- 修复 Autocomplete 在 blur 事件触发时没有隐藏下拉列表的问题,#2247 +- 修复 Tabs 嵌套使用时的样式问题,#2212(by @Kingwl) +- 修复 Tabs 默认激活非第一项时 tabBar 的显示位置不正确的问题,#2192 + ### 1.1.2 *2016-12-30* diff --git a/README.md b/README.md index c30d4ea39..383ed5651 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,14 @@ > A Vue.js 2.0 UI Toolkit for Web. +

+ Special thanks to the generous sponsorship by: +

+ + + +

+ ## Links - [Home Page](http://element.eleme.io/) - [Docs](http://element.eleme.io/#/component) diff --git a/build/bin/build-entry.js b/build/bin/build-entry.js index 9d5c75cb3..ec310c5d9 100644 --- a/build/bin/build-entry.js +++ b/build/bin/build-entry.js @@ -6,18 +6,25 @@ var path = require('path'); var OUTPUT_PATH = path.join(__dirname, '../../src/index.js'); var IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}\';'; -var INSTALL_COMPONENT_TEMPLATE = ' Vue.component({{name}}.name, {{name}});'; +var INSTALL_COMPONENT_TEMPLATE = ' {{name}}'; var MAIN_TEMPLATE = `/* Automatic generated by './build/bin/build-entry.js' */ {{include}} import locale from 'element-ui/src/locale'; +const components = [ +{{install}} +]; + const install = function(Vue, opts = {}) { /* istanbul ignore if */ if (install.installed) return; locale.use(opts.locale); + locale.i18n(opts.i18n); -{{install}} + components.map(component => { + Vue.component(component.name, component); + }); Vue.use(Loading.directive); @@ -38,6 +45,7 @@ if (typeof window !== 'undefined' && window.Vue) { module.exports = { version: '{{version}}', locale: locale.use, + i18n: locale.i18n, install, Loading, {{list}} @@ -72,7 +80,7 @@ ComponentNames.forEach(name => { var template = render(MAIN_TEMPLATE, { include: includeComponentTemplate.join('\n'), - install: installTemplate.join('\n'), + install: installTemplate.join(',\n'), version: process.env.VERSION || require('../../package.json').version, list: listTemplate.join(',\n') }); diff --git a/build/config.js b/build/config.js index 2fb0113ec..eaa7cc115 100644 --- a/build/config.js +++ b/build/config.js @@ -6,6 +6,7 @@ var saladConfig = require('../packages/theme-default/salad.config.json'); var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils')); var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins')); +var transitionList = fs.readdirSync(path.resolve(__dirname, '../src/transitions')); var externals = {}; Object.keys(Components).forEach(function(key) { @@ -21,6 +22,10 @@ mixinsList.forEach(function(file) { file = path.basename(file, '.js'); externals[`element-ui/src/mixins/${file}`] = `element-ui/lib/mixins/${file}`; }); +transitionList.forEach(function(file) { + file = path.basename(file, '.js'); + externals[`element-ui/src/transitions/${file}`] = `element-ui/lib/transitions/${file}`; +}); externals = [Object.assign({ vue: 'vue' diff --git a/examples/app.vue b/examples/app.vue index 04b3dbd34..c0708c2ec 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -1,7 +1,6 @@ -## Notification +## Notification Displays a global notification message at the upper right corner of the page. ### Basic usage ::: demo Element has registered the `$notify` method and it receives an object as its parameter. In the simplest case, you can set the `title` field and the` message` field for the title and body of the notification. By default, the notification automatically closes after 4500ms, but by setting `duration` you can control its duration. Specifically, if set to `0`, it will not close automatically. Note that `duration` receives a `Number` in milliseconds. - + ```html diff --git a/packages/menu/src/menu-mixin.js b/packages/menu/src/menu-mixin.js index e8095b492..b42e2eafc 100644 --- a/packages/menu/src/menu-mixin.js +++ b/packages/menu/src/menu-mixin.js @@ -13,7 +13,20 @@ module.exports = { }, rootMenu() { var parent = this.$parent; - while (parent.$options.componentName !== 'ElMenu') { + while ( + parent && + parent.$options.componentName !== 'ElMenu' + ) { + parent = parent.$parent; + } + return parent; + }, + parentMenu() { + let parent = this.$parent; + while ( + parent && + ['ElMenu', 'ElSubmenu'].indexOf(parent.$options.componentName) === -1 + ) { parent = parent.$parent; } return parent; diff --git a/packages/menu/src/menu.vue b/packages/menu/src/menu.vue index a5531ee4e..0ae67a4ad 100644 --- a/packages/menu/src/menu.vue +++ b/packages/menu/src/menu.vue @@ -41,26 +41,46 @@ }, data() { return { - activeIndex: this.defaultActive, + activedIndex: this.defaultActive, openedMenus: this.defaultOpeneds ? this.defaultOpeneds.slice(0) : [], - menuItems: {}, + items: {}, submenus: {} }; }, watch: { defaultActive(value) { - this.activeIndex = value; - if (!this.menuItems[value]) return; - let menuItem = this.menuItems[value]; - let indexPath = menuItem.indexPath; + const item = this.items[value]; + if (!item) return; - this.handleSelect(value, indexPath, null, menuItem); + this.activedIndex = item.index; + this.initOpenedMenu(); }, defaultOpeneds(value) { this.openedMenus = value; + }, + '$route': { + immediate: true, + handler(value) { + if (this.router) { + this.activedIndex = value.path; + this.initOpenedMenu(); + } + } } }, methods: { + addItem(item) { + this.$set(this.items, item.index, item); + }, + removeItem(item) { + delete this.items[item.index]; + }, + addSubmenu(item) { + this.$set(this.submenus, item.index, item); + }, + removeSubmenu(item) { + delete this.submenus[item.index]; + }, openMenu(index, indexPath) { let openedMenus = this.openedMenus; if (openedMenus.indexOf(index) !== -1) return; @@ -75,7 +95,8 @@ closeMenu(index, indexPath) { this.openedMenus.splice(this.openedMenus.indexOf(index), 1); }, - handleSubmenuClick(index, indexPath) { + handleSubmenuClick(submenu) { + const { index, indexPath } = submenu; let isOpened = this.openedMenus.indexOf(index) !== -1; if (isOpened) { @@ -86,49 +107,48 @@ this.$emit('open', index, indexPath); } }, - handleSelect(index, indexPath, route, instance) { - this.activeIndex = index; - this.$emit('select', index, indexPath, instance); + handleItemClick(item) { + let { index, indexPath } = item; + + this.$emit('select', index, indexPath, item); if (this.mode === 'horizontal') { - this.broadcast('ElSubmenu', 'item-select', [index, indexPath]); this.openedMenus = []; - } else { - this.openActiveItemMenus(); } - if (this.router && route) { - try { - this.$router.push(route); - } catch (e) { - console.error(e); - } + if (this.router) { + this.routeToItem(item); + } else { + this.activedIndex = item.index; } }, - openActiveItemMenus() { - let index = this.activeIndex; - // 选中用户指定的路由对应的menu - if (this.router) { - const userSpecifiedIndexs = Object - .keys(this.menuItems) - .filter(k => this.menuItems[k].route) - .filter(k => this.menuItems[k].route.path === this.$route.path); - userSpecifiedIndexs.length && (index = this.activeIndex = userSpecifiedIndexs[0]); - } - if (!this.menuItems[index]) return; - if (index && this.mode === 'vertical') { - let indexPath = this.menuItems[index].indexPath; + // 初始化展开菜单 + initOpenedMenu() { + const index = this.activedIndex; + const activeItem = this.items[index]; + if (!activeItem || this.mode === 'horizontal') return; - // 展开该菜单项的路径上所有子菜单 - indexPath.forEach(index => { - let submenu = this.submenus[index]; - submenu && this.openMenu(index, submenu.indexPath); - }); + let indexPath = activeItem.indexPath; + + // 展开该菜单项的路径上所有子菜单 + indexPath.forEach(index => { + let submenu = this.submenus[index]; + submenu && this.openMenu(index, submenu.indexPath); + }); + }, + routeToItem(item) { + let route = item.route || item.index; + try { + this.$router.push(route); + } catch (e) { + console.error(e); } } }, mounted() { - this.openActiveItemMenus(); + this.initOpenedMenu(); + this.$on('item-click', this.handleItemClick); + this.$on('submenu-click', this.handleSubmenuClick); } }; diff --git a/packages/menu/src/submenu.vue b/packages/menu/src/submenu.vue index 4eaf81c13..4737940e5 100644 --- a/packages/menu/src/submenu.vue +++ b/packages/menu/src/submenu.vue @@ -15,20 +15,31 @@ }"> - + + - + \ No newline at end of file diff --git a/packages/tabs/src/tab-pane.vue b/packages/tabs/src/tab-pane.vue index 9f5c782dd..3af89f695 100644 --- a/packages/tabs/src/tab-pane.vue +++ b/packages/tabs/src/tab-pane.vue @@ -1,14 +1,14 @@