@wordpress/fields 0.23.1-next.233ccab9b.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +8 -0
  3. package/build/actions/duplicate-post.js +1 -2
  4. package/build/actions/duplicate-post.js.map +1 -1
  5. package/build/actions/rename-post.js +1 -1
  6. package/build/actions/rename-post.js.map +1 -1
  7. package/build/actions/utils.js +9 -9
  8. package/build/actions/utils.js.map +1 -1
  9. package/build/fields/comment-status/index.js +2 -1
  10. package/build/fields/comment-status/index.js.map +1 -1
  11. package/build/fields/discussion/index.js +42 -0
  12. package/build/fields/discussion/index.js.map +1 -0
  13. package/build/fields/index.js +14 -0
  14. package/build/fields/index.js.map +1 -1
  15. package/build/fields/ping-status/index.js +64 -0
  16. package/build/fields/ping-status/index.js.map +1 -0
  17. package/build/types.js.map +1 -1
  18. package/build-module/actions/duplicate-post.js +1 -2
  19. package/build-module/actions/duplicate-post.js.map +1 -1
  20. package/build-module/actions/rename-post.js +1 -1
  21. package/build-module/actions/rename-post.js.map +1 -1
  22. package/build-module/actions/utils.js +9 -9
  23. package/build-module/actions/utils.js.map +1 -1
  24. package/build-module/fields/comment-status/index.js +2 -1
  25. package/build-module/fields/comment-status/index.js.map +1 -1
  26. package/build-module/fields/discussion/index.js +37 -0
  27. package/build-module/fields/discussion/index.js.map +1 -0
  28. package/build-module/fields/index.js +2 -0
  29. package/build-module/fields/index.js.map +1 -1
  30. package/build-module/fields/ping-status/index.js +58 -0
  31. package/build-module/fields/ping-status/index.js.map +1 -0
  32. package/build-module/types.js.map +1 -1
  33. package/build-types/actions/duplicate-post.d.ts.map +1 -1
  34. package/build-types/actions/utils.d.ts +1 -1
  35. package/build-types/actions/utils.d.ts.map +1 -1
  36. package/build-types/fields/comment-status/index.d.ts.map +1 -1
  37. package/build-types/fields/discussion/index.d.ts +14 -0
  38. package/build-types/fields/discussion/index.d.ts.map +1 -0
  39. package/build-types/fields/index.d.ts +2 -0
  40. package/build-types/fields/index.d.ts.map +1 -1
  41. package/build-types/fields/ping-status/index.d.ts +14 -0
  42. package/build-types/fields/ping-status/index.d.ts.map +1 -0
  43. package/build-types/types.d.ts +1 -0
  44. package/build-types/types.d.ts.map +1 -1
  45. package/package.json +25 -25
  46. package/src/actions/duplicate-post.tsx +1 -2
  47. package/src/actions/rename-post.tsx +1 -1
  48. package/src/actions/utils.ts +14 -11
  49. package/src/fields/comment-status/index.tsx +2 -1
  50. package/src/fields/discussion/index.tsx +36 -0
  51. package/src/fields/index.ts +2 -0
  52. package/src/fields/ping-status/index.tsx +74 -0
  53. package/src/types.ts +1 -0
  54. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["decodeEntities","isTemplate","post","type","isTemplatePart","isTemplateOrTemplatePart","p","getItemTitle","item","title","rendered","raw","isTemplateRemovable","template","source","includes","Boolean","plugin","has_theme_file"],"sources":["@wordpress/fields/src/actions/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport type { Post, TemplatePart, Template } from '../types';\n\nexport function isTemplate( post: Post ): post is Template {\n\treturn post.type === 'wp_template';\n}\n\nexport function isTemplatePart( post: Post ): post is TemplatePart {\n\treturn post.type === 'wp_template_part';\n}\n\nexport function isTemplateOrTemplatePart(\n\tp: Post\n): p is Template | TemplatePart {\n\treturn p.type === 'wp_template' || p.type === 'wp_template_part';\n}\n\nexport function getItemTitle( item: {\n\ttitle: string | { rendered: string } | { raw: string };\n} ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\tif ( item.title && 'rendered' in item.title ) {\n\t\treturn decodeEntities( item.title.rendered );\n\t}\n\tif ( item.title && 'raw' in item.title ) {\n\t\treturn decodeEntities( item.title.raw );\n\t}\n\treturn '';\n}\n\n/**\n * Check if a template is removable.\n *\n * @param template The template entity to check.\n * @return Whether the template is removable.\n */\nexport function isTemplateRemovable( template: Template | TemplatePart ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\t[ template.source, template.source ].includes( 'custom' ) &&\n\t\t! Boolean( template.type === 'wp_template' && template?.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;;AAGA,OAAO,SAASC,UAAUA,CAAEC,IAAU,EAAqB;EAC1D,OAAOA,IAAI,CAACC,IAAI,KAAK,aAAa;AACnC;AAEA,OAAO,SAASC,cAAcA,CAAEF,IAAU,EAAyB;EAClE,OAAOA,IAAI,CAACC,IAAI,KAAK,kBAAkB;AACxC;AAEA,OAAO,SAASE,wBAAwBA,CACvCC,CAAO,EACwB;EAC/B,OAAOA,CAAC,CAACH,IAAI,KAAK,aAAa,IAAIG,CAAC,CAACH,IAAI,KAAK,kBAAkB;AACjE;AAEA,OAAO,SAASI,YAAYA,CAAEC,IAE7B,EAAG;EACH,IAAK,OAAOA,IAAI,CAACC,KAAK,KAAK,QAAQ,EAAG;IACrC,OAAOT,cAAc,CAAEQ,IAAI,CAACC,KAAM,CAAC;EACpC;EACA,IAAKD,IAAI,CAACC,KAAK,IAAI,UAAU,IAAID,IAAI,CAACC,KAAK,EAAG;IAC7C,OAAOT,cAAc,CAAEQ,IAAI,CAACC,KAAK,CAACC,QAAS,CAAC;EAC7C;EACA,IAAKF,IAAI,CAACC,KAAK,IAAI,KAAK,IAAID,IAAI,CAACC,KAAK,EAAG;IACxC,OAAOT,cAAc,CAAEQ,IAAI,CAACC,KAAK,CAACE,GAAI,CAAC;EACxC;EACA,OAAO,EAAE;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,QAAiC,EAAG;EACxE,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA;EACA;EACA,OACC,CAAEA,QAAQ,CAACC,MAAM,EAAED,QAAQ,CAACC,MAAM,CAAE,CAACC,QAAQ,CAAE,QAAS,CAAC,IACzD,CAAEC,OAAO,CAAEH,QAAQ,CAACV,IAAI,KAAK,aAAa,IAAIU,QAAQ,EAAEI,MAAO,CAAC,IAChE,CAAEJ,QAAQ,CAACK,cAAc;AAE3B","ignoreList":[]}
