diff --git a/.eslintrc.js b/.eslintrc.js index 632d8b39d..dc55acfa9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,15 @@ module.exports = { - extends: [ - 'plugin:vue/recommended', - '@vue/standard' - ] -} \ No newline at end of file + extends: ['plugin:vue/recommended', '@vue/standard'], + rules: { + 'vue/max-attributes-per-line': [ + 2, + { + singleline: 20, + multiline: { + max: 1, + allowFirstLine: false + } + } + ] + } +} diff --git a/demo/documentation/components/advancedTable/enUS/basic.md b/demo/documentation/components/advancedTable/enUS/basic.md index ad5a27a46..873bfdb8d 100644 --- a/demo/documentation/components/advancedTable/enUS/basic.md +++ b/demo/documentation/components/advancedTable/enUS/basic.md @@ -1,4 +1,5 @@ # Basic + ```html -
+
``` + ```js const items = [ { @@ -56,20 +55,21 @@ const sex = [ value: 'female' } ] -const _columns3 = ($this) => { +const _columns3 = $this => { return [ { type: 'selection', - disabled (params, index) { + disabled(params, index) { return params.row.age < 8 } + // fixed: 'left' }, { title: 'Name', key: 'name', sortable: true, width: 300, - renderHeader(h,column){ + renderHeader(h, column) { return {column.title} } }, @@ -77,7 +77,7 @@ const _columns3 = ($this) => { title: 'Age', key: 'age', sortable: true, - sorter (a, b) { + sorter(a, b) { return a.age - b.age }, // filterMultiple: true, @@ -102,7 +102,7 @@ const _columns3 = ($this) => { return values.includes(record.sex) }, filterMultiple: true, - asyncFilterItems () { + asyncFilterItems() { return new Promise((resolve, reject) => { setTimeout(() => { Math.random() > 0.6 @@ -114,6 +114,8 @@ const _columns3 = ($this) => { }, { title: '#', + fixed: 'right', + width: 200, render: (h, params) => { return ( { } export default { components: {}, - data () { + data() { const columns = _columns3(this) return { @@ -156,30 +158,30 @@ export default { } } }, - mounted () { + mounted() { this.data = this.getData() // data一定要先有值才可以再selectRow this.$refs.table.selectRow([1, 2, 5]) // this.$refs.table.selectRow('all') // 可以全选当前展示数据 }, methods: { - clearSelect () { + clearSelect() { this.$refs.table.clearSelect() }, - batchDelete () { - this.selectedRow.forEach((item) => { + batchDelete() { + this.selectedRow.forEach(item => { let index = item._index this.data[index] = null }) - this.data = this.data.filter((item) => item !== null) + this.data = this.data.filter(item => item !== null) }, - computeRowcls (params) { + computeRowcls(params) { if (params.row.age > 15) { return 'age-too-old' } return '' }, - handleDelete (params) { + handleDelete(params) { let index = params._index this.data.splice(index, 1) this.$NMessage.success('Delete successfully,', { duration: 2000 }) @@ -187,7 +189,7 @@ export default { duration: 4000 }) }, - getData (args) { + getData(args) { let d = new Array(20).fill(0) d = d.map((item, idx) => { return { @@ -198,11 +200,11 @@ export default { }) return d }, - onSelectedChange (selectedRow) { + onSelectedChange(selectedRow) { console.log(selectedRow) this.selectedRow = selectedRow }, - onChange (args) { + onChange(args) { /** * "filter": { "age": { @@ -236,7 +238,7 @@ export default { } */ }, - clear () { + clear() { // 清除所有的Filter选项,会触发onchange事件 this.$refs.table.setParams({}) this.$NMessage.info('clear all filters', { duration: 5000 }) @@ -244,8 +246,9 @@ export default { } } ``` + ```css .age-too-old { color: rgba(255, 255, 255, 0.3); } -``` \ No newline at end of file +``` diff --git a/packages/common/AdvanceTable/body/body.vue b/packages/common/AdvanceTable/body/body.vue new file mode 100644 index 000000000..e69de29bb diff --git a/packages/common/AdvanceTable/header/header.vue b/packages/common/AdvanceTable/header/header.vue new file mode 100644 index 000000000..90601ce45 --- /dev/null +++ b/packages/common/AdvanceTable/header/header.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/packages/common/AdvanceTable/sortIcon/index.vue b/packages/common/AdvanceTable/sortIcon/index.vue index ea8a111e9..69fe6cb62 100644 --- a/packages/common/AdvanceTable/sortIcon/index.vue +++ b/packages/common/AdvanceTable/sortIcon/index.vue @@ -22,7 +22,7 @@