🎨 add eslint

This commit is contained in:
jingsam 2016-12-25 22:49:42 +08:00
parent 829a2e4cfc
commit b0893113b3
88 changed files with 376 additions and 370 deletions

18
.eslintrc.json Normal file
View file

@ -0,0 +1,18 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true
},
"extends": "eslint:recommended",
"plugins": [ "html" ],
"rules": {
"indent": ["error", 4, { "SwitchCase": 1 }],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"no-console": ["off"]
}
}

View file

@ -1,8 +1,5 @@
sudo: false
language: node_js
node_js:
- "5"
script: make dist
- "4"
script:
- npm run test

View file

@ -6,20 +6,20 @@ var autoprefixer = require('gulp-autoprefixer');
// 编译less
gulp.task('css', function () {
gulp.src('../src/styles/index.less')
.pipe(less())
.pipe(autoprefixer({
gulp.src('../src/styles/index.less')
.pipe(less())
.pipe(autoprefixer({
browsers: ['last 2 versions', 'ie > 8']
}))
.pipe(cleanCSS())
.pipe(rename('iview.css'))
.pipe(gulp.dest('../dist/styles'))
}))
.pipe(cleanCSS())
.pipe(rename('iview.css'))
.pipe(gulp.dest('../dist/styles'));
});
// 拷贝字体文件
gulp.task('fonts', function () {
gulp.src('../src/styles/common/iconfont/fonts/*.*')
.pipe(gulp.dest('../dist/styles/fonts'))
.pipe(gulp.dest('../dist/styles/fonts'));
});
gulp.task('default', ['css', 'fonts']);

View file

@ -24,6 +24,8 @@
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod",
"lint": "eslint --fix --ext .js,.vue src",
"test": "npm run dist && npm run lint",
"prepublish": "npm run dist"
},
"repository": {
@ -51,9 +53,8 @@
"babel-preset-es2015": "^6.9.0",
"babel-runtime": "^6.11.6",
"css-loader": "^0.23.1",
"eslint": "^2.5.3",
"eslint-friendly-formatter": "^2.0.6",
"eslint-loader": "^1.3.0",
"eslint": "^3.12.2",
"eslint-plugin-html": "^1.7.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"gulp": "^3.9.1",

View file

@ -35,7 +35,7 @@
return {
top: rect.top + scrollTop - clientTop,
left: rect.left + scrollLeft - clientLeft
}
};
}
export default {
@ -52,7 +52,7 @@
return {
affix: false,
styles: {}
}
};
},
computed: {
offsetType () {
@ -68,7 +68,7 @@
{
[`${prefixCls}`]: this.affix
}
]
];
}
},
ready () {
@ -117,10 +117,10 @@
} else if ((elOffset.top + this.offsetBottom + elHeight) < (scrollTop + windowHeight) && this.offsetType == 'bottom' && affix) {
this.affix = false;
this.styles = null;
this.$emit('on-change', false);
}
}
}
}
};
</script>

View file

@ -42,7 +42,7 @@
return {
closed: false,
desc: false
}
};
},
computed: {
wrapClasses () {
@ -53,7 +53,7 @@
[`${prefixCls}-with-icon`]: this.showIcon,
[`${prefixCls}-with-desc`]: this.desc
}
]
];
},
messageClasses () {
return `${prefixCls}-message`;
@ -97,5 +97,5 @@
compiled () {
this.desc = this.$els.desc.innerHTML != '';
}
}
</script>
};
</script>

View file

@ -28,7 +28,7 @@
data () {
return {
backTop: false
}
};
},
ready () {
window.addEventListener('scroll', this.handleScroll, false);
@ -45,13 +45,13 @@
{
[`${prefixCls}-show`]: this.backTop
}
]
];
},
styles () {
return {
bottom: `${this.bottom}px`,
right: `${this.right}px`
}
};
},
innerClasses () {
return `${prefixCls}-inner`;
@ -66,5 +66,5 @@
this.$emit('on-click');
}
}
}
};
</script>

View file

@ -38,7 +38,7 @@
[`${this.class}`]: !!this.class,
[`${prefixCls}-count-alone`]: this.alone
}
]
];
},
finalCount () {
return parseInt(this.count) >= parseInt(this.overflowCount) ? `${this.overflowCount}+` : this.count;
@ -65,7 +65,7 @@
data () {
return {
alone: false
}
};
},
compiled () {
const child_length = this.$els.badge.children.length;
@ -73,5 +73,5 @@
this.alone = true;
}
}
}
</script>
};
</script>

View file

@ -31,7 +31,7 @@ Notification.newInstance = properties => {
destroy () {
document.body.removeChild(div);
}
}
};
};
export default Notification;

View file

@ -26,7 +26,7 @@
default: function() {
return {
right: '50%'
}
};
}
},
closable: {
@ -50,7 +50,7 @@
data () {
return {
withDesc: false
}
};
},
computed: {
baseClass () {
@ -64,7 +64,7 @@
[`${this.baseClass}-closable`]: this.closable,
[`${this.baseClass}-with-desc`]: this.withDesc
}
]
];
},
contentClasses () {
return `${this.baseClass}-content`;
@ -89,7 +89,7 @@
if (this.duration !== 0) {
this.closeTimer = setTimeout(() => {
this.close();
}, this.duration * 1000)
}, this.duration * 1000);
}
// check if with desc in Notice component
@ -100,5 +100,5 @@
beforeDestroy () {
this.clearCloseTimer();
}
}
};
</script>

View file

@ -36,7 +36,7 @@
return {
top: '65px',
left: '50%'
}
};
}
},
content: {
@ -49,7 +49,7 @@
data () {
return {
notices: []
}
};
},
computed: {
classes () {
@ -58,7 +58,7 @@
{
[`${this.className}`]: !!this.className
}
]
];
}
},
methods: {
@ -88,5 +88,5 @@
}
}
}
}
</script>
};
</script>

