@wordpress/edit-site 5.20.1 → 5.21.1-next.f8d8eceb.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/actions/index.js +121 -0
- package/build/components/actions/index.js.map +1 -0
- package/build/components/add-new-template/add-custom-template-modal-content.js +17 -13
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +12 -4
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +10 -6
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/dataviews/context.js +15 -0
- package/build/components/dataviews/context.js.map +1 -0
- package/build/components/dataviews/dataviews.js +50 -33
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +74 -0
- package/build/components/dataviews/filters.js.map +1 -0
- package/build/components/dataviews/in-filter.js +49 -0
- package/build/components/dataviews/in-filter.js.map +1 -0
- package/build/components/dataviews/index.js +0 -7
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews/item-actions.js +62 -0
- package/build/components/dataviews/item-actions.js.map +1 -0
- package/build/components/dataviews/pagination.js +74 -45
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/{text-filter.js → search.js} +21 -15
- package/build/components/dataviews/search.js.map +1 -0
- package/build/components/dataviews/view-actions.js +94 -56
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-grid.js +59 -0
- package/build/components/dataviews/view-grid.js.map +1 -0
- package/build/components/dataviews/view-list.js +283 -0
- package/build/components/dataviews/view-list.js.map +1 -0
- package/build/components/editor/index.js +2 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +16 -10
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +20 -6
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -10
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-root.js +1 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -4
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/layout/index.js +10 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/media/index.js +34 -0
- package/build/components/media/index.js.map +1 -0
- package/build/components/page-actions/index.js +0 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-pages/default-views.js +60 -0
- package/build/components/page-pages/default-views.js.map +1 -0
- package/build/components/page-pages/index.js +174 -107
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +89 -0
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +52 -131
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +1 -0
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/header.js +25 -3
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +49 -0
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -0
- package/build/components/page-patterns/rename-menu-item.js +1 -1
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/pattern-modal/duplicate.js +65 -0
- package/build/components/pattern-modal/duplicate.js.map +1 -0
- package/build/components/pattern-modal/index.js +24 -0
- package/build/components/pattern-modal/index.js.map +1 -0
- package/build/components/pattern-modal/rename.js +42 -0
- package/build/components/pattern-modal/rename.js.map +1 -0
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +72 -0
- package/build/components/sidebar-dataviews/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +3 -0
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +2 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -3
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +29 -0
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +12 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +1 -2
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +50 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/selectors.js +4 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/actions/index.js +108 -0
- package/build-module/components/actions/index.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +16 -12
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +12 -4
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +10 -6
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/dataviews/context.js +7 -0
- package/build-module/components/dataviews/context.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +49 -32
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +66 -0
- package/build-module/components/dataviews/filters.js.map +1 -0
- package/build-module/components/dataviews/in-filter.js +41 -0
- package/build-module/components/dataviews/in-filter.js.map +1 -0
- package/build-module/components/dataviews/index.js +0 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +55 -0
- package/build-module/components/dataviews/item-actions.js.map +1 -0
- package/build-module/components/dataviews/pagination.js +73 -46
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/search.js +42 -0
- package/build-module/components/dataviews/search.js.map +1 -0
- package/build-module/components/dataviews/view-actions.js +95 -54
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-grid.js +51 -0
- package/build-module/components/dataviews/view-grid.js.map +1 -0
- package/build-module/components/dataviews/view-list.js +274 -0
- package/build-module/components/dataviews/view-list.js.map +1 -0
- package/build-module/components/editor/index.js +2 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +16 -10
- 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 +20 -6
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -10
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +1 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/ui.js +3 -4
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/layout/index.js +11 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/media/index.js +26 -0
- package/build-module/components/media/index.js.map +1 -0
- package/build-module/components/page-actions/index.js +0 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-pages/default-views.js +53 -0
- package/build-module/components/page-pages/default-views.js.map +1 -0
- package/build-module/components/page-pages/index.js +175 -110
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +82 -0
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +54 -133
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +1 -0
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/header.js +26 -4
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +42 -0
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/rename-menu-item.js +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/pattern-modal/duplicate.js +57 -0
- package/build-module/components/pattern-modal/duplicate.js.map +1 -0
- package/build-module/components/pattern-modal/index.js +14 -0
- package/build-module/components/pattern-modal/index.js.map +1 -0
- package/build-module/components/pattern-modal/rename.js +34 -0
- package/build-module/components/pattern-modal/rename.js.map +1 -0
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +64 -0
- package/build-module/components/sidebar-dataviews/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +3 -0
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -3
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +22 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +12 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +1 -2
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +51 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/selectors.js +4 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +48 -11
- package/build-style/style.css +48 -11
- package/package.json +40 -40
- package/src/components/actions/index.js +123 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +22 -17
- package/src/components/block-editor/resize-handle.js +1 -0
- package/src/components/block-editor/use-site-editor-settings.js +21 -13
- package/src/components/create-template-part-modal/index.js +9 -5
- package/src/components/dataviews/README.md +194 -0
- package/src/components/dataviews/context.js +7 -0
- package/src/components/dataviews/dataviews.js +55 -34
- package/src/components/dataviews/filters.js +75 -0
- package/src/components/dataviews/in-filter.js +45 -0
- package/src/components/dataviews/index.js +0 -1
- package/src/components/dataviews/item-actions.js +69 -0
- package/src/components/dataviews/pagination.js +80 -59
- package/src/components/dataviews/search.js +41 -0
- package/src/components/dataviews/style.scss +18 -3
- package/src/components/dataviews/view-actions.js +108 -63
- package/src/components/dataviews/view-grid.js +65 -0
- package/src/components/dataviews/view-list.js +348 -0
- package/src/components/editor/index.js +2 -0
- package/src/components/global-styles/font-library-modal/context.js +17 -11
- package/src/components/global-styles/font-library-modal/font-collection.js +19 -11
- package/src/components/global-styles/screen-block.js +2 -9
- package/src/components/global-styles/screen-root.js +1 -2
- package/src/components/global-styles/style.scss +16 -4
- package/src/components/global-styles/ui.js +1 -2
- package/src/components/layout/index.js +12 -4
- package/src/components/media/index.js +25 -0
- package/src/components/page-actions/index.js +1 -7
- package/src/components/page-pages/default-views.js +58 -0
- package/src/components/page-pages/index.js +181 -108
- package/src/components/page-pages/style.scss +3 -0
- package/src/components/page-patterns/delete-category-menu-item.js +104 -0
- package/src/components/page-patterns/duplicate-menu-item.js +68 -181
- package/src/components/page-patterns/grid-item.js +1 -0
- package/src/components/page-patterns/header.js +42 -6
- package/src/components/page-patterns/rename-category-menu-item.js +45 -0
- package/src/components/page-patterns/rename-menu-item.js +2 -2
- package/src/components/page-patterns/style.scss +8 -0
- package/src/components/page-patterns/use-patterns.js +5 -0
- package/src/components/pattern-modal/duplicate.js +53 -0
- package/src/components/pattern-modal/index.js +19 -0
- package/src/components/pattern-modal/rename.js +29 -0
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-dataviews/index.js +65 -0
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +4 -0
- package/src/components/sidebar-navigation-screen/style.scss +17 -5
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +2 -7
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -8
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +32 -0
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +21 -7
- package/src/hooks/commands/use-common-commands.js +1 -2
- package/src/hooks/commands/use-edit-mode-commands.js +43 -0
- package/src/lock-unlock.js +1 -1
- package/src/store/selectors.js +9 -10
- package/src/style.scss +1 -0
- package/build/components/dataviews/list-view.js +0 -89
- package/build/components/dataviews/list-view.js.map +0 -1
- package/build/components/dataviews/text-filter.js.map +0 -1
- package/build-module/components/dataviews/list-view.js +0 -80
- package/build-module/components/dataviews/list-view.js.map +0 -1
- package/build-module/components/dataviews/text-filter.js +0 -36
- package/build-module/components/dataviews/text-filter.js.map +0 -1
- package/src/components/dataviews/list-view.js +0 -106
- package/src/components/dataviews/text-filter.js +0 -37
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
getCoreRowModel,
|
|
6
|
+
getFilteredRowModel,
|
|
7
|
+
getSortedRowModel,
|
|
8
|
+
getPaginationRowModel,
|
|
9
|
+
useReactTable,
|
|
10
|
+
flexRender,
|
|
11
|
+
} from '@tanstack/react-table';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
17
|
+
import {
|
|
18
|
+
chevronDown,
|
|
19
|
+
chevronUp,
|
|
20
|
+
unseen,
|
|
21
|
+
check,
|
|
22
|
+
arrowUp,
|
|
23
|
+
arrowDown,
|
|
24
|
+
} from '@wordpress/icons';
|
|
25
|
+
import {
|
|
26
|
+
Button,
|
|
27
|
+
Icon,
|
|
28
|
+
privateApis as componentsPrivateApis,
|
|
29
|
+
VisuallyHidden,
|
|
30
|
+
} from '@wordpress/components';
|
|
31
|
+
import { useMemo, Children, Fragment } from '@wordpress/element';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Internal dependencies
|
|
35
|
+
*/
|
|
36
|
+
import { unlock } from '../../lock-unlock';
|
|
37
|
+
import ItemActions from './item-actions';
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
DropdownMenuV2,
|
|
41
|
+
DropdownMenuGroupV2,
|
|
42
|
+
DropdownMenuItemV2,
|
|
43
|
+
DropdownMenuSeparatorV2,
|
|
44
|
+
} = unlock( componentsPrivateApis );
|
|
45
|
+
|
|
46
|
+
const EMPTY_OBJECT = {};
|
|
47
|
+
const sortingItemsInfo = {
|
|
48
|
+
asc: { icon: arrowUp, label: __( 'Sort ascending' ) },
|
|
49
|
+
desc: { icon: arrowDown, label: __( 'Sort descending' ) },
|
|
50
|
+
};
|
|
51
|
+
const sortIcons = { asc: chevronUp, desc: chevronDown };
|
|
52
|
+
function HeaderMenu( { dataView, header } ) {
|
|
53
|
+
if ( header.isPlaceholder ) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const text = flexRender(
|
|
57
|
+
header.column.columnDef.header,
|
|
58
|
+
header.getContext()
|
|
59
|
+
);
|
|
60
|
+
const isSortable = !! header.column.getCanSort();
|
|
61
|
+
const isHidable = !! header.column.getCanHide();
|
|
62
|
+
if ( ! isSortable && ! isHidable ) {
|
|
63
|
+
return text;
|
|
64
|
+
}
|
|
65
|
+
const sortedDirection = header.column.getIsSorted();
|
|
66
|
+
return (
|
|
67
|
+
<DropdownMenuV2
|
|
68
|
+
align="start"
|
|
69
|
+
trigger={
|
|
70
|
+
<Button
|
|
71
|
+
icon={ sortIcons[ header.column.getIsSorted() ] }
|
|
72
|
+
iconPosition="right"
|
|
73
|
+
text={ text }
|
|
74
|
+
style={ { padding: 0 } }
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<WithSeparators>
|
|
79
|
+
{ isSortable && (
|
|
80
|
+
<DropdownMenuGroupV2>
|
|
81
|
+
{ Object.entries( sortingItemsInfo ).map(
|
|
82
|
+
( [ direction, info ] ) => (
|
|
83
|
+
<DropdownMenuItemV2
|
|
84
|
+
key={ direction }
|
|
85
|
+
prefix={ <Icon icon={ info.icon } /> }
|
|
86
|
+
suffix={
|
|
87
|
+
sortedDirection === direction && (
|
|
88
|
+
<Icon icon={ check } />
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
onSelect={ ( event ) => {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
if ( sortedDirection === direction ) {
|
|
94
|
+
dataView.resetSorting();
|
|
95
|
+
} else {
|
|
96
|
+
dataView.setSorting( [
|
|
97
|
+
{
|
|
98
|
+
id: header.column.id,
|
|
99
|
+
desc: direction === 'desc',
|
|
100
|
+
},
|
|
101
|
+
] );
|
|
102
|
+
}
|
|
103
|
+
} }
|
|
104
|
+
>
|
|
105
|
+
{ info.label }
|
|
106
|
+
</DropdownMenuItemV2>
|
|
107
|
+
)
|
|
108
|
+
) }
|
|
109
|
+
</DropdownMenuGroupV2>
|
|
110
|
+
) }
|
|
111
|
+
{ isHidable && (
|
|
112
|
+
<DropdownMenuItemV2
|
|
113
|
+
prefix={ <Icon icon={ unseen } /> }
|
|
114
|
+
onSelect={ ( event ) => {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
header.column.getToggleVisibilityHandler()( event );
|
|
117
|
+
} }
|
|
118
|
+
>
|
|
119
|
+
{ __( 'Hide' ) }
|
|
120
|
+
</DropdownMenuItemV2>
|
|
121
|
+
) }
|
|
122
|
+
</WithSeparators>
|
|
123
|
+
</DropdownMenuV2>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function WithSeparators( { children } ) {
|
|
128
|
+
return Children.toArray( children )
|
|
129
|
+
.filter( Boolean )
|
|
130
|
+
.map( ( child, i ) => (
|
|
131
|
+
<Fragment key={ i }>
|
|
132
|
+
{ i > 0 && <DropdownMenuSeparatorV2 /> }
|
|
133
|
+
{ child }
|
|
134
|
+
</Fragment>
|
|
135
|
+
) );
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function ViewList( {
|
|
139
|
+
view,
|
|
140
|
+
onChangeView,
|
|
141
|
+
fields,
|
|
142
|
+
actions,
|
|
143
|
+
data,
|
|
144
|
+
isLoading = false,
|
|
145
|
+
paginationInfo,
|
|
146
|
+
} ) {
|
|
147
|
+
const columns = useMemo( () => {
|
|
148
|
+
const _columns = fields.map( ( field ) => {
|
|
149
|
+
const { render, getValue, ...column } = field;
|
|
150
|
+
column.cell = ( props ) =>
|
|
151
|
+
render( { item: props.row.original, view } );
|
|
152
|
+
if ( getValue ) {
|
|
153
|
+
column.accessorFn = ( item ) => getValue( { item } );
|
|
154
|
+
}
|
|
155
|
+
return column;
|
|
156
|
+
} );
|
|
157
|
+
if ( actions?.length ) {
|
|
158
|
+
_columns.push( {
|
|
159
|
+
header: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,
|
|
160
|
+
id: 'actions',
|
|
161
|
+
cell: ( props ) => {
|
|
162
|
+
return (
|
|
163
|
+
<ItemActions
|
|
164
|
+
item={ props.row.original }
|
|
165
|
+
actions={ actions }
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
enableHiding: false,
|
|
170
|
+
} );
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return _columns;
|
|
174
|
+
}, [ fields, actions, view ] );
|
|
175
|
+
|
|
176
|
+
const columnVisibility = useMemo( () => {
|
|
177
|
+
if ( ! view.hiddenFields?.length ) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
return view.hiddenFields.reduce(
|
|
181
|
+
( accumulator, fieldId ) => ( {
|
|
182
|
+
...accumulator,
|
|
183
|
+
[ fieldId ]: false,
|
|
184
|
+
} ),
|
|
185
|
+
{}
|
|
186
|
+
);
|
|
187
|
+
}, [ view.hiddenFields ] );
|
|
188
|
+
|
|
189
|
+
const dataView = useReactTable( {
|
|
190
|
+
data,
|
|
191
|
+
columns,
|
|
192
|
+
manualSorting: true,
|
|
193
|
+
manualFiltering: true,
|
|
194
|
+
manualPagination: true,
|
|
195
|
+
enableRowSelection: true,
|
|
196
|
+
state: {
|
|
197
|
+
sorting: view.sort
|
|
198
|
+
? [
|
|
199
|
+
{
|
|
200
|
+
id: view.sort.field,
|
|
201
|
+
desc: view.sort.direction === 'desc',
|
|
202
|
+
},
|
|
203
|
+
]
|
|
204
|
+
: [],
|
|
205
|
+
globalFilter: view.search,
|
|
206
|
+
pagination: {
|
|
207
|
+
pageIndex: view.page,
|
|
208
|
+
pageSize: view.perPage,
|
|
209
|
+
},
|
|
210
|
+
columnVisibility: columnVisibility ?? EMPTY_OBJECT,
|
|
211
|
+
},
|
|
212
|
+
onSortingChange: ( sortingUpdater ) => {
|
|
213
|
+
onChangeView( ( currentView ) => {
|
|
214
|
+
const sort =
|
|
215
|
+
typeof sortingUpdater === 'function'
|
|
216
|
+
? sortingUpdater(
|
|
217
|
+
currentView.sort
|
|
218
|
+
? [
|
|
219
|
+
{
|
|
220
|
+
id: currentView.sort.field,
|
|
221
|
+
desc:
|
|
222
|
+
currentView.sort
|
|
223
|
+
.direction === 'desc',
|
|
224
|
+
},
|
|
225
|
+
]
|
|
226
|
+
: []
|
|
227
|
+
)
|
|
228
|
+
: sortingUpdater;
|
|
229
|
+
if ( ! sort.length ) {
|
|
230
|
+
return {
|
|
231
|
+
...currentView,
|
|
232
|
+
sort: {},
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const [ { id, desc } ] = sort;
|
|
236
|
+
return {
|
|
237
|
+
...currentView,
|
|
238
|
+
sort: { field: id, direction: desc ? 'desc' : 'asc' },
|
|
239
|
+
};
|
|
240
|
+
} );
|
|
241
|
+
},
|
|
242
|
+
onColumnVisibilityChange: ( columnVisibilityUpdater ) => {
|
|
243
|
+
onChangeView( ( currentView ) => {
|
|
244
|
+
const hiddenFields = Object.entries(
|
|
245
|
+
columnVisibilityUpdater()
|
|
246
|
+
).reduce(
|
|
247
|
+
( accumulator, [ fieldId, value ] ) => {
|
|
248
|
+
if ( value ) {
|
|
249
|
+
return accumulator.filter(
|
|
250
|
+
( id ) => id !== fieldId
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
return [ ...accumulator, fieldId ];
|
|
254
|
+
},
|
|
255
|
+
[ ...( currentView.hiddenFields || [] ) ]
|
|
256
|
+
);
|
|
257
|
+
return {
|
|
258
|
+
...currentView,
|
|
259
|
+
hiddenFields,
|
|
260
|
+
};
|
|
261
|
+
} );
|
|
262
|
+
},
|
|
263
|
+
onGlobalFilterChange: ( value ) => {
|
|
264
|
+
onChangeView( { ...view, search: value, page: 0 } );
|
|
265
|
+
},
|
|
266
|
+
onPaginationChange: ( paginationUpdater ) => {
|
|
267
|
+
onChangeView( ( currentView ) => {
|
|
268
|
+
const { pageIndex, pageSize } = paginationUpdater( {
|
|
269
|
+
pageIndex: currentView.page,
|
|
270
|
+
pageSize: currentView.perPage,
|
|
271
|
+
} );
|
|
272
|
+
return { ...view, page: pageIndex, perPage: pageSize };
|
|
273
|
+
} );
|
|
274
|
+
},
|
|
275
|
+
getCoreRowModel: getCoreRowModel(),
|
|
276
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
277
|
+
getSortedRowModel: getSortedRowModel(),
|
|
278
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
279
|
+
pageCount: paginationInfo.totalPages,
|
|
280
|
+
} );
|
|
281
|
+
|
|
282
|
+
const { rows } = dataView.getRowModel();
|
|
283
|
+
const hasRows = !! rows?.length;
|
|
284
|
+
if ( isLoading ) {
|
|
285
|
+
// TODO:Add spinner or progress bar..
|
|
286
|
+
return <h3>{ __( 'Loading' ) }</h3>;
|
|
287
|
+
}
|
|
288
|
+
return (
|
|
289
|
+
<div className="dataviews-list-view-wrapper">
|
|
290
|
+
{ hasRows && (
|
|
291
|
+
<table className="dataviews-list-view">
|
|
292
|
+
<thead>
|
|
293
|
+
{ dataView.getHeaderGroups().map( ( headerGroup ) => (
|
|
294
|
+
<tr key={ headerGroup.id }>
|
|
295
|
+
{ headerGroup.headers.map( ( header ) => (
|
|
296
|
+
<th
|
|
297
|
+
key={ header.id }
|
|
298
|
+
colSpan={ header.colSpan }
|
|
299
|
+
style={ {
|
|
300
|
+
width:
|
|
301
|
+
header.column.columnDef.width ||
|
|
302
|
+
undefined,
|
|
303
|
+
maxWidth:
|
|
304
|
+
header.column.columnDef
|
|
305
|
+
.maxWidth || undefined,
|
|
306
|
+
} }
|
|
307
|
+
>
|
|
308
|
+
<HeaderMenu
|
|
309
|
+
dataView={ dataView }
|
|
310
|
+
header={ header }
|
|
311
|
+
/>
|
|
312
|
+
</th>
|
|
313
|
+
) ) }
|
|
314
|
+
</tr>
|
|
315
|
+
) ) }
|
|
316
|
+
</thead>
|
|
317
|
+
<tbody>
|
|
318
|
+
{ rows.map( ( row ) => (
|
|
319
|
+
<tr key={ row.id }>
|
|
320
|
+
{ row.getVisibleCells().map( ( cell ) => (
|
|
321
|
+
<td
|
|
322
|
+
key={ cell.id }
|
|
323
|
+
style={ {
|
|
324
|
+
width:
|
|
325
|
+
cell.column.columnDef.width ||
|
|
326
|
+
undefined,
|
|
327
|
+
maxWidth:
|
|
328
|
+
cell.column.columnDef
|
|
329
|
+
.maxWidth || undefined,
|
|
330
|
+
} }
|
|
331
|
+
>
|
|
332
|
+
{ flexRender(
|
|
333
|
+
cell.column.columnDef.cell,
|
|
334
|
+
cell.getContext()
|
|
335
|
+
) }
|
|
336
|
+
</td>
|
|
337
|
+
) ) }
|
|
338
|
+
</tr>
|
|
339
|
+
) ) }
|
|
340
|
+
</tbody>
|
|
341
|
+
</table>
|
|
342
|
+
) }
|
|
343
|
+
{ ! hasRows && <p>{ __( 'no results' ) }</p> }
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export default ViewList;
|
|
@@ -44,6 +44,7 @@ import CanvasLoader from '../canvas-loader';
|
|
|
44
44
|
import { unlock } from '../../lock-unlock';
|
|
45
45
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
46
46
|
import { SidebarFixedBottomSlot } from '../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
47
|
+
import PatternModal from '../pattern-modal';
|
|
47
48
|
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
48
49
|
|
|
49
50
|
const { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );
|
|
@@ -220,6 +221,7 @@ export default function Editor( { listViewToggleElement, isLoading } ) {
|
|
|
220
221
|
<BlockRemovalWarningModal
|
|
221
222
|
rules={ blockRemovalRules }
|
|
222
223
|
/>
|
|
224
|
+
<PatternModal />
|
|
223
225
|
</>
|
|
224
226
|
) }
|
|
225
227
|
{ editorMode === 'text' &&
|
|
@@ -323,17 +323,23 @@ function FontLibraryProvider( { children } ) {
|
|
|
323
323
|
setFontCollections( response );
|
|
324
324
|
};
|
|
325
325
|
const getFontCollection = async ( id ) => {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
326
|
+
try {
|
|
327
|
+
const hasData = !! collections.find(
|
|
328
|
+
( collection ) => collection.id === id
|
|
329
|
+
)?.data;
|
|
330
|
+
if ( hasData ) return;
|
|
331
|
+
const response = await fetchFontCollection( id );
|
|
332
|
+
const updatedCollections = collections.map( ( collection ) =>
|
|
333
|
+
collection.id === id
|
|
334
|
+
? { ...collection, data: { ...response?.data } }
|
|
335
|
+
: collection
|
|
336
|
+
);
|
|
337
|
+
setFontCollections( updatedCollections );
|
|
338
|
+
} catch ( e ) {
|
|
339
|
+
// eslint-disable-next-line no-console
|
|
340
|
+
console.error( e );
|
|
341
|
+
throw e;
|
|
342
|
+
}
|
|
337
343
|
};
|
|
338
344
|
|
|
339
345
|
useEffect( () => {
|
|
@@ -72,20 +72,32 @@ function FontCollection( { id } ) {
|
|
|
72
72
|
}, [ id, requiresPermission ] );
|
|
73
73
|
|
|
74
74
|
useEffect( () => {
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const fetchFontCollection = async () => {
|
|
76
|
+
try {
|
|
77
|
+
await getFontCollection( id );
|
|
78
|
+
resetFilters();
|
|
79
|
+
} catch ( e ) {
|
|
80
|
+
setNotice( {
|
|
81
|
+
type: 'error',
|
|
82
|
+
message: e?.message,
|
|
83
|
+
duration: 0, // Don't auto-hide.
|
|
84
|
+
} );
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
fetchFontCollection();
|
|
77
88
|
}, [ id, getFontCollection ] );
|
|
78
89
|
|
|
79
90
|
useEffect( () => {
|
|
80
91
|
setSelectedFont( null );
|
|
92
|
+
setNotice( null );
|
|
81
93
|
}, [ id ] );
|
|
82
94
|
|
|
83
95
|
// Reset notice after 5 seconds
|
|
84
96
|
useEffect( () => {
|
|
85
|
-
if ( notice ) {
|
|
97
|
+
if ( notice && notice?.duration !== 0 ) {
|
|
86
98
|
const timeout = setTimeout( () => {
|
|
87
99
|
setNotice( null );
|
|
88
|
-
}, 5000 );
|
|
100
|
+
}, notice.duration ?? 5000 );
|
|
89
101
|
return () => clearTimeout( timeout );
|
|
90
102
|
}
|
|
91
103
|
}, [ notice ] );
|
|
@@ -167,10 +179,6 @@ function FontCollection( { id } ) {
|
|
|
167
179
|
</>
|
|
168
180
|
) }
|
|
169
181
|
|
|
170
|
-
{ ! renderConfirmDialog && ! selectedCollection.data && (
|
|
171
|
-
<Spinner />
|
|
172
|
-
) }
|
|
173
|
-
|
|
174
182
|
{ notice && (
|
|
175
183
|
<>
|
|
176
184
|
<FlexItem>
|
|
@@ -227,16 +235,16 @@ function FontCollection( { id } ) {
|
|
|
227
235
|
) }
|
|
228
236
|
|
|
229
237
|
<Spacer margin={ 4 } />
|
|
230
|
-
|
|
231
238
|
{ ! renderConfirmDialog &&
|
|
232
|
-
! selectedCollection?.data?.fontFamilies &&
|
|
239
|
+
! selectedCollection?.data?.fontFamilies &&
|
|
240
|
+
! notice && <Spinner /> }
|
|
233
241
|
|
|
234
242
|
{ ! renderConfirmDialog &&
|
|
235
243
|
!! selectedCollection?.data?.fontFamilies?.length &&
|
|
236
244
|
! fonts.length && (
|
|
237
245
|
<Text>
|
|
238
246
|
{ __(
|
|
239
|
-
'No fonts found. Try with a different
|
|
247
|
+
'No fonts found. Try with a different search term'
|
|
240
248
|
) }
|
|
241
249
|
</Text>
|
|
242
250
|
) }
|
|
@@ -132,8 +132,7 @@ function ScreenBlock( { name, variation } ) {
|
|
|
132
132
|
: undefined;
|
|
133
133
|
|
|
134
134
|
return {
|
|
135
|
-
canEditCSS:
|
|
136
|
-
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
135
|
+
canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
|
|
137
136
|
};
|
|
138
137
|
}, [] );
|
|
139
138
|
const currentBlockStyle = variation
|
|
@@ -284,13 +283,7 @@ function ScreenBlock( { name, variation } ) {
|
|
|
284
283
|
inheritedValue={ inheritedStyleWithLayout }
|
|
285
284
|
value={ styleWithLayout }
|
|
286
285
|
onChange={ setStyle }
|
|
287
|
-
settings={
|
|
288
|
-
...settings,
|
|
289
|
-
color: {
|
|
290
|
-
...settings.color,
|
|
291
|
-
customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
|
|
292
|
-
},
|
|
293
|
-
} }
|
|
286
|
+
settings={ settings }
|
|
294
287
|
includeLayoutControls
|
|
295
288
|
/>
|
|
296
289
|
) }
|
|
@@ -47,8 +47,7 @@ function ScreenRoot() {
|
|
|
47
47
|
hasVariations:
|
|
48
48
|
!! __experimentalGetCurrentThemeGlobalStylesVariations()
|
|
49
49
|
?.length,
|
|
50
|
-
canEditCSS:
|
|
51
|
-
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
50
|
+
canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
|
|
52
51
|
};
|
|
53
52
|
}, [] );
|
|
54
53
|
|
|
@@ -85,23 +85,35 @@
|
|
|
85
85
|
|
|
86
86
|
.edit-site-global-styles-variations_item {
|
|
87
87
|
box-sizing: border-box;
|
|
88
|
+
// To round the outline in Windows 10 high contrast mode.
|
|
89
|
+
border-radius: $radius-block-ui;
|
|
88
90
|
|
|
89
91
|
.edit-site-global-styles-variations_item-preview {
|
|
90
92
|
padding: $border-width * 2;
|
|
91
93
|
border-radius: $radius-block-ui;
|
|
92
|
-
|
|
94
|
+
box-shadow: 0 0 0 $border-width $gray-200;
|
|
95
|
+
// Shown in Windows 10 high contrast mode.
|
|
96
|
+
outline: 1px solid transparent;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
&.is-active .edit-site-global-styles-variations_item-preview {
|
|
96
|
-
|
|
100
|
+
box-shadow: 0 0 0 $border-width $gray-900;
|
|
101
|
+
// Shown in Windows 10 high contrast mode.
|
|
102
|
+
outline-width: 3px;
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
&:hover .edit-site-global-styles-variations_item-preview {
|
|
100
|
-
|
|
106
|
+
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
&:focus .edit-site-global-styles-variations_item-preview {
|
|
104
|
-
|
|
110
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&:focus-visible {
|
|
114
|
+
// Shown in Windows 10 high contrast mode.
|
|
115
|
+
outline: 3px solid transparent;
|
|
116
|
+
outline-offset: 0;
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
@@ -65,8 +65,7 @@ function GlobalStylesActionMenu() {
|
|
|
65
65
|
: undefined;
|
|
66
66
|
|
|
67
67
|
return {
|
|
68
|
-
canEditCSS:
|
|
69
|
-
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
68
|
+
canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
|
|
70
69
|
};
|
|
71
70
|
}, [] );
|
|
72
71
|
const { goTo } = useNavigator();
|
|
@@ -29,6 +29,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
29
29
|
import {
|
|
30
30
|
privateApis as blockEditorPrivateApis,
|
|
31
31
|
useBlockCommands,
|
|
32
|
+
store as blockEditorStore,
|
|
32
33
|
} from '@wordpress/block-editor';
|
|
33
34
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
34
35
|
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
@@ -80,6 +81,7 @@ export default function Layout() {
|
|
|
80
81
|
const {
|
|
81
82
|
isDistractionFree,
|
|
82
83
|
hasFixedToolbar,
|
|
84
|
+
hasBlockSelected,
|
|
83
85
|
canvasMode,
|
|
84
86
|
previousShortcut,
|
|
85
87
|
nextShortcut,
|
|
@@ -104,6 +106,8 @@ export default function Layout() {
|
|
|
104
106
|
'core/edit-site',
|
|
105
107
|
'distractionFree'
|
|
106
108
|
),
|
|
109
|
+
hasBlockSelected:
|
|
110
|
+
select( blockEditorStore ).getBlockSelectionStart(),
|
|
107
111
|
};
|
|
108
112
|
}, [] );
|
|
109
113
|
const isEditing = canvasMode === 'edit';
|
|
@@ -152,10 +156,14 @@ export default function Layout() {
|
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
// Sets the right context for the command palette
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
let commandContext = 'site-editor';
|
|
160
|
+
|
|
161
|
+
if ( canvasMode === 'edit' && isEditorPage ) {
|
|
162
|
+
commandContext = 'site-editor-edit';
|
|
163
|
+
}
|
|
164
|
+
if ( hasBlockSelected ) {
|
|
165
|
+
commandContext = 'block-selection-edit';
|
|
166
|
+
}
|
|
159
167
|
useCommandContext( commandContext );
|
|
160
168
|
|
|
161
169
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEntityRecord } from '@wordpress/core-data';
|
|
5
|
+
|
|
6
|
+
function Media( { id, size = [ 'large', 'medium', 'thumbnail' ], ...props } ) {
|
|
7
|
+
const { record: media } = useEntityRecord( 'root', 'media', id );
|
|
8
|
+
const currentSize = size.find(
|
|
9
|
+
( s ) => !! media?.media_details?.sizes[ s ]
|
|
10
|
+
);
|
|
11
|
+
const mediaDetails = media?.media_details?.sizes[ currentSize ];
|
|
12
|
+
if ( ! mediaDetails ) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<img
|
|
18
|
+
{ ...props }
|
|
19
|
+
src={ mediaDetails.source_url }
|
|
20
|
+
alt={ media.alt_text }
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default Media;
|
|
@@ -10,17 +10,11 @@ import { moreVertical } from '@wordpress/icons';
|
|
|
10
10
|
*/
|
|
11
11
|
import TrashPageMenuItem from './trash-page-menu-item';
|
|
12
12
|
|
|
13
|
-
export default function PageActions( {
|
|
14
|
-
postId,
|
|
15
|
-
className,
|
|
16
|
-
toggleProps,
|
|
17
|
-
onRemove,
|
|
18
|
-
} ) {
|
|
13
|
+
export default function PageActions( { postId, toggleProps, onRemove } ) {
|
|
19
14
|
return (
|
|
20
15
|
<DropdownMenu
|
|
21
16
|
icon={ moreVertical }
|
|
22
17
|
label={ __( 'Actions' ) }
|
|
23
|
-
className={ className }
|
|
24
18
|
toggleProps={ toggleProps }
|
|
25
19
|
>
|
|
26
20
|
{ () => (
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
// DEFAULT_STATUSES is intentionally sorted. Items do not have spaces in between them.
|
|
7
|
+
// The reason for that is to match the default statuses coming from the endpoint
|
|
8
|
+
// (entity request and useEffect to update the view).
|
|
9
|
+
export const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All statuses but 'trash'.
|
|
10
|
+
|
|
11
|
+
const DEFAULT_PAGE_BASE = {
|
|
12
|
+
type: 'list',
|
|
13
|
+
search: '',
|
|
14
|
+
filters: {
|
|
15
|
+
status: DEFAULT_STATUSES,
|
|
16
|
+
},
|
|
17
|
+
page: 1,
|
|
18
|
+
perPage: 5,
|
|
19
|
+
sort: {
|
|
20
|
+
field: 'date',
|
|
21
|
+
direction: 'desc',
|
|
22
|
+
},
|
|
23
|
+
visibleFilters: [ 'author', 'status' ],
|
|
24
|
+
// All fields are visible by default, so it's
|
|
25
|
+
// better to keep track of the hidden ones.
|
|
26
|
+
hiddenFields: [ 'date', 'featured-image' ],
|
|
27
|
+
layout: {},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const DEFAULT_VIEWS = [
|
|
31
|
+
{
|
|
32
|
+
title: __( 'All' ),
|
|
33
|
+
slug: 'all',
|
|
34
|
+
view: DEFAULT_PAGE_BASE,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: __( 'Drafts' ),
|
|
38
|
+
slug: 'drafts',
|
|
39
|
+
view: {
|
|
40
|
+
...DEFAULT_PAGE_BASE,
|
|
41
|
+
filters: {
|
|
42
|
+
status: 'draft',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: __( 'Trash' ),
|
|
48
|
+
slug: 'trash',
|
|
49
|
+
view: {
|
|
50
|
+
...DEFAULT_PAGE_BASE,
|
|
51
|
+
filters: {
|
|
52
|
+
status: 'trash',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
export default DEFAULT_VIEWS;
|