Skip to content

Commit 69af372

Browse files
samuelreichertgjulivan
authored andcommitted
fix: association caption expression not visible
1 parent 1ad3ac6 commit 69af372

File tree

5 files changed

+46
-30
lines changed

5 files changed

+46
-30
lines changed

packages/pluggableWidgets/combobox-web/package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,44 @@
1010
"url": "https://github.com/mendix/web-widgets.git"
1111
},
1212
"config": {
13-
"mendixHost": "http://localhost:8080",
14-
"developmentPort": 3000
13+
"developmentPort": 3000,
14+
"mendixHost": "http://localhost:8080"
1515
},
1616
"mxpackage": {
1717
"name": "Combobox",
1818
"type": "widget",
1919
"mpkName": "com.mendix.widget.web.Combobox.mpk"
2020
},
21+
"packagePath": "com.mendix.widget.web",
2122
"marketplace": {
2223
"minimumMXVersion": "9.24.0.2965",
2324
"appNumber": 219304,
24-
"appName": "Combo box",
25-
"reactReady": true
25+
"appName": "Combo box"
2626
},
2727
"testProject": {
2828
"githubUrl": "https://github.com/mendix/testProjects",
2929
"branchName": "combobox-web"
3030
},
31-
"packagePath": "com.mendix.widget.web",
3231
"scripts": {
33-
"start": "pluggable-widgets-tools start:server",
34-
"dev": "pluggable-widgets-tools start:web",
3532
"build": "pluggable-widgets-tools build:web",
36-
"format": "pluggable-widgets-tools format",
37-
"lint": "eslint --ext .jsx,.js,.ts,.tsx src/",
38-
"test": "jest --projects jest.config.js",
39-
"e2e": "run-e2e ci",
40-
"e2edev": "run-e2e dev --with-preps",
41-
"release": "pluggable-widgets-tools release:web",
4233
"create-gh-release": "rui-create-gh-release",
4334
"create-translation": "rui-create-translation",
35+
"dev": "pluggable-widgets-tools start:web",
36+
"e2e": "run-e2e ci",
37+
"e2edev": "run-e2e dev --with-preps",
38+
"format": "pluggable-widgets-tools format",
39+
"lint": "eslint --ext .jsx,.js,.ts,.tsx src/",
4440
"publish-marketplace": "rui-publish-marketplace",
45-
"verify": "rui-verify-package-format",
46-
"update-changelog": "rui-update-changelog-widget"
41+
"release": "pluggable-widgets-tools release:web",
42+
"start": "pluggable-widgets-tools start:server",
43+
"test": "jest --projects jest.config.js",
44+
"update-changelog": "rui-update-changelog-widget",
45+
"verify": "rui-verify-package-format"
46+
},
47+
"dependencies": {
48+
"classnames": "^2.3.2",
49+
"downshift": "^7.6.2",
50+
"match-sorter": "^6.3.4"
4751
},
4852
"devDependencies": {
4953
"@mendix/automation-utils": "workspace:*",
@@ -57,10 +61,5 @@
5761
"@mendix/widget-plugin-platform": "workspace:*",
5862
"@mendix/widget-plugin-test-utils": "workspace:*",
5963
"cross-env": "^7.0.3"
60-
},
61-
"dependencies": {
62-
"classnames": "^2.3.2",
63-
"downshift": "^7.6.2",
64-
"match-sorter": "^6.3.4"
6564
}
6665
}

