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