View file

@ -26,7 +26,7 @@ export default {
return {
gpuAcceleration: false,
boundariesElement: 'body'
}
};
}
},
visible: {
@ -103,4 +103,4 @@ export default {
this.popperJS.destroy();
}
}
};
};

View file

@ -32,5 +32,5 @@
return `${prefixCls}-separator`;
}
}
}
</script>
};
</script>

View file

@ -33,5 +33,5 @@
this.updateChildren();
}
}
}
</script>
};
</script>

View file

@ -34,8 +34,8 @@
[`${prefixCls}-${this.shape}`]: !!this.shape,
[`${prefixCls}-vertical`]: this.vertical
}
]
];
}
}
}
</script>
};
</script>

View file

@ -46,7 +46,7 @@
data () {
return {
showSlot: true
}
};
},
computed: {
classes () {
@ -60,11 +60,11 @@
[`${prefixCls}-loading`]: this.loading != null && this.loading,
[`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading)
}
]
];
}
},
compiled () {
this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== '';
}
}
};
</script>

View file

@ -27,7 +27,7 @@
return {
showHead: true,
showExtra: true
}
};
},
computed: {
classes () {
@ -38,7 +38,7 @@
[`${prefixCls}-dis-hover`]: this.disHover || this.shadow,
[`${prefixCls}-shadow`]: this.shadow
}
]
];
},
headClasses () {
return `${prefixCls}-head`;
@ -54,5 +54,5 @@
this.showHead = this.$els.head.innerHTML != '';
this.showExtra = this.$els.extra.innerHTML != '';
}
}
</script>
};
</script>

View file

@ -39,13 +39,13 @@
data: {
type: Array,
default () {
return []
return [];
}
},
value: {
type: Array,
default () {
return []
return [];
}
},
disabled: {
@ -88,7 +88,7 @@
visible: false,
selected: [],
tmpSelected: []
}
};
},
computed: {
classes () {
@ -99,7 +99,7 @@
[`${prefixCls}-visible`]: this.visible,
[`${prefixCls}-disabled`]: this.disabled
}
]
];
},
showCloseIcon () {
return this.value && this.value.length && this.clearable;
@ -182,5 +182,5 @@
this.updateSelected();
}
}
}
</script>
};
</script>

View file

@ -16,8 +16,8 @@
[`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value,
[`${this.prefixCls}-menu-item-disabled`]: this.data.disabled
}
]
];
}
}
}
</script>
};
</script>

View file

@ -11,7 +11,6 @@
</template>
<script>
import Casitem from './casitem.vue';
import { oneOf } from '../../utils/assist';
export default {
name: 'Caspanel',
@ -20,13 +19,13 @@
data: {
type: Array,
default () {
return []
return [];
}
},
sublist: {
type: Array,
default () {
return []
return [];
}
},
disabled: Boolean,
@ -38,7 +37,7 @@
return {
tmpItem: {},
result: []
}
};
},
methods: {
handleClickItem (item) {
@ -111,5 +110,5 @@
this.tmpItem = {};
}
}
}
</script>
};
</script>

View file

@ -12,7 +12,7 @@
model: {
type: Array,
default () {
return []
return [];
}
}
},
@ -43,14 +43,9 @@
}
},
watch: {
model (val, oldVal) {
// if (val == oldVal) {
// this.updateModel();
// } else {
// this.updateModel(true);
// }
model () {
this.updateModel(true);
}
}
}
</script>
};
</script>

View file

@ -44,7 +44,7 @@
selected: false,
group: false,
showSlot: true
}
};
},
computed: {
wrapClasses () {
@ -55,7 +55,7 @@
[`${prefixCls}-wrapper-checked`]: this.selected,
[`${prefixCls}-wrapper-disabled`]: this.disabled
}
]
];
},
checkboxClasses () {
return [
@ -64,7 +64,7 @@
[`${prefixCls}-checked`]: this.selected,
[`${prefixCls}-disabled`]: this.disabled
}
]
];
},
innerClasses () {
return `${prefixCls}-inner`;
@ -105,5 +105,5 @@
this.updateModel();
}
}
}
</script>
};
</script>

View file

@ -70,7 +70,7 @@
'stroke-dasharray': `${this.len}px ${this.len}px`,
'stroke-dashoffset': `${((100 - this.percent) / 100 * this.len)}px`,
'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease'
}
};
},
wrapClasses () {
return `${prefixCls}`;
@ -79,5 +79,5 @@
return `${prefixCls}-inner`;
}
}
}
</script>
};
</script>

View file

@ -40,7 +40,7 @@
child.isActive = isActive;
child.index = index;
})
});
},
getActiveKey () {
let activeKey = this.activeKey || [];
@ -94,5 +94,5 @@
this.setActive();
}
}
}
</script>
};
</script>

View file

@ -24,7 +24,7 @@
return {
index: 0, // use index for default when key is null
isActive: false
}
};
},
computed: {
itemClasses () {
@ -33,7 +33,7 @@
{
[`${prefixCls}-item-active`]: this.isActive
}
]
];
},
headerClasses () {
return `${prefixCls}-header`;
@ -53,5 +53,5 @@
});
}
}
}
</script>
};
</script>

View file

@ -14,7 +14,7 @@
data () {
return {
prefixCls: prefixCls
}
};
},
methods: {
handleClear () {
@ -24,5 +24,5 @@
this.$emit('on-pick-success');
}
}
}
</script>
};
</script>

View file

