@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.js
CHANGED
|
@@ -30,8 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
SiteContentListItemActionsSlot: () => SiteContentListItemActionsSlot,
|
|
33
34
|
extendIconsMap: () => extendIconsMap,
|
|
34
|
-
init: () => init
|
|
35
|
+
init: () => init,
|
|
36
|
+
injectIntoSiteContentListItemActions: () => injectIntoSiteContentListItemActions
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(index_exports);
|
|
37
39
|
|
|
@@ -55,25 +57,109 @@ function getIconsMap() {
|
|
|
55
57
|
// src/init.ts
|
|
56
58
|
var import_editor_app_bar = require("@elementor/editor-app-bar");
|
|
57
59
|
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
58
|
-
var
|
|
60
|
+
var import_editor_sidebar2 = require("@elementor/editor-sidebar");
|
|
59
61
|
|
|
60
62
|
// src/components/panel/panel.ts
|
|
61
63
|
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
62
64
|
|
|
63
65
|
// src/components/panel/shell.tsx
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
+
var React34 = __toESM(require("react"));
|
|
67
|
+
var import_react11 = require("react");
|
|
66
68
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
+
var import_editor_sidebar = require("@elementor/editor-sidebar");
|
|
70
|
+
var import_ui23 = require("@elementor/ui");
|
|
71
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
69
72
|
|
|
70
73
|
// src/contexts/content-panel-coordinator.tsx
|
|
71
74
|
var React = __toESM(require("react"));
|
|
72
75
|
var import_react = require("react");
|
|
76
|
+
|
|
77
|
+
// src/site-content-status-filter.ts
|
|
78
|
+
var import_i18n = require("@wordpress/i18n");
|
|
79
|
+
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
80
|
+
"publish",
|
|
81
|
+
"draft",
|
|
82
|
+
"pending",
|
|
83
|
+
"private",
|
|
84
|
+
"future",
|
|
85
|
+
"trash"
|
|
86
|
+
];
|
|
87
|
+
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
88
|
+
draft: false,
|
|
89
|
+
future: false,
|
|
90
|
+
pending: false,
|
|
91
|
+
private: false,
|
|
92
|
+
publish: false,
|
|
93
|
+
trash: false
|
|
94
|
+
};
|
|
95
|
+
var filterLabels = {
|
|
96
|
+
publish: (0, import_i18n.__)("Published", "elementor"),
|
|
97
|
+
draft: (0, import_i18n.__)("Drafts", "elementor"),
|
|
98
|
+
pending: (0, import_i18n.__)("Pending", "elementor"),
|
|
99
|
+
private: (0, import_i18n.__)("Private", "elementor"),
|
|
100
|
+
future: (0, import_i18n.__)("Scheduled", "elementor"),
|
|
101
|
+
trash: (0, import_i18n.__)("Trash", "elementor")
|
|
102
|
+
};
|
|
103
|
+
var SITE_CONTENT_ALL_FILTER_LABEL = (0, import_i18n.__)("All", "elementor");
|
|
104
|
+
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
105
|
+
function getSiteContentStatusFilterLabel(filter) {
|
|
106
|
+
return filterLabels[filter];
|
|
107
|
+
}
|
|
108
|
+
function hasActiveSiteContentStatusFilters(filters) {
|
|
109
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
110
|
+
}
|
|
111
|
+
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
112
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
113
|
+
}
|
|
114
|
+
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
115
|
+
function getRestStatusForSiteContentFilters(filters) {
|
|
116
|
+
if (filters.trash) {
|
|
117
|
+
return "trash";
|
|
118
|
+
}
|
|
119
|
+
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
120
|
+
if (0 === active.length) {
|
|
121
|
+
return "any";
|
|
122
|
+
}
|
|
123
|
+
return active.join(",");
|
|
124
|
+
}
|
|
125
|
+
function isSiteContentTrashFilterActive(filters) {
|
|
126
|
+
return filters.trash;
|
|
127
|
+
}
|
|
128
|
+
function isSiteContentListNarrowed(filters, search) {
|
|
129
|
+
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
130
|
+
}
|
|
131
|
+
function toggleSiteContentStatusFilter(filters, filter) {
|
|
132
|
+
if ("trash" === filter) {
|
|
133
|
+
const isTrashOn = !filters.trash;
|
|
134
|
+
return {
|
|
135
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
136
|
+
trash: isTrashOn
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
...filters,
|
|
141
|
+
trash: false,
|
|
142
|
+
[filter]: !filters[filter]
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
146
|
+
if (isSelected) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (isLoadingCounts || void 0 === count) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return count > 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/contexts/content-panel-coordinator.tsx
|
|
73
156
|
var ContentPanelCoordinatorContext = (0, import_react.createContext)(null);
|
|
74
157
|
function ContentPanelCoordinatorProvider({ children }) {
|
|
75
158
|
const sectionsRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
76
159
|
const [searchQuery, setSearchQuery] = (0, import_react.useState)("");
|
|
160
|
+
const [statusFilters, setStatusFilters] = (0, import_react.useState)(
|
|
161
|
+
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
162
|
+
);
|
|
77
163
|
const registerSection = (0, import_react.useCallback)((type, handlers) => {
|
|
78
164
|
sectionsRef.current.set(type, handlers);
|
|
79
165
|
}, []);
|
|
@@ -88,15 +174,32 @@ function ContentPanelCoordinatorProvider({ children }) {
|
|
|
88
174
|
handlers.setExpanded(true);
|
|
89
175
|
handlers.startCreate();
|
|
90
176
|
}, []);
|
|
177
|
+
const clearStatusFilters = (0, import_react.useCallback)(() => {
|
|
178
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
179
|
+
}, []);
|
|
180
|
+
const toggleStatusFilter = (0, import_react.useCallback)((filter) => {
|
|
181
|
+
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
182
|
+
}, []);
|
|
91
183
|
const value = (0, import_react.useMemo)(
|
|
92
184
|
() => ({
|
|
185
|
+
clearStatusFilters,
|
|
93
186
|
registerSection,
|
|
94
|
-
unregisterSection,
|
|
95
187
|
requestCreate,
|
|
96
188
|
searchQuery,
|
|
97
|
-
setSearchQuery
|
|
189
|
+
setSearchQuery,
|
|
190
|
+
statusFilters,
|
|
191
|
+
toggleStatusFilter,
|
|
192
|
+
unregisterSection
|
|
98
193
|
}),
|
|
99
|
-
[
|
|
194
|
+
[
|
|
195
|
+
clearStatusFilters,
|
|
196
|
+
registerSection,
|
|
197
|
+
requestCreate,
|
|
198
|
+
searchQuery,
|
|
199
|
+
statusFilters,
|
|
200
|
+
toggleStatusFilter,
|
|
201
|
+
unregisterSection
|
|
202
|
+
]
|
|
100
203
|
);
|
|
101
204
|
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
102
205
|
}
|
|
@@ -115,20 +218,20 @@ var import_react2 = require("react");
|
|
|
115
218
|
|
|
116
219
|
// src/api/post.ts
|
|
117
220
|
var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
|
|
118
|
-
var
|
|
221
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
119
222
|
var postTypesMap = {
|
|
120
223
|
page: {
|
|
121
224
|
labels: {
|
|
122
|
-
singular_name: (0,
|
|
123
|
-
plural_name: (0,
|
|
225
|
+
singular_name: (0, import_i18n2.__)("Page", "elementor"),
|
|
226
|
+
plural_name: (0, import_i18n2.__)("Pages", "elementor")
|
|
124
227
|
},
|
|
125
228
|
rest_base: "pages",
|
|
126
229
|
createCapability: "edit_pages"
|
|
127
230
|
},
|
|
128
231
|
post: {
|
|
129
232
|
labels: {
|
|
130
|
-
singular_name: (0,
|
|
131
|
-
plural_name: (0,
|
|
233
|
+
singular_name: (0, import_i18n2.__)("Post", "elementor"),
|
|
234
|
+
plural_name: (0, import_i18n2.__)("Posts", "elementor")
|
|
132
235
|
},
|
|
133
236
|
rest_base: "posts",
|
|
134
237
|
createCapability: "edit_posts"
|
|
@@ -143,19 +246,20 @@ function getAccessiblePanelPostTypes(capabilities) {
|
|
|
143
246
|
}
|
|
144
247
|
function getCannotEditPanelItemMessage(postTypeSlug) {
|
|
145
248
|
if ("page" === postTypeSlug) {
|
|
146
|
-
return (0,
|
|
249
|
+
return (0, import_i18n2.__)("You cannot edit this page.", "elementor");
|
|
147
250
|
}
|
|
148
|
-
return (0,
|
|
251
|
+
return (0, import_i18n2.__)("You cannot edit this post.", "elementor");
|
|
149
252
|
}
|
|
150
253
|
var POST_PER_PAGE = 10;
|
|
151
|
-
var
|
|
254
|
+
var COUNT_QUERY_PER_PAGE = 1;
|
|
255
|
+
var getRequest = async (postTypeSlug, page, search = "", status = "any", perPage = POST_PER_PAGE) => {
|
|
152
256
|
const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
153
257
|
const keys = ["id", "type", "title", "link", "status", "user_can"];
|
|
154
258
|
const queryParams = new URLSearchParams({
|
|
155
|
-
status
|
|
259
|
+
status,
|
|
156
260
|
order: "asc",
|
|
157
261
|
page: page.toString(),
|
|
158
|
-
per_page:
|
|
262
|
+
per_page: perPage.toString(),
|
|
159
263
|
_fields: keys.join(",")
|
|
160
264
|
});
|
|
161
265
|
const trimmedSearch = search.trim();
|
|
@@ -191,13 +295,18 @@ var updateRequest = (postTypeSlug, updatedPost) => {
|
|
|
191
295
|
data
|
|
192
296
|
});
|
|
193
297
|
};
|
|
194
|
-
var deleteRequest = (postTypeSlug, postId) => {
|
|
298
|
+
var deleteRequest = (postTypeSlug, postId, force = false) => {
|
|
195
299
|
const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
|
|
300
|
+
const forceQuery = force ? "?force=true" : "";
|
|
196
301
|
return (0, import_api_fetch.default)({
|
|
197
|
-
path: `${path}/${postId}`,
|
|
302
|
+
path: `${path}/${postId}${forceQuery}`,
|
|
198
303
|
method: "DELETE"
|
|
199
304
|
});
|
|
200
305
|
};
|
|
306
|
+
var fetchPostsTotal = async (postTypeSlug, status = "any", search = "") => {
|
|
307
|
+
const response = await getRequest(postTypeSlug, 1, search, status, COUNT_QUERY_PER_PAGE);
|
|
308
|
+
return response.totalPosts;
|
|
309
|
+
};
|
|
201
310
|
var duplicateRequest = (originalPost) => {
|
|
202
311
|
const path = `/elementor/v1/site-navigation/duplicate-post`;
|
|
203
312
|
return (0, import_api_fetch.default)({
|
|
@@ -266,6 +375,7 @@ function useAccessiblePanelPostTypes() {
|
|
|
266
375
|
var CONTENT_PANEL_INSET_SPACING = 2;
|
|
267
376
|
var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
|
|
268
377
|
var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
|
|
378
|
+
var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = 10;
|
|
269
379
|
var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
|
|
270
380
|
var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
|
|
271
381
|
var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
|
|
@@ -277,6 +387,21 @@ var contentPanelInsetPaddingSx = {
|
|
|
277
387
|
var contentPanelListRowPaddingSx = {
|
|
278
388
|
...contentPanelInsetPaddingSx
|
|
279
389
|
};
|
|
390
|
+
var contentPanelListItemActiveActionsInsetSx = {
|
|
391
|
+
"&& > .MuiListItemButton-root": {
|
|
392
|
+
paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
|
|
393
|
+
paddingRight: "unset"
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function getContentPanelListItemSx(hasActiveRowActions) {
|
|
397
|
+
if (!hasActiveRowActions) {
|
|
398
|
+
return contentPanelListRowPaddingSx;
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
...contentPanelListRowPaddingSx,
|
|
402
|
+
...contentPanelListItemActiveActionsInsetSx
|
|
403
|
+
};
|
|
404
|
+
}
|
|
280
405
|
var contentPanelHeaderStackSx = {
|
|
281
406
|
width: "100%"
|
|
282
407
|
};
|
|
@@ -318,7 +443,7 @@ var contentPanelListItemButtonSx = {
|
|
|
318
443
|
var React3 = __toESM(require("react"));
|
|
319
444
|
var import_icons3 = require("@elementor/icons");
|
|
320
445
|
var import_ui2 = require("@elementor/ui");
|
|
321
|
-
var
|
|
446
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
322
447
|
|
|
323
448
|
// src/hooks/use-can-create.ts
|
|
324
449
|
function useCanCreate(postTypeSlug) {
|
|
@@ -366,44 +491,249 @@ function ContentPanelHeaderAdd() {
|
|
|
366
491
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
367
492
|
ContentPanelAddIconButton,
|
|
368
493
|
{
|
|
369
|
-
"aria-label": (0,
|
|
494
|
+
"aria-label": (0, import_i18n3.__)("Add new", "elementor"),
|
|
370
495
|
...buttonProps,
|
|
371
496
|
disabled: !canAddAny
|
|
372
497
|
}
|
|
373
498
|
), /* @__PURE__ */ React3.createElement(import_ui2.Menu, { ...menuProps }, accessibleSlugs.map((slug) => /* @__PURE__ */ React3.createElement(HeaderAddMenuItem, { key: slug, onSelect: handleSelectType, slug }))));
|
|
374
499
|
}
|
|
375
500
|
|
|
376
|
-
// src/components/panel/content-panel-
|
|
501
|
+
// src/components/panel/content-panel-toolbar.tsx
|
|
502
|
+
var React9 = __toESM(require("react"));
|
|
503
|
+
var import_ui8 = require("@elementor/ui");
|
|
504
|
+
|
|
505
|
+
// src/components/panel/content-panel-active-filters.tsx
|
|
506
|
+
var React5 = __toESM(require("react"));
|
|
507
|
+
var import_ui4 = require("@elementor/ui");
|
|
508
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
509
|
+
|
|
510
|
+
// src/components/panel/content-panel-clear-filters-button.tsx
|
|
377
511
|
var React4 = __toESM(require("react"));
|
|
378
512
|
var import_icons4 = require("@elementor/icons");
|
|
379
513
|
var import_ui3 = require("@elementor/ui");
|
|
380
|
-
|
|
514
|
+
function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
|
|
515
|
+
return /* @__PURE__ */ React4.createElement(import_ui3.Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React4.createElement(import_ui3.Box, null, /* @__PURE__ */ React4.createElement(import_ui3.IconButton, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React4.createElement(import_icons4.BrushBigIcon, { fontSize: "tiny" }))));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// src/components/panel/content-panel-active-filters.tsx
|
|
519
|
+
var contentPanelFilterChipSx = {
|
|
520
|
+
"& .MuiChip-deleteIcon": {
|
|
521
|
+
display: "none",
|
|
522
|
+
transition: "opacity 0.2s"
|
|
523
|
+
},
|
|
524
|
+
"&:hover .MuiChip-deleteIcon": {
|
|
525
|
+
display: "block"
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
function ContentPanelActiveFilters() {
|
|
529
|
+
const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
|
|
530
|
+
if (!hasActiveSiteContentStatusFilters(statusFilters)) {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
|
|
534
|
+
return /* @__PURE__ */ React5.createElement(import_ui4.Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React5.createElement(import_ui4.Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, activeKeys.map((key) => /* @__PURE__ */ React5.createElement(
|
|
535
|
+
import_ui4.Chip,
|
|
536
|
+
{
|
|
537
|
+
key,
|
|
538
|
+
label: getSiteContentStatusFilterLabel(key),
|
|
539
|
+
onDelete: () => toggleStatusFilter(key),
|
|
540
|
+
size: "tiny",
|
|
541
|
+
sx: contentPanelFilterChipSx
|
|
542
|
+
}
|
|
543
|
+
))), /* @__PURE__ */ React5.createElement(
|
|
544
|
+
ContentPanelClearFiltersButton,
|
|
545
|
+
{
|
|
546
|
+
ariaLabel: (0, import_i18n4.__)("Clear Filters", "elementor"),
|
|
547
|
+
onClear: clearStatusFilters,
|
|
548
|
+
sx: { margin: "0 0 auto auto" },
|
|
549
|
+
tooltipText: (0, import_i18n4.__)("Clear Filters", "elementor")
|
|
550
|
+
}
|
|
551
|
+
));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// src/components/panel/content-panel-search.tsx
|
|
555
|
+
var React6 = __toESM(require("react"));
|
|
556
|
+
var import_icons5 = require("@elementor/icons");
|
|
557
|
+
var import_ui5 = require("@elementor/ui");
|
|
558
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
381
559
|
function ContentPanelSearch() {
|
|
382
560
|
const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
|
|
383
|
-
return /* @__PURE__ */
|
|
384
|
-
|
|
561
|
+
return /* @__PURE__ */ React6.createElement(import_ui5.Box, { component: "search", "aria-label": (0, import_i18n5.__)("Search site content", "elementor") }, /* @__PURE__ */ React6.createElement(
|
|
562
|
+
import_ui5.TextField,
|
|
385
563
|
{
|
|
386
564
|
fullWidth: true,
|
|
387
565
|
size: "tiny",
|
|
388
566
|
value: searchQuery,
|
|
389
|
-
placeholder: (0,
|
|
567
|
+
placeholder: (0, import_i18n5.__)("Search", "elementor"),
|
|
390
568
|
onChange: (event) => setSearchQuery(event.target.value),
|
|
391
569
|
inputProps: {
|
|
392
|
-
"aria-label": (0,
|
|
570
|
+
"aria-label": (0, import_i18n5.__)("Search", "elementor")
|
|
393
571
|
},
|
|
394
572
|
InputProps: {
|
|
395
|
-
startAdornment: /* @__PURE__ */
|
|
573
|
+
startAdornment: /* @__PURE__ */ React6.createElement(import_ui5.InputAdornment, { position: "start" }, /* @__PURE__ */ React6.createElement(import_icons5.SearchIcon, { fontSize: "tiny" }))
|
|
396
574
|
}
|
|
397
575
|
}
|
|
398
576
|
));
|
|
399
577
|
}
|
|
400
578
|
|
|
579
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
580
|
+
var React8 = __toESM(require("react"));
|
|
581
|
+
var import_editor_ui = require("@elementor/editor-ui");
|
|
582
|
+
var import_icons7 = require("@elementor/icons");
|
|
583
|
+
var import_ui7 = require("@elementor/ui");
|
|
584
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
585
|
+
|
|
586
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
587
|
+
var React7 = __toESM(require("react"));
|
|
588
|
+
var import_icons6 = require("@elementor/icons");
|
|
589
|
+
var import_ui6 = require("@elementor/ui");
|
|
590
|
+
|
|
591
|
+
// src/hooks/use-site-content-status-filter-counts.ts
|
|
592
|
+
var import_query2 = require("@elementor/query");
|
|
593
|
+
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
594
|
+
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
595
|
+
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
596
|
+
...siteContentStatusFilterCountsQueryKeyBase,
|
|
597
|
+
postTypes.join(",")
|
|
598
|
+
];
|
|
599
|
+
var sumFulfilledTotals = (results) => {
|
|
600
|
+
const fulfilled = results.filter(
|
|
601
|
+
(result) => "fulfilled" === result.status
|
|
602
|
+
);
|
|
603
|
+
if (fulfilled.length !== results.length) {
|
|
604
|
+
return void 0;
|
|
605
|
+
}
|
|
606
|
+
return fulfilled.reduce((sum, result) => sum + result.value, 0);
|
|
607
|
+
};
|
|
608
|
+
var fetchStatusFilterCounts = async (postTypes) => {
|
|
609
|
+
const entries = await Promise.all(
|
|
610
|
+
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
611
|
+
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
612
|
+
const total = sumFulfilledTotals(results);
|
|
613
|
+
if (void 0 === total) {
|
|
614
|
+
return null;
|
|
615
|
+
}
|
|
616
|
+
return [status, total];
|
|
617
|
+
})
|
|
618
|
+
);
|
|
619
|
+
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
620
|
+
};
|
|
621
|
+
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
622
|
+
return (0, import_query2.useQuery)({
|
|
623
|
+
enabled: enabled && postTypes.length > 0,
|
|
624
|
+
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
625
|
+
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
626
|
+
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
631
|
+
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React7.createElement(import_ui6.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React7.createElement(import_ui6.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React7.createElement(import_icons6.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
632
|
+
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
633
|
+
const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
|
|
634
|
+
const { accessiblePostTypes } = useAccessiblePanelPostTypes();
|
|
635
|
+
const { data: statusCounts, isPending: isLoadingCounts } = useSiteContentStatusFilterCounts(
|
|
636
|
+
accessiblePostTypes,
|
|
637
|
+
loadCounts
|
|
638
|
+
);
|
|
639
|
+
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
640
|
+
const visibleFilters = SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
641
|
+
(filter) => shouldShowSiteContentStatusFilterRow(statusCounts?.[filter], isLoadingCounts, statusFilters[filter])
|
|
642
|
+
);
|
|
643
|
+
return /* @__PURE__ */ React7.createElement(import_ui6.MenuList, { dense: true }, /* @__PURE__ */ React7.createElement(
|
|
644
|
+
import_ui6.MenuItem,
|
|
645
|
+
{
|
|
646
|
+
"aria-checked": isAllSelected,
|
|
647
|
+
onClick: clearStatusFilters,
|
|
648
|
+
role: "menuitemcheckbox",
|
|
649
|
+
selected: isAllSelected
|
|
650
|
+
},
|
|
651
|
+
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
652
|
+
), visibleFilters.map((filter) => {
|
|
653
|
+
const isSelected = statusFilters[filter];
|
|
654
|
+
return /* @__PURE__ */ React7.createElement(
|
|
655
|
+
import_ui6.MenuItem,
|
|
656
|
+
{
|
|
657
|
+
key: filter,
|
|
658
|
+
"aria-checked": isSelected,
|
|
659
|
+
onClick: () => toggleStatusFilter(filter),
|
|
660
|
+
role: "menuitemcheckbox",
|
|
661
|
+
selected: isSelected
|
|
662
|
+
},
|
|
663
|
+
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
664
|
+
);
|
|
665
|
+
}));
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
669
|
+
function ContentPanelStatusFilter() {
|
|
670
|
+
const { clearStatusFilters, statusFilters } = useContentPanelCoordinator();
|
|
671
|
+
const popupState = (0, import_ui7.usePopupState)({
|
|
672
|
+
variant: "popover",
|
|
673
|
+
disableAutoFocus: true
|
|
674
|
+
});
|
|
675
|
+
const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
|
|
676
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui7.Tooltip, { placement: "top", title: (0, import_i18n6.__)("Filters", "elementor") }, /* @__PURE__ */ React8.createElement(
|
|
677
|
+
import_ui7.ToggleButton,
|
|
678
|
+
{
|
|
679
|
+
"aria-label": (0, import_i18n6.__)("Filters", "elementor"),
|
|
680
|
+
selected: popupState.isOpen || hasActiveFilters,
|
|
681
|
+
size: "tiny",
|
|
682
|
+
value: "filter",
|
|
683
|
+
...(0, import_ui7.bindToggle)(popupState)
|
|
684
|
+
},
|
|
685
|
+
/* @__PURE__ */ React8.createElement(import_icons7.FilterIcon, { fontSize: "tiny" })
|
|
686
|
+
)), /* @__PURE__ */ React8.createElement(
|
|
687
|
+
import_ui7.Popover,
|
|
688
|
+
{
|
|
689
|
+
anchorOrigin: {
|
|
690
|
+
horizontal: "right",
|
|
691
|
+
vertical: "top"
|
|
692
|
+
},
|
|
693
|
+
sx: {
|
|
694
|
+
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
695
|
+
},
|
|
696
|
+
transformOrigin: {
|
|
697
|
+
horizontal: -21,
|
|
698
|
+
vertical: "top"
|
|
699
|
+
},
|
|
700
|
+
...(0, import_ui7.bindPopover)(popupState)
|
|
701
|
+
},
|
|
702
|
+
/* @__PURE__ */ React8.createElement(
|
|
703
|
+
import_editor_ui.PopoverHeader,
|
|
704
|
+
{
|
|
705
|
+
actions: hasActiveFilters ? [
|
|
706
|
+
/* @__PURE__ */ React8.createElement(
|
|
707
|
+
ContentPanelClearFiltersButton,
|
|
708
|
+
{
|
|
709
|
+
ariaLabel: (0, import_i18n6.__)("Clear all", "elementor"),
|
|
710
|
+
key: "clear-all-filters",
|
|
711
|
+
onClear: clearStatusFilters,
|
|
712
|
+
tooltipText: (0, import_i18n6.__)("Clear all", "elementor")
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
] : [],
|
|
716
|
+
icon: /* @__PURE__ */ React8.createElement(import_icons7.FilterIcon, { fontSize: "tiny" }),
|
|
717
|
+
onClose: popupState.close,
|
|
718
|
+
title: (0, import_i18n6.__)("Filters", "elementor")
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
/* @__PURE__ */ React8.createElement(import_ui7.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
722
|
+
/* @__PURE__ */ React8.createElement(import_editor_ui.PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React8.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
723
|
+
));
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/components/panel/content-panel-toolbar.tsx
|
|
727
|
+
function ContentPanelToolbar() {
|
|
728
|
+
return /* @__PURE__ */ React9.createElement(import_ui8.Box, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React9.createElement(import_ui8.Stack, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React9.createElement(import_ui8.Stack, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React9.createElement(import_ui8.Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React9.createElement(ContentPanelSearch, null)), /* @__PURE__ */ React9.createElement(ContentPanelStatusFilter, null)), /* @__PURE__ */ React9.createElement(ContentPanelActiveFilters, null)));
|
|
729
|
+
}
|
|
730
|
+
|
|
401
731
|
// src/components/panel/error-snackbar.tsx
|
|
402
|
-
var
|
|
403
|
-
var
|
|
732
|
+
var React10 = __toESM(require("react"));
|
|
733
|
+
var import_ui9 = require("@elementor/ui");
|
|
404
734
|
var ErrorSnackbar = ({ open, onClose }) => {
|
|
405
|
-
return /* @__PURE__ */
|
|
406
|
-
|
|
735
|
+
return /* @__PURE__ */ React10.createElement(
|
|
736
|
+
import_ui9.Snackbar,
|
|
407
737
|
{
|
|
408
738
|
open,
|
|
409
739
|
onClose,
|
|
@@ -412,8 +742,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
412
742
|
horizontal: "left"
|
|
413
743
|
}
|
|
414
744
|
},
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
|
|
745
|
+
/* @__PURE__ */ React10.createElement(import_ui9.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React10.createElement(
|
|
746
|
+
import_ui9.Typography,
|
|
417
747
|
{
|
|
418
748
|
component: "span",
|
|
419
749
|
sx: {
|
|
@@ -427,11 +757,11 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
427
757
|
var error_snackbar_default = ErrorSnackbar;
|
|
428
758
|
|
|
429
759
|
// src/components/panel/shell-panel-body-content.tsx
|
|
430
|
-
var
|
|
431
|
-
var
|
|
760
|
+
var React33 = __toESM(require("react"));
|
|
761
|
+
var import_ui22 = require("@elementor/ui");
|
|
432
762
|
|
|
433
763
|
// src/contexts/post-list-context.tsx
|
|
434
|
-
var
|
|
764
|
+
var React11 = __toESM(require("react"));
|
|
435
765
|
var import_react3 = require("react");
|
|
436
766
|
var defaultValues = {
|
|
437
767
|
type: "page",
|
|
@@ -450,7 +780,7 @@ var PostListContextProvider = ({
|
|
|
450
780
|
const resetEditMode = () => {
|
|
451
781
|
setEditMode(defaultValues.editMode);
|
|
452
782
|
};
|
|
453
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ React11.createElement(
|
|
454
784
|
PostListContext.Provider,
|
|
455
785
|
{
|
|
456
786
|
value: {
|
|
@@ -473,13 +803,13 @@ function usePostListContext() {
|
|
|
473
803
|
}
|
|
474
804
|
|
|
475
805
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
476
|
-
var
|
|
477
|
-
var
|
|
478
|
-
var
|
|
479
|
-
var
|
|
806
|
+
var React31 = __toESM(require("react"));
|
|
807
|
+
var import_react10 = require("react");
|
|
808
|
+
var import_ui20 = require("@elementor/ui");
|
|
809
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
480
810
|
|
|
481
811
|
// src/hooks/use-homepage.ts
|
|
482
|
-
var
|
|
812
|
+
var import_query3 = require("@elementor/query");
|
|
483
813
|
|
|
484
814
|
// src/api/settings.ts
|
|
485
815
|
var import_api_fetch3 = __toESM(require("@wordpress/api-fetch"));
|
|
@@ -499,7 +829,7 @@ var updateSettings = (settings) => {
|
|
|
499
829
|
// src/hooks/use-homepage.ts
|
|
500
830
|
var settingsQueryKey = () => ["site-navigation", "homepage"];
|
|
501
831
|
function useHomepage() {
|
|
502
|
-
return (0,
|
|
832
|
+
return (0, import_query3.useQuery)({
|
|
503
833
|
queryKey: settingsQueryKey(),
|
|
504
834
|
queryFn: () => getSettings()
|
|
505
835
|
});
|
|
@@ -570,15 +900,13 @@ function usePostListPagination({
|
|
|
570
900
|
}
|
|
571
901
|
|
|
572
902
|
// src/hooks/use-posts.ts
|
|
573
|
-
var
|
|
903
|
+
var import_query4 = require("@elementor/query");
|
|
574
904
|
var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
|
|
575
|
-
var postsQueryKey = (postTypeSlug,
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
return [...postsQueryKeyBase(postTypeSlug), trimmedSearch];
|
|
581
|
-
};
|
|
905
|
+
var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any") => [
|
|
906
|
+
...postsQueryKeyBase(postTypeSlug),
|
|
907
|
+
restStatus,
|
|
908
|
+
trimmedSearch
|
|
909
|
+
];
|
|
582
910
|
var flattenData = (data) => {
|
|
583
911
|
if (!data) {
|
|
584
912
|
return data;
|
|
@@ -589,33 +917,53 @@ var flattenData = (data) => {
|
|
|
589
917
|
});
|
|
590
918
|
return flattened;
|
|
591
919
|
};
|
|
592
|
-
function usePosts(postTypeSlug, search = "") {
|
|
920
|
+
function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS) {
|
|
593
921
|
const trimmedSearch = search.trim();
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
922
|
+
const restStatus = getRestStatusForSiteContentFilters(statusFilters);
|
|
923
|
+
const query = (0, import_query4.useInfiniteQuery)({
|
|
924
|
+
queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus),
|
|
925
|
+
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus),
|
|
597
926
|
initialPageParam: 1,
|
|
598
927
|
getNextPageParam: (lastPage) => {
|
|
599
928
|
return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
|
|
600
929
|
},
|
|
601
|
-
placeholderData:
|
|
930
|
+
placeholderData: import_query4.keepPreviousData
|
|
602
931
|
});
|
|
603
932
|
return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
|
|
604
933
|
}
|
|
605
934
|
|
|
935
|
+
// src/hooks/use-posts-baseline-total.ts
|
|
936
|
+
var import_query5 = require("@elementor/query");
|
|
937
|
+
var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
|
|
938
|
+
"site-navigation",
|
|
939
|
+
"posts-baseline-total",
|
|
940
|
+
postTypeSlug
|
|
941
|
+
];
|
|
942
|
+
var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
|
|
943
|
+
...postsBaselineTotalQueryKeyBase(postTypeSlug),
|
|
944
|
+
status
|
|
945
|
+
];
|
|
946
|
+
function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
947
|
+
return (0, import_query5.useQuery)({
|
|
948
|
+
enabled,
|
|
949
|
+
queryFn: () => fetchPostsTotal(postTypeSlug, status),
|
|
950
|
+
queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
|
|
606
954
|
// src/components/panel/section-add-button.tsx
|
|
607
|
-
var
|
|
608
|
-
var
|
|
955
|
+
var React12 = __toESM(require("react"));
|
|
956
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
609
957
|
function SectionAddButton({ onBeforeCreate }) {
|
|
610
958
|
const { type, setEditMode } = usePostListContext();
|
|
611
959
|
const canCreate = useCanCreate(type);
|
|
612
960
|
const singularName = postTypesMap[type].labels.singular_name;
|
|
613
|
-
const ariaLabel = (0,
|
|
961
|
+
const ariaLabel = (0, import_i18n7.sprintf)(
|
|
614
962
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
615
|
-
(0,
|
|
963
|
+
(0, import_i18n7.__)("New %s", "elementor"),
|
|
616
964
|
singularName
|
|
617
965
|
);
|
|
618
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ React12.createElement(
|
|
619
967
|
ContentPanelAddIconButton,
|
|
620
968
|
{
|
|
621
969
|
"aria-label": ariaLabel,
|
|
@@ -630,10 +978,10 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
630
978
|
}
|
|
631
979
|
|
|
632
980
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
633
|
-
var
|
|
981
|
+
var React13 = __toESM(require("react"));
|
|
634
982
|
var import_react5 = require("react");
|
|
635
|
-
var
|
|
636
|
-
var
|
|
983
|
+
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
984
|
+
var import_ui10 = require("@elementor/ui");
|
|
637
985
|
var sectionHeaderListItemButtonSx = {
|
|
638
986
|
flexGrow: 1,
|
|
639
987
|
justifyContent: "flex-start",
|
|
@@ -643,11 +991,12 @@ var sectionHeaderListItemButtonSx = {
|
|
|
643
991
|
"&:hover": { backgroundColor: "transparent" },
|
|
644
992
|
"&.Mui-focusVisible": { backgroundColor: "transparent" }
|
|
645
993
|
};
|
|
646
|
-
function getSectionHeaderAriaLabel(title,
|
|
647
|
-
return `${title} (${
|
|
994
|
+
function getSectionHeaderAriaLabel(title, countLabel) {
|
|
995
|
+
return `${title} (${countLabel})`;
|
|
648
996
|
}
|
|
649
997
|
function CollapsibleList({
|
|
650
998
|
count,
|
|
999
|
+
countChipLabel,
|
|
651
1000
|
headerRef,
|
|
652
1001
|
isOpen,
|
|
653
1002
|
onOpenChange,
|
|
@@ -658,10 +1007,11 @@ function CollapsibleList({
|
|
|
658
1007
|
const id = (0, import_react5.useId)();
|
|
659
1008
|
const labelId = `label-${id}`;
|
|
660
1009
|
const contentId = `content-${id}`;
|
|
661
|
-
const
|
|
1010
|
+
const chipLabel = countChipLabel ?? count.toString();
|
|
1011
|
+
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
|
|
662
1012
|
const handleClick = () => onOpenChange(!isOpen);
|
|
663
|
-
return /* @__PURE__ */
|
|
664
|
-
|
|
1013
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
1014
|
+
import_ui10.Box,
|
|
665
1015
|
{
|
|
666
1016
|
sx: {
|
|
667
1017
|
...contentPanelSectionHeaderSx,
|
|
@@ -671,8 +1021,8 @@ function CollapsibleList({
|
|
|
671
1021
|
width: "100%"
|
|
672
1022
|
}
|
|
673
1023
|
},
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
|
|
1024
|
+
/* @__PURE__ */ React13.createElement(
|
|
1025
|
+
import_ui10.ListItemButton,
|
|
676
1026
|
{
|
|
677
1027
|
ref: headerRef,
|
|
678
1028
|
id: labelId,
|
|
@@ -685,8 +1035,8 @@ function CollapsibleList({
|
|
|
685
1035
|
onClick: handleClick,
|
|
686
1036
|
sx: sectionHeaderListItemButtonSx
|
|
687
1037
|
},
|
|
688
|
-
/* @__PURE__ */
|
|
689
|
-
|
|
1038
|
+
/* @__PURE__ */ React13.createElement(import_ui10.Stack, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React13.createElement(import_ui10.Stack, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React13.createElement(
|
|
1039
|
+
import_ui10.ListItemText,
|
|
690
1040
|
{
|
|
691
1041
|
secondary: title,
|
|
692
1042
|
secondaryTypographyProps: {
|
|
@@ -696,10 +1046,10 @@ function CollapsibleList({
|
|
|
696
1046
|
},
|
|
697
1047
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
698
1048
|
}
|
|
699
|
-
), /* @__PURE__ */
|
|
1049
|
+
), /* @__PURE__ */ React13.createElement(import_ui10.Chip, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React13.createElement(import_editor_ui2.CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
|
|
700
1050
|
),
|
|
701
|
-
trailingActions && /* @__PURE__ */
|
|
702
|
-
|
|
1051
|
+
trailingActions && /* @__PURE__ */ React13.createElement(
|
|
1052
|
+
import_ui10.Stack,
|
|
703
1053
|
{
|
|
704
1054
|
alignItems: "center",
|
|
705
1055
|
direction: "row",
|
|
@@ -709,17 +1059,17 @@ function CollapsibleList({
|
|
|
709
1059
|
},
|
|
710
1060
|
trailingActions
|
|
711
1061
|
)
|
|
712
|
-
), /* @__PURE__ */
|
|
1062
|
+
), /* @__PURE__ */ React13.createElement(import_ui10.Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React13.createElement(import_ui10.List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React13.createElement(import_ui10.Divider, null));
|
|
713
1063
|
}
|
|
714
1064
|
|
|
715
1065
|
// src/components/panel/posts-list/error-state.tsx
|
|
716
|
-
var
|
|
717
|
-
var
|
|
718
|
-
var
|
|
719
|
-
var
|
|
1066
|
+
var React14 = __toESM(require("react"));
|
|
1067
|
+
var import_icons8 = require("@elementor/icons");
|
|
1068
|
+
var import_ui11 = require("@elementor/ui");
|
|
1069
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
720
1070
|
function ErrorState() {
|
|
721
|
-
return /* @__PURE__ */
|
|
722
|
-
|
|
1071
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1072
|
+
import_ui11.Box,
|
|
723
1073
|
{
|
|
724
1074
|
sx: {
|
|
725
1075
|
display: "flex",
|
|
@@ -730,9 +1080,9 @@ function ErrorState() {
|
|
|
730
1080
|
gap: "16px"
|
|
731
1081
|
}
|
|
732
1082
|
},
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
|
|
1083
|
+
/* @__PURE__ */ React14.createElement(import_icons8.Error404TemplateIcon, null),
|
|
1084
|
+
/* @__PURE__ */ React14.createElement(
|
|
1085
|
+
import_ui11.Box,
|
|
736
1086
|
{
|
|
737
1087
|
sx: {
|
|
738
1088
|
display: "flex",
|
|
@@ -742,25 +1092,28 @@ function ErrorState() {
|
|
|
742
1092
|
gap: "8px"
|
|
743
1093
|
}
|
|
744
1094
|
},
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
1095
|
+
/* @__PURE__ */ React14.createElement(import_ui11.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n8.__)("We couldn\u2019t display your pages.", "elementor")),
|
|
1096
|
+
/* @__PURE__ */ React14.createElement(import_ui11.Box, null, /* @__PURE__ */ React14.createElement(import_ui11.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n8.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React14.createElement(import_ui11.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n8.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React14.createElement(import_ui11.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
|
|
747
1097
|
)
|
|
748
1098
|
);
|
|
749
1099
|
}
|
|
750
1100
|
|
|
751
1101
|
// src/components/panel/posts-list/post-list-item.tsx
|
|
752
|
-
var
|
|
1102
|
+
var React29 = __toESM(require("react"));
|
|
753
1103
|
|
|
754
1104
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
755
|
-
var
|
|
1105
|
+
var React16 = __toESM(require("react"));
|
|
756
1106
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
757
|
-
var
|
|
1107
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
758
1108
|
|
|
759
1109
|
// src/hooks/use-posts-actions.ts
|
|
760
|
-
var
|
|
1110
|
+
var import_query7 = require("@elementor/query");
|
|
1111
|
+
|
|
1112
|
+
// src/site-content-restore.ts
|
|
1113
|
+
var SITE_CONTENT_V1_RESTORE_STATUS = "draft";
|
|
761
1114
|
|
|
762
1115
|
// src/hooks/use-recent-posts.ts
|
|
763
|
-
var
|
|
1116
|
+
var import_query6 = require("@elementor/query");
|
|
764
1117
|
|
|
765
1118
|
// src/api/recent-posts.ts
|
|
766
1119
|
var import_api_fetch4 = __toESM(require("@wordpress/api-fetch"));
|
|
@@ -777,7 +1130,7 @@ var getRequest2 = () => {
|
|
|
777
1130
|
// src/hooks/use-recent-posts.ts
|
|
778
1131
|
var recentPostsQueryKey = ["site-navigation", "recent-posts"];
|
|
779
1132
|
function useRecentPosts() {
|
|
780
|
-
return (0,
|
|
1133
|
+
return (0, import_query6.useQuery)({
|
|
781
1134
|
queryKey: recentPostsQueryKey,
|
|
782
1135
|
queryFn: () => getRequest2()
|
|
783
1136
|
});
|
|
@@ -787,44 +1140,56 @@ function useRecentPosts() {
|
|
|
787
1140
|
function usePostActions(postTypeSlug) {
|
|
788
1141
|
const invalidatePosts = useInvalidatePosts(postTypeSlug);
|
|
789
1142
|
const onSuccess = () => invalidatePosts();
|
|
790
|
-
const createPost = (0,
|
|
1143
|
+
const createPost = (0, import_query7.useMutation)({
|
|
791
1144
|
mutationFn: (newPost) => createRequest(postTypeSlug, newPost),
|
|
792
1145
|
onSuccess
|
|
793
1146
|
});
|
|
794
|
-
const updatePost = (0,
|
|
1147
|
+
const updatePost = (0, import_query7.useMutation)({
|
|
795
1148
|
mutationFn: (updatedPost) => updateRequest(postTypeSlug, updatedPost),
|
|
796
1149
|
onSuccess
|
|
797
1150
|
});
|
|
798
|
-
const deletePost = (0,
|
|
1151
|
+
const deletePost = (0, import_query7.useMutation)({
|
|
799
1152
|
mutationFn: (postId) => deleteRequest(postTypeSlug, postId),
|
|
800
1153
|
onSuccess
|
|
801
1154
|
});
|
|
802
|
-
const
|
|
1155
|
+
const forceDeletePost = (0, import_query7.useMutation)({
|
|
1156
|
+
mutationFn: (postId) => deleteRequest(postTypeSlug, postId, true),
|
|
1157
|
+
onSuccess
|
|
1158
|
+
});
|
|
1159
|
+
const restorePost = (0, import_query7.useMutation)({
|
|
1160
|
+
mutationFn: (postId) => updateRequest(postTypeSlug, { id: postId, status: SITE_CONTENT_V1_RESTORE_STATUS }),
|
|
1161
|
+
onSuccess
|
|
1162
|
+
});
|
|
1163
|
+
const duplicatePost = (0, import_query7.useMutation)({
|
|
803
1164
|
mutationFn: (originalPost) => duplicateRequest(originalPost),
|
|
804
1165
|
onSuccess
|
|
805
1166
|
});
|
|
806
1167
|
return {
|
|
807
1168
|
createPost,
|
|
808
|
-
updatePost,
|
|
809
1169
|
deletePost,
|
|
810
|
-
duplicatePost
|
|
1170
|
+
duplicatePost,
|
|
1171
|
+
forceDeletePost,
|
|
1172
|
+
restorePost,
|
|
1173
|
+
updatePost
|
|
811
1174
|
};
|
|
812
1175
|
}
|
|
813
1176
|
function useInvalidatePosts(postTypeSlug) {
|
|
814
|
-
const queryClient = (0,
|
|
1177
|
+
const queryClient = (0, import_query7.useQueryClient)();
|
|
815
1178
|
return () => {
|
|
816
1179
|
const queryKey = postsQueryKeyBase(postTypeSlug);
|
|
817
1180
|
queryClient.invalidateQueries({ queryKey: recentPostsQueryKey });
|
|
1181
|
+
queryClient.invalidateQueries({ queryKey: postsBaselineTotalQueryKeyBase(postTypeSlug) });
|
|
1182
|
+
queryClient.invalidateQueries({ queryKey: siteContentStatusFilterCountsQueryKeyBase });
|
|
818
1183
|
return queryClient.invalidateQueries({ queryKey });
|
|
819
1184
|
};
|
|
820
1185
|
}
|
|
821
1186
|
|
|
822
1187
|
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
823
|
-
var
|
|
1188
|
+
var React15 = __toESM(require("react"));
|
|
824
1189
|
var import_react6 = require("react");
|
|
825
|
-
var
|
|
826
|
-
var
|
|
827
|
-
var
|
|
1190
|
+
var import_icons9 = require("@elementor/icons");
|
|
1191
|
+
var import_ui12 = require("@elementor/ui");
|
|
1192
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
828
1193
|
var EDIT_ROW_FOCUS_BORDER_WIDTH_PX = 2;
|
|
829
1194
|
var EDIT_ROW_MIN_HEIGHT_PX = 36;
|
|
830
1195
|
var editModeListItemButtonSx = {
|
|
@@ -896,32 +1261,32 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
|
896
1261
|
}
|
|
897
1262
|
const value = e.target.value;
|
|
898
1263
|
if (!validateInput(value)) {
|
|
899
|
-
setInputError((0,
|
|
1264
|
+
setInputError((0, import_i18n9.__)("Name is required", "elementor"));
|
|
900
1265
|
} else {
|
|
901
1266
|
setInputError(null);
|
|
902
1267
|
}
|
|
903
1268
|
setTitle(value);
|
|
904
1269
|
};
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
|
|
1270
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
1271
|
+
import_ui12.ListItem,
|
|
907
1272
|
{
|
|
908
1273
|
disablePadding: true,
|
|
909
1274
|
sx: contentPanelListRowPaddingSx,
|
|
910
|
-
secondaryAction: /* @__PURE__ */
|
|
1275
|
+
secondaryAction: /* @__PURE__ */ React15.createElement(CloseButton, { isLoading, closeButton })
|
|
911
1276
|
},
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
|
|
1277
|
+
/* @__PURE__ */ React15.createElement(
|
|
1278
|
+
import_ui12.Box,
|
|
914
1279
|
{
|
|
915
1280
|
component: "form",
|
|
916
1281
|
onSubmit: onFormSubmit,
|
|
917
1282
|
sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
|
|
918
1283
|
},
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
|
|
1284
|
+
/* @__PURE__ */ React15.createElement(import_ui12.Box, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React15.createElement(
|
|
1285
|
+
import_ui12.Box,
|
|
921
1286
|
{
|
|
922
1287
|
autoFocus: true,
|
|
923
1288
|
"aria-invalid": !!inputError,
|
|
924
|
-
"aria-label": (0,
|
|
1289
|
+
"aria-label": (0, import_i18n9.__)("Name", "elementor"),
|
|
925
1290
|
component: "input",
|
|
926
1291
|
disabled: isLoading,
|
|
927
1292
|
onBlur,
|
|
@@ -932,11 +1297,11 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
|
|
|
932
1297
|
}
|
|
933
1298
|
))
|
|
934
1299
|
)
|
|
935
|
-
), inputError && /* @__PURE__ */
|
|
1300
|
+
), inputError && /* @__PURE__ */ React15.createElement(import_ui12.ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React15.createElement(import_ui12.ListItemText, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
|
|
936
1301
|
}
|
|
937
1302
|
function CloseButton({ isLoading, closeButton }) {
|
|
938
1303
|
const { resetEditMode } = usePostListContext();
|
|
939
|
-
return /* @__PURE__ */
|
|
1304
|
+
return /* @__PURE__ */ React15.createElement(import_ui12.IconButton, { size: "tiny", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React15.createElement(import_ui12.CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React15.createElement(import_icons9.XIcon, { fontSize: "tiny" }));
|
|
940
1305
|
}
|
|
941
1306
|
|
|
942
1307
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
@@ -958,12 +1323,12 @@ function ListItemCreate() {
|
|
|
958
1323
|
resetEditMode();
|
|
959
1324
|
}
|
|
960
1325
|
};
|
|
961
|
-
const newItemLabel = (0,
|
|
1326
|
+
const newItemLabel = (0, import_i18n10.sprintf)(
|
|
962
1327
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
963
|
-
(0,
|
|
1328
|
+
(0, import_i18n10.__)("New %s", "elementor"),
|
|
964
1329
|
postTypesMap[type].labels.singular_name
|
|
965
1330
|
);
|
|
966
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ React16.createElement(
|
|
967
1332
|
EditModeTemplate,
|
|
968
1333
|
{
|
|
969
1334
|
postTitle: newItemLabel,
|
|
@@ -974,9 +1339,9 @@ function ListItemCreate() {
|
|
|
974
1339
|
}
|
|
975
1340
|
|
|
976
1341
|
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx
|
|
977
|
-
var
|
|
1342
|
+
var React17 = __toESM(require("react"));
|
|
978
1343
|
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
979
|
-
var
|
|
1344
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
980
1345
|
function ListItemDuplicate() {
|
|
981
1346
|
const { type, editMode, resetEditMode } = usePostListContext();
|
|
982
1347
|
const navigateToDocument = (0, import_editor_documents2.__useNavigateToDocument)();
|
|
@@ -998,10 +1363,10 @@ function ListItemDuplicate() {
|
|
|
998
1363
|
resetEditMode();
|
|
999
1364
|
}
|
|
1000
1365
|
};
|
|
1001
|
-
return /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1002
1367
|
EditModeTemplate,
|
|
1003
1368
|
{
|
|
1004
|
-
postTitle: `${editMode.details.title} ${(0,
|
|
1369
|
+
postTitle: `${editMode.details.title} ${(0, import_i18n11.__)("copy", "elementor")}`,
|
|
1005
1370
|
isLoading: duplicatePost.isPending,
|
|
1006
1371
|
callback: duplicatePostCallback
|
|
1007
1372
|
}
|
|
@@ -1009,7 +1374,7 @@ function ListItemDuplicate() {
|
|
|
1009
1374
|
}
|
|
1010
1375
|
|
|
1011
1376
|
// src/components/panel/posts-list/list-items/list-item-rename.tsx
|
|
1012
|
-
var
|
|
1377
|
+
var React18 = __toESM(require("react"));
|
|
1013
1378
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
1014
1379
|
|
|
1015
1380
|
// src/hooks/use-rename-active-document.ts
|
|
@@ -1060,20 +1425,20 @@ function ListItemRename({ post }) {
|
|
|
1060
1425
|
resetEditMode();
|
|
1061
1426
|
}
|
|
1062
1427
|
};
|
|
1063
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ React18.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
|
|
1064
1429
|
}
|
|
1065
1430
|
|
|
1066
1431
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1067
|
-
var
|
|
1432
|
+
var React28 = __toESM(require("react"));
|
|
1068
1433
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1071
|
-
var
|
|
1434
|
+
var import_icons17 = require("@elementor/icons");
|
|
1435
|
+
var import_ui18 = require("@elementor/ui");
|
|
1436
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
1072
1437
|
|
|
1073
1438
|
// src/components/shared/page-title-and-status.tsx
|
|
1074
|
-
var
|
|
1075
|
-
var
|
|
1076
|
-
var
|
|
1439
|
+
var React19 = __toESM(require("react"));
|
|
1440
|
+
var import_ui13 = require("@elementor/ui");
|
|
1441
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1077
1442
|
|
|
1078
1443
|
// src/hooks/use-reverse-html-entities.ts
|
|
1079
1444
|
var import_react7 = require("react");
|
|
@@ -1100,19 +1465,19 @@ function humanizeStatusSlug(status) {
|
|
|
1100
1465
|
var statusChipConfig = {
|
|
1101
1466
|
draft: {
|
|
1102
1467
|
color: "default",
|
|
1103
|
-
label: (0,
|
|
1468
|
+
label: (0, import_i18n12.__)("Draft", "elementor")
|
|
1104
1469
|
},
|
|
1105
1470
|
future: {
|
|
1106
1471
|
color: "default",
|
|
1107
|
-
label: (0,
|
|
1472
|
+
label: (0, import_i18n12.__)("Scheduled", "elementor")
|
|
1108
1473
|
},
|
|
1109
1474
|
pending: {
|
|
1110
1475
|
color: "warning",
|
|
1111
|
-
label: (0,
|
|
1476
|
+
label: (0, import_i18n12.__)("Pending Review", "elementor")
|
|
1112
1477
|
},
|
|
1113
1478
|
private: {
|
|
1114
1479
|
color: "default",
|
|
1115
|
-
label: (0,
|
|
1480
|
+
label: (0, import_i18n12.__)("Private", "elementor")
|
|
1116
1481
|
}
|
|
1117
1482
|
};
|
|
1118
1483
|
function getStatusChipConfig(status) {
|
|
@@ -1134,8 +1499,8 @@ var PageStatus = ({ status }) => {
|
|
|
1134
1499
|
}
|
|
1135
1500
|
const { color, label } = getStatusChipConfig(status);
|
|
1136
1501
|
const isKnownStatus = isKnownPanelStatus(status);
|
|
1137
|
-
return /* @__PURE__ */
|
|
1138
|
-
|
|
1502
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1503
|
+
import_ui13.Chip,
|
|
1139
1504
|
{
|
|
1140
1505
|
color,
|
|
1141
1506
|
component: "span",
|
|
@@ -1159,8 +1524,8 @@ var PageStatus = ({ status }) => {
|
|
|
1159
1524
|
};
|
|
1160
1525
|
var PageTitle = ({ title }) => {
|
|
1161
1526
|
const modifiedTitle = useReverseHtmlEntities(title);
|
|
1162
|
-
return /* @__PURE__ */
|
|
1163
|
-
|
|
1527
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1528
|
+
import_ui13.Typography,
|
|
1164
1529
|
{
|
|
1165
1530
|
component: "span",
|
|
1166
1531
|
variant: "body2",
|
|
@@ -1168,37 +1533,39 @@ var PageTitle = ({ title }) => {
|
|
|
1168
1533
|
noWrap: true,
|
|
1169
1534
|
sx: {
|
|
1170
1535
|
...contentPanelListRowTitleSx,
|
|
1171
|
-
|
|
1536
|
+
flex: 1,
|
|
1537
|
+
flexBasis: "auto",
|
|
1538
|
+
minWidth: 0
|
|
1172
1539
|
}
|
|
1173
1540
|
},
|
|
1174
1541
|
modifiedTitle
|
|
1175
1542
|
);
|
|
1176
1543
|
};
|
|
1177
1544
|
function PageTitleAndStatus({ title, status }) {
|
|
1178
|
-
return /* @__PURE__ */
|
|
1545
|
+
return /* @__PURE__ */ React19.createElement(import_ui13.Box, { alignItems: "center", display: "flex", minWidth: 0 }, /* @__PURE__ */ React19.createElement(PageTitle, { title }), /* @__PURE__ */ React19.createElement(PageStatus, { status }));
|
|
1179
1546
|
}
|
|
1180
1547
|
|
|
1181
1548
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
1182
|
-
var
|
|
1549
|
+
var React21 = __toESM(require("react"));
|
|
1183
1550
|
var import_react8 = require("react");
|
|
1184
1551
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
1185
|
-
var
|
|
1186
|
-
var
|
|
1187
|
-
var
|
|
1552
|
+
var import_icons10 = require("@elementor/icons");
|
|
1553
|
+
var import_ui15 = require("@elementor/ui");
|
|
1554
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1188
1555
|
|
|
1189
1556
|
// src/components/panel/actions-menu/action-menu-item.tsx
|
|
1190
|
-
var
|
|
1191
|
-
var
|
|
1192
|
-
function ActionMenuItem({
|
|
1193
|
-
return /* @__PURE__ */
|
|
1194
|
-
|
|
1557
|
+
var React20 = __toESM(require("react"));
|
|
1558
|
+
var import_ui14 = require("@elementor/ui");
|
|
1559
|
+
function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
|
|
1560
|
+
return /* @__PURE__ */ React20.createElement(import_ui14.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ React20.createElement(
|
|
1561
|
+
import_ui14.ListItemIcon,
|
|
1195
1562
|
{
|
|
1196
1563
|
sx: {
|
|
1197
1564
|
color: "inherit"
|
|
1198
1565
|
}
|
|
1199
1566
|
},
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
), /* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ React20.createElement(Icon, null)
|
|
1568
|
+
), /* @__PURE__ */ React20.createElement(import_ui14.ListItemText, { primary: title, secondary: description }));
|
|
1202
1569
|
}
|
|
1203
1570
|
|
|
1204
1571
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
@@ -1208,18 +1575,18 @@ function Delete({ post }) {
|
|
|
1208
1575
|
const isPostActive = activeDocument?.id === post.id;
|
|
1209
1576
|
const userCanDelete = post.user_can.delete;
|
|
1210
1577
|
const isDisabled = !userCanDelete || post.isHome || isPostActive;
|
|
1211
|
-
return /* @__PURE__ */
|
|
1578
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1212
1579
|
ActionMenuItem,
|
|
1213
1580
|
{
|
|
1214
|
-
title: (0,
|
|
1215
|
-
icon:
|
|
1581
|
+
title: (0, import_i18n13.__)("Delete", "elementor"),
|
|
1582
|
+
icon: import_icons10.TrashIcon,
|
|
1216
1583
|
MenuItemProps: {
|
|
1217
1584
|
disabled: isDisabled,
|
|
1218
1585
|
onClick: () => setIsDialogOpen(true),
|
|
1219
1586
|
sx: { "&:hover": { color: "error.main" } }
|
|
1220
1587
|
}
|
|
1221
1588
|
}
|
|
1222
|
-
), isDialogOpen && /* @__PURE__ */
|
|
1589
|
+
), isDialogOpen && /* @__PURE__ */ React21.createElement(DeleteDialog, { post, setIsDialogOpen }));
|
|
1223
1590
|
}
|
|
1224
1591
|
function DeleteDialog({
|
|
1225
1592
|
post,
|
|
@@ -1228,11 +1595,11 @@ function DeleteDialog({
|
|
|
1228
1595
|
const { type } = usePostListContext();
|
|
1229
1596
|
const { deletePost } = usePostActions(type);
|
|
1230
1597
|
const { setError } = usePostListContext();
|
|
1231
|
-
const dialogTitle = (0,
|
|
1232
|
-
const dialogBody = type === "post" ? (0,
|
|
1598
|
+
const dialogTitle = (0, import_i18n13.sprintf)((0, import_i18n13.__)('Delete "%s"?', "elementor"), post.title.rendered);
|
|
1599
|
+
const dialogBody = type === "post" ? (0, import_i18n13.__)(
|
|
1233
1600
|
"The post and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1234
1601
|
"elementor"
|
|
1235
|
-
) : (0,
|
|
1602
|
+
) : (0, import_i18n13.__)(
|
|
1236
1603
|
"The page and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
1237
1604
|
"elementor"
|
|
1238
1605
|
);
|
|
@@ -1250,22 +1617,22 @@ function DeleteDialog({
|
|
|
1250
1617
|
}
|
|
1251
1618
|
setIsDialogOpen(false);
|
|
1252
1619
|
};
|
|
1253
|
-
return /* @__PURE__ */
|
|
1254
|
-
|
|
1620
|
+
return /* @__PURE__ */ React21.createElement(import_ui15.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React21.createElement(import_ui15.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React21.createElement(import_ui15.Divider, null), /* @__PURE__ */ React21.createElement(import_ui15.DialogContent, null, /* @__PURE__ */ React21.createElement(import_ui15.DialogContentText, null, dialogBody)), /* @__PURE__ */ React21.createElement(import_ui15.DialogActions, null, /* @__PURE__ */ React21.createElement(
|
|
1621
|
+
import_ui15.Button,
|
|
1255
1622
|
{
|
|
1256
1623
|
variant: "contained",
|
|
1257
1624
|
color: "secondary",
|
|
1258
1625
|
onClick: handleCancel,
|
|
1259
1626
|
disabled: deletePost.isPending
|
|
1260
1627
|
},
|
|
1261
|
-
(0,
|
|
1262
|
-
), /* @__PURE__ */
|
|
1628
|
+
(0, import_i18n13.__)("Cancel", "elementor")
|
|
1629
|
+
), /* @__PURE__ */ React21.createElement(import_ui15.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n13.__)("Delete", "elementor") : /* @__PURE__ */ React21.createElement(import_ui15.CircularProgress, null))));
|
|
1263
1630
|
}
|
|
1264
1631
|
|
|
1265
1632
|
// src/components/panel/actions-menu/actions/duplicate.tsx
|
|
1266
|
-
var
|
|
1267
|
-
var
|
|
1268
|
-
var
|
|
1633
|
+
var React22 = __toESM(require("react"));
|
|
1634
|
+
var import_icons11 = require("@elementor/icons");
|
|
1635
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1269
1636
|
function Duplicate({ post, popupState }) {
|
|
1270
1637
|
const { setEditMode, type } = usePostListContext();
|
|
1271
1638
|
const canCreate = useCanCreate(type);
|
|
@@ -1280,11 +1647,11 @@ function Duplicate({ post, popupState }) {
|
|
|
1280
1647
|
});
|
|
1281
1648
|
};
|
|
1282
1649
|
const isDisabled = !canCreate;
|
|
1283
|
-
return /* @__PURE__ */
|
|
1650
|
+
return /* @__PURE__ */ React22.createElement(
|
|
1284
1651
|
ActionMenuItem,
|
|
1285
1652
|
{
|
|
1286
|
-
title: (0,
|
|
1287
|
-
icon:
|
|
1653
|
+
title: (0, import_i18n14.__)("Duplicate", "elementor"),
|
|
1654
|
+
icon: import_icons11.CopyIcon,
|
|
1288
1655
|
MenuItemProps: {
|
|
1289
1656
|
disabled: isDisabled,
|
|
1290
1657
|
onClick
|
|
@@ -1293,17 +1660,82 @@ function Duplicate({ post, popupState }) {
|
|
|
1293
1660
|
);
|
|
1294
1661
|
}
|
|
1295
1662
|
|
|
1663
|
+
// src/components/panel/actions-menu/actions/force-delete.tsx
|
|
1664
|
+
var React23 = __toESM(require("react"));
|
|
1665
|
+
var import_react9 = require("react");
|
|
1666
|
+
var import_icons12 = require("@elementor/icons");
|
|
1667
|
+
var import_ui16 = require("@elementor/ui");
|
|
1668
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
1669
|
+
function ForceDelete({ post }) {
|
|
1670
|
+
const [isDialogOpen, setIsDialogOpen] = (0, import_react9.useState)(false);
|
|
1671
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(
|
|
1672
|
+
ActionMenuItem,
|
|
1673
|
+
{
|
|
1674
|
+
icon: import_icons12.TrashIcon,
|
|
1675
|
+
MenuItemProps: {
|
|
1676
|
+
disabled: !post.user_can.delete,
|
|
1677
|
+
onClick: () => setIsDialogOpen(true),
|
|
1678
|
+
sx: { "&:hover": { color: "error.main" } }
|
|
1679
|
+
},
|
|
1680
|
+
title: (0, import_i18n15.__)("Delete permanently", "elementor")
|
|
1681
|
+
}
|
|
1682
|
+
), isDialogOpen && /* @__PURE__ */ React23.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
|
|
1683
|
+
}
|
|
1684
|
+
function ForceDeleteDialog({
|
|
1685
|
+
post,
|
|
1686
|
+
setIsDialogOpen
|
|
1687
|
+
}) {
|
|
1688
|
+
const { setError, type } = usePostListContext();
|
|
1689
|
+
const { forceDeletePost } = usePostActions(type);
|
|
1690
|
+
const dialogTitle = (0, import_i18n15.sprintf)((0, import_i18n15.__)('Delete "%s" permanently?', "elementor"), post.title.rendered);
|
|
1691
|
+
const dialogBody = (0, import_i18n15.__)("This will permanently delete the item. You cannot undo this action.", "elementor");
|
|
1692
|
+
const handleDelete = async () => {
|
|
1693
|
+
try {
|
|
1694
|
+
await forceDeletePost.mutateAsync(post.id);
|
|
1695
|
+
setIsDialogOpen(false);
|
|
1696
|
+
} catch {
|
|
1697
|
+
setError();
|
|
1698
|
+
setIsDialogOpen(false);
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
const handleCancel = () => {
|
|
1702
|
+
if (forceDeletePost.isPending) {
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
setIsDialogOpen(false);
|
|
1706
|
+
};
|
|
1707
|
+
return /* @__PURE__ */ React23.createElement(import_ui16.Dialog, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React23.createElement(import_ui16.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React23.createElement(import_ui16.Divider, null), /* @__PURE__ */ React23.createElement(import_ui16.DialogContent, null, /* @__PURE__ */ React23.createElement(import_ui16.DialogContentText, null, dialogBody)), /* @__PURE__ */ React23.createElement(import_ui16.DialogActions, null, /* @__PURE__ */ React23.createElement(
|
|
1708
|
+
import_ui16.Button,
|
|
1709
|
+
{
|
|
1710
|
+
variant: "contained",
|
|
1711
|
+
color: "secondary",
|
|
1712
|
+
onClick: handleCancel,
|
|
1713
|
+
disabled: forceDeletePost.isPending
|
|
1714
|
+
},
|
|
1715
|
+
(0, import_i18n15.__)("Cancel", "elementor")
|
|
1716
|
+
), /* @__PURE__ */ React23.createElement(
|
|
1717
|
+
import_ui16.Button,
|
|
1718
|
+
{
|
|
1719
|
+
variant: "contained",
|
|
1720
|
+
color: "error",
|
|
1721
|
+
onClick: () => void handleDelete(),
|
|
1722
|
+
disabled: forceDeletePost.isPending
|
|
1723
|
+
},
|
|
1724
|
+
!forceDeletePost.isPending ? (0, import_i18n15.__)("Delete permanently", "elementor") : /* @__PURE__ */ React23.createElement(import_ui16.CircularProgress, null)
|
|
1725
|
+
)));
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1296
1728
|
// src/components/panel/actions-menu/actions/rename.tsx
|
|
1297
|
-
var
|
|
1298
|
-
var
|
|
1299
|
-
var
|
|
1729
|
+
var React24 = __toESM(require("react"));
|
|
1730
|
+
var import_icons13 = require("@elementor/icons");
|
|
1731
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
1300
1732
|
function Rename({ post }) {
|
|
1301
1733
|
const { setEditMode } = usePostListContext();
|
|
1302
|
-
return /* @__PURE__ */
|
|
1734
|
+
return /* @__PURE__ */ React24.createElement(
|
|
1303
1735
|
ActionMenuItem,
|
|
1304
1736
|
{
|
|
1305
|
-
title: (0,
|
|
1306
|
-
icon:
|
|
1737
|
+
title: (0, import_i18n16.__)("Rename", "elementor"),
|
|
1738
|
+
icon: import_icons13.EraseIcon,
|
|
1307
1739
|
MenuItemProps: {
|
|
1308
1740
|
disabled: !post.user_can.edit,
|
|
1309
1741
|
onClick: () => {
|
|
@@ -1319,25 +1751,53 @@ function Rename({ post }) {
|
|
|
1319
1751
|
);
|
|
1320
1752
|
}
|
|
1321
1753
|
|
|
1754
|
+
// src/components/panel/actions-menu/actions/restore.tsx
|
|
1755
|
+
var React25 = __toESM(require("react"));
|
|
1756
|
+
var import_icons14 = require("@elementor/icons");
|
|
1757
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
1758
|
+
function Restore({ post }) {
|
|
1759
|
+
const { setError, type } = usePostListContext();
|
|
1760
|
+
const { restorePost } = usePostActions(type);
|
|
1761
|
+
const handleClick = async () => {
|
|
1762
|
+
try {
|
|
1763
|
+
await restorePost.mutateAsync(post.id);
|
|
1764
|
+
} catch {
|
|
1765
|
+
setError();
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
return /* @__PURE__ */ React25.createElement(
|
|
1769
|
+
ActionMenuItem,
|
|
1770
|
+
{
|
|
1771
|
+
description: (0, import_i18n17.__)("Restored as draft", "elementor"),
|
|
1772
|
+
title: (0, import_i18n17.__)("Restore", "elementor"),
|
|
1773
|
+
icon: import_icons14.RefreshIcon,
|
|
1774
|
+
MenuItemProps: {
|
|
1775
|
+
disabled: restorePost.isPending || !post.user_can.delete,
|
|
1776
|
+
onClick: () => void handleClick()
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1322
1782
|
// src/components/panel/actions-menu/actions/set-home.tsx
|
|
1323
|
-
var
|
|
1324
|
-
var
|
|
1325
|
-
var
|
|
1326
|
-
var
|
|
1783
|
+
var React26 = __toESM(require("react"));
|
|
1784
|
+
var import_icons15 = require("@elementor/icons");
|
|
1785
|
+
var import_ui17 = require("@elementor/ui");
|
|
1786
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
1327
1787
|
|
|
1328
1788
|
// src/hooks/use-homepage-actions.ts
|
|
1329
|
-
var
|
|
1789
|
+
var import_query8 = require("@elementor/query");
|
|
1330
1790
|
function useHomepageActions() {
|
|
1331
1791
|
const invalidateSettings = useInvalidateSettings();
|
|
1332
1792
|
const onSuccess = async () => invalidateSettings({ exact: true });
|
|
1333
|
-
const updateSettingsMutation = (0,
|
|
1793
|
+
const updateSettingsMutation = (0, import_query8.useMutation)({
|
|
1334
1794
|
mutationFn: (settings) => updateSettings(settings),
|
|
1335
1795
|
onSuccess
|
|
1336
1796
|
});
|
|
1337
1797
|
return { updateSettingsMutation };
|
|
1338
1798
|
}
|
|
1339
1799
|
function useInvalidateSettings() {
|
|
1340
|
-
const queryClient = (0,
|
|
1800
|
+
const queryClient = (0, import_query8.useQueryClient)();
|
|
1341
1801
|
return (options = {}) => {
|
|
1342
1802
|
const queryKey = settingsQueryKey();
|
|
1343
1803
|
return queryClient.invalidateQueries({ queryKey }, options);
|
|
@@ -1362,11 +1822,11 @@ function SetHome({ post, closeMenu }) {
|
|
|
1362
1822
|
const isPostPublished = post.status === "publish";
|
|
1363
1823
|
const isPostHomepage = !!post.isHome;
|
|
1364
1824
|
const isDisabled = !canManageOptions || isPostHomepage || !isPostPublished || updateSettingsMutation.isPending;
|
|
1365
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ React26.createElement(
|
|
1366
1826
|
ActionMenuItem,
|
|
1367
1827
|
{
|
|
1368
|
-
title: (0,
|
|
1369
|
-
icon: !updateSettingsMutation.isPending ?
|
|
1828
|
+
title: (0, import_i18n18.__)("Set as homepage", "elementor"),
|
|
1829
|
+
icon: !updateSettingsMutation.isPending ? import_icons15.HomeIcon : import_ui17.CircularProgress,
|
|
1370
1830
|
MenuItemProps: {
|
|
1371
1831
|
disabled: isDisabled,
|
|
1372
1832
|
onClick: handleClick
|
|
@@ -1376,17 +1836,17 @@ function SetHome({ post, closeMenu }) {
|
|
|
1376
1836
|
}
|
|
1377
1837
|
|
|
1378
1838
|
// src/components/panel/actions-menu/actions/view.tsx
|
|
1379
|
-
var
|
|
1380
|
-
var
|
|
1381
|
-
var
|
|
1839
|
+
var React27 = __toESM(require("react"));
|
|
1840
|
+
var import_icons16 = require("@elementor/icons");
|
|
1841
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
1382
1842
|
function View({ post }) {
|
|
1383
1843
|
const { type } = usePostListContext();
|
|
1384
|
-
const title = (0,
|
|
1385
|
-
return /* @__PURE__ */
|
|
1844
|
+
const title = (0, import_i18n19.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
|
|
1845
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1386
1846
|
ActionMenuItem,
|
|
1387
1847
|
{
|
|
1388
1848
|
title,
|
|
1389
|
-
icon:
|
|
1849
|
+
icon: import_icons16.EyeIcon,
|
|
1390
1850
|
MenuItemProps: {
|
|
1391
1851
|
onClick: () => window.open(post.link, "_blank")
|
|
1392
1852
|
}
|
|
@@ -1394,6 +1854,14 @@ function View({ post }) {
|
|
|
1394
1854
|
);
|
|
1395
1855
|
}
|
|
1396
1856
|
|
|
1857
|
+
// src/components/panel/posts-list/list-items/site-content-list-item-actions-location.tsx
|
|
1858
|
+
var import_locations = require("@elementor/locations");
|
|
1859
|
+
var {
|
|
1860
|
+
Slot: SiteContentListItemActionsSlot,
|
|
1861
|
+
inject: injectIntoSiteContentListItemActions,
|
|
1862
|
+
useInjections: useSiteContentListItemActionsInjections
|
|
1863
|
+
} = (0, import_locations.createLocation)();
|
|
1864
|
+
|
|
1397
1865
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1398
1866
|
var DisabledPostTooltip = ({
|
|
1399
1867
|
children,
|
|
@@ -1401,16 +1869,16 @@ var DisabledPostTooltip = ({
|
|
|
1401
1869
|
postTypeSlug
|
|
1402
1870
|
}) => {
|
|
1403
1871
|
if (isDisabled) {
|
|
1404
|
-
const title = /* @__PURE__ */
|
|
1405
|
-
return /* @__PURE__ */
|
|
1872
|
+
const title = /* @__PURE__ */ React28.createElement(import_ui18.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React28.createElement("br", null), (0, import_i18n20.__)("To edit it directly, contact the site owner", "elementor"));
|
|
1873
|
+
return /* @__PURE__ */ React28.createElement(import_ui18.Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React28.createElement("span", null, children));
|
|
1406
1874
|
}
|
|
1407
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, children);
|
|
1408
1876
|
};
|
|
1409
1877
|
function ListItemView({ post }) {
|
|
1410
1878
|
const { type } = usePostListContext();
|
|
1411
1879
|
const activeDocument = (0, import_editor_documents5.__useActiveDocument)();
|
|
1412
1880
|
const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
|
|
1413
|
-
const popupState = (0,
|
|
1881
|
+
const popupState = (0, import_ui18.usePopupState)({
|
|
1414
1882
|
variant: "popover",
|
|
1415
1883
|
popupId: "post-actions",
|
|
1416
1884
|
disableAutoFocus: true
|
|
@@ -1418,17 +1886,21 @@ function ListItemView({ post }) {
|
|
|
1418
1886
|
const isActive = activeDocument?.id === post.id;
|
|
1419
1887
|
const status = isActive ? activeDocument?.status.value : post.status;
|
|
1420
1888
|
const title = isActive ? activeDocument?.title : post.title.rendered;
|
|
1421
|
-
const
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1424
|
-
|
|
1889
|
+
const isTrashed = "trash" === post.status;
|
|
1890
|
+
const isEditBlocked = !post.user_can.edit && !isTrashed;
|
|
1891
|
+
const isRowDisabled = isEditBlocked || isTrashed;
|
|
1892
|
+
const menuTriggerProps = (0, import_ui18.bindTrigger)(popupState);
|
|
1893
|
+
const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
|
|
1894
|
+
const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
|
|
1895
|
+
const listRow = /* @__PURE__ */ React28.createElement(
|
|
1896
|
+
import_ui18.ListItem,
|
|
1425
1897
|
{
|
|
1426
1898
|
disablePadding: true,
|
|
1427
|
-
sx:
|
|
1428
|
-
secondaryAction: /* @__PURE__ */
|
|
1429
|
-
|
|
1899
|
+
sx: getContentPanelListItemSx(showListItemActions),
|
|
1900
|
+
secondaryAction: /* @__PURE__ */ React28.createElement(import_ui18.Stack, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React28.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React28.createElement(
|
|
1901
|
+
import_ui18.IconButton,
|
|
1430
1902
|
{
|
|
1431
|
-
"aria-label": (0,
|
|
1903
|
+
"aria-label": (0, import_i18n20.__)("More actions", "elementor"),
|
|
1432
1904
|
size: "tiny",
|
|
1433
1905
|
...menuTriggerProps,
|
|
1434
1906
|
onClick: (event) => {
|
|
@@ -1436,39 +1908,37 @@ function ListItemView({ post }) {
|
|
|
1436
1908
|
menuTriggerProps.onClick?.(event);
|
|
1437
1909
|
}
|
|
1438
1910
|
},
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
)
|
|
1911
|
+
/* @__PURE__ */ React28.createElement(import_icons17.DotsVerticalIcon, { fontSize: "tiny" })
|
|
1912
|
+
))
|
|
1441
1913
|
},
|
|
1442
|
-
/* @__PURE__ */
|
|
1443
|
-
|
|
1914
|
+
/* @__PURE__ */ React28.createElement(
|
|
1915
|
+
import_ui18.ListItemButton,
|
|
1444
1916
|
{
|
|
1445
1917
|
dense: true,
|
|
1446
1918
|
disableGutters: true,
|
|
1447
|
-
disabled:
|
|
1919
|
+
disabled: isRowDisabled,
|
|
1448
1920
|
onClick: () => {
|
|
1449
|
-
if (
|
|
1450
|
-
|
|
1921
|
+
if (isTrashed || isActive) {
|
|
1922
|
+
return;
|
|
1451
1923
|
}
|
|
1924
|
+
navigateToDocument(post.id);
|
|
1452
1925
|
},
|
|
1453
1926
|
selected: isActive,
|
|
1454
1927
|
shape: "rounded",
|
|
1455
1928
|
sx: contentPanelListItemButtonSx
|
|
1456
1929
|
},
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
-
post.isHome && /* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ React28.createElement(import_ui18.ListItemText, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React28.createElement(PageTitleAndStatus, { title, status })),
|
|
1931
|
+
post.isHome && /* @__PURE__ */ React28.createElement(import_icons17.HomeIcon, { titleAccess: (0, import_i18n20.__)("Homepage", "elementor"), color: "disabled" })
|
|
1459
1932
|
)
|
|
1460
|
-
)
|
|
1461
|
-
|
|
1933
|
+
);
|
|
1934
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, isEditBlocked ? /* @__PURE__ */ React28.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React28.createElement(
|
|
1935
|
+
import_ui18.Menu,
|
|
1462
1936
|
{
|
|
1463
1937
|
PaperProps: { sx: { mt: 2, width: 200 } },
|
|
1464
1938
|
MenuListProps: { dense: true },
|
|
1465
|
-
...(0,
|
|
1939
|
+
...(0, import_ui18.bindMenu)(popupState)
|
|
1466
1940
|
},
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */ React21.createElement(Duplicate, { post, popupState }),
|
|
1469
|
-
/* @__PURE__ */ React21.createElement(Delete, { post }),
|
|
1470
|
-
/* @__PURE__ */ React21.createElement(View, { post }),
|
|
1471
|
-
type === "page" && /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(import_ui12.Divider, null), /* @__PURE__ */ React21.createElement(SetHome, { post, closeMenu: () => popupState.close() }))
|
|
1941
|
+
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(import_ui18.Divider, null), /* @__PURE__ */ React28.createElement(SetHome, { post, closeMenu: () => popupState.close() })))
|
|
1472
1942
|
));
|
|
1473
1943
|
}
|
|
1474
1944
|
|
|
@@ -1476,25 +1946,25 @@ function ListItemView({ post }) {
|
|
|
1476
1946
|
function PostListItem({ post }) {
|
|
1477
1947
|
const { editMode } = usePostListContext();
|
|
1478
1948
|
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
|
|
1479
|
-
return /* @__PURE__ */
|
|
1949
|
+
return /* @__PURE__ */ React29.createElement(ListItemRename, { post });
|
|
1480
1950
|
}
|
|
1481
1951
|
if ("create" === editMode.mode && !post) {
|
|
1482
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ React29.createElement(ListItemCreate, null);
|
|
1483
1953
|
}
|
|
1484
1954
|
if ("duplicate" === editMode.mode && !post) {
|
|
1485
|
-
return /* @__PURE__ */
|
|
1955
|
+
return /* @__PURE__ */ React29.createElement(ListItemDuplicate, null);
|
|
1486
1956
|
}
|
|
1487
1957
|
if (!post) {
|
|
1488
1958
|
return null;
|
|
1489
1959
|
}
|
|
1490
|
-
return /* @__PURE__ */
|
|
1960
|
+
return /* @__PURE__ */ React29.createElement(ListItemView, { post });
|
|
1491
1961
|
}
|
|
1492
1962
|
|
|
1493
1963
|
// src/components/panel/posts-list/post-list-pagination-actions.tsx
|
|
1494
|
-
var
|
|
1495
|
-
var
|
|
1496
|
-
var
|
|
1497
|
-
var
|
|
1964
|
+
var React30 = __toESM(require("react"));
|
|
1965
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1966
|
+
var import_ui19 = require("@elementor/ui");
|
|
1967
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
1498
1968
|
var listPaginationButtonProps = {
|
|
1499
1969
|
color: "secondary",
|
|
1500
1970
|
size: "small",
|
|
@@ -1511,28 +1981,28 @@ function PostListPaginationActions({
|
|
|
1511
1981
|
if (!canLoadMore && !canShowLess) {
|
|
1512
1982
|
return null;
|
|
1513
1983
|
}
|
|
1514
|
-
const loadMoreLabel = (0,
|
|
1515
|
-
const showLessLabel = (0,
|
|
1516
|
-
const loadMoreButton = /* @__PURE__ */
|
|
1517
|
-
|
|
1984
|
+
const loadMoreLabel = (0, import_i18n21.__)("Load more", "elementor");
|
|
1985
|
+
const showLessLabel = (0, import_i18n21.__)("Show less", "elementor");
|
|
1986
|
+
const loadMoreButton = /* @__PURE__ */ React30.createElement(
|
|
1987
|
+
import_ui19.Button,
|
|
1518
1988
|
{
|
|
1519
1989
|
...listPaginationButtonProps,
|
|
1520
1990
|
ref: loadMoreButtonRef,
|
|
1521
1991
|
"aria-label": loadMoreLabel,
|
|
1522
1992
|
disabled: isLoadingMore,
|
|
1523
|
-
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */
|
|
1993
|
+
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React30.createElement(import_editor_ui3.CollapseIcon, { open: false }),
|
|
1524
1994
|
fullWidth: true,
|
|
1525
1995
|
onClick: onLoadMore,
|
|
1526
1996
|
sx: { flex: 1, my: 0.5 }
|
|
1527
1997
|
},
|
|
1528
|
-
isLoadingMore ? /* @__PURE__ */
|
|
1998
|
+
isLoadingMore ? /* @__PURE__ */ React30.createElement(import_ui19.CircularProgress, { size: 20 }) : loadMoreLabel
|
|
1529
1999
|
);
|
|
1530
|
-
const showLessButton = /* @__PURE__ */
|
|
1531
|
-
|
|
2000
|
+
const showLessButton = /* @__PURE__ */ React30.createElement(
|
|
2001
|
+
import_ui19.Button,
|
|
1532
2002
|
{
|
|
1533
2003
|
...listPaginationButtonProps,
|
|
1534
2004
|
"aria-label": showLessLabel,
|
|
1535
|
-
endIcon: /* @__PURE__ */
|
|
2005
|
+
endIcon: /* @__PURE__ */ React30.createElement(import_editor_ui3.CollapseIcon, { open: true }),
|
|
1536
2006
|
fullWidth: true,
|
|
1537
2007
|
onClick: onShowLess,
|
|
1538
2008
|
sx: { flex: 1, my: 0.5 }
|
|
@@ -1540,24 +2010,24 @@ function PostListPaginationActions({
|
|
|
1540
2010
|
showLessLabel
|
|
1541
2011
|
);
|
|
1542
2012
|
if (canShowLess && canLoadMore) {
|
|
1543
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ React30.createElement(import_ui19.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React30.createElement(import_ui19.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
|
|
1544
2014
|
}
|
|
1545
|
-
return /* @__PURE__ */
|
|
2015
|
+
return /* @__PURE__ */ React30.createElement(import_ui19.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
|
|
1546
2016
|
}
|
|
1547
2017
|
|
|
1548
2018
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
1549
2019
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
1550
2020
|
function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
1551
|
-
const { type, editMode, setEditMode } = usePostListContext();
|
|
1552
|
-
const { registerSection,
|
|
1553
|
-
const [isOpen, setIsOpen] = (0,
|
|
2021
|
+
const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
|
|
2022
|
+
const { registerSection, searchQuery, statusFilters, unregisterSection } = useContentPanelCoordinator();
|
|
2023
|
+
const [isOpen, setIsOpen] = (0, import_react10.useState)(isOpenByDefault);
|
|
1554
2024
|
const trimmedSearch = searchQuery.trim();
|
|
1555
|
-
const [debouncedSearch, setDebouncedSearch] = (0,
|
|
1556
|
-
const focusAfterShowLessRef = (0,
|
|
1557
|
-
const listTopRef = (0,
|
|
1558
|
-
const loadMoreButtonRef = (0,
|
|
1559
|
-
const sectionHeaderRef = (0,
|
|
1560
|
-
(0,
|
|
2025
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react10.useState)(trimmedSearch);
|
|
2026
|
+
const focusAfterShowLessRef = (0, import_react10.useRef)(false);
|
|
2027
|
+
const listTopRef = (0, import_react10.useRef)(null);
|
|
2028
|
+
const loadMoreButtonRef = (0, import_react10.useRef)(null);
|
|
2029
|
+
const sectionHeaderRef = (0, import_react10.useRef)(null);
|
|
2030
|
+
(0, import_react10.useEffect)(() => {
|
|
1561
2031
|
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
1562
2032
|
return () => window.clearTimeout(handle);
|
|
1563
2033
|
}, [trimmedSearch]);
|
|
@@ -1568,17 +2038,27 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1568
2038
|
fetchNextPage,
|
|
1569
2039
|
hasNextPage,
|
|
1570
2040
|
isFetchingNextPage
|
|
1571
|
-
} = usePosts(type, debouncedSearch);
|
|
2041
|
+
} = usePosts(type, debouncedSearch, statusFilters);
|
|
2042
|
+
const isNarrowed = isSiteContentListNarrowed(statusFilters, debouncedSearch);
|
|
2043
|
+
const isTrashFilter = isSiteContentTrashFilterActive(statusFilters);
|
|
2044
|
+
const baselineStatus = isTrashFilter ? "trash" : "any";
|
|
2045
|
+
const { data: baselineTotal } = usePostsBaselineTotal(type, isNarrowed, baselineStatus);
|
|
1572
2046
|
const { data: homepageId } = useHomepage();
|
|
1573
2047
|
const isPageType = type === "page";
|
|
1574
|
-
|
|
2048
|
+
const statusFiltersKey = serializeSiteContentStatusFilters(statusFilters);
|
|
2049
|
+
(0, import_react10.useEffect)(() => {
|
|
2050
|
+
if (isTrashFilter) {
|
|
2051
|
+
resetEditMode();
|
|
2052
|
+
}
|
|
2053
|
+
}, [isTrashFilter, resetEditMode]);
|
|
2054
|
+
(0, import_react10.useEffect)(() => {
|
|
1575
2055
|
registerSection(type, {
|
|
1576
2056
|
setExpanded: setIsOpen,
|
|
1577
2057
|
startCreate: () => setEditMode({ mode: "create", details: {} })
|
|
1578
2058
|
});
|
|
1579
2059
|
return () => unregisterSection(type);
|
|
1580
2060
|
}, [registerSection, unregisterSection, type, setEditMode]);
|
|
1581
|
-
const filteredPosts = (0,
|
|
2061
|
+
const filteredPosts = (0, import_react10.useMemo)(() => {
|
|
1582
2062
|
if (!posts) {
|
|
1583
2063
|
return [];
|
|
1584
2064
|
}
|
|
@@ -1599,10 +2079,10 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1599
2079
|
hasNextPage,
|
|
1600
2080
|
isFetchingNextPage,
|
|
1601
2081
|
loadedCount: filteredPosts.length,
|
|
1602
|
-
resetKey: `${type}:${debouncedSearch}`,
|
|
2082
|
+
resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}`,
|
|
1603
2083
|
totalCount: total
|
|
1604
2084
|
});
|
|
1605
|
-
const displayedPosts = (0,
|
|
2085
|
+
const displayedPosts = (0, import_react10.useMemo)(
|
|
1606
2086
|
() => filteredPosts.slice(0, pagination.visibleCount),
|
|
1607
2087
|
[filteredPosts, pagination.visibleCount]
|
|
1608
2088
|
);
|
|
@@ -1614,7 +2094,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1614
2094
|
listTop.scrollIntoView({ block: "nearest" });
|
|
1615
2095
|
}
|
|
1616
2096
|
};
|
|
1617
|
-
(0,
|
|
2097
|
+
(0, import_react10.useEffect)(() => {
|
|
1618
2098
|
if (!focusAfterShowLessRef.current) {
|
|
1619
2099
|
return;
|
|
1620
2100
|
}
|
|
@@ -1626,37 +2106,39 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1626
2106
|
}
|
|
1627
2107
|
sectionHeaderRef.current?.focus();
|
|
1628
2108
|
}, [pagination.canLoadMore, pagination.visibleCount]);
|
|
1629
|
-
(0,
|
|
1630
|
-
if (debouncedSearch && filteredPosts.length > 0) {
|
|
2109
|
+
(0, import_react10.useEffect)(() => {
|
|
2110
|
+
if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
|
|
1631
2111
|
setIsOpen(true);
|
|
1632
2112
|
}
|
|
1633
|
-
}, [debouncedSearch, filteredPosts.length]);
|
|
2113
|
+
}, [debouncedSearch, filteredPosts.length, statusFilters]);
|
|
1634
2114
|
if (postsError) {
|
|
1635
|
-
return /* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ React31.createElement(ErrorState, null);
|
|
1636
2116
|
}
|
|
1637
2117
|
if (postsPending && !posts?.length) {
|
|
1638
|
-
return /* @__PURE__ */
|
|
2118
|
+
return /* @__PURE__ */ React31.createElement(import_ui20.Box, { sx: { px: 2 } }, /* @__PURE__ */ React31.createElement(import_ui20.Box, null, /* @__PURE__ */ React31.createElement(import_ui20.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React31.createElement(import_ui20.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React31.createElement(import_ui20.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React31.createElement(import_ui20.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
1639
2119
|
}
|
|
1640
2120
|
const displayCount = total;
|
|
1641
2121
|
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
1642
|
-
const showNoResults = debouncedSearch && filteredPosts.length === 0;
|
|
1643
|
-
|
|
2122
|
+
const showNoResults = (debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length === 0;
|
|
2123
|
+
const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
|
|
2124
|
+
return /* @__PURE__ */ React31.createElement(
|
|
1644
2125
|
CollapsibleList,
|
|
1645
2126
|
{
|
|
1646
2127
|
count: displayCount,
|
|
2128
|
+
countChipLabel,
|
|
1647
2129
|
headerRef: sectionHeaderRef,
|
|
1648
2130
|
isOpen,
|
|
1649
2131
|
onOpenChange: setIsOpen,
|
|
1650
2132
|
title: sectionTitle,
|
|
1651
|
-
trailingActions: /* @__PURE__ */
|
|
2133
|
+
trailingActions: isTrashFilter ? null : /* @__PURE__ */ React31.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
|
|
1652
2134
|
},
|
|
1653
|
-
showNoResults && /* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
2135
|
+
showNoResults && /* @__PURE__ */ React31.createElement(import_ui20.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React31.createElement(import_ui20.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n22.__)("No results found", "elementor"))),
|
|
2136
|
+
/* @__PURE__ */ React31.createElement(import_ui20.Box, { ref: listTopRef }),
|
|
1655
2137
|
displayedPosts.map((post) => {
|
|
1656
|
-
return /* @__PURE__ */
|
|
2138
|
+
return /* @__PURE__ */ React31.createElement(PostListItem, { key: post.id, post });
|
|
1657
2139
|
}),
|
|
1658
|
-
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
2140
|
+
!isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React31.createElement(PostListItem, null),
|
|
2141
|
+
/* @__PURE__ */ React31.createElement(
|
|
1660
2142
|
PostListPaginationActions,
|
|
1661
2143
|
{
|
|
1662
2144
|
canLoadMore: pagination.canLoadMore,
|
|
@@ -1671,11 +2153,11 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
|
|
|
1671
2153
|
}
|
|
1672
2154
|
|
|
1673
2155
|
// src/components/panel/user-load-error.tsx
|
|
1674
|
-
var
|
|
1675
|
-
var
|
|
1676
|
-
var
|
|
2156
|
+
var React32 = __toESM(require("react"));
|
|
2157
|
+
var import_ui21 = require("@elementor/ui");
|
|
2158
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
1677
2159
|
function UserLoadError() {
|
|
1678
|
-
return /* @__PURE__ */
|
|
2160
|
+
return /* @__PURE__ */ React32.createElement(import_ui21.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React32.createElement(import_ui21.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n23.__)(
|
|
1679
2161
|
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
1680
2162
|
"elementor"
|
|
1681
2163
|
)));
|
|
@@ -1689,31 +2171,33 @@ function ShellPanelBodyContent({
|
|
|
1689
2171
|
showUserLoadError
|
|
1690
2172
|
}) {
|
|
1691
2173
|
if (isUserPending) {
|
|
1692
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ React33.createElement(import_ui22.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React33.createElement(import_ui22.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React33.createElement(import_ui22.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
1693
2175
|
}
|
|
1694
2176
|
if (showUserLoadError) {
|
|
1695
|
-
return /* @__PURE__ */
|
|
2177
|
+
return /* @__PURE__ */ React33.createElement(UserLoadError, null);
|
|
1696
2178
|
}
|
|
1697
|
-
return /* @__PURE__ */
|
|
2179
|
+
return /* @__PURE__ */ React33.createElement(import_ui22.List, { 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 }))));
|
|
1698
2180
|
}
|
|
1699
2181
|
|
|
1700
2182
|
// src/components/panel/shell.tsx
|
|
1701
2183
|
var Shell = () => {
|
|
1702
|
-
const
|
|
2184
|
+
const sidebarPanelChrome = (0, import_editor_sidebar.isSidebarEnabled)();
|
|
2185
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react11.useState)(false);
|
|
1703
2186
|
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
1704
|
-
return /* @__PURE__ */
|
|
1705
|
-
|
|
2187
|
+
return /* @__PURE__ */ React34.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React34.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React34.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React34.createElement(
|
|
2188
|
+
import_ui23.Stack,
|
|
1706
2189
|
{
|
|
1707
2190
|
alignItems: "center",
|
|
1708
2191
|
direction: "row",
|
|
1709
2192
|
spacing: 0.5,
|
|
1710
2193
|
sx: {
|
|
1711
|
-
...contentPanelHeaderStackSx
|
|
2194
|
+
...contentPanelHeaderStackSx,
|
|
2195
|
+
...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
|
|
1712
2196
|
}
|
|
1713
2197
|
},
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
)), /* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ React34.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n24.__)("Site content", "elementor")),
|
|
2199
|
+
/* @__PURE__ */ React34.createElement(ContentPanelHeaderAdd, null)
|
|
2200
|
+
)), /* @__PURE__ */ React34.createElement(import_ui23.Divider, null), /* @__PURE__ */ React34.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React34.createElement(ContentPanelToolbar, null), /* @__PURE__ */ React34.createElement(import_ui23.Divider, null), /* @__PURE__ */ React34.createElement(
|
|
1717
2201
|
ShellPanelBodyContent,
|
|
1718
2202
|
{
|
|
1719
2203
|
accessiblePostTypes,
|
|
@@ -1721,7 +2205,7 @@ var Shell = () => {
|
|
|
1721
2205
|
onListError: () => setIsErrorSnackbarOpen(true),
|
|
1722
2206
|
showUserLoadError
|
|
1723
2207
|
}
|
|
1724
|
-
), /* @__PURE__ */
|
|
2208
|
+
), /* @__PURE__ */ React34.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
|
|
1725
2209
|
};
|
|
1726
2210
|
var shell_default = Shell;
|
|
1727
2211
|
|
|
@@ -1732,26 +2216,26 @@ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.creat
|
|
|
1732
2216
|
});
|
|
1733
2217
|
|
|
1734
2218
|
// src/components/top-bar/recently-edited.tsx
|
|
1735
|
-
var
|
|
2219
|
+
var React39 = __toESM(require("react"));
|
|
1736
2220
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
1737
|
-
var
|
|
1738
|
-
var
|
|
1739
|
-
var
|
|
2221
|
+
var import_icons20 = require("@elementor/icons");
|
|
2222
|
+
var import_ui28 = require("@elementor/ui");
|
|
2223
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
1740
2224
|
|
|
1741
2225
|
// src/components/top-bar/create-post-list-item.tsx
|
|
1742
|
-
var
|
|
2226
|
+
var React35 = __toESM(require("react"));
|
|
1743
2227
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
1744
2228
|
var import_events = require("@elementor/events");
|
|
1745
|
-
var
|
|
1746
|
-
var
|
|
1747
|
-
var
|
|
2229
|
+
var import_icons18 = require("@elementor/icons");
|
|
2230
|
+
var import_ui24 = require("@elementor/ui");
|
|
2231
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
1748
2232
|
|
|
1749
2233
|
// src/hooks/use-create-page.ts
|
|
1750
|
-
var
|
|
2234
|
+
var import_react12 = require("react");
|
|
1751
2235
|
var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
|
|
1752
2236
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
1753
2237
|
function useCreatePage() {
|
|
1754
|
-
const [isLoading, setIsLoading] = (0,
|
|
2238
|
+
const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
|
|
1755
2239
|
return {
|
|
1756
2240
|
create: () => {
|
|
1757
2241
|
setIsLoading(true);
|
|
@@ -1774,8 +2258,8 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1774
2258
|
const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
|
|
1775
2259
|
const { data: user } = useUser();
|
|
1776
2260
|
const { dispatchEvent, config } = (0, import_events.useMixpanel)();
|
|
1777
|
-
return /* @__PURE__ */
|
|
1778
|
-
|
|
2261
|
+
return /* @__PURE__ */ React35.createElement(
|
|
2262
|
+
import_ui24.MenuItem,
|
|
1779
2263
|
{
|
|
1780
2264
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
1781
2265
|
onClick: async () => {
|
|
@@ -1798,26 +2282,26 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
1798
2282
|
},
|
|
1799
2283
|
...props
|
|
1800
2284
|
},
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
|
|
2285
|
+
/* @__PURE__ */ React35.createElement(import_ui24.ListItemIcon, null, isLoading ? /* @__PURE__ */ React35.createElement(import_ui24.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React35.createElement(import_icons18.PlusIcon, { fontSize: "small" })),
|
|
2286
|
+
/* @__PURE__ */ React35.createElement(
|
|
2287
|
+
import_ui24.ListItemText,
|
|
1804
2288
|
{
|
|
1805
2289
|
primaryTypographyProps: { variant: "body2" },
|
|
1806
|
-
primary: (0,
|
|
2290
|
+
primary: (0, import_i18n25.__)("Add new page", "elementor")
|
|
1807
2291
|
}
|
|
1808
2292
|
)
|
|
1809
2293
|
);
|
|
1810
2294
|
}
|
|
1811
2295
|
|
|
1812
2296
|
// src/components/top-bar/indicator.tsx
|
|
1813
|
-
var
|
|
1814
|
-
var
|
|
2297
|
+
var React36 = __toESM(require("react"));
|
|
2298
|
+
var import_ui25 = require("@elementor/ui");
|
|
1815
2299
|
function Indicator({ title, status }) {
|
|
1816
|
-
return /* @__PURE__ */
|
|
2300
|
+
return /* @__PURE__ */ React36.createElement(Tooltip4, { title }, /* @__PURE__ */ React36.createElement(import_ui25.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React36.createElement(import_ui25.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React36.createElement(import_ui25.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
1817
2301
|
}
|
|
1818
|
-
function
|
|
1819
|
-
return /* @__PURE__ */
|
|
1820
|
-
|
|
2302
|
+
function Tooltip4(props) {
|
|
2303
|
+
return /* @__PURE__ */ React36.createElement(
|
|
2304
|
+
import_ui25.Tooltip,
|
|
1821
2305
|
{
|
|
1822
2306
|
PopperProps: {
|
|
1823
2307
|
sx: {
|
|
@@ -1832,21 +2316,21 @@ function Tooltip2(props) {
|
|
|
1832
2316
|
}
|
|
1833
2317
|
|
|
1834
2318
|
// src/components/top-bar/post-list-item.tsx
|
|
1835
|
-
var
|
|
2319
|
+
var React38 = __toESM(require("react"));
|
|
1836
2320
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
1837
2321
|
var import_events2 = require("@elementor/events");
|
|
1838
|
-
var
|
|
2322
|
+
var import_ui27 = require("@elementor/ui");
|
|
1839
2323
|
|
|
1840
2324
|
// src/components/top-bar/chip-doc-type.tsx
|
|
1841
|
-
var
|
|
1842
|
-
var
|
|
1843
|
-
var
|
|
2325
|
+
var React37 = __toESM(require("react"));
|
|
2326
|
+
var import_icons19 = require("@elementor/icons");
|
|
2327
|
+
var import_ui26 = require("@elementor/ui");
|
|
1844
2328
|
var iconsMap2 = getIconsMap();
|
|
1845
2329
|
function DocTypeChip({ postType, docType, label }) {
|
|
1846
2330
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
1847
|
-
const Icon = iconsMap2[docType] ||
|
|
1848
|
-
return /* @__PURE__ */
|
|
1849
|
-
|
|
2331
|
+
const Icon = iconsMap2[docType] || import_icons19.PostTypeIcon;
|
|
2332
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2333
|
+
import_ui26.Chip,
|
|
1850
2334
|
{
|
|
1851
2335
|
component: "span",
|
|
1852
2336
|
size: "small",
|
|
@@ -1854,7 +2338,7 @@ function DocTypeChip({ postType, docType, label }) {
|
|
|
1854
2338
|
label,
|
|
1855
2339
|
"data-value": docType,
|
|
1856
2340
|
color,
|
|
1857
|
-
icon: /* @__PURE__ */
|
|
2341
|
+
icon: /* @__PURE__ */ React37.createElement(Icon, null),
|
|
1858
2342
|
sx: { ml: 1, cursor: "inherit" }
|
|
1859
2343
|
}
|
|
1860
2344
|
);
|
|
@@ -1865,8 +2349,8 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1865
2349
|
const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
|
|
1866
2350
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
1867
2351
|
const { dispatchEvent, config } = (0, import_events2.useMixpanel)();
|
|
1868
|
-
return /* @__PURE__ */
|
|
1869
|
-
|
|
2352
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2353
|
+
import_ui27.MenuItem,
|
|
1870
2354
|
{
|
|
1871
2355
|
disabled: !post.user_can.edit,
|
|
1872
2356
|
onClick: async () => {
|
|
@@ -1888,15 +2372,15 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
1888
2372
|
},
|
|
1889
2373
|
...props
|
|
1890
2374
|
},
|
|
1891
|
-
/* @__PURE__ */
|
|
1892
|
-
|
|
2375
|
+
/* @__PURE__ */ React38.createElement(
|
|
2376
|
+
import_ui27.ListItemText,
|
|
1893
2377
|
{
|
|
1894
2378
|
sx: { flexGrow: 0 },
|
|
1895
2379
|
primaryTypographyProps: { variant: "body2", noWrap: true },
|
|
1896
2380
|
primary: postTitle
|
|
1897
2381
|
}
|
|
1898
2382
|
),
|
|
1899
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ React38.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
|
|
1900
2384
|
);
|
|
1901
2385
|
}
|
|
1902
2386
|
|
|
@@ -1913,7 +2397,7 @@ function RecentlyEdited() {
|
|
|
1913
2397
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
1914
2398
|
};
|
|
1915
2399
|
const recentPosts = getRecentPosts();
|
|
1916
|
-
const popupState = (0,
|
|
2400
|
+
const popupState = (0, import_ui28.usePopupState)({
|
|
1917
2401
|
variant: "popover",
|
|
1918
2402
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
1919
2403
|
});
|
|
@@ -1921,13 +2405,13 @@ function RecentlyEdited() {
|
|
|
1921
2405
|
if (!document2) {
|
|
1922
2406
|
return null;
|
|
1923
2407
|
}
|
|
1924
|
-
const buttonProps = (0,
|
|
1925
|
-
return /* @__PURE__ */
|
|
1926
|
-
|
|
2408
|
+
const buttonProps = (0, import_ui28.bindTrigger)(popupState);
|
|
2409
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(
|
|
2410
|
+
import_ui28.Button,
|
|
1927
2411
|
{
|
|
1928
2412
|
color: "inherit",
|
|
1929
2413
|
size: "small",
|
|
1930
|
-
endIcon: /* @__PURE__ */
|
|
2414
|
+
endIcon: /* @__PURE__ */ React39.createElement(import_icons20.ChevronDownIcon, { fontSize: "small" }),
|
|
1931
2415
|
...buttonProps,
|
|
1932
2416
|
onClick: (e) => {
|
|
1933
2417
|
const extendedWindow = window;
|
|
@@ -1946,41 +2430,41 @@ function RecentlyEdited() {
|
|
|
1946
2430
|
buttonProps.onClick(e);
|
|
1947
2431
|
}
|
|
1948
2432
|
},
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
), /* @__PURE__ */
|
|
1951
|
-
|
|
2433
|
+
/* @__PURE__ */ React39.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
2434
|
+
), /* @__PURE__ */ React39.createElement(
|
|
2435
|
+
import_ui28.Menu,
|
|
1952
2436
|
{
|
|
1953
2437
|
MenuListProps: {
|
|
1954
|
-
subheader: /* @__PURE__ */
|
|
2438
|
+
subheader: /* @__PURE__ */ React39.createElement(import_ui28.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n26.__)("Recent", "elementor"))
|
|
1955
2439
|
},
|
|
1956
2440
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
1957
|
-
...(0,
|
|
2441
|
+
...(0, import_ui28.bindMenu)(popupState)
|
|
1958
2442
|
},
|
|
1959
|
-
recentPosts.map((post) => /* @__PURE__ */
|
|
1960
|
-
recentPosts.length === 0 && /* @__PURE__ */
|
|
1961
|
-
|
|
2443
|
+
recentPosts.map((post) => /* @__PURE__ */ React39.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
2444
|
+
recentPosts.length === 0 && /* @__PURE__ */ React39.createElement(import_ui28.MenuItem, { disabled: true }, /* @__PURE__ */ React39.createElement(
|
|
2445
|
+
import_ui28.ListItemText,
|
|
1962
2446
|
{
|
|
1963
2447
|
primaryTypographyProps: {
|
|
1964
2448
|
variant: "caption",
|
|
1965
2449
|
fontStyle: "italic"
|
|
1966
2450
|
},
|
|
1967
|
-
primary: (0,
|
|
2451
|
+
primary: (0, import_i18n26.__)("There are no other pages or templates on this site yet.", "elementor")
|
|
1968
2452
|
}
|
|
1969
2453
|
)),
|
|
1970
|
-
/* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
2454
|
+
/* @__PURE__ */ React39.createElement(import_ui28.Divider, { disabled: recentPosts.length === 0 }),
|
|
2455
|
+
/* @__PURE__ */ React39.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
1972
2456
|
));
|
|
1973
2457
|
}
|
|
1974
2458
|
|
|
1975
2459
|
// src/hooks/use-toggle-button-props.ts
|
|
1976
|
-
var
|
|
1977
|
-
var
|
|
2460
|
+
var import_icons21 = require("@elementor/icons");
|
|
2461
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
1978
2462
|
function useToggleButtonProps() {
|
|
1979
2463
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1980
2464
|
const { open, close } = usePanelActions();
|
|
1981
2465
|
return {
|
|
1982
|
-
title: (0,
|
|
1983
|
-
icon:
|
|
2466
|
+
title: (0, import_i18n27.__)("Site content", "elementor"),
|
|
2467
|
+
icon: import_icons21.PagesIcon,
|
|
1984
2468
|
onClick: () => {
|
|
1985
2469
|
const extendedWindow = window;
|
|
1986
2470
|
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
@@ -2014,7 +2498,7 @@ function registerTopBarMenuItems() {
|
|
|
2014
2498
|
});
|
|
2015
2499
|
}
|
|
2016
2500
|
function registerButton() {
|
|
2017
|
-
const menu = (0,
|
|
2501
|
+
const menu = (0, import_editor_sidebar2.isSidebarEnabled)() ? import_editor_sidebar2.sidebarTools : import_editor_app_bar.toolsMenu;
|
|
2018
2502
|
menu.registerToggleAction({
|
|
2019
2503
|
id: "toggle-site-navigation-panel",
|
|
2020
2504
|
priority: 6,
|
|
@@ -2023,6 +2507,8 @@ function registerButton() {
|
|
|
2023
2507
|
}
|
|
2024
2508
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2025
2509
|
0 && (module.exports = {
|
|
2510
|
+
SiteContentListItemActionsSlot,
|
|
2026
2511
|
extendIconsMap,
|
|
2027
|
-
init
|
|
2512
|
+
init,
|
|
2513
|
+
injectIntoSiteContentListItemActions
|
|
2028
2514
|
});
|