@wordpress/edit-site 6.4.0 → 6.5.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/add-new-pattern/index.js +6 -1
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-post/index.js +2 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +2 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/editor/index.js +71 -20
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +3 -4
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +0 -5
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +25 -5
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +1 -8
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +21 -6
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +2 -3
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/screen-typeset.js +40 -0
- package/build/components/global-styles/screen-typeset.js.map +1 -0
- package/build/components/global-styles/screen-typography-element.js +14 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +50 -59
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/typeset-button.js +97 -0
- package/build/components/global-styles/typeset-button.js.map +1 -0
- package/build/components/global-styles/typeset.js +80 -0
- package/build/components/global-styles/typeset.js.map +1 -0
- package/build/components/global-styles/ui.js +4 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +10 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/page-patterns/fields.js +230 -0
- package/build/components/page-patterns/fields.js.map +1 -0
- package/build/components/page-patterns/index.js +8 -226
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +26 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/fields.js +169 -0
- package/build/components/page-templates/fields.js.map +1 -0
- package/build/components/page-templates/index.js +10 -177
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/post-edit/index.js +18 -6
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +19 -15
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +125 -67
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -3
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +81 -81
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -42
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +22 -25
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -3
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +6 -1
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +2 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +2 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/editor/index.js +73 -22
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +3 -4
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +0 -5
- 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 +26 -6
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +1 -8
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +21 -6
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +2 -3
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-typeset.js +34 -0
- package/build-module/components/global-styles/screen-typeset.js.map +1 -0
- package/build-module/components/global-styles/screen-typography-element.js +14 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +51 -60
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/typeset-button.js +89 -0
- package/build-module/components/global-styles/typeset-button.js.map +1 -0
- package/build-module/components/global-styles/typeset.js +71 -0
- package/build-module/components/global-styles/typeset.js.map +1 -0
- package/build-module/components/global-styles/ui.js +4 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +10 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +223 -0
- package/build-module/components/page-patterns/fields.js.map +1 -0
- package/build-module/components/page-patterns/index.js +11 -229
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +26 -1
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/fields.js +160 -0
- package/build-module/components/page-templates/fields.js.map +1 -0
- package/build-module/components/page-templates/index.js +12 -178
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +20 -8
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +19 -15
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +127 -69
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -3
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +81 -81
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +3 -42
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +7 -4
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +23 -26
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +2 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +0 -2
- package/build-module/index.js.map +1 -1
- package/build-style/posts-rtl.css +190 -11
- package/build-style/posts.css +190 -11
- package/build-style/style-rtl.css +296 -55
- package/build-style/style.css +296 -55
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +8 -3
- package/src/components/add-new-post/index.js +2 -1
- package/src/components/add-new-template/utils.js +10 -6
- package/src/components/editor/index.js +80 -22
- package/src/components/editor/style.scss +59 -1
- package/src/components/global-styles/font-families.js +3 -5
- package/src/components/global-styles/font-library-modal/context.js +0 -5
- package/src/components/global-styles/font-library-modal/font-collection.js +34 -10
- package/src/components/global-styles/font-library-modal/index.js +2 -7
- package/src/components/global-styles/font-library-modal/installed-fonts.js +23 -5
- package/src/components/global-styles/font-library-modal/style.scss +1 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +2 -2
- package/src/components/global-styles/screen-typeset.js +42 -0
- package/src/components/global-styles/screen-typography-element.js +14 -0
- package/src/components/global-styles/screen-typography.js +4 -4
- package/src/components/global-styles/shadows-edit-panel.js +66 -73
- package/src/components/global-styles/style.scss +4 -7
- package/src/components/global-styles/typeset-button.js +93 -0
- package/src/components/global-styles/typeset.js +73 -0
- package/src/components/global-styles/ui.js +5 -0
- package/src/components/global-styles/utils.js +13 -1
- package/src/components/layout/style.scss +8 -0
- package/src/components/page-patterns/fields.js +251 -0
- package/src/components/page-patterns/index.js +15 -244
- package/src/components/page-patterns/style.scss +82 -85
- package/src/components/page-patterns/use-patterns.js +31 -1
- package/src/components/page-templates/fields.js +157 -0
- package/src/components/page-templates/index.js +19 -170
- package/src/components/page-templates/style.scss +14 -5
- package/src/components/post-edit/index.js +27 -8
- package/src/components/post-fields/index.js +29 -17
- package/src/components/post-list/index.js +134 -74
- package/src/components/sidebar-dataviews/add-new-view.js +2 -4
- package/src/components/sidebar-dataviews/dataview-item.js +2 -2
- package/src/components/sidebar-dataviews/default-views.js +95 -95
- package/src/components/sidebar-dataviews/index.js +3 -37
- package/src/components/site-hub/index.js +11 -2
- package/src/components/site-icon/style.scss +4 -1
- package/src/components/style-book/index.js +27 -32
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/src/hooks/push-changes-to-global-styles/index.js +2 -3
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
- package/src/index.js +0 -2
- package/build/utils/clone-deep.js +0 -15
- package/build/utils/clone-deep.js.map +0 -1
- package/build-module/utils/clone-deep.js +0 -9
- package/build-module/utils/clone-deep.js.map +0 -1
- package/src/utils/clone-deep.js +0 -8
|
@@ -196,15 +196,16 @@ function usePostFields(viewType) {
|
|
|
196
196
|
item
|
|
197
197
|
}) => {
|
|
198
198
|
const addLink = [_constants.LAYOUT_TABLE, _constants.LAYOUT_GRID].includes(viewType) && item.status !== 'trash';
|
|
199
|
+
const renderedTitle = typeof item.title === 'string' ? item.title : item.title?.rendered;
|
|
199
200
|
const title = addLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_link.default, {
|
|
200
201
|
params: {
|
|
201
202
|
postId: item.id,
|
|
202
203
|
postType: item.type,
|
|
203
204
|
canvas: 'edit'
|
|
204
205
|
},
|
|
205
|
-
children: (0, _htmlEntities.decodeEntities)(
|
|
206
|
+
children: (0, _htmlEntities.decodeEntities)(renderedTitle) || (0, _i18n.__)('(no title)')
|
|
206
207
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
207
|
-
children: (0, _htmlEntities.decodeEntities)(
|
|
208
|
+
children: (0, _htmlEntities.decodeEntities)(renderedTitle) || (0, _i18n.__)('(no title)')
|
|
208
209
|
});
|
|
209
210
|
let suffix = '';
|
|
210
211
|
if (item.id === frontPageId) {
|
|
@@ -229,9 +230,7 @@ function usePostFields(viewType) {
|
|
|
229
230
|
}, {
|
|
230
231
|
label: (0, _i18n.__)('Author'),
|
|
231
232
|
id: 'author',
|
|
232
|
-
|
|
233
|
-
item
|
|
234
|
-
}) => item._embedded?.author[0]?.name,
|
|
233
|
+
type: 'integer',
|
|
235
234
|
elements: authors?.map(({
|
|
236
235
|
id,
|
|
237
236
|
name
|
|
@@ -239,7 +238,12 @@ function usePostFields(viewType) {
|
|
|
239
238
|
value: id,
|
|
240
239
|
label: name
|
|
241
240
|
})) || [],
|
|
242
|
-
render: PostAuthorField
|
|
241
|
+
render: PostAuthorField,
|
|
242
|
+
sort: (a, b, direction) => {
|
|
243
|
+
const nameA = a._embedded?.author?.[0]?.name || '';
|
|
244
|
+
const nameB = b._embedded?.author?.[0]?.name || '';
|
|
245
|
+
return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA);
|
|
246
|
+
}
|
|
243
247
|
}, {
|
|
244
248
|
label: (0, _i18n.__)('Status'),
|
|
245
249
|
id: 'status',
|
|
@@ -279,8 +283,16 @@ function usePostFields(viewType) {
|
|
|
279
283
|
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
280
284
|
});
|
|
281
285
|
}
|
|
286
|
+
const isPublished = item.status === 'publish';
|
|
287
|
+
if (isPublished) {
|
|
288
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %s: page creation time */
|
|
289
|
+
(0, _i18n.__)('<span>Published: <time>%s</time></span>'), getFormattedDate(item.date)), {
|
|
290
|
+
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
291
|
+
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
292
|
+
});
|
|
293
|
+
}
|
|
282
294
|
|
|
283
|
-
// Pending
|
|
295
|
+
// Pending posts show the modified date if it's newer.
|
|
284
296
|
const dateToDisplay = (0, _date.getDate)(item.modified) > (0, _date.getDate)(item.date) ? item.modified : item.date;
|
|
285
297
|
const isPending = item.status === 'pending';
|
|
286
298
|
if (isPending) {
|
|
@@ -290,14 +302,6 @@ function usePostFields(viewType) {
|
|
|
290
302
|
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
291
303
|
});
|
|
292
304
|
}
|
|
293
|
-
const isPublished = item.status === 'publish';
|
|
294
|
-
if (isPublished) {
|
|
295
|
-
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %s: the newest of created or modified date for the page */
|
|
296
|
-
(0, _i18n.__)('<span>Published: <time>%s</time></span>'), getFormattedDate(dateToDisplay)), {
|
|
297
|
-
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
298
|
-
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
305
|
|
|
302
306
|
// Unknow status.
|
|
303
307
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_htmlEntities","_element","_date","_icons","_components","_data","_coreData","_constants","_link","_interopRequireWildcard","_media","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","STATUSES","value","label","__","icon","drafts","scheduled","pending","notAllowed","published","trash","getFormattedDate","dateToDisplay","dateI18n","getSettings","formats","datetimeAbbreviated","getDate","FeaturedImage","item","viewType","isDisabled","status","onClick","useLink","postId","id","postType","type","canvas","hasMedia","featured_media","size","LAYOUT_GRID","media","jsx","className","renderButton","LAYOUT_LIST","children","title","rendered","PostStatusField","find","jsxs","__experimentalHStack","alignment","spacing","Icon","PostAuthorField","text","imageUrl","useSelect","select","getUser","coreStore","user","author","avatar_urls","name","isImageLoaded","setIsImageLoaded","useState","clsx","onLoad","alt","src","authorIcon","usePostFields","records","authors","isResolving","isLoadingAuthors","useEntityRecords","per_page","frontPageId","postsPageId","getEntityRecord","siteSettings","page_on_front","page_for_posts","fields","useMemo","getValue","render","enableSorting","raw","addLink","LAYOUT_TABLE","includes","params","decodeEntities","suffix","justify","enableHiding","_embedded","elements","map","_STATUSES$find$label","filterBy","operators","OPERATOR_IS_ANY","isDraftOrPrivate","createInterpolateElement","sprintf","date","span","time","isScheduled","modified","isPending","isPublished","isLoading","_default","exports"],"sources":["@wordpress/edit-site/src/components/post-fields/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n\tcommentAuthorAvatar as authorIcon,\n} from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\nimport { default as Link, useLink } from '../routes/link';\nimport Media from '../media';\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ), icon: drafts },\n\t{ value: 'future', label: __( 'Scheduled' ), icon: scheduled },\n\t{ value: 'pending', label: __( 'Pending Review' ), icon: pending },\n\t{ value: 'private', label: __( 'Private' ), icon: notAllowed },\n\t{ value: 'publish', label: __( 'Published' ), icon: published },\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\n\nconst getFormattedDate = ( dateToDisplay ) =>\n\tdateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( dateToDisplay )\n\t);\n\nfunction FeaturedImage( { item, viewType } ) {\n\tconst isDisabled = item.status === 'trash';\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\tconst hasMedia = !! item.featured_media;\n\tconst size =\n\t\tviewType === LAYOUT_GRID\n\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ];\n\tconst media = hasMedia ? (\n\t\t<Media\n\t\t\tclassName=\"edit-site-post-list__featured-image\"\n\t\t\tid={ item.featured_media }\n\t\t\tsize={ size }\n\t\t/>\n\t) : null;\n\tconst renderButton = viewType !== LAYOUT_LIST && ! isDisabled;\n\treturn (\n\t\t<div\n\t\t\tclassName={ `edit-site-post-list__featured-image-wrapper is-layout-${ viewType }` }\n\t\t>\n\t\t\t{ renderButton ? (\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"edit-site-post-list__featured-image-button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\taria-label={ item.title?.rendered || __( '(no title)' ) }\n\t\t\t\t>\n\t\t\t\t\t{ media }\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\tmedia\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PostStatusField( { item } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"edit-site-post-list__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction PostAuthorField( { item } ) {\n\tconst { text, imageUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\tconst user = getUser( item.author );\n\t\t\treturn {\n\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\ttext: user?.name,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction usePostFields( viewType ) {\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user', { per_page: -1 } );\n\n\tconst { frontPageId, postsPageId } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPageId: siteSettings?.page_on_front,\n\t\t\tpostsPageId: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\tlabel: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<FeaturedImage item={ item } viewType={ viewType } />\n\t\t\t\t),\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\ttype: 'text',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\ttypeof item.title === 'string'\n\t\t\t\t\t\t? item.title\n\t\t\t\t\t\t: item.title?.raw,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst addLink =\n\t\t\t\t\t\t[ LAYOUT_TABLE, LAYOUT_GRID ].includes( viewType ) &&\n\t\t\t\t\t\titem.status !== 'trash';\n\t\t\t\t\tconst title = addLink ? (\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t);\n\n\t\t\t\t\tlet suffix = '';\n\t\t\t\t\tif ( item.id === frontPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( item.id === postsPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tclassName=\"edit-site-post-list__title\"\n\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t\trender: PostAuthorField,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\telements: STATUSES,\n\t\t\t\trender: PostStatusField,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IS_ANY ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst isDraftOrPrivate = [ 'draft', 'private' ].includes(\n\t\t\t\t\t\titem.status\n\t\t\t\t\t);\n\t\t\t\t\tif ( isDraftOrPrivate ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isScheduled = item.status === 'future';\n\t\t\t\t\tif ( isScheduled ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Scheduled: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Pending & Published posts show the modified date if it's newer.\n\t\t\t\t\tconst dateToDisplay =\n\t\t\t\t\t\tgetDate( item.modified ) > getDate( item.date )\n\t\t\t\t\t\t\t? item.modified\n\t\t\t\t\t\t\t: item.date;\n\n\t\t\t\t\tconst isPending = item.status === 'pending';\n\t\t\t\t\tif ( isPending ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isPublished = item.status === 'publish';\n\t\t\t\t\tif ( isPublished ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Published: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Unknow status.\n\t\t\t\t\treturn <time>{ getFormattedDate( item.date ) }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, viewType, frontPageId, postsPageId ]\n\t);\n\n\treturn {\n\t\tisLoading: isLoadingAuthors,\n\t\tfields,\n\t};\n}\n\nexport default usePostFields;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AASA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,UAAA,GAAAT,OAAA;AAMA,IAAAU,KAAA,GAAAC,uBAAA,CAAAX,OAAA;AACA,IAAAY,MAAA,GAAAb,sBAAA,CAAAC,OAAA;AAA6B,IAAAa,WAAA,GAAAb,OAAA;AAAA,SAAAc,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAA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ACD,CAAC;MACF;MAEA,MAAM4E,WAAW,GAAG5F,IAAI,CAACG,MAAM,KAAK,SAAS;MAC7C,IAAKyF,WAAW,EAAG;QAClB,OAAO,IAAAR,iCAAwB,EAC9B,IAAAC,aAAO,GACN;QACA,IAAArG,QAAE,EAAE,yCAA0C,CAAC,EAC/CQ,gBAAgB,CAAEC,aAAc,CACjC,CAAC,EACD;UACC8F,IAAI,eAAE,IAAA/H,WAAA,CAAAwD,GAAA,YAAO,CAAC;UACdwE,IAAI,eAAE,IAAAhI,WAAA,CAAAwD,GAAA,YAAO;QACd,CACD,CAAC;MACF;;MAEA;MACA,oBAAO,IAAAxD,WAAA,CAAAwD,GAAA;QAAAI,QAAA,EAAQ5B,gBAAgB,CAAEQ,IAAI,CAACsF,IAAK;MAAC,CAAQ,CAAC;IACtD;EACD,CAAC,CACD,EACD,CAAEnC,OAAO,EAAElD,QAAQ,EAAEuD,WAAW,EAAEC,WAAW,CAC9C,CAAC;EAED,OAAO;IACNoC,SAAS,EAAExC,gBAAgB;IAC3BS;EACD,CAAC;AACF;AAAC,IAAAgC,QAAA,GAAAC,OAAA,CAAAhI,OAAA,GAEckF,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_htmlEntities","_element","_date","_icons","_components","_data","_coreData","_constants","_link","_interopRequireWildcard","_media","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","STATUSES","value","label","__","icon","drafts","scheduled","pending","notAllowed","published","trash","getFormattedDate","dateToDisplay","dateI18n","getSettings","formats","datetimeAbbreviated","getDate","FeaturedImage","item","viewType","isDisabled","status","onClick","useLink","postId","id","postType","type","canvas","hasMedia","featured_media","size","LAYOUT_GRID","media","jsx","className","renderButton","LAYOUT_LIST","children","title","rendered","PostStatusField","find","jsxs","__experimentalHStack","alignment","spacing","Icon","PostAuthorField","text","imageUrl","useSelect","select","getUser","coreStore","user","author","avatar_urls","name","isImageLoaded","setIsImageLoaded","useState","clsx","onLoad","alt","src","authorIcon","usePostFields","records","authors","isResolving","isLoadingAuthors","useEntityRecords","per_page","frontPageId","postsPageId","getEntityRecord","siteSettings","page_on_front","page_for_posts","fields","useMemo","getValue","render","enableSorting","raw","addLink","LAYOUT_TABLE","includes","renderedTitle","params","decodeEntities","suffix","justify","enableHiding","elements","map","sort","b","direction","nameA","_embedded","nameB","localeCompare","_STATUSES$find$label","filterBy","operators","OPERATOR_IS_ANY","isDraftOrPrivate","createInterpolateElement","sprintf","date","span","time","isScheduled","isPublished","modified","isPending","isLoading","_default","exports"],"sources":["@wordpress/edit-site/src/components/post-fields/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcreateInterpolateElement,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n\tcommentAuthorAvatar as authorIcon,\n} from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\nimport { default as Link, useLink } from '../routes/link';\nimport Media from '../media';\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ), icon: drafts },\n\t{ value: 'future', label: __( 'Scheduled' ), icon: scheduled },\n\t{ value: 'pending', label: __( 'Pending Review' ), icon: pending },\n\t{ value: 'private', label: __( 'Private' ), icon: notAllowed },\n\t{ value: 'publish', label: __( 'Published' ), icon: published },\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\n\nconst getFormattedDate = ( dateToDisplay ) =>\n\tdateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( dateToDisplay )\n\t);\n\nfunction FeaturedImage( { item, viewType } ) {\n\tconst isDisabled = item.status === 'trash';\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\tconst hasMedia = !! item.featured_media;\n\tconst size =\n\t\tviewType === LAYOUT_GRID\n\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ];\n\tconst media = hasMedia ? (\n\t\t<Media\n\t\t\tclassName=\"edit-site-post-list__featured-image\"\n\t\t\tid={ item.featured_media }\n\t\t\tsize={ size }\n\t\t/>\n\t) : null;\n\tconst renderButton = viewType !== LAYOUT_LIST && ! isDisabled;\n\treturn (\n\t\t<div\n\t\t\tclassName={ `edit-site-post-list__featured-image-wrapper is-layout-${ viewType }` }\n\t\t>\n\t\t\t{ renderButton ? (\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"edit-site-post-list__featured-image-button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\taria-label={ item.title?.rendered || __( '(no title)' ) }\n\t\t\t\t>\n\t\t\t\t\t{ media }\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\tmedia\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PostStatusField( { item } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"edit-site-post-list__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction PostAuthorField( { item } ) {\n\tconst { text, imageUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\tconst user = getUser( item.author );\n\t\t\treturn {\n\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\ttext: user?.name,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction usePostFields( viewType ) {\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user', { per_page: -1 } );\n\n\tconst { frontPageId, postsPageId } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPageId: siteSettings?.page_on_front,\n\t\t\tpostsPageId: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\tlabel: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<FeaturedImage item={ item } viewType={ viewType } />\n\t\t\t\t),\n\t\t\t\tenableSorting: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\ttype: 'text',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\ttypeof item.title === 'string'\n\t\t\t\t\t\t? item.title\n\t\t\t\t\t\t: item.title?.raw,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst addLink =\n\t\t\t\t\t\t[ LAYOUT_TABLE, LAYOUT_GRID ].includes( viewType ) &&\n\t\t\t\t\t\titem.status !== 'trash';\n\t\t\t\t\tconst renderedTitle =\n\t\t\t\t\t\ttypeof item.title === 'string'\n\t\t\t\t\t\t\t? item.title\n\t\t\t\t\t\t\t: item.title?.rendered;\n\t\t\t\t\tconst title = addLink ? (\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( renderedTitle ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ decodeEntities( renderedTitle ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t);\n\n\t\t\t\t\tlet suffix = '';\n\t\t\t\t\tif ( item.id === frontPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( item.id === postsPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tclassName=\"edit-site-post-list__title\"\n\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\ttype: 'integer',\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t\trender: PostAuthorField,\n\t\t\t\tsort: ( a, b, direction ) => {\n\t\t\t\t\tconst nameA = a._embedded?.author?.[ 0 ]?.name || '';\n\t\t\t\t\tconst nameB = b._embedded?.author?.[ 0 ]?.name || '';\n\n\t\t\t\t\treturn direction === 'asc'\n\t\t\t\t\t\t? nameA.localeCompare( nameB )\n\t\t\t\t\t\t: nameB.localeCompare( nameA );\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\telements: STATUSES,\n\t\t\t\trender: PostStatusField,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IS_ANY ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst isDraftOrPrivate = [ 'draft', 'private' ].includes(\n\t\t\t\t\t\titem.status\n\t\t\t\t\t);\n\t\t\t\t\tif ( isDraftOrPrivate ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isScheduled = item.status === 'future';\n\t\t\t\t\tif ( isScheduled ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Scheduled: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isPublished = item.status === 'publish';\n\t\t\t\t\tif ( isPublished ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation time */\n\t\t\t\t\t\t\t\t__( '<span>Published: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Pending posts show the modified date if it's newer.\n\t\t\t\t\tconst dateToDisplay =\n\t\t\t\t\t\tgetDate( item.modified ) > getDate( item.date )\n\t\t\t\t\t\t\t? item.modified\n\t\t\t\t\t\t\t: item.date;\n\n\t\t\t\t\tconst isPending = item.status === 'pending';\n\t\t\t\t\tif ( isPending ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Unknow status.\n\t\t\t\t\treturn <time>{ getFormattedDate( item.date ) }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, viewType, frontPageId, postsPageId ]\n\t);\n\n\treturn {\n\t\tisLoading: isLoadingAuthors,\n\t\tfields,\n\t};\n}\n\nexport default usePostFields;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,M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gG,SAAS,EAAG;QAChB,OAAO,IAAAR,iCAAwB,EAC9B,IAAAC,aAAO,GACN;QACA,IAAA5G,QAAE,EAAE,wCAAyC,CAAC,EAC9CQ,gBAAgB,CAAEC,aAAc,CACjC,CAAC,EACD;UACCqG,IAAI,eAAE,IAAAtI,WAAA,CAAAwD,GAAA,YAAO,CAAC;UACd+E,IAAI,eAAE,IAAAvI,WAAA,CAAAwD,GAAA,YAAO;QACd,CACD,CAAC;MACF;;MAEA;MACA,oBAAO,IAAAxD,WAAA,CAAAwD,GAAA;QAAAI,QAAA,EAAQ5B,gBAAgB,CAAEQ,IAAI,CAAC6F,IAAK;MAAC,CAAQ,CAAC;IACtD;EACD,CAAC,CACD,EACD,CAAE1C,OAAO,EAAElD,QAAQ,EAAEuD,WAAW,EAAEC,WAAW,CAC9C,CAAC;EAED,OAAO;IACN2C,SAAS,EAAE/C,gBAAgB;IAC3BS;EACD,CAAC;AACF;AAAC,IAAAuC,QAAA,GAAAC,OAAA,CAAAvI,OAAA,GAEckF,aAAa","ignoreList":[]}
|
|
@@ -38,7 +38,39 @@ const {
|
|
|
38
38
|
useLocation,
|
|
39
39
|
useHistory
|
|
40
40
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
41
|
+
const {
|
|
42
|
+
useEntityRecordsWithPermissions
|
|
43
|
+
} = (0, _lockUnlock.unlock)(_coreData.privateApis);
|
|
41
44
|
const EMPTY_ARRAY = [];
|
|
45
|
+
const getDefaultView = (defaultViews, activeView) => {
|
|
46
|
+
return defaultViews.find(({
|
|
47
|
+
slug
|
|
48
|
+
}) => slug === activeView)?.view;
|
|
49
|
+
};
|
|
50
|
+
const getCustomView = editedEntityRecord => {
|
|
51
|
+
if (!editedEntityRecord?.content) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const content = JSON.parse(editedEntityRecord.content);
|
|
55
|
+
if (!content) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...content,
|
|
60
|
+
layout: _defaultViews.defaultLayouts[content.type]?.layout
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* This function abstracts working with default & custom views by
|
|
66
|
+
* providing a [ state, setState ] tuple based on the URL parameters.
|
|
67
|
+
*
|
|
68
|
+
* Consumers use the provided tuple to work with state
|
|
69
|
+
* and don't have to deal with the specifics of default & custom views.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} postType Post type to retrieve default views for.
|
|
72
|
+
* @return {Array} The [ state, setState ] tuple.
|
|
73
|
+
*/
|
|
42
74
|
function useView(postType) {
|
|
43
75
|
const {
|
|
44
76
|
params: {
|
|
@@ -48,75 +80,87 @@ function useView(postType) {
|
|
|
48
80
|
}
|
|
49
81
|
} = useLocation();
|
|
50
82
|
const history = useHistory();
|
|
51
|
-
const
|
|
83
|
+
const defaultViews = (0, _defaultViews.useDefaultViews)({
|
|
52
84
|
postType
|
|
53
85
|
});
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (isCustom === 'false' && layout) {
|
|
59
|
-
return {
|
|
60
|
-
...defaultView,
|
|
61
|
-
type: layout,
|
|
62
|
-
layout: _defaultViews.defaultLayouts[layout]?.layout
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return defaultView;
|
|
66
|
-
}, [isCustom, activeView, layout, postType, DEFAULT_VIEWS]);
|
|
67
|
-
const [view, setView] = (0, _element.useState)(selectedDefaultView);
|
|
68
|
-
(0, _element.useEffect)(() => {
|
|
69
|
-
if (selectedDefaultView) {
|
|
70
|
-
setView(selectedDefaultView);
|
|
71
|
-
}
|
|
72
|
-
}, [selectedDefaultView]);
|
|
73
|
-
const editedViewRecord = (0, _data.useSelect)(select => {
|
|
86
|
+
const {
|
|
87
|
+
editEntityRecord
|
|
88
|
+
} = (0, _data.useDispatch)(_coreData.store);
|
|
89
|
+
const editedEntityRecord = (0, _data.useSelect)(select => {
|
|
74
90
|
if (isCustom !== 'true') {
|
|
75
|
-
return;
|
|
91
|
+
return undefined;
|
|
76
92
|
}
|
|
77
93
|
const {
|
|
78
94
|
getEditedEntityRecord
|
|
79
95
|
} = select(_coreData.store);
|
|
80
|
-
|
|
81
|
-
return dataviewRecord;
|
|
96
|
+
return getEditedEntityRecord('postType', 'wp_dataviews', Number(activeView));
|
|
82
97
|
}, [activeView, isCustom]);
|
|
83
|
-
const {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
const [view, setView] = (0, _element.useState)(() => {
|
|
99
|
+
let initialView;
|
|
100
|
+
if (isCustom === 'true') {
|
|
101
|
+
var _getCustomView;
|
|
102
|
+
initialView = (_getCustomView = getCustomView(editedEntityRecord)) !== null && _getCustomView !== void 0 ? _getCustomView : {
|
|
103
|
+
type: layout !== null && layout !== void 0 ? layout : _constants.LAYOUT_LIST
|
|
104
|
+
};
|
|
105
|
+
} else {
|
|
106
|
+
var _getDefaultView;
|
|
107
|
+
initialView = (_getDefaultView = getDefaultView(defaultViews, activeView)) !== null && _getDefaultView !== void 0 ? _getDefaultView : {
|
|
108
|
+
type: layout !== null && layout !== void 0 ? layout : _constants.LAYOUT_LIST
|
|
109
|
+
};
|
|
90
110
|
}
|
|
111
|
+
const type = layout !== null && layout !== void 0 ? layout : initialView.type;
|
|
91
112
|
return {
|
|
92
|
-
...
|
|
93
|
-
|
|
113
|
+
...initialView,
|
|
114
|
+
type
|
|
94
115
|
};
|
|
95
|
-
}
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
params
|
|
105
|
-
} = history.getLocationWithParams();
|
|
116
|
+
});
|
|
117
|
+
const setViewWithUrlUpdate = (0, _element.useCallback)(newView => {
|
|
118
|
+
const {
|
|
119
|
+
params
|
|
120
|
+
} = history.getLocationWithParams();
|
|
121
|
+
if (newView.type === _constants.LAYOUT_LIST && !params?.layout) {
|
|
122
|
+
// Skip updating the layout URL param if
|
|
123
|
+
// it is not present and the newView.type is LAYOUT_LIST.
|
|
124
|
+
} else if (newView.type !== params?.layout) {
|
|
106
125
|
history.push({
|
|
107
126
|
...params,
|
|
108
|
-
layout:
|
|
127
|
+
layout: newView.type
|
|
109
128
|
});
|
|
110
129
|
}
|
|
111
|
-
setView(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
setView(newView);
|
|
131
|
+
if (isCustom === 'true' && editedEntityRecord?.id) {
|
|
132
|
+
editEntityRecord('postType', 'wp_dataviews', editedEntityRecord?.id, {
|
|
133
|
+
content: JSON.stringify(newView)
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, [history, isCustom, editEntityRecord, editedEntityRecord?.id]);
|
|
137
|
+
|
|
138
|
+
// When layout URL param changes, update the view type
|
|
139
|
+
// without affecting any other config.
|
|
140
|
+
(0, _element.useEffect)(() => {
|
|
141
|
+
setView(prevView => ({
|
|
142
|
+
...prevView,
|
|
143
|
+
type: layout !== null && layout !== void 0 ? layout : _constants.LAYOUT_LIST
|
|
144
|
+
}));
|
|
145
|
+
}, [layout]);
|
|
146
|
+
|
|
147
|
+
// When activeView or isCustom URL parameters change, reset the view.
|
|
148
|
+
(0, _element.useEffect)(() => {
|
|
149
|
+
let newView;
|
|
150
|
+
if (isCustom === 'true') {
|
|
151
|
+
newView = getCustomView(editedEntityRecord);
|
|
152
|
+
} else {
|
|
153
|
+
newView = getDefaultView(defaultViews, activeView);
|
|
154
|
+
}
|
|
155
|
+
if (newView) {
|
|
156
|
+
const type = layout !== null && layout !== void 0 ? layout : newView.type;
|
|
157
|
+
setView({
|
|
158
|
+
...newView,
|
|
159
|
+
type
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, [activeView, isCustom, layout, defaultViews, editedEntityRecord]);
|
|
163
|
+
return [view, setViewWithUrlUpdate, setViewWithUrlUpdate];
|
|
120
164
|
}
|
|
121
165
|
const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.
|
|
122
166
|
|
|
@@ -126,13 +170,15 @@ function getItemId(item) {
|
|
|
126
170
|
function PostList({
|
|
127
171
|
postType
|
|
128
172
|
}) {
|
|
129
|
-
var _postId$split,
|
|
173
|
+
var _postId$split, _data$map, _usePrevious;
|
|
130
174
|
const [view, setView] = useView(postType);
|
|
131
175
|
const history = useHistory();
|
|
132
176
|
const location = useLocation();
|
|
133
177
|
const {
|
|
134
178
|
postId,
|
|
135
|
-
quickEdit = false
|
|
179
|
+
quickEdit = false,
|
|
180
|
+
isCustom,
|
|
181
|
+
activeView = 'all'
|
|
136
182
|
} = location.params;
|
|
137
183
|
const [selection, setSelection] = (0, _element.useState)((_postId$split = postId?.split(',')) !== null && _postId$split !== void 0 ? _postId$split : []);
|
|
138
184
|
const onChangeSelection = (0, _element.useCallback)(items => {
|
|
@@ -148,9 +194,13 @@ function PostList({
|
|
|
148
194
|
});
|
|
149
195
|
}
|
|
150
196
|
}, [history]);
|
|
197
|
+
const {
|
|
198
|
+
isLoading: isLoadingFields,
|
|
199
|
+
fields
|
|
200
|
+
} = (0, _postFields.default)(view.type);
|
|
151
201
|
const queryArgs = (0, _element.useMemo)(() => {
|
|
152
202
|
const filters = {};
|
|
153
|
-
view.filters
|
|
203
|
+
view.filters?.forEach(filter => {
|
|
154
204
|
if (filter.field === 'status' && filter.operator === _constants.OPERATOR_IS_ANY) {
|
|
155
205
|
filters.status = filter.value;
|
|
156
206
|
}
|
|
@@ -177,11 +227,23 @@ function PostList({
|
|
|
177
227
|
}, [view]);
|
|
178
228
|
const {
|
|
179
229
|
records,
|
|
180
|
-
isResolving:
|
|
230
|
+
isResolving: isLoadingData,
|
|
181
231
|
totalItems,
|
|
182
232
|
totalPages
|
|
183
|
-
} = (
|
|
184
|
-
|
|
233
|
+
} = useEntityRecordsWithPermissions('postType', postType, queryArgs);
|
|
234
|
+
|
|
235
|
+
// The REST API sort the authors by ID, but we want to sort them by name.
|
|
236
|
+
const data = (0, _element.useMemo)(() => {
|
|
237
|
+
if (!isLoadingFields && view?.sort?.field === 'author') {
|
|
238
|
+
return (0, _dataviews.filterSortAndPaginate)(records, {
|
|
239
|
+
sort: {
|
|
240
|
+
...view.sort
|
|
241
|
+
}
|
|
242
|
+
}, fields).data;
|
|
243
|
+
}
|
|
244
|
+
return records;
|
|
245
|
+
}, [records, fields, isLoadingFields, view?.sort]);
|
|
246
|
+
const ids = (_data$map = data?.map(record => getItemId(record))) !== null && _data$map !== void 0 ? _data$map : [];
|
|
185
247
|
const prevIds = (_usePrevious = (0, _compose.usePrevious)(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : [];
|
|
186
248
|
const deletedIds = prevIds.filter(id => !ids.includes(id));
|
|
187
249
|
const postIdWasDeleted = deletedIds.includes(postId);
|
|
@@ -233,10 +295,6 @@ function PostList({
|
|
|
233
295
|
});
|
|
234
296
|
closeModal();
|
|
235
297
|
};
|
|
236
|
-
const {
|
|
237
|
-
isLoading: isLoadingFields,
|
|
238
|
-
fields
|
|
239
|
-
} = (0, _postFields.default)(view.type);
|
|
240
298
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
241
299
|
title: labels?.name,
|
|
242
300
|
actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -255,8 +313,8 @@ function PostList({
|
|
|
255
313
|
paginationInfo: paginationInfo,
|
|
256
314
|
fields: fields,
|
|
257
315
|
actions: actions,
|
|
258
|
-
data:
|
|
259
|
-
isLoading:
|
|
316
|
+
data: data || EMPTY_ARRAY,
|
|
317
|
+
isLoading: isLoadingData || isLoadingFields,
|
|
260
318
|
view: view,
|
|
261
319
|
onChangeView: setView,
|
|
262
320
|
selection: selection,
|
|
@@ -275,7 +333,7 @@ function PostList({
|
|
|
275
333
|
});
|
|
276
334
|
}
|
|
277
335
|
})
|
|
278
|
-
})
|
|
336
|
+
}, activeView + isCustom)
|
|
279
337
|
});
|
|
280
338
|
}
|
|
281
339
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_element","_router","_data","_dataviews","_editor","_i18n","_icons","_page","_interopRequireDefault","_defaultViews","_constants","_addNewPost","_lockUnlock","_dataviewsActions","_compose","_postFields","_jsxRuntime","usePostActions","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","EMPTY_ARRAY","useView","postType","params","activeView","isCustom","layout","history","DEFAULT_VIEWS","useDefaultViews","selectedDefaultView","useMemo","defaultView","find","slug","view","type","defaultLayouts","setView","useState","useEffect","editedViewRecord","useSelect","select","getEditedEntityRecord","coreStore","dataviewRecord","Number","editEntityRecord","useDispatch","customView","storedView","content","JSON","parse","setCustomView","useCallback","viewToSet","id","stringify","setDefaultViewAndUpdateUrl","getLocationWithParams","push","DEFAULT_STATUSES","getItemId","item","toString","PostList","_postId$split","_records$map","_usePrevious","location","postId","quickEdit","selection","setSelection","split","onChangeSelection","items","_params$isCustom","join","queryArgs","filters","forEach","filter","field","operator","OPERATOR_IS_ANY","status","value","author","OPERATOR_IS_NONE","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingMainEntities","totalItems","totalPages","useEntityRecords","ids","map","record","prevIds","usePrevious","deletedIds","includes","postIdWasDeleted","undefined","paginationInfo","labels","canCreateRecord","getPostType","canUser","kind","name","postTypeActions","context","editAction","useEditPostAction","actions","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","canvas","isLoading","isLoadingFields","fields","usePostFields","jsx","default","title","add_new_item","jsxs","Fragment","children","Button","variant","onClick","__next40pxDefaultSize","onSave","onClose","DataViews","data","onChangeView","header","window","__experimentalQuickEditDataViews","LAYOUT_LIST","size","isPressed","icon","drawerRight","label","__"],"sources":["@wordpress/edit-site/src/components/post-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tuseDefaultViews,\n\tdefaultLayouts,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\nimport usePostFields from '../post-fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst EMPTY_ARRAY = [];\n\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst DEFAULT_VIEWS = useDefaultViews( { postType } );\n\tconst selectedDefaultView = useMemo( () => {\n\t\tconst defaultView =\n\t\t\tisCustom === 'false' &&\n\t\t\tDEFAULT_VIEWS[ postType ].find(\n\t\t\t\t( { slug } ) => slug === activeView\n\t\t\t)?.view;\n\t\tif ( isCustom === 'false' && layout ) {\n\t\t\treturn {\n\t\t\t\t...defaultView,\n\t\t\t\ttype: layout,\n\t\t\t\tlayout: defaultLayouts[ layout ]?.layout,\n\t\t\t};\n\t\t}\n\t\treturn defaultView;\n\t}, [ isCustom, activeView, layout, postType, DEFAULT_VIEWS ] );\n\tconst [ view, setView ] = useState( selectedDefaultView );\n\n\tuseEffect( () => {\n\t\tif ( selectedDefaultView ) {\n\t\t\tsetView( selectedDefaultView );\n\t\t}\n\t}, [ selectedDefaultView ] );\n\tconst editedViewRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst dataviewRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t\treturn dataviewRecord;\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst customView = useMemo( () => {\n\t\tconst storedView =\n\t\t\teditedViewRecord?.content &&\n\t\t\tJSON.parse( editedViewRecord?.content );\n\t\tif ( ! storedView ) {\n\t\t\treturn storedView;\n\t\t}\n\n\t\treturn {\n\t\t\t...storedView,\n\t\t\tlayout: defaultLayouts[ storedView?.type ]?.layout,\n\t\t};\n\t}, [ editedViewRecord?.content ] );\n\n\tconst setCustomView = useCallback(\n\t\t( viewToSet ) => {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\teditedViewRecord?.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: JSON.stringify( viewToSet ),\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ editEntityRecord, editedViewRecord?.id ]\n\t);\n\n\tconst setDefaultViewAndUpdateUrl = useCallback(\n\t\t( viewToSet ) => {\n\t\t\tif ( viewToSet.type !== view?.type ) {\n\t\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: viewToSet.type,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetView( viewToSet );\n\t\t},\n\t\t[ history, view?.type ]\n\t);\n\n\tif ( isCustom === 'false' ) {\n\t\treturn [ view, setDefaultViewAndUpdateUrl ];\n\t} else if ( isCustom === 'true' && customView ) {\n\t\treturn [ customView, setCustomView ];\n\t}\n\t// Loading state where no the view was not found on custom views or default views.\n\treturn [ DEFAULT_VIEWS[ postType ][ 0 ].view, setDefaultViewAndUpdateUrl ];\n}\n\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nexport default function PostList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst { postId, quickEdit = false } = location.params;\n\tconst [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif ( ( params.isCustom ?? 'false' ) === 'false' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingMainEntities,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', postType, queryArgs );\n\n\tconst ids = records?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\tconst { isLoading: isLoadingFields, fields } = usePostFields( view.type );\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ records || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingMainEntities || isLoadingFields }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ setView }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\theader={\n\t\t\t\t\twindow.__experimentalQuickEditDataViews &&\n\t\t\t\t\tview.type !== LAYOUT_LIST &&\n\t\t\t\t\tpostType === 'page' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tisPressed={ quickEdit }\n\t\t\t\t\t\t\ticon={ drawerRight }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t! quickEdit\n\t\t\t\t\t\t\t\t\t? __( 'Show quick edit sidebar' )\n\t\t\t\t\t\t\t\t\t: __( 'Close quick edit sidebar' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t...location.params,\n\t\t\t\t\t\t\t\t\tquickEdit: quickEdit ? undefined : true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAIA,IAAAY,UAAA,GAAAZ,OAAA;AAMA,IAAAa,WAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,QAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAP,sBAAA,CAAAV,OAAA;AAA2C,IAAAkB,WAAA,GAAAlB,OAAA;AA/B3C;AACA;AACA;;AAWA;AACA;AACA;;AAkBA,MAAM;EAAEmB;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC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,QAAQ,KAAK,MAAM,iBAClB,IAAAT,WAAA,CAAA8H,GAAA,EAACjJ,WAAA,CAAAwJ,MAAM;QACNa,IAAI,EAAC,SAAS;QACdC,SAAS,EAAGvF,SAAW;QACvBwF,IAAI,EAAGC,kBAAa;QACpBC,KAAK,EACJ,CAAE1F,SAAS,GACR,IAAA2F,QAAE,EAAE,yBAA0B,CAAC,GAC/B,IAAAA,QAAE,EAAE,0BAA2B,CAClC;QACDhB,OAAO,EAAGA,CAAA,KAAM;UACfzH,OAAO,CAACmC,IAAI,CAAE;YACb,GAAGS,QAAQ,CAAChD,MAAM;YAClBkD,SAAS,EAAEA,SAAS,GAAG2C,SAAS,GAAG;UACpC,CAAE,CAAC;QACJ;MAAG,CACH;IAEF,CACD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_element","_router","_data","_dataviews","_editor","_i18n","_icons","_page","_interopRequireDefault","_defaultViews","_constants","_addNewPost","_lockUnlock","_dataviewsActions","_compose","_postFields","_jsxRuntime","usePostActions","unlock","editorPrivateApis","useLocation","useHistory","routerPrivateApis","useEntityRecordsWithPermissions","coreDataPrivateApis","EMPTY_ARRAY","getDefaultView","defaultViews","activeView","find","slug","view","getCustomView","editedEntityRecord","content","undefined","JSON","parse","layout","defaultLayouts","type","useView","postType","params","isCustom","history","useDefaultViews","editEntityRecord","useDispatch","coreStore","useSelect","select","getEditedEntityRecord","Number","setView","useState","initialView","_getCustomView","LAYOUT_LIST","_getDefaultView","setViewWithUrlUpdate","useCallback","newView","getLocationWithParams","push","id","stringify","useEffect","prevView","DEFAULT_STATUSES","getItemId","item","toString","PostList","_postId$split","_data$map","_usePrevious","location","postId","quickEdit","selection","setSelection","split","onChangeSelection","items","_params$isCustom","join","isLoading","isLoadingFields","fields","usePostFields","queryArgs","useMemo","filters","forEach","filter","field","operator","OPERATOR_IS_ANY","status","value","author","OPERATOR_IS_NONE","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingData","totalItems","totalPages","data","filterSortAndPaginate","ids","map","record","prevIds","usePrevious","deletedIds","includes","postIdWasDeleted","paginationInfo","labels","canCreateRecord","getPostType","canUser","kind","name","postTypeActions","context","editAction","useEditPostAction","actions","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","canvas","jsx","default","title","add_new_item","jsxs","Fragment","children","Button","variant","onClick","__next40pxDefaultSize","onSave","onClose","DataViews","onChangeView","header","window","__experimentalQuickEditDataViews","size","isPressed","icon","drawerRight","label","__"],"sources":["@wordpress/edit-site/src/components/post-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport {\n\tstore as coreStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\nimport { useState, useMemo, useCallback, useEffect } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport {\n\tuseDefaultViews,\n\tdefaultLayouts,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n\tLAYOUT_LIST,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\nimport usePostFields from '../post-fields';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( coreDataPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst getDefaultView = ( defaultViews, activeView ) => {\n\treturn defaultViews.find( ( { slug } ) => slug === activeView )?.view;\n};\n\nconst getCustomView = ( editedEntityRecord ) => {\n\tif ( ! editedEntityRecord?.content ) {\n\t\treturn undefined;\n\t}\n\n\tconst content = JSON.parse( editedEntityRecord.content );\n\tif ( ! content ) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\t...content,\n\t\tlayout: defaultLayouts[ content.type ]?.layout,\n\t};\n};\n\n/**\n * This function abstracts working with default & custom views by\n * providing a [ state, setState ] tuple based on the URL parameters.\n *\n * Consumers use the provided tuple to work with state\n * and don't have to deal with the specifics of default & custom views.\n *\n * @param {string} postType Post type to retrieve default views for.\n * @return {Array} The [ state, setState ] tuple.\n */\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst editedEntityRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\treturn getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst [ view, setView ] = useState( () => {\n\t\tlet initialView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tinitialView = getCustomView( editedEntityRecord ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t} else {\n\t\t\tinitialView = getDefaultView( defaultViews, activeView ) ?? {\n\t\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t\t};\n\t\t}\n\n\t\tconst type = layout ?? initialView.type;\n\t\treturn {\n\t\t\t...initialView,\n\t\t\ttype,\n\t\t};\n\t} );\n\n\tconst setViewWithUrlUpdate = useCallback(\n\t\t( newView ) => {\n\t\t\tconst { params } = history.getLocationWithParams();\n\n\t\t\tif ( newView.type === LAYOUT_LIST && ! params?.layout ) {\n\t\t\t\t// Skip updating the layout URL param if\n\t\t\t\t// it is not present and the newView.type is LAYOUT_LIST.\n\t\t\t} else if ( newView.type !== params?.layout ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: newView.type,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tsetView( newView );\n\n\t\t\tif ( isCustom === 'true' && editedEntityRecord?.id ) {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\teditedEntityRecord?.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: JSON.stringify( newView ),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, isCustom, editEntityRecord, editedEntityRecord?.id ]\n\t);\n\n\t// When layout URL param changes, update the view type\n\t// without affecting any other config.\n\tuseEffect( () => {\n\t\tsetView( ( prevView ) => ( {\n\t\t\t...prevView,\n\t\t\ttype: layout ?? LAYOUT_LIST,\n\t\t} ) );\n\t}, [ layout ] );\n\n\t// When activeView or isCustom URL parameters change, reset the view.\n\tuseEffect( () => {\n\t\tlet newView;\n\t\tif ( isCustom === 'true' ) {\n\t\t\tnewView = getCustomView( editedEntityRecord );\n\t\t} else {\n\t\t\tnewView = getDefaultView( defaultViews, activeView );\n\t\t}\n\n\t\tif ( newView ) {\n\t\t\tconst type = layout ?? newView.type;\n\t\t\tsetView( {\n\t\t\t\t...newView,\n\t\t\t\ttype,\n\t\t\t} );\n\t\t}\n\t}, [ activeView, isCustom, layout, defaultViews, editedEntityRecord ] );\n\n\treturn [ view, setViewWithUrlUpdate, setViewWithUrlUpdate ];\n}\n\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nexport default function PostList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tpostId,\n\t\tquickEdit = false,\n\t\tisCustom,\n\t\tactiveView = 'all',\n\t} = location.params;\n\tconst [ selection, setSelection ] = useState( postId?.split( ',' ) ?? [] );\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif ( ( params.isCustom ?? 'false' ) === 'false' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst { isLoading: isLoadingFields, fields } = usePostFields( view.type );\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters?.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingData,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecordsWithPermissions( 'postType', postType, queryArgs );\n\n\t// The REST API sort the authors by ID, but we want to sort them by name.\n\tconst data = useMemo( () => {\n\t\tif ( ! isLoadingFields && view?.sort?.field === 'author' ) {\n\t\t\treturn filterSortAndPaginate(\n\t\t\t\trecords,\n\t\t\t\t{ sort: { ...view.sort } },\n\t\t\t\tfields\n\t\t\t).data;\n\t\t}\n\n\t\treturn records;\n\t}, [ records, fields, isLoadingFields, view?.sort ] );\n\n\tconst ids = data?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView + isCustom }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingData || isLoadingFields }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ setView }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\theader={\n\t\t\t\t\twindow.__experimentalQuickEditDataViews &&\n\t\t\t\t\tview.type !== LAYOUT_LIST &&\n\t\t\t\t\tpostType === 'page' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tisPressed={ quickEdit }\n\t\t\t\t\t\t\ticon={ drawerRight }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t! quickEdit\n\t\t\t\t\t\t\t\t\t? __( 'Show quick edit sidebar' )\n\t\t\t\t\t\t\t\t\t: __( 'Close quick edit sidebar' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t...location.params,\n\t\t\t\t\t\t\t\t\tquickEdit: quickEdit ? undefined : true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAIA,IAAAY,UAAA,GAAAZ,OAAA;AAMA,IAAAa,WAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,QAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAP,sBAAA,CAAAV,OAAA;AAA2C,IAAAkB,WAAA,GAAAlB,OAAA;AAlC3C;AACA;AACA;;AAcA;AACA;AACA;;AAkBA,MAAM;EAAEmB;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAA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AAKkB,sBAAW,IACzBhB,QAAQ,KAAK,MAAM,iBAClB,IAAA1B,WAAA,CAAAkI,GAAA,EAACrJ,WAAA,CAAA4J,MAAM;QACNW,IAAI,EAAC,SAAS;QACdC,SAAS,EAAGtF,SAAW;QACvBuF,IAAI,EAAGC,kBAAa;QACpBC,KAAK,EACJ,CAAEzF,SAAS,GACR,IAAA0F,QAAE,EAAE,yBAA0B,CAAC,GAC/B,IAAAA,QAAE,EAAE,0BAA2B,CAClC;QACDd,OAAO,EAAGA,CAAA,KAAM;UACf9G,OAAO,CAACmB,IAAI,CAAE;YACb,GAAGa,QAAQ,CAAClC,MAAM;YAClBoC,SAAS,EAAEA,SAAS,GAAG5C,SAAS,GAAG;UACpC,CAAE,CAAC;QACJ;MAAG,CACH;IAEF,GAjCKP,UAAU,GAAGgB,QAkCnB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -37,7 +37,7 @@ function AddNewItemModalContent({
|
|
|
37
37
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
38
38
|
const [title, setTitle] = (0, _element.useState)('');
|
|
39
39
|
const [isSaving, setIsSaving] = (0, _element.useState)(false);
|
|
40
|
-
const
|
|
40
|
+
const defaultViews = (0, _defaultViews.useDefaultViews)({
|
|
41
41
|
postType: type
|
|
42
42
|
});
|
|
43
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
@@ -65,7 +65,7 @@ function AddNewItemModalContent({
|
|
|
65
65
|
title,
|
|
66
66
|
status: 'publish',
|
|
67
67
|
wp_dataviews_type: dataViewTaxonomyId,
|
|
68
|
-
content: JSON.stringify(
|
|
68
|
+
content: JSON.stringify(defaultViews[0].view)
|
|
69
69
|
});
|
|
70
70
|
const {
|
|
71
71
|
params: {
|