-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #356 #357 #359 #360 #361 done * #358 hopefully fixed (#363) * #364 done (#365) * (bot) release notes updated for 0.13.0 * (bot) version updated to 0.13.0 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: vaadin-miki <vaadin-miki@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
804004b
commit 2254090
Showing
29 changed files
with
2,707 additions
and
5,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
demo-v23/src/main/java/org/vaadin/miki/demo/builders/MapFieldBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.vaadin.miki.demo.builders; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.component.combobox.ComboBox; | ||
import org.vaadin.miki.demo.ContentBuilder; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.superfields.collections.CollectionValueComponentProvider; | ||
import org.vaadin.miki.superfields.collections.MapEntryField; | ||
import org.vaadin.miki.superfields.collections.MapField; | ||
import org.vaadin.miki.superfields.numbers.SuperIntegerField; | ||
import org.vaadin.miki.superfields.text.SuperTextField; | ||
import org.vaadin.miki.superfields.util.CollectionComponentProviders; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
|
||
/** | ||
* Builds content for {@link MapField}. | ||
* | ||
* @author miki | ||
* @since 2022-04-12 | ||
*/ | ||
@Order(5) | ||
public class MapFieldBuilder implements ContentBuilder<MapField<String, Integer>> { | ||
@Override | ||
public void buildContent(MapField<String, Integer> component, Consumer<Component[]> callback) { | ||
final Map<CollectionValueComponentProvider<Map.Entry<String, Integer>, ?>, String> providersWithCaptions = new LinkedHashMap<>(); | ||
|
||
final CollectionValueComponentProvider<Map.Entry<String, Integer>, MapEntryField<String, Integer>> fieldsOnly = CollectionComponentProviders.mapEntryField(SuperTextField::new, SuperIntegerField::new); | ||
providersWithCaptions.put(fieldsOnly, "Unlabelled text and integer fields"); | ||
providersWithCaptions.put(CollectionComponentProviders.rowWithRemoveButtonFirst( | ||
CollectionComponentProviders.mapEntryField("Key", SuperTextField::new, "Value", SuperIntegerField::new) | ||
, "Remove" | ||
), "Remove button and labelled text and integer fields"); | ||
|
||
// configure the combo box | ||
final ComboBox<CollectionValueComponentProvider<Map.Entry<String, Integer>, ?>> box = new ComboBox<>("Choose item layout:", providersWithCaptions.keySet()); | ||
box.setItemLabelGenerator(providersWithCaptions::get); | ||
box.addValueChangeListener(event -> component.setCollectionValueComponentProvider(event.getValue())); | ||
box.setAllowCustomValue(false); | ||
box.setValue(fieldsOnly); | ||
|
||
callback.accept(new Component[]{box}); | ||
|
||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
demo-v23/src/main/java/org/vaadin/miki/demo/builders/VariantFieldBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.vaadin.miki.demo.builders; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.component.button.Button; | ||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; | ||
import org.vaadin.miki.demo.ContentBuilder; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.superfields.variant.VariantField; | ||
|
||
import java.time.LocalDate; | ||
import java.util.function.Consumer; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Builds content for {@link VariantField}. | ||
* | ||
* @author miki | ||
* @since 2022-04-11 | ||
*/ | ||
@Order(80) | ||
public class VariantFieldBuilder implements ContentBuilder<VariantField> { | ||
|
||
@Override | ||
public void buildContent(VariantField component, Consumer<Component[]> callback) { | ||
final HorizontalLayout layout = new HorizontalLayout( | ||
Stream.of(new Object[]{"LocalDate", LocalDate.now()}, | ||
new Object[]{"number (Integer)", 42}, | ||
new Object[]{"String", "Pay no mind to the distant thunder"}) | ||
.map(data -> new Button("Set a " + data[0].toString(), event -> component.setValue(data[1]))) | ||
.toArray(Component[]::new) | ||
); | ||
layout.add(new Button("Set null (clear value)", event -> component.clear())); | ||
callback.accept(new Component[]{layout}); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
demo-v23/src/main/java/org/vaadin/miki/demo/providers/MapFieldProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.vaadin.miki.demo.providers; | ||
|
||
import org.vaadin.miki.demo.ComponentProvider; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.superfields.collections.MapEntryField; | ||
import org.vaadin.miki.superfields.collections.MapField; | ||
import org.vaadin.miki.superfields.numbers.SuperIntegerField; | ||
import org.vaadin.miki.superfields.text.SuperTextField; | ||
import org.vaadin.miki.superfields.util.CollectionComponentProviders; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
|
||
/** | ||
* Provides a {@link MapField}. | ||
* @author miki | ||
* @since 2022-04-08 | ||
*/ | ||
@Order(147) | ||
public class MapFieldProvider implements ComponentProvider<MapField<String, Integer>> { | ||
|
||
@Override | ||
public MapField<String, Integer> getComponent() { | ||
return new MapField<>(LinkedHashMap::new, | ||
CollectionComponentProviders.columnWithHeaderAndFooterRows( | ||
Arrays.asList( | ||
CollectionComponentProviders.removeAllButton("Clear"), | ||
CollectionComponentProviders.addFirstButton("Add as first") | ||
), | ||
Collections.singletonList(CollectionComponentProviders.addLastButton("Add as last"))), | ||
CollectionComponentProviders.rowWithRemoveButtonFirst((i, c) -> new MapEntryField<>( | ||
() -> new SuperTextField("Any text:"), () -> new SuperIntegerField("Any integer:") | ||
), "Remove")) | ||
.withHelperText("(this is a Map<String, Integer>)"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
demo-v23/src/main/java/org/vaadin/miki/demo/providers/VariantFieldProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.vaadin.miki.demo.providers; | ||
|
||
import com.vaadin.flow.data.binder.ValidationResult; | ||
import com.vaadin.flow.data.binder.Validator; | ||
import com.vaadin.flow.data.binder.ValueContext; | ||
import org.vaadin.miki.demo.ComponentProvider; | ||
import org.vaadin.miki.demo.Order; | ||
import org.vaadin.miki.superfields.dates.SuperDatePicker; | ||
import org.vaadin.miki.superfields.numbers.SuperIntegerField; | ||
import org.vaadin.miki.superfields.text.LabelField; | ||
import org.vaadin.miki.superfields.text.SuperTextField; | ||
import org.vaadin.miki.superfields.variant.TypedFieldProvider; | ||
import org.vaadin.miki.superfields.variant.VariantField; | ||
|
||
import java.time.LocalDate; | ||
|
||
/** | ||
* Provides a {@link VariantField}. | ||
* | ||
* @author miki | ||
* @since 2022-04-11 | ||
*/ | ||
@Order(85) | ||
public class VariantFieldProvider implements ComponentProvider<VariantField>, Validator<Object> { | ||
|
||
@Override | ||
public ValidationResult apply(Object o, ValueContext valueContext) { | ||
return o != null && o.toString().length() > 5 ? ValidationResult.ok() : ValidationResult.error("(toString() on the value must be longer than 5 characters)"); | ||
} | ||
|
||
@Override | ||
public VariantField getComponent() { | ||
return new VariantField() | ||
.withTypedFieldProvider(TypedFieldProvider.of(Integer.class, SuperIntegerField::new), | ||
TypedFieldProvider.of(String.class, SuperTextField::new), | ||
TypedFieldProvider.of(LocalDate.class, SuperDatePicker::new)) | ||
.withNullComponentProvider(() -> new LabelField<>().withNullRepresentation("(no value specified)")) | ||
.withHelperText("(this is a CustomField<Object>)") | ||
.withLabel("Choose a value type below, then edit it here:"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A field that works with any `Map<K, V>` allowing different components for keys and values. Uses a `CollectionField` to produce a `Map` from a list of `Map.Entry`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
An extendable `CustomField<Object>` that displays values in components that match the registered type(s). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,32 @@ | ||
/** | ||
* This file contains project specific customizations for the webpack build. | ||
* This file contains project specific customizations for the webpack build. | ||
* It is autogenerated if it didn't exist or if it was made for an older | ||
* incompatible version. | ||
* | ||
* Defaults are provided in an autogenerated webpack.generated.js file and used by this file. | ||
* Defaults are provided in an autogenerated webpack.generated.js file and used by this file. | ||
* The webpack.generated.js file is overwritten on each build and no customization can be done there. | ||
*/ | ||
const merge = require('webpack-merge'); | ||
const flowDefaults = require('./webpack.generated.js'); | ||
|
||
module.exports = merge(flowDefaults, { | ||
|
||
}); | ||
|
||
/** | ||
* This file can be used to configure the flow plugin defaults. | ||
* <code> | ||
* // Add a custom plugin | ||
* flowDefaults.plugins.push(new MyPlugin()); | ||
* | ||
* // Update the rules to also transpile `.mjs` files | ||
* if (!flowDefaults.module.rules[0].test) { | ||
* throw "Unexpected structure in generated webpack config"; | ||
* } | ||
* flowDefaults.module.rules[0].test = /\.m?js$/ | ||
* | ||
* // Include a custom JS in the entry point in addition to generated-flow-imports.js | ||
* if (typeof flowDefaults.entry.index != "string") { | ||
* throw "Unexpected structure in generated webpack config"; | ||
* } | ||
* flowDefaults.entry.index = [flowDefaults.entry.index, "myCustomFile.js"]; | ||
* </code> | ||
* or add new configuration in the merge block. | ||
* <code> | ||
* module.exports = merge(flowDefaults, { | ||
* mode: 'development', | ||
* devtool: 'inline-source-map' | ||
* }); | ||
* </code> | ||
* To change the webpack config, add a new configuration object in | ||
* the merge arguments below: | ||
*/ | ||
module.exports = merge(flowDefaults, | ||
// Override default configuration | ||
// { | ||
// mode: 'development', | ||
// devtool: 'inline-source-map', | ||
// }, | ||
|
||
// Add a custom plugin | ||
// (install the plugin with `npm install --save-dev webpack-bundle-analyzer`) | ||
// { | ||
// plugins: [ | ||
// new require('webpack-bundle-analyzer').BundleAnalyzerPlugin({ | ||
// analyzerMode: 'static' | ||
// }) | ||
// ] | ||
// }, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.