Skip to content

Commit 5f7795e

Browse files
author
JelteMX
committed
Prepare for 1.1.0
1 parent f13e9df commit 5f7795e

File tree

6 files changed

+22
-28
lines changed

6 files changed

+22
-28
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Place the widget inside or outside a context object, based on if you need this f
5353

5454
Test-project can be found here: [https://dropdownpluginwidg-sandbox.mxapps.io](https://dropdownpluginwidg-sandbox.mxapps.io)
5555

56+
## Known issues
57+
58+
- **(Platform issue)** __A Dropdown container cannot be used directly in a listview, only a dataview.__ If you want to use a dropdown in a listview, make sure you surround your container with a dataview. Obviously this should be the same as the context. One way to do this is to add a dataview with a Nanoflow datasource. The Nanoflow simply passes the context object to the dataview
59+
5660
## Issues, suggestions and feature requests
5761

5862
Please report your issues/suggestions [here](https://github.com/JelteMX/mendix-dropdown-container/issues)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dropdowncontainer",
33
"widgetName": "DropdownContainer",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"description": "Place Mendix components in a dropdown",
66
"copyright": "Mendix 2019",
77
"author": "Jelte Lagendijk <jelte.lagendijk@mendix.com>",

src/DropdownContainer.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
1-
import { Component, ReactNode, createElement } from "react";
1+
import { ReactNode, createElement } from "react";
22
import { DropDown, getFilteredProps, DropDownProps } from "./components/DropDown";
33
import { hot } from "react-hot-loader/root";
44
import { DropdownContainerContainerProps } from "../typings/DropdownContainerProps";
55

66
import "./ui/DropdownContainer.scss";
77

8-
class DropdownContainer extends Component<DropdownContainerContainerProps> {
9-
constructor(props: DropdownContainerContainerProps) {
10-
super(props);
8+
const DropdownContainer = (props: DropdownContainerContainerProps): ReactNode => {
9+
const filteredProps: DropDownProps = getFilteredProps(props);
10+
const { generalButtonText, style, splitButtonSplitButtonClicked } = props;
1111

12-
this.handleClick = this.handleClick.bind(this);
13-
}
14-
15-
render(): ReactNode {
16-
const filteredProps: DropDownProps = getFilteredProps(this.props);
17-
const { generalButtonText, style } = this.props;
18-
19-
if (!generalButtonText) {
20-
return null;
12+
const handleClick = (): void => {
13+
if (splitButtonSplitButtonClicked && splitButtonSplitButtonClicked.canExecute) {
14+
splitButtonSplitButtonClicked.execute();
2115
}
22-
const buttonText = generalButtonText.status === "available" ? generalButtonText.value : "";
16+
};
2317

24-
return (
25-
<DropDown {...filteredProps} buttonText={buttonText} splitButtonAction={this.handleClick} style={style} />
26-
);
18+
if (!generalButtonText) {
19+
return null;
2720
}
21+
const buttonText = generalButtonText.status === "available" ? generalButtonText.value : "";
2822

29-
private handleClick(): void {
30-
if (this.props.splitButtonSplitButtonClicked && this.props.splitButtonSplitButtonClicked.canExecute) {
31-
this.props.splitButtonSplitButtonClicked.execute();
32-
}
33-
}
34-
}
23+
return <DropDown {...filteredProps} buttonText={buttonText} splitButtonAction={handleClick} style={style} />;
24+
};
3525

3626
export default hot(DropdownContainer);

src/DropdownContainer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<widget id="mendix.dropdowncontainer.DropdownContainer" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
2+
<widget id="mendix.dropdowncontainer.DropdownContainer" pluginWidget="true" offlineCapable="true"
33
supportedPlatform="Web"
44
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">

src/components/DropDown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class DropDownInternal extends Component<DropDownProps, DropDownState> {
9898
$menu.find("button, a").each(function() {
9999
const $el = $(this);
100100

101-
if (!$el.data(dropDownDataAttribute)) {
101+
if ($el && !$el.data(dropDownDataAttribute)) {
102102
$el.data(dropDownDataAttribute, true);
103103
const el = $el.get(0) as HTMLElement;
104104
el.addEventListener("click", closeMenu);
@@ -108,7 +108,7 @@ export class DropDownInternal extends Component<DropDownProps, DropDownState> {
108108
$menu.find(".mx-listview-clickable .mx-list").each(function() {
109109
const $el = $(this);
110110

111-
if (!$el.data(dropDownDataAttribute)) {
111+
if ($el && !$el.data(dropDownDataAttribute)) {
112112
$el.data(dropDownDataAttribute, true);
113113
const el = $el.get(0) as HTMLElement;
114114
el.addEventListener("click", closeMenu, true);

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="DropdownContainer" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="DropdownContainer" version="1.1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="DropdownContainer.xml"/>
66
</widgetFiles>

0 commit comments

Comments
 (0)