From cf556c5d3d42ed0edf2e5c6f1d329fbdd37d0120 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Thu, 17 Oct 2019 17:17:27 +0300 Subject: [PATCH] Fixed lints --- src/components/columngroup/ColumnGroup.vue | 6 ++--- src/components/datatable/DataTable.vue | 27 +++++++++----------- src/views/datatable/DataTableDoc.vue | 10 +++----- src/views/datatable/DataTableReorderDemo.vue | 4 +-- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/components/columngroup/ColumnGroup.vue b/src/components/columngroup/ColumnGroup.vue index 5a81bd6d7..25ffa033d 100644 --- a/src/components/columngroup/ColumnGroup.vue +++ b/src/components/columngroup/ColumnGroup.vue @@ -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; } } } diff --git a/src/components/datatable/DataTable.vue b/src/components/datatable/DataTable.vue index 11f232e54..59c52d41e 100644 --- a/src/components/datatable/DataTable.vue +++ b/src/components/datatable/DataTable.vue @@ -23,7 +23,7 @@ - - - + + @@ -630,8 +630,7 @@ data() {

Column Reorder

-

Columns can be reordered using drag drop by setting the reorderableColumns to true. column-reorder 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.

+

Columns can be reordered using drag drop by setting the reorderableColumns to true. column-reorder 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.

@@ -1001,7 +1001,7 @@ export default { event.preventDefault(); return; } - + this.colReorderIconWidth = DomHandler.getHiddenElementOuterWidth(this.$refs.reorderIndicatorUp); this.colReorderIconHeight = DomHandler.getHiddenElementOuterHeight(this.$refs.reorderIndicatorUp); @@ -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'; @@ -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'; } @@ -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); @@ -1064,7 +1064,7 @@ export default { dropIndex: dropIndex }); } - + this.$refs.reorderIndicatorUp.style.display = 'none'; this.$refs.reorderIndicatorDown.style.display = 'none'; this.draggedColumn.draggable = false; @@ -1094,7 +1094,7 @@ export default { } } } - + return null; }, onRowMouseDown(event) { @@ -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'); @@ -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'); } @@ -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]; @@ -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) { @@ -1207,7 +1205,6 @@ export default { })]; } } - return columns; }, headerColumnGroup() { diff --git a/src/views/datatable/DataTableDoc.vue b/src/views/datatable/DataTableDoc.vue index fa723fb00..9386cbf21 100644 --- a/src/views/datatable/DataTableDoc.vue +++ b/src/views/datatable/DataTableDoc.vue @@ -246,8 +246,8 @@ export default {
reorderableColumnstringnullbooleantrue Defines if the column itself can be reordered with dragging.