Skip to content

Commit

Permalink
add popover
Browse files Browse the repository at this point in the history
  • Loading branch information
mioe committed May 19, 2024
1 parent f316974 commit b4b875b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ onChange((files) => {
class="h-[calc(100svh-48px)] w-[calc(100svw-48px)] flex flex-col"
>
<Table
:sys-field="sysField"
:custom-field="customField"
:csv="csvData"
@update:csv="$ev => (csvData = $ev)"
/>
Expand Down
27 changes: 27 additions & 0 deletions src/components/ColumnPicker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup>
defineProps({
popid: { type: String, required: true },
})
</script>

<template>
<div>
<button :popovertarget="popid">
Select column ->
</button>
<div
:id="popid"
popover
>
{{ popid }}
</div>
</div>
</template>

<style>
[popover] {
font-size: 2rem;
font-weight: bold;
overflow: visible;
}
</style>
14 changes: 12 additions & 2 deletions src/components/Table.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<script setup>
import { useVModels } from '@vueuse/core'
import ColumnPicker from '~/components/ColumnPicker.vue'
const props = defineProps({
csv: Array,
sysField: Array,
customField: Array,
})
const emit = defineEmits(['update:csv'])
const { csv } = useVModels(props, emit)
Expand Down Expand Up @@ -89,7 +92,9 @@ onUpdated(() => {
:key="colIdx"
>
<div class="col-body">
{{ colIdx }}
<ColumnPicker
:popid="colIdx"
/>
</div>
</th>
</tr>
Expand Down Expand Up @@ -143,11 +148,16 @@ onUpdated(() => {
.table-custom {
all: unset;
display: table;
}
.table-custom th {
text-align: left;
}
.col-body {
min-width: 200px;
max-width: 300px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down

0 comments on commit b4b875b

Please sign in to comment.