From 4455d6ec5987c4f4034028ab01ba7a3e26d7ea6c Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 13 May 2024 17:26:45 +0300 Subject: [PATCH] Remove .p-unselectable-text --- components/lib/base/style/BaseStyle.js | 4 ---- components/lib/datatable/DataTable.vue | 4 ++-- components/lib/dialog/Dialog.vue | 4 ++-- components/lib/treetable/HeaderCell.vue | 2 +- components/lib/treetable/TreeTable.vue | 9 +++++---- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/components/lib/base/style/BaseStyle.js b/components/lib/base/style/BaseStyle.js index 5f812832a..09ede7df8 100644 --- a/components/lib/base/style/BaseStyle.js +++ b/components/lib/base/style/BaseStyle.js @@ -7,10 +7,6 @@ const theme = ({ dt }) => ` box-sizing: border-box; } -.p-unselectable-text { - user-select: none; -} - /* Non vue overlay animations */ .p-connected-overlay { opacity: 0; diff --git a/components/lib/datatable/DataTable.vue b/components/lib/datatable/DataTable.vue index c27ac8c9d..f93363a29 100755 --- a/components/lib/datatable/DataTable.vue +++ b/components/lib/datatable/DataTable.vue @@ -1231,7 +1231,7 @@ export default { let containerLeft = DomHandler.getOffset(this.$el).left; this.$el.setAttribute('data-p-unselectable-text', 'true'); - !this.isUnstyled && DomHandler.addClass(this.$el, 'p-unselectable-text'); + !this.isUnstyled && DomHandler.addStyles(this.$el, { 'user-select': 'none' }); this.$refs.resizeHelper.style.height = this.$el.offsetHeight + 'px'; this.$refs.resizeHelper.style.top = 0 + 'px'; this.$refs.resizeHelper.style.left = event.pageX - containerLeft + this.$el.scrollLeft + 'px'; @@ -1281,7 +1281,7 @@ export default { this.$refs.resizeHelper.style.display = 'none'; this.resizeColumn = null; this.$el.removeAttribute('data-p-unselectable-text'); - !this.isUnstyled && DomHandler.removeClass(this.$el, 'p-unselectable-text'); + !this.isUnstyled && (this.$el.style['user-select'] = ''); this.unbindColumnResizeEvents(); diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index e7e5d0fd7..5bc773a4e 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -307,7 +307,7 @@ export default { this.container.style.margin = '0'; document.body.setAttribute('data-p-unselectable-text', 'true'); - !this.isUnstyled && DomHandler.addClass(document.body, 'p-unselectable-text'); + !this.isUnstyled && DomHandler.addStyles(document.body, { 'user-select': 'none' }); } }, bindGlobalListeners() { @@ -374,7 +374,7 @@ export default { if (this.dragging) { this.dragging = false; document.body.removeAttribute('data-p-unselectable-text'); - !this.isUnstyled && DomHandler.removeClass(document.body, 'p-unselectable-text'); + !this.isUnstyled && (document.body.style['user-select'] = ''); this.$emit('dragend', event); } diff --git a/components/lib/treetable/HeaderCell.vue b/components/lib/treetable/HeaderCell.vue index 8274891d2..0662bd32d 100644 --- a/components/lib/treetable/HeaderCell.vue +++ b/components/lib/treetable/HeaderCell.vue @@ -13,8 +13,8 @@ :data-p-highlight="isColumnSorted()" :data-p-frozen-column="columnProp('frozen')" > +
- {{ columnProp('header') }} diff --git a/components/lib/treetable/TreeTable.vue b/components/lib/treetable/TreeTable.vue index c92e5ad35..215b7cdcb 100755 --- a/components/lib/treetable/TreeTable.vue +++ b/components/lib/treetable/TreeTable.vue @@ -64,8 +64,8 @@ :sortOrder="d_sortOrder" :multiSortMeta="d_multiSortMeta" :sortMode="sortMode" - @column-click="onColumnHeaderClick" - @column-resizestart="onColumnResizeStart" + @column-click="onColumnHeaderClick($event)" + @column-resizestart="onColumnResizeStart($event)" :index="i" :unstyled="unstyled" :pt="pt" @@ -388,6 +388,7 @@ export default { if ( DomHandler.getAttribute(targetNode, 'data-p-sortable-column') === true || DomHandler.getAttribute(targetNode, 'data-pc-section') === 'columntitle' || + DomHandler.getAttribute(targetNode, 'data-pc-section') === 'columnheadercontent' || DomHandler.getAttribute(targetNode, 'data-pc-section') === 'sorticon' || DomHandler.getAttribute(targetNode.parentElement, 'data-pc-section') === 'sorticon' || DomHandler.getAttribute(targetNode.parentElement.parentElement, 'data-pc-section') === 'sorticon' || @@ -624,7 +625,7 @@ export default { let containerLeft = DomHandler.getOffset(this.$el).left; this.$el.setAttribute('data-p-unselectable-text', 'true'); - !this.isUnstyled && DomHandler.addClass(this.$el, 'p-unselectable-text'); + !this.isUnstyled && DomHandler.addStyles(this.$el, { 'user-select': 'none' }); this.$refs.resizeHelper.style.height = this.$el.offsetHeight + 'px'; this.$refs.resizeHelper.style.top = 0 + 'px'; this.$refs.resizeHelper.style.left = event.pageX - containerLeft + this.$el.scrollLeft + 'px'; @@ -666,7 +667,7 @@ export default { this.$refs.resizeHelper.style.display = 'none'; this.resizeColumn = null; this.$el.removeAttribute('data-p-unselectable-text'); - !this.isUnstyled && DomHandler.removeClass(this.$el, 'p-unselectable-text'); + !this.isUnstyled && (this.$el.style['user-select'] = ''); this.unbindColumnResizeEvents(); },