Skip to content

Commit

Permalink
Fixed lints
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Oct 17, 2019
1 parent 772eb9e commit cf556c5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/components/columngroup/ColumnGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export default {
},
data() {
return {
_rows: null
children: null
};
},
mounted() {
this._rows = this.$children;
this.children = this.$children;
},
computed: {
rows() {
return this._rows;
return this.children;
}
}
}
Expand Down
27 changes: 12 additions & 15 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<table ref="table">
<thead class="p-datatable-thead">
<tr v-if="!headerColumnGroup">
<th v-for="(col,i) of columns" :key="col.columnKey||col.field||i" :style="col.headerStyle" :class="getColumnHeaderClass(col)"
<th v-for="(col,i) of columns" :key="col.columnKey||col.field||i" :style="col.headerStyle" :class="getColumnHeaderClass(col)"
@click="onColumnHeaderClick($event, col)" @mousedown="onColumnHeaderMouseDown($event, col)"
@dragstart="onColumnHeaderDragStart($event)" @dragover="onColumnHeaderDragOver($event)" @dragleave="onColumnHeaderDragLeave($event)" @drop="onColumnHeaderDrop($event)"
:colspan="col.colspan" :rowspan="col.rowspan">
Expand Down Expand Up @@ -1001,7 +1001,7 @@ export default {
event.preventDefault();
return;
}
this.colReorderIconWidth = DomHandler.getHiddenElementOuterWidth(this.$refs.reorderIndicatorUp);
this.colReorderIconHeight = DomHandler.getHiddenElementOuterHeight(this.$refs.reorderIndicatorUp);
Expand All @@ -1014,11 +1014,11 @@ export default {
event.preventDefault();
let containerOffset = DomHandler.getOffset(this.$el);
let dropHeaderOffset = DomHandler.getOffset(dropHeader);
if (this.draggedColumn !== dropHeader) {
let targetLeft = dropHeaderOffset.left - containerOffset.left;
let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
this.$refs.reorderIndicatorUp.style.top = dropHeaderOffset.top - containerOffset.top - (this.colReorderIconHeight - 1) + 'px';
this.$refs.reorderIndicatorDown.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px';
Expand All @@ -1032,7 +1032,7 @@ export default {
this.$refs.reorderIndicatorDown.style.left = (targetLeft - Math.ceil(this.colReorderIconWidth / 2))+ 'px';
this.dropPosition = -1;
}
this.$refs.reorderIndicatorUp.style.display = 'block';
this.$refs.reorderIndicatorDown.style.display = 'block';
}
Expand All @@ -1054,7 +1054,7 @@ export default {
if (allowDrop && ((dropIndex - dragIndex === 1 && this.dropPosition === -1) || (dragIndex - dropIndex === 1 && this.dropPosition === 1))) {
allowDrop = false;
}
if (allowDrop) {
ObjectUtils.reorderArray(this.columnOrder, dragIndex, dropIndex);
Expand All @@ -1064,7 +1064,7 @@ export default {
dropIndex: dropIndex
});
}
this.$refs.reorderIndicatorUp.style.display = 'none';
this.$refs.reorderIndicatorDown.style.display = 'none';
this.draggedColumn.draggable = false;
Expand Down Expand Up @@ -1094,7 +1094,7 @@ export default {
}
}
}
return null;
},
onRowMouseDown(event) {
Expand All @@ -1115,10 +1115,10 @@ export default {
let pageY = event.pageY;
let rowMidY = rowY + DomHandler.getOuterHeight(rowElement) / 2;
let prevRowElement = rowElement.previousElementSibling;
if (pageY < rowMidY) {
DomHandler.removeClass(rowElement, 'p-datatable-dragpoint-bottom');
this.droppedRowIndex = index;
if (prevRowElement)
DomHandler.addClass(prevRowElement, 'p-datatable-dragpoint-bottom');
Expand All @@ -1130,7 +1130,7 @@ export default {
DomHandler.removeClass(prevRowElement, 'p-datatable-dragpoint-bottom');
else
DomHandler.addClass(rowElement, 'p-datatable-dragpoint-top');
this.droppedRowIndex = index + 1;
DomHandler.addClass(rowElement, 'p-datatable-dragpoint-bottom');
}
Expand All @@ -1155,8 +1155,6 @@ export default {
event.currentTarget.draggable = false;
},
onRowDrop(event) {
let rowElement = event.currentTarget;
if (this.droppedRowIndex != null) {
let dropIndex = (this.draggedRowIndex > this.droppedRowIndex) ? this.droppedRowIndex : (this.droppedRowIndex === 0) ? 0 : this.droppedRowIndex - 1;
let processedData = [...this.processedData];
Expand Down Expand Up @@ -1192,7 +1190,7 @@ export default {
if (this.allChildren) {
columns = this.allChildren.filter(child => child.$options._propKeys.indexOf('columnKey') !== -1);
if (this.reorderableColumns && this.columnOrder) {
let orderedColumns = [];
for (let columnKey of this.columnOrder) {
Expand All @@ -1207,7 +1205,6 @@ export default {
})];
}
}
return columns;
},
headerColumnGroup() {
Expand Down
10 changes: 4 additions & 6 deletions src/views/datatable/DataTableDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ export default {
</tr>
<tr>
<td>reorderableColumn</td>
<td>string</td>
<td>null</td>
<td>boolean</td>
<td>true</td>
<td>Defines if the column itself can be reordered with dragging.</td>
</tr>
</tbody>
Expand Down Expand Up @@ -630,8 +630,7 @@ data() {
</CodeHighlight>

<h3>Column Reorder</h3>
<p>Columns can be reordered using drag drop by setting the <i>reorderableColumns</i> to true. <i>column-reorder</i> is a callback that is invoked when a column is reordered.
DataTable keeps the column order state internally using keys that identifies a column using the field property. If the column has no field, use columnKey instead.</p>
<p>Columns can be reordered using drag drop by setting the <i>reorderableColumns</i> to true. <i>column-reorder</i> is a callback that is invoked when a column is reordered. DataTable keeps the column order state internally using keys that identifies a column using the field property. If the column has no field, use columnKey instead.</p>
<CodeHighlight>
<template v-pre>
&lt;DataTable :value="cars" :reorderableColumns="true"&gt;
Expand All @@ -644,8 +643,7 @@ data() {
</CodeHighlight>

<h3>Row Reorder</h3>
<p>Data can be reordered using drag drop by adding a reorder column that will display an icon as a drag handle.
"row-reorder" is a mandatory callback that is invoked when a column is reordered, use this event to update the new order. Note that the reorder icon can be customized using <i>rowReorderIcon</i> of the column component.</p>
<p>Data can be reordered using drag drop by adding a reorder column that will display an icon as a drag handle. "row-reorder" is a mandatory callback that is invoked when a column is reordered, use this event to update the new order. Note that the reorder icon can be customized using <i>rowReorderIcon</i> of the column component.</p>
<CodeHighlight>
<template v-pre>
&lt;DataTable :value="cars" @row-reorder="onRowReorder"&gt;
Expand Down
4 changes: 1 addition & 3 deletions src/views/datatable/DataTableReorderDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export default {
<script>
import CarService from '../../service/CarService';
import DataTableSubMenu from './DataTableSubMenu';
import DataTableDoc from './DataTableDoc';
export default {
data() {
Expand All @@ -96,7 +95,7 @@ export default {
this.carService.getCarsSmall().then(data => this.cars = data);
},
methods: {
onColReorder(event) {
onColReorder() {
this.$toast.add({severity:'success', summary: 'Column Reordered', life: 3000});
},
onRowReorder(event) {
Expand All @@ -105,7 +104,6 @@ export default {
}
},
components: {
'DataTableDoc': DataTableDoc,
'DataTableSubMenu': DataTableSubMenu
}
}
Expand Down

0 comments on commit cf556c5

Please sign in to comment.