@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.
Files changed (96) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/page-patterns/index.cjs +7 -27
  3. package/build/components/page-patterns/index.cjs.map +2 -2
  4. package/build/components/page-templates/index-legacy.cjs +13 -6
  5. package/build/components/page-templates/index-legacy.cjs.map +2 -2
  6. package/build/components/post-list/index.cjs +15 -6
  7. package/build/components/post-list/index.cjs.map +2 -2
  8. package/build/components/post-list/quick-edit-modal.cjs +16 -48
  9. package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
  10. package/build/components/sidebar-dataviews/index.cjs +37 -25
  11. package/build/components/sidebar-dataviews/index.cjs.map +3 -3
  12. package/build/components/sidebar-navigation-screen-patterns/index.cjs +55 -47
  13. package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
  14. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs +33 -56
  15. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +3 -3
  16. package/build/components/site-editor-routes/home.cjs +8 -4
  17. package/build/components/site-editor-routes/home.cjs.map +2 -2
  18. package/build/components/site-editor-routes/navigation-item.cjs +13 -6
  19. package/build/components/site-editor-routes/navigation-item.cjs.map +2 -2
  20. package/build/components/site-editor-routes/navigation.cjs +9 -4
  21. package/build/components/site-editor-routes/navigation.cjs.map +2 -2
  22. package/build/components/site-editor-routes/page-item.cjs +13 -6
  23. package/build/components/site-editor-routes/page-item.cjs.map +2 -2
  24. package/build/components/site-editor-routes/pages.cjs +21 -7
  25. package/build/components/site-editor-routes/pages.cjs.map +3 -3
  26. package/build/components/site-editor-routes/stylebook.cjs +17 -2
  27. package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
  28. package/build/components/site-editor-routes/template-item.cjs +13 -6
  29. package/build/components/site-editor-routes/template-item.cjs.map +2 -2
  30. package/build/components/site-editor-routes/templates.cjs +20 -7
  31. package/build/components/site-editor-routes/templates.cjs.map +3 -3
  32. package/build/components/site-editor-routes/utils.cjs +7 -2
  33. package/build/components/site-editor-routes/utils.cjs.map +2 -2
  34. package/build-module/components/page-patterns/index.mjs +8 -30
  35. package/build-module/components/page-patterns/index.mjs.map +2 -2
  36. package/build-module/components/page-templates/index-legacy.mjs +14 -11
  37. package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
  38. package/build-module/components/post-list/index.mjs +16 -11
  39. package/build-module/components/post-list/index.mjs.map +2 -2
  40. package/build-module/components/post-list/quick-edit-modal.mjs +16 -48
  41. package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
  42. package/build-module/components/sidebar-dataviews/index.mjs +45 -25
  43. package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
  44. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +55 -47
  45. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
  46. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs +41 -59
  47. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +2 -2
  48. package/build-module/components/site-editor-routes/home.mjs +10 -6
  49. package/build-module/components/site-editor-routes/home.mjs.map +2 -2
  50. package/build-module/components/site-editor-routes/navigation-item.mjs +14 -7
  51. package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
  52. package/build-module/components/site-editor-routes/navigation.mjs +10 -5
  53. package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
  54. package/build-module/components/site-editor-routes/page-item.mjs +14 -7
  55. package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
  56. package/build-module/components/site-editor-routes/pages.mjs +22 -11
  57. package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
  58. package/build-module/components/site-editor-routes/stylebook.mjs +18 -3
  59. package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
  60. package/build-module/components/site-editor-routes/template-item.mjs +14 -7
  61. package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
  62. package/build-module/components/site-editor-routes/templates.mjs +21 -11
  63. package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
  64. package/build-module/components/site-editor-routes/utils.mjs +5 -1
  65. package/build-module/components/site-editor-routes/utils.mjs.map +2 -2
  66. package/build-style/style-rtl.css +60 -49
  67. package/build-style/style.css +60 -49
  68. package/package.json +46 -46
  69. package/src/components/page-patterns/index.js +9 -30
  70. package/src/components/page-templates/index-legacy.js +14 -11
  71. package/src/components/post-list/index.js +16 -10
  72. package/src/components/post-list/quick-edit-modal.js +19 -54
  73. package/src/components/post-list/style.scss +2 -0
  74. package/src/components/sidebar-dataviews/index.js +48 -26
  75. package/src/components/sidebar-dataviews/style.scss +0 -16
  76. package/src/components/sidebar-navigation-screen-patterns/index.js +62 -55
  77. package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +44 -64
  78. package/src/components/site-editor-routes/home.js +9 -5
  79. package/src/components/site-editor-routes/navigation-item.js +13 -6
  80. package/src/components/site-editor-routes/navigation.js +9 -4
  81. package/src/components/site-editor-routes/page-item.js +13 -6
  82. package/src/components/site-editor-routes/pages.js +21 -10
  83. package/src/components/site-editor-routes/stylebook.js +12 -3
  84. package/src/components/site-editor-routes/template-item.js +13 -6
  85. package/src/components/site-editor-routes/templates.js +21 -10
  86. package/src/components/site-editor-routes/utils.js +12 -0
  87. package/build/components/post-list/view-utils.cjs +0 -202
  88. package/build/components/post-list/view-utils.cjs.map +0 -7
  89. package/build/components/sidebar-dataviews/dataview-item.cjs +0 -82
  90. package/build/components/sidebar-dataviews/dataview-item.cjs.map +0 -7
  91. package/build-module/components/post-list/view-utils.mjs +0 -182
  92. package/build-module/components/post-list/view-utils.mjs.map +0 -7
  93. package/build-module/components/sidebar-dataviews/dataview-item.mjs +0 -51
  94. package/build-module/components/sidebar-dataviews/dataview-item.mjs.map +0 -7
  95. package/src/components/post-list/view-utils.js +0 -187
  96. 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.42.0",
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.42.0",
52
- "@wordpress/admin-ui": "^1.10.0",
53
- "@wordpress/api-fetch": "^7.42.0",
54
- "@wordpress/base-styles": "^6.18.0",
55
- "@wordpress/blob": "^4.42.0",
56
- "@wordpress/block-editor": "^15.15.0",
57
- "@wordpress/block-library": "^9.42.0",
58
- "@wordpress/blocks": "^15.15.0",
59
- "@wordpress/commands": "^1.42.0",
60
- "@wordpress/components": "^32.4.0",
61
- "@wordpress/compose": "^7.42.0",
62
- "@wordpress/core-data": "^7.42.0",
63
- "@wordpress/data": "^10.42.0",
64
- "@wordpress/dataviews": "^13.1.0",
65
- "@wordpress/date": "^5.42.0",
66
- "@wordpress/deprecated": "^4.42.0",
67
- "@wordpress/dom": "^4.42.0",
68
- "@wordpress/editor": "^14.42.0",
69
- "@wordpress/element": "^6.42.0",
70
- "@wordpress/escape-html": "^3.42.0",
71
- "@wordpress/fields": "^0.34.0",
72
- "@wordpress/global-styles-engine": "^1.9.0",
73
- "@wordpress/global-styles-ui": "^1.9.0",
74
- "@wordpress/hooks": "^4.42.0",
75
- "@wordpress/html-entities": "^4.42.0",
76
- "@wordpress/i18n": "^6.15.0",
77
- "@wordpress/icons": "^12.0.0",
78
- "@wordpress/keyboard-shortcuts": "^5.42.0",
79
- "@wordpress/keycodes": "^4.42.0",
80
- "@wordpress/media-utils": "^5.42.0",
81
- "@wordpress/notices": "^5.42.0",
82
- "@wordpress/patterns": "^2.42.0",
83
- "@wordpress/plugins": "^7.42.0",
84
- "@wordpress/preferences": "^4.42.0",
85
- "@wordpress/primitives": "^4.42.0",
86
- "@wordpress/private-apis": "^1.42.0",
87
- "@wordpress/reusable-blocks": "^5.42.0",
88
- "@wordpress/router": "^1.42.0",
89
- "@wordpress/style-engine": "^2.42.0",
90
- "@wordpress/url": "^4.42.0",
91
- "@wordpress/viewport": "^6.42.0",
92
- "@wordpress/views": "^1.9.0",
93
- "@wordpress/widgets": "^4.42.0",
94
- "@wordpress/wordcount": "^4.42.0",
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": "c20787b1778ae64c2db65643b1c236309d68e6ba"
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: DEFAULT_VIEW,
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 = 'active', postId } = query;
30
+ const { activeView = 'all', postId } = query;
36
31
  const [ selection, setSelection ] = useState( [ postId ] );
