2023-05-22 22:05:19 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
2023-09-25 19:11:55 +00:00
|
|
|
@layer primevue {
|
|
|
|
.p-divider-horizontal {
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
position: relative;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-horizontal:before {
|
|
|
|
position: absolute;
|
|
|
|
display: block;
|
|
|
|
top: 50%;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
content: '';
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-content {
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-vertical {
|
|
|
|
min-height: 100%;
|
|
|
|
margin: 0 1rem;
|
|
|
|
display: flex;
|
|
|
|
position: relative;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-vertical:before {
|
|
|
|
position: absolute;
|
|
|
|
display: block;
|
|
|
|
top: 0;
|
|
|
|
left: 50%;
|
|
|
|
height: 100%;
|
|
|
|
content: '';
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-solid.p-divider-horizontal:before {
|
|
|
|
border-top-style: solid;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-solid.p-divider-vertical:before {
|
|
|
|
border-left-style: solid;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-dashed.p-divider-horizontal:before {
|
|
|
|
border-top-style: dashed;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-dashed.p-divider-vertical:before {
|
|
|
|
border-left-style: dashed;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-dotted.p-divider-horizontal:before {
|
|
|
|
border-top-style: dotted;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-divider-dotted.p-divider-vertical:before {
|
|
|
|
border-left-style: dotted;
|
|
|
|
}
|
2023-05-22 22:05:19 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-08-03 08:29:02 +00:00
|
|
|
/* Position */
|
|
|
|
const inlineStyles = {
|
|
|
|
root: ({ props }) => ({
|
2023-08-11 09:08:20 +00:00
|
|
|
justifyContent: props.layout === 'horizontal' ? (props.align === 'center' || props.align === null ? 'center' : props.align === 'left' ? 'flex-start' : props.align === 'right' ? 'flex-end' : null) : null,
|
|
|
|
alignItems: props.layout === 'vertical' ? (props.align === 'center' || props.align === null ? 'center' : props.align === 'top' ? 'flex-start' : props.align === 'bottom' ? 'flex-end' : null) : null
|
2023-08-03 08:29:02 +00:00
|
|
|
})
|
|
|
|
};
|
|
|
|
|
2023-05-22 22:05:19 +00:00
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => [
|
|
|
|
'p-divider p-component',
|
|
|
|
'p-divider-' + props.layout,
|
|
|
|
'p-divider-' + props.type,
|
|
|
|
{ 'p-divider-left': props.layout === 'horizontal' && (!props.align || props.align === 'left') },
|
|
|
|
{ 'p-divider-center': props.layout === 'horizontal' && props.align === 'center' },
|
|
|
|
{ 'p-divider-right': props.layout === 'horizontal' && props.align === 'right' },
|
|
|
|
{ 'p-divider-top': props.layout === 'vertical' && props.align === 'top' },
|
|
|
|
{ 'p-divider-center': props.layout === 'vertical' && (!props.align || props.align === 'center') },
|
|
|
|
{ 'p-divider-bottom': props.layout === 'vertical' && props.align === 'bottom' }
|
|
|
|
],
|
|
|
|
content: 'p-divider-content'
|
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'divider', manual: true });
|
2023-05-22 22:05:19 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseDivider',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
align: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
type: String,
|
|
|
|
default: 'horizontal'
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'solid'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-05-30 12:28:04 +00:00
|
|
|
classes,
|
2023-08-03 08:29:02 +00:00
|
|
|
inlineStyles,
|
2023-05-30 12:28:04 +00:00
|
|
|
loadStyle
|
2023-05-22 22:05:19 +00:00
|
|
|
},
|
2023-05-30 12:28:04 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-22 22:05:19 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|