1
+ {"version":3,"names":["decodeEntities","__","isTemplate","post","type","isTemplatePart","isTemplateOrTemplatePart","p","getItemTitle","item","fallback","title","rendered","raw","isTemplateRemovable","template","source","includes","Boolean","plugin","has_theme_file"],"sources":["@wordpress/fields/src/actions/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Post, TemplatePart, Template } from '../types';\n\nexport function isTemplate( post: Post ): post is Template {\n\treturn post.type === 'wp_template';\n}\n\nexport function isTemplatePart( post: Post ): post is TemplatePart {\n\treturn post.type === 'wp_template_part';\n}\n\nexport function isTemplateOrTemplatePart(\n\tp: Post\n): p is Template | TemplatePart {\n\treturn p.type === 'wp_template' || p.type === 'wp_template_part';\n}\n\nexport function getItemTitle(\n\titem: {\n\t\ttitle: string | { rendered: string } | { raw: string };\n\t},\n\tfallback: string = __( '(no title)' )\n) {\n\tlet title = '';\n\tif ( typeof item.title === 'string' ) {\n\t\ttitle = decodeEntities( item.title );\n\t} else if ( item.title && 'rendered' in item.title ) {\n\t\ttitle = decodeEntities( item.title.rendered );\n\t} else if ( item.title && 'raw' in item.title ) {\n\t\ttitle = decodeEntities( item.title.raw );\n\t}\n\treturn title || fallback;\n}\n\n/**\n * Check if a template is removable.\n *\n * @param template The template entity to check.\n * @return Whether the template is removable.\n */\nexport function isTemplateRemovable( template: Template | TemplatePart ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\t[ template.source, template.source ].includes( 'custom' ) &&\n\t\t! Boolean( template.type === 'wp_template' && template?.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA,OAAO,SAASC,UAAUA,CAAEC,IAAU,EAAqB;EAC1D,OAAOA,IAAI,CAACC,IAAI,KAAK,aAAa;AACnC;AAEA,OAAO,SAASC,cAAcA,CAAEF,IAAU,EAAyB;EAClE,OAAOA,IAAI,CAACC,IAAI,KAAK,kBAAkB;AACxC;AAEA,OAAO,SAASE,wBAAwBA,CACvCC,CAAO,EACwB;EAC/B,OAAOA,CAAC,CAACH,IAAI,KAAK,aAAa,IAAIG,CAAC,CAACH,IAAI,KAAK,kBAAkB;AACjE;AAEA,OAAO,SAASI,YAAYA,CAC3BC,IAEC,EACDC,QAAgB,GAAGT,EAAE,CAAE,YAAa,CAAC,EACpC;EACD,IAAIU,KAAK,GAAG,EAAE;EACd,IAAK,OAAOF,IAAI,CAACE,KAAK,KAAK,QAAQ,EAAG;IACrCA,KAAK,GAAGX,cAAc,CAAES,IAAI,CAACE,KAAM,CAAC;EACrC,CAAC,MAAM,IAAKF,IAAI,CAACE,KAAK,IAAI,UAAU,IAAIF,IAAI,CAACE,KAAK,EAAG;IACpDA,KAAK,GAAGX,cAAc,CAAES,IAAI,CAACE,KAAK,CAACC,QAAS,CAAC;EAC9C,CAAC,MAAM,IAAKH,IAAI,CAACE,KAAK,IAAI,KAAK,IAAIF,IAAI,CAACE,KAAK,EAAG;IAC/CA,KAAK,GAAGX,cAAc,CAAES,IAAI,CAACE,KAAK,CAACE,GAAI,CAAC;EACzC;EACA,OAAOF,KAAK,IAAID,QAAQ;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,mBAAmBA,CAAEC,QAAiC,EAAG;EACxE,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA;EACA;EACA,OACC,CAAEA,QAAQ,CAACC,MAAM,EAAED,QAAQ,CAACC,MAAM,CAAE,CAACC,QAAQ,CAAE,QAAS,CAAC,IACzD,CAAEC,OAAO,CAAEH,QAAQ,CAACX,IAAI,KAAK,aAAa,IAAIW,QAAQ,EAAEI,MAAO,CAAC,IAChE,CAAEJ,QAAQ,CAACK,cAAc;AAE3B","ignoreList":[]}
@@ -10,10 +10,11 @@ import { __ } from '@wordpress/i18n';
10
10
 
11
11
  const commentStatusField = {
12
12
  id: 'comment_status',
13
- label: __('Discussion'),
13
+ label: __('Comments'),
14
14
  type: 'text',
15
15
  Edit: 'radio',
16
16
  enableSorting: false,
17
+ enableHiding: false,
17
18
  filterBy: false,
18
19
  elements: [{
19
20
  value: 'open',
@@ -1 +1 @@
1
- {"version":3,"names":["__","commentStatusField","id","label","type","Edit","enableSorting","filterBy","elements","value","description"],"sources":["@wordpress/fields/src/fields/comment-status/index.tsx"],"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: __( 'Discussion' ),\n\ttype: 'text',\n\tEdit: 'radio',\n\tenableSorting: 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"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA,MAAMC,kBAAqC,GAAG;EAC7CC,EAAE,EAAE,gBAAgB;EACpBC,KAAK,EAAEH,EAAE,CAAE,YAAa,CAAC;EACzBI,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,OAAO;EACbC,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,CACT;IACCC,KAAK,EAAE,MAAM;IACbN,KAAK,EAAEH,EAAE,CAAE,MAAO,CAAC;IACnBU,WAAW,EAAEV,EAAE,CAAE,4CAA6C;EAC/D,CAAC,EACD;IACCS,KAAK,EAAE,QAAQ;IACfN,KAAK,EAAEH,EAAE,CAAE,QAAS,CAAC;IACrBU,WAAW,EAAEV,EAAE,CACd,gFACD;EACD,CAAC;AAEH,CAAC;;AAED;AACA;AACA;AACA,eAAeC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["__","commentStatusField","id","label","type","Edit","enableSorting","enableHiding","filterBy","elements","value","description"],"sources":["@wordpress/fields/src/fields/comment-status/index.tsx"],"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"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA,MAAMC,kBAAqC,GAAG;EAC7CC,EAAE,EAAE,gBAAgB;EACpBC,KAAK,EAAEH,EAAE,CAAE,UAAW,CAAC;EACvBI,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,OAAO;EACbC,aAAa,EAAE,KAAK;EACpBC,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,CACT;IACCC,KAAK,EAAE,MAAM;IACbP,KAAK,EAAEH,EAAE,CAAE,MAAO,CAAC;IACnBW,WAAW,EAAEX,EAAE,CAAE,4CAA6C;EAC/D,CAAC,EACD;IACCU,KAAK,EAAE,QAAQ;IACfP,KAAK,EAAEH,EAAE,CAAE,QAAS,CAAC;IACrBW,WAAW,EAAEX,EAAE,CACd,gFACD;EACD,CAAC;AAEH,CAAC;;AAED;AACA;AACA;AACA,eAAeC,kBAAkB","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
11
+ const discussionField = {
12
+ id: 'discussion',
13
+ label: __('Discussion'),
14
+ type: 'text',
15
+ render: ({
16
+ item
17
+ }) => {
18
+ const commentsOpen = item.comment_status === 'open';
19
+ const pingsOpen = item.ping_status === 'open';
20
+ if (commentsOpen && pingsOpen) {
21
+ return __('Open');
22
+ }
23
+ if (commentsOpen && !pingsOpen) {
24
+ return __('Comments only');
25
+ }
26
+ if (!commentsOpen && pingsOpen) {
27
+ return __('Pings only');
28
+ }
29
+ return __('Closed');
30
+ }
31
+ };
32
+
33
+ /**
34
+ * Discussion field for BasePost with custom render logic.
35
+ */
36
+ export default discussionField;
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","discussionField","id","label","type","render","item","commentsOpen","comment_status","pingsOpen","ping_status"],"sources":["@wordpress/fields/src/fields/discussion/index.tsx"],"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};\n\n/**\n * Discussion field for BasePost with custom render logic.\n */\nexport default discussionField;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA,MAAMC,eAAkC,GAAG;EAC1CC,EAAE,EAAE,YAAY;EAChBC,KAAK,EAAEH,EAAE,CAAE,YAAa,CAAC;EACzBI,IAAI,EAAE,MAAM;EACZC,MAAM,EAAEA,CAAE;IAAEC;EAAK,CAAC,KAAM;IACvB,MAAMC,YAAY,GAAGD,IAAI,CAACE,cAAc,KAAK,MAAM;IACnD,MAAMC,SAAS,GAAGH,IAAI,CAACI,WAAW,KAAK,MAAM;IAE7C,IAAKH,YAAY,IAAIE,SAAS,EAAG;MAChC,OAAOT,EAAE,CAAE,MAAO,CAAC;IACpB;IACA,IAAKO,YAAY,IAAI,CAAEE,SAAS,EAAG;MAClC,OAAOT,EAAE,CAAE,eAAgB,CAAC;IAC7B;IACA,IAAK,CAAEO,YAAY,IAAIE,SAAS,EAAG;MAClC,OAAOT,EAAE,CAAE,YAAa,CAAC;IAC1B;IACA,OAAOA,EAAE,CAAE,QAAS,CAAC;EACtB;AACD,CAAC;;AAED;AACA;AACA;AACA,eAAeC,eAAe","ignoreList":[]}
@@ -10,6 +10,8 @@ export { default as parentField } from './parent';
10
10
  export { default as passwordField } from './password';
11
11
  export { default as statusField } from './status';
12
12
  export { default as commentStatusField } from './comment-status';
13
+ export { default as pingStatusField } from './ping-status';
14
+ export { default as discussionField } from './discussion';
13
15
  export { default as dateField } from './date';
14
16
  export { default as authorField } from './author';
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","slugField","titleField","pageTitleField","templateTitleField","patternTitleField","orderField","featuredImageField","templateField","parentField","passwordField","statusField","commentStatusField","dateField","authorField"],"sources":["@wordpress/fields/src/fields/index.ts"],"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 dateField } from './date';\nexport { default as authorField } from './author';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,SAAS,QAAQ,QAAQ;AAC7C,SAASD,OAAO,IAAIE,UAAU,QAAQ,SAAS;AAC/C,SAASF,OAAO,IAAIG,cAAc,QAAQ,cAAc;AACxD,SAASH,OAAO,IAAII,kBAAkB,QAAQ,kBAAkB;AAChE,SAASJ,OAAO,IAAIK,iBAAiB,QAAQ,iBAAiB;AAC9D,SAASL,OAAO,IAAIM,UAAU,QAAQ,SAAS;AAC/C,SAASN,OAAO,IAAIO,kBAAkB,QAAQ,kBAAkB;AAChE,SAASP,OAAO,IAAIQ,aAAa,QAAQ,YAAY;AACrD,SAASR,OAAO,IAAIS,WAAW,QAAQ,UAAU;AACjD,SAAST,OAAO,IAAIU,aAAa,QAAQ,YAAY;AACrD,SAASV,OAAO,IAAIW,WAAW,QAAQ,UAAU;AACjD,SAASX,OAAO,IAAIY,kBAAkB,QAAQ,kBAAkB;AAChE,SAASZ,OAAO,IAAIa,SAAS,QAAQ,QAAQ;AAC7C,SAASb,OAAO,IAAIc,WAAW,QAAQ,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["default","slugField","titleField","pageTitleField","templateTitleField","patternTitleField","orderField","featuredImageField","templateField","parentField","passwordField","statusField","commentStatusField","pingStatusField","discussionField","dateField","authorField"],"sources":["@wordpress/fields/src/fields/index.ts"],"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"],"mappings":"AAAA,SAASA,OAAO,IAAIC,SAAS,QAAQ,QAAQ;AAC7C,SAASD,OAAO,IAAIE,UAAU,QAAQ,SAAS;AAC/C,SAASF,OAAO,IAAIG,cAAc,QAAQ,cAAc;AACxD,SAASH,OAAO,IAAII,kBAAkB,QAAQ,kBAAkB;AAChE,SAASJ,OAAO,IAAIK,iBAAiB,QAAQ,iBAAiB;AAC9D,SAASL,OAAO,IAAIM,UAAU,QAAQ,SAAS;AAC/C,SAASN,OAAO,IAAIO,kBAAkB,QAAQ,kBAAkB;AAChE,SAASP,OAAO,IAAIQ,aAAa,QAAQ,YAAY;AACrD,SAASR,OAAO,IAAIS,WAAW,QAAQ,UAAU;AACjD,SAAST,OAAO,IAAIU,aAAa,QAAQ,YAAY;AACrD,SAASV,OAAO,IAAIW,WAAW,QAAQ,UAAU;AACjD,SAASX,OAAO,IAAIY,kBAAkB,QAAQ,kBAAkB;AAChE,SAASZ,OAAO,IAAIa,eAAe,QAAQ,eAAe;AAC1D,SAASb,OAAO,IAAIc,eAAe,QAAQ,cAAc;AACzD,SAASd,OAAO,IAAIe,SAAS,QAAQ,QAAQ;AAC7C,SAASf,OAAO,IAAIgB,WAAW,QAAQ,UAAU","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+
5
+ import { __ } from '@wordpress/i18n';
6
+ import { CheckboxControl, ExternalLink } from '@wordpress/components';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ function PingStatusEdit({
13
+ data,
14
+ onChange
15
+ }) {
16
+ var _data$ping_status;
17
+ const pingStatus = (_data$ping_status = data?.ping_status) !== null && _data$ping_status !== void 0 ? _data$ping_status : 'open';
18
+ const onTogglePingback = checked => {
19
+ onChange({
20
+ ...data,
21
+ ping_status: checked ? 'open' : 'closed'
22
+ });
23
+ };
24
+ return /*#__PURE__*/_jsx(CheckboxControl, {
25
+ __nextHasNoMarginBottom: true,
26
+ label: __('Enable pingbacks & trackbacks'),
27
+ checked: pingStatus === 'open',
28
+ onChange: onTogglePingback,
29
+ help: /*#__PURE__*/_jsx(ExternalLink, {
30
+ href: __('https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'),
31
+ children: __('Learn more about pingbacks & trackbacks')
32
+ })
33
+ });
34
+ }
35
+ const pingStatusField = {
36
+ id: 'ping_status',
37
+ label: __('Trackbacks & Pingbacks'),
38
+ type: 'text',
39
+ Edit: PingStatusEdit,
40
+ enableSorting: false,
41
+ enableHiding: false,
42
+ filterBy: false,
43
+ elements: [{
44
+ value: 'open',
45
+ label: __('Allow'),
46
+ description: __('Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.')
47
+ }, {
48
+ value: 'closed',
49
+ label: __("Don't allow"),
50
+ description: __("Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles.")
51
+ }]
52
+ };
53
+
54
+ /**
55
+ * Ping status field for BasePost.
56
+ */
57
+ export default pingStatusField;
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","CheckboxControl","ExternalLink","jsx","_jsx","PingStatusEdit","data","onChange","_data$ping_status","pingStatus","ping_status","onTogglePingback","checked","__nextHasNoMarginBottom","label","help","href","children","pingStatusField","id","type","Edit","enableSorting","enableHiding","filterBy","elements","value","description"],"sources":["@wordpress/fields/src/fields/ping-status/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps, Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl, ExternalLink } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nfunction PingStatusEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< BasePost > ) {\n\tconst pingStatus = data?.ping_status ?? 'open';\n\n\tconst onTogglePingback = ( checked: boolean ) => {\n\t\tonChange( {\n\t\t\t...data,\n\t\t\tping_status: checked ? 'open' : 'closed',\n\t\t} );\n\t};\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Enable pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t\thelp={\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Learn more about pingbacks & trackbacks' ) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nconst pingStatusField: Field< BasePost > = {\n\tid: 'ping_status',\n\tlabel: __( 'Trackbacks & Pingbacks' ),\n\ttype: 'text',\n\tEdit: PingStatusEdit,\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n\telements: [\n\t\t{\n\t\t\tvalue: 'open',\n\t\t\tlabel: __( 'Allow' ),\n\t\t\tdescription: __(\n\t\t\t\t'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.'\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tvalue: 'closed',\n\t\t\tlabel: __( \"Don't allow\" ),\n\t\t\tdescription: __(\n\t\t\t\t\"Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles.\"\n\t\t\t),\n\t\t},\n\t],\n};\n\n/**\n * Ping status field for BasePost.\n */\nexport default pingStatusField;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,YAAY,QAAQ,uBAAuB;;AAErE;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA;AAKA,SAASC,cAAcA,CAAE;EACxBC,IAAI;EACJC;AACiC,CAAC,EAAG;EAAA,IAAAC,iBAAA;EACrC,MAAMC,UAAU,IAAAD,iBAAA,GAAGF,IAAI,EAAEI,WAAW,cAAAF,iBAAA,cAAAA,iBAAA,GAAI,MAAM;EAE9C,MAAMG,gBAAgB,GAAKC,OAAgB,IAAM;IAChDL,QAAQ,CAAE;MACT,GAAGD,IAAI;MACPI,WAAW,EAAEE,OAAO,GAAG,MAAM,GAAG;IACjC,CAAE,CAAC;EACJ,CAAC;EAED,oBACCR,IAAA,CAACH,eAAe;IACfY,uBAAuB;IACvBC,KAAK,EAAGd,EAAE,CAAE,+BAAgC,CAAG;IAC/CY,OAAO,EAAGH,UAAU,KAAK,MAAQ;IACjCF,QAAQ,EAAGI,gBAAkB;IAC7BI,IAAI,eACHX,IAAA,CAACF,YAAY;MACZc,IAAI,EAAGhB,EAAE,CACR,uEACD,CAAG;MAAAiB,QAAA,EAEDjB,EAAE,CAAE,yCAA0C;IAAC,CACpC;EACd,CACD,CAAC;AAEJ;AAEA,MAAMkB,eAAkC,GAAG;EAC1CC,EAAE,EAAE,aAAa;EACjBL,KAAK,EAAEd,EAAE,CAAE,wBAAyB,CAAC;EACrCoB,IAAI,EAAE,MAAM;EACZC,IAAI,EAAEhB,cAAc;EACpBiB,aAAa,EAAE,KAAK;EACpBC,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,CACT;IACCC,KAAK,EAAE,MAAM;IACbZ,KAAK,EAAEd,EAAE,CAAE,OAAQ,CAAC;IACpB2B,WAAW,EAAE3B,EAAE,CACd,uFACD;EACD,CAAC,EACD;IACC0B,KAAK,EAAE,QAAQ;IACfZ,KAAK,EAAEd,EAAE,CAAE,aAAc,CAAC;IAC1B2B,WAAW,EAAE3B,EAAE,CACd,6FACD;EACD,CAAC;AAEH,CAAC;;AAED;AACA;AACA;AACA,eAAekB,eAAe","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/fields/src/types.ts"],"sourcesContent":["type PostStatus =\n\t| 'publish'\n\t| 'draft'\n\t| 'pending'\n\t| 'private'\n\t| 'future'\n\t| 'auto-draft'\n\t| 'trash';\n\nexport interface CommonPost {\n\tstatus?: PostStatus;\n\ttitle: string | { rendered: string } | { raw: string };\n\tcontent: string | { raw: string; rendered: string };\n\ttype: string;\n\tid: string | number;\n\tblocks?: Object[];\n\t_links?: Links;\n}\n\ninterface Links {\n\t'predecessor-version'?: { href: string; id: number }[];\n\t'version-history'?: { href: string; count: number }[];\n\t[ key: string ]: { href: string }[] | undefined;\n}\n\ninterface Author {\n\tname: string;\n\tavatar_urls: Record< string, string >;\n}\n\ninterface EmbeddedAuthor {\n\tauthor: Author[];\n}\n\n/**\n * BasePost interface used for all post types.\n */\nexport interface BasePost extends CommonPost {\n\tcomment_status?: 'open' | 'closed';\n\texcerpt?: string | { raw: string; rendered: string };\n\tmeta?: Record< string, any >;\n\tparent?: number;\n\tpassword?: string;\n\ttemplate?: string;\n\tformat?: string;\n\tfeatured_media?: number;\n\tmenu_order?: number;\n\tping_status?: 'open' | 'closed';\n\tlink?: string;\n\tslug?: string;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEmbeddedAuthor extends BasePost {\n\t_embedded: EmbeddedAuthor;\n}\n\nexport interface Template extends CommonPost {\n\ttype: 'wp_template';\n\tis_custom: boolean;\n\tsource: string;\n\torigin: string;\n\tplugin?: string;\n\thas_theme_file: boolean;\n\tid: string;\n}\n\nexport interface TemplatePart extends CommonPost {\n\ttype: 'wp_template_part';\n\tsource: string;\n\torigin: string;\n\thas_theme_file: boolean;\n\tid: string;\n\tarea: string;\n\tplugin?: string;\n}\n\nexport interface Pattern extends CommonPost {\n\tslug: string;\n\ttitle: { raw: string };\n\twp_pattern_sync_status: string;\n}\n\nexport type Post = Template | TemplatePart | Pattern | BasePost;\n\nexport type PostWithPermissions = Post & {\n\tpermissions: {\n\t\tdelete: boolean;\n\t\tupdate: boolean;\n\t};\n};\n\nexport interface PostType {\n\tslug: string;\n\tviewable: boolean;\n\tsupports?: {\n\t\t'page-attributes'?: boolean;\n\t\ttitle?: boolean;\n\t\trevisions?: boolean;\n\t\tauthor?: string;\n\t\tthumbnail?: string;\n\t\tcomments?: string;\n\t\teditor?: boolean;\n\t};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/fields/src/types.ts"],"sourcesContent":["type PostStatus =\n\t| 'publish'\n\t| 'draft'\n\t| 'pending'\n\t| 'private'\n\t| 'future'\n\t| 'auto-draft'\n\t| 'trash';\n\nexport interface CommonPost {\n\tstatus?: PostStatus;\n\ttitle: string | { rendered: string } | { raw: string };\n\tcontent: string | { raw: string; rendered: string };\n\ttype: string;\n\tid: string | number;\n\tblocks?: Object[];\n\t_links?: Links;\n}\n\ninterface Links {\n\t'predecessor-version'?: { href: string; id: number }[];\n\t'version-history'?: { href: string; count: number }[];\n\t[ key: string ]: { href: string }[] | undefined;\n}\n\ninterface Author {\n\tname: string;\n\tavatar_urls: Record< string, string >;\n}\n\ninterface EmbeddedAuthor {\n\tauthor: Author[];\n}\n\n/**\n * BasePost interface used for all post types.\n */\nexport interface BasePost extends CommonPost {\n\tcomment_status?: 'open' | 'closed';\n\texcerpt?: string | { raw: string; rendered: string };\n\tmeta?: Record< string, any >;\n\tparent?: number;\n\tpassword?: string;\n\ttemplate?: string;\n\tformat?: string;\n\tfeatured_media?: number;\n\tmenu_order?: number;\n\tping_status?: 'open' | 'closed';\n\tlink?: string;\n\tslug?: string;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEmbeddedAuthor extends BasePost {\n\t_embedded: EmbeddedAuthor;\n}\n\nexport interface Template extends CommonPost {\n\ttype: 'wp_template';\n\tis_custom: boolean;\n\tsource: string;\n\torigin: string;\n\tplugin?: string;\n\thas_theme_file: boolean;\n\tid: string;\n}\n\nexport interface TemplatePart extends CommonPost {\n\ttype: 'wp_template_part';\n\tsource: string;\n\torigin: string;\n\thas_theme_file: boolean;\n\tid: string;\n\tarea: string;\n\tplugin?: string;\n}\n\nexport interface Pattern extends CommonPost {\n\tslug: string;\n\ttitle: { raw: string };\n\twp_pattern_sync_status: string;\n}\n\nexport type Post = Template | TemplatePart | Pattern | BasePost;\n\nexport type PostWithPermissions = Post & {\n\tpermissions: {\n\t\tdelete: boolean;\n\t\tupdate: boolean;\n\t};\n};\n\nexport interface PostType {\n\tslug: string;\n\tviewable: boolean;\n\tsupports?: {\n\t\t'page-attributes'?: boolean;\n\t\ttitle?: boolean;\n\t\trevisions?: boolean;\n\t\tauthor?: string;\n\t\tthumbnail?: string;\n\t\tcomments?: string;\n\t\teditor?: boolean;\n\t\ttrackbacks?: boolean;\n\t};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate-post.d.ts","sourceRoot":"","sources":["../../src/actions/duplicate-post.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMnD,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,UAAU,CAAC;AAQxD,QAAA,MAAM,aAAa,EAAE,MAAM,CAAE,QAAQ,CAqJpC,CAAC;AAEF;;GAEG;AACH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"duplicate-post.d.ts","sourceRoot":"","sources":["../../src/actions/duplicate-post.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMnD,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,UAAU,CAAC;AAQxD,QAAA,MAAM,aAAa,EAAE,MAAM,CAAE,QAAQ,CAqJpC,CAAC;AAEF;;GAEG;AACH,eAAe,aAAa,CAAC"}
@@ -11,7 +11,7 @@ export declare function getItemTitle(item: {
11
11
  } | {
12
12
  raw: string;
13
13
  };
14
- }): string;
14
+ }, fallback?: string): string;
15
15
  /**
16
16
  * Check if a template is removable.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/actions/utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7D,wBAAgB,UAAU,CAAE,IAAI,EAAE,IAAI,GAAI,IAAI,IAAI,QAAQ,CAEzD;AAED,wBAAgB,cAAc,CAAE,IAAI,EAAE,IAAI,GAAI,IAAI,IAAI,YAAY,CAEjE;AAED,wBAAgB,wBAAwB,CACvC,CAAC,EAAE,IAAI,GACL,CAAC,IAAI,QAAQ,GAAG,YAAY,CAE9B;AAED,wBAAgB,YAAY,CAAE,IAAI,EAAE;IACnC,KAAK,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD,UAWA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAE,QAAQ,EAAE,QAAQ,GAAG,YAAY,WAYrE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/actions/utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7D,wBAAgB,UAAU,CAAE,IAAI,EAAE,IAAI,GAAI,IAAI,IAAI,QAAQ,CAEzD;AAED,wBAAgB,cAAc,CAAE,IAAI,EAAE,IAAI,GAAI,IAAI,IAAI,YAAY,CAEjE;AAED,wBAAgB,wBAAwB,CACvC,CAAC,EAAE,IAAI,GACL,CAAC,IAAI,QAAQ,GAAG,YAAY,CAE9B;AAED,wBAAgB,YAAY,CAC3B,IAAI,EAAE;IACL,KAAK,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD,EACD,QAAQ,GAAE,MAA2B,UAWrC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAE,QAAQ,EAAE,QAAQ,GAAG,YAAY,WAYrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/comment-status/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAE,QAAQ,CAqBxC,CAAC;AAEF;;GAEG;AACH,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/comment-status/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAE,QAAQ,CAsBxC,CAAC;AAEF;;GAEG;AACH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { Field } from '@wordpress/dataviews';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import type { BasePost } from '../../types';
9
+ declare const discussionField: Field<BasePost>;
10
+ /**
11
+ * Discussion field for BasePost with custom render logic.
12
+ */
13
+ export default discussionField;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/discussion/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,QAAA,MAAM,eAAe,EAAE,KAAK,CAAE,QAAQ,CAmBrC,CAAC;AAEF;;GAEG;AACH,eAAe,eAAe,CAAC"}
@@ -10,6 +10,8 @@ export { default as parentField } from './parent';
10
10
  export { default as passwordField } from './password';
