@wordpress/edit-site 6.42.0 → 6.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/page-patterns/index.cjs +7 -27
- package/build/components/page-patterns/index.cjs.map +2 -2
- package/build/components/page-templates/index-legacy.cjs +13 -6
- package/build/components/page-templates/index-legacy.cjs.map +2 -2
- package/build/components/post-list/index.cjs +15 -6
- package/build/components/post-list/index.cjs.map +2 -2
- package/build/components/post-list/quick-edit-modal.cjs +16 -48
- package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
- package/build/components/sidebar-dataviews/index.cjs +37 -25
- package/build/components/sidebar-dataviews/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-patterns/index.cjs +55 -47
- package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs +33 -56
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +3 -3
- package/build/components/site-editor-routes/home.cjs +8 -4
- package/build/components/site-editor-routes/home.cjs.map +2 -2
- package/build/components/site-editor-routes/navigation-item.cjs +13 -6
- package/build/components/site-editor-routes/navigation-item.cjs.map +2 -2
- package/build/components/site-editor-routes/navigation.cjs +9 -4
- package/build/components/site-editor-routes/navigation.cjs.map +2 -2
- package/build/components/site-editor-routes/page-item.cjs +13 -6
- package/build/components/site-editor-routes/page-item.cjs.map +2 -2
- package/build/components/site-editor-routes/pages.cjs +21 -7
- package/build/components/site-editor-routes/pages.cjs.map +3 -3
- package/build/components/site-editor-routes/stylebook.cjs +17 -2
- package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
- package/build/components/site-editor-routes/template-item.cjs +13 -6
- package/build/components/site-editor-routes/template-item.cjs.map +2 -2
- package/build/components/site-editor-routes/templates.cjs +20 -7
- package/build/components/site-editor-routes/templates.cjs.map +3 -3
- package/build/components/site-editor-routes/utils.cjs +7 -2
- package/build/components/site-editor-routes/utils.cjs.map +2 -2
- package/build-module/components/page-patterns/index.mjs +8 -30
- package/build-module/components/page-patterns/index.mjs.map +2 -2
- package/build-module/components/page-templates/index-legacy.mjs +14 -11
- package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
- package/build-module/components/post-list/index.mjs +16 -11
- package/build-module/components/post-list/index.mjs.map +2 -2
- package/build-module/components/post-list/quick-edit-modal.mjs +16 -48
- package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
- package/build-module/components/sidebar-dataviews/index.mjs +45 -25
- package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +55 -47
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs +41 -59
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +2 -2
- package/build-module/components/site-editor-routes/home.mjs +10 -6
- package/build-module/components/site-editor-routes/home.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation-item.mjs +14 -7
- package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/navigation.mjs +10 -5
- package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
- package/build-module/components/site-editor-routes/page-item.mjs +14 -7
- package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/pages.mjs +22 -11
- package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
- package/build-module/components/site-editor-routes/stylebook.mjs +18 -3
- package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
- package/build-module/components/site-editor-routes/template-item.mjs +14 -7
- package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
- package/build-module/components/site-editor-routes/templates.mjs +21 -11
- package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
- package/build-module/components/site-editor-routes/utils.mjs +5 -1
- package/build-module/components/site-editor-routes/utils.mjs.map +2 -2
- package/build-style/style-rtl.css +60 -49
- package/build-style/style.css +60 -49
- package/package.json +46 -46
- package/src/components/page-patterns/index.js +9 -30
- package/src/components/page-templates/index-legacy.js +14 -11
- package/src/components/post-list/index.js +16 -10
- package/src/components/post-list/quick-edit-modal.js +19 -54
- package/src/components/post-list/style.scss +2 -0
- package/src/components/sidebar-dataviews/index.js +48 -26
- package/src/components/sidebar-dataviews/style.scss +0 -16
- package/src/components/sidebar-navigation-screen-patterns/index.js +62 -55
- package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +44 -64
- package/src/components/site-editor-routes/home.js +9 -5
- package/src/components/site-editor-routes/navigation-item.js +13 -6
- package/src/components/site-editor-routes/navigation.js +9 -4
- package/src/components/site-editor-routes/page-item.js +13 -6
- package/src/components/site-editor-routes/pages.js +21 -10
- package/src/components/site-editor-routes/stylebook.js +12 -3
- package/src/components/site-editor-routes/template-item.js +13 -6
- package/src/components/site-editor-routes/templates.js +21 -10
- package/src/components/site-editor-routes/utils.js +12 -0
- package/build/components/post-list/view-utils.cjs +0 -202
- package/build/components/post-list/view-utils.cjs.map +0 -7
- package/build/components/sidebar-dataviews/dataview-item.cjs +0 -82
- package/build/components/sidebar-dataviews/dataview-item.cjs.map +0 -7
- package/build-module/components/post-list/view-utils.mjs +0 -182
- package/build-module/components/post-list/view-utils.mjs.map +0 -7
- package/build-module/components/sidebar-dataviews/dataview-item.mjs +0 -51
- package/build-module/components/sidebar-dataviews/dataview-item.mjs.map +0 -7
- package/src/components/post-list/view-utils.js +0 -187
- package/src/components/sidebar-dataviews/dataview-item.js +0 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.43.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -48,50 +48,50 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@react-spring/web": "^9.4.5",
|
|
51
|
-
"@wordpress/a11y": "^4.
|
|
52
|
-
"@wordpress/admin-ui": "^1.
|
|
53
|
-
"@wordpress/api-fetch": "^7.
|
|
54
|
-
"@wordpress/base-styles": "^6.
|
|
55
|
-
"@wordpress/blob": "^4.
|
|
56
|
-
"@wordpress/block-editor": "^15.
|
|
57
|
-
"@wordpress/block-library": "^9.
|
|
58
|
-
"@wordpress/blocks": "^15.
|
|
59
|
-
"@wordpress/commands": "^1.
|
|
60
|
-
"@wordpress/components": "^32.
|
|
61
|
-
"@wordpress/compose": "^7.
|
|
62
|
-
"@wordpress/core-data": "^7.
|
|
63
|
-
"@wordpress/data": "^10.
|
|
64
|
-
"@wordpress/dataviews": "^
|
|
65
|
-
"@wordpress/date": "^5.
|
|
66
|
-
"@wordpress/deprecated": "^4.
|
|
67
|
-
"@wordpress/dom": "^4.
|
|
68
|
-
"@wordpress/editor": "^14.
|
|
69
|
-
"@wordpress/element": "^6.
|
|
70
|
-
"@wordpress/escape-html": "^3.
|
|
71
|
-
"@wordpress/fields": "^0.
|
|
72
|
-
"@wordpress/global-styles-engine": "^1.
|
|
73
|
-
"@wordpress/global-styles-ui": "^1.
|
|
74
|
-
"@wordpress/hooks": "^4.
|
|
75
|
-
"@wordpress/html-entities": "^4.
|
|
76
|
-
"@wordpress/i18n": "^6.
|
|
77
|
-
"@wordpress/icons": "^12.
|
|
78
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
79
|
-
"@wordpress/keycodes": "^4.
|
|
80
|
-
"@wordpress/media-utils": "^5.
|
|
81
|
-
"@wordpress/notices": "^5.
|
|
82
|
-
"@wordpress/patterns": "^2.
|
|
83
|
-
"@wordpress/plugins": "^7.
|
|
84
|
-
"@wordpress/preferences": "^4.
|
|
85
|
-
"@wordpress/primitives": "^4.
|
|
86
|
-
"@wordpress/private-apis": "^1.
|
|
87
|
-
"@wordpress/reusable-blocks": "^5.
|
|
88
|
-
"@wordpress/router": "^1.
|
|
89
|
-
"@wordpress/style-engine": "^2.
|
|
90
|
-
"@wordpress/url": "^4.
|
|
91
|
-
"@wordpress/viewport": "^6.
|
|
92
|
-
"@wordpress/views": "^1.
|
|
93
|
-
"@wordpress/widgets": "^4.
|
|
94
|
-
"@wordpress/wordcount": "^4.
|
|
51
|
+
"@wordpress/a11y": "^4.43.0",
|
|
52
|
+
"@wordpress/admin-ui": "^1.11.0",
|
|
53
|
+
"@wordpress/api-fetch": "^7.43.0",
|
|
54
|
+
"@wordpress/base-styles": "^6.19.0",
|
|
55
|
+
"@wordpress/blob": "^4.43.0",
|
|
56
|
+
"@wordpress/block-editor": "^15.16.0",
|
|
57
|
+
"@wordpress/block-library": "^9.43.0",
|
|
58
|
+
"@wordpress/blocks": "^15.16.0",
|
|
59
|
+
"@wordpress/commands": "^1.43.0",
|
|
60
|
+
"@wordpress/components": "^32.5.0",
|
|
61
|
+
"@wordpress/compose": "^7.43.0",
|
|
62
|
+
"@wordpress/core-data": "^7.43.0",
|
|
63
|
+
"@wordpress/data": "^10.43.0",
|
|
64
|
+
"@wordpress/dataviews": "^14.0.0",
|
|
65
|
+
"@wordpress/date": "^5.43.0",
|
|
66
|
+
"@wordpress/deprecated": "^4.43.0",
|
|
67
|
+
"@wordpress/dom": "^4.43.0",
|
|
68
|
+
"@wordpress/editor": "^14.43.0",
|
|
69
|
+
"@wordpress/element": "^6.43.0",
|
|
70
|
+
"@wordpress/escape-html": "^3.43.0",
|
|
71
|
+
"@wordpress/fields": "^0.35.0",
|
|
72
|
+
"@wordpress/global-styles-engine": "^1.10.0",
|
|
73
|
+
"@wordpress/global-styles-ui": "^1.10.0",
|
|
74
|
+
"@wordpress/hooks": "^4.43.0",
|
|
75
|
+
"@wordpress/html-entities": "^4.43.0",
|
|
76
|
+
"@wordpress/i18n": "^6.16.0",
|
|
77
|
+
"@wordpress/icons": "^12.1.0",
|
|
78
|
+
"@wordpress/keyboard-shortcuts": "^5.43.0",
|
|
79
|
+
"@wordpress/keycodes": "^4.43.0",
|
|
80
|
+
"@wordpress/media-utils": "^5.43.0",
|
|
81
|
+
"@wordpress/notices": "^5.43.0",
|
|
82
|
+
"@wordpress/patterns": "^2.43.0",
|
|
83
|
+
"@wordpress/plugins": "^7.43.0",
|
|
84
|
+
"@wordpress/preferences": "^4.43.0",
|
|
85
|
+
"@wordpress/primitives": "^4.43.0",
|
|
86
|
+
"@wordpress/private-apis": "^1.43.0",
|
|
87
|
+
"@wordpress/reusable-blocks": "^5.43.0",
|
|
88
|
+
"@wordpress/router": "^1.43.0",
|
|
89
|
+
"@wordpress/style-engine": "^2.43.0",
|
|
90
|
+
"@wordpress/url": "^4.43.0",
|
|
91
|
+
"@wordpress/viewport": "^6.43.0",
|
|
92
|
+
"@wordpress/views": "^1.10.0",
|
|
93
|
+
"@wordpress/widgets": "^4.43.0",
|
|
94
|
+
"@wordpress/wordcount": "^4.43.0",
|
|
95
95
|
"change-case": "^4.1.2",
|
|
96
96
|
"clsx": "^2.1.1",
|
|
97
97
|
"colord": "^2.9.2",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "2cea90674d11aa521ec3f71652fb3a6a4c383969"
|
|
110
110
|
}
|
|
@@ -9,7 +9,7 @@ import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
|
|
|
9
9
|
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
10
10
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
11
11
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
|
-
import { useView } from '@wordpress/views';
|
|
12
|
+
import { useView, useViewConfig } from '@wordpress/views';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { addQueryArgs } from '@wordpress/url';
|
|
15
15
|
|
|
@@ -17,8 +17,6 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
19
|
import {
|
|
20
|
-
LAYOUT_GRID,
|
|
21
|
-
LAYOUT_TABLE,
|
|
22
20
|
PATTERN_TYPES,
|
|
23
21
|
TEMPLATE_PART_POST_TYPE,
|
|
24
22
|
PATTERN_DEFAULT_CATEGORY,
|
|
@@ -40,31 +38,6 @@ const { usePostActions, patternTitleField } = unlock( editorPrivateApis );
|
|
|
40
38
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
41
39
|
|
|
42
40
|
const EMPTY_ARRAY = [];
|
|
43
|
-
const defaultLayouts = {
|
|
44
|
-
[ LAYOUT_TABLE ]: {
|
|
45
|
-
layout: {
|
|
46
|
-
styles: {
|
|
47
|
-
author: {
|
|
48
|
-
width: '1%',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
[ LAYOUT_GRID ]: {
|
|
54
|
-
layout: {
|
|
55
|
-
badgeFields: [ 'sync-status' ],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
const DEFAULT_VIEW = {
|
|
60
|
-
type: LAYOUT_GRID,
|
|
61
|
-
perPage: 20,
|
|
62
|
-
titleField: 'title',
|
|
63
|
-
mediaField: 'preview',
|
|
64
|
-
fields: [ 'sync-status' ],
|
|
65
|
-
filters: [],
|
|
66
|
-
...defaultLayouts[ LAYOUT_GRID ],
|
|
67
|
-
};
|
|
68
41
|
|
|
69
42
|
function usePagePatternsHeader( type, categoryId ) {
|
|
70
43
|
const { patternCategories } = usePatternCategories();
|
|
@@ -99,11 +72,17 @@ export default function DataviewsPatterns() {
|
|
|
99
72
|
const { postType = 'wp_block', categoryId: categoryIdFromURL } = query;
|
|
100
73
|
const history = useHistory();
|
|
101
74
|
const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
|
|
75
|
+
const { default_view: defaultView, default_layouts: defaultLayouts } =
|
|
76
|
+
useViewConfig( {
|
|
77
|
+
kind: 'postType',
|
|
78
|
+
name: postType,
|
|
79
|
+
} );
|
|
102
80
|
const { view, updateView, isModified, resetToDefault } = useView( {
|
|
103
81
|
kind: 'postType',
|
|
104
82
|
name: postType,
|
|
105
83
|
slug: 'default',
|
|
106
|
-
defaultView
|
|
84
|
+
defaultView,
|
|
85
|
+
defaultLayouts,
|
|
107
86
|
queryParams: {
|
|
108
87
|
page: query.pageNumber,
|
|
109
88
|
search: query.search,
|
|
@@ -235,7 +214,7 @@ export default function DataviewsPatterns() {
|
|
|
235
214
|
} }
|
|
236
215
|
view={ view }
|
|
237
216
|
onChangeView={ updateView }
|
|
238
|
-
defaultLayouts={ defaultLayouts }
|
|
217
|
+
defaultLayouts={ defaultLayouts ?? {} }
|
|
239
218
|
onReset={ isModified ? resetToDefault : false }
|
|
240
219
|
/>
|
|
241
220
|
</Page>
|
|
@@ -10,7 +10,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
10
10
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
11
11
|
import { addQueryArgs } from '@wordpress/url';
|
|
12
12
|
import { useEvent } from '@wordpress/compose';
|
|
13
|
-
import { useView } from '@wordpress/views';
|
|
13
|
+
import { useView, useViewConfig } from '@wordpress/views';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -20,11 +20,6 @@ import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
|
20
20
|
import { unlock } from '../../lock-unlock';
|
|
21
21
|
import { useEditPostAction } from '../dataviews-actions';
|
|
22
22
|
import { authorField, descriptionField, previewField } from './fields';
|
|
23
|
-
import {
|
|
24
|
-
defaultLayouts,
|
|
25
|
-
DEFAULT_VIEW,
|
|
26
|
-
getActiveViewOverridesForTab,
|
|
27
|
-
} from './view-utils';
|
|
28
23
|
|
|
29
24
|
const { usePostActions, templateTitleField } = unlock( editorPrivateApis );
|
|
30
25
|
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
@@ -32,13 +27,20 @@ const { useEntityRecordsWithPermissions } = unlock( corePrivateApis );
|
|
|
32
27
|
|
|
33
28
|
export default function PageTemplates() {
|
|
34
29
|
const { path, query } = useLocation();
|
|
35
|
-
const { activeView = '
|
|
30
|
+
const { activeView = 'all', postId } = query;
|
|
36
31
|
const [ selection, setSelection ] = useState( [ postId ] );
|
|
37
32
|
|
|
38
|
-
const
|
|
33
|
+
const {
|
|
34
|
+
default_view: defaultView,
|
|
35
|
+
default_layouts: defaultLayouts,
|
|
36
|
+
view_list: viewList,
|
|
37
|
+
} = useViewConfig( {
|
|
38
|
+
kind: 'postType',
|
|
39
|
+
name: TEMPLATE_POST_TYPE,
|
|
40
|
+
} );
|
|
39
41
|
const activeViewOverrides = useMemo(
|
|
40
|
-
() =>
|
|
41
|
-
[ activeView ]
|
|
42
|
+
() => viewList?.find( ( v ) => v.slug === activeView )?.view ?? {},
|
|
43
|
+
[ viewList, activeView ]
|
|
42
44
|
);
|
|
43
45
|
const { view, updateView, isModified, resetToDefault } = useView( {
|
|
44
46
|
kind: 'postType',
|
|
@@ -46,6 +48,7 @@ export default function PageTemplates() {
|
|
|
46
48
|
slug: 'default',
|
|
47
49
|
defaultView,
|
|
48
50
|
activeViewOverrides,
|
|
51
|
+
defaultLayouts,
|
|
49
52
|
queryParams: {
|
|
50
53
|
page: query.pageNumber,
|
|
51
54
|
search: query.search,
|
|
@@ -150,7 +153,7 @@ export default function PageTemplates() {
|
|
|
150
153
|
history.navigate( `/wp_template/${ id }?canvas=edit` );
|
|
151
154
|
} }
|
|
152
155
|
selection={ selection }
|
|
153
|
-
defaultLayouts={ defaultLayouts }
|
|
156
|
+
defaultLayouts={ defaultLayouts ?? {} }
|
|
154
157
|
onReset={
|
|
155
158
|
isModified
|
|
156
159
|
? () => {
|
|
@@ -14,7 +14,7 @@ import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
|
|
|
14
14
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
15
15
|
import { useEvent, usePrevious } from '@wordpress/compose';
|
|
16
16
|
import { addQueryArgs } from '@wordpress/url';
|
|
17
|
-
import { useView } from '@wordpress/views';
|
|
17
|
+
import { useView, useViewConfig } from '@wordpress/views';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal dependencies
|
|
@@ -33,11 +33,7 @@ import {
|
|
|
33
33
|
useEditPostAction,
|
|
34
34
|
useQuickEditPostAction,
|
|
35
35
|
} from '../dataviews-actions';
|
|
36
|
-
|
|
37
|
-
defaultLayouts,
|
|
38
|
-
DEFAULT_VIEW,
|
|
39
|
-
getActiveViewOverridesForTab,
|
|
40
|
-
} from './view-utils';
|
|
36
|
+
|
|
41
37
|
import useNotesCount from './use-notes-count';
|
|
42
38
|
import { QuickEditModal } from './quick-edit-modal';
|
|
43
39
|
|
|
@@ -60,16 +56,25 @@ export default function PostList( { postType } ) {
|
|
|
60
56
|
const { path, query } = useLocation();
|
|
61
57
|
const { activeView = 'all', postId, quickEdit = false } = query;
|
|
62
58
|
const history = useHistory();
|
|
63
|
-
const
|
|
59
|
+
const {
|
|
60
|
+
default_view: defaultView,
|
|
61
|
+
default_layouts: defaultLayouts,
|
|
62
|
+
view_list: viewList,
|
|
63
|
+
form: quickEditForm,
|
|
64
|
+
} = useViewConfig( {
|
|
65
|
+
kind: 'postType',
|
|
66
|
+
name: postType,
|
|
67
|
+
} );
|
|
64
68
|
const activeViewOverrides = useMemo(
|
|
65
|
-
() =>
|
|
66
|
-
[ activeView ]
|
|
69
|
+
() => viewList?.find( ( v ) => v.slug === activeView )?.view ?? {},
|
|
70
|
+
[ viewList, activeView ]
|
|
67
71
|
);
|
|
68
72
|
const { view, updateView, isModified, resetToDefault } = useView( {
|
|
69
73
|
kind: 'postType',
|
|
70
74
|
name: postType,
|
|
71
75
|
slug: 'default',
|
|
72
76
|
defaultView,
|
|
77
|
+
defaultLayouts,
|
|
73
78
|
activeViewOverrides,
|
|
74
79
|
queryParams: {
|
|
75
80
|
page: query.pageNumber,
|
|
@@ -317,7 +322,7 @@ export default function PostList( { postType } ) {
|
|
|
317
322
|
} }
|
|
318
323
|
getItemId={ getItemId }
|
|
319
324
|
getItemLevel={ getItemLevel }
|
|
320
|
-
defaultLayouts={ defaultLayouts }
|
|
325
|
+
defaultLayouts={ defaultLayouts ?? {} }
|
|
321
326
|
onReset={
|
|
322
327
|
isModified
|
|
323
328
|
? () => {
|
|
@@ -335,6 +340,7 @@ export default function PostList( { postType } ) {
|
|
|
335
340
|
postType={ postType }
|
|
336
341
|
postId={ selection }
|
|
337
342
|
closeModal={ closeQuickEditModal }
|
|
343
|
+
quickEditForm={ quickEditForm }
|
|
338
344
|
/>
|
|
339
345
|
) }
|
|
340
346
|
</Page>
|
|
@@ -22,7 +22,12 @@ const { usePostFields, PostCardPanel } = unlock( editorPrivateApis );
|
|
|
22
22
|
|
|
23
23
|
const fieldsWithBulkEditSupport = [ 'status', 'date', 'author', 'discussion' ];
|
|
24
24
|
|
|
25
|
-
export function QuickEditModal( {
|
|
25
|
+
export function QuickEditModal( {
|
|
26
|
+
postType,
|
|
27
|
+
postId,
|
|
28
|
+
closeModal,
|
|
29
|
+
quickEditForm,
|
|
30
|
+
} ) {
|
|
26
31
|
const isBulk = postId.length > 1;
|
|
27
32
|
|
|
28
33
|
const [ localEdits, setLocalEdits ] = useState( {} );
|
|
@@ -93,61 +98,21 @@ export function QuickEditModal( { postType, postId, closeModal } ) {
|
|
|
93
98
|
);
|
|
94
99
|
|
|
95
100
|
const form = useMemo( () => {
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: 'post-content-info',
|
|
106
|
-
layout: { type: 'regular', labelPosition: 'none' },
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
id: 'status',
|
|
110
|
-
label: __( 'Status' ),
|
|
111
|
-
children: [
|
|
112
|
-
{
|
|
113
|
-
id: 'status',
|
|
114
|
-
layout: { type: 'regular', labelPosition: 'none' },
|
|
115
|
-
},
|
|
116
|
-
'scheduled_date',
|
|
117
|
-
'password',
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
'author',
|
|
121
|
-
'date',
|
|
122
|
-
'slug',
|
|
123
|
-
'parent',
|
|
124
|
-
{
|
|
125
|
-
id: 'discussion',
|
|
126
|
-
label: __( 'Discussion' ),
|
|
127
|
-
children: [
|
|
128
|
-
{
|
|
129
|
-
id: 'comment_status',
|
|
130
|
-
layout: { type: 'regular', labelPosition: 'none' },
|
|
131
|
-
},
|
|
132
|
-
'ping_status',
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
'template',
|
|
136
|
-
];
|
|
137
|
-
|
|
101
|
+
if ( ! quickEditForm ) {
|
|
102
|
+
return { layout: { type: 'panel' }, fields: [] };
|
|
103
|
+
}
|
|
104
|
+
if ( ! isBulk ) {
|
|
105
|
+
return quickEditForm;
|
|
106
|
+
}
|
|
138
107
|
return {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
typeof field === 'string' ? field : field.id
|
|
146
|
-
)
|
|
147
|
-
)
|
|
148
|
-
: allFields,
|
|
108
|
+
...quickEditForm,
|
|
109
|
+
fields: ( quickEditForm.fields ?? [] ).filter( ( field ) =>
|
|
110
|
+
fieldsWithBulkEditSupport.includes(
|
|
111
|
+
typeof field === 'string' ? field : field.id
|
|
112
|
+
)
|
|
113
|
+
),
|
|
149
114
|
};
|
|
150
|
-
}, [ isBulk ] );
|
|
115
|
+
}, [ isBulk, quickEditForm ] );
|
|
151
116
|
|
|
152
117
|
const onChange = ( edits ) => {
|
|
153
118
|
const currentData = { ...record, ...localEdits };
|
|
@@ -3,34 +3,51 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
5
5
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import {
|
|
7
|
+
trash,
|
|
8
|
+
pages,
|
|
9
|
+
drafts,
|
|
10
|
+
published,
|
|
11
|
+
scheduled,
|
|
12
|
+
pending,
|
|
13
|
+
notAllowed,
|
|
14
|
+
} from '@wordpress/icons';
|
|
15
|
+
import { useViewConfig } from '@wordpress/views';
|
|
16
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* Internal dependencies
|
|
12
20
|
*/
|
|
13
21
|
import { unlock } from '../../lock-unlock';
|
|
14
|
-
import
|
|
15
|
-
import { getDefaultViews } from '../post-list/view-utils';
|
|
22
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
16
23
|
|
|
17
24
|
const { useLocation } = unlock( routerPrivateApis );
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
const SLUG_TO_ICON = {
|
|
27
|
+
all: pages,
|
|
28
|
+
published,
|
|
29
|
+
future: scheduled,
|
|
30
|
+
drafts,
|
|
31
|
+
pending,
|
|
32
|
+
private: notAllowed,
|
|
33
|
+
trash,
|
|
34
|
+
};
|
|
35
|
+
const defaultResolveIcon = ( view ) => {
|
|
36
|
+
return SLUG_TO_ICON[ view.slug ];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default function DataViewsSidebarContent( {
|
|
40
|
+
postType,
|
|
41
|
+
resolveIcon = defaultResolveIcon,
|
|
42
|
+
} ) {
|
|
20
43
|
const {
|
|
44
|
+
path,
|
|
21
45
|
query: { activeView = 'all' },
|
|
22
46
|
} = useLocation();
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
[ postType ]
|
|
29
|
-
);
|
|
30
|
-
const defaultViews = useMemo(
|
|
31
|
-
() => getDefaultViews( postTypeObject ),
|
|
32
|
-
[ postTypeObject ]
|
|
33
|
-
);
|
|
47
|
+
const { view_list: viewList } = useViewConfig( {
|
|
48
|
+
kind: 'postType',
|
|
49
|
+
name: postType,
|
|
50
|
+
} );
|
|
34
51
|
if ( ! postType ) {
|
|
35
52
|
return null;
|
|
36
53
|
}
|
|
@@ -38,16 +55,21 @@ export default function DataViewsSidebarContent( { postType } ) {
|
|
|
38
55
|
return (
|
|
39
56
|
<>
|
|
40
57
|
<ItemGroup className="edit-site-sidebar-dataviews">
|
|
41
|
-
{
|
|
58
|
+
{ viewList?.map( ( view ) => {
|
|
59
|
+
const isActive = view.slug === activeView;
|
|
60
|
+
const slug = view.slug === 'all' ? undefined : view.slug;
|
|
61
|
+
const icon = resolveIcon( view );
|
|
42
62
|
return (
|
|
43
|
-
<
|
|
44
|
-
key={
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
<SidebarNavigationItem
|
|
64
|
+
key={ view.slug }
|
|
65
|
+
icon={ icon }
|
|
66
|
+
to={ addQueryArgs( path, {
|
|
67
|
+
activeView: slug,
|
|
68
|
+
} ) }
|
|
69
|
+
aria-current={ isActive ? 'true' : undefined }
|
|
70
|
+
>
|
|
71
|
+
{ view.title }
|
|
72
|
+
</SidebarNavigationItem>
|
|
51
73
|
);
|
|
52
74
|
} ) }
|
|
53
75
|
</ItemGroup>
|
|
@@ -5,19 +5,3 @@
|
|
|
5
5
|
margin-left: -$grid-unit-20;
|
|
6
6
|
margin-right: -$grid-unit-20;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
.edit-site-sidebar-dataviews-dataview-item {
|
|
10
|
-
border-radius: $radius-small;
|
|
11
|
-
|
|
12
|
-
&:hover,
|
|
13
|
-
&:focus,
|
|
14
|
-
&[aria-current] {
|
|
15
|
-
color: $gray-200;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&.is-selected {
|
|
19
|
-
background: $gray-800;
|
|
20
|
-
font-weight: $font-weight-medium;
|
|
21
|
-
color: $white;
|
|
22
|
-
}
|
|
23
|
-
}
|