Fixed #5322 - SplitterPanel: nested context hydration fixed

pull/5323/head
tugcekucukoglu 2024-02-22 15:12:55 +03:00
parent 2e90fe4ed3
commit 68741f54d5
2 changed files with 16 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div :class="cx('root')" :style="sx('root')" :data-p-resizing="false" v-bind="ptmi('root', getPTOptions())"> <div :class="cx('root')" :style="sx('root')" :data-p-resizing="false" v-bind="ptmi('root', getPTOptions)">
<template v-for="(panel, i) of panels" :key="i"> <template v-for="(panel, i) of panels" :key="i">
<component :is="panel" tabindex="-1"></component> <component :is="panel" tabindex="-1"></component>
<div <div
@ -80,13 +80,6 @@ export default {
this.unbindMouseListeners(); this.unbindMouseListeners();
}, },
methods: { methods: {
getPTOptions() {
return {
context: {
nested: DomHandler.getAttribute(this.$parentInstance?.$el, 'data-pc-name') === 'splitterpanel'
}
};
},
isSplitterPanel(child) { isSplitterPanel(child) {
return child.type.name === 'SplitterPanel'; return child.type.name === 'SplitterPanel';
}, },
@ -379,6 +372,13 @@ export default {
}, },
horizontal() { horizontal() {
return this.layout === 'horizontal'; return this.layout === 'horizontal';
},
getPTOptions() {
return {
context: {
nested: this.$parentInstance?.nestedState
}
};
} }
} }
}; };

View File

@ -11,10 +11,17 @@ export default {
name: 'SplitterPanel', name: 'SplitterPanel',
extends: BaseSplitterPanel, extends: BaseSplitterPanel,
inheritAttrs: false, inheritAttrs: false,
data() {
return {
nestedState: null
};
},
computed: { computed: {
isNested() { isNested() {
return this.$slots.default().some((child) => { return this.$slots.default().some((child) => {
return child.type.name === 'Splitter'; this.nestedState = child.type.name === 'Splitter' ? true : null;
return this.nestedState;
}); });
}, },
getPTOptions() { getPTOptions() {