Fixed #5895 - [nuxt] Could not access pt.
parent
de2560a1cb
commit
4790459a66
|
@ -62,7 +62,7 @@ export default {
|
|||
|
||||
(value || originalValue)?.hooks?.['onBeforeCreate']?.();
|
||||
|
||||
const _useptInConfig = this.$config?.pt?.['_usept'];
|
||||
const _useptInConfig = this.$primevueConfig?.pt?.['_usept'];
|
||||
const originalValueInConfig = _useptInConfig ? this.$primevue?.config?.pt?.originalValue : undefined;
|
||||
const valueInConfig = _useptInConfig ? this.$primevue?.config?.pt?.value : this.$primevue?.config?.pt;
|
||||
|
||||
|
@ -215,7 +215,7 @@ export default {
|
|||
},
|
||||
_getPTValue(obj = {}, key = '', params = {}, searchInDefaultPT = true) {
|
||||
const searchOut = /./g.test(key) && !!params[key.split('.')[0]];
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = this._getPropValue('ptOptions') || this.$config?.ptOptions || {};
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = this._getPropValue('ptOptions') || this.$primevueConfig?.ptOptions || {};
|
||||
const global = searchInDefaultPT ? (searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params)) : undefined;
|
||||
const self = searchOut ? undefined : this._getPTSelf(obj, this._getPTClassValue, key, { ...params, global: global || {} });
|
||||
const datasets = this._getPTDatasets(key);
|
||||
|
@ -268,7 +268,7 @@ export default {
|
|||
const fn = (value) => callback(value, key, params);
|
||||
|
||||
if (pt?.hasOwnProperty('_usept')) {
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || this.$config?.ptOptions || {};
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || this.$primevueConfig?.ptOptions || {};
|
||||
const originalValue = fn(pt.originalValue);
|
||||
const value = fn(pt.value);
|
||||
|
||||
|
@ -313,24 +313,24 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
globalPT() {
|
||||
return this._getPT(this.$config?.pt, undefined, (value) => ObjectUtils.getItemValue(value, { instance: this }));
|
||||
return this._getPT(this.$primevueConfig?.pt, undefined, (value) => ObjectUtils.getItemValue(value, { instance: this }));
|
||||
},
|
||||
defaultPT() {
|
||||
return this._getPT(this.$config?.pt, undefined, (value) => this._getOptionValue(value, this.$name, { ...this.$params }) || ObjectUtils.getItemValue(value, { ...this.$params }));
|
||||
return this._getPT(this.$primevueConfig?.pt, undefined, (value) => this._getOptionValue(value, this.$name, { ...this.$params }) || ObjectUtils.getItemValue(value, { ...this.$params }));
|
||||
},
|
||||
isUnstyled() {
|
||||
return this.unstyled !== undefined ? this.unstyled : this.$config?.unstyled;
|
||||
return this.unstyled !== undefined ? this.unstyled : this.$primevueConfig?.unstyled;
|
||||
},
|
||||
$theme() {
|
||||
return this.$config?.theme;
|
||||
return this.$primevueConfig?.theme;
|
||||
},
|
||||
$style() {
|
||||
return { classes: undefined, inlineStyles: undefined, load: () => {}, loadCSS: () => {}, loadTheme: () => {}, ...(this._getHostInstance(this) || {}).$style, ...this.$options.style };
|
||||
},
|
||||
$styleOptions() {
|
||||
return { nonce: this.$config?.csp?.nonce };
|
||||
return { nonce: this.$primevueConfig?.csp?.nonce };
|
||||
},
|
||||
$config() {
|
||||
$primevueConfig() {
|
||||
return this.$primevue?.config;
|
||||
},
|
||||
$name() {
|
||||
|
|
|
@ -25,7 +25,7 @@ const BaseDirective = {
|
|||
return ObjectUtils.isString(value) || ObjectUtils.isArray(value) ? { class: value } : value;
|
||||
};
|
||||
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = instance.binding?.value?.ptOptions || instance.$config?.ptOptions || {};
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = instance.binding?.value?.ptOptions || instance.$primevueConfig?.ptOptions || {};
|
||||
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 datasets = BaseDirective._getPTDatasets(instance, key);
|
||||
|
@ -60,7 +60,7 @@ const BaseDirective = {
|
|||
const fn = (value) => callback(value, key, params);
|
||||
|
||||
if (pt?.hasOwnProperty('_usept')) {
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || instance.$config?.ptOptions || {};
|
||||
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || instance.$primevueConfig?.ptOptions || {};
|
||||
const originalValue = fn(pt.originalValue);
|
||||
const value = fn(pt.value);
|
||||
|
||||
|
@ -173,12 +173,12 @@ const BaseDirective = {
|
|||
$value: binding?.value,
|
||||
$el: $prevInstance['$el'] || el || undefined,
|
||||
$style: { classes: undefined, inlineStyles: undefined, load: () => {}, loadCSS: () => {}, loadTheme: () => {}, ...options?.style },
|
||||
$config: config,
|
||||
$primevueConfig: config,
|
||||
$attrSelector: el.$attrSelector,
|
||||
/* computed instance variables */
|
||||
defaultPT: () => BaseDirective._getPT(config?.pt, undefined, (value) => value?.directives?.[name]),
|
||||
isUnstyled: () => (el.$instance?.$binding?.value?.unstyled !== undefined ? el.$instance?.$binding?.value?.unstyled : config?.unstyled),
|
||||
theme: () => el.$instance?.$config?.theme,
|
||||
theme: () => el.$instance?.$primevueConfig?.theme,
|
||||
preset: () => el.$instance?.$binding?.value?.dt,
|
||||
/* instance's methods */
|
||||
ptm: (key = '', params = {}) => BaseDirective._getPTValue(el.$instance, el.$instance?.$binding?.value?.pt, key, { ...params }),
|
||||
|
@ -201,11 +201,11 @@ const BaseDirective = {
|
|||
const watchers = el.$instance?.watch;
|
||||
|
||||
// for 'config'
|
||||
watchers?.['config']?.call(el.$instance, el.$instance?.$config);
|
||||
watchers?.['config']?.call(el.$instance, el.$instance?.$primevueConfig);
|
||||
PrimeVueService.on('config:change', ({ newValue, oldValue }) => watchers?.['config']?.call(el.$instance, newValue, oldValue));
|
||||
|
||||
// for 'config.ripple'
|
||||
watchers?.['config.ripple']?.call(el.$instance, el.$instance?.$config?.ripple);
|
||||
watchers?.['config.ripple']?.call(el.$instance, el.$instance?.$primevueConfig?.ripple);
|
||||
PrimeVueService.on('config:ripple:change', ({ newValue, oldValue }) => watchers?.['config.ripple']?.call(el.$instance, newValue, oldValue));
|
||||
};
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ export default {
|
|||
};
|
||||
},
|
||||
beforeMount() {
|
||||
VirtualScrollerStyle.loadCSS({ nonce: this.$config?.csp?.nonce });
|
||||
VirtualScrollerStyle.loadCSS({ nonce: this.$primevueConfig?.csp?.nonce });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue