@wordpress/fields 0.24.0 → 0.24.1-next.ff1cebbba.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/README.md +1 -1
- package/build/actions/delete-post.js +168 -117
- package/build/actions/delete-post.js.map +7 -1
- package/build/actions/duplicate-pattern.js +42 -43
- package/build/actions/duplicate-pattern.js.map +7 -1
- package/build/actions/duplicate-post.js +104 -93
- package/build/actions/duplicate-post.js.map +7 -1
- package/build/actions/duplicate-template-part.js +71 -63
- package/build/actions/duplicate-template-part.js.map +7 -1
- package/build/actions/export-pattern.js +60 -45
- package/build/actions/export-pattern.js.map +7 -1
- package/build/actions/index.js +71 -94
- package/build/actions/index.js.map +7 -1
- package/build/actions/permanently-delete-post.js +161 -132
- package/build/actions/permanently-delete-post.js.map +7 -1
- package/build/actions/rename-post.js +77 -83
- package/build/actions/rename-post.js.map +7 -1
- package/build/actions/reorder-page.js +76 -73
- package/build/actions/reorder-page.js.map +7 -1
- package/build/actions/reset-post.js +214 -165
- package/build/actions/reset-post.js.map +7 -1
- package/build/actions/restore-post.js +91 -75
- package/build/actions/restore-post.js.map +7 -1
- package/build/actions/trash-post.js +167 -127
- package/build/actions/trash-post.js.map +7 -1
- package/build/actions/utils.js +48 -41
- package/build/actions/utils.js.map +7 -1
- package/build/actions/view-post-revisions.js +39 -35
- package/build/actions/view-post-revisions.js.map +7 -1
- package/build/actions/view-post.js +31 -28
- package/build/actions/view-post.js.map +7 -1
- package/build/components/create-template-part-modal/index.js +213 -169
- package/build/components/create-template-part-modal/index.js.map +7 -1
- package/build/components/create-template-part-modal/utils.js +48 -48
- package/build/components/create-template-part-modal/utils.js.map +7 -1
- package/build/fields/author/author-view.js +63 -69
- package/build/fields/author/author-view.js.map +7 -1
- package/build/fields/author/index.js +43 -29
- package/build/fields/author/index.js.map +7 -1
- package/build/fields/comment-status/index.js +42 -32
- package/build/fields/comment-status/index.js.map +7 -1
- package/build/fields/date/date-view.js +84 -58
- package/build/fields/date/date-view.js.map +7 -1
- package/build/fields/date/index.js +39 -25
- package/build/fields/date/index.js.map +7 -1
- package/build/fields/discussion/index.js +36 -32
- package/build/fields/discussion/index.js.map +7 -1
- package/build/fields/featured-image/featured-image-edit.js +115 -97
- package/build/fields/featured-image/featured-image-edit.js.map +7 -1
- package/build/fields/featured-image/featured-image-view.js +41 -34
- package/build/fields/featured-image/featured-image-view.js.map +7 -1
- package/build/fields/featured-image/index.js +31 -26
- package/build/fields/featured-image/index.js.map +7 -1
- package/build/fields/index.js +83 -118
- package/build/fields/index.js.map +7 -1
- package/build/fields/order/index.js +28 -23
- package/build/fields/order/index.js.map +7 -1
- package/build/fields/page-title/index.js +42 -30
- package/build/fields/page-title/index.js.map +7 -1
- package/build/fields/page-title/view.js +38 -41
- package/build/fields/page-title/view.js.map +7 -1
- package/build/fields/parent/index.js +31 -26
- package/build/fields/parent/index.js.map +7 -1
- package/build/fields/parent/parent-edit.js +200 -168
- package/build/fields/parent/parent-edit.js.map +7 -1
- package/build/fields/parent/parent-view.js +40 -31
- package/build/fields/parent/parent-view.js.map +7 -1
- package/build/fields/parent/utils.js +29 -16
- package/build/fields/parent/utils.js.map +7 -1
- package/build/fields/password/edit.js +67 -53
- package/build/fields/password/edit.js.map +7 -1
- package/build/fields/password/index.js +40 -26
- package/build/fields/password/index.js.map +7 -1
- package/build/fields/pattern-title/index.js +42 -30
- package/build/fields/pattern-title/index.js.map +7 -1
- package/build/fields/pattern-title/view.js +43 -41
- package/build/fields/pattern-title/view.js.map +7 -1
- package/build/fields/ping-status/index.js +66 -47
- package/build/fields/ping-status/index.js.map +7 -1
- package/build/fields/slug/index.js +41 -27
- package/build/fields/slug/index.js.map +7 -1
- package/build/fields/slug/slug-edit.js +116 -107
- package/build/fields/slug/slug-edit.js.map +7 -1
- package/build/fields/slug/slug-view.js +30 -23
- package/build/fields/slug/slug-view.js.map +7 -1
- package/build/fields/slug/utils.js +32 -20
- package/build/fields/slug/utils.js.map +7 -1
- package/build/fields/status/index.js +43 -29
- package/build/fields/status/index.js.map +7 -1
- package/build/fields/status/status-elements.js +58 -44
- package/build/fields/status/status-elements.js.map +7 -1
- package/build/fields/status/status-view.js +42 -36
- package/build/fields/status/status-view.js.map +7 -1
- package/build/fields/template/index.js +29 -24
- package/build/fields/template/index.js.map +7 -1
- package/build/fields/template/template-edit.js +167 -142
- package/build/fields/template/template-edit.js.map +7 -1
- package/build/fields/template-title/index.js +42 -30
- package/build/fields/template-title/index.js.map +7 -1
- package/build/fields/title/index.js +42 -32
- package/build/fields/title/index.js.map +7 -1
- package/build/fields/title/view.js +57 -39
- package/build/fields/title/view.js.map +7 -1
- package/build/index.js +39 -36
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -14
- package/build/lock-unlock.js.map +7 -1
- package/build/mutation/index.js +91 -76
- package/build/mutation/index.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build-module/actions/delete-post.js +155 -107
- package/build-module/actions/delete-post.js.map +7 -1
- package/build-module/actions/duplicate-pattern.js +24 -36
- package/build-module/actions/duplicate-pattern.js.map +7 -1
- package/build-module/actions/duplicate-post.js +87 -84
- package/build-module/actions/duplicate-post.js.map +7 -1
- package/build-module/actions/duplicate-template-part.js +51 -58
- package/build-module/actions/duplicate-template-part.js.map +7 -1
- package/build-module/actions/export-pattern.js +40 -39
- package/build-module/actions/export-pattern.js.map +7 -1
- package/build-module/actions/index.js +29 -14
- package/build-module/actions/index.js.map +7 -1
- package/build-module/actions/permanently-delete-post.js +146 -125
- package/build-module/actions/permanently-delete-post.js.map +7 -1
- package/build-module/actions/rename-post.js +63 -77
- package/build-module/actions/rename-post.js.map +7 -1
- package/build-module/actions/reorder-page.js +58 -65
- package/build-module/actions/reorder-page.js.map +7 -1
- package/build-module/actions/reset-post.js +185 -152
- package/build-module/actions/reset-post.js.map +7 -1
- package/build-module/actions/restore-post.js +72 -68
- package/build-module/actions/restore-post.js.map +7 -1
- package/build-module/actions/trash-post.js +152 -119
- package/build-module/actions/trash-post.js.map +7 -1
- package/build-module/actions/utils.js +23 -34
- package/build-module/actions/utils.js.map +7 -1
- package/build-module/actions/view-post-revisions.js +21 -31
- package/build-module/actions/view-post-revisions.js.map +7 -1
- package/build-module/actions/view-post.js +12 -23
- package/build-module/actions/view-post.js.map +7 -1
- package/build-module/components/create-template-part-modal/index.js +201 -154
- package/build-module/components/create-template-part-modal/index.js.map +7 -1
- package/build-module/components/create-template-part-modal/utils.js +26 -43
- package/build-module/components/create-template-part-modal/utils.js.map +7 -1
- package/build-module/fields/author/author-view.js +34 -62
- package/build-module/fields/author/author-view.js.map +7 -1
- package/build-module/fields/author/index.js +14 -24
- package/build-module/fields/author/index.js.map +7 -1
- package/build-module/fields/comment-status/index.js +24 -29
- package/build-module/fields/comment-status/index.js.map +7 -1
- package/build-module/fields/date/date-view.js +66 -53
- package/build-module/fields/date/date-view.js.map +7 -1
- package/build-module/fields/date/index.js +10 -20
- package/build-module/fields/date/index.js.map +7 -1
- package/build-module/fields/discussion/index.js +18 -29
- package/build-module/fields/discussion/index.js.map +7 -1
- package/build-module/fields/featured-image/featured-image-edit.js +93 -90
- package/build-module/fields/featured-image/featured-image-edit.js.map +7 -1
- package/build-module/fields/featured-image/featured-image-view.js +20 -29
- package/build-module/fields/featured-image/featured-image-view.js.map +7 -1
- package/build-module/fields/featured-image/index.js +11 -21
- package/build-module/fields/featured-image/index.js.map +7 -1
- package/build-module/fields/index.js +35 -17
- package/build-module/fields/index.js.map +7 -1
- package/build-module/fields/order/index.js +10 -20
- package/build-module/fields/order/index.js.map +7 -1
- package/build-module/fields/page-title/index.js +13 -25
- package/build-module/fields/page-title/index.js.map +7 -1
- package/build-module/fields/page-title/view.js +20 -37
- package/build-module/fields/page-title/view.js.map +7 -1
- package/build-module/fields/parent/index.js +11 -21
- package/build-module/fields/parent/index.js.map +7 -1
- package/build-module/fields/parent/parent-edit.js +172 -160
- package/build-module/fields/parent/parent-edit.js.map +7 -1
- package/build-module/fields/parent/parent-view.js +19 -27
- package/build-module/fields/parent/parent-view.js.map +7 -1
- package/build-module/fields/parent/utils.js +8 -13
- package/build-module/fields/parent/utils.js.map +7 -1
- package/build-module/fields/password/edit.js +53 -48
- package/build-module/fields/password/edit.js.map +7 -1
- package/build-module/fields/password/index.js +11 -21
- package/build-module/fields/password/index.js.map +7 -1
- package/build-module/fields/pattern-title/index.js +13 -25
- package/build-module/fields/pattern-title/index.js.map +7 -1
- package/build-module/fields/pattern-title/view.js +21 -34
- package/build-module/fields/pattern-title/view.js.map +7 -1
- package/build-module/fields/ping-status/index.js +48 -43
- package/build-module/fields/ping-status/index.js.map +7 -1
- package/build-module/fields/slug/index.js +11 -21
- package/build-module/fields/slug/index.js.map +7 -1
- package/build-module/fields/slug/slug-edit.js +101 -100
- package/build-module/fields/slug/slug-edit.js.map +7 -1
- package/build-module/fields/slug/slug-view.js +9 -16
- package/build-module/fields/slug/slug-view.js.map +7 -1
- package/build-module/fields/slug/utils.js +9 -13
- package/build-module/fields/slug/utils.js.map +7 -1
- package/build-module/fields/status/index.js +13 -23
- package/build-module/fields/status/index.js.map +7 -1
- package/build-module/fields/status/status-elements.js +47 -40
- package/build-module/fields/status/status-elements.js.map +7 -1
- package/build-module/fields/status/status-view.js +14 -31
- package/build-module/fields/status/status-view.js.map +7 -1
- package/build-module/fields/template/index.js +10 -18
- package/build-module/fields/template/index.js.map +7 -1
- package/build-module/fields/template/template-edit.js +147 -130
- package/build-module/fields/template/template-edit.js.map +7 -1
- package/build-module/fields/template-title/index.js +13 -25
- package/build-module/fields/template-title/index.js.map +7 -1
- package/build-module/fields/title/index.js +13 -27
- package/build-module/fields/title/index.js.map +7 -1
- package/build-module/fields/title/view.js +25 -32
- package/build-module/fields/title/view.js.map +7 -1
- package/build-module/index.js +7 -4
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/mutation/index.js +70 -72
- package/build-module/mutation/index.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/build-style/style-rtl.css +4 -139
- package/build-style/style.css +4 -139
- package/build-types/fields/author/author-view.d.ts.map +1 -1
- package/build-types/fields/discussion/index.d.ts.map +1 -1
- package/build-types/fields/featured-image/featured-image-edit.d.ts +2 -2
- 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 +5 -2
- package/build-types/fields/featured-image/featured-image-view.d.ts.map +1 -1
- package/build-types/fields/featured-image/index.d.ts +3 -3
- package/build-types/fields/featured-image/index.d.ts.map +1 -1
- package/build-types/types.d.ts +18 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +34 -27
- package/src/components/create-template-part-modal/style.scss +4 -0
- package/src/fields/author/author-view.tsx +3 -17
- package/src/fields/discussion/index.tsx +1 -0
- package/src/fields/featured-image/featured-image-edit.tsx +2 -2
- package/src/fields/featured-image/featured-image-view.tsx +3 -15
- package/src/fields/featured-image/index.ts +3 -3
- package/src/fields/featured-image/style.scss +3 -0
- package/src/fields/template/style.scss +4 -0
- package/src/fields/title/style.scss +1 -1
- package/src/style.scss +9 -8
- package/src/types.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/index.native.js +0 -2
- package/build/index.native.js.map +0 -1
- package/build-module/index.native.js +0 -2
- package/build-module/index.native.js.map +0 -1
|
@@ -1,104 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
export const FeaturedImageEdit = ({
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, __experimentalGrid as Grid } from "@wordpress/components";
|
|
3
|
+
import { useSelect } from "@wordpress/data";
|
|
4
|
+
import { useCallback, useRef } from "@wordpress/element";
|
|
5
|
+
import { MediaUpload } from "@wordpress/media-utils";
|
|
6
|
+
import { lineSolid } from "@wordpress/icons";
|
|
7
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
8
|
+
import { __ } from "@wordpress/i18n";
|
|
9
|
+
const FeaturedImageEdit = ({
|
|
18
10
|
data,
|
|
19
11
|
field,
|
|
20
12
|
onChange
|
|
21
13
|
}) => {
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[id]
|
|
36
|
-
|
|
14
|
+
const { id } = field;
|
|
15
|
+
const value = field.getValue({ item: data });
|
|
16
|
+
const media = useSelect(
|
|
17
|
+
(select) => {
|
|
18
|
+
const { getEntityRecord } = select(coreStore);
|
|
19
|
+
return getEntityRecord("postType", "attachment", value);
|
|
20
|
+
},
|
|
21
|
+
[value]
|
|
22
|
+
);
|
|
23
|
+
const onChangeControl = useCallback(
|
|
24
|
+
(newValue) => onChange({
|
|
25
|
+
[id]: newValue
|
|
26
|
+
}),
|
|
27
|
+
[id, onChange]
|
|
28
|
+
);
|
|
37
29
|
const url = media?.source_url;
|
|
38
30
|
const title = media?.title?.rendered;
|
|
39
31
|
const ref = useRef(null);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return /*#__PURE__*/_jsx("div", {
|
|
53
|
-
ref: ref,
|
|
32
|
+
return /* @__PURE__ */ jsx("fieldset", { className: "fields-controls__featured-image", children: /* @__PURE__ */ jsx("div", { className: "fields-controls__featured-image-container", children: /* @__PURE__ */ jsx(
|
|
33
|
+
MediaUpload,
|
|
34
|
+
{
|
|
35
|
+
onSelect: (selectedMedia) => {
|
|
36
|
+
onChangeControl(selectedMedia.id);
|
|
37
|
+
},
|
|
38
|
+
allowedTypes: ["image"],
|
|
39
|
+
render: ({ open }) => {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
54
44
|
role: "button",
|
|
55
45
|
tabIndex: -1,
|
|
56
46
|
onClick: () => {
|
|
57
47
|
open();
|
|
58
48
|
},
|
|
59
49
|
onKeyDown: open,
|
|
60
|
-
children:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
children: /* @__PURE__ */ jsxs(
|
|
51
|
+
Grid,
|
|
52
|
+
{
|
|
53
|
+
rowGap: 0,
|
|
54
|
+
columnGap: 8,
|
|
55
|
+
templateColumns: "24px 1fr 24px",
|
|
56
|
+
children: [
|
|
57
|
+
url && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
"img",
|
|
60
|
+
{
|
|
61
|
+
className: "fields-controls__featured-image-image",
|
|
62
|
+
alt: "",
|
|
63
|
+
width: 24,
|
|
64
|
+
height: 24,
|
|
65
|
+
src: url
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__featured-image-title", children: title })
|
|
69
|
+
] }),
|
|
70
|
+
!url && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
className: "fields-controls__featured-image-placeholder",
|
|
75
|
+
style: {
|
|
76
|
+
width: "24px",
|
|
77
|
+
height: "24px"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__featured-image-title", children: __("Choose an image\u2026") })
|
|
82
|
+
] }),
|
|
83
|
+
url && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
size: "small",
|
|
87
|
+
className: "fields-controls__featured-image-remove-button",
|
|
88
|
+
icon: lineSolid,
|
|
89
|
+
onClick: (event) => {
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
onChangeControl(0);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
) })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
) }) });
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
export {
|
|
105
|
+
FeaturedImageEdit
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=featured-image-edit.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/featured-image/featured-image-edit.tsx"],
|
|
4
|
+
"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 { BasePostWithEmbeddedFeaturedMedia } from '../../types';\n\nexport const FeaturedImageEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePostWithEmbeddedFeaturedMedia > ) => {\n\tconst { id } = field;\n\n\tconst value = field.getValue( { item: data } );\n\n\tconst media = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', 'attachment', value );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: number ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\tconst url = media?.source_url;\n\tconst title = media?.title?.rendered;\n\tconst ref = useRef( null );\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__featured-image\">\n\t\t\t<div className=\"fields-controls__featured-image-container\">\n\t\t\t\t<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\u2026' ) }\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"],
|
|
5
|
+
"mappings": "AAwEU,mBACC,KADD;AArEV,SAAS,QAAQ,sBAAsB,YAAY;AACnD,SAAS,iBAAiB;AAC1B,SAAS,aAAa,cAAc;AAEpC,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAEnC,SAAS,UAAU;AAOZ,MAAM,oBAAoB,CAAE;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACD,MAAkE;AACjE,QAAM,EAAE,GAAG,IAAI;AAEf,QAAM,QAAQ,MAAM,SAAU,EAAE,MAAM,KAAK,CAAE;AAE7C,QAAM,QAAQ;AAAA,IACb,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,aAAO,gBAAiB,YAAY,cAAc,KAAM;AAAA,IACzD;AAAA,IACA,CAAE,KAAM;AAAA,EACT;AAEA,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU;AAAA,MACT,CAAE,EAAG,GAAG;AAAA,IACT,CAAE;AAAA,IACH,CAAE,IAAI,QAAS;AAAA,EAChB;AAEA,QAAM,MAAM,OAAO;AACnB,QAAM,QAAQ,OAAO,OAAO;AAC5B,QAAM,MAAM,OAAQ,IAAK;AAEzB,SACC,oBAAC,cAAS,WAAU,mCACnB,8BAAC,SAAI,WAAU,6CACd;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAE,kBAAmC;AAC/C,wBAAiB,cAAc,EAAG;AAAA,MACnC;AAAA,MACA,cAAe,CAAE,OAAQ;AAAA,MACzB,QAAS,CAAE,EAAE,KAAK,MAA6B;AAC9C,eACC;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA,MAAK;AAAA,YACL,UAAW;AAAA,YACX,SAAU,MAAM;AACf,mBAAK;AAAA,YACN;AAAA,YACA,WAAY;AAAA,YAEZ;AAAA,cAAC;AAAA;AAAA,gBACA,QAAS;AAAA,gBACT,WAAY;AAAA,gBACZ,iBAAgB;AAAA,gBAEd;AAAA,yBACD,iCACC;AAAA;AAAA,sBAAC;AAAA;AAAA,wBACA,WAAU;AAAA,wBACV,KAAI;AAAA,wBACJ,OAAQ;AAAA,wBACR,QAAS;AAAA,wBACT,KAAM;AAAA;AAAA,oBACP;AAAA,oBACA,oBAAC,UAAK,WAAU,yCACb,iBACH;AAAA,qBACD;AAAA,kBAEC,CAAE,OACH,iCACC;AAAA;AAAA,sBAAC;AAAA;AAAA,wBACA,WAAU;AAAA,wBACV,OAAQ;AAAA,0BACP,OAAO;AAAA,0BACP,QAAQ;AAAA,wBACT;AAAA;AAAA,oBACD;AAAA,oBACA,oBAAC,UAAK,WAAU,yCACb,aAAI,uBAAmB,GAC1B;AAAA,qBACD;AAAA,kBAEC,OACD,gCACC;AAAA,oBAAC;AAAA;AAAA,sBACA,MAAK;AAAA,sBACL,WAAU;AAAA,sBACV,MAAO;AAAA,sBACP,SAAU,CACT,UACI;AACJ,8BAAM,gBAAgB;AACtB,wCAAiB,CAAE;AAAA,sBACpB;AAAA;AAAA,kBACD,GACD;AAAA;AAAA;AAAA,YAEF;AAAA;AAAA,QACD;AAAA,MAEF;AAAA;AAAA,EACD,GACD,GACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
export const FeaturedImageView = ({
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const FeaturedImageView = ({
|
|
12
3
|
item,
|
|
13
4
|
config
|
|
14
5
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
const media = useSelect(select => {
|
|
17
|
-
const {
|
|
18
|
-
getEntityRecord
|
|
19
|
-
} = select(coreStore);
|
|
20
|
-
return mediaId ? getEntityRecord('postType', 'attachment', mediaId) : null;
|
|
21
|
-
}, [mediaId]);
|
|
6
|
+
const media = item?._embedded?.["wp:featuredmedia"]?.[0];
|
|
22
7
|
const url = media?.source_url;
|
|
23
8
|
if (url) {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"img",
|
|
11
|
+
{
|
|
12
|
+
className: "fields-controls__featured-image-image",
|
|
13
|
+
src: url,
|
|
14
|
+
alt: "",
|
|
15
|
+
srcSet: media?.media_details?.sizes ? Object.values(media.media_details.sizes).map(
|
|
16
|
+
(size) => `${size.source_url} ${size.width}w`
|
|
17
|
+
).join(", ") : void 0,
|
|
18
|
+
sizes: config?.sizes || "100vw"
|
|
19
|
+
}
|
|
20
|
+
);
|
|
31
21
|
}
|
|
32
|
-
return
|
|
33
|
-
className: "fields-controls__featured-image-placeholder"
|
|
34
|
-
});
|
|
22
|
+
return /* @__PURE__ */ jsx("span", { className: "fields-controls__featured-image-placeholder" });
|
|
35
23
|
};
|
|
36
|
-
|
|
24
|
+
export {
|
|
25
|
+
FeaturedImageView
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=featured-image-view.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/featured-image/featured-image-view.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\n\nexport const FeaturedImageView = ( {\n\titem,\n\tconfig,\n}: DataViewRenderFieldProps< BasePostWithEmbeddedFeaturedMedia > ) => {\n\tconst media = item?._embedded?.[ 'wp:featuredmedia' ]?.[ 0 ];\n\tconst url = media?.source_url;\n\n\tif ( url ) {\n\t\treturn (\n\t\t\t<img\n\t\t\t\tclassName=\"fields-controls__featured-image-image\"\n\t\t\t\tsrc={ url }\n\t\t\t\talt=\"\"\n\t\t\t\tsrcSet={\n\t\t\t\t\tmedia?.media_details?.sizes\n\t\t\t\t\t\t? Object.values( media.media_details.sizes )\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( size: any ) =>\n\t\t\t\t\t\t\t\t\t\t`${ size.source_url } ${ size.width }w`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ', ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tsizes={ config?.sizes || '100vw' }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn <span className=\"fields-controls__featured-image-placeholder\" />;\n};\n"],
|
|
5
|
+
"mappings": "AAmBG;AATI,MAAM,oBAAoB,CAAE;AAAA,EAClC;AAAA,EACA;AACD,MAAsE;AACrE,QAAM,QAAQ,MAAM,YAAa,kBAAmB,IAAK,CAAE;AAC3D,QAAM,MAAM,OAAO;AAEnB,MAAK,KAAM;AACV,WACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,KAAM;AAAA,QACN,KAAI;AAAA,QACJ,QACC,OAAO,eAAe,QACnB,OAAO,OAAQ,MAAM,cAAc,KAAM,EACxC;AAAA,UACA,CAAE,SACD,GAAI,KAAK,UAAW,IAAK,KAAK,KAAM;AAAA,QACtC,EACC,KAAM,IAAK,IACZ;AAAA,QAEJ,OAAQ,QAAQ,SAAS;AAAA;AAAA,IAC1B;AAAA,EAEF;AAEA,SAAO,oBAAC,UAAK,WAAU,+CAA8C;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { FeaturedImageEdit } from './featured-image-edit';
|
|
12
|
-
import { FeaturedImageView } from './featured-image-view';
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import { FeaturedImageEdit } from "./featured-image-edit";
|
|
3
|
+
import { FeaturedImageView } from "./featured-image-view";
|
|
13
4
|
const featuredImageField = {
|
|
14
|
-
id:
|
|
15
|
-
type:
|
|
16
|
-
label: __(
|
|
5
|
+
id: "featured_media",
|
|
6
|
+
type: "media",
|
|
7
|
+
label: __("Featured Image"),
|
|
17
8
|
Edit: FeaturedImageEdit,
|
|
18
9
|
render: FeaturedImageView,
|
|
19
10
|
enableSorting: false,
|
|
20
11
|
filterBy: false
|
|
21
12
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
13
|
+
var featured_image_default = featuredImageField;
|
|
14
|
+
export {
|
|
15
|
+
featured_image_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/featured-image/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePostWithEmbeddedFeaturedMedia } from '../../types';\nimport { FeaturedImageEdit } from './featured-image-edit';\nimport { FeaturedImageView } from './featured-image-view';\n\nconst featuredImageField: Field< BasePostWithEmbeddedFeaturedMedia > = {\n\tid: 'featured_media',\n\ttype: 'media',\n\tlabel: __( 'Featured Image' ),\n\tEdit: FeaturedImageEdit,\n\trender: FeaturedImageView,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * Featured Image field for BasePostWithEmbeddedFeaturedMedia.\n */\nexport default featuredImageField;\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAElC,MAAM,qBAAiE;AAAA,EACtE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,gBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { default as default2 } from "./slug";
|
|
2
|
+
import { default as default3 } from "./title";
|
|
3
|
+
import { default as default4 } from "./page-title";
|
|
4
|
+
import { default as default5 } from "./template-title";
|
|
5
|
+
import { default as default6 } from "./pattern-title";
|
|
6
|
+
import { default as default7 } from "./order";
|
|
7
|
+
import { default as default8 } from "./featured-image";
|
|
8
|
+
import { default as default9 } from "./template";
|
|
9
|
+
import { default as default10 } from "./parent";
|
|
10
|
+
import { default as default11 } from "./password";
|
|
11
|
+
import { default as default12 } from "./status";
|
|
12
|
+
import { default as default13 } from "./comment-status";
|
|
13
|
+
import { default as default14 } from "./ping-status";
|
|
14
|
+
import { default as default15 } from "./discussion";
|
|
15
|
+
import { default as default16 } from "./date";
|
|
16
|
+
import { default as default17 } from "./author";
|
|
17
|
+
export {
|
|
18
|
+
default17 as authorField,
|
|
19
|
+
default13 as commentStatusField,
|
|
20
|
+
default16 as dateField,
|
|
21
|
+
default15 as discussionField,
|
|
22
|
+
default8 as featuredImageField,
|
|
23
|
+
default7 as orderField,
|
|
24
|
+
default4 as pageTitleField,
|
|
25
|
+
default10 as parentField,
|
|
26
|
+
default11 as passwordField,
|
|
27
|
+
default6 as patternTitleField,
|
|
28
|
+
default14 as pingStatusField,
|
|
29
|
+
default2 as slugField,
|
|
30
|
+
default12 as statusField,
|
|
31
|
+
default9 as templateField,
|
|
32
|
+
default5 as templateTitleField,
|
|
33
|
+
default3 as titleField
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/fields/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default as slugField } from './slug';\nexport { default as titleField } from './title';\nexport { default as pageTitleField } from './page-title';\nexport { default as templateTitleField } from './template-title';\nexport { default as patternTitleField } from './pattern-title';\nexport { default as orderField } from './order';\nexport { default as featuredImageField } from './featured-image';\nexport { default as templateField } from './template';\nexport { default as parentField } from './parent';\nexport { default as passwordField } from './password';\nexport { default as statusField } from './status';\nexport { default as commentStatusField } from './comment-status';\nexport { default as pingStatusField } from './ping-status';\nexport { default as discussionField } from './discussion';\nexport { default as dateField } from './date';\nexport { default as authorField } from './author';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAoB,WAAXA,gBAA4B;AACrC,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAA6B;AACtC,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAqC;AAC9C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAAkC;AAC3C,SAAoB,WAAXA,iBAA4B;AACrC,SAAoB,WAAXA,iBAA8B;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
11
2
|
const orderField = {
|
|
12
|
-
id:
|
|
13
|
-
type:
|
|
14
|
-
label: __(
|
|
15
|
-
description: __(
|
|
3
|
+
id: "menu_order",
|
|
4
|
+
type: "integer",
|
|
5
|
+
label: __("Order"),
|
|
6
|
+
description: __("Determines the order of pages."),
|
|
16
7
|
filterBy: false,
|
|
17
8
|
isValid: {
|
|
18
9
|
required: true
|
|
19
10
|
}
|
|
20
11
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
12
|
+
var order_default = orderField;
|
|
13
|
+
export {
|
|
14
|
+
order_default as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/order/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst orderField: Field< BasePost > = {\n\tid: 'menu_order',\n\ttype: 'integer',\n\tlabel: __( 'Order' ),\n\tdescription: __( 'Determines the order of pages.' ),\n\tfilterBy: false,\n\tisValid: {\n\t\trequired: true,\n\t},\n};\n\n/**\n * Order field for BasePost.\n */\nexport default orderField;\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,UAAU;AAOnB,MAAM,aAAgC;AAAA,EACrC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,gCAAiC;AAAA,EAClD,UAAU;AAAA,EACV,SAAS;AAAA,IACR,UAAU;AAAA,EACX;AACD;AAKA,IAAO,gBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { getItemTitle } from '../../actions/utils';
|
|
12
|
-
import PageTitleView from './view';
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import { getItemTitle } from "../../actions/utils";
|
|
3
|
+
import PageTitleView from "./view";
|
|
13
4
|
const pageTitleField = {
|
|
14
|
-
type:
|
|
15
|
-
id:
|
|
16
|
-
label: __(
|
|
17
|
-
placeholder: __(
|
|
18
|
-
getValue: ({
|
|
19
|
-
item
|
|
20
|
-
}) => getItemTitle(item),
|
|
5
|
+
type: "text",
|
|
6
|
+
id: "title",
|
|
7
|
+
label: __("Title"),
|
|
8
|
+
placeholder: __("No title"),
|
|
9
|
+
getValue: ({ item }) => getItemTitle(item),
|
|
21
10
|
render: PageTitleView,
|
|
22
11
|
enableHiding: false,
|
|
23
12
|
enableGlobalSearch: true,
|
|
24
13
|
filterBy: false
|
|
25
14
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
15
|
+
var page_title_default = pageTitleField;
|
|
16
|
+
export {
|
|
17
|
+
page_title_default as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/page-title/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport PageTitleView from './view';\n\nconst pageTitleField: Field< BasePost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: PageTitleView,\n\tenableHiding: false,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the page entity.\n */\nexport default pageTitleField;\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,mBAAmB;AAE1B,MAAM,iBAAoC;AAAA,EACzC,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,UAAW;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,aAAc,IAAK;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAKA,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,43 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
Badge
|
|
18
|
-
} = unlock(componentsPrivateApis);
|
|
19
|
-
export default function PageTitleView({
|
|
20
|
-
item
|
|
21
|
-
}) {
|
|
22
|
-
const {
|
|
23
|
-
frontPageId,
|
|
24
|
-
postsPageId
|
|
25
|
-
} = useSelect(select => {
|
|
26
|
-
const {
|
|
27
|
-
getEntityRecord
|
|
28
|
-
} = select(coreStore);
|
|
29
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import { useSelect } from "@wordpress/data";
|
|
4
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
5
|
+
import { privateApis as componentsPrivateApis } from "@wordpress/components";
|
|
6
|
+
import { BaseTitleView } from "../title/view";
|
|
7
|
+
import { unlock } from "../../lock-unlock";
|
|
8
|
+
const { Badge } = unlock(componentsPrivateApis);
|
|
9
|
+
function PageTitleView({ item }) {
|
|
10
|
+
const { frontPageId, postsPageId } = useSelect((select) => {
|
|
11
|
+
const { getEntityRecord } = select(coreStore);
|
|
12
|
+
const siteSettings = getEntityRecord(
|
|
13
|
+
"root",
|
|
14
|
+
"site"
|
|
15
|
+
);
|
|
30
16
|
return {
|
|
31
17
|
frontPageId: siteSettings?.page_on_front,
|
|
32
18
|
postsPageId: siteSettings?.page_for_posts
|
|
33
19
|
};
|
|
34
20
|
}, []);
|
|
35
|
-
return
|
|
36
|
-
item: item,
|
|
37
|
-
className: "fields-field__page-title",
|
|
38
|
-
children: [frontPageId, postsPageId].includes(item.id) && /*#__PURE__*/_jsx(Badge, {
|
|
39
|
-
children: item.id === frontPageId ? __('Homepage') : __('Posts Page')
|
|
40
|
-
})
|
|
41
|
-
});
|
|
21
|
+
return /* @__PURE__ */ jsx(BaseTitleView, { item, className: "fields-field__page-title", children: [frontPageId, postsPageId].includes(item.id) && /* @__PURE__ */ jsx(Badge, { children: item.id === frontPageId ? __("Homepage") : __("Posts Page") }) });
|
|
42
22
|
}
|
|
43
|
-
|
|
23
|
+
export {
|
|
24
|
+
PageTitleView as default
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=view.js.map
|