Fixed #4136 - Improve pt options on components that use helper component
parent
ce96ce96b9
commit
d730a7081c
|
@ -52,6 +52,7 @@ import ChevronDownIcon from 'primevue/icons/chevrondown';
|
|||
import ChevronRightIcon from 'primevue/icons/chevronright';
|
||||
import Ripple from 'primevue/ripple';
|
||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import BaseAccordion from './BaseAccordion.vue';
|
||||
|
||||
export default {
|
||||
|
@ -111,7 +112,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`tab.${key}`, { tab: tabMetaData }), ...this.ptmo(this.getTabProp(tab, 'pt'), key, tabMetaData) };
|
||||
return mergeProps(this.ptm(`tab.${key}`, { tab: tabMetaData }), this.ptm(`accordiontab.${key}`, tabMetaData), this.ptmo(this.getTabProp(tab, 'pt'), key, tabMetaData));
|
||||
},
|
||||
onTabClick(event, tab, index) {
|
||||
this.changeActiveIndex(event, tab, index);
|
||||
|
|
|
@ -455,7 +455,7 @@ export default {
|
|||
|
||||
const datasetPrefix = 'data-pc-';
|
||||
const self = getValue(obj, key, params);
|
||||
const globalPT = searchInDefaultPT ? getValue(this.defaultPT, key, params) : undefined;
|
||||
const globalPT = searchInDefaultPT ? getValue(this.defaultPT, key, params) || (/./g.test(key) && !!params[key.split('.')[0]] ? getValue(this.globalPT, key, params) : undefined) : undefined;
|
||||
const merged = mergeProps(self, globalPT, {
|
||||
...(key === 'root' && { [`${datasetPrefix}name`]: ObjectUtils.toFlatCase(this.$.type.name) }),
|
||||
[`${datasetPrefix}section`]: ObjectUtils.toFlatCase(key)
|
||||
|
@ -489,8 +489,11 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
globalPT() {
|
||||
return ObjectUtils.getItemValue(this.$primevue.config.pt, { instance: this });
|
||||
},
|
||||
defaultPT() {
|
||||
return this._getOptionValue(this.$primevue.config.pt, this.$options.hostName || this.$.type.name, { instance: this });
|
||||
return this._getOptionValue(this.$primevue.config.pt, this.$options.hostName || this.$.type.name, { instance: this }) || this.globalPT;
|
||||
},
|
||||
isUnstyled() {
|
||||
return this.unstyled !== undefined ? this.unstyled : this.$primevue.config.unstyled;
|
||||
|
|
|
@ -86,6 +86,7 @@ import TimesIcon from 'primevue/icons/times';
|
|||
import OverlayEventBus from 'primevue/overlayeventbus';
|
||||
import Ripple from 'primevue/ripple';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import RowCheckbox from './RowCheckbox.vue';
|
||||
import RowRadioButton from './RowRadioButton.vue';
|
||||
|
||||
|
@ -217,7 +218,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
|
||||
export default {
|
||||
name: 'FooterCell',
|
||||
|
@ -54,7 +55,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined;
|
||||
|
|
|
@ -87,6 +87,7 @@ import SortAltIcon from 'primevue/icons/sortalt';
|
|||
import SortAmountDownIcon from 'primevue/icons/sortamountdown';
|
||||
import SortAmountUpAltIcon from 'primevue/icons/sortamountupalt';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import ColumnFilter from './ColumnFilter.vue';
|
||||
import HeaderCheckbox from './HeaderCheckbox.vue';
|
||||
|
||||
|
@ -217,7 +218,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo:
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import FooterCell from './FooterCell.vue';
|
||||
|
||||
export default {
|
||||
|
@ -50,7 +51,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`columnGroup.${key}`, { columnGroup: columnGroupMetaData }), ...this.ptmo(this.getColumnGroupProps(), key, columnGroupMetaData) };
|
||||
return mergeProps(this.ptm(`columnGroup.${key}`, { columnGroup: columnGroupMetaData }), this.ptm(`columnGroup.${key}`, columnGroupMetaData), this.ptmo(this.getColumnGroupProps(), key, columnGroupMetaData));
|
||||
},
|
||||
getColumnGroupProps() {
|
||||
return this.columnGroup && this.columnGroup.props && this.columnGroup.props.pt ? this.columnGroup.props.pt : undefined; //@todo
|
||||
|
@ -67,7 +68,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`row.${key}`, { row: rowMetaData }), ...this.ptmo(this.getRowProp(row), key, rowMetaData) };
|
||||
return mergeProps(this.ptm(`row.${key}`, { row: rowMetaData }), this.ptm(`row.${key}`, rowMetaData), this.ptmo(this.getRowProp(row), key, rowMetaData));
|
||||
},
|
||||
getRowProp(row) {
|
||||
return row.props && row.props.pt ? row.props.pt : undefined; //@todo
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import ColumnFilter from './ColumnFilter.vue';
|
||||
import HeaderCell from './HeaderCell.vue';
|
||||
import HeaderCheckbox from './HeaderCheckbox.vue';
|
||||
|
@ -247,7 +248,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`columnGroup.${key}`, { columnGroup: columnGroupMetaData }), ...this.ptmo(this.getColumnGroupProps(), key, columnGroupMetaData) };
|
||||
return mergeProps(this.ptm(`columnGroup.${key}`, { columnGroup: columnGroupMetaData }), this.ptm(`columnGroup.${key}`, columnGroupMetaData), this.ptmo(this.getColumnGroupProps(), key, columnGroupMetaData));
|
||||
},
|
||||
getColumnGroupProps() {
|
||||
return this.columnGroup && this.columnGroup.props && this.columnGroup.props.pt ? this.columnGroup.props.pt : undefined; //@todo
|
||||
|
@ -264,7 +265,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`row.${key}`, { row: rowMetaData }), ...this.ptmo(this.getRowProp(row), key, rowMetaData) };
|
||||
return mergeProps(this.ptm(`row.${key}`, { row: rowMetaData }), this.ptm(`row.${key}`, rowMetaData), this.ptmo(this.getRowProp(row), key, rowMetaData));
|
||||
},
|
||||
getRowProp(row) {
|
||||
return row.props && row.props.pt ? row.props.pt : undefined; //@todo
|
||||
|
@ -281,7 +282,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(column), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(column), key, columnMetaData));
|
||||
},
|
||||
getColumnProp(column) {
|
||||
return column.props && column.props.pt ? column.props.pt : undefined; //@todo
|
||||
|
|
|
@ -119,6 +119,22 @@ export interface TabPanelContext {
|
|||
* Current index of the tab.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Count of tabs
|
||||
*/
|
||||
count: number;
|
||||
/**
|
||||
* Whether the tab is first.
|
||||
*/
|
||||
first: boolean;
|
||||
/**
|
||||
* Whether the tab is last.
|
||||
*/
|
||||
last: boolean;
|
||||
/**
|
||||
* Whether the tab is active.
|
||||
*/
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
:style="getTabProp(tab, 'headerStyle')"
|
||||
:class="cx('tab.header', { tab, index })"
|
||||
role="presentation"
|
||||
v-bind="{ ...getTabProp(tab, 'headerProps'), ...getTabPT(tab, 'root', index), ...getTabPT(tab, 'header', index) }"
|
||||
data-pc-name="tabpanel"
|
||||
:data-p-highlight="d_activeIndex === index"
|
||||
:data-p-disabled="getTabProp(tab, 'disabled')"
|
||||
:data-pc-index="index"
|
||||
:data-p-active="d_activeIndex === index"
|
||||
v-bind="{ ...getTabProp(tab, 'headerProps'), ...getTabPT(tab, 'root', index), ...getTabPT(tab, 'header', index) }"
|
||||
>
|
||||
<a
|
||||
:id="getTabHeaderActionId(index)"
|
||||
|
@ -76,10 +76,10 @@
|
|||
:class="cx('tab.content', { tab })"
|
||||
role="tabpanel"
|
||||
:aria-labelledby="getTabHeaderActionId(index)"
|
||||
v-bind="{ ...getTabProp(tab, 'contentProps'), ...getTabPT(tab, 'root', index), ...getTabPT(tab, 'content', index) }"
|
||||
data-pc-name="tabpanel"
|
||||
:data-pc-index="index"
|
||||
:data-p-active="d_activeIndex === index"
|
||||
v-bind="{ ...getTabProp(tab, 'contentProps'), ...getTabPT(tab, 'root', index), ...getTabPT(tab, 'content', index) }"
|
||||
>
|
||||
<component :is="tab"></component>
|
||||
</div>
|
||||
|
@ -93,6 +93,7 @@ import ChevronLeftIcon from 'primevue/icons/chevronleft';
|
|||
import ChevronRightIcon from 'primevue/icons/chevronright';
|
||||
import Ripple from 'primevue/ripple';
|
||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
import BaseTabView from './BaseTabView.vue';
|
||||
|
||||
export default {
|
||||
|
@ -146,6 +147,7 @@ export default {
|
|||
return `${this.id}_${index}_content`;
|
||||
},
|
||||
getTabPT(tab, key, index) {
|
||||
const count = this.tabs.length;
|
||||
const tabMetaData = {
|
||||
props: tab.props,
|
||||
parent: {
|
||||
|
@ -153,11 +155,15 @@ export default {
|
|||
state: this.$data
|
||||
},
|
||||
context: {
|
||||
index
|
||||
index,
|
||||
count,
|
||||
first: index === 0,
|
||||
last: index === count - 1,
|
||||
active: this.isTabActive(index)
|
||||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`tab.${key}`, { tab: tabMetaData }), ...this.ptmo(this.getTabProp(tab, 'pt'), key, tabMetaData) };
|
||||
return mergeProps(this.ptm(`tab.${key}`, { tab: tabMetaData }), this.ptm(`tabpanel.${key}`, tabMetaData), this.ptmo(this.getTabProp(tab, 'pt'), key, tabMetaData));
|
||||
},
|
||||
onScroll(event) {
|
||||
this.scrollable && this.updateButtonState();
|
||||
|
|
|
@ -29,6 +29,7 @@ import ChevronRightIcon from 'primevue/icons/chevronright';
|
|||
import MinusIcon from 'primevue/icons/minus';
|
||||
import Ripple from 'primevue/ripple';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
|
||||
export default {
|
||||
name: 'BodyCell',
|
||||
|
@ -116,7 +117,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
|
||||
export default {
|
||||
name: 'FooterCell',
|
||||
|
@ -54,7 +55,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined;
|
||||
|
|
|
@ -29,6 +29,7 @@ import SortAltIcon from 'primevue/icons/sortalt';
|
|||
import SortAmountDownIcon from 'primevue/icons/sortamountdown';
|
||||
import SortAmountUpAltIcon from 'primevue/icons/sortamountupalt';
|
||||
import { DomHandler, ObjectUtils } from 'primevue/utils';
|
||||
import { mergeProps } from 'vue';
|
||||
|
||||
export default {
|
||||
name: 'HeaderCell',
|
||||
|
@ -96,7 +97,7 @@ export default {
|
|||
}
|
||||
};
|
||||
|
||||
return { ...this.ptm(`column.${key}`, { column: columnMetaData }), ...this.ptmo(this.getColumnProp(), key, columnMetaData) };
|
||||
return mergeProps(this.ptm(`column.${key}`, { column: columnMetaData }), this.ptm(`column.${key}`, columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData));
|
||||
},
|
||||
getColumnProp() {
|
||||
return this.column.props && this.column.props.pt ? this.column.props.pt : undefined; //@todo:
|
||||
|
|
Loading…
Reference in New Issue