1- import { html , customElement , property } from '@umbraco-cms/backoffice/external/lit' ;
2- import { splitStringToArray } from '@umbraco-cms/backoffice/utils' ;
1+ import { html , customElement , property , state } from '@umbraco-cms/backoffice/external/lit' ;
32import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element' ;
43import { UmbPropertyValueChangeEvent } from '@umbraco-cms/backoffice/property-editor' ;
54import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models' ;
@@ -9,41 +8,34 @@ import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extensi
98
109@customElement ( 'umb-property-editor-ui-media-entity-picker' )
1110export class UmbPropertyEditorUIMediaEntityPickerElement extends UmbLitElement implements UmbPropertyEditorUiElement {
12- #min: number = 0 ;
13- #max: number = Infinity ;
14-
15- @property ( { attribute : false } )
16- public set value ( value : string | null | undefined ) {
17- this . #selection = value ? ( Array . isArray ( value ) ? value : splitStringToArray ( value ) ) : [ ] ;
18- }
19- public get value ( ) {
20- return this . #selection. length > 0 ? this . #selection. join ( ',' ) : null ;
21- }
22-
23- #selection: Array < string > = [ ] ;
11+ @property ( { type : String } )
12+ public value : string | undefined ;
2413
2514 public set config ( config : UmbPropertyEditorConfigCollection | undefined ) {
2615 if ( ! config ) return ;
2716
2817 const minMax = config ?. getValueByAlias < UmbNumberRangeValueType > ( 'validationLimit' ) ;
29- this . #min = minMax ?. min ?? 0 ;
30- this . #max = minMax ?. max ?? Infinity ;
31- }
32- public get config ( ) {
33- return undefined ;
18+ this . _min = minMax ?. min ?? 0 ;
19+ this . _max = minMax ?. max ?? Infinity ;
3420 }
3521
22+ @state ( )
23+ _min : number = 0 ;
24+
25+ @state ( )
26+ _max : number = Infinity ;
27+
3628 #onChange( event : CustomEvent & { target : UmbInputMediaElement } ) {
37- this . value = event . target . selection ?. join ( ',' ) ?? null ;
29+ this . value = event . target . value ;
3830 this . dispatchEvent ( new UmbPropertyValueChangeEvent ( ) ) ;
3931 }
4032
4133 render ( ) {
4234 return html `
4335 < umb-input-media
44- .min =${ this . #min }
45- .max =${ this . #max }
46- .selection =${ this . #selection }
36+ .min =${ this . _min }
37+ .max =${ this . _max }
38+ .value =${ this . value }
4739 @change=${ this . #onChange} > </ umb-input-media >
4840 ` ;
4941 }
0 commit comments