Skip to content

Commit

Permalink
Add fixed layout to Table widget
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaugiralt committed Feb 19, 2024
1 parent 4dc5791 commit c39dbc7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions components/src/widgets/complexTable/widget.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<ui-table :headers="props.headers">
<ui-table
:headers="props.headers"
:fixed="fixed"
>
<slot />
</ui-table>
<div class="buttons-container">
Expand Down Expand Up @@ -62,7 +65,11 @@ const props = defineProps({
totalItems: {
type: Number,
default: 1,
}
},
fixed: {
type: Boolean,
default: false,
},
});
const totalPages = computed(() => Math.ceil(props.totalItems / ITEMS_PER_PAGE))
Expand Down
11 changes: 10 additions & 1 deletion components/src/widgets/table/widget.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>
<div class="table">
<table>
<table :class="{ fixed: fixed }">
<thead v-if="headers.length">
<tr>
<th
v-for="header in headers"
:key="header.name"
:style="{ width: header.width }"
>
<div>{{ header.text }}</div>
<div class="splitpane" />
Expand All @@ -26,6 +27,10 @@ defineProps({
required: true,
default: () => [],
},
fixed: {
type: Boolean,
default: false,
}
})
</script>

Expand All @@ -36,6 +41,10 @@ table {
width: 100%;
max-width: 100%;
&.fixed {
table-layout: fixed;
}
thead {
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
Expand Down

0 comments on commit c39dbc7

Please sign in to comment.