11
11
  export { default as statusField } from './status';
12
12
  export { default as commentStatusField } from './comment-status';
13
+ export { default as pingStatusField } from './ping-status';
14
+ export { default as discussionField } from './discussion';
13
15
  export { default as dateField } from './date';
14
16
  export { default as authorField } from './author';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { Field } from '@wordpress/dataviews';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import type { BasePost } from '../../types';
9
+ declare const pingStatusField: Field<BasePost>;
10
+ /**
11
+ * Ping status field for BasePost.
12
+ */
13
+ export default pingStatusField;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/ping-status/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAwB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAIxE;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkC5C,QAAA,MAAM,eAAe,EAAE,KAAK,CAAE,QAAQ,CAwBrC,CAAC;AAEF;;GAEG;AACH,eAAe,eAAe,CAAC"}
@@ -105,6 +105,7 @@ export interface PostType {
105
105
  thumbnail?: string;
106
106
  comments?: string;
107
107
  editor?: boolean;
108
+ trackbacks?: boolean;
108
109
  };
109
110
  }
110
111
  export type CoreDataError = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GACZ,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,OAAO,CAAC;AAEX,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,OAAO,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC;CACf;AAED,UAAU,KAAK;IACd,qBAAqB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvD,iBAAiB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD,CAAE,GAAG,EAAE,MAAM,GAAI;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,S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,UAAU;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG;IACxC,WAAW,EAAE;QACZ,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;KAChB,CAAC;CACF,CAAC;AAEF,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE;QACV,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACF;AAGD,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/fields",
