Skip to content

Commit

Permalink
chore(cb): revert changes so combobox can be use on 9.24
Browse files Browse the repository at this point in the history
  • Loading branch information
gjulivan committed Jan 28, 2025
1 parent b722ffb commit 50ad999
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/combobox-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

- We fixed an issue where database onchange failed to trigger, If you have set your onChange event using database source on v1.7.0 previously, it will clear again upon upgrade. But it will be seamless upgrade from 1.6.x version.

## [1.7.0] - 2024-12-17

### Fixed

- We fixed an issue where placeholder failed to shown on database source.
Expand Down
7 changes: 4 additions & 3 deletions packages/pluggableWidgets/combobox-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mendix/combobox-web",
"widgetName": "Combobox",
"version": "1.7.0",
"version": "1.7.1",
"description": "Configurable Combo box widget with suggestions and autocomplete.",
"copyright": "© Mendix Technology BV 2024. All rights reserved.",
"license": "Apache-2.0",
Expand All @@ -19,9 +19,10 @@
"mpkName": "com.mendix.widget.web.Combobox.mpk"
},
"marketplace": {
"minimumMXVersion": "10.7.0",
"minimumMXVersion": "9.24.0.2965",
"appNumber": 219304,
"appName": "Combo box"
"appName": "Combo box",
"reactReady": true
},
"testProject": {
"githubUrl": "https://github.com/mendix/testProjects",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ const DATABASE_SOURCE_CONFIG: Array<keyof ComboboxPreviewProps> = [
"optionsSourceDatabaseDataSource",
"optionsSourceDatabaseDefaultValue",
"optionsSourceDatabaseValueAttribute",
"databaseAttributeString",
"onChangeDatabaseEvent"
"databaseAttributeString"
];

const ASSOCIATION_SOURCE_CONFIG: Array<keyof ComboboxPreviewProps> = [
Expand Down Expand Up @@ -99,7 +98,6 @@ export function getProperties(values: ComboboxPreviewProps, defaultProperties: P
"selectionMethod",
"selectAllButton",
"selectAllButtonCaption",
"onChangeEvent",
...ASSOCIATION_SOURCE_CONFIG
]);
if (values.optionsSourceDatabaseDataSource === null) {
Expand Down
4 changes: 0 additions & 4 deletions packages/pluggableWidgets/combobox-web/src/Combobox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@
<caption>On change action</caption>
<description />
</property>
<property key="onChangeDatabaseEvent" type="action" required="false">
<caption>On change action</caption>
<description />
</property>
<property key="onEnterEvent" type="action" required="false">
<caption>On enter action</caption>
<description />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { EditableValue } from "mendix";
import { ActionValue, EditableValue } from "mendix";
import { ComboboxContainerProps } from "../../../typings/ComboboxProps";
import { _valuesIsEqual } from "../utils";
import { BaseDatabaseSingleSelector } from "./BaseDatabaseSingleSelector";
import { DatabaseValuesProvider } from "./DatabaseValuesProvider";
import { extractDatabaseProps } from "./utils";
import { executeAction } from "@mendix/widget-plugin-platform/framework/execute-action";

export class DatabaseSingleSelectionSelector<
T extends string | Big,
R extends EditableValue<T>
> extends BaseDatabaseSingleSelector<T> {
validation?: string = undefined;
values: DatabaseValuesProvider;
private onChangeEvent?: ActionValue;
protected _attr: R | undefined;

constructor() {
Expand All @@ -29,6 +31,7 @@ export class DatabaseSingleSelectionSelector<
ds,
emptyOption,
emptyValue,
onChangeEvent,
lazyLoading,
valueSourceAttribute
} = extractDatabaseProps(props);
Expand Down Expand Up @@ -85,12 +88,14 @@ export class DatabaseSingleSelectionSelector<
this.readOnly = targetAttribute?.readOnly ?? false;
this.status = targetAttribute?.status ?? ds.status;
this.validation = targetAttribute?.validation;
this.onChangeEvent = onChangeEvent;
}

setValue(objectId: string | null): void {
const value = this.values.get(objectId) as T;
this.lastSetValue = value;
this._attr?.setValue(value);
super.setValue(objectId);
executeAction(this.onChangeEvent);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Big from "big.js";
import {
ActionValue,
DynamicValue,
EditableValue,
ListAttributeValue,
Expand All @@ -13,7 +15,6 @@ import {
OptionsSourceAssociationCustomContentTypeEnum,
OptionsSourceDatabaseCaptionTypeEnum
} from "../../../typings/ComboboxProps";
import Big from "big.js";

type ExtractionReturnValue = {
targetAttribute?: EditableValue<string | Big>;
Expand All @@ -26,6 +27,7 @@ type ExtractionReturnValue = {
emptyOption?: DynamicValue<string>;
emptyValue?: DynamicValue<string | Big>;
filterType: FilterTypeEnum;
onChangeEvent?: ActionValue;
lazyLoading: boolean;
loadingType: LoadingTypeEnum;
valueSourceAttribute: ListAttributeValue<string | Big> | undefined;
Expand All @@ -34,6 +36,7 @@ type ExtractionReturnValue = {
export function extractDatabaseProps(props: ComboboxContainerProps): ExtractionReturnValue {
const targetAttribute = props.databaseAttributeString;
const filterType = props.filterType;
const onChangeEvent = props.onChangeEvent;

const ds = props.optionsSourceDatabaseDataSource;
if (!ds) {
Expand Down Expand Up @@ -84,6 +87,7 @@ export function extractDatabaseProps(props: ComboboxContainerProps): ExtractionR
emptyOption,
emptyValue,
filterType,
onChangeEvent,
lazyLoading,
loadingType,
valueSourceAttribute
Expand Down
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/combobox-web/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="Combobox" version="1.7.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="Combobox" version="1.7.1" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="Combobox.xml" />
</widgetFiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export interface ComboboxContainerProps {
selectAllButtonCaption: DynamicValue<string>;
readOnlyStyle: ReadOnlyStyleEnum;
onChangeEvent?: ActionValue;
onChangeDatabaseEvent?: ActionValue;
onEnterEvent?: ActionValue;
onLeaveEvent?: ActionValue;
ariaRequired: boolean;
Expand Down Expand Up @@ -133,7 +132,6 @@ export interface ComboboxPreviewProps {
selectAllButtonCaption: string;
readOnlyStyle: ReadOnlyStyleEnum;
onChangeEvent: {} | null;
onChangeDatabaseEvent: {} | null;
onEnterEvent: {} | null;
onLeaveEvent: {} | null;
ariaRequired: boolean;
Expand Down

0 comments on commit 50ad999

Please sign in to comment.