From a80d079b78b086317d3e6959d447016efafd4133 Mon Sep 17 00:00:00 2001 From: Ian Svoboda Date: Mon, 25 Nov 2024 12:41:02 -0500 Subject: [PATCH 1/3] Ensure number types are handled like numbers --- .../query/components/ControlBuilder.jsx | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/blocks/query/components/ControlBuilder.jsx b/src/blocks/query/components/ControlBuilder.jsx index eed8fcfe7..69dc16eac 100644 --- a/src/blocks/query/components/ControlBuilder.jsx +++ b/src/blocks/query/components/ControlBuilder.jsx @@ -1,4 +1,4 @@ -import { ToggleControl, Button, Tooltip, ComboboxControl } from '@wordpress/components'; +import { ToggleControl, Button, Tooltip, ComboboxControl, TextControl } from '@wordpress/components'; import { sprintf, __ } from '@wordpress/i18n'; import { isArray, isObject } from 'lodash'; @@ -6,9 +6,9 @@ import { isArray, isObject } from 'lodash'; import { CategoriesSelect, TagsSelect, - DebouncedTextControl, } from '@components'; import { SelectPostType, SelectPost, MultiSelect, SelectUser } from '@edge22/components'; +import { Control } from '@edge22/styles-builder'; import { TaxonomyParameterControl } from './TaxonomyParameterControl'; import { DateQueryControl } from './DateQueryControl'; @@ -23,8 +23,16 @@ function ControlComponent( props ) { switch ( props?.type ) { case 'text': + return ; case 'number': - return ; + return ( + + ); case 'postTypeSelect': return ; case 'select': @@ -32,7 +40,13 @@ function ControlComponent( props ) { case 'multiSelect': return ; case 'authorsSelect': - return ; + return ( + + ); case 'categoriesSelect': return ; case 'tagsSelect': @@ -40,7 +54,14 @@ function ControlComponent( props ) { case 'taxonomySelect': return ; case 'includePosts': - return ; + return ( + + ); case 'excludePosts': return ; case 'dateQuery': From 58cb69057e883e80e9683a280497d9ebc66ff80a Mon Sep 17 00:00:00 2001 From: Ian Svoboda Date: Thu, 28 Nov 2024 08:40:37 -0500 Subject: [PATCH 2/3] Enforce minimum for text control --- src/blocks/query/components/ControlBuilder.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/blocks/query/components/ControlBuilder.jsx b/src/blocks/query/components/ControlBuilder.jsx index 69dc16eac..b6ae29849 100644 --- a/src/blocks/query/components/ControlBuilder.jsx +++ b/src/blocks/query/components/ControlBuilder.jsx @@ -26,11 +26,19 @@ function ControlComponent( props ) { return ; case 'number': return ( - { + if ( parseInt( newValue, 10 ) < -1 ) { + standardProps.onChange( -1 ); + return; + } + + standardProps.onChange( newValue ); + } } /> ); case 'postTypeSelect': From 4f451f57d70b1fa051f20a16e15315fb2b1fe5bf Mon Sep 17 00:00:00 2001 From: Ian Svoboda Date: Thu, 28 Nov 2024 08:42:23 -0500 Subject: [PATCH 3/3] Revert value handling test --- src/blocks/query/components/ControlBuilder.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blocks/query/components/ControlBuilder.jsx b/src/blocks/query/components/ControlBuilder.jsx index b6ae29849..09dc3ecfe 100644 --- a/src/blocks/query/components/ControlBuilder.jsx +++ b/src/blocks/query/components/ControlBuilder.jsx @@ -28,7 +28,7 @@ function ControlComponent( props ) { return ( {