File tree Expand file tree Collapse file tree 4 files changed +44
-10
lines changed Expand file tree Collapse file tree 4 files changed +44
-10
lines changed Original file line number Diff line number Diff line change 3939 return ret
4040 }
4141 });
42+ const mutedTags = computed (() => {
43+ const ret = uiState .tagStatus .checked .copy ();
44+ if (currentSelectedDatapoint .value !== null ){
45+ ret .pop_ifcontains_ (currentSelectedDatapoint .value .tags );
46+ }
47+ return ret
48+ });
4249
4350 function clearTagSelection(){
4451 uiState .tagStatus .checked = new DataTags ();
94101 <hr >
95102 </div >
96103 <TagSelector @onCheck =" (status: TagStatus) => emit('onCheck', status)" v-model:tagStatus =" uiState.tagStatus" ></TagSelector >
97- <TagBubbleContainer v-if =" currentSelectedDatapoint"
104+ <hr >
105+ <TagBubbleContainer
98106 @click-on-bubble =" (tag: string) => {
99107 if (uiState.tagStatus.checked.has(tag)){ uiState.tagStatus.checked.delete(tag); }
100108 else{ uiState.tagStatus.checked.add(tag); }
101109 uiState.updateShownData();
102110 }"
103- :tags =" currentSelectedDatapoint.tags"
104- :highlightTags =" highlightTags"
105- :maxWidth =" ftPanel? ftPanel.clientWidth : null" >
111+ :tags =" currentSelectedDatapoint? currentSelectedDatapoint.tags : uiState.tagStatus.checked"
112+ :highlight-tags =" highlightTags"
113+ :muted-tags =" mutedTags"
114+ :max-width =" ftPanel? ftPanel.clientWidth : null" >
106115 </TagBubbleContainer >
107116 <div class =" buttons" >
108117 <button id =" btnClear" class =" green" @click =" clearTagSelection" >CLEAR SELECTION</button >
Original file line number Diff line number Diff line change 55
66 const props = withDefaults (defineProps <{
77 tag: string ,
8- highlight ? : boolean
8+ tStyle : " " | " highlight " | " muted "
99 }>(), {
10- highlight: false ,
10+ tStyle: " " ,
1111 })
1212
1313 const emit = defineEmits <{
2525 </script >
2626
2727<template >
28- <div :class =" `bubble${highlight ? ' highlight' : ''}`" @click =" ()=>emit('click')" >
28+ <div :class =" `bubble${tStyle ? ' '+tStyle : ''}`" @click =" ()=>emit('click')" >
2929 <div class =" prefix" v-if =" tagComponents[0]" >
3030 {{ tagComponents[0] }}
3131 </div >
@@ -54,7 +54,9 @@ div.bubble{
5454div .highlight {
5555 background-color : rgba (248 , 54 , 255 , 0.247 );
5656 box-shadow : 0 0 5px var (--color-shadow );
57- transition : all 0.2s ;
57+ }
58+ div .muted {
59+ opacity : 0.35 ;
5860}
5961
6062div .prefix {
Original file line number Diff line number Diff line change 22<script setup lang="ts">
33 import { DataTags } from ' ../../core/dataClass' ;
44 import TagBubble from ' ./TagBubble.vue' ;
5+ import { computed } from ' vue' ;
56
67 const props = withDefaults (defineProps <{
78 tags: DataTags | string []
89 highlightTags? : DataTags | null
10+ mutedTags? : DataTags | null
911 maxWidth? : number | null
1012 middleAlign? : boolean
1113 }>(), {
1214 highlightTags: null ,
15+ mutedTags: null ,
1316 maxWidth: null ,
1417 middleAlign: false ,
1518 })
1821 (e : " clickOnBubble" , tag : string ): void
1922 }>()
2023
24+ const tagStyles = computed (() => {
25+ const style = {} as Record <string , " highlight" | " muted" | " " >;
26+ for (const tag of props .tags ){
27+ if (props .highlightTags && props .highlightTags .has (tag )){
28+ style [tag ] = " highlight" ;
29+ }else if (props .mutedTags && props .mutedTags .has (tag )){
30+ style [tag ] = " muted" ;
31+ }else {
32+ style [tag ] = " " ;
33+ }
34+ }
35+ return style ;
36+ })
37+
2138 </script >
2239
2340<template >
2946 <TagBubble v-for =" tag in props.tags"
3047 @click =" ()=>emit('clickOnBubble', tag)"
3148 :tag =" tag"
32- :highlight = " props.highlightTags? props.highlightTags.has( tag) : false " >
49+ :t-style = " tagStyles[ tag] " >
3350 </TagBubble >
3451 </div >
3552</template >
@@ -39,7 +56,6 @@ div#bubbleContainer{
3956 display : flex ;
4057 flex-wrap : wrap ;
4158 align-items : center ;
42- overflow : hidden ;
4359 gap : 5px ;
4460 padding : 5px ;
4561 border-radius : 5px ;
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ export class DataTags extends Set<string>{
3030 _tags . forEach ( ( tag ) => { return DataTags . removeSpaces ( tag ) ; } )
3131 super ( _tags ) ;
3232 }
33+ copy ( ) {
34+ return new DataTags ( this ) ;
35+ }
3336 add ( tag : string ) {
3437 return super . add ( DataTags . removeSpaces ( tag ) ) ;
3538 }
@@ -54,6 +57,10 @@ export class DataTags extends Set<string>{
5457 tags . forEach ( ( value ) => this . delete ( value ) ) ;
5558 return this ;
5659 }
60+ pop_ifcontains_ ( tags : DataTags ) {
61+ tags . forEach ( ( value ) => { if ( this . has ( value ) ) { this . delete ( value ) ; } } )
62+ return this ;
63+ }
5764 issubset ( tags : DataTags ) {
5865 return TagRule . isSubset ( this , tags )
5966 }
You can’t perform that action at this time.
0 commit comments