2018-10-11 00:21:03 +05:30
|
|
|
<template>
|
2023-02-20 11:22:48 +05:30
|
|
|
<div class="inline-grid" :style="style" v-bind="$attrs">
|
2018-10-11 00:21:03 +05:30
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</template>
|
2019-10-04 23:30:51 +05:30
|
|
|
<script>
|
|
|
|
export default {
|
2019-10-13 17:33:01 +05:30
|
|
|
name: 'Row',
|
2019-10-04 23:30:51 +05:30
|
|
|
props: {
|
2019-11-08 16:19:06 +05:30
|
|
|
columnWidth: {
|
|
|
|
type: String,
|
2022-02-10 12:11:51 +05:30
|
|
|
default: '1fr',
|
2019-11-08 16:19:06 +05:30
|
|
|
},
|
2019-10-04 23:30:51 +05:30
|
|
|
columnCount: {
|
|
|
|
type: Number,
|
2022-02-10 12:11:51 +05:30
|
|
|
default: 0,
|
2019-10-11 15:25:50 +05:30
|
|
|
},
|
|
|
|
ratio: {
|
|
|
|
type: Array,
|
2022-02-10 12:11:51 +05:30
|
|
|
default: () => [],
|
2019-10-14 03:26:20 +05:30
|
|
|
},
|
2019-12-03 17:15:07 +05:30
|
|
|
gridTemplateColumns: {
|
|
|
|
type: String,
|
2022-02-10 12:11:51 +05:30
|
|
|
default: null,
|
2019-12-03 17:15:07 +05:30
|
|
|
},
|
2022-02-10 12:11:51 +05:30
|
|
|
gap: String,
|
2019-10-04 23:30:51 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
style() {
|
2019-10-14 03:26:20 +05:30
|
|
|
let obj = {};
|
2019-10-11 15:25:50 +05:30
|
|
|
if (this.columnCount) {
|
2019-12-21 21:19:01 +05:30
|
|
|
// prettier-ignore
|
2019-11-08 16:19:06 +05:30
|
|
|
obj['grid-template-columns'] = `repeat(${this.columnCount}, ${this.columnWidth})`;
|
2019-10-11 15:25:50 +05:30
|
|
|
}
|
|
|
|
if (this.ratio.length) {
|
2022-02-10 12:11:51 +05:30
|
|
|
obj['grid-template-columns'] = this.ratio
|
2022-10-13 17:30:58 +05:30
|
|
|
.map((r) => `minmax(0, ${r}fr)`)
|
2022-02-10 12:11:51 +05:30
|
|
|
.join(' ');
|
2019-10-14 03:26:20 +05:30
|
|
|
}
|
2019-12-03 17:15:07 +05:30
|
|
|
if (this.gridTemplateColumns) {
|
|
|
|
obj['grid-template-columns'] = this.gridTemplateColumns;
|
|
|
|
}
|
2019-10-14 03:26:20 +05:30
|
|
|
if (this.gap) {
|
|
|
|
obj['grid-gap'] = this.gap;
|
2019-10-04 23:30:51 +05:30
|
|
|
}
|
2019-10-14 03:26:20 +05:30
|
|
|
|
|
|
|
return obj;
|
2022-02-10 12:11:51 +05:30
|
|
|
},
|
|
|
|
},
|
2019-10-14 03:26:20 +05:30
|
|
|
};
|
2019-10-04 23:30:51 +05:30
|
|
|
</script>
|