-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WTF-1967]: Generate widget property types for metadata associations (#…
…106) ## Checklist - Contains unit tests ✅ - Contains breaking changes ❌ - Compatible with: MX 🔟 - Did you update version and changelog? ❌ (This will be done after the release.) - 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? This PR introduces types generation for `AssociationMetaData`. ## Relevant changes Client types generator is adjusted to incorporate the recently developed PW API of flexible filtering over associations. ## What should be covered while testing? Testing should include, creating a `AssociationMetaData` property in the Widget Definition XML and verifying (after building the widget to trigger the generator) the resulting widget property TypeScript types.
- Loading branch information
Showing
9 changed files
with
141 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...es/pluggable-widgets-tools/src/typings-generator/__tests__/inputs/metadata-association.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export const associationMetaDataWebInput = `<?xml version="1.0" encoding="utf-8"?> | ||
<widget id="mendix.mywidget.MyWidget" needsEntityContext="true" offlineCapable="true" | ||
pluginWidget="true" supportedPlatform="Web" | ||
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../xsd/widget.xsd"> | ||
<properties> | ||
<propertyGroup caption="General"> | ||
<property key="data" type="datasource" isList="true"> | ||
<caption>Reference</caption> | ||
<description /> | ||
</property> | ||
<property key="metaReference" type="association" isMetaData="true" dataSource="data"> | ||
<caption>Reference</caption> | ||
<description /> | ||
<associationTypes> | ||
<associationType name="Reference" /> | ||
</associationTypes> | ||
</property> | ||
<property key="metaReferenceSet" type="association" isMetaData="true" dataSource="data"> | ||
<caption>Reference</caption> | ||
<description /> | ||
<associationTypes> | ||
<associationType name="ReferenceSet" /> | ||
</associationTypes> | ||
</property> | ||
</propertyGroup> | ||
</properties> | ||
</widget>`; | ||
export const associationMetaDataNativeInput = `<?xml version="1.0" encoding="utf-8"?> | ||
<widget id="mendix.mywidget.MyWidget" needsEntityContext="true" offlineCapable="true" | ||
pluginWidget="true" supportedPlatform="Native" | ||
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../xsd/widget.xsd"> | ||
<properties> | ||
<propertyGroup caption="General"> | ||
<property key="data" type="datasource" isList="true"> | ||
<caption>Reference</caption> | ||
<description /> | ||
</property> | ||
<property key="metaReference" type="association" isMetaData="true" dataSource="data"> | ||
<caption>Reference</caption> | ||
<description /> | ||
<associationTypes> | ||
<associationType name="Reference" /> | ||
</associationTypes> | ||
</property> | ||
<property key="metaReferenceSet" type="association" isMetaData="true" dataSource="data"> | ||
<caption>Reference</caption> | ||
<description /> | ||
<associationTypes> | ||
<associationType name="ReferenceSet" /> | ||
</associationTypes> | ||
</property> | ||
</propertyGroup> | ||
</properties> | ||
</widget>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...s/pluggable-widgets-tools/src/typings-generator/__tests__/outputs/metadata-association.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export const associationMetaDataWebOutput = `/** | ||
* This file was generated from MyWidget.xml | ||
* WARNING: All changes made to this file will be overwritten | ||
* @author Mendix Widgets Framework Team | ||
*/ | ||
import { CSSProperties } from "react"; | ||
import { AssociationMetaData, ListValue } from "mendix"; | ||
export interface MyWidgetContainerProps { | ||
name: string; | ||
class: string; | ||
style?: CSSProperties; | ||
tabIndex?: number; | ||
data: ListValue; | ||
metaReference: AssociationMetaData; | ||
metaReferenceSet: AssociationMetaData; | ||
} | ||
export interface MyWidgetPreviewProps { | ||
/** | ||
* @deprecated Deprecated since version 9.18.0. Please use class property instead. | ||
*/ | ||
className: string; | ||
class: string; | ||
style: string; | ||
styleObject?: CSSProperties; | ||
readOnly: boolean; | ||
renderMode?: "design" | "xray" | "structure"; | ||
data: {} | { caption: string } | { type: string } | null; | ||
metaReference: string; | ||
metaReferenceSet: string; | ||
} | ||
`; | ||
|
||
export const associationMetaDataNativeOutput = `export interface MyWidgetProps<Style> { | ||
name: string; | ||
style: Style[]; | ||
data: ListValue; | ||
metaReference: AssociationMetaData; | ||
metaReferenceSet: AssociationMetaData; | ||
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters