diff --git a/components/lib/column/Column.d.ts b/components/lib/column/Column.d.ts index 7c26663b4..b96c57476 100755 --- a/components/lib/column/Column.d.ts +++ b/components/lib/column/Column.d.ts @@ -594,6 +594,21 @@ export interface ColumnContext { * @defaultValue false */ disabled: boolean; + /** + * Current sort state of the column as a boolean. + * @defaultValue false + */ + sorted: boolean; + /** + * Current frozen state of the column as a boolean. + * @defaultValue false + */ + frozen: boolean; + /** + * Current resizable state of the column as a boolean. + * @defaultValue false + */ + resizable: boolean; } /** diff --git a/components/lib/treetable/BodyCell.vue b/components/lib/treetable/BodyCell.vue index d7eb23d5f..f23fe05f9 100644 --- a/components/lib/treetable/BodyCell.vue +++ b/components/lib/treetable/BodyCell.vue @@ -113,7 +113,10 @@ export default { state: this.$data }, context: { - index: this.index + index: this.index, + selectable: this.$parentInstance.rowHover || this.$parentInstance.rowSelectionMode, + selected: this.$parent.selected, + frozen: this.columnProp('frozen') } }; diff --git a/components/lib/treetable/FooterCell.vue b/components/lib/treetable/FooterCell.vue index 8be494d6c..4d5bed7e7 100644 --- a/components/lib/treetable/FooterCell.vue +++ b/components/lib/treetable/FooterCell.vue @@ -51,7 +51,8 @@ export default { state: this.$data }, context: { - index: this.index + index: this.index, + frozen: this.columnProp('frozen') } }; diff --git a/components/lib/treetable/HeaderCell.vue b/components/lib/treetable/HeaderCell.vue index f3c50c41d..50c7d53d2 100644 --- a/components/lib/treetable/HeaderCell.vue +++ b/components/lib/treetable/HeaderCell.vue @@ -17,7 +17,7 @@ {{ columnProp('header') }} - + {{ getMultiSortMetaIndex() + 1 }} @@ -93,7 +93,10 @@ export default { state: this.$data }, context: { - index: this.index + index: this.index, + sorted: this.isColumnSorted(), + frozen: this.columnProp('frozen'), + resizable: this.resizableColumns } }; diff --git a/components/lib/treetable/TreeTable.d.ts b/components/lib/treetable/TreeTable.d.ts index 1ad480491..cfe9c8ed0 100755 --- a/components/lib/treetable/TreeTable.d.ts +++ b/components/lib/treetable/TreeTable.d.ts @@ -23,6 +23,7 @@ export interface TreeTablePassThroughMethodOptions { instance: any; props: TreeTableProps; state: TreeTableState; + context: TreeTableContext; } /** @@ -213,14 +214,6 @@ export interface TreeTablePassThroughOptions { * Uses to pass attributes to the header row's DOM element. */ headerRow?: TreeTablePassThroughOptionType; - /** - * Uses to pass attributes to the header filter row's DOM element. - */ - headerFilterRow?: TreeTablePassThroughOptionType; - /** - * Uses to pass attributes to the header filter cell's DOM element. - */ - headerFilterCell?: TreeTablePassThroughOptionType; /** * Uses to pass attributes to the tbody's DOM element. */ @@ -330,6 +323,31 @@ export interface TreeTableState { d_editing: boolean; } +/** + * Defines current options in TreeTable component. + */ +export interface TreeTableContext { + /** + * Current index state of the item. + */ + index: number; + /** + * Current frozen state of the row as a boolean. + * @defaultValue false + */ + frozen: boolean; + /** + * Current selectable state of the row as a boolean. + * @defaultValue false + */ + selectable: boolean; + /** + * Current selected state of the row as a boolean. + * @defaultValue false + */ + selected: boolean; +} + /** * Defines valid properties in TreeTable component. */ diff --git a/components/lib/treetable/TreeTable.vue b/components/lib/treetable/TreeTable.vue index 117a60930..03182622c 100755 --- a/components/lib/treetable/TreeTable.vue +++ b/components/lib/treetable/TreeTable.vue @@ -65,9 +65,9 @@ > - + @@ -231,6 +231,13 @@ export default { columnProp(col, prop) { return ObjectUtils.getVNodeProp(col, prop); }, + ptHeaderCellOptions(column) { + return { + context: { + frozen: this.columnProp(column, 'frozen') + } + }; + }, onNodeToggle(node) { const key = node.key; diff --git a/components/lib/treetable/TreeTableRow.vue b/components/lib/treetable/TreeTableRow.vue index 212177c49..55bed4dbd 100755 --- a/components/lib/treetable/TreeTableRow.vue +++ b/components/lib/treetable/TreeTableRow.vue @@ -14,7 +14,7 @@ @click="onClick" @keydown="onKeyDown" @touchend="onTouchEnd" - v-bind="ptm('row')" + v-bind="ptm('row', ptmOptions)" :data-p-highlight="selected" >