Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Jul 27, 2016
0 parents commit e320f43
Show file tree
Hide file tree
Showing 352 changed files with 28,969 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"comments": false
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
popper.js
fecha.js
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": ['vue'],
"extends": 'elemefe',
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
}
}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
.DS_Store
npm-debug.log
lerna-debug.log
npm-debug.log.*
lerna-debug.log.*
lib
.idea
examples/element-ui
fe.element/element-ui
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## 更新日志

### 0.2.0

`2016-07-29`

- 增加 grid 相关组件
- form-item 增加 required 属性

*非兼容性更新*

- progress 的 percentage 属性值范围从 0~1 改变为 1~100.

### 0.1.9

`2016-07-12`

- 增加 menu 组件

*非兼容性更新*

- 使用了新的图标集,原有的某些图标可能不存在了

### 0.1.8

`2016-07-07`

- dropdown 和 tooltip 首次出现闪动问题

### 0.1.7

`2016-07-06`

- dropdown 增加触发下拉菜单方式的参数
- 修正若干组件的样式问题和浏览器兼容问题
- 修复 popper.js 产生的过多 scroll 事件绑定
- 在 radio-group 里增加 radio-button 类型
- 为 select 添加 singleCancelable 选项

### 0.1.6

`2016-06-30`
- dropdown-menu 改为动态创建
- 修复 textarea 缺失 model 参数的 bug
- 修复 pagination 和 input-group 在 safari 下的样式问题

### 0.1.5

`2016-06-29`
- 为 MessageBox 和 Notification 注册全局方法
- button 的 loading 状态时改为不触发 hover 和点击等操作
- input组件 增加 maxlength 和 minlength 属性支持

### 0.1.4

`2016-06-29`

- 增加 Tabs、Form、MessageBox、Alert、Notification、Slider 组件
- dropdown menu 现在是直接插入到 body 节点下,并且修正了自适应宽度的 bug
- dropdown item 点击后关闭 dropdown menu
- radio 绑定值增加 Number 类型支持
- 增加 radio-group 组件
- 增加 checkbox-group 组件
- Select 组件 API 更新,现在的用法和原生 select 标签更加相似

53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.PHONY: dist
default: help

# build all theme
build-theme: build-theme-default

build-theme-default:
packages/theme-default/node_modules/.bin/gulp build --gulpfile packages/theme-default/gulpfile.js
cp -rf packages/theme-default/lib lib/theme-default

install:
npm i --registry=http://registry.npm.taobao.org --ignore-scripts --loglevel=error
./node_modules/.bin/lerna bootstrap

dev: install
node bin/iconInit.js
npm run dev

new:
node bin/new.js $(filter-out $@,$(MAKECMDGOALS))

dist:
npm run dist
make build-theme

dist-all:
node bin/build-all.js
make build-theme

deploy: install
@npm run deploy
@rm -rf fe.element/element-ui
@cp -r examples/element-ui fe.element

gh-docs:
@npm run gh-docs

pub:
./node_modules/.bin/kp $(filter-out $@,$(MAKECMDGOALS))

pub-all: dist-all
./node_modules/.bin/lerna publish

help:
@echo " \033[35mmake\033[0m \033[1m命令使用说明\033[0m"
@echo " \033[35mmake install\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 安装依赖"
@echo " \033[35mmake new <component-name> [中文名]\033[0m\t--- 创建新组件 package. 例如 'make new button 按钮'"
@echo " \033[35mmake dev\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 开发模式"
@echo " \033[35mmake dist\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 编译项目,生成目标文件"
@echo " \033[35mmake dist-all\033[0m\t\033[0m\t\033[0m\t--- 分别编译每个组件项目"
@echo " \033[35mmake deploy\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 部署 demo"
@echo " \033[35mmake pub\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 发布到 npm 上"
@echo " \033[35mmake pub-all\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 发布各组件到 npm 上"
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Element
> UI Elements for admin page.
## Demo/Docs
https://element-component.github.io/element

