From 2669fd59251c410ce09e512e6780f64aea0210ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 2 Jun 2023 09:52:13 +0300 Subject: [PATCH] Refactor #3965 - For DataTable & Column & ColumnGroup & Row --- components/lib/column/BaseColumn.vue | 191 +++++ components/lib/column/Column.vue | 182 +---- .../lib/columngroup/BaseColumnGroup.vue | 19 + components/lib/columngroup/ColumnGroup.vue | 10 +- components/lib/datatable/BaseDataTable.vue | 741 ++++++++++++++++++ components/lib/datatable/BodyCell.vue | 59 +- components/lib/datatable/ColumnFilter.vue | 96 +-- components/lib/datatable/DataTable.vue | 626 ++------------- components/lib/datatable/FooterCell.vue | 8 +- components/lib/datatable/HeaderCell.vue | 31 +- components/lib/datatable/HeaderCheckbox.vue | 10 +- components/lib/datatable/RowCheckbox.vue | 10 +- components/lib/datatable/RowRadioButton.vue | 8 +- components/lib/datatable/TableBody.vue | 41 +- components/lib/datatable/TableFooter.vue | 2 +- components/lib/datatable/TableHeader.vue | 13 +- 16 files changed, 1127 insertions(+), 920 deletions(-) create mode 100644 components/lib/column/BaseColumn.vue create mode 100644 components/lib/columngroup/BaseColumnGroup.vue create mode 100644 components/lib/datatable/BaseDataTable.vue diff --git a/components/lib/column/BaseColumn.vue b/components/lib/column/BaseColumn.vue new file mode 100644 index 000000000..827985920 --- /dev/null +++ b/components/lib/column/BaseColumn.vue @@ -0,0 +1,191 @@ + diff --git a/components/lib/column/Column.vue b/components/lib/column/Column.vue index f687443d3..0335aa007 100755 --- a/components/lib/column/Column.vue +++ b/components/lib/column/Column.vue @@ -1,187 +1,9 @@ diff --git a/components/lib/columngroup/ColumnGroup.vue b/components/lib/columngroup/ColumnGroup.vue index 2747ea869..ed3c6170b 100755 --- a/components/lib/columngroup/ColumnGroup.vue +++ b/components/lib/columngroup/ColumnGroup.vue @@ -1,15 +1,9 @@ diff --git a/components/lib/datatable/BodyCell.vue b/components/lib/datatable/BodyCell.vue index 36b182588..2aacba596 100755 --- a/components/lib/datatable/BodyCell.vue +++ b/components/lib/datatable/BodyCell.vue @@ -2,8 +2,20 @@ - - {{ columnProp('header') }} + + {{ columnProp('header') }} @@ -331,7 +345,7 @@ export default { if (element) { let cell = element; - while (cell && !DomHandler.hasClass(cell, 'p-cell-editing')) { + while (cell && !DomHandler.getAttribute(cell, 'data-p-cell-editing')) { cell = cell.parentElement; } @@ -352,7 +366,7 @@ export default { } if (prevCell) { - if (DomHandler.hasClass(prevCell, 'p-editable-column')) return prevCell; + if (DomHandler.getAttribute(prevCell, 'data-p-editable-column')) return prevCell; else return this.findPreviousEditableColumn(prevCell); } else { return null; @@ -370,7 +384,7 @@ export default { } if (nextCell) { - if (DomHandler.hasClass(nextCell, 'p-editable-column')) return nextCell; + if (DomHandler.getAttribute(nextCell, 'data-p-editable-column')) return nextCell; else return this.findNextEditableColumn(nextCell); } else { return null; @@ -443,16 +457,7 @@ export default { return this.columnProp('field'); }, containerClass() { - return [ - this.columnProp('bodyClass'), - this.columnProp('class'), - { - 'p-selection-column': this.columnProp('selectionMode') != null, - 'p-editable-column': this.isEditable(), - 'p-cell-editing': this.d_editing, - 'p-frozen-column': this.columnProp('frozen') - } - ]; + return [this.columnProp('bodyClass'), this.columnProp('class'), this.cx('bodyCell')]; }, containerStyle() { let bodyStyle = this.columnProp('bodyStyle'); diff --git a/components/lib/datatable/ColumnFilter.vue b/components/lib/datatable/ColumnFilter.vue index d2eb3bcc9..4ef4db8ab 100644 --- a/components/lib/datatable/ColumnFilter.vue +++ b/components/lib/datatable/ColumnFilter.vue @@ -1,25 +1,24 @@