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>
<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">
<component :is="panel" tabindex="-1"></component>
<div
@ -80,13 +80,6 @@ export default {
this.unbindMouseListeners();
},
methods: {
getPTOptions() {
return {
context: {
nested: DomHandler.getAttribute(this.$parentInstance?.$el, 'data-pc-name') === 'splitterpanel'
}
};
},
isSplitterPanel(child) {
return child.type.name === 'SplitterPanel';
},
@ -379,6 +372,13 @@ export default {
},
horizontal() {
return this.layout === 'horizontal';
},
getPTOptions() {
return {
context: {
nested: this.$parentInstance?.nestedState
}
};
}
}
};

View File

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