Refactor #4211 - For Splitter

pull/4203/head
Tuğçe Küçükoğlu 2023-08-01 11:26:08 +03:00
parent b238d68d49
commit 587ed2a7ff
2 changed files with 19 additions and 1 deletions

View File

@ -20,6 +20,7 @@ export interface SplitterPassThroughMethodOptions {
instance: any;
props: SplitterProps;
state: SplitterState;
context: SplitterContext;
}
/**
@ -93,6 +94,16 @@ export interface SplitterState {
prevSize: number;
}
/**
* Defines options in Splitter component.
*/
export interface SplitterContext {
/**
* Current nested state of the component.
*/
nested?: boolean;
}
/**
* Defines valid properties in Splitter component.
*/

View File

@ -1,5 +1,5 @@
<template>
<div :class="cx('root')" :style="sx('root')" :data-p-resizing="false" v-bind="ptm('root')" data-pc-name="splitter">
<div :class="cx('root')" :style="sx('root')" :data-p-resizing="false" v-bind="ptm('root', getPTOptions())" data-pc-name="splitter">
<template v-for="(panel, i) of panels" :key="i">
<component :is="panel" tabindex="-1"></component>
<div
@ -79,6 +79,13 @@ 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';
},