Skip to content

Commit

Permalink
#493 done (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaadin-miki authored Nov 24, 2023
1 parent 0d598f5 commit e1c4bfc
Show file tree
Hide file tree
Showing 26 changed files with 170 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public ItemGrid<Class<? extends Component>> getComponent() {
result.setAlignItems(FlexComponent.Alignment.CENTER);
result.setPadding(true);
return result;
});
}).withHelperText("(you can select at most one item)")
.withLabel("Select your favourite component:");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.function.SerializableBiConsumer;
import com.vaadin.flow.function.SerializableBiFunction;
import org.vaadin.miki.superfields.componentselect.ComponentSelect;
Expand All @@ -17,6 +19,8 @@
* @author miki
* @since 2023-11-17
*/
@Tag("button-select")
@JsModule("./button-select.js")
public class ButtonSelect<T> extends ComponentSelect<Button, T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.function.SerializablePredicate;
import com.vaadin.flow.function.SerializableSupplier;
Expand Down Expand Up @@ -36,7 +38,9 @@
* @param <T> Type of the element in the collection.
* @param <C> Type of the collection.
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@Tag("collection-field")
@CssImport(value = "./styles/label-positions.css", themeFor = "collection-field")
@JsModule("./collection-field.js")
public class CollectionField<T, C extends Collection<T>> extends CustomField<C>
implements CollectionController, WithIdMixin<CollectionField<T, C>>, HasStyle,
WithCollectionValueComponentProviderMixin<T, CollectionField<T, C>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.function.SerializableSupplier;
import org.vaadin.miki.superfields.layouts.FlexLayoutHelpers;
Expand All @@ -23,6 +25,8 @@
* @author miki
* @since 2022-04-08
*/
@Tag("map-entry-field")
@JsModule("./map-entry-field.js")
public class MapEntryField<K, V> extends CustomField<Map.Entry<K, V>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.function.SerializablePredicate;
import com.vaadin.flow.function.SerializableSupplier;
import org.vaadin.miki.markers.WithHelperMixin;
Expand Down Expand Up @@ -36,6 +38,8 @@
* @since 2022-04-08
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@Tag("map-field")
@JsModule("./map-field.js")
public class MapField<K, V> extends CustomField<Map<K, V>> implements HasStyle,
WithIdMixin<MapField<K, V>>, WithValueMixin<AbstractField.ComponentValueChangeEvent<CustomField<Map<K, V>>, Map<K, V>>, Map<K, V>, MapField<K, V>>,
WithHelperPositionableMixin<MapField<K, V>>, WithHelperMixin<MapField<K, V>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import com.vaadin.flow.component.Focusable;
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.function.SerializableBiConsumer;
import com.vaadin.flow.function.SerializableBiFunction;
import org.vaadin.miki.markers.WithHelperMixin;
Expand Down Expand Up @@ -35,6 +37,8 @@
* @author miki
* @since 2023-11-14
*/
@Tag("component-select")
@JsModule("./component-select.js")
public class ComponentSelect<C extends Component & ClickNotifier<C>, T> extends CustomField<T>
implements WithItemsMixin<T, ComponentSelect<C, T>>, HasStyle, WithIdMixin<ComponentSelect<C, T>>,
WithLabelMixin<ComponentSelect<C, T>>, WithLabelPositionableMixin<ComponentSelect<C, T>>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.vaadin.miki.superfields.gridselect;

import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.data.selection.SelectionEvent;

