@wordpress/fields 0.2.0 → 0.4.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 (202) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +28 -0
  3. package/build/actions/delete-post.js +4 -4
  4. package/build/actions/delete-post.js.map +1 -1
  5. package/build/actions/duplicate-post.js +2 -2
  6. package/build/actions/duplicate-post.js.map +1 -1
  7. package/build/actions/utils.js +2 -2
  8. package/build/actions/utils.js.map +1 -1
  9. package/build/actions/view-post-revisions.js +1 -1
  10. package/build/actions/view-post-revisions.js.map +1 -1
  11. package/build/fields/comment-status/index.js +40 -0
  12. package/build/fields/comment-status/index.js.map +1 -0
  13. package/build/fields/date/date-view.js +69 -0
  14. package/build/fields/date/date-view.js.map +1 -0
  15. package/build/fields/date/index.js +29 -0
  16. package/build/fields/date/index.js.map +1 -0
  17. package/build/fields/featured-image/featured-image-edit.js +113 -0
  18. package/build/fields/featured-image/featured-image-edit.js.map +1 -0
  19. package/build/fields/featured-image/featured-image-view.js +41 -0
  20. package/build/fields/featured-image/featured-image-view.js.map +1 -0
  21. package/build/fields/featured-image/index.js +27 -0
  22. package/build/fields/featured-image/index.js.map +1 -0
  23. package/build/fields/index.js +49 -0
  24. package/build/fields/index.js.map +1 -1
  25. package/build/fields/order/index.js +1 -1
  26. package/build/fields/order/index.js.map +1 -1
  27. package/build/fields/parent/index.js +31 -0
  28. package/build/fields/parent/index.js.map +1 -0
  29. package/build/fields/parent/parent-edit.js +243 -0
  30. package/build/fields/parent/parent-edit.js.map +1 -0
  31. package/build/fields/parent/parent-view.js +39 -0
  32. package/build/fields/parent/parent-view.js.map +1 -0
  33. package/build/fields/parent/utils.js +20 -0
  34. package/build/fields/parent/utils.js.map +1 -0
  35. package/build/fields/password/edit.js +65 -0
  36. package/build/fields/password/edit.js.map +1 -0
  37. package/build/fields/password/index.js +30 -0
  38. package/build/fields/password/index.js.map +1 -0
  39. package/build/fields/slug/index.js +27 -0
  40. package/build/fields/slug/index.js.map +1 -0
  41. package/build/fields/slug/slug-edit.js +129 -0
  42. package/build/fields/slug/slug-edit.js.map +1 -0
  43. package/build/fields/slug/slug-view.js +31 -0
  44. package/build/fields/slug/slug-view.js.map +1 -0
  45. package/build/fields/slug/utils.js +21 -0
  46. package/build/fields/slug/utils.js.map +1 -0
  47. package/build/fields/status/index.js +37 -0
  48. package/build/fields/status/index.js.map +1 -0
  49. package/build/fields/status/status-elements.js +46 -0
  50. package/build/fields/status/status-elements.js.map +1 -0
  51. package/build/fields/status/status-view.js +41 -0
  52. package/build/fields/status/status-view.js.map +1 -0
  53. package/build/fields/title/index.js +5 -1
  54. package/build/fields/title/index.js.map +1 -1
  55. package/build/fields/title/title-view.js +61 -0
  56. package/build/fields/title/title-view.js.map +1 -0
  57. package/build/mutation/index.js +2 -2
  58. package/build/mutation/index.js.map +1 -1
  59. package/build/types.js.map +1 -1
  60. package/build-module/actions/delete-post.js +5 -5
  61. package/build-module/actions/delete-post.js.map +1 -1
  62. package/build-module/actions/duplicate-post.js +2 -2
  63. package/build-module/actions/duplicate-post.js.map +1 -1
  64. package/build-module/actions/utils.js +2 -2
  65. package/build-module/actions/utils.js.map +1 -1
  66. package/build-module/actions/view-post-revisions.js +1 -1
  67. package/build-module/actions/view-post-revisions.js.map +1 -1
  68. package/build-module/fields/comment-status/index.js +35 -0
  69. package/build-module/fields/comment-status/index.js.map +1 -0
  70. package/build-module/fields/date/date-view.js +62 -0
  71. package/build-module/fields/date/date-view.js.map +1 -0
  72. package/build-module/fields/date/index.js +23 -0
  73. package/build-module/fields/date/index.js.map +1 -0
  74. package/build-module/fields/featured-image/featured-image-edit.js +104 -0
  75. package/build-module/fields/featured-image/featured-image-edit.js.map +1 -0
  76. package/build-module/fields/featured-image/featured-image-view.js +33 -0
  77. package/build-module/fields/featured-image/featured-image-view.js.map +1 -0
  78. package/build-module/fields/featured-image/index.js +22 -0
  79. package/build-module/fields/featured-image/index.js.map +1 -0
  80. package/build-module/fields/index.js +7 -0
  81. package/build-module/fields/index.js.map +1 -1
  82. package/build-module/fields/order/index.js +2 -1
  83. package/build-module/fields/order/index.js.map +1 -1
  84. package/build-module/fields/parent/index.js +26 -0
  85. package/build-module/fields/parent/index.js.map +1 -0
  86. package/build-module/fields/parent/parent-edit.js +232 -0
  87. package/build-module/fields/parent/parent-edit.js.map +1 -0
  88. package/build-module/fields/parent/parent-view.js +32 -0
  89. package/build-module/fields/parent/parent-view.js.map +1 -0
  90. package/build-module/fields/parent/utils.js +14 -0
  91. package/build-module/fields/parent/utils.js.map +1 -0
  92. package/build-module/fields/password/edit.js +58 -0
  93. package/build-module/fields/password/edit.js.map +1 -0
  94. package/build-module/fields/password/index.js +23 -0
  95. package/build-module/fields/password/index.js.map +1 -0
  96. package/build-module/fields/slug/index.js +21 -0
  97. package/build-module/fields/slug/index.js.map +1 -0
  98. package/build-module/fields/slug/slug-edit.js +123 -0
  99. package/build-module/fields/slug/slug-edit.js.map +1 -0
  100. package/build-module/fields/slug/slug-view.js +25 -0
  101. package/build-module/fields/slug/slug-view.js.map +1 -0
  102. package/build-module/fields/slug/utils.js +13 -0
  103. package/build-module/fields/slug/utils.js.map +1 -0
  104. package/build-module/fields/status/index.js +31 -0
  105. package/build-module/fields/status/index.js.map +1 -0
  106. package/build-module/fields/status/status-elements.js +40 -0
  107. package/build-module/fields/status/status-elements.js.map +1 -0
  108. package/build-module/fields/status/status-view.js +34 -0
  109. package/build-module/fields/status/status-view.js.map +1 -0
  110. package/build-module/fields/title/index.js +4 -1
  111. package/build-module/fields/title/index.js.map +1 -1
  112. package/build-module/fields/title/title-view.js +55 -0
  113. package/build-module/fields/title/title-view.js.map +1 -0
  114. package/build-module/mutation/index.js +2 -2
  115. package/build-module/mutation/index.js.map +1 -1
  116. package/build-module/types.js.map +1 -1
  117. package/build-style/style-rtl.css +213 -0
  118. package/build-style/style.css +213 -0
  119. package/build-types/actions/delete-post.d.ts.map +1 -1
  120. package/build-types/fields/comment-status/index.d.ts +14 -0
  121. package/build-types/fields/comment-status/index.d.ts.map +1 -0
  122. package/build-types/fields/date/date-view.d.ts +9 -0
  123. package/build-types/fields/date/date-view.d.ts.map +1 -0
  124. package/build-types/fields/date/index.d.ts +14 -0
  125. package/build-types/fields/date/index.d.ts.map +1 -0
  126. package/build-types/fields/featured-image/featured-image-edit.d.ts +7 -0
  127. package/build-types/fields/featured-image/featured-image-edit.d.ts.map +1 -0
  128. package/build-types/fields/featured-image/featured-image-view.d.ts +7 -0
  129. package/build-types/fields/featured-image/featured-image-view.d.ts.map +1 -0
  130. package/build-types/fields/featured-image/index.d.ts +11 -0
  131. package/build-types/fields/featured-image/index.d.ts.map +1 -0
  132. package/build-types/fields/index.d.ts +7 -0
  133. package/build-types/fields/index.d.ts.map +1 -1
  134. package/build-types/fields/order/index.d.ts.map +1 -1
  135. package/build-types/fields/parent/index.d.ts +14 -0
  136. package/build-types/fields/parent/index.d.ts.map +1 -0
  137. package/build-types/fields/parent/parent-edit.d.ts +12 -0
  138. package/build-types/fields/parent/parent-edit.d.ts.map +1 -0
  139. package/build-types/fields/parent/parent-view.d.ts +7 -0
  140. package/build-types/fields/parent/parent-view.d.ts.map +1 -0
  141. package/build-types/fields/parent/utils.d.ts +6 -0
  142. package/build-types/fields/parent/utils.d.ts.map +1 -0
  143. package/build-types/fields/password/edit.d.ts +8 -0
  144. package/build-types/fields/password/edit.d.ts.map +1 -0
  145. package/build-types/fields/password/index.d.ts +14 -0
  146. package/build-types/fields/password/index.d.ts.map +1 -0
  147. package/build-types/fields/slug/index.d.ts +11 -0
  148. package/build-types/fields/slug/index.d.ts.map +1 -0
  149. package/build-types/fields/slug/slug-edit.d.ts +8 -0
  150. package/build-types/fields/slug/slug-edit.d.ts.map +1 -0
  151. package/build-types/fields/slug/slug-view.d.ts +9 -0
  152. package/build-types/fields/slug/slug-view.d.ts.map +1 -0
  153. package/build-types/fields/slug/utils.d.ts +6 -0
  154. package/build-types/fields/slug/utils.d.ts.map +1 -0
  155. package/build-types/fields/status/index.d.ts +14 -0
  156. package/build-types/fields/status/index.d.ts.map +1 -0
  157. package/build-types/fields/status/status-elements.d.ts +13 -0
  158. package/build-types/fields/status/status-elements.d.ts.map +1 -0
  159. package/build-types/fields/status/status-view.d.ts +9 -0
  160. package/build-types/fields/status/status-view.d.ts.map +1 -0
  161. package/build-types/fields/title/index.d.ts.map +1 -1
  162. package/build-types/fields/title/title-view.d.ts +9 -0
  163. package/build-types/fields/title/title-view.d.ts.map +1 -0
  164. package/build-types/lock-unlock.d.ts +1 -1
  165. package/build-types/lock-unlock.d.ts.map +1 -1
  166. package/build-types/types.d.ts +5 -1
  167. package/build-types/types.d.ts.map +1 -1
  168. package/package.json +27 -22
  169. package/src/actions/delete-post.tsx +8 -5
  170. package/src/actions/duplicate-post.tsx +2 -2
  171. package/src/actions/utils.ts +2 -2
  172. package/src/actions/view-post-revisions.tsx +1 -1
  173. package/src/fields/comment-status/index.tsx +40 -0
  174. package/src/fields/date/date-view.tsx +92 -0
  175. package/src/fields/date/index.tsx +23 -0
  176. package/src/fields/featured-image/featured-image-edit.tsx +123 -0
  177. package/src/fields/featured-image/featured-image-view.tsx +38 -0
  178. package/src/fields/featured-image/index.ts +23 -0
  179. package/src/fields/featured-image/style.scss +95 -0
  180. package/src/fields/index.ts +7 -0
  181. package/src/fields/order/index.ts +2 -1
  182. package/src/fields/parent/index.ts +26 -0
  183. package/src/fields/parent/parent-edit.tsx +348 -0
  184. package/src/fields/parent/parent-view.tsx +33 -0
  185. package/src/fields/parent/utils.ts +18 -0
  186. package/src/fields/password/edit.tsx +68 -0
  187. package/src/fields/password/index.tsx +24 -0
  188. package/src/fields/slug/index.ts +22 -0
  189. package/src/fields/slug/slug-edit.tsx +153 -0
  190. package/src/fields/slug/slug-view.tsx +27 -0
  191. package/src/fields/slug/style.scss +22 -0
  192. package/src/fields/slug/utils.ts +15 -0
  193. package/src/fields/status/index.tsx +32 -0
  194. package/src/fields/status/status-elements.tsx +50 -0
  195. package/src/fields/status/status-view.tsx +28 -0
  196. package/src/fields/title/index.ts +3 -0
  197. package/src/fields/title/title-view.tsx +62 -0
  198. package/src/mutation/index.ts +3 -3
  199. package/src/style.scss +2 -0
  200. package/src/types.ts +5 -1
  201. package/tsconfig.json +10 -7
  202. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,25 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect, useRef } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import { getSlug } from './utils';
