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 Dec 12, 2024
1 parent ab53faa commit d1374a1
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 214 deletions.
38 changes: 5 additions & 33 deletions packages/pluggableWidgets/combobox-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,59 +10,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- We fixed an issue where placeholder failed to shown on database source.

## [2.1.2] - 2024-12-09

### Fixed

- We fixed an issue where onchange event on database source triggered directly onload.

- We fixed an issue where selected value sometimes shows unavailable text on lazy loaded content.

## [2.1.1] - 2024-11-15

### Fixed

- We fixed an issue where database optional value attribute breaks on runtime when not being set.

- We fixed an issue where custom content not shown on design preview and runtime for database datasource.

## [2.1.0] - 2024-10-29

### Added

- We added support for attribute with **Long** type.

### Changed

- We make **Value** no longer required if the **Target attribute** is not set for database datasource.

- We restructure **Attribute** group configuration and rename it as **Store value**.

## [2.0.2] - 2024-10-03

### Fixed

- We fixed an issue where the onChange event was not being triggered when selecting an item for the first time.

- We fixed an issue where the combo box values would not refresh after toggling its read-only state.

## [2.0.1] - 2024-08-16

### Fixed

- We fixed an issue with the toolbar visibility when a combobox menu overlays it.

## [2.0.0] - 2024-08-09
- We fixed a11y issue where aria-required not applied in the widget.

### Added

- We added the ability to auto label combobox, based on the set attributes.
- We added support for attribute with **Long** type.

- We implement the selection API for combobox that use database datasource, which allows the widget selection to be listened into.
### Changed

### Fixed
- We make **Value** no longer required if the **Target attribute** is not set for database datasource.

- We fixed a11y issue where aria-required not applied in the widget.
- We restructure **Attribute** group configuration and rename it as **Store value**.

## [1.6.3] - 2024-08-07

Expand Down
2 changes: 1 addition & 1 deletion 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": "2.1.3",
"version": "1.7.0",
"description": "Configurable Combo box widget with suggestions and autocomplete.",
"copyright": "© Mendix Technology BV 2024. All rights reserved.",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const DATABASE_SOURCE_CONFIG: Array<keyof ComboboxPreviewProps> = [
"optionsSourceDatabaseDataSource",
"optionsSourceDatabaseDefaultValue",
"optionsSourceDatabaseValueAttribute",
"optionsSourceDatabaseItemSelection",
"databaseAttributeString",
"onChangeDatabaseEvent"
];
Expand Down Expand Up @@ -119,13 +118,7 @@ export function getProperties(values: ComboboxPreviewProps, defaultProperties: P
} else {
hidePropertiesIn(defaultProperties, values, ["selectedItemsStyle"]);
}
if (values.optionsSourceDatabaseItemSelection === "Multi") {
hidePropertiesIn(defaultProperties, values, [
"optionsSourceDatabaseValueAttribute",
"databaseAttributeString",
"optionsSourceDatabaseDefaultValue"
]);
}

