Skip to content

Commit

Permalink
show info popup buttons on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Apr 8, 2023
1 parent a57126d commit 58467cd
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ui/src/data_cells/components/data_cell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
ref="cell"
:value="value"
:format="format"
:with-filter-button="isTable"
@tag-click="$emit('tag-click', $event)"
/>
<DataImage
Expand Down Expand Up @@ -165,6 +166,11 @@ export default {
required: false,
default: () => ({})
},
isTable: {
type: Boolean,
required: false,
default: false
},
textTruncate: {
type: Boolean,
required: false,
Expand Down
35 changes: 34 additions & 1 deletion ui/src/data_cells/components/reference.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<VButton
v-popover="popoverParams"
:to="referenceId || resourceId || alwaysRefer ? { name: 'resources', params: { fragments: [resourceSlug, referenceId || resourceId].filter(Boolean) }} : null"
type="primary"
ghost
shape="circle"
class="position-relative"
@click.stop
>
<template v-if="isNumberId">
Expand All @@ -17,6 +17,16 @@
<template v-else>
{{ truncate(model.display_primary_key ? resourceId.toString() : displayText, maxLength) }}
</template>
<span
v-if="!popoverParams.disabled"
class="info-popup"
>
<span
v-popover="popoverParams"
style="vertical-align: middle; font-size: 16px; margin-bottom: 2px"
class="ion ion-ios-information-circle-outline"
/>
</span>
</VButton>
</template>

Expand Down Expand Up @@ -144,7 +154,30 @@ export default {
</style>
<style lang="scss" scoped>
@import 'utils/styles/variables';
.ivu-btn {
user-select: initial
}
.info-popup {
display: none;
width: 30px;
height: calc(100% + 2px);
top: -1px;
right: -15px;
position: absolute;
background: #fff;
border-top: 1px $primary-color solid;
border-bottom: 1px $primary-color solid;
border-top-right-radius: 32px;
border-bottom-right-radius: 32px;
border-right: 1px $primary-color solid
}
.ivu-btn:hover {
.info-popup {
display: inline;
}
}
</style>
45 changes: 42 additions & 3 deletions ui/src/data_cells/components/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,27 @@
</template>
<div
v-else-if="value || value == 0"
class="ivu-tag ivu-tag-size-default ivu-tag-checked cursor-unset"
class="ivu-tag ivu-tag-size-default ivu-tag-checked cursor-unset position-relative"
:class="colorClass"
:style="bgStyle"
@click.stop="$emit('tag-click', value)"
>
<span
class="ivu-tag-text ivu-tag-color-white cursor-unset"
:style="textStyle"
>{{ options[value] || titleize(value.toString()) }}</span>
<span
v-if="withFilterButton"
class="filter-popup"
:style="bgStyle"
style="border-left-width: 0"
:class="colorClass"
@click.stop="$emit('tag-click', value)"
>
<span
style="vertical-align: middle; margin-bottom: 2px"
class="ion ion-ios-funnel"
/>
</span>
</div>
</template>

Expand Down Expand Up @@ -59,6 +71,11 @@ export default {
type: Object,
required: false,
default: () => ({})
},
withFilterButton: {
type: Boolean,
required: false,
default: false
}
},
emits: ['tag-click'],
Expand Down Expand Up @@ -93,5 +110,27 @@ export default {
}
</script>

<style>
<style lang="scss" scoped>
@import 'utils/styles/variables';
.ivu-tag {
overflow: visible;
}
.filter-popup {
display: none;
width: 15px;
height: calc(100% + 2px);
top: -1px;
right: -12px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
position: absolute;
background: #fff;
}
.ivu-tag:hover {
.filter-popup {
display: inline;
}
}
</style>
1 change: 1 addition & 0 deletions ui/src/data_tables/components/table_column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
v-else
:value="row[column.key]"
:format="column.format"
:is-table="true"
:type="column.type"
@tag-click="$emit('tag-click', { key: column.key, value: $event })"
/>
Expand Down

0 comments on commit 58467cd

Please sign in to comment.