Skip to content

Commit

Permalink
Dropdown/dropup configurable
Browse files Browse the repository at this point in the history
The dropdown/dropup behaviour is now configurable (auto/down/up)
  • Loading branch information
JelleDekker committed Oct 20, 2023
1 parent 150669e commit fe7ee5e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bizzomatereactselect",
"widgetName": "BizzomateReactSelect",
"version": "1.2.5",
"version": "1.3.0",
"description": "React Select implementation for Mendix",
"copyright": "© Bizzomate BV 2023. All rights reserved.",
"author": "Jelle Dekker",
Expand Down
7 changes: 4 additions & 3 deletions src/BizzomateReactSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export function BizzomateReactSelect({
disabledAttr,
unstyled,
placeholderText,
tabIndex
tabIndex,
menuPlacement
}: BizzomateReactSelectContainerProps): ReactElement {
const [options, setOptions] = useState<readonly MxOption[]>();
const [value, setValue] = useState<PropsValue<MxOption>>();
Expand Down Expand Up @@ -155,7 +156,7 @@ export function BizzomateReactSelect({
return (
<Fragment>
<Select
tabIndex={tabIndex}
tabIndex={tabIndex ? tabIndex : undefined}
options={options}
value={value}
// @ts-ignore
Expand All @@ -166,7 +167,7 @@ export function BizzomateReactSelect({
isMulti={isMulti}
isDisabled={disabled}
unstyled={unstyled}
menuPlacement="auto"
menuPlacement={menuPlacement}
placeholder={placeholder && !disabled ? placeholder : null}
className={unstyled ? "mx-compound-control" : undefined}
classNamePrefix="react-select"
Expand Down
9 changes: 9 additions & 0 deletions src/BizzomateReactSelect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
</propertyGroup>
<propertyGroup caption="Advanced">
<propertyGroup caption="Appearance">
<property key="menuPlacement" type="enumeration" defaultValue="auto">
<caption>Drop down/up</caption>
<description/>
<enumerationValues>
<enumerationValue key="auto">Auto</enumerationValue>
<enumerationValue key="bottom">Drop down</enumerationValue>
<enumerationValue key="top">Drop up</enumerationValue>
</enumerationValues>
</property>
<property key="unstyled" type="boolean" defaultValue="true">
<caption>Unstyled</caption>
<description>Removes default styling</description>
Expand Down
2 changes: 1 addition & 1 deletion src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="BizzomateReactSelect" version="1.2.5" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="BizzomateReactSelect" version="1.3.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="BizzomateReactSelect.xml"/>
</widgetFiles>
Expand Down
4 changes: 4 additions & 0 deletions typings/BizzomateReactSelectProps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
import { ActionValue, DynamicValue, ListValue, ListAttributeValue, ListExpressionValue, ReferenceValue, ReferenceSetValue } from "mendix";

export type MenuPlacementEnum = "auto" | "bottom" | "top";

export interface BizzomateReactSelectContainerProps {
name: string;
tabIndex?: number;
Expand All @@ -14,6 +16,7 @@ export interface BizzomateReactSelectContainerProps {
objectsDatasource: ListValue;
assocCaption: ListExpressionValue<string>;
onChangeAction?: ActionValue;
menuPlacement: MenuPlacementEnum;
unstyled: boolean;
searchCaption?: ListExpressionValue<string>;
disabledAttr?: ListAttributeValue<boolean>;
Expand All @@ -26,6 +29,7 @@ export interface BizzomateReactSelectPreviewProps {
objectsDatasource: {} | { type: string } | null;
assocCaption: string;
onChangeAction: {} | null;
menuPlacement: MenuPlacementEnum;
unstyled: boolean;
searchCaption: string;
disabledAttr: string;
Expand Down

0 comments on commit fe7ee5e

Please sign in to comment.