@wordpress/edit-site 5.21.0 → 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/build/components/actions/index.js +121 -0
- package/build/components/actions/index.js.map +1 -0
- 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/dataviews/context.js +15 -0
- package/build/components/dataviews/context.js.map +1 -0
- package/build/components/dataviews/dataviews.js +10 -2
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +30 -17
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/in-filter.js +5 -7
- package/build/components/dataviews/in-filter.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 +31 -50
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/{text-filter.js → search.js} +10 -10
- package/build/components/dataviews/search.js.map +1 -0
- package/build/components/dataviews/view-grid.js +3 -3
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +2 -2
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -8
- package/build/components/global-styles/screen-block.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 +73 -52
- package/build/components/page-pages/index.js.map +1 -1
- 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/hooks/commands/use-edit-mode-commands.js +3 -2
- package/build/hooks/commands/use-edit-mode-commands.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/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/dataviews/context.js +7 -0
- package/build-module/components/dataviews/context.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +10 -2
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +30 -17
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/in-filter.js +5 -7
- package/build-module/components/dataviews/in-filter.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 +32 -51
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/{text-filter.js → search.js} +9 -9
- package/build-module/components/dataviews/search.js.map +1 -0
- package/build-module/components/dataviews/view-grid.js +3 -3
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +2 -2
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -8
- package/build-module/components/global-styles/screen-block.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 +71 -52
- package/build-module/components/page-pages/index.js.map +1 -1
- 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/hooks/commands/use-edit-mode-commands.js +4 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-style/style-rtl.css +9 -5
- package/build-style/style.css +9 -5
- package/package.json +40 -40
- package/src/components/actions/index.js +123 -0
- package/src/components/block-editor/use-site-editor-settings.js +21 -13
- package/src/components/dataviews/README.md +134 -47
- package/src/components/dataviews/context.js +7 -0
- package/src/components/dataviews/dataviews.js +11 -1
- package/src/components/dataviews/filters.js +35 -17
- package/src/components/dataviews/in-filter.js +5 -7
- package/src/components/dataviews/item-actions.js +69 -0
- package/src/components/dataviews/pagination.js +53 -74
- package/src/components/dataviews/{text-filter.js → search.js} +7 -7
- package/src/components/dataviews/style.scss +10 -5
- package/src/components/dataviews/view-grid.js +7 -2
- package/src/components/dataviews/view-list.js +2 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +1 -1
- package/src/components/global-styles/screen-block.js +1 -7
- package/src/components/page-pages/default-views.js +58 -0
- package/src/components/page-pages/index.js +85 -60
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-dataviews/index.js +65 -0
- package/src/hooks/commands/use-edit-mode-commands.js +3 -1
- package/build/components/actions/trash-post.js +0 -48
- package/build/components/actions/trash-post.js.map +0 -1
- package/build/components/dataviews/field-actions.js +0 -30
- package/build/components/dataviews/field-actions.js.map +0 -1
- package/build/components/dataviews/text-filter.js.map +0 -1
- package/build-module/components/actions/trash-post.js +0 -41
- package/build-module/components/actions/trash-post.js.map +0 -1
- package/build-module/components/dataviews/field-actions.js +0 -22
- package/build-module/components/dataviews/field-actions.js.map +0 -1
- package/build-module/components/dataviews/text-filter.js.map +0 -1
- package/src/components/actions/trash-post.js +0 -55
- package/src/components/dataviews/field-actions.js +0 -28
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import
|
|
15
|
+
import ItemActions from './item-actions';
|
|
16
16
|
|
|
17
17
|
export function ViewGrid( { data, fields, view, actions } ) {
|
|
18
18
|
const mediaField = fields.find(
|
|
@@ -50,7 +50,12 @@ export function ViewGrid( { data, fields, view, actions } ) {
|
|
|
50
50
|
) ) }
|
|
51
51
|
</VStack>
|
|
52
52
|
</FlexBlock>
|
|
53
|
-
<
|
|
53
|
+
<FlexBlock>
|
|
54
|
+
<ItemActions
|
|
55
|
+
item={ item }
|
|
56
|
+
actions={ actions }
|
|
57
|
+
/>
|
|
58
|
+
</FlexBlock>
|
|
54
59
|
</HStack>
|
|
55
60
|
</VStack>
|
|
56
61
|
);
|
|
@@ -34,7 +34,7 @@ import { useMemo, Children, Fragment } from '@wordpress/element';
|
|
|
34
34
|
* Internal dependencies
|
|
35
35
|
*/
|
|
36
36
|
import { unlock } from '../../lock-unlock';
|
|
37
|
-
import
|
|
37
|
+
import ItemActions from './item-actions';
|
|
38
38
|
|
|
39
39
|
const {
|
|
40
40
|
DropdownMenuV2,
|
|
@@ -160,7 +160,7 @@ function ViewList( {
|
|
|
160
160
|
id: 'actions',
|
|
161
161
|
cell: ( props ) => {
|
|
162
162
|
return (
|
|
163
|
-
<
|
|
163
|
+
<ItemActions
|
|
164
164
|
item={ props.row.original }
|
|
165
165
|
actions={ actions }
|
|
166
166
|
/>
|
|
@@ -283,13 +283,7 @@ function ScreenBlock( { name, variation } ) {
|
|
|
283
283
|
inheritedValue={ inheritedStyleWithLayout }
|
|
284
284
|
value={ styleWithLayout }
|
|
285
285
|
onChange={ setStyle }
|
|
286
|
-
settings={
|
|
287
|
-
...settings,
|
|
288
|
-
color: {
|
|
289
|
-
...settings.color,
|
|
290
|
-
customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
|
|
291
|
-
},
|
|
292
|
-
} }
|
|
286
|
+
settings={ settings }
|
|
293
287
|
includeLayoutControls
|
|
294
288
|
/>
|
|
295
289
|
) }
|
|
@@ -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;
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
|
-
import { useState, useMemo, useCallback } from '@wordpress/element';
|
|
11
|
+
import { useState, useMemo, useCallback, useEffect } from '@wordpress/element';
|
|
12
12
|
import { dateI18n, getDate, getSettings } from '@wordpress/date';
|
|
13
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -17,11 +18,18 @@ import { dateI18n, getDate, getSettings } from '@wordpress/date';
|
|
|
17
18
|
import Page from '../page';
|
|
18
19
|
import Link from '../routes/link';
|
|
19
20
|
import { DataViews } from '../dataviews';
|
|
20
|
-
import
|
|
21
|
+
import { DEFAULT_STATUSES, default as DEFAULT_VIEWS } from './default-views';
|
|
22
|
+
import {
|
|
23
|
+
useTrashPostAction,
|
|
24
|
+
postRevisionsAction,
|
|
25
|
+
viewPostAction,
|
|
26
|
+
useEditPostAction,
|
|
27
|
+
} from '../actions';
|
|
21
28
|
import Media from '../media';
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
30
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
22
31
|
|
|
23
32
|
const EMPTY_ARRAY = [];
|
|
24
|
-
const EMPTY_OBJECT = {};
|
|
25
33
|
const defaultConfigPerViewType = {
|
|
26
34
|
list: {},
|
|
27
35
|
grid: {
|
|
@@ -30,35 +38,51 @@ const defaultConfigPerViewType = {
|
|
|
30
38
|
};
|
|
31
39
|
|
|
32
40
|
export default function PagePages() {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
visibleFilters: [ 'search', 'author', 'status' ],
|
|
46
|
-
// All fields are visible by default, so it's
|
|
47
|
-
// better to keep track of the hidden ones.
|
|
48
|
-
hiddenFields: [ 'date', 'featured-image' ],
|
|
49
|
-
layout: {},
|
|
50
|
-
} );
|
|
41
|
+
const {
|
|
42
|
+
params: { path, activeView = 'all' },
|
|
43
|
+
} = useLocation();
|
|
44
|
+
const initialView = DEFAULT_VIEWS.find(
|
|
45
|
+
( { slug } ) => slug === activeView
|
|
46
|
+
).view;
|
|
47
|
+
const [ view, setView ] = useState( initialView );
|
|
48
|
+
useEffect( () => {
|
|
49
|
+
setView(
|
|
50
|
+
DEFAULT_VIEWS.find( ( { slug } ) => slug === activeView ).view
|
|
51
|
+
);
|
|
52
|
+
}, [ path, activeView ] );
|
|
51
53
|
// Request post statuses to get the proper labels.
|
|
52
54
|
const { records: statuses } = useEntityRecords( 'root', 'status' );
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
55
|
+
const defaultStatuses = useMemo( () => {
|
|
56
|
+
return statuses === null
|
|
57
|
+
? DEFAULT_STATUSES
|
|
58
|
+
: statuses
|
|
59
|
+
.filter( ( { slug } ) => slug !== 'trash' )
|
|
60
|
+
.map( ( { slug } ) => slug )
|
|
61
|
+
.sort()
|
|
62
|
+
.join();
|
|
63
|
+
}, [ statuses ] );
|
|
64
|
+
|
|
65
|
+
useEffect( () => {
|
|
66
|
+
// Only update the view if the statuses received from the endpoint
|
|
67
|
+
// are different from the DEFAULT_STATUSES provided initially.
|
|
68
|
+
//
|
|
69
|
+
// The pages endpoint depends on the status endpoint via the status filter.
|
|
70
|
+
// Initially, this code filters the pages request by DEFAULT_STATUTES,
|
|
71
|
+
// instead of using the default (publish).
|
|
72
|
+
// https://developer.wordpress.org/rest-api/reference/pages/#list-pages
|
|
73
|
+
//
|
|
74
|
+
// By doing so, it avoids a second request to the pages endpoint
|
|
75
|
+
// upon receiving the statuses when they are the same (most common scenario).
|
|
76
|
+
if ( DEFAULT_STATUSES !== defaultStatuses ) {
|
|
77
|
+
setView( {
|
|
78
|
+
...view,
|
|
79
|
+
filters: {
|
|
80
|
+
...view.filters,
|
|
81
|
+
status: defaultStatuses,
|
|
82
|
+
},
|
|
83
|
+
} );
|
|
84
|
+
}
|
|
85
|
+
}, [ defaultStatuses ] );
|
|
62
86
|
|
|
63
87
|
const queryArgs = useMemo(
|
|
64
88
|
() => ( {
|
|
@@ -67,6 +91,7 @@ export default function PagePages() {
|
|
|
67
91
|
_embed: 'author',
|
|
68
92
|
order: view.sort?.direction,
|
|
69
93
|
orderby: view.sort?.field,
|
|
94
|
+
search: view.search,
|
|
70
95
|
...view.filters,
|
|
71
96
|
} ),
|
|
72
97
|
[ view ]
|
|
@@ -78,9 +103,7 @@ export default function PagePages() {
|
|
|
78
103
|
totalPages,
|
|
79
104
|
} = useEntityRecords( 'postType', 'page', queryArgs );
|
|
80
105
|
|
|
81
|
-
const { records: authors } = useEntityRecords( 'root', 'user'
|
|
82
|
-
who: 'authors',
|
|
83
|
-
} );
|
|
106
|
+
const { records: authors } = useEntityRecords( 'root', 'user' );
|
|
84
107
|
|
|
85
108
|
const paginationInfo = useMemo(
|
|
86
109
|
() => ( {
|
|
@@ -133,7 +156,6 @@ export default function PagePages() {
|
|
|
133
156
|
</VStack>
|
|
134
157
|
);
|
|
135
158
|
},
|
|
136
|
-
filters: [ { id: 'search', type: 'search' } ],
|
|
137
159
|
maxWidth: 400,
|
|
138
160
|
sortingFn: 'alphanumeric',
|
|
139
161
|
enableHiding: false,
|
|
@@ -150,37 +172,31 @@ export default function PagePages() {
|
|
|
150
172
|
</a>
|
|
151
173
|
);
|
|
152
174
|
},
|
|
153
|
-
filters: [
|
|
154
|
-
elements:
|
|
155
|
-
{
|
|
156
|
-
value: '',
|
|
157
|
-
label: __( 'All' ),
|
|
158
|
-
},
|
|
159
|
-
...( authors?.map( ( { id, name } ) => ( {
|
|
175
|
+
filters: [ 'enumeration' ],
|
|
176
|
+
elements:
|
|
177
|
+
authors?.map( ( { id, name } ) => ( {
|
|
160
178
|
value: id,
|
|
161
179
|
label: name,
|
|
162
|
-
} ) ) || []
|
|
163
|
-
],
|
|
180
|
+
} ) ) || [],
|
|
164
181
|
},
|
|
165
182
|
{
|
|
166
183
|
header: __( 'Status' ),
|
|
167
184
|
id: 'status',
|
|
168
185
|
getValue: ( { item } ) =>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
)
|
|
178
|
-
.map( ( [ slug, name ] ) => ( {
|
|
179
|
-
value: slug,
|
|
180
|
-
label: name,
|
|
181
|
-
} ) ) ) ||
|
|
182
|
-
[] ),
|
|
186
|
+
statuses?.find( ( { slug } ) => slug === item.status )
|
|
187
|
+
?.name ?? item.status,
|
|
188
|
+
filters: [
|
|
189
|
+
{
|
|
190
|
+
type: 'enumeration',
|
|
191
|
+
id: 'status',
|
|
192
|
+
resetValue: defaultStatuses,
|
|
193
|
+
},
|
|
183
194
|
],
|
|
195
|
+
elements:
|
|
196
|
+
statuses?.map( ( { slug, name } ) => ( {
|
|
197
|
+
value: slug,
|
|
198
|
+
label: name,
|
|
199
|
+
} ) ) || [],
|
|
184
200
|
enableSorting: false,
|
|
185
201
|
},
|
|
186
202
|
{
|
|
@@ -196,11 +212,20 @@ export default function PagePages() {
|
|
|
196
212
|
},
|
|
197
213
|
},
|
|
198
214
|
],
|
|
199
|
-
[
|
|
215
|
+
[ defaultStatuses, statuses, authors ]
|
|
200
216
|
);
|
|
201
217
|
|
|
202
218
|
const trashPostAction = useTrashPostAction();
|
|
203
|
-
const
|
|
219
|
+
const editPostAction = useEditPostAction();
|
|
220
|
+
const actions = useMemo(
|
|
221
|
+
() => [
|
|
222
|
+
viewPostAction,
|
|
223
|
+
trashPostAction,
|
|
224
|
+
editPostAction,
|
|
225
|
+
postRevisionsAction,
|
|
226
|
+
],
|
|
227
|
+
[ trashPostAction, editPostAction ]
|
|
228
|
+
);
|
|
204
229
|
const onChangeView = useCallback(
|
|
205
230
|
( viewUpdater ) => {
|
|
206
231
|
let updatedView =
|
|
@@ -218,7 +243,7 @@ export default function PagePages() {
|
|
|
218
243
|
|
|
219
244
|
setView( updatedView );
|
|
220
245
|
},
|
|
221
|
-
[ view ]
|
|
246
|
+
[ view, setView ]
|
|
222
247
|
);
|
|
223
248
|
|
|
224
249
|
// TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`.
|
|
@@ -29,6 +29,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
29
29
|
import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
|
|
30
30
|
import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
|
|
31
31
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
32
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
32
33
|
|
|
33
34
|
const { useLocation } = unlock( routerPrivateApis );
|
|
34
35
|
|
|
@@ -61,6 +62,7 @@ function SidebarScreens() {
|
|
|
61
62
|
title={ __( 'All Pages' ) }
|
|
62
63
|
description={ __( 'Manage your pages.' ) }
|
|
63
64
|
backPath="/page"
|
|
65
|
+
content={ <DataViewsSidebarContent /> }
|
|
64
66
|
/>
|
|
65
67
|
</NavigatorScreen>
|
|
66
68
|
) }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
5
|
+
import { page, columns } from '@wordpress/icons';
|
|
6
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { useLink } from '../routes/link';
|
|
12
|
+
import { default as DEFAULT_VIEWS } from '../page-pages/default-views';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
15
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
16
|
+
|
|
17
|
+
function getDataViewIcon( dataview ) {
|
|
18
|
+
const icons = { list: page, grid: columns };
|
|
19
|
+
return icons[ dataview.view.type ];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DataViewItem( { dataview, isActive } ) {
|
|
23
|
+
const {
|
|
24
|
+
params: { path },
|
|
25
|
+
} = useLocation();
|
|
26
|
+
|
|
27
|
+
const icon = getDataViewIcon( dataview );
|
|
28
|
+
|
|
29
|
+
const linkInfo = useLink( {
|
|
30
|
+
path,
|
|
31
|
+
activeView: dataview.slug,
|
|
32
|
+
} );
|
|
33
|
+
return (
|
|
34
|
+
<SidebarNavigationItem
|
|
35
|
+
icon={ icon }
|
|
36
|
+
{ ...linkInfo }
|
|
37
|
+
aria-current={ isActive ? 'true' : undefined }
|
|
38
|
+
>
|
|
39
|
+
{ dataview.title }
|
|
40
|
+
</SidebarNavigationItem>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function DataViewsSidebarContent() {
|
|
45
|
+
const {
|
|
46
|
+
params: { path, activeView = 'all' },
|
|
47
|
+
} = useLocation();
|
|
48
|
+
if ( ! path || path !== '/pages' ) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ItemGroup>
|
|
54
|
+
{ DEFAULT_VIEWS.map( ( dataview ) => {
|
|
55
|
+
return (
|
|
56
|
+
<DataViewItem
|
|
57
|
+
key={ dataview.slug }
|
|
58
|
+
dataview={ dataview }
|
|
59
|
+
isActive={ dataview.slug === activeView }
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
} ) }
|
|
63
|
+
</ItemGroup>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
6
6
|
import {
|
|
7
|
+
edit,
|
|
7
8
|
trash,
|
|
8
9
|
rotateLeft,
|
|
9
10
|
rotateRight,
|
|
@@ -375,7 +376,7 @@ function usePatternCommands() {
|
|
|
375
376
|
commands.push( {
|
|
376
377
|
name: 'core/rename-pattern',
|
|
377
378
|
label: __( 'Rename pattern' ),
|
|
378
|
-
icon:
|
|
379
|
+
icon: edit,
|
|
379
380
|
callback: ( { close } ) => {
|
|
380
381
|
openModal( PATTERN_MODALS.rename );
|
|
381
382
|
close();
|
|
@@ -416,6 +417,7 @@ export function useEditModeCommands() {
|
|
|
416
417
|
useCommandLoader( {
|
|
417
418
|
name: 'core/edit-site/patterns',
|
|
418
419
|
hook: usePatternCommands,
|
|
420
|
+
context: 'site-editor-edit',
|
|
419
421
|
} );
|
|
420
422
|
|
|
421
423
|
useCommandLoader( {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useMoveToTrashAction;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
9
|
-
var _coreData = require("@wordpress/core-data");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _notices = require("@wordpress/notices");
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
function useMoveToTrashAction() {
|
|
18
|
-
const {
|
|
19
|
-
createSuccessNotice,
|
|
20
|
-
createErrorNotice
|
|
21
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
22
|
-
const {
|
|
23
|
-
deleteEntityRecord
|
|
24
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
25
|
-
return (0, _element.useMemo)(() => ({
|
|
26
|
-
id: 'move-to-trash',
|
|
27
|
-
label: (0, _i18n.__)('Move to Trash'),
|
|
28
|
-
async perform(post) {
|
|
29
|
-
try {
|
|
30
|
-
await deleteEntityRecord('postType', post.type, post.id, {}, {
|
|
31
|
-
throwOnError: true
|
|
32
|
-
});
|
|
33
|
-
createSuccessNotice((0, _i18n.sprintf)( /* translators: The page's title. */
|
|
34
|
-
(0, _i18n.__)('"%s" moved to the Trash.'), (0, _htmlEntities.decodeEntities)(post.title.rendered)), {
|
|
35
|
-
type: 'snackbar',
|
|
36
|
-
id: 'edit-site-page-trashed'
|
|
37
|
-
});
|
|
38
|
-
} catch (error) {
|
|
39
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while moving the page to the trash.');
|
|
40
|
-
createErrorNotice(errorMessage, {
|
|
41
|
-
type: 'snackbar'
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
isDesctructive: true
|
|
46
|
-
}), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=trash-post.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_htmlEntities","_coreData","_i18n","_notices","_element","useMoveToTrashAction","createSuccessNotice","createErrorNotice","useDispatch","noticesStore","deleteEntityRecord","coreStore","useMemo","id","label","__","perform","post","type","throwOnError","sprintf","decodeEntities","title","rendered","error","errorMessage","message","code","isDesctructive"],"sources":["@wordpress/edit-site/src/components/actions/trash-post.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\n\nexport default function useMoveToTrashAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'move-to-trash',\n\t\t\tlabel: __( 'Move to Trash' ),\n\t\t\tasync perform( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDesctructive: true,\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,mBAAmB;IAAEC;EAAkB,CAAC,GAC/C,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAC5B,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAF,iBAAW,EAAEG,eAAU,CAAC;EAEvD,OAAO,IAAAC,gBAAO,EACb,OAAQ;IACPC,EAAE,EAAE,eAAe;IACnBC,KAAK,EAAE,IAAAC,QAAE,EAAE,eAAgB,CAAC;IAC5B,MAAMC,OAAOA,CAAEC,IAAI,EAAG;MACrB,IAAI;QACH,MAAMP,kBAAkB,CACvB,UAAU,EACVO,IAAI,CAACC,IAAI,EACTD,IAAI,CAACJ,EAAE,EACP,CAAC,CAAC,EACF;UAAEM,YAAY,EAAE;QAAK,CACtB,CAAC;QACDb,mBAAmB,CAClB,IAAAc,aAAO,GACN;QACA,IAAAL,QAAE,EAAE,0BAA2B,CAAC,EAChC,IAAAM,4BAAc,EAAEJ,IAAI,CAACK,KAAK,CAACC,QAAS,CACrC,CAAC,EACD;UACCL,IAAI,EAAE,UAAU;UAChBL,EAAE,EAAE;QACL,CACD,CAAC;MACF,CAAC,CAAC,OAAQW,KAAK,EAAG;QACjB,MAAMC,YAAY,GACjBD,KAAK,CAACE,OAAO,IAAIF,KAAK,CAACG,IAAI,KAAK,eAAe,GAC5CH,KAAK,CAACE,OAAO,GACb,IAAAX,QAAE,EACF,uDACA,CAAC;QAELR,iBAAiB,CAAEkB,YAAY,EAAE;UAAEP,IAAI,EAAE;QAAW,CAAE,CAAC;MACxD;IACD,CAAC;IACDU,cAAc,EAAE;EACjB,CAAC,CAAE,EACH,CAAEtB,mBAAmB,EAAEC,iBAAiB,EAAEG,kBAAkB,CAC7D,CAAC;AACF"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _components = require("@wordpress/components");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
function FieldActions({
|
|
16
|
-
item,
|
|
17
|
-
actions
|
|
18
|
-
}) {
|
|
19
|
-
return (0, _react.createElement)(_components.DropdownMenu, {
|
|
20
|
-
icon: _icons.moreVertical,
|
|
21
|
-
label: (0, _i18n.__)('Actions')
|
|
22
|
-
}, () => (0, _react.createElement)(_components.MenuGroup, null, actions.map(action => (0, _react.createElement)(_components.MenuItem, {
|
|
23
|
-
key: action.id,
|
|
24
|
-
onClick: () => action.perform(item),
|
|
25
|
-
isDestructive: action.isDesctructive
|
|
26
|
-
}, action.label))));
|
|
27
|
-
}
|
|
28
|
-
var _default = FieldActions;
|
|
29
|
-
exports.default = _default;
|
|
30
|
-
//# sourceMappingURL=field-actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_icons","FieldActions","item","actions","_react","createElement","DropdownMenu","icon","moreVertical","label","__","MenuGroup","map","action","MenuItem","key","id","onClick","perform","isDestructive","isDesctructive","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/dataviews/field-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nfunction FieldActions( { item, actions } ) {\n\treturn (\n\t\t<DropdownMenu icon={ moreVertical } label={ __( 'Actions' ) }>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\tonClick={ () => action.perform( item ) }\n\t\t\t\t\t\t\tisDestructive={ action.isDesctructive }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ action.label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) ) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nexport default FieldActions;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,SAASG,YAAYA,CAAE;EAAEC,IAAI;EAAEC;AAAQ,CAAC,EAAG;EAC1C,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAS,YAAY;IAACC,IAAI,EAAGC,mBAAc;IAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU;EAAG,GAC1D,MACD,IAAAN,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAc,SAAS,QACPR,OAAO,CAACS,GAAG,CAAIC,MAAM,IACtB,IAAAT,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAiB,QAAQ;IACRC,GAAG,EAAGF,MAAM,CAACG,EAAI;IACjBC,OAAO,EAAGA,CAAA,KAAMJ,MAAM,CAACK,OAAO,CAAEhB,IAAK,CAAG;IACxCiB,aAAa,EAAGN,MAAM,CAACO;EAAgB,GAErCP,MAAM,CAACJ,KACA,CACT,CACQ,CAEC,CAAC;AAEjB;AAAC,IAAAY,QAAA,GAEcpB,YAAY;AAAAqB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_useDebouncedInput","_interopRequireDefault","TextFilter","id","view","onChangeView","search","setSearch","debouncedSearch","useDebouncedInput","filters","onChangeViewRef","useRef","useEffect","current","currentView","page","searchLabel","__","_react","createElement","SearchControl","onChange","value","label","placeholder","size"],"sources":["@wordpress/edit-site/src/components/dataviews/text-filter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { SearchControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useDebouncedInput from '../../utils/use-debounced-input';\n\nexport default function TextFilter( { id, view, onChangeView } ) {\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput(\n\t\tview.filters[ id ]\n\t);\n\tconst onChangeViewRef = useRef( onChangeView );\n\tuseEffect( () => {\n\t\tonChangeViewRef.current = onChangeView;\n\t}, [ onChangeView ] );\n\tuseEffect( () => {\n\t\tonChangeViewRef.current( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tpage: 1,\n\t\t\tfilters: {\n\t\t\t\t...currentView.filters,\n\t\t\t\t[ id ]: debouncedSearch,\n\t\t\t},\n\t\t} ) );\n\t}, [ debouncedSearch ] );\n\tconst searchLabel = __( 'Filter list' );\n\treturn (\n\t\t<SearchControl\n\t\t\tonChange={ setSearch }\n\t\t\tvalue={ search }\n\t\t\tlabel={ searchLabel }\n\t\t\tplaceholder={ searchLabel }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,kBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EAAEC,EAAE;EAAEC,IAAI;EAAEC;AAAa,CAAC,EAAG;EAChE,MAAM,CAAEC,MAAM,EAAEC,SAAS,EAAEC,eAAe,CAAE,GAAG,IAAAC,0BAAiB,EAC/DL,IAAI,CAACM,OAAO,CAAEP,EAAE,CACjB,CAAC;EACD,MAAMQ,eAAe,GAAG,IAAAC,eAAM,EAAEP,YAAa,CAAC;EAC9C,IAAAQ,kBAAS,EAAE,MAAM;IAChBF,eAAe,CAACG,OAAO,GAAGT,YAAY;EACvC,CAAC,EAAE,CAAEA,YAAY,CAAG,CAAC;EACrB,IAAAQ,kBAAS,EAAE,MAAM;IAChBF,eAAe,CAACG,OAAO,CAAIC,WAAW,KAAQ;MAC7C,GAAGA,WAAW;MACdC,IAAI,EAAE,CAAC;MACPN,OAAO,EAAE;QACR,GAAGK,WAAW,CAACL,OAAO;QACtB,CAAEP,EAAE,GAAIK;MACT;IACD,CAAC,CAAG,CAAC;EACN,CAAC,EAAE,CAAEA,eAAe,CAAG,CAAC;EACxB,MAAMS,WAAW,GAAG,IAAAC,QAAE,EAAE,aAAc,CAAC;EACvC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAsB,aAAa;IACbC,QAAQ,EAAGf,SAAW;IACtBgB,KAAK,EAAGjB,MAAQ;IAChBkB,KAAK,EAAGP,WAAa;IACrBQ,WAAW,EAAGR,WAAa;IAC3BS,IAAI,EAAC;EAAS,CACd,CAAC;AAEJ"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
|
-
export default function useMoveToTrashAction() {
|
|
11
|
-
const {
|
|
12
|
-
createSuccessNotice,
|
|
13
|
-
createErrorNotice
|
|
14
|
-
} = useDispatch(noticesStore);
|
|
15
|
-
const {
|
|
16
|
-
deleteEntityRecord
|
|
17
|
-
} = useDispatch(coreStore);
|
|
18
|
-
return useMemo(() => ({
|
|
19
|
-
id: 'move-to-trash',
|
|
20
|
-
label: __('Move to Trash'),
|
|
21
|
-
async perform(post) {
|
|
22
|
-
try {
|
|
23
|
-
await deleteEntityRecord('postType', post.type, post.id, {}, {
|
|
24
|
-
throwOnError: true
|
|
25
|
-
});
|
|
26
|
-
createSuccessNotice(sprintf( /* translators: The page's title. */
|
|
27
|
-
__('"%s" moved to the Trash.'), decodeEntities(post.title.rendered)), {
|
|
28
|
-
type: 'snackbar',
|
|
29
|
-
id: 'edit-site-page-trashed'
|
|
30
|
-
});
|
|
31
|
-
} catch (error) {
|
|
32
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while moving the page to the trash.');
|
|
33
|
-
createErrorNotice(errorMessage, {
|
|
34
|
-
type: 'snackbar'
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
isDesctructive: true
|
|
39
|
-
}), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=trash-post.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","decodeEntities","store","coreStore","__","sprintf","noticesStore","useMemo","useMoveToTrashAction","createSuccessNotice","createErrorNotice","deleteEntityRecord","id","label","perform","post","type","throwOnError","title","rendered","error","errorMessage","message","code","isDesctructive"],"sources":["@wordpress/edit-site/src/components/actions/trash-post.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\n\nexport default function useMoveToTrashAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'move-to-trash',\n\t\t\tlabel: __( 'Move to Trash' ),\n\t\t\tasync perform( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDesctructive: true,\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,mBAAmB;IAAEC;EAAkB,CAAC,GAC/CV,WAAW,CAAEM,YAAa,CAAC;EAC5B,MAAM;IAAEK;EAAmB,CAAC,GAAGX,WAAW,CAAEG,SAAU,CAAC;EAEvD,OAAOI,OAAO,CACb,OAAQ;IACPK,EAAE,EAAE,eAAe;IACnBC,KAAK,EAAET,EAAE,CAAE,eAAgB,CAAC;IAC5B,MAAMU,OAAOA,CAAEC,IAAI,EAAG;MACrB,IAAI;QACH,MAAMJ,kBAAkB,CACvB,UAAU,EACVI,IAAI,CAACC,IAAI,EACTD,IAAI,CAACH,EAAE,EACP,CAAC,CAAC,EACF;UAAEK,YAAY,EAAE;QAAK,CACtB,CAAC;QACDR,mBAAmB,CAClBJ,OAAO,EACN;QACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCH,cAAc,CAAEc,IAAI,CAACG,KAAK,CAACC,QAAS,CACrC,CAAC,EACD;UACCH,IAAI,EAAE,UAAU;UAChBJ,EAAE,EAAE;QACL,CACD,CAAC;MACF,CAAC,CAAC,OAAQQ,KAAK,EAAG;QACjB,MAAMC,YAAY,GACjBD,KAAK,CAACE,OAAO,IAAIF,KAAK,CAACG,IAAI,KAAK,eAAe,GAC5CH,KAAK,CAACE,OAAO,GACblB,EAAE,CACF,uDACA,CAAC;QAELM,iBAAiB,CAAEW,YAAY,EAAE;UAAEL,IAAI,EAAE;QAAW,CAAE,CAAC;MACxD;IACD,CAAC;IACDQ,cAAc,EAAE;EACjB,CAAC,CAAE,EACH,CAAEf,mBAAmB,EAAEC,iBAAiB,EAAEC,kBAAkB,CAC7D,CAAC;AACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { moreVertical } from '@wordpress/icons';
|
|
8
|
-
function FieldActions({
|
|
9
|
-
item,
|
|
10
|
-
actions
|
|
11
|
-
}) {
|
|
12
|
-
return createElement(DropdownMenu, {
|
|
13
|
-
icon: moreVertical,
|
|
14
|
-
label: __('Actions')
|
|
15
|
-
}, () => createElement(MenuGroup, null, actions.map(action => createElement(MenuItem, {
|
|
16
|
-
key: action.id,
|
|
17
|
-
onClick: () => action.perform(item),
|
|
18
|
-
isDestructive: action.isDesctructive
|
|
19
|
-
}, action.label))));
|
|
20
|
-
}
|
|
21
|
-
export default FieldActions;
|
|
22
|
-
//# sourceMappingURL=field-actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DropdownMenu","MenuGroup","MenuItem","__","moreVertical","FieldActions","item","actions","createElement","icon","label","map","action","key","id","onClick","perform","isDestructive","isDesctructive"],"sources":["@wordpress/edit-site/src/components/dataviews/field-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nfunction FieldActions( { item, actions } ) {\n\treturn (\n\t\t<DropdownMenu icon={ moreVertical } label={ __( 'Actions' ) }>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ actions.map( ( action ) => (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\tonClick={ () => action.perform( item ) }\n\t\t\t\t\t\t\tisDestructive={ action.isDesctructive }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ action.label }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) ) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nexport default FieldActions;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,SAASC,YAAYA,CAAE;EAAEC,IAAI;EAAEC;AAAQ,CAAC,EAAG;EAC1C,OACCC,aAAA,CAACR,YAAY;IAACS,IAAI,EAAGL,YAAc;IAACM,KAAK,EAAGP,EAAE,CAAE,SAAU;EAAG,GAC1D,MACDK,aAAA,CAACP,SAAS,QACPM,OAAO,CAACI,GAAG,CAAIC,MAAM,IACtBJ,aAAA,CAACN,QAAQ;IACRW,GAAG,EAAGD,MAAM,CAACE,EAAI;IACjBC,OAAO,EAAGA,CAAA,KAAMH,MAAM,CAACI,OAAO,CAAEV,IAAK,CAAG;IACxCW,aAAa,EAAGL,MAAM,CAACM;EAAgB,GAErCN,MAAM,CAACF,KACA,CACT,CACQ,CAEC,CAAC;AAEjB;AAEA,eAAeL,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","useEffect","useRef","SearchControl","useDebouncedInput","TextFilter","id","view","onChangeView","search","setSearch","debouncedSearch","filters","onChangeViewRef","current","currentView","page","searchLabel","createElement","onChange","value","label","placeholder","size"],"sources":["@wordpress/edit-site/src/components/dataviews/text-filter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { SearchControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useDebouncedInput from '../../utils/use-debounced-input';\n\nexport default function TextFilter( { id, view, onChangeView } ) {\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput(\n\t\tview.filters[ id ]\n\t);\n\tconst onChangeViewRef = useRef( onChangeView );\n\tuseEffect( () => {\n\t\tonChangeViewRef.current = onChangeView;\n\t}, [ onChangeView ] );\n\tuseEffect( () => {\n\t\tonChangeViewRef.current( ( currentView ) => ( {\n\t\t\t...currentView,\n\t\t\tpage: 1,\n\t\t\tfilters: {\n\t\t\t\t...currentView.filters,\n\t\t\t\t[ id ]: debouncedSearch,\n\t\t\t},\n\t\t} ) );\n\t}, [ debouncedSearch ] );\n\tconst searchLabel = __( 'Filter list' );\n\treturn (\n\t\t<SearchControl\n\t\t\tonChange={ setSearch }\n\t\t\tvalue={ search }\n\t\t\tlabel={ searchLabel }\n\t\t\tplaceholder={ searchLabel }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,aAAa,QAAQ,uBAAuB;;AAErD;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,iCAAiC;AAE/D,eAAe,SAASC,UAAUA,CAAE;EAAEC,EAAE;EAAEC,IAAI;EAAEC;AAAa,CAAC,EAAG;EAChE,MAAM,CAAEC,MAAM,EAAEC,SAAS,EAAEC,eAAe,CAAE,GAAGP,iBAAiB,CAC/DG,IAAI,CAACK,OAAO,CAAEN,EAAE,CACjB,CAAC;EACD,MAAMO,eAAe,GAAGX,MAAM,CAAEM,YAAa,CAAC;EAC9CP,SAAS,CAAE,MAAM;IAChBY,eAAe,CAACC,OAAO,GAAGN,YAAY;EACvC,CAAC,EAAE,CAAEA,YAAY,CAAG,CAAC;EACrBP,SAAS,CAAE,MAAM;IAChBY,eAAe,CAACC,OAAO,CAAIC,WAAW,KAAQ;MAC7C,GAAGA,WAAW;MACdC,IAAI,EAAE,CAAC;MACPJ,OAAO,EAAE;QACR,GAAGG,WAAW,CAACH,OAAO;QACtB,CAAEN,EAAE,GAAIK;MACT;IACD,CAAC,CAAG,CAAC;EACN,CAAC,EAAE,CAAEA,eAAe,CAAG,CAAC;EACxB,MAAMM,WAAW,GAAGjB,EAAE,CAAE,aAAc,CAAC;EACvC,OACCkB,aAAA,CAACf,aAAa;IACbgB,QAAQ,EAAGT,SAAW;IACtBU,KAAK,EAAGX,MAAQ;IAChBY,KAAK,EAAGJ,WAAa;IACrBK,WAAW,EAAGL,WAAa;IAC3BM,IAAI,EAAC;EAAS,CACd,CAAC;AAEJ"}
|