@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,123 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { getSlug } from './utils';
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
ExternalLink,
|
|
5
|
+
__experimentalInputControl as InputControl,
|
|
6
|
+
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
|
|
7
|
+
__experimentalVStack as VStack
|
|
8
|
+
} from "@wordpress/components";
|
|
9
|
+
import { copySmall } from "@wordpress/icons";
|
|
10
|
+
import { useCopyToClipboard, useInstanceId } from "@wordpress/compose";
|
|
11
|
+
import { useDispatch } from "@wordpress/data";
|
|
12
|
+
import { useCallback, useEffect, useRef } from "@wordpress/element";
|
|
13
|
+
import { store as noticesStore } from "@wordpress/notices";
|
|
14
|
+
import { safeDecodeURIComponent } from "@wordpress/url";
|
|
15
|
+
import { __ } from "@wordpress/i18n";
|
|
16
|
+
import { getSlug } from "./utils";
|
|
19
17
|
const SlugEdit = ({
|
|
20
18
|
field,
|
|
21
19
|
onChange,
|
|
22
20
|
data
|
|
23
21
|
}) => {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const slug = field.getValue({
|
|
28
|
-
item: data
|
|
29
|
-
}) || getSlug(data);
|
|
30
|
-
const permalinkTemplate = data.permalink_template || '';
|
|
22
|
+
const { id } = field;
|
|
23
|
+
const slug = field.getValue({ item: data }) || getSlug(data);
|
|
24
|
+
const permalinkTemplate = data.permalink_template || "";
|
|
31
25
|
const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
|
|
32
|
-
const [prefix, suffix] = permalinkTemplate.split(
|
|
26
|
+
const [prefix, suffix] = permalinkTemplate.split(
|
|
27
|
+
PERMALINK_POSTNAME_REGEX
|
|
28
|
+
);
|
|
33
29
|
const permalinkPrefix = prefix;
|
|
34
30
|
const permalinkSuffix = suffix;
|
|
35
31
|
const isEditable = PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
|
|
36
32
|
const originalSlugRef = useRef(slug);
|
|
37
33
|
const slugToDisplay = slug || originalSlugRef.current;
|
|
38
|
-
const permalink = isEditable ? `${permalinkPrefix}${slugToDisplay}${permalinkSuffix}` : safeDecodeURIComponent(data.link ||
|
|
34
|
+
const permalink = isEditable ? `${permalinkPrefix}${slugToDisplay}${permalinkSuffix}` : safeDecodeURIComponent(data.link || "");
|
|
39
35
|
useEffect(() => {
|
|
40
|
-
if (slug && originalSlugRef.current ===
|
|
36
|
+
if (slug && originalSlugRef.current === void 0) {
|
|
41
37
|
originalSlugRef.current = slug;
|
|
42
38
|
}
|
|
43
39
|
}, [slug]);
|
|
44
|
-
const onChangeControl = useCallback(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const onChangeControl = useCallback(
|
|
41
|
+
(newValue) => onChange({
|
|
42
|
+
[id]: newValue
|
|
43
|
+
}),
|
|
44
|
+
[id, onChange]
|
|
45
|
+
);
|
|
46
|
+
const { createNotice } = useDispatch(noticesStore);
|
|
50
47
|
const copyButtonRef = useCopyToClipboard(permalink, () => {
|
|
51
|
-
createNotice(
|
|
48
|
+
createNotice("info", __("Copied Permalink to clipboard."), {
|
|
52
49
|
isDismissible: true,
|
|
53
|
-
type:
|
|
50
|
+
type: "snackbar"
|
|
54
51
|
});
|
|
55
52
|
});
|
|
56
|
-
const postUrlSlugDescriptionId =
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}), /*#__PURE__*/_jsx(InputControl, {
|
|
69
|
-
__next40pxDefaultSize: true,
|
|
70
|
-
prefix: /*#__PURE__*/_jsx(InputControlPrefixWrapper, {
|
|
71
|
-
children: "/"
|
|
72
|
-
}),
|
|
73
|
-
suffix: /*#__PURE__*/_jsx(Button, {
|
|
53
|
+
const postUrlSlugDescriptionId = "editor-post-url__slug-description-" + useInstanceId(SlugEdit);
|
|
54
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "fields-controls__slug", children: [
|
|
55
|
+
isEditable && /* @__PURE__ */ jsxs(VStack, { children: [
|
|
56
|
+
/* @__PURE__ */ jsxs(VStack, { spacing: "0px", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { children: __(
|
|
58
|
+
"Customize the last part of the Permalink."
|
|
59
|
+
) }),
|
|
60
|
+
/* @__PURE__ */ jsx(ExternalLink, { href: "https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink", children: __("Learn more") })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
InputControl,
|
|
64
|
+
{
|
|
74
65
|
__next40pxDefaultSize: true,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
66
|
+
prefix: /* @__PURE__ */ jsx(InputControlPrefixWrapper, { children: "/" }),
|
|
67
|
+
suffix: /* @__PURE__ */ jsx(
|
|
68
|
+
Button,
|
|
69
|
+
{
|
|
70
|
+
__next40pxDefaultSize: true,
|
|
71
|
+
icon: copySmall,
|
|
72
|
+
ref: copyButtonRef,
|
|
73
|
+
label: __("Copy")
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
label: __("Link"),
|
|
77
|
+
hideLabelFromVision: true,
|
|
78
|
+
value: slug,
|
|
79
|
+
autoComplete: "off",
|
|
80
|
+
spellCheck: "false",
|
|
81
|
+
type: "text",
|
|
82
|
+
className: "fields-controls__slug-input",
|
|
83
|
+
onChange: (newValue) => {
|
|
84
|
+
onChangeControl(newValue);
|
|
85
|
+
},
|
|
86
|
+
onBlur: () => {
|
|
87
|
+
if (slug === "") {
|
|
88
|
+
onChangeControl(originalSlugRef.current);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"aria-describedby": postUrlSlugDescriptionId
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { className: "fields-controls__slug-help", children: [
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__slug-help-visual-label", children: __("Permalink:") }),
|
|
96
|
+
/* @__PURE__ */ jsxs(
|
|
97
|
+
ExternalLink,
|
|
98
|
+
{
|
|
99
|
+
className: "fields-controls__slug-help-link",
|
|
100
|
+
href: permalink,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__slug-help-prefix", children: permalinkPrefix }),
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__slug-help-slug", children: slugToDisplay }),
|
|
104
|
+
/* @__PURE__ */ jsx("span", { className: "fields-controls__slug-help-suffix", children: permalinkSuffix })
|
|
105
|
+
]
|
|
92
106
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
107
|
+
)
|
|
108
|
+
] })
|
|
109
|
+
] }),
|
|
110
|
+
!isEditable && /* @__PURE__ */ jsx(
|
|
111
|
+
ExternalLink,
|
|
112
|
+
{
|
|
96
113
|
className: "fields-controls__slug-help",
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
107
|
-
className: "fields-controls__slug-help-slug",
|
|
108
|
-
children: slugToDisplay
|
|
109
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
110
|
-
className: "fields-controls__slug-help-suffix",
|
|
111
|
-
children: permalinkSuffix
|
|
112
|
-
})]
|
|
113
|
-
})]
|
|
114
|
-
})]
|
|
115
|
-
}), !isEditable && /*#__PURE__*/_jsx(ExternalLink, {
|
|
116
|
-
className: "fields-controls__slug-help",
|
|
117
|
-
href: permalink,
|
|
118
|
-
children: permalink
|
|
119
|
-
})]
|
|
120
|
-
});
|
|
114
|
+
href: permalink,
|
|
115
|
+
children: permalink
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
var slug_edit_default = SlugEdit;
|
|
121
|
+
export {
|
|
122
|
+
slug_edit_default as default
|
|
121
123
|
};
|
|
122
|
-
|
|
123
|
-
//# sourceMappingURL=slug-edit.js.map
|
|
124
|
+
//# sourceMappingURL=slug-edit.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/slug/slug-edit.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tExternalLink,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { copySmall } from '@wordpress/icons';\nimport { useCopyToClipboard, useInstanceId } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getSlug } from './utils';\n\nconst SlugEdit = ( {\n\tfield,\n\tonChange,\n\tdata,\n}: DataFormControlProps< BasePost > ) => {\n\tconst { id } = field;\n\n\tconst slug = field.getValue( { item: data } ) || getSlug( data );\n\tconst permalinkTemplate = data.permalink_template || '';\n\tconst PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;\n\tconst [ prefix, suffix ] = permalinkTemplate.split(\n\t\tPERMALINK_POSTNAME_REGEX\n\t);\n\tconst permalinkPrefix = prefix;\n\tconst permalinkSuffix = suffix;\n\tconst isEditable = PERMALINK_POSTNAME_REGEX.test( permalinkTemplate );\n\tconst originalSlugRef = useRef( slug );\n\tconst slugToDisplay = slug || originalSlugRef.current;\n\tconst permalink = isEditable\n\t\t? `${ permalinkPrefix }${ slugToDisplay }${ permalinkSuffix }`\n\t\t: safeDecodeURIComponent( data.link || '' );\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 onChangeControl = useCallback(\n\t\t( newValue?: string ) =>\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 { createNotice } = useDispatch( noticesStore );\n\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied Permalink to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\tconst postUrlSlugDescriptionId =\n\t\t'editor-post-url__slug-description-' + useInstanceId( SlugEdit );\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__slug\">\n\t\t\t{ isEditable && (\n\t\t\t\t<VStack>\n\t\t\t\t\t<VStack spacing=\"0px\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Customize the last part of the Permalink.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<ExternalLink href=\"https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink\">\n\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ slug }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tclassName=\"fields-controls__slug-input\"\n\t\t\t\t\t\tonChange={ ( newValue?: string ) => {\n\t\t\t\t\t\t\tonChangeControl( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\tif ( slug === '' ) {\n\t\t\t\t\t\t\t\tonChangeControl( originalSlugRef.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-describedby={ postUrlSlugDescriptionId }\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"fields-controls__slug-help\">\n\t\t\t\t\t\t<span className=\"fields-controls__slug-help-visual-label\">\n\t\t\t\t\t\t\t{ __( 'Permalink:' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"fields-controls__slug-help-link\"\n\t\t\t\t\t\t\thref={ permalink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-slug\">\n\t\t\t\t\t\t\t\t{ slugToDisplay }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</div>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ ! isEditable && (\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"fields-controls__slug-help\"\n\t\t\t\t\thref={ permalink }\n\t\t\t\t>\n\t\t\t\t\t{ permalink }\n\t\t\t\t</ExternalLink>\n\t\t\t) }\n\t\t</fieldset>\n\t);\n};\n\nexport default SlugEdit;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
}) => {
|
|
1
|
+
import { useEffect, useRef } from "@wordpress/element";
|
|
2
|
+
import { getSlug } from "./utils";
|
|
3
|
+
const SlugView = ({ item }) => {
|
|
14
4
|
const slug = getSlug(item);
|
|
15
5
|
const originalSlugRef = useRef(slug);
|
|
16
6
|
useEffect(() => {
|
|
17
|
-
if (slug && originalSlugRef.current ===
|
|
7
|
+
if (slug && originalSlugRef.current === void 0) {
|
|
18
8
|
originalSlugRef.current = slug;
|
|
19
9
|
}
|
|
20
10
|
}, [slug]);
|
|
21
11
|
const slugToDisplay = slug || originalSlugRef.current;
|
|
22
12
|
return `${slugToDisplay}`;
|
|
23
13
|
};
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
var slug_view_default = SlugView;
|
|
15
|
+
export {
|
|
16
|
+
slug_view_default as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=slug-view.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/slug/slug-view.tsx"],
|
|
4
|
+
"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 = 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"],
|
|
5
|
+
"mappings": "AAGA,SAAS,WAAW,cAAc;AAMlC,SAAS,eAAe;AAExB,MAAM,WAAW,CAAE,EAAE,KAAK,MAA2B;AACpD,QAAM,OAAO,QAAS,IAAK;AAC3B,QAAM,kBAAkB,OAAQ,IAAK;AAErC,YAAW,MAAM;AAChB,QAAK,QAAQ,gBAAgB,YAAY,QAAY;AACpD,sBAAgB,UAAU;AAAA,IAC3B;AAAA,EACD,GAAG,CAAE,IAAK,CAAE;AAEZ,QAAM,gBAAgB,QAAQ,gBAAgB;AAE9C,SAAO,GAAI,aAAc;AAC1B;AAEA,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { getItemTitle } from '../../actions/utils';
|
|
10
|
-
export const getSlug = item => {
|
|
11
|
-
if (typeof item !== 'object') {
|
|
12
|
-
return '';
|
|
1
|
+
import { cleanForSlug } from "@wordpress/url";
|
|
2
|
+
import { getItemTitle } from "../../actions/utils";
|
|
3
|
+
const getSlug = (item) => {
|
|
4
|
+
if (typeof item !== "object") {
|
|
5
|
+
return "";
|
|
13
6
|
}
|
|
14
7
|
return item.slug || cleanForSlug(getItemTitle(item)) || item.id.toString();
|
|
15
8
|
};
|
|
16
|
-
|
|
9
|
+
export {
|
|
10
|
+
getSlug
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/slug/utils.ts"],
|
|
4
|
+
"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\tif ( typeof item !== 'object' ) {\n\t\treturn '';\n\t}\n\n\treturn (\n\t\titem.slug || cleanForSlug( getItemTitle( item ) ) || item.id.toString()\n\t);\n};\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,oBAAoB;AAK7B,SAAS,oBAAoB;AAEtB,MAAM,UAAU,CAAE,SAA4B;AACpD,MAAK,OAAO,SAAS,UAAW;AAC/B,WAAO;AAAA,EACR;AAEA,SACC,KAAK,QAAQ,aAAc,aAAc,IAAK,CAAE,KAAK,KAAK,GAAG,SAAS;AAExE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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';
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import StatusView from "./status-view";
|
|
3
|
+
import STATUSES from "./status-elements";
|
|
4
|
+
const OPERATOR_IS_ANY = "isAny";
|
|
14
5
|
const statusField = {
|
|
15
|
-
label: __(
|
|
16
|
-
id:
|
|
17
|
-
type:
|
|
6
|
+
label: __("Status"),
|
|
7
|
+
id: "status",
|
|
8
|
+
type: "text",
|
|
18
9
|
elements: STATUSES,
|
|
19
10
|
render: StatusView,
|
|
20
|
-
Edit:
|
|
11
|
+
Edit: "radio",
|
|
21
12
|
enableSorting: false,
|
|
22
13
|
filterBy: {
|
|
23
14
|
operators: [OPERATOR_IS_ANY]
|
|
24
15
|
}
|
|
25
16
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
17
|
+
var status_default = statusField;
|
|
18
|
+
export {
|
|
19
|
+
status_default as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/status/index.tsx"],
|
|
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 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"],
|
|
5
|
+
"mappings": "AAIA,SAAS,UAAU;AAMnB,OAAO,gBAAgB;AACvB,OAAO,cAAc;AAErB,MAAM,kBAAkB;AAExB,MAAM,cAAiC;AAAA,EACtC,OAAO,GAAI,QAAS;AAAA,EACpB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,eAAe;AAAA,EACf,UAAU;AAAA,IACT,WAAW,CAAE,eAAgB;AAAA,EAC9B;AACD;AAKA,IAAO,iBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import {
|
|
2
|
+
trash,
|
|
3
|
+
drafts,
|
|
4
|
+
published,
|
|
5
|
+
scheduled,
|
|
6
|
+
pending,
|
|
7
|
+
notAllowed
|
|
8
|
+
} from "@wordpress/icons";
|
|
9
|
+
import { __ } from "@wordpress/i18n";
|
|
10
|
+
const STATUSES = [
|
|
11
|
+
{
|
|
12
|
+
value: "draft",
|
|
13
|
+
label: __("Draft"),
|
|
14
|
+
icon: drafts,
|
|
15
|
+
description: __("Not ready to publish.")
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "future",
|
|
19
|
+
label: __("Scheduled"),
|
|
20
|
+
icon: scheduled,
|
|
21
|
+
description: __("Publish automatically on a chosen date.")
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "pending",
|
|
25
|
+
label: __("Pending Review"),
|
|
26
|
+
icon: pending,
|
|
27
|
+
description: __("Waiting for review before publishing.")
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "private",
|
|
31
|
+
label: __("Private"),
|
|
32
|
+
icon: notAllowed,
|
|
33
|
+
description: __("Only visible to site admins and editors.")
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "publish",
|
|
37
|
+
label: __("Published"),
|
|
38
|
+
icon: published,
|
|
39
|
+
description: __("Visible to everyone.")
|
|
40
|
+
},
|
|
41
|
+
{ value: "trash", label: __("Trash"), icon: trash }
|
|
42
|
+
];
|
|
43
|
+
var status_elements_default = STATUSES;
|
|
44
|
+
export {
|
|
45
|
+
status_elements_default as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=status-elements.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/status/status-elements.tsx"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AAInB,MAAM,WAAW;AAAA,EAChB;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,OAAQ;AAAA,IACnB,MAAM;AAAA,IACN,aAAa,GAAI,uBAAwB;AAAA,EAC1C;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,WAAY;AAAA,IACvB,MAAM;AAAA,IACN,aAAa,GAAI,yCAA0C;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,gBAAiB;AAAA,IAC5B,MAAM;AAAA,IACN,aAAa,GAAI,uCAAwC;AAAA,EAC1D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,SAAU;AAAA,IACrB,MAAM;AAAA,IACN,aAAa,GAAI,0CAA2C;AAAA,EAC7D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,WAAY;AAAA,IACvB,MAAM;AAAA,IACN,aAAa,GAAI,sBAAuB;AAAA,EACzC;AAAA,EACA,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,GAAG,MAAM,MAAM;AACrD;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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);
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { __experimentalHStack as HStack, Icon } from "@wordpress/components";
|
|
3
|
+
import STATUSES from "./status-elements";
|
|
4
|
+
function StatusView({ item }) {
|
|
5
|
+
const status = STATUSES.find(({ value }) => value === item.status);
|
|
18
6
|
const label = status?.label || item.status;
|
|
19
7
|
const icon = status?.icon;
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
});
|
|
8
|
+
return /* @__PURE__ */ jsxs(HStack, { alignment: "left", spacing: 0, children: [
|
|
9
|
+
icon && /* @__PURE__ */ jsx("div", { className: "edit-site-post-list__status-icon", children: /* @__PURE__ */ jsx(Icon, { icon }) }),
|
|
10
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
11
|
+
] });
|
|
32
12
|
}
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
var status_view_default = StatusView;
|
|
14
|
+
export {
|
|
15
|
+
status_view_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=status-view.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/fields/status/status-view.tsx"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": "AAgBE,SAGG,KAHH;AAbF,SAAS,wBAAwB,QAAQ,YAAY;AAMrD,OAAO,cAAc;AAErB,SAAS,WAAY,EAAE,KAAK,GAAwB;AACnD,QAAM,SAAS,SAAS,KAAM,CAAE,EAAE,MAAM,MAAO,UAAU,KAAK,MAAO;AACrE,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,OAAO,QAAQ;AACrB,SACC,qBAAC,UAAO,WAAU,QAAO,SAAU,GAChC;AAAA,YACD,oBAAC,SAAI,WAAU,oCACd,8BAAC,QAAK,MAAc,GACrB;AAAA,IAED,oBAAC,UAAO,iBAAO;AAAA,KAChB;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { TemplateEdit } from './template-edit';
|
|
1
|
+
import { __ } from "@wordpress/i18n";
|
|
2
|
+
import { TemplateEdit } from "./template-edit";
|
|
10
3
|
const templateField = {
|
|
11
|
-
id:
|
|
12
|
-
type:
|
|
13
|
-
label: __(
|
|
4
|
+
id: "template",
|
|
5
|
+
type: "text",
|
|
6
|
+
label: __("Template"),
|
|
14
7
|
Edit: TemplateEdit,
|
|
15
8
|
enableSorting: false,
|
|
16
9
|
filterBy: false
|
|
17
10
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
var template_default = templateField;
|
|
12
|
+
export {
|
|
13
|
+
template_default as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|