11
+ const SlugView = ({
12
+ item
13
+ }) => {
14
+ const slug = typeof item === 'object' ? getSlug(item) : '';
15
+ const originalSlugRef = useRef(slug);
16
+ useEffect(() => {
17
+ if (slug && originalSlugRef.current === undefined) {
18
+ originalSlugRef.current = slug;
19
+ }
20
+ }, [slug]);
21
+ const slugToDisplay = slug || originalSlugRef.current;
22
+ return `${slugToDisplay}`;
23
+ };
24
+ export default SlugView;
25
+ //# sourceMappingURL=slug-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useRef","getSlug","SlugView","item","slug","originalSlugRef","current","undefined","slugToDisplay"],"sources":["@wordpress/fields/src/fields/slug/slug-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getSlug } from './utils';\n\nconst SlugView = ( { item }: { item: BasePost } ) => {\n\tconst slug = typeof item === 'object' ? getSlug( item ) : '';\n\tconst originalSlugRef = useRef( slug );\n\n\tuseEffect( () => {\n\t\tif ( slug && originalSlugRef.current === undefined ) {\n\t\t\toriginalSlugRef.current = slug;\n\t\t}\n\t}, [ slug ] );\n\n\tconst slugToDisplay = slug || originalSlugRef.current;\n\n\treturn `${ slugToDisplay }`;\n};\n\nexport default SlugView;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;;AAEtD;AACA;AACA;;AAEA,SAASC,OAAO,QAAQ,SAAS;AAEjC,MAAMC,QAAQ,GAAGA,CAAE;EAAEC;AAAyB,CAAC,KAAM;EACpD,MAAMC,IAAI,GAAG,OAAOD,IAAI,KAAK,QAAQ,GAAGF,OAAO,CAAEE,IAAK,CAAC,GAAG,EAAE;EAC5D,MAAME,eAAe,GAAGL,MAAM,CAAEI,IAAK,CAAC;EAEtCL,SAAS,CAAE,MAAM;IAChB,IAAKK,IAAI,IAAIC,eAAe,CAACC,OAAO,KAAKC,SAAS,EAAG;MACpDF,eAAe,CAACC,OAAO,GAAGF,IAAI;IAC/B;EACD,CAAC,EAAE,CAAEA,IAAI,CAAG,CAAC;EAEb,MAAMI,aAAa,GAAGJ,IAAI,IAAIC,eAAe,CAACC,OAAO;EAErD,OAAO,GAAIE,aAAa,EAAG;AAC5B,CAAC;AAED,eAAeN,QAAQ","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { cleanForSlug } from '@wordpress/url';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+
9
+ import { getItemTitle } from '../../actions/utils';
10
+ export const getSlug = item => {
11
+ return item.slug || cleanForSlug(getItemTitle(item)) || item.id.toString();
12
+ };
13
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cleanForSlug","getItemTitle","getSlug","item","slug","id","toString"],"sources":["@wordpress/fields/src/fields/slug/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { cleanForSlug } from '@wordpress/url';\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\n\nexport const getSlug = ( item: BasePost ): string => {\n\treturn (\n\t\titem.slug || cleanForSlug( getItemTitle( item ) ) || item.id.toString()\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C;AACA;AACA;;AAEA,SAASC,YAAY,QAAQ,qBAAqB;AAElD,OAAO,MAAMC,OAAO,GAAKC,IAAc,IAAc;EACpD,OACCA,IAAI,CAACC,IAAI,IAAIJ,YAAY,CAAEC,YAAY,CAAEE,IAAK,CAAE,CAAC,IAAIA,IAAI,CAACE,EAAE,CAACC,QAAQ,CAAC,CAAC;AAEzE,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
11
+ import StatusView from './status-view';
12
+ import STATUSES from './status-elements';
13
+ const OPERATOR_IS_ANY = 'isAny';
14
+ const statusField = {
15
+ label: __('Status'),
16
+ id: 'status',
17
+ type: 'text',
18
+ elements: STATUSES,
19
+ render: StatusView,
20
+ Edit: 'radio',
21
+ enableSorting: false,
22
+ filterBy: {
23
+ operators: [OPERATOR_IS_ANY]
24
+ }
25
+ };
26
+
27
+ /**
28
+ * Status field for BasePost.
29
+ */
30
+ export default statusField;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","StatusView","STATUSES","OPERATOR_IS_ANY","statusField","label","id","type","elements","render","Edit","enableSorting","filterBy","operators"],"sources":["@wordpress/fields/src/fields/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';\nimport StatusView from './status-view';\nimport STATUSES from './status-elements';\n\nconst OPERATOR_IS_ANY = 'isAny';\n\nconst statusField: Field< BasePost > = {\n\tlabel: __( 'Status' ),\n\tid: 'status',\n\ttype: 'text',\n\telements: STATUSES,\n\trender: StatusView,\n\tEdit: 'radio',\n\tenableSorting: false,\n\tfilterBy: {\n\t\toperators: [ OPERATOR_IS_ANY ],\n\t},\n};\n\n/**\n * Status field for BasePost.\n */\nexport default statusField;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAEA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,QAAQ,MAAM,mBAAmB;AAExC,MAAMC,eAAe,GAAG,OAAO;AAE/B,MAAMC,WAA8B,GAAG;EACtCC,KAAK,EAAEL,EAAE,CAAE,QAAS,CAAC;EACrBM,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAEN,QAAQ;EAClBO,MAAM,EAAER,UAAU;EAClBS,IAAI,EAAE,OAAO;EACbC,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAE;IACTC,SAAS,EAAE,CAAEV,eAAe;EAC7B;AACD,CAAC;;AAED;AACA;AACA;AACA,eAAeC,WAAW","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { trash, drafts, published, scheduled, pending, notAllowed } from '@wordpress/icons';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ // See https://github.com/WordPress/gutenberg/issues/55886
8
+ // We do not support custom statutes at the moment.
9
+ const STATUSES = [{
10
+ value: 'draft',
11
+ label: __('Draft'),
12
+ icon: drafts,
13
+ description: __('Not ready to publish.')
14
+ }, {
15
+ value: 'future',
16
+ label: __('Scheduled'),
17
+ icon: scheduled,
18
+ description: __('Publish automatically on a chosen date.')
19
+ }, {
20
+ value: 'pending',
21
+ label: __('Pending Review'),
22
+ icon: pending,
23
+ description: __('Waiting for review before publishing.')
24
+ }, {
25
+ value: 'private',
26
+ label: __('Private'),
27
+ icon: notAllowed,
28
+ description: __('Only visible to site admins and editors.')
29
+ }, {
30
+ value: 'publish',
31
+ label: __('Published'),
32
+ icon: published,
33
+ description: __('Visible to everyone.')
34
+ }, {
35
+ value: 'trash',
36
+ label: __('Trash'),
37
+ icon: trash
38
+ }];
39
+ export default STATUSES;
40
+ //# sourceMappingURL=status-elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["trash","drafts","published","scheduled","pending","notAllowed","__","STATUSES","value","label","icon","description"],"sources":["@wordpress/fields/src/fields/status/status-elements.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{\n\t\tvalue: 'draft',\n\t\tlabel: __( 'Draft' ),\n\t\ticon: drafts,\n\t\tdescription: __( 'Not ready to publish.' ),\n\t},\n\t{\n\t\tvalue: 'future',\n\t\tlabel: __( 'Scheduled' ),\n\t\ticon: scheduled,\n\t\tdescription: __( 'Publish automatically on a chosen date.' ),\n\t},\n\t{\n\t\tvalue: 'pending',\n\t\tlabel: __( 'Pending Review' ),\n\t\ticon: pending,\n\t\tdescription: __( 'Waiting for review before publishing.' ),\n\t},\n\t{\n\t\tvalue: 'private',\n\t\tlabel: __( 'Private' ),\n\t\ticon: notAllowed,\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tvalue: 'publish',\n\t\tlabel: __( 'Published' ),\n\t\ticon: published,\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\n\nexport default STATUSES;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,UAAU,QACJ,kBAAkB;AACzB,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA,MAAMC,QAAQ,GAAG,CAChB;EACCC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAEH,EAAE,CAAE,OAAQ,CAAC;EACpBI,IAAI,EAAET,MAAM;EACZU,WAAW,EAAEL,EAAE,CAAE,uBAAwB;AAC1C,CAAC,EACD;EACCE,KAAK,EAAE,QAAQ;EACfC,KAAK,EAAEH,EAAE,CAAE,WAAY,CAAC;EACxBI,IAAI,EAAEP,SAAS;EACfQ,WAAW,EAAEL,EAAE,CAAE,yCAA0C;AAC5D,CAAC,EACD;EACCE,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAEH,EAAE,CAAE,gBAAiB,CAAC;EAC7BI,IAAI,EAAEN,OAAO;EACbO,WAAW,EAAEL,EAAE,CAAE,uCAAwC;AAC1D,CAAC,EACD;EACCE,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAEH,EAAE,CAAE,SAAU,CAAC;EACtBI,IAAI,EAAEL,UAAU;EAChBM,WAAW,EAAEL,EAAE,CAAE,0CAA2C;AAC7D,CAAC,EACD;EACCE,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAEH,EAAE,CAAE,WAAY,CAAC;EACxBI,IAAI,EAAER,SAAS;EACfS,WAAW,EAAEL,EAAE,CAAE,sBAAuB;AACzC,CAAC,EACD;EAAEE,KAAK,EAAE,OAAO;EAAEC,KAAK,EAAEH,EAAE,CAAE,OAAQ,CAAC;EAAEI,IAAI,EAAEV;AAAM,CAAC,CACrD;AAED,eAAeO,QAAQ","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalHStack as HStack, Icon } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
10
+ import STATUSES from './status-elements';
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ function StatusView({
13
+ item
14
+ }) {
15
+ const status = STATUSES.find(({
16
+ value
17
+ }) => value === item.status);
18
+ const label = status?.label || item.status;
19
+ const icon = status?.icon;
20
+ return /*#__PURE__*/_jsxs(HStack, {
21
+ alignment: "left",
22
+ spacing: 0,
23
+ children: [icon && /*#__PURE__*/_jsx("div", {
24
+ className: "edit-site-post-list__status-icon",
25
+ children: /*#__PURE__*/_jsx(Icon, {
26
+ icon: icon
27
+ })
28
+ }), /*#__PURE__*/_jsx("span", {
29
+ children: label
30
+ })]
31
+ });
32
+ }
33
+ export default StatusView;
34
+ //# sourceMappingURL=status-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__experimentalHStack","HStack","Icon","STATUSES","jsx","_jsx","jsxs","_jsxs","StatusView","item","status","find","value","label","icon","alignment","spacing","children","className"],"sources":["@wordpress/fields/src/fields/status/status-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport STATUSES from './status-elements';\n\nfunction StatusView( { item }: { item: BasePost } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"edit-site-post-list__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default StatusView;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,oBAAoB,IAAIC,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;;AAE5E;AACA;AACA;;AAEA,OAAOC,QAAQ,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,SAASC,UAAUA,CAAE;EAAEC;AAAyB,CAAC,EAAG;EACnD,MAAMC,MAAM,GAAGP,QAAQ,CAACQ,IAAI,CAAE,CAAE;IAAEC;EAAM,CAAC,KAAMA,KAAK,KAAKH,IAAI,CAACC,MAAO,CAAC;EACtE,MAAMG,KAAK,GAAGH,MAAM,EAAEG,KAAK,IAAIJ,IAAI,CAACC,MAAM;EAC1C,MAAMI,IAAI,GAAGJ,MAAM,EAAEI,IAAI;EACzB,oBACCP,KAAA,CAACN,MAAM;IAACc,SAAS,EAAC,MAAM;IAACC,OAAO,EAAG,CAAG;IAAAC,QAAA,GACnCH,IAAI,iBACLT,IAAA;MAAKa,SAAS,EAAC,kCAAkC;MAAAD,QAAA,eAChDZ,IAAA,CAACH,IAAI;QAACY,IAAI,EAAGA;MAAM,CAAE;IAAC,CAClB,CACL,eACDT,IAAA;MAAAY,QAAA,EAAQJ;IAAK,CAAQ,CAAC;EAAA,CACf,CAAC;AAEX;AAEA,eAAeL,UAAU","ignoreList":[]}
@@ -9,6 +9,7 @@ import { __ } from '@wordpress/i18n';
9
9
  */
10
10
 
11
11
  import { getItemTitle } from '../../actions/utils';
12
+ import TitleView from './title-view';
12
13
  const titleField = {
13
14
  type: 'text',
14
15
  id: 'title',
@@ -16,7 +17,9 @@ const titleField = {
16
17
  placeholder: __('No title'),
17
18
  getValue: ({
18
19
  item
19
- }) => getItemTitle(item)
20
+ }) => getItemTitle(item),
21
+ render: TitleView,
22
+ enableHiding: false
20
23
  };
21
24
  export default titleField;
22
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","getItemTitle","titleField","type","id","label","placeholder","getValue","item"],"sources":["@wordpress/fields/src/fields/title/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 { getItemTitle } from '../../actions/utils';\n\nconst titleField: Field< BasePost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n};\n\nexport default titleField;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAEA,SAASC,YAAY,QAAQ,qBAAqB;AAElD,MAAMC,UAA6B,GAAG;EACrCC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,OAAO;EACXC,KAAK,EAAEL,EAAE,CAAE,OAAQ,CAAC;EACpBM,WAAW,EAAEN,EAAE,CAAE,UAAW,CAAC;EAC7BO,QAAQ,EAAEA,CAAE;IAAEC;EAAK,CAAC,KAAMP,YAAY,CAAEO,IAAK;AAC9C,CAAC;AAED,eAAeN,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["__","getItemTitle","TitleView","titleField","type","id","label","placeholder","getValue","item","render","enableHiding"],"sources":["@wordpress/fields/src/fields/title/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 { getItemTitle } from '../../actions/utils';\nimport TitleView from './title-view';\n\nconst titleField: Field< BasePost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: TitleView,\n\tenableHiding: false,\n};\n\nexport default titleField;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAEA,SAASC,YAAY,QAAQ,qBAAqB;AAClD,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,UAA6B,GAAG;EACrCC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,OAAO;EACXC,KAAK,EAAEN,EAAE,CAAE,OAAQ,CAAC;EACpBO,WAAW,EAAEP,EAAE,CAAE,UAAW,CAAC;EAC7BQ,QAAQ,EAAEA,CAAE;IAAEC;EAAK,CAAC,KAAMR,YAAY,CAAEQ,IAAK,CAAC;EAC9CC,MAAM,EAAER,SAAS;EACjBS,YAAY,EAAE;AACf,CAAC;AAED,eAAeR,UAAU","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalHStack as HStack } from '@wordpress/components';
5
+ import { decodeEntities } from '@wordpress/html-entities';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { useSelect } from '@wordpress/data';
8
+ import { store as coreStore } from '@wordpress/core-data';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { getItemTitle } from '../../actions/utils';
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const TitleView = ({
17
+ item
18
+ }) => {
19
+ const {
20
+ frontPageId,
21
+ postsPageId
22
+ } = useSelect(select => {
23
+ const {
24
+ getEntityRecord
25
+ } = select(coreStore);
26
+ const siteSettings = getEntityRecord('root', 'site', '');
27
+ return {
28
+ frontPageId: siteSettings?.page_on_front,
29
+ postsPageId: siteSettings?.page_for_posts
30
+ };
31
+ }, []);
32
+ const renderedTitle = getItemTitle(item);
33
+ let suffix;
34
+ if (item.id === frontPageId) {
35
+ suffix = /*#__PURE__*/_jsx("span", {
36
+ className: "edit-site-post-list__title-badge",
37
+ children: __('Homepage')
38
+ });
39
+ } else if (item.id === postsPageId) {
40
+ suffix = /*#__PURE__*/_jsx("span", {
41
+ className: "edit-site-post-list__title-badge",
42
+ children: __('Posts Page')
43
+ });
44
+ }
45
+ return /*#__PURE__*/_jsxs(HStack, {
46
+ className: "edit-site-post-list__title",
47
+ alignment: "center",
48
+ justify: "flex-start",
49
+ children: [/*#__PURE__*/_jsx("span", {
50
+ children: decodeEntities(renderedTitle) || __('(no title)')
51
+ }), suffix]
52
+ });
53
+ };
54
+ export default TitleView;
55
+ //# sourceMappingURL=title-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__experimentalHStack","HStack","decodeEntities","__","useSelect","store","coreStore","getItemTitle","jsx","_jsx","jsxs","_jsxs","TitleView","item","frontPageId","postsPageId","select","getEntityRecord","siteSettings","page_on_front","page_for_posts","renderedTitle","suffix","id","className","children","alignment","justify"],"sources":["@wordpress/fields/src/fields/title/title-view.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Settings } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\n\nconst TitleView = ( { item }: { item: BasePost } ) => {\n\tconst { frontPageId, postsPageId } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings: Settings | undefined = getEntityRecord(\n\t\t\t'root',\n\t\t\t'site',\n\t\t\t''\n\t\t);\n\t\treturn {\n\t\t\tfrontPageId: siteSettings?.page_on_front,\n\t\t\tpostsPageId: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst renderedTitle = getItemTitle( item );\n\n\tlet suffix;\n\tif ( item.id === frontPageId ) {\n\t\tsuffix = (\n\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t</span>\n\t\t);\n\t} else if ( item.id === postsPageId ) {\n\t\tsuffix = (\n\t\t\t<span className=\"edit-site-post-list__title-badge\">\n\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<HStack\n\t\t\tclassName=\"edit-site-post-list__title\"\n\t\t\talignment=\"center\"\n\t\t\tjustify=\"flex-start\"\n\t\t>\n\t\t\t<span>\n\t\t\t\t{ decodeEntities( renderedTitle ) || __( '(no title)' ) }\n\t\t\t</span>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n};\n\nexport default TitleView;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAA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CACD,CAAC;AAEX,CAAC;AAED,eAAeV,SAAS","ignoreList":[]}
@@ -10,7 +10,7 @@ import { dispatch } from '@wordpress/data';
10
10
  * Internal dependencies
11
11
  */
12
12
 
13
- const getErrorMessagesFromPromises = allSettledResults => {
13
+ function getErrorMessagesFromPromises(allSettledResults) {
14
14
  const errorMessages = new Set();
15
15
  // If there was at lease one failure.
16
16
  if (allSettledResults.length === 1) {
@@ -30,7 +30,7 @@ const getErrorMessagesFromPromises = allSettledResults => {
30
30
  }
31
31
  }
32
32
  return errorMessages;
33
- };
33
+ }
34
34
  export const deletePostWithNotices = async (posts, notice, callbacks) => {
35
35
  const {
36
36
  createSuccessNotice,
@@ -1 +1 @@
1
- {"version":3,"names":["store","noticesStore","coreStore","dispatch","getErrorMessagesFromPromises","allSettledResults","errorMessages","Set","length","typedError","reason","message","add","failedPromises","filter","status","failedPromise","deletePostWithNotices","posts","notice","callbacks","createSuccessNotice","createErrorNotice","deleteEntityRecord","Promise","allSettled","map","post","type","id","force","throwOnError","every","_notice$success$type","successMessage","success","messages","getMessage","getBatchMessage","onActionPerformed","_notice$error$type","errorMessage","error","onActionError","editPostWithNotices","postsWithUpdates","editEntityRecord","saveEditedEntityRecord","originalPost","changes","_notice$success$type2","_notice$error$type2"],"sources":["@wordpress/fields/src/mutation/index.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { CoreDataError, Post } from '../types';\n\nconst getErrorMessagesFromPromises = < T >(\n\tallSettledResults: PromiseSettledResult< T >[]\n) => {\n\tconst errorMessages = new Set< string >();\n\t// If there was at lease one failure.\n\tif ( allSettledResults.length === 1 ) {\n\t\tconst typedError = allSettledResults[ 0 ] as {\n\t\t\treason?: CoreDataError;\n\t\t};\n\t\tif ( typedError.reason?.message ) {\n\t\t\terrorMessages.add( typedError.reason.message );\n\t\t}\n\t} else {\n\t\tconst failedPromises = allSettledResults.filter(\n\t\t\t( { status } ) => status === 'rejected'\n\t\t);\n\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\tconst typedError = failedPromise as {\n\t\t\t\treason?: CoreDataError;\n\t\t\t};\n\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\terrorMessages.add( typedError.reason.message );\n\t\t\t}\n\t\t}\n\t}\n\treturn errorMessages;\n};\n\nexport type NoticeSettings< T extends Post > = {\n\tsuccess: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( posts: T ) => string;\n\t\t\tgetBatchMessage: ( posts: T[] ) => string;\n\t\t};\n\t};\n\terror: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( errors: Set< string > ) => string;\n\t\t\tgetBatchMessage: ( errors: Set< string > ) => string;\n\t\t};\n\t};\n};\n\nexport const deletePostWithNotices = async < T extends Post >(\n\tposts: T[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { deleteEntityRecord } = dispatch( coreStore );\n\tconst allSettledResults = await Promise.allSettled(\n\t\tposts.map( ( post ) => {\n\t\t\treturn deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.type,\n\t\t\t\tpost.id,\n\t\t\t\t{ force: true },\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage( posts[ 0 ] );\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage( posts );\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.( posts );\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n\nexport const editPostWithNotices = async < T extends Post >(\n\tpostsWithUpdates: {\n\t\toriginalPost: T;\n\t\tchanges: Partial< T >;\n\t}[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } = dispatch( coreStore );\n\tawait Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\t...post.changes,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\tconst allSettledResults = await Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage(\n\t\t\t\tpostsWithUpdates[ 0 ].originalPost\n\t\t\t);\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage(\n\t\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t\t);\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.(\n\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t);\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,iBAAiB;;AAE1C;AACA;AACA;;AAGA,MAAMC,4BAA4B,GACjCC,iBAA8C,IAC1C;EACJ,MAAMC,aAAa,GAAG,IAAIC,GAAG,CAAW,CAAC;EACzC;EACA,IAAKF,iBAAiB,CAACG,MAAM,KAAK,CAAC,EAAG;IACrC,MAAMC,UAAU,GAAGJ,iBAAiB,CAAE,CAAC,CAEtC;IACD,IAAKI,UAAU,CAACC,MAAM,EAAEC,OAAO,EAAG;MACjCL,aAAa,CAACM,GAAG,CAAEH,UAAU,CAACC,MAAM,CAACC,OAAQ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B,OAAO,CAACN;IACpB,CAAE,CAAC;IACHT,SAAS,CAACmB,iBAAiB,GAC1BM,gBAAgB,CAACnB,GAAG,CAAIC,IAAI,IAAMA,IAAI,CAACqB,YAAa,CACrD,CAAC;EACF,CAAC,MAAM;IAAA,IAAAG,mBAAA;IACN,MAAM7C,aAAa,GAAGF,4BAA4B,CAAEC,iBAAkB,CAAC;IACvE,IAAIoC,YAAY,GAAG,EAAE;IACrB,IAAKpC,iBAAiB,CAACG,MAAM,KAAK,CAAC,EAAG;MACrCiC,YAAY,GAAGtB,MAAM,CAACuB,KAAK,CAACN,QAAQ,CAACC,UAAU,CAAE/B,aAAc,CAAC;IACjE,CAAC,MAAM;MACNmC,YAAY,GACXtB,MAAM,CAACuB,KAAK,CAACN,QAAQ,CAACE,eAAe,CAAEhC,aAAc,CAAC;IACxD;IAEAgB,iBAAiB,CAAEmB,YAAY,EAAE;MAChCb,IAAI,GAAAuB,mBAAA,GAAEhC,MAAM,CAACuB,KAAK,CAACd,IAAI,cAAAuB,mBAAA,cAAAA,mBAAA,GAAI,UAAU;MACrCtB,EAAE,EAAEV,MAAM,CAACuB,KAAK,CAACb;IAClB,CAAE,CAAC;IACHT,SAAS,CAACuB,aAAa,GAAG,CAAC;EAC5B;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["store","noticesStore","coreStore","dispatch","getErrorMessagesFromPromises","allSettledResults","errorMessages","Set","length","typedError","reason","message","add","failedPromises","filter","status","failedPromise","deletePostWithNotices","posts","notice","callbacks","createSuccessNotice","createErrorNotice","deleteEntityRecord","Promise","allSettled","map","post","type","id","force","throwOnError","every","_notice$success$type","successMessage","success","messages","getMessage","getBatchMessage","onActionPerformed","_notice$error$type","errorMessage","error","onActionError","editPostWithNotices","postsWithUpdates","editEntityRecord","saveEditedEntityRecord","originalPost","changes","_notice$success$type2","_notice$error$type2"],"sources":["@wordpress/fields/src/mutation/index.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { CoreDataError, Post } from '../types';\n\nfunction getErrorMessagesFromPromises< T >(\n\tallSettledResults: PromiseSettledResult< T >[]\n) {\n\tconst errorMessages = new Set< string >();\n\t// If there was at lease one failure.\n\tif ( allSettledResults.length === 1 ) {\n\t\tconst typedError = allSettledResults[ 0 ] as {\n\t\t\treason?: CoreDataError;\n\t\t};\n\t\tif ( typedError.reason?.message ) {\n\t\t\terrorMessages.add( typedError.reason.message );\n\t\t}\n\t} else {\n\t\tconst failedPromises = allSettledResults.filter(\n\t\t\t( { status } ) => status === 'rejected'\n\t\t);\n\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\tconst typedError = failedPromise as {\n\t\t\t\treason?: CoreDataError;\n\t\t\t};\n\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\terrorMessages.add( typedError.reason.message );\n\t\t\t}\n\t\t}\n\t}\n\treturn errorMessages;\n}\n\nexport type NoticeSettings< T extends Post > = {\n\tsuccess: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( posts: T ) => string;\n\t\t\tgetBatchMessage: ( posts: T[] ) => string;\n\t\t};\n\t};\n\terror: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( errors: Set< string > ) => string;\n\t\t\tgetBatchMessage: ( errors: Set< string > ) => string;\n\t\t};\n\t};\n};\n\nexport const deletePostWithNotices = async < T extends Post >(\n\tposts: T[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { deleteEntityRecord } = dispatch( coreStore );\n\tconst allSettledResults = await Promise.allSettled(\n\t\tposts.map( ( post ) => {\n\t\t\treturn deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.type,\n\t\t\t\tpost.id,\n\t\t\t\t{ force: true },\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage( posts[ 0 ] );\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage( posts );\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.( posts );\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n\nexport const editPostWithNotices = async < T extends Post >(\n\tpostsWithUpdates: {\n\t\toriginalPost: T;\n\t\tchanges: Partial< T >;\n\t}[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } = dispatch( coreStore );\n\tawait Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\t...post.changes,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\tconst allSettledResults = await Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage(\n\t\t\t\tpostsWithUpdates[ 0 ].originalPost\n\t\t\t);\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage(\n\t\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t\t);\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.(\n\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t);\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,S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,YACvB,CAAC;IACF,CAAC,MAAM;MACNd,cAAc,GAAGf,MAAM,CAACgB,OAAO,CAACC,QAAQ,CAACE,eAAe,CACvDO,gBAAgB,CAACnB,GAAG,CAAIC,IAAI,IAAMA,IAAI,CAACqB,YAAa,CACrD,CAAC;IACF;IACA3B,mBAAmB,CAAEa,cAAc,EAAE;MACpCN,IAAI,GAAAsB,qBAAA,GAAE/B,MAAM,CAACgB,OAAO,CAACP,IAAI,cAAAsB,qBAAA,cAAAA,qBAAA,GAAI,UAAU;MACvCrB,EAAE,EAAEV,MAAM,CAACgB,OAAO,CAACN;IACpB,CAAE,CAAC;IACHT,SAAS,CAACmB,iBAAiB,GAC1BM,gBAAgB,CAACnB,GAAG,CAAIC,IAAI,IAAMA,IAAI,CAACqB,YAAa,CACrD,CAAC;EACF,CAAC,MAAM;IAAA,IAAAG,mBAAA;IACN,MAAM7C,aAAa,GAAGF,4BAA4B,CAAEC,iBAAkB,CAAC;IACvE,IAAIoC,YAAY,GAAG,EAAE;IACrB,IAAKpC,iBAAiB,CAACG,MAAM,KAAK,CAAC,EAAG;MACrCiC,YAAY,GAAGtB,MAAM,CAACuB,KAAK,CAACN,QAAQ,CAACC,UAAU,CAAE/B,aAAc,CAAC;IACjE,CAAC,MAAM;MACNmC,YAAY,GACXtB,MAAM,CAACuB,KAAK,CAACN,QAAQ,CAACE,eAAe,CAAEhC,aAAc,CAAC;IACxD;IAEAgB,iBAAiB,CAAEmB,YAAY,EAAE;MAChCb,IAAI,GAAAuB,mBAAA,GAAEhC,MAAM,CAACuB,KAAK,CAACd,IAAI,cAAAuB,mBAAA,cAAAA,mBAAA,GAAI,UAAU;MACrCtB,EAAE,EAAEV,MAAM,CAACuB,KAAK,CAACb;IAClB,CAAE,CAAC;IACHT,SAAS,CAACuB,aAAa,GAAG,CAAC;EAC5B;AACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/fields/src/types.ts"],"sourcesContent":["type PostStatus =\n\t| 'published'\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\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}\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};\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\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}\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};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Converts a hex value into the rgb equivalent.
3
+ *
4
+ * @param {string} hex - the hexadecimal value to convert
5
+ * @return {string} comma separated rgb values
6
+ */
7
+ /**
8
+ * Colors
9
+ */
10
+ /**
11
+ * Breakpoints & Media Queries
12
+ */
13
+ /**
14
+ * SCSS Variables.
15
+ *
16
+ * Please use variables from this sheet to ensure consistency across the UI.
17
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
18
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
19
+ */
20
+ /**
21
+ * Converts a hex value into the rgb equivalent.
22
+ *
23
+ * @param {string} hex - the hexadecimal value to convert
24
+ * @return {string} comma separated rgb values
25
+ */
26
+ /**
27
+ * Colors
28
+ */
29
+ /**
30
+ * Fonts & basic variables.
31
+ */
32
+ /**
33
+ * Typography
34
+ */
35
+ /**
36
+ * Grid System.
37
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
38
+ */
39
+ /**
40
+ * Radius scale.
41
+ */
42
+ /**
43
+ * Elevation scale.
44
+ */
45
+ /**
46
+ * Dimensions.
47
+ */
48
+ /**
49
+ * Mobile specific styles
50
+ */
51
+ /**
52
+ * Editor styles.
53
+ */
54
+ /**
55
+ * Block & Editor UI.
56
+ */
57
+ /**
58
+ * Block paddings.
59
+ */
60
+ /**
61
+ * React Native specific.
62
+ * These variables do not appear to be used anywhere else.
63
+ */
64
+ /**
65
+ * Converts a hex value into the rgb equivalent.
66
+ *
67
+ * @param {string} hex - the hexadecimal value to convert
68
+ * @return {string} comma separated rgb values
69
+ */
70
+ /**
71
+ * Long content fade mixin
72
+ *
73
+ * Creates a fading overlay to signify that the content is longer
74
+ * than the space allows.
75
+ */
76
+ /**
77
+ * Typography
78
+ */
79
+ /**
80
+ * Breakpoint mixins
81
+ */
82
+ /**
83
+ * Focus styles.
84
+ */
85
+ /**
86
+ * Applies editor left position to the selector passed as argument
87
+ */
88
+ /**
89
+ * Styles that are reused verbatim in a few places
90
+ */
91
+ /**
92
+ * Allows users to opt-out of animations via OS-level preferences.
93
+ */
94
+ /**
95
+ * Reset default styles for JavaScript UI based pages.
96
+ * This is a WP-admin agnostic reset
97
+ */
98
+ /**
99
+ * Reset the WP Admin page styles for Gutenberg-like pages.
100
+ */
101
+ :root {
102
+ --wp-admin-theme-color: #007cba;
103
+ --wp-admin-theme-color--rgb: 0, 124, 186;
104
+ --wp-admin-theme-color-darker-10: #006ba1;
105
+ --wp-admin-theme-color-darker-10--rgb: 0, 107, 161;
106
+ --wp-admin-theme-color-darker-20: #005a87;
107
+ --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
108
+ --wp-admin-border-width-focus: 2px;
109
+ --wp-block-synced-color: #7a00df;
110
+ --wp-block-synced-color--rgb: 122, 0, 223;
111
+ --wp-bound-block-color: var(--wp-block-synced-color);
112
+ }
113
+ @media (min-resolution: 192dpi) {
114
+ :root {
115
+ --wp-admin-border-width-focus: 1.5px;
116
+ }
117
+ }
118
+
119
+ .fields-controls__slug .fields-controls__slug-external-icon {
120
+ margin-right: 5ch;
121
+ }
122
+ .fields-controls__slug .fields-controls__slug-input input.components-input-control__input {
123
+ padding-inline-start: 0 !important;
124
+ }
125
+ .fields-controls__slug .fields-controls__slug-help-link {
126
+ word-break: break-word;
127
+ }
128
+ .fields-controls__slug .fields-controls__slug-help {
129
+ display: flex;
130
+ flex-direction: column;
131
+ }
132
+ .fields-controls__slug .fields-controls__slug-help .fields-controls__slug-help-slug {
133
+ font-weight: 600;
134
+ }
135
+
136
+ .fields-controls__featured-image-placeholder {
137
+ border-radius: 2px;
138
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
139
+ display: inline-block;
140
+ padding: 0;
141
+ background: #fff linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
142
+ }
143
+
144
+ .fields-controls__featured-image-title {
145
+ width: 100%;
146
+ color: #1e1e1e;
147
+ white-space: nowrap;
148
+ text-overflow: ellipsis;
149
+ overflow: hidden;
150
+ }
151
+
152
+ .fields-controls__featured-image-image {
153
+ width: 100%;
154
+ height: 100%;
155
+ border-radius: 2px;
156
+ align-self: center;
157
+ }
158
+
159
+ .fields-controls__featured-image-container .fields-controls__featured-image-placeholder {
160
+ margin: 0;
161
+ }
162
+ .fields-controls__featured-image-container span {
163
+ margin-left: auto;
164
+ }
165
+
166
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-container {
167
+ border: 1px solid #ddd;
168
+ border-radius: 2px;
169
+ padding: 8px 12px;
170
+ cursor: pointer;
171
+ }
172
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-container:hover {
173
+ background-color: #f0f0f0;
174
+ }
175
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-placeholder {
176
+ width: 24px;
177
+ height: 24px;
178
+ }
179
+ fieldset.fields-controls__featured-image span {
180
+ align-self: center;
181
+ text-align: start;
182
+ white-space: nowrap;
183
+ }
184
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button {
185
+ padding: 0;
186
+ height: -moz-fit-content;
187
+ height: fit-content;
188
+ }
189
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button:hover, fieldset.fields-controls__featured-image .fields-controls__featured-image-upload-button:focus {
190
+ border: 0;
191
+ color: unset;
192
+ }
193
+ fieldset.fields-controls__featured-image .fields-controls__featured-image-remove-button {
194
+ place-self: end;
195
+ }
196
+
197
+ .dataforms-layouts-panel__field-control .fields-controls__featured-image-image {
198
+ width: 16px;
199
+ height: 16px;
200
+ }
201
+ .dataforms-layouts-panel__field-control .fields-controls__featured-image-placeholder {
202
+ width: 16px;
203
+ height: 16px;
204
+ }
205
+
206
+ .dataviews-view-table__cell-content-wrapper .fields-controls__featured-image-image {
207
+ width: 32px;
208
+ height: 32px;
209
+ }
210
+ .dataviews-view-table__cell-content-wrapper .fields-controls__featured-image-placeholder {
211
+ width: 32px;
212
+ height: 32px;
213
+ }