diff --git a/examples/components/footer.vue b/examples/components/footer.vue index ca06e032563..d24ca4063c8 100644 --- a/examples/components/footer.vue +++ b/examples/components/footer.vue @@ -7,8 +7,7 @@ {{ langConfig.changelog }} {{ langConfig.faq }} {{ langConfig.starter }} - {{ langConfig.theme }} - {{ langConfig.preview }} + {{ langConfig.theme }} Element-React Element-Angular @@ -62,7 +61,7 @@ display: inline-block; vertical-align: top; margin-right: 110px; - + h4 { font-size: 18px; color: #333; @@ -86,7 +85,7 @@ .footer-social { float: right; text-align: right; - + .footer-social-title { color: #666; font-size: 18px; @@ -144,13 +143,13 @@ height: auto; } } - + @media (max-width: 1000px) { .footer-social { display: none; } } - + @media (max-width: 768px) { .footer { .footer-main { diff --git a/examples/components/theme-configurator/index.vue b/examples/components/theme-configurator/index.vue index 04ed6f1806f..a11591e22f4 100644 --- a/examples/components/theme-configurator/index.vue +++ b/examples/components/theme-configurator/index.vue @@ -48,6 +48,7 @@ import { export default { props: { themeConfig: Object, + previewConfig: Object, isOfficial: Boolean, onUserConfigUpdate: Function }, @@ -155,7 +156,7 @@ export default { this.onAction(); }, onDownload() { - bus.$emit(ACTION_DOWNLOAD_THEME, this.userConfig); + bus.$emit(ACTION_DOWNLOAD_THEME, this.userConfig, this.previewConfig.name); }, onAction() { this.onUserConfigUpdate(this.userConfig); diff --git a/examples/components/theme/loader/index.vue b/examples/components/theme/loader/index.vue index b84bd25ddab..e078d11589d 100644 --- a/examples/components/theme/loader/index.vue +++ b/examples/components/theme/loader/index.vue @@ -23,8 +23,8 @@ export default { this.userConfig = val; this.onAction(); }); - bus.$on(ACTION_DOWNLOAD_THEME, val => { - this.onDownload(val); + bus.$on(ACTION_DOWNLOAD_THEME, (themeConfig, themeName) => { + this.onDownload(themeConfig, themeName); }); }, data() { @@ -41,7 +41,7 @@ export default { }); this.lastApply = time; }, - onDownload(themeConfig) { + onDownload(themeConfig, themeName) { this.triggertProgressBar(true); updateVars( Object.assign({}, themeConfig, { download: true }), @@ -55,7 +55,7 @@ export default { .then(() => { this.triggertProgressBar(false); }); - ga('send', 'event', 'ThemeConfigurator', 'Download'); + ga('send', 'event', 'ThemeConfigurator', 'Download', themeName); }, onAction() { this.triggertProgressBar(true); diff --git a/examples/components/theme/theme-card.vue b/examples/components/theme/theme-card.vue index c928a94828c..bf7ee0d8df4 100644 --- a/examples/components/theme/theme-card.vue +++ b/examples/components/theme/theme-card.vue @@ -152,7 +152,7 @@ } &.is-upload:hover { box-shadow: none; - } + } &:hover { box-shadow: 0 0 10px 0 #999; @@ -172,10 +172,10 @@ {{getActionDisplayName('upload-theme')}} - @@ -224,8 +224,8 @@ {{getActionDisplayName('rename-theme')}} {{getActionDisplayName('copy-theme')}} - {{getActionDisplayName('delete-theme')}} @@ -325,7 +325,7 @@ export default { }); break; case 'download': - bus.$emit(ACTION_DOWNLOAD_THEME, this.theme); + bus.$emit(ACTION_DOWNLOAD_THEME, this.theme, this.config.name); break; default: this.$emit('action', e, this.config); diff --git a/examples/docs/zh-CN/divider.md b/examples/docs/zh-CN/divider.md index 190a29154c2..a5dae7d3b24 100644 --- a/examples/docs/zh-CN/divider.md +++ b/examples/docs/zh-CN/divider.md @@ -57,5 +57,5 @@ ### Divider Attributes | 参数 | 说明 | 类型 | 可选值 | 默认值 | |------------- |---------------- |---------------- |---------------------- |-------- | -| direction | 设置分割线方向 | boolean | horizontal / vertical | horizontal | +| direction | 设置分割线方向 | string | horizontal / vertical | horizontal | | content-position | 设置分割线文案的位置 | string | left / right / center | center | \ No newline at end of file diff --git a/examples/i18n/component.json b/examples/i18n/component.json index 3b1e1736a7b..1b7c553d017 100644 --- a/examples/i18n/component.json +++ b/examples/i18n/component.json @@ -12,8 +12,7 @@ "repo": "代码仓库", "community": "社区", "changelog": "更新日志", - "theme": "自定义主题工具", - "preview": "在线主题生成", + "theme": "在线主题生成器", "faq": "常见问题", "gitter": "在线讨论", "starter": "脚手架", @@ -44,8 +43,7 @@ "repo": "GitHub", "community": "Community", "changelog": "Changelog", - "theme": "Theme CLI tool", - "preview": "Online theme generator", + "theme": "Online Theme Roller", "faq": "FAQ", "gitter": "Gitter", "starter": "Starter kit", @@ -76,8 +74,7 @@ "repo": "GitHub", "community": "Comunidad", "changelog": "Lista de cambios", - "theme": "Generador de temas por CLI", - "preview": "Generador de temas en línea", + "theme": "Online Theme Roller", "faq": "FAQ", "gitter": "Gitter", "starter": "Kit de inicio", @@ -108,8 +105,7 @@ "repo": "GitHub", "community": "Communauté", "changelog": "Changelog", - "theme": "Générateur de thème (CLI)", - "preview": "Générateur de thème en ligne", + "theme": "Online Theme Roller", "faq": "FAQ", "gitter": "Gitter", "starter": "Kit de démarrage", diff --git a/examples/index.tpl b/examples/index.tpl index fc51edbcb42..ee4ae898d21 100644 --- a/examples/index.tpl +++ b/examples/index.tpl @@ -37,6 +37,8 @@ }); <% } %> <% if (process.env.NODE_ENV !== 'production') { %><% } %> diff --git a/examples/pages/template/theme-preview.tpl b/examples/pages/template/theme-preview.tpl index 384cb6f6844..0ad1cd02bcb 100644 --- a/examples/pages/template/theme-preview.tpl +++ b/examples/pages/template/theme-preview.tpl @@ -45,6 +45,7 @@ diff --git a/packages/menu/src/submenu.vue b/packages/menu/src/submenu.vue index 36d65fb34cf..7631128a458 100644 --- a/packages/menu/src/submenu.vue +++ b/packages/menu/src/submenu.vue @@ -208,6 +208,9 @@ this.dispatch('ElSubmenu', 'mouse-leave-child'); clearTimeout(this.timeout); this.timeout = setTimeout(() => { + if (this.appendToBody) { + this.rootMenu.openedMenus = []; + } !this.mouseInChild && this.rootMenu.closeMenu(this.index); }, this.hideTimeout); }, diff --git a/packages/select/src/select.vue b/packages/select/src/select.vue index 8b7876143c8..7472d0fc4d9 100644 --- a/packages/select/src/select.vue +++ b/packages/select/src/select.vue @@ -869,7 +869,8 @@ small: 32, mini: 28 }; - this.initialInputHeight = reference.$el.getBoundingClientRect().height || sizeMap[this.selectSize]; + const input = reference.$el.querySelector('input'); + this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize]; } if (this.remote && this.multiple) { this.resetInputHeight(); diff --git a/packages/table/src/store/tree.js b/packages/table/src/store/tree.js index c95cf3bd127..2005e453c2c 100644 --- a/packages/table/src/store/tree.js +++ b/packages/table/src/store/tree.js @@ -120,6 +120,7 @@ export default { } else { const { loaded = false, loading = false } = oldValue || {}; newTreeData[key] = { + lazy: true, loaded: !!loaded, loading: !!loading, expanded: getExpanded(oldValue, key), diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index 52898413c89..d10a67bc83e 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -351,7 +351,6 @@ export default { indent: treeRowData.level * treeIndent, level: treeRowData.level }; - // TODO: 优化这里的逻辑 if (typeof treeRowData.expanded === 'boolean') { data.treeNode.expanded = treeRowData.expanded; // 表明是懒加载 @@ -418,10 +417,10 @@ export default { level: cur.level, display: true }; - if (typeof cur.loaded === 'boolean' && cur.loaded) { - treeRowData.noLazyChildren = !(cur.children && cur.children.length); - } - if (typeof cur.loading === 'boolean') { + if (typeof cur.lazy === 'boolean') { + if (typeof cur.loaded === 'boolean' && cur.loaded) { + treeRowData.noLazyChildren = !(cur.children && cur.children.length); + } treeRowData.loading = cur.loading; } } @@ -451,10 +450,10 @@ export default { // 懒加载的某些节点,level 未知 cur.level = cur.level || innerTreeRowData.level; cur.display = !!(cur.expanded && innerTreeRowData.display); - if (typeof cur.loaded === 'boolean' && cur.loaded) { - innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length); - } if (typeof cur.lazy === 'boolean') { + if (typeof cur.loaded === 'boolean' && cur.loaded) { + innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length); + } innerTreeRowData.loading = cur.loading; } } diff --git a/packages/theme-chalk/src/table.scss b/packages/theme-chalk/src/table.scss index 2d399117105..1d2d164feff 100644 --- a/packages/theme-chalk/src/table.scss +++ b/packages/theme-chalk/src/table.scss @@ -505,7 +505,7 @@ &, &.el-table__row--striped { &, &.current-row { > td { - background-color: $--table-current-row-background-color; + background-color: $--table-row-hover-background-color; } } } diff --git a/packages/tree/src/model/node.js b/packages/tree/src/model/node.js index 454cfcabde0..657b3b82be9 100644 --- a/packages/tree/src/model/node.js +++ b/packages/tree/src/model/node.js @@ -1,5 +1,6 @@ import objectAssign from 'element-ui/src/utils/merge'; import { markNodeData, NODE_KEY } from './util'; +import { arrayFindIndex } from 'element-ui/src/utils/util'; export const getChildState = node => { let all = true; @@ -435,8 +436,10 @@ export default class Node { const newNodes = []; newData.forEach((item, index) => { - if (item[NODE_KEY]) { - newDataMap[item[NODE_KEY]] = { index, data: item }; + const key = item[NODE_KEY]; + const isNodeExists = !!key && arrayFindIndex(oldData, data => data[NODE_KEY] === key) >= 0; + if (isNodeExists) { + newDataMap[key] = { index, data: item }; } else { newNodes.push({ index, data: item }); } diff --git a/src/locale/lang/fa.js b/src/locale/lang/fa.js index 84ad5b660a0..61205d573b1 100644 --- a/src/locale/lang/fa.js +++ b/src/locale/lang/fa.js @@ -107,10 +107,10 @@ export default { hasCheckedFormat: '{checked} مورد از {total} مورد انتخاب شده است' }, image: { - error: 'FAILED' // to be translated + error: 'خطا در بارگیری تصویر' }, pageHeader: { - title: 'Back' // to be translated + title: 'بازگشت' } } }; diff --git a/test/unit/specs/tree.spec.js b/test/unit/specs/tree.spec.js index 7642fa5b74d..403d51c061c 100644 --- a/test/unit/specs/tree.spec.js +++ b/test/unit/specs/tree.spec.js @@ -1,4 +1,4 @@ -import { createVue, destroyVM, waitImmediate } from '../util'; +import { createVue, destroyVM, waitImmediate, wait } from '../util'; const DELAY = 10; @@ -831,4 +831,63 @@ describe('Tree', () => { done(); }); }); + + it('update multi tree data', async() => { + const vm = createVue({ + template: ` +
+ + +
+ `, + + data() { + return { + data: [{ + id: 1, + label: '一级 1', + children: [{ + id: 11, + label: '二级 1-1', + children: [{ + id: 111, + label: '三级 1-1' + }] + }] + }, { + id: 2, + label: '一级 2', + children: [{ + id: 21, + label: '二级 2-1' + }, { + id: 22, + label: '二级 2-2' + }] + }, { + id: 3, + label: '一级 3', + children: [{ + id: 31, + label: '二级 3-1' + }, { + id: 32, + label: '二级 3-2' + }] + }], + defaultProps: { + children: 'children', + label: 'label' + } + }; + } + }, true); + const nodeData = { label: '新增 1', id: 4 }; + vm.data.push(nodeData); + await wait(); + const tree1 = vm.$refs.tree1; + expect(tree1.getNode(4).data).to.equal(nodeData); + const tree2 = vm.$refs.tree2; + expect(tree2.getNode(4).data).to.equal(nodeData); + }); }); diff --git a/test/unit/specs/upload.spec.js b/test/unit/specs/upload.spec.js index 9550f0f46c1..834fcdbf71f 100644 --- a/test/unit/specs/upload.spec.js +++ b/test/unit/specs/upload.spec.js @@ -1,13 +1,13 @@ import { createVue, destroyVM } from '../util.js'; import ajax from 'packages/upload/src/ajax'; -const noop = () => { -}; + +const noop = () => {}; const option = { onSuccess: noop, onProgress: noop, data: { a: 'abc', b: 'bcd' }, filename: 'file.png', - file: 'foo', + file: new File([JSON.stringify('foo')], {type: 'image/png'}), action: '/upload', headers: { region: 'shanghai' } }; @@ -35,7 +35,6 @@ describe('ajax', () => { it('request width header', done => { ajax(option); expect(requests[0].requestHeaders).to.eql({ - // 'X-Requested-With': 'XMLHttpRequest', region: 'shanghai' }); done(); diff --git a/yarn.lock b/yarn.lock index 3999270028c..26c11ebde47 100644 --- a/yarn.lock +++ b/yarn.lock @@ -653,14 +653,7 @@ async@1.x, async@^1.5.2: resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= -async@^2.0.0, async@^2.5.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" - integrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ== - dependencies: - lodash "^4.17.10" - -async@^2.6.1: +async@^2.0.0, async@^2.6.1: version "2.6.2" resolved "https://registry.npmjs.org/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg== @@ -2213,6 +2206,11 @@ commander@^2.11.0, commander@^2.19.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== +commander@~2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -4454,11 +4452,11 @@ handle-thing@^2.0.0: integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== handlebars@^4.0.1: - version "4.0.12" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.12.tgz#2c15c8a96d46da5e266700518ba8cb8d919d5bc5" - integrity sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA== + version "4.1.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" + integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== dependencies: - async "^2.5.0" + neo-async "^2.6.0" optimist "^0.6.1" source-map "^0.6.1" optionalDependencies: @@ -6503,10 +6501,10 @@ negotiator@0.6.1: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" integrity sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= -neo-async@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" - integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== +neo-async@^2.5.0, neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== next-tick@1, next-tick@^1.0.0: version "1.0.0" @@ -9355,7 +9353,7 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376" integrity sha512-JoLI4g5zv5qNyT09f4YAvEZIIV1oOjqnewYg5D38dkQljIzpPT296dbIGvKro3digYI1bkb7W6EP1y4uDlmzLg== -uglify-js@3.4.x, uglify-js@^3.0.0, uglify-js@^3.1.4: +uglify-js@3.4.x, uglify-js@^3.0.0: version "3.4.9" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== @@ -9363,6 +9361,14 @@ uglify-js@3.4.x, uglify-js@^3.0.0, uglify-js@^3.1.4: commander "~2.17.1" source-map "~0.6.1" +uglify-js@^3.1.4: + version "3.6.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" + integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg== + dependencies: + commander "~2.20.0" + source-map "~0.6.1" + uglifyjs-webpack-plugin@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.1.1.tgz#6937d7513a37280d4792f1fb536bef35e08e420a"