Skip to content

Commit d9fdeb8

Browse files
authored
[MOO-2069] Generate EditableImageValue for native images with allowUpload set to true (#175)
## Checklist - Contains unit tests ✅ - Contains breaking changes ❌ - Compatible with: MX 11 - Did you update version and changelog? ✅ - PR title properly formatted (`[XX-000]: description`)? ✅ ## This PR contains - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Other (describe) ## What is the purpose of this PR? We have integrated allowUpload property for image type for our use case in native signature widget and set its value to true. For it we will have to change the type for it to "EditableImageValue<NativeImage>" . Updated the existing test's output accordingly.
2 parents 084165d + 32b8899 commit d9fdeb8

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/pluggable-widgets-tools/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- We added support for the `allowUpload` attribute on image properties in native widgets, generating `EditableImageValue<NativeImage>` when enabled, introduced in Mendix 11.11.
12+
913
### Changed
1014

1115
- We changed the order of imports in generated widget prop types to match that of the eslint sort-imports rule.

packages/pluggable-widgets-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mendix/pluggable-widgets-tools",
3-
"version": "11.8.2",
3+
"version": "11.11.0",
44
"description": "Mendix Pluggable Widgets Tools",
55
"engines": {
66
"node": ">=20"

packages/pluggable-widgets-tools/src/typings-generator/__tests__/outputs/image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const imageNativeOutput = `export interface MyWidgetProps<Style> {
3232
style: Style[];
3333
image: DynamicValue<NativeImage>;
3434
image2?: DynamicValue<NativeImage>;
35-
image3: DynamicValue<NativeImage>;
35+
image3: EditableImageValue<NativeImage>;
3636
description: EditableValue<string>;
3737
action?: ActionValue;
3838
}`;

packages/pluggable-widgets-tools/src/typings-generator/generateClientTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ function toClientPropType(
131131
case "icon":
132132
return isNative ? "DynamicValue<NativeIcon>" : "DynamicValue<WebIcon>";
133133
case "image":
134-
return isNative ? "DynamicValue<NativeImage>" : prop.$.allowUpload === "true" ? "EditableImageValue<WebImage>" : "DynamicValue<WebImage>";
134+
const imageType = isNative ? "NativeImage" : "WebImage";
135+
return `${prop.$.allowUpload === "true" ? "EditableImageValue" : "DynamicValue"}<${imageType}>`;
135136
case "file":
136137
return prop.$.allowUpload ? "EditableFileValue" : "DynamicValue<FileValue>";
137138
case "datasource":

0 commit comments

Comments
 (0)