3
- "version": "0.23.1-next.233ccab9b.0",
3
+ "version": "0.24.0",
4
4
  "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -33,29 +33,29 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@babel/runtime": "7.25.7",
36
- "@wordpress/api-fetch": "^7.31.1-next.233ccab9b.0",
37
- "@wordpress/blob": "^4.31.1-next.233ccab9b.0",
38
- "@wordpress/block-editor": "^15.4.1-next.233ccab9b.0",
39
- "@wordpress/blocks": "^15.4.1-next.233ccab9b.0",
40
- "@wordpress/components": "^30.5.1-next.233ccab9b.0",
41
- "@wordpress/compose": "^7.31.1-next.233ccab9b.0",
42
- "@wordpress/core-data": "^7.31.1-next.233ccab9b.0",
43
- "@wordpress/data": "^10.31.1-next.233ccab9b.0",
44
- "@wordpress/dataviews": "^9.1.1-next.233ccab9b.0",
45
- "@wordpress/date": "^5.31.1-next.233ccab9b.0",
46
- "@wordpress/element": "^6.31.1-next.233ccab9b.0",
47
- "@wordpress/hooks": "^4.31.1-next.233ccab9b.0",
48
- "@wordpress/html-entities": "^4.31.1-next.233ccab9b.0",
49
- "@wordpress/i18n": "^6.4.1-next.233ccab9b.0",
50
- "@wordpress/icons": "^10.31.1-next.233ccab9b.0",
51
- "@wordpress/media-utils": "^5.31.1-next.233ccab9b.0",
52
- "@wordpress/notices": "^5.31.1-next.233ccab9b.0",
53
- "@wordpress/patterns": "^2.31.1-next.233ccab9b.0",
54
- "@wordpress/primitives": "^4.31.1-next.233ccab9b.0",
55
- "@wordpress/private-apis": "^1.31.1-next.233ccab9b.0",
56
- "@wordpress/router": "^1.31.1-next.233ccab9b.0",
57
- "@wordpress/url": "^4.31.1-next.233ccab9b.0",
58
- "@wordpress/warning": "^3.31.1-next.233ccab9b.0",
36
+ "@wordpress/api-fetch": "^7.32.0",
37
+ "@wordpress/blob": "^4.32.0",
38
+ "@wordpress/block-editor": "^15.5.0",
39
+ "@wordpress/blocks": "^15.5.0",
40
+ "@wordpress/components": "^30.5.0",
41
+ "@wordpress/compose": "^7.32.0",
42
+ "@wordpress/core-data": "^7.32.0",
43
+ "@wordpress/data": "^10.32.0",
44
+ "@wordpress/dataviews": "^9.1.0",
45
+ "@wordpress/date": "^5.32.0",
46
+ "@wordpress/element": "^6.32.0",
47
+ "@wordpress/hooks": "^4.32.0",
48
+ "@wordpress/html-entities": "^4.32.0",
49
+ "@wordpress/i18n": "^6.5.0",
50
+ "@wordpress/icons": "^10.32.0",
51
+ "@wordpress/media-utils": "^5.32.0",
52
+ "@wordpress/notices": "^5.32.0",
53
+ "@wordpress/patterns": "^2.32.0",
54
+ "@wordpress/primitives": "^4.32.0",
55
+ "@wordpress/private-apis": "^1.32.0",
56
+ "@wordpress/router": "^1.32.0",
57
+ "@wordpress/url": "^4.32.0",
58
+ "@wordpress/warning": "^3.32.0",
59
59
  "change-case": "4.1.2",
