@wordpress/fields 0.3.0 → 0.4.1-next.082ed6819.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/README.md +20 -0
- package/build/actions/utils.js +2 -2
- package/build/actions/utils.js.map +1 -1
- package/build/fields/author/author-view.js +72 -0
- package/build/fields/author/author-view.js.map +1 -0
- package/build/fields/author/index.js +35 -0
- package/build/fields/author/index.js.map +1 -0
- package/build/fields/comment-status/index.js +40 -0
- package/build/fields/comment-status/index.js.map +1 -0
- package/build/fields/date/date-view.js +69 -0
- package/build/fields/date/date-view.js.map +1 -0
- package/build/fields/date/index.js +29 -0
- package/build/fields/date/index.js.map +1 -0
- package/build/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build/fields/featured-image/featured-image-view.js.map +1 -1
- package/build/fields/featured-image/index.js +0 -3
- package/build/fields/featured-image/index.js.map +1 -1
- package/build/fields/index.js +35 -0
- package/build/fields/index.js.map +1 -1
- package/build/fields/order/index.js +1 -1
- package/build/fields/order/index.js.map +1 -1
- package/build/fields/parent/index.js +0 -3
- package/build/fields/parent/index.js.map +1 -1
- package/build/fields/parent/parent-edit.js +6 -6
- package/build/fields/parent/parent-edit.js.map +1 -1
- package/build/fields/parent/parent-view.js +1 -1
- package/build/fields/parent/parent-view.js.map +1 -1
- package/build/fields/password/edit.js +65 -0
- package/build/fields/password/edit.js.map +1 -0
- package/build/fields/password/index.js +30 -0
- package/build/fields/password/index.js.map +1 -0
- package/build/fields/slug/index.js +0 -3
- package/build/fields/slug/index.js.map +1 -1
- package/build/fields/slug/slug-edit.js +23 -26
- package/build/fields/slug/slug-edit.js.map +1 -1
- package/build/fields/slug/slug-view.js +3 -2
- package/build/fields/slug/slug-view.js.map +1 -1
- package/build/fields/slug/utils.js +21 -0
- package/build/fields/slug/utils.js.map +1 -0
- package/build/fields/status/index.js +37 -0
- package/build/fields/status/index.js.map +1 -0
- package/build/fields/status/status-elements.js +46 -0
- package/build/fields/status/status-elements.js.map +1 -0
- package/build/fields/status/status-view.js +41 -0
- package/build/fields/status/status-view.js.map +1 -0
- package/build/fields/title/index.js +5 -1
- package/build/fields/title/index.js.map +1 -1
- package/build/fields/title/title-view.js +61 -0
- package/build/fields/title/title-view.js.map +1 -0
- package/build/index.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/actions/utils.js +2 -2
- package/build-module/actions/utils.js.map +1 -1
- package/build-module/fields/author/author-view.js +64 -0
- package/build-module/fields/author/author-view.js.map +1 -0
- package/build-module/fields/author/index.js +29 -0
- package/build-module/fields/author/index.js.map +1 -0
- package/build-module/fields/comment-status/index.js +35 -0
- package/build-module/fields/comment-status/index.js.map +1 -0
- package/build-module/fields/date/date-view.js +62 -0
- package/build-module/fields/date/date-view.js.map +1 -0
- package/build-module/fields/date/index.js +23 -0
- package/build-module/fields/date/index.js.map +1 -0
- package/build-module/fields/featured-image/featured-image-edit.js +1 -2
- package/build-module/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build-module/fields/featured-image/featured-image-view.js.map +1 -1
- package/build-module/fields/featured-image/index.js +2 -4
- package/build-module/fields/featured-image/index.js.map +1 -1
- package/build-module/fields/index.js +5 -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/parent/index.js +2 -4
- package/build-module/fields/parent/index.js.map +1 -1
- package/build-module/fields/parent/parent-edit.js +10 -8
- package/build-module/fields/parent/parent-edit.js.map +1 -1
- package/build-module/fields/parent/parent-view.js +1 -1
- package/build-module/fields/parent/parent-view.js.map +1 -1
- package/build-module/fields/password/edit.js +58 -0
- package/build-module/fields/password/edit.js.map +1 -0
- package/build-module/fields/password/index.js +23 -0
- package/build-module/fields/password/index.js.map +1 -0
- package/build-module/fields/slug/index.js +2 -4
- package/build-module/fields/slug/index.js.map +1 -1
- package/build-module/fields/slug/slug-edit.js +25 -27
- package/build-module/fields/slug/slug-edit.js.map +1 -1
- package/build-module/fields/slug/slug-view.js +3 -2
- package/build-module/fields/slug/slug-view.js.map +1 -1
- package/build-module/fields/slug/utils.js +13 -0
- package/build-module/fields/slug/utils.js.map +1 -0
- package/build-module/fields/status/index.js +31 -0
- package/build-module/fields/status/index.js.map +1 -0
- package/build-module/fields/status/status-elements.js +40 -0
- package/build-module/fields/status/status-elements.js.map +1 -0
- package/build-module/fields/status/status-view.js +34 -0
- package/build-module/fields/status/status-view.js.map +1 -0
- package/build-module/fields/title/index.js +4 -1
- package/build-module/fields/title/index.js.map +1 -1
- package/build-module/fields/title/title-view.js +55 -0
- package/build-module/fields/title/title-view.js.map +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/{styles-rtl.css → style-rtl.css} +77 -0
- package/build-style/{styles.css → style.css} +77 -0
- package/build-types/fields/author/author-view.d.ts +9 -0
- package/build-types/fields/author/author-view.d.ts.map +1 -0
- package/build-types/fields/author/index.d.ts +14 -0
- package/build-types/fields/author/index.d.ts.map +1 -0
- package/build-types/fields/comment-status/index.d.ts +14 -0
- package/build-types/fields/comment-status/index.d.ts.map +1 -0
- package/build-types/fields/date/date-view.d.ts +9 -0
- package/build-types/fields/date/date-view.d.ts.map +1 -0
- package/build-types/fields/date/index.d.ts +14 -0
- package/build-types/fields/date/index.d.ts.map +1 -0
- 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 +1 -1
- package/build-types/fields/featured-image/featured-image-view.d.ts.map +1 -1
- package/build-types/fields/featured-image/index.d.ts.map +1 -1
- package/build-types/fields/index.d.ts +5 -0
- package/build-types/fields/index.d.ts.map +1 -1
- package/build-types/fields/order/index.d.ts.map +1 -1
- package/build-types/fields/parent/index.d.ts.map +1 -1
- package/build-types/fields/parent/parent-edit.d.ts +3 -0
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/parent/parent-view.d.ts +1 -1
- package/build-types/fields/parent/parent-view.d.ts.map +1 -1
- package/build-types/fields/password/edit.d.ts +8 -0
- package/build-types/fields/password/edit.d.ts.map +1 -0
- package/build-types/fields/password/index.d.ts +14 -0
- package/build-types/fields/password/index.d.ts.map +1 -0
- package/build-types/fields/slug/index.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 +6 -0
- package/build-types/fields/slug/utils.d.ts.map +1 -0
- package/build-types/fields/status/index.d.ts +14 -0
- package/build-types/fields/status/index.d.ts.map +1 -0
- package/build-types/fields/status/status-elements.d.ts +13 -0
- package/build-types/fields/status/status-elements.d.ts.map +1 -0
- package/build-types/fields/status/status-view.d.ts +9 -0
- package/build-types/fields/status/status-view.d.ts.map +1 -0
- package/build-types/fields/title/index.d.ts.map +1 -1
- package/build-types/fields/title/title-view.d.ts +9 -0
- package/build-types/fields/title/title-view.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/types.d.ts +14 -1
- package/build-types/types.d.ts.map +1 -1
- package/package.json +23 -21
- package/src/actions/utils.ts +2 -2
- package/src/fields/author/author-view.tsx +63 -0
- package/src/fields/author/index.tsx +32 -0
- package/src/fields/comment-status/index.tsx +40 -0
- package/src/fields/date/date-view.tsx +92 -0
- package/src/fields/date/index.tsx +23 -0
- package/src/fields/featured-image/featured-image-edit.tsx +2 -1
- package/src/fields/featured-image/featured-image-view.tsx +1 -1
- package/src/fields/featured-image/index.ts +1 -2
- package/src/fields/featured-image/style.scss +2 -5
- package/src/fields/index.ts +5 -0
- package/src/fields/order/index.ts +2 -1
- package/src/fields/parent/index.ts +1 -2
- package/src/fields/parent/parent-edit.tsx +9 -9
- package/src/fields/parent/parent-view.tsx +2 -2
- package/src/fields/password/edit.tsx +68 -0
- package/src/fields/password/index.tsx +24 -0
- package/src/fields/slug/index.ts +1 -2
- package/src/fields/slug/slug-edit.tsx +21 -24
- package/src/fields/slug/slug-view.tsx +3 -2
- package/src/fields/slug/utils.ts +15 -0
- package/src/fields/status/index.tsx +32 -0
- package/src/fields/status/status-elements.tsx +50 -0
- package/src/fields/status/status-view.tsx +28 -0
- package/src/fields/title/index.ts +3 -0
- package/src/fields/title/title-view.tsx +62 -0
- package/src/index.ts +1 -0
- package/src/style.scss +2 -0
- package/src/types.ts +17 -1
- package/tsconfig.json +10 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/src/styles.scss +0 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -14,6 +14,18 @@ npm install @wordpress/fields --save
|
|
|
14
14
|
|
|
15
15
|
<!-- START TOKEN(Autogenerated API docs) -->
|
|
16
16
|
|
|
17
|
+
### authorField
|
|
18
|
+
|
|
19
|
+
Author field for BasePost.
|
|
20
|
+
|
|
21
|
+
### commentStatusField
|
|
22
|
+
|
|
23
|
+
Comment status field for BasePost.
|
|
24
|
+
|
|
25
|
+
### dateField
|
|
26
|
+
|
|
27
|
+
Date field for BasePost.
|
|
28
|
+
|
|
17
29
|
### deletePost
|
|
18
30
|
|
|
19
31
|
Undocumented declaration.
|
|
@@ -50,6 +62,10 @@ Undocumented declaration.
|
|
|
50
62
|
|
|
51
63
|
This field is used to display the post parent.
|
|
52
64
|
|
|
65
|
+
### passwordField
|
|
66
|
+
|
|
67
|
+
This field is used to display the post password.
|
|
68
|
+
|
|
53
69
|
### permanentlyDeletePost
|
|
54
70
|
|
|
55
71
|
Undocumented declaration.
|
|
@@ -78,6 +94,10 @@ Undocumented declaration.
|
|
|
78
94
|
|
|
79
95
|
Undocumented declaration.
|
|
80
96
|
|
|
97
|
+
### statusField
|
|
98
|
+
|
|
99
|
+
Status field for BasePost.
|
|
100
|
+
|
|
81
101
|
### titleField
|
|
82
102
|
|
|
83
103
|
Undocumented declaration.
|
package/build/actions/utils.js
CHANGED
|
@@ -38,10 +38,10 @@ function getItemTitle(item) {
|
|
|
38
38
|
if (typeof item.title === 'string') {
|
|
39
39
|
return (0, _htmlEntities.decodeEntities)(item.title);
|
|
40
40
|
}
|
|
41
|
-
if ('rendered' in item.title) {
|
|
41
|
+
if (item.title && 'rendered' in item.title) {
|
|
42
42
|
return (0, _htmlEntities.decodeEntities)(item.title.rendered);
|
|
43
43
|
}
|
|
44
|
-
if ('raw' in item.title) {
|
|
44
|
+
if (item.title && 'raw' in item.title) {
|
|
45
45
|
return (0, _htmlEntities.decodeEntities)(item.title.raw);
|
|
46
46
|
}
|
|
47
47
|
return '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_htmlEntities","require","TEMPLATE_POST_TYPE","exports","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","isTemplate","post","type","isTemplatePart","isTemplateOrTemplatePart","p","getItemTitle","item","title","decodeEntities","rendered","raw","isTemplateRemovable","template","source","includes","Boolean","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 const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\n\nexport function isTemplate( post: Post ): post is Template {\n\treturn post.type === TEMPLATE_POST_TYPE;\n}\n\nexport function isTemplatePart( post: Post ): post is TemplatePart {\n\treturn post.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function isTemplateOrTemplatePart(\n\tp: Post\n): p is Template | TemplatePart {\n\treturn p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function getItemTitle( item: Post ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\tif ( 'rendered' in item.title ) {\n\t\treturn decodeEntities( item.title.rendered );\n\t}\n\tif ( '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(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! Boolean( template.type === 'wp_template' && template?.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,aAAa;AACxC,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AAEM,SAASC,UAAUA,CAAEC,IAAU,EAAqB;EAC1D,OAAOA,IAAI,CAACC,IAAI,KAAKT,kBAAkB;AACxC;AAEO,SAASU,cAAcA,CAAEF,IAAU,EAAyB;EAClE,OAAOA,IAAI,CAACC,IAAI,KAAKP,uBAAuB;AAC7C;AAEO,SAASS,wBAAwBA,CACvCC,CAAO,EACwB;EAC/B,OAAOA,CAAC,CAACH,IAAI,KAAKT,kBAAkB,IAAIY,CAAC,CAACH,IAAI,KAAKP,uBAAuB;AAC3E;AAEO,SAASW,YAAYA,CAAEC,IAAU,EAAG;EAC1C,IAAK,OAAOA,IAAI,CAACC,KAAK,KAAK,QAAQ,EAAG;IACrC,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAM,CAAC;EACpC;EACA,
|
|
1
|
+
{"version":3,"names":["_htmlEntities","require","TEMPLATE_POST_TYPE","exports","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","isTemplate","post","type","isTemplatePart","isTemplateOrTemplatePart","p","getItemTitle","item","title","decodeEntities","rendered","raw","isTemplateRemovable","template","source","includes","Boolean","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 const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\n\nexport function isTemplate( post: Post ): post is Template {\n\treturn post.type === TEMPLATE_POST_TYPE;\n}\n\nexport function isTemplatePart( post: Post ): post is TemplatePart {\n\treturn post.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function isTemplateOrTemplatePart(\n\tp: Post\n): p is Template | TemplatePart {\n\treturn p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function getItemTitle( item: Post ) {\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(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! Boolean( template.type === 'wp_template' && template?.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,aAAa;AACxC,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AAEM,SAASC,UAAUA,CAAEC,IAAU,EAAqB;EAC1D,OAAOA,IAAI,CAACC,IAAI,KAAKT,kBAAkB;AACxC;AAEO,SAASU,cAAcA,CAAEF,IAAU,EAAyB;EAClE,OAAOA,IAAI,CAACC,IAAI,KAAKP,uBAAuB;AAC7C;AAEO,SAASS,wBAAwBA,CACvCC,CAAO,EACwB;EAC/B,OAAOA,CAAC,CAACH,IAAI,KAAKT,kBAAkB,IAAIY,CAAC,CAACH,IAAI,KAAKP,uBAAuB;AAC3E;AAEO,SAASW,YAAYA,CAAEC,IAAU,EAAG;EAC1C,IAAK,OAAOA,IAAI,CAACC,KAAK,KAAK,QAAQ,EAAG;IACrC,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAM,CAAC;EACpC;EACA,IAAKD,IAAI,CAACC,KAAK,IAAI,UAAU,IAAID,IAAI,CAACC,KAAK,EAAG;IAC7C,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAK,CAACE,QAAS,CAAC;EAC7C;EACA,IAAKH,IAAI,CAACC,KAAK,IAAI,KAAK,IAAID,IAAI,CAACC,KAAK,EAAG;IACxC,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAK,CAACG,GAAI,CAAC;EACxC;EACA,OAAO,EAAE;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,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,CAC5CnB,gBAAgB,CAACC,MAClB,CAAC,IACD,CAAEmB,OAAO,CAAEH,QAAQ,CAACX,IAAI,KAAK,aAAa,IAAIW,QAAQ,EAAEd,MAAO,CAAC,IAChE,CAAEc,QAAQ,CAACI,cAAc;AAE3B","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
|
+
var _i18n = require("@wordpress/i18n");
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
var _data = require("@wordpress/data");
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
function AuthorView({
|
|
29
|
+
item
|
|
30
|
+
}) {
|
|
31
|
+
const {
|
|
32
|
+
text,
|
|
33
|
+
imageUrl
|
|
34
|
+
} = (0, _data.useSelect)(select => {
|
|
35
|
+
const {
|
|
36
|
+
getEntityRecord
|
|
37
|
+
} = select(_coreData.store);
|
|
38
|
+
let user;
|
|
39
|
+
if (!!item.author) {
|
|
40
|
+
user = getEntityRecord('root', 'user', item.author);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
imageUrl: user?.avatar_urls?.[48],
|
|
44
|
+
text: user?.name
|
|
45
|
+
};
|
|
46
|
+
}, [item]);
|
|
47
|
+
const [isImageLoaded, setIsImageLoaded] = (0, _element.useState)(false);
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
49
|
+
alignment: "left",
|
|
50
|
+
spacing: 0,
|
|
51
|
+
children: [!!imageUrl && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
52
|
+
className: (0, _clsx.default)('page-templates-author-field__avatar', {
|
|
53
|
+
'is-loaded': isImageLoaded
|
|
54
|
+
}),
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
56
|
+
onLoad: () => setIsImageLoaded(true),
|
|
57
|
+
alt: (0, _i18n.__)('Author avatar'),
|
|
58
|
+
src: imageUrl
|
|
59
|
+
})
|
|
60
|
+
}), !imageUrl && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
|
+
className: "page-templates-author-field__icon",
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
63
|
+
icon: _icons.commentAuthorAvatar
|
|
64
|
+
})
|
|
65
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
66
|
+
className: "page-templates-author-field__name",
|
|
67
|
+
children: text
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
var _default = exports.default = AuthorView;
|
|
72
|
+
//# sourceMappingURL=author-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_icons","_components","_data","_coreData","_jsxRuntime","AuthorView","item","text","imageUrl","useSelect","select","getEntityRecord","coreStore","user","author","avatar_urls","name","isImageLoaded","setIsImageLoaded","useState","jsxs","__experimentalHStack","alignment","spacing","children","jsx","className","clsx","onLoad","alt","__","src","Icon","icon","authorIcon","_default","exports","default"],"sources":["@wordpress/fields/src/fields/author/author-view.tsx"],"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';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { User } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedAuthor } from '../../types';\n\nfunction AuthorView( { item }: { item: BasePostWithEmbeddedAuthor } ) {\n\tconst { text, imageUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tlet user: User | undefined;\n\t\t\tif ( !! item.author ) {\n\t\t\t\tuser = getEntityRecord( 'root', 'user', item.author );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\ttext: user?.name,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default AuthorView;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAA0D,IAAAO,WAAA,GAAAP,OAAA;AAb1D;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASQ,UAAUA,CAAE;EAAEC;AAA2C,CAAC,EAAG;EACrE,MAAM;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACjCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IAC/C,IAAIC,IAAsB;IAC1B,IAAK,CAAC,CAAEP,IAAI,CAACQ,MAAM,EAAG;MACrBD,IAAI,GAAGF,eAAe,CAAE,MAAM,EAAE,MAAM,EAAEL,IAAI,CAACQ,MAAO,CAAC;IACtD;IACA,OAAO;MACNN,QAAQ,EAAEK,IAAI,EAAEE,WAAW,GAAI,EAAE,CAAE;MACnCR,IAAI,EAAEM,IAAI,EAAEG;IACb,CAAC;EACF,CAAC,EACD,CAAEV,IAAI,CACP,CAAC;EACD,MAAM,CAAEW,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAC7D,oBACC,IAAAf,WAAA,CAAAgB,IAAA,EAACnB,WAAA,CAAAoB,oBAAM;IAACC,SAAS,EAAC,MAAM;IAACC,OAAO,EAAG,CAAG;IAAAC,QAAA,GACnC,CAAC,CAAEhB,QAAQ,iBACZ,IAAAJ,WAAA,CAAAqB,GAAA;MACCC,SAAS,EAAG,IAAAC,aAAI,EAAE,qCAAqC,EAAE;QACxD,WAAW,EAAEV;MACd,CAAE,CAAG;MAAAO,QAAA,eAEL,IAAApB,WAAA,CAAAqB,GAAA;QACCG,MAAM,EAAGA,CAAA,KAAMV,gBAAgB,CAAE,IAAK,CAAG;QACzCW,GAAG,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;QAC7BC,GAAG,EAAGvB;MAAU,CAChB;IAAC,CACE,CACL,EACC,CAAEA,QAAQ,iBACX,IAAAJ,WAAA,CAAAqB,GAAA;MAAKC,SAAS,EAAC,mCAAmC;MAAAF,QAAA,eACjD,IAAApB,WAAA,CAAAqB,GAAA,EAACxB,WAAA,CAAA+B,IAAI;QAACC,IAAI,EAAGC;MAAY,CAAE;IAAC,CACxB,CACL,eACD,IAAA9B,WAAA,CAAAqB,GAAA;MAAMC,SAAS,EAAC,mCAAmC;MAAAF,QAAA,EAAGjB;IAAI,CAAQ,CAAC;EAAA,CAC5D,CAAC;AAEX;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchC,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _authorView = _interopRequireDefault(require("./author-view"));
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const authorField = {
|
|
19
|
+
label: (0, _i18n.__)('Author'),
|
|
20
|
+
id: 'author',
|
|
21
|
+
type: 'integer',
|
|
22
|
+
elements: [],
|
|
23
|
+
render: _authorView.default,
|
|
24
|
+
sort: (a, b, direction) => {
|
|
25
|
+
const nameA = a._embedded?.author?.[0]?.name || '';
|
|
26
|
+
const nameB = b._embedded?.author?.[0]?.name || '';
|
|
27
|
+
return direction === 'asc' ? nameA.localeCompare(nameB) : nameB.localeCompare(nameA);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Author field for BasePost.
|
|
33
|
+
*/
|
|
34
|
+
var _default = exports.default = authorField;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_authorView","_interopRequireDefault","authorField","label","__","id","type","elements","render","AuthorView","sort","a","b","direction","nameA","_embedded","author","name","nameB","localeCompare","_default","exports","default"],"sources":["@wordpress/fields/src/fields/author/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 { BasePostWithEmbeddedAuthor } from '../../types';\nimport AuthorView from './author-view';\n\nconst authorField: Field< BasePostWithEmbeddedAuthor > = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\ttype: 'integer',\n\telements: [],\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\n/**\n * Author field for BasePost.\n */\nexport default authorField;\n"],"mappings":";;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMG,WAAgD,GAAG;EACxDC,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EACrBC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,SAAS;EACfC,QAAQ,EAAE,EAAE;EACZC,MAAM,EAAEC,mBAAU;EAClBC,IAAI,EAAEA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,KAAM;IAC5B,MAAMC,KAAK,GAAGH,CAAC,CAACI,SAAS,EAAEC,MAAM,GAAI,CAAC,CAAE,EAAEC,IAAI,IAAI,EAAE;IACpD,MAAMC,KAAK,GAAGN,CAAC,CAACG,SAAS,EAAEC,MAAM,GAAI,CAAC,CAAE,EAAEC,IAAI,IAAI,EAAE;IAEpD,OAAOJ,SAAS,KAAK,KAAK,GACvBC,KAAK,CAACK,aAAa,CAAED,KAAM,CAAC,GAC5BA,KAAK,CAACC,aAAa,CAAEL,KAAM,CAAC;EAChC;AACD,CAAC;;AAED;AACA;AACA;AAFA,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGepB,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const commentStatusField = {
|
|
17
|
+
id: 'comment_status',
|
|
18
|
+
label: (0, _i18n.__)('Discussion'),
|
|
19
|
+
type: 'text',
|
|
20
|
+
Edit: 'radio',
|
|
21
|
+
enableSorting: false,
|
|
22
|
+
filterBy: {
|
|
23
|
+
operators: []
|
|
24
|
+
},
|
|
25
|
+
elements: [{
|
|
26
|
+
value: 'open',
|
|
27
|
+
label: (0, _i18n.__)('Open'),
|
|
28
|
+
description: (0, _i18n.__)('Visitors can add new comments and replies.')
|
|
29
|
+
}, {
|
|
30
|
+
value: 'closed',
|
|
31
|
+
label: (0, _i18n.__)('Closed'),
|
|
32
|
+
description: (0, _i18n.__)('Visitors cannot add new comments or replies. Existing comments remain visible.')
|
|
33
|
+
}]
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Comment status field for BasePost.
|
|
38
|
+
*/
|
|
39
|
+
var _default = exports.default = commentStatusField;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","commentStatusField","id","label","__","type","Edit","enableSorting","filterBy","operators","elements","value","description","_default","exports","default"],"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: {\n\t\toperators: [],\n\t},\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":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMC,kBAAqC,GAAG;EAC7CC,EAAE,EAAE,gBAAgB;EACpBC,KAAK,EAAE,IAAAC,QAAE,EAAE,YAAa,CAAC;EACzBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,OAAO;EACbC,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAE;IACTC,SAAS,EAAE;EACZ,CAAC;EACDC,QAAQ,EAAE,CACT;IACCC,KAAK,EAAE,MAAM;IACbR,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;IACnBQ,WAAW,EAAE,IAAAR,QAAE,EAAE,4CAA6C;EAC/D,CAAC,EACD;IACCO,KAAK,EAAE,QAAQ;IACfR,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;IACrBQ,WAAW,EAAE,IAAAR,QAAE,EACd,gFACD;EACD,CAAC;AAEH,CAAC;;AAED;AACA;AACA;AAFA,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGed,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _date = require("@wordpress/date");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const getFormattedDate = dateToDisplay => (0, _date.dateI18n)((0, _date.getSettings)().formats.datetimeAbbreviated, (0, _date.getDate)(dateToDisplay));
|
|
20
|
+
const DateView = ({
|
|
21
|
+
item
|
|
22
|
+
}) => {
|
|
23
|
+
var _item$status, _item$modified, _item$date4, _item$date5;
|
|
24
|
+
const isDraftOrPrivate = ['draft', 'private'].includes((_item$status = item.status) !== null && _item$status !== void 0 ? _item$status : '');
|
|
25
|
+
if (isDraftOrPrivate) {
|
|
26
|
+
var _item$date;
|
|
27
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: page creation or modification date. */
|
|
28
|
+
(0, _i18n.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate((_item$date = item.date) !== null && _item$date !== void 0 ? _item$date : null)), {
|
|
29
|
+
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
30
|
+
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const isScheduled = item.status === 'future';
|
|
34
|
+
if (isScheduled) {
|
|
35
|
+
var _item$date2;
|
|
36
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: page creation date */
|
|
37
|
+
(0, _i18n.__)('<span>Scheduled: <time>%s</time></span>'), getFormattedDate((_item$date2 = item.date) !== null && _item$date2 !== void 0 ? _item$date2 : null)), {
|
|
38
|
+
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
39
|
+
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const isPublished = item.status === 'publish';
|
|
43
|
+
if (isPublished) {
|
|
44
|
+
var _item$date3;
|
|
45
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: page creation time */
|
|
46
|
+
(0, _i18n.__)('<span>Published: <time>%s</time></span>'), getFormattedDate((_item$date3 = item.date) !== null && _item$date3 !== void 0 ? _item$date3 : null)), {
|
|
47
|
+
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
48
|
+
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Pending posts show the modified date if it's newer.
|
|
53
|
+
const dateToDisplay = (0, _date.getDate)((_item$modified = item.modified) !== null && _item$modified !== void 0 ? _item$modified : null) > (0, _date.getDate)((_item$date4 = item.date) !== null && _item$date4 !== void 0 ? _item$date4 : null) ? item.modified : item.date;
|
|
54
|
+
const isPending = item.status === 'pending';
|
|
55
|
+
if (isPending) {
|
|
56
|
+
return (0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: page creation or modification date. */
|
|
57
|
+
(0, _i18n.__)('<span>Modified: <time>%s</time></span>'), getFormattedDate(dateToDisplay !== null && dateToDisplay !== void 0 ? dateToDisplay : null)), {
|
|
58
|
+
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}),
|
|
59
|
+
time: /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Unknow status.
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
|
|
65
|
+
children: getFormattedDate((_item$date5 = item.date) !== null && _item$date5 !== void 0 ? _item$date5 : null)
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var _default = exports.default = DateView;
|
|
69
|
+
//# sourceMappingURL=date-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_date","_jsxRuntime","getFormattedDate","dateToDisplay","dateI18n","getSettings","formats","datetimeAbbreviated","getDate","DateView","item","_item$status","_item$modified","_item$date4","_item$date5","isDraftOrPrivate","includes","status","_item$date","createInterpolateElement","sprintf","__","date","span","jsx","time","isScheduled","_item$date2","isPublished","_item$date3","modified","isPending","children","_default","exports","default"],"sources":["@wordpress/fields/src/fields/date/date-view.tsx"],"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"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _dateView = _interopRequireDefault(require("./date-view"));
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const dateField = {
|
|
19
|
+
id: 'date',
|
|
20
|
+
type: 'datetime',
|
|
21
|
+
label: (0, _i18n.__)('Date'),
|
|
22
|
+
render: _dateView.default
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Date field for BasePost.
|
|
27
|
+
*/
|
|
28
|
+
var _default = exports.default = dateField;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_dateView","_interopRequireDefault","dateField","id","type","label","__","render","DateView","_default","exports","default"],"sources":["@wordpress/fields/src/fields/date/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';\nimport DateView from './date-view';\n\nconst dateField: Field< BasePost > = {\n\tid: 'date',\n\ttype: 'datetime',\n\tlabel: __( 'Date' ),\n\trender: DateView,\n};\n\n/**\n * Date field for BasePost.\n */\nexport default dateField;\n"],"mappings":";;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAMG,SAA4B,GAAG;EACpCC,EAAE,EAAE,MAAM;EACVC,IAAI,EAAE,UAAU;EAChBC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;EACnBC,MAAM,EAAEC;AACT,CAAC;;AAED;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGeT,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_element","_mediaUtils","_icons","_coreData","_i18n","_jsxRuntime","FeaturedImageEdit","data","field","onChange","id","value","getValue","item","media","useSelect","select","getEntityRecord","coreStore","onChangeControl","useCallback","newValue","url","source_url","title","rendered","ref","useRef","jsx","className","children","MediaUpload","onSelect","selectedMedia","allowedTypes","render","open","role","tabIndex","onClick","onKeyDown","jsxs","__experimentalGrid","rowGap","columnGap","templateColumns","Fragment","alt","width","height","src","style","__","Button","size","icon","lineSolid","event","stopPropagation","exports"],"sources":["@wordpress/fields/src/fields/featured-image/featured-image-edit.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, __experimentalGrid as Grid } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\n// @ts-ignore\nimport { MediaUpload } from '@wordpress/media-utils';\nimport { lineSolid } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_element","_mediaUtils","_icons","_coreData","_i18n","_jsxRuntime","FeaturedImageEdit","data","field","onChange","id","value","getValue","item","media","useSelect","select","getEntityRecord","coreStore","onChangeControl","useCallback","newValue","url","source_url","title","rendered","ref","useRef","jsx","className","children","MediaUpload","onSelect","selectedMedia","allowedTypes","render","open","role","tabIndex","onClick","onKeyDown","jsxs","__experimentalGrid","rowGap","columnGap","templateColumns","Fragment","alt","width","height","src","style","__","Button","size","icon","lineSolid","event","stopPropagation","exports"],"sources":["@wordpress/fields/src/fields/featured-image/featured-image-edit.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, __experimentalGrid as Grid } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\n// @ts-ignore\nimport { MediaUpload } 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 { BasePost } from '../../types';\n\nexport const FeaturedImageEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePost > ) => {\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( 'root', 'media', 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<MediaUpload\n\t\t\t\t\tonSelect={ ( selectedMedia: { id: number } ) => {\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\trender={ ( { open }: { open: () => void } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t\tonClick={ () => {\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\tonKeyDown={ open }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Grid\n\t\t\t\t\t\t\t\t\trowGap={ 0 }\n\t\t\t\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t\t\t\t\ttemplateColumns=\"24px 1fr 24px\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\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\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t\twidth={ 24 }\n\t\t\t\t\t\t\t\t\t\t\t\theight={ 24 }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\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\t{ title }\n\t\t\t\t\t\t\t\t\t\t\t</span>\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\t{ ! url && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<span\n\t\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\t\tstyle={ {\n\t\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\t\theight: '24px',\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\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\t{ __( 'Choose an image…' ) }\n\t\t\t\t\t\t\t\t\t\t\t</span>\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\t{ url && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\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\t\ticon={ lineSolid }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ (\n\t\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\t) => {\n\t\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\t\tonChangeControl( 0 );\n\t\t\t\t\t\t\t\t\t\t\t\t} }\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</Grid>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_jsxRuntime","FeaturedImageView","item","mediaId","featured_media","media","useSelect","select","getEntityRecord","coreStore","url","source_url","jsx","className","src","alt","exports"],"sources":["@wordpress/fields/src/fields/featured-image/featured-image-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_jsxRuntime","FeaturedImageView","item","mediaId","featured_media","media","useSelect","select","getEntityRecord","coreStore","url","source_url","jsx","className","src","alt","exports"],"sources":["@wordpress/fields/src/fields/featured-image/featured-image-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nexport const FeaturedImageView = ( {\n\titem,\n}: DataViewRenderFieldProps< BasePost > ) => {\n\tconst mediaId = item.featured_media;\n\n\tconst media = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn mediaId ? getEntityRecord( 'root', 'media', mediaId ) : null;\n\t\t},\n\t\t[ mediaId ]\n\t);\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/>\n\t\t);\n\t}\n\n\treturn <span className=\"fields-controls__featured-image-placeholder\" />;\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAA0D,IAAAE,WAAA,GAAAF,OAAA;AAJ1D;AACA;AACA;;AAKA;AACA;AACA;;AAGO,MAAMG,iBAAiB,GAAGA,CAAE;EAClCC;AACqC,CAAC,KAAM;EAC5C,MAAMC,OAAO,GAAGD,IAAI,CAACE,cAAc;EAEnC,MAAMC,KAAK,GAAG,IAAAC,eAAS,EACpBC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IAC/C,OAAON,OAAO,GAAGK,eAAe,CAAE,MAAM,EAAE,OAAO,EAAEL,OAAQ,CAAC,GAAG,IAAI;EACpE,CAAC,EACD,CAAEA,OAAO,CACV,CAAC;EACD,MAAMO,GAAG,GAAGL,KAAK,EAAEM,UAAU;EAE7B,IAAKD,GAAG,EAAG;IACV,oBACC,IAAAV,WAAA,CAAAY,GAAA;MACCC,SAAS,EAAC,uCAAuC;MACjDC,GAAG,EAAGJ,GAAK;MACXK,GAAG,EAAC;IAAE,CACN,CAAC;EAEJ;EAEA,oBAAO,IAAAf,WAAA,CAAAY,GAAA;IAAMC,SAAS,EAAC;EAA6C,CAAE,CAAC;AACxE,CAAC;AAACG,OAAA,CAAAf,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -19,9 +19,6 @@ const featuredImageField = {
|
|
|
19
19
|
id: 'featured_media',
|
|
20
20
|
type: 'text',
|
|
21
21
|
label: (0, _i18n.__)('Featured Image'),
|
|
22
|
-
getValue: ({
|
|
23
|
-
item
|
|
24
|
-
}) => item.featured_media,
|
|
25
22
|
Edit: _featuredImageEdit.FeaturedImageEdit,
|
|
26
23
|
render: _featuredImageView.FeaturedImageView,
|
|
27
24
|
enableSorting: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_featuredImageEdit","_featuredImageView","featuredImageField","id","type","label","__","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_featuredImageEdit","_featuredImageView","featuredImageField","id","type","label","__","Edit","FeaturedImageEdit","render","FeaturedImageView","enableSorting","_default","exports","default"],"sources":["@wordpress/fields/src/fields/featured-image/index.ts"],"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 { FeaturedImageEdit } from './featured-image-edit';\nimport { FeaturedImageView } from './featured-image-view';\n\nconst featuredImageField: Field< BasePost > = {\n\tid: 'featured_media',\n\ttype: 'text',\n\tlabel: __( 'Featured Image' ),\n\tEdit: FeaturedImageEdit,\n\trender: FeaturedImageView,\n\tenableSorting: false,\n};\n\nexport default featuredImageField;\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMG,kBAAqC,GAAG;EAC7CC,EAAE,EAAE,gBAAgB;EACpBC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;EAC7BC,IAAI,EAAEC,oCAAiB;EACvBC,MAAM,EAAEC,oCAAiB;EACzBC,aAAa,EAAE;AAChB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,kBAAkB","ignoreList":[]}
|
package/build/fields/index.js
CHANGED
|
@@ -4,6 +4,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "authorField", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _author.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "commentStatusField", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _commentStatus.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "dateField", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _date.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
7
25
|
Object.defineProperty(exports, "featuredImageField", {
|
|
8
26
|
enumerable: true,
|
|
9
27
|
get: function () {
|
|
@@ -22,12 +40,24 @@ Object.defineProperty(exports, "parentField", {
|
|
|
22
40
|
return _parent.default;
|
|
23
41
|
}
|
|
24
42
|
});
|
|
43
|
+
Object.defineProperty(exports, "passwordField", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _password.default;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
25
49
|
Object.defineProperty(exports, "slugField", {
|
|
26
50
|
enumerable: true,
|
|
27
51
|
get: function () {
|
|
28
52
|
return _slug.default;
|
|
29
53
|
}
|
|
30
54
|
});
|
|
55
|
+
Object.defineProperty(exports, "statusField", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _status.default;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
31
61
|
Object.defineProperty(exports, "titleField", {
|
|
32
62
|
enumerable: true,
|
|
33
63
|
get: function () {
|
|
@@ -39,4 +69,9 @@ var _title = _interopRequireDefault(require("./title"));
|
|
|
39
69
|
var _order = _interopRequireDefault(require("./order"));
|
|
40
70
|
var _featuredImage = _interopRequireDefault(require("./featured-image"));
|
|
41
71
|
var _parent = _interopRequireDefault(require("./parent"));
|
|
72
|
+
var _password = _interopRequireDefault(require("./password"));
|
|
73
|
+
var _status = _interopRequireDefault(require("./status"));
|
|
74
|
+
var _commentStatus = _interopRequireDefault(require("./comment-status"));
|
|
75
|
+
var _date = _interopRequireDefault(require("./date"));
|
|
76
|
+
var _author = _interopRequireDefault(require("./author"));
|
|
42
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_slug","_interopRequireDefault","require","_title","_order","_featuredImage","_parent"],"sources":["@wordpress/fields/src/fields/index.ts"],"sourcesContent":["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\nexport { default as parentField } from './parent';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_slug","_interopRequireDefault","require","_title","_order","_featuredImage","_parent","_password","_status","_commentStatus","_date","_author"],"sources":["@wordpress/fields/src/fields/index.ts"],"sourcesContent":["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,cAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,KAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","orderField","
|
|
1
|
+
{"version":3,"names":["_i18n","require","orderField","id","type","label","__","description","_default","exports","default"],"sources":["@wordpress/fields/src/fields/order/index.ts"],"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};\n\nexport default orderField;\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,MAAMC,UAA6B,GAAG;EACrCC,EAAE,EAAE,YAAY;EAChBC,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBC,WAAW,EAAE,IAAAD,QAAE,EAAE,gCAAiC;AACnD,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaR,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_parentEdit","_parentView","parentField","id","type","label","__","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_parentEdit","_parentView","parentField","id","type","label","__","Edit","ParentEdit","render","ParentView","enableSorting","_default","exports","default"],"sources":["@wordpress/fields/src/fields/parent/index.ts"],"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};\n\n/**\n * This field is used to display the post parent.\n */\nexport default parentField;\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMG,WAA8B,GAAG;EACtCC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,IAAAC,QAAE,EAAE,QAAS,CAAC;EACrBC,IAAI,EAAEC,sBAAU;EAChBC,MAAM,EAAEC,sBAAU;EAClBC,aAAa,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AAFA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAGeZ,WAAW","ignoreList":[]}
|
|
@@ -6,27 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.PageAttributesParent = PageAttributesParent;
|
|
8
8
|
exports.getItemPriority = exports.ParentEdit = void 0;
|
|
9
|
+
var _removeAccents = _interopRequireDefault(require("remove-accents"));
|
|
9
10
|
var _components = require("@wordpress/components");
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
var _element = require("@wordpress/element");
|
|
12
13
|
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _removeAccents = _interopRequireDefault(require("remove-accents"));
|
|
14
14
|
var _compose = require("@wordpress/compose");
|
|
15
15
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
16
16
|
var _i18n = require("@wordpress/i18n");
|
|
17
|
-
var _utils = require("./utils");
|
|
18
17
|
var _url = require("@wordpress/url");
|
|
18
|
+
var _utils = require("./utils");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* External dependencies
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
25
|
+
* WordPress dependencies
|
|
28
26
|
*/
|
|
29
27
|
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|