@ -10,7 +10,7 @@
</div>
</template>
<script>
import { getFirstDayOfMonth, getDayCountOfMonth, getStartDateOfMonth } from '../util';
import { getFirstDayOfMonth, getDayCountOfMonth } from '../util';
import { deepCopy } from '../../../utils/assist';
const prefixCls = 'ivu-date-picker-cells';
@ -46,7 +46,7 @@
return {
prefixCls: prefixCls,
readCells: []
}
};
},
watch: {
'rangeState.endDate' (newVal) {
@ -84,7 +84,7 @@
classes () {
return [
`${prefixCls}`
]
];
},
cells () {
const date = new Date(this.year, this.month, 1);
@ -269,9 +269,9 @@
[`${prefixCls}-cell-next-month`]: cell.type === 'next-month',
[`${prefixCls}-cell-range`]: cell.range && !cell.start && !cell.end
}
]
];
},
}
}
</script>
};
</script>

View file

@ -23,7 +23,7 @@
return [
`${prefixCls}`,
`${prefixCls}-month`
]
];
},
cells () {
let cells = [];
@ -56,7 +56,7 @@
[`${prefixCls}-cell-selected`]: cell.selected,
[`${prefixCls}-cell-disabled`]: cell.disabled
}
]
];
},
handleClick (event) {
const target = event.target;
@ -70,5 +70,5 @@
this.$emit('on-pick-click');
}
}
}
</script>
};
</script>

View file

@ -21,7 +21,7 @@
return [
`${prefixCls}`,
`${prefixCls}-year`
]
];
},
startYear() {
return Math.floor(this.year / 10) * 10;
@ -57,7 +57,7 @@
[`${prefixCls}-cell-selected`]: cell.selected,
[`${prefixCls}-cell-disabled`]: cell.disabled
}
]
];
},
nextTenYear() {
this.$emit('on-pick', Number(this.year) + 10, false);
@ -76,5 +76,5 @@
this.$emit('on-pick-click');
}
}
}
</script>
};
</script>

View file

@ -157,7 +157,7 @@
selectionMode: 'range',
leftTableYear: null,
rightTableYear: null
}
};
},
computed: {
classes () {
@ -167,7 +167,7 @@
{
[`${prefixCls}-with-sidebar`]: this.shortcuts.length
}
]
];
},
leftYear () {
return this.date.getFullYear();
@ -353,5 +353,5 @@
this.rangeState = val.rangeState;
}
}
}
</script>
};
</script>

View file

@ -73,7 +73,6 @@
import YearTable from '../base/year-table.vue';
import MonthTable from '../base/month-table.vue';
import Confirm from '../base/confirm.vue';
import { formatDate, parseDate } from '../util';
import Mixin from './mixin';
@ -97,7 +96,7 @@
year: null,
month: null,
confirm: false
}
};
},
computed: {
classes () {
@ -106,7 +105,7 @@
{
[`${prefixCls}-with-sidebar`]: this.shortcuts.length
}
]
];
},
yearLabel () {
const year = this.year;
@ -238,5 +237,5 @@
this.month = this.date.getMonth();
}
}
}
</script>
};
</script>

View file

@ -8,7 +8,7 @@ export default {
`${prefixCls}-icon-btn`,
`${datePrefixCls}-${direction}-btn`,
`${datePrefixCls}-${direction}-btn-arrow${type}`,
]
];
},
handleShortcutClick (shortcut) {
if (shortcut.value) this.$emit('on-pick', shortcut.value());
@ -24,4 +24,4 @@ export default {
this.$emit('on-pick-click');
}
}
}
};

View file

@ -193,7 +193,7 @@
picker: null,
internalValue: '',
disableClickOutSide: false // fixed when click a date,trigger clickoutside to close picker
}
};
},
computed: {
opened () {
@ -424,5 +424,5 @@
ready () {
if (this.open !== null) this.visible = this.open;
}
}
</script>
};
</script>

View file

@ -33,4 +33,4 @@ export default {
this.panel = getPanel(this.type);
}
}
};

View file

@ -31,7 +31,7 @@
[`${prefixCls}-selected`]: this.selected,
[`${prefixCls}-divided`]: this.divided
}
]
];
}
},
methods: {
@ -53,5 +53,5 @@
$parent.$emit('on-click', this.key);
}
}
}
</script>
};
</script>

View file

@ -2,5 +2,5 @@
<ul class="ivu-dropdown-menu"><slot></slot></ul>
</template>
<script>
export default {}
</script>
export default {};
</script>

View file

@ -42,7 +42,7 @@
return {
prefixCls: prefixCls,
visible: false
}
};
},
methods: {
handleClick () {
@ -120,5 +120,5 @@
if ($parent) $parent.$emit('on-haschild-click');
}
}
}
</script>
};
</script>

View file

@ -12,21 +12,21 @@
},
computed: {
classes () {
return `${prefixCls} ${prefixCls}-${this.type}`
return `${prefixCls} ${prefixCls}-${this.type}`;
},
styles () {
let style = {};
if (!!this.size) {
if (this.size) {
style['font-size'] = `${this.size}px`;
}
if (!!this.color) {
if (this.color) {
style.color = this.color;
}
return style;
}
}
}
</script>
};
</script>

View file

