Skip to content

Commit 5fb174e

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents d935da5 + 0a1b693 commit 5fb174e

File tree

67 files changed

+3342
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3342
-35
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ body:
1515
attributes:
1616
label: "Checklist"
1717
options:
18-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
18+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-grid-filter/releases/latest)"
1919
required: true
20-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
20+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-grid-filter/issues) or [closed](https://github.com/xdev-software/vaadin-grid-filter/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2121
required: true
2222
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2323
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: "Checklist"
1515
options:
16-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
16+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-grid-filter/issues) or [closed](https://github.com/xdev-software/vaadin-grid-filter/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1717
required: true
1818
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1919
required: true

.github/ISSUE_TEMPLATE/question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/vaadin-grid-filter/issues) or [closed](https://github.com/xdev-software/vaadin-grid-filter/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.run/Run Demo.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
4-
<module name="template-placeholder-demo" />
4+
<module name="vaadin-grid-filter-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 2.0.2
2+
* Migrated deployment to _Sonatype Maven Central Portal_ [#155](https://github.com/xdev-software/standard-maven-template/issues/155)
3+
* Updated dependencies
4+
5+
# 2.0.1
6+
* Make it possible to control how filtering is applied to Grid #32
7+
* Updated dependencies
8+
9+
# 2.0.0
10+
_Reworked component_
11+
12+
* New customizable UI, including
13+
* nested filters (AND, OR, NOT)
14+
* depth can be limited
15+
* customizable operations (=,>,<,contains,is empty)
16+
* support for multiple value types
17+
* can easily be bound with Vaadin components
18+
* Improved support for QueryParameters
19+
* Better translation support
20+
21+
v1 component can now be found at https://github.com/xdev-software/vaadin-simple-grid-filter
22+
23+
# 1.0.0
24+
_Initial release_

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Bigger changes may require a complete restart.
4747
* [Vaadin automatically reloads the UI on each restart](https://vaadin.com/docs/latest/configuration/live-reload/spring-boot).<br/>
4848
You can control this behavior with the ``vaadin.devmode.liveReload.enabled`` property (default: ``true``).
4949

50-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
50+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-grid-filter/release.yml?branch=master)](https://github.com/xdev-software/vaadin-grid-filter/actions/workflows/release.yml)
5151

5252
Before releasing:
53-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
53+
* Consider doing a [test-deployment](https://github.com/xdev-software/vaadin-grid-filter/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
5454
* Check the [changelog](CHANGELOG.md)
5555

5656
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

README.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,66 @@
1-
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/template-placeholder)
2-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
3-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
4-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/grid-filter-for-vaadin)
2+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-grid-filter?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-grid-filter)
3+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-grid-filter/check-build.yml?branch=develop)](https://github.com/xdev-software/vaadin-grid-filter/actions/workflows/check-build.yml?query=branch%3Adevelop)
4+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_vaadin-grid-filter&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_vaadin-grid-filter)
55
![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0)
66

7-
# template-placeholder
8-
A Vaadin Template Repo
7+
# vaadin-grid-filter
8+
9+
A customizable Vaadin Flow component for filtering Grids.
910

1011
![demo](assets/demo.png)
1112

13+
## Features
14+
* Customizable and dynamic filter UI
15+
* Most common filters, operations and value types are supported out of the box
16+
* Nested filters (AND, OR, NOT)
17+
* depth can be limited
18+
* customizable operations (=,>,<,contains,is empty)
19+
* support for multiple value types
20+
* can easily be bound with Vaadin components
21+
* Query parameter support
22+
* Support for custom translations
23+
24+
> [!NOTE]
25+
> If you are looking for a simpler component you may check out our [simple-grid-filter](https://github.com/xdev-software/vaadin-simple-grid-filter).
26+
27+
## Usage
28+
29+
Here is a very simple example how the GridFilter can be used:
30+
```java
31+
Grid<Person> grid = createGrid();
32+
33+
GridFilter<Person> filter = GridFilter.createDefault(grid)
34+
.withFilterableField("ID", Person::id, Integer.class)
35+
.withFilterableField("First Name", Person::firstName, String.class);
36+
37+
this.add(filter, grid);
38+
```
39+
40+
To get started further it's recommended to have a look at the [demo](./vaadin-grid-filter-demo).<br/>
41+
A description how to get it running can be found [below](#run-the-demo).
42+
43+
> [!IMPORTANT]
44+
> This component is designed for "in memory" filtering of small to medium sized amounts of data.
45+
46+
> [!NOTE]
47+
> Filtering multiple thousand items with complex filtering conditions can drastically impact performance and make the UI unresponsive!<br/> In these cases it's recommended to use backend filtering solutions like database queries or search engines like [ElasticSearch](https://en.wikipedia.org/wiki/Elasticsearch) in combination with a customized UI search framework. If you need help in implementing these feel free to [contact us](https://xdev.software/en/services/support).
1248
1349
## Installation
14-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
50+
[Installation guide for the latest release](https://github.com/xdev-software/vaadin-grid-filter/releases/latest#Installation)
51+
52+
#### Compatibility with Vaadin
53+
54+
| Vaadin version | Grid-Filter version |
55+
| --- | --- |
56+
| Vaadin 24+ (latest) | ``1+`` |
1557

1658
### Spring-Boot
1759
* You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages)
1860

1961
## Run the Demo
2062
* Checkout the repo
21-
* Run ``mvn install && mvn -f template-placeholder-demo spring-boot:run``
63+
* Run ``mvn install && mvn -f vaadin-grid-filter-demo spring-boot:run``
2264
* Open http://localhost:8080
2365

2466
<details>
@@ -34,4 +76,4 @@ If you need support as soon as possible and you can't wait for any pull request,
3476
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
3577

3678
## Dependencies and Licenses
37-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
79+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-grid-filter/dependencies)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-grid-filter/security/advisories/new).

assets/demo.avif

562 KB
Binary file not shown.

assets/demo.png

5.74 KB
Loading

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder-root</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
8+
<artifactId>vaadin-grid-filter-root</artifactId>
9+
<version>2.0.3-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>
@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>template-placeholder</module>
19-
<module>template-placeholder-demo</module>
18+
<module>vaadin-grid-filter</module>
19+
<module>vaadin-grid-filter-demo</module>
2020
</modules>
2121

2222
<properties>

renovate.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"packageRules": [
55
{
66
"description": "Ignore project internal dependencies",
7-
"packagePattern": "^software.xdev:template-placeholder",
7+
"packagePattern": "^software.xdev:vaadin-grid-filter",
88
"datasources": [
99
"maven"
1010
],

template-placeholder-demo/pom.xml renamed to vaadin-grid-filter-demo/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
<parent>
88
<groupId>software.xdev</groupId>
9-
<artifactId>template-placeholder-root</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
9+
<artifactId>vaadin-grid-filter-root</artifactId>
10+
<version>2.0.3-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>template-placeholder-demo</artifactId>
14-
<version>1.0.0-SNAPSHOT</version>
13+
<artifactId>vaadin-grid-filter-demo</artifactId>
14+
<version>2.0.3-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>
@@ -70,7 +70,7 @@
7070
</dependency>
7171
<dependency>
7272
<groupId>software.xdev</groupId>
73-
<artifactId>template-placeholder</artifactId>
73+
<artifactId>vaadin-grid-filter</artifactId>
7474
<version>${project.version}</version>
7575
</dependency>
7676

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package software.xdev.vaadin.gridfilter;
2+
3+
import java.util.List;
4+
5+
import com.vaadin.flow.component.AttachEvent;
6+
import com.vaadin.flow.component.Composite;
7+
import com.vaadin.flow.component.grid.Grid;
8+
import com.vaadin.flow.component.grid.GridVariant;
9+
import com.vaadin.flow.component.html.Anchor;
10+
import com.vaadin.flow.component.html.Span;
11+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
12+
import com.vaadin.flow.data.renderer.ComponentRenderer;
13+
import com.vaadin.flow.router.PageTitle;
14+
import com.vaadin.flow.router.Route;
15+
16+
import software.xdev.vaadin.gridfilter.demo.LocalizationDemo;
17+
import software.xdev.vaadin.gridfilter.demo.MaxNestedDepthDemo;
18+
import software.xdev.vaadin.gridfilter.demo.MinimalisticDemo;
19+
import software.xdev.vaadin.gridfilter.demo.QueryParameterDemo;
20+
21+
22+
@PageTitle("Grid Filter demos")
23+
@Route("")
24+
public class DemoView extends Composite<VerticalLayout>
25+
{
26+
private final Grid<Example> grExamples = new Grid<>();
27+
28+
public DemoView()
29+
{
30+
this.grExamples
31+
.addColumn(new ComponentRenderer<>(example -> {
32+
final Anchor anchor = new Anchor(example.route(), example.name());
33+
34+
final Span spDesc = new Span(example.desc());
35+
spDesc.getStyle().set("font-size", "90%");
36+
spDesc.getStyle().set("white-space", "pre");
37+
38+
final VerticalLayout vl = new VerticalLayout(anchor, spDesc);
39+
vl.setSpacing(false);
40+
return vl;
41+
}))
42+
.setHeader("Available demos");
43+
44+
this.grExamples.setSizeFull();
45+
this.grExamples.addThemeVariants(GridVariant.LUMO_COMPACT, GridVariant.LUMO_NO_BORDER);
46+
47+
this.getContent().add(this.grExamples);
48+
this.getContent().setHeightFull();
49+
}
50+
51+
@Override
52+
protected void onAttach(final AttachEvent attachEvent)
53+
{
54+
this.grExamples.setItems(List.of(
55+
new Example(
56+
MinimalisticDemo.NAV,
57+
"Minimalistic",
58+
"Showcasing the simplest form of using the component"
59+
),
60+
new Example(
61+
QueryParameterDemo.NAV,
62+
"Store filters in QueryParameter",
63+
"Shows how filters can be persisted in and loaded from QueryParameters/Url"
64+
),
65+
new Example(
66+
MaxNestedDepthDemo.NAV,
67+
"Limit depth/nesting of filters",
68+
"Limits the how many filters can be nested"
69+
),
70+
new Example(
71+
LocalizationDemo.NAV,
72+
"Localization",
73+
"Showcases how localization can be done (UI in German)"
74+
)
75+
));
76+
}
77+
78+
record Example(String route, String name, String desc)
79+
{
80+
}
81+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package software.xdev.vaadin.gridfilter.demo;
2+
3+
import java.time.LocalDate;
4+
5+
import com.vaadin.flow.component.AttachEvent;
6+
import com.vaadin.flow.component.grid.Grid;
7+
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
8+
9+
import software.xdev.vaadin.gridfilter.GridFilter;
10+
import software.xdev.vaadin.gridfilter.model.Department;
11+
import software.xdev.vaadin.gridfilter.model.Person;
12+
13+
14+
public class AbstractDemo extends VerticalLayout
15+
{
16+
protected final Grid<Person> grid = new Grid<>(Person.class, true);
17+
18+
protected GridFilter<Person> createDefaultFilter()
19+
{
20+
return GridFilter.createDefault(this.grid)
21+
.withFilterableField("ID", Person::id, Integer.class)
22+
.withFilterableField("First Name", Person::firstName, String.class)
23+
.withFilterableField("Birthday", Person::birthday, LocalDate.class)
24+
.withFilterableField("Married", Person::married, Boolean.class)
25+
.withFilterableField("Department", Person::department, Department.class);
26+
}
27+
28+
@Override
29+
protected void onAttach(final AttachEvent attachEvent)
30+
{
31+
this.grid.setItems(Person.list());
32+
}
33+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package software.xdev.vaadin.gridfilter.demo;
2+
3+
import com.vaadin.flow.router.Route;
4+
5+
import software.xdev.vaadin.gridfilter.GridFilter;
6+
import software.xdev.vaadin.gridfilter.GridFilterLocalizationConfig;
7+
import software.xdev.vaadin.gridfilter.model.Person;
8+
9+
10+
@Route(LocalizationDemo.NAV)
11+
public class LocalizationDemo extends AbstractDemo
12+
{
13+
public static final String NAV = "/localization";
14+
15+
public LocalizationDemo()
16+
{
17+
final GridFilter<Person> filter = this.createDefaultFilter()
18+
.withLocalizationConfig(new GridFilterLocalizationConfig()
19+
.with(GridFilterLocalizationConfig.BLOCK_AND, "UND")
20+
.with(GridFilterLocalizationConfig.BLOCK_OR, "ODER")
21+
.with(GridFilterLocalizationConfig.BLOCK_NOT, "NICHT")
22+
.with(GridFilterLocalizationConfig.OP_CONTAINS, "enthält")
23+
.with(GridFilterLocalizationConfig.OP_GREATER_THAN, "größer als")
24+
.with(GridFilterLocalizationConfig.OP_LESS_THAN, "kleiner als")
25+
.with(GridFilterLocalizationConfig.OP_EQUALS, "ist gleich")
26+
.with(GridFilterLocalizationConfig.OP_IS_EMPTY, "ist leer")
27+
.with(GridFilterLocalizationConfig.CONDITION, "Bedingung"));
28+
29+
this.add(filter, this.grid);
30+
}
31+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package software.xdev.vaadin.gridfilter.demo;
2+
3+
import com.vaadin.flow.router.Route;
4+
5+
import software.xdev.vaadin.gridfilter.GridFilter;
6+
import software.xdev.vaadin.gridfilter.model.Person;
7+
8+
9+
@Route(MaxNestedDepthDemo.NAV)
10+
public class MaxNestedDepthDemo extends AbstractDemo
11+
{
12+
public static final String NAV = "/maxNestedDepth";
13+
14+
public MaxNestedDepthDemo()
15+
{
16+
final GridFilter<Person> filter = this.createDefaultFilter()
17+
.withMaxNestedDepth(1);
18+
19+
this.add(filter, this.grid);
20+
}
21+
}

0 commit comments

Comments
 (0)