## Usages
```shell
npm i element-ui -S
```

## Quick Start
use [babel-plugin-component](https://github.com/QingWei-Li/babel-plugin-component)

``` javascript
import Vue from 'vue'
import Element from 'element-ui'

Vue.use(Element)

// or
import {
Select,
Button
// ...
} from 'element-ui'

Vue.component(Select.name, ElSelect)
Vue.component(Button.name, Button)
```

(roughly) to

``` javascript
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-default/index.css';

Vue.use(Element)

// or
import Select from 'element-ui/lib/select';
import Select from 'element-ui/lib/theme-default/select.css';
import Button from 'element-ui/lib/button';
import Button from 'element-ui/lib/theme-default/button.css';

Vue.component(Select.name, ElSelect)
Vue.component(Button.name, Button)
```

## babel-plugin-component
.babelrc
```json
{
"plugins": ["xxx", ["component", [
{
"libraryName": "element-ui",
"styleLibraryName": "theme-default"
}
]]]
}
```

## LICENSE
MIT

26 changes: 26 additions & 0 deletions bin/build-all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const components = require('../components.json');
const execSync = require('child_process').execSync;
const existsSync = require('fs').existsSync;
const path = require('path');

let componentPaths = [];

delete components.index;
delete components.font;

Object.keys(components).forEach(key => {
const filePath = path.join(__dirname, `../packages/${key}/cooking.conf.js`);

if (existsSync(filePath)) {
componentPaths.push(`packages/${key}/cooking.conf.js`)
}
});

const paths = componentPaths.join(',');
const cli = `cooking build -c ${paths} -p`;

execSync(cli, {
stdio: 'inherit'
});
70 changes: 70 additions & 0 deletions bin/build-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
var Components = require('../components.json')
var fs = require('fs')
var render = require('json-templater/string')
var uppercamelcase = require('uppercamelcase')
var path = require('path')

var OUTPUT_PATH = path.join(__dirname, '../src/index.js')
var IMPORT_TEMPLATE = `import {{name}} from '../packages/{{package}}/index.js';`
var ISNTALL_COMPONENT_TEMPLATE = ` Vue.component({{name}}.name, {{name}});`
var MAIN_TEMPLATE = `{{include}}
const install = function(Vue) {
{{install}}
Vue.use(Loading);
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
};
// auto install
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
};
module.exports = {
install,
{{list}}
};
`

delete Components.font

var ComponentNames = Object.keys(Components)

var includeComponentTemplate = []
var installTemplate = []
var listTemplate = []

ComponentNames.forEach(name => {
var componentName = uppercamelcase(name)

includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
name: componentName,
package: name
}))


if (['Loading', 'MessageBox', 'Notification'].indexOf(componentName) === -1) {
installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
name: componentName,
component: name
}))
}

listTemplate.push(` ${componentName}`)
})

var template = render(MAIN_TEMPLATE, {
include: includeComponentTemplate.join('\n'),
install: installTemplate.join('\n'),
list: listTemplate.join(',\n')
})

fs.writeFileSync(OUTPUT_PATH, template)
console.log('[build entry] DONE:', OUTPUT_PATH)

20 changes: 20 additions & 0 deletions bin/iconInit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var postcss = require('postcss');
var fs = require('fs');
var path = require('path');
var fontFile = fs.readFileSync(path.resolve(__dirname, '../packages/theme-default/src/icon.css'), 'utf8');
var nodes = postcss.parse(fontFile).nodes;
var classList = [];

nodes.forEach((node) => {
var selector = node.selector || '';
var reg = new RegExp(/\.el-icon-([^:]+):before/);
var arr = selector.match(reg);

if (arr && arr[1]) {
classList.push(arr[1]);
}
})

fs.writeFile(path.resolve(__dirname, '../examples/icon.json'), JSON.stringify(classList));
Loading

0 comments on commit e320f43

Please sign in to comment.