Skip to content

Commit

Permalink
$mol_select_list, badge index to id
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Sep 29, 2023
1 parent 91575b7 commit 1454905
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions select/list/list.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ namespace $.$$ {
return value == null ? key : value
}

override badge_title( index: number ) {
return this.option_title( this.value()[ index ] )
override badge_title( key: string ) {
return this.option_title( key )
}

@ $mol_mem
Expand All @@ -57,7 +57,7 @@ namespace $.$$ {

override Badges() {
return this.value()
.map( ( _, index )=> this.Badge( index ) )
.map( id => this.Badge( id ) )
.reverse()
}

Expand All @@ -67,12 +67,8 @@ namespace $.$$ {
}

@ $mol_action
override remove( index: number ) {
const value = this.value()
this.value([
... value.slice( 0 , index ),
... value.slice( index + 1 ),
])
override remove( key: string ) {
this.value(this.value().filter(id => id !== key))
}

}
Expand Down

0 comments on commit 1454905

Please sign in to comment.