if (values.databaseAttributeString.length === 0) {
hidePropertiesIn(defaultProperties, values, [
"optionsSourceDatabaseValueAttribute",
Expand Down
20 changes: 6 additions & 14 deletions packages/pluggableWidgets/combobox-web/src/Combobox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
</property>

<!-- ENUM & BOOLEAN-->
<property key="attributeEnumeration" type="attribute" required="true" setLabel="true">
<property key="attributeEnumeration" type="attribute" required="true">
<caption>Attribute</caption>
<description />
<attributeTypes>
<attributeType name="Enum" />
</attributeTypes>
</property>
<property key="attributeBoolean" type="attribute" required="true" setLabel="true">
<property key="attributeBoolean" type="attribute" required="true">
<caption>Attribute</caption>
<description />
<attributeTypes>
Expand All @@ -50,14 +50,6 @@
<caption>Selectable objects</caption>
<description />
</property>
<property key="optionsSourceDatabaseItemSelection" type="selection" dataSource="optionsSourceDatabaseDataSource" onChange="onChangeDatabaseEvent">
<caption>Selection type</caption>
<description />
<selectionTypes>
<selectionType name="Single" />
<selectionType name="Multi" />
</selectionTypes>
</property>
</propertyGroup>
<propertyGroup caption="Caption">
<!-- CAPTIONS -->
Expand Down Expand Up @@ -114,7 +106,7 @@
<attributeType name="Enum" />
</attributeTypes>
</property>
<property key="databaseAttributeString" type="attribute" setLabel="true" required="false">
<property key="databaseAttributeString" type="attribute">
<caption>Target attribute</caption>
<description />
<attributeTypes>
Expand All @@ -124,7 +116,7 @@
<attributeType name="Enum" />
</attributeTypes>
</property>
<property key="optionsSourceDatabaseDefaultValue" type="expression" required="false">
<property key="optionsSourceDatabaseDefaultValue" type="expression">
<caption>Default value</caption>
<description />
<returnType assignableTo="databaseAttributeString" />
Expand All @@ -133,7 +125,7 @@
</propertyGroup>
<propertyGroup caption="Attribute">
<!-- ASSOCIATION -->
<property key="attributeAssociation" type="association" selectableObjects="optionsSourceAssociationDataSource" required="true" setLabel="true">
<property key="attributeAssociation" type="association" selectableObjects="optionsSourceAssociationDataSource" required="true">
<caption>Entity</caption>
<description />
<associationTypes>
Expand All @@ -149,7 +141,7 @@
<!-- END OPTIONS SOURCE -->
<!-- STATIC-->
<propertyGroup caption="Values">
<property key="staticAttribute" type="attribute" required="true" setLabel="true">
<property key="staticAttribute" type="attribute" required="true">
<caption>Attribute</caption>
<description />
<attributeTypes>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EditableValue, SelectionSingleValue } from "mendix";
import { EditableValue } from "mendix";
import { ComboboxContainerProps } from "../../../typings/ComboboxProps";
import { _valuesIsEqual } from "../utils";
import { BaseDatabaseSingleSelector } from "./BaseDatabaseSingleSelector";
Expand All @@ -12,7 +12,6 @@ export class DatabaseSingleSelectionSelector<
validation?: string = undefined;
values: DatabaseValuesProvider;
protected _attr: R | undefined;
private selection?: SelectionSingleValue;

constructor() {
super();
Expand Down Expand Up @@ -86,25 +85,12 @@ export class DatabaseSingleSelectionSelector<
this.readOnly = targetAttribute?.readOnly ?? false;
this.status = targetAttribute?.status ?? ds.status;
this.validation = targetAttribute?.validation;
this.selection = props.optionsSourceDatabaseItemSelection as SelectionSingleValue;

if (this.selection.selection === undefined) {
const objectId = this.options.getAll().find(option => {
return targetAttribute && _valuesIsEqual(targetAttribute?.value, this.values.get(option));
});
if (objectId) {
this.selection.setSelection(this.options._optionToValue(objectId));
}
}
}

setValue(objectId: string | null): void {
const value = this.values.get(objectId) as T;
this.lastSetValue = value;
this._attr?.setValue(value);
if (objectId !== (this.selection?.selection?.id ?? "")) {
this.selection?.setSelection(this.options._optionToValue(objectId));
}
super.setValue(objectId);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ComboboxContainerProps } from "../../typings/ComboboxProps";
import { AssociationMultiSelector } from "./Association/AssociationMultiSelector";
import { AssociationSingleSelector } from "./Association/AssociationSingleSelector";
import { DatabaseMultiSelectionSelector } from "./Database/DatabaseMultiSelectionSelector";
import { DatabaseSingleSelectionSelector } from "./Database/DatabaseSingleSelectionSelector";
import { EnumBooleanSingleSelector } from "./EnumBool/EnumBoolSingleSelector";
import { StaticSingleSelector } from "./Static/StaticSingleSelector";
Expand All @@ -19,11 +18,7 @@ export function getSelector(props: ComboboxContainerProps): Selector {
throw new Error(`'optionsSourceType' of type '${props.optionsSourceType}' is not supported`);
}
} else if (props.source === "database") {
if (props.optionsSourceDatabaseItemSelection?.type === "Multi") {
return new DatabaseMultiSelectionSelector();
} else {
return new DatabaseSingleSelectionSelector();
}
return new DatabaseSingleSelectionSelector();
} else if (props.source === "static") {
return new StaticSingleSelector();
}
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="2.1.3" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="Combobox" version="1.7.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="Combobox.xml" />
</widgetFiles>
Expand Down
Loading

0 comments on commit d1374a1

Please sign in to comment.