mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 15:03:57 +00:00
horizontal splitter improved
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
<script context="module">
|
<script context="module">
|
||||||
export function computeSplitterSize(initialValue, clientSize, customRatio) {
|
export function computeSplitterSize(initialValue, clientSize, customRatio, initialSizeRight) {
|
||||||
if (customRatio != null) {
|
if (customRatio != null) {
|
||||||
return clientSize * customRatio;
|
return clientSize * customRatio;
|
||||||
}
|
}
|
||||||
|
if (initialSizeRight) {
|
||||||
|
return clientSize - initialSizeRight;
|
||||||
|
}
|
||||||
if (_.isString(initialValue) && initialValue.startsWith('~') && initialValue.endsWith('px'))
|
if (_.isString(initialValue) && initialValue.startsWith('~') && initialValue.endsWith('px'))
|
||||||
return clientSize - parseInt(initialValue.slice(1, -2));
|
return clientSize - parseInt(initialValue.slice(1, -2));
|
||||||
if (_.isString(initialValue) && initialValue.endsWith('px')) return parseInt(initialValue.slice(0, -2));
|
if (_.isString(initialValue) && initialValue.endsWith('px')) return parseInt(initialValue.slice(0, -2));
|
||||||
@@ -20,6 +23,7 @@
|
|||||||
|
|
||||||
export let isSplitter = true;
|
export let isSplitter = true;
|
||||||
export let initialValue = undefined;
|
export let initialValue = undefined;
|
||||||
|
export let initialSizeRight = undefined;
|
||||||
export let hideFirst = false;
|
export let hideFirst = false;
|
||||||
|
|
||||||
export let allowCollapseChild1 = false;
|
export let allowCollapseChild1 = false;
|
||||||
@@ -32,7 +36,7 @@
|
|||||||
let clientWidth;
|
let clientWidth;
|
||||||
let customRatio = null;
|
let customRatio = null;
|
||||||
|
|
||||||
$: size = computeSplitterSize(initialValue, clientWidth, customRatio);
|
$: size = computeSplitterSize(initialValue, clientWidth, customRatio, initialSizeRight);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container" bind:clientWidth>
|
<div class="container" bind:clientWidth>
|
||||||
|
|||||||
Reference in New Issue
Block a user