11import { localized , msg } from "@lit/localize" ;
22import type { SlSelect } from "@shoelace-style/shoelace" ;
3- import { html } from "lit" ;
3+ import { html , type PropertyValues } from "lit" ;
44import { customElement , property , state } from "lit/decorators.js" ;
55import { ifDefined } from "lit/directives/if-defined.js" ;
66
@@ -49,6 +49,12 @@ export class SelectCrawlerProxy extends BtrixElement {
4949 @property ( { type : String } )
5050 size ?: SlSelect [ "size" ] ;
5151
52+ @property ( { type : String } )
53+ helpText ?: string ;
54+
55+ @property ( { type : Boolean } )
56+ disabled ?: boolean ;
57+
5258 @state ( )
5359 private selectedProxy ?: Proxy ;
5460
@@ -59,6 +65,18 @@ export class SelectCrawlerProxy extends BtrixElement {
5965 return this . selectedProxy ?. id || "" ;
6066 }
6167
68+ protected willUpdate ( changedProperties : PropertyValues ) : void {
69+ if ( changedProperties . has ( "proxyId" ) ) {
70+ if ( this . proxyId ) {
71+ this . selectedProxy = this . proxyServers . find (
72+ ( { id } ) => id === this . proxyId ,
73+ ) ;
74+ } else if ( changedProperties . get ( "proxyId" ) ) {
75+ this . selectedProxy = undefined ;
76+ }
77+ }
78+ }
79+
6280 protected firstUpdated ( ) {
6381 void this . initProxies ( ) ;
6482 }
@@ -82,6 +100,7 @@ export class SelectCrawlerProxy extends BtrixElement {
82100 : msg ( "No Proxy" ) }
83101 hoist
84102 clearable
103+ ?disabled=${ this . disabled }
85104 size=${ ifDefined ( this . size ) }
86105 @sl-change=${ this . onChange }
87106 @sl-hide=${ this . stopProp }
0 commit comments