From 1e8dd1cd6f68df70e7534a52e8580800d619772c Mon Sep 17 00:00:00 2001 From: Martina Carella Date: Tue, 13 Feb 2024 10:43:28 +0100 Subject: [PATCH 1/2] adjusted filter (#74) --- src/components/table/filters.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/table/filters.jsx b/src/components/table/filters.jsx index f5cf211..4be3c25 100644 --- a/src/components/table/filters.jsx +++ b/src/components/table/filters.jsx @@ -23,7 +23,14 @@ function DefaultColumnFilter({ column: { filterValue, setFilter, id } }) { "input-dark" )} value={inputValue} - onChange={(e) => setInputValue(e.target.value)} + onChange={(e) => { + setInputValue(e.target.value); + // if the user clears the filter + if(e.target.value.length === 0) { + // Set undefined to remove the filter entirely + setFilter(undefined); + } + }} onKeyDown={(e) => { // the request is sent if the user presses 'enter' if (e.key === "Enter") { @@ -33,7 +40,7 @@ function DefaultColumnFilter({ column: { filterValue, setFilter, id } }) { onKeyUp={(e) => { // if the user presses 'backspace' // the request is sent if input value is empty - if (e.key === "Backspace" && e.target.value === "") { + if (e.key === "Backspace" && e.target.value.length === 0) { // Set undefined to remove the filter entirely setFilter(undefined); } From e8262f0eef0ab102d11c94f8c9c184f1783bdcc5 Mon Sep 17 00:00:00 2001 From: Daniele Rosetti Date: Tue, 13 Feb 2024 14:48:46 +0100 Subject: [PATCH 2/2] updated version --- CHANGELOG.md | 3 +++ example/package-lock.json | 2 +- example/src/layouts/AppFooter.jsx | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d53352..b7e50bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ **[Get it on npm](https://www.npmjs.com/package/certego-ui)** +## [v0.1.12](https://github.com/certego/certego-ui/releases/tag/v0.1.12) +Fixed auto-update DataTable when removed a filter with the cross icon + ## [v0.1.11](https://github.com/certego/certego-ui/releases/tag/v0.1.11) Removed debounce filter for columns diff --git a/example/package-lock.json b/example/package-lock.json index ba63808..ea617d5 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -19,7 +19,7 @@ }, "..": { "name": "@certego/certego-ui", - "version": "0.1.11", + "version": "0.1.12", "license": "MIT", "dependencies": { "classnames": "^2.3.1", diff --git a/example/src/layouts/AppFooter.jsx b/example/src/layouts/AppFooter.jsx index 19de5e8..6ee6193 100644 --- a/example/src/layouts/AppFooter.jsx +++ b/example/src/layouts/AppFooter.jsx @@ -5,7 +5,7 @@ import { FaTwitter } from "react-icons/fa"; import { Toaster, ScrollToTopButton, useToastr } from "@certego/certego-ui"; // constants -const CERTEGO_UI_VERSION = "v0.1.11"; +const CERTEGO_UI_VERSION = "v0.1.12"; const selector = (state) => state.toasts; function AppFooter() { diff --git a/package-lock.json b/package-lock.json index 7629de8..16e0425 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@certego/certego-ui", - "version": "0.1.11", + "version": "0.1.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@certego/certego-ui", - "version": "0.1.11", + "version": "0.1.12", "license": "MIT", "dependencies": { "classnames": "^2.3.1", diff --git a/package.json b/package.json index 3b830c8..03ad85f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@certego/certego-ui", - "version": "0.1.11", + "version": "0.1.12", "description": "certego components library (react.js, reactstrap, etc)", "author": "certego", "license": "MIT",