@wordpress/edit-site 5.21.0 → 5.21.1-next.f8d8eceb.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/build/components/actions/index.js +121 -0
- package/build/components/actions/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +12 -4
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews/context.js +15 -0
- package/build/components/dataviews/context.js.map +1 -0
- package/build/components/dataviews/dataviews.js +10 -2
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +30 -17
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/in-filter.js +5 -7
- package/build/components/dataviews/in-filter.js.map +1 -1
- package/build/components/dataviews/item-actions.js +62 -0
- package/build/components/dataviews/item-actions.js.map +1 -0
- package/build/components/dataviews/pagination.js +31 -50
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/{text-filter.js → search.js} +10 -10
- package/build/components/dataviews/search.js.map +1 -0
- package/build/components/dataviews/view-grid.js +3 -3
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +2 -2
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -8
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/page-pages/default-views.js +60 -0
- package/build/components/page-pages/default-views.js.map +1 -0
- package/build/components/page-pages/index.js +73 -52
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +72 -0
- package/build/components/sidebar-dataviews/index.js.map +1 -0
- package/build/hooks/commands/use-edit-mode-commands.js +3 -2
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/components/actions/index.js +108 -0
- package/build-module/components/actions/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +12 -4
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews/context.js +7 -0
- package/build-module/components/dataviews/context.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +10 -2
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +30 -17
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/in-filter.js +5 -7
- package/build-module/components/dataviews/in-filter.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +55 -0
- package/build-module/components/dataviews/item-actions.js.map +1 -0
- package/build-module/components/dataviews/pagination.js +32 -51
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/{text-filter.js → search.js} +9 -9
- package/build-module/components/dataviews/search.js.map +1 -0
- package/build-module/components/dataviews/view-grid.js +3 -3
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +2 -2
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -8
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/page-pages/default-views.js +53 -0
- package/build-module/components/page-pages/default-views.js.map +1 -0
- package/build-module/components/page-pages/index.js +71 -52
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +64 -0
- package/build-module/components/sidebar-dataviews/index.js.map +1 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-style/style-rtl.css +9 -5
- package/build-style/style.css +9 -5
- package/package.json +40 -40
- package/src/components/actions/index.js +123 -0
- package/src/components/block-editor/use-site-editor-settings.js +21 -13
- package/src/components/dataviews/README.md +134 -47
- package/src/components/dataviews/context.js +7 -0
- package/src/components/dataviews/dataviews.js +11 -1
- package/src/components/dataviews/filters.js +35 -17
- package/src/components/dataviews/in-filter.js +5 -7
- package/src/components/dataviews/item-actions.js +69 -0
- package/src/components/dataviews/pagination.js +53 -74
- package/src/components/dataviews/{text-filter.js → search.js} +7 -7
- package/src/components/dataviews/style.scss +10 -5
- package/src/components/dataviews/view-grid.js +7 -2
- package/src/components/dataviews/view-list.js +2 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/src/components/global-styles/screen-block.js +1 -7
- package/src/components/page-pages/default-views.js +58 -0
- package/src/components/page-pages/index.js +85 -60
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-dataviews/index.js +65 -0
- package/src/hooks/commands/use-edit-mode-commands.js +3 -1
- package/build/components/actions/trash-post.js +0 -48
- package/build/components/actions/trash-post.js.map +0 -1
- package/build/components/dataviews/field-actions.js +0 -30
- package/build/components/dataviews/field-actions.js.map +0 -1
- package/build/components/dataviews/text-filter.js.map +0 -1
- package/build-module/components/actions/trash-post.js +0 -41
- package/build-module/components/actions/trash-post.js.map +0 -1
- package/build-module/components/dataviews/field-actions.js +0 -22
- package/build-module/components/dataviews/field-actions.js.map +0 -1
- package/build-module/components/dataviews/text-filter.js.map +0 -1
- package/src/components/actions/trash-post.js +0 -55
- package/src/components/dataviews/field-actions.js +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","customDuotone","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...settings.color,\n\t\t\t\t\t\t\tcustomDuotone: false, //TO FIX: Custom duotone only works on the block level right now\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,EAC9BC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,UAAU;AACnC,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,oBAAoB;AAExE,SAASC,kBAAkBA,CAAEC,MAAM,EAAG;EACrC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAOA,MAAM;EACd;EAEA,MAAMC,eAAe,GAAGD,MAAM,CAACE,KAAK,IAAIF,MAAM,CAACG,KAAK;EAEpD,IAAK,CAAEH,MAAM,CAACI,KAAK,IAAIH,eAAe,EAAG;IACxC,OAAO;MAAE,GAAGD,MAAM;MAAEI,KAAK,EAAE;IAAQ,CAAC;EACrC;EAEA,IAAKJ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"version":3,"names":["getBlockType","privateApis","blockEditorPrivateApis","useMemo","useSelect","store","coreStore","PanelBody","__experimentalVStack","VStack","__experimentalHasSplitBorders","hasSplitBorders","__","sprintf","ScreenHeader","BlockPreviewPanel","unlock","Subtitle","useBlockVariations","VariationsPanel","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasEffectsPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","EffectsPanel","StylesEffectsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","blockVariations","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasEffectsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","createElement","Fragment","title","label","className","inheritedValue","value","onChange","includeLayoutControls","initialOpen"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport { useBlockVariations, VariationsPanel } from './variations-panel';\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasEffectsPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tEffectsPanel: StylesEffectsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<StylesEffectsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,SAAS,EACTC,oBAAoB,IAAIC,MAAM,EAC9BC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,UAAU;AACnC,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,oBAAoB;AAExE,SAASC,kBAAkBA,CAAEC,MAAM,EAAG;EACrC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAOA,MAAM;EACd;EAEA,MAAMC,eAAe,GAAGD,MAAM,CAACE,KAAK,IAAIF,MAAM,CAACG,KAAK;EAEpD,IAAK,CAAEH,MAAM,CAACI,K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@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
// DEFAULT_STATUSES is intentionally sorted. Items do not have spaces in between them.
|
|
7
|
+
// The reason for that is to match the default statuses coming from the endpoint
|
|
8
|
+
// (entity request and useEffect to update the view).
|
|
9
|
+
export const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All statuses but 'trash'.
|
|
10
|
+
|
|
11
|
+
const DEFAULT_PAGE_BASE = {
|
|
12
|
+
type: 'list',
|
|
13
|
+
search: '',
|
|
14
|
+
filters: {
|
|
15
|
+
status: DEFAULT_STATUSES
|
|
16
|
+
},
|
|
17
|
+
page: 1,
|
|
18
|
+
perPage: 5,
|
|
19
|
+
sort: {
|
|
20
|
+
field: 'date',
|
|
21
|
+
direction: 'desc'
|
|
22
|
+
},
|
|
23
|
+
visibleFilters: ['author', 'status'],
|
|
24
|
+
// All fields are visible by default, so it's
|
|
25
|
+
// better to keep track of the hidden ones.
|
|
26
|
+
hiddenFields: ['date', 'featured-image'],
|
|
27
|
+
layout: {}
|
|
28
|
+
};
|
|
29
|
+
const DEFAULT_VIEWS = [{
|
|
30
|
+
title: __('All'),
|
|
31
|
+
slug: 'all',
|
|
32
|
+
view: DEFAULT_PAGE_BASE
|
|
33
|
+
}, {
|
|
34
|
+
title: __('Drafts'),
|
|
35
|
+
slug: 'drafts',
|
|
36
|
+
view: {
|
|
37
|
+
...DEFAULT_PAGE_BASE,
|
|
38
|
+
filters: {
|
|
39
|
+
status: 'draft'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
title: __('Trash'),
|
|
44
|
+
slug: 'trash',
|
|
45
|
+
view: {
|
|
46
|
+
...DEFAULT_PAGE_BASE,
|
|
47
|
+
filters: {
|
|
48
|
+
status: 'trash'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}];
|
|
52
|
+
export default DEFAULT_VIEWS;
|
|
53
|
+
//# sourceMappingURL=default-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","DEFAULT_STATUSES","DEFAULT_PAGE_BASE","type","search","filters","status","page","perPage","sort","field","direction","visibleFilters","hiddenFields","layout","DEFAULT_VIEWS","title","slug","view"],"sources":["@wordpress/edit-site/src/components/page-pages/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n// DEFAULT_STATUSES is intentionally sorted. Items do not have spaces in between them.\n// The reason for that is to match the default statuses coming from the endpoint\n// (entity request and useEffect to update the view).\nexport const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All statuses but 'trash'.\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: 'list',\n\tsearch: '',\n\tfilters: {\n\t\tstatus: DEFAULT_STATUSES,\n\t},\n\tpage: 1,\n\tperPage: 5,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\tvisibleFilters: [ 'author', 'status' ],\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {},\n};\n\nconst DEFAULT_VIEWS = [\n\t{\n\t\ttitle: __( 'All' ),\n\t\tslug: 'all',\n\t\tview: DEFAULT_PAGE_BASE,\n\t},\n\t{\n\t\ttitle: __( 'Drafts' ),\n\t\tslug: 'drafts',\n\t\tview: {\n\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\tfilters: {\n\t\t\t\tstatus: 'draft',\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\ttitle: __( 'Trash' ),\n\t\tslug: 'trash',\n\t\tview: {\n\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\tfilters: {\n\t\t\t\tstatus: 'trash',\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport default DEFAULT_VIEWS;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,sCAAsC,CAAC,CAAC;;AAExE,MAAMC,iBAAiB,GAAG;EACzBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE;IACRC,MAAM,EAAEL;EACT,CAAC;EACDM,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE;IACLC,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE;EACZ,CAAC;EACDC,cAAc,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;EACtC;EACA;EACAC,YAAY,EAAE,CAAE,MAAM,EAAE,gBAAgB,CAAE;EAC1CC,MAAM,EAAE,CAAC;AACV,CAAC;AAED,MAAMC,aAAa,GAAG,CACrB;EACCC,KAAK,EAAEhB,EAAE,CAAE,KAAM,CAAC;EAClBiB,IAAI,EAAE,KAAK;EACXC,IAAI,EAAEhB;AACP,CAAC,EACD;EACCc,KAAK,EAAEhB,EAAE,CAAE,QAAS,CAAC;EACrBiB,IAAI,EAAE,QAAQ;EACdC,IAAI,EAAE;IACL,GAAGhB,iBAAiB;IACpBG,OAAO,EAAE;MACRC,MAAM,EAAE;IACT;EACD;AACD,CAAC,EACD;EACCU,KAAK,EAAEhB,EAAE,CAAE,OAAQ,CAAC;EACpBiB,IAAI,EAAE,OAAO;EACbC,IAAI,EAAE;IACL,GAAGhB,iBAAiB;IACpBG,OAAO,EAAE;MACRC,MAAM,EAAE;IACT;EACD;AACD,CAAC,CACD;AAED,eAAeS,aAAa"}
|
|
@@ -6,8 +6,9 @@ import { __experimentalHeading as Heading, __experimentalVStack as VStack } from
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
8
8
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
|
-
import { useState, useMemo, useCallback } from '@wordpress/element';
|
|
9
|
+
import { useState, useMemo, useCallback, useEffect } from '@wordpress/element';
|
|
10
10
|
import { dateI18n, getDate, getSettings } from '@wordpress/date';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -15,10 +16,14 @@ import { dateI18n, getDate, getSettings } from '@wordpress/date';
|
|
|
15
16
|
import Page from '../page';
|
|
16
17
|
import Link from '../routes/link';
|
|
17
18
|
import { DataViews } from '../dataviews';
|
|
18
|
-
import
|
|
19
|
+
import { DEFAULT_STATUSES, default as DEFAULT_VIEWS } from './default-views';
|
|
20
|
+
import { useTrashPostAction, postRevisionsAction, viewPostAction, useEditPostAction } from '../actions';
|
|
19
21
|
import Media from '../media';
|
|
22
|
+
import { unlock } from '../../lock-unlock';
|
|
23
|
+
const {
|
|
24
|
+
useLocation
|
|
25
|
+
} = unlock(routerPrivateApis);
|
|
20
26
|
const EMPTY_ARRAY = [];
|
|
21
|
-
const EMPTY_OBJECT = {};
|
|
22
27
|
const defaultConfigPerViewType = {
|
|
23
28
|
list: {},
|
|
24
29
|
grid: {
|
|
@@ -26,38 +31,60 @@ const defaultConfigPerViewType = {
|
|
|
26
31
|
}
|
|
27
32
|
};
|
|
28
33
|
export default function PagePages() {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
hiddenFields: ['date', 'featured-image'],
|
|
45
|
-
layout: {}
|
|
46
|
-
});
|
|
34
|
+
const {
|
|
35
|
+
params: {
|
|
36
|
+
path,
|
|
37
|
+
activeView = 'all'
|
|
38
|
+
}
|
|
39
|
+
} = useLocation();
|
|
40
|
+
const initialView = DEFAULT_VIEWS.find(({
|
|
41
|
+
slug
|
|
42
|
+
}) => slug === activeView).view;
|
|
43
|
+
const [view, setView] = useState(initialView);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setView(DEFAULT_VIEWS.find(({
|
|
46
|
+
slug
|
|
47
|
+
}) => slug === activeView).view);
|
|
48
|
+
}, [path, activeView]);
|
|
47
49
|
// Request post statuses to get the proper labels.
|
|
48
50
|
const {
|
|
49
51
|
records: statuses
|
|
50
52
|
} = useEntityRecords('root', 'status');
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const defaultStatuses = useMemo(() => {
|
|
54
|
+
return statuses === null ? DEFAULT_STATUSES : statuses.filter(({
|
|
55
|
+
slug
|
|
56
|
+
}) => slug !== 'trash').map(({
|
|
57
|
+
slug
|
|
58
|
+
}) => slug).sort().join();
|
|
59
|
+
}, [statuses]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
// Only update the view if the statuses received from the endpoint
|
|
62
|
+
// are different from the DEFAULT_STATUSES provided initially.
|
|
63
|
+
//
|
|
64
|
+
// The pages endpoint depends on the status endpoint via the status filter.
|
|
65
|
+
// Initially, this code filters the pages request by DEFAULT_STATUTES,
|
|
66
|
+
// instead of using the default (publish).
|
|
67
|
+
// https://developer.wordpress.org/rest-api/reference/pages/#list-pages
|
|
68
|
+
//
|
|
69
|
+
// By doing so, it avoids a second request to the pages endpoint
|
|
70
|
+
// upon receiving the statuses when they are the same (most common scenario).
|
|
71
|
+
if (DEFAULT_STATUSES !== defaultStatuses) {
|
|
72
|
+
setView({
|
|
73
|
+
...view,
|
|
74
|
+
filters: {
|
|
75
|
+
...view.filters,
|
|
76
|
+
status: defaultStatuses
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, [defaultStatuses]);
|
|
55
81
|
const queryArgs = useMemo(() => ({
|
|
56
82
|
per_page: view.perPage,
|
|
57
83
|
page: view.page,
|
|
58
84
|
_embed: 'author',
|
|
59
85
|
order: view.sort?.direction,
|
|
60
86
|
orderby: view.sort?.field,
|
|
87
|
+
search: view.search,
|
|
61
88
|
...view.filters
|
|
62
89
|
}), [view]);
|
|
63
90
|
const {
|
|
@@ -68,9 +95,7 @@ export default function PagePages() {
|
|
|
68
95
|
} = useEntityRecords('postType', 'page', queryArgs);
|
|
69
96
|
const {
|
|
70
97
|
records: authors
|
|
71
|
-
} = useEntityRecords('root', 'user'
|
|
72
|
-
who: 'authors'
|
|
73
|
-
});
|
|
98
|
+
} = useEntityRecords('root', 'user');
|
|
74
99
|
const paginationInfo = useMemo(() => ({
|
|
75
100
|
totalItems,
|
|
76
101
|
totalPages
|
|
@@ -112,10 +137,6 @@ export default function PagePages() {
|
|
|
112
137
|
}
|
|
113
138
|
}, decodeEntities(item.title?.rendered || item.slug) || __('(no title)'))));
|
|
114
139
|
},
|
|
115
|
-
filters: [{
|
|
116
|
-
id: 'search',
|
|
117
|
-
type: 'search'
|
|
118
|
-
}],
|
|
119
140
|
maxWidth: 400,
|
|
120
141
|
sortingFn: 'alphanumeric',
|
|
121
142
|
enableHiding: false
|
|
@@ -133,40 +154,37 @@ export default function PagePages() {
|
|
|
133
154
|
href: `user-edit.php?user_id=${author.id}`
|
|
134
155
|
}, author.name);
|
|
135
156
|
},
|
|
136
|
-
filters: [
|
|
137
|
-
|
|
138
|
-
type: 'enumeration'
|
|
139
|
-
}],
|
|
140
|
-
elements: [{
|
|
141
|
-
value: '',
|
|
142
|
-
label: __('All')
|
|
143
|
-
}, ...(authors?.map(({
|
|
157
|
+
filters: ['enumeration'],
|
|
158
|
+
elements: authors?.map(({
|
|
144
159
|
id,
|
|
145
160
|
name
|
|
146
161
|
}) => ({
|
|
147
162
|
value: id,
|
|
148
163
|
label: name
|
|
149
|
-
})) || []
|
|
164
|
+
})) || []
|
|
150
165
|
}, {
|
|
151
166
|
header: __('Status'),
|
|
152
167
|
id: 'status',
|
|
153
168
|
getValue: ({
|
|
154
169
|
item
|
|
155
170
|
}) => {
|
|
156
|
-
var
|
|
157
|
-
return (
|
|
171
|
+
var _statuses$find$name;
|
|
172
|
+
return (_statuses$find$name = statuses?.find(({
|
|
173
|
+
slug
|
|
174
|
+
}) => slug === item.status)?.name) !== null && _statuses$find$name !== void 0 ? _statuses$find$name : item.status;
|
|
158
175
|
},
|
|
159
176
|
filters: [{
|
|
160
177
|
type: 'enumeration',
|
|
161
|
-
id: 'status'
|
|
178
|
+
id: 'status',
|
|
179
|
+
resetValue: defaultStatuses
|
|
162
180
|
}],
|
|
163
|
-
elements:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
181
|
+
elements: statuses?.map(({
|
|
182
|
+
slug,
|
|
183
|
+
name
|
|
184
|
+
}) => ({
|
|
167
185
|
value: slug,
|
|
168
186
|
label: name
|
|
169
|
-
})) || []
|
|
187
|
+
})) || [],
|
|
170
188
|
enableSorting: false
|
|
171
189
|
}, {
|
|
172
190
|
header: __('Date'),
|
|
@@ -180,9 +198,10 @@ export default function PagePages() {
|
|
|
180
198
|
const formattedDate = dateI18n(getSettings().formats.datetimeAbbreviated, getDate(item.date));
|
|
181
199
|
return createElement("time", null, formattedDate);
|
|
182
200
|
}
|
|
183
|
-
}], [
|
|
201
|
+
}], [defaultStatuses, statuses, authors]);
|
|
184
202
|
const trashPostAction = useTrashPostAction();
|
|
185
|
-
const
|
|
203
|
+
const editPostAction = useEditPostAction();
|
|
204
|
+
const actions = useMemo(() => [viewPostAction, trashPostAction, editPostAction, postRevisionsAction], [trashPostAction, editPostAction]);
|
|
186
205
|
const onChangeView = useCallback(viewUpdater => {
|
|
187
206
|
let updatedView = typeof viewUpdater === 'function' ? viewUpdater(view) : viewUpdater;
|
|
188
207
|
if (updatedView.type !== view.type) {
|
|
@@ -194,7 +213,7 @@ export default function PagePages() {
|
|
|
194
213
|
};
|
|
195
214
|
}
|
|
196
215
|
setView(updatedView);
|
|
197
|
-
}, [view]);
|
|
216
|
+
}, [view, setView]);
|
|
198
217
|
|
|
199
218
|
// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.
|
|
200
219
|
return createElement(Page, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalHeading","Heading","__experimentalVStack","VStack","__","useEntityRecords","decodeEntities","useState","useMemo","useCallback","dateI18n","getDate","getSettings","Page","Link","DataViews","useTrashPostAction","Media","EMPTY_ARRAY","EMPTY_OBJECT","defaultConfigPerViewType","list","grid","mediaField","PagePages","view","setView","type","filters","search","status","page","perPage","sort","field","direction","visibleFilters","hiddenFields","layout","records","statuses","postStatuses","Object","fromEntries","map","slug","name","queryArgs","per_page","_embed","order","orderby","pages","isResolving","isLoadingPages","totalItems","totalPages","authors","who","paginationInfo","fields","id","header","getValue","item","featured_media","render","currentView","createElement","className","size","enableSorting","title","rendered","spacing","as","level","params","postId","postType","canvas","maxWidth","sortingFn","enableHiding","_embedded","author","href","elements","value","label","_postStatuses$item$st","entries","filter","includes","date","formattedDate","formats","datetimeAbbreviated","trashPostAction","actions","onChangeView","viewUpdater","updatedView","data","isLoading"],"sources":["@wordpress/edit-site/src/components/page-pages/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport { DataViews } from '../dataviews';\nimport useTrashPostAction from '../actions/trash-post';\nimport Media from '../media';\n\nconst EMPTY_ARRAY = [];\nconst EMPTY_OBJECT = {};\nconst defaultConfigPerViewType = {\n\tlist: {},\n\tgrid: {\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nexport default function PagePages() {\n\tconst [ view, setView ] = useState( {\n\t\ttype: 'list',\n\t\tfilters: {\n\t\t\tsearch: '',\n\t\t\tstatus: 'publish, draft',\n\t\t},\n\t\tpage: 1,\n\t\tperPage: 5,\n\t\tsort: {\n\t\t\tfield: 'date',\n\t\t\tdirection: 'desc',\n\t\t},\n\t\tvisibleFilters: [ 'search', 'author', 'status' ],\n\t\t// All fields are visible by default, so it's\n\t\t// better to keep track of the hidden ones.\n\t\thiddenFields: [ 'date', 'featured-image' ],\n\t\tlayout: {},\n\t} );\n\t// Request post statuses to get the proper labels.\n\tconst { records: statuses } = useEntityRecords( 'root', 'status' );\n\tconst postStatuses = useMemo(\n\t\t() =>\n\t\t\tstatuses === null\n\t\t\t\t? EMPTY_OBJECT\n\t\t\t\t: Object.fromEntries(\n\t\t\t\t\t\tstatuses.map( ( { slug, name } ) => [ slug, name ] )\n\t\t\t\t ),\n\t\t[ statuses ]\n\t);\n\n\tconst queryArgs = useMemo(\n\t\t() => ( {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\t...view.filters,\n\t\t} ),\n\t\t[ view ]\n\t);\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isLoadingPages,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', 'page', queryArgs );\n\n\tconst { records: authors } = useEntityRecords( 'root', 'user', {\n\t\twho: 'authors',\n\t} );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\theader: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item, view: currentView } ) =>\n\t\t\t\t\t!! item.featured_media ? (\n\t\t\t\t\t\t<Media\n\t\t\t\t\t\t\tclassName=\"edit-site-page-pages__featured-image\"\n\t\t\t\t\t\t\tid={ item.featured_media }\n\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\tcurrentView.type === 'list'\n\t\t\t\t\t\t\t\t\t? [ 'thumbnail', 'medium', 'large', 'full' ]\n\t\t\t\t\t\t\t\t\t: [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered || item.slug,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\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\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered || item.slug\n\t\t\t\t\t\t\t\t\t) || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tfilters: [ { id: 'search', type: 'search' } ],\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tsortingFn: 'alphanumeric',\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst author = item._embedded?.author[ 0 ];\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<a href={ `user-edit.php?user_id=${ author.id }` }>\n\t\t\t\t\t\t\t{ author.name }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tfilters: [ { id: 'author', type: 'enumeration' } ],\n\t\t\t\telements: [\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t\tlabel: __( 'All' ),\n\t\t\t\t\t},\n\t\t\t\t\t...( authors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [] ),\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tpostStatuses[ item.status ] ?? item.status,\n\t\t\t\tfilters: [ { type: 'enumeration', id: 'status' } ],\n\t\t\t\telements: [\n\t\t\t\t\t{ label: __( 'All' ), value: 'publish,draft' },\n\t\t\t\t\t...( ( postStatuses &&\n\t\t\t\t\t\tObject.entries( postStatuses )\n\t\t\t\t\t\t\t.filter( ( [ slug ] ) =>\n\t\t\t\t\t\t\t\t[ 'publish', 'draft' ].includes( slug )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( [ slug, name ] ) => ( {\n\t\t\t\t\t\t\t\tvalue: slug,\n\t\t\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t\t\t} ) ) ) ||\n\t\t\t\t\t\t[] ),\n\t\t\t\t],\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\tgetValue: ( { item } ) => item.date,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst formattedDate = dateI18n(\n\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\tgetDate( item.date )\n\t\t\t\t\t);\n\t\t\t\t\treturn <time>{ formattedDate }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ postStatuses, authors ]\n\t);\n\n\tconst trashPostAction = useTrashPostAction();\n\tconst actions = useMemo( () => [ trashPostAction ], [ trashPostAction ] );\n\tconst onChangeView = useCallback(\n\t\t( viewUpdater ) => {\n\t\t\tlet updatedView =\n\t\t\t\ttypeof viewUpdater === 'function'\n\t\t\t\t\t? viewUpdater( view )\n\t\t\t\t\t: viewUpdater;\n\t\t\tif ( updatedView.type !== view.type ) {\n\t\t\t\tupdatedView = {\n\t\t\t\t\t...updatedView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ updatedView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( updatedView );\n\t\t},\n\t\t[ view ]\n\t);\n\n\t// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.\n\treturn (\n\t\t<Page title={ __( 'Pages' ) }>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ pages || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingPages }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACnE,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,iBAAiB;;AAEhE;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAA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E,OAAQ;EAAG,GAC5BgE,aAAA,CAACrD,SAAS;IACT4C,cAAc,EAAGA,cAAgB;IACjCC,MAAM,EAAGA,MAAQ;IACjBuC,OAAO,EAAGA,OAAS;IACnBI,IAAI,EAAGnD,KAAK,IAAIlC,WAAa;IAC7BsF,SAAS,EAAGlD,cAAgB;IAC5B7B,IAAI,EAAGA,IAAM;IACb2E,YAAY,EAAGA;EAAc,CAC7B,CACI,CAAC;AAET"}
|
|
1
|
+
{"version":3,"names":["__experimentalHeading","Heading","__experimentalVStack","VStack","__","useEntityRecords","decodeEntities","useState","useMemo","useCallback","useEffect","dateI18n","getDate","getSettings","privateApis","routerPrivateApis","Page","Link","DataViews","DEFAULT_STATUSES","default","DEFAULT_VIEWS","useTrashPostAction","postRevisionsAction","viewPostAction","useEditPostAction","Media","unlock","useLocation","EMPTY_ARRAY","defaultConfigPerViewType","list","grid","mediaField","PagePages","params","path","activeView","initialView","find","slug","view","setView","records","statuses","defaultStatuses","filter","map","sort","join","filters","status","queryArgs","per_page","perPage","page","_embed","order","direction","orderby","field","search","pages","isResolving","isLoadingPages","totalItems","totalPages","authors","paginationInfo","fields","id","header","getValue","item","featured_media","render","currentView","createElement","className","size","type","enableSorting","title","rendered","spacing","as","level","postId","postType","canvas","maxWidth","sortingFn","enableHiding","_embedded","author","name","href","elements","value","label","_statuses$find$name","resetValue","date","formattedDate","formats","datetimeAbbreviated","trashPostAction","editPostAction","actions","onChangeView","viewUpdater","updatedView","layout","data","isLoading"],"sources":["@wordpress/edit-site/src/components/page-pages/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Link from '../routes/link';\nimport { DataViews } from '../dataviews';\nimport { DEFAULT_STATUSES, default as DEFAULT_VIEWS } from './default-views';\nimport {\n\tuseTrashPostAction,\n\tpostRevisionsAction,\n\tviewPostAction,\n\tuseEditPostAction,\n} from '../actions';\nimport Media from '../media';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultConfigPerViewType = {\n\tlist: {},\n\tgrid: {\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nexport default function PagePages() {\n\tconst {\n\t\tparams: { path, activeView = 'all' },\n\t} = useLocation();\n\tconst initialView = DEFAULT_VIEWS.find(\n\t\t( { slug } ) => slug === activeView\n\t).view;\n\tconst [ view, setView ] = useState( initialView );\n\tuseEffect( () => {\n\t\tsetView(\n\t\t\tDEFAULT_VIEWS.find( ( { slug } ) => slug === activeView ).view\n\t\t);\n\t}, [ path, activeView ] );\n\t// Request post statuses to get the proper labels.\n\tconst { records: statuses } = useEntityRecords( 'root', 'status' );\n\tconst defaultStatuses = useMemo( () => {\n\t\treturn statuses === null\n\t\t\t? DEFAULT_STATUSES\n\t\t\t: statuses\n\t\t\t\t\t.filter( ( { slug } ) => slug !== 'trash' )\n\t\t\t\t\t.map( ( { slug } ) => slug )\n\t\t\t\t\t.sort()\n\t\t\t\t\t.join();\n\t}, [ statuses ] );\n\n\tuseEffect( () => {\n\t\t// Only update the view if the statuses received from the endpoint\n\t\t// are different from the DEFAULT_STATUSES provided initially.\n\t\t//\n\t\t// The pages endpoint depends on the status endpoint via the status filter.\n\t\t// Initially, this code filters the pages request by DEFAULT_STATUTES,\n\t\t// instead of using the default (publish).\n\t\t// https://developer.wordpress.org/rest-api/reference/pages/#list-pages\n\t\t//\n\t\t// By doing so, it avoids a second request to the pages endpoint\n\t\t// upon receiving the statuses when they are the same (most common scenario).\n\t\tif ( DEFAULT_STATUSES !== defaultStatuses ) {\n\t\t\tsetView( {\n\t\t\t\t...view,\n\t\t\t\tfilters: {\n\t\t\t\t\t...view.filters,\n\t\t\t\t\tstatus: defaultStatuses,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [ defaultStatuses ] );\n\n\tconst queryArgs = useMemo(\n\t\t() => ( {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...view.filters,\n\t\t} ),\n\t\t[ view ]\n\t);\n\tconst {\n\t\trecords: pages,\n\t\tisResolving: isLoadingPages,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', 'page', queryArgs );\n\n\tconst { records: authors } = useEntityRecords( 'root', 'user' );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\theader: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item, view: currentView } ) =>\n\t\t\t\t\t!! item.featured_media ? (\n\t\t\t\t\t\t<Media\n\t\t\t\t\t\t\tclassName=\"edit-site-page-pages__featured-image\"\n\t\t\t\t\t\t\tid={ item.featured_media }\n\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\tcurrentView.type === 'list'\n\t\t\t\t\t\t\t\t\t? [ 'thumbnail', 'medium', 'large', 'full' ]\n\t\t\t\t\t\t\t\t\t: [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered || item.slug,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\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\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered || item.slug\n\t\t\t\t\t\t\t\t\t) || __( '(no title)' ) }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 400,\n\t\t\t\tsortingFn: 'alphanumeric',\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst author = item._embedded?.author[ 0 ];\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<a href={ `user-edit.php?user_id=${ author.id }` }>\n\t\t\t\t\t\t\t{ author.name }\n\t\t\t\t\t\t</a>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tfilters: [ 'enumeration' ],\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tstatuses?.find( ( { slug } ) => slug === item.status )\n\t\t\t\t\t\t?.name ?? item.status,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'enumeration',\n\t\t\t\t\t\tid: 'status',\n\t\t\t\t\t\tresetValue: defaultStatuses,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\telements:\n\t\t\t\t\tstatuses?.map( ( { slug, name } ) => ( {\n\t\t\t\t\t\tvalue: slug,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\tgetValue: ( { item } ) => item.date,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst formattedDate = dateI18n(\n\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\tgetDate( item.date )\n\t\t\t\t\t);\n\t\t\t\t\treturn <time>{ formattedDate }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ defaultStatuses, statuses, authors ]\n\t);\n\n\tconst trashPostAction = useTrashPostAction();\n\tconst editPostAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [\n\t\t\tviewPostAction,\n\t\t\ttrashPostAction,\n\t\t\teditPostAction,\n\t\t\tpostRevisionsAction,\n\t\t],\n\t\t[ trashPostAction, editPostAction ]\n\t);\n\tconst onChangeView = useCallback(\n\t\t( viewUpdater ) => {\n\t\t\tlet updatedView =\n\t\t\t\ttypeof viewUpdater === 'function'\n\t\t\t\t\t? viewUpdater( view )\n\t\t\t\t\t: viewUpdater;\n\t\t\tif ( updatedView.type !== view.type ) {\n\t\t\t\tupdatedView = {\n\t\t\t\t\t...updatedView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...defaultConfigPerViewType[ updatedView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( updatedView );\n\t\t},\n\t\t[ view, setView ]\n\t);\n\n\t// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.\n\treturn (\n\t\t<Page title={ __( 'Pages' ) }>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ pages || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingPages }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AAC9E,SAASC,QAAQ,EAAEC,OAAO,EAAEC,WAAW,QAAQ,iBAAiB;AAChE,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,IAAI,MAAM,gBAAgB;AACjC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,gBAAgB,EAAEC,OAAO,IAAIC,aAAa,QAAQ,iBAAiB;AAC5E,SACCC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,iBAAiB,QACX,YAAY;AACnB,OAAOC,KAAK,MAAM,UAAU;AAC5B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,MAAM;EAAEC;AAAY,CAAC,GAAGD,MAAM,CAAEZ,iBAAkB,CAAC;AAEnD,MAAMc,WAAW,GAAG,EAAE;AACtB,MAAMC,wBAAwB,G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,cAAgB;IACjCC,MAAM,EAAGA,MAAQ;IACjBuC,OAAO,EAAGA,OAAS;IACnBK,IAAI,EAAGnD,KAAK,IAAIjC,WAAa;IAC7BqF,SAAS,EAAGlD,cAAgB;IAC5BvB,IAAI,EAAGA,IAAM;IACboE,YAAY,EAAGA;EAAc,CAC7B,CACI,CAAC;AAET"}
|
|
@@ -25,6 +25,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
25
25
|
import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
|
|
26
26
|
import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
|
|
27
27
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
28
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
28
29
|
const {
|
|
29
30
|
useLocation
|
|
30
31
|
} = unlock(routerPrivateApis);
|
|
@@ -47,7 +48,8 @@ function SidebarScreens() {
|
|
|
47
48
|
}, createElement(SidebarNavigationScreen, {
|
|
48
49
|
title: __('All Pages'),
|
|
49
50
|
description: __('Manage your pages.'),
|
|
50
|
-
backPath: "/page"
|
|
51
|
+
backPath: "/page",
|
|
52
|
+
content: createElement(DataViewsSidebarContent, null)
|
|
51
53
|
})), createElement(NavigatorScreen, {
|
|
52
54
|
path: "/:postType(wp_template)"
|
|
53
55
|
}, createElement(SidebarNavigationScreenTemplates, null)), createElement(NavigatorScreen, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useRef","__","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","SidebarNavigationScreen","useLocation","SidebarScreens","createElement","Fragment","path","window","__experimentalAdminViews","title","description","backPath","Sidebar","params","urlParams","initialPath","className","current"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</NavigatorScreen>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<NavigatorScreen path=\"/pages\">\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ __( 'All Pages' ) }\n\t\t\t\t\t\tdescription={ __( 'Manage your pages.' ) }\n\t\t\t\t\t\tbackPath=\"/page\"\n\t\t\t\t\t/>\n\t\t\t\t</NavigatorScreen>\n\t\t\t) }\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/patterns\">\n\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,8BAA8B,MAAM,sCAAsC;AACjF,OAAOC,kBAAkB,IACxBC,cAAc,QACR,+CAA+C;AACtD,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,qCAAqC,MAAM,8CAA8C;AAChG,OAAOC,mCAAmC,MAAM,4CAA4C;AAC5F,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,OAAO,MAAM,aAAa;AACjC,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,4BAA4B,MAAM,oCAAoC;AAC7E,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,uBAAuB,MAAM,8BAA8B;
|
|
1
|
+
{"version":3,"names":["memo","useRef","__","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","SidebarNavigationScreen","DataViewsSidebarContent","useLocation","SidebarScreens","createElement","Fragment","path","window","__experimentalAdminViews","title","description","backPath","content","Sidebar","params","urlParams","initialPath","className","current"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</NavigatorScreen>\n\t\t\t{ window?.__experimentalAdminViews && (\n\t\t\t\t<NavigatorScreen path=\"/pages\">\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ __( 'All Pages' ) }\n\t\t\t\t\t\tdescription={ __( 'Manage your pages.' ) }\n\t\t\t\t\t\tbackPath=\"/page\"\n\t\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\t/>\n\t\t\t\t</NavigatorScreen>\n\t\t\t) }\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/patterns\">\n\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,QAC1C,uBAAuB;AAC9B,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,+BAA+B,MAAM,uCAAuC;AACnF,OAAOC,8BAA8B,MAAM,sCAAsC;AACjF,OAAOC,kBAAkB,IACxBC,cAAc,QACR,+CAA+C;AACtD,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,qCAAqC,MAAM,8CAA8C;AAChG,OAAOC,mCAAmC,MAAM,4CAA4C;AAC5F,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,OAAO,MAAM,aAAa;AACjC,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,4BAA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AAyB,GAC9CF,aAAA,CAAClB,gCAAgC,MAAE,CACnB,CAAC,EAClBkB,aAAA,CAACtB,eAAe;IAACwB,IAAI,EAAC;EAAW,GAChCF,aAAA,CAAChB,+BAA+B,MAAE,CAClB,CAAC,EAClBgB,aAAA,CAACtB,eAAe;IAACwB,IAAI,EAAC;EAA8C,GACnEF,aAAA,CAACT,sCAAsC,MAAE,CACzB,CAAC,EAClBS,aAAA,CAACtB,eAAe;IAACwB,IAAI,EAAC;EAA+C,GACpEF,aAAA,CAACf,8BAA8B,MAAE,CACjB,CAAC,EAClBe,aAAA,CAACtB,eAAe;IAACwB,IAAI,EAAC;EAAiC,GACtDF,aAAA,CAACjB,+BAA+B,MAAE,CAClB,CAChB,CAAC;AAEL;AAEA,SAAS0B,OAAOA,CAAA,EAAG;EAClB,MAAM;IAAEC,MAAM,EAAEC;EAAU,CAAC,GAAGb,WAAW,CAAC,CAAC;EAC3C,MAAMc,WAAW,GAAGvC,MAAM,CAAEc,cAAc,CAAEwB,SAAU,CAAE,CAAC;EAEzD,OACCX,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACxB,iBAAiB;IACjBqC,SAAS,EAAC,4BAA4B;IACtCD,WAAW,EAAGA,WAAW,CAACE;EAAS,GAEnCd,aAAA,CAACD,cAAc,MAAE,CACC,CAAC,EACpBC,aAAA,CAACR,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEqC,OAAQ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
6
|
+
import { page, columns } from '@wordpress/icons';
|
|
7
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { useLink } from '../routes/link';
|
|
13
|
+
import { default as DEFAULT_VIEWS } from '../page-pages/default-views';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
const {
|
|
16
|
+
useLocation
|
|
17
|
+
} = unlock(routerPrivateApis);
|
|
18
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
function getDataViewIcon(dataview) {
|
|
20
|
+
const icons = {
|
|
21
|
+
list: page,
|
|
22
|
+
grid: columns
|
|
23
|
+
};
|
|
24
|
+
return icons[dataview.view.type];
|
|
25
|
+
}
|
|
26
|
+
function DataViewItem({
|
|
27
|
+
dataview,
|
|
28
|
+
isActive
|
|
29
|
+
}) {
|
|
30
|
+
const {
|
|
31
|
+
params: {
|
|
32
|
+
path
|
|
33
|
+
}
|
|
34
|
+
} = useLocation();
|
|
35
|
+
const icon = getDataViewIcon(dataview);
|
|
36
|
+
const linkInfo = useLink({
|
|
37
|
+
path,
|
|
38
|
+
activeView: dataview.slug
|
|
39
|
+
});
|
|
40
|
+
return createElement(SidebarNavigationItem, {
|
|
41
|
+
icon: icon,
|
|
42
|
+
...linkInfo,
|
|
43
|
+
"aria-current": isActive ? 'true' : undefined
|
|
44
|
+
}, dataview.title);
|
|
45
|
+
}
|
|
46
|
+
export default function DataViewsSidebarContent() {
|
|
47
|
+
const {
|
|
48
|
+
params: {
|
|
49
|
+
path,
|
|
50
|
+
activeView = 'all'
|
|
51
|
+
}
|
|
52
|
+
} = useLocation();
|
|
53
|
+
if (!path || path !== '/pages') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return createElement(ItemGroup, null, DEFAULT_VIEWS.map(dataview => {
|
|
57
|
+
return createElement(DataViewItem, {
|
|
58
|
+
key: dataview.slug,
|
|
59
|
+
dataview: dataview,
|
|
60
|
+
isActive: dataview.slug === activeView
|
|
61
|
+
});
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalItemGroup","ItemGroup","page","columns","privateApis","routerPrivateApis","useLink","default","DEFAULT_VIEWS","unlock","useLocation","SidebarNavigationItem","getDataViewIcon","dataview","icons","list","grid","view","type","DataViewItem","isActive","params","path","icon","linkInfo","activeView","slug","createElement","undefined","title","DataViewsSidebarContent","map","key"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { page, columns } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport { default as DEFAULT_VIEWS } from '../page-pages/default-views';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nfunction getDataViewIcon( dataview ) {\n\tconst icons = { list: page, grid: columns };\n\treturn icons[ dataview.view.type ];\n}\n\nfunction DataViewItem( { dataview, isActive } ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\n\tconst icon = getDataViewIcon( dataview );\n\n\tconst linkInfo = useLink( {\n\t\tpath,\n\t\tactiveView: dataview.slug,\n\t} );\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\ticon={ icon }\n\t\t\t{ ...linkInfo }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ dataview.title }\n\t\t</SidebarNavigationItem>\n\t);\n}\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { path, activeView = 'all' },\n\t} = useLocation();\n\tif ( ! path || path !== '/pages' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ DEFAULT_VIEWS.map( ( dataview ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\tdataview={ dataview }\n\t\t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;IACLT,MAAM,EAAE;MAAEC,IAAI;MAAEG,UAAU,GAAG;IAAM;EACpC,CAAC,GAAGf,WAAW,CAAC,CAAC;EACjB,IAAK,CAAEY,IAAI,IAAIA,IAAI,KAAK,QAAQ,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,OACCK,aAAA,CAAC1B,SAAS,QACPO,aAAa,CAACuB,GAAG,CAAIlB,QAAQ,IAAM;IACpC,OACCc,aAAA,CAACR,YAAY;MACZa,GAAG,EAAGnB,QAAQ,CAACa,IAAM;MACrBb,QAAQ,EAAGA,QAAU;MACrBO,QAAQ,EAAGP,QAAQ,CAACa,IAAI,KAAKD;IAAY,CACzC,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import { trash, rotateLeft, rotateRight, layout, page, drawerLeft, drawerRight, blockDefault, code, keyboard, listView, symbol } from '@wordpress/icons';
|
|
6
|
+
import { edit, trash, rotateLeft, rotateRight, layout, page, drawerLeft, drawerRight, blockDefault, code, keyboard, listView, symbol } from '@wordpress/icons';
|
|
7
7
|
import { useCommandLoader } from '@wordpress/commands';
|
|
8
8
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
9
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
@@ -361,7 +361,7 @@ function usePatternCommands() {
|
|
|
361
361
|
commands.push({
|
|
362
362
|
name: 'core/rename-pattern',
|
|
363
363
|
label: __('Rename pattern'),
|
|
364
|
-
icon:
|
|
364
|
+
icon: edit,
|
|
365
365
|
callback: ({
|
|
366
366
|
close
|
|
367
367
|
}) => {
|
|
@@ -403,7 +403,8 @@ export function useEditModeCommands() {
|
|
|
403
403
|
});
|
|
404
404
|
useCommandLoader({
|
|
405
405
|
name: 'core/edit-site/patterns',
|
|
406
|
-
hook: usePatternCommands
|
|
406
|
+
hook: usePatternCommands,
|
|
407
|
+
context: 'site-editor-edit'
|
|
407
408
|
});
|
|
408
409
|
useCommandLoader({
|
|
409
410
|
name: 'core/edit-site/edit-ui',
|