diff --git a/src/CustomDropdown.xml b/src/CustomDropdown.xml index 60fe934..f3721fc 100644 --- a/src/CustomDropdown.xml +++ b/src/CustomDropdown.xml @@ -172,6 +172,23 @@ Menu height Max dropdown menu height in pixels + + Menu placement + Default placement of the menu in relation to the control. 'auto' will flip when there isn't enough space below the control. + + Bottom + Auto + Top + + + + Menu position + The CSS position value of the menu, when "fixed" extra layout management is required. + + Absolute + Fixed + + \ No newline at end of file diff --git a/src/components/CustomDropdown/index.tsx b/src/components/CustomDropdown/index.tsx index 7185df9..1f474e2 100644 --- a/src/components/CustomDropdown/index.tsx +++ b/src/components/CustomDropdown/index.tsx @@ -1,5 +1,6 @@ import { createElement, ReactElement, Component } from "react"; import Select from "react-select"; +import { MenuPlacement } from "react-select"; import Creatable from "react-select/creatable"; import { Styles } from "react-select/src/styles"; import { OptionTypeBase } from "react-select/src/types"; @@ -383,6 +384,8 @@ export default class CustomDropdown extends Component loaded} maxMenuHeight={this.props.menuHeight} + menuPlacement={this.props.menuPlacement} + menuPosition={this.props.menuPosition} onFocus={this.handleFocus} {...propsOverride} /> @@ -412,6 +415,8 @@ export default class CustomDropdown extends Component loaded} maxMenuHeight={this.props.menuHeight} + menuPlacement={this.props.menuPlacement} + menuPosition={this.props.menuPosition} onFocus={this.handleFocus} {...propsOverride} /> diff --git a/tests/testProject/CustomDropdownTestProject.mpr b/tests/testProject/CustomDropdownTestProject.mpr index a418948..a3e6482 100644 Binary files a/tests/testProject/CustomDropdownTestProject.mpr and b/tests/testProject/CustomDropdownTestProject.mpr differ diff --git a/tests/testProject/widgets/mendix.CustomDropdown.mpk b/tests/testProject/widgets/mendix.CustomDropdown.mpk index 709dc8e..f3da5ed 100644 Binary files a/tests/testProject/widgets/mendix.CustomDropdown.mpk and b/tests/testProject/widgets/mendix.CustomDropdown.mpk differ diff --git a/typings/CustomDropdownProps.d.ts b/typings/CustomDropdownProps.d.ts index cc6ede9..8ef0b08 100644 --- a/typings/CustomDropdownProps.d.ts +++ b/typings/CustomDropdownProps.d.ts @@ -6,6 +6,9 @@ import { CSSProperties } from "react"; import { ActionValue, EditableValue, ListValue, ListAttributeValue, ListExpressionValue } from "mendix"; +export type MenuPlacementEnum = "bottom" | "auto" | "top"; +export type MenuPositionEnum = "absolute" | "fixed"; + export interface CustomDropdownContainerProps { name: string; class: string; @@ -42,13 +45,13 @@ export interface CustomDropdownContainerProps { className: string; classNamePrefix: string; menuHeight: number; + menuPlacement: MenuPlacementEnum; + menuPosition: MenuPositionEnum; } export interface CustomDropdownPreviewProps { - className: string; + class: string; style: string; - styleObject?: CSSProperties; - readOnly: boolean; contextObjId: string; contextObjLabel: string; paginate: boolean; @@ -80,4 +83,6 @@ export interface CustomDropdownPreviewProps { className: string; classNamePrefix: string; menuHeight: number | null; + menuPlacement: MenuPlacementEnum; + menuPosition: MenuPositionEnum; }