diff --git a/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBox.ts b/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBox.ts index 55a6bf4640..efc0254590 100644 --- a/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBox.ts +++ b/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBox.ts @@ -136,6 +136,10 @@ export class FormFieldPropertiesBox extends GroupBox { } }); + let placeholderTextField = this.widget('PlaceholderField'); + placeholderTextField.setValue(this.field.placeholder); + placeholderTextField.on('propertyChange:value', event => this.field.setPlaceholder(event.newValue)); + let tooltipTextField = this.widget('TooltipTextField'); tooltipTextField.setValue(this.field.tooltipText); tooltipTextField.on('propertyChange:value', event => this.field.setTooltipText(event.newValue)); diff --git a/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBoxModel.ts b/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBoxModel.ts index 7f489f6352..085641e802 100644 --- a/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBoxModel.ts +++ b/code/widgets/org.eclipse.scout.jswidgets.ui.html/src/main/js/formfield/FormFieldPropertiesBoxModel.ts @@ -142,6 +142,11 @@ export default (): GroupBoxModel => ({ lookupCall: LabelWidthInPixelLookupCall, label: 'Label Width in Pixel' }, + { + id: 'PlaceholderField', + objectType: StringField, + label: 'Placeholder' + }, { id: 'TooltipTextField', objectType: StringField, @@ -193,6 +198,7 @@ export type FormFieldPropertiesBoxWidgetMap = { 'LabelField': StringField; 'LabelPositionField': SmartField; 'LabelWidthInPixelField': ProposalField; + 'PlaceholderField': StringField; 'TooltipTextField': StringField; 'TooltipAnchorField': SmartField; 'ErrorStatusField': SmartField; diff --git a/code/widgets/org.eclipse.scout.widgets.client/src/main/java/org/eclipse/scout/widgets/client/ui/forms/fields/formfield/AbstractFormFieldPropertiesBox.java b/code/widgets/org.eclipse.scout.widgets.client/src/main/java/org/eclipse/scout/widgets/client/ui/forms/fields/formfield/AbstractFormFieldPropertiesBox.java index 6f56c6cf9e..6bdf39f92f 100644 --- a/code/widgets/org.eclipse.scout.widgets.client/src/main/java/org/eclipse/scout/widgets/client/ui/forms/fields/formfield/AbstractFormFieldPropertiesBox.java +++ b/code/widgets/org.eclipse.scout.widgets.client/src/main/java/org/eclipse/scout/widgets/client/ui/forms/fields/formfield/AbstractFormFieldPropertiesBox.java @@ -50,6 +50,10 @@ public FieldStyleField getFieldStyleField() { return getFieldByClass(FieldStyleField.class); } + public PlaceholderField getPlaceholderField() { + return getFieldByClass(PlaceholderField.class); + } + @Order(1000) @ClassId("c136fb40-c06e-4c76-8020-68e5d21b5f90") public class EnabledField extends AbstractBooleanField { @@ -397,6 +401,25 @@ protected void execInitField() { } } + @Order(10500) + @ClassId("8b79e63a-f3bc-4e53-ad18-638a59ae4b48") + public class PlaceholderField extends AbstractStringField { + @Override + protected String getConfiguredLabel() { + return "Placeholder"; + } + + @Override + protected void execChangedValue() { + m_field.setPlaceholder(getValue()); + } + + @Override + protected void execInitField() { + setValue(m_field.getPlaceholder()); + } + } + @Order(11000) @ClassId("39042fa7-8106-4794-92ff-f0fa47519f6a") public class ErrorStatusField extends AbstractSmartField { diff --git a/docs/modules/migration/partials/migration-guide-27.1.adoc b/docs/modules/migration/partials/migration-guide-27.1.adoc index e3515e4bd1..30d709f3d2 100644 --- a/docs/modules/migration/partials/migration-guide-27.1.adoc +++ b/docs/modules/migration/partials/migration-guide-27.1.adoc @@ -119,3 +119,25 @@ In Scout Classic the following methods have been moved: So intead calling these methods on the page, call them on the corresponding Table. E.g. `myPage.getTable().setResultInfo()`. In Scout JS the function `Table.setLimitedResultTableStatus` was renamed to `Table.updateLimitedResultTableStatus` and requires no argument anymore as the table now directly holds the `limitedResult` property. Furthermore, the function `TableMaxResultsHelper.isLoadMoreDataPossible` now requires the whole table as argument for maximum flexiblity. + +== Support for placeholders + +Placeholder support has been added at top level and is therefore available throughout the form field hierarchy. +As a consequence, this change may affect existing customizations in your project. + +Scout Classic + +- `org.eclipse.scout.rt.client.ui.form.fields.IFormField.getPlaceholder()` +- `org.eclipse.scout.rt.client.ui.form.fields.IFormField.setPlaceholder(String)` +- `org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField.getConfiguredPlaceholder()` + +Scout JS + +- `FormField.placeholder` +- `FormField.setPlaceholder(string)` + +Please review your project for potential conflicts: + +- If you have implemented custom placeholder functionality, consider removing or migrating those customizations to the new built-in API. +- If you have introduced custom methods named `getPlaceholder()`, `setPlaceholder()`, or similar on form fields, consider renaming them to avoid naming conflicts and unintended behavior. + diff --git a/docs/modules/releasenotes/partials/release-notes-27.1.adoc b/docs/modules/releasenotes/partials/release-notes-27.1.adoc index 3f4835abde..4b148df232 100644 --- a/docs/modules/releasenotes/partials/release-notes-27.1.adoc +++ b/docs/modules/releasenotes/partials/release-notes-27.1.adoc @@ -47,3 +47,8 @@ Refer to the JsDoc of the class for details and a usage example. The new batch support is used by default by the `SmartColumn` and the `LookupColumn`. Furthermore, `StaticLookupCall` is now batched. + +== Support for placeholders + +Form fields can now be configured with placeholder text. +If supported by the field type, the configured text is displayed when the field is empty.