@wordpress/edit-site 5.21.1-next.f8d8eceb.0 → 5.23.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 +4 -0
- package/build/components/actions/index.js +86 -4
- package/build/components/actions/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +0 -7
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +54 -63
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews/add-filter.js +90 -0
- package/build/components/dataviews/add-filter.js.map +1 -0
- package/build/components/dataviews/dataviews.js +23 -4
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +36 -32
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/in-filter.js +22 -20
- package/build/components/dataviews/in-filter.js.map +1 -1
- package/build/components/dataviews/index.js +9 -2
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews/item-actions.js +81 -13
- package/build/components/dataviews/item-actions.js.map +1 -1
- package/build/components/dataviews/pagination.js +3 -2
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/reset-filters.js +33 -0
- package/build/components/dataviews/reset-filters.js.map +1 -0
- package/build/components/dataviews/search.js +1 -0
- package/build/components/dataviews/search.js.map +1 -1
- package/build/components/dataviews/view-actions.js +27 -10
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-list.js +126 -5
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/dataviews/view-side-by-side.js +20 -0
- package/build/components/dataviews/view-side-by-side.js.map +1 -0
- package/build/components/editor/index.js +53 -53
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +42 -21
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -3
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -1
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +160 -0
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build/components/header-edit-mode/index.js +48 -116
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build/components/layout/index.js +4 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +1 -0
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js +5 -10
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +2 -1
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +133 -78
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-pages/side-editor.js +25 -0
- package/build/components/page-pages/side-editor.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +2 -2
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +27 -9
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/dataviews-templates.js +201 -0
- package/build/components/page-templates/dataviews-templates.js.map +1 -0
- package/build/components/page-templates/template-actions.js +168 -0
- package/build/components/page-templates/template-actions.js.map +1 -0
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +124 -0
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +189 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +71 -0
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build/components/sidebar-dataviews/default-views.js +60 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build/components/sidebar-dataviews/index.js +22 -37
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -11
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +4 -12
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +4 -12
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +3 -3
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +4 -12
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +18 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +12 -16
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -49
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +1 -1
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +6 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +0 -3
- package/build/index.js.map +1 -1
- package/build/store/actions.js +35 -82
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -63
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +3 -3
- package/build/utils/constants.js.map +1 -1
- package/build/utils/use-activate-theme.js +8 -0
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/actions/index.js +85 -5
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +0 -7
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +54 -62
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews/add-filter.js +83 -0
- package/build-module/components/dataviews/add-filter.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +22 -4
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +34 -32
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/in-filter.js +20 -19
- package/build-module/components/dataviews/in-filter.js.map +1 -1
- package/build-module/components/dataviews/index.js +1 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +84 -16
- package/build-module/components/dataviews/item-actions.js.map +1 -1
- package/build-module/components/dataviews/pagination.js +3 -2
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/reset-filters.js +26 -0
- package/build-module/components/dataviews/reset-filters.js.map +1 -0
- package/build-module/components/dataviews/search.js +1 -0
- package/build-module/components/dataviews/search.js.map +1 -1
- package/build-module/components/dataviews/view-actions.js +28 -11
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +128 -7
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/dataviews/view-side-by-side.js +12 -0
- package/build-module/components/dataviews/view-side-by-side.js.map +1 -0
- package/build-module/components/editor/index.js +57 -57
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +42 -21
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/ui.js +3 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +152 -0
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +52 -120
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build-module/components/layout/index.js +5 -20
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +1 -1
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +5 -10
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +2 -1
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +137 -80
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-pages/side-editor.js +17 -0
- package/build-module/components/page-pages/side-editor.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +2 -2
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +4 -4
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +25 -9
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +2 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +193 -0
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -0
- package/build-module/components/page-templates/template-actions.js +157 -0
- package/build-module/components/page-templates/template-actions.js.map +1 -0
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +116 -0
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +180 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +63 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build-module/components/sidebar-dataviews/default-views.js +52 -0
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build-module/components/sidebar-dataviews/index.js +23 -38
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +12 -12
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +5 -13
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +5 -13
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +4 -4
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +4 -12
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +19 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +13 -16
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -50
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +6 -2
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +0 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +33 -79
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +19 -58
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +1 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +8 -0
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +69 -119
- package/build-style/style.css +69 -119
- package/package.json +41 -41
- package/src/components/actions/index.js +113 -5
- package/src/components/add-new-template/new-template.js +0 -5
- package/src/components/block-editor/style.scss +0 -87
- package/src/components/block-editor/use-site-editor-settings.js +68 -89
- package/src/components/dataviews/README.md +77 -83
- package/src/components/dataviews/add-filter.js +111 -0
- package/src/components/dataviews/dataviews.js +20 -2
- package/src/components/dataviews/filters.js +56 -49
- package/src/components/dataviews/in-filter.js +35 -17
- package/src/components/dataviews/index.js +1 -1
- package/src/components/dataviews/item-actions.js +95 -20
- package/src/components/dataviews/pagination.js +5 -4
- package/src/components/dataviews/reset-filters.js +26 -0
- package/src/components/dataviews/search.js +1 -0
- package/src/components/dataviews/style.scss +5 -1
- package/src/components/dataviews/view-actions.js +39 -9
- package/src/components/dataviews/view-list.js +174 -3
- package/src/components/dataviews/view-side-by-side.js +9 -0
- package/src/components/editor/index.js +149 -121
- package/src/components/global-styles/screen-revisions/index.js +52 -25
- package/src/components/global-styles/screen-root.js +2 -1
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-renderer/index.js +1 -1
- package/src/components/header-edit-mode/document-tools/index.js +201 -0
- package/src/components/header-edit-mode/index.js +86 -184
- package/src/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/src/components/header-edit-mode/style.scss +35 -2
- package/src/components/layout/index.js +4 -11
- package/src/components/layout/style.scss +6 -18
- package/src/components/list/added-by.js +1 -1
- package/src/components/page-content-focus-manager/back-to-page-notification.js +4 -15
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +38 -33
- package/src/components/page-main/index.js +6 -1
- package/src/components/page-pages/index.js +162 -81
- package/src/components/page-pages/side-editor.js +14 -0
- package/src/components/page-patterns/grid-item.js +3 -3
- package/src/components/page-patterns/patterns-list.js +10 -4
- package/src/components/page-patterns/rename-category-menu-item.js +29 -12
- package/src/components/page-patterns/use-patterns.js +3 -2
- package/src/components/page-templates/dataviews-templates.js +224 -0
- package/src/components/page-templates/template-actions.js +209 -0
- package/src/components/save-button/index.js +10 -5
- package/src/components/sidebar/index.js +1 -2
- package/src/components/sidebar-dataviews/add-new-view.js +141 -0
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +227 -0
- package/src/components/sidebar-dataviews/dataview-item.js +67 -0
- package/src/components/sidebar-dataviews/default-views.js +54 -0
- package/src/components/sidebar-dataviews/index.js +36 -44
- package/src/components/sidebar-dataviews/style.scss +22 -0
- package/src/components/sidebar-edit-mode/default-sidebar.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +14 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +3 -0
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +10 -9
- package/src/components/sidebar-edit-mode/page-panels/style.scss +5 -0
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +10 -9
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +11 -7
- package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/src/components/sidebar-navigation-screen-page/page-details.js +7 -18
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/src/components/site-hub/index.js +9 -8
- package/src/components/start-template-options/index.js +14 -12
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +117 -50
- package/src/components/template-part-converter/convert-to-regular.js +1 -1
- package/src/hooks/push-changes-to-global-styles/index.js +13 -6
- package/src/hooks/template-part-edit.js +4 -2
- package/src/index.js +0 -8
- package/src/store/actions.js +37 -95
- package/src/store/selectors.js +31 -91
- package/src/store/test/actions.js +11 -137
- package/src/store/test/selectors.js +0 -82
- package/src/style.scss +1 -0
- package/src/utils/constants.js +1 -1
- package/src/utils/use-activate-theme.js +5 -0
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -77
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/index.js +0 -31
- package/build/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -110
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -84
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build/components/block-editor/index.js +0 -30
- package/build/components/block-editor/index.js.map +0 -1
- package/build/components/dataviews/context.js +0 -15
- package/build/components/dataviews/context.js.map +0 -1
- package/build/components/page-pages/default-views.js +0 -60
- package/build/components/page-pages/default-views.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -69
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/index.js +0 -23
- package/build-module/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -102
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -78
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build-module/components/block-editor/index.js +0 -22
- package/build-module/components/block-editor/index.js.map +0 -1
- package/build-module/components/dataviews/context.js +0 -7
- package/build-module/components/dataviews/context.js.map +0 -1
- package/build-module/components/page-pages/default-views.js +0 -53
- package/build-module/components/page-pages/default-views.js.map +0 -1
- package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -75
- package/src/components/block-editor/block-editor-provider/index.js +0 -29
- package/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -114
- package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +0 -116
- package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -90
- package/src/components/block-editor/index.js +0 -28
- package/src/components/dataviews/context.js +0 -7
- package/src/components/page-pages/default-views.js +0 -58
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { backup, trash } from '@wordpress/icons';
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
+
import { Button, TextControl, __experimentalText as Text, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { store as editSiteStore } from '../../store';
|
|
18
|
+
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
19
|
+
import isTemplateRemovable from '../../utils/is-template-removable';
|
|
20
|
+
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
21
|
+
export function useResetTemplateAction() {
|
|
22
|
+
const {
|
|
23
|
+
revertTemplate
|
|
24
|
+
} = useDispatch(editSiteStore);
|
|
25
|
+
const {
|
|
26
|
+
saveEditedEntityRecord
|
|
27
|
+
} = useDispatch(coreStore);
|
|
28
|
+
const {
|
|
29
|
+
createSuccessNotice,
|
|
30
|
+
createErrorNotice
|
|
31
|
+
} = useDispatch(noticesStore);
|
|
32
|
+
return useMemo(() => ({
|
|
33
|
+
id: 'reset-template',
|
|
34
|
+
label: __('Reset template'),
|
|
35
|
+
isPrimary: true,
|
|
36
|
+
icon: backup,
|
|
37
|
+
isEligible: isTemplateRevertable,
|
|
38
|
+
async callback(template) {
|
|
39
|
+
try {
|
|
40
|
+
await revertTemplate(template, {
|
|
41
|
+
allowUndo: false
|
|
42
|
+
});
|
|
43
|
+
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
44
|
+
createSuccessNotice(sprintf( /* translators: The template/part's name. */
|
|
45
|
+
__('"%s" reverted.'), decodeEntities(template.title.rendered)), {
|
|
46
|
+
type: 'snackbar',
|
|
47
|
+
id: 'edit-site-template-reverted'
|
|
48
|
+
});
|
|
49
|
+
} catch (error) {
|
|
50
|
+
const fallbackErrorMessage = template.type === TEMPLATE_POST_TYPE ? __('An error occurred while reverting the template.') : __('An error occurred while reverting the template part.');
|
|
51
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
|
|
52
|
+
createErrorNotice(errorMessage, {
|
|
53
|
+
type: 'snackbar'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}), [createErrorNotice, createSuccessNotice, revertTemplate, saveEditedEntityRecord]);
|
|
58
|
+
}
|
|
59
|
+
export const deleteTemplateAction = {
|
|
60
|
+
id: 'delete-template',
|
|
61
|
+
label: __('Delete template'),
|
|
62
|
+
isPrimary: true,
|
|
63
|
+
icon: trash,
|
|
64
|
+
isEligible: isTemplateRemovable,
|
|
65
|
+
hideModalHeader: true,
|
|
66
|
+
RenderModal: ({
|
|
67
|
+
item: template,
|
|
68
|
+
closeModal
|
|
69
|
+
}) => {
|
|
70
|
+
const {
|
|
71
|
+
removeTemplate
|
|
72
|
+
} = useDispatch(editSiteStore);
|
|
73
|
+
return createElement(VStack, {
|
|
74
|
+
spacing: "5"
|
|
75
|
+
}, createElement(Text, null, sprintf(
|
|
76
|
+
// translators: %s: The template or template part's title.
|
|
77
|
+
__('Are you sure you want to delete "%s"?'), decodeEntities(template.title.rendered))), createElement(HStack, {
|
|
78
|
+
justify: "right"
|
|
79
|
+
}, createElement(Button, {
|
|
80
|
+
variant: "tertiary",
|
|
81
|
+
onClick: closeModal
|
|
82
|
+
}, __('Cancel')), createElement(Button, {
|
|
83
|
+
variant: "primary",
|
|
84
|
+
onClick: () => removeTemplate(template, {
|
|
85
|
+
allowUndo: false
|
|
86
|
+
})
|
|
87
|
+
}, __('Delete'))));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
export const renameTemplateAction = {
|
|
91
|
+
id: 'rename-template',
|
|
92
|
+
label: __('Rename'),
|
|
93
|
+
isEligible: template => isTemplateRemovable(template) && template.is_custom,
|
|
94
|
+
RenderModal: ({
|
|
95
|
+
item: template,
|
|
96
|
+
closeModal
|
|
97
|
+
}) => {
|
|
98
|
+
const title = decodeEntities(template.title.rendered);
|
|
99
|
+
const [editedTitle, setEditedTitle] = useState(title);
|
|
100
|
+
const {
|
|
101
|
+
editEntityRecord,
|
|
102
|
+
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
|
|
103
|
+
} = useDispatch(coreStore);
|
|
104
|
+
const {
|
|
105
|
+
createSuccessNotice,
|
|
106
|
+
createErrorNotice
|
|
107
|
+
} = useDispatch(noticesStore);
|
|
108
|
+
async function onTemplateRename(event) {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
try {
|
|
111
|
+
await editEntityRecord('postType', template.type, template.id, {
|
|
112
|
+
title: editedTitle
|
|
113
|
+
});
|
|
114
|
+
// Update state before saving rerenders the list.
|
|
115
|
+
setEditedTitle('');
|
|
116
|
+
closeModal();
|
|
117
|
+
// Persist edited entity.
|
|
118
|
+
await saveSpecifiedEntityEdits('postType', template.type, template.id, ['title'],
|
|
119
|
+
// Only save title to avoid persisting other edits.
|
|
120
|
+
{
|
|
121
|
+
throwOnError: true
|
|
122
|
+
});
|
|
123
|
+
// TODO: this action will be reused in template parts list, so
|
|
124
|
+
// let's keep this for a bit, even it's always a `template` now.
|
|
125
|
+
createSuccessNotice(template.type === TEMPLATE_POST_TYPE ? __('Template renamed.') : __('Template part renamed.'), {
|
|
126
|
+
type: 'snackbar'
|
|
127
|
+
});
|
|
128
|
+
} catch (error) {
|
|
129
|
+
const fallbackErrorMessage = template.type === TEMPLATE_POST_TYPE ? __('An error occurred while renaming the template.') : __('An error occurred while renaming the template part.');
|
|
130
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
|
|
131
|
+
createErrorNotice(errorMessage, {
|
|
132
|
+
type: 'snackbar'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return createElement("form", {
|
|
137
|
+
onSubmit: onTemplateRename
|
|
138
|
+
}, createElement(VStack, {
|
|
139
|
+
spacing: "5"
|
|
140
|
+
}, createElement(TextControl, {
|
|
141
|
+
__nextHasNoMarginBottom: true,
|
|
142
|
+
label: __('Name'),
|
|
143
|
+
value: editedTitle,
|
|
144
|
+
onChange: setEditedTitle,
|
|
145
|
+
required: true
|
|
146
|
+
}), createElement(HStack, {
|
|
147
|
+
justify: "right"
|
|
148
|
+
}, createElement(Button, {
|
|
149
|
+
variant: "tertiary",
|
|
150
|
+
onClick: closeModal
|
|
151
|
+
}, __('Cancel')), createElement(Button, {
|
|
152
|
+
variant: "primary",
|
|
153
|
+
type: "submit"
|
|
154
|
+
}, __('Save')))));
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=template-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["backup","trash","__","sprintf","useDispatch","useMemo","useState","store","coreStore","noticesStore","decodeEntities","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","editSiteStore","isTemplateRevertable","isTemplateRemovable","TEMPLATE_POST_TYPE","useResetTemplateAction","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","id","label","isPrimary","icon","isEligible","callback","template","allowUndo","type","title","rendered","error","fallbackErrorMessage","errorMessage","message","code","deleteTemplateAction","hideModalHeader","RenderModal","item","closeModal","removeTemplate","createElement","spacing","justify","variant","onClick","renameTemplateAction","is_custom","editedTitle","setEditedTitle","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","onTemplateRename","event","preventDefault","throwOnError","onSubmit","__nextHasNoMarginBottom","value","onChange","required"],"sources":["@wordpress/edit-site/src/components/page-templates/template-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { backup, trash } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nexport function useResetTemplateAction() {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'reset-template',\n\t\t\tlabel: __( 'Reset template' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tisEligible: isTemplateRevertable,\n\t\t\tasync callback( template ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\ttemplate.id\n\t\t\t\t\t);\n\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t__( '\"%s\" reverted.' ),\n\t\t\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst fallbackErrorMessage =\n\t\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t );\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: fallbackErrorMessage;\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateErrorNotice,\n\t\t\tcreateSuccessNotice,\n\t\t\trevertTemplate,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const deleteTemplateAction = {\n\tid: 'delete-template',\n\tlabel: __( 'Delete template' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible: isTemplateRemovable,\n\thideModalHeader: true,\n\tRenderModal: ( { item: template, closeModal } ) => {\n\t\tconst { removeTemplate } = useDispatch( editSiteStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: The template or template part's title.\n\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tremoveTemplate( template, {\n\t\t\t\t\t\t\t\tallowUndo: false,\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\t{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nexport const renameTemplateAction = {\n\tid: 'rename-template',\n\tlabel: __( 'Rename' ),\n\tisEligible: ( template ) =>\n\t\tisTemplateRemovable( template ) && template.is_custom,\n\tRenderModal: ( { item: template, closeModal } ) => {\n\t\tconst title = decodeEntities( template.title.rendered );\n\t\tconst [ editedTitle, setEditedTitle ] = useState( title );\n\t\tconst {\n\t\t\teditEntityRecord,\n\t\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t\t} = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tasync function onTemplateRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: editedTitle,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetEditedTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id,\n\t\t\t\t\t[ 'title' ], // Only save title to avoid persisting other edits.\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// TODO: this action will be reused in template parts list, so\n\t\t\t\t// let's keep this for a bit, even it's always a `template` now.\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'Template renamed.' )\n\t\t\t\t\t\t: __( 'Template part renamed.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tconst fallbackErrorMessage =\n\t\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t\t? __( 'An error occurred while renaming the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while renaming the template part.'\n\t\t\t\t\t\t );\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ onTemplateRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ editedTitle }\n\t\t\t\t\t\tonChange={ setEditedTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,KAAK,QAAQ,kBAAkB;AAChD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACCC,MAAM,EACNC,WAAW,EACXC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,SAASX,KAAK,IAAIY,aAAa,QAAQ,aAAa;AACpD,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEC;EAAe,CAAC,GAAGpB,WAAW,CAAEe,aAAc,CAAC;EACvD,MAAM;IAAEM;EAAuB,CAAC,GAAGrB,WAAW,CAAEI,SAAU,CAAC;EAC3D,MAAM;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xD;IACD;IACA,OACCc,aAAA;MAAMgB,QAAQ,EAAGJ;IAAkB,GAClCZ,aAAA,CAAChC,MAAM;MAACiC,OAAO,EAAC;IAAG,GAClBD,aAAA,CAACtC,WAAW;MACXuD,uBAAuB;MACvBtC,KAAK,EAAG3B,EAAE,CAAE,MAAO,CAAG;MACtBkE,KAAK,EAAGX,WAAa;MACrBY,QAAQ,EAAGX,cAAgB;MAC3BY,QAAQ;IAAA,CACR,CAAC,EACFpB,aAAA,CAAClC,MAAM;MAACoC,OAAO,EAAC;IAAO,GACtBF,aAAA,CAACvC,MAAM;MAAC0C,OAAO,EAAC,UAAU;MAACC,OAAO,EAAGN;IAAY,GAC9C9C,EAAE,CAAE,QAAS,CACR,CAAC,EACTgD,aAAA,CAACvC,MAAM;MAAC0C,OAAO,EAAC,SAAS;MAACjB,IAAI,EAAC;IAAQ,GACpClC,EAAE,CAAE,MAAO,CACN,CACD,CACD,CACH,CAAC;EAET;AACD,CAAC"}
|
|
@@ -28,15 +28,17 @@ export default function SaveButton({
|
|
|
28
28
|
} = useSelect(select => {
|
|
29
29
|
const {
|
|
30
30
|
__experimentalGetDirtyEntityRecords,
|
|
31
|
-
isSavingEntityRecord
|
|
31
|
+
isSavingEntityRecord,
|
|
32
|
+
isResolving
|
|
32
33
|
} = select(coreStore);
|
|
33
34
|
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
34
35
|
const {
|
|
35
36
|
isSaveViewOpened
|
|
36
37
|
} = select(editSiteStore);
|
|
38
|
+
const isActivatingTheme = isResolving('activateTheme');
|
|
37
39
|
return {
|
|
38
40
|
isDirty: dirtyEntityRecords.length > 0,
|
|
39
|
-
isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)),
|
|
41
|
+
isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme,
|
|
40
42
|
isSaveViewOpen: isSaveViewOpened()
|
|
41
43
|
};
|
|
42
44
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","Button","__","store","coreStore","displayShortcut","editSiteStore","isPreviewingTheme","SaveButton","className","variant","showTooltip","defaultLabel","icon","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","isSaveViewOpened","length","some","record","kind","name","key","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","createElement","isBusy","onClick","undefined","shortcut","primary"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {\n\t\tconst {
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","__","store","coreStore","displayShortcut","editSiteStore","isPreviewingTheme","SaveButton","className","variant","showTooltip","defaultLabel","icon","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isSaveViewOpened","isActivatingTheme","length","some","record","kind","name","key","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","createElement","isBusy","onClick","undefined","shortcut","primary"],"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t\tisResolving,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving:\n\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t) || isActivatingTheme,\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn __( 'Activating' );\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( isDirty ) {\n\t\t\t\treturn __( 'Activate & Save' );\n\t\t\t}\n\t\t\treturn __( 'Activate' );\n\t\t}\n\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t} else if ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t} else if ( defaultLabel ) {\n\t\t\treturn defaultLabel;\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AACpD,SAASC,iBAAiB,QAAQ,iCAAiC;AAEnE,eAAe,SAASC,UAAUA,CAAE;EACnCC,SAAS,GAAG,+BAA+B;EAC3CC,OAAO,GAAG,SAAS;EACnBC,WAAW,GAAG,IAAI;EAClBC,YAAY;EACZC,IAAI;EACJC,qBAAqB,GAAG;AACzB,CAAC,EAAG;EACH,MAAM;IAAEC,O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,EAAE,CAAE,QAAS,CAAC;IACtB,CAAC,MAAM,IAAK+B,QAAQ,EAAG;MACtB,OAAO/B,EAAE,CAAE,OAAQ,CAAC;IACrB,CAAC,MAAM,IAAKU,YAAY,EAAG;MAC1B,OAAOA,YAAY;IACpB;IACA,OAAOV,EAAE,CAAE,MAAO,CAAC;EACpB,CAAC;EACD,MAAMiC,KAAK,GAAGD,QAAQ,CAAC,CAAC;EAExB,OACCE,aAAA,CAACnC,MAAM;IACNS,OAAO,EAAGA,OAAS;IACnBD,SAAS,EAAGA,SAAW;IACvB,iBAAgBwB,QAAU;IAC1B,iBAAgBhB,cAAgB;IAChCoB,MAAM,EAAGrB,QAAU;IACnBsB,OAAO,EAAGL,QAAQ,GAAGM,SAAS,GAAG,MAAMR,mBAAmB,CAAE,IAAK,CAAG;IACpEI,KAAK,EAAGA;IACR;AACH;AACA;AACA,OAHG;IAIAK,QAAQ,EAAGP,QAAQ,GAAGM,SAAS,GAAGlC,eAAe,CAACoC,OAAO,CAAE,GAAI;IAC/D;AACH;AACA;AACA;AACA;AACA,OALG;IAMA9B,WAAW,EAAGA,WAAa;IAC3BE,IAAI,EAAGA,IAAM;IACbC,qBAAqB,EAAGA;EAAuB,GAE7CqB,KACK,CAAC;AAEX"}
|
|
@@ -46,8 +46,7 @@ function SidebarScreens() {
|
|
|
46
46
|
}, createElement(SidebarNavigationScreenPage, null)), window?.__experimentalAdminViews && createElement(NavigatorScreen, {
|
|
47
47
|
path: "/pages"
|
|
48
48
|
}, createElement(SidebarNavigationScreen, {
|
|
49
|
-
title: __('
|
|
50
|
-
description: __('Manage your pages.'),
|
|
49
|
+
title: __('Pages'),
|
|
51
50
|
backPath: "/page",
|
|
52
51
|
content: createElement(DataViewsSidebarContent, null)
|
|
53
52
|
})), 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","DataViewsSidebarContent","useLocation","SidebarScreens","createElement","Fragment","path","window","__experimentalAdminViews","title","
|
|
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","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={ __( '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;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,CAAC,EACpBC,aAAA,CAACR,OAAO,MAAE,CACT,CAAC;AAEL;AAEA,eAAepB,IAAI,CAAEoC,OAAQ,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { Modal, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack, Button } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch, resolveSelect } from '@wordpress/data';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
import { plus } from '@wordpress/icons';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
17
|
+
import DEFAULT_VIEWS from './default-views';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
const {
|
|
20
|
+
useHistory,
|
|
21
|
+
useLocation
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
function AddNewItemModalContent({
|
|
24
|
+
type,
|
|
25
|
+
setIsAdding
|
|
26
|
+
}) {
|
|
27
|
+
const {
|
|
28
|
+
params: {
|
|
29
|
+
path
|
|
30
|
+
}
|
|
31
|
+
} = useLocation();
|
|
32
|
+
const history = useHistory();
|
|
33
|
+
const {
|
|
34
|
+
saveEntityRecord
|
|
35
|
+
} = useDispatch(coreStore);
|
|
36
|
+
const [title, setTitle] = useState('');
|
|
37
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
38
|
+
return createElement("form", {
|
|
39
|
+
onSubmit: async event => {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setIsSaving(true);
|
|
42
|
+
const {
|
|
43
|
+
getEntityRecords
|
|
44
|
+
} = resolveSelect(coreStore);
|
|
45
|
+
let dataViewTaxonomyId;
|
|
46
|
+
const dataViewTypeRecords = await getEntityRecords('taxonomy', 'wp_dataviews_type', {
|
|
47
|
+
slug: type
|
|
48
|
+
});
|
|
49
|
+
if (dataViewTypeRecords && dataViewTypeRecords.length > 0) {
|
|
50
|
+
dataViewTaxonomyId = dataViewTypeRecords[0].id;
|
|
51
|
+
} else {
|
|
52
|
+
const record = await saveEntityRecord('taxonomy', 'wp_dataviews_type', {
|
|
53
|
+
name: type
|
|
54
|
+
});
|
|
55
|
+
if (record && record.id) {
|
|
56
|
+
dataViewTaxonomyId = record.id;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const savedRecord = await saveEntityRecord('postType', 'wp_dataviews', {
|
|
60
|
+
title,
|
|
61
|
+
status: 'publish',
|
|
62
|
+
wp_dataviews_type: dataViewTaxonomyId,
|
|
63
|
+
content: JSON.stringify(DEFAULT_VIEWS[type][0].view)
|
|
64
|
+
});
|
|
65
|
+
history.push({
|
|
66
|
+
path,
|
|
67
|
+
activeView: savedRecord.id,
|
|
68
|
+
isCustom: 'true'
|
|
69
|
+
});
|
|
70
|
+
setIsSaving(false);
|
|
71
|
+
setIsAdding(false);
|
|
72
|
+
}
|
|
73
|
+
}, createElement(VStack, {
|
|
74
|
+
spacing: "5"
|
|
75
|
+
}, createElement(TextControl, {
|
|
76
|
+
__nextHasNoMarginBottom: true,
|
|
77
|
+
label: __('Name'),
|
|
78
|
+
value: title,
|
|
79
|
+
onChange: setTitle,
|
|
80
|
+
placeholder: __('My view'),
|
|
81
|
+
className: "patterns-create-modal__name-input"
|
|
82
|
+
}), createElement(HStack, {
|
|
83
|
+
justify: "right"
|
|
84
|
+
}, createElement(Button, {
|
|
85
|
+
variant: "tertiary",
|
|
86
|
+
onClick: () => {
|
|
87
|
+
setIsAdding(false);
|
|
88
|
+
}
|
|
89
|
+
}, __('Cancel')), createElement(Button, {
|
|
90
|
+
variant: "primary",
|
|
91
|
+
type: "submit",
|
|
92
|
+
"aria-disabled": !title || isSaving,
|
|
93
|
+
isBusy: isSaving
|
|
94
|
+
}, __('Create')))));
|
|
95
|
+
}
|
|
96
|
+
export default function AddNewItem({
|
|
97
|
+
type
|
|
98
|
+
}) {
|
|
99
|
+
const [isAdding, setIsAdding] = useState(false);
|
|
100
|
+
return createElement(Fragment, null, createElement(SidebarNavigationItem, {
|
|
101
|
+
icon: plus,
|
|
102
|
+
onClick: () => {
|
|
103
|
+
setIsAdding(true);
|
|
104
|
+
},
|
|
105
|
+
className: "dataviews__siderbar-content-add-new-item"
|
|
106
|
+
}, __('New view')), isAdding && createElement(Modal, {
|
|
107
|
+
title: __('Add new view'),
|
|
108
|
+
onRequestClose: () => {
|
|
109
|
+
setIsAdding(false);
|
|
110
|
+
}
|
|
111
|
+
}, createElement(AddNewItemModalContent, {
|
|
112
|
+
type: type,
|
|
113
|
+
setIsAdding: setIsAdding
|
|
114
|
+
})));
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=add-new-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Modal","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","__","useDispatch","resolveSelect","store","coreStore","useState","plus","privateApis","routerPrivateApis","SidebarNavigationItem","DEFAULT_VIEWS","unlock","useHistory","useLocation","AddNewItemModalContent","type","setIsAdding","params","path","history","saveEntityRecord","title","setTitle","isSaving","setIsSaving","createElement","onSubmit","event","preventDefault","getEntityRecords","dataViewTaxonomyId","dataViewTypeRecords","slug","length","id","record","name","savedRecord","status","wp_dataviews_type","content","JSON","stringify","view","push","activeView","isCustom","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","className","justify","variant","onClick","isBusy","AddNewItem","isAdding","Fragment","icon","onRequestClose"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/add-new-view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport DEFAULT_VIEWS from './default-views';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction AddNewItemModalContent( { type, setIsAdding } ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isSaving, setIsSaving ] = useState( false );\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsSaving( true );\n\t\t\t\tconst { getEntityRecords } = resolveSelect( coreStore );\n\t\t\t\tlet dataViewTaxonomyId;\n\t\t\t\tconst dataViewTypeRecords = await getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t{ slug: type }\n\t\t\t\t);\n\t\t\t\tif ( dataViewTypeRecords && dataViewTypeRecords.length > 0 ) {\n\t\t\t\t\tdataViewTaxonomyId = dataViewTypeRecords[ 0 ].id;\n\t\t\t\t} else {\n\t\t\t\t\tconst record = await saveEntityRecord(\n\t\t\t\t\t\t'taxonomy',\n\t\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t\t{ name: type }\n\t\t\t\t\t);\n\t\t\t\t\tif ( record && record.id ) {\n\t\t\t\t\t\tdataViewTaxonomyId = record.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\twp_dataviews_type: dataViewTaxonomyId,\n\t\t\t\t\t\tcontent: JSON.stringify(\n\t\t\t\t\t\t\tDEFAULT_VIEWS[ type ][ 0 ].view\n\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t\tactiveView: savedRecord.id,\n\t\t\t\t\tisCustom: 'true',\n\t\t\t\t} );\n\t\t\t\tsetIsSaving( false );\n\t\t\t\tsetIsAdding( false );\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ __( 'My view' ) }\n\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSaving }\n\t\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nexport default function AddNewItem( { type } ) {\n\tconst [ isAdding, setIsAdding ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsAdding( true );\n\t\t\t\t} }\n\t\t\t\tclassName=\"dataviews__siderbar-content-add-new-item\"\n\t\t\t>\n\t\t\t\t{ __( 'New view' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ isAdding && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Add new view' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AddNewItemModalContent\n\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\tsetIsAdding={ setIsAdding }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,KAAK,EACLC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,aAAa,QAAQ,iBAAiB;AAC5D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,SAASM,sBAAsBA,CAAE;EAAEC,IAAI;EAAEC;AAAY,CAAC,EAAG;EACxD,MAAM;IACLC,MAAM,EAAE;MAAEC;IAAK;EAChB,CAAC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C;IACpB,CAAG;IACHqC,SAAS,EAAC;EAA0C,GAElDrD,EAAE,CAAE,UAAW,CACK,CAAC,EACtB2D,QAAQ,IACTlC,aAAA,CAAChC,KAAK;IACL4B,KAAK,EAAGrB,EAAE,CAAE,cAAe,CAAG;IAC9B8D,cAAc,EAAGA,CAAA,KAAM;MACtB9C,WAAW,CAAE,KAAM,CAAC;IACrB;EAAG,GAEHS,aAAA,CAACX,sBAAsB;IACtBC,IAAI,EAAGA,IAAM;IACbC,WAAW,EAAGA;EAAa,CAC3B,CACK,CAEP,CAAC;AAEL"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalHeading as Heading, DropdownMenu, MenuGroup, MenuItem, TextControl, __experimentalHStack as HStack, __experimentalVStack as VStack, Button, Modal } from '@wordpress/components';
|
|
8
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
9
|
+
import { moreVertical } from '@wordpress/icons';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import DataViewItem from './dataview-item';
|
|
17
|
+
import AddNewItem from './add-new-view';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
const {
|
|
20
|
+
useHistory,
|
|
21
|
+
useLocation
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
const EMPTY_ARRAY = [];
|
|
24
|
+
function RenameItemModalContent({
|
|
25
|
+
dataviewId,
|
|
26
|
+
currentTitle,
|
|
27
|
+
setIsRenaming
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
editEntityRecord
|
|
31
|
+
} = useDispatch(coreStore);
|
|
32
|
+
const [title, setTitle] = useState(currentTitle);
|
|
33
|
+
return createElement("form", {
|
|
34
|
+
onSubmit: async event => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
await editEntityRecord('postType', 'wp_dataviews', dataviewId, {
|
|
37
|
+
title
|
|
38
|
+
});
|
|
39
|
+
setIsRenaming(false);
|
|
40
|
+
}
|
|
41
|
+
}, createElement(VStack, {
|
|
42
|
+
spacing: "5"
|
|
43
|
+
}, createElement(TextControl, {
|
|
44
|
+
__nextHasNoMarginBottom: true,
|
|
45
|
+
label: __('Name'),
|
|
46
|
+
value: title,
|
|
47
|
+
onChange: setTitle,
|
|
48
|
+
placeholder: __('My view'),
|
|
49
|
+
className: "patterns-create-modal__name-input"
|
|
50
|
+
}), createElement(HStack, {
|
|
51
|
+
justify: "right"
|
|
52
|
+
}, createElement(Button, {
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
onClick: () => {
|
|
55
|
+
setIsRenaming(false);
|
|
56
|
+
}
|
|
57
|
+
}, __('Cancel')), createElement(Button, {
|
|
58
|
+
variant: "primary",
|
|
59
|
+
type: "submit",
|
|
60
|
+
"aria-disabled": !title
|
|
61
|
+
}, __('Rename')))));
|
|
62
|
+
}
|
|
63
|
+
function CustomDataViewItem({
|
|
64
|
+
dataviewId,
|
|
65
|
+
isActive
|
|
66
|
+
}) {
|
|
67
|
+
const {
|
|
68
|
+
params: {
|
|
69
|
+
path
|
|
70
|
+
}
|
|
71
|
+
} = useLocation();
|
|
72
|
+
const history = useHistory();
|
|
73
|
+
const {
|
|
74
|
+
dataview
|
|
75
|
+
} = useSelect(select => {
|
|
76
|
+
const {
|
|
77
|
+
getEditedEntityRecord
|
|
78
|
+
} = select(coreStore);
|
|
79
|
+
return {
|
|
80
|
+
dataview: getEditedEntityRecord('postType', 'wp_dataviews', dataviewId)
|
|
81
|
+
};
|
|
82
|
+
}, [dataviewId]);
|
|
83
|
+
const {
|
|
84
|
+
deleteEntityRecord
|
|
85
|
+
} = useDispatch(coreStore);
|
|
86
|
+
const type = useMemo(() => {
|
|
87
|
+
const viewContent = JSON.parse(dataview.content);
|
|
88
|
+
return viewContent.type;
|
|
89
|
+
}, [dataview.content]);
|
|
90
|
+
const [isRenaming, setIsRenaming] = useState(false);
|
|
91
|
+
return createElement(Fragment, null, createElement(DataViewItem, {
|
|
92
|
+
title: dataview.title,
|
|
93
|
+
type: type,
|
|
94
|
+
isActive: isActive,
|
|
95
|
+
isCustom: "true",
|
|
96
|
+
customViewId: dataviewId,
|
|
97
|
+
suffix: createElement(DropdownMenu, {
|
|
98
|
+
icon: moreVertical,
|
|
99
|
+
label: __('Actions'),
|
|
100
|
+
toggleProps: {
|
|
101
|
+
style: {
|
|
102
|
+
color: 'inherit'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, ({
|
|
106
|
+
onClose
|
|
107
|
+
}) => createElement(MenuGroup, null, createElement(MenuItem, {
|
|
108
|
+
onClick: () => {
|
|
109
|
+
setIsRenaming(true);
|
|
110
|
+
onClose();
|
|
111
|
+
}
|
|
112
|
+
}, __('Rename')), createElement(MenuItem, {
|
|
113
|
+
onClick: async () => {
|
|
114
|
+
await deleteEntityRecord('postType', 'wp_dataviews', dataview.id, {
|
|
115
|
+
force: true
|
|
116
|
+
});
|
|
117
|
+
if (isActive) {
|
|
118
|
+
history.replace({
|
|
119
|
+
path
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
onClose();
|
|
123
|
+
},
|
|
124
|
+
isDestructive: true
|
|
125
|
+
}, __('Delete'))))
|
|
126
|
+
}), isRenaming && createElement(Modal, {
|
|
127
|
+
title: __('Rename view'),
|
|
128
|
+
onRequestClose: () => {
|
|
129
|
+
setIsRenaming(false);
|
|
130
|
+
}
|
|
131
|
+
}, createElement(RenameItemModalContent, {
|
|
132
|
+
dataviewId: dataviewId,
|
|
133
|
+
setIsRenaming: setIsRenaming,
|
|
134
|
+
currentTitle: dataview.title
|
|
135
|
+
})));
|
|
136
|
+
}
|
|
137
|
+
export function useCustomDataViews(type) {
|
|
138
|
+
const customDataViews = useSelect(select => {
|
|
139
|
+
const {
|
|
140
|
+
getEntityRecords
|
|
141
|
+
} = select(coreStore);
|
|
142
|
+
const dataViewTypeRecords = getEntityRecords('taxonomy', 'wp_dataviews_type', {
|
|
143
|
+
slug: type
|
|
144
|
+
});
|
|
145
|
+
if (!dataViewTypeRecords || dataViewTypeRecords.length === 0) {
|
|
146
|
+
return EMPTY_ARRAY;
|
|
147
|
+
}
|
|
148
|
+
const dataViews = getEntityRecords('postType', 'wp_dataviews', {
|
|
149
|
+
wp_dataviews_type: dataViewTypeRecords[0].id,
|
|
150
|
+
orderby: 'date',
|
|
151
|
+
order: 'asc'
|
|
152
|
+
});
|
|
153
|
+
if (!dataViews) {
|
|
154
|
+
return EMPTY_ARRAY;
|
|
155
|
+
}
|
|
156
|
+
return dataViews;
|
|
157
|
+
});
|
|
158
|
+
return customDataViews;
|
|
159
|
+
}
|
|
160
|
+
export default function CustomDataViewsList({
|
|
161
|
+
type,
|
|
162
|
+
activeView,
|
|
163
|
+
isCustom
|
|
164
|
+
}) {
|
|
165
|
+
const customDataViews = useCustomDataViews(type);
|
|
166
|
+
return createElement(Fragment, null, createElement("div", {
|
|
167
|
+
className: "edit-site-sidebar-navigation-screen-dataviews__group-header"
|
|
168
|
+
}, createElement(Heading, {
|
|
169
|
+
level: 2
|
|
170
|
+
}, __('Custom Views'))), createElement(ItemGroup, null, customDataViews.map(customViewRecord => {
|
|
171
|
+
return createElement(CustomDataViewItem, {
|
|
172
|
+
key: customViewRecord.id,
|
|
173
|
+
dataviewId: customViewRecord.id,
|
|
174
|
+
isActive: isCustom === 'true' && Number(activeView) === customViewRecord.id
|
|
175
|
+
});
|
|
176
|
+
}), createElement(AddNewItem, {
|
|
177
|
+
type: type
|
|
178
|
+
})));
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=custom-dataviews-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","store","coreStore","__experimentalItemGroup","ItemGroup","__experimentalHeading","Heading","DropdownMenu","MenuGroup","MenuItem","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","Modal","useMemo","useState","moreVertical","__","privateApis","routerPrivateApis","DataViewItem","AddNewItem","unlock","useHistory","useLocation","EMPTY_ARRAY","RenameItemModalContent","dataviewId","currentTitle","setIsRenaming","editEntityRecord","title","setTitle","createElement","onSubmit","event","preventDefault","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","className","justify","variant","onClick","type","CustomDataViewItem","isActive","params","path","history","dataview","select","getEditedEntityRecord","deleteEntityRecord","viewContent","JSON","parse","content","isRenaming","Fragment","isCustom","customViewId","suffix","icon","toggleProps","style","color","onClose","id","force","replace","isDestructive","onRequestClose","useCustomDataViews","customDataViews","getEntityRecords","dataViewTypeRecords","slug","length","dataViews","wp_dataviews_type","orderby","order","CustomDataViewsList","activeView","level","map","customViewRecord","key","Number"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/custom-dataviews-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHeading as Heading,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from './dataview-item';\nimport AddNewItem from './add-new-view';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\n\nfunction RenameItemModalContent( { dataviewId, currentTitle, setIsRenaming } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ title, setTitle ] = useState( currentTitle );\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\tdataviewId,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tsetIsRenaming( false );\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ __( 'My view' ) }\n\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsRenaming( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction CustomDataViewItem( { dataviewId, isActive } ) {\n\tconst {\n\t\tparams: { path },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst { dataview } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tdataview: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\tdataviewId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ dataviewId ]\n\t);\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst type = useMemo( () => {\n\t\tconst viewContent = JSON.parse( dataview.content );\n\t\treturn viewContent.type;\n\t}, [ dataview.content ] );\n\tconst [ isRenaming, setIsRenaming ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<DataViewItem\n\t\t\t\ttitle={ dataview.title }\n\t\t\t\ttype={ type }\n\t\t\t\tisActive={ isActive }\n\t\t\t\tisCustom=\"true\"\n\t\t\t\tcustomViewId={ dataviewId }\n\t\t\t\tsuffix={\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\tcolor: 'inherit',\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\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsRenaming( true );\n\t\t\t\t\t\t\t\t\t\tonClose();\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{ __( 'Rename' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\t\t\t\t\t\t\tdataview.id,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tforce: true,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif ( isActive ) {\n\t\t\t\t\t\t\t\t\t\t\thistory.replace( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isRenaming && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename view' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsRenaming( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<RenameItemModalContent\n\t\t\t\t\t\tdataviewId={ dataviewId }\n\t\t\t\t\t\tsetIsRenaming={ setIsRenaming }\n\t\t\t\t\t\tcurrentTitle={ dataview.title }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport function useCustomDataViews( type ) {\n\tconst customDataViews = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\tconst dataViewTypeRecords = getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'wp_dataviews_type',\n\t\t\t{ slug: type }\n\t\t);\n\t\tif ( ! dataViewTypeRecords || dataViewTypeRecords.length === 0 ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst dataViews = getEntityRecords( 'postType', 'wp_dataviews', {\n\t\t\twp_dataviews_type: dataViewTypeRecords[ 0 ].id,\n\t\t\torderby: 'date',\n\t\t\torder: 'asc',\n\t\t} );\n\t\tif ( ! dataViews ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn dataViews;\n\t} );\n\treturn customDataViews;\n}\n\nexport default function CustomDataViewsList( { type, activeView, isCustom } ) {\n\tconst customDataViews = useCustomDataViews( type );\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-dataviews__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Custom Views' ) }</Heading>\n\t\t\t</div>\n\t\t\t<ItemGroup>\n\t\t\t\t{ customDataViews.map( ( customViewRecord ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CustomDataViewItem\n\t\t\t\t\t\t\tkey={ customViewRecord.id }\n\t\t\t\t\t\t\tdataviewId={ customViewRecord.id }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tisCustom === 'true' &&\n\t\t\t\t\t\t\t\tNumber( activeView ) === customViewRecord.id\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} ) }\n\t\t\t\t<AddNewItem type={ type } />\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,qBAAqB,IAAIC,OAAO,EAChCC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBA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