Fixed #4473 - Add ptOptions option to PrimeVue config
parent
234c9a48d2
commit
31c3bdf566
|
@ -471,7 +471,7 @@ export default {
|
||||||
_getPTValue(obj = {}, key = '', params = {}, searchInDefaultPT = true) {
|
_getPTValue(obj = {}, key = '', params = {}, searchInDefaultPT = true) {
|
||||||
const datasetPrefix = 'data-pc-';
|
const datasetPrefix = 'data-pc-';
|
||||||
const searchOut = /./g.test(key) && !!params[key.split('.')[0]];
|
const searchOut = /./g.test(key) && !!params[key.split('.')[0]];
|
||||||
const { mergeSections = true, mergeProps: useMergeProps = false } = this._getPropValue('ptOptions') || {};
|
const { mergeSections = true, mergeProps: useMergeProps = false } = this._getPropValue('ptOptions') || this.$config?.ptOptions || {};
|
||||||
const global = searchInDefaultPT ? (searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params)) : undefined;
|
const global = searchInDefaultPT ? (searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params)) : undefined;
|
||||||
const self = searchOut ? undefined : this._usePT(this._getPT(obj, this.$name), this._getPTClassValue, key, { ...params, global: global || {} });
|
const self = searchOut ? undefined : this._usePT(this._getPT(obj, this.$name), this._getPTClassValue, key, { ...params, global: global || {} });
|
||||||
const datasets = key !== 'transition' && {
|
const datasets = key !== 'transition' && {
|
||||||
|
@ -509,7 +509,7 @@ export default {
|
||||||
const fn = (value) => callback(value, key, params);
|
const fn = (value) => callback(value, key, params);
|
||||||
|
|
||||||
if (pt?.hasOwnProperty('_usept')) {
|
if (pt?.hasOwnProperty('_usept')) {
|
||||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || {};
|
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || this.$config?.ptOptions || {};
|
||||||
const originalValue = fn(pt.originalValue);
|
const originalValue = fn(pt.originalValue);
|
||||||
const value = fn(pt.value);
|
const value = fn(pt.value);
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const BaseDirective = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const datasetPrefix = 'data-pc-';
|
const datasetPrefix = 'data-pc-';
|
||||||
const { mergeSections = true, mergeProps: useMergeProps = false } = instance.binding?.value?.ptOptions || {};
|
const { mergeSections = true, mergeProps: useMergeProps = false } = instance.binding?.value?.ptOptions || instance.$config?.ptOptions || {};
|
||||||
const global = searchInDefaultPT ? BaseDirective._useDefaultPT(instance, instance.defaultPT, getValue, key, params) : undefined;
|
const global = searchInDefaultPT ? BaseDirective._useDefaultPT(instance, instance.defaultPT, getValue, key, params) : undefined;
|
||||||
const self = BaseDirective._usePT(instance, BaseDirective._getPT(obj, instance.$name), getValue, key, { ...params, global: global || {} });
|
const self = BaseDirective._usePT(instance, BaseDirective._getPT(obj, instance.$name), getValue, key, { ...params, global: global || {} });
|
||||||
const datasets = {
|
const datasets = {
|
||||||
|
@ -54,7 +54,7 @@ const BaseDirective = {
|
||||||
const fn = (value) => callback(value, key, params);
|
const fn = (value) => callback(value, key, params);
|
||||||
|
|
||||||
if (pt?.hasOwnProperty('_usept')) {
|
if (pt?.hasOwnProperty('_usept')) {
|
||||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || {};
|
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || instance.$config?.ptOptions || {};
|
||||||
const originalValue = fn(pt.originalValue);
|
const originalValue = fn(pt.originalValue);
|
||||||
const value = fn(pt.value);
|
const value = fn(pt.value);
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ import { OverlayPanelPassThroughOptions } from '../overlaypanel';
|
||||||
import { PaginatorPassThroughOptions } from '../paginator';
|
import { PaginatorPassThroughOptions } from '../paginator';
|
||||||
import { PanelPassThroughOptions } from '../panel';
|
import { PanelPassThroughOptions } from '../panel';
|
||||||
import { PanelMenuPassThroughOptions } from '../panelmenu';
|
import { PanelMenuPassThroughOptions } from '../panelmenu';
|
||||||
|
import { PassThroughOptions } from '../passthrough';
|
||||||
import { PasswordPassThroughOptions } from '../password';
|
import { PasswordPassThroughOptions } from '../password';
|
||||||
import { PickListPassThroughOptions } from '../picklist';
|
import { PickListPassThroughOptions } from '../picklist';
|
||||||
import { ProgressBarPassThroughOptions } from '../progressbar';
|
import { ProgressBarPassThroughOptions } from '../progressbar';
|
||||||
|
@ -102,6 +103,7 @@ export interface PrimeVueConfiguration {
|
||||||
filterMatchModeOptions?: any;
|
filterMatchModeOptions?: any;
|
||||||
zIndex?: PrimeVueZIndexOptions;
|
zIndex?: PrimeVueZIndexOptions;
|
||||||
pt?: PassThrough<PrimeVuePTOptions>;
|
pt?: PassThrough<PrimeVuePTOptions>;
|
||||||
|
ptOptions?: PassThroughOptions;
|
||||||
unstyled?: boolean;
|
unstyled?: boolean;
|
||||||
csp?: PrimeVueCSPOptions;
|
csp?: PrimeVueCSPOptions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,10 @@ export const defaultOptions = {
|
||||||
tooltip: 1100
|
tooltip: 1100
|
||||||
},
|
},
|
||||||
pt: undefined,
|
pt: undefined,
|
||||||
|
ptOptions: {
|
||||||
|
mergeSections: true,
|
||||||
|
mergeProps: false
|
||||||
|
},
|
||||||
unstyled: false,
|
unstyled: false,
|
||||||
csp: {
|
csp: {
|
||||||
nonce: undefined
|
nonce: undefined
|
||||||
|
|
|
@ -5,12 +5,9 @@
|
||||||
* usePassThrough(pt1, pt2, pt3, pt*, { mergeSections: true });
|
* usePassThrough(pt1, pt2, pt3, pt*, { mergeSections: true });
|
||||||
* usePassThrough(pt1, { mergeSections: true });
|
* usePassThrough(pt1, { mergeSections: true });
|
||||||
*/
|
*/
|
||||||
export const usePassThrough = (pt1 = {}, pt2 = {}, { mergeSections = true, mergeProps = false } = {}) => {
|
export const usePassThrough = (pt1 = {}, pt2 = {}, ptOptions) => {
|
||||||
return {
|
return {
|
||||||
_usept: {
|
_usept: ptOptions,
|
||||||
mergeSections,
|
|
||||||
mergeProps
|
|
||||||
},
|
|
||||||
originalValue: pt1,
|
originalValue: pt1,
|
||||||
value: { ...pt1, ...pt2 }
|
value: { ...pt1, ...pt2 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue