Skip to content

Commit

Permalink
Merge branch 'develop' into update-from-template-merged
Browse files Browse the repository at this point in the history
  • Loading branch information
xdev-gh-bot committed Dec 9, 2024
2 parents c861a0d + 212aaea commit c713ecd
Show file tree
Hide file tree
Showing 67 changed files with 3,336 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ body:
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/vaadin-grid-filter/releases/latest)"
required: true
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .run/Run Demo.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.vaadin.Application" />
<module name="template-placeholder-demo" />
<module name="vaadin-grid-filter-demo" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<extension name="coverage">
<pattern>
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 2.0.1
* Make it possible to control how filtering is applied to Grid #32
* Updated dependencies

# 2.0.0
_Reworked component_

* New customizable UI, including
* nested filters (AND, OR, NOT)
* depth can be limited
* customizable operations (=,>,<,contains,is empty)
* support for multiple value types
* can easily be bound with Vaadin components
* Improved support for QueryParameters
* Better translation support

v1 component can now be found at https://github.com/xdev-software/vaadin-simple-grid-filter

# 1.0.0
_Initial release_
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ Bigger changes may require a complete restart.
* [Vaadin automatically reloads the UI on each restart](https://vaadin.com/docs/latest/configuration/live-reload/spring-boot).<br/>
You can control this behavior with the ``vaadin.devmode.liveReload.enabled`` property (default: ``true``).

## 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)
## 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)

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

If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes
Expand Down
60 changes: 51 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,63 @@
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/template-placeholder)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
[![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)
[![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)
[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/grid-filter-for-vaadin)
[![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)
[![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)
[![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)
![Vaadin 24+](https://img.shields.io/badge/Vaadin%20Platform/Flow-24+-00b4f0)

# template-placeholder
A Vaadin Template Repo
# vaadin-grid-filter

A customizable Vaadin Flow component for filtering Grids.

![demo](assets/demo.png)

## Features
* Customizable and dynamic filter UI
* Most common filters, operations and value types are supported out of the box
* Nested filters (AND, OR, NOT)
* depth can be limited
* customizable operations (=,>,<,contains,is empty)
* support for multiple value types
* can easily be bound with Vaadin components
* Query parameter support
* Support for custom translations

> [!NOTE]
> 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).
## Usage

Here is a very simple example how the GridFilter can be used:
```java
Grid<Person> grid = createGrid();

GridFilter<Person> filter = GridFilter.createDefault(grid)
.withFilterableField("ID", Person::id, Integer.class)
.withFilterableField("First Name", Person::firstName, String.class);

this.add(filter, grid);
```

To get started further it's recommended to have a look at the [demo](./vaadin-grid-filter-demo).<br/>
A description how to get it running can be found [below](#run-the-demo).

> [!IMPORTANT]
> This component is designed for "in memory" filtering of small to medium sized amounts of data.
> [!NOTE]
> 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).
## Installation
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
[Installation guide for the latest release](https://github.com/xdev-software/vaadin-grid-filter/releases/latest#Installation)

#### Compatibility with Vaadin

| Vaadin version | Grid-Filter version |
| --- | --- |
| Vaadin 24+ (latest) | ``1+`` |

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

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

## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-grid-filter/dependencies)
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/vaadin-grid-filter/security/advisories/new).
Binary file modified assets/demo.avif
Binary file not shown.
Binary file modified assets/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>template-placeholder-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-grid-filter-root</artifactId>
<version>2.0.2-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand All @@ -15,8 +15,8 @@
</organization>

<modules>
<module>template-placeholder</module>
<module>template-placeholder-demo</module>
<module>vaadin-grid-filter</module>
<module>vaadin-grid-filter-demo</module>
</modules>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packageRules": [
{
"description": "Ignore project internal dependencies",
"packagePattern": "^software.xdev:template-placeholder",
"packagePattern": "^software.xdev:vaadin-grid-filter",
"datasources": [
"maven"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

<parent>
<groupId>software.xdev</groupId>
<artifactId>template-placeholder-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-grid-filter-root</artifactId>
<version>2.0.2-SNAPSHOT</version>
</parent>

<artifactId>template-placeholder-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<artifactId>vaadin-grid-filter-demo</artifactId>
<version>2.0.2-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down Expand Up @@ -70,7 +70,7 @@
</dependency>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>template-placeholder</artifactId>
<artifactId>vaadin-grid-filter</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package software.xdev.vaadin.gridfilter;

import java.util.List;

import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridVariant;
import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.data.renderer.ComponentRenderer;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

import software.xdev.vaadin.gridfilter.demo.LocalizationDemo;
import software.xdev.vaadin.gridfilter.demo.MaxNestedDepthDemo;
import software.xdev.vaadin.gridfilter.demo.MinimalisticDemo;
import software.xdev.vaadin.gridfilter.demo.QueryParameterDemo;


@PageTitle("Grid Filter demos")
@Route("")
public class DemoView extends Composite<VerticalLayout>
{
private final Grid<Example> grExamples = new Grid<>();

public DemoView()
{
this.grExamples
.addColumn(new ComponentRenderer<>(example -> {
final Anchor anchor = new Anchor(example.route(), example.name());

final Span spDesc = new Span(example.desc());
spDesc.getStyle().set("font-size", "90%");
spDesc.getStyle().set("white-space", "pre");

final VerticalLayout vl = new VerticalLayout(anchor, spDesc);
vl.setSpacing(false);
return vl;
}))
.setHeader("Available demos");

this.grExamples.setSizeFull();
this.grExamples.addThemeVariants(GridVariant.LUMO_COMPACT, GridVariant.LUMO_NO_BORDER);

this.getContent().add(this.grExamples);
this.getContent().setHeightFull();
}

@Override
protected void onAttach(final AttachEvent attachEvent)
{
this.grExamples.setItems(List.of(
new Example(
MinimalisticDemo.NAV,
"Minimalistic",
"Showcasing the simplest form of using the component"
),
new Example(
QueryParameterDemo.NAV,
"Store filters in QueryParameter",
"Shows how filters can be persisted in and loaded from QueryParameters/Url"
),
new Example(
MaxNestedDepthDemo.NAV,
"Limit depth/nesting of filters",
"Limits the how many filters can be nested"
),
new Example(
LocalizationDemo.NAV,
"Localization",
"Showcases how localization can be done (UI in German)"
)
));
}

record Example(String route, String name, String desc)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package software.xdev.vaadin.gridfilter.demo;

import java.time.LocalDate;

import com.vaadin.flow.component.AttachEvent;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;

import software.xdev.vaadin.gridfilter.GridFilter;
import software.xdev.vaadin.gridfilter.model.Department;
import software.xdev.vaadin.gridfilter.model.Person;


public class AbstractDemo extends VerticalLayout
{
protected final Grid<Person> grid = new Grid<>(Person.class, true);

protected GridFilter<Person> createDefaultFilter()
{
return GridFilter.createDefault(this.grid)
.withFilterableField("ID", Person::id, Integer.class)
.withFilterableField("First Name", Person::firstName, String.class)
.withFilterableField("Birthday", Person::birthday, LocalDate.class)
.withFilterableField("Married", Person::married, Boolean.class)
.withFilterableField("Department", Person::department, Department.class);
}

@Override
protected void onAttach(final AttachEvent attachEvent)
{
this.grid.setItems(Person.list());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package software.xdev.vaadin.gridfilter.demo;

import com.vaadin.flow.router.Route;

import software.xdev.vaadin.gridfilter.GridFilter;
import software.xdev.vaadin.gridfilter.GridFilterLocalizationConfig;
import software.xdev.vaadin.gridfilter.model.Person;


@Route(LocalizationDemo.NAV)
public class LocalizationDemo extends AbstractDemo
{
public static final String NAV = "/localization";

public LocalizationDemo()
{
final GridFilter<Person> filter = this.createDefaultFilter()
.withLocalizationConfig(new GridFilterLocalizationConfig()
.with(GridFilterLocalizationConfig.BLOCK_AND, "UND")
.with(GridFilterLocalizationConfig.BLOCK_OR, "ODER")
.with(GridFilterLocalizationConfig.BLOCK_NOT, "NICHT")
.with(GridFilterLocalizationConfig.OP_CONTAINS, "enthält")
.with(GridFilterLocalizationConfig.OP_GREATER_THAN, "größer als")
.with(GridFilterLocalizationConfig.OP_LESS_THAN, "kleiner als")
.with(GridFilterLocalizationConfig.OP_EQUALS, "ist gleich")
.with(GridFilterLocalizationConfig.OP_IS_EMPTY, "ist leer")
.with(GridFilterLocalizationConfig.CONDITION, "Bedingung"));

this.add(filter, this.grid);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package software.xdev.vaadin.gridfilter.demo;

import com.vaadin.flow.router.Route;

import software.xdev.vaadin.gridfilter.GridFilter;
import software.xdev.vaadin.gridfilter.model.Person;


@Route(MaxNestedDepthDemo.NAV)
public class MaxNestedDepthDemo extends AbstractDemo
{
public static final String NAV = "/maxNestedDepth";

public MaxNestedDepthDemo()
{
final GridFilter<Person> filter = this.createDefaultFilter()
.withMaxNestedDepth(1);

this.add(filter, this.grid);
}
}
Loading

0 comments on commit c713ecd

Please sign in to comment.