Skip to content

Commit

Permalink
Merge branch 'dev' into feat/back-to-top
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun authored May 27, 2019
2 parents 5be8cf6 + 5fea8b4 commit 635c794
Show file tree
Hide file tree
Showing 53 changed files with 1,133 additions and 161 deletions.
3 changes: 2 additions & 1 deletion build/bin/build-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const install = function(Vue, opts = {}) {
Vue.component(component.name, component);
});
Vue.use(InfiniteScroll);
Vue.use(Loading.directive);
Vue.prototype.$ELEMENT = {
Expand Down Expand Up @@ -76,7 +77,7 @@ ComponentNames.forEach(name => {
package: name
}));

if (['Loading', 'MessageBox', 'Notification', 'Message'].indexOf(componentName) === -1) {
if (['Loading', 'MessageBox', 'Notification', 'Message', 'InfiniteScroll'].indexOf(componentName) === -1) {
installTemplate.push(render(INSTALL_COMPONENT_TEMPLATE, {
name: componentName,
component: name
Expand Down
24 changes: 24 additions & 0 deletions build/bin/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if (!process.argv[2]) {
}

const path = require('path');
const fs = require('fs');
const fileSave = require('file-save');
const uppercamelcase = require('uppercamelcase');
const componentname = process.argv[2];
Expand Down Expand Up @@ -104,6 +105,29 @@ fileSave(path.join(__dirname, '../../components.json'))
.write(JSON.stringify(componentsFile, null, ' '), 'utf8')
.end('\n');

// 添加到 index.scss
const sassPath = path.join(__dirname, '../../packages/theme-chalk/src/index.scss');
const sassImportText = `${fs.readFileSync(sassPath)}@import "./${componentname}.scss";`;
fileSave(sassPath)
.write(sassImportText, 'utf8')
.end('\n');

// 添加到 element-ui.d.ts
const elementTsPath = path.join(__dirname, '../../types/element-ui.d.ts');

let elementTsText = `${fs.readFileSync(elementTsPath)}
/** ${ComponentName} Component */
export class ${ComponentName} extends El${ComponentName} {}`;

const index = elementTsText.indexOf('export') - 1;
const importString = `import { El${ComponentName} } from './${componentname}'`;

elementTsText = elementTsText.slice(0, index) + importString + '\n' + elementTsText.slice(index);

fileSave(elementTsPath)
.write(elementTsText, 'utf8')
.end('\n');

// 创建 package
Files.forEach(file => {
fileSave(path.join(PackagePath, file.filename))
Expand Down
3 changes: 2 additions & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"divider": "./packages/divider/index.js",
"image": "./packages/image/index.js",
"calendar": "./packages/calendar/index.js",
"backtop": "./packages/backtop/index.js"
"backtop": "./packages/backtop/index.js",
"infiniteScroll": "./packages/infiniteScroll/index.js"
}
2 changes: 0 additions & 2 deletions examples/components/theme-configurator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@select="onSelectChange"
></action-panel>
<main-panel
ref='configuratorMain'
v-if="defaultConfig"
:currentConfig="currentConfig"
:defaultConfig="defaultConfig"
Expand Down Expand Up @@ -180,7 +179,6 @@ export default {
bus.$emit(ACTION_COMPONECT_SELECT, val);
this.selectedComponent = val;
this.filterCurrentConfig();
this.$refs.configuratorMain.focus();
}
},
watch: {
Expand Down
1 change: 1 addition & 0 deletions examples/demo-styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
@import "./upload.scss";
@import "./divider.scss";
@import "./image.scss";
@import "./infiniteScroll.scss";
48 changes: 48 additions & 0 deletions examples/demo-styles/infiniteScroll.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.infinite-list {
height: 300px;
padding: 0;
margin: 0;
list-style: none;
overflow: auto;

.infinite-list-item {
display: flex;
align-items: center;
justify-content: center;
height: 50px;
background: #e8f3fe;
margin: 10px;
color: lighten(#1989fa, 20%);
& + .list-item {
margin-top: 10px
}
}
}

.infinite-list-wrapper {
height: 300px;
overflow: auto;
text-align: center;

.list{
padding: 0;
margin: 0;
list-style: none;
}


.list-item{
display: flex;
align-items: center;
justify-content: center;
height: 50px;
background: #fff6f6;
color: #ff8484;
& + .list-item {
margin-top: 10px
}
}
}



17 changes: 17 additions & 0 deletions examples/demo-styles/tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@
.el-tag + .el-tag {
margin-left: 10px;
}

.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}

.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}

.tag-group {
display: flex;
align-items: center;

&__title {
width: 45px;
font-size: 14px;
color: #606266;
}

&+.tag-group {
margin-top: 10px;
}
}
}
1 change: 1 addition & 0 deletions examples/docs/en-US/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Besides the native features of img, support lazy load, custom placeholder and lo
| src | Image source, same as native | string || - |
| fit | Indicate how the image should be resized to fit its container, same as [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) | string | fill / contain / cover / none / scale-down | - |
| alt | Native alt | string | - | - |
| referrer-policy | Native referrerPolicy | string | - | - |
| lazy | Whether to use lazy load | boolean || false |
| scroll-container | The container to add scroll listener when using lazy load | string / HTMLElement || The nearest parent container whose overflow property is auto or scroll |

Expand Down
87 changes: 87 additions & 0 deletions examples/docs/en-US/infiniteScroll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## InfiniteScroll

Load more data while reach bottom of the page

### Basic usage
Add `v-infinite-scroll` to the list to automatically execute loading method when scrolling to the bottom.
:::demo
```html
<template>
<ul class="infinite-list" v-infinite-scroll="load">
<li v-for="i in count" class="infinite-list-item">{{ i }}</li>
</ul>
</template>

<script>
export default {
data () {
return {
count: 0
}
},
methods: {
load () {
this.count += 2
}
}
}
</script>
```
:::

### Disable Loading

:::demo
```html
<template>
<div class="infinite-list-wrapper">
<ul
class="list"
v-infinite-scroll="load"
infinite-scroll-disabled="disabled">
<li v-for="i in count" class="list-item">{{ i }}</li>
</ul>
<p v-if="loading">loading...</p>
<p v-if="noMore">Mo more</p>
</div>
</template>

<script>
export default {
data () {
return {
count: 10,
loading: false
}
},
computed: {
noMore () {
return this.count >= 20
},
disabled () {
return this.loading || this.noMore
}
},
methods: {
load () {
this.loading = true
setTimeout(() => {
this.count += 2
this.loading = false
}, 2000)
}
}
}
</script>
```
:::


### Attributes

| Attribute | Description | Type | Accepted values | Default |
| -------------- | ------------------------------ | --------- | ------------------------------------ | ------- |
| infinite-scroll-disabled | is disabled | boolean | - |false |
| infinite-scroll-delay | throttle delay (ms) | number | - |200 |
| infinite-scroll-distance| trigger distance (px) | number |- |0 |
| infinite-scroll-immediate |Whether to execute the loading method immediately, in case the content cannot be filled up in the initial state. | boolean | - |true |
5 changes: 2 additions & 3 deletions examples/docs/en-US/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ In this case the percentage takes no additional space.
<el-progress type="circle" :percentage="80" color="#8e71c7"></el-progress>
<el-progress type="circle" :percentage="100" status="success"></el-progress>
<el-progress type="circle" :percentage="50" status="exception"></el-progress>
<el-progress type="circle" :percentage="100" status="text">Done</el-progress>
```
```
:::

### Attributes
Expand All @@ -48,7 +47,7 @@ In this case the percentage takes no additional space.
| type | the type of progress bar | string | line/circle | line |
| stroke-width | the width of progress bar | number || 6 |
| text-inside | whether to place the percentage inside progress bar, only works when `type` is 'line' | boolean || false |
| status | the current status of progress bar | string | success/exception/text ||
| status | the current status of progress bar | string | success/exception ||
| color | background color of progress bar. Overrides `status` prop | string |||
| width | the canvas width of circle progress bar | number || 126 |
| show-text | whether to show percentage | boolean || true |
61 changes: 54 additions & 7 deletions examples/docs/en-US/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Used for marking and selection.
:::demo Use the `type` attribute to define Tag's type. In addition, the `color` attribute can be used to set the background color of the Tag.

```html
<el-tag>Tag One</el-tag>
<el-tag type="success">Tag Two</el-tag>
<el-tag type="info">Tag Three</el-tag>
<el-tag type="warning">Tag Four</el-tag>
<el-tag type="danger">Tag Five</el-tag>
<el-tag>Tag 1</el-tag>
<el-tag type="success">Tag 2</el-tag>
<el-tag type="info">Tag 3</el-tag>
<el-tag type="warning">Tag 4</el-tag>
<el-tag type="danger">Tag 5</el-tag>
```
:::

Expand Down Expand Up @@ -139,19 +139,66 @@ Besides default size, Tag component provides three additional sizes for you to c
```
:::


### Theme

Tag provide three different themes: `dark``light` and `plain`

:::demo Using `effect` to change, default is `light`
```html
<div class="tag-group">
<span class="tag-group__title">Dark</span>
<el-tag
v-for="item in items"
:key="item.label"
:type="item.type"
effect="dark">
{{ item.label }}
</el-tag>
</div>
<div class="tag-group">
<span class="tag-group__title">Plain</span>
<el-tag
v-for="item in items"
:key="item.label"
:type="item.type"
effect="plain">
{{ item.label }}
</el-tag>
</div>

<script>
export default {
data() {
return {
items: [
{ type: '', label: 'Tag 1' },
{ type: 'success', label: 'Tag 2' },
{ type: 'info', label: 'Tag 3' },
{ type: 'danger', label: 'Tag 4' },
{ type: 'warning', label: 'Tag 5' }
]
}
}
}
</script>
```
:::

### Attributes
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- |
| type | theme | string | success/info/warning/danger ||
| type | component type | string | success/info/warning/danger ||
| closable | whether Tag can be removed | boolean || false |
| disable-transitions | whether to disable animations | boolean || false |
| hit | whether Tag has a highlighted border | boolean || false |
| color | background color of the Tag | string |||
| size | tag size | string | medium / small / mini ||
| effect | component theme | string | dark / light / plain | light |


### Events
| Event Name | Description | Parameters |
|---------- |-------- |---------- |
| click | triggers when Tag is clicked ||
| close | triggers when Tag is removed ||
| close | triggers when Tag is removed ||
1 change: 1 addition & 0 deletions examples/docs/es/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Además de las características nativas de img, soporte de carga perezosa, marca
| src | origen de la imagen, igual que en nativo | string || - |
| fit | Indica como la imagen debe adaptarse al contenendor, lo mismo que [object-fit](https://developer.mozilla.org/es/docs/Web/CSS/object-fit) | string | fill / contain / cover / none / scale-down | - |
| alt | alt nativo | string | - | - |
| referrer-policy | referrerPolicy nativo | string | - | - |
| lazy | si se usara lazy load | boolean || false |
| scroll-container | El contenedor para añadir el scroll listener cuando se utiliza lazy load | string / HTMLElement || El contenedor padre más cercano cuya propiedad de desbordamiento es auto o scroll |

Expand Down
Loading

0 comments on commit 635c794

Please sign in to comment.