Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | 7x 7x 7x 7x 7x | <template>
<div :class="$style.root" v-bind="$attrs" :direction="direction" :gap="gap" v-on="$listeners" vusion-slot-name="default" ref="root">
<slot></slot>
<s-empty v-if="(!$slots.default) && $env.VUE_APP_DESIGNER && !!$attrs['vusion-node-path']"></s-empty>
</div>
</template>
<script>
import SEmpty from '../s-empty.vue';
import { throttle } from '../../utils/throttle';
export default {
name: 'u-multi-layout',
components: {
SEmpty,
},
props: {
direction: {
type: String,
default: 'horizontal',
},
gap: {
type: String,
default: 'none',
},
},
mounted() {
this.$refs.root.addEventListener('scroll', throttle(this.handleScroll.bind(this), 200));
},
methods: {
handleScroll(e) {
const el = e.target;
const { scrollHeight, scrollWidth, scrollTop, scrollLeft, clientHeight, clientWidth} = el;
this.$emit('scroll', {
scrollHeight,
scrollWidth,
scrollTop,
scrollLeft,
clientHeight,
clientWidth,
});
},
},
};
</script>
<style module>
.root {
display: flex;
box-sizing: border-box;
position: relative;
height: 100%;
}
.root[direction="horizontal"] {
flex-direction: row;
}
.root[direction="vertical"] {
flex-direction: column;
}
.root[direction="horizontal"][gap="shrink"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-right: var(--space-shrink);;
}
.root[direction="horizontal"][gap="none"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-right: 0;
}
.root[direction="horizontal"][gap="small"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-right: var(--space-small);
}
.root[direction="horizontal"][gap="normal"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-right: var(--space-base);
}
.root[direction="horizontal"][gap="large"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-right: var(--space-large);
}
.root[direction="vertical"][gap="shrink"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-bottom: var(--space-shrink);;
}
.root[direction="vertical"][gap="none"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-bottom: 0;
}
.root[direction="vertical"][gap="small"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-bottom: var(--space-small);
}
.root[direction="vertical"][gap="normal"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-bottom: var(--space-base);
}
.root[direction="vertical"][gap="large"] > [class^="u-multi-layout_item"]:not(:last-child) {
margin-bottom: var(--space-large);
}
.root[justify="start"] { justify-content: flex-start; }
.root[justify="center"] { justify-content: center; }
.root[justify="end"] { justify-content: flex-end; }
.root[justify="space-between"] { justify-content: space-between; }
.root[justify="space-between"]::after { display: none; }
.root[justify="space-around"] { justify-content: space-around; }
.root[alignment="start"] { align-items: flex-start; }
.root[alignment="center"] { align-items: center; }
.root[alignment="end"] { align-items: flex-end; }
.root[alignment="baseline"] { align-items: baseline; }
.root[alignment="stretch"] { align-items: stretch; }
</style>
|