@wordpress/block-library 9.7.1-next.1f6eadc42.0 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/categories/edit.js +38 -17
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +10 -3
- package/build/categories/index.js.map +1 -1
- package/build/categories/variations.js +43 -0
- package/build/categories/variations.js.map +1 -0
- package/build/embed/edit.js +1 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-preview.js +80 -100
- package/build/embed/embed-preview.js.map +1 -1
- package/build/embed/embed-preview.native.js +1 -0
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/form/view.js +1 -0
- package/build/form/view.js.map +1 -1
- package/build/image/image.js +5 -2
- package/build/image/image.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-template/edit.js +6 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/post-title/index.js +1 -4
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +102 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +45 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +26 -10
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +3 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +12 -1
- package/build/query/utils.js.map +1 -1
- package/build/site-title/index.js +1 -4
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +13 -11
- package/build/social-link/edit.js.map +1 -1
- package/build-module/categories/edit.js +40 -19
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +10 -3
- package/build-module/categories/index.js.map +1 -1
- package/build-module/categories/variations.js +36 -0
- package/build-module/categories/variations.js.map +1 -0
- package/build-module/embed/edit.js +1 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +1 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-preview.js +80 -100
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +1 -0
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/form/view.js +1 -0
- package/build-module/form/view.js.map +1 -1
- package/build-module/image/image.js +5 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation-submenu/index.js +13 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -4
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +96 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +45 -9
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +27 -11
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +3 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +12 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/site-title/index.js +1 -4
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +14 -12
- package/build-module/social-link/edit.js.map +1 -1
- package/build-style/editor-rtl.css +1 -1
- package/build-style/editor.css +1 -1
- package/build-style/gallery/editor-rtl.css +1 -1
- package/build-style/gallery/editor.css +1 -1
- package/build-style/post-title/style-rtl.css +4 -18
- package/build-style/post-title/style.css +4 -18
- package/build-style/site-title/style-rtl.css +4 -18
- package/build-style/site-title/style.css +4 -18
- package/build-style/style-rtl.css +8 -36
- package/build-style/style.css +8 -36
- package/package.json +35 -35
- package/src/categories/block.json +7 -2
- package/src/categories/edit.js +69 -30
- package/src/categories/index.js +2 -0
- package/src/categories/index.php +21 -9
- package/src/categories/variations.js +40 -0
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-previous/index.php +2 -1
- package/src/embed/embed-preview.js +96 -112
- package/src/image/image.js +2 -1
- package/src/navigation-submenu/block.json +13 -0
- package/src/post-template/edit.js +6 -0
- package/src/post-template/index.php +5 -0
- package/src/post-title/block.json +1 -4
- package/src/post-title/style.scss +4 -21
- package/src/query/block.json +3 -1
- package/src/query/edit/inspector-controls/format-controls.js +90 -0
- package/src/query/edit/inspector-controls/index.js +68 -9
- package/src/query/edit/query-content.js +38 -5
- package/src/query/utils.js +16 -1
- package/src/site-title/block.json +1 -4
- package/src/site-title/style.scss +4 -21
- package/src/social-link/edit.js +11 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_data","_i18n","_blockEditor","_components","_coreData","_icons","_jsxRuntime","TEMPLATE","PostTemplateInnerBlocks","classList","innerBlocksProps","useInnerBlocksProps","className","clsx","template","__unstableDisableLayoutClassNames","jsx","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","useBlockPreview","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","memo","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","useState","posts","useSelect","select","getEntityRecords","getTaxonomies","coreStore","getBlocks","blockEditorStore","templateCategory","startsWith","per_page","_fields","slug","replace","orderby","taxonomies","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","useMemo","map","post","_post$class_list","postId","class_list","blockProps","useBlockProps","children","Spinner","jsxs","__","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","list","title","_x","isActive","grid","Fragment","BlockControls","ToolbarGroup","controls","blockContext","BlockContextProvider","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks( { classList } ) {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: clsx( 'wp-block-post', classList ) },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tclassList,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: clsx( 'wp-block-post', classList ),\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t} );\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t\tclassList: post.class_list ?? '',\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Post template block display setting' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Post template block display setting' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks\n\t\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA8C,IAAAQ,WAAA,GAAAR,OAAA;AArB9C;AACA;AACA;;AAGA;AACA;AACA;;AAgBA,MAAMS,QAAQ,GAAG,CAChB,CAAE,iBAAiB,CAAE,EACrB,CAAE,gBAAgB,CAAE,EACpB,CAAE,mBAAmB,CAAE,CACvB;AAED,SAASC,uBAAuBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EACjD,MAAMC,gBAAgB,GAAG,IAAAC,gCAAmB,EAC3C;IAAEC,SAAS,EAAE,IAAAC,aAAI,EAAE,eAAe,EAAEJ,SAAU;EAAE,CAAC,EACjD;IAAEK,QAAQ,EAAEP,QAAQ;IAAEQ,iCAAiC,EAAE;EAAK,CAC/D,CAAC;EACD,oBAAO,IAAAT,WAAA,CAAAU,GAAA;IAAA,GAASN;EAAgB,CAAI,CAAC;AACtC;AAEA,SAASO,wBA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ACnBxC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEK,MAAM,CAAE,gBAC5B,IAAAhG,WAAA,CAAAU,GAAA,EAACR,uBAAuB;UACvBC,SAAS,EAAGkH,YAAY,CAAClH;QAAW,CACpC,CAAC,GACC,IAAI,eACR,IAAAH,WAAA,CAAAU,GAAA,EAACiB,gCAAgC;UAChCf,MAAM,EAAGA,MAAQ;UACjBC,cAAc,EAAGwG,YAAY,CAACrB,MAAQ;UACtC7F,SAAS,EAAGkH,YAAY,CAAClH,SAAW;UACpCY,uBAAuB,EACtBA,uBACA;UACDD,QAAQ,EACPuG,YAAY,CAACrB,MAAM,MACjBxC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEK,MAAM;QAC3B,CACD,CAAC;MAAA,GAtBIqB,YAAY,CAACrB,MAuBE,CACrB;IAAC,CACD,CAAC;EAAA,CACJ,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_data","_i18n","_blockEditor","_components","_coreData","_icons","_jsxRuntime","TEMPLATE","PostTemplateInnerBlocks","classList","innerBlocksProps","useInnerBlocksProps","className","clsx","template","__unstableDisableLayoutClassNames","jsx","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","useBlockPreview","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","memo","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","format","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","useState","posts","useSelect","select","getEntityRecords","getTaxonomies","coreStore","getBlocks","blockEditorStore","templateCategory","startsWith","per_page","_fields","slug","replace","orderby","taxonomies","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","useMemo","map","post","_post$class_list","postId","class_list","blockProps","useBlockProps","children","Spinner","jsxs","__","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","list","title","_x","isActive","grid","Fragment","BlockControls","ToolbarGroup","controls","blockContext","BlockContextProvider","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks( { classList } ) {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: clsx( 'wp-block-post', classList ) },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tclassList,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: clsx( 'wp-block-post', classList ),\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\tformat,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t} );\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\tif ( format?.length ) {\n\t\t\t\tquery.format = format;\n\t\t\t}\n\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tformat,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t\tclassList: post.class_list ?? '',\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'Post template block display setting' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'Post template block display setting' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks\n\t\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tclassList={ blockContext.classList }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA8C,IAAAQ,WAAA,GAAAR,OAAA;AArB9C;AACA;AACA;;AAGA;AACA;AACA;;AAgBA,MAAMS,QAAQ,GAAG,CAChB,CAAE,iBAAiB,CAAE,EACrB,CAAE,gBAAgB,CAAE,EACpB,CAAE,mBAAmB,CAAE,CACvB;AAED,SAASC,uBAAuBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EACjD,MAAMC,gBAAgB,GAAG,IAAAC,gCAAmB,EAC3C;IAAEC,SAAS,EAAE,IAAAC,aAAI,EAAE,eAAe,EAAEJ,SAAU;EAAE,CAAC,EACjD;IAAEK,QAAQ,EAAEP,QAAQ;IA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WAAA,CAAAU,GAAA;MAAA,GAASyF,UAAU;MAAAE,QAAA,EAChBT,aAAa,IACdA,aAAa,CAACE,GAAG,CAAIwB,YAAY,iBAChC,IAAAtH,WAAA,CAAAuG,IAAA,EAAC3G,YAAA,CAAA2H,oBAAoB;QAEpBC,KAAK,EAAGF,YAAc;QAAAjB,QAAA,GAEpBiB,YAAY,CAACrB,MAAM,MACnBxC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEK,MAAM,CAAE,gBAC5B,IAAAjG,WAAA,CAAAU,GAAA,EAACR,uBAAuB;UACvBC,SAAS,EAAGmH,YAAY,CAACnH;QAAW,CACpC,CAAC,GACC,IAAI,eACR,IAAAH,WAAA,CAAAU,GAAA,EAACiB,gCAAgC;UAChCf,MAAM,EAAGA,MAAQ;UACjBC,cAAc,EAAGyG,YAAY,CAACrB,MAAQ;UACtC9F,SAAS,EAAGmH,YAAY,CAACnH,SAAW;UACpCY,uBAAuB,EACtBA,uBACA;UACDD,QAAQ,EACPwG,YAAY,CAACrB,MAAM,MACjBxC,oBAAoB,IACrBmC,aAAa,CAAE,CAAC,CAAE,EAAEK,MAAM;QAC3B,CACD,CAAC;MAAA,GAtBIqB,YAAY,CAACrB,MAuBE,CACrB;IAAC,CACD,CAAC;EAAA,CACJ,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","usesContext","attributes","textAlign","type","level","levelOptions","isLink","rel","attribute","linkTarget","example","viewportWidth","supports","align","html","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","__experimentalBorder","radius","width","style","
|
|
1
|
+
{"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","textdomain","usesContext","attributes","textAlign","type","level","levelOptions","isLink","rel","attribute","linkTarget","example","viewportWidth","supports","align","html","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","interactivity","clientNavigation","__experimentalBorder","radius","width","style","settings","icon","edit","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/post-title/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { title as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAF,sBAAA,CAAAF,OAAA;AAXA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAK,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,WAAA;EAAAC,UAAA;IAAAC,SAAA;MAAAC,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,YAAA;MAAAF,IAAA;IAAA;IAAAG,MAAA;MAAAH,IAAA;MAAA;IAAA;IAAAI,GAAA;MAAAJ,IAAA;MAAAK,SAAA;MAAA;IAAA;IAAAC,UAAA;MAAAN,IAAA;MAAA;IAAA;EAAA;EAAAO,OAAA;IAAAC,aAAA;EAAA;EAAAC,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;QAAAH,IAAA;MAAA;IAAA;IAAAI,OAAA;MAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAd,6BAAA;QAAAO,QAAA;MAAA;IAAA;IAAAQ,aAAA;MAAAC,gBAAA;IAAA;IAAAC,oBAAA;MAAAC,MAAA;MAAArB,KAAA;MAAAsB,KAAA;MAAAC,KAAA;MAAApB,6BAAA;QAAAkB,MAAA;QAAArB,KAAA;QAAAsB,KAAA;QAAAC,KAAA;MAAA;IAAA;EAAA;EAAAA,KAAA;AAAA;AAQA,MAAM;EAAE3C;AAAK,CAAC,GAAGJ,QAAQ;AAACC,OAAA,CAAAG,IAAA,GAAAA,IAAA;AAGnB,MAAM4C,QAAQ,GAAA/C,OAAA,CAAA+C,QAAA,GAAG;EACvBC,IAAI,EAAJA,YAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEjD,IAAI;EAAEJ,QAAQ;EAAEgD;AAAS,CAAE,CAAC;AAAC/C,OAAA,CAAAmD,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = FormatControls;
|
|
7
|
+
var _components = require("@wordpress/components");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _coreData = require("@wordpress/core-data");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// All WP post formats, sorted alphabetically by translated name.
|
|
17
|
+
// Value is the post format slug. Label is the name.
|
|
18
|
+
const POST_FORMATS = [{
|
|
19
|
+
value: 'aside',
|
|
20
|
+
label: (0, _i18n.__)('Aside')
|
|
21
|
+
}, {
|
|
22
|
+
value: 'audio',
|
|
23
|
+
label: (0, _i18n.__)('Audio')
|
|
24
|
+
}, {
|
|
25
|
+
value: 'chat',
|
|
26
|
+
label: (0, _i18n.__)('Chat')
|
|
27
|
+
}, {
|
|
28
|
+
value: 'gallery',
|
|
29
|
+
label: (0, _i18n.__)('Gallery')
|
|
30
|
+
}, {
|
|
31
|
+
value: 'image',
|
|
32
|
+
label: (0, _i18n.__)('Image')
|
|
33
|
+
}, {
|
|
34
|
+
value: 'link',
|
|
35
|
+
label: (0, _i18n.__)('Link')
|
|
36
|
+
}, {
|
|
37
|
+
value: 'quote',
|
|
38
|
+
label: (0, _i18n.__)('Quote')
|
|
39
|
+
}, {
|
|
40
|
+
value: 'standard',
|
|
41
|
+
label: (0, _i18n.__)('Standard')
|
|
42
|
+
}, {
|
|
43
|
+
value: 'status',
|
|
44
|
+
label: (0, _i18n.__)('Status')
|
|
45
|
+
}, {
|
|
46
|
+
value: 'video',
|
|
47
|
+
label: (0, _i18n.__)('Video')
|
|
48
|
+
}].sort((a, b) => {
|
|
49
|
+
const normalizedA = a.label.toUpperCase();
|
|
50
|
+
const normalizedB = b.label.toUpperCase();
|
|
51
|
+
if (normalizedA < normalizedB) {
|
|
52
|
+
return -1;
|
|
53
|
+
}
|
|
54
|
+
if (normalizedA > normalizedB) {
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// A helper function to convert translatable post format names into their static values.
|
|
61
|
+
function formatNamesToValues(names, formats) {
|
|
62
|
+
return names.map(name => {
|
|
63
|
+
return formats.find(item => item.label.toLocaleLowerCase() === name.toLocaleLowerCase())?.value;
|
|
64
|
+
}).filter(Boolean);
|
|
65
|
+
}
|
|
66
|
+
function FormatControls({
|
|
67
|
+
onChange,
|
|
68
|
+
query: {
|
|
69
|
+
format
|
|
70
|
+
}
|
|
71
|
+
}) {
|
|
72
|
+
// 'format' is expected to be an array. If it is not an array, for example
|
|
73
|
+
// if a user has manually entered an invalid value in the block markup,
|
|
74
|
+
// convert it to an array to prevent JavaScript errors.
|
|
75
|
+
const normalizedFormats = Array.isArray(format) ? format : [format];
|
|
76
|
+
const {
|
|
77
|
+
supportedFormats
|
|
78
|
+
} = (0, _data.useSelect)(select => {
|
|
79
|
+
const themeSupports = select(_coreData.store).getThemeSupports();
|
|
80
|
+
return {
|
|
81
|
+
supportedFormats: themeSupports.formats
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
const formats = POST_FORMATS.filter(item => supportedFormats.includes(item.value));
|
|
85
|
+
const values = normalizedFormats.map(name => formats.find(item => item.value === name)?.label).filter(Boolean);
|
|
86
|
+
const suggestions = formats.filter(item => !format.includes(item.value)).map(item => item.label);
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormTokenField, {
|
|
88
|
+
label: (0, _i18n.__)('Formats'),
|
|
89
|
+
value: values,
|
|
90
|
+
suggestions: suggestions,
|
|
91
|
+
onChange: newValues => {
|
|
92
|
+
onChange({
|
|
93
|
+
format: formatNamesToValues(newValues, formats)
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
__experimentalShowHowTo: false,
|
|
97
|
+
__experimentalExpandOnFocus: true,
|
|
98
|
+
__nextHasNoMarginBottom: true,
|
|
99
|
+
__next40pxDefaultSize: true
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=format-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_coreData","_i18n","_jsxRuntime","POST_FORMATS","value","label","__","sort","a","b","normalizedA","toUpperCase","normalizedB","formatNamesToValues","names","formats","map","name","find","item","toLocaleLowerCase","filter","Boolean","FormatControls","onChange","query","format","normalizedFormats","Array","isArray","supportedFormats","useSelect","select","themeSupports","coreStore","getThemeSupports","includes","values","suggestions","jsx","FormTokenField","newValues","__experimentalShowHowTo","__experimentalExpandOnFocus","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/format-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n// All WP post formats, sorted alphabetically by translated name.\n// Value is the post format slug. Label is the name.\nconst POST_FORMATS = [\n\t{ value: 'aside', label: __( 'Aside' ) },\n\t{ value: 'audio', label: __( 'Audio' ) },\n\t{ value: 'chat', label: __( 'Chat' ) },\n\t{ value: 'gallery', label: __( 'Gallery' ) },\n\t{ value: 'image', label: __( 'Image' ) },\n\t{ value: 'link', label: __( 'Link' ) },\n\t{ value: 'quote', label: __( 'Quote' ) },\n\t{ value: 'standard', label: __( 'Standard' ) },\n\t{ value: 'status', label: __( 'Status' ) },\n\t{ value: 'video', label: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.label.toUpperCase();\n\tconst normalizedB = b.label.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n// A helper function to convert translatable post format names into their static values.\nfunction formatNamesToValues( names, formats ) {\n\treturn names\n\t\t.map( ( name ) => {\n\t\t\treturn formats.find(\n\t\t\t\t( item ) =>\n\t\t\t\t\titem.label.toLocaleLowerCase() === name.toLocaleLowerCase()\n\t\t\t)?.value;\n\t\t} )\n\t\t.filter( Boolean );\n}\n\nexport default function FormatControls( { onChange, query: { format } } ) {\n\t// 'format' is expected to be an array. If it is not an array, for example\n\t// if a user has manually entered an invalid value in the block markup,\n\t// convert it to an array to prevent JavaScript errors.\n\tconst normalizedFormats = Array.isArray( format ) ? format : [ format ];\n\n\tconst { supportedFormats } = useSelect( ( select ) => {\n\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\treturn {\n\t\t\tsupportedFormats: themeSupports.formats,\n\t\t};\n\t}, [] );\n\n\tconst formats = POST_FORMATS.filter( ( item ) =>\n\t\tsupportedFormats.includes( item.value )\n\t);\n\n\tconst values = normalizedFormats\n\t\t.map(\n\t\t\t( name ) => formats.find( ( item ) => item.value === name )?.label\n\t\t)\n\t\t.filter( Boolean );\n\n\tconst suggestions = formats\n\t\t.filter( ( item ) => ! format.includes( item.value ) )\n\t\t.map( ( item ) => item.label );\n\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Formats' ) }\n\t\t\tvalue={ values }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ ( newValues ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\tformat: formatNamesToValues( newValues, formats ),\n\t\t\t\t} );\n\t\t\t} }\n\t\t\t__experimentalShowHowTo={ false }\n\t\t\t__experimentalExpandOnFocus\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,IAAAI,WAAA,GAAAJ,OAAA;AANrC;AACA;AACA;;AAMA;AACA;AACA,MAAMK,YAAY,GAAG,CACpB;EAAEC,KAAK,EAAE,OAAO;EAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,OA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AC;EAE/B,oBACC,IAAAH,WAAA,CAAAqC,GAAA,EAAC1C,WAAA,CAAA2C,cAAc;IACdnC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBF,KAAK,EAAGiC,MAAQ;IAChBC,WAAW,EAAGA,WAAa;IAC3Bd,QAAQ,EAAKiB,SAAS,IAAM;MAC3BjB,QAAQ,CAAE;QACTE,MAAM,EAAEb,mBAAmB,CAAE4B,SAAS,EAAE1B,OAAQ;MACjD,CAAE,CAAC;IACJ,CAAG;IACH2B,uBAAuB,EAAG,KAAO;IACjCC,2BAA2B;IAC3BC,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = QueryInspectorControls;
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _coreData = require("@wordpress/core-data");
|
|
9
11
|
var _i18n = require("@wordpress/i18n");
|
|
10
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
13
|
var _compose = require("@wordpress/compose");
|
|
@@ -14,6 +16,7 @@ var _orderControl = _interopRequireDefault(require("./order-control"));
|
|
|
14
16
|
var _authorControl = _interopRequireDefault(require("./author-control"));
|
|
15
17
|
var _parentControl = _interopRequireDefault(require("./parent-control"));
|
|
16
18
|
var _taxonomyControls = require("./taxonomy-controls");
|
|
19
|
+
var _formatControls = _interopRequireDefault(require("./format-controls"));
|
|
17
20
|
var _stickyControl = _interopRequireDefault(require("./sticky-control"));
|
|
18
21
|
var _createNewPostLink = _interopRequireDefault(require("./create-new-post-link"));
|
|
19
22
|
var _perPageControl = _interopRequireDefault(require("./per-page-control"));
|
|
@@ -38,7 +41,8 @@ function QueryInspectorControls(props) {
|
|
|
38
41
|
const {
|
|
39
42
|
attributes,
|
|
40
43
|
setQuery,
|
|
41
|
-
setDisplayLayout
|
|
44
|
+
setDisplayLayout,
|
|
45
|
+
isTemplate
|
|
42
46
|
} = props;
|
|
43
47
|
const {
|
|
44
48
|
query,
|
|
@@ -55,13 +59,15 @@ function QueryInspectorControls(props) {
|
|
|
55
59
|
sticky,
|
|
56
60
|
inherit,
|
|
57
61
|
taxQuery,
|
|
58
|
-
parents
|
|
62
|
+
parents,
|
|
63
|
+
format
|
|
59
64
|
} = query;
|
|
60
65
|
const allowedControls = (0, _utils.useAllowedControls)(attributes);
|
|
61
66
|
const [showSticky, setShowSticky] = (0, _element.useState)(postType === 'post');
|
|
62
67
|
const {
|
|
63
68
|
postTypesTaxonomiesMap,
|
|
64
|
-
postTypesSelectOptions
|
|
69
|
+
postTypesSelectOptions,
|
|
70
|
+
postTypeFormatSupportMap
|
|
65
71
|
} = (0, _utils.usePostTypes)();
|
|
66
72
|
const taxonomies = (0, _utils.useTaxonomies)(postType);
|
|
67
73
|
const isPostTypeHierarchical = (0, _utils.useIsPostTypeHierarchical)(postType);
|
|
@@ -87,6 +93,13 @@ function QueryInspectorControls(props) {
|
|
|
87
93
|
}
|
|
88
94
|
// We need to reset `parents` because they are tied to each post type.
|
|
89
95
|
updateQuery.parents = [];
|
|
96
|
+
// Post types can register post format support with `add_post_type_support`.
|
|
97
|
+
// But we need to reset the `format` property when switching to post types
|
|
98
|
+
// that do not support post formats.
|
|
99
|
+
const hasFormatSupport = postTypeFormatSupportMap[newValue];
|
|
100
|
+
if (!hasFormatSupport) {
|
|
101
|
+
updateQuery.format = [];
|
|
102
|
+
}
|
|
90
103
|
setQuery(updateQuery);
|
|
91
104
|
};
|
|
92
105
|
const [querySearch, setQuerySearch] = (0, _element.useState)(query.search);
|
|
@@ -101,19 +114,31 @@ function QueryInspectorControls(props) {
|
|
|
101
114
|
onChangeDebounced();
|
|
102
115
|
return onChangeDebounced.cancel;
|
|
103
116
|
}, [querySearch, onChangeDebounced]);
|
|
104
|
-
const showInheritControl = (0, _utils.isControlAllowed)(allowedControls, 'inherit');
|
|
105
|
-
const showPostTypeControl = !inherit && (0, _utils.isControlAllowed)(allowedControls, 'postType');
|
|
117
|
+
const showInheritControl = isTemplate && (0, _utils.isControlAllowed)(allowedControls, 'inherit');
|
|
118
|
+
const showPostTypeControl = !inherit && (0, _utils.isControlAllowed)(allowedControls, 'postType') || !isTemplate;
|
|
106
119
|
const postTypeControlLabel = (0, _i18n.__)('Post type');
|
|
107
120
|
const postTypeControlHelp = (0, _i18n.__)('Select the type of content to display: posts, pages, or custom post types.');
|
|
108
121
|
const showColumnsControl = false;
|
|
109
|
-
const showOrderControl = !inherit && (0, _utils.isControlAllowed)(allowedControls, 'order');
|
|
110
|
-
const showStickyControl = !inherit && showSticky && (0, _utils.isControlAllowed)(allowedControls, 'sticky');
|
|
122
|
+
const showOrderControl = !inherit && (0, _utils.isControlAllowed)(allowedControls, 'order') || !isTemplate;
|
|
123
|
+
const showStickyControl = !inherit && showSticky && (0, _utils.isControlAllowed)(allowedControls, 'sticky') || showSticky && !isTemplate;
|
|
111
124
|
const showSettingsPanel = showInheritControl || showPostTypeControl || showColumnsControl || showOrderControl || showStickyControl;
|
|
112
125
|
const showTaxControl = !!taxonomies?.length && (0, _utils.isControlAllowed)(allowedControls, 'taxQuery');
|
|
113
126
|
const showAuthorControl = (0, _utils.isControlAllowed)(allowedControls, 'author');
|
|
114
127
|
const showSearchControl = (0, _utils.isControlAllowed)(allowedControls, 'search');
|
|
115
128
|
const showParentControl = (0, _utils.isControlAllowed)(allowedControls, 'parents') && isPostTypeHierarchical;
|
|
116
|
-
const
|
|
129
|
+
const postTypeHasFormatSupport = postTypeFormatSupportMap[postType];
|
|
130
|
+
const showFormatControl = (0, _data.useSelect)(select => {
|
|
131
|
+
// Check if the post type supports post formats and if the control is allowed.
|
|
132
|
+
if (!postTypeHasFormatSupport || !(0, _utils.isControlAllowed)(allowedControls, 'format')) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const themeSupports = select(_coreData.store).getThemeSupports();
|
|
136
|
+
|
|
137
|
+
// If there are no supported formats, getThemeSupports still includes the default 'standard' format,
|
|
138
|
+
// and in this case the control should not be shown since the user has no other formats to choose from.
|
|
139
|
+
return themeSupports.formats && themeSupports.formats.length > 0 && themeSupports.formats.some(type => type !== 'standard');
|
|
140
|
+
}, [allowedControls, postTypeHasFormatSupport]);
|
|
141
|
+
const showFiltersPanel = showTaxControl || showAuthorControl || showSearchControl || showParentControl || showFormatControl;
|
|
117
142
|
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
118
143
|
const showPostCountControl = (0, _utils.isControlAllowed)(allowedControls, 'postCount');
|
|
119
144
|
const showOffSetControl = (0, _utils.isControlAllowed)(allowedControls, 'offset');
|
|
@@ -239,7 +264,8 @@ function QueryInspectorControls(props) {
|
|
|
239
264
|
author: '',
|
|
240
265
|
parents: [],
|
|
241
266
|
search: '',
|
|
242
|
-
taxQuery: null
|
|
267
|
+
taxQuery: null,
|
|
268
|
+
format: []
|
|
243
269
|
});
|
|
244
270
|
setQuerySearch('');
|
|
245
271
|
},
|
|
@@ -286,6 +312,16 @@ function QueryInspectorControls(props) {
|
|
|
286
312
|
postType: postType,
|
|
287
313
|
onChange: setQuery
|
|
288
314
|
})
|
|
315
|
+
}), showFormatControl && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
316
|
+
hasValue: () => !!format?.length,
|
|
317
|
+
label: (0, _i18n.__)('Formats'),
|
|
318
|
+
onDeselect: () => setQuery({
|
|
319
|
+
format: []
|
|
320
|
+
}),
|
|
321
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_formatControls.default, {
|
|
322
|
+
onChange: setQuery,
|
|
323
|
+
query: query
|
|
324
|
+
})
|
|
289
325
|
})]
|
|
290
326
|
})]
|
|
291
327
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_blockEditor","_compose","_element","_orderControl","_interopRequireDefault","_authorControl","_parentControl","_taxonomyControls","_stickyControl","_createNewPostLink","_perPageControl","_offsetControls","_pagesControl","_lockUnlock","_utils","_hooks","_jsxRuntime","BlockInfo","unlock","blockEditorPrivateApis","QueryInspectorControls","props","attributes","setQuery","setDisplayLayout","query","displayLayout","order","orderBy","author","authorIds","pages","postType","perPage","offset","sticky","inherit","taxQuery","parents","allowedControls","useAllowedControls","showSticky","setShowSticky","useState","postTypesTaxonomiesMap","postTypesSelectOptions","usePostTypes","taxonomies","useTaxonomies","isPostTypeHierarchical","useIsPostTypeHierarchical","useEffect","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","querySearch","setQuerySearch","search","onChangeDebounced","useCallback","debounce","cancel","showInheritControl","isControlAllowed","showPostTypeControl","postTypeControlLabel","__","postTypeControlHelp","showColumnsControl","showOrderControl","showStickyControl","showSettingsPanel","showTaxControl","showAuthorControl","showSearchControl","showParentControl","showFiltersPanel","dropdownMenuProps","useToolsPanelDropdownMenuProps","showPostCountControl","showOffSetControl","showPagesControl","showDisplayPanel","jsxs","Fragment","children","jsx","default","PanelBody","title","__experimentalToggleGroupControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","isBlock","onChange","value","help","__experimentalToggleGroupControlOption","SelectControl","options","map","option","RangeControl","columns","min","max","Math","Notice","status","isDismissible","__experimentalToolsPanel","className","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","values","some","TaxonomyControls","TextControl"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tNotice,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport StickyControl from './sticky-control';\nimport CreateNewPostLink from './create-new-post-link';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nconst { BlockInfo } = unlock( blockEditorPrivateApis );\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, setDisplayLayout } = props;\n\tconst { query, displayLayout } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst { postTypesTaxonomiesMap, postTypesSelectOptions } = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showColumnsControl = false;\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowColumnsControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\treturn (\n\t\t<>\n\t\t\t{ !! postType && (\n\t\t\t\t<BlockInfo>\n\t\t\t\t\t<CreateNewPostLink postType={ postType } />\n\t\t\t\t</BlockInfo>\n\t\t\t) }\n\t\t\t{ showSettingsPanel && (\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ showInheritControl && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetQuery( { inherit: !! value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ !! inherit }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue={ false }\n\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showPostTypeControl &&\n\t\t\t\t\t\t( postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map( ( option ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t) ) }\n\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\t\t\t\t\t\tcolumns: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Items' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Max Pages to Show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( terms ) => !! terms.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuerySearch( '' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAWA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,aAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA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GAAA,EAAC5F,cAAA,CAAA6F,OAAa;UACb7D,OAAO,EAAGA,OAAS;UACnBN,QAAQ,EAAGA,QAAU;UACrB2E,QAAQ,EAAGpF;QAAU,CACrB;MAAC,CACa,CAChB;IAAA,CACU,CACZ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_coreData","_i18n","_blockEditor","_compose","_element","_orderControl","_interopRequireDefault","_authorControl","_parentControl","_taxonomyControls","_formatControls","_stickyControl","_createNewPostLink","_perPageControl","_offsetControls","_pagesControl","_lockUnlock","_utils","_hooks","_jsxRuntime","BlockInfo","unlock","blockEditorPrivateApis","QueryInspectorControls","props","attributes","setQuery","setDisplayLayout","isTemplate","query","displayLayout","order","orderBy","author","authorIds","pages","postType","perPage","offset","sticky","inherit","taxQuery","parents","format","allowedControls","useAllowedControls","showSticky","setShowSticky","useState","postTypesTaxonomiesMap","postTypesSelectOptions","postTypeFormatSupportMap","usePostTypes","taxonomies","useTaxonomies","isPostTypeHierarchical","useIsPostTypeHierarchical","useEffect","onPostTypeChange","newValue","updateQuery","supportedTaxonomies","updatedTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","includes","keys","length","undefined","hasFormatSupport","querySearch","setQuerySearch","search","onChangeDebounced","useCallback","debounce","cancel","showInheritControl","isControlAllowed","showPostTypeControl","postTypeControlLabel","__","postTypeControlHelp","showColumnsControl","showOrderControl","showStickyControl","showSettingsPanel","showTaxControl","showAuthorControl","showSearchControl","showParentControl","postTypeHasFormatSupport","showFormatControl","useSelect","select","themeSupports","coreStore","getThemeSupports","formats","some","type","showFiltersPanel","dropdownMenuProps","useToolsPanelDropdownMenuProps","showPostCountControl","showOffSetControl","showPagesControl","showDisplayPanel","jsxs","Fragment","children","jsx","default","PanelBody","title","__experimentalToggleGroupControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","isBlock","onChange","value","help","__experimentalToggleGroupControlOption","SelectControl","options","map","option","RangeControl","columns","min","max","Math","Notice","status","isDismissible","__experimentalToolsPanel","className","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","values","TaxonomyControls","TextControl"],"sources":["@wordpress/block-library/src/query/edit/inspector-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tTextControl,\n\tSelectControl,\n\tRangeControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tNotice,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport FormatControls from './format-controls';\nimport StickyControl from './sticky-control';\nimport CreateNewPostLink from './create-new-post-link';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nconst { BlockInfo } = unlock( blockEditorPrivateApis );\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, setDisplayLayout, isTemplate } = props;\n\tconst { query, displayLayout } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t\tformat,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst [ showSticky, setShowSticky ] = useState( postType === 'post' );\n\tconst {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t} = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tuseEffect( () => {\n\t\tsetShowSticky( postType === 'post' );\n\t}, [ postType ] );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tconst updatedTaxQuery = Object.entries( taxQuery || {} ).reduce(\n\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\tif ( supportedTaxonomies.includes( taxonomySlug ) ) {\n\t\t\t\t\taccumulator[ taxonomySlug ] = terms;\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t? updatedTaxQuery\n\t\t\t: undefined;\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\t// Post types can register post format support with `add_post_type_support`.\n\t\t// But we need to reset the `format` property when switching to post types\n\t\t// that do not support post formats.\n\t\tconst hasFormatSupport = postTypeFormatSupportMap[ newValue ];\n\t\tif ( ! hasFormatSupport ) {\n\t\t\tupdateQuery.format = [];\n\t\t}\n\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst onChangeDebounced = useCallback(\n\t\tdebounce( () => {\n\t\t\tif ( query.search !== querySearch ) {\n\t\t\t\tsetQuery( { search: querySearch } );\n\t\t\t}\n\t\t}, 250 ),\n\t\t[ querySearch, query.search ]\n\t);\n\tuseEffect( () => {\n\t\tonChangeDebounced();\n\t\treturn onChangeDebounced.cancel;\n\t}, [ querySearch, onChangeDebounced ] );\n\n\tconst showInheritControl =\n\t\tisTemplate && isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) ||\n\t\t! isTemplate;\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showColumnsControl = false;\n\tconst showOrderControl =\n\t\t( ! inherit && isControlAllowed( allowedControls, 'order' ) ) ||\n\t\t! isTemplate;\n\tconst showStickyControl =\n\t\t( ! inherit &&\n\t\t\tshowSticky &&\n\t\t\tisControlAllowed( allowedControls, 'sticky' ) ) ||\n\t\t( showSticky && ! isTemplate );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowColumnsControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];\n\tconst showFormatControl = useSelect(\n\t\t( select ) => {\n\t\t\t// Check if the post type supports post formats and if the control is allowed.\n\t\t\tif (\n\t\t\t\t! postTypeHasFormatSupport ||\n\t\t\t\t! isControlAllowed( allowedControls, 'format' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\n\t\t\t// If there are no supported formats, getThemeSupports still includes the default 'standard' format,\n\t\t\t// and in this case the control should not be shown since the user has no other formats to choose from.\n\t\t\treturn (\n\t\t\t\tthemeSupports.formats &&\n\t\t\t\tthemeSupports.formats.length > 0 &&\n\t\t\t\tthemeSupports.formats.some( ( type ) => type !== 'standard' )\n\t\t\t);\n\t\t},\n\t\t[ allowedControls, postTypeHasFormatSupport ]\n\t);\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl ||\n\t\tshowFormatControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\treturn (\n\t\t<>\n\t\t\t{ !! postType && (\n\t\t\t\t<BlockInfo>\n\t\t\t\t\t<CreateNewPostLink postType={ postType } />\n\t\t\t\t</BlockInfo>\n\t\t\t) }\n\t\t\t{ showSettingsPanel && (\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ showInheritControl && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetQuery( { inherit: !! value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ !! inherit }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue={ false }\n\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showPostTypeControl &&\n\t\t\t\t\t\t( postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map( ( option ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t) ) }\n\n\t\t\t\t\t{ showColumnsControl && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ displayLayout.columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\t\t\t\t\t\tcolumns: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, displayLayout.columns ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ displayLayout.columns > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<OrderControl\n\t\t\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Items' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Max Pages to Show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\tformat: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( terms ) => !! terms.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuerySearch( '' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ setQuerySearch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showFormatControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! format?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Formats' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { format: [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CAAAkJ,4BAAc;QACdC,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAEtG,OAAO,EAAE6B,MAAQ;QACrCmD,KAAK,EAAG,IAAArC,QAAE,EAAE,SAAU,CAAG;QACzB4D,UAAU,EAAGA,CAAA,KAAMvH,QAAQ,CAAE;UAAEgB,OAAO,EAAE;QAAG,CAAE,CAAG;QAAAwE,QAAA,eAEhD,IAAA/F,WAAA,CAAAgG,GAAA,EAAC3G,cAAA,CAAA4G,OAAa;UACb1E,OAAO,EAAGA,OAAS;UACnBN,QAAQ,EAAGA,QAAU;UACrBwF,QAAQ,EAAGlG;QAAU,CACrB;MAAC,CACa,CAChB,EACCsE,iBAAiB,iBAClB,IAAA7E,WAAA,CAAAgG,GAAA,EAACtH,WAAA,CAAAkJ,4BAAc;QACdC,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAErG,MAAM,EAAE4B,MAAQ;QACpCmD,KAAK,EAAG,IAAArC,QAAE,EAAE,SAAU,CAAG;QACzB4D,UAAU,EAAGA,CAAA,KAAMvH,QAAQ,CAAE;UAAEiB,MAAM,EAAE;QAAG,CAAE,CAAG;QAAAuE,QAAA,eAE/C,IAAA/F,WAAA,CAAAgG,GAAA,EAACzG,eAAA,CAAA0G,OAAc;UACdQ,QAAQ,EAAGlG,QAAU;UACrBG,KAAK,EAAGA;QAAO,CACf;MAAC,CACa,CAChB;IAAA,CACU,CACZ;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -32,7 +32,8 @@ function QueryContent({
|
|
|
32
32
|
setAttributes,
|
|
33
33
|
openPatternSelectionModal,
|
|
34
34
|
name,
|
|
35
|
-
clientId
|
|
35
|
+
clientId,
|
|
36
|
+
context
|
|
36
37
|
}) {
|
|
37
38
|
const {
|
|
38
39
|
queryId,
|
|
@@ -44,6 +45,9 @@ function QueryContent({
|
|
|
44
45
|
inherit
|
|
45
46
|
} = {}
|
|
46
47
|
} = attributes;
|
|
48
|
+
const {
|
|
49
|
+
postType
|
|
50
|
+
} = context;
|
|
47
51
|
const {
|
|
48
52
|
__unstableMarkNextChangeAsNotPersistent
|
|
49
53
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
@@ -52,6 +56,12 @@ function QueryContent({
|
|
|
52
56
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
53
57
|
template: TEMPLATE
|
|
54
58
|
});
|
|
59
|
+
const isTemplate = (0, _data.useSelect)(select => {
|
|
60
|
+
const currentTemplate = select(_coreData.store).__experimentalGetTemplateForLink()?.type;
|
|
61
|
+
const isInTemplate = 'wp_template' === currentTemplate;
|
|
62
|
+
const isInSingularContent = postType !== undefined;
|
|
63
|
+
return isInTemplate && !isInSingularContent;
|
|
64
|
+
}, [postType]);
|
|
55
65
|
const {
|
|
56
66
|
postsPerPage
|
|
57
67
|
} = (0, _data.useSelect)(select => {
|
|
@@ -85,6 +95,12 @@ function QueryContent({
|
|
|
85
95
|
// Changes in query property (which is an object) need to be in the same callback,
|
|
86
96
|
// because updates are batched after the render and changes in different query properties
|
|
87
97
|
// would cause to override previous wanted changes.
|
|
98
|
+
const updateQuery = (0, _element.useCallback)(newQuery => setAttributes({
|
|
99
|
+
query: {
|
|
100
|
+
...query,
|
|
101
|
+
...newQuery
|
|
102
|
+
}
|
|
103
|
+
}), [query, setAttributes]);
|
|
88
104
|
(0, _element.useEffect)(() => {
|
|
89
105
|
const newQuery = {};
|
|
90
106
|
// When we inherit from global query always need to set the `perPage`
|
|
@@ -94,11 +110,16 @@ function QueryContent({
|
|
|
94
110
|
} else if (!query.perPage && postsPerPage) {
|
|
95
111
|
newQuery.perPage = postsPerPage;
|
|
96
112
|
}
|
|
113
|
+
// We need to reset the `inherit` value if not in a template, as queries
|
|
114
|
+
// are not inherited when outside a template (e.g. when in singular content).
|
|
115
|
+
if (!isTemplate && query.inherit) {
|
|
116
|
+
newQuery.inherit = false;
|
|
117
|
+
}
|
|
97
118
|
if (!!Object.keys(newQuery).length) {
|
|
98
119
|
__unstableMarkNextChangeAsNotPersistent();
|
|
99
120
|
updateQuery(newQuery);
|
|
100
121
|
}
|
|
101
|
-
}, [query.perPage, postsPerPage, inherit]);
|
|
122
|
+
}, [query.perPage, postsPerPage, inherit, isTemplate, query.inherit, __unstableMarkNextChangeAsNotPersistent, updateQuery]);
|
|
102
123
|
// We need this for multi-query block pagination.
|
|
103
124
|
// Query parameters for each block are scoped to their ID.
|
|
104
125
|
(0, _element.useEffect)(() => {
|
|
@@ -108,13 +129,7 @@ function QueryContent({
|
|
|
108
129
|
queryId: instanceId
|
|
109
130
|
});
|
|
110
131
|
}
|
|
111
|
-
}, [queryId, instanceId]);
|
|
112
|
-
const updateQuery = newQuery => setAttributes({
|
|
113
|
-
query: {
|
|
114
|
-
...query,
|
|
115
|
-
...newQuery
|
|
116
|
-
}
|
|
117
|
-
});
|
|
132
|
+
}, [queryId, instanceId, __unstableMarkNextChangeAsNotPersistent, setAttributes]);
|
|
118
133
|
const updateDisplayLayout = newDisplayLayout => setAttributes({
|
|
119
134
|
displayLayout: {
|
|
120
135
|
...displayLayout,
|
|
@@ -137,7 +152,8 @@ function QueryContent({
|
|
|
137
152
|
setQuery: updateQuery,
|
|
138
153
|
setDisplayLayout: updateDisplayLayout,
|
|
139
154
|
setAttributes: setAttributes,
|
|
140
|
-
clientId: clientId
|
|
155
|
+
clientId: clientId,
|
|
156
|
+
isTemplate: isTemplate
|
|
141
157
|
})
|
|
142
158
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
|
|
143
159
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_queryToolbar.default, {
|