2020-11-25 13:31:34 +01:00
|
|
|
<template>
|
2021-04-16 10:34:06 +02:00
|
|
|
<div class="vrtktovg _formItem _formNoConcat" v-size="{ max: [500] }" v-sticky-container>
|
2020-11-25 13:31:34 +01:00
|
|
|
<div class="_formLabel"><slot name="label"></slot></div>
|
2021-04-16 10:34:06 +02:00
|
|
|
<div class="main _form_group" ref="child">
|
2020-11-25 13:31:34 +01:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
<div class="_formCaption"><slot name="caption"></slot></div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-04-16 10:34:06 +02:00
|
|
|
import { defineComponent, onMounted, ref } from 'vue';
|
2020-11-25 13:31:34 +01:00
|
|
|
|
|
|
|
export default defineComponent({
|
2021-04-16 10:34:06 +02:00
|
|
|
setup(props, context) {
|
|
|
|
const child = ref<HTMLElement | null>(null);
|
|
|
|
|
|
|
|
const scanChild = () => {
|
|
|
|
if (child.value == null) return;
|
|
|
|
const els = Array.from(child.value.children);
|
|
|
|
for (let i = 0; i < els.length; i++) {
|
|
|
|
const el = els[i];
|
|
|
|
if (el.classList.contains('_formNoConcat')) {
|
|
|
|
if (els[i - 1]) els[i - 1].classList.add('_formNoConcatPrev');
|
|
|
|
if (els[i + 1]) els[i + 1].classList.add('_formNoConcatNext');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
scanChild();
|
|
|
|
|
|
|
|
const observer = new MutationObserver(records => {
|
|
|
|
scanChild();
|
|
|
|
});
|
|
|
|
|
|
|
|
observer.observe(child.value, {
|
|
|
|
childList: true,
|
|
|
|
subtree: false,
|
|
|
|
attributes: false,
|
|
|
|
characterData: false,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
child
|
|
|
|
};
|
|
|
|
}
|
2020-11-25 13:31:34 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vrtktovg {
|
|
|
|
> .main {
|
2021-04-16 10:34:06 +02:00
|
|
|
> ::v-deep(*):not(._formNoConcat) {
|
|
|
|
&:not(._formNoConcatNext) {
|
|
|
|
margin: 0;
|
|
|
|
}
|
2020-11-25 13:31:34 +01:00
|
|
|
|
2021-04-16 10:34:06 +02:00
|
|
|
&:not(:last-child):not(._formNoConcatPrev) {
|
2020-11-25 13:31:34 +01:00
|
|
|
&._formPanel, ._formPanel {
|
|
|
|
border-bottom: solid 0.5px var(--divider);
|
|
|
|
border-bottom-left-radius: 0;
|
|
|
|
border-bottom-right-radius: 0;
|
|
|
|
}
|
|
|
|
}
|
2021-04-16 10:34:06 +02:00
|
|
|
|
|
|
|
&:not(:first-child):not(._formNoConcatNext) {
|
2021-04-16 08:44:17 +02:00
|
|
|
&._formPanel, ._formPanel {
|
|
|
|
border-top: none;
|
|
|
|
border-top-left-radius: 0;
|
|
|
|
border-top-right-radius: 0;
|
|
|
|
}
|
|
|
|
}
|
2020-11-25 13:31:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|