diff --git a/src/components/BSMap.vue b/src/components/BSMap.vue index 3ebf17c..62bea1b 100644 --- a/src/components/BSMap.vue +++ b/src/components/BSMap.vue @@ -1,6 +1,6 @@ @@ -11,6 +11,8 @@ import { defineProps, } from 'vue'; +import { max } from 'radash'; + import BSRow from './BSMap/BSRow.vue'; const props = defineProps<{ @@ -19,15 +21,7 @@ const props = defineProps<{ }>(); const rows = computed(() => props.content.split('\n')); - -const cols = computed(() => { - let cols = 0; - for (const row of rows.value) { - const c = Math.max(cols, row.split('\\').length); - if (c > cols) cols = c; - } - return cols; -}); +const cols = computed(() => max(rows.value.map((row) => row.split('\\').length)) || 1); const style = computed(() => ({ '--bs-map-size': props.size, diff --git a/src/components/BSMap/BSCell.vue b/src/components/BSMap/BSCell.vue index 5582073..d74dfe4 100644 --- a/src/components/BSMap/BSCell.vue +++ b/src/components/BSMap/BSCell.vue @@ -1,7 +1,7 @@