Skip to content

Commit

Permalink
Fixed #5105 - Highlight state changes on Checkbox selection mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jan 18, 2024
1 parent 7b7eb3d commit 19f9813
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions components/lib/datatable/BaseDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ export default {
type: Boolean,
default: false
},
highlightOnSelect: {
type: Boolean,
default: false
},
size: {
type: String,
default: null
Expand Down
2 changes: 1 addition & 1 deletion components/lib/datatable/style/DataTableStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const classes = {

if (props.selection) {
rowStyleClass.push({
'p-highlight': instance.isSelected
'p-highlight': instance.isSelected && instance.$parentInstance.$parentInstance.highlightOnSelect
});
}

Expand Down
4 changes: 4 additions & 0 deletions components/lib/multiselect/BaseMultiSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export default {
type: Boolean,
default: false
},
highlightOnSelect: {
type: Boolean,
default: false
},
filterMessage: {
type: String,
default: null
Expand Down
4 changes: 2 additions & 2 deletions components/lib/multiselect/style/MultiSelectStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ const classes = {
wrapper: 'p-multiselect-items-wrapper',
list: 'p-multiselect-items p-component',
itemGroup: 'p-multiselect-item-group',
item: ({ instance, option, index, getItemOptions }) => [
item: ({ instance, option, index, getItemOptions, props }) => [
'p-multiselect-item',
{
'p-highlight': instance.isSelected(option),
'p-highlight': instance.isSelected(option) && props.highlightOnSelect,
'p-focus': instance.focusedOptionIndex === instance.getOptionIndex(index, getItemOptions),
'p-disabled': instance.isOptionDisabled(option)
}
Expand Down
4 changes: 4 additions & 0 deletions components/lib/tree/BaseTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default {
type: String,
default: undefined
},
highlightOnSelect: {
type: Boolean,
default: false
},
scrollHeight: {
type: String,
default: null
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tree/style/TreeStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const classes = {
instance.node.styleClass,
{
'p-treenode-selectable': instance.selectable,
'p-highlight': instance.checkboxMode ? instance.checked : instance.selected
'p-highlight': instance.checkboxMode && instance.$parentInstance.highlightOnSelect ? instance.checked : instance.selected
}
],
toggler: 'p-tree-toggler p-link',
Expand Down

0 comments on commit 19f9813

Please sign in to comment.