From c29f63ac8b07cf598e4843d0cf90205ac72fcb2e Mon Sep 17 00:00:00 2001 From: Ricardo Date: Wed, 16 Nov 2016 18:27:56 -0600 Subject: [PATCH 001/450] Patch 1 (#1119) * Create es.js Spanish translation. * Update es.js --- src/locale/lang/es.js | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/locale/lang/es.js diff --git a/src/locale/lang/es.js b/src/locale/lang/es.js new file mode 100644 index 000000000..8855191dd --- /dev/null +++ b/src/locale/lang/es.js @@ -0,0 +1,85 @@ +export default { + el: { + datepicker: { + now: 'Ahora', + today: 'Hoy', + cancel: 'Cancelar', + clear: 'Limpiar', + confirm: 'Confirmar', + selectDate: 'Seleccionar fecha', + selectTime: 'Seleccionar hora', + startDate: 'Fecha de Inicio', + startTime: 'Hora de Inicio', + endDate: 'Fecha Final', + endTime: 'Hora Final', + year: 'Año', + month1: 'Enero', + month2: 'Febrero', + month3: 'Marzo', + month4: 'Abril', + month5: 'Mayo', + month6: 'Junio', + month7: 'Julio', + month8: 'Agosto', + month9: 'Septiembre', + month10: 'Octubre', + month11: 'Noviembre', + month12: 'Diciembre', + // week: 'semana', + weeks: { + sun: 'Dom', + mon: 'Lun', + tue: 'Mar', + wed: 'Mié', + thu: 'Jue', + fri: 'Vie', + sat: 'Sáb' + }, + months: { + jan: 'Ene', + feb: 'Feb', + mar: 'Mar', + apr: 'Abr', + may: 'May', + jun: 'Jun', + jul: 'Jul', + aug: 'Ago', + sep: 'Sep', + oct: 'Oct', + nov: 'Nov', + dec: 'Dic' + } + }, + select: { + loading: 'Cargando', + noMatch: 'No hay datos que coincidan', + noData: 'Sin datos', + placeholder: 'Seleccionar' + }, + pagination: { + goto: 'Ir a', + pagesize: '/pagina', + total: 'Total {total}', + pageClassifier: '' + }, + messagebox: { + confirm: 'Aceptar', + cancel: 'Cancelar', + error: 'Entrada inválida' + }, + upload: { + delete: 'Eliminar', + preview: 'Vista Previa', + continue: 'Continuar' + }, + table: { + emptyText: 'Sin Datos', + confirmFilter: 'Confirmar', + resetFilter: 'Limpiar', + clearFilter: 'Todo' + }, + tree: { + emptyText: 'Sin Datos' + } + } +}; From d4aa5197af6c0013417f0c1c87f0606d8d986929 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Wed, 16 Nov 2016 20:06:02 +0800 Subject: [PATCH 002/450] fix doc typos --- examples/docs/en-US/installation.md | 2 +- examples/docs/en-US/quickstart.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/docs/en-US/installation.md b/examples/docs/en-US/installation.md index a1700a0e4..8ad49c029 100644 --- a/examples/docs/en-US/installation.md +++ b/examples/docs/en-US/installation.md @@ -36,7 +36,7 @@ If you are using CDN, a hello-world page is easy with Element. [Online Demo](htt - + diff --git a/examples/docs/en-US/quickstart.md b/examples/docs/en-US/quickstart.md index dd29c1c80..405c2860a 100644 --- a/examples/docs/en-US/quickstart.md +++ b/examples/docs/en-US/quickstart.md @@ -142,7 +142,7 @@ import ElementUI from 'element-ui' import 'element-ui/lib/theme-default/index.css' import App from './App.vue' -Vue.use(MintUI) +Vue.use(ElementUI) new Vue({ el: '#app', From 2308c321c198af4df73fb2acc2a1130dab790ef2 Mon Sep 17 00:00:00 2001 From: Waam Date: Wed, 16 Nov 2016 15:35:48 +0100 Subject: [PATCH 003/450] fr translation --- src/locale/lang/fr.js | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/locale/lang/fr.js diff --git a/src/locale/lang/fr.js b/src/locale/lang/fr.js new file mode 100644 index 000000000..1767ef894 --- /dev/null +++ b/src/locale/lang/fr.js @@ -0,0 +1,85 @@ +export default { + el: { + datepicker: { + now: 'Maintenant', + today: "Aujourd'hui", + cancel: 'Annuler', + clear: 'Effacer', + confirm: 'OK', + selectDate: 'Sélectionner date', + selectTime: 'Sélectionner horaire', + startDate: 'Date de début', + startTime: 'Horaire de début', + endDate: 'Date de fin', + endTime: 'Horaire de fin', + year: 'Année', + month1: 'Janvier', + month2: 'Février', + month3: 'Mars', + month4: 'Avril', + month5: 'Mai', + month6: 'Juin', + month7: 'Juillet', + month8: 'Août', + month9: 'Septembre', + month10: 'Octobre', + month11: 'Novembre', + month12: 'Décembre', + // week: 'week', + weeks: { + sun: 'Dim', + mon: 'Lun', + tue: 'Mar', + wed: 'Mer', + thu: 'Jeu', + fri: 'Ven', + sat: 'Sam' + }, + months: { + jan: 'Jan', + feb: 'Fév', + mar: 'Mar', + apr: 'Avr', + may: 'Mai', + jun: 'Jun', + jul: 'Jul', + aug: 'Aoû', + sep: 'Sep', + oct: 'Oct', + nov: 'Nov', + dec: 'Déc' + } + }, + select: { + loading: 'Chargement', + noMatch: 'Aucune correspondance', + noData: 'Aucune donnée', + placeholder: 'Sélectionner' + }, + pagination: { + goto: 'Aller à', + pagesize: '/page', + total: 'Total {total}', + pageClassifier: '' + }, + messagebox: { + confirm: 'Confirmer', + cancel: 'Annuler', + error: 'Erreur' + }, + upload: { + delete: 'Supprimer', + preview: 'Aperçu', + continue: 'Continuer' + }, + table: { + emptyText: 'Aucune donné', + confirmFilter: 'Confirmer', + resetFilter: 'Réinitialiser', + clearFilter: 'Tous' + }, + tree: { + emptyText: 'Aucune donnée' + } + } +}; From 020b9ea45974db3e1060bbe02f599fe81b7b07ac Mon Sep 17 00:00:00 2001 From: Waam Date: Wed, 16 Nov 2016 16:49:08 +0100 Subject: [PATCH 004/450] add some abbreviations --- src/locale/lang/fr.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/locale/lang/fr.js b/src/locale/lang/fr.js index 1767ef894..e0f77e83f 100644 --- a/src/locale/lang/fr.js +++ b/src/locale/lang/fr.js @@ -2,16 +2,16 @@ export default { el: { datepicker: { now: 'Maintenant', - today: "Aujourd'hui", + today: "Auj.", cancel: 'Annuler', clear: 'Effacer', confirm: 'OK', - selectDate: 'Sélectionner date', - selectTime: 'Sélectionner horaire', - startDate: 'Date de début', - startTime: 'Horaire de début', - endDate: 'Date de fin', - endTime: 'Horaire de fin', + selectDate: 'Choisir date', + selectTime: 'Choisir horaire', + startDate: 'Date début', + startTime: 'Horaire début', + endDate: 'Date fin', + endTime: 'Horaire fin', year: 'Année', month1: 'Janvier', month2: 'Février', @@ -25,7 +25,7 @@ export default { month10: 'Octobre', month11: 'Novembre', month12: 'Décembre', - // week: 'week', + // week: 'Semaine', weeks: { sun: 'Dim', mon: 'Lun', @@ -53,8 +53,8 @@ export default { select: { loading: 'Chargement', noMatch: 'Aucune correspondance', - noData: 'Aucune donnée', - placeholder: 'Sélectionner' + noData: 'Aucun résultat', + placeholder: 'Choisir' }, pagination: { goto: 'Aller à', From 463747f97785bf1707939aba2e4ba470bc1ef1ac Mon Sep 17 00:00:00 2001 From: Waam Date: Wed, 16 Nov 2016 16:57:33 +0100 Subject: [PATCH 005/450] replace double quote --- src/locale/lang/fr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/lang/fr.js b/src/locale/lang/fr.js index e0f77e83f..b01aab985 100644 --- a/src/locale/lang/fr.js +++ b/src/locale/lang/fr.js @@ -2,7 +2,7 @@ export default { el: { datepicker: { now: 'Maintenant', - today: "Auj.", + today: 'Auj.', cancel: 'Annuler', clear: 'Effacer', confirm: 'OK', From 97eb76259625a979e6d8b5af2a654a3ccefd79a5 Mon Sep 17 00:00:00 2001 From: Waam Date: Wed, 16 Nov 2016 19:32:17 +0100 Subject: [PATCH 006/450] typo --- src/locale/lang/fr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/lang/fr.js b/src/locale/lang/fr.js index b01aab985..966fbf5f0 100644 --- a/src/locale/lang/fr.js +++ b/src/locale/lang/fr.js @@ -73,7 +73,7 @@ export default { continue: 'Continuer' }, table: { - emptyText: 'Aucune donné', + emptyText: 'Aucune donnée', confirmFilter: 'Confirmer', resetFilter: 'Réinitialiser', clearFilter: 'Tous' From c9e180ff505de0a8df2c46818eb176735e3adaf7 Mon Sep 17 00:00:00 2001 From: baiyaaaaa Date: Thu, 17 Nov 2016 11:37:02 +0800 Subject: [PATCH 007/450] fix col responsive style bug --- examples/docs/zh-CN/layout.md | 2 +- packages/theme-default/src/col.css | 66 +++++++++++++++--------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/docs/zh-CN/layout.md b/examples/docs/zh-CN/layout.md index 260f809eb..ad63b097f 100644 --- a/examples/docs/zh-CN/layout.md +++ b/examples/docs/zh-CN/layout.md @@ -250,7 +250,7 @@ ::: demo 将 `type` 属性赋值为 'flex',可以启用 flex 布局,并可通过 `justify` 属性来指定 start, center, end, space-between, space-around 其中的值来定义子元素的排版方式。 ```html -
+
diff --git a/packages/theme-default/src/col.css b/packages/theme-default/src/col.css index b7ebff886..f922688e8 100644 --- a/packages/theme-default/src/col.css +++ b/packages/theme-default/src/col.css @@ -32,17 +32,17 @@ .el-col-sm-$i { width: calc(1 / 24 * $(i) * 100)%; } - } - .el-col-xs-offset-$i { - margin-left: calc(1 / 24 * $(i) * 100)%; - } - .el-col-xs-pull-$i { - position: relative; - right: calc(1 / 24 * $(i) * 100)%; - } - .el-col-xs-push-$i { - position: relative; - left: calc(1 / 24 * $(i) * 100)%; + .el-col-xs-offset-$i { + margin-left: calc(1 / 24 * $(i) * 100)%; + } + .el-col-xs-pull-$i { + position: relative; + right: calc(1 / 24 * $(i) * 100)%; + } + .el-col-xs-push-$i { + position: relative; + left: calc(1 / 24 * $(i) * 100)%; + } } } @media (min-width: 992px) { @@ -50,17 +50,17 @@ .el-col-md-$i { width: calc(1 / 24 * $(i) * 100)%; } - } - .el-col-md-offset-$i { - margin-left: calc(1 / 24 * $(i) * 100)%; - } - .el-col-md-pull-$i { - position: relative; - right: calc(1 / 24 * $(i) * 100)%; - } - .el-col-md-push-$i { - position: relative; - left: calc(1 / 24 * $(i) * 100)%; + .el-col-md-offset-$i { + margin-left: calc(1 / 24 * $(i) * 100)%; + } + .el-col-md-pull-$i { + position: relative; + right: calc(1 / 24 * $(i) * 100)%; + } + .el-col-md-push-$i { + position: relative; + left: calc(1 / 24 * $(i) * 100)%; + } } } @media (min-width: 1200px) { @@ -68,16 +68,16 @@ .el-col-lg-$i { width: calc(1 / 24 * $(i) * 100)%; } - } - .el-col-xs-offset-$i { - margin-left: calc(1 / 24 * $(i) * 100)%; - } - .el-col-xs-pull-$i { - position: relative; - right: calc(1 / 24 * $(i) * 100)%; - } - .el-col-xs-push-$i { - position: relative; - left: calc(1 / 24 * $(i) * 100)%; + .el-col-xs-offset-$i { + margin-left: calc(1 / 24 * $(i) * 100)%; + } + .el-col-xs-pull-$i { + position: relative; + right: calc(1 / 24 * $(i) * 100)%; + } + .el-col-xs-push-$i { + position: relative; + left: calc(1 / 24 * $(i) * 100)%; + } } } \ No newline at end of file From 8177d0612c9b6dee1bc21773ad25a367751968c1 Mon Sep 17 00:00:00 2001 From: Henning Horn Date: Wed, 16 Nov 2016 16:27:51 +0100 Subject: [PATCH 008/450] Added Danish translation --- src/locale/lang/da.js | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/locale/lang/da.js diff --git a/src/locale/lang/da.js b/src/locale/lang/da.js new file mode 100644 index 000000000..403471b6c --- /dev/null +++ b/src/locale/lang/da.js @@ -0,0 +1,85 @@ +export default { + el: { + datepicker: { + now: 'Nu', + today: 'I dag', + cancel: 'Annuller', + clear: 'Ryd', + confirm: 'OK', + selectDate: 'Vælg dato', + selectTime: 'Vælg tidspunkt', + startDate: 'Startdato', + startTime: 'Starttidspunkt', + endDate: 'Slutdato', + endTime: 'Sluttidspunkt', + year: 'År', + month1: 'Januar', + month2: 'Februar', + month3: 'Marts', + month4: 'April', + month5: 'Maj', + month6: 'Juni', + month7: 'Juli', + month8: 'August', + month9: 'September', + month10: 'Oktober', + month11: 'November', + month12: 'December', + week: 'uge', + weeks: { + sun: 'Søn', + mon: 'Man', + tue: 'Tir', + wed: 'Ons', + thu: 'Tor', + fri: 'Fre', + sat: 'Lør' + }, + months: { + jan: 'Jan', + feb: 'Feb', + mar: 'Mar', + apr: 'Apr', + may: 'Maj', + jun: 'Jun', + jul: 'Jul', + aug: 'Aug', + sep: 'Sep', + oct: 'Okt', + nov: 'Nov', + dec: 'Dec' + } + }, + select: { + loading: 'Henter', + noMatch: 'Ingen matchende data', + noData: 'Ingen data', + placeholder: 'Vælg' + }, + pagination: { + goto: 'Gå til', + pagesize: '/side', + total: 'Total {total}', + pageClassifier: '' + }, + messagebox: { + confirm: 'OK', + cancel: 'Annuller', + error: 'Ugyldig input' + }, + upload: { + delete: 'Slet', + preview: 'Forhåndsvisning', + continue: 'Fortsæt' + }, + table: { + emptyText: 'Ingen data', + confirmFilter: 'Bekræft', + resetFilter: 'Nulstil', + clearFilter: 'Alle' + }, + tree: { + emptyText: 'Ingen data' + } + } +}; From 3e3a33075841d313288b22eb309631b08df45a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Thu, 17 Nov 2016 12:21:33 +0800 Subject: [PATCH 009/450] Button: add focus style (#1116) --- packages/theme-default/src/button.css | 16 +++++++++++----- packages/theme-default/src/mixins/_button.css | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/theme-default/src/button.css b/packages/theme-default/src/button.css index 941b0b7f7..9724daab7 100644 --- a/packages/theme-default/src/button.css +++ b/packages/theme-default/src/button.css @@ -23,7 +23,8 @@ @mixin button-size var(--button-padding-vertical), var(--button-padding-horizontal), var(--button-font-size), var(--button-border-radius); - &:hover { + &:hover, + &:focus { color: var(--color-primary); border-color: @color; } @@ -45,7 +46,8 @@ } @when plain { - &:hover { + &:hover, + &:focus { background: #fff; border-color: var(--color-primary); color: var(--color-primary); @@ -66,7 +68,8 @@ @when disabled { &, - &:hover { + &:hover, + &:focus { color: var(--button-disabled-color); cursor: not-allowed; background-image: none; @@ -80,7 +83,8 @@ &.is-plain { &, - &:hover { + &:hover, + &:focus { background-color: #fff; border-color: #d3dce6; color: #C0CCDA; @@ -135,7 +139,8 @@ padding-left: 0; padding-right: 0; - &:hover { + &:hover, + &:focus { color: tint(var(--color-primary), var(--button-hover-tint-percent)); } &:active { @@ -171,6 +176,7 @@ } &:hover, + &:focus, &:active { z-index: 1; } diff --git a/packages/theme-default/src/mixins/_button.css b/packages/theme-default/src/mixins/_button.css index 55288e9e4..dbc440c8e 100644 --- a/packages/theme-default/src/mixins/_button.css +++ b/packages/theme-default/src/mixins/_button.css @@ -3,7 +3,8 @@ background-color: $background-color; border-color: $border-color; - &:hover { + &:hover, + &:focus { background: tint($background-color, var(--button-hover-tint-percent)); border-color: tint($border-color, var(--button-hover-tint-percent)); color: $color; @@ -27,7 +28,8 @@ border: var(--border-base); color: var(--button-default-color); - &:hover { + &:hover, + &:focus { background: #fff; border-color: $border-color; color: $background-color; From 5f496b36e0211f04a48e584e83ff2de82e49465b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Thu, 17 Nov 2016 12:21:50 +0800 Subject: [PATCH 010/450] add dev notice in contributing guide (#1136) --- .github/CONTRIBUTING.md | 2 ++ .github/PULL_REQUEST_TEMPLATE.md | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 086a77524..f06ebe5f9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -26,6 +26,8 @@ Element UI 的成长离不开大家的支持,如果你愿意为 Element UI 贡 - 提交 PR 前请 rebase,确保 commit 记录的整洁。 +- 确保 PR 是提交到 `dev` 分支,而不是 `master` 分支。 + - 如果是修复 bug,请在 PR 中给出描述信息。 - 合并代码需要两名维护人员参与:一人进行 review 后 approve,另一人再次 review,通过后即可合并。 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 65e27877b..1e5ef96f4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,6 @@ Please makes sure these boxes are checked before submitting your PR, thank you! * [ ] Make sure you follow Element's [Contributing Guide](https://github.com/ElemeFE/element/blob/master/.github/CONTRIBUTING.md). +* [ ] Make sure you are merging your commits to `dev` branch. * [ ] Rebase before creating a PR to keep commit history clear. * [ ] Add some descriptions and refer relative issues for you PR. From 98c9cca24cf2cad8e2d75678a2237f71ebfa056a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Thu, 17 Nov 2016 12:24:33 +0800 Subject: [PATCH 011/450] fix doc typos (#1137) --- examples/docs/en-US/installation.md | 2 +- examples/docs/en-US/quickstart.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/docs/en-US/installation.md b/examples/docs/en-US/installation.md index a1700a0e4..8ad49c029 100644 --- a/examples/docs/en-US/installation.md +++ b/examples/docs/en-US/installation.md @@ -36,7 +36,7 @@ If you are using CDN, a hello-world page is easy with Element. [Online Demo](htt - + diff --git a/examples/docs/en-US/quickstart.md b/examples/docs/en-US/quickstart.md index dd29c1c80..405c2860a 100644 --- a/examples/docs/en-US/quickstart.md +++ b/examples/docs/en-US/quickstart.md @@ -142,7 +142,7 @@ import ElementUI from 'element-ui' import 'element-ui/lib/theme-default/index.css' import App from './App.vue' -Vue.use(MintUI) +Vue.use(ElementUI) new Vue({ el: '#app', From 2bd5a61790eb7c204ff840dc79617a39f9aba445 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Thu, 17 Nov 2016 12:09:43 +0800 Subject: [PATCH 012/450] Update ci --- build/cooking.demo.js | 2 +- build/deploy-ci.sh | 40 ++++++++++++++++++++-------------------- build/release.sh | 5 +++++ package.json | 3 +-- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/build/cooking.demo.js b/build/cooking.demo.js index d388d1b3c..92c978fdf 100644 --- a/build/cooking.demo.js +++ b/build/cooking.demo.js @@ -26,7 +26,7 @@ cooking.set({ favicon: './examples/favicon.ico' } ], - publicPath: process.env.CI_ENV || '/', + publicPath: process.env.CI_ENV || '', hash: true, devServer: { port: 8085, diff --git a/build/deploy-ci.sh b/build/deploy-ci.sh index ecd6bc512..5c65c7fb4 100644 --- a/build/deploy-ci.sh +++ b/build/deploy-ci.sh @@ -1,15 +1,16 @@ #! /bin/sh mkdir temp_web +git config --global user.name "element_bot" +git config --global user.email "element_bot" # build dev site -if [ "$TRAVIS_BRANCH" = "master" ] && [ "$GH_TOKEN" ]; then - npm run deploy:dev +if [ "$GH_TOKEN" ]; then + npm run build:file && CI_ENV=/dev/$TRAVIS_BRANCH/ node_modules/.bin/cooking build -c build/cooking.demo.js cd temp_web git clone https://$GH_TOKEN@github.com/ElementUI/dev.git && cd dev - git config user.name "element_bot" - git config user.email "element_bot" - rm -rf `find * ! -name README.md` - cp -rf ../../examples/element-ui/** . + mkdir $TRAVIS_BRANCH + rm -rf $TRAVIS_BRANCH/** + cp -rf ../../examples/element-ui/** $TRAVIS_BRANCH/ git add -A . git commit -m "$TRAVIS_COMMIT_MSG" git push origin master @@ -17,26 +18,25 @@ if [ "$TRAVIS_BRANCH" = "master" ] && [ "$GH_TOKEN" ]; then fi # push theme-default -if [ "$TRAVIS_BRANCH" = "master" ] && [ "$GH_TOKEN" ]; then +if [ "$GH_TOKEN" ]; then cd temp_web - git clone https://$GH_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default - git config user.name "element_bot" - git config user.email "element_bot" + git clone -b $TRAVIS_BRANCH https://$GH_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default rm -rf * cp -rf ../../packages/theme-default/** . git add -A . git commit -m "$TRAVIS_COMMIT_MSG" - git push origin master --tags + git push origin $TRAVIS_BRANCH cd ../.. fi if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then + # site sub folder + SUB_FOLDER=$(echo $TRAVIS_TAG | grep -o -E '^\d+\.\d+') + # build lib npm run dist cd temp_web git clone https://$GH_TOKEN@github.com/ElementUI/lib.git && cd lib - git config user.name "element_bot" - git config user.email "element_bot" rm -rf `find * ! -name README.md` cp -rf ../../lib/** . git add -A . @@ -48,8 +48,6 @@ if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then # build theme-default cd temp_web git clone https://$GH_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default - git config user.name "element_bot" - git config user.email "element_bot" rm -rf * cp -rf ../../packages/theme-default/** . git add -A . @@ -61,12 +59,14 @@ if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then # build site npm run deploy:build cd temp_web - git clone https://$GH_TOKEN@github.com/ElemeFE/element.git && cd element - git config user.name "element_bot" - git config user.email "element_bot" - git checkout gh-pages - rm -rf `find * ! -name README.md` + git clone -b gh-pages https://$GH_TOKEN@github.com/ElemeFE/element.git && cd element + + # only remove files + mkdir $SUB_FOLDER + rm -f * + rm -rf $SUB_FOLDER/** cp -rf ../../examples/element-ui/** . + cp -rf ../../examples/element-ui/** $SUB_FOLDER/ git add -A . git commit -m "$TRAVIS_COMMIT_MSG" git push origin gh-pages diff --git a/build/release.sh b/build/release.sh index 7f9401da1..bfd1fb61c 100644 --- a/build/release.sh +++ b/build/release.sh @@ -1,3 +1,8 @@ +git checkout dev +git pull eleme dev --rebase +git checkout master +git merge dev + set -e echo "Enter release version: " read VERSION diff --git a/package.json b/package.json index c2059e14f..0b9e15c23 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,13 @@ "clean": "rimraf lib && rimraf packages/*/lib && rimraf test/**/coverage && lerna clean --yes", "deploy": "npm run deploy:build && gh-pages -d examples/element-ui --remote eleme && del examples/element-ui", "deploy:build": "npm run build:file && cooking build -c build/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME", - "deploy:dev": "npm run build:file && CI_ENV=/dev/ cooking build -c build/cooking.demo.js", "dev": "npm run bootstrap && npm run build:file && cooking watch -c build/cooking.demo.js -p", "dev:play": "npm run build:file && cross-env PLAY_ENV=true cooking watch -c build/cooking.demo.js -p", "dist": "npm run clean && npm run build:file && npm run lint && cooking build -c build/cooking.conf.js,build/cooking.common.js,build/cooking.component.js -p && npm run build:utils && npm run build:theme", "dist:all": "node build/bin/build-all.js && npm run build:theme", "i18n": "node build/bin/i18n.js", "lint": "eslint src/**/* test/**/* packages/**/*.{js,vue} build/**/* --quiet", - "pub": "git checkout master && git pull eleme master --rebase && sh build/release.sh", + "pub": "sh build/release.sh", "pub:all": "npm run dist:all && lerna publish", "test": "npm run lint && CI_ENV=/dev/ karma start test/unit/karma.conf.js --single-run", "test:watch": "karma start test/unit/karma.conf.js" From b090d3eafb8d17a6f2d806b2a302d3ff7d3dc990 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Thu, 17 Nov 2016 14:30:25 +0800 Subject: [PATCH 013/450] Loading: fix export module --- build/bin/build-entry.js | 3 +-- packages/loading/index.js | 5 +++++ src/index.js | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build/bin/build-entry.js b/build/bin/build-entry.js index 173b2f95a..9d5c75cb3 100644 --- a/build/bin/build-entry.js +++ b/build/bin/build-entry.js @@ -39,8 +39,7 @@ module.exports = { version: '{{version}}', locale: locale.use, install, - Loading: Loading.directive, - LoadingService: Loading.service, + Loading, {{list}} }; `; diff --git a/packages/loading/index.js b/packages/loading/index.js index 159628012..6d28faf7f 100644 --- a/packages/loading/index.js +++ b/packages/loading/index.js @@ -1,6 +1,11 @@ import directive from './src/directive'; import service from './src/index'; + export default { + install(Vue) { + Vue.use(directive); + Vue.prototype.$loading = service; + }, directive, service }; diff --git a/src/index.js b/src/index.js index d387154e8..bf1160c08 100644 --- a/src/index.js +++ b/src/index.js @@ -134,8 +134,7 @@ module.exports = { version: '1.0.1', locale: locale.use, install, - Loading: Loading.directive, - LoadingService: Loading.service, + Loading, Pagination, Dialog, Autocomplete, From 51ec650221b2242ac8a177a22fe8d4966d9b69d7 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Thu, 17 Nov 2016 14:33:04 +0800 Subject: [PATCH 014/450] Input: fix input-group line height --- packages/theme-default/src/input.css | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/theme-default/src/input.css b/packages/theme-default/src/input.css index 43816afec..292a29b76 100644 --- a/packages/theme-default/src/input.css +++ b/packages/theme-default/src/input.css @@ -99,6 +99,7 @@ } @b input-group { + line-height: normal; display: table; border-collapse: separate; From 87e171d30089c213d945fc038f707f40f54ec2b6 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Thu, 17 Nov 2016 15:37:04 +0800 Subject: [PATCH 015/450] Locale: fix dynamic change locale --- packages/message-box/src/main.js | 11 +++-------- packages/message-box/src/main.vue | 18 +++++++++--------- packages/select/src/select.vue | 4 +++- packages/table/src/table.vue | 4 +++- packages/tree/src/tree.vue | 4 +++- src/locale/lang/en.js | 1 + src/locale/lang/zh-CN.js | 1 + 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/packages/message-box/src/main.js b/packages/message-box/src/main.js index f1f8fe32e..a63299217 100644 --- a/packages/message-box/src/main.js +++ b/packages/message-box/src/main.js @@ -1,10 +1,5 @@ -import { t } from 'element-ui/src/locale'; - -const CONFIRM_TEXT = t('el.messagebox.confirm'); -const CANCEL_TEXT = t('el.messagebox.cancel'); - const defaults = { - title: '提示', + title: undefined, message: '', type: '', showInput: false, @@ -22,8 +17,8 @@ const defaults = { confirmButtonPosition: 'right', confirmButtonHighlight: false, cancelButtonHighlight: false, - confirmButtonText: CONFIRM_TEXT, - cancelButtonText: CANCEL_TEXT, + confirmButtonText: '', + cancelButtonText: '', confirmButtonClass: '', cancelButtonClass: '' }; diff --git a/packages/message-box/src/main.vue b/packages/message-box/src/main.vue index 38e2bdf1b..95cf8b756 100644 --- a/packages/message-box/src/main.vue +++ b/packages/message-box/src/main.vue @@ -2,8 +2,8 @@
-
-
{{ title }}
+
+
{{ title || t('el.messagebox.title') }}
@@ -15,8 +15,8 @@
- {{ cancelButtonText }} - {{ confirmButtonText }} + {{ cancelButtonText || t('el.messagebox.cancel') }} + {{ confirmButtonText || t('el.messagebox.confirm') }}
@@ -25,6 +25,7 @@ +``` +::: + ### Table Attributes | Attribute | Description | Type | Accepted Values | Default | |---------- |-------------- |---------- |-------------------------------- |-------- | @@ -969,7 +1074,8 @@ Filter the table to find desired data. | fit | whether width of column automatically fits its container | boolean | — | true | | highlight-current-row | whether current row is highlighted | boolean | — | false | | row-class-name | function that returns custom class names for a row | Function(row, index) | — | — | -| row-key | Key of row data, used for optimizing rendering. Required if `reserve-selection` is on | Function(row)/String | — | — | +| row-key | key of row data, used for optimizing rendering. Required if `reserve-selection` is on | Function(row)/String | — | — | +| context | context of Table, e.g. `_self` refers to the current context, `$parent` parent context, `$root` root context, can be overridden by `context` in `el-table-column` | Object | - | current context where Table lies | ### Table Events | Event Name | Description | Parameters | @@ -1005,7 +1111,8 @@ Filter the table to find desired data. | resizable | whether column width can be resized, works when `border` of `el-table` is `true` | boolean | — | false | | formatter | function that formats content | Function(row, column) | — | — | | show-overflow-tooltip | whether to hide extra content and show them in a tooltip when hovering on the cell | boolean | — | false | -| inline-template | by using this attribute, you can customize column template. Row data can be accessed by `row` object, and current context can be accessed by `_self` in JSX. In this case you don't need to set `prop`. In your template, you have access to the following: `{ row (current row), column (current column), $index (row index), _self( context), store (table store) }` | — | — | +| context | context of Table-column, e.g. `_self` refers to the current context, `$parent` parent context, `$root` root context | Object | - | current context where Table lies | +| inline-template | by using this attribute, you can customize column template. Row data can be accessed by `row` object. In your template, you have access to the following: `{ row (current row), column (current column), $index (row index), store (table store) }` | — | — | | align | alignment | string | left/center/right | left | | class-name | class name of cells in the column | string | — | — | | selectable | function that determines if a certain row can be selected, works when `type` is 'selection' | Function(row, index) | — | — | From bc04f949a38e1a16c7221ba54d971f80d8b634bb Mon Sep 17 00:00:00 2001 From: YanagiEiichi Date: Fri, 18 Nov 2016 13:56:30 +0800 Subject: [PATCH 029/450] Add ja.js --- src/locale/lang/ja.js | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/locale/lang/ja.js diff --git a/src/locale/lang/ja.js b/src/locale/lang/ja.js new file mode 100644 index 000000000..22d39cc80 --- /dev/null +++ b/src/locale/lang/ja.js @@ -0,0 +1,86 @@ +export default { + el: { + datepicker: { + now: '今', + today: '今日', + cancel: 'キャンセルする', + clear: 'クリヤー', + confirm: 'はい', + selectDate: '日付を入力', + selectTime: '時間を入力', + startDate: '開始日', + startTime: '開始時間', + endDate: '終了日', + endTime: '終了時間', + year: '年', + month1: '一月', + month2: '二月', + month3: '三月', + month4: '四月', + month5: '五月', + month6: '六月', + month7: '七月', + month8: '八月', + month9: '九月', + month10: '十月', + month11: '十一月', + month12: '十二月', + // week: 'week', + weeks: { + sun: '日', + mon: '月', + tue: '火', + wed: '水', + thu: '木', + fri: '金', + sat: '土' + }, + months: { + jan: '一月', + feb: '二月', + mar: '三月', + apr: '四月', + may: '五月', + jun: '六月', + jul: '七月', + aug: '八月', + sep: '九月', + oct: '十月', + nov: '十一月', + dec: '十二月' + } + }, + select: { + loading: 'ロード中', + noMatch: 'データなし', + noData: 'データなし', + placeholder: 'セレクター' + }, + pagination: { + goto: '', + pagesize: '件/頁', + total: '総計 {total} 件', + pageClassifier: 'に跳ぶ' + }, + messagebox: { + title: 'メッセージ', + confirm: 'はい', + cancel: 'キャンセルする', + error: 'エラー' + }, + upload: { + delete: '削除する', + preview: 'プレビュー', + continue: '次の件をアップロードする' + }, + table: { + emptyText: 'データなし', + confirmFilter: 'フィルターする', + resetFilter: 'リセットする', + clearFilter: 'すべて' + }, + tree: { + emptyText: 'データなし' + } + } +}; From c3529615926286509251e4899201e57ed3742032 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Fri, 18 Nov 2016 14:47:37 +0800 Subject: [PATCH 030/450] TimeSelect: fix 00:00 is disabled, fixed #676 --- packages/date-picker/src/panel/time-select.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/date-picker/src/panel/time-select.vue b/packages/date-picker/src/panel/time-select.vue index 70bb34cf8..95165acba 100644 --- a/packages/date-picker/src/panel/time-select.vue +++ b/packages/date-picker/src/panel/time-select.vue @@ -113,7 +113,7 @@ while (compareTime(current, end) <= 0) { result.push({ value: current, - disabled: compareTime(current, this.minTime || '00:00') <= 0 + disabled: compareTime(current, this.minTime || '-1:-1') <= 0 }); current = nextTime(current, step); } From 1239c98511870ad76be1d449cef244a32fbb3ef9 Mon Sep 17 00:00:00 2001 From: "cinwell.li" Date: Fri, 18 Nov 2016 15:00:22 +0800 Subject: [PATCH 031/450] Table: add context prop (#1161) --- examples/docs/zh-CN/table.md | 113 ++++++++++++++++++++++++++++- packages/table/src/table-body.js | 3 +- packages/table/src/table-column.js | 6 ++ packages/table/src/table.vue | 3 + 4 files changed, 122 insertions(+), 3 deletions(-) diff --git a/examples/docs/zh-CN/table.md b/examples/docs/zh-CN/table.md index 1c6eaf3f4..4ce5a294b 100644 --- a/examples/docs/zh-CN/table.md +++ b/examples/docs/zh-CN/table.md @@ -110,6 +110,18 @@ }, methods: { + handleClick() { + console.log('click'); + }, + + handleEdit(index, row) { + console.log(index, row); + }, + + handleDelete(index, row) { + console.log(index, row); + }, + handleSelectionChange(val) { this.multipleSelection = val; }, @@ -512,11 +524,12 @@ - 查看 + 查看 编辑 @@ -525,6 +538,12 @@ +``` +::: + ### Table Attributes | 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------------- |---------- |-------------------------------- |-------- | @@ -973,6 +1080,7 @@ | highlight-current-row | 是否要高亮当前行 | boolean | — | false | | row-class-name | 行的 className 的回调。 | Function(row, index) | — | — | | row-key | 行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能的情况下,该属性是必填的 | Function(row)/String | — | — | +| context | 设置上下文环境,例如设置当前上下文就是 `_self`,父级就是 `$parent`,根组件 `$root`。优先读取 column 的 context 属性。 | Object | - | Table 所处上下文 | ### Table Events | 事件名 | 说明 | 参数 | @@ -1008,7 +1116,8 @@ | resizable | 对应列是否可以通过拖动改变宽度(需要在 el-table 上设置 border 属性为真) | boolean | — | true | | formatter | 用来格式化内容 | Function(row, column) | — | — | | show-overflow-tooltip | 当内容过长被隐藏时显示 tooltip | Boolean | — | false | -| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息,JSX 里通过 _self 获取当前上下文。此时不需要配置 prop 属性。总共可以获取到 `{ row(当前行), column(当前列), $index(行数), _self(当前上下文), store(table store) }` 的信息。 | — | — | +| context | 设置上下文环境,例如设置当前上下文就是 `_self`,父级就是 `$parent`,根组件 `$root` | Object | - | Table 所处上下文 | +| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息。总共可以获取到 `{ row(当前行), column(当前列), $index(行数), store(table store) }` 以及 Table 所处的上下文环境。 | — | — | | align | 对齐方式 | String | left, center, right | left | | class-name | 列的 className | string | — | — | | selectable | 仅对 type=selection 的列有效,类型为 Function,Function 的返回值用来决定这一行的 CheckBox 是否可以勾选 | Function(row, index) | — | — | diff --git a/packages/table/src/table-body.js b/packages/table/src/table-body.js index 9f431bec6..f5cc2e5b3 100644 --- a/packages/table/src/table-body.js +++ b/packages/table/src/table-body.js @@ -5,6 +5,7 @@ export default { store: { required: true }, + context: {}, layout: { required: true }, @@ -43,7 +44,7 @@ export default { on-mouseenter={ ($event) => this.handleCellMouseEnter($event, row) } on-mouseleave={ this.handleCellMouseLeave }> { - column.renderCell.call(this._renderProxy, h, { row, column, $index, store: this.store, _self: this.$parent.$vnode.context }) + column.renderCell.call(this._renderProxy, h, { row, column, $index, store: this.store, _self: this.context || this.$parent.$vnode.context }) } ) diff --git a/packages/table/src/table-column.js b/packages/table/src/table-column.js index 139068853..fd9ea95eb 100644 --- a/packages/table/src/table-column.js +++ b/packages/table/src/table-column.js @@ -100,6 +100,7 @@ export default { type: Boolean, default: true }, + context: {}, align: String, showTooltipWhenOverflow: Boolean, showOverflowTooltip: Boolean, @@ -186,6 +187,7 @@ export default { minWidth, width, isColumnGroup, + context: this.context, align: this.align ? 'is-' + this.align : null, sortable: this.sortable, sortMethod: this.sortMethod, @@ -211,6 +213,7 @@ export default { column.renderCell = function(h, data) { if (_self.$vnode.data.inlineTemplate) { renderCell = function() { + data._self = _self.context || data._self; if (Object.prototype.toString.call(data._self) === '[object Object]') { for (let prop in data._self) { if (!data.hasOwnProperty(prop)) { @@ -218,6 +221,9 @@ export default { } } } + // 静态内容会缓存到 _staticTrees 内,不改的话获取的静态数据就不是内部 context + data._staticTrees = _self._staticTrees; + data.$options.staticRenderFns = _self.$options.staticRenderFns; return _self.customRender.call(data); }; } diff --git a/packages/table/src/table.vue b/packages/table/src/table.vue index 387ec1520..8747485a3 100644 --- a/packages/table/src/table.vue +++ b/packages/table/src/table.vue @@ -14,6 +14,7 @@
Date: Fri, 18 Nov 2016 15:04:19 +0800 Subject: [PATCH 032/450] i18n: update language list (#1187) --- examples/docs/en-US/i18n.md | 10 +++++++++- examples/docs/zh-CN/i18n.md | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/docs/en-US/i18n.md b/examples/docs/en-US/i18n.md index 09f97c7f7..7a0623ebf 100644 --- a/examples/docs/en-US/i18n.md +++ b/examples/docs/en-US/i18n.md @@ -39,10 +39,18 @@ webpack.config.js Currently Element ships with the following languages:
    -
  • Chinese (zh-CN)
  • +
  • Simplified Chinese (zh-CN)
  • English (en)
  • German (de)
  • Portuguese (pt)
  • +
  • Spanish(es)
  • +
  • Danish(da)
  • +
  • French(fr)
  • +
  • Norwegian(nb-NO)
  • +
  • Traditional Chinese(zh-TW)
  • +
  • Italian(it)
  • +
  • Korean(ko)
  • +
  • Japanese(ja)
If your target language is not included, you are more than welcome to contribute: just add another language config [here](https://github.com/ElemeFE/element/tree/master/src/locale/lang) and create a pull request. diff --git a/examples/docs/zh-CN/i18n.md b/examples/docs/zh-CN/i18n.md index e2bf6c5c5..ce3ad15e2 100644 --- a/examples/docs/zh-CN/i18n.md +++ b/examples/docs/zh-CN/i18n.md @@ -51,10 +51,18 @@ Vue.component(Select.name, Select) 目前 Element 内置了以下语言:
    -
  • 汉语(zh-CN)
  • +
  • 简体中文(zh-CN)
  • 英语(en)
  • 德语(de)
  • 葡萄牙语(pt)
  • +
  • 西班牙语(es)
  • +
  • 丹麦语(da)
  • +
  • 法语(fr)
  • +
  • 挪威语(nb-NO)
  • +
  • 繁体中文(zh-TW)
  • +
  • 意大利语(it)
  • +
  • 韩语(ko)
  • +
  • 日语(ja)
如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。 From ffff83d0944f8550adb013b261023d38a831265a Mon Sep 17 00:00:00 2001 From: furybean Date: Fri, 18 Nov 2016 15:59:00 +0800 Subject: [PATCH 033/450] Table: add show-header prop & add header-click event & make height more reasonable. --- examples/docs/en-US/table.md | 2 ++ examples/docs/zh-CN/table.md | 4 +++- packages/table/src/table-header.js | 7 +++++- packages/table/src/table-layout.js | 37 ++++++++++++++++++++++-------- packages/table/src/table.vue | 14 +++++++---- test/unit/specs/table.spec.js | 23 +++++++++++++++++++ 6 files changed, 71 insertions(+), 16 deletions(-) diff --git a/examples/docs/en-US/table.md b/examples/docs/en-US/table.md index 6f9f1f200..d977263f6 100644 --- a/examples/docs/en-US/table.md +++ b/examples/docs/en-US/table.md @@ -1072,6 +1072,7 @@ Customize table column so it can be integrated with other components. | stripe | whether table is striped | boolean | — | false | | border | whether table has vertical border | boolean | — | false | | fit | whether width of column automatically fits its container | boolean | — | true | +| show-header | whether table header is visible | boolean | - | true | | highlight-current-row | whether current row is highlighted | boolean | — | false | | row-class-name | function that returns custom class names for a row | Function(row, index) | — | — | | row-key | key of row data, used for optimizing rendering. Required if `reserve-selection` is on | Function(row)/String | — | — | @@ -1087,6 +1088,7 @@ Customize table column so it can be integrated with other components. | cell-mouse-leave | triggers when hovering out of a cell | row, column, cell, event | | cell-click | triggers when clicking a cell | row, column, cell, event | | row-click | triggers when clicking a row | row, event | +| header-click | triggers when clicking a column header | column, event | | sort-change | triggers when Table's sorting changes | { column, prop, order } | | current-change | triggers when current row changes | currentRow, oldCurrentRow | diff --git a/examples/docs/zh-CN/table.md b/examples/docs/zh-CN/table.md index 4ce5a294b..4d871ec5a 100644 --- a/examples/docs/zh-CN/table.md +++ b/examples/docs/zh-CN/table.md @@ -1073,10 +1073,11 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------------- |---------- |-------------------------------- |-------- | | data | 显示的数据 | array | — | — | -| height | table 的高度,默认高度为空,即自动高度,单位 px | string/number | — | — | +| height | Table 的高度,默认为自动高度。如果 height 为 number 类型,单位 px;如果 height 为 string 类型,则 Table 的高度受控于外部样式。 | string/number | — | — | | stripe | 是否为斑马纹 table | boolean | — | false | | border | 是否带有纵向边框 | boolean | — | false | | fit | 列的宽度是否自撑开 | boolean | — | true | +| show-header | 是否显示表头 | boolean | - | true | | highlight-current-row | 是否要高亮当前行 | boolean | — | false | | row-class-name | 行的 className 的回调。 | Function(row, index) | — | — | | row-key | 行数据的 Key,用来优化 Table 的渲染;在使用 reserve-selection 功能的情况下,该属性是必填的 | Function(row)/String | — | — | @@ -1092,6 +1093,7 @@ | cell-mouse-leave | 当单元格 hover 退出时会触发该事件 | row, column, cell, event | | cell-click | 当某个单元格被点击时会触发该事件 | row, column, cell, event | | row-click | 当某一行被点击时会触发该事件 | row, event | +| header-click | 当某一列的表头被点击时会触发该事件 | column, event | | sort-change | 当表格的排序条件发生变化的时候会触发该事件 | { column, prop, order } | | current-change | 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性 | currentRow, oldCurrentRow | diff --git a/packages/table/src/table-header.js b/packages/table/src/table-header.js index 89d419866..447d79c2e 100644 --- a/packages/table/src/table-header.js +++ b/packages/table/src/table-header.js @@ -33,6 +33,7 @@ export default { on-mousemove={ ($event) => this.handleMouseMove($event, column) } on-mouseout={ this.handleMouseOut } on-mousedown={ ($event) => this.handleMouseDown($event, column) } + on-click={ ($event) => this.handleClick($event, column) } class={ [column.id, column.order, column.align, column.className || '', this.isCellHidden(cellIndex) ? 'is-hidden' : ''] }>
0 ? 'highlight' : ''] }> { @@ -162,6 +163,10 @@ export default { }, 16); }, + handleClick(event, column) { + this.$parent.$emit('header-click', column, event); + }, + handleMouseDown(event, column) { /* istanbul ignore if */ if (this.draggingColumn && this.border) { @@ -239,7 +244,7 @@ export default { if (!this.dragging && this.border) { let rect = target.getBoundingClientRect(); - var bodyStyle = document.body.style; + const bodyStyle = document.body.style; if (rect.width > 12 && rect.right - event.pageX < 8) { bodyStyle.cursor = 'col-resize'; this.draggingColumn = column; diff --git a/packages/table/src/table-layout.js b/packages/table/src/table-layout.js index cbe1f478d..8dcf6071a 100644 --- a/packages/table/src/table-layout.js +++ b/packages/table/src/table-layout.js @@ -8,6 +8,7 @@ class TableLayout { this.store = null; this.columns = null; this.fit = true; + this.showHeader = true; this.height = null; this.scrollX = false; @@ -50,16 +51,21 @@ class TableLayout { } setHeight(height) { - if (typeof height === 'string' && /^\d+$/.test(height)) { - height = Number(height); + const el = this.table.$el; + if (typeof height === 'string') { + if (/^\d+$/.test(height)) { + height = Number(height); + } } this.height = height; - const el = this.table.$el; - if (!isNaN(height) && el) { + if (!el) return; + if (!isNaN(height)) { el.style.height = height + 'px'; + this.updateHeight(); + } else if (typeof height === 'string') { this.updateHeight(); } } @@ -67,12 +73,23 @@ class TableLayout { updateHeight() { const height = this.tableHeight = this.table.$el.clientHeight; const { headerWrapper } = this.table.$refs; - if (!headerWrapper) return; - const headerHeight = this.headerHeight = headerWrapper.offsetHeight; - const bodyHeight = height - headerHeight; - if (this.height !== null && !isNaN(this.height)) this.bodyHeight = bodyHeight; - this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight; - this.viewportHeight = this.scrollX ? height - this.gutterWidth : height; + if (this.showHeader && !headerWrapper) return; + if (!this.showHeader) { + this.headerHeight = 0; + if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) { + this.bodyHeight = height; + } + this.fixedBodyHeight = this.scrollX ? height - this.gutterWidth : height; + this.viewportHeight = this.scrollX ? height - this.gutterWidth : height; + } else { + const headerHeight = this.headerHeight = headerWrapper.offsetHeight; + const bodyHeight = height - headerHeight; + if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) { + this.bodyHeight = bodyHeight; + } + this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight; + this.viewportHeight = this.scrollX ? height - this.gutterWidth : height; + } } update() { diff --git a/packages/table/src/table.vue b/packages/table/src/table.vue index 8747485a3..46ea0c531 100644 --- a/packages/table/src/table.vue +++ b/packages/table/src/table.vue @@ -3,7 +3,7 @@ :class="{ 'el-table--fit': fit, 'el-table--striped': stripe, 'el-table--border': border }" @mouseleave="handleMouseLeave($event)">
-
+
-
+
-
+
{ }, DELAY); }); + it('show-header', done => { + const vm = createTable(':show-header="false"'); + setTimeout(_ => { + expect(vm.$el.querySelectorAll('.el-table__header-wrapper').length).to.equal(0); + destroyVM(vm); + done(); + }, DELAY); + }); + it('tableRowClassName', done => { const vm = createTable(':row-class-name="tableRowClassName"', { methods: { @@ -384,6 +393,20 @@ describe('Table', () => { }, DELAY); }, DELAY); }); + + it('header-click', done => { + const vm = createTable('header-click'); + + setTimeout(_ => { + const cell = vm.$el.querySelectorAll('.el-table__header th')[1]; // header[prop='name'] + + triggerEvent(cell, 'click'); + expect(vm.result).to.length(2); // column, event + expect(vm.result[0]).to.have.property('property').to.equal('name'); + destroyVM(vm); + done(); + }, DELAY); + }); }); describe('column attributes', () => { From fa5342ecf018a4958696a1790329cda1f617843c Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Fri, 18 Nov 2016 15:54:33 +0800 Subject: [PATCH 034/450] i18n: use the right parentheses --- examples/docs/en-US/i18n.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/docs/en-US/i18n.md b/examples/docs/en-US/i18n.md index 7a0623ebf..8b9ce43f8 100644 --- a/examples/docs/en-US/i18n.md +++ b/examples/docs/en-US/i18n.md @@ -43,14 +43,14 @@ Currently Element ships with the following languages:
  • English (en)
  • German (de)
  • Portuguese (pt)
  • -
  • Spanish(es)
  • -
  • Danish(da)
  • -
  • French(fr)
  • -
  • Norwegian(nb-NO)
  • -
  • Traditional Chinese(zh-TW)
  • -
  • Italian(it)
  • -
  • Korean(ko)
  • -
  • Japanese(ja)
  • +
  • Spanish (es)
  • +
  • Danish (da)
  • +
  • French (fr)
  • +
  • Norwegian (nb-NO)
  • +
  • Traditional Chinese (zh-TW)
  • +
  • Italian (it)
  • +
  • Korean (ko)
  • +
  • Japanese (ja)
  • If your target language is not included, you are more than welcome to contribute: just add another language config [here](https://github.com/ElemeFE/element/tree/master/src/locale/lang) and create a pull request. From 77ef3836b1eeb7390fb6d5b1ffbc9674d316ee80 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Fri, 18 Nov 2016 16:32:00 +0800 Subject: [PATCH 035/450] Switch: fix @change timing bug --- packages/switch/src/component.vue | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/switch/src/component.vue b/packages/switch/src/component.vue index 49ab93f22..b5894dd07 100644 --- a/packages/switch/src/component.vue +++ b/packages/switch/src/component.vue @@ -5,7 +5,7 @@ class="el-switch__input" type="checkbox" @change="handleChange" - v-model="currentValue" + v-model="_value" :name="name" :disabled="disabled"> @@ -79,7 +79,6 @@ }, data() { return { - currentValue: this.value, coreWidth: this.width, buttonStyle: { transform: '' @@ -90,18 +89,22 @@ hasText() { /* istanbul ignore next */ return this.onText || this.offText; + }, + _value: { + get() { + return this.value; + }, + set(val) { + this.$emit('input', val); + } } }, watch: { - value(val) { - this.currentValue = val; + value() { if (this.onColor || this.offColor) { - this.handleCoreColor(); + this.setBackgroundColor(); } this.handleButtonTransform(); - }, - currentValue(val) { - this.$emit('input', val); } }, methods: { @@ -111,9 +114,10 @@ handleButtonTransform() { this.buttonStyle.transform = this.value ? `translate(${ this.coreWidth - 20 }px, 2px)` : 'translate(2px, 2px)'; }, - handleCoreColor() { - this.$refs.core.style.borderColor = this.value ? this.onColor : this.offColor; - this.$refs.core.style.backgroundColor = this.value ? this.onColor : this.offColor; + setBackgroundColor() { + let newColor = this.value ? this.onColor : this.offColor; + this.$refs.core.style.borderColor = newColor; + this.$refs.core.style.backgroundColor = newColor; } }, mounted() { @@ -123,7 +127,7 @@ } this.handleButtonTransform(); if ((this.onColor || this.offColor) && !this.disabled) { - this.handleCoreColor(); + this.setBackgroundColor(); } } }; From bca5fc1868085696cec0a16a63f5048049e9a621 Mon Sep 17 00:00:00 2001 From: FuryBean Date: Fri, 18 Nov 2016 16:43:48 +0800 Subject: [PATCH 036/450] Table: fix selection-change not fire in some condition. (#1198) --- packages/table/src/table-store.js | 9 +++- packages/theme-default/src/table.css | 1 + test/unit/specs/table.spec.js | 65 ++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/packages/table/src/table-store.js b/packages/table/src/table-store.js index 953b03814..594e84fc3 100644 --- a/packages/table/src/table-store.js +++ b/packages/table/src/table-store.js @@ -255,11 +255,18 @@ TableStore.prototype.isSelected = function(row) { TableStore.prototype.clearSelection = function() { const states = this.states; states.isAllSelected = false; + const oldSelection = states.selection; states.selection = []; + if (oldSelection.length > 0) { + this.table.$emit('selection-change', states.selection); + } }; TableStore.prototype.toggleRowSelection = function(row, selected) { - toggleRowSelection(this.states, row, selected); + const changed = toggleRowSelection(this.states, row, selected); + if (changed) { + this.table.$emit('selection-change', this.states.selection); + } }; TableStore.prototype.cleanSelection = function() { diff --git a/packages/theme-default/src/table.css b/packages/theme-default/src/table.css index 41b21aa47..7c5fcb931 100644 --- a/packages/theme-default/src/table.css +++ b/packages/theme-default/src/table.css @@ -296,6 +296,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: normal; + word-break: break-all; line-height: 24px; padding-left: 18px; padding-right: 18px; diff --git a/test/unit/specs/table.spec.js b/test/unit/specs/table.spec.js index 257c1445f..e44f95107 100644 --- a/test/unit/specs/table.spec.js +++ b/test/unit/specs/table.spec.js @@ -985,6 +985,71 @@ describe('Table', () => { }); }); + describe('methods', () => { + const createTable = function(prop = '', opts) { + return createVue({ + template: ` + + + + + + + + `, + + methods: { + handleEvent(selection) { + this.fireCount++; + this.selection = selection; + } + }, + + created() { + this.testData = getTestData(); + }, + + data() { + return { selection: null, testData: this.testData, fireCount: 0 }; + } + }, true); + }; + + it('toggleRowSelection', () => { + const vm = createTable('selection-change'); + vm.$refs.table.toggleRowSelection(vm.testData[0]); + expect(vm.selection).to.length(1); + expect(vm.fireCount).to.equal(1); + + // test use second parameter + vm.$refs.table.toggleRowSelection(vm.testData[0], true); + expect(vm.fireCount).to.equal(1); + + vm.$refs.table.toggleRowSelection(vm.testData[0], false); + expect(vm.fireCount).to.equal(2); + expect(vm.selection).to.length(0); + + destroyVM(vm); + }); + + it('clearSelection', () => { + const vm = createTable('selection-change'); + vm.$refs.table.toggleRowSelection(vm.testData[0]); + expect(vm.selection).to.length(1); + expect(vm.fireCount).to.equal(1); + + // clear selection + vm.$refs.table.clearSelection(); + expect(vm.fireCount).to.equal(2); + expect(vm.selection).to.length(0); + + vm.$refs.table.clearSelection(); + expect(vm.fireCount).to.equal(2); + + destroyVM(vm); + }); + }); + it('hover', done => { const vm = createVue({ template: ` From 63b465086df45ccb31f71f0ef2cc1e914452f23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=A5=95?= Date: Fri, 18 Nov 2016 16:49:07 +0800 Subject: [PATCH 037/450] Homepage: add responsive (#1177) --- CHANGELOG.en-US.md | 2 +- CHANGELOG.zh-CN.md | 2 +- examples/app.vue | 8 +++ examples/assets/images/element-logo-small.svg | 12 ++++ examples/components/footer.vue | 8 +++ examples/components/header.vue | 45 ++++++++++++- examples/components/side-nav.vue | 64 +++++++++++++++++-- examples/index.tpl | 1 + examples/pages/template/component.tpl | 5 +- examples/pages/template/design.tpl | 8 +-- examples/pages/template/guide.tpl | 15 ++++- examples/pages/template/index.tpl | 44 ++++++++++++- examples/pages/template/resource.tpl | 18 ++++++ 13 files changed, 215 insertions(+), 17 deletions(-) create mode 100644 examples/assets/images/element-logo-small.svg diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 2f64e18a5..fd5a69fcd 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -23,7 +23,7 @@ - Fixed DiatePicker not refresh year when switched in month picker, #1070 - Added $loading service - Added `manual` trigger in Popover -- Added props: `nodeKey` `emptyText` `checkStrictly` `defaultExpandAll` `autoExpandParent` `defaultCheckedKeys` `defaultExpandedKeys` and method: `setCheckedNodes` for Tree +- Added props: `nodeKey`, `emptyText`, `checkStrictly`, `defaultExpandAll`, `autoExpandParent`, `defaultCheckedKeys`, `defaultExpandedKeys` and method: `setCheckedNodes` for Tree ### 1.0.0 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 88a673e31..45d5486a3 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -23,7 +23,7 @@ - 修复 DatePicker 月份选择器直接切换年份并未更新年份数据 #1070 - 新增 $loading 服务,用以调用 Loading - 新增 Popover 可手动控制显示隐藏,将 trigger 设置为 `manual` -- 新增 Tree 的 `nodeKey` `emptyText` `checkStrictly` `defaultExpandAll` `autoExpandParent` `defaultCheckedKeys` `defaultExpandedKeys` 属性,`setCheckedNodes` 方法。 +- 新增 Tree 的 `nodeKey`、`emptyText`、`checkStrictly`、`defaultExpandAll`、`autoExpandParent`、`defaultCheckedKeys`、`defaultExpandedKeys` 属性,`setCheckedNodes` 方法。 ### 1.0.0 diff --git a/examples/app.vue b/examples/app.vue index 6fb049ce3..e6297e8a9 100644 --- a/examples/app.vue +++ b/examples/app.vue @@ -54,6 +54,7 @@ .container, .page-container { width: 1140px; + padding: 0 30px; margin: 0 auto; } @@ -101,6 +102,13 @@ width: 100%; } } + + @media (max-width: 768px) { + .container, + .page-container { + padding: 0 20px; + } + }