60
60
  "client-zip": "^2.4.5",
61
61
  "clsx": "2.1.1",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "d11f971521e4b39b07124d5c5516890ff98b0e31"
70
+ "gitHead": "a030b4c0e0695239b942c7dc18511782b64f10ed"
71
71
  }
@@ -2,7 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useDispatch } from '@wordpress/data';
5
- import { decodeEntities } from '@wordpress/html-entities';
6
5
  import { store as coreStore } from '@wordpress/core-data';
7
6
  import { __, sprintf, _x } from '@wordpress/i18n';
8
7
  import { store as noticesStore } from '@wordpress/notices';
@@ -113,7 +112,7 @@ const duplicatePost: Action< BasePost > = {
113
112
  sprintf(
114
113
  // translators: %s: Title of the created post, e.g: "Hello world".
115
114
  __( '"%s" successfully created.' ),
116
- decodeEntities( newItem.title?.rendered || item.title )
115
+ getItemTitle( newItem )
117
116
  ),
118
117
  {
119
118
  id: 'duplicate-post-action',
@@ -57,7 +57,7 @@ const renamePost: Action< PostWithPermissions > = {
57
57
  },
58
58
  RenderModal: ( { items, closeModal, onActionPerformed } ) => {
59
59
  const [ item ] = items;
60
- const [ title, setTitle ] = useState( () => getItemTitle( item ) );
60
+ const [ title, setTitle ] = useState( () => getItemTitle( item, '' ) );
61
61
  const { editEntityRecord, saveEditedEntityRecord } =
62
62
  useDispatch( coreStore );
63
63
  const { createSuccessNotice, createErrorNotice } =
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { decodeEntities } from '@wordpress/html-entities';
5
+ import { __ } from '@wordpress/i18n';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -22,19 +23,21 @@ export function isTemplateOrTemplatePart(
22
23
  return p.type === 'wp_template' || p.type === 'wp_template_part';
23
24
  }
24
25
 
25
- export function getItemTitle( item: {
26
- title: string | { rendered: string } | { raw: string };
27
- } ) {
26
+ export function getItemTitle(
27
+ item: {
28
+ title: string | { rendered: string } | { raw: string };
29
+ },
30
+ fallback: string = __( '(no title)' )
31
+ ) {
32
+ let title = '';
28
33
  if ( typeof item.title === 'string' ) {
29
- return decodeEntities( item.title );
34
+ title = decodeEntities( item.title );
35
+ } else if ( item.title && 'rendered' in item.title ) {
36
+ title = decodeEntities( item.title.rendered );
37
+ } else if ( item.title && 'raw' in item.title ) {
38
+ title = decodeEntities( item.title.raw );
30
39
  }
31
- if ( item.title && 'rendered' in item.title ) {
32
- return decodeEntities( item.title.rendered );
33
- }
34
- if ( item.title && 'raw' in item.title ) {
35
- return decodeEntities( item.title.raw );
36
- }
37
- return '';
40
+ return title || fallback;
38
41
  }
39
42
 
40
43
  /**
@@ -11,10 +11,11 @@ import type { BasePost } from '../../types';
11
11
 
12
12
  const commentStatusField: Field< BasePost > = {
13
13
  id: 'comment_status',
14
- label: __( 'Discussion' ),
14
+ label: __( 'Comments' ),
15
15
  type: 'text',
16
16
  Edit: 'radio',
17
17
  enableSorting: false,
18
+ enableHiding: false,
18
19
  filterBy: false,
19
20
  elements: [
20
21
  {
@@ -0,0 +1,36 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { Field } from '@wordpress/dataviews';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import type { BasePost } from '../../types';
11
+
12
+ const discussionField: Field< BasePost > = {
13
+ id: 'discussion',
14
+ label: __( 'Discussion' ),
15
+ type: 'text',
16
+ render: ( { item } ) => {
17
+ const commentsOpen = item.comment_status === 'open';
18
+ const pingsOpen = item.ping_status === 'open';
19
+
20
+ if ( commentsOpen && pingsOpen ) {
21
+ return __( 'Open' );
22
+ }
23
+ if ( commentsOpen && ! pingsOpen ) {
24
+ return __( 'Comments only' );
25
+ }
26
+ if ( ! commentsOpen && pingsOpen ) {
27
+ return __( 'Pings only' );
28
+ }
29
+ return __( 'Closed' );
30
+ },
31
+ };
32
+
33
+ /**
34
+ * Discussion field for BasePost with custom render logic.
35
+ */
36
+ export default discussionField;
@@ -10,5 +10,7 @@ export { default as parentField } from './parent';
10
10
  export { default as passwordField } from './password';
11
11
  export { default as statusField } from './status';
12
12
  export { default as commentStatusField } from './comment-status';
13
+ export { default as pingStatusField } from './ping-status';
14
+ export { default as discussionField } from './discussion';
13
15
  export { default as dateField } from './date';
14
16
  export { default as authorField } from './author';
@@ -0,0 +1,74 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import type { DataFormControlProps, Field } from '@wordpress/dataviews';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { CheckboxControl, ExternalLink } from '@wordpress/components';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import type { BasePost } from '../../types';
12
+
13
+ function PingStatusEdit( {
14
+ data,
15
+ onChange,
16
+ }: DataFormControlProps< BasePost > ) {
17
+ const pingStatus = data?.ping_status ?? 'open';
18
+
19
+ const onTogglePingback = ( checked: boolean ) => {
20
+ onChange( {
21
+ ...data,
22
+ ping_status: checked ? 'open' : 'closed',
23
+ } );
24
+ };
25
+
26
+ return (
27
+ <CheckboxControl
28
+ __nextHasNoMarginBottom
29
+ label={ __( 'Enable pingbacks & trackbacks' ) }
30
+ checked={ pingStatus === 'open' }
31
+ onChange={ onTogglePingback }
32
+ help={
33
+ <ExternalLink
34
+ href={ __(
35
+ 'https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'
36
+ ) }
37
+ >
38
+ { __( 'Learn more about pingbacks & trackbacks' ) }
39
+ </ExternalLink>
40
+ }
41
+ />
42
+ );
43
+ }
44
+
45
+ const pingStatusField: Field< BasePost > = {
46
+ id: 'ping_status',
47
+ label: __( 'Trackbacks & Pingbacks' ),
48
+ type: 'text',
49
+ Edit: PingStatusEdit,
50
+ enableSorting: false,
51
+ enableHiding: false,
52
+ filterBy: false,
53
+ elements: [
54
+ {
55
+ value: 'open',
56
+ label: __( 'Allow' ),
57
+ description: __(
58
+ 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.'
59
+ ),
60
+ },
61
+ {
62
+ value: 'closed',
63
+ label: __( "Don't allow" ),
64
+ description: __(
65
+ "Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles."
66
+ ),
67
+ },
68
+ ],
69
+ };
70
+
71
+ /**
72
+ * Ping status field for BasePost.
73
+ */
74
+ export default pingStatusField;
package/src/types.ts CHANGED
@@ -104,6 +104,7 @@ export interface PostType {
104
104
  thumbnail?: string;
105
105
  comments?: string;
106
106
  editor?: boolean;
107
+ trackbacks?: boolean;
107
108
  };
108
109
  }
109
110