Refactor #4211 - For Splitter
parent
b238d68d49
commit
587ed2a7ff
|
@ -20,6 +20,7 @@ export interface SplitterPassThroughMethodOptions {
|
||||||
instance: any;
|
instance: any;
|
||||||
props: SplitterProps;
|
props: SplitterProps;
|
||||||
state: SplitterState;
|
state: SplitterState;
|
||||||
|
context: SplitterContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +94,16 @@ export interface SplitterState {
|
||||||
prevSize: number;
|
prevSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines options in Splitter component.
|
||||||
|
*/
|
||||||
|
export interface SplitterContext {
|
||||||
|
/**
|
||||||
|
* Current nested state of the component.
|
||||||
|
*/
|
||||||
|
nested?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines valid properties in Splitter component.
|
* Defines valid properties in Splitter component.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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">
|
<template v-for="(panel, i) of panels" :key="i">
|
||||||
<component :is="panel" tabindex="-1"></component>
|
<component :is="panel" tabindex="-1"></component>
|
||||||
<div
|
<div
|
||||||
|
@ -79,6 +79,13 @@ 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';
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue