diff --git a/.eslintignore b/.eslintignore index f3b51f5c5f..aa95173977 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,11 @@ src/utils/popper.js src/utils/date.js +examples/play *.sh node_modules lib coverage +*.md +*.scss +*.woff +*.ttf diff --git a/.eslintrc b/.eslintrc index ba8a1b1887..2a84035cf0 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,8 +6,11 @@ "expect": true, "sinon": true }, - "plugins": ['vue'], - "extends": 'elemefe', + "plugins": ["html", "json"], + "extends": "elemefe", + "rules": { + "no-restricted-globals": ["error", "event", "fdescribe"] + }, "parserOptions": { "ecmaFeatures": { "experimentalObjectRestSpread": true, diff --git a/.github/CONTRIBUTING.en-US.md b/.github/CONTRIBUTING.en-US.md index e527744db9..0a8c357e64 100644 --- a/.github/CONTRIBUTING.en-US.md +++ b/.github/CONTRIBUTING.en-US.md @@ -8,7 +8,7 @@ We are excited that you are interested in contributing to Element. Before submit ## Issue Guidelines -- Issues are exclusively for bug reports, feature requests and design-related topics. Other questions may be closed directly. If any questions come up when you are using Element, please hit [Gitter](https://gitter.im/ElemeFE/element) for help. +- Issues are exclusively for bug reports, feature requests and design-related topics. Other questions may be closed directly. If any questions come up when you are using Element, please hit [Gitter](https://gitter.im/element-en/Lobby) for help. - Before submitting an issue, please check if similar problems have already been issued. @@ -35,7 +35,7 @@ We are excited that you are interested in contributing to Element. Before submit - Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges. ## Prerequisites -`Node.js 4+` and `NPM 3+` are required. +`Node.js 4+`, `yarn` and `npm 3+` are required. Note: we use yarn to lock dependency versions, so you should install dependencies using `yarn` instead of `npm install`. ```shell git clone git@github.com:ElemeFE/element.git npm run dev @@ -43,16 +43,6 @@ npm run dev # open http://localhost:8085 ``` -For Chinese users, [yarn](https://github.com/yarnpkg/yarn) with taobao registry is recommended if the dependency installation is slow. -```shell -npm i yarn -g -yarn config set registry https://registry.npm.taobao.org -yarn -npm run dev - -# open http://localhost:8085 -``` - To build: ```shell @@ -60,7 +50,7 @@ npm run dist ``` ## Component Developing Guidelines -- Run `make new ` to create project directory for a new component. Test codes, entry file, cooking config, documentation and `package.json` are included. +- Run `make new ` to create project directory for a new component. Test codes, entry file and documentation are included. - Refer to `Button` for nested components. - Refer to `Select` for components that depend on other components. diff --git a/.github/CONTRIBUTING.es.md b/.github/CONTRIBUTING.es.md new file mode 100644 index 0000000000..177e0ca091 --- /dev/null +++ b/.github/CONTRIBUTING.es.md @@ -0,0 +1,65 @@ +# Guía para Contribuidores a `Element UI` + +¡Hola! Gracias por elegir [Element UI](http://element.eleme.io/#/en-US). + +`Element UI` es un archivo de componentes para desarrolladores y para gerentes de productos ‘web’ basado en [Vue 2.0](https://vuejs.org/) + +Estamos orgullosos de que usted esta interesado en contribuir al proyecto `Element`. Antes de someter sus contribuciones, por favor tome un momentito para leer estas simples guías para contribuidores. + + +## Guía Para Reportar Problemas (“Issues”) + +- [“Issues”]( https://elementui.github.io/issue-generator) son exclusivamente para informar de errores, sugerencias o solicitaciones para funcionalidad adicional referente a diseño. Preguntas de otro tipo corren el riesgo de ser cerradas inmediatamente. Sí tiene preguntas sobre el uso de `Element`, vea [Gitter](https://gitter.im/element-en/Lobby) para más ayuda. + +- Antes de someter un informe sobre algún problema, sírvase de revisar sí ya hubo un informe. + +- Por favor especifique que versión de `Element` y `Vue` que esta utilizando, y que versión de sistema operativo y que versión de navegador web que está utilizando. [JSFiddle](https://jsfiddle.net/) esta recomendado para crear un entorno para reproducir el problema claramente. + + +## Guías para un “Pull Request (PR)” + +- Crea una bifurcación (“fork”) del repositorio a su propia cuenta en github.com. Por favor no crea ramas nuevas aquí. + +- Cuando cometa su cambio, formatea en esta forma: `[Nombre de componente]: Datos sobre el “commit”.` (por ejemplo. `Button: Reparación de xxx error`) + +- **DE NINGUNA MANERA** incluya archivos dentro del directorio `lib`. + +- Asegúrese de que el comando `npm run dist` produzca los archivos correctos. + +- Para asegurar compatibilidad y reducir tamaño de los archivos, nuestra configuración de `babel` solo importa `preset-2015`, así que IPAs como Array.prototype.find` y `Object.assign` en `ES2015` no son recomendados. Puede importar “polyfills” terceros, sí es necesario. + +- “Rebase” antes de crear un “pull request (PR)” para mantener la historia de “commits” limpia. + +- Asegúrese que sus PRs se refrieran a la rama `dev` y no a la rama `master`. + +- Si su PR arregla un error técnico, por favor, haga referencia al error especifico. + +- Fusión de un PR requiere dos mantenedores: el primero aprueba los cambios después de revisar, y entonces el segundo mantenedor revisa los cambios y hace la fusión. + + +## Requerimientos Técnicos +`Node.js 4+`, `yarn` y `npm 3+` son requisitos. Nota: Usamos yarn para bloquear versiones de dependencias, por lo que debería instalar dependencias usando `yarn` en lugar de `npm install`. +. +```shell +git clone git@github.com:ElemeFE/element.git +npm run dev + +# abra http://localhost:8085 +``` + +Para armar: + +``` +shell +npm run dist +``` + +## Guía Para Desarrollo de Componentes +- Corra el comando `make new ` para crear el directorio de su proyecto para un componente nuevo. Verifique su código fuente test, archivo de entrada y documentación están incluidos. +- Refiérase al `Button` para componentes anidados. +- Refiérase al `Select` para componentes que dependen de otros componentes. + + +## Estilo de Desarrollo +Por favor acate a este estilo [ESLint](https://github.com/ElemeFE/eslint-config-elemefe) configuración de [ElemeFE](https://github.com/elemefe). + diff --git a/.github/CONTRIBUTING.zh-CN.md b/.github/CONTRIBUTING.zh-CN.md index 79dbb3dd7c..ce07fd8ea0 100644 --- a/.github/CONTRIBUTING.zh-CN.md +++ b/.github/CONTRIBUTING.zh-CN.md @@ -33,7 +33,7 @@ Element UI 的成长离不开大家的支持,如果你愿意为 Element UI 贡 - 合并代码需要两名维护人员参与:一人进行 review 后 approve,另一人再次 review,通过后即可合并。 ## 开发环境搭建 -首先你需要 Node.js 4+ 和 NPM 3+ +首先你需要 Node.js 4+,yarn 和 npm 3+。注意:我们使用 yarn 进行依赖版本的锁定,所以请不要使用 `npm install` 安装依赖。 ```shell git clone git@github.com:ElemeFE/element.git npm run dev @@ -41,24 +41,14 @@ npm run dev # open http://localhost:8085 ``` -如果国内用户觉得安装慢可以使用 [yarn](https://github.com/yarnpkg/yarn) 搭配 taobao registry -```shell -npm i yarn -g -yarn config set registry https://registry.npm.taobao.org -yarn -npm run dev - -# open http://localhost:8085 -``` - -To build: +打包代码: ```shell npm run dist ``` ## 组件开发规范 -- 通过 `make new` 创建组件目录结构,包含测试代码、入口文件、cooking 配置、package.json、文档 +- 通过 `make new` 创建组件目录结构,包含测试代码、入口文件、文档 - 如果包含父子组件,需要更改目录结构,参考 `Button` - 组件内如果依赖了其他组件,需要在当前组件内引入,参考 `Select` diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index fe1e339e6c..cc7784513c 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,12 @@ - landingpage_illustration - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/assets/images/button-d-cn.png b/examples/assets/images/button-d-cn.png new file mode 100644 index 0000000000..a3afa111a8 Binary files /dev/null and b/examples/assets/images/button-d-cn.png differ diff --git a/examples/assets/images/button-d-en.png b/examples/assets/images/button-d-en.png new file mode 100644 index 0000000000..5210474187 Binary files /dev/null and b/examples/assets/images/button-d-en.png differ diff --git a/examples/assets/images/button-l-cn.png b/examples/assets/images/button-l-cn.png new file mode 100644 index 0000000000..e334448d86 Binary files /dev/null and b/examples/assets/images/button-l-cn.png differ diff --git a/examples/assets/images/button-l-en.png b/examples/assets/images/button-l-en.png new file mode 100644 index 0000000000..d368df9ddf Binary files /dev/null and b/examples/assets/images/button-l-en.png differ diff --git a/examples/assets/images/cloud-1.png b/examples/assets/images/cloud-1.png new file mode 100644 index 0000000000..1f221b5d62 Binary files /dev/null and b/examples/assets/images/cloud-1.png differ diff --git a/examples/assets/images/cloud-2.png b/examples/assets/images/cloud-2.png new file mode 100644 index 0000000000..651f30ef73 Binary files /dev/null and b/examples/assets/images/cloud-2.png differ diff --git a/examples/assets/images/compo-1.png b/examples/assets/images/compo-1.png new file mode 100644 index 0000000000..6264c030f9 Binary files /dev/null and b/examples/assets/images/compo-1.png differ diff --git a/examples/assets/images/compo-2.png b/examples/assets/images/compo-2.png new file mode 100644 index 0000000000..202dbdec63 Binary files /dev/null and b/examples/assets/images/compo-2.png differ diff --git a/examples/assets/images/compo-3.png b/examples/assets/images/compo-3.png new file mode 100644 index 0000000000..c018f4f87f Binary files /dev/null and b/examples/assets/images/compo-3.png differ diff --git a/examples/assets/images/dialog-close.png b/examples/assets/images/dialog-close.png new file mode 100644 index 0000000000..c810eafe46 Binary files /dev/null and b/examples/assets/images/dialog-close.png differ diff --git a/examples/assets/images/duohui.svg b/examples/assets/images/duohui.svg new file mode 100644 index 0000000000..f395bfa965 --- /dev/null +++ b/examples/assets/images/duohui.svg @@ -0,0 +1,24 @@ + +duohui-element +Created using Figma + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/assets/images/duotai.svg b/examples/assets/images/duotai.svg new file mode 100644 index 0000000000..e8735a0f91 --- /dev/null +++ b/examples/assets/images/duotai.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/examples/assets/images/element-logo-small.svg b/examples/assets/images/element-logo-small.svg index 6319a87e9b..9e185f5747 100644 --- a/examples/assets/images/element-logo-small.svg +++ b/examples/assets/images/element-logo-small.svg @@ -5,7 +5,7 @@ Created with Sketch. - + diff --git a/examples/assets/images/element-logo.svg b/examples/assets/images/element-logo.svg index 825acba02b..8cd2c6d38b 100644 --- a/examples/assets/images/element-logo.svg +++ b/examples/assets/images/element-logo.svg @@ -5,7 +5,7 @@ Created with Sketch. - + diff --git a/examples/assets/images/figure-1.png b/examples/assets/images/figure-1.png new file mode 100644 index 0000000000..7a8041570d Binary files /dev/null and b/examples/assets/images/figure-1.png differ diff --git a/examples/assets/images/figure-2.png b/examples/assets/images/figure-2.png new file mode 100644 index 0000000000..dc7e482135 Binary files /dev/null and b/examples/assets/images/figure-2.png differ diff --git a/examples/assets/images/plant-1.png b/examples/assets/images/plant-1.png new file mode 100644 index 0000000000..458563ae0b Binary files /dev/null and b/examples/assets/images/plant-1.png differ diff --git a/examples/assets/images/plant-2.png b/examples/assets/images/plant-2.png new file mode 100644 index 0000000000..7f58ed6992 Binary files /dev/null and b/examples/assets/images/plant-2.png differ diff --git a/examples/assets/images/resource-placeholder.svg b/examples/assets/images/resource-placeholder.svg new file mode 100755 index 0000000000..dd335ee231 --- /dev/null +++ b/examples/assets/images/resource-placeholder.svg @@ -0,0 +1,23 @@ + + + + 整理中-icon + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/assets/images/search-by-algolia.svg b/examples/assets/images/search-by-algolia.svg new file mode 100644 index 0000000000..989ed6ab8f --- /dev/null +++ b/examples/assets/images/search-by-algolia.svg @@ -0,0 +1 @@ +search-by-algolia \ No newline at end of file diff --git a/examples/assets/images/stars.png b/examples/assets/images/stars.png deleted file mode 100644 index 19a245bb94..0000000000 Binary files a/examples/assets/images/stars.png and /dev/null differ diff --git a/examples/assets/images/tipe.svg b/examples/assets/images/tipe.svg new file mode 100644 index 0000000000..e4026a1c5e --- /dev/null +++ b/examples/assets/images/tipe.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Asset 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/assets/images/web.png b/examples/assets/images/web.png new file mode 100644 index 0000000000..8f85521d59 Binary files /dev/null and b/examples/assets/images/web.png differ diff --git a/examples/bus.js b/examples/bus.js new file mode 100644 index 0000000000..c17d88ac58 --- /dev/null +++ b/examples/bus.js @@ -0,0 +1,2 @@ +import Vue from 'vue'; +export default new Vue(); diff --git a/examples/components/demo-block.vue b/examples/components/demo-block.vue index 35bd7992b3..ae29f29c5b 100644 --- a/examples/components/demo-block.vue +++ b/examples/components/demo-block.vue @@ -5,30 +5,43 @@ @mouseenter="hovering = true" @mouseleave="hovering = false"> -
-
+
+
- - {{ langConfig['button-text'] }} -
-
+
{{ controlText }} + + + + {{ langConfig['button-text'] }} + + +
@@ -159,7 +184,9 @@ data() { return { hovering: false, - isExpanded: false + isExpanded: false, + fixedControl: false, + scrollParent: null }; }, @@ -177,7 +204,7 @@ '\n'; let jsTpl = (script || '').replace(/export default/, 'var Main =').trim(); let htmlTpl = `${resourcesTpl}\n
\n${html.trim()}\n
`; - let cssTpl = `@import url("//unpkg.com/element-ui@${ version }/lib/theme-default/index.css");\n${(style || '').trim()}\n`; + let cssTpl = `@import url("//unpkg.com/element-ui@${ version }/lib/theme-chalk/index.css");\n${(style || '').trim()}\n`; jsTpl = jsTpl ? jsTpl + '\nvar Ctor = Vue.extend(Main)\nnew Ctor().$mount(\'#app\')' : 'new Vue().$mount(\'#app\')'; @@ -206,6 +233,17 @@ document.body.appendChild(form); form.submit(); + }, + + scrollHandler() { + const { top, bottom, left } = this.$refs.meta.getBoundingClientRect(); + this.fixedControl = bottom > document.documentElement.clientHeight && + top + 44 <= document.documentElement.clientHeight; + this.$refs.control.style.left = this.fixedControl ? `${ left }px` : '0'; + }, + + removeScrollHandler() { + this.scrollParent && this.scrollParent.removeEventListener('scroll', this.scrollHandler); } }, @@ -236,7 +274,8 @@ codeAreaHeight() { if (this.$el.getElementsByClassName('description').length > 0) { - return Math.max(this.$el.getElementsByClassName('description')[0].clientHeight, this.$el.getElementsByClassName('highlight')[0].clientHeight); + return this.$el.getElementsByClassName('description')[0].clientHeight + + this.$el.getElementsByClassName('highlight')[0].clientHeight + 20; } return this.$el.getElementsByClassName('highlight')[0].clientHeight; } @@ -245,6 +284,17 @@ watch: { isExpanded(val) { this.codeArea.style.height = val ? `${ this.codeAreaHeight + 1 }px` : '0'; + if (!val) { + this.fixedControl = false; + this.$refs.control.style.left = '0'; + this.removeScrollHandler(); + return; + } + setTimeout(() => { + this.scrollParent = document.querySelector('.page-component__scroll > .el-scrollbar__wrap'); + this.scrollParent && this.scrollParent.addEventListener('scroll', this.scrollHandler); + this.scrollHandler(); + }, 200); } }, @@ -256,6 +306,10 @@ highlight.borderRight = 'none'; } }); + }, + + beforeDestroy() { + this.removeScrollHandler(); } }; diff --git a/examples/components/footer-nav.vue b/examples/components/footer-nav.vue index f43214a68c..45e58123ea 100644 --- a/examples/components/footer-nav.vue +++ b/examples/components/footer-nav.vue @@ -19,8 +19,8 @@ diff --git a/examples/components/search.vue b/examples/components/search.vue new file mode 100644 index 0000000000..0060b0cc98 --- /dev/null +++ b/examples/components/search.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/examples/components/side-nav.vue b/examples/components/side-nav.vue index 11a9f4b519..f2d30a09b0 100644 --- a/examples/components/side-nav.vue +++ b/examples/components/side-nav.vue @@ -3,56 +3,33 @@ width: 100%; box-sizing: border-box; padding-right: 30px; + transition: opacity .3s; + &.is-fade { + transition: opacity 3s; + } li { list-style: none; } + ul { padding: 0; margin: 0; overflow: hidden; } + + > ul > .nav-item > a { + margin-top: 15px; + } - .nav-dropdown { - margin-bottom: 6px; - width: 100%; - span { - display: block; - width: 100%; - font-size: 16px; - color: #5e6d82; - line-height: 40px; - transition: .2s; - padding-bottom: 6px; - 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; - } - } + > ul > .nav-item:nth-child(-n + 4) > a { + margin-top: 0; } .nav-item { a { font-size: 16px; - color: #5e6d82; + color: #333; line-height: 40px; height: 40px; margin: 0; @@ -60,36 +37,74 @@ text-decoration: none; display: block; position: relative; - transition: all .3s; + transition: .15s ease-out; + font-weight: bold; &.active { - color: #20a0ff; + color: #409EFF; } } + .nav-item { a { display: block; height: 40px; + color: #444; line-height: 40px; - font-size: 13px; - padding-left: 24px; + font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + font-weight: normal; + + &:hover, + &.active { + color: #409EFF; + } + } + } + + &.sponsors { + & > .sub-nav { + margin-top: -10px; + } + + & > a { + color: #777; + font-weight: 300; + font-size: 14px; + } + + .nav-item { + display: inline-block; + + a { + height: auto; + display: inline-block; + vertical-align: middle; + margin: 8px 12px 12px 0; + img { + width: 42px; + } + } - &:hover { - color: #20a0ff; + &:first-child a img { + width: 36px; } } } } + .nav-group__title { font-size: 12px; - color: #99a9bf; - padding-left: 8px; + color: #999; line-height: 26px; - margin-top: 10px; + margin-top: 15px; + } + + #code-sponsor-widget { + margin: 0 0 0 -20px; } } .nav-dropdown-list { @@ -101,31 +116,36 @@ }