2023-05-24 08:54:19 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
|
|
|
.p-splitter {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-vertical {
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-gutter {
|
|
|
|
flex-grow: 0;
|
|
|
|
flex-shrink: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
cursor: col-resize;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-horizontal.p-splitter-resizing {
|
|
|
|
cursor: col-resize;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-horizontal > .p-splitter-gutter > .p-splitter-gutter-handle {
|
|
|
|
height: 24px;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-horizontal > .p-splitter-gutter {
|
|
|
|
cursor: col-resize;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-vertical.p-splitter-resizing {
|
|
|
|
cursor: row-resize;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-vertical > .p-splitter-gutter {
|
|
|
|
cursor: row-resize;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-splitter-vertical > .p-splitter-gutter > .p-splitter-gutter-handle {
|
|
|
|
width: 24px;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => ['p-splitter p-component', 'p-splitter-' + props.layout],
|
|
|
|
gutter: 'p-splitter-gutter',
|
|
|
|
gutterHandler: 'p-splitter-gutter-handle'
|
|
|
|
};
|
|
|
|
|
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ props }) => [{ display: 'flex', 'flex-wrap': 'nowrap' }, props.layout === 'vertical' ? { 'flex-direction': 'column' } : '']
|
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'splitter', manual: true });
|
2023-05-24 08:54:19 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseSplitter',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
layout: {
|
|
|
|
type: String,
|
|
|
|
default: 'horizontal'
|
|
|
|
},
|
|
|
|
gutterSize: {
|
|
|
|
type: Number,
|
|
|
|
default: 4
|
|
|
|
},
|
|
|
|
stateKey: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
stateStorage: {
|
|
|
|
type: String,
|
|
|
|
default: 'session'
|
|
|
|
},
|
|
|
|
step: {
|
|
|
|
type: Number,
|
|
|
|
default: 5
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
classes,
|
2023-05-30 11:06:57 +00:00
|
|
|
inlineStyles,
|
|
|
|
loadStyle
|
2023-05-24 08:54:19 +00:00
|
|
|
},
|
2023-05-30 11:06:57 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-24 08:54:19 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|