diff --git a/components/lib/treetable/BodyCell.vue b/components/lib/treetable/BodyCell.vue index 0c0b047de..a2b9166e5 100644 --- a/components/lib/treetable/BodyCell.vue +++ b/components/lib/treetable/BodyCell.vue @@ -1,22 +1,22 @@ @@ -74,6 +74,10 @@ export default { templates: { type: Object, default: null + }, + index: { + type: Number, + default: null } }, data() { @@ -99,16 +103,24 @@ export default { columnProp(prop) { return ObjectUtils.getVNodeProp(this.column, prop); }, - getColumnPTOptions(key) { - return this.ptmo(this.getColumnProp(), key, { + getColumnPT(key) { + const columnMetaData = { props: this.column.props, parent: { props: this.$props, state: this.$data + }, + context: { + index: this.index } - }); + }; + + return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) }; }, - getColumnCheckboxPTOptions(key) { + getColumnProp() { + return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo + }, + getColumnCheckboxPT(key) { return this.ptmo(this.getColumnProp(), key, { props: this.column.props, parent: { @@ -122,9 +134,6 @@ export default { } }); }, - getColumnProp() { - return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo - }, updateStickyPosition() { if (this.columnProp('frozen')) { let align = this.columnProp('alignFrozen'); diff --git a/components/lib/treetable/FooterCell.vue b/components/lib/treetable/FooterCell.vue index 6f2e60552..7708f9bfa 100644 --- a/components/lib/treetable/FooterCell.vue +++ b/components/lib/treetable/FooterCell.vue @@ -1,5 +1,5 @@ @@ -58,6 +58,10 @@ export default { sortMode: { type: String, default: 'single' + }, + index: { + type: Number, + default: null } }, data() { @@ -79,14 +83,19 @@ export default { columnProp(prop) { return ObjectUtils.getVNodeProp(this.column, prop); }, - getColumnPTOptions(key) { - return this.ptmo(this.getColumnProp(), key, { + getColumnPT(key) { + const columnMetaData = { props: this.column.props, parent: { props: this.$props, state: this.$data + }, + context: { + index: this.index } - }); + }; + + return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) }; }, getColumnProp() { return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo: diff --git a/components/lib/treetable/TreeTable.d.ts b/components/lib/treetable/TreeTable.d.ts index 655fce3b9..3b3906813 100755 --- a/components/lib/treetable/TreeTable.d.ts +++ b/components/lib/treetable/TreeTable.d.ts @@ -8,6 +8,7 @@ * */ import { VNode } from 'vue'; +import { ColumnPassThroughOptionType } from '../column'; import { PaginatorPassThroughOptionType } from '../paginator'; import { TreeNode } from '../tree'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; @@ -282,6 +283,10 @@ export interface TreeTablePassThroughOptions { * Uses to pass attributes to the hidden input's DOM element. */ hiddenInput?: TreeTablePassThroughOptionType; + /** + * Uses to pass attributes to the Column helper components. + */ + column?: ColumnPassThroughOptionType; } /** diff --git a/components/lib/treetable/TreeTable.vue b/components/lib/treetable/TreeTable.vue index 62f0eb8df..98c86a785 100755 --- a/components/lib/treetable/TreeTable.vue +++ b/components/lib/treetable/TreeTable.vue @@ -60,6 +60,7 @@ :sortMode="sortMode" @column-click="onColumnHeaderClick" @column-resizestart="onColumnResizeStart" + :index="i" :pt="pt" > @@ -67,7 +68,7 @@ @@ -103,7 +104,7 @@ diff --git a/components/lib/treetable/TreeTableRow.vue b/components/lib/treetable/TreeTableRow.vue index 4bbfe283f..e426c96c9 100755 --- a/components/lib/treetable/TreeTableRow.vue +++ b/components/lib/treetable/TreeTableRow.vue @@ -32,6 +32,7 @@ :templates="templates" @node-toggle="$emit('node-toggle', $event)" @checkbox-toggle="toggleCheckbox" + :index="i" :pt="pt" >