From e976272c699fe189f8dd9b84faea0274002cf9e8 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 1 Jul 2024 12:25:39 +0200 Subject: [PATCH 1/7] Move Query block Display settings from block toolbar to inspector. --- .../query/edit/inspector-controls/index.js | 65 +++++++++++ .../src/query/edit/query-toolbar.js | 103 +----------------- 2 files changed, 66 insertions(+), 102 deletions(-) diff --git a/packages/block-library/src/query/edit/inspector-controls/index.js b/packages/block-library/src/query/edit/inspector-controls/index.js index e71b2d09af4b81..1d25680b31df78 100644 --- a/packages/block-library/src/query/edit/inspector-controls/index.js +++ b/packages/block-library/src/query/edit/inspector-controls/index.js @@ -10,6 +10,7 @@ import { Notice, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, + __experimentalNumberControl as NumberControl, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; @@ -190,6 +191,70 @@ export default function QueryInspectorControls( props ) { ) } ) } + { ! inherit && ( + <> + { + if ( + isNaN( value ) || + value < 1 || + value > 100 + ) { + return; + } + setQuery( { + perPage: value, + } ); + } } + step="1" + value={ query.perPage } + isDragEnabled={ false } + /> + { + if ( + isNaN( value ) || + value < 0 || + value > 100 + ) { + return; + } + setQuery( { offset: value } ); + } } + step="1" + value={ query.offset } + isDragEnabled={ false } + /> + { + if ( isNaN( value ) || value < 0 ) { + return; + } + setQuery( { pages: value } ); + } } + step="1" + value={ query.pages } + isDragEnabled={ false } + help={ __( + 'Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).' + ) } + /> + + ) } { showOrderControl && ( - { ! query.inherit && ( - - ( - - ) } - renderContent={ () => ( - <> - - { - if ( - isNaN( value ) || - value < 1 || - value > 100 - ) { - return; - } - setQuery( { - perPage: value, - } ); - } } - step="1" - value={ query.perPage } - isDragEnabled={ false } - /> - - - { - if ( - isNaN( value ) || - value < 0 || - value > 100 - ) { - return; - } - setQuery( { offset: value } ); - } } - step="1" - value={ query.offset } - isDragEnabled={ false } - /> - - - { - if ( isNaN( value ) || value < 0 ) { - return; - } - setQuery( { pages: value } ); - } } - step="1" - value={ query.pages } - isDragEnabled={ false } - /> - - - ) } - /> - - ) } { hasPatterns && ( From 2884323cae0d644f57b2030db8a8894438f1ff72 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 1 Jul 2024 13:20:53 +0200 Subject: [PATCH 2/7] Replace dataviews View options icon with the cog icon. --- packages/dataviews/src/view-actions.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dataviews/src/view-actions.tsx b/packages/dataviews/src/view-actions.tsx index f83a5887065ec3..ff3041b1077337 100644 --- a/packages/dataviews/src/view-actions.tsx +++ b/packages/dataviews/src/view-actions.tsx @@ -12,7 +12,7 @@ import { } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { memo } from '@wordpress/element'; -import { settings } from '@wordpress/icons'; +import { cog } from '@wordpress/icons'; /** * Internal dependencies @@ -314,7 +314,7 @@ function _ViewActions< Item >( { trigger={