@ -39,13 +39,13 @@
function addNum (num1, num2) {
let sq1, sq2, m;
try {
sq1 = num1.toString().split(".")[1].length;
sq1 = num1.toString().split('.')[1].length;
}
catch (e) {
sq1 = 0;
}
try {
sq2 = num2.toString().split(".")[1].length;
sq2 = num2.toString().split('.')[1].length;
}
catch (e) {
sq2 = 0;
@ -93,7 +93,7 @@
focused: false,
upDisabled: false,
downDisabled: false
}
};
},
computed: {
wrapClasses () {
@ -104,7 +104,7 @@
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-focused`]: this.focused
}
]
];
},
handlerClasses () {
return `${prefixCls}-handler-wrap`;
@ -116,7 +116,7 @@
{
[`${prefixCls}-handler-up-disabled`]: this.upDisabled
}
]
];
},
innerUpClasses () {
return `${prefixCls}-handler-up-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-up`;
@ -128,7 +128,7 @@
{
[`${prefixCls}-handler-down-disabled`]: this.downDisabled
}
]
];
},
innerDownClasses () {
return `${prefixCls}-handler-down-inner ${iconPrefixCls} ${iconPrefixCls}-ios-arrow-down`;
@ -190,10 +190,10 @@
keyDown (e) {
if (e.keyCode === 38) {
e.preventDefault();
this.up()
this.up();
} else if (e.keyCode === 40) {
e.preventDefault();
this.down()
this.down();
}
},
change (event) {
@ -238,5 +238,5 @@
this.changeVal(val);
}
}
}
};
</script>

View file

@ -96,7 +96,7 @@
append: true,
slotReady: false,
textareaStyles: {}
}
};
},
computed: {
wrapClasses () {
@ -108,7 +108,7 @@
[`${prefixCls}-group`]: this.prepend || this.append,
[`${prefixCls}-group-${this.size}`]: (this.prepend || this.append) && !!this.size
}
]
];
},
inputClasses () {
return [
@ -117,7 +117,7 @@
[`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-disabled`]: this.disabled
}
]
];
},
textareaClasses () {
return [
@ -125,7 +125,7 @@
{
[`${prefixCls}-disabled`]: this.disabled
}
]
];
}
},
methods: {
@ -174,5 +174,5 @@
this.slotReady = true;
this.resizeTextarea();
}
}
</script>
};
</script>

View file

@ -4,8 +4,6 @@
</div>
</template>
<script>
import { oneOf } from '../../utils/assist';
const prefixCls = 'ivu-col';
export default {
@ -24,7 +22,7 @@
data () {
return {
gutter: 0
}
};
},
computed: {
classes () {
@ -63,11 +61,11 @@
style = {
paddingLeft: this.gutter / 2 + 'px',
paddingRight: this.gutter / 2 + 'px'
}
};
}
return style;
}
}
}
</script>
};
</script>

View file

@ -41,7 +41,7 @@
[`${prefixCls}-${this.type}-${this.justify}`]: !!this.justify,
[`${this.className}`]: !!this.className
}
]
];
},
styles () {
let style = {};
@ -49,7 +49,7 @@
style = {
marginLeft: this.gutter / -2 + 'px',
marginRight: this.gutter / -2 + 'px'
}
};
}
return style;
@ -72,5 +72,5 @@
ready () {
this.updateGutter(this.gutter);
}
}
</script>
};
</script>

View file

@ -31,7 +31,7 @@ function hide() {
update({
percent: 0
});
}, 200)
}, 200);
}, 800);
}
@ -109,4 +109,4 @@ export default {
loadingBarInstance = null;
instance.destroy();
}
}
};

View file

@ -36,7 +36,7 @@ LoadingBar.newInstance = properties => {
destroy () {
document.body.removeChild(div);
}
}
};
};
export default LoadingBar;

View file

@ -49,12 +49,12 @@
[`${prefixCls}-inner-color-primary`]: this.color === 'primary' && this.status === 'success',
[`${prefixCls}-inner-failed-color-error`]: this.failedColor === 'error' && this.status === 'error'
}
]
];
},
outerStyles () {
return {
height: `${this.height}px`
}
};
},
styles () {
let style = {
@ -73,5 +73,5 @@
return style;
}
}
}
</script>
};
</script>

View file

@ -18,7 +18,7 @@
data () {
return {
prefixCls: prefixCls
}
};
}
}
</script>
};
</script>

View file

@ -19,7 +19,7 @@
data () {
return {
active: false
}
};
},
computed: {
classes () {
@ -30,7 +30,7 @@
[`${prefixCls}-item-selected`]: this.active,
[`${prefixCls}-item-disabled`]: this.disabled
}
]
];
}
},
methods: {
@ -39,5 +39,5 @@
this.$dispatch('on-menu-item-select', this.key);
}
}
}
</script>
};
</script>

View file

@ -26,7 +26,7 @@
openKeys: {
type: Array,
default () {
return []
return [];
}
},
accordion: {
@ -49,7 +49,7 @@
{
[`${prefixCls}-${this.mode}`]: this.mode
}
]
];
},
styles () {
let style = {};
@ -77,7 +77,7 @@
} else {
groupItem.active = false;
}
})
});
} else if (subitem.$options.name === 'MenuItem') {
if (subitem.key === this.activeKey) {
subitem.active = true;
@ -86,15 +86,15 @@
subitem.active = false;
}
}
})
});
} else if (item.$options.name === 'MenuGroup') {
item.$children.forEach(groupItem => {
groupItem.active = groupItem.key === this.activeKey;
})
});
} else if (item.$options.name === 'MenuItem') {
item.active = item.key === this.activeKey;
}
})
});
},
updateOpenKeys (key) {
const index = this.openKeys.indexOf(key);
@ -109,7 +109,7 @@
if (item.$options.name === 'Submenu') {
if (this.openKeys.indexOf(item.key) > -1) item.opened = true;
}
})
});
}
},
compiled () {
@ -128,5 +128,5 @@
this.$emit('on-open-change', this.openKeys);
}
}
}
</script>
};
</script>

View file

@ -31,7 +31,7 @@
prefixCls: prefixCls,
active: false,
opened: false
}
};
},
computed: {
classes () {
@ -42,7 +42,7 @@
[`${prefixCls}-opened`]: this.opened,
[`${prefixCls}-submenu-disabled`]: this.disabled
}
]
];
},
mode () {
return this.$parent.mode;
@ -106,5 +106,5 @@
return true;
}
}
}
</script>
};
</script>

View file

@ -32,7 +32,7 @@ function notice (content, duration = defaultDuration, type, onClose) {
if (!onClose) {
onClose = function () {
}
};
}
const iconType = iconTypes[type];
@ -61,7 +61,7 @@ function notice (content, duration = defaultDuration, type, onClose) {
return function () {
instance.remove(`${prefixKey}${target}`);
}
};
})();
}
@ -94,4 +94,4 @@ export default {
messageInstance = null;
instance.destroy();
}
}
};

View file

@ -55,13 +55,13 @@ Modal.newInstance = properties => {
return [
`${prefixCls}-body-icon`,
`${prefixCls}-body-icon-${this.iconType}`
]
];
},
iconNameCls () {
return [
'ivu-icon',
`ivu-icon-${this.iconName}`
]
];
}
},
methods: {
@ -163,7 +163,7 @@ Modal.newInstance = properties => {
modal.$parent.remove();
},
component: modal
}
};
};
export default Modal;

View file

@ -79,7 +79,7 @@
wrapShow: false,
showHead: true,
buttonLoading: false
}
};
},
computed: {
wrapClasses () {
@ -89,7 +89,7 @@
[`${prefixCls}-hidden`]: !this.wrapShow,
[`${this.className}`]: !!this.className
}
]
];
},
maskClasses () {
return `${prefixCls}-mask`;
@ -104,7 +104,7 @@
width: `${this.width}px`
};
const customStyle = !!this.style ? this.style : {};
const customStyle = this.style ? this.style : {};
Object.assign(style, styleWidth, customStyle);
@ -135,7 +135,7 @@
EscClose (e) {
if (this.visible && this.closable) {
if (e.keyCode === 27) {
this.close()
this.close();
}
}
},
@ -207,5 +207,5 @@
}
}
}
}
};
</script>

View file

@ -114,4 +114,4 @@ export default {
noticeInstance = null;
instance.destroy();
}
}
};

View file

@ -41,17 +41,17 @@
optsClasses () {
return [
`${prefixCls}-options`
]
];
},
sizerClasses () {
return [
`${prefixCls}-options-sizer`
]
];
},
ElevatorClasses () {
return [
`${prefixCls}-options-elevator`
]
];
}
},
methods: {
@ -83,5 +83,5 @@
}
}
}
}
</script>
};
</script>

View file

@ -86,7 +86,7 @@
pageSizeOpts: {
type: Array,
default () {
return [10, 20, 30, 40]
return [10, 20, 30, 40];
}
},
size: {
@ -120,7 +120,7 @@
data () {
return {
prefixCls: prefixCls
}
};
},
computed: {
isSmall () {
@ -137,7 +137,7 @@
{
[`${this.class}`]: !!this.class
}
]
];
},
simplePagerClasses () {
return `${prefixCls}-simple-pager`;
@ -149,7 +149,7 @@
[`${this.class}`]: !!this.class,
'mini': !!this.size
}
]
];
},
prevClasses () {
return [
@ -157,7 +157,7 @@
{
[`${prefixCls}-disabled`]: this.current === 1
}
]
];
},
nextClasses () {
return [
@ -165,7 +165,7 @@
{
[`${prefixCls}-disabled`]: this.current === this.allPages
}
]
];
},
firstPageClasses () {
return [
@ -173,7 +173,7 @@
{
[`${prefixCls}-item-active`]: this.current === 1
}
]
];
},
lastPageClasses () {
return [
@ -181,7 +181,7 @@
{
[`${prefixCls}-item-active`]: this.current === this.allPages
}
]
];
}
},
methods: {
@ -242,9 +242,9 @@
const val = parseInt(e.target.value);
if (key === 38) {
this.prev()
this.prev();
} else if (key === 40) {
this.next()
this.next();
} else if (key == 13) {
let page = 1;
@ -261,5 +261,5 @@
}
}
}
}
};
</script>

View file

@ -87,7 +87,7 @@
return {
prefixCls: prefixCls,
showTitle: true
}
};
},
computed: {
classes () {
@ -96,12 +96,12 @@
{
[`${prefixCls}-confirm`]: this.confirm
}
]
];
},
styles () {
let style = {};
if (!!this.width) {
if (this.width) {
style.width = `${this.width}px`;
}
return style;
@ -166,5 +166,5 @@
this.showTitle = this.$els.title.innerHTML != `<div class="${prefixCls}-title-inner"></div>`;
}
}
}
};
</script>

View file

@ -56,7 +56,7 @@
type = 'ios-close';
break;
case 'success':
type = 'ios-checkmark';
type = 'ios-checkmark';
break;
}
@ -66,7 +66,7 @@
return {
width: `${this.percent}%`,
height: `${this.strokeWidth}px`
}
};
},
wrapClasses () {
return [
@ -76,7 +76,7 @@
[`${prefixCls}-show-info`]: !this.hideInfo,
}
]
];
},
textClasses () {
return `${prefixCls}-text`;
@ -117,5 +117,5 @@
}
}
}
}
</script>
};
</script>

View file

@ -33,7 +33,7 @@
[`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-${this.type}`]: !!this.type
}
]
];
}
},
compiled () {
@ -55,8 +55,8 @@
},
watch: {
model () {
this.updateModel()
this.updateModel();
}
}
}
</script>
};
</script>

View file

@ -32,7 +32,7 @@
return {
selected: false,
group: false
}
};
},
computed: {
wrapClasses () {
@ -43,7 +43,7 @@
[`${prefixCls}-wrapper-checked`]: this.selected,
[`${prefixCls}-wrapper-disabled`]: this.disabled
}
]
];
},
radioClasses () {
return [
@ -52,7 +52,7 @@
[`${prefixCls}-checked`]: this.selected,
[`${prefixCls}-disabled`]: this.disabled
}
]
];
},
innerClasses () {
return `${prefixCls}-inner`;
@ -91,5 +91,5 @@
this.updateModel();
}
}
}
</script>
};
</script>

View file

@ -14,7 +14,7 @@
data () {
return {
popper: null
}
};
},
methods: {
update () {
@ -62,5 +62,5 @@
this.popper.destroy();
}
}
}
</script>
};
</script>

View file

@ -19,7 +19,7 @@
data () {
return {
prefixCls: prefixCls
}
};
}
}
};
</script>

View file

@ -26,7 +26,7 @@
isFocus: false,
hidden: false, // for search
searchLabel: '' // the value is slot,only for search
}
};
},
computed: {
classes () {
@ -37,10 +37,10 @@
[`${prefixCls}-selected`]: this.selected,
[`${prefixCls}-focus`]: this.isFocus
}
]
];
},
showLabel () {
return (!!this.label) ? this.label : this.value;
return (this.label) ? this.label : this.value;
}
},
methods: {
@ -69,5 +69,5 @@
this.queryChange(val);
}
}
}
</script>
};
</script>

View file

@ -96,7 +96,7 @@
inputLength: 20,
notFound: false,
slotChangeDuration: false // if slot change duration and in multiple, set true and after slot change, set false
}
};
},
computed: {
classes () {
@ -110,7 +110,7 @@
[`${prefixCls}-show-clear`]: this.showCloseIcon,
[`${prefixCls}-${this.size}`]: !!this.size
}
]
];
},
showPlaceholder () {
let status = false;
@ -174,7 +174,7 @@
if (this.optionInstances.length) {
this.optionInstances.forEach((child) => {
find(child);
})
});
} else {
this.$children.forEach((child) => {
find(child);
@ -252,7 +252,7 @@
selected.push({
value: option.value,
label: option.label
})
});
}
}
}
@ -435,7 +435,7 @@
const model = this.model;
if (this.multiple) {
//
} else {
if (model !== '') {
this.findChild((child) => {
@ -561,5 +561,5 @@
}
}
}
}
};
</script>

View file

@ -109,7 +109,7 @@
singlePosition: (this.value - this.min) / (this.max - this.min) * 100,
firstPosition: (this.value[0] - this.min) / (this.max - this.min) * 100,
secondPosition: (this.value[1] - this.min) / (this.max - this.min) * 100
}
};
},
computed: {
classes () {
@ -120,7 +120,7 @@
[`${prefixCls}-range`]: this.range,
[`${prefixCls}-disabled`]: this.disabled
}
]
];
},
buttonClasses () {
return [
@ -153,11 +153,11 @@
style = {
width: (this.value[1] - this.value[0]) / (this.max - this.min) * 100 + '%',
left: (this.value[0] - this.min) / (this.max - this.min) * 100 + '%'
}
};
} else {
style = {
width: (this.value - this.min) / (this.max - this.min) * 100 + '%'
}
};
}
return style;
@ -418,5 +418,5 @@
this.updateValue(this.value);
}
}
}
</script>
};
</script>

View file

@ -26,7 +26,7 @@
data () {
return {
showText: false
}
};
},
computed: {
classes () {
@ -37,7 +37,7 @@
[`${prefixCls}-fix`]: this.fix,
[`${prefixCls}-show-text`]: this.showText,
}
]
];
},
mainClasses () {
return `${prefixCls}-main`;
@ -56,5 +56,5 @@
this.showText = true;
}
}
}
</script>
};
</script>

View file

@ -43,7 +43,7 @@
stepNumber: '',
nextError: false,
total: 1
}
};
},
computed: {
wrapClasses () {
@ -54,12 +54,12 @@
[`${prefixCls}-custom`]: !!this.icon,
[`${prefixCls}-next-error`]: this.nextError
}
]
];
},
iconClasses () {
let icon = '';
if (!!this.icon) {
if (this.icon) {
icon = this.icon;
} else {
if (this.status == 'finish') {
@ -75,12 +75,12 @@
{
[`${iconPrefixCls}-${icon}`]: icon != ''
}
]
];
},
styles () {
return {
width: `${1/this.total*100}%`
}
};
}
},
watch: {
@ -90,5 +90,5 @@
}
}
}
}
};
</script>

View file

@ -40,7 +40,7 @@
{
[`${prefixCls}-${this.size}`]: !!this.size
}
]
];
}
},
ready () {
@ -103,5 +103,5 @@
this.updateCurrent();
}
}
}
</script>
};
</script>

View file

@ -36,7 +36,7 @@
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-${this.size}`]: !!this.size
}
]
];
},
innerClasses () {
return `${prefixCls}-inner`;
@ -52,5 +52,5 @@
this.$emit('on-change', this.checked);
}
}
}
</script>
};
</script>