Expand All @@ -12,8 +11,6 @@
* @author miki
* @since 2020-12-09
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@CssImport(value = "./styles/label-positions-grids.css", themeFor = "vaadin-custom-field")
public abstract class AbstractGridSelect<V, F> extends CustomField<F> {

private final Grid<V> grid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.vaadin.miki.superfields.gridselect;

import com.vaadin.flow.component.AbstractField;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridMultiSelectionModel;
import com.vaadin.flow.data.selection.SelectionEvent;
Expand All @@ -10,8 +13,8 @@
import org.vaadin.miki.markers.WithIdMixin;
import org.vaadin.miki.markers.WithItemsMixin;
import org.vaadin.miki.markers.WithLabelMixin;
import org.vaadin.miki.markers.WithMaximumSelectionSizeMixin;
import org.vaadin.miki.markers.WithLabelPositionableMixin;
import org.vaadin.miki.markers.WithMaximumSelectionSizeMixin;
import org.vaadin.miki.markers.WithValueMixin;

import java.util.Collection;
Expand All @@ -24,6 +27,10 @@
* @author miki
* @since 2020-12-09
*/
@Tag("grid-multi-select")
@CssImport(value = "./styles/label-positions.css", themeFor = "grid-multi-select")
@CssImport(value = "./styles/label-positions-grids.css", themeFor = "grid-multi-select")
@JsModule("./grid-multi-select.js")
public class GridMultiSelect<V> extends AbstractGridSelect<V, Set<V>>
implements WithIdMixin<GridMultiSelect<V>>, WithItemsMixin<V, GridMultiSelect<V>>,
WithMaximumSelectionSizeMixin<GridMultiSelect<V>>, WithHelperMixin<GridMultiSelect<V>>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.vaadin.miki.superfields.gridselect;

import com.vaadin.flow.component.AbstractField;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.grid.Grid;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
Expand All @@ -20,6 +23,10 @@
* @author miki
* @since 2020-08-07
*/
@Tag("grid-select")
@CssImport(value = "./styles/label-positions.css", themeFor = "grid-select")
@CssImport(value = "./styles/label-positions-grids.css", themeFor = "grid-select")
@JsModule("./grid-select.js")
public class GridSelect<V> extends AbstractGridSelect<V, V>
implements WithIdMixin<GridSelect<V>>, WithItemsMixin<V, GridSelect<V>>, WithHelperMixin<GridSelect<V>>,
WithHelperPositionableMixin<GridSelect<V>>, WithLabelMixin<GridSelect<V>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.data.binder.HasItems;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
import org.vaadin.miki.markers.WithIdMixin;
import org.vaadin.miki.markers.WithItemsMixin;
import org.vaadin.miki.markers.WithLabelMixin;
import org.vaadin.miki.markers.WithLabelPositionableMixin;
import org.vaadin.miki.markers.WithValueMixin;

import java.util.ArrayList;
Expand All @@ -36,10 +38,12 @@
* @since 2020-04-14
*/
@Tag("item-grid")
@JsModule("./item-grid.js")
public class ItemGrid<T>
extends CustomField<T>
implements HasItems<T>, HasStyle, WithItemsMixin<T, ItemGrid<T>>, WithIdMixin<ItemGrid<T>>,
implements HasStyle, WithItemsMixin<T, ItemGrid<T>>, WithIdMixin<ItemGrid<T>>,
WithHelperMixin<ItemGrid<T>>, WithHelperPositionableMixin<ItemGrid<T>>,
WithLabelMixin<ItemGrid<T>>, WithLabelPositionableMixin<ItemGrid<T>>,
WithValueMixin<AbstractField.ComponentValueChangeEvent<CustomField<T>, T>, T, ItemGrid<T>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.vaadin.flow.component.HasHelper;
import com.vaadin.flow.component.HasLabel;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.JsModule;
import org.vaadin.miki.markers.HasIndex;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
Expand All @@ -32,6 +34,8 @@
* @author miki
* @since 2021-09-03
*/
@Tag("header-footer-field-wrapper")
@JsModule("./header-footer-field-wrapper.js")
public class HeaderFooterFieldWrapper<T,
H extends Component & HasComponents,
F extends Component & HasComponents>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import com.vaadin.flow.component.HasComponents;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
import com.vaadin.flow.function.SerializableSupplier;
import org.slf4j.Logger;
Expand Down Expand Up @@ -50,6 +52,8 @@
* @since 2022-05-16
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@Tag("object-field")
@JsModule("./object-field.js")
public class ObjectField<T> extends CustomField<T>
implements HasStyle, WithHelperMixin<ObjectField<T>>, WithHelperPositionableMixin<ObjectField<T>>,
WithIdMixin<ObjectField<T>>, WithLabelMixin<ObjectField<T>>, WithLabelPositionableMixin<ObjectField<T>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.vaadin.flow.component.AbstractField;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.Text;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.function.SerializableFunction;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
Expand All @@ -23,6 +25,8 @@
* @since 2022-04-08
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@Tag("label-field")
@JsModule("./label-field.js")
public class LabelField<V> extends CustomField<V> implements HasStyle, WithLabelMixin<LabelField<V>>,
WithHelperPositionableMixin<LabelField<V>>, WithHelperMixin<LabelField<V>>,
WithLabelPositionableMixin<LabelField<V>>, WithIdMixin<LabelField<V>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasStyle;
import com.vaadin.flow.component.HasValue;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.customfield.CustomField;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.function.SerializableSupplier;
import org.vaadin.miki.markers.WithHelperMixin;
import org.vaadin.miki.markers.WithHelperPositionableMixin;
Expand All @@ -28,6 +30,8 @@
* @since 2022-04-11
*/
@CssImport(value = "./styles/label-positions.css", themeFor = "vaadin-custom-field")
@Tag("variant-field")
@JsModule("./variant-field.js")
public class VariantField extends CustomField<Object> implements HasStyle,
WithLabelMixin<VariantField>,
WithHelperMixin<VariantField>, WithHelperPositionableMixin<VariantField>,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class ButtonSelect extends CustomField {

static get is() {return 'button-select'}

}

customElements.define(ButtonSelect.is, ButtonSelect);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class CollectionField extends CustomField {

static get is() {return 'collection-field'}

}

customElements.define(CollectionField.is, CollectionField);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class ComponentSelect extends CustomField {

static get is() {return 'component-select'}

}

customElements.define(ComponentSelect.is, ComponentSelect);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class GridMultiSelect extends CustomField {

static get is() {return 'grid-multi-select'}

}

customElements.define(GridMultiSelect.is, GridMultiSelect);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class GridSelect extends CustomField {

static get is() {return 'grid-select'}

}

customElements.define(GridSelect.is, GridSelect);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class HeaderFooterFieldWrapper extends CustomField {

static get is() {return 'header-footer-field-wrapper'}

}

customElements.define(HeaderFooterFieldWrapper.is, HeaderFooterFieldWrapper);
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {CustomField} from '@vaadin/custom-field';

export class ItemGrid extends CustomField {

static get is() {
return 'item-grid';
}

}

customElements.define(ItemGrid.is, ItemGrid);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class LabelField extends CustomField {

static get is() {return 'label-field'}

}

customElements.define(LabelField.is, LabelField);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class MapEntryField extends CustomField {

static get is() {return 'map-entry-field'}

}

customElements.define(MapEntryField.is, MapEntryField);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {CustomField} from '@vaadin/custom-field';

class MapField extends CustomField {

static get is() {return 'map-field'}

}

customElements.define(MapField.is, MapField);
Loading

0 comments on commit e1c4bfc

Please sign in to comment.