1
- import {
2
- DynamicValue ,
3
- EditableValue ,
4
- ListAttributeValue ,
5
- ListExpressionValue ,
6
- ListWidgetValue ,
7
- ObjectItem
8
- } from "mendix" ;
1
+ import { DynamicValue , ListAttributeValue , ListExpressionValue , ListWidgetValue , ObjectItem } from "mendix" ;
9
2
import { ReactNode , createElement } from "react" ;
10
3
import { OptionsSourceAssociationCustomContentTypeEnum } from "../../../typings/ComboboxProps" ;
11
4
import { CaptionPlacement , CaptionsProvider } from "../types" ;
@@ -22,11 +15,10 @@ interface Props {
22
15
23
16
export class DatabaseCaptionsProvider implements CaptionsProvider {
24
17
private unavailableCaption = "<...>" ;
25
- private formatter ?: ListExpressionValue < string > | ListAttributeValue < string > ;
18
+ formatter ?: ListExpressionValue < string > | ListAttributeValue < string > ;
26
19
protected customContent ?: ListWidgetValue ;
27
20
protected customContentType : OptionsSourceAssociationCustomContentTypeEnum = "no" ;
28
21
attribute ?: ListAttributeValue < string | Big > ;
29
- value ?: DynamicValue < string > | EditableValue < string > ;
30
22
emptyCaption = "" ;
31
23
overrideCaption : string | null | undefined = undefined ;
32
24
@@ -63,12 +55,12 @@ export class DatabaseCaptionsProvider implements CaptionsProvider {
63
55
if ( ! item ) {
64
56
return this . unavailableCaption ;
65
57
}
66
- this . value = this . formatter ?. get ( item ) ;
67
- if ( this . value ? .status === "unavailable" ) {
58
+ const captionValue = this . formatter ?. get ( item ) ;
59
+ if ( ! captionValue || captionValue . status === "unavailable" ) {
68
60
return this . unavailableCaption ;
69
61
}
70
62
71
- return this . value ?. value ?? "" ;
63
+ return captionValue ?. value ?? "" ;
72
64
}
73
65
74
66
getCustomContent ( value : string | null ) : ReactNode | null {
0 commit comments