View file

@ -29,7 +29,7 @@
renderType: '',
uid: -1,
content: this.$parent.$parent.content
}
};
},
computed: {
classes () {
@ -38,7 +38,7 @@
{
[`${this.prefixCls}-hidden`]: !this.fixed && this.column.fixed && (this.column.fixed === 'left' || this.column.fixed === 'right')
}
]
];
}
},
methods: {
@ -94,5 +94,5 @@
this.compile();
}
}
}
</script>
};
</script>

View file

@ -3,11 +3,11 @@ function has (browser) {
if (browser === 'ie') {
const isIE = ua.indexOf('compatible') > -1 && ua.indexOf('MSIE') > -1;
if (isIE) {
const reIE = new RegExp("MSIE (\\d+\\.\\d+);");
const reIE = new RegExp('MSIE (\\d+\\.\\d+);');
reIE.test(ua);
return parseFloat(RegExp["$1"]);
return parseFloat(RegExp['$1']);
} else {
return false
return false;
}
} else {
return ua.indexOf(browser) > -1;
@ -19,12 +19,12 @@ const csv = {
let iev = 0;
const ieold = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
const trident = !!navigator.userAgent.match(/Trident\/7.0/);
const rv = navigator.userAgent.indexOf("rv:11.0");
const rv = navigator.userAgent.indexOf('rv:11.0');
if (ieold) {
iev = Number(RegExp.$1);
}
if (navigator.appVersion.indexOf("MSIE 10") !== -1) {
if (navigator.appVersion.indexOf('MSIE 10') !== -1) {
iev = 10;
}
if (trident && rv !== -1) {
@ -39,7 +39,7 @@ const csv = {
},
_getDownloadUrl (text) {
const BOM = "\uFEFF";
const BOM = '\uFEFF';
// Add BOM to text for open in excel correctly
if (window.Blob && window.URL && window.URL.createObjectURL && !has('Safari')) {
const csvData = new Blob([BOM + text], { type: 'text/csv' });
@ -52,14 +52,14 @@ const csv = {
download (filename, text) {
if (has('ie') && has('ie') < 10) {
// has module unable identify ie11 and Edge
const oWin = window.top.open("about:blank", "_blank");
const oWin = window.top.open('about:blank', '_blank');
oWin.document.charset = 'utf-8';
oWin.document.write(text);
oWin.document.close();
oWin.document.execCommand('SaveAs', filename);
oWin.close();
} else if (has("ie") === 10 || this._isIE11() || this._isEdge()) {
const BOM = "\uFEFF";
} else if (has('ie') === 10 || this._isIE11() || this._isEdge()) {
const BOM = '\uFEFF';
const csvData = new Blob([BOM + text], { type: 'text/csv' });
navigator.msSaveBlob(csvData, filename);
} else {

View file

@ -6,21 +6,21 @@ export default {
[`${this.prefixCls}-column-${column.align}`]: column.align,
[`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
}
]
];
},
isPopperShow (column) {
return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
},
setCellWidth (column, index) {
setCellWidth (column) {
// return column.width ? column.width : this.columnsWidth[index];
let width = '';
if (column.width) {
width = column.width;
} else if (this.columnsWidth[column._index]) {
width = this.columnsWidth[column._index].width
width = this.columnsWidth[column._index].width;
}
// return this.columnsWidth[column._index] ? this.columnsWidth[column._index].width : '';
return width;
}
}
}
};

View file

@ -52,7 +52,7 @@
[`${this.prefixCls}-row-highlight`]: this.objData[_index] && this.objData[_index]._isHighlight,
[`${this.prefixCls}-row-hover`]: this.objData[_index] && this.objData[_index]._isHover
}
]
];
},
rowChecked (_index) {
return this.objData[_index] && this.objData[_index]._isChecked;
@ -70,5 +70,5 @@
this.$parent.highlightCurrentRow(_index);
}
}
}
</script>
};
</script>

View file

@ -58,7 +58,6 @@
import Poptip from '../poptip/poptip.vue';
import iButton from '../button/button.vue';
import Mixin from './mixin';
import { deepCopy } from '../../utils/assist';
export default {
mixins: [ Mixin ],
@ -97,7 +96,7 @@
{
[`${this.prefixCls}-hidden`]: !this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right')
}
]
];
},
itemClasses (column, item) {
return [
@ -105,7 +104,7 @@
{
[`${this.prefixCls}-filter-select-item-selected`]: column._filterChecked[0] === item.value
}
]
];
},
itemAllClasses (column) {
return [
@ -113,7 +112,7 @@
{
[`${this.prefixCls}-filter-select-item-selected`]: !column._filterChecked.length
}
]
];
},
renderHeader (column, $index) {
if ('renderHeader' in this.columns[$index]) {
@ -145,5 +144,5 @@
this.$parent.handleFilterHide(index);
}
}
}
</script>
};
</script>

View file

@ -83,13 +83,13 @@
data: {
type: Array,
default () {
return []
return [];
}
},
columns: {
type: Array,
default () {
return []
return [];
}
},
size: {
@ -142,7 +142,7 @@
showSlotHeader: true,
showSlotFooter: true,
bodyHeight: 0
}
};
},
computed: {
wrapClasses () {
@ -153,7 +153,7 @@
[`${prefixCls}-with-header`]: this.showSlotHeader,
[`${prefixCls}-with-footer`]: this.showSlotFooter
}
]
];
},
classes () {
return [
@ -164,12 +164,12 @@
[`${prefixCls}-stripe`]: this.stripe,
[`${prefixCls}-with-fixed-top`]: !!this.height
}
]
];
},
styles () {
let style = {};
if (!!this.height) style.height = `${this.height}px`;
if (!!this.width) style.width = `${this.width}px`;
if (this.height) style.height = `${this.height}px`;
if (this.width) style.width = `${this.width}px`;
return style;
},
tableStyle () {
@ -269,7 +269,7 @@
columnsWidth[column._index] = {
width: width
}
};
}
this.columnsWidth = columnsWidth;
}
@ -334,13 +334,13 @@
this.$emit('on-selection-change', selection);
},
fixedHeader () {
if (!!this.height) {
if (this.height) {
this.$nextTick(() => {
const titleHeight = parseInt(getStyle(this.$els.title, 'height')) || 0;
const headerHeight = parseInt(getStyle(this.$els.header, 'height')) || 0;
const footerHeight = parseInt(getStyle(this.$els.footer, 'height')) || 0;
this.bodyHeight = this.height - titleHeight - headerHeight - footerHeight;
})
});
} else {
this.bodyHeight = 0;
}
@ -584,5 +584,5 @@
this.fixedHeader();
}
}
}
</script>
};
</script>

View file

@ -26,7 +26,7 @@
return {
prefixCls: prefixCls,
show: true
}
};
},
computed: {
@ -47,5 +47,5 @@
this.updateNav();
}
}
}
</script>
};
</script>

View file

@ -58,7 +58,7 @@
navList: [],
barWidth: 0,
barOffset: 0
}
};
},
computed: {
classes () {
@ -69,7 +69,7 @@
[`${prefixCls}-mini`]: this.size === 'small' && this.type === 'line',
[`${prefixCls}-no-animation`]: !this.animated
}
]
];
},
contentClasses () {
return [
@ -77,7 +77,7 @@
{
[`${prefixCls}-content-animated`]: this.animated
}
]
];
},
barClasses () {
return [
@ -85,17 +85,17 @@
{
[`${prefixCls}-ink-bar-animated`]: this.animated
}
]
];
},
contentStyle () {
const x = this.navList.findIndex((nav, index) => nav.key === this.activeKey);
const x = this.navList.findIndex((nav) => nav.key === this.activeKey);
const p = x === 0 ? '0%' : `-${x}00%`;
let style = {};
if (x > -1) {
style = {
transform: `translateX(${p}) translateZ(0px)`
}
};
}
return style;
},
@ -137,7 +137,7 @@
},
updateBar () {
this.$nextTick(() => {
const index = this.navList.findIndex((nav, index) => nav.key === this.activeKey);
const index = this.navList.findIndex((nav) => nav.key === this.activeKey);
const prevTabs = this.$els.nav.querySelectorAll(`.${prefixCls}-tab`);
const tab = prevTabs[index];
this.barWidth = parseFloat(getStyle(tab, 'width'));
@ -166,7 +166,7 @@
[`${prefixCls}-tab-disabled`]: item.disabled,
[`${prefixCls}-tab-active`]: item.key === this.activeKey
}
]
];
},
handleChange (index) {
const nav = this.navList[index];
@ -210,5 +210,5 @@
this.updateBar();
}
}
}
</script>
};
</script>

View file

@ -30,7 +30,7 @@
data () {
return {
closed: false
}
};
},
computed: {
classes () {
@ -41,7 +41,7 @@
[`${prefixCls}-${this.type}`]: !!this.type,
[`${prefixCls}-closable`]: this.closable
}
]
];
},
textClasses () {
return `${prefixCls}-text`;
@ -59,5 +59,5 @@
this.$emit('on-close', e);
}
}
}
</script>
};
</script>

View file

@ -20,7 +20,7 @@
data () {
return {
dot: false
}
};
},
ready () {
this.dot = this.$els.dot.innerHTML.length ? true : false;
@ -39,7 +39,7 @@
[`${prefixCls}-item-head-custom`]: this.dot,
[`${prefixCls}-item-head-${this.color}`]: this.headColorShow
}
]
];
},
headColorShow () {
return this.color == 'blue' || this.color == 'red' || this.color == 'green';
@ -51,7 +51,7 @@
style = {
'color': this.color,
'border-color': this.color
}
};
}
}
@ -61,5 +61,5 @@
return `${prefixCls}-item-content`;
}
}
}
</script>
};
</script>

View file

@ -20,8 +20,8 @@
{
[`${prefixCls}-pending`]: this.pending
}
]
];
}
}
}
</script>
};
</script>

View file

@ -46,7 +46,7 @@
data () {
return {
prefixCls: prefixCls
}
};
},
methods: {
handleShowPopper() {
@ -61,5 +61,5 @@
}
}
}
}
};
</script>

View file

@ -50,7 +50,7 @@
showItems: [],
query: '',
showFooter: true
}
};
},
computed: {
classes () {
@ -59,7 +59,7 @@
{
[`${this.prefixCls}-with-footer`]: this.showFooter
}
]
];
},
bodyClasses () {
return [
@ -68,7 +68,7 @@
[`${this.prefixCls}-body-with-search`]: this.filterable,
[`${this.prefixCls}-body-with-footer`]: this.showFooter
}
]
];
},
count () {
const validKeysCount = this.validKeysCount;
@ -88,7 +88,7 @@
{
[`${this.prefixCls}-content-item-disabled`]: item.disabled
}
]
];
},
showLabel (item) {
return this.renderFormat(item);
@ -125,5 +125,5 @@
this.updateFilteredData();
}
}
}
};
</script>

View file

@ -28,5 +28,5 @@
this.$parent.moveTo('right');
}
}
}
};
</script>

View file

@ -29,5 +29,5 @@
this.query = '';
}
}
}
</script>
};
</script>

View file

@ -47,7 +47,7 @@
data: {
type: Array,
default () {
return []
return [];
}
},
renderFormat: {
@ -59,31 +59,31 @@
targetKeys: {
type: Array,
default () {
return []
return [];
}
},
selectedKeys: {
type: Array,
default () {
return []
return [];
}
},
listStyle: {
type: Object,
default () {
return {}
return {};
}
},
titles: {
type: Array,
default () {
return ['源列表', '目的列表']
return ['源列表', '目的列表'];
}
},
operations: {
type: Array,
default () {
return []
return [];
}
},
filterable: {
@ -113,13 +113,13 @@
rightData: [],
leftCheckedKeys: [],
rightCheckedKeys: []
}
};
},
computed: {
classes () {
return [
`${prefixCls}`
]
];
},
leftValidKeysCount () {
return this.getValidKeys('left').length;
@ -182,5 +182,5 @@
created () {
this.splitData(true);
}
}
</script>
};
</script>

View file

@ -16,4 +16,4 @@ export default {
unbind () {
document.removeEventListener('click', this.documentHandler);
}
}
};

View file

@ -1,5 +1,5 @@
// es6 polyfill
import 'core-js/fn/array/find-index'
import 'core-js/fn/array/find-index';
import Affix from './components/affix';
import Alert from './components/alert';
@ -97,7 +97,7 @@ const iview = {
const install = function (Vue) {
Object.keys(iview).forEach((key) => {
Vue.component(key, iview[key])
Vue.component(key, iview[key]);
});
Vue.prototype.$Loading = LoadingBar;
@ -111,4 +111,4 @@ if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
module.exports = Object.assign(iview, {install});
module.exports = Object.assign(iview, {install}); // eslint-disable-line no-undef

View file

@ -131,4 +131,4 @@ function deepCopy(data) {
return o;
}
export {deepCopy}
export {deepCopy};

View file

@ -105,4 +105,4 @@ export default function calcTextareaHeight(targetNode, minRows = null, maxRows =
minHeight: `${minHeight}px`,
maxHeight: `${maxHeight}px`
};
};
}