From 1454905161d2ceac01fed392bbe128bb75841798 Mon Sep 17 00:00:00 2001 From: Stefan Zerkalica Date: Fri, 29 Sep 2023 15:49:46 +0300 Subject: [PATCH] $mol_select_list, badge index to id --- select/list/list.view.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/select/list/list.view.ts b/select/list/list.view.ts index 0895f88edc8..2dc33859a48 100644 --- a/select/list/list.view.ts +++ b/select/list/list.view.ts @@ -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 @@ -57,7 +57,7 @@ namespace $.$$ { override Badges() { return this.value() - .map( ( _, index )=> this.Badge( index ) ) + .map( id => this.Badge( id ) ) .reverse() } @@ -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)) } }