@elementor/editor-site-navigation 4.5.0-1216 → 4.5.0-1218
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/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +830 -344
- package/dist/index.mjs +782 -288
- package/package.json +11 -10
- package/src/api/post.ts +21 -5
- package/src/components/panel/actions-menu/action-menu-item.tsx +4 -3
- package/src/components/panel/actions-menu/actions/force-delete.tsx +99 -0
- package/src/components/panel/actions-menu/actions/restore.tsx +33 -0
- package/src/components/panel/content-panel-active-filters.tsx +53 -0
- package/src/components/panel/content-panel-chrome.ts +19 -0
- package/src/components/panel/content-panel-clear-filters-button.tsx +22 -0
- package/src/components/panel/content-panel-search.tsx +1 -2
- package/src/components/panel/content-panel-status-filter-list.tsx +70 -0
- package/src/components/panel/content-panel-status-filter.tsx +75 -0
- package/src/components/panel/content-panel-toolbar.tsx +23 -0
- package/src/components/panel/posts-list/collapsible-list.tsx +7 -4
- package/src/components/panel/posts-list/list-items/list-item-view.tsx +80 -47
- package/src/components/panel/posts-list/list-items/site-content-list-item-actions-location.tsx +14 -0
- package/src/components/panel/posts-list/posts-collapsible-list.tsx +30 -9
- package/src/components/panel/shell.tsx +6 -2
- package/src/components/shared/page-title-and-status.tsx +2 -0
- package/src/contexts/content-panel-coordinator.tsx +34 -3
- package/src/hooks/use-posts-actions.ts +20 -1
- package/src/hooks/use-posts-baseline-total.ts +22 -0
- package/src/hooks/use-posts.ts +19 -13
- package/src/hooks/use-site-content-status-filter-counts.ts +56 -0
- package/src/index.ts +5 -0
- package/src/site-content-restore.ts +1 -0
- package/src/site-content-status-filter.ts +111 -0
package/dist/index.mjs
CHANGED
|
@@ -24,25 +24,109 @@ function getIconsMap() {
|
|
|
24
24
|
// src/init.ts
|
|
25
25
|
import { injectIntoPageIndication, toolsMenu } from "@elementor/editor-app-bar";
|
|
26
26
|
import { registerPanel } from "@elementor/editor-panels";
|
|
27
|
-
import { isSidebarEnabled, sidebarTools } from "@elementor/editor-sidebar";
|
|
27
|
+
import { isSidebarEnabled as isSidebarEnabled2, sidebarTools } from "@elementor/editor-sidebar";
|
|
28
28
|
|
|
29
29
|
// src/components/panel/panel.ts
|
|
30
30
|
import { createPanel } from "@elementor/editor-panels";
|
|
31
31
|
|
|
32
32
|
// src/components/panel/shell.tsx
|
|
33
|
-
import * as
|
|
34
|
-
import { useState as
|
|
33
|
+
import * as React34 from "react";
|
|
34
|
+
import { useState as useState8 } from "react";
|
|
35
35
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
36
|
+
import { isSidebarEnabled } from "@elementor/editor-sidebar";
|
|
37
|
+
import { Divider as Divider6, Stack as Stack8 } from "@elementor/ui";
|
|
38
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
38
39
|
|
|
39
40
|
// src/contexts/content-panel-coordinator.tsx
|
|
40
41
|
import * as React from "react";
|
|
41
42
|
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
43
|
+
|
|
44
|
+
// src/site-content-status-filter.ts
|
|
45
|
+
import { __ } from "@wordpress/i18n";
|
|
46
|
+
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
47
|
+
"publish",
|
|
48
|
+
"draft",
|
|
49
|
+
"pending",
|
|
50
|
+
"private",
|
|
51
|
+
"future",
|
|
52
|
+
"trash"
|
|
53
|
+
];
|
|
54
|
+
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
55
|
+
draft: false,
|
|
56
|
+
future: false,
|
|
57
|
+
pending: false,
|
|
58
|
+
private: false,
|
|
59
|
+
publish: false,
|
|
60
|
+
trash: false
|
|
61
|
+
};
|
|
62
|
+
var filterLabels = {
|
|
63
|
+
publish: __("Published", "elementor"),
|
|
64
|
+
draft: __("Drafts", "elementor"),
|
|
65
|
+
pending: __("Pending", "elementor"),
|
|
66
|
+
private: __("Private", "elementor"),
|
|
67
|
+
future: __("Scheduled", "elementor"),
|
|
68
|
+
trash: __("Trash", "elementor")
|
|
69
|
+
};
|
|
70
|
+
var SITE_CONTENT_ALL_FILTER_LABEL = __("All", "elementor");
|
|
71
|
+
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
72
|
+
function getSiteContentStatusFilterLabel(filter) {
|
|
73
|
+
return filterLabels[filter];
|
|
74
|
+
}
|
|
75
|
+
function hasActiveSiteContentStatusFilters(filters) {
|
|
76
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
77
|
+
}
|
|
78
|
+
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
79
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
80
|
+
}
|
|
81
|
+
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
82
|
+
function getRestStatusForSiteContentFilters(filters) {
|
|
83
|
+
if (filters.trash) {
|
|
84
|
+
return "trash";
|
|
85
|
+
}
|
|
86
|
+
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
87
|
+
if (0 === active.length) {
|
|
88
|
+
return "any";
|
|
89
|
+
}
|
|
90
|
+
return active.join(",");
|
|
91
|
+
}
|
|
92
|
+
function isSiteContentTrashFilterActive(filters) {
|
|
93
|
+
return filters.trash;
|
|
94
|
+
}
|
|
95
|
+
function isSiteContentListNarrowed(filters, search) {
|
|
96
|
+
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
97
|
+
}
|
|
98
|
+
function toggleSiteContentStatusFilter(filters, filter) {
|
|
99
|
+
if ("trash" === filter) {
|
|
100
|
+
const isTrashOn = !filters.trash;
|
|
101
|
+
return {
|
|
102
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
103
|
+
trash: isTrashOn
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
...filters,
|
|
108
|
+
trash: false,
|
|
109
|
+
[filter]: !filters[filter]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
113
|
+
if (isSelected) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
if (isLoadingCounts || void 0 === count) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
return count > 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/contexts/content-panel-coordinator.tsx
|
|
42
123
|
var ContentPanelCoordinatorContext = createContext(null);
|
|
43
124
|
function ContentPanelCoordinatorProvider({ children }) {
|
|
44
125
|
const sectionsRef = useRef(/* @__PURE__ */ new Map());
|
|
45
126
|
const [searchQuery, setSearchQuery] = useState("");
|
|
127
|
+
const [statusFilters, setStatusFilters] = useState(
|
|
128
|
+
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
129
|
+
);
|
|
46
130
|
const registerSection = useCallback((type, handlers) => {
|
|
47
131
|
sectionsRef.current.set(type, handlers);
|
|
48
132
|
}, []);
|
|
@@ -57,15 +141,32 @@ function ContentPanelCoordinatorProvider({ children }) {
|
|
|
57
141
|
handlers.setExpanded(true);
|
|
58
142
|
handlers.startCreate();
|
|
59
143
|
}, []);
|
|
144
|
+
const clearStatusFilters = useCallback(() => {
|
|
145
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
146
|
+
}, []);
|
|
147
|
+
const toggleStatusFilter = useCallback((filter) => {
|
|
148
|
+
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
149
|
+
}, []);
|
|
60
150
|
const value = useMemo(
|
|
61
151
|
() => ({
|
|
152
|
+
clearStatusFilters,
|
|
62
153
|
registerSection,
|
|
63
|
-
unregisterSection,
|
|
64
154
|
requestCreate,
|
|
65
155
|
searchQuery,
|
|
66
|
-
setSearchQuery
|
|
156
|
+
setSearchQuery,
|
|
157
|
+
statusFilters,
|
|
158
|
+
toggleStatusFilter,
|
|
159
|
+
unregisterSection
|
|
67
160
|
}),
|
|
68
|
-
[
|
|
161
|
+
[
|
|
162
|
+
clearStatusFilters,
|
|
163
|
+
registerSection,
|
|
164
|
+
requestCreate,
|
|
165
|
+
searchQuery,
|
|
166
|
+
statusFilters,
|
|
167
|
+
toggleStatusFilter,
|
|
168
|
+
unregisterSection
|
|
169
|
+
]
|
|
69
170
|
);
|
|
70
171
|
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
71
172
|
}
|
|
@@ -84,20 +185,20 @@ import { useMemo as useMemo2 } from "react";
|
|
|
84
185
|
|
|
85
186
|
// src/api/post.ts
|
|
86
187
|
import apiFetch from "@wordpress/api-fetch";
|
|
87
|
-
import { __ } from "@wordpress/i18n";
|
|
188
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
88
189
|
var postTypesMap = {
|
|
89
190
|
page: {
|
|
90
191
|
labels: {
|
|
91
|
-
singular_name:
|
|
92
|
-
plural_name:
|
|
192
|
+
singular_name: __2("Page", "elementor"),
|
|
193
|
+
plural_name: __2("Pages", "elementor")
|
|
93
194
|
},
|
|
94
195
|
rest_base: "pages",
|
|
95
196
|
createCapability: "edit_pages"
|
|
96
197
|
},
|
|
97
198
|
post: {
|
|
98
199
|
labels: {
|
|
99
|
-
singular_name:
|
|
100
|
-
plural_name:
|
|
200
|
+
singular_name: __2("Post", "elementor"),
|
|
201
|
+
plural_name: __2("Posts", "elementor")
|
|
101
202
|
},
|
|
102
203
|
rest_base: "posts",
|
|
103
204
|
createCapability: "edit_posts"
|
|
@@ -112,19 +213,20 @@ function getAccessiblePanelPostTypes(capabilities) {
|
|
|
112
213
|
}
|
|
113
214
|
function getCannotEditPanelItemMessage(postTypeSlug) {
|
|
114
215
|
if ("page" === postTypeSlug) {
|
|
115
|
-
return
|
|
216
|
+
return __2("You cannot edit this page.", "elementor");
|
|
116
217
|
}
|
|
117
|
-
return
|
|
218
|
+
return __2("You cannot edit this post.", "elementor");
|
|
118
219
|
}
|
|
119
220
|
var POST_PER_PAGE = 10;
|
|
120
|
-
var
|
|
221
|
+
var COUNT_QUERY_PER_PAGE = 1;
|
|
222
|
+
var getRequest = async (postTypeSlug, page, search = "", status = "any", perPage = POST_PER_PAGE) => {
|
|
121
223
|
const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
122
224
|
const keys = ["id", "type", "title", "link", "status", "user_can"];
|
|
123
225
|
const queryParams = new URLSearchParams({
|
|
124
|
-
status
|
|
226
|
+
status,
|
|
125
227
|
order: "asc",
|
|
126
228
|
page: page.toString(),
|
|
127
|
-
per_page:
|
|
229
|
+
per_page: perPage.toString(),
|
|
128
230
|
_fields: keys.join(",")
|
|
129
231
|
});
|
|
130
232
|
const trimmedSearch = search.trim();
|
|
@@ -160,13 +262,18 @@ var updateRequest = (postTypeSlug, updatedPost) => {
|
|
|
160
262
|
data
|
|
161
263
|
});
|
|
162
264
|
};
|
|
163
|
-
var deleteRequest = (postTypeSlug, postId) => {
|
|
265
|
+
var deleteRequest = (postTypeSlug, postId, force = false) => {
|
|
164
266
|
const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
267
|
+
const forceQuery = force ? "?force=true" : "";
|
|
165
268
|
return apiFetch({
|
|
166
|
-
path: `${path}/${postId}`,
|
|
269
|
+
path: `${path}/${postId}${forceQuery}`,
|
|
167
270
|
method: "DELETE"
|
|
168
271
|
});
|
|
169
272
|
};
|
|
273
|
+
var fetchPostsTotal = async (postTypeSlug, status = "any", search = "") => {
|
|
274
|
+
const response = await getRequest(postTypeSlug, 1, search, status, COUNT_QUERY_PER_PAGE);
|
|
275
|
+
return response.totalPosts;
|
|
276
|
+
};
|
|
170
277
|
var duplicateRequest = (originalPost) => {
|
|
171
278
|
const path = `/elementor/v1/site-navigation/duplicate-post`;
|
|
172
279
|
return apiFetch({
|
|
@@ -235,6 +342,7 @@ function useAccessiblePanelPostTypes() {
|
|
|
235
342
|
var CONTENT_PANEL_INSET_SPACING = 2;
|
|
236
343
|
var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
|
|
237
344
|
var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
|
|
345
|
+
var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = 10;
|
|
238
346
|
var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
|
|
239
347
|
var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
|
|
240
348
|
var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
|
|
@@ -246,6 +354,21 @@ var contentPanelInsetPaddingSx = {
|
|
|
246
354
|
var contentPanelListRowPaddingSx = {
|
|
247
355
|
...contentPanelInsetPaddingSx
|
|
248
356
|
};
|
|
357
|
+
var contentPanelListItemActiveActionsInsetSx = {
|
|
358
|
+
"&& > .MuiListItemButton-root": {
|
|
359
|
+
paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
|
|
360
|
+
paddingRight: "unset"
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
function getContentPanelListItemSx(hasActiveRowActions) {
|
|
364
|
+
if (!hasActiveRowActions) {
|
|
365
|
+
return contentPanelListRowPaddingSx;
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
...contentPanelListRowPaddingSx,
|
|
369
|
+
...contentPanelListItemActiveActionsInsetSx
|
|
370
|
+
};
|
|
371
|
+
}
|
|
249
372
|
var contentPanelHeaderStackSx = {
|
|
250
373
|
width: "100%"
|
|
251
374
|
};
|
|
@@ -287,7 +410,7 @@ var contentPanelListItemButtonSx = {
|
|
|
287
410
|
import * as React3 from "react";
|
|
288
411
|
import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
|
|
289
412
|
import { bindMenu, bindTrigger, ListItemIcon, ListItemText, Menu, MenuItem, usePopupState } from "@elementor/ui";
|
|
290
|
-
import { __ as
|
|
413
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
291
414
|
|
|
292
415
|
// src/hooks/use-can-create.ts
|
|
293
416
|
function useCanCreate(postTypeSlug) {
|
|
@@ -335,43 +458,248 @@ function ContentPanelHeaderAdd() {
|
|
|
335
458
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
336
459
|
ContentPanelAddIconButton,
|
|
337
460
|
{
|
|
338
|
-
"aria-label":
|
|
461
|
+
"aria-label": __3("Add new", "elementor"),
|
|
339
462
|
...buttonProps,
|
|
340
463
|
disabled: !canAddAny
|
|
341
464
|
}
|
|
342
465
|
), /* @__PURE__ */ React3.createElement(Menu, { ...menuProps }, accessibleSlugs.map((slug) => /* @__PURE__ */ React3.createElement(HeaderAddMenuItem, { key: slug, onSelect: handleSelectType, slug }))));
|
|
343
466
|
}
|
|
344
467
|
|
|
345
|
-
// src/components/panel/content-panel-
|
|
468
|
+
// src/components/panel/content-panel-toolbar.tsx
|
|
469
|
+
import * as React9 from "react";
|
|
470
|
+
import { Box as Box3, Stack as Stack3 } from "@elementor/ui";
|
|
471
|
+
|
|
472
|
+
// src/components/panel/content-panel-active-filters.tsx
|
|
473
|
+
import * as React5 from "react";
|
|
474
|
+
import { Chip, Stack } from "@elementor/ui";
|
|
475
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
476
|
+
|
|
477
|
+
// src/components/panel/content-panel-clear-filters-button.tsx
|
|
346
478
|
import * as React4 from "react";
|
|
479
|
+
import { BrushBigIcon } from "@elementor/icons";
|
|
480
|
+
import { Box, IconButton as IconButton2, Tooltip } from "@elementor/ui";
|
|
481
|
+
function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
|
|
482
|
+
return /* @__PURE__ */ React4.createElement(Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React4.createElement(Box, null, /* @__PURE__ */ React4.createElement(IconButton2, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React4.createElement(BrushBigIcon, { fontSize: "tiny" }))));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// src/components/panel/content-panel-active-filters.tsx
|
|
486
|
+
var contentPanelFilterChipSx = {
|
|
487
|
+
"& .MuiChip-deleteIcon": {
|
|
488
|
+
display: "none",
|
|
489
|
+
transition: "opacity 0.2s"
|
|
490
|
+
},
|
|
491
|
+
"&:hover .MuiChip-deleteIcon": {
|
|
492
|
+
display: "block"
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
function ContentPanelActiveFilters() {
|
|
496
|
+
const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
|
|
497
|
+
if (!hasActiveSiteContentStatusFilters(statusFilters)) {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
|
|
501
|
+
return /* @__PURE__ */ React5.createElement(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React5.createElement(Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, activeKeys.map((key) => /* @__PURE__ */ React5.createElement(
|
|
502
|
+
Chip,
|
|
503
|
+
{
|
|
504
|
+
key,
|
|
505
|
+
label: getSiteContentStatusFilterLabel(key),
|
|
506
|
+
onDelete: () => toggleStatusFilter(key),
|
|
507
|
+
size: "tiny",
|
|
508
|
+
sx: contentPanelFilterChipSx
|
|
509
|
+
}
|
|
510
|
+
))), /* @__PURE__ */ React5.createElement(
|
|
511
|
+
ContentPanelClearFiltersButton,
|
|
512
|
+
{
|
|
513
|
+
ariaLabel: __4("Clear Filters", "elementor"),
|
|
514
|
+
onClear: clearStatusFilters,
|
|
515
|
+
sx: { margin: "0 0 auto auto" },
|
|
516
|
+
tooltipText: __4("Clear Filters", "elementor")
|
|
517
|
+
}
|
|
518
|
+
));
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// src/components/panel/content-panel-search.tsx
|
|
522
|
+
import * as React6 from "react";
|
|
347
523
|
import { SearchIcon } from "@elementor/icons";
|
|
348
|
-
import { Box, InputAdornment, TextField } from "@elementor/ui";
|
|
349
|
-
import { __ as
|
|
524
|
+
import { Box as Box2, InputAdornment, TextField } from "@elementor/ui";
|
|
525
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
350
526
|
function ContentPanelSearch() {
|
|
351
527
|
const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
|
|
352
|
-
return /* @__PURE__ */
|
|
528
|
+
return /* @__PURE__ */ React6.createElement(Box2, { component: "search", "aria-label": __5("Search site content", "elementor") }, /* @__PURE__ */ React6.createElement(
|
|
353
529
|
TextField,
|
|
354
530
|
{
|
|
355
531
|
fullWidth: true,
|
|
356
532
|
size: "tiny",
|
|
357
533
|
value: searchQuery,
|
|
358
|
-
placeholder:
|
|
534
|
+
placeholder: __5("Search", "elementor"),
|
|
359
535
|
onChange: (event) => setSearchQuery(event.target.value),
|
|
360
536
|
inputProps: {
|
|
361
|
-
"aria-label":
|
|
537
|
+
"aria-label": __5("Search", "elementor")
|
|
362
538
|
},
|
|
363
539
|
InputProps: {
|
|
364
|
-
startAdornment: /* @__PURE__ */
|
|
540
|
+
startAdornment: /* @__PURE__ */ React6.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React6.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
365
541
|
}
|
|
366
542
|
}
|
|
367
543
|
));
|
|
368
544
|
}
|
|
369
545
|
|
|
546
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
547
|
+
import * as React8 from "react";
|
|
548
|
+
import { PopoverBody, PopoverHeader } from "@elementor/editor-ui";
|
|
549
|
+
import { FilterIcon } from "@elementor/icons";
|
|
550
|
+
import { bindPopover, bindToggle, Divider, Popover, ToggleButton, Tooltip as Tooltip2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
551
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
552
|
+
|
|
553
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
554
|
+
import * as React7 from "react";
|
|
555
|
+
import { CheckIcon } from "@elementor/icons";
|
|
556
|
+
import { MenuItem as MenuItem2, MenuList, Stack as Stack2, Typography } from "@elementor/ui";
|
|
557
|
+
|
|
558
|
+
// src/hooks/use-site-content-status-filter-counts.ts
|
|
559
|
+
import { useQuery as useQuery2 } from "@elementor/query";
|
|
560
|
+
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
561
|
+
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
562
|
+
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
563
|
+
...siteContentStatusFilterCountsQueryKeyBase,
|
|
564
|
+
postTypes.join(",")
|
|
565
|
+
];
|
|
566
|
+
var sumFulfilledTotals = (results) => {
|
|
567
|
+
const fulfilled = results.filter(
|
|
568
|
+
(result) => "fulfilled" === result.status
|
|
569
|
+
);
|
|
570
|
+
if (fulfilled.length !== results.length) {
|
|
571
|
+
return void 0;
|
|
572
|
+
}
|
|
573
|
+
return fulfilled.reduce((sum, result) => sum + result.value, 0);
|
|
574
|
+
};
|
|
575
|
+
var fetchStatusFilterCounts = async (postTypes) => {
|
|
576
|
+
const entries = await Promise.all(
|
|
577
|
+
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
578
|
+
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
579
|
+
const total = sumFulfilledTotals(results);
|
|
580
|
+
if (void 0 === total) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
return [status, total];
|
|
584
|
+
})
|
|
585
|
+
);
|
|
586
|
+
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
587
|
+
};
|
|
588
|
+
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
589
|
+
return useQuery2({
|
|
590
|
+
enabled: enabled && postTypes.length > 0,
|
|
591
|
+
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
592
|
+
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
593
|
+
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
598
|
+
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React7.createElement(Stack2, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React7.createElement(Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React7.createElement(CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
599
|
+
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
600
|
+
const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
|
|
601
|
+
const { accessiblePostTypes } = useAccessiblePanelPostTypes();
|
|
602
|
+
const { data: statusCounts, isPending: isLoadingCounts } = useSiteContentStatusFilterCounts(
|
|
603
|
+
accessiblePostTypes,
|
|
604
|
+
loadCounts
|
|
605
|
+
);
|
|
606
|
+
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
607
|
+
const visibleFilters = SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
608
|
+
(filter) => shouldShowSiteContentStatusFilterRow(statusCounts?.[filter], isLoadingCounts, statusFilters[filter])
|
|
609
|
+
);
|
|
610
|
+
return /* @__PURE__ */ React7.createElement(MenuList, { dense: true }, /* @__PURE__ */ React7.createElement(
|
|
611
|
+
MenuItem2,
|
|
612
|
+
{
|
|
613
|
+
"aria-checked": isAllSelected,
|
|
614
|
+
onClick: clearStatusFilters,
|
|
615
|
+
role: "menuitemcheckbox",
|
|
616
|
+
selected: isAllSelected
|
|
617
|
+
},
|
|
618
|
+
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
619
|
+
), visibleFilters.map((filter) => {
|
|
620
|
+
const isSelected = statusFilters[filter];
|
|
621
|
+
return /* @__PURE__ */ React7.createElement(
|
|
622
|
+
MenuItem2,
|
|
623
|
+
{
|
|
624
|
+
key: filter,
|
|
625
|
+
"aria-checked": isSelected,
|
|
626
|
+
onClick: () => toggleStatusFilter(filter),
|
|
627
|
+
role: "menuitemcheckbox",
|
|
628
|
+
selected: isSelected
|
|
629
|
+
},
|
|
630
|
+
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
631
|
+
);
|
|
632
|
+
}));
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
636
|
+
function ContentPanelStatusFilter() {
|
|
637
|
+
const { clearStatusFilters, statusFilters } = useContentPanelCoordinator();
|
|
638
|
+
const popupState = usePopupState2({
|
|
639
|
+
variant: "popover",
|
|
640
|
+
disableAutoFocus: true
|
|
641
|
+
});
|
|
642
|
+
const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
|
|
643
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(Tooltip2, { placement: "top", title: __6("Filters", "elementor") }, /* @__PURE__ */ React8.createElement(
|
|
644
|
+
ToggleButton,
|
|
645
|
+
{
|
|
646
|
+
"aria-label": __6("Filters", "elementor"),
|
|
647
|
+
selected: popupState.isOpen || hasActiveFilters,
|
|
648
|
+
size: "tiny",
|
|
649
|
+
value: "filter",
|
|
650
|
+
...bindToggle(popupState)
|
|
651
|
+
},
|
|
652
|
+
/* @__PURE__ */ React8.createElement(FilterIcon, { fontSize: "tiny" })
|
|
653
|
+
)), /* @__PURE__ */ React8.createElement(
|
|
654
|
+
Popover,
|
|
655
|
+
{
|
|
656
|
+
anchorOrigin: {
|
|
657
|
+
horizontal: "right",
|
|
658
|
+
vertical: "top"
|
|
659
|
+
},
|
|
660
|
+
sx: {
|
|
661
|
+
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
662
|
+
},
|
|
663
|
+
transformOrigin: {
|
|
664
|
+
horizontal: -21,
|
|
665
|
+
vertical: "top"
|
|
666
|
+
},
|
|
667
|
+
...bindPopover(popupState)
|
|
668
|
+
},
|
|
669
|
+
/* @__PURE__ */ React8.createElement(
|
|
670
|
+
PopoverHeader,
|
|
671
|
+
{
|
|
672
|
+
actions: hasActiveFilters ? [
|
|
673
|
+
/* @__PURE__ */ React8.createElement(
|
|
674
|
+
ContentPanelClearFiltersButton,
|
|
675
|
+
{
|
|
676
|
+
ariaLabel: __6("Clear all", "elementor"),
|
|
677
|
+
key: "clear-all-filters",
|
|
678
|
+
onClear: clearStatusFilters,
|
|
679
|
+
tooltipText: __6("Clear all", "elementor")
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
] : [],
|
|
683
|
+
icon: /* @__PURE__ */ React8.createElement(FilterIcon, { fontSize: "tiny" }),
|
|
684
|
+
onClose: popupState.close,
|
|
685
|
+
title: __6("Filters", "elementor")
|
|
686
|
+
}
|
|
687
|
+
),
|
|
688
|
+
/* @__PURE__ */ React8.createElement(Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
689
|
+
/* @__PURE__ */ React8.createElement(PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React8.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
690
|
+
));
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// src/components/panel/content-panel-toolbar.tsx
|
|
694
|
+
function ContentPanelToolbar() {
|
|
695
|
+
return /* @__PURE__ */ React9.createElement(Box3, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React9.createElement(Stack3, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React9.createElement(Stack3, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React9.createElement(Box3, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React9.createElement(ContentPanelSearch, null)), /* @__PURE__ */ React9.createElement(ContentPanelStatusFilter, null)), /* @__PURE__ */ React9.createElement(ContentPanelActiveFilters, null)));
|
|
696
|
+
}
|
|
697
|
+
|
|
370
698
|
// src/components/panel/error-snackbar.tsx
|
|
371
|
-
import * as
|
|
372
|
-
import { Alert, Snackbar, Typography } from "@elementor/ui";
|
|
699
|
+
import * as React10 from "react";
|
|
700
|
+
import { Alert, Snackbar, Typography as Typography2 } from "@elementor/ui";
|
|
373
701
|
var ErrorSnackbar = ({ open, onClose }) => {
|
|
374
|
-
return /* @__PURE__ */
|
|
702
|
+
return /* @__PURE__ */ React10.createElement(
|
|
375
703
|
Snackbar,
|
|
376
704
|
{
|
|
377
705
|
open,
|
|
@@ -381,8 +709,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
381
709
|
horizontal: "left"
|
|
382
710
|
}
|
|
383
711
|
},
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
|
|
712
|
+
/* @__PURE__ */ React10.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React10.createElement(
|
|
713
|
+
Typography2,
|
|
386
714
|
{
|
|
387
715
|
component: "span",
|
|
388
716
|
sx: {
|
|
@@ -396,11 +724,11 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
396
724
|
var error_snackbar_default = ErrorSnackbar;
|
|
397
725
|
|
|
398
726
|
// src/components/panel/shell-panel-body-content.tsx
|
|
399
|
-
import * as
|
|
400
|
-
import { List as List2, Skeleton as Skeleton2, Stack as
|
|
727
|
+
import * as React33 from "react";
|
|
728
|
+
import { List as List2, Skeleton as Skeleton2, Stack as Stack7 } from "@elementor/ui";
|
|
401
729
|
|
|
402
730
|
// src/contexts/post-list-context.tsx
|
|
403
|
-
import * as
|
|
731
|
+
import * as React11 from "react";
|
|
404
732
|
import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
|
|
405
733
|
var defaultValues = {
|
|
406
734
|
type: "page",
|
|
@@ -419,7 +747,7 @@ var PostListContextProvider = ({
|
|
|
419
747
|
const resetEditMode = () => {
|
|
420
748
|
setEditMode(defaultValues.editMode);
|
|
421
749
|
};
|
|
422
|
-
return /* @__PURE__ */
|
|
750
|
+
return /* @__PURE__ */ React11.createElement(
|
|
423
751
|
PostListContext.Provider,
|
|
424
752
|
{
|
|
425
753
|
value: {
|
|
@@ -442,13 +770,13 @@ function usePostListContext() {
|
|
|
442
770
|
}
|
|
443
771
|
|
|
444
772
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
445
|
-
import * as
|
|
446
|
-
import { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef4, useState as
|
|
447
|
-
import { Box as
|
|
448
|
-
import { __ as
|
|
773
|
+
import * as React31 from "react";
|
|
774
|
+
import { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef4, useState as useState7 } from "react";
|
|
775
|
+
import { Box as Box9, Skeleton, Typography as Typography6 } from "@elementor/ui";
|
|
776
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
449
777
|
|
|
450
778
|
// src/hooks/use-homepage.ts
|
|
451
|
-
import { useQuery as
|
|
779
|
+
import { useQuery as useQuery3 } from "@elementor/query";
|
|
452
780
|
|
|
453
781
|
// src/api/settings.ts
|
|
454
782
|
import apiFetch3 from "@wordpress/api-fetch";
|
|
@@ -468,7 +796,7 @@ var updateSettings = (settings) => {
|
|
|
468
796
|
// src/hooks/use-homepage.ts
|
|
469
797
|
var settingsQueryKey = () => ["site-navigation", "homepage"];
|
|
470
798
|
function useHomepage() {
|
|
471
|
-
return
|
|
799
|
+
return useQuery3({
|
|
472
800
|
queryKey: settingsQueryKey(),
|
|
473
801
|
queryFn: () => getSettings()
|
|
474
802
|
});
|
|
@@ -541,13 +869,11 @@ function usePostListPagination({
|
|
|
541
869
|
// src/hooks/use-posts.ts
|
|
542
870
|
import { keepPreviousData, useInfiniteQuery } from "@elementor/query";
|
|
543
871
|
var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
|
|
544
|
-
var postsQueryKey = (postTypeSlug,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return [...postsQueryKeyBase(postTypeSlug), trimmedSearch];
|
|
550
|
-
};
|
|
872
|
+
var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any") => [
|
|
873
|
+
...postsQueryKeyBase(postTypeSlug),
|
|
874
|
+
restStatus,
|
|
875
|
+
trimmedSearch
|
|
876
|
+
];
|
|
551
877
|
var flattenData = (data) => {
|
|
552
878
|
if (!data) {
|
|
553
879
|
return data;
|
|
@@ -558,11 +884,12 @@ var flattenData = (data) => {
|
|
|
558
884
|
});
|
|
559
885
|
return flattened;
|
|
560
886
|
};
|
|
561
|
-
function usePosts(postTypeSlug, search = "") {
|
|
887
|
+
function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS) {
|
|
562
888
|
const trimmedSearch = search.trim();
|
|
889
|
+
const restStatus = getRestStatusForSiteContentFilters(statusFilters);
|
|
563
890
|
const query = useInfiniteQuery({
|
|
564
|
-
queryKey: postsQueryKey(postTypeSlug, trimmedSearch),
|
|
565
|
-
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch),
|
|
891
|
+
queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus),
|
|
892
|
+
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus),
|
|
566
893
|
initialPageParam: 1,
|
|
567
894
|
getNextPageParam: (lastPage) => {
|
|
568
895
|
return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
|
|
@@ -572,19 +899,38 @@ function usePosts(postTypeSlug, search = "") {
|
|
|
572
899
|
return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
|
|
573
900
|
}
|
|
574
901
|
|
|
902
|
+
// src/hooks/use-posts-baseline-total.ts
|
|
903
|
+
import { useQuery as useQuery4 } from "@elementor/query";
|
|
904
|
+
var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
|
|
905
|
+
"site-navigation",
|
|
906
|
+
"posts-baseline-total",
|
|
907
|
+
postTypeSlug
|
|
908
|
+
];
|
|
909
|
+
var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
|
|
910
|
+
...postsBaselineTotalQueryKeyBase(postTypeSlug),
|
|
911
|
+
status
|
|
912
|
+
];
|
|
913
|
+
function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
914
|
+
return useQuery4({
|
|
915
|
+
enabled,
|
|
916
|
+
queryFn: () => fetchPostsTotal(postTypeSlug, status),
|
|
917
|
+
queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
|
|
575
921
|
// src/components/panel/section-add-button.tsx
|
|
576
|
-
import * as
|
|
577
|
-
import { __ as
|
|
922
|
+
import * as React12 from "react";
|
|
923
|
+
import { __ as __7, sprintf } from "@wordpress/i18n";
|
|
578
924
|
function SectionAddButton({ onBeforeCreate }) {
|
|
579
925
|
const { type, setEditMode } = usePostListContext();
|
|
580
926
|
const canCreate = useCanCreate(type);
|
|
581
927
|
const singularName = postTypesMap[type].labels.singular_name;
|
|
582
928
|
const ariaLabel = sprintf(
|
|
583
929
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
584
|
-
|
|
930
|
+
__7("New %s", "elementor"),
|
|
585
931
|
singularName
|
|
586
932
|
);
|
|
587
|
-
return /* @__PURE__ */
|
|
933
|
+
return /* @__PURE__ */ React12.createElement(
|
|
588
934
|
ContentPanelAddIconButton,
|
|
589
935
|
{
|
|
590
936
|
"aria-label": ariaLabel,
|
|
@@ -599,10 +945,10 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
599
945
|
}
|
|
600
946
|
|
|
601
947
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
602
|
-
import * as
|
|
948
|
+
import * as React13 from "react";
|
|
603
949
|
import { useId } from "react";
|
|
604
950
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
605
|
-
import { Box as
|
|
951
|
+
import { Box as Box4, Chip as Chip2, Collapse, Divider as Divider2, List, ListItemButton, ListItemText as ListItemText2, Stack as Stack4 } from "@elementor/ui";
|
|
606
952
|
var sectionHeaderListItemButtonSx = {
|
|
607
953
|
flexGrow: 1,
|
|
608
954
|
justifyContent: "flex-start",
|
|
@@ -612,11 +958,12 @@ var sectionHeaderListItemButtonSx = {
|
|
|
612
958
|
"&:hover": { backgroundColor: "transparent" },
|
|
613
959
|
"&.Mui-focusVisible": { backgroundColor: "transparent" }
|
|
614
960
|
};
|
|
615
|
-
function getSectionHeaderAriaLabel(title,
|
|
616
|
-
return `${title} (${
|
|
961
|
+
function getSectionHeaderAriaLabel(title, countLabel) {
|
|
962
|
+
return `${title} (${countLabel})`;
|
|
617
963
|
}
|
|
618
964
|
function CollapsibleList({
|
|
619
965
|
count,
|
|
966
|
+
countChipLabel,
|
|
620
967
|
headerRef,
|
|
621
968
|
isOpen,
|
|
622
969
|
onOpenChange,
|
|
@@ -627,10 +974,11 @@ function CollapsibleList({
|
|
|
627
974
|
const id = useId();
|
|
628
975
|
const labelId = `label-${id}`;
|
|
629
976
|
const contentId = `content-${id}`;
|
|
630
|
-
const
|
|
977
|
+
const chipLabel = countChipLabel ?? count.toString();
|
|
978
|
+
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
|
|
631
979
|
const handleClick = () => onOpenChange(!isOpen);
|
|
632
|
-
return /* @__PURE__ */
|
|
633
|
-
|
|
980
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
981
|
+
Box4,
|
|
634
982
|
{
|
|
635
983
|
sx: {
|
|
636
984
|
...contentPanelSectionHeaderSx,
|
|
@@ -640,7 +988,7 @@ function CollapsibleList({
|
|
|
640
988
|
width: "100%"
|
|
641
989
|
}
|
|
642
990
|
},
|
|
643
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ React13.createElement(
|
|
644
992
|
ListItemButton,
|
|
645
993
|
{
|
|
646
994
|
ref: headerRef,
|
|
@@ -654,7 +1002,7 @@ function CollapsibleList({
|
|
|
654
1002
|
onClick: handleClick,
|
|
655
1003
|
sx: sectionHeaderListItemButtonSx
|
|
656
1004
|
},
|
|
657
|
-
/* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ React13.createElement(Stack4, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(Stack4, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React13.createElement(
|
|
658
1006
|
ListItemText2,
|
|
659
1007
|
{
|
|
660
1008
|
secondary: title,
|
|
@@ -665,10 +1013,10 @@ function CollapsibleList({
|
|
|
665
1013
|
},
|
|
666
1014
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
667
1015
|
}
|
|
668
|
-
), /* @__PURE__ */
|
|
1016
|
+
), /* @__PURE__ */ React13.createElement(Chip2, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React13.createElement(CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
|
|
669
1017
|
),
|
|
670
|
-
trailingActions && /* @__PURE__ */
|
|
671
|
-
|
|
1018
|
+
trailingActions && /* @__PURE__ */ React13.createElement(
|
|
1019
|
+
Stack4,
|
|
672
1020
|
{
|
|
673
1021
|
alignItems: "center",
|
|
674
1022
|
direction: "row",
|
|
@@ -678,17 +1026,17 @@ function CollapsibleList({
|
|
|
678
1026
|
},
|
|
679
1027
|
trailingActions
|
|
680
1028
|
)
|
|
681
|
-
), /* @__PURE__ */
|
|
1029
|
+
), /* @__PURE__ */ React13.createElement(Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React13.createElement(List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React13.createElement(Divider2, null));
|
|
682
1030
|
}
|
|
683
1031
|
|
|
684
1032
|
// src/components/panel/posts-list/error-state.tsx
|
|
685
|
-
import * as
|
|
1033
|
+
import * as React14 from "react";
|
|
686
1034
|
import { Error404TemplateIcon } from "@elementor/icons";
|
|
687
|
-
import { Box as
|
|
688
|
-
import { __ as
|
|
1035
|
+
import { Box as Box5, Link, Typography as Typography3 } from "@elementor/ui";
|
|
1036
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
689
1037
|
function ErrorState() {
|
|
690
|
-
return /* @__PURE__ */
|
|
691
|
-
|
|
1038
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1039
|
+
Box5,
|
|
692
1040
|
{
|
|
693
1041
|
sx: {
|
|
694
1042
|
display: "flex",
|
|
@@ -699,9 +1047,9 @@ function ErrorState() {
|
|
|
699
1047
|
gap: "16px"
|
|
700
1048
|
}
|
|
701
1049
|
},
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
|
|
1050
|
+
/* @__PURE__ */ React14.createElement(Error404TemplateIcon, null),
|
|
1051
|
+
/* @__PURE__ */ React14.createElement(
|
|
1052
|
+
Box5,
|
|
705
1053
|
{
|
|
706
1054
|
sx: {
|
|
707
1055
|
display: "flex",
|
|
@@ -711,25 +1059,28 @@ function ErrorState() {
|
|
|
711
1059
|
gap: "8px"
|
|
712
1060
|
}
|
|
713
1061
|
},
|
|
714
|
-
/* @__PURE__ */
|
|
715
|
-
/* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ React14.createElement(Typography3, { variant: "body1", color: "text.primary" }, __8("We couldn\u2019t display your pages.", "elementor")),
|
|
1063
|
+
/* @__PURE__ */ React14.createElement(Box5, null, /* @__PURE__ */ React14.createElement(Typography3, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __8("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React14.createElement(Typography3, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __8("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React14.createElement(Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
|
|
716
1064
|
)
|
|
717
1065
|
);
|
|
718
1066
|
}
|
|
719
1067
|
|
|
720
1068
|
// src/components/panel/posts-list/post-list-item.tsx
|
|
721
|
-
import * as
|
|
1069
|
+
import * as React29 from "react";
|
|
722
1070
|
|
|
723
1071
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
724
|
-
import * as
|
|
1072
|
+
import * as React16 from "react";
|
|
725
1073
|
import { __useNavigateToDocument as useNavigateToDocument } from "@elementor/editor-documents";
|
|
726
|
-
import { __ as
|
|
1074
|
+
import { __ as __10, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
727
1075
|
|
|
728
1076
|
// src/hooks/use-posts-actions.ts
|
|
729
1077
|
import { useMutation, useQueryClient } from "@elementor/query";
|
|
730
1078
|
|
|
1079
|
+
// src/site-content-restore.ts
|
|
1080
|
+
var SITE_CONTENT_V1_RESTORE_STATUS = "draft";
|
|
1081
|
+
|
|
731
1082
|
// src/hooks/use-recent-posts.ts
|
|
732
|
-
import { useQuery as
|
|
1083
|
+
import { useQuery as useQuery5 } from "@elementor/query";
|
|
733
1084
|
|
|
734
1085
|
// src/api/recent-posts.ts
|
|
735
1086
|
import apiFetch4 from "@wordpress/api-fetch";
|
|
@@ -746,7 +1097,7 @@ var getRequest2 = () => {
|
|
|
746
1097
|
// src/hooks/use-recent-posts.ts
|
|
747
1098
|
var recentPostsQueryKey = ["site-navigation", "recent-posts"];
|
|
748
1099
|
function useRecentPosts() {
|
|
749
|
-
return
|
|
1100
|
+
return useQuery5({
|
|
750
1101
|
queryKey: recentPostsQueryKey,
|
|
751
1102
|
queryFn: () => getRequest2()
|
|
752
1103
|
});
|
|
@@ -768,15 +1119,25 @@ function usePostActions(postTypeSlug) {
|
|
|
768
1119
|
mutationFn: (postId) => deleteRequest(postTypeSlug, postId),
|
|
769
1120
|
onSuccess
|
|
770
1121
|
});
|
|
1122
|
+
const forceDeletePost = useMutation({
|
|
1123
|
+
mutationFn: (postId) => deleteRequest(postTypeSlug, postId, true),
|
|
1124
|
+
onSuccess
|
|
1125
|
+
});
|
|
1126
|
+
const restorePost = useMutation({
|
|
1127
|
+
mutationFn: (postId) => updateRequest(postTypeSlug, { id: postId, status: SITE_CONTENT_V1_RESTORE_STATUS }),
|
|
1128
|
+
onSuccess
|
|
1129
|
+
});
|
|
771
1130
|
const duplicatePost = useMutation({
|
|
772
1131
|
mutationFn: (originalPost) => duplicateRequest(originalPost),
|
|
773
1132
|
onSuccess
|
|
774
1133
|
});
|
|
775
1134
|
return {
|
|
776
1135
|
createPost,
|
|
777
|
-
updatePost,
|
|
778
1136
|
deletePost,
|
|
779
|
-
duplicatePost
|
|
1137
|
+
duplicatePost,
|
|
1138
|
+
forceDeletePost,
|
|
1139
|
+
restorePost,
|
|
1140
|
+
updatePost
|
|
780
1141
|
};
|
|
781
1142
|
}
|
|
782
1143
|
function useInvalidatePosts(postTypeSlug) {
|
|
@@ -784,16 +1145,18 @@ function useInvalidatePosts(postTypeSlug) {
|
|
|
784
1145
|
return () => {
|
|
785
1146
|
const queryKey = postsQueryKeyBase(postTypeSlug);
|
|
786
1147
|
queryClient.invalidateQueries({ queryKey: recentPostsQueryKey });
|
|
1148
|
+
queryClient.invalidateQueries({ queryKey: postsBaselineTotalQueryKeyBase(postTypeSlug) });
|
|
1149
|
+
queryClient.invalidateQueries({ queryKey: siteContentStatusFilterCountsQueryKeyBase });
|
|
787
1150
|
return queryClient.invalidateQueries({ queryKey });
|
|
788
1151
|
};
|
|
789
1152
|
}
|
|
790
1153
|
|
|
791
1154
|
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
792
|
-
import * as
|
|
1155
|
+
import * as React15 from "react";
|
|
793
1156
|
import { useRef as useRef3, useState as useState4 } from "react";
|
|
794
1157
|
import { XIcon } from "@elementor/icons";
|
|
795
|
-
import { Box as
|
|
796
|
-
import { __ as
|
|
1158
|
+
import { Box as Box6, CircularProgress, IconButton as IconButton3, ListItem, ListItemText as ListItemText3 } from "@elementor/ui";
|
|
1159
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
797
1160
|
var EDIT_ROW_FOCUS_BORDER_WIDTH_PX = 2;
|
|
798
1161
|
var EDIT_ROW_MIN_HEIGHT_PX = 36;
|
|
799
1162
|
var editModeListItemButtonSx = {
|
|
@@ -865,32 +1228,32 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
|
865
1228
|
}
|
|
866
1229
|
const value = e.target.value;
|
|
867
1230
|
if (!validateInput(value)) {
|
|
868
|
-
setInputError(
|
|
1231
|
+
setInputError(__9("Name is required", "elementor"));
|
|
869
1232
|
} else {
|
|
870
1233
|
setInputError(null);
|
|
871
1234
|
}
|
|
872
1235
|
setTitle(value);
|
|
873
1236
|
};
|
|
874
|
-
return /* @__PURE__ */
|
|
1237
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
875
1238
|
ListItem,
|
|
876
1239
|
{
|
|
877
1240
|
disablePadding: true,
|
|
878
1241
|
sx: contentPanelListRowPaddingSx,
|
|
879
|
-
secondaryAction: /* @__PURE__ */
|
|
1242
|
+
secondaryAction: /* @__PURE__ */ React15.createElement(CloseButton, { isLoading, closeButton })
|
|
880
1243
|
},
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
|
|
1244
|
+
/* @__PURE__ */ React15.createElement(
|
|
1245
|
+
Box6,
|
|
883
1246
|
{
|
|
884
1247
|
component: "form",
|
|
885
1248
|
onSubmit: onFormSubmit,
|
|
886
1249
|
sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
|
|
887
1250
|
},
|
|
888
|
-
/* @__PURE__ */
|
|
889
|
-
|
|
1251
|
+
/* @__PURE__ */ React15.createElement(Box6, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React15.createElement(
|
|
1252
|
+
Box6,
|
|
890
1253
|
{
|
|
891
1254
|
autoFocus: true,
|
|
892
1255
|
"aria-invalid": !!inputError,
|
|
893
|
-
"aria-label":
|
|
1256
|
+
"aria-label": __9("Name", "elementor"),
|
|
894
1257
|
component: "input",
|
|
895
1258
|
disabled: isLoading,
|
|
896
1259
|
onBlur,
|
|
@@ -901,11 +1264,11 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
|
901
1264
|
}
|
|
902
1265
|
))
|
|
903
1266
|
)
|
|
904
|
-
), inputError && /* @__PURE__ */
|
|
1267
|
+
), inputError && /* @__PURE__ */ React15.createElement(ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React15.createElement(ListItemText3, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
|
|
905
1268
|
}
|
|
906
1269
|
function CloseButton({ isLoading, closeButton }) {
|
|
907
1270
|
const { resetEditMode } = usePostListContext();
|
|
908
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ React15.createElement(IconButton3, { size: "tiny", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React15.createElement(CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React15.createElement(XIcon, { fontSize: "tiny" }));
|
|
909
1272
|
}
|
|
910
1273
|
|
|
911
1274
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
@@ -929,10 +1292,10 @@ function ListItemCreate() {
|
|
|
929
1292
|
};
|
|
930
1293
|
const newItemLabel = sprintf2(
|
|
931
1294
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
932
|
-
|
|
1295
|
+
__10("New %s", "elementor"),
|
|
933
1296
|
postTypesMap[type].labels.singular_name
|
|
934
1297
|
);
|
|
935
|
-
return /* @__PURE__ */
|
|
1298
|
+
return /* @__PURE__ */ React16.createElement(
|
|
936
1299
|
EditModeTemplate,
|
|
937
1300
|
{
|
|
938
1301
|
postTitle: newItemLabel,
|
|
@@ -943,9 +1306,9 @@ function ListItemCreate() {
|
|
|
943
1306
|
}
|
|
944
1307
|
|
|
945
1308
|
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx
|
|
946
|
-
import * as
|
|
1309
|
+
import * as React17 from "react";
|
|
947
1310
|
import { __useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
|
|
948
|
-
import { __ as
|
|
1311
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
949
1312
|
function ListItemDuplicate() {
|
|
950
1313
|
const { type, editMode, resetEditMode } = usePostListContext();
|
|
951
1314
|
const navigateToDocument = useNavigateToDocument2();
|
|
@@ -967,10 +1330,10 @@ function ListItemDuplicate() {
|
|
|
967
1330
|
resetEditMode();
|
|
968
1331
|
}
|
|
969
1332
|
};
|
|
970
|
-
return /* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ React17.createElement(
|
|
971
1334
|
EditModeTemplate,
|
|
972
1335
|
{
|
|
973
|
-
postTitle: `${editMode.details.title} ${
|
|
1336
|
+
postTitle: `${editMode.details.title} ${__11("copy", "elementor")}`,
|
|
974
1337
|
isLoading: duplicatePost.isPending,
|
|
975
1338
|
callback: duplicatePostCallback
|
|
976
1339
|
}
|
|
@@ -978,7 +1341,7 @@ function ListItemDuplicate() {
|
|
|
978
1341
|
}
|
|
979
1342
|
|
|
980
1343
|
// src/components/panel/posts-list/list-items/list-item-rename.tsx
|
|
981
|
-
import * as
|
|
1344
|
+
import * as React18 from "react";
|
|
982
1345
|
import { __useActiveDocument as useActiveDocument } from "@elementor/editor-documents";
|
|
983
1346
|
|
|
984
1347
|
// src/hooks/use-rename-active-document.ts
|
|
@@ -1029,11 +1392,11 @@ function ListItemRename({ post }) {
|
|
|
1029
1392
|
resetEditMode();
|
|
1030
1393
|
}
|
|
1031
1394
|
};
|
|
1032
|
-
return /* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ React18.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
|
|
1033
1396
|
}
|
|
1034
1397
|
|
|
1035
1398
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1036
|
-
import * as
|
|
1399
|
+
import * as React28 from "react";
|
|
1037
1400
|
import {
|
|
1038
1401
|
__useActiveDocument as useActiveDocument3,
|
|
1039
1402
|
__useNavigateToDocument as useNavigateToDocument3
|
|
@@ -1042,22 +1405,23 @@ import { DotsVerticalIcon, HomeIcon as HomeIcon2 } from "@elementor/icons";
|
|
|
1042
1405
|
import {
|
|
1043
1406
|
bindMenu as bindMenu2,
|
|
1044
1407
|
bindTrigger as bindTrigger2,
|
|
1045
|
-
Divider as
|
|
1046
|
-
IconButton as
|
|
1408
|
+
Divider as Divider5,
|
|
1409
|
+
IconButton as IconButton4,
|
|
1047
1410
|
ListItem as ListItem2,
|
|
1048
1411
|
ListItemButton as ListItemButton2,
|
|
1049
1412
|
ListItemText as ListItemText5,
|
|
1050
1413
|
Menu as Menu2,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1414
|
+
Stack as Stack5,
|
|
1415
|
+
Tooltip as Tooltip3,
|
|
1416
|
+
Typography as Typography5,
|
|
1417
|
+
usePopupState as usePopupState3
|
|
1054
1418
|
} from "@elementor/ui";
|
|
1055
|
-
import { __ as
|
|
1419
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
1056
1420
|
|
|
1057
1421
|
// src/components/shared/page-title-and-status.tsx
|
|
1058
|
-
import * as
|
|
1059
|
-
import { Box as
|
|
1060
|
-
import { __ as
|
|
1422
|
+
import * as React19 from "react";
|
|
1423
|
+
import { Box as Box7, Chip as Chip3, Typography as Typography4 } from "@elementor/ui";
|
|
1424
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1061
1425
|
|
|
1062
1426
|
// src/hooks/use-reverse-html-entities.ts
|
|
1063
1427
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -1084,19 +1448,19 @@ function humanizeStatusSlug(status) {
|
|
|
1084
1448
|
var statusChipConfig = {
|
|
1085
1449
|
draft: {
|
|
1086
1450
|
color: "default",
|
|
1087
|
-
label:
|
|
1451
|
+
label: __12("Draft", "elementor")
|
|
1088
1452
|
},
|
|
1089
1453
|
future: {
|
|
1090
1454
|
color: "default",
|
|
1091
|
-
label:
|
|
1455
|
+
label: __12("Scheduled", "elementor")
|
|
1092
1456
|
},
|
|
1093
1457
|
pending: {
|
|
1094
1458
|
color: "warning",
|
|
1095
|
-
label:
|
|
1459
|
+
label: __12("Pending Review", "elementor")
|
|
1096
1460
|
},
|
|
1097
1461
|
private: {
|
|
1098
1462
|
color: "default",
|
|
1099
|
-
label:
|
|
1463
|
+
label: __12("Private", "elementor")
|
|
1100
1464
|
}
|
|
1101
1465
|
};
|
|
1102
1466
|
function getStatusChipConfig(status) {
|
|
@@ -1118,8 +1482,8 @@ var PageStatus = ({ status }) => {
|
|
|
1118
1482
|
}
|
|
1119
1483
|
const { color, label } = getStatusChipConfig(status);
|
|
1120
1484
|
const isKnownStatus = isKnownPanelStatus(status);
|
|
1121
|
-
return /* @__PURE__ */
|
|
1122
|
-
|
|
1485
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1486
|
+
Chip3,
|
|
1123
1487
|
{
|
|
1124
1488
|
color,
|
|
1125
1489
|
component: "span",
|
|
@@ -1143,8 +1507,8 @@ var PageStatus = ({ status }) => {
|
|
|
1143
1507
|
};
|
|
1144
1508
|
var PageTitle = ({ title }) => {
|
|
1145
1509
|
const modifiedTitle = useReverseHtmlEntities(title);
|
|
1146
|
-
return /* @__PURE__ */
|
|
1147
|
-
|
|
1510
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1511
|
+
Typography4,
|
|
1148
1512
|
{
|
|
1149
1513
|
component: "span",
|
|
1150
1514
|
variant: "body2",
|
|
@@ -1152,18 +1516,20 @@ var PageTitle = ({ title }) => {
|
|
|
1152
1516
|
noWrap: true,
|
|
1153
1517
|
sx: {
|
|
1154
1518
|
...contentPanelListRowTitleSx,
|
|
1155
|
-
|
|
1519
|
+
flex: 1,
|
|
1520
|
+
flexBasis: "auto",
|
|
1521
|
+
minWidth: 0
|
|
1156
1522
|
}
|
|
1157
1523
|
},
|
|
1158
1524
|
modifiedTitle
|
|
1159
1525
|
);
|
|
1160
1526
|
};
|
|
1161
1527
|
function PageTitleAndStatus({ title, status }) {
|
|
1162
|
-
return /* @__PURE__ */
|
|
1528
|
+
return /* @__PURE__ */ React19.createElement(Box7, { alignItems: "center", display: "flex", minWidth: 0 }, /* @__PURE__ */ React19.createElement(PageTitle, { title }), /* @__PURE__ */ React19.createElement(PageStatus, { status }));
|
|
1163
1529
|
}
|
|
1164
1530
|
|
|
1165
1531
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
1166
|
-
import * as
|
|
1532
|
+
import * as React21 from "react";
|
|
1167
1533
|
import { useState as useState5 } from "react";
|
|
1168
1534
|
import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
|
|
1169
1535
|
import { TrashIcon } from "@elementor/icons";
|
|
@@ -1175,23 +1541,23 @@ import {
|
|
|
1175
1541
|
DialogContent,
|
|
1176
1542
|
DialogContentText,
|
|
1177
1543
|
DialogTitle,
|
|
1178
|
-
Divider as
|
|
1544
|
+
Divider as Divider3
|
|
1179
1545
|
} from "@elementor/ui";
|
|
1180
|
-
import { __ as
|
|
1546
|
+
import { __ as __13, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
1181
1547
|
|
|
1182
1548
|
// src/components/panel/actions-menu/action-menu-item.tsx
|
|
1183
|
-
import * as
|
|
1184
|
-
import { ListItemIcon as ListItemIcon2, ListItemText as ListItemText4, MenuItem as
|
|
1185
|
-
function ActionMenuItem({
|
|
1186
|
-
return /* @__PURE__ */
|
|
1549
|
+
import * as React20 from "react";
|
|
1550
|
+
import { ListItemIcon as ListItemIcon2, ListItemText as ListItemText4, MenuItem as MenuItem3 } from "@elementor/ui";
|
|
1551
|
+
function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
|
|
1552
|
+
return /* @__PURE__ */ React20.createElement(MenuItem3, { ...MenuItemProps }, /* @__PURE__ */ React20.createElement(
|
|
1187
1553
|
ListItemIcon2,
|
|
1188
1554
|
{
|
|
1189
1555
|
sx: {
|
|
1190
1556
|
color: "inherit"
|
|
1191
1557
|
}
|
|
1192
1558
|
},
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
), /* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ React20.createElement(Icon, null)
|
|
1560
|
+
), /* @__PURE__ */ React20.createElement(ListItemText4, { primary: title, secondary: description }));
|
|
1195
1561
|
}
|
|
1196
1562
|
|
|
1197
1563
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
@@ -1201,10 +1567,10 @@ function Delete({ post }) {
|
|
|
1201
1567
|
const isPostActive = activeDocument?.id === post.id;
|
|
1202
1568
|
const userCanDelete = post.user_can.delete;
|
|
1203
1569
|
const isDisabled = !userCanDelete || post.isHome || isPostActive;
|
|
1204
|
-
return /* @__PURE__ */
|
|
1570
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1205
1571
|
ActionMenuItem,
|
|
1206
1572
|
{
|
|
1207
|
-
title:
|
|
1573
|
+
title: __13("Delete", "elementor"),
|
|
1208
1574
|
icon: TrashIcon,
|
|
1209
1575
|
MenuItemProps: {
|
|
1210
1576
|
disabled: isDisabled,
|
|
@@ -1212,7 +1578,7 @@ function Delete({ post }) {
|
|
|
1212
1578
|
sx: { "&:hover": { color: "error.main" } }
|
|
1213
1579
|
}
|
|
1214
1580
|
}
|
|
1215
|
-
), isDialogOpen && /* @__PURE__ */
|
|
1581
|
+
), isDialogOpen && /* @__PURE__ */ React21.createElement(DeleteDialog, { post, setIsDialogOpen }));
|
|
1216
1582
|
}
|
|
1217
1583
|
function DeleteDialog({
|
|
1218
1584
|
post,
|
|
@@ -1221,11 +1587,11 @@ function DeleteDialog({
|
|
|
1221
1587
|
const { type } = usePostListContext();
|
|
1222
1588
|
const { deletePost } = usePostActions(type);
|
|
1223
1589
|
const { setError } = usePostListContext();
|
|
1224
|
-
const dialogTitle = sprintf3(
|
|
1225
|
-
const dialogBody = type === "post" ?
|
|
1590
|
+
const dialogTitle = sprintf3(__13('Delete "%s"?', "elementor"), post.title.rendered);
|
|
1591
|
+
const dialogBody = type === "post" ? __13(
|
|
1226
1592
|
"The post and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1227
1593
|
"elementor"
|
|
1228
|
-
) :
|
|
1594
|
+
) : __13(
|
|
1229
1595
|
"The page and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1230
1596
|
"elementor"
|
|
1231
1597
|
);
|
|
@@ -1243,7 +1609,7 @@ function DeleteDialog({
|
|
|
1243
1609
|
}
|
|
1244
1610
|
setIsDialogOpen(false);
|
|
1245
1611
|
};
|
|
1246
|
-
return /* @__PURE__ */
|
|
1612
|
+
return /* @__PURE__ */ React21.createElement(Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React21.createElement(DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React21.createElement(Divider3, null), /* @__PURE__ */ React21.createElement(DialogContent, null, /* @__PURE__ */ React21.createElement(DialogContentText, null, dialogBody)), /* @__PURE__ */ React21.createElement(DialogActions, null, /* @__PURE__ */ React21.createElement(
|
|
1247
1613
|
Button,
|
|
1248
1614
|
{
|
|
1249
1615
|
variant: "contained",
|
|
@@ -1251,14 +1617,14 @@ function DeleteDialog({
|
|
|
1251
1617
|
onClick: handleCancel,
|
|
1252
1618
|
disabled: deletePost.isPending
|
|
1253
1619
|
},
|
|
1254
|
-
|
|
1255
|
-
), /* @__PURE__ */
|
|
1620
|
+
__13("Cancel", "elementor")
|
|
1621
|
+
), /* @__PURE__ */ React21.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __13("Delete", "elementor") : /* @__PURE__ */ React21.createElement(CircularProgress2, null))));
|
|
1256
1622
|
}
|
|
1257
1623
|
|
|
1258
1624
|
// src/components/panel/actions-menu/actions/duplicate.tsx
|
|
1259
|
-
import * as
|
|
1625
|
+
import * as React22 from "react";
|
|
1260
1626
|
import { CopyIcon } from "@elementor/icons";
|
|
1261
|
-
import { __ as
|
|
1627
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
1262
1628
|
function Duplicate({ post, popupState }) {
|
|
1263
1629
|
const { setEditMode, type } = usePostListContext();
|
|
1264
1630
|
const canCreate = useCanCreate(type);
|
|
@@ -1273,10 +1639,10 @@ function Duplicate({ post, popupState }) {
|
|
|
1273
1639
|
});
|
|
1274
1640
|
};
|
|
1275
1641
|
const isDisabled = !canCreate;
|
|
1276
|
-
return /* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ React22.createElement(
|
|
1277
1643
|
ActionMenuItem,
|
|
1278
1644
|
{
|
|
1279
|
-
title:
|
|
1645
|
+
title: __14("Duplicate", "elementor"),
|
|
1280
1646
|
icon: CopyIcon,
|
|
1281
1647
|
MenuItemProps: {
|
|
1282
1648
|
disabled: isDisabled,
|
|
@@ -1286,16 +1652,90 @@ function Duplicate({ post, popupState }) {
|
|
|
1286
1652
|
);
|
|
1287
1653
|
}
|
|
1288
1654
|
|
|
1655
|
+
// src/components/panel/actions-menu/actions/force-delete.tsx
|
|
1656
|
+
import * as React23 from "react";
|
|
1657
|
+
import { useState as useState6 } from "react";
|
|
1658
|
+
import { TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
1659
|
+
import {
|
|
1660
|
+
Button as Button2,
|
|
1661
|
+
CircularProgress as CircularProgress3,
|
|
1662
|
+
Dialog as Dialog2,
|
|
1663
|
+
DialogActions as DialogActions2,
|
|
1664
|
+
DialogContent as DialogContent2,
|
|
1665
|
+
DialogContentText as DialogContentText2,
|
|
1666
|
+
DialogTitle as DialogTitle2,
|
|
1667
|
+
Divider as Divider4
|
|
1668
|
+
} from "@elementor/ui";
|
|
1669
|
+
import { __ as __15, sprintf as sprintf4 } from "@wordpress/i18n";
|
|
1670
|
+
function ForceDelete({ post }) {
|
|
1671
|
+
const [isDialogOpen, setIsDialogOpen] = useState6(false);
|
|
1672
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(
|
|
1673
|
+
ActionMenuItem,
|
|
1674
|
+
{
|
|
1675
|
+
icon: TrashIcon2,
|
|
1676
|
+
MenuItemProps: {
|
|
1677
|
+
disabled: !post.user_can.delete,
|
|
1678
|
+
onClick: () => setIsDialogOpen(true),
|
|
1679
|
+
sx: { "&:hover": { color: "error.main" } }
|
|
1680
|
+
},
|
|
1681
|
+
title: __15("Delete permanently", "elementor")
|
|
1682
|
+
}
|
|
1683
|
+
), isDialogOpen && /* @__PURE__ */ React23.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
|
|
1684
|
+
}
|
|
1685
|
+
function ForceDeleteDialog({
|
|
1686
|
+
post,
|
|
1687
|
+
setIsDialogOpen
|
|
1688
|
+
}) {
|
|
1689
|
+
const { setError, type } = usePostListContext();
|
|
1690
|
+
const { forceDeletePost } = usePostActions(type);
|
|
1691
|
+
const dialogTitle = sprintf4(__15('Delete "%s" permanently?', "elementor"), post.title.rendered);
|
|
1692
|
+
const dialogBody = __15("This will permanently delete the item. You cannot undo this action.", "elementor");
|
|
1693
|
+
const handleDelete = async () => {
|
|
1694
|
+
try {
|
|
1695
|
+
await forceDeletePost.mutateAsync(post.id);
|
|
1696
|
+
setIsDialogOpen(false);
|
|
1697
|
+
} catch {
|
|
1698
|
+
setError();
|
|
1699
|
+
setIsDialogOpen(false);
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
const handleCancel = () => {
|
|
1703
|
+
if (forceDeletePost.isPending) {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
setIsDialogOpen(false);
|
|
1707
|
+
};
|
|
1708
|
+
return /* @__PURE__ */ React23.createElement(Dialog2, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React23.createElement(DialogTitle2, { noWrap: true }, dialogTitle), /* @__PURE__ */ React23.createElement(Divider4, null), /* @__PURE__ */ React23.createElement(DialogContent2, null, /* @__PURE__ */ React23.createElement(DialogContentText2, null, dialogBody)), /* @__PURE__ */ React23.createElement(DialogActions2, null, /* @__PURE__ */ React23.createElement(
|
|
1709
|
+
Button2,
|
|
1710
|
+
{
|
|
1711
|
+
variant: "contained",
|
|
1712
|
+
color: "secondary",
|
|
1713
|
+
onClick: handleCancel,
|
|
1714
|
+
disabled: forceDeletePost.isPending
|
|
1715
|
+
},
|
|
1716
|
+
__15("Cancel", "elementor")
|
|
1717
|
+
), /* @__PURE__ */ React23.createElement(
|
|
1718
|
+
Button2,
|
|
1719
|
+
{
|
|
1720
|
+
variant: "contained",
|
|
1721
|
+
color: "error",
|
|
1722
|
+
onClick: () => void handleDelete(),
|
|
1723
|
+
disabled: forceDeletePost.isPending
|
|
1724
|
+
},
|
|
1725
|
+
!forceDeletePost.isPending ? __15("Delete permanently", "elementor") : /* @__PURE__ */ React23.createElement(CircularProgress3, null)
|
|
1726
|
+
)));
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1289
1729
|
// src/components/panel/actions-menu/actions/rename.tsx
|
|
1290
|
-
import * as
|
|
1730
|
+
import * as React24 from "react";
|
|
1291
1731
|
import { EraseIcon } from "@elementor/icons";
|
|
1292
|
-
import { __ as
|
|
1732
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
1293
1733
|
function Rename({ post }) {
|
|
1294
1734
|
const { setEditMode } = usePostListContext();
|
|
1295
|
-
return /* @__PURE__ */
|
|
1735
|
+
return /* @__PURE__ */ React24.createElement(
|
|
1296
1736
|
ActionMenuItem,
|
|
1297
1737
|
{
|
|
1298
|
-
title:
|
|
1738
|
+
title: __16("Rename", "elementor"),
|
|
1299
1739
|
icon: EraseIcon,
|
|
1300
1740
|
MenuItemProps: {
|
|
1301
1741
|
disabled: !post.user_can.edit,
|
|
@@ -1312,11 +1752,39 @@ function Rename({ post }) {
|
|
|
1312
1752
|
);
|
|
1313
1753
|
}
|
|
1314
1754
|
|
|
1755
|
+
// src/components/panel/actions-menu/actions/restore.tsx
|
|
1756
|
+
import * as React25 from "react";
|
|
1757
|
+
import { RefreshIcon } from "@elementor/icons";
|
|
1758
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1759
|
+
function Restore({ post }) {
|
|
1760
|
+
const { setError, type } = usePostListContext();
|
|
1761
|
+
const { restorePost } = usePostActions(type);
|
|
1762
|
+
const handleClick = async () => {
|
|
1763
|
+
try {
|
|
1764
|
+
await restorePost.mutateAsync(post.id);
|
|
1765
|
+
} catch {
|
|
1766
|
+
setError();
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
return /* @__PURE__ */ React25.createElement(
|
|
1770
|
+
ActionMenuItem,
|
|
1771
|
+
{
|
|
1772
|
+
description: __17("Restored as draft", "elementor"),
|
|
1773
|
+
title: __17("Restore", "elementor"),
|
|
1774
|
+
icon: RefreshIcon,
|
|
1775
|
+
MenuItemProps: {
|
|
1776
|
+
disabled: restorePost.isPending || !post.user_can.delete,
|
|
1777
|
+
onClick: () => void handleClick()
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
);
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1315
1783
|
// src/components/panel/actions-menu/actions/set-home.tsx
|
|
1316
|
-
import * as
|
|
1784
|
+
import * as React26 from "react";
|
|
1317
1785
|
import { HomeIcon } from "@elementor/icons";
|
|
1318
|
-
import { CircularProgress as
|
|
1319
|
-
import { __ as
|
|
1786
|
+
import { CircularProgress as CircularProgress4 } from "@elementor/ui";
|
|
1787
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
1320
1788
|
|
|
1321
1789
|
// src/hooks/use-homepage-actions.ts
|
|
1322
1790
|
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@elementor/query";
|
|
@@ -1355,11 +1823,11 @@ function SetHome({ post, closeMenu }) {
|
|
|
1355
1823
|
const isPostPublished = post.status === "publish";
|
|
1356
1824
|
const isPostHomepage = !!post.isHome;
|
|
1357
1825
|
const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending;
|
|
1358
|
-
return /* @__PURE__ */
|
|
1826
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1359
1827
|
ActionMenuItem,
|
|
1360
1828
|
{
|
|
1361
|
-
title:
|
|
1362
|
-
icon: !updateSettingsMutation.isPending ? HomeIcon :
|
|
1829
|
+
title: __18("Set as homepage", "elementor"),
|
|
1830
|
+
icon: !updateSettingsMutation.isPending ? HomeIcon : CircularProgress4,
|
|
1363
1831
|
MenuItemProps: {
|
|
1364
1832
|
disabled: isDisabled,
|
|
1365
1833
|
onClick: handleClick
|
|
@@ -1369,13 +1837,13 @@ function SetHome({ post, closeMenu }) {
|
|
|
1369
1837
|
}
|
|
1370
1838
|
|
|
1371
1839
|
// src/components/panel/actions-menu/actions/view.tsx
|
|
1372
|
-
import * as
|
|
1840
|
+
import * as React27 from "react";
|
|
1373
1841
|
import { EyeIcon } from "@elementor/icons";
|
|
1374
|
-
import { __ as
|
|
1842
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
1375
1843
|
function View({ post }) {
|
|
1376
1844
|
const { type } = usePostListContext();
|
|
1377
|
-
const title =
|
|
1378
|
-
return /* @__PURE__ */
|
|
1845
|
+
const title = __19("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
|
|
1846
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1379
1847
|
ActionMenuItem,
|
|
1380
1848
|
{
|
|
1381
1849
|
title,
|
|
@@ -1387,6 +1855,14 @@ function View({ post }) {
|
|
|
1387
1855
|
);
|
|
1388
1856
|
}
|
|
1389
1857
|
|
|
1858
|
+
// src/components/panel/posts-list/list-items/site-content-list-item-actions-location.tsx
|
|
1859
|
+
import { createLocation } from "@elementor/locations";
|
|
1860
|
+
var {
|
|
1861
|
+
Slot: SiteContentListItemActionsSlot,
|
|
1862
|
+
inject: injectIntoSiteContentListItemActions,
|
|
1863
|
+
useInjections: useSiteContentListItemActionsInjections
|
|
1864
|
+
} = createLocation();
|
|
1865
|
+
|
|
1390
1866
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1391
1867
|
var DisabledPostTooltip = ({
|
|
1392
1868
|
children,
|
|
@@ -1394,16 +1870,16 @@ var DisabledPostTooltip = ({
|
|
|
1394
1870
|
postTypeSlug
|
|
1395
1871
|
}) => {
|
|
1396
1872
|
if (isDisabled) {
|
|
1397
|
-
const title = /* @__PURE__ */
|
|
1398
|
-
return /* @__PURE__ */
|
|
1873
|
+
const title = /* @__PURE__ */ React28.createElement(Typography5, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React28.createElement("br", null), __20("To edit it directly, contact the site owner", "elementor"));
|
|
1874
|
+
return /* @__PURE__ */ React28.createElement(Tooltip3, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React28.createElement("span", null, children));
|
|
1399
1875
|
}
|
|
1400
|
-
return /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, children);
|
|
1401
1877
|
};
|
|
1402
1878
|
function ListItemView({ post }) {
|
|
1403
1879
|
const { type } = usePostListContext();
|
|
1404
1880
|
const activeDocument = useActiveDocument3();
|
|
1405
1881
|
const navigateToDocument = useNavigateToDocument3();
|
|
1406
|
-
const popupState =
|
|
1882
|
+
const popupState = usePopupState3({
|
|
1407
1883
|
variant: "popover",
|
|
1408
1884
|
popupId: "post-actions",
|
|
1409
1885
|
disableAutoFocus: true
|
|
@@ -1411,17 +1887,21 @@ function ListItemView({ post }) {
|
|
|
1411
1887
|
const isActive = activeDocument?.id === post.id;
|
|
1412
1888
|
const status = isActive ? activeDocument?.status.value : post.status;
|
|
1413
1889
|
const title = isActive ? activeDocument?.title : post.title.rendered;
|
|
1414
|
-
const
|
|
1890
|
+
const isTrashed = "trash" === post.status;
|
|
1891
|
+
const isEditBlocked = !post.user_can.edit && !isTrashed;
|
|
1892
|
+
const isRowDisabled = isEditBlocked || isTrashed;
|
|
1415
1893
|
const menuTriggerProps = bindTrigger2(popupState);
|
|
1416
|
-
|
|
1894
|
+
const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
|
|
1895
|
+
const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
|
|
1896
|
+
const listRow = /* @__PURE__ */ React28.createElement(
|
|
1417
1897
|
ListItem2,
|
|
1418
1898
|
{
|
|
1419
1899
|
disablePadding: true,
|
|
1420
|
-
sx:
|
|
1421
|
-
secondaryAction: /* @__PURE__ */
|
|
1422
|
-
|
|
1900
|
+
sx: getContentPanelListItemSx(showListItemActions),
|
|
1901
|
+
secondaryAction: /* @__PURE__ */ React28.createElement(Stack5, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React28.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React28.createElement(
|
|
1902
|
+
IconButton4,
|
|
1423
1903
|
{
|
|
1424
|
-
"aria-label":
|
|
1904
|
+
"aria-label": __20("More actions", "elementor"),
|
|
1425
1905
|
size: "tiny",
|
|
1426
1906
|
...menuTriggerProps,
|
|
1427
1907
|
onClick: (event) => {
|
|
@@ -1429,39 +1909,37 @@ function ListItemView({ post }) {
|
|
|
1429
1909
|
menuTriggerProps.onClick?.(event);
|
|
1430
1910
|
}
|
|
1431
1911
|
},
|
|
1432
|
-
/* @__PURE__ */
|
|
1433
|
-
)
|
|
1912
|
+
/* @__PURE__ */ React28.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
1913
|
+
))
|
|
1434
1914
|
},
|
|
1435
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ React28.createElement(
|
|
1436
1916
|
ListItemButton2,
|
|
1437
1917
|
{
|
|
1438
1918
|
dense: true,
|
|
1439
1919
|
disableGutters: true,
|
|
1440
|
-
disabled:
|
|
1920
|
+
disabled: isRowDisabled,
|
|
1441
1921
|
onClick: () => {
|
|
1442
|
-
if (
|
|
1443
|
-
|
|
1922
|
+
if (isTrashed || isActive) {
|
|
1923
|
+
return;
|
|
1444
1924
|
}
|
|
1925
|
+
navigateToDocument(post.id);
|
|
1445
1926
|
},
|
|
1446
1927
|
selected: isActive,
|
|
1447
1928
|
shape: "rounded",
|
|
1448
1929
|
sx: contentPanelListItemButtonSx
|
|
1449
1930
|
},
|
|
1450
|
-
/* @__PURE__ */
|
|
1451
|
-
post.isHome && /* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ React28.createElement(ListItemText5, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React28.createElement(PageTitleAndStatus, { title, status })),
|
|
1932
|
+
post.isHome && /* @__PURE__ */ React28.createElement(HomeIcon2, { titleAccess: __20("Homepage", "elementor"), color: "disabled" })
|
|
1452
1933
|
)
|
|
1453
|
-
)
|
|
1934
|
+
);
|
|
1935
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, isEditBlocked ? /* @__PURE__ */ React28.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React28.createElement(
|
|
1454
1936
|
Menu2,
|
|
1455
1937
|
{
|
|
1456
1938
|
PaperProps: { sx: { mt: 2, width: 200 } },
|
|
1457
1939
|
MenuListProps: { dense: true },
|
|
1458
1940
|
...bindMenu2(popupState)
|
|
1459
1941
|
},
|
|
1460
|
-
/* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */ React21.createElement(Duplicate, { post, popupState }),
|
|
1462
|
-
/* @__PURE__ */ React21.createElement(Delete, { post }),
|
|
1463
|
-
/* @__PURE__ */ React21.createElement(View, { post }),
|
|
1464
|
-
type === "page" && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(Divider3, null), /* @__PURE__ */ React21.createElement(SetHome, { post, closeMenu: () => popupState.close() }))
|
|
1942
|
+
isTrashed ? /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Restore, { post }), /* @__PURE__ */ React28.createElement(ForceDelete, { post })) : /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Rename, { post }), /* @__PURE__ */ React28.createElement(Duplicate, { post, popupState }), /* @__PURE__ */ React28.createElement(Delete, { post }), /* @__PURE__ */ React28.createElement(View, { post }), type === "page" && /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(Divider5, null), /* @__PURE__ */ React28.createElement(SetHome, { post, closeMenu: () => popupState.close() })))
|
|
1465
1943
|
));
|
|
1466
1944
|
}
|
|
1467
1945
|
|
|
@@ -1469,25 +1947,25 @@ function ListItemView({ post }) {
|
|
|
1469
1947
|
function PostListItem({ post }) {
|
|
1470
1948
|
const { editMode } = usePostListContext();
|
|
1471
1949
|
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
|
|
1472
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ React29.createElement(ListItemRename, { post });
|
|
1473
1951
|
}
|
|
1474
1952
|
if ("create" === editMode.mode && !post) {
|
|
1475
|
-
return /* @__PURE__ */
|
|
1953
|
+
return /* @__PURE__ */ React29.createElement(ListItemCreate, null);
|
|
1476
1954
|
}
|
|
1477
1955
|
if ("duplicate" === editMode.mode && !post) {
|
|
1478
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ React29.createElement(ListItemDuplicate, null);
|
|
1479
1957
|
}
|
|
1480
1958
|
if (!post) {
|
|
1481
1959
|
return null;
|
|
1482
1960
|
}
|
|
1483
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ React29.createElement(ListItemView, { post });
|
|
1484
1962
|
}
|
|
1485
1963
|
|
|
1486
1964
|
// src/components/panel/posts-list/post-list-pagination-actions.tsx
|
|
1487
|
-
import * as
|
|
1965
|
+
import * as React30 from "react";
|
|
1488
1966
|
import { CollapseIcon as CollapseIcon2 } from "@elementor/editor-ui";
|
|
1489
|
-
import { Box as
|
|
1490
|
-
import { __ as
|
|
1967
|
+
import { Box as Box8, Button as Button3, CircularProgress as CircularProgress5, Stack as Stack6 } from "@elementor/ui";
|
|
1968
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
1491
1969
|
var listPaginationButtonProps = {
|
|
1492
1970
|
color: "secondary",
|
|
1493
1971
|
size: "small",
|
|
@@ -1504,28 +1982,28 @@ function PostListPaginationActions({
|
|
|
1504
1982
|
if (!canLoadMore && !canShowLess) {
|
|
1505
1983
|
return null;
|
|
1506
1984
|
}
|
|
1507
|
-
const loadMoreLabel =
|
|
1508
|
-
const showLessLabel =
|
|
1509
|
-
const loadMoreButton = /* @__PURE__ */
|
|
1510
|
-
|
|
1985
|
+
const loadMoreLabel = __21("Load more", "elementor");
|
|
1986
|
+
const showLessLabel = __21("Show less", "elementor");
|
|
1987
|
+
const loadMoreButton = /* @__PURE__ */ React30.createElement(
|
|
1988
|
+
Button3,
|
|
1511
1989
|
{
|
|
1512
1990
|
...listPaginationButtonProps,
|
|
1513
1991
|
ref: loadMoreButtonRef,
|
|
1514
1992
|
"aria-label": loadMoreLabel,
|
|
1515
1993
|
disabled: isLoadingMore,
|
|
1516
|
-
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */
|
|
1994
|
+
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React30.createElement(CollapseIcon2, { open: false }),
|
|
1517
1995
|
fullWidth: true,
|
|
1518
1996
|
onClick: onLoadMore,
|
|
1519
1997
|
sx: { flex: 1, my: 0.5 }
|
|
1520
1998
|
},
|
|
1521
|
-
isLoadingMore ? /* @__PURE__ */
|
|
1999
|
+
isLoadingMore ? /* @__PURE__ */ React30.createElement(CircularProgress5, { size: 20 }) : loadMoreLabel
|
|
1522
2000
|
);
|
|
1523
|
-
const showLessButton = /* @__PURE__ */
|
|
1524
|
-
|
|
2001
|
+
const showLessButton = /* @__PURE__ */ React30.createElement(
|
|
2002
|
+
Button3,
|
|
1525
2003
|
{
|
|
1526
2004
|
...listPaginationButtonProps,
|
|
1527
2005
|
"aria-label": showLessLabel,
|
|
1528
|
-
endIcon: /* @__PURE__ */
|
|
2006
|
+
endIcon: /* @__PURE__ */ React30.createElement(CollapseIcon2, { open: true }),
|
|
1529
2007
|
fullWidth: true,
|
|
1530
2008
|
onClick: onShowLess,
|
|
1531
2009
|
sx: { flex: 1, my: 0.5 }
|
|
@@ -1533,19 +2011,19 @@ function PostListPaginationActions({
|
|
|
1533
2011
|
showLessLabel
|
|
1534
2012
|
);
|
|
1535
2013
|
if (canShowLess && canLoadMore) {
|
|
1536
|
-
return /* @__PURE__ */
|
|
2014
|
+
return /* @__PURE__ */ React30.createElement(Box8, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React30.createElement(Stack6, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
|
|
1537
2015
|
}
|
|
1538
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ React30.createElement(Box8, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
|
|
1539
2017
|
}
|
|
1540
2018
|
|
|
1541
2019
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
1542
2020
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
1543
2021
|
function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
1544
|
-
const { type, editMode, setEditMode } = usePostListContext();
|
|
1545
|
-
const { registerSection,
|
|
1546
|
-
const [isOpen, setIsOpen] =
|
|
2022
|
+
const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
|
|
2023
|
+
const { registerSection, searchQuery, statusFilters, unregisterSection } = useContentPanelCoordinator();
|
|
2024
|
+
const [isOpen, setIsOpen] = useState7(isOpenByDefault);
|
|
1547
2025
|
const trimmedSearch = searchQuery.trim();
|
|
1548
|
-
const [debouncedSearch, setDebouncedSearch] =
|
|
2026
|
+
const [debouncedSearch, setDebouncedSearch] = useState7(trimmedSearch);
|
|
1549
2027
|
const focusAfterShowLessRef = useRef4(false);
|
|
1550
2028
|
const listTopRef = useRef4(null);
|
|
1551
2029
|
const loadMoreButtonRef = useRef4(null);
|
|
@@ -1561,9 +2039,19 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1561
2039
|
fetchNextPage,
|
|
1562
2040
|
hasNextPage,
|
|
1563
2041
|
isFetchingNextPage
|
|
1564
|
-
} = usePosts(type, debouncedSearch);
|
|
2042
|
+
} = usePosts(type, debouncedSearch, statusFilters);
|
|
2043
|
+
const isNarrowed = isSiteContentListNarrowed(statusFilters, debouncedSearch);
|
|
2044
|
+
const isTrashFilter = isSiteContentTrashFilterActive(statusFilters);
|
|
2045
|
+
const baselineStatus = isTrashFilter ? "trash" : "any";
|
|
2046
|
+
const { data: baselineTotal } = usePostsBaselineTotal(type, isNarrowed, baselineStatus);
|
|
1565
2047
|
const { data: homepageId } = useHomepage();
|
|
1566
2048
|
const isPageType = type === "page";
|
|
2049
|
+
const statusFiltersKey = serializeSiteContentStatusFilters(statusFilters);
|
|
2050
|
+
useEffect2(() => {
|
|
2051
|
+
if (isTrashFilter) {
|
|
2052
|
+
resetEditMode();
|
|
2053
|
+
}
|
|
2054
|
+
}, [isTrashFilter, resetEditMode]);
|
|
1567
2055
|
useEffect2(() => {
|
|
1568
2056
|
registerSection(type, {
|
|
1569
2057
|
setExpanded: setIsOpen,
|
|
@@ -1592,7 +2080,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1592
2080
|
hasNextPage,
|
|
1593
2081
|
isFetchingNextPage,
|
|
1594
2082
|
loadedCount: filteredPosts.length,
|
|
1595
|
-
resetKey: `${type}:${debouncedSearch}`,
|
|
2083
|
+
resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}`,
|
|
1596
2084
|
totalCount: total
|
|
1597
2085
|
});
|
|
1598
2086
|
const displayedPosts = useMemo4(
|
|
@@ -1620,36 +2108,38 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1620
2108
|
sectionHeaderRef.current?.focus();
|
|
1621
2109
|
}, [pagination.canLoadMore, pagination.visibleCount]);
|
|
1622
2110
|
useEffect2(() => {
|
|
1623
|
-
if (debouncedSearch && filteredPosts.length > 0) {
|
|
2111
|
+
if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
|
|
1624
2112
|
setIsOpen(true);
|
|
1625
2113
|
}
|
|
1626
|
-
}, [debouncedSearch, filteredPosts.length]);
|
|
2114
|
+
}, [debouncedSearch, filteredPosts.length, statusFilters]);
|
|
1627
2115
|
if (postsError) {
|
|
1628
|
-
return /* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ React31.createElement(ErrorState, null);
|
|
1629
2117
|
}
|
|
1630
2118
|
if (postsPending && !posts?.length) {
|
|
1631
|
-
return /* @__PURE__ */
|
|
2119
|
+
return /* @__PURE__ */ React31.createElement(Box9, { sx: { px: 2 } }, /* @__PURE__ */ React31.createElement(Box9, null, /* @__PURE__ */ React31.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React31.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React31.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React31.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
1632
2120
|
}
|
|
1633
2121
|
const displayCount = total;
|
|
1634
2122
|
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
1635
|
-
const showNoResults = debouncedSearch && filteredPosts.length === 0;
|
|
1636
|
-
|
|
2123
|
+
const showNoResults = (debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length === 0;
|
|
2124
|
+
const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
|
|
2125
|
+
return /* @__PURE__ */ React31.createElement(
|
|
1637
2126
|
CollapsibleList,
|
|
1638
2127
|
{
|
|
1639
2128
|
count: displayCount,
|
|
2129
|
+
countChipLabel,
|
|
1640
2130
|
headerRef: sectionHeaderRef,
|
|
1641
2131
|
isOpen,
|
|
1642
2132
|
onOpenChange: setIsOpen,
|
|
1643
2133
|
title: sectionTitle,
|
|
1644
|
-
trailingActions: /* @__PURE__ */
|
|
2134
|
+
trailingActions: isTrashFilter ? null : /* @__PURE__ */ React31.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
|
|
1645
2135
|
},
|
|
1646
|
-
showNoResults && /* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
2136
|
+
showNoResults && /* @__PURE__ */ React31.createElement(Box9, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React31.createElement(Typography6, { variant: "body2", color: "text.secondary" }, __22("No results found", "elementor"))),
|
|
2137
|
+
/* @__PURE__ */ React31.createElement(Box9, { ref: listTopRef }),
|
|
1648
2138
|
displayedPosts.map((post) => {
|
|
1649
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ React31.createElement(PostListItem, { key: post.id, post });
|
|
1650
2140
|
}),
|
|
1651
|
-
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
2141
|
+
!isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React31.createElement(PostListItem, null),
|
|
2142
|
+
/* @__PURE__ */ React31.createElement(
|
|
1653
2143
|
PostListPaginationActions,
|
|
1654
2144
|
{
|
|
1655
2145
|
canLoadMore: pagination.canLoadMore,
|
|
@@ -1664,11 +2154,11 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1664
2154
|
}
|
|
1665
2155
|
|
|
1666
2156
|
// src/components/panel/user-load-error.tsx
|
|
1667
|
-
import * as
|
|
1668
|
-
import { Box as
|
|
1669
|
-
import { __ as
|
|
2157
|
+
import * as React32 from "react";
|
|
2158
|
+
import { Box as Box10, Typography as Typography7 } from "@elementor/ui";
|
|
2159
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
1670
2160
|
function UserLoadError() {
|
|
1671
|
-
return /* @__PURE__ */
|
|
2161
|
+
return /* @__PURE__ */ React32.createElement(Box10, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React32.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __23(
|
|
1672
2162
|
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
1673
2163
|
"elementor"
|
|
1674
2164
|
)));
|
|
@@ -1682,31 +2172,33 @@ function ShellPanelBodyContent({
|
|
|
1682
2172
|
showUserLoadError
|
|
1683
2173
|
}) {
|
|
1684
2174
|
if (isUserPending) {
|
|
1685
|
-
return /* @__PURE__ */
|
|
2175
|
+
return /* @__PURE__ */ React33.createElement(Stack7, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
1686
2176
|
}
|
|
1687
2177
|
if (showUserLoadError) {
|
|
1688
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ React33.createElement(UserLoadError, null);
|
|
1689
2179
|
}
|
|
1690
|
-
return /* @__PURE__ */
|
|
2180
|
+
return /* @__PURE__ */ React33.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React33.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React33.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
|
|
1691
2181
|
}
|
|
1692
2182
|
|
|
1693
2183
|
// src/components/panel/shell.tsx
|
|
1694
2184
|
var Shell = () => {
|
|
1695
|
-
const
|
|
2185
|
+
const sidebarPanelChrome = isSidebarEnabled();
|
|
2186
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState8(false);
|
|
1696
2187
|
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
1697
|
-
return /* @__PURE__ */
|
|
1698
|
-
|
|
2188
|
+
return /* @__PURE__ */ React34.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React34.createElement(Panel, null, /* @__PURE__ */ React34.createElement(PanelHeader, null, /* @__PURE__ */ React34.createElement(
|
|
2189
|
+
Stack8,
|
|
1699
2190
|
{
|
|
1700
2191
|
alignItems: "center",
|
|
1701
2192
|
direction: "row",
|
|
1702
2193
|
spacing: 0.5,
|
|
1703
2194
|
sx: {
|
|
1704
|
-
...contentPanelHeaderStackSx
|
|
2195
|
+
...contentPanelHeaderStackSx,
|
|
2196
|
+
...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
|
|
1705
2197
|
}
|
|
1706
2198
|
},
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
)), /* @__PURE__ */
|
|
2199
|
+
/* @__PURE__ */ React34.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __24("Site content", "elementor")),
|
|
2200
|
+
/* @__PURE__ */ React34.createElement(ContentPanelHeaderAdd, null)
|
|
2201
|
+
)), /* @__PURE__ */ React34.createElement(Divider6, null), /* @__PURE__ */ React34.createElement(PanelBody, null, /* @__PURE__ */ React34.createElement(ContentPanelToolbar, null), /* @__PURE__ */ React34.createElement(Divider6, null), /* @__PURE__ */ React34.createElement(
|
|
1710
2202
|
ShellPanelBodyContent,
|
|
1711
2203
|
{
|
|
1712
2204
|
accessiblePostTypes,
|
|
@@ -1714,7 +2206,7 @@ var Shell = () => {
|
|
|
1714
2206
|
onListError: () => setIsErrorSnackbarOpen(true),
|
|
1715
2207
|
showUserLoadError
|
|
1716
2208
|
}
|
|
1717
|
-
), /* @__PURE__ */
|
|
2209
|
+
), /* @__PURE__ */ React34.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
|
|
1718
2210
|
};
|
|
1719
2211
|
var shell_default = Shell;
|
|
1720
2212
|
|
|
@@ -1725,7 +2217,7 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
|
|
|
1725
2217
|
});
|
|
1726
2218
|
|
|
1727
2219
|
// src/components/top-bar/recently-edited.tsx
|
|
1728
|
-
import * as
|
|
2220
|
+
import * as React39 from "react";
|
|
1729
2221
|
import {
|
|
1730
2222
|
__useActiveDocument as useActiveDocument4,
|
|
1731
2223
|
__useHostDocument as useHostDocument
|
|
@@ -1734,30 +2226,30 @@ import { ChevronDownIcon } from "@elementor/icons";
|
|
|
1734
2226
|
import {
|
|
1735
2227
|
bindMenu as bindMenu3,
|
|
1736
2228
|
bindTrigger as bindTrigger3,
|
|
1737
|
-
Button as
|
|
1738
|
-
Divider as
|
|
2229
|
+
Button as Button4,
|
|
2230
|
+
Divider as Divider7,
|
|
1739
2231
|
ListItemText as ListItemText8,
|
|
1740
2232
|
ListSubheader,
|
|
1741
2233
|
Menu as Menu3,
|
|
1742
|
-
MenuItem as
|
|
1743
|
-
usePopupState as
|
|
2234
|
+
MenuItem as MenuItem6,
|
|
2235
|
+
usePopupState as usePopupState4
|
|
1744
2236
|
} from "@elementor/ui";
|
|
1745
|
-
import { __ as
|
|
2237
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
1746
2238
|
|
|
1747
2239
|
// src/components/top-bar/create-post-list-item.tsx
|
|
1748
|
-
import * as
|
|
2240
|
+
import * as React35 from "react";
|
|
1749
2241
|
import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
|
|
1750
2242
|
import { useMixpanel } from "@elementor/events";
|
|
1751
2243
|
import { PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1752
|
-
import { CircularProgress as
|
|
1753
|
-
import { __ as
|
|
2244
|
+
import { CircularProgress as CircularProgress6, ListItemIcon as ListItemIcon3, ListItemText as ListItemText6, MenuItem as MenuItem4 } from "@elementor/ui";
|
|
2245
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
1754
2246
|
|
|
1755
2247
|
// src/hooks/use-create-page.ts
|
|
1756
|
-
import { useState as
|
|
2248
|
+
import { useState as useState9 } from "react";
|
|
1757
2249
|
import apiFetch5 from "@wordpress/api-fetch";
|
|
1758
2250
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
1759
2251
|
function useCreatePage() {
|
|
1760
|
-
const [isLoading, setIsLoading] =
|
|
2252
|
+
const [isLoading, setIsLoading] = useState9(false);
|
|
1761
2253
|
return {
|
|
1762
2254
|
create: () => {
|
|
1763
2255
|
setIsLoading(true);
|
|
@@ -1780,8 +2272,8 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1780
2272
|
const navigateToDocument = useNavigateToDocument4();
|
|
1781
2273
|
const { data: user } = useUser();
|
|
1782
2274
|
const { dispatchEvent, config } = useMixpanel();
|
|
1783
|
-
return /* @__PURE__ */
|
|
1784
|
-
|
|
2275
|
+
return /* @__PURE__ */ React35.createElement(
|
|
2276
|
+
MenuItem4,
|
|
1785
2277
|
{
|
|
1786
2278
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
1787
2279
|
onClick: async () => {
|
|
@@ -1804,25 +2296,25 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1804
2296
|
},
|
|
1805
2297
|
...props
|
|
1806
2298
|
},
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ React35.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React35.createElement(CircularProgress6, { size: "1.25rem" }) : /* @__PURE__ */ React35.createElement(PlusIcon2, { fontSize: "small" })),
|
|
2300
|
+
/* @__PURE__ */ React35.createElement(
|
|
1809
2301
|
ListItemText6,
|
|
1810
2302
|
{
|
|
1811
2303
|
primaryTypographyProps: { variant: "body2" },
|
|
1812
|
-
primary:
|
|
2304
|
+
primary: __25("Add new page", "elementor")
|
|
1813
2305
|
}
|
|
1814
2306
|
)
|
|
1815
2307
|
);
|
|
1816
2308
|
}
|
|
1817
2309
|
|
|
1818
2310
|
// src/components/top-bar/indicator.tsx
|
|
1819
|
-
import * as
|
|
1820
|
-
import { Stack as
|
|
2311
|
+
import * as React36 from "react";
|
|
2312
|
+
import { Stack as Stack9, Tooltip as BaseTooltip, Typography as Typography8 } from "@elementor/ui";
|
|
1821
2313
|
function Indicator({ title, status }) {
|
|
1822
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ React36.createElement(Tooltip4, { title }, /* @__PURE__ */ React36.createElement(Stack9, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
1823
2315
|
}
|
|
1824
|
-
function
|
|
1825
|
-
return /* @__PURE__ */
|
|
2316
|
+
function Tooltip4(props) {
|
|
2317
|
+
return /* @__PURE__ */ React36.createElement(
|
|
1826
2318
|
BaseTooltip,
|
|
1827
2319
|
{
|
|
1828
2320
|
PopperProps: {
|
|
@@ -1838,21 +2330,21 @@ function Tooltip2(props) {
|
|
|
1838
2330
|
}
|
|
1839
2331
|
|
|
1840
2332
|
// src/components/top-bar/post-list-item.tsx
|
|
1841
|
-
import * as
|
|
2333
|
+
import * as React38 from "react";
|
|
1842
2334
|
import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
|
|
1843
2335
|
import { useMixpanel as useMixpanel2 } from "@elementor/events";
|
|
1844
|
-
import { ListItemText as ListItemText7, MenuItem as
|
|
2336
|
+
import { ListItemText as ListItemText7, MenuItem as MenuItem5 } from "@elementor/ui";
|
|
1845
2337
|
|
|
1846
2338
|
// src/components/top-bar/chip-doc-type.tsx
|
|
1847
|
-
import * as
|
|
2339
|
+
import * as React37 from "react";
|
|
1848
2340
|
import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
|
|
1849
|
-
import { Chip as
|
|
2341
|
+
import { Chip as Chip4 } from "@elementor/ui";
|
|
1850
2342
|
var iconsMap2 = getIconsMap();
|
|
1851
2343
|
function DocTypeChip({ postType, docType, label }) {
|
|
1852
2344
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
1853
2345
|
const Icon = iconsMap2[docType] || PostTypeIcon3;
|
|
1854
|
-
return /* @__PURE__ */
|
|
1855
|
-
|
|
2346
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2347
|
+
Chip4,
|
|
1856
2348
|
{
|
|
1857
2349
|
component: "span",
|
|
1858
2350
|
size: "small",
|
|
@@ -1860,7 +2352,7 @@ function DocTypeChip({ postType, docType, label }) {
|
|
|
1860
2352
|
label,
|
|
1861
2353
|
"data-value": docType,
|
|
1862
2354
|
color,
|
|
1863
|
-
icon: /* @__PURE__ */
|
|
2355
|
+
icon: /* @__PURE__ */ React37.createElement(Icon, null),
|
|
1864
2356
|
sx: { ml: 1, cursor: "inherit" }
|
|
1865
2357
|
}
|
|
1866
2358
|
);
|
|
@@ -1871,8 +2363,8 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1871
2363
|
const navigateToDocument = useNavigateToDocument5();
|
|
1872
2364
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
1873
2365
|
const { dispatchEvent, config } = useMixpanel2();
|
|
1874
|
-
return /* @__PURE__ */
|
|
1875
|
-
|
|
2366
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2367
|
+
MenuItem5,
|
|
1876
2368
|
{
|
|
1877
2369
|
disabled: !post.user_can.edit,
|
|
1878
2370
|
onClick: async () => {
|
|
@@ -1894,7 +2386,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1894
2386
|
},
|
|
1895
2387
|
...props
|
|
1896
2388
|
},
|
|
1897
|
-
/* @__PURE__ */
|
|
2389
|
+
/* @__PURE__ */ React38.createElement(
|
|
1898
2390
|
ListItemText7,
|
|
1899
2391
|
{
|
|
1900
2392
|
sx: { flexGrow: 0 },
|
|
@@ -1902,7 +2394,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1902
2394
|
primary: postTitle
|
|
1903
2395
|
}
|
|
1904
2396
|
),
|
|
1905
|
-
/* @__PURE__ */
|
|
2397
|
+
/* @__PURE__ */ React38.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
|
|
1906
2398
|
);
|
|
1907
2399
|
}
|
|
1908
2400
|
|
|
@@ -1919,7 +2411,7 @@ function RecentlyEdited() {
|
|
|
1919
2411
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
1920
2412
|
};
|
|
1921
2413
|
const recentPosts = getRecentPosts();
|
|
1922
|
-
const popupState =
|
|
2414
|
+
const popupState = usePopupState4({
|
|
1923
2415
|
variant: "popover",
|
|
1924
2416
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
1925
2417
|
});
|
|
@@ -1928,12 +2420,12 @@ function RecentlyEdited() {
|
|
|
1928
2420
|
return null;
|
|
1929
2421
|
}
|
|
1930
2422
|
const buttonProps = bindTrigger3(popupState);
|
|
1931
|
-
return /* @__PURE__ */
|
|
1932
|
-
|
|
2423
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(
|
|
2424
|
+
Button4,
|
|
1933
2425
|
{
|
|
1934
2426
|
color: "inherit",
|
|
1935
2427
|
size: "small",
|
|
1936
|
-
endIcon: /* @__PURE__ */
|
|
2428
|
+
endIcon: /* @__PURE__ */ React39.createElement(ChevronDownIcon, { fontSize: "small" }),
|
|
1937
2429
|
...buttonProps,
|
|
1938
2430
|
onClick: (e) => {
|
|
1939
2431
|
const extendedWindow = window;
|
|
@@ -1952,40 +2444,40 @@ function RecentlyEdited() {
|
|
|
1952
2444
|
buttonProps.onClick(e);
|
|
1953
2445
|
}
|
|
1954
2446
|
},
|
|
1955
|
-
/* @__PURE__ */
|
|
1956
|
-
), /* @__PURE__ */
|
|
2447
|
+
/* @__PURE__ */ React39.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
2448
|
+
), /* @__PURE__ */ React39.createElement(
|
|
1957
2449
|
Menu3,
|
|
1958
2450
|
{
|
|
1959
2451
|
MenuListProps: {
|
|
1960
|
-
subheader: /* @__PURE__ */
|
|
2452
|
+
subheader: /* @__PURE__ */ React39.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __26("Recent", "elementor"))
|
|
1961
2453
|
},
|
|
1962
2454
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
1963
2455
|
...bindMenu3(popupState)
|
|
1964
2456
|
},
|
|
1965
|
-
recentPosts.map((post) => /* @__PURE__ */
|
|
1966
|
-
recentPosts.length === 0 && /* @__PURE__ */
|
|
2457
|
+
recentPosts.map((post) => /* @__PURE__ */ React39.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
2458
|
+
recentPosts.length === 0 && /* @__PURE__ */ React39.createElement(MenuItem6, { disabled: true }, /* @__PURE__ */ React39.createElement(
|
|
1967
2459
|
ListItemText8,
|
|
1968
2460
|
{
|
|
1969
2461
|
primaryTypographyProps: {
|
|
1970
2462
|
variant: "caption",
|
|
1971
2463
|
fontStyle: "italic"
|
|
1972
2464
|
},
|
|
1973
|
-
primary:
|
|
2465
|
+
primary: __26("There are no other pages or templates on this site yet.", "elementor")
|
|
1974
2466
|
}
|
|
1975
2467
|
)),
|
|
1976
|
-
/* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
2468
|
+
/* @__PURE__ */ React39.createElement(Divider7, { disabled: recentPosts.length === 0 }),
|
|
2469
|
+
/* @__PURE__ */ React39.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
1978
2470
|
));
|
|
1979
2471
|
}
|
|
1980
2472
|
|
|
1981
2473
|
// src/hooks/use-toggle-button-props.ts
|
|
1982
2474
|
import { PagesIcon } from "@elementor/icons";
|
|
1983
|
-
import { __ as
|
|
2475
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
1984
2476
|
function useToggleButtonProps() {
|
|
1985
2477
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1986
2478
|
const { open, close } = usePanelActions();
|
|
1987
2479
|
return {
|
|
1988
|
-
title:
|
|
2480
|
+
title: __27("Site content", "elementor"),
|
|
1989
2481
|
icon: PagesIcon,
|
|
1990
2482
|
onClick: () => {
|
|
1991
2483
|
const extendedWindow = window;
|
|
@@ -2020,7 +2512,7 @@ function registerTopBarMenuItems() {
|
|
|
2020
2512
|
});
|
|
2021
2513
|
}
|
|
2022
2514
|
function registerButton() {
|
|
2023
|
-
const menu =
|
|
2515
|
+
const menu = isSidebarEnabled2() ? sidebarTools : toolsMenu;
|
|
2024
2516
|
menu.registerToggleAction({
|
|
2025
2517
|
id: "toggle-site-navigation-panel",
|
|
2026
2518
|
priority: 6,
|
|
@@ -2028,6 +2520,8 @@ function registerButton() {
|
|
|
2028
2520
|
});
|
|
2029
2521
|
}
|
|
2030
2522
|
export {
|
|
2523
|
+
SiteContentListItemActionsSlot,
|
|
2031
2524
|
extendIconsMap,
|
|
2032
|
-
init
|
|
2525
|
+
init,
|
|
2526
|
+
injectIntoSiteContentListItemActions
|
|
2033
2527
|
};
|