37
32
 
38
- const defaultView = DEFAULT_VIEW;
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
- () => getActiveViewOverridesForTab( activeView ),
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
- import {
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 defaultView = DEFAULT_VIEW;
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
- () => getActiveViewOverridesForTab( activeView ),
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( { postType, postId, closeModal } ) {
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
- const allFields = [
97
- {
98
- id: 'featured_media',
99
- layout: {
100
- type: 'regular',
101
- labelPosition: 'none',
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
- layout: {
140
- type: 'panel',
141
- },
142
- fields: isBulk
143
- ? allFields.filter( ( field ) =>
144
- fieldsWithBulkEditSupport.includes(
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 };
@@ -68,6 +68,8 @@
68
68
  }
69
69
  }
70
70
 
71
+ // TODO: These styles should be absorbed by DataForm API.
72
+ // @see https://github.com/WordPress/gutenberg/issues/75916
71
73
  .fields-controls__password {
72
74
  border-top: $border-width solid $gray-200;
73
75
  padding-top: $grid-unit-20;
@@ -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 { useSelect } from '@wordpress/data';
7
- import { store as coreStore } from '@wordpress/core-data';
8
- import { useMemo } from '@wordpress/element';
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 DataViewItem from './dataview-item';
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
- export default function DataViewsSidebarContent( { postType } ) {
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 postTypeObject = useSelect(
24
- ( select ) => {
25
- const { getPostType } = select( coreStore );
26
- return getPostType( postType );
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
- { defaultViews.map( ( dataview ) => {
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
- <DataViewItem
44
- key={ dataview.slug }
45
- slug={ dataview.slug }
46
- title={ dataview.title }
47
- icon={ dataview.icon }
48
- type={ dataview.view.type }
49
- isActive={ dataview.slug === activeView }
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
- }