Revert "Fixed #5463 - Splitter/SplitterPanel: size not updated"
This reverts commit cd18096e89
.
pull/5513/head
parent
cd18096e89
commit
4e3ae01cbb
|
@ -2,7 +2,6 @@
|
||||||
<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
|
||||||
v-if="i !== panels.length - 1"
|
v-if="i !== panels.length - 1"
|
||||||
ref="gutter"
|
ref="gutter"
|
||||||
|
@ -52,10 +51,29 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initializePanels();
|
if (this.panels && this.panels.length) {
|
||||||
},
|
let initialized = false;
|
||||||
updated() {
|
|
||||||
this.initializePanels();
|
if (this.isStateful()) {
|
||||||
|
initialized = this.restoreState();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
let children = [...this.$el.children].filter((child) => child.getAttribute('data-pc-name') === 'splitterpanel');
|
||||||
|
let _panelSizes = [];
|
||||||
|
|
||||||
|
this.panels.map((panel, i) => {
|
||||||
|
let panelInitialSize = panel.props && panel.props.size ? panel.props.size : null;
|
||||||
|
let panelSize = panelInitialSize || 100 / this.panels.length;
|
||||||
|
|
||||||
|
_panelSizes[i] = panelSize;
|
||||||
|
children[i].style.flexBasis = 'calc(' + panelSize + '% - ' + (this.panels.length - 1) * this.gutterSize + 'px)';
|
||||||
|
});
|
||||||
|
|
||||||
|
this.panelSizes = _panelSizes;
|
||||||
|
this.prevSize = parseFloat(_panelSizes[0]).toFixed(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
@ -65,31 +83,6 @@ export default {
|
||||||
isSplitterPanel(child) {
|
isSplitterPanel(child) {
|
||||||
return child.type.name === 'SplitterPanel';
|
return child.type.name === 'SplitterPanel';
|
||||||
},
|
},
|
||||||
initializePanels() {
|
|
||||||
if (this.panels && this.panels.length) {
|
|
||||||
let initialized = false;
|
|
||||||
|
|
||||||
if (this.isStateful()) {
|
|
||||||
initialized = this.restoreState();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!initialized) {
|
|
||||||
let children = [...this.$el.children].filter((child) => child.getAttribute('data-pc-name') === 'splitterpanel');
|
|
||||||
let _panelSizes = [];
|
|
||||||
|
|
||||||
this.panels.map((panel, i) => {
|
|
||||||
let panelInitialSize = panel.props && panel.props.size ? panel.props.size : null;
|
|
||||||
let panelSize = panelInitialSize || 100 / this.panels.length;
|
|
||||||
|
|
||||||
_panelSizes[i] = panelSize;
|
|
||||||
children[i].style.flexBasis = 'calc(' + panelSize + '% - ' + (this.panels.length - 1) * this.gutterSize + 'px)';
|
|
||||||
});
|
|
||||||
|
|
||||||
this.panelSizes = _panelSizes;
|
|
||||||
this.prevSize = parseFloat(_panelSizes[0]).toFixed(4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onResizeStart(event, index, isKeyDown) {
|
onResizeStart(event, index, isKeyDown) {
|
||||||
this.gutterElement = event.currentTarget || event.target.parentElement;
|
this.gutterElement = event.currentTarget || event.target.parentElement;
|
||||||
this.size = this.horizontal ? DomHandler.getWidth(this.$el) : DomHandler.getHeight(this.$el);
|
this.size = this.horizontal ? DomHandler.getWidth(this.$el) : DomHandler.getHeight(this.$el);
|
||||||
|
|
Loading…
Reference in New Issue