packages/pluggableWidgets/combobox-web/src/components/SingleSelection/SingleSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function SingleSelection({
4444

4545
const selectedItemCaption = useMemo(
4646
() => selector.caption.render(selectedItem, "label"),
47-
[selectedItem, selector.status, selector.caption.emptyCaption]
47+
[selectedItem, selector.status, selector.caption.emptyCaption, selector.caption.value?.value]
4848
);
4949

5050
return (

packages/pluggableWidgets/combobox-web/src/helpers/Association/AssociationSimpleCaptionsProvider.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { DynamicValue, ListAttributeValue, ListExpressionValue, ListWidgetValue, ObjectItem } from "mendix";
1+
import {
2+
DynamicValue,
3+
EditableValue,
4+
ListAttributeValue,
5+
ListExpressionValue,
6+
ListWidgetValue,
7+
ObjectItem
8+
} from "mendix";
29
import { ReactNode, createElement } from "react";
310
import { OptionsSourceAssociationCustomContentTypeEnum } from "../../../typings/ComboboxProps";
411
import { CaptionPlacement, CaptionsProvider } from "../types";
@@ -16,6 +23,7 @@ export class AssociationSimpleCaptionsProvider implements CaptionsProvider {
1623
private formatter?: ListExpressionValue<string> | ListAttributeValue<string>;
1724
protected customContent?: ListWidgetValue;
1825
protected customContentType: OptionsSourceAssociationCustomContentTypeEnum = "no";
26+
value?: DynamicValue<string> | EditableValue<string>;
1927
emptyCaption = "";
2028

2129
constructor(private optionsMap: Map<string, ObjectItem>) {}
@@ -44,12 +52,12 @@ export class AssociationSimpleCaptionsProvider implements CaptionsProvider {
4452
return this.unavailableCaption;
4553
}
4654

47-
const captionValue = this.formatter.get(item);
48-
if (!captionValue || captionValue.status === "unavailable") {
55+
this.value = this.formatter.get(item);
56+
if (!this.value || this.value.status === "unavailable") {
4957
return this.unavailableCaption;
5058
}
5159

52-
return captionValue.value ?? "";
60+
return this.value.value ?? "";
5361
}
5462

5563
getCustomContent(value: string | null): ReactNode | null {

packages/pluggableWidgets/combobox-web/src/helpers/Database/DatabaseCaptionsProvider.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { DynamicValue, ListAttributeValue, ListExpressionValue, ListWidgetValue, ObjectItem } from "mendix";
1+
import {
2+
DynamicValue,
3+
EditableValue,
4+
ListAttributeValue,
5+
ListExpressionValue,
6+
ListWidgetValue,
7+
ObjectItem
8+
} from "mendix";
29
import { ReactNode, createElement } from "react";
310
import { OptionsSourceAssociationCustomContentTypeEnum } from "../../../typings/ComboboxProps";
411
import { CaptionPlacement, CaptionsProvider } from "../types";
@@ -19,6 +26,7 @@ export class DatabaseCaptionsProvider implements CaptionsProvider {
1926
protected customContent?: ListWidgetValue;
2027
protected customContentType: OptionsSourceAssociationCustomContentTypeEnum = "no";
2128
attribute?: ListAttributeValue<string | Big>;
29+
value?: DynamicValue<string> | EditableValue<string>;
2230
emptyCaption = "";
2331
overrideCaption: string | null | undefined = undefined;
2432

@@ -55,12 +63,12 @@ export class DatabaseCaptionsProvider implements CaptionsProvider {
5563
if (!item) {
5664
return this.unavailableCaption;
5765
}
58-
const captionValue = this.formatter?.get(item);
59-
if (captionValue?.status === "unavailable") {
66+
this.value = this.formatter?.get(item);
67+
if (this.value?.status === "unavailable") {
6068
return this.unavailableCaption;
6169
}
6270

63-
return captionValue?.value ?? "";
71+
return this.value?.value ?? "";
6472
}
6573

6674
getCustomContent(value: string | null): ReactNode | null {

packages/pluggableWidgets/combobox-web/src/helpers/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
SelectionMethodEnum
1010
} from "../../typings/ComboboxProps";
1111
import { ThreeStateCheckBoxEnum } from "@mendix/widget-plugin-component-kit/ThreeStateCheckBox";
12-
import { ListValue } from "mendix";
12+
import { DynamicValue, EditableValue, ListValue } from "mendix";
1313

1414
export type Status = "unavailable" | "loading" | "available";
1515
export type CaptionPlacement = "label" | "options";
@@ -21,6 +21,7 @@ export interface CaptionsProvider {
2121
get(value: string | null): string;
2222
render(value: (string | null) | (number | null), placement?: CaptionPlacement, htmlFor?: string): ReactNode;
2323
emptyCaption: string;
24+
value?: DynamicValue<string> | EditableValue<string>;
2425
}
2526
export interface ValuesProvider<T> {
2627
get(key: string | null): T | undefined;

0 commit comments

Comments
 (0)