@elementor/editor-site-navigation 4.5.0-1251 → 4.5.0-1252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +30 -13
- package/dist/index.d.ts +30 -13
- package/dist/index.js +1215 -1018
- package/dist/index.mjs +1146 -955
- package/package.json +12 -12
- package/src/components/panel/content-panel-chrome.ts +32 -8
- package/src/components/panel/content-panel-section-header-actions.tsx +22 -0
- package/src/components/panel/content-panel-section-toolbar.tsx +33 -3
- package/src/components/panel/posts-list/list-items/list-item-view.tsx +18 -8
- package/src/components/panel/posts-list/posts-collapsible-list.tsx +54 -21
- package/src/components/panel/shell-panel-body-content.tsx +21 -29
- package/src/components/panel/shell.tsx +103 -35
- package/src/components/panel/site-content-home.tsx +149 -0
- package/src/components/panel/site-content-section-header.tsx +60 -0
- package/src/contexts/content-panel-coordinator.tsx +65 -11
- package/src/index.ts +9 -0
- package/src/site-content-sections.ts +8 -0
- package/src/site-content-view.ts +47 -0
- package/src/utils/keyboard-click.ts +10 -0
package/dist/index.mjs
CHANGED
|
@@ -31,39 +31,78 @@ import { createPanel } from "@elementor/editor-panels";
|
|
|
31
31
|
|
|
32
32
|
// src/components/panel/shell.tsx
|
|
33
33
|
import * as React42 from "react";
|
|
34
|
-
import { useState as
|
|
34
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef6, useState as useState10 } from "react";
|
|
35
35
|
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
36
36
|
import { isSidebarEnabled } from "@elementor/editor-sidebar";
|
|
37
|
-
import { Divider as Divider8, Stack as
|
|
38
|
-
import { __ as
|
|
37
|
+
import { Box as Box15, Divider as Divider8, Stack as Stack12 } from "@elementor/ui";
|
|
38
|
+
import { __ as __30 } from "@wordpress/i18n";
|
|
39
39
|
|
|
40
40
|
// src/contexts/content-panel-coordinator.tsx
|
|
41
41
|
import * as React from "react";
|
|
42
|
-
import { createContext, useCallback, useContext, useMemo, useRef } from "react";
|
|
42
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef } from "react";
|
|
43
43
|
var ContentPanelCoordinatorContext = createContext(null);
|
|
44
|
-
function ContentPanelCoordinatorProvider({
|
|
44
|
+
function ContentPanelCoordinatorProvider({
|
|
45
|
+
children,
|
|
46
|
+
clearPendingCreateRef,
|
|
47
|
+
onNavigateToSection
|
|
48
|
+
}) {
|
|
49
|
+
const pendingCreateSectionRef = useRef(null);
|
|
45
50
|
const sectionsRef = useRef(/* @__PURE__ */ new Map());
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
}, []);
|
|
49
|
-
const unregisterSection = useCallback((type) => {
|
|
50
|
-
sectionsRef.current.delete(type);
|
|
51
|
+
const clearPendingCreate = useCallback(() => {
|
|
52
|
+
pendingCreateSectionRef.current = null;
|
|
51
53
|
}, []);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!clearPendingCreateRef) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
clearPendingCreateRef.current = clearPendingCreate;
|
|
59
|
+
return () => {
|
|
60
|
+
clearPendingCreateRef.current = void 0;
|
|
61
|
+
};
|
|
62
|
+
}, [clearPendingCreate, clearPendingCreateRef]);
|
|
63
|
+
const runPendingCreate = useCallback((type, handlers) => {
|
|
64
|
+
if (pendingCreateSectionRef.current !== type) {
|
|
55
65
|
return;
|
|
56
66
|
}
|
|
67
|
+
pendingCreateSectionRef.current = null;
|
|
57
68
|
handlers.setExpanded(true);
|
|
58
69
|
handlers.startCreate();
|
|
59
70
|
}, []);
|
|
71
|
+
const registerSection = useCallback(
|
|
72
|
+
(type, handlers) => {
|
|
73
|
+
sectionsRef.current.set(type, handlers);
|
|
74
|
+
runPendingCreate(type, handlers);
|
|
75
|
+
},
|
|
76
|
+
[runPendingCreate]
|
|
77
|
+
);
|
|
78
|
+
const unregisterSection = useCallback((type) => {
|
|
79
|
+
sectionsRef.current.delete(type);
|
|
80
|
+
if (pendingCreateSectionRef.current === type) {
|
|
81
|
+
pendingCreateSectionRef.current = null;
|
|
82
|
+
}
|
|
83
|
+
}, []);
|
|
84
|
+
const requestCreate = useCallback(
|
|
85
|
+
(type) => {
|
|
86
|
+
onNavigateToSection?.(type);
|
|
87
|
+
const handlers = sectionsRef.current.get(type);
|
|
88
|
+
if (handlers) {
|
|
89
|
+
handlers.setExpanded(true);
|
|
90
|
+
handlers.startCreate();
|
|
91
|
+
pendingCreateSectionRef.current = null;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
pendingCreateSectionRef.current = type;
|
|
95
|
+
},
|
|
96
|
+
[onNavigateToSection]
|
|
97
|
+
);
|
|
60
98
|
const value = useMemo(
|
|
61
99
|
() => ({
|
|
100
|
+
clearPendingCreate,
|
|
62
101
|
registerSection,
|
|
63
102
|
requestCreate,
|
|
64
103
|
unregisterSection
|
|
65
104
|
}),
|
|
66
|
-
[registerSection, requestCreate, unregisterSection]
|
|
105
|
+
[clearPendingCreate, registerSection, requestCreate, unregisterSection]
|
|
67
106
|
);
|
|
68
107
|
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
69
108
|
}
|
|
@@ -77,16 +116,54 @@ function useContentPanelCoordinator() {
|
|
|
77
116
|
return context;
|
|
78
117
|
}
|
|
79
118
|
|
|
80
|
-
// src/contexts/
|
|
119
|
+
// src/contexts/post-list-context.tsx
|
|
81
120
|
import * as React2 from "react";
|
|
82
|
-
import { createContext as createContext2,
|
|
121
|
+
import { createContext as createContext2, useContext as useContext2, useState } from "react";
|
|
122
|
+
var defaultValues = {
|
|
123
|
+
type: "page",
|
|
124
|
+
editMode: { mode: "none", details: {} },
|
|
125
|
+
setEditMode: () => null,
|
|
126
|
+
resetEditMode: () => null,
|
|
127
|
+
setError: () => null
|
|
128
|
+
};
|
|
129
|
+
var PostListContext = createContext2(defaultValues);
|
|
130
|
+
var PostListContextProvider = ({
|
|
131
|
+
type,
|
|
132
|
+
setError,
|
|
133
|
+
children
|
|
134
|
+
}) => {
|
|
135
|
+
const [editMode, setEditMode] = useState(defaultValues.editMode);
|
|
136
|
+
const resetEditMode = () => {
|
|
137
|
+
setEditMode(defaultValues.editMode);
|
|
138
|
+
};
|
|
139
|
+
return /* @__PURE__ */ React2.createElement(
|
|
140
|
+
PostListContext.Provider,
|
|
141
|
+
{
|
|
142
|
+
value: {
|
|
143
|
+
type,
|
|
144
|
+
editMode,
|
|
145
|
+
setEditMode,
|
|
146
|
+
resetEditMode,
|
|
147
|
+
setError
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
children
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
function usePostListContext() {
|
|
154
|
+
const context = useContext2(PostListContext);
|
|
155
|
+
if (!context) {
|
|
156
|
+
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
157
|
+
}
|
|
158
|
+
return context;
|
|
159
|
+
}
|
|
83
160
|
|
|
84
|
-
// src/
|
|
85
|
-
import
|
|
161
|
+
// src/contexts/site-content-section-toolbar.tsx
|
|
162
|
+
import * as React3 from "react";
|
|
163
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
|
|
86
164
|
|
|
87
|
-
// src/
|
|
88
|
-
import
|
|
89
|
-
import { __ as __2 } from "@wordpress/i18n";
|
|
165
|
+
// src/hooks/use-site-content-section-list-controls.ts
|
|
166
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
|
|
90
167
|
|
|
91
168
|
// src/site-content-sort.ts
|
|
92
169
|
import { __ } from "@wordpress/i18n";
|
|
@@ -113,20 +190,186 @@ function shouldPinHomepageForSiteContentSort(sort) {
|
|
|
113
190
|
return sort === DEFAULT_SITE_CONTENT_SORT;
|
|
114
191
|
}
|
|
115
192
|
|
|
193
|
+
// src/site-content-status-filter.ts
|
|
194
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
195
|
+
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
196
|
+
"publish",
|
|
197
|
+
"draft",
|
|
198
|
+
"pending",
|
|
199
|
+
"private",
|
|
200
|
+
"future",
|
|
201
|
+
"trash"
|
|
202
|
+
];
|
|
203
|
+
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
204
|
+
draft: false,
|
|
205
|
+
future: false,
|
|
206
|
+
pending: false,
|
|
207
|
+
private: false,
|
|
208
|
+
publish: false,
|
|
209
|
+
trash: false
|
|
210
|
+
};
|
|
211
|
+
var filterLabels = {
|
|
212
|
+
publish: __2("Published", "elementor"),
|
|
213
|
+
draft: __2("Drafts", "elementor"),
|
|
214
|
+
pending: __2("Pending", "elementor"),
|
|
215
|
+
private: __2("Private", "elementor"),
|
|
216
|
+
future: __2("Scheduled", "elementor"),
|
|
217
|
+
trash: __2("Trash", "elementor")
|
|
218
|
+
};
|
|
219
|
+
var SITE_CONTENT_ALL_FILTER_LABEL = __2("All", "elementor");
|
|
220
|
+
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
221
|
+
function getSiteContentStatusFilterLabel(filter) {
|
|
222
|
+
return filterLabels[filter];
|
|
223
|
+
}
|
|
224
|
+
function hasActiveSiteContentStatusFilters(filters) {
|
|
225
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
226
|
+
}
|
|
227
|
+
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
228
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
229
|
+
}
|
|
230
|
+
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
231
|
+
function getRestStatusForSiteContentFilters(filters) {
|
|
232
|
+
if (filters.trash) {
|
|
233
|
+
return "trash";
|
|
234
|
+
}
|
|
235
|
+
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
236
|
+
if (0 === active.length) {
|
|
237
|
+
return "any";
|
|
238
|
+
}
|
|
239
|
+
return active.join(",");
|
|
240
|
+
}
|
|
241
|
+
function isSiteContentTrashFilterActive(filters) {
|
|
242
|
+
return filters.trash;
|
|
243
|
+
}
|
|
244
|
+
function isSiteContentListNarrowed(filters, search) {
|
|
245
|
+
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
246
|
+
}
|
|
247
|
+
function toggleSiteContentStatusFilter(filters, filter) {
|
|
248
|
+
if ("trash" === filter) {
|
|
249
|
+
const isTrashOn = !filters.trash;
|
|
250
|
+
return {
|
|
251
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
252
|
+
trash: isTrashOn
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
...filters,
|
|
257
|
+
trash: false,
|
|
258
|
+
[filter]: !filters[filter]
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function getSiteContentStatusFilterForCount(status) {
|
|
262
|
+
if ("trash" === status) {
|
|
263
|
+
return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
267
|
+
[status]: true
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
271
|
+
if (isSelected) {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
if (isLoadingCounts || void 0 === count) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
return count > 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/hooks/use-site-content-section-list-controls.ts
|
|
281
|
+
var SEARCH_DEBOUNCE_MS = 300;
|
|
282
|
+
function useSiteContentSectionListControls() {
|
|
283
|
+
const [searchQuery, setSearchQuery] = useState2("");
|
|
284
|
+
const [debouncedSearch, setDebouncedSearch] = useState2("");
|
|
285
|
+
const [siteContentSort, setSiteContentSortState] = useState2(DEFAULT_SITE_CONTENT_SORT);
|
|
286
|
+
const [statusFilters, setStatusFilters] = useState2(
|
|
287
|
+
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
288
|
+
);
|
|
289
|
+
const trimmedSearch = searchQuery.trim();
|
|
290
|
+
useEffect2(() => {
|
|
291
|
+
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
292
|
+
return () => window.clearTimeout(handle);
|
|
293
|
+
}, [trimmedSearch]);
|
|
294
|
+
const clearActiveToolbarFilters = useCallback2(() => {
|
|
295
|
+
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
296
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
297
|
+
}, []);
|
|
298
|
+
const clearSiteContentSort = useCallback2(() => {
|
|
299
|
+
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
300
|
+
}, []);
|
|
301
|
+
const clearStatusFilters = useCallback2(() => {
|
|
302
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
303
|
+
}, []);
|
|
304
|
+
const setSiteContentSort = useCallback2((sort) => {
|
|
305
|
+
setSiteContentSortState(sort);
|
|
306
|
+
}, []);
|
|
307
|
+
const toggleStatusFilter = useCallback2((filter) => {
|
|
308
|
+
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
309
|
+
}, []);
|
|
310
|
+
return {
|
|
311
|
+
clearActiveToolbarFilters,
|
|
312
|
+
clearSiteContentSort,
|
|
313
|
+
clearStatusFilters,
|
|
314
|
+
debouncedSearch,
|
|
315
|
+
searchQuery,
|
|
316
|
+
setSearchQuery,
|
|
317
|
+
setSiteContentSort,
|
|
318
|
+
siteContentSort,
|
|
319
|
+
statusFilters,
|
|
320
|
+
toggleStatusFilter
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/contexts/site-content-section-toolbar.tsx
|
|
325
|
+
var SiteContentSectionToolbarContext = createContext3(null);
|
|
326
|
+
function SiteContentSectionToolbarProvider({
|
|
327
|
+
children,
|
|
328
|
+
statusFilterCountSlugs = [],
|
|
329
|
+
statusFilterCounts,
|
|
330
|
+
statusFilterCountsPending = false
|
|
331
|
+
}) {
|
|
332
|
+
const controls = useSiteContentSectionListControls();
|
|
333
|
+
const value = useMemo2(
|
|
334
|
+
() => ({
|
|
335
|
+
...controls,
|
|
336
|
+
statusFilterCountSlugs,
|
|
337
|
+
statusFilterCounts,
|
|
338
|
+
statusFilterCountsPending
|
|
339
|
+
}),
|
|
340
|
+
[controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
|
|
341
|
+
);
|
|
342
|
+
return /* @__PURE__ */ React3.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
|
|
343
|
+
}
|
|
344
|
+
function useSiteContentSectionToolbar() {
|
|
345
|
+
const context = useContext3(SiteContentSectionToolbarContext);
|
|
346
|
+
if (!context) {
|
|
347
|
+
throw new Error(
|
|
348
|
+
"The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
return context;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// src/hooks/use-accessible-panel-post-types.ts
|
|
355
|
+
import { useMemo as useMemo3 } from "react";
|
|
356
|
+
|
|
116
357
|
// src/api/post.ts
|
|
358
|
+
import apiFetch from "@wordpress/api-fetch";
|
|
359
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
117
360
|
var postTypesMap = {
|
|
118
361
|
page: {
|
|
119
362
|
labels: {
|
|
120
|
-
singular_name:
|
|
121
|
-
plural_name:
|
|
363
|
+
singular_name: __3("Page", "elementor"),
|
|
364
|
+
plural_name: __3("Pages", "elementor")
|
|
122
365
|
},
|
|
123
366
|
rest_base: "pages",
|
|
124
367
|
createCapability: "edit_pages"
|
|
125
368
|
},
|
|
126
369
|
post: {
|
|
127
370
|
labels: {
|
|
128
|
-
singular_name:
|
|
129
|
-
plural_name:
|
|
371
|
+
singular_name: __3("Post", "elementor"),
|
|
372
|
+
plural_name: __3("Posts", "elementor")
|
|
130
373
|
},
|
|
131
374
|
rest_base: "posts",
|
|
132
375
|
createCapability: "edit_posts"
|
|
@@ -141,9 +384,9 @@ function getAccessiblePanelPostTypes(capabilities) {
|
|
|
141
384
|
}
|
|
142
385
|
function getCannotEditPanelItemMessage(postTypeSlug) {
|
|
143
386
|
if ("page" === postTypeSlug) {
|
|
144
|
-
return
|
|
387
|
+
return __3("You cannot edit this page.", "elementor");
|
|
145
388
|
}
|
|
146
|
-
return
|
|
389
|
+
return __3("You cannot edit this post.", "elementor");
|
|
147
390
|
}
|
|
148
391
|
var POST_PER_PAGE = 10;
|
|
149
392
|
var COUNT_QUERY_PER_PAGE = 1;
|
|
@@ -251,7 +494,7 @@ function useUser() {
|
|
|
251
494
|
// src/hooks/use-accessible-panel-post-types.ts
|
|
252
495
|
function useAccessiblePanelPostTypes() {
|
|
253
496
|
const { data: user, isPending: isUserPending, isError: isUserError } = useUser();
|
|
254
|
-
const accessiblePostTypes =
|
|
497
|
+
const accessiblePostTypes = useMemo3(() => {
|
|
255
498
|
if (user?.capabilities) {
|
|
256
499
|
return getAccessiblePanelPostTypes(user.capabilities);
|
|
257
500
|
}
|
|
@@ -274,6 +517,9 @@ var DEFAULT_SECTION_PRIORITY = 0;
|
|
|
274
517
|
function registerSiteContentSection(section) {
|
|
275
518
|
registeredSections.set(section.id, section);
|
|
276
519
|
}
|
|
520
|
+
function getSiteContentSectionById(sectionId) {
|
|
521
|
+
return registeredSections.get(sectionId);
|
|
522
|
+
}
|
|
277
523
|
function getSiteContentSections() {
|
|
278
524
|
return Array.from(registeredSections.values()).sort(
|
|
279
525
|
(first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
|
|
@@ -283,92 +529,37 @@ function resetSiteContentSections() {
|
|
|
283
529
|
registeredSections.clear();
|
|
284
530
|
}
|
|
285
531
|
|
|
286
|
-
// src/site-content-
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
label: postTypesMap[slug].labels.plural_name
|
|
292
|
-
}));
|
|
293
|
-
const registeredSections2 = getSiteContentSections().map((section) => ({
|
|
294
|
-
id: section.id,
|
|
295
|
-
label: section.label ?? section.id
|
|
296
|
-
}));
|
|
297
|
-
return [...postTypeSections, ...registeredSections2];
|
|
298
|
-
}
|
|
299
|
-
function hasHiddenSiteContentPanelSections(hiddenSectionIds) {
|
|
300
|
-
return hiddenSectionIds.size > 0;
|
|
532
|
+
// src/site-content-view.ts
|
|
533
|
+
var pendingOpenView;
|
|
534
|
+
var activeViewInMemory = null;
|
|
535
|
+
function setPendingSiteContentSection(sectionId) {
|
|
536
|
+
pendingOpenView = sectionId;
|
|
301
537
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var SiteContentPanelSectionsFilterContext = createContext2(
|
|
305
|
-
null
|
|
306
|
-
);
|
|
307
|
-
function SiteContentPanelSectionsFilterProvider({ children }) {
|
|
308
|
-
const { accessiblePostTypes } = useAccessiblePanelPostTypes();
|
|
309
|
-
const descriptors = useMemo3(
|
|
310
|
-
() => getSiteContentPanelSectionDescriptors(accessiblePostTypes),
|
|
311
|
-
[accessiblePostTypes]
|
|
312
|
-
);
|
|
313
|
-
const [hiddenSectionIds, setHiddenSectionIds] = useState(() => /* @__PURE__ */ new Set());
|
|
314
|
-
useEffect(() => {
|
|
315
|
-
const validIds = new Set(descriptors.map((descriptor) => descriptor.id));
|
|
316
|
-
setHiddenSectionIds((current) => {
|
|
317
|
-
const nextHidden = new Set([...current].filter((id) => validIds.has(id)));
|
|
318
|
-
return nextHidden.size === current.size ? current : nextHidden;
|
|
319
|
-
});
|
|
320
|
-
}, [descriptors]);
|
|
321
|
-
const setSectionVisible = useCallback2(
|
|
322
|
-
(sectionId, visible) => {
|
|
323
|
-
setHiddenSectionIds((current) => {
|
|
324
|
-
if (visible) {
|
|
325
|
-
if (!current.has(sectionId)) {
|
|
326
|
-
return current;
|
|
327
|
-
}
|
|
328
|
-
const next2 = new Set(current);
|
|
329
|
-
next2.delete(sectionId);
|
|
330
|
-
return next2;
|
|
331
|
-
}
|
|
332
|
-
const visibleSectionCount = descriptors.length - current.size;
|
|
333
|
-
if (current.has(sectionId) || visibleSectionCount <= 1) {
|
|
334
|
-
return current;
|
|
335
|
-
}
|
|
336
|
-
const next = new Set(current);
|
|
337
|
-
next.add(sectionId);
|
|
338
|
-
return next;
|
|
339
|
-
});
|
|
340
|
-
},
|
|
341
|
-
[descriptors.length]
|
|
342
|
-
);
|
|
343
|
-
const isSectionVisible = useCallback2(
|
|
344
|
-
(sectionId) => !hiddenSectionIds.has(sectionId),
|
|
345
|
-
[hiddenSectionIds]
|
|
346
|
-
);
|
|
347
|
-
const clearHiddenSections = useCallback2(() => {
|
|
348
|
-
setHiddenSectionIds(() => /* @__PURE__ */ new Set());
|
|
349
|
-
}, []);
|
|
350
|
-
const value = useMemo3(
|
|
351
|
-
() => ({
|
|
352
|
-
clearHiddenSections,
|
|
353
|
-
descriptors,
|
|
354
|
-
hasHiddenSections: hasHiddenSiteContentPanelSections(hiddenSectionIds),
|
|
355
|
-
hiddenSectionIds,
|
|
356
|
-
isSectionVisible,
|
|
357
|
-
setSectionVisible,
|
|
358
|
-
shouldShowSectionsFilter: descriptors.length > 1
|
|
359
|
-
}),
|
|
360
|
-
[clearHiddenSections, descriptors, hiddenSectionIds, isSectionVisible, setSectionVisible]
|
|
361
|
-
);
|
|
362
|
-
return /* @__PURE__ */ React2.createElement(SiteContentPanelSectionsFilterContext.Provider, { value }, children);
|
|
538
|
+
function setPendingSiteContentHome() {
|
|
539
|
+
pendingOpenView = null;
|
|
363
540
|
}
|
|
364
|
-
function
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
throw new Error(
|
|
368
|
-
"useSiteContentPanelSectionsFilter() must be used within a SiteContentPanelSectionsFilterProvider"
|
|
369
|
-
);
|
|
541
|
+
function consumePendingOpen() {
|
|
542
|
+
if (pendingOpenView === void 0) {
|
|
543
|
+
return void 0;
|
|
370
544
|
}
|
|
371
|
-
|
|
545
|
+
const view = pendingOpenView;
|
|
546
|
+
pendingOpenView = void 0;
|
|
547
|
+
activeViewInMemory = view;
|
|
548
|
+
return view;
|
|
549
|
+
}
|
|
550
|
+
function getInitialSiteContentView() {
|
|
551
|
+
const pending = consumePendingOpen();
|
|
552
|
+
if (pending !== void 0) {
|
|
553
|
+
return pending;
|
|
554
|
+
}
|
|
555
|
+
activeViewInMemory = null;
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
558
|
+
function notifySiteContentViewChange(view) {
|
|
559
|
+
activeViewInMemory = view;
|
|
560
|
+
}
|
|
561
|
+
function getActiveSiteContentView() {
|
|
562
|
+
return activeViewInMemory;
|
|
372
563
|
}
|
|
373
564
|
|
|
374
565
|
// src/components/panel/content-panel-chrome.ts
|
|
@@ -379,7 +570,11 @@ var CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
|
|
|
379
570
|
var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
|
|
380
571
|
var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
|
|
381
572
|
var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
|
|
573
|
+
var CONTENT_PANEL_SHELL_HEADER_PADDING_BLOCK = 1;
|
|
574
|
+
var CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_INLINE = 1;
|
|
575
|
+
var CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_START = 2;
|
|
382
576
|
var CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP = 0.75;
|
|
577
|
+
var CONTENT_PANEL_FLAT_SECTION_TOOLBAR_PADDING_BLOCK = 1.25;
|
|
383
578
|
var CONTENT_PANEL_SEARCH_PADDING_BLOCK = 1.5;
|
|
384
579
|
var contentPanelInsetPaddingSx = {
|
|
385
580
|
paddingInline: CONTENT_PANEL_INSET_SPACING
|
|
@@ -402,21 +597,19 @@ function getContentPanelListItemSx(trailingActionCount) {
|
|
|
402
597
|
function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
|
|
403
598
|
if (isActive) {
|
|
404
599
|
return {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
600
|
+
"&&": {
|
|
601
|
+
backgroundColor: "action.selected",
|
|
602
|
+
"&:hover": {
|
|
603
|
+
backgroundColor: "action.selected"
|
|
604
|
+
}
|
|
409
605
|
}
|
|
410
606
|
};
|
|
411
607
|
}
|
|
412
608
|
if (!allowRowHover) {
|
|
413
|
-
return {
|
|
414
|
-
borderRadius: 1
|
|
415
|
-
};
|
|
609
|
+
return {};
|
|
416
610
|
}
|
|
417
611
|
return {
|
|
418
|
-
|
|
419
|
-
"&:hover": {
|
|
612
|
+
"&&:hover": {
|
|
420
613
|
backgroundColor: "action.hover"
|
|
421
614
|
}
|
|
422
615
|
};
|
|
@@ -424,6 +617,25 @@ function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
|
|
|
424
617
|
var contentPanelHeaderStackSx = {
|
|
425
618
|
width: "100%"
|
|
426
619
|
};
|
|
620
|
+
function getContentPanelShellHeaderStackSx(sidebarPanelChrome) {
|
|
621
|
+
if (sidebarPanelChrome) {
|
|
622
|
+
return {
|
|
623
|
+
...contentPanelHeaderStackSx,
|
|
624
|
+
paddingInlineEnd: CONTENT_PANEL_INSET_SPACING - CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_INLINE,
|
|
625
|
+
paddingInlineStart: CONTENT_PANEL_INSET_SPACING - CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_START
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
return {
|
|
629
|
+
...contentPanelHeaderStackSx,
|
|
630
|
+
paddingInline: CONTENT_PANEL_INSET_SPACING,
|
|
631
|
+
py: CONTENT_PANEL_SHELL_HEADER_PADDING_BLOCK
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
var contentPanelFlatSectionToolbarRowSx = {
|
|
635
|
+
flexShrink: 0,
|
|
636
|
+
px: CONTENT_PANEL_INSET_SPACING,
|
|
637
|
+
py: CONTENT_PANEL_FLAT_SECTION_TOOLBAR_PADDING_BLOCK
|
|
638
|
+
};
|
|
427
639
|
var contentPanelSearchBoxSx = {
|
|
428
640
|
...contentPanelInsetPaddingSx,
|
|
429
641
|
py: CONTENT_PANEL_SEARCH_PADDING_BLOCK
|
|
@@ -433,6 +645,10 @@ var contentPanelSectionHeaderSx = {
|
|
|
433
645
|
py: CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK
|
|
434
646
|
};
|
|
435
647
|
var contentPanelSectionHeaderTrailingGap = CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP;
|
|
648
|
+
var contentPanelFullBleedDividerSx = {
|
|
649
|
+
marginInline: 0,
|
|
650
|
+
width: "100%"
|
|
651
|
+
};
|
|
436
652
|
var contentPanelListRowTitleSx = {
|
|
437
653
|
fontSize: CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE
|
|
438
654
|
};
|
|
@@ -466,10 +682,10 @@ var contentPanelListItemButtonSx = {
|
|
|
466
682
|
};
|
|
467
683
|
|
|
468
684
|
// src/components/panel/content-panel-header-add.tsx
|
|
469
|
-
import * as
|
|
685
|
+
import * as React7 from "react";
|
|
470
686
|
import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
|
|
471
687
|
import { bindMenu, bindTrigger, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Menu, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
|
|
472
|
-
import { __ as
|
|
688
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
473
689
|
|
|
474
690
|
// src/hooks/use-can-create.ts
|
|
475
691
|
function useCanCreate(postTypeSlug) {
|
|
@@ -500,34 +716,34 @@ function resetSiteContentHeaderCreateItems() {
|
|
|
500
716
|
}
|
|
501
717
|
|
|
502
718
|
// src/components/panel/content-panel-add-icon-button.tsx
|
|
503
|
-
import * as
|
|
719
|
+
import * as React4 from "react";
|
|
504
720
|
import { PlusIcon } from "@elementor/icons";
|
|
505
721
|
import { IconButton } from "@elementor/ui";
|
|
506
722
|
var CONTENT_PANEL_ADD_ICON_SIZE = "tiny";
|
|
507
723
|
function ContentPanelAddIconButton(props) {
|
|
508
|
-
return /* @__PURE__ */
|
|
724
|
+
return /* @__PURE__ */ React4.createElement(IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React4.createElement(PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
|
|
509
725
|
}
|
|
510
726
|
|
|
511
727
|
// src/components/panel/popups/popup-header-create-menu-item.tsx
|
|
512
|
-
import * as
|
|
728
|
+
import * as React6 from "react";
|
|
513
729
|
import { useRef as useRef2 } from "react";
|
|
514
730
|
import { PopupTemplateIcon } from "@elementor/icons";
|
|
515
731
|
import { Box as Box2, ListItemIcon, ListItemText, MenuItem } from "@elementor/ui";
|
|
516
|
-
import { __ as
|
|
732
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
517
733
|
|
|
518
734
|
// src/components/panel/popups/site-content-popups-promotion-chip.tsx
|
|
519
|
-
import * as
|
|
520
|
-
import { forwardRef, useCallback as useCallback3, useImperativeHandle, useState as
|
|
735
|
+
import * as React5 from "react";
|
|
736
|
+
import { forwardRef, useCallback as useCallback3, useImperativeHandle, useState as useState3 } from "react";
|
|
521
737
|
import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
|
|
522
738
|
import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
|
|
523
739
|
import { Box } from "@elementor/ui";
|
|
524
|
-
import { __ as
|
|
740
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
525
741
|
var TRACKING_DATA = {
|
|
526
742
|
target_name: "popups",
|
|
527
743
|
target_location: "widget_panel"
|
|
528
744
|
};
|
|
529
745
|
var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
|
|
530
|
-
const [isOpen, setIsOpen] =
|
|
746
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
531
747
|
const upgradeUrl = env.popups?.upgrade_url ?? POPUP_SITE_CONTENT_UPGRADE_URL;
|
|
532
748
|
useCanvasClickHandler(isOpen, () => setIsOpen(false));
|
|
533
749
|
const toggle = useCallback3(() => {
|
|
@@ -539,13 +755,13 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
|
|
|
539
755
|
});
|
|
540
756
|
}, []);
|
|
541
757
|
useImperativeHandle(ref, () => ({ toggle }), [toggle]);
|
|
542
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ React5.createElement(
|
|
543
759
|
PromotionPopover,
|
|
544
760
|
{
|
|
545
761
|
open: isOpen,
|
|
546
|
-
title:
|
|
547
|
-
content:
|
|
548
|
-
ctaText:
|
|
762
|
+
title: __4("Popups", "elementor"),
|
|
763
|
+
content: __4("Upgrade to continue creating and editing popups.", "elementor"),
|
|
764
|
+
ctaText: __4("Upgrade now", "elementor"),
|
|
549
765
|
ctaUrl: upgradeUrl,
|
|
550
766
|
onClose: (event) => {
|
|
551
767
|
event.stopPropagation();
|
|
@@ -553,7 +769,7 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
|
|
|
553
769
|
},
|
|
554
770
|
onCtaClick: () => trackUpgradePromotionClick(TRACKING_DATA)
|
|
555
771
|
},
|
|
556
|
-
/* @__PURE__ */
|
|
772
|
+
/* @__PURE__ */ React5.createElement(
|
|
557
773
|
Box,
|
|
558
774
|
{
|
|
559
775
|
onClick: (event) => {
|
|
@@ -562,7 +778,7 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
|
|
|
562
778
|
},
|
|
563
779
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
564
780
|
},
|
|
565
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ React5.createElement(PromotionChip, null)
|
|
566
782
|
)
|
|
567
783
|
);
|
|
568
784
|
});
|
|
@@ -571,7 +787,7 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
|
|
|
571
787
|
function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
572
788
|
const promotionRef = useRef2(null);
|
|
573
789
|
const canCreate = env.popups?.can_use ?? false;
|
|
574
|
-
const label =
|
|
790
|
+
const label = __5("Popup", "elementor");
|
|
575
791
|
const handleClick = () => {
|
|
576
792
|
if (!canCreate) {
|
|
577
793
|
promotionRef.current?.toggle();
|
|
@@ -579,7 +795,7 @@ function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
|
579
795
|
}
|
|
580
796
|
onSelect();
|
|
581
797
|
};
|
|
582
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ React6.createElement(MenuItem, { onClick: handleClick }, /* @__PURE__ */ React6.createElement(ListItemIcon, null, /* @__PURE__ */ React6.createElement(PopupTemplateIcon, { fontSize: "small", color: canCreate ? "action" : "disabled" })), /* @__PURE__ */ React6.createElement(
|
|
583
799
|
ListItemText,
|
|
584
800
|
{
|
|
585
801
|
primary: label,
|
|
@@ -588,7 +804,7 @@ function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
|
588
804
|
color: canCreate ? "text.primary" : "text.disabled"
|
|
589
805
|
}
|
|
590
806
|
}
|
|
591
|
-
), !canCreate && /* @__PURE__ */
|
|
807
|
+
), !canCreate && /* @__PURE__ */ React6.createElement(Box2, { sx: { flexShrink: 0, ml: "auto", pl: 1 } }, /* @__PURE__ */ React6.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })));
|
|
592
808
|
}
|
|
593
809
|
|
|
594
810
|
// src/components/panel/content-panel-header-add.tsx
|
|
@@ -600,7 +816,7 @@ function HeaderAddMenuItem({ slug, onSelect }) {
|
|
|
600
816
|
const canCreate = useCanCreate(slug);
|
|
601
817
|
const Icon = typeIcons[slug];
|
|
602
818
|
const singularName = postTypesMap[slug].labels.singular_name;
|
|
603
|
-
return /* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ React7.createElement(MenuItem2, { disabled: !canCreate, onClick: () => onSelect(slug) }, /* @__PURE__ */ React7.createElement(ListItemIcon2, null, /* @__PURE__ */ React7.createElement(Icon, { fontSize: "small" })), /* @__PURE__ */ React7.createElement(ListItemText2, { primary: singularName, primaryTypographyProps: { variant: "body2" } }));
|
|
604
820
|
}
|
|
605
821
|
function ContentPanelHeaderAdd() {
|
|
606
822
|
const { requestCreate } = useContentPanelCoordinator();
|
|
@@ -625,14 +841,14 @@ function ContentPanelHeaderAdd() {
|
|
|
625
841
|
requestCreate(POPUPS_SITE_CONTENT_SECTION_ID);
|
|
626
842
|
});
|
|
627
843
|
};
|
|
628
|
-
return /* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
629
845
|
ContentPanelAddIconButton,
|
|
630
846
|
{
|
|
631
|
-
"aria-label":
|
|
847
|
+
"aria-label": __6("Add new", "elementor"),
|
|
632
848
|
...buttonProps,
|
|
633
849
|
disabled: !canAddAny
|
|
634
850
|
}
|
|
635
|
-
), /* @__PURE__ */
|
|
851
|
+
), /* @__PURE__ */ React7.createElement(Menu, { ...menuProps }, accessibleSlugs.map((slug) => /* @__PURE__ */ React7.createElement(HeaderAddMenuItem, { key: slug, onSelect: handleSelectType, slug })), /* @__PURE__ */ React7.createElement(PopupHeaderCreateMenuItem, { onSelect: handleSelectPopup }), headerCreateItems.map((item) => /* @__PURE__ */ React7.createElement(React7.Fragment, { key: item.id }, item.renderMenuItem(() => {
|
|
636
852
|
popupState.close();
|
|
637
853
|
requestAnimationFrame(() => {
|
|
638
854
|
requestCreate(item.id);
|
|
@@ -640,65 +856,67 @@ function ContentPanelHeaderAdd() {
|
|
|
640
856
|
})))));
|
|
641
857
|
}
|
|
642
858
|
|
|
643
|
-
// src/components/panel/content-panel-
|
|
644
|
-
import * as
|
|
859
|
+
// src/components/panel/content-panel-section-header-actions.tsx
|
|
860
|
+
import * as React13 from "react";
|
|
861
|
+
import { Stack as Stack3 } from "@elementor/ui";
|
|
862
|
+
|
|
863
|
+
// src/components/panel/content-panel-sort.tsx
|
|
864
|
+
import * as React10 from "react";
|
|
645
865
|
import { PopoverBody, PopoverHeader } from "@elementor/editor-ui";
|
|
646
|
-
import {
|
|
866
|
+
import { ArrowsSortIcon } from "@elementor/icons";
|
|
647
867
|
import { bindPopover, bindToggle, Divider, Popover, ToggleButton, Tooltip as Tooltip2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
648
|
-
import { __ as
|
|
868
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
649
869
|
|
|
650
870
|
// src/components/panel/content-panel-clear-filters-button.tsx
|
|
651
|
-
import * as
|
|
871
|
+
import * as React8 from "react";
|
|
652
872
|
import { BrushBigIcon } from "@elementor/icons";
|
|
653
873
|
import { Box as Box3, IconButton as IconButton2, Tooltip } from "@elementor/ui";
|
|
654
874
|
function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
|
|
655
|
-
return /* @__PURE__ */
|
|
875
|
+
return /* @__PURE__ */ React8.createElement(Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React8.createElement(Box3, null, /* @__PURE__ */ React8.createElement(IconButton2, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React8.createElement(BrushBigIcon, { fontSize: "tiny" }))));
|
|
656
876
|
}
|
|
657
877
|
|
|
658
|
-
// src/components/panel/content-panel-
|
|
659
|
-
import * as
|
|
878
|
+
// src/components/panel/content-panel-sort-list.tsx
|
|
879
|
+
import * as React9 from "react";
|
|
660
880
|
import { CheckIcon } from "@elementor/icons";
|
|
661
881
|
import { MenuItem as MenuItem3, MenuList, Stack, Typography } from "@elementor/ui";
|
|
662
|
-
var
|
|
663
|
-
function
|
|
664
|
-
const {
|
|
665
|
-
return /* @__PURE__ */
|
|
666
|
-
const
|
|
667
|
-
return /* @__PURE__ */
|
|
882
|
+
var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React9.createElement(Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React9.createElement(Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React9.createElement(CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
883
|
+
function ContentPanelSortList() {
|
|
884
|
+
const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
885
|
+
return /* @__PURE__ */ React9.createElement(MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
|
|
886
|
+
const isSelected = siteContentSort === option;
|
|
887
|
+
return /* @__PURE__ */ React9.createElement(
|
|
668
888
|
MenuItem3,
|
|
669
889
|
{
|
|
670
|
-
key:
|
|
671
|
-
|
|
672
|
-
onClick: () =>
|
|
673
|
-
|
|
890
|
+
key: option,
|
|
891
|
+
"aria-checked": isSelected,
|
|
892
|
+
onClick: () => setSiteContentSort(option),
|
|
893
|
+
role: "menuitemradio",
|
|
894
|
+
selected: isSelected
|
|
674
895
|
},
|
|
675
|
-
|
|
896
|
+
renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
|
|
676
897
|
);
|
|
677
898
|
}));
|
|
678
899
|
}
|
|
679
900
|
|
|
680
|
-
// src/components/panel/content-panel-
|
|
681
|
-
function
|
|
682
|
-
const {
|
|
901
|
+
// src/components/panel/content-panel-sort.tsx
|
|
902
|
+
function ContentPanelSort() {
|
|
903
|
+
const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
683
904
|
const popupState = usePopupState2({
|
|
684
905
|
variant: "popover",
|
|
685
906
|
disableAutoFocus: true
|
|
686
907
|
});
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
const filterLabel = __6("Content types", "elementor");
|
|
691
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Tooltip2, { placement: "top", title: filterLabel }, /* @__PURE__ */ React9.createElement(
|
|
908
|
+
const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
|
|
909
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Tooltip2, { placement: "top", title: __7("Sort", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
692
910
|
ToggleButton,
|
|
693
911
|
{
|
|
694
|
-
"aria-label":
|
|
695
|
-
selected: popupState.isOpen ||
|
|
912
|
+
"aria-label": __7("Sort", "elementor"),
|
|
913
|
+
selected: popupState.isOpen || hasActiveSort,
|
|
696
914
|
size: "tiny",
|
|
697
|
-
value: "
|
|
915
|
+
value: "sort",
|
|
698
916
|
...bindToggle(popupState)
|
|
699
917
|
},
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
)), /* @__PURE__ */
|
|
918
|
+
/* @__PURE__ */ React10.createElement(ArrowsSortIcon, { fontSize: "tiny" })
|
|
919
|
+
)), /* @__PURE__ */ React10.createElement(
|
|
702
920
|
Popover,
|
|
703
921
|
{
|
|
704
922
|
anchorOrigin: {
|
|
@@ -706,7 +924,7 @@ function ContentPanelSectionsFilter() {
|
|
|
706
924
|
vertical: "top"
|
|
707
925
|
},
|
|
708
926
|
sx: {
|
|
709
|
-
maxWidth: `${
|
|
927
|
+
maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
|
|
710
928
|
},
|
|
711
929
|
transformOrigin: {
|
|
712
930
|
horizontal: -21,
|
|
@@ -714,35 +932,213 @@ function ContentPanelSectionsFilter() {
|
|
|
714
932
|
},
|
|
715
933
|
...bindPopover(popupState)
|
|
716
934
|
},
|
|
717
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ React10.createElement(
|
|
718
936
|
PopoverHeader,
|
|
719
937
|
{
|
|
720
|
-
actions:
|
|
721
|
-
/* @__PURE__ */
|
|
938
|
+
actions: hasActiveSort ? [
|
|
939
|
+
/* @__PURE__ */ React10.createElement(
|
|
940
|
+
ContentPanelClearFiltersButton,
|
|
941
|
+
{
|
|
942
|
+
ariaLabel: __7("Clear sort", "elementor"),
|
|
943
|
+
key: "clear-sort",
|
|
944
|
+
onClear: clearSiteContentSort,
|
|
945
|
+
tooltipText: __7("Clear sort", "elementor")
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
] : [],
|
|
949
|
+
icon: /* @__PURE__ */ React10.createElement(ArrowsSortIcon, { fontSize: "tiny" }),
|
|
950
|
+
onClose: popupState.close,
|
|
951
|
+
title: __7("Sort", "elementor")
|
|
952
|
+
}
|
|
953
|
+
),
|
|
954
|
+
/* @__PURE__ */ React10.createElement(Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
955
|
+
/* @__PURE__ */ React10.createElement(PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React10.createElement(ContentPanelSortList, null))
|
|
956
|
+
));
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
960
|
+
import * as React12 from "react";
|
|
961
|
+
import { PopoverBody as PopoverBody2, PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
962
|
+
import { FilterIcon } from "@elementor/icons";
|
|
963
|
+
import { bindPopover as bindPopover2, bindToggle as bindToggle2, Divider as Divider2, Popover as Popover2, ToggleButton as ToggleButton2, Tooltip as Tooltip3, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
964
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
965
|
+
|
|
966
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
967
|
+
import * as React11 from "react";
|
|
968
|
+
import { CheckIcon as CheckIcon2 } from "@elementor/icons";
|
|
969
|
+
import { MenuItem as MenuItem4, MenuList as MenuList2, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
|
|
970
|
+
|
|
971
|
+
// src/hooks/use-site-content-status-filter-counts.ts
|
|
972
|
+
import { useQuery as useQuery2 } from "@elementor/query";
|
|
973
|
+
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
974
|
+
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
975
|
+
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
976
|
+
...siteContentStatusFilterCountsQueryKeyBase,
|
|
977
|
+
postTypes.join(",")
|
|
978
|
+
];
|
|
979
|
+
var sumFulfilledTotals = (results) => {
|
|
980
|
+
const fulfilled = results.filter(
|
|
981
|
+
(result) => "fulfilled" === result.status
|
|
982
|
+
);
|
|
983
|
+
if (fulfilled.length !== results.length) {
|
|
984
|
+
return void 0;
|
|
985
|
+
}
|
|
986
|
+
return fulfilled.reduce((sum, result) => sum + result.value, 0);
|
|
987
|
+
};
|
|
988
|
+
var fetchStatusFilterCounts = async (postTypes) => {
|
|
989
|
+
const entries = await Promise.all(
|
|
990
|
+
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
991
|
+
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
992
|
+
const total = sumFulfilledTotals(results);
|
|
993
|
+
if (void 0 === total) {
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
return [status, total];
|
|
997
|
+
})
|
|
998
|
+
);
|
|
999
|
+
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
1000
|
+
};
|
|
1001
|
+
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
1002
|
+
return useQuery2({
|
|
1003
|
+
enabled: enabled && postTypes.length > 0,
|
|
1004
|
+
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
1005
|
+
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
1006
|
+
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1011
|
+
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React11.createElement(Stack2, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React11.createElement(Typography2, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React11.createElement(CheckIcon2, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1012
|
+
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
1013
|
+
const {
|
|
1014
|
+
clearStatusFilters,
|
|
1015
|
+
statusFilterCountSlugs,
|
|
1016
|
+
statusFilterCounts: presetStatusCounts,
|
|
1017
|
+
statusFilterCountsPending,
|
|
1018
|
+
statusFilters,
|
|
1019
|
+
toggleStatusFilter
|
|
1020
|
+
} = useSiteContentSectionToolbar();
|
|
1021
|
+
const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
|
|
1022
|
+
const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
|
|
1023
|
+
statusFilterCountSlugs,
|
|
1024
|
+
shouldLoadPostTypeCounts
|
|
1025
|
+
);
|
|
1026
|
+
const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
|
|
1027
|
+
const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
|
|
1028
|
+
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
1029
|
+
const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
1030
|
+
(filter) => shouldShowSiteContentStatusFilterRow(
|
|
1031
|
+
statusCounts?.[filter],
|
|
1032
|
+
isLoadingCounts,
|
|
1033
|
+
statusFilters[filter]
|
|
1034
|
+
)
|
|
1035
|
+
);
|
|
1036
|
+
return /* @__PURE__ */ React11.createElement(MenuList2, { dense: true }, /* @__PURE__ */ React11.createElement(
|
|
1037
|
+
MenuItem4,
|
|
1038
|
+
{
|
|
1039
|
+
"aria-checked": isAllSelected,
|
|
1040
|
+
onClick: clearStatusFilters,
|
|
1041
|
+
role: "menuitemcheckbox",
|
|
1042
|
+
selected: isAllSelected
|
|
1043
|
+
},
|
|
1044
|
+
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
1045
|
+
), visibleFilters.map((filter) => {
|
|
1046
|
+
const isSelected = statusFilters[filter];
|
|
1047
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1048
|
+
MenuItem4,
|
|
1049
|
+
{
|
|
1050
|
+
key: filter,
|
|
1051
|
+
"aria-checked": isSelected,
|
|
1052
|
+
onClick: () => toggleStatusFilter(filter),
|
|
1053
|
+
role: "menuitemcheckbox",
|
|
1054
|
+
selected: isSelected
|
|
1055
|
+
},
|
|
1056
|
+
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
1057
|
+
);
|
|
1058
|
+
}));
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
1062
|
+
function ContentPanelStatusFilter() {
|
|
1063
|
+
const { clearStatusFilters, statusFilters } = useSiteContentSectionToolbar();
|
|
1064
|
+
const popupState = usePopupState3({
|
|
1065
|
+
variant: "popover",
|
|
1066
|
+
disableAutoFocus: true
|
|
1067
|
+
});
|
|
1068
|
+
const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
|
|
1069
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Tooltip3, { placement: "top", title: __8("Filters", "elementor") }, /* @__PURE__ */ React12.createElement(
|
|
1070
|
+
ToggleButton2,
|
|
1071
|
+
{
|
|
1072
|
+
"aria-label": __8("Filters", "elementor"),
|
|
1073
|
+
selected: popupState.isOpen || hasActiveFilters,
|
|
1074
|
+
size: "tiny",
|
|
1075
|
+
value: "filter",
|
|
1076
|
+
...bindToggle2(popupState)
|
|
1077
|
+
},
|
|
1078
|
+
/* @__PURE__ */ React12.createElement(FilterIcon, { fontSize: "tiny" })
|
|
1079
|
+
)), /* @__PURE__ */ React12.createElement(
|
|
1080
|
+
Popover2,
|
|
1081
|
+
{
|
|
1082
|
+
anchorOrigin: {
|
|
1083
|
+
horizontal: "right",
|
|
1084
|
+
vertical: "top"
|
|
1085
|
+
},
|
|
1086
|
+
sx: {
|
|
1087
|
+
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
1088
|
+
},
|
|
1089
|
+
transformOrigin: {
|
|
1090
|
+
horizontal: -21,
|
|
1091
|
+
vertical: "top"
|
|
1092
|
+
},
|
|
1093
|
+
...bindPopover2(popupState)
|
|
1094
|
+
},
|
|
1095
|
+
/* @__PURE__ */ React12.createElement(
|
|
1096
|
+
PopoverHeader2,
|
|
1097
|
+
{
|
|
1098
|
+
actions: hasActiveFilters ? [
|
|
1099
|
+
/* @__PURE__ */ React12.createElement(
|
|
722
1100
|
ContentPanelClearFiltersButton,
|
|
723
1101
|
{
|
|
724
|
-
ariaLabel:
|
|
725
|
-
key: "
|
|
726
|
-
onClear:
|
|
727
|
-
tooltipText:
|
|
1102
|
+
ariaLabel: __8("Clear all", "elementor"),
|
|
1103
|
+
key: "clear-all-filters",
|
|
1104
|
+
onClear: clearStatusFilters,
|
|
1105
|
+
tooltipText: __8("Clear all", "elementor")
|
|
728
1106
|
}
|
|
729
1107
|
)
|
|
730
1108
|
] : [],
|
|
731
|
-
icon: /* @__PURE__ */
|
|
1109
|
+
icon: /* @__PURE__ */ React12.createElement(FilterIcon, { fontSize: "tiny" }),
|
|
732
1110
|
onClose: popupState.close,
|
|
733
|
-
title:
|
|
1111
|
+
title: __8("Filters", "elementor")
|
|
734
1112
|
}
|
|
735
1113
|
),
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ React12.createElement(Divider2, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1115
|
+
/* @__PURE__ */ React12.createElement(PopoverBody2, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React12.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
738
1116
|
));
|
|
739
1117
|
}
|
|
740
1118
|
|
|
1119
|
+
// src/components/panel/content-panel-section-header-actions.tsx
|
|
1120
|
+
function ContentPanelSectionHeaderActions() {
|
|
1121
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1122
|
+
Stack3,
|
|
1123
|
+
{
|
|
1124
|
+
alignItems: "center",
|
|
1125
|
+
direction: "row",
|
|
1126
|
+
spacing: 0.5,
|
|
1127
|
+
sx: {
|
|
1128
|
+
flexShrink: 0,
|
|
1129
|
+
marginInlineStart: "auto"
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
/* @__PURE__ */ React13.createElement(ContentPanelStatusFilter, null),
|
|
1133
|
+
/* @__PURE__ */ React13.createElement(ContentPanelSort, null)
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
741
1137
|
// src/components/panel/error-snackbar.tsx
|
|
742
|
-
import * as
|
|
743
|
-
import { Alert, Snackbar, Typography as
|
|
1138
|
+
import * as React14 from "react";
|
|
1139
|
+
import { Alert, Snackbar, Typography as Typography3 } from "@elementor/ui";
|
|
744
1140
|
var ErrorSnackbar = ({ open, onClose }) => {
|
|
745
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ React14.createElement(
|
|
746
1142
|
Snackbar,
|
|
747
1143
|
{
|
|
748
1144
|
open,
|
|
@@ -752,8 +1148,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
752
1148
|
horizontal: "left"
|
|
753
1149
|
}
|
|
754
1150
|
},
|
|
755
|
-
/* @__PURE__ */
|
|
756
|
-
|
|
1151
|
+
/* @__PURE__ */ React14.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React14.createElement(
|
|
1152
|
+
Typography3,
|
|
757
1153
|
{
|
|
758
1154
|
component: "span",
|
|
759
1155
|
sx: {
|
|
@@ -767,227 +1163,17 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
767
1163
|
var error_snackbar_default = ErrorSnackbar;
|
|
768
1164
|
|
|
769
1165
|
// src/components/panel/shell-panel-body-content.tsx
|
|
770
|
-
import * as
|
|
771
|
-
import {
|
|
772
|
-
|
|
773
|
-
// src/contexts/post-list-context.tsx
|
|
774
|
-
import * as React11 from "react";
|
|
775
|
-
import { createContext as createContext3, useContext as useContext3, useState as useState3 } from "react";
|
|
776
|
-
var defaultValues = {
|
|
777
|
-
type: "page",
|
|
778
|
-
editMode: { mode: "none", details: {} },
|
|
779
|
-
setEditMode: () => null,
|
|
780
|
-
resetEditMode: () => null,
|
|
781
|
-
setError: () => null
|
|
782
|
-
};
|
|
783
|
-
var PostListContext = createContext3(defaultValues);
|
|
784
|
-
var PostListContextProvider = ({
|
|
785
|
-
type,
|
|
786
|
-
setError,
|
|
787
|
-
children
|
|
788
|
-
}) => {
|
|
789
|
-
const [editMode, setEditMode] = useState3(defaultValues.editMode);
|
|
790
|
-
const resetEditMode = () => {
|
|
791
|
-
setEditMode(defaultValues.editMode);
|
|
792
|
-
};
|
|
793
|
-
return /* @__PURE__ */ React11.createElement(
|
|
794
|
-
PostListContext.Provider,
|
|
795
|
-
{
|
|
796
|
-
value: {
|
|
797
|
-
type,
|
|
798
|
-
editMode,
|
|
799
|
-
setEditMode,
|
|
800
|
-
resetEditMode,
|
|
801
|
-
setError
|
|
802
|
-
}
|
|
803
|
-
},
|
|
804
|
-
children
|
|
805
|
-
);
|
|
806
|
-
};
|
|
807
|
-
function usePostListContext() {
|
|
808
|
-
const context = useContext3(PostListContext);
|
|
809
|
-
if (!context) {
|
|
810
|
-
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
811
|
-
}
|
|
812
|
-
return context;
|
|
813
|
-
}
|
|
1166
|
+
import * as React40 from "react";
|
|
1167
|
+
import { Box as Box14, Skeleton as Skeleton3, Stack as Stack10 } from "@elementor/ui";
|
|
814
1168
|
|
|
815
1169
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
816
|
-
import * as
|
|
817
|
-
import { useEffect as useEffect4, useMemo as
|
|
818
|
-
import { Box as Box11, Skeleton, Typography as
|
|
819
|
-
import { __ as
|
|
820
|
-
|
|
821
|
-
// src/contexts/site-content-section-toolbar.tsx
|
|
822
|
-
import * as React12 from "react";
|
|
823
|
-
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo4 } from "react";
|
|
1170
|
+
import * as React37 from "react";
|
|
1171
|
+
import { useEffect as useEffect4, useMemo as useMemo5, useRef as useRef5, useState as useState9 } from "react";
|
|
1172
|
+
import { Box as Box11, Skeleton, Typography as Typography7 } from "@elementor/ui";
|
|
1173
|
+
import { __ as __26, sprintf as sprintf5 } from "@wordpress/i18n";
|
|
824
1174
|
|
|
825
|
-
// src/hooks/use-
|
|
826
|
-
import {
|
|
827
|
-
|
|
828
|
-
// src/site-content-status-filter.ts
|
|
829
|
-
import { __ as __7 } from "@wordpress/i18n";
|
|
830
|
-
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
831
|
-
"publish",
|
|
832
|
-
"draft",
|
|
833
|
-
"pending",
|
|
834
|
-
"private",
|
|
835
|
-
"future",
|
|
836
|
-
"trash"
|
|
837
|
-
];
|
|
838
|
-
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
839
|
-
draft: false,
|
|
840
|
-
future: false,
|
|
841
|
-
pending: false,
|
|
842
|
-
private: false,
|
|
843
|
-
publish: false,
|
|
844
|
-
trash: false
|
|
845
|
-
};
|
|
846
|
-
var filterLabels = {
|
|
847
|
-
publish: __7("Published", "elementor"),
|
|
848
|
-
draft: __7("Drafts", "elementor"),
|
|
849
|
-
pending: __7("Pending", "elementor"),
|
|
850
|
-
private: __7("Private", "elementor"),
|
|
851
|
-
future: __7("Scheduled", "elementor"),
|
|
852
|
-
trash: __7("Trash", "elementor")
|
|
853
|
-
};
|
|
854
|
-
var SITE_CONTENT_ALL_FILTER_LABEL = __7("All", "elementor");
|
|
855
|
-
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
856
|
-
function getSiteContentStatusFilterLabel(filter) {
|
|
857
|
-
return filterLabels[filter];
|
|
858
|
-
}
|
|
859
|
-
function hasActiveSiteContentStatusFilters(filters) {
|
|
860
|
-
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
861
|
-
}
|
|
862
|
-
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
863
|
-
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
864
|
-
}
|
|
865
|
-
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
866
|
-
function getRestStatusForSiteContentFilters(filters) {
|
|
867
|
-
if (filters.trash) {
|
|
868
|
-
return "trash";
|
|
869
|
-
}
|
|
870
|
-
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
871
|
-
if (0 === active.length) {
|
|
872
|
-
return "any";
|
|
873
|
-
}
|
|
874
|
-
return active.join(",");
|
|
875
|
-
}
|
|
876
|
-
function isSiteContentTrashFilterActive(filters) {
|
|
877
|
-
return filters.trash;
|
|
878
|
-
}
|
|
879
|
-
function isSiteContentListNarrowed(filters, search) {
|
|
880
|
-
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
881
|
-
}
|
|
882
|
-
function toggleSiteContentStatusFilter(filters, filter) {
|
|
883
|
-
if ("trash" === filter) {
|
|
884
|
-
const isTrashOn = !filters.trash;
|
|
885
|
-
return {
|
|
886
|
-
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
887
|
-
trash: isTrashOn
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
return {
|
|
891
|
-
...filters,
|
|
892
|
-
trash: false,
|
|
893
|
-
[filter]: !filters[filter]
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
function getSiteContentStatusFilterForCount(status) {
|
|
897
|
-
if ("trash" === status) {
|
|
898
|
-
return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
902
|
-
[status]: true
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
906
|
-
if (isSelected) {
|
|
907
|
-
return true;
|
|
908
|
-
}
|
|
909
|
-
if (isLoadingCounts || void 0 === count) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
return count > 0;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
// src/hooks/use-site-content-section-list-controls.ts
|
|
916
|
-
var SEARCH_DEBOUNCE_MS = 300;
|
|
917
|
-
function useSiteContentSectionListControls() {
|
|
918
|
-
const [searchQuery, setSearchQuery] = useState4("");
|
|
919
|
-
const [debouncedSearch, setDebouncedSearch] = useState4("");
|
|
920
|
-
const [siteContentSort, setSiteContentSortState] = useState4(DEFAULT_SITE_CONTENT_SORT);
|
|
921
|
-
const [statusFilters, setStatusFilters] = useState4(
|
|
922
|
-
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
923
|
-
);
|
|
924
|
-
const trimmedSearch = searchQuery.trim();
|
|
925
|
-
useEffect2(() => {
|
|
926
|
-
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
927
|
-
return () => window.clearTimeout(handle);
|
|
928
|
-
}, [trimmedSearch]);
|
|
929
|
-
const clearActiveToolbarFilters = useCallback4(() => {
|
|
930
|
-
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
931
|
-
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
932
|
-
}, []);
|
|
933
|
-
const clearSiteContentSort = useCallback4(() => {
|
|
934
|
-
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
935
|
-
}, []);
|
|
936
|
-
const clearStatusFilters = useCallback4(() => {
|
|
937
|
-
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
938
|
-
}, []);
|
|
939
|
-
const setSiteContentSort = useCallback4((sort) => {
|
|
940
|
-
setSiteContentSortState(sort);
|
|
941
|
-
}, []);
|
|
942
|
-
const toggleStatusFilter = useCallback4((filter) => {
|
|
943
|
-
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
944
|
-
}, []);
|
|
945
|
-
return {
|
|
946
|
-
clearActiveToolbarFilters,
|
|
947
|
-
clearSiteContentSort,
|
|
948
|
-
clearStatusFilters,
|
|
949
|
-
debouncedSearch,
|
|
950
|
-
searchQuery,
|
|
951
|
-
setSearchQuery,
|
|
952
|
-
setSiteContentSort,
|
|
953
|
-
siteContentSort,
|
|
954
|
-
statusFilters,
|
|
955
|
-
toggleStatusFilter
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
// src/contexts/site-content-section-toolbar.tsx
|
|
960
|
-
var SiteContentSectionToolbarContext = createContext4(null);
|
|
961
|
-
function SiteContentSectionToolbarProvider({
|
|
962
|
-
children,
|
|
963
|
-
statusFilterCountSlugs = [],
|
|
964
|
-
statusFilterCounts,
|
|
965
|
-
statusFilterCountsPending = false
|
|
966
|
-
}) {
|
|
967
|
-
const controls = useSiteContentSectionListControls();
|
|
968
|
-
const value = useMemo4(
|
|
969
|
-
() => ({
|
|
970
|
-
...controls,
|
|
971
|
-
statusFilterCountSlugs,
|
|
972
|
-
statusFilterCounts,
|
|
973
|
-
statusFilterCountsPending
|
|
974
|
-
}),
|
|
975
|
-
[controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
|
|
976
|
-
);
|
|
977
|
-
return /* @__PURE__ */ React12.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
|
|
978
|
-
}
|
|
979
|
-
function useSiteContentSectionToolbar() {
|
|
980
|
-
const context = useContext4(SiteContentSectionToolbarContext);
|
|
981
|
-
if (!context) {
|
|
982
|
-
throw new Error(
|
|
983
|
-
"The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
|
|
984
|
-
);
|
|
985
|
-
}
|
|
986
|
-
return context;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
// src/hooks/use-homepage.ts
|
|
990
|
-
import { useQuery as useQuery2 } from "@elementor/query";
|
|
1175
|
+
// src/hooks/use-homepage.ts
|
|
1176
|
+
import { useQuery as useQuery3 } from "@elementor/query";
|
|
991
1177
|
|
|
992
1178
|
// src/api/settings.ts
|
|
993
1179
|
import apiFetch3 from "@wordpress/api-fetch";
|
|
@@ -1007,14 +1193,14 @@ var updateSettings = (settings) => {
|
|
|
1007
1193
|
// src/hooks/use-homepage.ts
|
|
1008
1194
|
var settingsQueryKey = () => ["site-navigation", "homepage"];
|
|
1009
1195
|
function useHomepage() {
|
|
1010
|
-
return
|
|
1196
|
+
return useQuery3({
|
|
1011
1197
|
queryKey: settingsQueryKey(),
|
|
1012
1198
|
queryFn: () => getSettings()
|
|
1013
1199
|
});
|
|
1014
1200
|
}
|
|
1015
1201
|
|
|
1016
1202
|
// src/hooks/use-post-list-pagination.ts
|
|
1017
|
-
import { useCallback as
|
|
1203
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
|
|
1018
1204
|
function usePostListPagination({
|
|
1019
1205
|
fetchNextPage,
|
|
1020
1206
|
hasNextPage,
|
|
@@ -1023,7 +1209,7 @@ function usePostListPagination({
|
|
|
1023
1209
|
resetKey,
|
|
1024
1210
|
totalCount
|
|
1025
1211
|
}) {
|
|
1026
|
-
const [visibleCount, setVisibleCount] =
|
|
1212
|
+
const [visibleCount, setVisibleCount] = useState4(POST_PER_PAGE);
|
|
1027
1213
|
const pendingVisibleTargetRef = useRef3(null);
|
|
1028
1214
|
useEffect3(() => {
|
|
1029
1215
|
setVisibleCount(POST_PER_PAGE);
|
|
@@ -1046,7 +1232,7 @@ function usePostListPagination({
|
|
|
1046
1232
|
}, [isFetchingNextPage, loadedCount]);
|
|
1047
1233
|
const canShowLess = visibleCount > POST_PER_PAGE;
|
|
1048
1234
|
const canLoadMore = visibleCount < loadedCount || hasNextPage;
|
|
1049
|
-
const handleLoadMore =
|
|
1235
|
+
const handleLoadMore = useCallback4(() => {
|
|
1050
1236
|
if (isFetchingNextPage || !canLoadMore) {
|
|
1051
1237
|
return;
|
|
1052
1238
|
}
|
|
@@ -1064,7 +1250,7 @@ function usePostListPagination({
|
|
|
1064
1250
|
setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
|
|
1065
1251
|
}
|
|
1066
1252
|
}, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
|
|
1067
|
-
const handleShowLess =
|
|
1253
|
+
const handleShowLess = useCallback4(() => {
|
|
1068
1254
|
pendingVisibleTargetRef.current = null;
|
|
1069
1255
|
setVisibleCount(POST_PER_PAGE);
|
|
1070
1256
|
}, []);
|
|
@@ -1114,7 +1300,7 @@ function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_
|
|
|
1114
1300
|
}
|
|
1115
1301
|
|
|
1116
1302
|
// src/hooks/use-posts-baseline-total.ts
|
|
1117
|
-
import { useQuery as
|
|
1303
|
+
import { useQuery as useQuery4 } from "@elementor/query";
|
|
1118
1304
|
var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
|
|
1119
1305
|
"site-navigation",
|
|
1120
1306
|
"posts-baseline-total",
|
|
@@ -1125,7 +1311,7 @@ var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
|
|
|
1125
1311
|
status
|
|
1126
1312
|
];
|
|
1127
1313
|
function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
1128
|
-
return
|
|
1314
|
+
return useQuery4({
|
|
1129
1315
|
enabled,
|
|
1130
1316
|
queryFn: () => fetchPostsTotal(postTypeSlug, status),
|
|
1131
1317
|
queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
|
|
@@ -1133,13 +1319,13 @@ function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
|
1133
1319
|
}
|
|
1134
1320
|
|
|
1135
1321
|
// src/components/panel/content-panel-section-toolbar.tsx
|
|
1136
|
-
import * as
|
|
1137
|
-
import { Box as Box5, Stack as Stack5 } from "@elementor/ui";
|
|
1322
|
+
import * as React17 from "react";
|
|
1323
|
+
import { Box as Box5, Divider as Divider3, Stack as Stack5 } from "@elementor/ui";
|
|
1138
1324
|
|
|
1139
1325
|
// src/components/panel/content-panel-active-filters.tsx
|
|
1140
|
-
import * as
|
|
1141
|
-
import { Chip, Stack as
|
|
1142
|
-
import { __ as
|
|
1326
|
+
import * as React15 from "react";
|
|
1327
|
+
import { Chip, Stack as Stack4 } from "@elementor/ui";
|
|
1328
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
1143
1329
|
var contentPanelFilterChipSx = {
|
|
1144
1330
|
"& .MuiChip-deleteIcon": {
|
|
1145
1331
|
display: "none",
|
|
@@ -1157,7 +1343,7 @@ function ContentPanelActiveFilters() {
|
|
|
1157
1343
|
return null;
|
|
1158
1344
|
}
|
|
1159
1345
|
const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
|
|
1160
|
-
return /* @__PURE__ */
|
|
1346
|
+
return /* @__PURE__ */ React15.createElement(Stack4, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React15.createElement(Stack4, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React15.createElement(
|
|
1161
1347
|
Chip,
|
|
1162
1348
|
{
|
|
1163
1349
|
label: getSiteContentSortLabel(siteContentSort),
|
|
@@ -1165,318 +1351,84 @@ function ContentPanelActiveFilters() {
|
|
|
1165
1351
|
size: "tiny",
|
|
1166
1352
|
sx: contentPanelFilterChipSx
|
|
1167
1353
|
}
|
|
1168
|
-
), activeKeys.map((key) => /* @__PURE__ */
|
|
1354
|
+
), activeKeys.map((key) => /* @__PURE__ */ React15.createElement(
|
|
1169
1355
|
Chip,
|
|
1170
1356
|
{
|
|
1171
1357
|
key,
|
|
1172
1358
|
label: getSiteContentStatusFilterLabel(key),
|
|
1173
1359
|
onDelete: () => toggleStatusFilter(key),
|
|
1174
|
-
size: "tiny",
|
|
1175
|
-
sx: contentPanelFilterChipSx
|
|
1176
|
-
}
|
|
1177
|
-
))), /* @__PURE__ */
|
|
1178
|
-
ContentPanelClearFiltersButton,
|
|
1179
|
-
{
|
|
1180
|
-
ariaLabel:
|
|
1181
|
-
onClear: clearActiveToolbarFilters,
|
|
1182
|
-
sx: { margin: "0 0 auto auto" },
|
|
1183
|
-
tooltipText:
|
|
1184
|
-
}
|
|
1185
|
-
));
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
// src/components/panel/content-panel-search.tsx
|
|
1189
|
-
import * as React14 from "react";
|
|
1190
|
-
import { SearchIcon } from "@elementor/icons";
|
|
1191
|
-
import { Box as Box4, InputAdornment, TextField } from "@elementor/ui";
|
|
1192
|
-
import { __ as __9 } from "@wordpress/i18n";
|
|
1193
|
-
function ContentPanelSearch({ searchAriaLabel }) {
|
|
1194
|
-
const { searchQuery, setSearchQuery } = useSiteContentSectionToolbar();
|
|
1195
|
-
const ariaLabel = searchAriaLabel ?? __9("Search site content", "elementor");
|
|
1196
|
-
return /* @__PURE__ */ React14.createElement(Box4, { component: "search", "aria-label": ariaLabel }, /* @__PURE__ */ React14.createElement(
|
|
1197
|
-
TextField,
|
|
1198
|
-
{
|
|
1199
|
-
fullWidth: true,
|
|
1200
|
-
size: "tiny",
|
|
1201
|
-
value: searchQuery,
|
|
1202
|
-
placeholder: __9("Search", "elementor"),
|
|
1203
|
-
onChange: (event) => setSearchQuery(event.target.value),
|
|
1204
|
-
inputProps: {
|
|
1205
|
-
"aria-label": __9("Search", "elementor")
|
|
1206
|
-
},
|
|
1207
|
-
InputProps: {
|
|
1208
|
-
startAdornment: /* @__PURE__ */ React14.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React14.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
));
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
// src/components/panel/content-panel-sort.tsx
|
|
1215
|
-
import * as React16 from "react";
|
|
1216
|
-
import { PopoverBody as PopoverBody2, PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
1217
|
-
import { ArrowsSortIcon } from "@elementor/icons";
|
|
1218
|
-
import { bindPopover as bindPopover2, bindToggle as bindToggle2, Divider as Divider2, Popover as Popover2, ToggleButton as ToggleButton2, Tooltip as Tooltip3, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1219
|
-
import { __ as __10 } from "@wordpress/i18n";
|
|
1220
|
-
|
|
1221
|
-
// src/components/panel/content-panel-sort-list.tsx
|
|
1222
|
-
import * as React15 from "react";
|
|
1223
|
-
import { CheckIcon as CheckIcon2 } from "@elementor/icons";
|
|
1224
|
-
import { MenuItem as MenuItem4, MenuList as MenuList2, Stack as Stack3, Typography as Typography3 } from "@elementor/ui";
|
|
1225
|
-
var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React15.createElement(Stack3, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React15.createElement(Typography3, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React15.createElement(CheckIcon2, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1226
|
-
function ContentPanelSortList() {
|
|
1227
|
-
const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
1228
|
-
return /* @__PURE__ */ React15.createElement(MenuList2, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
|
|
1229
|
-
const isSelected = siteContentSort === option;
|
|
1230
|
-
return /* @__PURE__ */ React15.createElement(
|
|
1231
|
-
MenuItem4,
|
|
1232
|
-
{
|
|
1233
|
-
key: option,
|
|
1234
|
-
"aria-checked": isSelected,
|
|
1235
|
-
onClick: () => setSiteContentSort(option),
|
|
1236
|
-
role: "menuitemradio",
|
|
1237
|
-
selected: isSelected
|
|
1238
|
-
},
|
|
1239
|
-
renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
|
|
1240
|
-
);
|
|
1241
|
-
}));
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// src/components/panel/content-panel-sort.tsx
|
|
1245
|
-
function ContentPanelSort() {
|
|
1246
|
-
const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
1247
|
-
const popupState = usePopupState3({
|
|
1248
|
-
variant: "popover",
|
|
1249
|
-
disableAutoFocus: true
|
|
1250
|
-
});
|
|
1251
|
-
const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
|
|
1252
|
-
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Tooltip3, { placement: "top", title: __10("Sort", "elementor") }, /* @__PURE__ */ React16.createElement(
|
|
1253
|
-
ToggleButton2,
|
|
1254
|
-
{
|
|
1255
|
-
"aria-label": __10("Sort", "elementor"),
|
|
1256
|
-
selected: popupState.isOpen || hasActiveSort,
|
|
1257
|
-
size: "tiny",
|
|
1258
|
-
value: "sort",
|
|
1259
|
-
...bindToggle2(popupState)
|
|
1260
|
-
},
|
|
1261
|
-
/* @__PURE__ */ React16.createElement(ArrowsSortIcon, { fontSize: "tiny" })
|
|
1262
|
-
)), /* @__PURE__ */ React16.createElement(
|
|
1263
|
-
Popover2,
|
|
1264
|
-
{
|
|
1265
|
-
anchorOrigin: {
|
|
1266
|
-
horizontal: "right",
|
|
1267
|
-
vertical: "top"
|
|
1268
|
-
},
|
|
1269
|
-
sx: {
|
|
1270
|
-
maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
|
|
1271
|
-
},
|
|
1272
|
-
transformOrigin: {
|
|
1273
|
-
horizontal: -21,
|
|
1274
|
-
vertical: "top"
|
|
1275
|
-
},
|
|
1276
|
-
...bindPopover2(popupState)
|
|
1277
|
-
},
|
|
1278
|
-
/* @__PURE__ */ React16.createElement(
|
|
1279
|
-
PopoverHeader2,
|
|
1280
|
-
{
|
|
1281
|
-
actions: hasActiveSort ? [
|
|
1282
|
-
/* @__PURE__ */ React16.createElement(
|
|
1283
|
-
ContentPanelClearFiltersButton,
|
|
1284
|
-
{
|
|
1285
|
-
ariaLabel: __10("Clear sort", "elementor"),
|
|
1286
|
-
key: "clear-sort",
|
|
1287
|
-
onClear: clearSiteContentSort,
|
|
1288
|
-
tooltipText: __10("Clear sort", "elementor")
|
|
1289
|
-
}
|
|
1290
|
-
)
|
|
1291
|
-
] : [],
|
|
1292
|
-
icon: /* @__PURE__ */ React16.createElement(ArrowsSortIcon, { fontSize: "tiny" }),
|
|
1293
|
-
onClose: popupState.close,
|
|
1294
|
-
title: __10("Sort", "elementor")
|
|
1295
|
-
}
|
|
1296
|
-
),
|
|
1297
|
-
/* @__PURE__ */ React16.createElement(Divider2, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1298
|
-
/* @__PURE__ */ React16.createElement(PopoverBody2, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React16.createElement(ContentPanelSortList, null))
|
|
1299
|
-
));
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
// src/components/panel/content-panel-status-filter.tsx
|
|
1303
|
-
import * as React18 from "react";
|
|
1304
|
-
import { PopoverBody as PopoverBody3, PopoverHeader as PopoverHeader3 } from "@elementor/editor-ui";
|
|
1305
|
-
import { FilterIcon as FilterIcon2 } from "@elementor/icons";
|
|
1306
|
-
import { bindPopover as bindPopover3, bindToggle as bindToggle3, Divider as Divider3, Popover as Popover3, ToggleButton as ToggleButton3, Tooltip as Tooltip4, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
1307
|
-
import { __ as __11 } from "@wordpress/i18n";
|
|
1308
|
-
|
|
1309
|
-
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1310
|
-
import * as React17 from "react";
|
|
1311
|
-
import { CheckIcon as CheckIcon3 } from "@elementor/icons";
|
|
1312
|
-
import { MenuItem as MenuItem5, MenuList as MenuList3, Stack as Stack4, Typography as Typography4 } from "@elementor/ui";
|
|
1313
|
-
|
|
1314
|
-
// src/hooks/use-site-content-status-filter-counts.ts
|
|
1315
|
-
import { useQuery as useQuery4 } from "@elementor/query";
|
|
1316
|
-
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
1317
|
-
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
1318
|
-
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
1319
|
-
...siteContentStatusFilterCountsQueryKeyBase,
|
|
1320
|
-
postTypes.join(",")
|
|
1321
|
-
];
|
|
1322
|
-
var sumFulfilledTotals = (results) => {
|
|
1323
|
-
const fulfilled = results.filter(
|
|
1324
|
-
(result) => "fulfilled" === result.status
|
|
1325
|
-
);
|
|
1326
|
-
if (fulfilled.length !== results.length) {
|
|
1327
|
-
return void 0;
|
|
1328
|
-
}
|
|
1329
|
-
return fulfilled.reduce((sum, result) => sum + result.value, 0);
|
|
1330
|
-
};
|
|
1331
|
-
var fetchStatusFilterCounts = async (postTypes) => {
|
|
1332
|
-
const entries = await Promise.all(
|
|
1333
|
-
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
1334
|
-
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
1335
|
-
const total = sumFulfilledTotals(results);
|
|
1336
|
-
if (void 0 === total) {
|
|
1337
|
-
return null;
|
|
1338
|
-
}
|
|
1339
|
-
return [status, total];
|
|
1340
|
-
})
|
|
1341
|
-
);
|
|
1342
|
-
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
1343
|
-
};
|
|
1344
|
-
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
1345
|
-
return useQuery4({
|
|
1346
|
-
enabled: enabled && postTypes.length > 0,
|
|
1347
|
-
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
1348
|
-
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
1349
|
-
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1354
|
-
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React17.createElement(Stack4, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React17.createElement(Typography4, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React17.createElement(CheckIcon3, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1355
|
-
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
1356
|
-
const {
|
|
1357
|
-
clearStatusFilters,
|
|
1358
|
-
statusFilterCountSlugs,
|
|
1359
|
-
statusFilterCounts: presetStatusCounts,
|
|
1360
|
-
statusFilterCountsPending,
|
|
1361
|
-
statusFilters,
|
|
1362
|
-
toggleStatusFilter
|
|
1363
|
-
} = useSiteContentSectionToolbar();
|
|
1364
|
-
const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
|
|
1365
|
-
const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
|
|
1366
|
-
statusFilterCountSlugs,
|
|
1367
|
-
shouldLoadPostTypeCounts
|
|
1368
|
-
);
|
|
1369
|
-
const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
|
|
1370
|
-
const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
|
|
1371
|
-
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
1372
|
-
const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
1373
|
-
(filter) => shouldShowSiteContentStatusFilterRow(
|
|
1374
|
-
statusCounts?.[filter],
|
|
1375
|
-
isLoadingCounts,
|
|
1376
|
-
statusFilters[filter]
|
|
1377
|
-
)
|
|
1378
|
-
);
|
|
1379
|
-
return /* @__PURE__ */ React17.createElement(MenuList3, { dense: true }, /* @__PURE__ */ React17.createElement(
|
|
1380
|
-
MenuItem5,
|
|
1381
|
-
{
|
|
1382
|
-
"aria-checked": isAllSelected,
|
|
1383
|
-
onClick: clearStatusFilters,
|
|
1384
|
-
role: "menuitemcheckbox",
|
|
1385
|
-
selected: isAllSelected
|
|
1386
|
-
},
|
|
1387
|
-
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
1388
|
-
), visibleFilters.map((filter) => {
|
|
1389
|
-
const isSelected = statusFilters[filter];
|
|
1390
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1391
|
-
MenuItem5,
|
|
1392
|
-
{
|
|
1393
|
-
key: filter,
|
|
1394
|
-
"aria-checked": isSelected,
|
|
1395
|
-
onClick: () => toggleStatusFilter(filter),
|
|
1396
|
-
role: "menuitemcheckbox",
|
|
1397
|
-
selected: isSelected
|
|
1398
|
-
},
|
|
1399
|
-
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
1400
|
-
);
|
|
1401
|
-
}));
|
|
1360
|
+
size: "tiny",
|
|
1361
|
+
sx: contentPanelFilterChipSx
|
|
1362
|
+
}
|
|
1363
|
+
))), /* @__PURE__ */ React15.createElement(
|
|
1364
|
+
ContentPanelClearFiltersButton,
|
|
1365
|
+
{
|
|
1366
|
+
ariaLabel: __9("Clear Filters", "elementor"),
|
|
1367
|
+
onClear: clearActiveToolbarFilters,
|
|
1368
|
+
sx: { margin: "0 0 auto auto" },
|
|
1369
|
+
tooltipText: __9("Clear Filters", "elementor")
|
|
1370
|
+
}
|
|
1371
|
+
));
|
|
1402
1372
|
}
|
|
1403
1373
|
|
|
1404
|
-
// src/components/panel/content-panel-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
});
|
|
1411
|
-
const
|
|
1412
|
-
return /* @__PURE__ */
|
|
1413
|
-
|
|
1374
|
+
// src/components/panel/content-panel-search.tsx
|
|
1375
|
+
import * as React16 from "react";
|
|
1376
|
+
import { SearchIcon } from "@elementor/icons";
|
|
1377
|
+
import { Box as Box4, InputAdornment, TextField } from "@elementor/ui";
|
|
1378
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
1379
|
+
function ContentPanelSearch({ searchAriaLabel }) {
|
|
1380
|
+
const { searchQuery, setSearchQuery } = useSiteContentSectionToolbar();
|
|
1381
|
+
const ariaLabel = searchAriaLabel ?? __10("Search site content", "elementor");
|
|
1382
|
+
return /* @__PURE__ */ React16.createElement(Box4, { component: "search", "aria-label": ariaLabel }, /* @__PURE__ */ React16.createElement(
|
|
1383
|
+
TextField,
|
|
1414
1384
|
{
|
|
1415
|
-
|
|
1416
|
-
selected: popupState.isOpen || hasActiveFilters,
|
|
1385
|
+
fullWidth: true,
|
|
1417
1386
|
size: "tiny",
|
|
1418
|
-
value:
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
Popover3,
|
|
1424
|
-
{
|
|
1425
|
-
anchorOrigin: {
|
|
1426
|
-
horizontal: "right",
|
|
1427
|
-
vertical: "top"
|
|
1428
|
-
},
|
|
1429
|
-
sx: {
|
|
1430
|
-
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
1431
|
-
},
|
|
1432
|
-
transformOrigin: {
|
|
1433
|
-
horizontal: -21,
|
|
1434
|
-
vertical: "top"
|
|
1387
|
+
value: searchQuery,
|
|
1388
|
+
placeholder: __10("Search", "elementor"),
|
|
1389
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1390
|
+
inputProps: {
|
|
1391
|
+
"aria-label": __10("Search", "elementor")
|
|
1435
1392
|
},
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
/* @__PURE__ */ React18.createElement(
|
|
1439
|
-
PopoverHeader3,
|
|
1440
|
-
{
|
|
1441
|
-
actions: hasActiveFilters ? [
|
|
1442
|
-
/* @__PURE__ */ React18.createElement(
|
|
1443
|
-
ContentPanelClearFiltersButton,
|
|
1444
|
-
{
|
|
1445
|
-
ariaLabel: __11("Clear all", "elementor"),
|
|
1446
|
-
key: "clear-all-filters",
|
|
1447
|
-
onClear: clearStatusFilters,
|
|
1448
|
-
tooltipText: __11("Clear all", "elementor")
|
|
1449
|
-
}
|
|
1450
|
-
)
|
|
1451
|
-
] : [],
|
|
1452
|
-
icon: /* @__PURE__ */ React18.createElement(FilterIcon2, { fontSize: "tiny" }),
|
|
1453
|
-
onClose: popupState.close,
|
|
1454
|
-
title: __11("Filters", "elementor")
|
|
1393
|
+
InputProps: {
|
|
1394
|
+
startAdornment: /* @__PURE__ */ React16.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React16.createElement(SearchIcon, { fontSize: "tiny" }))
|
|
1455
1395
|
}
|
|
1456
|
-
|
|
1457
|
-
/* @__PURE__ */ React18.createElement(Divider3, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1458
|
-
/* @__PURE__ */ React18.createElement(PopoverBody3, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React18.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
1396
|
+
}
|
|
1459
1397
|
));
|
|
1460
1398
|
}
|
|
1461
1399
|
|
|
1462
1400
|
// src/components/panel/content-panel-section-toolbar.tsx
|
|
1463
|
-
function ContentPanelSectionToolbar({ addAction, searchAriaLabel }) {
|
|
1464
|
-
|
|
1401
|
+
function ContentPanelSectionToolbar({ addAction, actionsInHeader, searchAriaLabel }) {
|
|
1402
|
+
if (actionsInHeader) {
|
|
1403
|
+
return /* @__PURE__ */ React17.createElement(Box5, { sx: { display: "flex", flexDirection: "column", flexShrink: 0, width: "100%" } }, /* @__PURE__ */ React17.createElement(
|
|
1404
|
+
Stack5,
|
|
1405
|
+
{
|
|
1406
|
+
alignItems: "center",
|
|
1407
|
+
direction: "row",
|
|
1408
|
+
spacing: 1,
|
|
1409
|
+
width: "100%",
|
|
1410
|
+
sx: contentPanelFlatSectionToolbarRowSx
|
|
1411
|
+
},
|
|
1412
|
+
/* @__PURE__ */ React17.createElement(Box5, { sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React17.createElement(ContentPanelSearch, { searchAriaLabel })),
|
|
1413
|
+
addAction ? /* @__PURE__ */ React17.createElement(Box5, { sx: { alignItems: "center", display: "flex", flexShrink: 0 } }, addAction) : null
|
|
1414
|
+
), /* @__PURE__ */ React17.createElement(Box5, { sx: { px: 2, pb: 0.75 } }, /* @__PURE__ */ React17.createElement(ContentPanelActiveFilters, null)), /* @__PURE__ */ React17.createElement(Divider3, { sx: { ...contentPanelFullBleedDividerSx, width: "100%" } }));
|
|
1415
|
+
}
|
|
1416
|
+
return /* @__PURE__ */ React17.createElement(Box5, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React17.createElement(Stack5, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React17.createElement(Stack5, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React17.createElement(Box5, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React17.createElement(ContentPanelSearch, { searchAriaLabel })), /* @__PURE__ */ React17.createElement(ContentPanelStatusFilter, null), /* @__PURE__ */ React17.createElement(ContentPanelSort, null), addAction), /* @__PURE__ */ React17.createElement(ContentPanelActiveFilters, null)));
|
|
1465
1417
|
}
|
|
1466
1418
|
|
|
1467
1419
|
// src/components/panel/section-add-button.tsx
|
|
1468
|
-
import * as
|
|
1469
|
-
import { __ as
|
|
1420
|
+
import * as React18 from "react";
|
|
1421
|
+
import { __ as __11, sprintf } from "@wordpress/i18n";
|
|
1470
1422
|
function SectionAddButton({ onBeforeCreate }) {
|
|
1471
1423
|
const { type, setEditMode } = usePostListContext();
|
|
1472
1424
|
const canCreate = useCanCreate(type);
|
|
1473
1425
|
const singularName = postTypesMap[type].labels.singular_name;
|
|
1474
1426
|
const ariaLabel = sprintf(
|
|
1475
1427
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
1476
|
-
|
|
1428
|
+
__11("New %s", "elementor"),
|
|
1477
1429
|
singularName
|
|
1478
1430
|
);
|
|
1479
|
-
return /* @__PURE__ */
|
|
1431
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1480
1432
|
ContentPanelAddIconButton,
|
|
1481
1433
|
{
|
|
1482
1434
|
"aria-label": ariaLabel,
|
|
@@ -1491,7 +1443,7 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
1491
1443
|
}
|
|
1492
1444
|
|
|
1493
1445
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
1494
|
-
import * as
|
|
1446
|
+
import * as React19 from "react";
|
|
1495
1447
|
import { useId } from "react";
|
|
1496
1448
|
import { CollapseIcon } from "@elementor/editor-ui";
|
|
1497
1449
|
import { Box as Box6, Chip as Chip2, Collapse, Divider as Divider4, List, ListItemButton, ListItemText as ListItemText3, Stack as Stack6 } from "@elementor/ui";
|
|
@@ -1524,7 +1476,7 @@ function CollapsibleList({
|
|
|
1524
1476
|
const chipLabel = countChipLabel ?? count.toString();
|
|
1525
1477
|
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
|
|
1526
1478
|
const handleClick = () => onOpenChange(!isOpen);
|
|
1527
|
-
return /* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
1528
1480
|
Box6,
|
|
1529
1481
|
{
|
|
1530
1482
|
sx: {
|
|
@@ -1535,7 +1487,7 @@ function CollapsibleList({
|
|
|
1535
1487
|
width: "100%"
|
|
1536
1488
|
}
|
|
1537
1489
|
},
|
|
1538
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ React19.createElement(
|
|
1539
1491
|
ListItemButton,
|
|
1540
1492
|
{
|
|
1541
1493
|
ref: headerRef,
|
|
@@ -1549,7 +1501,7 @@ function CollapsibleList({
|
|
|
1549
1501
|
onClick: handleClick,
|
|
1550
1502
|
sx: sectionHeaderListItemButtonSx
|
|
1551
1503
|
},
|
|
1552
|
-
/* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ React19.createElement(Stack6, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React19.createElement(Stack6, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React19.createElement(
|
|
1553
1505
|
ListItemText3,
|
|
1554
1506
|
{
|
|
1555
1507
|
secondary: title,
|
|
@@ -1560,9 +1512,9 @@ function CollapsibleList({
|
|
|
1560
1512
|
},
|
|
1561
1513
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1562
1514
|
}
|
|
1563
|
-
), /* @__PURE__ */
|
|
1515
|
+
), /* @__PURE__ */ React19.createElement(Chip2, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React19.createElement(CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
|
|
1564
1516
|
),
|
|
1565
|
-
trailingActions && /* @__PURE__ */
|
|
1517
|
+
trailingActions && /* @__PURE__ */ React19.createElement(
|
|
1566
1518
|
Stack6,
|
|
1567
1519
|
{
|
|
1568
1520
|
alignItems: "center",
|
|
@@ -1573,16 +1525,16 @@ function CollapsibleList({
|
|
|
1573
1525
|
},
|
|
1574
1526
|
trailingActions
|
|
1575
1527
|
)
|
|
1576
|
-
), isOpen && sectionToolbar, /* @__PURE__ */
|
|
1528
|
+
), isOpen && sectionToolbar, /* @__PURE__ */ React19.createElement(Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React19.createElement(List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React19.createElement(Divider4, null));
|
|
1577
1529
|
}
|
|
1578
1530
|
|
|
1579
1531
|
// src/components/panel/posts-list/error-state.tsx
|
|
1580
|
-
import * as
|
|
1532
|
+
import * as React20 from "react";
|
|
1581
1533
|
import { Error404TemplateIcon } from "@elementor/icons";
|
|
1582
|
-
import { Box as Box7, Link, Typography as
|
|
1583
|
-
import { __ as
|
|
1534
|
+
import { Box as Box7, Link, Typography as Typography4 } from "@elementor/ui";
|
|
1535
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1584
1536
|
function ErrorState() {
|
|
1585
|
-
return /* @__PURE__ */
|
|
1537
|
+
return /* @__PURE__ */ React20.createElement(
|
|
1586
1538
|
Box7,
|
|
1587
1539
|
{
|
|
1588
1540
|
sx: {
|
|
@@ -1594,8 +1546,8 @@ function ErrorState() {
|
|
|
1594
1546
|
gap: "16px"
|
|
1595
1547
|
}
|
|
1596
1548
|
},
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ React20.createElement(Error404TemplateIcon, null),
|
|
1550
|
+
/* @__PURE__ */ React20.createElement(
|
|
1599
1551
|
Box7,
|
|
1600
1552
|
{
|
|
1601
1553
|
sx: {
|
|
@@ -1606,19 +1558,19 @@ function ErrorState() {
|
|
|
1606
1558
|
gap: "8px"
|
|
1607
1559
|
}
|
|
1608
1560
|
},
|
|
1609
|
-
/* @__PURE__ */
|
|
1610
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ React20.createElement(Typography4, { variant: "body1", color: "text.primary" }, __12("We couldn\u2019t display your pages.", "elementor")),
|
|
1562
|
+
/* @__PURE__ */ React20.createElement(Box7, null, /* @__PURE__ */ React20.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React20.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React20.createElement(Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
|
|
1611
1563
|
)
|
|
1612
1564
|
);
|
|
1613
1565
|
}
|
|
1614
1566
|
|
|
1615
1567
|
// src/components/panel/posts-list/post-list-item.tsx
|
|
1616
|
-
import * as
|
|
1568
|
+
import * as React35 from "react";
|
|
1617
1569
|
|
|
1618
1570
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
1619
|
-
import * as
|
|
1571
|
+
import * as React22 from "react";
|
|
1620
1572
|
import { __useNavigateToDocument as useNavigateToDocument } from "@elementor/editor-documents";
|
|
1621
|
-
import { __ as
|
|
1573
|
+
import { __ as __14, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
1622
1574
|
|
|
1623
1575
|
// src/hooks/use-posts-actions.ts
|
|
1624
1576
|
import { useMutation, useQueryClient } from "@elementor/query";
|
|
@@ -1699,11 +1651,11 @@ function useInvalidatePosts(postTypeSlug) {
|
|
|
1699
1651
|
}
|
|
1700
1652
|
|
|
1701
1653
|
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
1702
|
-
import * as
|
|
1703
|
-
import { useRef as useRef4, useState as
|
|
1654
|
+
import * as React21 from "react";
|
|
1655
|
+
import { useRef as useRef4, useState as useState5 } from "react";
|
|
1704
1656
|
import { XIcon } from "@elementor/icons";
|
|
1705
1657
|
import { Box as Box8, CircularProgress, IconButton as IconButton3, ListItem, ListItemText as ListItemText4 } from "@elementor/ui";
|
|
1706
|
-
import { __ as
|
|
1658
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
1707
1659
|
var EDIT_ROW_FOCUS_BORDER_WIDTH_PX = 2;
|
|
1708
1660
|
var EDIT_ROW_MIN_HEIGHT_PX = 36;
|
|
1709
1661
|
var editModeListItemButtonSx = {
|
|
@@ -1743,9 +1695,9 @@ var editRowInputSx = {
|
|
|
1743
1695
|
function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
1744
1696
|
const { resetEditMode } = usePostListContext();
|
|
1745
1697
|
const dismissEditMode = onDismiss ?? resetEditMode;
|
|
1746
|
-
const [title, setTitle] =
|
|
1747
|
-
const [touched, setTouched] =
|
|
1748
|
-
const [inputError, setInputError] =
|
|
1698
|
+
const [title, setTitle] = useState5(postTitle);
|
|
1699
|
+
const [touched, setTouched] = useState5(false);
|
|
1700
|
+
const [inputError, setInputError] = useState5(null);
|
|
1749
1701
|
const closeButton = useRef4();
|
|
1750
1702
|
const hasSubmittedRef = useRef4(false);
|
|
1751
1703
|
const onBlur = (e) => {
|
|
@@ -1781,32 +1733,32 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
|
1781
1733
|
}
|
|
1782
1734
|
const value = e.target.value;
|
|
1783
1735
|
if (!validateInput(value)) {
|
|
1784
|
-
setInputError(
|
|
1736
|
+
setInputError(__13("Name is required", "elementor"));
|
|
1785
1737
|
} else {
|
|
1786
1738
|
setInputError(null);
|
|
1787
1739
|
}
|
|
1788
1740
|
setTitle(value);
|
|
1789
1741
|
};
|
|
1790
|
-
return /* @__PURE__ */
|
|
1742
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1791
1743
|
ListItem,
|
|
1792
1744
|
{
|
|
1793
1745
|
disablePadding: true,
|
|
1794
1746
|
sx: contentPanelListRowPaddingSx,
|
|
1795
|
-
secondaryAction: /* @__PURE__ */
|
|
1747
|
+
secondaryAction: /* @__PURE__ */ React21.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
|
|
1796
1748
|
},
|
|
1797
|
-
/* @__PURE__ */
|
|
1749
|
+
/* @__PURE__ */ React21.createElement(
|
|
1798
1750
|
Box8,
|
|
1799
1751
|
{
|
|
1800
1752
|
component: "form",
|
|
1801
1753
|
onSubmit: onFormSubmit,
|
|
1802
1754
|
sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
|
|
1803
1755
|
},
|
|
1804
|
-
/* @__PURE__ */
|
|
1756
|
+
/* @__PURE__ */ React21.createElement(Box8, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React21.createElement(
|
|
1805
1757
|
Box8,
|
|
1806
1758
|
{
|
|
1807
1759
|
autoFocus: true,
|
|
1808
1760
|
"aria-invalid": !!inputError,
|
|
1809
|
-
"aria-label":
|
|
1761
|
+
"aria-label": __13("Name", "elementor"),
|
|
1810
1762
|
component: "input",
|
|
1811
1763
|
disabled: isLoading,
|
|
1812
1764
|
onBlur,
|
|
@@ -1817,10 +1769,10 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
|
1817
1769
|
}
|
|
1818
1770
|
))
|
|
1819
1771
|
)
|
|
1820
|
-
), inputError && /* @__PURE__ */
|
|
1772
|
+
), inputError && /* @__PURE__ */ React21.createElement(ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React21.createElement(ListItemText4, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
|
|
1821
1773
|
}
|
|
1822
1774
|
function CloseButton({ isLoading, closeButton, onDismiss }) {
|
|
1823
|
-
return /* @__PURE__ */
|
|
1775
|
+
return /* @__PURE__ */ React21.createElement(IconButton3, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React21.createElement(CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React21.createElement(XIcon, { fontSize: "tiny" }));
|
|
1824
1776
|
}
|
|
1825
1777
|
|
|
1826
1778
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
@@ -1845,10 +1797,10 @@ function ListItemCreate() {
|
|
|
1845
1797
|
};
|
|
1846
1798
|
const newItemLabel = sprintf2(
|
|
1847
1799
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
1848
|
-
|
|
1800
|
+
__14("New %s", "elementor"),
|
|
1849
1801
|
postTypesMap[type].labels.singular_name
|
|
1850
1802
|
);
|
|
1851
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ React22.createElement(
|
|
1852
1804
|
EditModeTemplate,
|
|
1853
1805
|
{
|
|
1854
1806
|
postTitle: newItemLabel,
|
|
@@ -1859,9 +1811,9 @@ function ListItemCreate() {
|
|
|
1859
1811
|
}
|
|
1860
1812
|
|
|
1861
1813
|
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx
|
|
1862
|
-
import * as
|
|
1814
|
+
import * as React23 from "react";
|
|
1863
1815
|
import { __useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
|
|
1864
|
-
import { __ as
|
|
1816
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
1865
1817
|
function ListItemDuplicate() {
|
|
1866
1818
|
const { type, editMode, resetEditMode } = usePostListContext();
|
|
1867
1819
|
const navigateToDocument = useNavigateToDocument2();
|
|
@@ -1884,10 +1836,10 @@ function ListItemDuplicate() {
|
|
|
1884
1836
|
resetEditMode();
|
|
1885
1837
|
}
|
|
1886
1838
|
};
|
|
1887
|
-
return /* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1888
1840
|
EditModeTemplate,
|
|
1889
1841
|
{
|
|
1890
|
-
postTitle: `${editMode.details.title} ${
|
|
1842
|
+
postTitle: `${editMode.details.title} ${__15("copy", "elementor")}`,
|
|
1891
1843
|
isLoading: duplicatePost.isPending,
|
|
1892
1844
|
callback: duplicatePostCallback
|
|
1893
1845
|
}
|
|
@@ -1895,7 +1847,7 @@ function ListItemDuplicate() {
|
|
|
1895
1847
|
}
|
|
1896
1848
|
|
|
1897
1849
|
// src/components/panel/posts-list/list-items/list-item-rename.tsx
|
|
1898
|
-
import * as
|
|
1850
|
+
import * as React24 from "react";
|
|
1899
1851
|
import { __useActiveDocument as useActiveDocument } from "@elementor/editor-documents";
|
|
1900
1852
|
|
|
1901
1853
|
// src/hooks/use-rename-active-document.ts
|
|
@@ -1946,12 +1898,12 @@ function ListItemRename({ post }) {
|
|
|
1946
1898
|
resetEditMode();
|
|
1947
1899
|
}
|
|
1948
1900
|
};
|
|
1949
|
-
return /* @__PURE__ */
|
|
1901
|
+
return /* @__PURE__ */ React24.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
|
|
1950
1902
|
}
|
|
1951
1903
|
|
|
1952
1904
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
1953
|
-
import * as
|
|
1954
|
-
import { useState as
|
|
1905
|
+
import * as React34 from "react";
|
|
1906
|
+
import { useState as useState8 } from "react";
|
|
1955
1907
|
import {
|
|
1956
1908
|
__useActiveDocument as useActiveDocument3,
|
|
1957
1909
|
__useNavigateToDocument as useNavigateToDocument3
|
|
@@ -1967,19 +1919,19 @@ import {
|
|
|
1967
1919
|
ListItemText as ListItemText6,
|
|
1968
1920
|
Menu as Menu2,
|
|
1969
1921
|
Stack as Stack7,
|
|
1970
|
-
Tooltip as
|
|
1971
|
-
Typography as
|
|
1972
|
-
usePopupState as
|
|
1922
|
+
Tooltip as Tooltip4,
|
|
1923
|
+
Typography as Typography6,
|
|
1924
|
+
usePopupState as usePopupState4
|
|
1973
1925
|
} from "@elementor/ui";
|
|
1974
|
-
import { __ as
|
|
1926
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
1975
1927
|
|
|
1976
1928
|
// src/components/shared/page-title-and-status.tsx
|
|
1977
|
-
import * as
|
|
1978
|
-
import { Box as Box9, Chip as Chip3, Typography as
|
|
1979
|
-
import { __ as
|
|
1929
|
+
import * as React25 from "react";
|
|
1930
|
+
import { Box as Box9, Chip as Chip3, Typography as Typography5 } from "@elementor/ui";
|
|
1931
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
1980
1932
|
|
|
1981
1933
|
// src/hooks/use-reverse-html-entities.ts
|
|
1982
|
-
import { useMemo as
|
|
1934
|
+
import { useMemo as useMemo4 } from "react";
|
|
1983
1935
|
|
|
1984
1936
|
// src/utils/post-title-plain.ts
|
|
1985
1937
|
function getPostTitlePlain(renderedTitle) {
|
|
@@ -1993,7 +1945,7 @@ function getPostTitlePlain(renderedTitle) {
|
|
|
1993
1945
|
|
|
1994
1946
|
// src/hooks/use-reverse-html-entities.ts
|
|
1995
1947
|
function useReverseHtmlEntities(escapedHTML = "") {
|
|
1996
|
-
return
|
|
1948
|
+
return useMemo4(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
|
|
1997
1949
|
}
|
|
1998
1950
|
|
|
1999
1951
|
// src/components/shared/page-title-and-status.tsx
|
|
@@ -2003,19 +1955,19 @@ function humanizeStatusSlug(status) {
|
|
|
2003
1955
|
var statusChipConfig = {
|
|
2004
1956
|
draft: {
|
|
2005
1957
|
color: "default",
|
|
2006
|
-
label:
|
|
1958
|
+
label: __16("Draft", "elementor")
|
|
2007
1959
|
},
|
|
2008
1960
|
future: {
|
|
2009
1961
|
color: "default",
|
|
2010
|
-
label:
|
|
1962
|
+
label: __16("Scheduled", "elementor")
|
|
2011
1963
|
},
|
|
2012
1964
|
pending: {
|
|
2013
1965
|
color: "warning",
|
|
2014
|
-
label:
|
|
1966
|
+
label: __16("Pending Review", "elementor")
|
|
2015
1967
|
},
|
|
2016
1968
|
private: {
|
|
2017
1969
|
color: "default",
|
|
2018
|
-
label:
|
|
1970
|
+
label: __16("Private", "elementor")
|
|
2019
1971
|
}
|
|
2020
1972
|
};
|
|
2021
1973
|
function getStatusChipConfig(status) {
|
|
@@ -2037,7 +1989,7 @@ var PageStatus = ({ status }) => {
|
|
|
2037
1989
|
}
|
|
2038
1990
|
const { color, label } = getStatusChipConfig(status);
|
|
2039
1991
|
const isKnownStatus = isKnownPanelStatus(status);
|
|
2040
|
-
return /* @__PURE__ */
|
|
1992
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2041
1993
|
Chip3,
|
|
2042
1994
|
{
|
|
2043
1995
|
color,
|
|
@@ -2063,8 +2015,8 @@ var PageStatus = ({ status }) => {
|
|
|
2063
2015
|
var PageTitle = ({ status, title }) => {
|
|
2064
2016
|
const modifiedTitle = useReverseHtmlEntities(title);
|
|
2065
2017
|
const titleColor = "trash" === status ? "text.disabled" : "text.secondary";
|
|
2066
|
-
return /* @__PURE__ */
|
|
2067
|
-
|
|
2018
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2019
|
+
Typography5,
|
|
2068
2020
|
{
|
|
2069
2021
|
component: "span",
|
|
2070
2022
|
variant: "body2",
|
|
@@ -2083,12 +2035,12 @@ var PageTitle = ({ status, title }) => {
|
|
|
2083
2035
|
);
|
|
2084
2036
|
};
|
|
2085
2037
|
function PageTitleAndStatus({ title, status }) {
|
|
2086
|
-
return /* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ React25.createElement(Box9, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React25.createElement(PageTitle, { status, title }), /* @__PURE__ */ React25.createElement(PageStatus, { status }));
|
|
2087
2039
|
}
|
|
2088
2040
|
|
|
2089
2041
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
2090
|
-
import * as
|
|
2091
|
-
import { useState as
|
|
2042
|
+
import * as React27 from "react";
|
|
2043
|
+
import { useState as useState6 } from "react";
|
|
2092
2044
|
import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
|
|
2093
2045
|
import { TrashIcon } from "@elementor/icons";
|
|
2094
2046
|
import {
|
|
@@ -2101,34 +2053,34 @@ import {
|
|
|
2101
2053
|
DialogTitle,
|
|
2102
2054
|
Divider as Divider5
|
|
2103
2055
|
} from "@elementor/ui";
|
|
2104
|
-
import { __ as
|
|
2056
|
+
import { __ as __17, sprintf as sprintf3 } from "@wordpress/i18n";
|
|
2105
2057
|
|
|
2106
2058
|
// src/components/panel/actions-menu/action-menu-item.tsx
|
|
2107
|
-
import * as
|
|
2108
|
-
import { ListItemIcon as ListItemIcon3, ListItemText as ListItemText5, MenuItem as
|
|
2059
|
+
import * as React26 from "react";
|
|
2060
|
+
import { ListItemIcon as ListItemIcon3, ListItemText as ListItemText5, MenuItem as MenuItem5 } from "@elementor/ui";
|
|
2109
2061
|
function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
|
|
2110
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ React26.createElement(MenuItem5, { ...MenuItemProps }, /* @__PURE__ */ React26.createElement(
|
|
2111
2063
|
ListItemIcon3,
|
|
2112
2064
|
{
|
|
2113
2065
|
sx: {
|
|
2114
2066
|
color: "inherit"
|
|
2115
2067
|
}
|
|
2116
2068
|
},
|
|
2117
|
-
/* @__PURE__ */
|
|
2118
|
-
), /* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ React26.createElement(Icon, null)
|
|
2070
|
+
), /* @__PURE__ */ React26.createElement(ListItemText5, { primary: title, secondary: description }));
|
|
2119
2071
|
}
|
|
2120
2072
|
|
|
2121
2073
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
2122
2074
|
function Delete({ post }) {
|
|
2123
|
-
const [isDialogOpen, setIsDialogOpen] =
|
|
2075
|
+
const [isDialogOpen, setIsDialogOpen] = useState6(false);
|
|
2124
2076
|
const activeDocument = useActiveDocument2();
|
|
2125
2077
|
const isPostActive = activeDocument?.id === post.id;
|
|
2126
2078
|
const userCanDelete = post.user_can.delete;
|
|
2127
2079
|
const isDisabled = !userCanDelete || post.isHome || isPostActive;
|
|
2128
|
-
return /* @__PURE__ */
|
|
2080
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
|
|
2129
2081
|
ActionMenuItem,
|
|
2130
2082
|
{
|
|
2131
|
-
title:
|
|
2083
|
+
title: __17("Delete", "elementor"),
|
|
2132
2084
|
icon: TrashIcon,
|
|
2133
2085
|
MenuItemProps: {
|
|
2134
2086
|
disabled: isDisabled,
|
|
@@ -2136,7 +2088,7 @@ function Delete({ post }) {
|
|
|
2136
2088
|
sx: { "&:hover": { color: "error.main" } }
|
|
2137
2089
|
}
|
|
2138
2090
|
}
|
|
2139
|
-
), isDialogOpen && /* @__PURE__ */
|
|
2091
|
+
), isDialogOpen && /* @__PURE__ */ React27.createElement(DeleteDialog, { post, setIsDialogOpen }));
|
|
2140
2092
|
}
|
|
2141
2093
|
function DeleteDialog({
|
|
2142
2094
|
post,
|
|
@@ -2145,11 +2097,11 @@ function DeleteDialog({
|
|
|
2145
2097
|
const { type } = usePostListContext();
|
|
2146
2098
|
const { deletePost } = usePostActions(type);
|
|
2147
2099
|
const { setError } = usePostListContext();
|
|
2148
|
-
const dialogTitle = sprintf3(
|
|
2149
|
-
const dialogBody = type === "post" ?
|
|
2100
|
+
const dialogTitle = sprintf3(__17('Delete "%s"?', "elementor"), post.title.rendered);
|
|
2101
|
+
const dialogBody = type === "post" ? __17(
|
|
2150
2102
|
"The post and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
2151
2103
|
"elementor"
|
|
2152
|
-
) :
|
|
2104
|
+
) : __17(
|
|
2153
2105
|
"The page and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
2154
2106
|
"elementor"
|
|
2155
2107
|
);
|
|
@@ -2167,7 +2119,7 @@ function DeleteDialog({
|
|
|
2167
2119
|
}
|
|
2168
2120
|
setIsDialogOpen(false);
|
|
2169
2121
|
};
|
|
2170
|
-
return /* @__PURE__ */
|
|
2122
|
+
return /* @__PURE__ */ React27.createElement(Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React27.createElement(DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React27.createElement(Divider5, null), /* @__PURE__ */ React27.createElement(DialogContent, null, /* @__PURE__ */ React27.createElement(DialogContentText, null, dialogBody)), /* @__PURE__ */ React27.createElement(DialogActions, null, /* @__PURE__ */ React27.createElement(
|
|
2171
2123
|
Button,
|
|
2172
2124
|
{
|
|
2173
2125
|
variant: "contained",
|
|
@@ -2175,14 +2127,14 @@ function DeleteDialog({
|
|
|
2175
2127
|
onClick: handleCancel,
|
|
2176
2128
|
disabled: deletePost.isPending
|
|
2177
2129
|
},
|
|
2178
|
-
|
|
2179
|
-
), /* @__PURE__ */
|
|
2130
|
+
__17("Cancel", "elementor")
|
|
2131
|
+
), /* @__PURE__ */ React27.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __17("Delete", "elementor") : /* @__PURE__ */ React27.createElement(CircularProgress2, null))));
|
|
2180
2132
|
}
|
|
2181
2133
|
|
|
2182
2134
|
// src/components/panel/actions-menu/actions/duplicate.tsx
|
|
2183
|
-
import * as
|
|
2135
|
+
import * as React28 from "react";
|
|
2184
2136
|
import { CopyIcon } from "@elementor/icons";
|
|
2185
|
-
import { __ as
|
|
2137
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2186
2138
|
function Duplicate({ post, popupState }) {
|
|
2187
2139
|
const { setEditMode, type } = usePostListContext();
|
|
2188
2140
|
const canCreate = useCanCreate(type);
|
|
@@ -2197,10 +2149,10 @@ function Duplicate({ post, popupState }) {
|
|
|
2197
2149
|
});
|
|
2198
2150
|
};
|
|
2199
2151
|
const isDisabled = !canCreate;
|
|
2200
|
-
return /* @__PURE__ */
|
|
2152
|
+
return /* @__PURE__ */ React28.createElement(
|
|
2201
2153
|
ActionMenuItem,
|
|
2202
2154
|
{
|
|
2203
|
-
title:
|
|
2155
|
+
title: __18("Duplicate", "elementor"),
|
|
2204
2156
|
icon: CopyIcon,
|
|
2205
2157
|
MenuItemProps: {
|
|
2206
2158
|
disabled: isDisabled,
|
|
@@ -2211,8 +2163,8 @@ function Duplicate({ post, popupState }) {
|
|
|
2211
2163
|
}
|
|
2212
2164
|
|
|
2213
2165
|
// src/components/panel/actions-menu/actions/force-delete.tsx
|
|
2214
|
-
import * as
|
|
2215
|
-
import { useState as
|
|
2166
|
+
import * as React29 from "react";
|
|
2167
|
+
import { useState as useState7 } from "react";
|
|
2216
2168
|
import { TrashIcon as TrashIcon2 } from "@elementor/icons";
|
|
2217
2169
|
import {
|
|
2218
2170
|
Button as Button2,
|
|
@@ -2224,10 +2176,10 @@ import {
|
|
|
2224
2176
|
DialogTitle as DialogTitle2,
|
|
2225
2177
|
Divider as Divider6
|
|
2226
2178
|
} from "@elementor/ui";
|
|
2227
|
-
import { __ as
|
|
2179
|
+
import { __ as __19, sprintf as sprintf4 } from "@wordpress/i18n";
|
|
2228
2180
|
function ForceDelete({ post }) {
|
|
2229
|
-
const [isDialogOpen, setIsDialogOpen] =
|
|
2230
|
-
return /* @__PURE__ */
|
|
2181
|
+
const [isDialogOpen, setIsDialogOpen] = useState7(false);
|
|
2182
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
2231
2183
|
ActionMenuItem,
|
|
2232
2184
|
{
|
|
2233
2185
|
icon: TrashIcon2,
|
|
@@ -2236,9 +2188,9 @@ function ForceDelete({ post }) {
|
|
|
2236
2188
|
onClick: () => setIsDialogOpen(true),
|
|
2237
2189
|
sx: { "&:hover": { color: "error.main" } }
|
|
2238
2190
|
},
|
|
2239
|
-
title:
|
|
2191
|
+
title: __19("Delete permanently", "elementor")
|
|
2240
2192
|
}
|
|
2241
|
-
), isDialogOpen && /* @__PURE__ */
|
|
2193
|
+
), isDialogOpen && /* @__PURE__ */ React29.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
|
|
2242
2194
|
}
|
|
2243
2195
|
function ForceDeleteDialog({
|
|
2244
2196
|
post,
|
|
@@ -2246,8 +2198,8 @@ function ForceDeleteDialog({
|
|
|
2246
2198
|
}) {
|
|
2247
2199
|
const { setError, type } = usePostListContext();
|
|
2248
2200
|
const { forceDeletePost } = usePostActions(type);
|
|
2249
|
-
const dialogTitle = sprintf4(
|
|
2250
|
-
const dialogBody =
|
|
2201
|
+
const dialogTitle = sprintf4(__19('Delete "%s" permanently?', "elementor"), post.title.rendered);
|
|
2202
|
+
const dialogBody = __19("This will permanently delete the item. You cannot undo this action.", "elementor");
|
|
2251
2203
|
const handleDelete = async () => {
|
|
2252
2204
|
try {
|
|
2253
2205
|
await forceDeletePost.mutateAsync(post.id);
|
|
@@ -2263,7 +2215,7 @@ function ForceDeleteDialog({
|
|
|
2263
2215
|
}
|
|
2264
2216
|
setIsDialogOpen(false);
|
|
2265
2217
|
};
|
|
2266
|
-
return /* @__PURE__ */
|
|
2218
|
+
return /* @__PURE__ */ React29.createElement(Dialog2, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React29.createElement(DialogTitle2, { noWrap: true }, dialogTitle), /* @__PURE__ */ React29.createElement(Divider6, null), /* @__PURE__ */ React29.createElement(DialogContent2, null, /* @__PURE__ */ React29.createElement(DialogContentText2, null, dialogBody)), /* @__PURE__ */ React29.createElement(DialogActions2, null, /* @__PURE__ */ React29.createElement(
|
|
2267
2219
|
Button2,
|
|
2268
2220
|
{
|
|
2269
2221
|
variant: "contained",
|
|
@@ -2271,8 +2223,8 @@ function ForceDeleteDialog({
|
|
|
2271
2223
|
onClick: handleCancel,
|
|
2272
2224
|
disabled: forceDeletePost.isPending
|
|
2273
2225
|
},
|
|
2274
|
-
|
|
2275
|
-
), /* @__PURE__ */
|
|
2226
|
+
__19("Cancel", "elementor")
|
|
2227
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2276
2228
|
Button2,
|
|
2277
2229
|
{
|
|
2278
2230
|
variant: "contained",
|
|
@@ -2280,20 +2232,20 @@ function ForceDeleteDialog({
|
|
|
2280
2232
|
onClick: () => void handleDelete(),
|
|
2281
2233
|
disabled: forceDeletePost.isPending
|
|
2282
2234
|
},
|
|
2283
|
-
!forceDeletePost.isPending ?
|
|
2235
|
+
!forceDeletePost.isPending ? __19("Delete permanently", "elementor") : /* @__PURE__ */ React29.createElement(CircularProgress3, null)
|
|
2284
2236
|
)));
|
|
2285
2237
|
}
|
|
2286
2238
|
|
|
2287
2239
|
// src/components/panel/actions-menu/actions/rename.tsx
|
|
2288
|
-
import * as
|
|
2240
|
+
import * as React30 from "react";
|
|
2289
2241
|
import { EraseIcon } from "@elementor/icons";
|
|
2290
|
-
import { __ as
|
|
2242
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2291
2243
|
function Rename({ post }) {
|
|
2292
2244
|
const { setEditMode } = usePostListContext();
|
|
2293
|
-
return /* @__PURE__ */
|
|
2245
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2294
2246
|
ActionMenuItem,
|
|
2295
2247
|
{
|
|
2296
|
-
title:
|
|
2248
|
+
title: __20("Rename", "elementor"),
|
|
2297
2249
|
icon: EraseIcon,
|
|
2298
2250
|
MenuItemProps: {
|
|
2299
2251
|
disabled: !post.user_can.edit,
|
|
@@ -2311,9 +2263,9 @@ function Rename({ post }) {
|
|
|
2311
2263
|
}
|
|
2312
2264
|
|
|
2313
2265
|
// src/components/panel/actions-menu/actions/restore.tsx
|
|
2314
|
-
import * as
|
|
2266
|
+
import * as React31 from "react";
|
|
2315
2267
|
import { RefreshIcon } from "@elementor/icons";
|
|
2316
|
-
import { __ as
|
|
2268
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
2317
2269
|
function Restore({ post }) {
|
|
2318
2270
|
const { setError, type } = usePostListContext();
|
|
2319
2271
|
const { restorePost } = usePostActions(type);
|
|
@@ -2324,11 +2276,11 @@ function Restore({ post }) {
|
|
|
2324
2276
|
setError();
|
|
2325
2277
|
}
|
|
2326
2278
|
};
|
|
2327
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ React31.createElement(
|
|
2328
2280
|
ActionMenuItem,
|
|
2329
2281
|
{
|
|
2330
|
-
description:
|
|
2331
|
-
title:
|
|
2282
|
+
description: __21("Restored as draft", "elementor"),
|
|
2283
|
+
title: __21("Restore", "elementor"),
|
|
2332
2284
|
icon: RefreshIcon,
|
|
2333
2285
|
MenuItemProps: {
|
|
2334
2286
|
disabled: restorePost.isPending || !post.user_can.delete,
|
|
@@ -2339,11 +2291,11 @@ function Restore({ post }) {
|
|
|
2339
2291
|
}
|
|
2340
2292
|
|
|
2341
2293
|
// src/components/panel/actions-menu/actions/set-home.tsx
|
|
2342
|
-
import * as
|
|
2294
|
+
import * as React32 from "react";
|
|
2343
2295
|
import { ConfirmationDialog } from "@elementor/editor-ui";
|
|
2344
2296
|
import { HomeIcon } from "@elementor/icons";
|
|
2345
2297
|
import { Button as Button3, CircularProgress as CircularProgress4, DialogActions as DialogActions3 } from "@elementor/ui";
|
|
2346
|
-
import { __ as
|
|
2298
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2347
2299
|
|
|
2348
2300
|
// src/hooks/use-homepage-actions.ts
|
|
2349
2301
|
import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@elementor/query";
|
|
@@ -2401,8 +2353,8 @@ function SetHome({ post, closeMenu, onRequestRemoveHomepage }) {
|
|
|
2401
2353
|
const isSetHomeDisabled = !canManageOptions || !isPostPublished || updateSettingsMutation.isPending;
|
|
2402
2354
|
const isRemoveHomeDisabled = !canManageOptions || updateSettingsMutation.isPending;
|
|
2403
2355
|
const isDisabled = isPostHomepage ? isRemoveHomeDisabled : isSetHomeDisabled;
|
|
2404
|
-
const title = isPostHomepage ?
|
|
2405
|
-
return /* @__PURE__ */
|
|
2356
|
+
const title = isPostHomepage ? __22("Remove as homepage", "elementor") : __22("Set as homepage", "elementor");
|
|
2357
|
+
return /* @__PURE__ */ React32.createElement(
|
|
2406
2358
|
ActionMenuItem,
|
|
2407
2359
|
{
|
|
2408
2360
|
title,
|
|
@@ -2439,11 +2391,11 @@ function RemoveHomepageDialog({ open, onClose }) {
|
|
|
2439
2391
|
}
|
|
2440
2392
|
};
|
|
2441
2393
|
const isPending = updateSettingsMutation.isPending;
|
|
2442
|
-
const removeHomepageLabel =
|
|
2443
|
-
return /* @__PURE__ */
|
|
2394
|
+
const removeHomepageLabel = __22("Remove as homepage", "elementor");
|
|
2395
|
+
return /* @__PURE__ */ React32.createElement(ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React32.createElement(ConfirmationDialog.Title, { iconColor: "secondary" }, __22("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React32.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React32.createElement(ConfirmationDialog.ContentText, null, __22(
|
|
2444
2396
|
"Your homepage will go back to showing your latest posts. You can set a page as your homepage again at any time.",
|
|
2445
2397
|
"elementor"
|
|
2446
|
-
))), /* @__PURE__ */
|
|
2398
|
+
))), /* @__PURE__ */ React32.createElement(DialogActions3, null, /* @__PURE__ */ React32.createElement(Button3, { color: "secondary", disabled: isPending, onClick: handleCancel }, __22("Not now", "elementor")), /* @__PURE__ */ React32.createElement(
|
|
2447
2399
|
Button3,
|
|
2448
2400
|
{
|
|
2449
2401
|
color: "secondary",
|
|
@@ -2452,18 +2404,18 @@ function RemoveHomepageDialog({ open, onClose }) {
|
|
|
2452
2404
|
sx: { ml: 1 },
|
|
2453
2405
|
variant: "contained"
|
|
2454
2406
|
},
|
|
2455
|
-
!isPending ? removeHomepageLabel : /* @__PURE__ */
|
|
2407
|
+
!isPending ? removeHomepageLabel : /* @__PURE__ */ React32.createElement(CircularProgress4, null)
|
|
2456
2408
|
)));
|
|
2457
2409
|
}
|
|
2458
2410
|
|
|
2459
2411
|
// src/components/panel/actions-menu/actions/view.tsx
|
|
2460
|
-
import * as
|
|
2412
|
+
import * as React33 from "react";
|
|
2461
2413
|
import { EyeIcon } from "@elementor/icons";
|
|
2462
|
-
import { __ as
|
|
2414
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
2463
2415
|
function View({ post }) {
|
|
2464
2416
|
const { type } = usePostListContext();
|
|
2465
|
-
const title =
|
|
2466
|
-
return /* @__PURE__ */
|
|
2417
|
+
const title = __23("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
|
|
2418
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2467
2419
|
ActionMenuItem,
|
|
2468
2420
|
{
|
|
2469
2421
|
title,
|
|
@@ -2490,17 +2442,17 @@ var DisabledPostTooltip = ({
|
|
|
2490
2442
|
postTypeSlug
|
|
2491
2443
|
}) => {
|
|
2492
2444
|
if (isDisabled) {
|
|
2493
|
-
const title = /* @__PURE__ */
|
|
2494
|
-
return /* @__PURE__ */
|
|
2445
|
+
const title = /* @__PURE__ */ React34.createElement(Typography6, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React34.createElement("br", null), __24("To edit it directly, contact the site owner", "elementor"));
|
|
2446
|
+
return /* @__PURE__ */ React34.createElement(Tooltip4, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React34.createElement("span", null, children));
|
|
2495
2447
|
}
|
|
2496
|
-
return /* @__PURE__ */
|
|
2448
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, children);
|
|
2497
2449
|
};
|
|
2498
2450
|
function ListItemView({ post }) {
|
|
2499
2451
|
const { type } = usePostListContext();
|
|
2500
|
-
const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] =
|
|
2452
|
+
const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] = useState8(false);
|
|
2501
2453
|
const activeDocument = useActiveDocument3();
|
|
2502
2454
|
const navigateToDocument = useNavigateToDocument3();
|
|
2503
|
-
const popupState =
|
|
2455
|
+
const popupState = usePopupState4({
|
|
2504
2456
|
variant: "popover",
|
|
2505
2457
|
popupId: "post-actions",
|
|
2506
2458
|
disableAutoFocus: true
|
|
@@ -2517,18 +2469,26 @@ function ListItemView({ post }) {
|
|
|
2517
2469
|
const isHome = Boolean(post.isHome);
|
|
2518
2470
|
const trailingActionCount = 1 + (showListItemActions ? 1 : 0) + (isHome ? 1 : 0);
|
|
2519
2471
|
const allowRowHover = !isEditBlocked;
|
|
2520
|
-
const listRow = /* @__PURE__ */
|
|
2472
|
+
const listRow = /* @__PURE__ */ React34.createElement(
|
|
2521
2473
|
ListItem2,
|
|
2522
2474
|
{
|
|
2523
2475
|
disablePadding: true,
|
|
2524
|
-
sx:
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2476
|
+
sx: getContentPanelListItemSx(trailingActionCount),
|
|
2477
|
+
secondaryAction: /* @__PURE__ */ React34.createElement(Stack7, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React34.createElement(SiteContentListItemActionsSlot, { post, title }), isHome ? /* @__PURE__ */ React34.createElement(
|
|
2478
|
+
IconButton4,
|
|
2479
|
+
{
|
|
2480
|
+
"aria-label": __24("Homepage", "elementor"),
|
|
2481
|
+
disableRipple: true,
|
|
2482
|
+
disabled: true,
|
|
2483
|
+
size: "tiny",
|
|
2484
|
+
sx: { pointerEvents: "none" },
|
|
2485
|
+
tabIndex: -1
|
|
2486
|
+
},
|
|
2487
|
+
/* @__PURE__ */ React34.createElement(HomeIcon2, { color: "disabled", fontSize: "tiny" })
|
|
2488
|
+
) : null, /* @__PURE__ */ React34.createElement(
|
|
2529
2489
|
IconButton4,
|
|
2530
2490
|
{
|
|
2531
|
-
"aria-label":
|
|
2491
|
+
"aria-label": __24("More actions", "elementor"),
|
|
2532
2492
|
size: "tiny",
|
|
2533
2493
|
...menuTriggerProps,
|
|
2534
2494
|
onClick: (event) => {
|
|
@@ -2536,10 +2496,10 @@ function ListItemView({ post }) {
|
|
|
2536
2496
|
menuTriggerProps.onClick?.(event);
|
|
2537
2497
|
}
|
|
2538
2498
|
},
|
|
2539
|
-
/* @__PURE__ */
|
|
2499
|
+
/* @__PURE__ */ React34.createElement(DotsVerticalIcon, { fontSize: "tiny" })
|
|
2540
2500
|
))
|
|
2541
2501
|
},
|
|
2542
|
-
/* @__PURE__ */
|
|
2502
|
+
/* @__PURE__ */ React34.createElement(
|
|
2543
2503
|
ListItemButton2,
|
|
2544
2504
|
{
|
|
2545
2505
|
dense: true,
|
|
@@ -2553,19 +2513,23 @@ function ListItemView({ post }) {
|
|
|
2553
2513
|
},
|
|
2554
2514
|
selected: isActive,
|
|
2555
2515
|
shape: "rounded",
|
|
2556
|
-
sx:
|
|
2516
|
+
sx: {
|
|
2517
|
+
...contentPanelListItemButtonSx,
|
|
2518
|
+
...getContentPanelListItemRowStateSx(isActive, allowRowHover),
|
|
2519
|
+
borderRadius: 1
|
|
2520
|
+
}
|
|
2557
2521
|
},
|
|
2558
|
-
/* @__PURE__ */
|
|
2522
|
+
/* @__PURE__ */ React34.createElement(ListItemText6, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React34.createElement(PageTitleAndStatus, { title, status }))
|
|
2559
2523
|
)
|
|
2560
2524
|
);
|
|
2561
|
-
return /* @__PURE__ */
|
|
2525
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, isEditBlocked ? /* @__PURE__ */ React34.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React34.createElement(
|
|
2562
2526
|
Menu2,
|
|
2563
2527
|
{
|
|
2564
2528
|
PaperProps: { sx: { mt: 2, width: 200 } },
|
|
2565
2529
|
MenuListProps: { dense: true },
|
|
2566
2530
|
...bindMenu2(popupState)
|
|
2567
2531
|
},
|
|
2568
|
-
isTrashed ? /* @__PURE__ */
|
|
2532
|
+
isTrashed ? /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(Restore, { post }), /* @__PURE__ */ React34.createElement(ForceDelete, { post })) : /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(Rename, { post }), /* @__PURE__ */ React34.createElement(Duplicate, { post, popupState }), /* @__PURE__ */ React34.createElement(Delete, { post }), /* @__PURE__ */ React34.createElement(View, { post }), type === "page" && /* @__PURE__ */ React34.createElement(React34.Fragment, null, /* @__PURE__ */ React34.createElement(Divider7, null), /* @__PURE__ */ React34.createElement(
|
|
2569
2533
|
SetHome,
|
|
2570
2534
|
{
|
|
2571
2535
|
post,
|
|
@@ -2573,7 +2537,7 @@ function ListItemView({ post }) {
|
|
|
2573
2537
|
onRequestRemoveHomepage: () => setIsRemoveHomeDialogOpen(true)
|
|
2574
2538
|
}
|
|
2575
2539
|
)))
|
|
2576
|
-
), /* @__PURE__ */
|
|
2540
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2577
2541
|
RemoveHomepageDialog,
|
|
2578
2542
|
{
|
|
2579
2543
|
open: isRemoveHomeDialogOpen,
|
|
@@ -2586,25 +2550,25 @@ function ListItemView({ post }) {
|
|
|
2586
2550
|
function PostListItem({ post }) {
|
|
2587
2551
|
const { editMode } = usePostListContext();
|
|
2588
2552
|
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
|
|
2589
|
-
return /* @__PURE__ */
|
|
2553
|
+
return /* @__PURE__ */ React35.createElement(ListItemRename, { post });
|
|
2590
2554
|
}
|
|
2591
2555
|
if ("create" === editMode.mode && !post) {
|
|
2592
|
-
return /* @__PURE__ */
|
|
2556
|
+
return /* @__PURE__ */ React35.createElement(ListItemCreate, null);
|
|
2593
2557
|
}
|
|
2594
2558
|
if ("duplicate" === editMode.mode && !post) {
|
|
2595
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ React35.createElement(ListItemDuplicate, null);
|
|
2596
2560
|
}
|
|
2597
2561
|
if (!post) {
|
|
2598
2562
|
return null;
|
|
2599
2563
|
}
|
|
2600
|
-
return /* @__PURE__ */
|
|
2564
|
+
return /* @__PURE__ */ React35.createElement(ListItemView, { post });
|
|
2601
2565
|
}
|
|
2602
2566
|
|
|
2603
2567
|
// src/components/panel/posts-list/post-list-pagination-actions.tsx
|
|
2604
|
-
import * as
|
|
2568
|
+
import * as React36 from "react";
|
|
2605
2569
|
import { CollapseIcon as CollapseIcon2 } from "@elementor/editor-ui";
|
|
2606
2570
|
import { Box as Box10, Button as Button4, CircularProgress as CircularProgress5, Stack as Stack8 } from "@elementor/ui";
|
|
2607
|
-
import { __ as
|
|
2571
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
2608
2572
|
var listPaginationButtonProps = {
|
|
2609
2573
|
color: "secondary",
|
|
2610
2574
|
size: "small",
|
|
@@ -2621,28 +2585,28 @@ function PostListPaginationActions({
|
|
|
2621
2585
|
if (!canLoadMore && !canShowLess) {
|
|
2622
2586
|
return null;
|
|
2623
2587
|
}
|
|
2624
|
-
const loadMoreLabel =
|
|
2625
|
-
const showLessLabel =
|
|
2626
|
-
const loadMoreButton = /* @__PURE__ */
|
|
2588
|
+
const loadMoreLabel = __25("Load more", "elementor");
|
|
2589
|
+
const showLessLabel = __25("Show less", "elementor");
|
|
2590
|
+
const loadMoreButton = /* @__PURE__ */ React36.createElement(
|
|
2627
2591
|
Button4,
|
|
2628
2592
|
{
|
|
2629
2593
|
...listPaginationButtonProps,
|
|
2630
2594
|
ref: loadMoreButtonRef,
|
|
2631
2595
|
"aria-label": loadMoreLabel,
|
|
2632
2596
|
disabled: isLoadingMore,
|
|
2633
|
-
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */
|
|
2597
|
+
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React36.createElement(CollapseIcon2, { open: false }),
|
|
2634
2598
|
fullWidth: true,
|
|
2635
2599
|
onClick: onLoadMore,
|
|
2636
2600
|
sx: { flex: 1, my: 0.5 }
|
|
2637
2601
|
},
|
|
2638
|
-
isLoadingMore ? /* @__PURE__ */
|
|
2602
|
+
isLoadingMore ? /* @__PURE__ */ React36.createElement(CircularProgress5, { size: 20 }) : loadMoreLabel
|
|
2639
2603
|
);
|
|
2640
|
-
const showLessButton = /* @__PURE__ */
|
|
2604
|
+
const showLessButton = /* @__PURE__ */ React36.createElement(
|
|
2641
2605
|
Button4,
|
|
2642
2606
|
{
|
|
2643
2607
|
...listPaginationButtonProps,
|
|
2644
2608
|
"aria-label": showLessLabel,
|
|
2645
|
-
endIcon: /* @__PURE__ */
|
|
2609
|
+
endIcon: /* @__PURE__ */ React36.createElement(CollapseIcon2, { open: true }),
|
|
2646
2610
|
fullWidth: true,
|
|
2647
2611
|
onClick: onShowLess,
|
|
2648
2612
|
sx: { flex: 1, my: 0.5 }
|
|
@@ -2650,17 +2614,18 @@ function PostListPaginationActions({
|
|
|
2650
2614
|
showLessLabel
|
|
2651
2615
|
);
|
|
2652
2616
|
if (canShowLess && canLoadMore) {
|
|
2653
|
-
return /* @__PURE__ */
|
|
2617
|
+
return /* @__PURE__ */ React36.createElement(Box10, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React36.createElement(Stack8, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
|
|
2654
2618
|
}
|
|
2655
|
-
return /* @__PURE__ */
|
|
2619
|
+
return /* @__PURE__ */ React36.createElement(Box10, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
|
|
2656
2620
|
}
|
|
2657
2621
|
|
|
2658
2622
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
2659
|
-
function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
2623
|
+
function PostsCollapsibleListContent({ isOpenByDefault = false, layout = "accordion" }) {
|
|
2624
|
+
const isFlatLayout = layout === "flat";
|
|
2660
2625
|
const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
|
|
2661
2626
|
const { registerSection, unregisterSection } = useContentPanelCoordinator();
|
|
2662
2627
|
const { clearStatusFilters, debouncedSearch, siteContentSort, statusFilters } = useSiteContentSectionToolbar();
|
|
2663
|
-
const [isOpen, setIsOpen] =
|
|
2628
|
+
const [isOpen, setIsOpen] = useState9(isFlatLayout || isOpenByDefault);
|
|
2664
2629
|
const focusAfterShowLessRef = useRef5(false);
|
|
2665
2630
|
const listTopRef = useRef5(null);
|
|
2666
2631
|
const loadMoreButtonRef = useRef5(null);
|
|
@@ -2697,7 +2662,7 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2697
2662
|
});
|
|
2698
2663
|
return () => unregisterSection(type);
|
|
2699
2664
|
}, [clearStatusFilters, registerSection, setEditMode, statusFilters, type, unregisterSection]);
|
|
2700
|
-
const filteredPosts =
|
|
2665
|
+
const filteredPosts = useMemo5(() => {
|
|
2701
2666
|
if (!posts) {
|
|
2702
2667
|
return [];
|
|
2703
2668
|
}
|
|
@@ -2722,7 +2687,7 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2722
2687
|
resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}:${siteContentSort}`,
|
|
2723
2688
|
totalCount: total
|
|
2724
2689
|
});
|
|
2725
|
-
const displayedPosts =
|
|
2690
|
+
const displayedPosts = useMemo5(
|
|
2726
2691
|
() => filteredPosts.slice(0, pagination.visibleCount),
|
|
2727
2692
|
[filteredPosts, pagination.visibleCount]
|
|
2728
2693
|
);
|
|
@@ -2747,15 +2712,18 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2747
2712
|
sectionHeaderRef.current?.focus();
|
|
2748
2713
|
}, [pagination.canLoadMore, pagination.visibleCount]);
|
|
2749
2714
|
useEffect4(() => {
|
|
2715
|
+
if (isFlatLayout) {
|
|
2716
|
+
return;
|
|
2717
|
+
}
|
|
2750
2718
|
if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
|
|
2751
2719
|
setIsOpen(true);
|
|
2752
2720
|
}
|
|
2753
|
-
}, [debouncedSearch, filteredPosts.length, statusFilters]);
|
|
2721
|
+
}, [debouncedSearch, filteredPosts.length, isFlatLayout, statusFilters]);
|
|
2754
2722
|
if (postsError) {
|
|
2755
|
-
return /* @__PURE__ */
|
|
2723
|
+
return /* @__PURE__ */ React37.createElement(ErrorState, null);
|
|
2756
2724
|
}
|
|
2757
2725
|
if (postsPending && !posts?.length) {
|
|
2758
|
-
return /* @__PURE__ */
|
|
2726
|
+
return /* @__PURE__ */ React37.createElement(Box11, { sx: { px: 2 } }, /* @__PURE__ */ React37.createElement(Box11, null, /* @__PURE__ */ React37.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React37.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React37.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React37.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
2759
2727
|
}
|
|
2760
2728
|
const displayCount = total;
|
|
2761
2729
|
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
@@ -2763,10 +2731,36 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2763
2731
|
const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
|
|
2764
2732
|
const searchAriaLabel = sprintf5(
|
|
2765
2733
|
/* translators: %s: document type plural label. */
|
|
2766
|
-
|
|
2734
|
+
__26("Search %s", "elementor"),
|
|
2767
2735
|
sectionTitle
|
|
2768
2736
|
);
|
|
2769
|
-
|
|
2737
|
+
const listBody = /* @__PURE__ */ React37.createElement(React37.Fragment, null, showNoResults && /* @__PURE__ */ React37.createElement(Box11, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React37.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __26("No results found", "elementor"))), /* @__PURE__ */ React37.createElement(Box11, { ref: listTopRef }), displayedPosts.map((post) => {
|
|
2738
|
+
return /* @__PURE__ */ React37.createElement(PostListItem, { key: post.id, post });
|
|
2739
|
+
}), !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React37.createElement(PostListItem, null), /* @__PURE__ */ React37.createElement(
|
|
2740
|
+
PostListPaginationActions,
|
|
2741
|
+
{
|
|
2742
|
+
canLoadMore: pagination.canLoadMore,
|
|
2743
|
+
canShowLess: pagination.canShowLess,
|
|
2744
|
+
isLoadingMore: isFetchingNextPage,
|
|
2745
|
+
loadMoreButtonRef,
|
|
2746
|
+
onLoadMore: pagination.handleLoadMore,
|
|
2747
|
+
onShowLess: handleShowLess
|
|
2748
|
+
}
|
|
2749
|
+
));
|
|
2750
|
+
const flatSectionAddAction = isTrashFilter ? void 0 : /* @__PURE__ */ React37.createElement(SectionAddButton, null);
|
|
2751
|
+
const accordionSectionAddAction = isTrashFilter ? void 0 : /* @__PURE__ */ React37.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) });
|
|
2752
|
+
const sectionToolbar = /* @__PURE__ */ React37.createElement(
|
|
2753
|
+
ContentPanelSectionToolbar,
|
|
2754
|
+
{
|
|
2755
|
+
addAction: isFlatLayout ? flatSectionAddAction : accordionSectionAddAction,
|
|
2756
|
+
actionsInHeader: isFlatLayout,
|
|
2757
|
+
searchAriaLabel
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
if (isFlatLayout) {
|
|
2761
|
+
return /* @__PURE__ */ React37.createElement(Box11, { sx: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0, width: "100%" } }, sectionToolbar, /* @__PURE__ */ React37.createElement(Box11, { sx: { flex: 1, minHeight: 0, overflow: "auto" } }, listBody));
|
|
2762
|
+
}
|
|
2763
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2770
2764
|
CollapsibleList,
|
|
2771
2765
|
{
|
|
2772
2766
|
count: displayCount,
|
|
@@ -2774,45 +2768,150 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2774
2768
|
headerRef: sectionHeaderRef,
|
|
2775
2769
|
isOpen,
|
|
2776
2770
|
onOpenChange: setIsOpen,
|
|
2777
|
-
sectionToolbar
|
|
2778
|
-
ContentPanelSectionToolbar,
|
|
2779
|
-
{
|
|
2780
|
-
addAction: isTrashFilter ? void 0 : /* @__PURE__ */ React39.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) }),
|
|
2781
|
-
searchAriaLabel
|
|
2782
|
-
}
|
|
2783
|
-
),
|
|
2771
|
+
sectionToolbar,
|
|
2784
2772
|
title: sectionTitle
|
|
2785
2773
|
},
|
|
2786
|
-
|
|
2787
|
-
/* @__PURE__ */ React39.createElement(Box11, { ref: listTopRef }),
|
|
2788
|
-
displayedPosts.map((post) => {
|
|
2789
|
-
return /* @__PURE__ */ React39.createElement(PostListItem, { key: post.id, post });
|
|
2790
|
-
}),
|
|
2791
|
-
!isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React39.createElement(PostListItem, null),
|
|
2792
|
-
/* @__PURE__ */ React39.createElement(
|
|
2793
|
-
PostListPaginationActions,
|
|
2794
|
-
{
|
|
2795
|
-
canLoadMore: pagination.canLoadMore,
|
|
2796
|
-
canShowLess: pagination.canShowLess,
|
|
2797
|
-
isLoadingMore: isFetchingNextPage,
|
|
2798
|
-
loadMoreButtonRef,
|
|
2799
|
-
onLoadMore: pagination.handleLoadMore,
|
|
2800
|
-
onShowLess: handleShowLess
|
|
2801
|
-
}
|
|
2802
|
-
)
|
|
2774
|
+
listBody
|
|
2803
2775
|
);
|
|
2804
2776
|
}
|
|
2805
2777
|
function PostsCollapsibleList(props) {
|
|
2806
2778
|
const { type } = usePostListContext();
|
|
2807
|
-
|
|
2779
|
+
const isFlatLayout = props.layout === "flat";
|
|
2780
|
+
const content = /* @__PURE__ */ React37.createElement(PostsCollapsibleListContent, { ...props });
|
|
2781
|
+
if (isFlatLayout) {
|
|
2782
|
+
return content;
|
|
2783
|
+
}
|
|
2784
|
+
return /* @__PURE__ */ React37.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [type] }, content);
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
// src/components/panel/site-content-home.tsx
|
|
2788
|
+
import * as React38 from "react";
|
|
2789
|
+
import { ChevronRightIcon, PageTypeIcon as PageTypeIcon3, PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
|
|
2790
|
+
import { Box as Box12, Chip as Chip4, Rotate, Skeleton as Skeleton2, Stack as Stack9, Typography as Typography8, useTheme } from "@elementor/ui";
|
|
2791
|
+
import { __ as __27 } from "@wordpress/i18n";
|
|
2792
|
+
|
|
2793
|
+
// src/site-content-panel-sections.ts
|
|
2794
|
+
function getSiteContentPanelSectionDescriptors(accessiblePostTypes) {
|
|
2795
|
+
const postTypeSections = accessiblePostTypes.map((slug) => ({
|
|
2796
|
+
id: slug,
|
|
2797
|
+
label: postTypesMap[slug].labels.plural_name
|
|
2798
|
+
}));
|
|
2799
|
+
const registeredSections2 = getSiteContentSections().map((section) => ({
|
|
2800
|
+
id: section.id,
|
|
2801
|
+
label: section.label ?? section.id
|
|
2802
|
+
}));
|
|
2803
|
+
return [...postTypeSections, ...registeredSections2];
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
// src/utils/keyboard-click.ts
|
|
2807
|
+
function onKeyboardClick(callback) {
|
|
2808
|
+
return (event) => {
|
|
2809
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2810
|
+
event.preventDefault();
|
|
2811
|
+
callback();
|
|
2812
|
+
}
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// src/components/panel/site-content-home.tsx
|
|
2817
|
+
var POST_TYPE_ICONS = {
|
|
2818
|
+
page: PageTypeIcon3,
|
|
2819
|
+
post: PostTypeIcon3
|
|
2820
|
+
};
|
|
2821
|
+
var POST_TYPE_SUBTITLES = {
|
|
2822
|
+
page: __27("Website pages", "elementor"),
|
|
2823
|
+
post: __27("Blog & articles", "elementor")
|
|
2824
|
+
};
|
|
2825
|
+
function SiteContentHome({ accessiblePostTypes, onSelect }) {
|
|
2826
|
+
const isRtl = "rtl" === useTheme().direction;
|
|
2827
|
+
const items = getSiteContentPanelSectionDescriptors(accessiblePostTypes).map((descriptor) => {
|
|
2828
|
+
const isPostType = descriptor.id in postTypesMap;
|
|
2829
|
+
if (isPostType) {
|
|
2830
|
+
const slug = descriptor.id;
|
|
2831
|
+
const Icon = POST_TYPE_ICONS[slug];
|
|
2832
|
+
return {
|
|
2833
|
+
id: descriptor.id,
|
|
2834
|
+
title: descriptor.label,
|
|
2835
|
+
description: POST_TYPE_SUBTITLES[slug],
|
|
2836
|
+
icon: /* @__PURE__ */ React38.createElement(Icon, { fontSize: "small", color: "action" }),
|
|
2837
|
+
isPostType: true
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2840
|
+
const RegisteredIcon = getIconsMap()[descriptor.id] ?? PageTypeIcon3;
|
|
2841
|
+
const registeredSection = getSiteContentSectionById(descriptor.id);
|
|
2842
|
+
return {
|
|
2843
|
+
description: registeredSection?.description,
|
|
2844
|
+
hubCount: registeredSection?.renderHubCount?.(),
|
|
2845
|
+
id: descriptor.id,
|
|
2846
|
+
title: descriptor.label,
|
|
2847
|
+
icon: /* @__PURE__ */ React38.createElement(RegisteredIcon, { fontSize: "small", color: "action" }),
|
|
2848
|
+
isPostType: false
|
|
2849
|
+
};
|
|
2850
|
+
});
|
|
2851
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2852
|
+
Stack9,
|
|
2853
|
+
{
|
|
2854
|
+
role: "list",
|
|
2855
|
+
"aria-label": __27("Site content sections", "elementor"),
|
|
2856
|
+
sx: {
|
|
2857
|
+
flex: 1,
|
|
2858
|
+
minHeight: 0,
|
|
2859
|
+
overflow: "auto",
|
|
2860
|
+
px: 2,
|
|
2861
|
+
py: 1.5,
|
|
2862
|
+
gap: 1
|
|
2863
|
+
}
|
|
2864
|
+
},
|
|
2865
|
+
items.map((item) => /* @__PURE__ */ React38.createElement(Box12, { key: item.id, role: "listitem" }, /* @__PURE__ */ React38.createElement(HomeRow, { ...item, isRtl, onSelect: () => onSelect(item.id) })))
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
function HomeRow({ hubCount, title, description, icon, id, isPostType, isRtl, onSelect }) {
|
|
2869
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2870
|
+
Box12,
|
|
2871
|
+
{
|
|
2872
|
+
role: "button",
|
|
2873
|
+
tabIndex: 0,
|
|
2874
|
+
"aria-label": title,
|
|
2875
|
+
onClick: onSelect,
|
|
2876
|
+
onKeyDown: onKeyboardClick(onSelect),
|
|
2877
|
+
sx: {
|
|
2878
|
+
display: "flex",
|
|
2879
|
+
alignItems: "center",
|
|
2880
|
+
gap: 1.5,
|
|
2881
|
+
px: 1.5,
|
|
2882
|
+
py: 1.25,
|
|
2883
|
+
cursor: "pointer",
|
|
2884
|
+
borderRadius: 1,
|
|
2885
|
+
border: 1,
|
|
2886
|
+
borderColor: "divider",
|
|
2887
|
+
"&:hover": { bgcolor: "action.hover" },
|
|
2888
|
+
outline: "none",
|
|
2889
|
+
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
2890
|
+
}
|
|
2891
|
+
},
|
|
2892
|
+
icon,
|
|
2893
|
+
/* @__PURE__ */ React38.createElement(Stack9, { sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React38.createElement(Typography8, { variant: "body2", fontWeight: "bold" }, title), description ? /* @__PURE__ */ React38.createElement(Typography8, { variant: "caption", color: "text.secondary" }, description) : null),
|
|
2894
|
+
isPostType ? /* @__PURE__ */ React38.createElement(HubCountBadge, { postTypeSlug: id }) : hubCount,
|
|
2895
|
+
/* @__PURE__ */ React38.createElement(Rotate, { in: isRtl }, /* @__PURE__ */ React38.createElement(ChevronRightIcon, { fontSize: "small", color: "action" }))
|
|
2896
|
+
);
|
|
2897
|
+
}
|
|
2898
|
+
function HubCountBadge({ postTypeSlug }) {
|
|
2899
|
+
const { data, isPending } = usePostsBaselineTotal(postTypeSlug, true, "any");
|
|
2900
|
+
if (isPending) {
|
|
2901
|
+
return /* @__PURE__ */ React38.createElement(Skeleton2, { variant: "circular", width: 24, height: 24 });
|
|
2902
|
+
}
|
|
2903
|
+
if (data === void 0) {
|
|
2904
|
+
return null;
|
|
2905
|
+
}
|
|
2906
|
+
return /* @__PURE__ */ React38.createElement(Chip4, { size: "tiny", variant: "default", label: String(data) });
|
|
2808
2907
|
}
|
|
2809
2908
|
|
|
2810
2909
|
// src/components/panel/user-load-error.tsx
|
|
2811
|
-
import * as
|
|
2812
|
-
import { Box as
|
|
2910
|
+
import * as React39 from "react";
|
|
2911
|
+
import { Box as Box13, Typography as Typography9 } from "@elementor/ui";
|
|
2813
2912
|
import { __ as __28 } from "@wordpress/i18n";
|
|
2814
2913
|
function UserLoadError() {
|
|
2815
|
-
return /* @__PURE__ */
|
|
2914
|
+
return /* @__PURE__ */ React39.createElement(Box13, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React39.createElement(Typography9, { variant: "body2", color: "text.secondary" }, __28(
|
|
2816
2915
|
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
2817
2916
|
"elementor"
|
|
2818
2917
|
)));
|
|
@@ -2821,57 +2920,143 @@ function UserLoadError() {
|
|
|
2821
2920
|
// src/components/panel/shell-panel-body-content.tsx
|
|
2822
2921
|
function ShellPanelBodyContent({
|
|
2823
2922
|
accessiblePostTypes,
|
|
2923
|
+
currentView,
|
|
2824
2924
|
isUserPending,
|
|
2825
|
-
|
|
2925
|
+
onSelectSection,
|
|
2826
2926
|
showUserLoadError
|
|
2827
2927
|
}) {
|
|
2828
2928
|
if (isUserPending) {
|
|
2829
|
-
return /* @__PURE__ */
|
|
2929
|
+
return /* @__PURE__ */ React40.createElement(Stack10, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React40.createElement(Skeleton3, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React40.createElement(Skeleton3, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
2830
2930
|
}
|
|
2831
2931
|
if (showUserLoadError) {
|
|
2832
|
-
return /* @__PURE__ */
|
|
2932
|
+
return /* @__PURE__ */ React40.createElement(UserLoadError, null);
|
|
2833
2933
|
}
|
|
2834
|
-
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
accessiblePostTypes
|
|
2838
|
-
onListError
|
|
2839
|
-
}) {
|
|
2840
|
-
const { isSectionVisible } = useSiteContentPanelSectionsFilter();
|
|
2934
|
+
if (currentView === null) {
|
|
2935
|
+
return /* @__PURE__ */ React40.createElement(SiteContentHome, { accessiblePostTypes, onSelect: onSelectSection });
|
|
2936
|
+
}
|
|
2937
|
+
const isPostTypeSection = accessiblePostTypes.includes(currentView);
|
|
2841
2938
|
const extraSections = getSiteContentSections();
|
|
2842
|
-
const
|
|
2843
|
-
|
|
2844
|
-
|
|
2939
|
+
const registeredSection = extraSections.find((section) => section.id === currentView);
|
|
2940
|
+
if (isPostTypeSection) {
|
|
2941
|
+
return /* @__PURE__ */ React40.createElement(PostsCollapsibleList, { layout: "flat" });
|
|
2942
|
+
}
|
|
2943
|
+
if (registeredSection) {
|
|
2944
|
+
return /* @__PURE__ */ React40.createElement(Box14, { sx: { width: "100%", flex: 1, minHeight: 0 } }, registeredSection.render());
|
|
2945
|
+
}
|
|
2946
|
+
return /* @__PURE__ */ React40.createElement(SiteContentHome, { accessiblePostTypes, onSelect: onSelectSection });
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
// src/components/panel/site-content-section-header.tsx
|
|
2950
|
+
import * as React41 from "react";
|
|
2951
|
+
import { ArrowLeftIcon, PageTypeIcon as PageTypeIcon4, PostTypeIcon as PostTypeIcon4 } from "@elementor/icons";
|
|
2952
|
+
import { IconButton as IconButton5, Rotate as Rotate2, Stack as Stack11, Typography as Typography10, useTheme as useTheme2 } from "@elementor/ui";
|
|
2953
|
+
import { __ as __29 } from "@wordpress/i18n";
|
|
2954
|
+
var POST_TYPE_ICONS2 = {
|
|
2955
|
+
page: PageTypeIcon4,
|
|
2956
|
+
post: PostTypeIcon4
|
|
2957
|
+
};
|
|
2958
|
+
function getSectionTitle(sectionId) {
|
|
2959
|
+
if (sectionId in postTypesMap) {
|
|
2960
|
+
return postTypesMap[sectionId].labels.plural_name;
|
|
2961
|
+
}
|
|
2962
|
+
const registered = getSiteContentSections().find((section) => section.id === sectionId);
|
|
2963
|
+
return registered?.label ?? sectionId;
|
|
2964
|
+
}
|
|
2965
|
+
function getSectionIcon(sectionId) {
|
|
2966
|
+
if (sectionId in POST_TYPE_ICONS2) {
|
|
2967
|
+
return POST_TYPE_ICONS2[sectionId];
|
|
2968
|
+
}
|
|
2969
|
+
return getIconsMap()[sectionId] ?? PageTypeIcon4;
|
|
2970
|
+
}
|
|
2971
|
+
function SiteContentSectionHeader({ sectionId, onBack }) {
|
|
2972
|
+
const isRtl = "rtl" === useTheme2().direction;
|
|
2973
|
+
const Icon = getSectionIcon(sectionId);
|
|
2974
|
+
return /* @__PURE__ */ React41.createElement(Stack11, { direction: "row", alignItems: "center", spacing: 0.5, sx: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ React41.createElement(
|
|
2975
|
+
IconButton5,
|
|
2976
|
+
{
|
|
2977
|
+
size: "small",
|
|
2978
|
+
"aria-label": __29("Back", "elementor"),
|
|
2979
|
+
onClick: onBack,
|
|
2980
|
+
sx: { flexShrink: 0 }
|
|
2981
|
+
},
|
|
2982
|
+
/* @__PURE__ */ React41.createElement(Rotate2, { in: isRtl }, /* @__PURE__ */ React41.createElement(ArrowLeftIcon, { fontSize: "small" }))
|
|
2983
|
+
), /* @__PURE__ */ React41.createElement(Icon, { fontSize: "small", color: "action" }), /* @__PURE__ */ React41.createElement(Typography10, { variant: "subtitle2", fontWeight: "bold", noWrap: true, sx: { flex: 1, minWidth: 0 } }, getSectionTitle(sectionId)));
|
|
2845
2984
|
}
|
|
2846
2985
|
|
|
2847
2986
|
// src/components/panel/shell.tsx
|
|
2987
|
+
function isPostTypeSectionView(view, accessiblePostTypes) {
|
|
2988
|
+
return view !== null && accessiblePostTypes.includes(view);
|
|
2989
|
+
}
|
|
2848
2990
|
var Shell = () => {
|
|
2849
2991
|
const sidebarPanelChrome = isSidebarEnabled();
|
|
2850
|
-
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] =
|
|
2992
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState10(false);
|
|
2851
2993
|
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
2852
|
-
|
|
2853
|
-
|
|
2994
|
+
const [currentView, setCurrentView] = useState10(() => getInitialSiteContentView());
|
|
2995
|
+
const clearPendingCreateRef = useRef6();
|
|
2996
|
+
const openSection = useCallback5((sectionId) => {
|
|
2997
|
+
clearPendingCreateRef.current?.();
|
|
2998
|
+
setCurrentView(sectionId);
|
|
2999
|
+
notifySiteContentViewChange(sectionId);
|
|
3000
|
+
}, []);
|
|
3001
|
+
const goHome = useCallback5(() => {
|
|
3002
|
+
clearPendingCreateRef.current?.();
|
|
3003
|
+
setCurrentView(null);
|
|
3004
|
+
notifySiteContentViewChange(null);
|
|
3005
|
+
}, []);
|
|
3006
|
+
useEffect5(() => {
|
|
3007
|
+
notifySiteContentViewChange(currentView);
|
|
3008
|
+
}, [currentView]);
|
|
3009
|
+
const showHome = currentView === null;
|
|
3010
|
+
const postTypeSection = isPostTypeSectionView(currentView, accessiblePostTypes);
|
|
3011
|
+
const registeredSection = currentView ? getSiteContentSectionById(currentView) : void 0;
|
|
3012
|
+
const usesDrillInToolbarShell = postTypeSection || Boolean(registeredSection?.usesDrillInToolbarShell);
|
|
3013
|
+
const panel2 = /* @__PURE__ */ React42.createElement(Panel, null, /* @__PURE__ */ React42.createElement(PanelHeader, null, /* @__PURE__ */ React42.createElement(
|
|
3014
|
+
Stack12,
|
|
2854
3015
|
{
|
|
2855
3016
|
alignItems: "center",
|
|
2856
3017
|
direction: "row",
|
|
2857
3018
|
spacing: 0.5,
|
|
3019
|
+
sx: getContentPanelShellHeaderStackSx(sidebarPanelChrome)
|
|
3020
|
+
},
|
|
3021
|
+
showHome ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __30("Site content", "elementor")), /* @__PURE__ */ React42.createElement(ContentPanelHeaderAdd, null)) : /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(SiteContentSectionHeader, { sectionId: currentView, onBack: goHome }), usesDrillInToolbarShell ? /* @__PURE__ */ React42.createElement(ContentPanelSectionHeaderActions, null) : null)
|
|
3022
|
+
)), /* @__PURE__ */ React42.createElement(Divider8, null), /* @__PURE__ */ React42.createElement(
|
|
3023
|
+
PanelBody,
|
|
3024
|
+
{
|
|
2858
3025
|
sx: {
|
|
2859
|
-
|
|
2860
|
-
|
|
3026
|
+
display: "flex",
|
|
3027
|
+
flexDirection: "column",
|
|
3028
|
+
height: "100%",
|
|
3029
|
+
overflow: "hidden",
|
|
3030
|
+
minHeight: 0
|
|
2861
3031
|
}
|
|
2862
3032
|
},
|
|
2863
|
-
/* @__PURE__ */ React42.createElement(
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
3033
|
+
/* @__PURE__ */ React42.createElement(Box15, { sx: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0, overflow: "hidden" } }, /* @__PURE__ */ React42.createElement(
|
|
3034
|
+
ShellPanelBodyContent,
|
|
3035
|
+
{
|
|
3036
|
+
accessiblePostTypes,
|
|
3037
|
+
currentView,
|
|
3038
|
+
isUserPending,
|
|
3039
|
+
onSelectSection: openSection,
|
|
3040
|
+
showUserLoadError
|
|
3041
|
+
}
|
|
3042
|
+
)),
|
|
3043
|
+
/* @__PURE__ */ React42.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) })
|
|
3044
|
+
));
|
|
3045
|
+
const panelWithProviders = (() => {
|
|
3046
|
+
let resolvedPanel = registeredSection?.wrapDrillInPanel ? registeredSection.wrapDrillInPanel(panel2) : panel2;
|
|
3047
|
+
if (postTypeSection) {
|
|
3048
|
+
resolvedPanel = /* @__PURE__ */ React42.createElement(PostListContextProvider, { type: currentView, setError: () => setIsErrorSnackbarOpen(true) }, /* @__PURE__ */ React42.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [currentView] }, resolvedPanel));
|
|
2873
3049
|
}
|
|
2874
|
-
|
|
3050
|
+
return resolvedPanel;
|
|
3051
|
+
})();
|
|
3052
|
+
return /* @__PURE__ */ React42.createElement(
|
|
3053
|
+
ContentPanelCoordinatorProvider,
|
|
3054
|
+
{
|
|
3055
|
+
clearPendingCreateRef,
|
|
3056
|
+
onNavigateToSection: openSection
|
|
3057
|
+
},
|
|
3058
|
+
panelWithProviders
|
|
3059
|
+
);
|
|
2875
3060
|
};
|
|
2876
3061
|
var shell_default = Shell;
|
|
2877
3062
|
|
|
@@ -2896,25 +3081,25 @@ import {
|
|
|
2896
3081
|
ListItemText as ListItemText9,
|
|
2897
3082
|
ListSubheader,
|
|
2898
3083
|
Menu as Menu3,
|
|
2899
|
-
MenuItem as
|
|
2900
|
-
usePopupState as
|
|
3084
|
+
MenuItem as MenuItem8,
|
|
3085
|
+
usePopupState as usePopupState5
|
|
2901
3086
|
} from "@elementor/ui";
|
|
2902
|
-
import { __ as
|
|
3087
|
+
import { __ as __32 } from "@wordpress/i18n";
|
|
2903
3088
|
|
|
2904
3089
|
// src/components/top-bar/create-post-list-item.tsx
|
|
2905
3090
|
import * as React43 from "react";
|
|
2906
3091
|
import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
|
|
2907
3092
|
import { useMixpanel } from "@elementor/events";
|
|
2908
3093
|
import { PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
2909
|
-
import { CircularProgress as CircularProgress6, ListItemIcon as ListItemIcon4, ListItemText as ListItemText7, MenuItem as
|
|
2910
|
-
import { __ as
|
|
3094
|
+
import { CircularProgress as CircularProgress6, ListItemIcon as ListItemIcon4, ListItemText as ListItemText7, MenuItem as MenuItem6 } from "@elementor/ui";
|
|
3095
|
+
import { __ as __31 } from "@wordpress/i18n";
|
|
2911
3096
|
|
|
2912
3097
|
// src/hooks/use-create-page.ts
|
|
2913
|
-
import { useState as
|
|
3098
|
+
import { useState as useState11 } from "react";
|
|
2914
3099
|
import apiFetch5 from "@wordpress/api-fetch";
|
|
2915
3100
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
2916
3101
|
function useCreatePage() {
|
|
2917
|
-
const [isLoading, setIsLoading] =
|
|
3102
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
2918
3103
|
return {
|
|
2919
3104
|
create: () => {
|
|
2920
3105
|
setIsLoading(true);
|
|
@@ -2938,7 +3123,7 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2938
3123
|
const { data: user } = useUser();
|
|
2939
3124
|
const { dispatchEvent, config } = useMixpanel();
|
|
2940
3125
|
return /* @__PURE__ */ React43.createElement(
|
|
2941
|
-
|
|
3126
|
+
MenuItem6,
|
|
2942
3127
|
{
|
|
2943
3128
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
2944
3129
|
onClick: async () => {
|
|
@@ -2966,7 +3151,7 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2966
3151
|
ListItemText7,
|
|
2967
3152
|
{
|
|
2968
3153
|
primaryTypographyProps: { variant: "body2" },
|
|
2969
|
-
primary:
|
|
3154
|
+
primary: __31("Add new page", "elementor")
|
|
2970
3155
|
}
|
|
2971
3156
|
)
|
|
2972
3157
|
);
|
|
@@ -2974,11 +3159,11 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2974
3159
|
|
|
2975
3160
|
// src/components/top-bar/indicator.tsx
|
|
2976
3161
|
import * as React44 from "react";
|
|
2977
|
-
import { Stack as
|
|
3162
|
+
import { Stack as Stack13, Tooltip as BaseTooltip, Typography as Typography11 } from "@elementor/ui";
|
|
2978
3163
|
function Indicator({ title, status }) {
|
|
2979
|
-
return /* @__PURE__ */ React44.createElement(
|
|
3164
|
+
return /* @__PURE__ */ React44.createElement(Tooltip5, { title }, /* @__PURE__ */ React44.createElement(Stack13, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React44.createElement(Typography11, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React44.createElement(Typography11, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
2980
3165
|
}
|
|
2981
|
-
function
|
|
3166
|
+
function Tooltip5(props) {
|
|
2982
3167
|
return /* @__PURE__ */ React44.createElement(
|
|
2983
3168
|
BaseTooltip,
|
|
2984
3169
|
{
|
|
@@ -2998,18 +3183,18 @@ function Tooltip6(props) {
|
|
|
2998
3183
|
import * as React46 from "react";
|
|
2999
3184
|
import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
|
|
3000
3185
|
import { useMixpanel as useMixpanel2 } from "@elementor/events";
|
|
3001
|
-
import { ListItemText as ListItemText8, MenuItem as
|
|
3186
|
+
import { ListItemText as ListItemText8, MenuItem as MenuItem7 } from "@elementor/ui";
|
|
3002
3187
|
|
|
3003
3188
|
// src/components/top-bar/chip-doc-type.tsx
|
|
3004
3189
|
import * as React45 from "react";
|
|
3005
|
-
import { PostTypeIcon as
|
|
3006
|
-
import { Chip as
|
|
3190
|
+
import { PostTypeIcon as PostTypeIcon5 } from "@elementor/icons";
|
|
3191
|
+
import { Chip as Chip5 } from "@elementor/ui";
|
|
3007
3192
|
var iconsMap2 = getIconsMap();
|
|
3008
3193
|
function DocTypeChip({ postType, docType, label }) {
|
|
3009
3194
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
3010
|
-
const Icon = iconsMap2[docType] ||
|
|
3195
|
+
const Icon = iconsMap2[docType] || PostTypeIcon5;
|
|
3011
3196
|
return /* @__PURE__ */ React45.createElement(
|
|
3012
|
-
|
|
3197
|
+
Chip5,
|
|
3013
3198
|
{
|
|
3014
3199
|
component: "span",
|
|
3015
3200
|
size: "small",
|
|
@@ -3029,7 +3214,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
3029
3214
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
3030
3215
|
const { dispatchEvent, config } = useMixpanel2();
|
|
3031
3216
|
return /* @__PURE__ */ React46.createElement(
|
|
3032
|
-
|
|
3217
|
+
MenuItem7,
|
|
3033
3218
|
{
|
|
3034
3219
|
disabled: !post.user_can.edit,
|
|
3035
3220
|
onClick: async () => {
|
|
@@ -3076,7 +3261,7 @@ function RecentlyEdited() {
|
|
|
3076
3261
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
3077
3262
|
};
|
|
3078
3263
|
const recentPosts = getRecentPosts();
|
|
3079
|
-
const popupState =
|
|
3264
|
+
const popupState = usePopupState5({
|
|
3080
3265
|
variant: "popover",
|
|
3081
3266
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
3082
3267
|
});
|
|
@@ -3114,20 +3299,20 @@ function RecentlyEdited() {
|
|
|
3114
3299
|
Menu3,
|
|
3115
3300
|
{
|
|
3116
3301
|
MenuListProps: {
|
|
3117
|
-
subheader: /* @__PURE__ */ React47.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } },
|
|
3302
|
+
subheader: /* @__PURE__ */ React47.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __32("Recent", "elementor"))
|
|
3118
3303
|
},
|
|
3119
3304
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
3120
3305
|
...bindMenu3(popupState)
|
|
3121
3306
|
},
|
|
3122
3307
|
recentPosts.map((post) => /* @__PURE__ */ React47.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
3123
|
-
recentPosts.length === 0 && /* @__PURE__ */ React47.createElement(
|
|
3308
|
+
recentPosts.length === 0 && /* @__PURE__ */ React47.createElement(MenuItem8, { disabled: true }, /* @__PURE__ */ React47.createElement(
|
|
3124
3309
|
ListItemText9,
|
|
3125
3310
|
{
|
|
3126
3311
|
primaryTypographyProps: {
|
|
3127
3312
|
variant: "caption",
|
|
3128
3313
|
fontStyle: "italic"
|
|
3129
3314
|
},
|
|
3130
|
-
primary:
|
|
3315
|
+
primary: __32("There are no other pages or templates on this site yet.", "elementor")
|
|
3131
3316
|
}
|
|
3132
3317
|
)),
|
|
3133
3318
|
/* @__PURE__ */ React47.createElement(Divider9, { disabled: recentPosts.length === 0 }),
|
|
@@ -3137,12 +3322,12 @@ function RecentlyEdited() {
|
|
|
3137
3322
|
|
|
3138
3323
|
// src/hooks/use-toggle-button-props.ts
|
|
3139
3324
|
import { PagesIcon } from "@elementor/icons";
|
|
3140
|
-
import { __ as
|
|
3325
|
+
import { __ as __33 } from "@wordpress/i18n";
|
|
3141
3326
|
function useToggleButtonProps() {
|
|
3142
3327
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
3143
3328
|
const { open, close } = usePanelActions();
|
|
3144
3329
|
return {
|
|
3145
|
-
title:
|
|
3330
|
+
title: __33("Site content", "elementor"),
|
|
3146
3331
|
icon: PagesIcon,
|
|
3147
3332
|
onClick: () => {
|
|
3148
3333
|
const extendedWindow = window;
|
|
@@ -3187,12 +3372,12 @@ function registerButton() {
|
|
|
3187
3372
|
|
|
3188
3373
|
// src/components/panel/popups/popup-section-add-button.tsx
|
|
3189
3374
|
import * as React48 from "react";
|
|
3190
|
-
import { forwardRef as forwardRef2, useCallback as useCallback6, useImperativeHandle as useImperativeHandle2, useRef as
|
|
3191
|
-
import { Stack as
|
|
3192
|
-
import { __ as
|
|
3375
|
+
import { forwardRef as forwardRef2, useCallback as useCallback6, useImperativeHandle as useImperativeHandle2, useRef as useRef7 } from "react";
|
|
3376
|
+
import { Stack as Stack14 } from "@elementor/ui";
|
|
3377
|
+
import { __ as __34, sprintf as sprintf6 } from "@wordpress/i18n";
|
|
3193
3378
|
var PopupSectionAddButton = forwardRef2(
|
|
3194
3379
|
({ disabled, onBeforeCreate, onCreate }, ref) => {
|
|
3195
|
-
const promotionRef =
|
|
3380
|
+
const promotionRef = useRef7(null);
|
|
3196
3381
|
const canCreate = env.popups?.can_use ?? false;
|
|
3197
3382
|
const togglePromotion = useCallback6(() => {
|
|
3198
3383
|
promotionRef.current?.toggle();
|
|
@@ -3200,8 +3385,8 @@ var PopupSectionAddButton = forwardRef2(
|
|
|
3200
3385
|
useImperativeHandle2(ref, () => ({ togglePromotion }), [togglePromotion]);
|
|
3201
3386
|
const ariaLabel = sprintf6(
|
|
3202
3387
|
/* translators: %s: Document type singular name. */
|
|
3203
|
-
|
|
3204
|
-
|
|
3388
|
+
__34("New %s", "elementor"),
|
|
3389
|
+
__34("Popup", "elementor")
|
|
3205
3390
|
);
|
|
3206
3391
|
if (canCreate) {
|
|
3207
3392
|
return /* @__PURE__ */ React48.createElement(
|
|
@@ -3218,7 +3403,7 @@ var PopupSectionAddButton = forwardRef2(
|
|
|
3218
3403
|
);
|
|
3219
3404
|
}
|
|
3220
3405
|
return /* @__PURE__ */ React48.createElement(
|
|
3221
|
-
|
|
3406
|
+
Stack14,
|
|
3222
3407
|
{
|
|
3223
3408
|
alignItems: "center",
|
|
3224
3409
|
direction: "row",
|
|
@@ -3255,11 +3440,14 @@ export {
|
|
|
3255
3440
|
contentPanelListRowPaddingSx,
|
|
3256
3441
|
env,
|
|
3257
3442
|
extendIconsMap,
|
|
3443
|
+
getActiveSiteContentView,
|
|
3258
3444
|
getContentPanelListItemRowStateSx,
|
|
3259
3445
|
getContentPanelListItemSx,
|
|
3446
|
+
getInitialSiteContentView,
|
|
3260
3447
|
getRestOrderForSiteContentSort,
|
|
3261
3448
|
getRestStatusForSiteContentFilters,
|
|
3262
3449
|
getSiteContentHeaderCreateItems,
|
|
3450
|
+
getSiteContentSectionById,
|
|
3263
3451
|
getSiteContentSections,
|
|
3264
3452
|
getSiteContentStatusFilterForCount,
|
|
3265
3453
|
hasActiveSiteContentStatusFilters,
|
|
@@ -3267,11 +3455,14 @@ export {
|
|
|
3267
3455
|
injectIntoSiteContentListItemActions,
|
|
3268
3456
|
isSiteContentListNarrowed,
|
|
3269
3457
|
isSiteContentTrashFilterActive,
|
|
3458
|
+
notifySiteContentViewChange,
|
|
3270
3459
|
registerSiteContentHeaderCreateItem,
|
|
3271
3460
|
registerSiteContentSection,
|
|
3272
3461
|
resetSiteContentHeaderCreateItems,
|
|
3273
3462
|
resetSiteContentSections,
|
|
3274
3463
|
serializeSiteContentStatusFilters,
|
|
3464
|
+
setPendingSiteContentHome,
|
|
3465
|
+
setPendingSiteContentSection,
|
|
3275
3466
|
useContentPanelCoordinator,
|
|
3276
3467
|
usePostListPagination,
|
|
3277
3468
|
useSiteContentSectionToolbar
|