@wordpress/edit-site 6.1.0 → 6.3.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 +10 -6
- package/build/components/add-new-pattern/index.js +31 -16
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/{add-new-page → add-new-post}/index.js +28 -16
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +5 -3
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +32 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +18 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +17 -17
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +14 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +28 -22
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +5 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -27
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +20 -41
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/index.js +51 -41
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +27 -21
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/{page-pages/index.js → posts-app/posts-list.js} +165 -38
- package/build/components/posts-app/posts-list.js.map +1 -0
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +98 -84
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/deprecated.js +11 -0
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +11 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +31 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +28 -16
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +33 -8
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +18 -18
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +2 -2
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +15 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +6 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +29 -23
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +5 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -28
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +20 -41
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/index.js +52 -42
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +27 -21
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +164 -37
- package/build-module/components/posts-app/posts-list.js.map +1 -0
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +97 -84
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/deprecated.js +11 -0
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +11 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +108 -28
- package/build-style/posts.css +108 -28
- package/build-style/style-rtl.css +127 -157
- package/build-style/style.css +127 -157
- package/lib/inflate.js +3188 -3937
- package/lib/lib-font.browser.js +32 -2
- package/lib/unbrotli.js +1818 -2458
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +38 -23
- package/src/components/{add-new-page → add-new-post}/index.js +42 -18
- package/src/components/block-editor/style.scss +0 -11
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +34 -20
- package/src/components/editor-canvas-container/index.js +20 -8
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/font-families.js +28 -19
- package/src/components/global-styles/font-library-modal/context.js +2 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/src/components/global-styles/font-library-modal/style.scss +17 -10
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +22 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/style-variations-container.js +10 -7
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +41 -26
- package/src/components/global-styles/variations/variations-color.js +6 -3
- package/src/components/global-styles/variations/variations-typography.js +16 -32
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +13 -4
- package/src/components/layout/router.js +20 -36
- package/src/components/layout/style.scss +12 -0
- package/src/components/page-patterns/index.js +55 -58
- package/src/components/page-patterns/rename-category-menu-item.js +2 -0
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +26 -21
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/pagination/index.js +4 -4
- package/src/components/posts-app/index.js +9 -11
- package/src/components/{page-pages/index.js → posts-app/posts-list.js} +163 -42
- package/src/components/posts-app/router.js +69 -0
- package/src/components/{page-pages → posts-app}/style.scss +22 -8
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +119 -98
- package/src/components/sidebar-dataviews/index.js +3 -3
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +8 -2
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/deprecated.js +14 -0
- package/src/hooks/commands/use-set-command-context.js +12 -0
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +8 -1
- package/src/lock-unlock.js +1 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +14 -2
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = PostsApp;
|
|
8
8
|
var _editor = require("@wordpress/editor");
|
|
9
9
|
var _router = require("@wordpress/router");
|
|
10
|
+
var _useInitEditedEntityFromUrl = _interopRequireDefault(require("../sync-state-with-url/use-init-edited-entity-from-url"));
|
|
10
11
|
var _layout = _interopRequireDefault(require("../layout"));
|
|
11
|
-
var
|
|
12
|
+
var _router2 = _interopRequireDefault(require("./router"));
|
|
12
13
|
var _lockUnlock = require("../../lock-unlock");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
/**
|
|
@@ -25,25 +26,18 @@ const {
|
|
|
25
26
|
const {
|
|
26
27
|
GlobalStylesProvider
|
|
27
28
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
mobile: /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
37
|
-
children: "Welcome to Posts"
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
};
|
|
29
|
+
function PostsLayout() {
|
|
30
|
+
// This ensures the edited entity id and type are initialized properly.
|
|
31
|
+
(0, _useInitEditedEntityFromUrl.default)();
|
|
32
|
+
const route = (0, _router2.default)();
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
34
|
+
route: route
|
|
35
|
+
});
|
|
36
|
+
}
|
|
41
37
|
function PostsApp() {
|
|
42
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GlobalStylesProvider, {
|
|
43
39
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.UnsavedChangesWarning, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterProvider, {
|
|
44
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
45
|
-
route: defaultRoute
|
|
46
|
-
})
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PostsLayout, {})
|
|
47
41
|
})]
|
|
48
42
|
});
|
|
49
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_editor","require","_router","
|
|
1
|
+
{"version":3,"names":["_editor","require","_router","_useInitEditedEntityFromUrl","_interopRequireDefault","_layout","_router2","_lockUnlock","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","PostsLayout","useInitEditedEntityFromURL","route","useLayoutAreas","jsx","default","PostsApp","jsxs","children","UnsavedChangesWarning"],"sources":["@wordpress/edit-site/src/components/posts-app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport Layout from '../layout';\nimport useLayoutAreas from './router';\nimport { unlock } from '../../lock-unlock';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction PostsLayout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tconst route = useLayoutAreas();\n\treturn <Layout route={ route } />;\n}\n\nexport default function PostsApp() {\n\treturn (\n\t\t<GlobalStylesProvider>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<RouterProvider>\n\t\t\t\t<PostsLayout />\n\t\t\t</RouterProvider>\n\t\t</GlobalStylesProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,2BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,QAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAf3C;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAM;EAAEQ;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AACtD,MAAM;EAAEC;AAAqB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE5D,SAASC,WAAWA,CAAA,EAAG;EACtB;EACA,IAAAC,mCAA0B,EAAC,CAAC;EAC5B,MAAMC,KAAK,GAAG,IAAAC,gBAAc,EAAC,CAAC;EAC9B,oBAAO,IAAAT,WAAA,CAAAU,GAAA,EAACb,OAAA,CAAAc,OAAM;IAACH,KAAK,EAAGA;EAAO,CAAE,CAAC;AAClC;AAEe,SAASI,QAAQA,CAAA,EAAG;EAClC,oBACC,IAAAZ,WAAA,CAAAa,IAAA,EAACT,oBAAoB;IAAAU,QAAA,gBACpB,IAAAd,WAAA,CAAAU,GAAA,EAAClB,OAAA,CAAAuB,qBAAqB,IAAE,CAAC,eACzB,IAAAf,WAAA,CAAAU,GAAA,EAACT,cAAc;MAAAa,QAAA,eACd,IAAAd,WAAA,CAAAU,GAAA,EAACJ,WAAW,IAAE;IAAC,CACA,CAAC;EAAA,CACI,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -4,7 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = PostsList;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
9
|
var _components = require("@wordpress/components");
|
|
9
10
|
var _i18n = require("@wordpress/i18n");
|
|
10
11
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -15,17 +16,23 @@ var _router = require("@wordpress/router");
|
|
|
15
16
|
var _data = require("@wordpress/data");
|
|
16
17
|
var _dataviews = require("@wordpress/dataviews");
|
|
17
18
|
var _editor = require("@wordpress/editor");
|
|
19
|
+
var _icons = require("@wordpress/icons");
|
|
18
20
|
var _page = _interopRequireDefault(require("../page"));
|
|
19
21
|
var _link = _interopRequireWildcard(require("../routes/link"));
|
|
20
22
|
var _defaultViews = require("../sidebar-dataviews/default-views");
|
|
21
23
|
var _constants = require("../../utils/constants");
|
|
22
|
-
var
|
|
24
|
+
var _addNewPost = _interopRequireDefault(require("../add-new-post"));
|
|
23
25
|
var _media = _interopRequireDefault(require("../media"));
|
|
24
26
|
var _lockUnlock = require("../../lock-unlock");
|
|
25
27
|
var _dataviewsActions = require("../dataviews-actions");
|
|
28
|
+
var _compose = require("@wordpress/compose");
|
|
26
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
28
31
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
|
+
/**
|
|
33
|
+
* External dependencies
|
|
34
|
+
*/
|
|
35
|
+
|
|
29
36
|
/**
|
|
30
37
|
* WordPress dependencies
|
|
31
38
|
*/
|
|
@@ -52,8 +59,11 @@ function useView(postType) {
|
|
|
52
59
|
}
|
|
53
60
|
} = useLocation();
|
|
54
61
|
const history = useHistory();
|
|
62
|
+
const DEFAULT_VIEWS = (0, _defaultViews.useDefaultViews)({
|
|
63
|
+
postType
|
|
64
|
+
});
|
|
55
65
|
const selectedDefaultView = (0, _element.useMemo)(() => {
|
|
56
|
-
const defaultView = isCustom === 'false' &&
|
|
66
|
+
const defaultView = isCustom === 'false' && DEFAULT_VIEWS[postType].find(({
|
|
57
67
|
slug
|
|
58
68
|
}) => slug === activeView)?.view;
|
|
59
69
|
if (isCustom === 'false' && layout) {
|
|
@@ -66,7 +76,7 @@ function useView(postType) {
|
|
|
66
76
|
};
|
|
67
77
|
}
|
|
68
78
|
return defaultView;
|
|
69
|
-
}, [isCustom, activeView, layout, postType]);
|
|
79
|
+
}, [isCustom, activeView, layout, postType, DEFAULT_VIEWS]);
|
|
70
80
|
const [view, setView] = (0, _element.useState)(selectedDefaultView);
|
|
71
81
|
(0, _element.useEffect)(() => {
|
|
72
82
|
if (selectedDefaultView) {
|
|
@@ -121,29 +131,35 @@ function useView(postType) {
|
|
|
121
131
|
return [customView, setCustomView];
|
|
122
132
|
}
|
|
123
133
|
// Loading state where no the view was not found on custom views or default views.
|
|
124
|
-
return [
|
|
134
|
+
return [DEFAULT_VIEWS[postType][0].view, setDefaultViewAndUpdateUrl];
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
// See https://github.com/WordPress/gutenberg/issues/55886
|
|
128
138
|
// We do not support custom statutes at the moment.
|
|
129
139
|
const STATUSES = [{
|
|
130
140
|
value: 'draft',
|
|
131
|
-
label: (0, _i18n.__)('Draft')
|
|
141
|
+
label: (0, _i18n.__)('Draft'),
|
|
142
|
+
icon: _icons.drafts
|
|
132
143
|
}, {
|
|
133
144
|
value: 'future',
|
|
134
|
-
label: (0, _i18n.__)('Scheduled')
|
|
145
|
+
label: (0, _i18n.__)('Scheduled'),
|
|
146
|
+
icon: _icons.scheduled
|
|
135
147
|
}, {
|
|
136
148
|
value: 'pending',
|
|
137
|
-
label: (0, _i18n.__)('Pending Review')
|
|
149
|
+
label: (0, _i18n.__)('Pending Review'),
|
|
150
|
+
icon: _icons.pending
|
|
138
151
|
}, {
|
|
139
152
|
value: 'private',
|
|
140
|
-
label: (0, _i18n.__)('Private')
|
|
153
|
+
label: (0, _i18n.__)('Private'),
|
|
154
|
+
icon: _icons.notAllowed
|
|
141
155
|
}, {
|
|
142
156
|
value: 'publish',
|
|
143
|
-
label: (0, _i18n.__)('Published')
|
|
157
|
+
label: (0, _i18n.__)('Published'),
|
|
158
|
+
icon: _icons.published
|
|
144
159
|
}, {
|
|
145
160
|
value: 'trash',
|
|
146
|
-
label: (0, _i18n.__)('Trash')
|
|
161
|
+
label: (0, _i18n.__)('Trash'),
|
|
162
|
+
icon: _icons.trash
|
|
147
163
|
}];
|
|
148
164
|
const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.
|
|
149
165
|
|
|
@@ -162,15 +178,15 @@ function FeaturedImage({
|
|
|
162
178
|
const hasMedia = !!item.featured_media;
|
|
163
179
|
const size = viewType === _constants.LAYOUT_GRID ? ['large', 'full', 'medium', 'thumbnail'] : ['thumbnail', 'medium', 'large', 'full'];
|
|
164
180
|
const media = hasMedia ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_media.default, {
|
|
165
|
-
className: "
|
|
181
|
+
className: "posts-list-page__featured-image",
|
|
166
182
|
id: item.featured_media,
|
|
167
183
|
size: size
|
|
168
184
|
}) : null;
|
|
169
185
|
const renderButton = viewType !== _constants.LAYOUT_LIST && !isDisabled;
|
|
170
186
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
171
|
-
className: `
|
|
187
|
+
className: `posts-list-page__featured-image-wrapper is-layout-${viewType}`,
|
|
172
188
|
children: renderButton ? /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
173
|
-
className: "page-
|
|
189
|
+
className: "posts-list-page-preview-field__button",
|
|
174
190
|
type: "button",
|
|
175
191
|
onClick: onClick,
|
|
176
192
|
"aria-label": item.title?.rendered || (0, _i18n.__)('(no title)'),
|
|
@@ -178,10 +194,87 @@ function FeaturedImage({
|
|
|
178
194
|
}) : media
|
|
179
195
|
});
|
|
180
196
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
197
|
+
function getItemId(item) {
|
|
198
|
+
return item.id.toString();
|
|
199
|
+
}
|
|
200
|
+
function PostStatusField({
|
|
201
|
+
item
|
|
202
|
+
}) {
|
|
203
|
+
const status = STATUSES.find(({
|
|
204
|
+
value
|
|
205
|
+
}) => value === item.status);
|
|
206
|
+
const label = status?.label || item.status;
|
|
207
|
+
const icon = status?.icon;
|
|
208
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
209
|
+
alignment: "left",
|
|
210
|
+
spacing: 1,
|
|
211
|
+
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
212
|
+
className: "posts-list-page-post-author-field__icon-container",
|
|
213
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
214
|
+
icon: icon
|
|
215
|
+
})
|
|
216
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
217
|
+
children: label
|
|
218
|
+
})]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function PostAuthorField({
|
|
222
|
+
item,
|
|
223
|
+
viewType
|
|
224
|
+
}) {
|
|
225
|
+
const {
|
|
226
|
+
text,
|
|
227
|
+
icon,
|
|
228
|
+
imageUrl
|
|
229
|
+
} = (0, _data.useSelect)(select => {
|
|
230
|
+
const {
|
|
231
|
+
getUser
|
|
232
|
+
} = select(_coreData.store);
|
|
233
|
+
const user = getUser(item.author);
|
|
234
|
+
return {
|
|
235
|
+
icon: _icons.commentAuthorAvatar,
|
|
236
|
+
imageUrl: user?.avatar_urls?.[48],
|
|
237
|
+
text: user?.name
|
|
238
|
+
};
|
|
239
|
+
}, [item]);
|
|
240
|
+
const withAuthorImage = viewType !== _constants.LAYOUT_LIST && imageUrl;
|
|
241
|
+
const withAuthorIcon = viewType !== _constants.LAYOUT_LIST && !imageUrl;
|
|
242
|
+
const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
|
|
243
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
244
|
+
alignment: "left",
|
|
245
|
+
spacing: 1,
|
|
246
|
+
children: [withAuthorImage && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
247
|
+
className: (0, _clsx.default)('page-templates-author-field__avatar', {
|
|
248
|
+
'is-loaded': isImageLoaded
|
|
249
|
+
}),
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
251
|
+
onLoad: () => setIsImageLoaded(true),
|
|
252
|
+
alt: (0, _i18n.__)('Author avatar'),
|
|
253
|
+
src: imageUrl
|
|
254
|
+
})
|
|
255
|
+
}), withAuthorIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
256
|
+
className: "page-templates-author-field__icon",
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
258
|
+
icon: icon
|
|
259
|
+
})
|
|
260
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
261
|
+
className: "page-templates-author-field__name",
|
|
262
|
+
children: text
|
|
263
|
+
})]
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
function PostsList({
|
|
267
|
+
postType
|
|
268
|
+
}) {
|
|
269
|
+
var _records$map, _usePrevious;
|
|
183
270
|
const [view, setView] = useView(postType);
|
|
184
271
|
const history = useHistory();
|
|
272
|
+
const {
|
|
273
|
+
params: {
|
|
274
|
+
postId
|
|
275
|
+
}
|
|
276
|
+
} = useLocation();
|
|
277
|
+
const [selection, setSelection] = (0, _element.useState)([postId]);
|
|
185
278
|
const onSelectionChange = (0, _element.useCallback)(items => {
|
|
186
279
|
var _params$isCustom;
|
|
187
280
|
const {
|
|
@@ -222,11 +315,23 @@ function PagePages() {
|
|
|
222
315
|
};
|
|
223
316
|
}, [view]);
|
|
224
317
|
const {
|
|
225
|
-
records
|
|
226
|
-
isResolving:
|
|
318
|
+
records,
|
|
319
|
+
isResolving: isLoadingMainEntities,
|
|
227
320
|
totalItems,
|
|
228
321
|
totalPages
|
|
229
322
|
} = (0, _coreData.useEntityRecords)('postType', postType, queryArgs);
|
|
323
|
+
const ids = (_records$map = records?.map(record => getItemId(record))) !== null && _records$map !== void 0 ? _records$map : [];
|
|
324
|
+
const prevIds = (_usePrevious = (0, _compose.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : [];
|
|
325
|
+
const deletedIds = prevIds.filter(id => !ids.includes(id));
|
|
326
|
+
const postIdWasDeleted = deletedIds.includes(postId);
|
|
327
|
+
(0, _element.useEffect)(() => {
|
|
328
|
+
if (postIdWasDeleted) {
|
|
329
|
+
history.push({
|
|
330
|
+
...history.getLocationWithParams().params,
|
|
331
|
+
postId: undefined
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}, [postIdWasDeleted, history]);
|
|
230
335
|
const {
|
|
231
336
|
records: authors,
|
|
232
337
|
isResolving: isLoadingAuthors
|
|
@@ -240,19 +345,25 @@ function PagePages() {
|
|
|
240
345
|
const {
|
|
241
346
|
frontPageId,
|
|
242
347
|
postsPageId,
|
|
243
|
-
|
|
348
|
+
labels,
|
|
349
|
+
canCreateRecord
|
|
244
350
|
} = (0, _data.useSelect)(select => {
|
|
245
351
|
const {
|
|
246
352
|
getEntityRecord,
|
|
247
|
-
getPostType
|
|
353
|
+
getPostType,
|
|
354
|
+
canUser
|
|
248
355
|
} = select(_coreData.store);
|
|
249
356
|
const siteSettings = getEntityRecord('root', 'site');
|
|
357
|
+
const postTypeObject = getPostType(postType);
|
|
250
358
|
return {
|
|
251
359
|
frontPageId: siteSettings?.page_on_front,
|
|
252
360
|
postsPageId: siteSettings?.page_for_posts,
|
|
253
|
-
|
|
361
|
+
labels: getPostType(postType)?.labels,
|
|
362
|
+
canCreateRecord: canUser('create', postTypeObject?.rest_base || 'posts')
|
|
254
363
|
};
|
|
255
|
-
});
|
|
364
|
+
}, [postType]);
|
|
365
|
+
|
|
366
|
+
// TODO: this should be abstracted into a hook similar to `usePostActions`.
|
|
256
367
|
const fields = (0, _element.useMemo)(() => [{
|
|
257
368
|
id: 'featured-image',
|
|
258
369
|
header: (0, _i18n.__)('Featured Image'),
|
|
@@ -290,17 +401,17 @@ function PagePages() {
|
|
|
290
401
|
let suffix = '';
|
|
291
402
|
if (item.id === frontPageId) {
|
|
292
403
|
suffix = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
293
|
-
className: "
|
|
404
|
+
className: "posts-list-page-title-badge",
|
|
294
405
|
children: (0, _i18n.__)('Front Page')
|
|
295
406
|
});
|
|
296
407
|
} else if (item.id === postsPageId) {
|
|
297
408
|
suffix = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
298
|
-
className: "
|
|
409
|
+
className: "posts-list-page-title-badge",
|
|
299
410
|
children: (0, _i18n.__)('Posts Page')
|
|
300
411
|
});
|
|
301
412
|
}
|
|
302
413
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
303
|
-
className: "
|
|
414
|
+
className: "posts-list-page-title",
|
|
304
415
|
alignment: "center",
|
|
305
416
|
justify: "flex-start",
|
|
306
417
|
children: [title, suffix]
|
|
@@ -320,7 +431,15 @@ function PagePages() {
|
|
|
320
431
|
}) => ({
|
|
321
432
|
value: id,
|
|
322
433
|
label: name
|
|
323
|
-
})) || []
|
|
434
|
+
})) || [],
|
|
435
|
+
render: ({
|
|
436
|
+
item
|
|
437
|
+
}) => {
|
|
438
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PostAuthorField, {
|
|
439
|
+
viewType: view.type,
|
|
440
|
+
item: item
|
|
441
|
+
});
|
|
442
|
+
}
|
|
324
443
|
}, {
|
|
325
444
|
header: (0, _i18n.__)('Status'),
|
|
326
445
|
id: 'status',
|
|
@@ -333,6 +452,7 @@ function PagePages() {
|
|
|
333
452
|
}) => value === item.status)?.label) !== null && _STATUSES$find$label !== void 0 ? _STATUSES$find$label : item.status;
|
|
334
453
|
},
|
|
335
454
|
elements: STATUSES,
|
|
455
|
+
render: PostStatusField,
|
|
336
456
|
enableSorting: false,
|
|
337
457
|
filterBy: {
|
|
338
458
|
operators: [_constants.OPERATOR_IS_ANY]
|
|
@@ -385,7 +505,10 @@ function PagePages() {
|
|
|
385
505
|
});
|
|
386
506
|
}
|
|
387
507
|
}], [authors, view.type, frontPageId, postsPageId]);
|
|
388
|
-
const postTypeActions = usePostActions(
|
|
508
|
+
const postTypeActions = usePostActions({
|
|
509
|
+
postType,
|
|
510
|
+
context: 'list'
|
|
511
|
+
});
|
|
389
512
|
const editAction = (0, _dataviewsActions.useEditPostAction)();
|
|
390
513
|
const actions = (0, _element.useMemo)(() => [editAction, ...postTypeActions], [postTypeActions, editAction]);
|
|
391
514
|
const onChangeView = (0, _element.useCallback)(newView => {
|
|
@@ -399,9 +522,9 @@ function PagePages() {
|
|
|
399
522
|
}
|
|
400
523
|
setView(newView);
|
|
401
524
|
}, [view.type, setView]);
|
|
402
|
-
const [
|
|
403
|
-
const openModal = () =>
|
|
404
|
-
const closeModal = () =>
|
|
525
|
+
const [showAddPostModal, setShowAddPostModal] = (0, _element.useState)(false);
|
|
526
|
+
const openModal = () => setShowAddPostModal(true);
|
|
527
|
+
const closeModal = () => setShowAddPostModal(false);
|
|
405
528
|
const handleNewPage = ({
|
|
406
529
|
type,
|
|
407
530
|
id
|
|
@@ -414,14 +537,15 @@ function PagePages() {
|
|
|
414
537
|
closeModal();
|
|
415
538
|
};
|
|
416
539
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
417
|
-
title:
|
|
418
|
-
actions:
|
|
540
|
+
title: labels?.name,
|
|
541
|
+
actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
419
542
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
420
543
|
variant: "primary",
|
|
421
544
|
onClick: openModal,
|
|
422
545
|
__next40pxDefaultSize: true,
|
|
423
|
-
children:
|
|
424
|
-
}),
|
|
546
|
+
children: labels.add_new_item
|
|
547
|
+
}), showAddPostModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_addNewPost.default, {
|
|
548
|
+
postType: postType,
|
|
425
549
|
onSave: handleNewPage,
|
|
426
550
|
onClose: closeModal
|
|
427
551
|
})]
|
|
@@ -430,12 +554,15 @@ function PagePages() {
|
|
|
430
554
|
paginationInfo: paginationInfo,
|
|
431
555
|
fields: fields,
|
|
432
556
|
actions: actions,
|
|
433
|
-
data:
|
|
434
|
-
isLoading:
|
|
557
|
+
data: records || EMPTY_ARRAY,
|
|
558
|
+
isLoading: isLoadingMainEntities || isLoadingAuthors,
|
|
435
559
|
view: view,
|
|
436
560
|
onChangeView: onChangeView,
|
|
437
|
-
|
|
561
|
+
selection: selection,
|
|
562
|
+
setSelection: setSelection,
|
|
563
|
+
onSelectionChange: onSelectionChange,
|
|
564
|
+
getItemId: getItemId
|
|
438
565
|
})
|
|
439
566
|
});
|
|
440
567
|
}
|
|
441
|
-
//# sourceMappingURL=
|
|
568
|
+
//# sourceMappingURL=posts-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_coreData","_htmlEntities","_element","_date","_router","_data","_dataviews","_editor","_icons","_page","_link","_interopRequireWildcard","_defaultViews","_constants","_addNewPost","_media","_lockUnlock","_dataviewsActions","_compose","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","usePostActions","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","EMPTY_ARRAY","getFormattedDate","dateToDisplay","dateI18n","getSettings","formats","datetimeAbbreviated","getDate","useView","postType","params","activeView","isCustom","layout","history","DEFAULT_VIEWS","useDefaultViews","selectedDefaultView","useMemo","defaultView","find","slug","view","type","DEFAULT_CONFIG_PER_VIEW_TYPE","setView","useState","useEffect","editedViewRecord","useSelect","select","getEditedEntityRecord","coreStore","dataviewRecord","Number","editEntityRecord","useDispatch","customView","storedView","content","JSON","parse","setCustomView","useCallback","viewToSet","id","stringify","setDefaultViewAndUpdateUrl","getLocationWithParams","push","STATUSES","value","label","__","icon","drafts","scheduled","pending","notAllowed","published","trash","DEFAULT_STATUSES","FeaturedImage","item","viewType","isDisabled","status","onClick","useLink","postId","canvas","hasMedia","featured_media","size","LAYOUT_GRID","media","jsx","className","renderButton","LAYOUT_LIST","children","title","rendered","getItemId","toString","PostStatusField","jsxs","__experimentalHStack","alignment","spacing","Icon","PostAuthorField","text","imageUrl","getUser","user","author","authorIcon","avatar_urls","name","withAuthorImage","withAuthorIcon","isImageLoaded","setIsImageLoaded","clsx","onLoad","alt","src","PostsList","_records$map","_usePrevious","selection","setSelection","onSelectionChange","items","_params$isCustom","length","undefined","queryArgs","filters","forEach","filter","field","operator","OPERATOR_IS_ANY","OPERATOR_IS_NONE","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingMainEntities","totalItems","totalPages","useEntityRecords","ids","map","record","prevIds","usePrevious","deletedIds","includes","postIdWasDeleted","authors","isLoadingAuthors","paginationInfo","frontPageId","postsPageId","labels","canCreateRecord","getEntityRecord","getPostType","canUser","siteSettings","postTypeObject","page_on_front","page_for_posts","rest_base","fields","header","getValue","render","enableSorting","width","addLink","LAYOUT_TABLE","decodeEntities","suffix","justify","maxWidth","enableHiding","_embedded","elements","_STATUSES$find$label","filterBy","operators","isDraftOrPrivate","createInterpolateElement","sprintf","date","span","time","isScheduled","modified","isPending","isPublished","postTypeActions","context","editAction","useEditPostAction","actions","onChangeView","newView","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","add_new_item","Fragment","Button","variant","__next40pxDefaultSize","onSave","onClose","DataViews","data","isLoading"],"sources":["@wordpress/edit-site/src/components/posts-app/posts-list.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\tIcon,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcreateInterpolateElement,\n\tuseState,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n\tcommentAuthorAvatar as authorIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { default as Link, useLink } from '../routes/link';\nimport {\n\tuseDefaultViews,\n\tDEFAULT_CONFIG_PER_VIEW_TYPE,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport Media from '../media';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst getFormattedDate = ( dateToDisplay ) =>\n\tdateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( dateToDisplay )\n\t);\n\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst DEFAULT_VIEWS = useDefaultViews( { postType } );\n\tconst selectedDefaultView = useMemo( () => {\n\t\tconst defaultView =\n\t\t\tisCustom === 'false' &&\n\t\t\tDEFAULT_VIEWS[ postType ].find(\n\t\t\t\t( { slug } ) => slug === activeView\n\t\t\t)?.view;\n\t\tif ( isCustom === 'false' && layout ) {\n\t\t\treturn {\n\t\t\t\t...defaultView,\n\t\t\t\ttype: layout,\n\t\t\t\tlayout: {\n\t\t\t\t\t...( DEFAULT_CONFIG_PER_VIEW_TYPE[ layout ] || {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn defaultView;\n\t}, [ isCustom, activeView, layout, postType, DEFAULT_VIEWS ] );\n\tconst [ view, setView ] = useState( selectedDefaultView );\n\n\tuseEffect( () => {\n\t\tif ( selectedDefaultView ) {\n\t\t\tsetView( selectedDefaultView );\n\t\t}\n\t}, [ selectedDefaultView ] );\n\tconst editedViewRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst dataviewRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t\treturn dataviewRecord;\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst customView = useMemo( () => {\n\t\tconst storedView =\n\t\t\teditedViewRecord?.content &&\n\t\t\tJSON.parse( editedViewRecord?.content );\n\t\tif ( ! storedView ) {\n\t\t\treturn storedView;\n\t\t}\n\n\t\treturn {\n\t\t\t...storedView,\n\t\t\tlayout: {\n\t\t\t\t...( DEFAULT_CONFIG_PER_VIEW_TYPE[ storedView?.type ] || {} ),\n\t\t\t},\n\t\t};\n\t}, [ editedViewRecord?.content ] );\n\n\tconst setCustomView = useCallback(\n\t\t( viewToSet ) => {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\teditedViewRecord?.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: JSON.stringify( viewToSet ),\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ editEntityRecord, editedViewRecord?.id ]\n\t);\n\n\tconst setDefaultViewAndUpdateUrl = useCallback(\n\t\t( viewToSet ) => {\n\t\t\tif ( viewToSet.type !== view?.type ) {\n\t\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: viewToSet.type,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetView( viewToSet );\n\t\t},\n\t\t[ history, view?.type ]\n\t);\n\n\tif ( isCustom === 'false' ) {\n\t\treturn [ view, setDefaultViewAndUpdateUrl ];\n\t} else if ( isCustom === 'true' && customView ) {\n\t\treturn [ customView, setCustomView ];\n\t}\n\t// Loading state where no the view was not found on custom views or default views.\n\treturn [ DEFAULT_VIEWS[ postType ][ 0 ].view, setDefaultViewAndUpdateUrl ];\n}\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ), icon: drafts },\n\t{ value: 'future', label: __( 'Scheduled' ), icon: scheduled },\n\t{ value: 'pending', label: __( 'Pending Review' ), icon: pending },\n\t{ value: 'private', label: __( 'Private' ), icon: notAllowed },\n\t{ value: 'publish', label: __( 'Published' ), icon: published },\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction FeaturedImage( { item, viewType } ) {\n\tconst isDisabled = item.status === 'trash';\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\tconst hasMedia = !! item.featured_media;\n\tconst size =\n\t\tviewType === LAYOUT_GRID\n\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ];\n\tconst media = hasMedia ? (\n\t\t<Media\n\t\t\tclassName=\"posts-list-page__featured-image\"\n\t\t\tid={ item.featured_media }\n\t\t\tsize={ size }\n\t\t/>\n\t) : null;\n\tconst renderButton = viewType !== LAYOUT_LIST && ! isDisabled;\n\treturn (\n\t\t<div\n\t\t\tclassName={ `posts-list-page__featured-image-wrapper is-layout-${ viewType }` }\n\t\t>\n\t\t\t{ renderButton ? (\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"posts-list-page-preview-field__button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\taria-label={ item.title?.rendered || __( '(no title)' ) }\n\t\t\t\t>\n\t\t\t\t\t{ media }\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\tmedia\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nfunction PostStatusField( { item } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"posts-list-page-post-author-field__icon-container\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction PostAuthorField( { item, viewType } ) {\n\tconst { text, icon, imageUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\tconst user = getUser( item.author );\n\t\t\treturn {\n\t\t\t\ticon: authorIcon,\n\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\ttext: user?.name,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tconst withAuthorImage = viewType !== LAYOUT_LIST && imageUrl;\n\tconst withAuthorIcon = viewType !== LAYOUT_LIST && ! imageUrl;\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ withAuthorImage && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ withAuthorIcon && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default function PostsList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst onSelectionChange = useCallback(\n\t\t( items ) => {\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif (\n\t\t\t\t( params.isCustom ?? 'false' ) === 'false' &&\n\t\t\t\tview?.type === LAYOUT_LIST\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ].id : undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, view?.type ]\n\t);\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\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...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingMainEntities,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', postType, queryArgs );\n\n\tconst ids = records?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user', { per_page: -1 } );\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 { frontPageId, postsPageId, labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst postTypeObject = getPostType( postType );\n\t\t\treturn {\n\t\t\t\tfrontPageId: siteSettings?.page_on_front,\n\t\t\t\tpostsPageId: siteSettings?.page_for_posts,\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\tpostTypeObject?.rest_base || 'posts'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// TODO: this should be abstracted into a hook similar to `usePostActions`.\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 } ) => (\n\t\t\t\t\t<FeaturedImage item={ item } viewType={ view.type } />\n\t\t\t\t),\n\t\t\t\tenableSorting: false,\n\t\t\t\twidth: '1%',\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,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst addLink =\n\t\t\t\t\t\t[ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) &&\n\t\t\t\t\t\titem.status !== 'trash';\n\t\t\t\t\tconst title = addLink ? (\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t);\n\n\t\t\t\t\tlet suffix = '';\n\t\t\t\t\tif ( item.id === frontPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"posts-list-page-title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Front Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( item.id === postsPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"posts-list-page-title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tclassName=\"posts-list-page-title\"\n\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 300,\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\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\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PostAuthorField viewType={ view.type } item={ item } />\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\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\telements: STATUSES,\n\t\t\t\trender: PostStatusField,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IS_ANY ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst isDraftOrPrivate = [ 'draft', 'private' ].includes(\n\t\t\t\t\t\titem.status\n\t\t\t\t\t);\n\t\t\t\t\tif ( isDraftOrPrivate ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isScheduled = item.status === 'future';\n\t\t\t\t\tif ( isScheduled ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Scheduled: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Pending & Published posts show the modified date if it's newer.\n\t\t\t\t\tconst dateToDisplay =\n\t\t\t\t\t\tgetDate( item.modified ) > getDate( item.date )\n\t\t\t\t\t\t\t? item.modified\n\t\t\t\t\t\t\t: item.date;\n\n\t\t\t\t\tconst isPending = item.status === 'pending';\n\t\t\t\t\tif ( isPending ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isPublished = item.status === 'publish';\n\t\t\t\t\tif ( isPublished ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Published: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Unknow status.\n\t\t\t\t\treturn <time>{ getFormattedDate( item.date ) }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, view.type, frontPageId, postsPageId ]\n\t);\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\tnewView = {\n\t\t\t\t\t...newView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ newView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\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}\n\t\t>\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={ records || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingMainEntities || isLoadingAuthors }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tselection={ selection }\n\t\t\t\tsetSelection={ setSelection }\n\t\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAA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ED,oBACC,IAAAtO,WAAA,CAAAuG,GAAA,EAACjH,KAAA,CAAAiB,OAAI;IACJqG,KAAK,EAAG0E,MAAM,EAAExD,IAAM;IACtBkG,OAAO,EACN1C,MAAM,EAAEkD,YAAY,IACpBjD,eAAe,iBACd,IAAAvL,WAAA,CAAAiH,IAAA,EAAAjH,WAAA,CAAAyO,QAAA;MAAA9H,QAAA,gBACC,IAAA3G,WAAA,CAAAuG,GAAA,EAAC5H,WAAA,CAAA+P,MAAM;QACNC,OAAO,EAAC,SAAS;QACjB7I,OAAO,EAAGuI,SAAW;QACrBO,qBAAqB;QAAAjI,QAAA,EAEnB2E,MAAM,CAACkD;MAAY,CACd,CAAC,EACPL,gBAAgB,iBACjB,IAAAnO,WAAA,CAAAuG,GAAA,EAAC5G,WAAA,CAAAY,OAAe;QACf6B,QAAQ,EAAGA,QAAU;QACrByM,MAAM,EAAGN,aAAe;QACxBO,OAAO,EAAGR;MAAY,CACtB,CACD;IAAA,CACA,CAEH;IAAA3H,QAAA,eAED,IAAA3G,WAAA,CAAAuG,GAAA,EAACpH,UAAA,CAAA4P,SAAS;MACT5D,cAAc,EAAGA,cAAgB;MACjCa,MAAM,EAAGA,MAAQ;MACjBgC,OAAO,EAAGA,OAAS;MACnBgB,IAAI,EAAG7E,OAAO,IAAIxI,WAAa;MAC/BsN,SAAS,EAAG5E,qBAAqB,IAAIa,gBAAkB;MACvDjI,IAAI,EAAGA,IAAM;MACbgL,YAAY,EAAGA,YAAc;MAC7BvF,SAAS,EAAGA,SAAW;MACvBC,YAAY,EAAGA,YAAc;MAC7BC,iBAAiB,EAAGA,iBAAmB;MACvC9B,SAAS,EAAGA;IAAW,CACvB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = useLayoutAreas;
|
|
8
|
+
var _router = require("@wordpress/router");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _coreData = require("@wordpress/core-data");
|
|
11
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
12
|
+
var _editor = _interopRequireDefault(require("../editor"));
|
|
13
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
14
|
+
var _sidebarNavigationScreenMain = _interopRequireDefault(require("../sidebar-navigation-screen-main"));
|
|
15
|
+
var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
|
|
16
|
+
var _postsList = _interopRequireDefault(require("../posts-app/posts-list"));
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
useLocation
|
|
28
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
29
|
+
function useLayoutAreas() {
|
|
30
|
+
const {
|
|
31
|
+
params = {}
|
|
32
|
+
} = useLocation();
|
|
33
|
+
const {
|
|
34
|
+
postType,
|
|
35
|
+
layout,
|
|
36
|
+
canvas
|
|
37
|
+
} = params;
|
|
38
|
+
const labels = (0, _data.useSelect)(select => {
|
|
39
|
+
return select(_coreData.store).getPostType(postType)?.labels;
|
|
40
|
+
}, [postType]);
|
|
41
|
+
|
|
42
|
+
// Posts list.
|
|
43
|
+
if (['post'].includes(postType)) {
|
|
44
|
+
const isListLayout = layout === 'list' || !layout;
|
|
45
|
+
return {
|
|
46
|
+
key: 'posts-list',
|
|
47
|
+
areas: {
|
|
48
|
+
sidebar: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreen.default, {
|
|
49
|
+
title: labels?.name,
|
|
50
|
+
isRoot: true,
|
|
51
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarDataviews.default, {})
|
|
52
|
+
}),
|
|
53
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsList.default, {
|
|
54
|
+
postType: postType
|
|
55
|
+
}),
|
|
56
|
+
preview: (isListLayout || canvas === 'edit') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
|
|
57
|
+
isPostsList: true
|
|
58
|
+
}),
|
|
59
|
+
mobile: canvas === 'edit' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
|
|
60
|
+
isPostsList: true
|
|
61
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsList.default, {
|
|
62
|
+
postType: postType
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
widths: {
|
|
66
|
+
content: isListLayout ? 380 : undefined
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Fallback shows the home page preview
|
|
72
|
+
return {
|
|
73
|
+
key: 'default',
|
|
74
|
+
areas: {
|
|
75
|
+
sidebar: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreenMain.default, {}),
|
|
76
|
+
preview: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
|
|
77
|
+
isPostsList: true
|
|
78
|
+
}),
|
|
79
|
+
mobile: canvas === 'edit' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
|
|
80
|
+
isPostsList: true
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_router","require","_data","_coreData","_lockUnlock","_editor","_interopRequireDefault","_sidebarNavigationScreen","_sidebarNavigationScreenMain","_sidebarDataviews","_postsList","_jsxRuntime","useLocation","unlock","routerPrivateApis","useLayoutAreas","params","postType","layout","canvas","labels","useSelect","select","coreStore","getPostType","includes","isListLayout","key","areas","sidebar","jsx","default","title","name","isRoot","content","preview","isPostsList","mobile","widths","undefined"],"sources":["@wordpress/edit-site/src/components/posts-app/router.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport Editor from '../editor';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport PostsList from '../posts-app/posts-list';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useLayoutAreas() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, layout, canvas } = params;\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Posts list.\n\tif ( [ 'post' ].includes( postType ) ) {\n\t\tconst isListLayout = layout === 'list' || ! layout;\n\t\treturn {\n\t\t\tkey: 'posts-list',\n\t\t\tareas: {\n\t\t\t\tsidebar: (\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ labels?.name }\n\t\t\t\t\t\tisRoot\n\t\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tcontent: <PostsList postType={ postType } />,\n\t\t\t\tpreview: ( isListLayout || canvas === 'edit' ) && (\n\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t),\n\t\t\t\tmobile:\n\t\t\t\t\tcanvas === 'edit' ? (\n\t\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PostsList postType={ postType } />\n\t\t\t\t\t),\n\t\t\t},\n\t\t\twidths: {\n\t\t\t\tcontent: isListLayout ? 380 : undefined,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Fallback shows the home page preview\n\treturn {\n\t\tkey: 'default',\n\t\tareas: {\n\t\t\tsidebar: <SidebarNavigationScreenMain />,\n\t\t\tpreview: <Editor isPostsList />,\n\t\t\tmobile: canvas === 'edit' && <Editor isPostsList />,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,4BAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,iBAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,UAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAAgD,IAAAU,WAAA,GAAAV,OAAA;AAfhD;AACA;AACA;;AAKA;AACA;AACA;;AAQA,MAAM;EAAEW;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEpC,SAASC,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGJ,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEK,QAAQ;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAC3C,MAAMI,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IAAM;IACb,OAAOA,MAAM,CAAEC,eAAU,CAAC,CAACC,WAAW,CAAEP,QAAS,CAAC,EAAEG,MAAM;EAC3D,CAAC,EACD,CAAEH,QAAQ,CACX,CAAC;;EAED;EACA,IAAK,CAAE,MAAM,CAAE,CAACQ,QAAQ,CAAER,QAAS,CAAC,EAAG;IACtC,MAAMS,YAAY,GAAGR,MAAM,KAA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