@wordpress/fields 0.26.0 → 0.27.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/actions/delete-post.js +5 -3
- package/build/actions/delete-post.js.map +1 -1
- package/build/actions/duplicate-pattern.js +5 -3
- package/build/actions/duplicate-pattern.js.map +1 -1
- package/build/actions/duplicate-post.js +4 -2
- package/build/actions/duplicate-post.js.map +1 -1
- package/build/actions/duplicate-template-part.js +4 -2
- package/build/actions/duplicate-template-part.js.map +1 -1
- package/build/actions/export-pattern.js +3 -1
- package/build/actions/export-pattern.js.map +1 -1
- package/build/actions/index.js +2 -0
- package/build/actions/index.js.map +1 -1
- package/build/actions/permanently-delete-post.js +4 -2
- package/build/actions/permanently-delete-post.js.map +1 -1
- package/build/actions/rename-post.js +8 -3
- package/build/actions/rename-post.js.map +2 -2
- package/build/actions/reorder-page.js +4 -2
- package/build/actions/reorder-page.js.map +1 -1
- package/build/actions/reset-post.js +6 -4
- package/build/actions/reset-post.js.map +1 -1
- package/build/actions/restore-post.js +3 -1
- package/build/actions/restore-post.js.map +1 -1
- package/build/actions/trash-post.js +7 -2
- package/build/actions/trash-post.js.map +2 -2
- package/build/actions/utils.js +2 -0
- package/build/actions/utils.js.map +1 -1
- package/build/actions/view-post-revisions.js +3 -1
- package/build/actions/view-post-revisions.js.map +1 -1
- package/build/actions/view-post.js +3 -1
- package/build/actions/view-post.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +4 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/utils.js +5 -3
- package/build/components/create-template-part-modal/utils.js.map +1 -1
- package/build/fields/author/author-view.js +3 -1
- package/build/fields/author/author-view.js.map +1 -1
- package/build/fields/author/index.js +3 -1
- package/build/fields/author/index.js.map +1 -1
- package/build/fields/comment-status/index.js +3 -1
- package/build/fields/comment-status/index.js.map +1 -1
- package/build/fields/date/date-view.js +5 -3
- package/build/fields/date/date-view.js.map +1 -1
- package/build/fields/date/index.js +3 -1
- package/build/fields/date/index.js.map +1 -1
- package/build/fields/discussion/index.js +3 -1
- package/build/fields/discussion/index.js.map +1 -1
- package/build/fields/featured-image/featured-image-edit.js +5 -3
- package/build/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build/fields/featured-image/featured-image-view.js +3 -1
- package/build/fields/featured-image/featured-image-view.js.map +1 -1
- package/build/fields/featured-image/index.js +3 -1
- package/build/fields/featured-image/index.js.map +1 -1
- package/build/fields/index.js +2 -0
- package/build/fields/index.js.map +1 -1
- package/build/fields/order/index.js +3 -1
- package/build/fields/order/index.js.map +1 -1
- package/build/fields/page-title/index.js +3 -1
- package/build/fields/page-title/index.js.map +1 -1
- package/build/fields/page-title/view.js +4 -2
- package/build/fields/page-title/view.js.map +1 -1
- package/build/fields/parent/index.js +3 -1
- package/build/fields/parent/index.js.map +1 -1
- package/build/fields/parent/parent-edit.js +5 -3
- package/build/fields/parent/parent-edit.js.map +1 -1
- package/build/fields/parent/parent-view.js +4 -2
- package/build/fields/parent/parent-view.js.map +1 -1
- package/build/fields/parent/utils.js +2 -0
- package/build/fields/parent/utils.js.map +1 -1
- package/build/fields/password/edit.js +3 -1
- package/build/fields/password/edit.js.map +1 -1
- package/build/fields/password/index.js +3 -1
- package/build/fields/password/index.js.map +1 -1
- package/build/fields/pattern-title/index.js +3 -1
- package/build/fields/pattern-title/index.js.map +1 -1
- package/build/fields/pattern-title/view.js +4 -2
- package/build/fields/pattern-title/view.js.map +1 -1
- package/build/fields/ping-status/index.js +4 -2
- package/build/fields/ping-status/index.js.map +1 -1
- package/build/fields/slug/index.js +3 -1
- package/build/fields/slug/index.js.map +1 -1
- package/build/fields/slug/slug-edit.js +4 -2
- package/build/fields/slug/slug-edit.js.map +1 -1
- package/build/fields/slug/slug-view.js +3 -1
- package/build/fields/slug/slug-view.js.map +1 -1
- package/build/fields/slug/utils.js +3 -1
- package/build/fields/slug/utils.js.map +1 -1
- package/build/fields/status/index.js +4 -2
- package/build/fields/status/index.js.map +1 -1
- package/build/fields/status/status-elements.js +3 -1
- package/build/fields/status/status-elements.js.map +1 -1
- package/build/fields/status/status-view.js +3 -1
- package/build/fields/status/status-view.js.map +1 -1
- package/build/fields/template/index.js +3 -1
- package/build/fields/template/index.js.map +1 -1
- package/build/fields/template/template-edit.js +5 -3
- package/build/fields/template/template-edit.js.map +1 -1
- package/build/fields/template-title/index.js +3 -1
- package/build/fields/template-title/index.js.map +1 -1
- package/build/fields/title/index.js +3 -1
- package/build/fields/title/index.js.map +1 -1
- package/build/fields/title/view.js +3 -1
- package/build/fields/title/view.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/mutation/index.js +4 -2
- package/build/mutation/index.js.map +1 -1
- package/build/types.js +2 -0
- package/build/types.js.map +1 -1
- package/build-module/actions/delete-post.js +4 -3
- package/build-module/actions/delete-post.js.map +1 -1
- package/build-module/actions/duplicate-pattern.js +4 -3
- package/build-module/actions/duplicate-pattern.js.map +1 -1
- package/build-module/actions/duplicate-post.js +3 -2
- package/build-module/actions/duplicate-post.js.map +1 -1
- package/build-module/actions/duplicate-template-part.js +3 -2
- package/build-module/actions/duplicate-template-part.js.map +1 -1
- package/build-module/actions/export-pattern.js +2 -1
- package/build-module/actions/export-pattern.js.map +1 -1
- package/build-module/actions/index.js +1 -0
- package/build-module/actions/index.js.map +1 -1
- package/build-module/actions/permanently-delete-post.js +3 -2
- package/build-module/actions/permanently-delete-post.js.map +1 -1
- package/build-module/actions/rename-post.js +7 -3
- package/build-module/actions/rename-post.js.map +2 -2
- package/build-module/actions/reorder-page.js +3 -2
- package/build-module/actions/reorder-page.js.map +1 -1
- package/build-module/actions/reset-post.js +5 -4
- package/build-module/actions/reset-post.js.map +1 -1
- package/build-module/actions/restore-post.js +2 -1
- package/build-module/actions/restore-post.js.map +1 -1
- package/build-module/actions/trash-post.js +6 -2
- package/build-module/actions/trash-post.js.map +2 -2
- package/build-module/actions/utils.js +1 -0
- package/build-module/actions/utils.js.map +1 -1
- package/build-module/actions/view-post-revisions.js +2 -1
- package/build-module/actions/view-post-revisions.js.map +1 -1
- package/build-module/actions/view-post.js +2 -1
- package/build-module/actions/view-post.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/utils.js +4 -3
- package/build-module/components/create-template-part-modal/utils.js.map +1 -1
- package/build-module/fields/author/author-view.js +2 -1
- package/build-module/fields/author/author-view.js.map +1 -1
- package/build-module/fields/author/index.js +2 -1
- package/build-module/fields/author/index.js.map +1 -1
- package/build-module/fields/comment-status/index.js +2 -1
- package/build-module/fields/comment-status/index.js.map +1 -1
- package/build-module/fields/date/date-view.js +4 -3
- package/build-module/fields/date/date-view.js.map +1 -1
- package/build-module/fields/date/index.js +2 -1
- package/build-module/fields/date/index.js.map +1 -1
- package/build-module/fields/discussion/index.js +2 -1
- package/build-module/fields/discussion/index.js.map +1 -1
- package/build-module/fields/featured-image/featured-image-edit.js +4 -3
- package/build-module/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build-module/fields/featured-image/featured-image-view.js +2 -1
- package/build-module/fields/featured-image/featured-image-view.js.map +1 -1
- package/build-module/fields/featured-image/index.js +2 -1
- package/build-module/fields/featured-image/index.js.map +1 -1
- package/build-module/fields/index.js +1 -0
- package/build-module/fields/index.js.map +1 -1
- package/build-module/fields/order/index.js +2 -1
- package/build-module/fields/order/index.js.map +1 -1
- package/build-module/fields/page-title/index.js +2 -1
- package/build-module/fields/page-title/index.js.map +1 -1
- package/build-module/fields/page-title/view.js +3 -2
- package/build-module/fields/page-title/view.js.map +1 -1
- package/build-module/fields/parent/index.js +2 -1
- package/build-module/fields/parent/index.js.map +1 -1
- package/build-module/fields/parent/parent-edit.js +4 -3
- package/build-module/fields/parent/parent-edit.js.map +1 -1
- package/build-module/fields/parent/parent-view.js +3 -2
- package/build-module/fields/parent/parent-view.js.map +1 -1
- package/build-module/fields/parent/utils.js +1 -0
- package/build-module/fields/parent/utils.js.map +1 -1
- package/build-module/fields/password/edit.js +2 -1
- package/build-module/fields/password/edit.js.map +1 -1
- package/build-module/fields/password/index.js +2 -1
- package/build-module/fields/password/index.js.map +1 -1
- package/build-module/fields/pattern-title/index.js +2 -1
- package/build-module/fields/pattern-title/index.js.map +1 -1
- package/build-module/fields/pattern-title/view.js +3 -2
- package/build-module/fields/pattern-title/view.js.map +1 -1
- package/build-module/fields/ping-status/index.js +3 -2
- package/build-module/fields/ping-status/index.js.map +1 -1
- package/build-module/fields/slug/index.js +2 -1
- package/build-module/fields/slug/index.js.map +1 -1
- package/build-module/fields/slug/slug-edit.js +3 -2
- package/build-module/fields/slug/slug-edit.js.map +1 -1
- package/build-module/fields/slug/slug-view.js +2 -1
- package/build-module/fields/slug/slug-view.js.map +1 -1
- package/build-module/fields/slug/utils.js +2 -1
- package/build-module/fields/slug/utils.js.map +1 -1
- package/build-module/fields/status/index.js +3 -2
- package/build-module/fields/status/index.js.map +1 -1
- package/build-module/fields/status/status-elements.js +2 -1
- package/build-module/fields/status/status-elements.js.map +1 -1
- package/build-module/fields/status/status-view.js +2 -1
- package/build-module/fields/status/status-view.js.map +1 -1
- package/build-module/fields/template/index.js +2 -1
- package/build-module/fields/template/index.js.map +1 -1
- package/build-module/fields/template/template-edit.js +4 -3
- package/build-module/fields/template/template-edit.js.map +1 -1
- package/build-module/fields/template-title/index.js +2 -1
- package/build-module/fields/template-title/index.js.map +1 -1
- package/build-module/fields/title/index.js +2 -1
- package/build-module/fields/title/index.js.map +1 -1
- package/build-module/fields/title/view.js +2 -1
- package/build-module/fields/title/view.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/mutation/index.js +3 -2
- package/build-module/mutation/index.js.map +1 -1
- package/build-types/actions/rename-post.d.ts.map +1 -1
- package/build-types/actions/trash-post.d.ts.map +1 -1
- package/build-types/fields/date/date-view.d.ts.map +1 -1
- package/build-types/fields/featured-image/featured-image-edit.d.ts.map +1 -1
- package/build-types/fields/featured-image/featured-image-view.d.ts.map +1 -1
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/parent/parent-view.d.ts.map +1 -1
- package/build-types/fields/slug/slug-edit.d.ts.map +1 -1
- package/build-types/fields/slug/slug-view.d.ts.map +1 -1
- package/build-types/fields/slug/utils.d.ts.map +1 -1
- package/build-types/fields/template/template-edit.d.ts.map +1 -1
- package/build-types/mutation/index.d.ts.map +1 -1
- package/package.json +26 -26
- package/src/actions/rename-post.tsx +6 -0
- package/src/actions/trash-post.tsx +5 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/actions/view-post.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { external } from '@wordpress/icons';\nimport { _x } from '@wordpress/i18n';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../types';\n\nconst viewPost: Action< BasePost > = {\n\tid: 'view-post',\n\tlabel: _x( 'View', 'verb' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post?.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\n/**\n * View post action for BasePost.\n */\nexport default viewPost;\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAQnB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAQnB,IAAM,WAA+B;AAAA,EACpC,IAAI;AAAA,EACJ,OAAO,GAAI,QAAQ,MAAO;AAAA,EAC1B,WAAW;AAAA,EACX,MAAM;AAAA,EACN,WAAY,MAAO;AAClB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,EACA,SAAU,OAAO,EAAE,kBAAkB,GAAI;AACxC,UAAM,OAAO,MAAO,CAAE;AACtB,WAAO,KAAM,MAAM,MAAM,QAAS;AAClC,QAAK,mBAAoB;AACxB,wBAAmB,KAAM;AAAA,IAC1B;AAAA,EACD;AACD;AAKA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/components/create-template-part-modal/index.tsx
|
|
2
2
|
import {
|
|
3
3
|
Icon,
|
|
4
4
|
BaseControl,
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
getUniqueTemplatePartTitle,
|
|
28
28
|
useExistingTemplateParts
|
|
29
29
|
} from "./utils";
|
|
30
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
31
|
function getAreaRadioId(value, instanceId) {
|
|
31
32
|
return `fields-create-template-part-modal__area-option-${value}-${instanceId}`;
|
|
32
33
|
}
|
|
@@ -53,7 +54,7 @@ function CreateTemplatePartModal({
|
|
|
53
54
|
}
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
var getTemplatePartIcon = (iconName) => {
|
|
57
58
|
if ("header" === iconName) {
|
|
58
59
|
return headerIcon;
|
|
59
60
|
} else if ("footer" === iconName) {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/create-template-part-modal/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport type { TemplatePartArea } from '@wordpress/core-data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcheck,\n\tfooter as footerIcon,\n\theader as headerIcon,\n\tsidebar as sidebarIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n// @ts-expect-error serialize is not typed\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetCleanTemplatePartSlug,\n\tgetUniqueTemplatePartTitle,\n\tuseExistingTemplateParts,\n} from './utils';\n\nfunction getAreaRadioId( value: string, instanceId: number ) {\n\treturn `fields-create-template-part-modal__area-option-${ value }-${ instanceId }`;\n}\nfunction getAreaRadioDescriptionId( value: string, instanceId: number ) {\n\treturn `fields-create-template-part-modal__area-option-description-${ value }-${ instanceId }`;\n}\n\ntype CreateTemplatePartModalContentsProps = {\n\tdefaultArea?: string;\n\tblocks: any[];\n\tconfirmLabel?: string;\n\tcloseModal: () => void;\n\tonCreate: ( templatePart: any ) => void;\n\tonError?: () => void;\n\tdefaultTitle?: string;\n};\n\n/**\n * A React component that renders a modal for creating a template part. The modal displays a title and the contents for creating the template part.\n * This component should not live in this package, it should be moved to a dedicated package responsible for managing template.\n * @param {Object} props The component props.\n * @param props.modalTitle\n */\nexport default function CreateTemplatePartModal( {\n\tmodalTitle,\n\t...restProps\n}: {\n\tmodalTitle: string;\n} & CreateTemplatePartModalContentsProps ) {\n\tconst defaultModalTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( 'wp_template_part' )?.labels\n\t\t\t\t?.add_new_item,\n\t\t[]\n\t);\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle || defaultModalTitle }\n\t\t\tonRequestClose={ restProps.closeModal }\n\t\t\toverlayClassName=\"fields-create-template-part-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<CreateTemplatePartModalContents { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nconst getTemplatePartIcon = ( iconName: string ) => {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn symbolFilledIcon;\n};\n\n/**\n * A React component that renders the content of a model for creating a template part.\n * This component should not live in this package; it should be moved to a dedicated package responsible for managing template.\n *\n * @param {Object} props - The component props.\n * @param {string} [props.defaultArea=uncategorized] - The default area for the template part.\n * @param {Array} [props.blocks=[]] - The blocks to be included in the template part.\n * @param {string} [props.confirmLabel='Add'] - The label for the confirm button.\n * @param {Function} props.closeModal - Function to close the modal.\n * @param {Function} props.onCreate - Function to call when the template part is successfully created.\n * @param {Function} [props.onError] - Function to call when there is an error creating the template part.\n * @param {string} [props.defaultTitle=''] - The default title for the template part.\n */\nexport function CreateTemplatePartModalContents( {\n\tdefaultArea = 'uncategorized',\n\tblocks = [],\n\tconfirmLabel = __( 'Add' ),\n\tcloseModal,\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n}: CreateTemplatePartModalContentsProps ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()?.default_template_part_areas,\n\t\t[]\n\t);\n\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error &&\n\t\t\t\t'code' in error &&\n\t\t\t\terror.message &&\n\t\t\t\terror.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait createTemplatePart();\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"4\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<fieldset className=\"fields-create-template-part-modal__area-fieldset\">\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Area' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t<div className=\"fields-create-template-part-modal__area-radio-group\">\n\t\t\t\t\t\t{ ( defaultTemplatePartAreas ?? [] ).map(\n\t\t\t\t\t\t\t( item: TemplatePartArea ) => {\n\t\t\t\t\t\t\t\tconst icon = getTemplatePartIcon( item.icon );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tkey={ item.area }\n\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-wrapper\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\t\t\tid={ getAreaRadioId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tname={ `fields-create-template-part-modal__area-${ instanceId }` }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ item.area }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ area === item.area }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetArea( item.area );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\taria-describedby={ getAreaRadioDescriptionId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-icon\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t\t\thtmlFor={ getAreaRadioId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-label\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-checkmark\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-description\"\n\t\t\t\t\t\t\t\t\t\t\tid={ getAreaRadioDescriptionId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ item.description }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\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</div>\n\t\t\t\t</fieldset>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,qBAAqB;AAE9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,aAAa,iBAAiB;AACvC,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,gBAAgB;AAAA,OACV;AACP,SAAS,SAAS,oBAAoB;AAEtC,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA6CJ,cA2HM,YA3HN;AA3CH,SAAS,eAAgB,OAAe,YAAqB;AAC5D,SAAO,kDAAmD,KAAM,IAAK,UAAW;AACjF;AACA,SAAS,0BAA2B,OAAe,YAAqB;AACvE,SAAO,8DAA+D,KAAM,IAAK,UAAW;AAC7F;AAkBe,SAAR,wBAA0C;AAAA,EAChD;AAAA,EACA,GAAG;AACJ,GAE2C;AAC1C,QAAM,oBAAoB;AAAA,IACzB,CAAE,WACD,OAAQ,SAAU,EAAE,YAAa,kBAAmB,GAAG,QACpD;AAAA,IACJ,CAAC;AAAA,EACF;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,cAAc;AAAA,MACtB,gBAAiB,UAAU;AAAA,MAC3B,kBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,MAAK;AAAA,MAEL,8BAA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AAAA,sBAAC;AAAA;AAAA,wBACA,SAAU;AAAA,0BACT,KAAK;AAAA,0BACL;AAAA,wBACD;AAAA,wBACA,WAAU;AAAA,wBAER,eAAK;AAAA;AAAA,oBACR;AAAA,oBACA;AAAA,sBAAC;AAAA;AAAA,wBACA,MAAO;AAAA,wBACP,WAAU;AAAA;AAAA,oBACX;AAAA,oBACA;AAAA,sBAAC;AAAA;AAAA,wBACA,WAAU;AAAA,wBACV,IAAK;AAAA,0BACJ,KAAK;AAAA,0BACL;AAAA,wBACD;AAAA,wBAEE,eAAK;AAAA;AAAA,oBACR;AAAA;AAAA;AAAA,gBA7CM,KAAK;AAAA,cA8CZ;AAAA,YAEF;AAAA,UACD,GACD;AAAA,WACD;AAAA,QACA,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,SAAU,MAAM;AACf,2BAAW;AAAA,cACZ;AAAA,cAEE,aAAI,QAAS;AAAA;AAAA,UAChB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,iBAAgB,CAAE,SAAS;AAAA,cAC3B,QAAS;AAAA,cAEP;AAAA;AAAA,UACH;AAAA,WACD;AAAA,SACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/components/create-template-part-modal/utils.js
|
|
1
2
|
import { paramCase as kebabCase } from "change-case";
|
|
2
3
|
import { useSelect } from "@wordpress/data";
|
|
3
4
|
import { store as coreStore } from "@wordpress/core-data";
|
|
4
|
-
|
|
5
|
+
var useExistingTemplateParts = () => {
|
|
5
6
|
return useSelect(
|
|
6
7
|
(select) => select(coreStore).getEntityRecords(
|
|
7
8
|
"postType",
|
|
@@ -13,7 +14,7 @@ const useExistingTemplateParts = () => {
|
|
|
13
14
|
[]
|
|
14
15
|
) ?? [];
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
var getUniqueTemplatePartTitle = (title, templateParts) => {
|
|
17
18
|
const lowercaseTitle = title.toLowerCase();
|
|
18
19
|
const existingTitles = templateParts.map(
|
|
19
20
|
(templatePart) => templatePart.title.rendered.toLowerCase()
|
|
@@ -27,7 +28,7 @@ const getUniqueTemplatePartTitle = (title, templateParts) => {
|
|
|
27
28
|
}
|
|
28
29
|
return `${title} ${suffix}`;
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
var getCleanTemplatePartSlug = (title) => {
|
|
31
32
|
return kebabCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part";
|
|
32
33
|
};
|
|
33
34
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/create-template-part-modal/utils.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\n\nexport const useExistingTemplateParts = () => {\n\treturn (\n\t\tuseSelect(\n\t\t\t( select ) =>\n\t\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t{\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t[]\n\t\t) ?? []\n\t);\n};\n\n/**\n * Return a unique template part title based on\n * the given title and existing template parts.\n *\n * @param {string} title The original template part title.\n * @param {Object} templateParts The array of template part entities.\n * @return {string} A unique template part title.\n */\nexport const getUniqueTemplatePartTitle = ( title, templateParts ) => {\n\tconst lowercaseTitle = title.toLowerCase();\n\tconst existingTitles = templateParts.map( ( templatePart ) =>\n\t\ttemplatePart.title.rendered.toLowerCase()\n\t);\n\n\tif ( ! existingTitles.includes( lowercaseTitle ) ) {\n\t\treturn title;\n\t}\n\n\tlet suffix = 2;\n\twhile ( existingTitles.includes( `${ lowercaseTitle } ${ suffix }` ) ) {\n\t\tsuffix++;\n\t}\n\n\treturn `${ title } ${ suffix }`;\n};\n\n/**\n * Get a valid slug for a template part.\n * Currently template parts only allow latin chars.\n * The fallback slug will receive suffix by default.\n *\n * @param {string} title The template part title.\n * @return {string} A valid template part slug.\n */\nexport const getCleanTemplatePartSlug = ( title ) => {\n\treturn kebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,aAAa,iBAAiB;AAKvC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAM5B,
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AAKvC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAM5B,IAAM,2BAA2B,MAAM;AAC7C,SACC;AAAA,IACC,CAAE,WACD,OAAQ,SAAU,EAAE;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,QACC,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF,KAAK,CAAC;AAER;AAUO,IAAM,6BAA6B,CAAE,OAAO,kBAAmB;AACrE,QAAM,iBAAiB,MAAM,YAAY;AACzC,QAAM,iBAAiB,cAAc;AAAA,IAAK,CAAE,iBAC3C,aAAa,MAAM,SAAS,YAAY;AAAA,EACzC;AAEA,MAAK,CAAE,eAAe,SAAU,cAAe,GAAI;AAClD,WAAO;AAAA,EACR;AAEA,MAAI,SAAS;AACb,SAAQ,eAAe,SAAU,GAAI,cAAe,IAAK,MAAO,EAAG,GAAI;AACtE;AAAA,EACD;AAEA,SAAO,GAAI,KAAM,IAAK,MAAO;AAC9B;AAUO,IAAM,2BAA2B,CAAE,UAAW;AACpD,SAAO,UAAW,KAAM,EAAE,QAAS,YAAY,EAAG,KAAK;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/author/author-view.tsx
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { __ } from "@wordpress/i18n";
|
|
4
4
|
import { useState } from "@wordpress/element";
|
|
5
5
|
import { commentAuthorAvatar as authorIcon } from "@wordpress/icons";
|
|
6
6
|
import { __experimentalHStack as HStack, Icon } from "@wordpress/components";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
function AuthorView({ item }) {
|
|
8
9
|
const text = item?._embedded?.author?.[0]?.name;
|
|
9
10
|
const imageUrl = item?._embedded?.author?.[0]?.avatar_urls?.[48];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/author/author-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\tconst text = item?._embedded?.author?.[ 0 ]?.name;\n\tconst imageUrl = item?._embedded?.author?.[ 0 ]?.avatar_urls?.[ 48 ];\n\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\nexport default AuthorView;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,kBAAkB;AAClD,SAAS,wBAAwB,QAAQ,YAAY;AAanD,SAOG,KAPH;AANF,SAAS,WAAY,EAAE,KAAK,GAA0C;AACrE,QAAM,OAAO,MAAM,WAAW,SAAU,CAAE,GAAG;AAC7C,QAAM,WAAW,MAAM,WAAW,SAAU,CAAE,GAAG,cAAe,EAAG;AAEnE,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAU,KAAM;AAC5D,SACC,qBAAC,UAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,WAAY,KAAM,uCAAuC;AAAA,UACxD,aAAa;AAAA,QACd,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,QAAS,MAAM,iBAAkB,IAAK;AAAA,YACtC,KAAM,GAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,oBAAC,SAAI,WAAU,qCACd,8BAAC,QAAK,MAAO,YAAa,GAC3B;AAAA,IAED,oBAAC,UAAK,WAAU,qCAAsC,gBAAM;AAAA,KAC7D;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// packages/fields/src/fields/author/index.tsx
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { resolveSelect } from "@wordpress/data";
|
|
3
4
|
import { store as coreDataStore } from "@wordpress/core-data";
|
|
4
5
|
import AuthorView from "./author-view";
|
|
5
|
-
|
|
6
|
+
var authorField = {
|
|
6
7
|
label: __("Author"),
|
|
7
8
|
id: "author",
|
|
8
9
|
type: "integer",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/author/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\nimport AuthorView from './author-view';\n\ninterface Author {\n\tid: number;\n\tname: string;\n}\n\nconst authorField: Field< BasePostWithEmbeddedAuthor > = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\ttype: 'integer',\n\tgetElements: async () => {\n\t\tconst authors: Author[] =\n\t\t\t( await resolveSelect( coreDataStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'user',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t) ) ?? [];\n\t\treturn authors.map( ( { id, name } ) => ( {\n\t\t\tvalue: id,\n\t\t\tlabel: name,\n\t\t} ) );\n\t},\n\trender: AuthorView,\n\tsort: ( a, b, direction ) => {\n\t\tconst nameA = a._embedded?.author?.[ 0 ]?.name || '';\n\t\tconst nameB = b._embedded?.author?.[ 0 ]?.name || '';\n\n\t\treturn direction === 'asc'\n\t\t\t? nameA.localeCompare( nameB )\n\t\t\t: nameB.localeCompare( nameA );\n\t},\n\n\tfilterBy: {\n\t\toperators: [ 'isAny', 'isNone' ],\n\t},\n};\n\n/**\n * Author field for BasePost.\n */\nexport default authorField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,qBAAqB;AAMvC,OAAO,gBAAgB;AAOvB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,SAAS,qBAAqB;AAMvC,OAAO,gBAAgB;AAOvB,IAAM,cAAmD;AAAA,EACxD,OAAO,GAAI,QAAS;AAAA,EACpB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa,YAAY;AACxB,UAAM,UACH,MAAM,cAAe,aAAc,EAAE;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,QACC,UAAU;AAAA,MACX;AAAA,IACD,KAAO,CAAC;AACT,WAAO,QAAQ,IAAK,CAAE,EAAE,IAAI,KAAK,OAAS;AAAA,MACzC,OAAO;AAAA,MACP,OAAO;AAAA,IACR,EAAI;AAAA,EACL;AAAA,EACA,QAAQ;AAAA,EACR,MAAM,CAAE,GAAG,GAAG,cAAe;AAC5B,UAAM,QAAQ,EAAE,WAAW,SAAU,CAAE,GAAG,QAAQ;AAClD,UAAM,QAAQ,EAAE,WAAW,SAAU,CAAE,GAAG,QAAQ;AAElD,WAAO,cAAc,QAClB,MAAM,cAAe,KAAM,IAC3B,MAAM,cAAe,KAAM;AAAA,EAC/B;AAAA,EAEA,UAAU;AAAA,IACT,WAAW,CAAE,SAAS,QAAS;AAAA,EAChC;AACD;AAKA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/comment-status/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst commentStatusField: Field< BasePost > = {\n\tid: 'comment_status',\n\tlabel: __( 'Comments' ),\n\ttype: 'text',\n\tEdit: 'radio',\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n\telements: [\n\t\t{\n\t\t\tvalue: 'open',\n\t\t\tlabel: __( 'Open' ),\n\t\t\tdescription: __( 'Visitors can add new comments and replies.' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'closed',\n\t\t\tlabel: __( 'Closed' ),\n\t\t\tdescription: __(\n\t\t\t\t'Visitors cannot add new comments or replies. Existing comments remain visible.'\n\t\t\t),\n\t\t},\n\t],\n};\n\n/**\n * Comment status field for BasePost.\n */\nexport default commentStatusField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAOnB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAOnB,IAAM,qBAAwC;AAAA,EAC7C,IAAI;AAAA,EACJ,OAAO,GAAI,UAAW;AAAA,EACtB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,IACT;AAAA,MACC,OAAO;AAAA,MACP,OAAO,GAAI,MAAO;AAAA,MAClB,aAAa,GAAI,4CAA6C;AAAA,IAC/D;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,OAAO,GAAI,QAAS;AAAA,MACpB,aAAa;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAKA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/date/date-view.tsx
|
|
2
2
|
import { __, sprintf } from "@wordpress/i18n";
|
|
3
3
|
import { createInterpolateElement } from "@wordpress/element";
|
|
4
4
|
import { dateI18n, getDate, getSettings } from "@wordpress/date";
|
|
5
|
-
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var getFormattedDate = (dateToDisplay) => dateI18n(
|
|
6
7
|
getSettings().formats.datetimeAbbreviated,
|
|
7
8
|
getDate(dateToDisplay)
|
|
8
9
|
);
|
|
9
|
-
|
|
10
|
+
var DateView = ({ item }) => {
|
|
10
11
|
const isDraftOrPrivate = ["draft", "private"].includes(
|
|
11
12
|
item.status ?? ""
|
|
12
13
|
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/date/date-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst getFormattedDate = ( dateToDisplay: string | null ) =>\n\tdateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( dateToDisplay )\n\t);\n\nconst DateView = ( { item }: { item: BasePost } ) => {\n\tconst isDraftOrPrivate = [ 'draft', 'private' ].includes(\n\t\titem.status ?? ''\n\t);\n\tif ( isDraftOrPrivate ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: page creation or modification date. */\n\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\tgetFormattedDate( item.date ?? null )\n\t\t\t),\n\t\t\t{\n\t\t\t\tspan: <span />,\n\t\t\t\ttime: <time />,\n\t\t\t}\n\t\t);\n\t}\n\n\tconst isScheduled = item.status === 'future';\n\tif ( isScheduled ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t__( '<span>Scheduled: <time>%s</time></span>' ),\n\t\t\t\tgetFormattedDate( item.date ?? null )\n\t\t\t),\n\t\t\t{\n\t\t\t\tspan: <span />,\n\t\t\t\ttime: <time />,\n\t\t\t}\n\t\t);\n\t}\n\n\tconst isPublished = item.status === 'publish';\n\tif ( isPublished ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: page creation time */\n\t\t\t\t__( '<span>Published: <time>%s</time></span>' ),\n\t\t\t\tgetFormattedDate( item.date ?? null )\n\t\t\t),\n\t\t\t{\n\t\t\t\tspan: <span />,\n\t\t\t\ttime: <time />,\n\t\t\t}\n\t\t);\n\t}\n\n\t// Pending posts show the modified date if it's newer.\n\tconst dateToDisplay =\n\t\tgetDate( item.modified ?? null ) > getDate( item.date ?? null )\n\t\t\t? item.modified\n\t\t\t: item.date;\n\n\tconst isPending = item.status === 'pending';\n\tif ( isPending ) {\n\t\treturn createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: page creation or modification date. */\n\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\tgetFormattedDate( dateToDisplay ?? null )\n\t\t\t),\n\t\t\t{\n\t\t\t\tspan: <span />,\n\t\t\t\ttime: <time />,\n\t\t\t}\n\t\t);\n\t}\n\n\t// Unknow status.\n\treturn <time>{ getFormattedDate( item.date ?? null ) }</time>;\n};\n\nexport default DateView;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,gCAAgC;AACzC,SAAS,UAAU,SAAS,mBAAmB;AAyBrC;AAlBV,IAAM,mBAAmB,CAAE,kBAC1B;AAAA,EACC,YAAY,EAAE,QAAQ;AAAA,EACtB,QAAS,aAAc;AACxB;AAED,IAAM,WAAW,CAAE,EAAE,KAAK,MAA2B;AACpD,QAAM,mBAAmB,CAAE,SAAS,SAAU,EAAE;AAAA,IAC/C,KAAK,UAAU;AAAA,EAChB;AACA,MAAK,kBAAmB;AACvB,WAAO;AAAA,MACN;AAAA;AAAA,QAEC,GAAI,wCAAyC;AAAA,QAC7C,iBAAkB,KAAK,QAAQ,IAAK;AAAA,MACrC;AAAA,MACA;AAAA,QACC,MAAM,oBAAC,UAAK;AAAA,QACZ,MAAM,oBAAC,UAAK;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAEA,QAAM,cAAc,KAAK,WAAW;AACpC,MAAK,aAAc;AAClB,WAAO;AAAA,MACN;AAAA;AAAA,QAEC,GAAI,yCAA0C;AAAA,QAC9C,iBAAkB,KAAK,QAAQ,IAAK;AAAA,MACrC;AAAA,MACA;AAAA,QACC,MAAM,oBAAC,UAAK;AAAA,QACZ,MAAM,oBAAC,UAAK;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAEA,QAAM,cAAc,KAAK,WAAW;AACpC,MAAK,aAAc;AAClB,WAAO;AAAA,MACN;AAAA;AAAA,QAEC,GAAI,yCAA0C;AAAA,QAC9C,iBAAkB,KAAK,QAAQ,IAAK;AAAA,MACrC;AAAA,MACA;AAAA,QACC,MAAM,oBAAC,UAAK;AAAA,QACZ,MAAM,oBAAC,UAAK;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAGA,QAAM,gBACL,QAAS,KAAK,YAAY,IAAK,IAAI,QAAS,KAAK,QAAQ,IAAK,IAC3D,KAAK,WACL,KAAK;AAET,QAAM,YAAY,KAAK,WAAW;AAClC,MAAK,WAAY;AAChB,WAAO;AAAA,MACN;AAAA;AAAA,QAEC,GAAI,wCAAyC;AAAA,QAC7C,iBAAkB,iBAAiB,IAAK;AAAA,MACzC;AAAA,MACA;AAAA,QACC,MAAM,oBAAC,UAAK;AAAA,QACZ,MAAM,oBAAC,UAAK;AAAA,MACb;AAAA,IACD;AAAA,EACD;AAGA,SAAO,oBAAC,UAAO,2BAAkB,KAAK,QAAQ,IAAK,GAAG;AACvD;AAEA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/date/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport DateView from './date-view';\n\nconst dateField: Field< BasePost > = {\n\tid: 'date',\n\ttype: 'datetime',\n\tlabel: __( 'Date' ),\n\trender: DateView,\n\tfilterBy: false,\n};\n\n/**\n * Date field for BasePost.\n */\nexport default dateField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,OAAO,cAAc;AAErB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,OAAO,cAAc;AAErB,IAAM,YAA+B;AAAA,EACpC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,MAAO;AAAA,EAClB,QAAQ;AAAA,EACR,UAAU;AACX;AAKA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/discussion/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst discussionField: Field< BasePost > = {\n\tid: 'discussion',\n\tlabel: __( 'Discussion' ),\n\ttype: 'text',\n\trender: ( { item } ) => {\n\t\tconst commentsOpen = item.comment_status === 'open';\n\t\tconst pingsOpen = item.ping_status === 'open';\n\n\t\tif ( commentsOpen && pingsOpen ) {\n\t\t\treturn __( 'Open' );\n\t\t}\n\t\tif ( commentsOpen && ! pingsOpen ) {\n\t\t\treturn __( 'Comments only' );\n\t\t}\n\t\tif ( ! commentsOpen && pingsOpen ) {\n\t\t\treturn __( 'Pings only' );\n\t\t}\n\t\treturn __( 'Closed' );\n\t},\n\tfilterBy: false,\n};\n\n/**\n * Discussion field for BasePost with custom render logic.\n */\nexport default discussionField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAOnB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAOnB,IAAM,kBAAqC;AAAA,EAC1C,IAAI;AAAA,EACJ,OAAO,GAAI,YAAa;AAAA,EACxB,MAAM;AAAA,EACN,QAAQ,CAAE,EAAE,KAAK,MAAO;AACvB,UAAM,eAAe,KAAK,mBAAmB;AAC7C,UAAM,YAAY,KAAK,gBAAgB;AAEvC,QAAK,gBAAgB,WAAY;AAChC,aAAO,GAAI,MAAO;AAAA,IACnB;AACA,QAAK,gBAAgB,CAAE,WAAY;AAClC,aAAO,GAAI,eAAgB;AAAA,IAC5B;AACA,QAAK,CAAE,gBAAgB,WAAY;AAClC,aAAO,GAAI,YAAa;AAAA,IACzB;AACA,WAAO,GAAI,QAAS;AAAA,EACrB;AAAA,EACA,UAAU;AACX;AAKA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/featured-image/featured-image-edit.tsx
|
|
2
2
|
import { Button, __experimentalGrid as Grid } from "@wordpress/components";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { useCallback, useRef, useState } from "@wordpress/element";
|
|
@@ -10,7 +10,8 @@ import { lineSolid } from "@wordpress/icons";
|
|
|
10
10
|
import { store as coreStore } from "@wordpress/core-data";
|
|
11
11
|
import { __ } from "@wordpress/i18n";
|
|
12
12
|
import { unlock } from "../../lock-unlock";
|
|
13
|
-
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var { MediaUploadModal } = unlock(mediaUtilsPrivateApis);
|
|
14
15
|
function ConditionalMediaUpload({ render, ...props }) {
|
|
15
16
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
16
17
|
if (window.__experimentalDataViewsMediaModal) {
|
|
@@ -35,7 +36,7 @@ function ConditionalMediaUpload({ render, ...props }) {
|
|
|
35
36
|
}
|
|
36
37
|
return /* @__PURE__ */ jsx(MediaUpload, { ...props, render });
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
var FeaturedImageEdit = ({
|
|
39
40
|
data,
|
|
40
41
|
field,
|
|
41
42
|
onChange
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/featured-image/featured-image-edit.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Button, __experimentalGrid as Grid } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport {\n\tprivateApis as mediaUtilsPrivateApis,\n\tMediaUpload,\n} from '@wordpress/media-utils';\nimport { lineSolid } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\nimport { unlock } from '../../lock-unlock';\n\nconst { MediaUploadModal } = unlock( mediaUtilsPrivateApis );\n\n/**\n * Conditional Media component that uses MediaUploadModal when experiment is enabled,\n * otherwise falls back to media-utils MediaUpload.\n *\n * @param {Object} root0 Component props.\n * @param {Function} root0.render Render prop function that receives { open } object.\n * @param {Object} root0.props Other props passed to the media upload component.\n * @return {JSX.Element} The component.\n */\nfunction ConditionalMediaUpload( { render, ...props }: any ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tif ( ( window as any ).__experimentalDataViewsMediaModal ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ render && render( { open: () => setIsModalOpen( true ) } ) }\n\t\t\t\t<MediaUploadModal\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tprops.onClose?.();\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ ( media: any ) => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tprops.onSelect?.( media );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n\n\t// Fallback to media-utils MediaUpload when experiment is disabled\n\treturn <MediaUpload { ...props } render={ render } />;\n}\n\nexport const FeaturedImageEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePostWithEmbeddedFeaturedMedia > ) => {\n\tconst { id } = field;\n\n\tconst value = field.getValue( { item: data } );\n\n\tconst media = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', 'attachment', value );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: number ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\tconst url = media?.source_url;\n\tconst title = media?.title?.rendered;\n\tconst ref = useRef( null );\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__featured-image\">\n\t\t\t<div className=\"fields-controls__featured-image-container\">\n\t\t\t\t<ConditionalMediaUpload\n\t\t\t\t\tonSelect={ ( selectedMedia: any ) => {\n\t\t\t\t\t\tonChangeControl( selectedMedia.id );\n\t\t\t\t\t} }\n\t\t\t\t\tallowedTypes={ [ 'image' ] }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\ttitle={ __( 'Select Featured Image' ) }\n\t\t\t\t\trender={ ( { open }: any ) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.key === 'Enter' ||\n\t\t\t\t\t\t\t\t\tevent.key === ' '\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\topen();\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\t\t<Grid\n\t\t\t\t\t\t\t\trowGap={ 0 }\n\t\t\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t\t\t\ttemplateColumns=\"24px 1fr 24px\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-controls__featured-image-image\"\n\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\twidth={ 24 }\n\t\t\t\t\t\t\t\t\t\t\theight={ 24 }\n\t\t\t\t\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<span className=\"fields-controls__featured-image-title\">\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! url && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-controls__featured-image-placeholder\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\t\theight: '24px',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<span className=\"fields-controls__featured-image-title\">\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Choose an image\u2026' ) }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-controls__featured-image-remove-button\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\t\tonChangeControl( 0 );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Grid>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,QAAQ,sBAAsB,YAAY;AACnD,SAAS,iBAAiB;AAC1B,SAAS,aAAa,QAAQ,gBAAgB;AAC9C;AAAA,EACC,eAAe;AAAA,EACf;AAAA,OACM;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAEnC,SAAS,UAAU;AAMnB,SAAS,cAAc;AAkBpB,mBAEC,KAFD;AAhBH,IAAM,EAAE,iBAAiB,IAAI,OAAQ,qBAAsB;AAW3D,SAAS,uBAAwB,EAAE,QAAQ,GAAG,MAAM,GAAS;AAC5D,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,KAAM;AAExD,MAAO,OAAgB,mCAAoC;AAC1D,WACC,iCACG;AAAA,gBAAU,OAAQ,E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AA,UACL,UAAW;AAAA,UACX,SAAU;AAAA,UACV,WAAY,CAAE,UAAW;AACxB,gBACC,MAAM,QAAQ,WACd,MAAM,QAAQ,KACb;AACD,oBAAM,eAAe;AACrB,mBAAK;AAAA,YACN;AAAA,UACD;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,QAAS;AAAA,cACT,WAAY;AAAA,cACZ,iBAAgB;AAAA,cAEd;AAAA,uBACD,iCACC;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,KAAI;AAAA,sBACJ,OAAQ;AAAA,sBACR,QAAS;AAAA,sBACT,KAAM;AAAA;AAAA,kBACP;AAAA,kBACA,oBAAC,UAAK,WAAU,yCACb,iBACH;AAAA,mBACD;AAAA,gBAEC,CAAE,OACH,iCACC;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACA,WAAU;AAAA,sBACV,OAAQ;AAAA,wBACP,OAAO;AAAA,wBACP,QAAQ;AAAA,sBACT;AAAA;AAAA,kBACD;AAAA,kBACA,oBAAC,UAAK,WAAU,yCACb,aAAI,uBAAmB,GAC1B;AAAA,mBACD;AAAA,gBAEC,OACD,gCACC;AAAA,kBAAC;AAAA;AAAA,oBACA,MAAK;AAAA,oBACL,WAAU;AAAA,oBACV,MAAO;AAAA,oBACP,SAAU,CACT,UACI;AACJ,4BAAM,gBAAgB;AACtB,sCAAiB,CAAE;AAAA,oBACpB;AAAA;AAAA,gBACD,GACD;AAAA;AAAA;AAAA,UAEF;AAAA;AAAA,MACD;AAAA;AAAA,EAEF,GACD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/featured-image/featured-image-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\n\nexport const FeaturedImageView = ( {\n\titem,\n\tconfig,\n}: DataViewRenderFieldProps< BasePostWithEmbeddedFeaturedMedia > ) => {\n\tconst media = item?._embedded?.[ 'wp:featuredmedia' ]?.[ 0 ];\n\tconst url = media?.source_url;\n\n\tif ( url ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tclassName=\"fields-controls__featured-image-image\"\n\t\t\t\tsrc={ url }\n\t\t\t\talt=\"\"\n\t\t\t\tsrcSet={\n\t\t\t\t\tmedia?.media_details?.sizes\n\t\t\t\t\t\t? Object.values( media.media_details.sizes )\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( size: any ) =>\n\t\t\t\t\t\t\t\t\t\t`${ size.source_url } ${ size.width }w`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ', ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tsizes={ config?.sizes || '100vw' }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn <span className=\"fields-controls__featured-image-placeholder\" />;\n};\n"],
|
|
5
|
-
"mappings": "AAmBG;AATI,
|
|
5
|
+
"mappings": ";AAmBG;AATI,IAAM,oBAAoB,CAAE;AAAA,EAClC;AAAA,EACA;AACD,MAAsE;AACrE,QAAM,QAAQ,MAAM,YAAa,kBAAmB,IAAK,CAAE;AAC3D,QAAM,MAAM,OAAO;AAEnB,MAAK,KAAM;AACV,WACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,KAAM;AAAA,QACN,KAAI;AAAA,QACJ,QACC,OAAO,eAAe,QACnB,OAAO,OAAQ,MAAM,cAAc,KAAM,EACxC;AAAA,UACA,CAAE,SACD,GAAI,KAAK,UAAW,IAAK,KAAK,KAAM;AAAA,QACtC,EACC,KAAM,IAAK,IACZ;AAAA,QAEJ,OAAQ,QAAQ,SAAS;AAAA;AAAA,IAC1B;AAAA,EAEF;AAEA,SAAO,oBAAC,UAAK,WAAU,+CAA8C;AACtE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/featured-image/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { FeaturedImageEdit } from "./featured-image-edit";
|
|
3
4
|
import { FeaturedImageView } from "./featured-image-view";
|
|
4
|
-
|
|
5
|
+
var featuredImageField = {
|
|
5
6
|
id: "featured_media",
|
|
6
7
|
type: "media",
|
|
7
8
|
label: __("Featured Image"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/featured-image/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\nimport { FeaturedImageEdit } from './featured-image-edit';\nimport { FeaturedImageView } from './featured-image-view';\n\nconst featuredImageField: Field< BasePostWithEmbeddedFeaturedMedia > = {\n\tid: 'featured_media',\n\ttype: 'media',\n\tlabel: __( 'Featured Image' ),\n\tEdit: FeaturedImageEdit,\n\trender: FeaturedImageView,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * Featured Image field for BasePostWithEmbeddedFeaturedMedia.\n */\nexport default featuredImageField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAElC,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAElC,IAAM,qBAAiE;AAAA,EACtE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,gBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/fields/index.ts"],
|
|
4
4
|
"sourcesContent": ["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as pageTitleField } from './page-title';\nexport { default as templateTitleField } from './template-title';\nexport { default as patternTitleField } from './pattern-title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\nexport { default as templateField } from './template';\nexport { default as parentField } from './parent';\nexport { default as passwordField } from './password';\nexport { default as statusField } from './status';\nexport { default as commentStatusField } from './comment-status';\nexport { default as pingStatusField } from './ping-status';\nexport { default as discussionField } from './discussion';\nexport { default as dateField } from './date';\nexport { default as authorField } from './author';\n"],
|
|
5
|
-
"mappings": "AAAA,SAAoB,WAAXA,gBAA4B;AACrC,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAA4B;AACrC,SAAoB,WAAXA,iBAA8B;",
|
|
5
|
+
"mappings": ";AAAA,SAAoB,WAAXA,gBAA4B;AACrC,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAA4B;AACrC,SAAoB,WAAXA,iBAA8B;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/order/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst orderField: Field< BasePost > = {\n\tid: 'menu_order',\n\ttype: 'integer',\n\tlabel: __( 'Order' ),\n\tdescription: __( 'Determines the order of pages.' ),\n\tfilterBy: false,\n\tisValid: {\n\t\trequired: true,\n\t},\n};\n\n/**\n * Order field for BasePost.\n */\nexport default orderField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAOnB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAOnB,IAAM,aAAgC;AAAA,EACrC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,gCAAiC;AAAA,EAClD,UAAU;AAAA,EACV,SAAS;AAAA,IACR,UAAU;AAAA,EACX;AACD;AAKA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/page-title/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { getItemTitle } from "../../actions/utils";
|
|
3
4
|
import PageTitleView from "./view";
|
|
4
|
-
|
|
5
|
+
var pageTitleField = {
|
|
5
6
|
type: "text",
|
|
6
7
|
id: "title",
|
|
7
8
|
label: __("Title"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/page-title/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport PageTitleView from './view';\n\nconst pageTitleField: Field< BasePost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: PageTitleView,\n\tenableHiding: false,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the page entity.\n */\nexport default pageTitleField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAE1B,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAE1B,IAAM,iBAAoC;AAAA,EACzC,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,UAAW;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,aAAc,IAAK;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAKA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/page-title/view.tsx
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { store as coreStore } from "@wordpress/core-data";
|
|
5
5
|
import { privateApis as componentsPrivateApis } from "@wordpress/components";
|
|
6
6
|
import { BaseTitleView } from "../title/view";
|
|
7
7
|
import { unlock } from "../../lock-unlock";
|
|
8
|
-
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var { Badge } = unlock(componentsPrivateApis);
|
|
9
10
|
function PageTitleView({ item }) {
|
|
10
11
|
const { frontPageId, postsPageId } = useSelect((select) => {
|
|
11
12
|
const { getEntityRecord } = select(coreStore);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/page-title/view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Settings } from '@wordpress/core-data';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { CommonPost } from '../../types';\nimport { BaseTitleView } from '../title/view';\nimport { unlock } from '../../lock-unlock';\nconst { Badge } = unlock( componentsPrivateApis );\n\nexport default function PageTitleView( { item }: { item: CommonPost } ) {\n\tconst { frontPageId, postsPageId } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t) as Partial< Settings >;\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\treturn (\n\t\t<BaseTitleView item={ item } className=\"fields-field__page-title\">\n\t\t\t{ [ frontPageId, postsPageId ].includes( item.id as number ) && (\n\t\t\t\t<Badge>\n\t\t\t\t\t{ item.id === frontPageId\n\t\t\t\t\t\t? __( 'Homepage' )\n\t\t\t\t\t\t: __( 'Posts Page' ) }\n\t\t\t\t</Badge>\n\t\t\t) }\n\t\t</BaseTitleView>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAEnC,SAAS,eAAe,6BAA6B;AAMrD,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AAkBnB;AAjBJ,IAAM,EAAE,MAAM,IAAI,OAAQ,qBAAsB;AAEjC,SAAR,cAAgC,EAAE,KAAK,GAA0B;AACvE,QAAM,EAAE,aAAa,YAAY,IAAI,UAAW,CAAE,WAAY;AAC7D,UAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,UAAM,eAAe;AAAA,MACpB;AAAA,MACA;AAAA,IACD;AACA,WAAO;AAAA,MACN,aAAa,cAAc;AAAA,MAC3B,aAAa,cAAc;AAAA,IAC5B;AAAA,EACD,GAAG,CAAC,CAAE;AACN,SACC,oBAAC,iBAAc,MAAc,WAAU,4BACpC,WAAE,aAAa,WAAY,EAAE,SAAU,KAAK,EAAa,KAC1D,oBAAC,SACE,eAAK,OAAO,cACX,GAAI,UAAW,IACf,GAAI,YAAa,GACrB,GAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/parent/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { ParentEdit } from "./parent-edit";
|
|
3
4
|
import { ParentView } from "./parent-view";
|
|
4
|
-
|
|
5
|
+
var parentField = {
|
|
5
6
|
id: "parent",
|
|
6
7
|
type: "text",
|
|
7
8
|
label: __("Parent"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/parent/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { ParentEdit } from './parent-edit';\nimport { ParentView } from './parent-view';\n\nconst parentField: Field< BasePost > = {\n\tid: 'parent',\n\ttype: 'text',\n\tlabel: __( 'Parent' ),\n\tEdit: ParentEdit,\n\trender: ParentView,\n\tenableSorting: true,\n\tfilterBy: false,\n};\n\n/**\n * Parent field for BasePost.\n */\nexport default parentField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAE3B,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAE3B,IAAM,cAAiC;AAAA,EACtC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,QAAS;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/parent/parent-edit.tsx
|
|
2
2
|
import removeAccents from "remove-accents";
|
|
3
3
|
import { ComboboxControl, ExternalLink } from "@wordpress/components";
|
|
4
4
|
import { useSelect } from "@wordpress/data";
|
|
@@ -14,6 +14,7 @@ import { decodeEntities } from "@wordpress/html-entities";
|
|
|
14
14
|
import { __, sprintf } from "@wordpress/i18n";
|
|
15
15
|
import { filterURLForDisplay } from "@wordpress/url";
|
|
16
16
|
import { getTitleWithFallbackName } from "./utils";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
18
|
function buildTermsTree(flatTerms) {
|
|
18
19
|
const flatTermsWithParentAndChildren = flatTerms.map((term) => {
|
|
19
20
|
return {
|
|
@@ -48,7 +49,7 @@ function buildTermsTree(flatTerms) {
|
|
|
48
49
|
};
|
|
49
50
|
return fillWithChildren(termsByParent["0"] || []);
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
var getItemPriority = (name, searchValue) => {
|
|
52
53
|
const normalizedName = removeAccents(name || "").toLowerCase();
|
|
53
54
|
const normalizedSearch = removeAccents(searchValue || "").toLowerCase();
|
|
54
55
|
if (normalizedName === normalizedSearch) {
|
|
@@ -178,7 +179,7 @@ function PageAttributesParent({
|
|
|
178
179
|
}
|
|
179
180
|
);
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
+
var ParentEdit = ({
|
|
182
183
|
data,
|
|
183
184
|
field,
|
|
184
185
|
onChange
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/parent/parent-edit.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { ComboboxControl, ExternalLink } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcreateInterpolateElement,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n} from '@wordpress/element';\n// @ts-ignore\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { debounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getTitleWithFallbackName } from './utils';\n\ntype TreeBase = {\n\tid: number;\n\tname: string;\n\t[ key: string ]: any;\n};\n\ntype TreeWithParent = TreeBase & {\n\tparent: number;\n};\n\ntype TreeWithoutParent = TreeBase & {\n\tparent: null;\n};\n\ntype Tree = TreeWithParent | TreeWithoutParent;\n\nfunction buildTermsTree( flatTerms: Tree[] ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some(\n\t\t\t( { parent } ) => parent === null || parent === undefined\n\t\t)\n\t) {\n\t\treturn flatTermsWithParentAndChildren as TreeWithParent[];\n\t}\n\n\tconst termsByParent = (\n\t\tflatTermsWithParentAndChildren as TreeWithParent[]\n\t ).reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{} as Record< string, Array< TreeWithParent > >\n\t);\n\n\tconst fillWithChildren = (\n\t\tterms: Array< TreeWithParent >\n\t): Array< TreeWithParent > => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const getItemPriority = ( name: string, searchValue: string ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent( {\n\tdata,\n\tonChangeControl,\n}: {\n\tdata: BasePost;\n\tonChangeControl: ( newValue: number ) => void;\n} ) {\n\tconst [ fieldValue, setFieldValue ] = useState< null | string >( null );\n\n\tconst pageId = data.parent;\n\tconst postId = data.id;\n\tconst postTypeSlug = data.type;\n\n\tconst { parentPostTitle, pageItems, isHierarchical } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords, getPostType } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst postTypeInfo = getPostType( postTypeSlug );\n\n\t\t\tconst postIsHierarchical =\n\t\t\t\tpostTypeInfo?.hierarchical && postTypeInfo.viewable;\n\n\t\t\tconst parentPost = pageId\n\t\t\t\t? getEntityRecord< BasePost >(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\tpageId\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t...( fieldValue !== null && {\n\t\t\t\t\tsearch: fieldValue,\n\t\t\t\t} ),\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\tparentPostTitle: parentPost\n\t\t\t\t\t? getTitleWithFallbackName( parentPost )\n\t\t\t\t\t: '',\n\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t? getEntityRecords< BasePost >(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue, pageId, postId, postTypeSlug ]\n\t);\n\n\t/**\n\t * This logic has been copied from https://github.com/WordPress/gutenberg/blob/0249771b519d5646171fb9fae422006c8ab773f2/packages/editor/src/components/page-attributes/parent.js#L106.\n\t */\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = (\n\t\t\ttree: Array< Tree >,\n\t\t\tlevel = 0\n\t\t): Array< {\n\t\t\tvalue: number;\n\t\t\tlabel: string;\n\t\t\trawName: string;\n\t\t} > => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'\u2014 '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority(\n\t\t\t\t\ta.rawName,\n\t\t\t\t\tfieldValue ?? ''\n\t\t\t\t);\n\t\t\t\tconst priorityB = getItemPriority(\n\t\t\t\t\tb.rawName,\n\t\t\t\t\tfieldValue ?? ''\n\t\t\t\t);\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id as number,\n\t\t\tparent: item.parent ?? null,\n\t\t\tname: getTitleWithFallbackName( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find( ( item ) => item.value === pageId );\n\t\tif ( pageId && parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: pageId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t\trawName: '',\n\t\t\t} );\n\t\t}\n\t\treturn opts.map( ( option ) => ( {\n\t\t\t...option,\n\t\t\tvalue: option.value.toString(),\n\t\t} ) );\n\t}, [ pageItems, fieldValue, parentPostTitle, pageId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue: string ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId: string | null | undefined ) => {\n\t\tif ( selectedPostId ) {\n\t\t\treturn onChangeControl( parseInt( selectedPostId, 10 ) ?? 0 );\n\t\t}\n\n\t\tonChangeControl( 0 );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\thelp={ __( 'Choose a parent page.' ) }\n\t\t\tvalue={ pageId?.toString() }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce(\n\t\t\t\t( value: unknown ) => handleKeydown( value as string ),\n\t\t\t\t300\n\t\t\t) }\n\t\t\tonChange={ handleChange }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n\nexport const ParentEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePost > ) => {\n\tconst { id } = field;\n\n\tconst homeUrl = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getEntityRecord< {\n\t\t\thome: string;\n\t\t} >( 'root', '__unstableBase' )?.home as string;\n\t}, [] );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue?: number ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__parent\">\n\t\t\t<div>\n\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %1$s The home URL of the WordPress installation without the scheme. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Child pages inherit characteristics from their parent, such as URL structure. For instance, if \"Pricing\" is a child of \"Services\", its URL would be %1$s<wbr />/services<wbr />/pricing.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfilterURLForDisplay( homeUrl ).replace(\n\t\t\t\t\t\t\t/([/.])/g,\n\t\t\t\t\t\t\t'<wbr />$1'\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\twbr: <wbr />,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t<p>\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tchildren={ undefined }\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</p>\n\t\t\t\t<PageAttributesParent\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tonChangeControl={ onChangeControl }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,OAAO,mBAAmB;AAK1B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,SAAS,SAAS,iBAAiB;AAEnC,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,IAAI,eAAe;AAC5B,SAAS,2BAA2B;AAMpC,SAAS,gCAAgC;AA6OvC,cAwCC,YAxCD;AA3NF,SAAS,eAAgB,WAAoB;AAC5C,QAAM,iCAAiC,UAAU,IAAK,CAAE,SAAU;AACjE,WAAO;AAAA,MACN,UAAU,CAAC;AAAA,MACX,GAAG;AAAA,IACJ;AA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EO,IAAM,aAAa,CAAE;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACD,MAAyC;AACxC,QAAM,EAAE,GAAG,IAAI;AAEf,QAAM,UAAU,UAAW,CAAE,WAAY;AACxC,WAAO,OAAQ,SAAU,EAAE,gBAEtB,QAAQ,gBAAiB,GAAG;AAAA,EAClC,GAAG,CAAC,CAAE;AAEN,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU;AAAA,MACT,CAAE,EAAG,GAAG;AAAA,IACT,CAAE;AAAA,IACH,CAAE,IAAI,QAAS;AAAA,EAChB;AAEA,SACC,oBAAC,cAAS,WAAU,2BACnB,+BAAC,SACE;AAAA;AAAA,MACD;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,QACD;AAAA,QACA,oBAAqB,OAAQ,EAAE;AAAA,UAC9B;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,QACC,KAAK,oBAAC,SAAI;AAAA,MACX;AAAA,IACD;AAAA,IACA,oBAAC,OACE;AAAA,MACD;AAAA,QACC;AAAA,MACD;AAAA,MACA;AAAA,QACC,GACC;AAAA,UAAC;AAAA;AAAA,YACA,MAAO;AAAA,cACN;AAAA,YACD;AAAA,YACA,UAAW;AAAA;AAAA,QACZ;AAAA,MAEF;AAAA,IACD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,KACD,GACD;AAEF;",
|
|
6
6
|
"names": ["tree"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/parent/parent-view.tsx
|
|
2
2
|
import { useSelect } from "@wordpress/data";
|
|
3
3
|
import { store as coreStore } from "@wordpress/core-data";
|
|
4
4
|
import { __ } from "@wordpress/i18n";
|
|
5
5
|
import { getTitleWithFallbackName } from "./utils";
|
|
6
|
-
|
|
6
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
7
|
+
var ParentView = ({
|
|
7
8
|
item
|
|
8
9
|
}) => {
|
|
9
10
|
const parent = useSelect(
|