@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.js
CHANGED
|
@@ -50,11 +50,14 @@ __export(index_exports, {
|
|
|
50
50
|
contentPanelListRowPaddingSx: () => contentPanelListRowPaddingSx,
|
|
51
51
|
env: () => env,
|
|
52
52
|
extendIconsMap: () => extendIconsMap,
|
|
53
|
+
getActiveSiteContentView: () => getActiveSiteContentView,
|
|
53
54
|
getContentPanelListItemRowStateSx: () => getContentPanelListItemRowStateSx,
|
|
54
55
|
getContentPanelListItemSx: () => getContentPanelListItemSx,
|
|
56
|
+
getInitialSiteContentView: () => getInitialSiteContentView,
|
|
55
57
|
getRestOrderForSiteContentSort: () => getRestOrderForSiteContentSort,
|
|
56
58
|
getRestStatusForSiteContentFilters: () => getRestStatusForSiteContentFilters,
|
|
57
59
|
getSiteContentHeaderCreateItems: () => getSiteContentHeaderCreateItems,
|
|
60
|
+
getSiteContentSectionById: () => getSiteContentSectionById,
|
|
58
61
|
getSiteContentSections: () => getSiteContentSections,
|
|
59
62
|
getSiteContentStatusFilterForCount: () => getSiteContentStatusFilterForCount,
|
|
60
63
|
hasActiveSiteContentStatusFilters: () => hasActiveSiteContentStatusFilters,
|
|
@@ -62,11 +65,14 @@ __export(index_exports, {
|
|
|
62
65
|
injectIntoSiteContentListItemActions: () => injectIntoSiteContentListItemActions,
|
|
63
66
|
isSiteContentListNarrowed: () => isSiteContentListNarrowed,
|
|
64
67
|
isSiteContentTrashFilterActive: () => isSiteContentTrashFilterActive,
|
|
68
|
+
notifySiteContentViewChange: () => notifySiteContentViewChange,
|
|
65
69
|
registerSiteContentHeaderCreateItem: () => registerSiteContentHeaderCreateItem,
|
|
66
70
|
registerSiteContentSection: () => registerSiteContentSection,
|
|
67
71
|
resetSiteContentHeaderCreateItems: () => resetSiteContentHeaderCreateItems,
|
|
68
72
|
resetSiteContentSections: () => resetSiteContentSections,
|
|
69
73
|
serializeSiteContentStatusFilters: () => serializeSiteContentStatusFilters,
|
|
74
|
+
setPendingSiteContentHome: () => setPendingSiteContentHome,
|
|
75
|
+
setPendingSiteContentSection: () => setPendingSiteContentSection,
|
|
70
76
|
useContentPanelCoordinator: () => useContentPanelCoordinator,
|
|
71
77
|
usePostListPagination: () => usePostListPagination,
|
|
72
78
|
useSiteContentSectionToolbar: () => useSiteContentSectionToolbar
|
|
@@ -100,39 +106,78 @@ var import_editor_panels2 = require("@elementor/editor-panels");
|
|
|
100
106
|
|
|
101
107
|
// src/components/panel/shell.tsx
|
|
102
108
|
var React42 = __toESM(require("react"));
|
|
103
|
-
var
|
|
109
|
+
var import_react16 = require("react");
|
|
104
110
|
var import_editor_panels = require("@elementor/editor-panels");
|
|
105
111
|
var import_editor_sidebar = require("@elementor/editor-sidebar");
|
|
106
|
-
var
|
|
107
|
-
var
|
|
112
|
+
var import_ui30 = require("@elementor/ui");
|
|
113
|
+
var import_i18n30 = require("@wordpress/i18n");
|
|
108
114
|
|
|
109
115
|
// src/contexts/content-panel-coordinator.tsx
|
|
110
116
|
var React = __toESM(require("react"));
|
|
111
117
|
var import_react = require("react");
|
|
112
118
|
var ContentPanelCoordinatorContext = (0, import_react.createContext)(null);
|
|
113
|
-
function ContentPanelCoordinatorProvider({
|
|
119
|
+
function ContentPanelCoordinatorProvider({
|
|
120
|
+
children,
|
|
121
|
+
clearPendingCreateRef,
|
|
122
|
+
onNavigateToSection
|
|
123
|
+
}) {
|
|
124
|
+
const pendingCreateSectionRef = (0, import_react.useRef)(null);
|
|
114
125
|
const sectionsRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
115
|
-
const
|
|
116
|
-
|
|
126
|
+
const clearPendingCreate = (0, import_react.useCallback)(() => {
|
|
127
|
+
pendingCreateSectionRef.current = null;
|
|
117
128
|
}, []);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
(0, import_react.useEffect)(() => {
|
|
130
|
+
if (!clearPendingCreateRef) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
clearPendingCreateRef.current = clearPendingCreate;
|
|
134
|
+
return () => {
|
|
135
|
+
clearPendingCreateRef.current = void 0;
|
|
136
|
+
};
|
|
137
|
+
}, [clearPendingCreate, clearPendingCreateRef]);
|
|
138
|
+
const runPendingCreate = (0, import_react.useCallback)((type, handlers) => {
|
|
139
|
+
if (pendingCreateSectionRef.current !== type) {
|
|
124
140
|
return;
|
|
125
141
|
}
|
|
142
|
+
pendingCreateSectionRef.current = null;
|
|
126
143
|
handlers.setExpanded(true);
|
|
127
144
|
handlers.startCreate();
|
|
128
145
|
}, []);
|
|
146
|
+
const registerSection = (0, import_react.useCallback)(
|
|
147
|
+
(type, handlers) => {
|
|
148
|
+
sectionsRef.current.set(type, handlers);
|
|
149
|
+
runPendingCreate(type, handlers);
|
|
150
|
+
},
|
|
151
|
+
[runPendingCreate]
|
|
152
|
+
);
|
|
153
|
+
const unregisterSection = (0, import_react.useCallback)((type) => {
|
|
154
|
+
sectionsRef.current.delete(type);
|
|
155
|
+
if (pendingCreateSectionRef.current === type) {
|
|
156
|
+
pendingCreateSectionRef.current = null;
|
|
157
|
+
}
|
|
158
|
+
}, []);
|
|
159
|
+
const requestCreate = (0, import_react.useCallback)(
|
|
160
|
+
(type) => {
|
|
161
|
+
onNavigateToSection?.(type);
|
|
162
|
+
const handlers = sectionsRef.current.get(type);
|
|
163
|
+
if (handlers) {
|
|
164
|
+
handlers.setExpanded(true);
|
|
165
|
+
handlers.startCreate();
|
|
166
|
+
pendingCreateSectionRef.current = null;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
pendingCreateSectionRef.current = type;
|
|
170
|
+
},
|
|
171
|
+
[onNavigateToSection]
|
|
172
|
+
);
|
|
129
173
|
const value = (0, import_react.useMemo)(
|
|
130
174
|
() => ({
|
|
175
|
+
clearPendingCreate,
|
|
131
176
|
registerSection,
|
|
132
177
|
requestCreate,
|
|
133
178
|
unregisterSection
|
|
134
179
|
}),
|
|
135
|
-
[registerSection, requestCreate, unregisterSection]
|
|
180
|
+
[clearPendingCreate, registerSection, requestCreate, unregisterSection]
|
|
136
181
|
);
|
|
137
182
|
return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
|
|
138
183
|
}
|
|
@@ -146,16 +191,54 @@ function useContentPanelCoordinator() {
|
|
|
146
191
|
return context;
|
|
147
192
|
}
|
|
148
193
|
|
|
149
|
-
// src/contexts/
|
|
194
|
+
// src/contexts/post-list-context.tsx
|
|
150
195
|
var React2 = __toESM(require("react"));
|
|
151
|
-
var import_react3 = require("react");
|
|
152
|
-
|
|
153
|
-
// src/hooks/use-accessible-panel-post-types.ts
|
|
154
196
|
var import_react2 = require("react");
|
|
197
|
+
var defaultValues = {
|
|
198
|
+
type: "page",
|
|
199
|
+
editMode: { mode: "none", details: {} },
|
|
200
|
+
setEditMode: () => null,
|
|
201
|
+
resetEditMode: () => null,
|
|
202
|
+
setError: () => null
|
|
203
|
+
};
|
|
204
|
+
var PostListContext = (0, import_react2.createContext)(defaultValues);
|
|
205
|
+
var PostListContextProvider = ({
|
|
206
|
+
type,
|
|
207
|
+
setError,
|
|
208
|
+
children
|
|
209
|
+
}) => {
|
|
210
|
+
const [editMode, setEditMode] = (0, import_react2.useState)(defaultValues.editMode);
|
|
211
|
+
const resetEditMode = () => {
|
|
212
|
+
setEditMode(defaultValues.editMode);
|
|
213
|
+
};
|
|
214
|
+
return /* @__PURE__ */ React2.createElement(
|
|
215
|
+
PostListContext.Provider,
|
|
216
|
+
{
|
|
217
|
+
value: {
|
|
218
|
+
type,
|
|
219
|
+
editMode,
|
|
220
|
+
setEditMode,
|
|
221
|
+
resetEditMode,
|
|
222
|
+
setError
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
children
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
function usePostListContext() {
|
|
229
|
+
const context = (0, import_react2.useContext)(PostListContext);
|
|
230
|
+
if (!context) {
|
|
231
|
+
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
232
|
+
}
|
|
233
|
+
return context;
|
|
234
|
+
}
|
|
155
235
|
|
|
156
|
-
// src/
|
|
157
|
-
var
|
|
158
|
-
var
|
|
236
|
+
// src/contexts/site-content-section-toolbar.tsx
|
|
237
|
+
var React3 = __toESM(require("react"));
|
|
238
|
+
var import_react4 = require("react");
|
|
239
|
+
|
|
240
|
+
// src/hooks/use-site-content-section-list-controls.ts
|
|
241
|
+
var import_react3 = require("react");
|
|
159
242
|
|
|
160
243
|
// src/site-content-sort.ts
|
|
161
244
|
var import_i18n = require("@wordpress/i18n");
|
|
@@ -182,20 +265,186 @@ function shouldPinHomepageForSiteContentSort(sort) {
|
|
|
182
265
|
return sort === DEFAULT_SITE_CONTENT_SORT;
|
|
183
266
|
}
|
|
184
267
|
|
|
268
|
+
// src/site-content-status-filter.ts
|
|
269
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
270
|
+
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
271
|
+
"publish",
|
|
272
|
+
"draft",
|
|
273
|
+
"pending",
|
|
274
|
+
"private",
|
|
275
|
+
"future",
|
|
276
|
+
"trash"
|
|
277
|
+
];
|
|
278
|
+
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
279
|
+
draft: false,
|
|
280
|
+
future: false,
|
|
281
|
+
pending: false,
|
|
282
|
+
private: false,
|
|
283
|
+
publish: false,
|
|
284
|
+
trash: false
|
|
285
|
+
};
|
|
286
|
+
var filterLabels = {
|
|
287
|
+
publish: (0, import_i18n2.__)("Published", "elementor"),
|
|
288
|
+
draft: (0, import_i18n2.__)("Drafts", "elementor"),
|
|
289
|
+
pending: (0, import_i18n2.__)("Pending", "elementor"),
|
|
290
|
+
private: (0, import_i18n2.__)("Private", "elementor"),
|
|
291
|
+
future: (0, import_i18n2.__)("Scheduled", "elementor"),
|
|
292
|
+
trash: (0, import_i18n2.__)("Trash", "elementor")
|
|
293
|
+
};
|
|
294
|
+
var SITE_CONTENT_ALL_FILTER_LABEL = (0, import_i18n2.__)("All", "elementor");
|
|
295
|
+
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
296
|
+
function getSiteContentStatusFilterLabel(filter) {
|
|
297
|
+
return filterLabels[filter];
|
|
298
|
+
}
|
|
299
|
+
function hasActiveSiteContentStatusFilters(filters) {
|
|
300
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
301
|
+
}
|
|
302
|
+
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
303
|
+
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
304
|
+
}
|
|
305
|
+
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
306
|
+
function getRestStatusForSiteContentFilters(filters) {
|
|
307
|
+
if (filters.trash) {
|
|
308
|
+
return "trash";
|
|
309
|
+
}
|
|
310
|
+
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
311
|
+
if (0 === active.length) {
|
|
312
|
+
return "any";
|
|
313
|
+
}
|
|
314
|
+
return active.join(",");
|
|
315
|
+
}
|
|
316
|
+
function isSiteContentTrashFilterActive(filters) {
|
|
317
|
+
return filters.trash;
|
|
318
|
+
}
|
|
319
|
+
function isSiteContentListNarrowed(filters, search) {
|
|
320
|
+
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
321
|
+
}
|
|
322
|
+
function toggleSiteContentStatusFilter(filters, filter) {
|
|
323
|
+
if ("trash" === filter) {
|
|
324
|
+
const isTrashOn = !filters.trash;
|
|
325
|
+
return {
|
|
326
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
327
|
+
trash: isTrashOn
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
...filters,
|
|
332
|
+
trash: false,
|
|
333
|
+
[filter]: !filters[filter]
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function getSiteContentStatusFilterForCount(status) {
|
|
337
|
+
if ("trash" === status) {
|
|
338
|
+
return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
342
|
+
[status]: true
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
346
|
+
if (isSelected) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
if (isLoadingCounts || void 0 === count) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
return count > 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/hooks/use-site-content-section-list-controls.ts
|
|
356
|
+
var SEARCH_DEBOUNCE_MS = 300;
|
|
357
|
+
function useSiteContentSectionListControls() {
|
|
358
|
+
const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
|
|
359
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react3.useState)("");
|
|
360
|
+
const [siteContentSort, setSiteContentSortState] = (0, import_react3.useState)(DEFAULT_SITE_CONTENT_SORT);
|
|
361
|
+
const [statusFilters, setStatusFilters] = (0, import_react3.useState)(
|
|
362
|
+
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
363
|
+
);
|
|
364
|
+
const trimmedSearch = searchQuery.trim();
|
|
365
|
+
(0, import_react3.useEffect)(() => {
|
|
366
|
+
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
367
|
+
return () => window.clearTimeout(handle);
|
|
368
|
+
}, [trimmedSearch]);
|
|
369
|
+
const clearActiveToolbarFilters = (0, import_react3.useCallback)(() => {
|
|
370
|
+
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
371
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
372
|
+
}, []);
|
|
373
|
+
const clearSiteContentSort = (0, import_react3.useCallback)(() => {
|
|
374
|
+
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
375
|
+
}, []);
|
|
376
|
+
const clearStatusFilters = (0, import_react3.useCallback)(() => {
|
|
377
|
+
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
378
|
+
}, []);
|
|
379
|
+
const setSiteContentSort = (0, import_react3.useCallback)((sort) => {
|
|
380
|
+
setSiteContentSortState(sort);
|
|
381
|
+
}, []);
|
|
382
|
+
const toggleStatusFilter = (0, import_react3.useCallback)((filter) => {
|
|
383
|
+
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
384
|
+
}, []);
|
|
385
|
+
return {
|
|
386
|
+
clearActiveToolbarFilters,
|
|
387
|
+
clearSiteContentSort,
|
|
388
|
+
clearStatusFilters,
|
|
389
|
+
debouncedSearch,
|
|
390
|
+
searchQuery,
|
|
391
|
+
setSearchQuery,
|
|
392
|
+
setSiteContentSort,
|
|
393
|
+
siteContentSort,
|
|
394
|
+
statusFilters,
|
|
395
|
+
toggleStatusFilter
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// src/contexts/site-content-section-toolbar.tsx
|
|
400
|
+
var SiteContentSectionToolbarContext = (0, import_react4.createContext)(null);
|
|
401
|
+
function SiteContentSectionToolbarProvider({
|
|
402
|
+
children,
|
|
403
|
+
statusFilterCountSlugs = [],
|
|
404
|
+
statusFilterCounts,
|
|
405
|
+
statusFilterCountsPending = false
|
|
406
|
+
}) {
|
|
407
|
+
const controls = useSiteContentSectionListControls();
|
|
408
|
+
const value = (0, import_react4.useMemo)(
|
|
409
|
+
() => ({
|
|
410
|
+
...controls,
|
|
411
|
+
statusFilterCountSlugs,
|
|
412
|
+
statusFilterCounts,
|
|
413
|
+
statusFilterCountsPending
|
|
414
|
+
}),
|
|
415
|
+
[controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
|
|
416
|
+
);
|
|
417
|
+
return /* @__PURE__ */ React3.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
|
|
418
|
+
}
|
|
419
|
+
function useSiteContentSectionToolbar() {
|
|
420
|
+
const context = (0, import_react4.useContext)(SiteContentSectionToolbarContext);
|
|
421
|
+
if (!context) {
|
|
422
|
+
throw new Error(
|
|
423
|
+
"The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
return context;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/hooks/use-accessible-panel-post-types.ts
|
|
430
|
+
var import_react5 = require("react");
|
|
431
|
+
|
|
185
432
|
// src/api/post.ts
|
|
433
|
+
var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
|
|
434
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
186
435
|
var postTypesMap = {
|
|
187
436
|
page: {
|
|
188
437
|
labels: {
|
|
189
|
-
singular_name: (0,
|
|
190
|
-
plural_name: (0,
|
|
438
|
+
singular_name: (0, import_i18n3.__)("Page", "elementor"),
|
|
439
|
+
plural_name: (0, import_i18n3.__)("Pages", "elementor")
|
|
191
440
|
},
|
|
192
441
|
rest_base: "pages",
|
|
193
442
|
createCapability: "edit_pages"
|
|
194
443
|
},
|
|
195
444
|
post: {
|
|
196
445
|
labels: {
|
|
197
|
-
singular_name: (0,
|
|
198
|
-
plural_name: (0,
|
|
446
|
+
singular_name: (0, import_i18n3.__)("Post", "elementor"),
|
|
447
|
+
plural_name: (0, import_i18n3.__)("Posts", "elementor")
|
|
199
448
|
},
|
|
200
449
|
rest_base: "posts",
|
|
201
450
|
createCapability: "edit_posts"
|
|
@@ -210,9 +459,9 @@ function getAccessiblePanelPostTypes(capabilities) {
|
|
|
210
459
|
}
|
|
211
460
|
function getCannotEditPanelItemMessage(postTypeSlug) {
|
|
212
461
|
if ("page" === postTypeSlug) {
|
|
213
|
-
return (0,
|
|
462
|
+
return (0, import_i18n3.__)("You cannot edit this page.", "elementor");
|
|
214
463
|
}
|
|
215
|
-
return (0,
|
|
464
|
+
return (0, import_i18n3.__)("You cannot edit this post.", "elementor");
|
|
216
465
|
}
|
|
217
466
|
var POST_PER_PAGE = 10;
|
|
218
467
|
var COUNT_QUERY_PER_PAGE = 1;
|
|
@@ -320,7 +569,7 @@ function useUser() {
|
|
|
320
569
|
// src/hooks/use-accessible-panel-post-types.ts
|
|
321
570
|
function useAccessiblePanelPostTypes() {
|
|
322
571
|
const { data: user, isPending: isUserPending, isError: isUserError } = useUser();
|
|
323
|
-
const accessiblePostTypes = (0,
|
|
572
|
+
const accessiblePostTypes = (0, import_react5.useMemo)(() => {
|
|
324
573
|
if (user?.capabilities) {
|
|
325
574
|
return getAccessiblePanelPostTypes(user.capabilities);
|
|
326
575
|
}
|
|
@@ -343,6 +592,9 @@ var DEFAULT_SECTION_PRIORITY = 0;
|
|
|
343
592
|
function registerSiteContentSection(section) {
|
|
344
593
|
registeredSections.set(section.id, section);
|
|
345
594
|
}
|
|
595
|
+
function getSiteContentSectionById(sectionId) {
|
|
596
|
+
return registeredSections.get(sectionId);
|
|
597
|
+
}
|
|
346
598
|
function getSiteContentSections() {
|
|
347
599
|
return Array.from(registeredSections.values()).sort(
|
|
348
600
|
(first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
|
|
@@ -352,92 +604,37 @@ function resetSiteContentSections() {
|
|
|
352
604
|
registeredSections.clear();
|
|
353
605
|
}
|
|
354
606
|
|
|
355
|
-
// src/site-content-
|
|
356
|
-
var
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
label: postTypesMap[slug].labels.plural_name
|
|
361
|
-
}));
|
|
362
|
-
const registeredSections2 = getSiteContentSections().map((section) => ({
|
|
363
|
-
id: section.id,
|
|
364
|
-
label: section.label ?? section.id
|
|
365
|
-
}));
|
|
366
|
-
return [...postTypeSections, ...registeredSections2];
|
|
367
|
-
}
|
|
368
|
-
function hasHiddenSiteContentPanelSections(hiddenSectionIds) {
|
|
369
|
-
return hiddenSectionIds.size > 0;
|
|
607
|
+
// src/site-content-view.ts
|
|
608
|
+
var pendingOpenView;
|
|
609
|
+
var activeViewInMemory = null;
|
|
610
|
+
function setPendingSiteContentSection(sectionId) {
|
|
611
|
+
pendingOpenView = sectionId;
|
|
370
612
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
var SiteContentPanelSectionsFilterContext = (0, import_react3.createContext)(
|
|
374
|
-
null
|
|
375
|
-
);
|
|
376
|
-
function SiteContentPanelSectionsFilterProvider({ children }) {
|
|
377
|
-
const { accessiblePostTypes } = useAccessiblePanelPostTypes();
|
|
378
|
-
const descriptors = (0, import_react3.useMemo)(
|
|
379
|
-
() => getSiteContentPanelSectionDescriptors(accessiblePostTypes),
|
|
380
|
-
[accessiblePostTypes]
|
|
381
|
-
);
|
|
382
|
-
const [hiddenSectionIds, setHiddenSectionIds] = (0, import_react3.useState)(() => /* @__PURE__ */ new Set());
|
|
383
|
-
(0, import_react3.useEffect)(() => {
|
|
384
|
-
const validIds = new Set(descriptors.map((descriptor) => descriptor.id));
|
|
385
|
-
setHiddenSectionIds((current) => {
|
|
386
|
-
const nextHidden = new Set([...current].filter((id) => validIds.has(id)));
|
|
387
|
-
return nextHidden.size === current.size ? current : nextHidden;
|
|
388
|
-
});
|
|
389
|
-
}, [descriptors]);
|
|
390
|
-
const setSectionVisible = (0, import_react3.useCallback)(
|
|
391
|
-
(sectionId, visible) => {
|
|
392
|
-
setHiddenSectionIds((current) => {
|
|
393
|
-
if (visible) {
|
|
394
|
-
if (!current.has(sectionId)) {
|
|
395
|
-
return current;
|
|
396
|
-
}
|
|
397
|
-
const next2 = new Set(current);
|
|
398
|
-
next2.delete(sectionId);
|
|
399
|
-
return next2;
|
|
400
|
-
}
|
|
401
|
-
const visibleSectionCount = descriptors.length - current.size;
|
|
402
|
-
if (current.has(sectionId) || visibleSectionCount <= 1) {
|
|
403
|
-
return current;
|
|
404
|
-
}
|
|
405
|
-
const next = new Set(current);
|
|
406
|
-
next.add(sectionId);
|
|
407
|
-
return next;
|
|
408
|
-
});
|
|
409
|
-
},
|
|
410
|
-
[descriptors.length]
|
|
411
|
-
);
|
|
412
|
-
const isSectionVisible = (0, import_react3.useCallback)(
|
|
413
|
-
(sectionId) => !hiddenSectionIds.has(sectionId),
|
|
414
|
-
[hiddenSectionIds]
|
|
415
|
-
);
|
|
416
|
-
const clearHiddenSections = (0, import_react3.useCallback)(() => {
|
|
417
|
-
setHiddenSectionIds(() => /* @__PURE__ */ new Set());
|
|
418
|
-
}, []);
|
|
419
|
-
const value = (0, import_react3.useMemo)(
|
|
420
|
-
() => ({
|
|
421
|
-
clearHiddenSections,
|
|
422
|
-
descriptors,
|
|
423
|
-
hasHiddenSections: hasHiddenSiteContentPanelSections(hiddenSectionIds),
|
|
424
|
-
hiddenSectionIds,
|
|
425
|
-
isSectionVisible,
|
|
426
|
-
setSectionVisible,
|
|
427
|
-
shouldShowSectionsFilter: descriptors.length > 1
|
|
428
|
-
}),
|
|
429
|
-
[clearHiddenSections, descriptors, hiddenSectionIds, isSectionVisible, setSectionVisible]
|
|
430
|
-
);
|
|
431
|
-
return /* @__PURE__ */ React2.createElement(SiteContentPanelSectionsFilterContext.Provider, { value }, children);
|
|
613
|
+
function setPendingSiteContentHome() {
|
|
614
|
+
pendingOpenView = null;
|
|
432
615
|
}
|
|
433
|
-
function
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
throw new Error(
|
|
437
|
-
"useSiteContentPanelSectionsFilter() must be used within a SiteContentPanelSectionsFilterProvider"
|
|
438
|
-
);
|
|
616
|
+
function consumePendingOpen() {
|
|
617
|
+
if (pendingOpenView === void 0) {
|
|
618
|
+
return void 0;
|
|
439
619
|
}
|
|
440
|
-
|
|
620
|
+
const view = pendingOpenView;
|
|
621
|
+
pendingOpenView = void 0;
|
|
622
|
+
activeViewInMemory = view;
|
|
623
|
+
return view;
|
|
624
|
+
}
|
|
625
|
+
function getInitialSiteContentView() {
|
|
626
|
+
const pending = consumePendingOpen();
|
|
627
|
+
if (pending !== void 0) {
|
|
628
|
+
return pending;
|
|
629
|
+
}
|
|
630
|
+
activeViewInMemory = null;
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
function notifySiteContentViewChange(view) {
|
|
634
|
+
activeViewInMemory = view;
|
|
635
|
+
}
|
|
636
|
+
function getActiveSiteContentView() {
|
|
637
|
+
return activeViewInMemory;
|
|
441
638
|
}
|
|
442
639
|
|
|
443
640
|
// src/components/panel/content-panel-chrome.ts
|
|
@@ -448,7 +645,11 @@ var CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
|
|
|
448
645
|
var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
|
|
449
646
|
var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
|
|
450
647
|
var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
|
|
648
|
+
var CONTENT_PANEL_SHELL_HEADER_PADDING_BLOCK = 1;
|
|
649
|
+
var CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_INLINE = 1;
|
|
650
|
+
var CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_START = 2;
|
|
451
651
|
var CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP = 0.75;
|
|
652
|
+
var CONTENT_PANEL_FLAT_SECTION_TOOLBAR_PADDING_BLOCK = 1.25;
|
|
452
653
|
var CONTENT_PANEL_SEARCH_PADDING_BLOCK = 1.5;
|
|
453
654
|
var contentPanelInsetPaddingSx = {
|
|
454
655
|
paddingInline: CONTENT_PANEL_INSET_SPACING
|
|
@@ -471,21 +672,19 @@ function getContentPanelListItemSx(trailingActionCount) {
|
|
|
471
672
|
function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
|
|
472
673
|
if (isActive) {
|
|
473
674
|
return {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
675
|
+
"&&": {
|
|
676
|
+
backgroundColor: "action.selected",
|
|
677
|
+
"&:hover": {
|
|
678
|
+
backgroundColor: "action.selected"
|
|
679
|
+
}
|
|
478
680
|
}
|
|
479
681
|
};
|
|
480
682
|
}
|
|
481
683
|
if (!allowRowHover) {
|
|
482
|
-
return {
|
|
483
|
-
borderRadius: 1
|
|
484
|
-
};
|
|
684
|
+
return {};
|
|
485
685
|
}
|
|
486
686
|
return {
|
|
487
|
-
|
|
488
|
-
"&:hover": {
|
|
687
|
+
"&&:hover": {
|
|
489
688
|
backgroundColor: "action.hover"
|
|
490
689
|
}
|
|
491
690
|
};
|
|
@@ -493,6 +692,25 @@ function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
|
|
|
493
692
|
var contentPanelHeaderStackSx = {
|
|
494
693
|
width: "100%"
|
|
495
694
|
};
|
|
695
|
+
function getContentPanelShellHeaderStackSx(sidebarPanelChrome) {
|
|
696
|
+
if (sidebarPanelChrome) {
|
|
697
|
+
return {
|
|
698
|
+
...contentPanelHeaderStackSx,
|
|
699
|
+
paddingInlineEnd: CONTENT_PANEL_INSET_SPACING - CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_INLINE,
|
|
700
|
+
paddingInlineStart: CONTENT_PANEL_INSET_SPACING - CONTENT_PANEL_SIDEBAR_PANEL_HEADER_PADDING_START
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
return {
|
|
704
|
+
...contentPanelHeaderStackSx,
|
|
705
|
+
paddingInline: CONTENT_PANEL_INSET_SPACING,
|
|
706
|
+
py: CONTENT_PANEL_SHELL_HEADER_PADDING_BLOCK
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
var contentPanelFlatSectionToolbarRowSx = {
|
|
710
|
+
flexShrink: 0,
|
|
711
|
+
px: CONTENT_PANEL_INSET_SPACING,
|
|
712
|
+
py: CONTENT_PANEL_FLAT_SECTION_TOOLBAR_PADDING_BLOCK
|
|
713
|
+
};
|
|
496
714
|
var contentPanelSearchBoxSx = {
|
|
497
715
|
...contentPanelInsetPaddingSx,
|
|
498
716
|
py: CONTENT_PANEL_SEARCH_PADDING_BLOCK
|
|
@@ -502,6 +720,10 @@ var contentPanelSectionHeaderSx = {
|
|
|
502
720
|
py: CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK
|
|
503
721
|
};
|
|
504
722
|
var contentPanelSectionHeaderTrailingGap = CONTENT_PANEL_SECTION_HEADER_TRAILING_GAP;
|
|
723
|
+
var contentPanelFullBleedDividerSx = {
|
|
724
|
+
marginInline: 0,
|
|
725
|
+
width: "100%"
|
|
726
|
+
};
|
|
505
727
|
var contentPanelListRowTitleSx = {
|
|
506
728
|
fontSize: CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE
|
|
507
729
|
};
|
|
@@ -535,10 +757,10 @@ var contentPanelListItemButtonSx = {
|
|
|
535
757
|
};
|
|
536
758
|
|
|
537
759
|
// src/components/panel/content-panel-header-add.tsx
|
|
538
|
-
var
|
|
760
|
+
var React7 = __toESM(require("react"));
|
|
539
761
|
var import_icons4 = require("@elementor/icons");
|
|
540
762
|
var import_ui4 = require("@elementor/ui");
|
|
541
|
-
var
|
|
763
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
542
764
|
|
|
543
765
|
// src/hooks/use-can-create.ts
|
|
544
766
|
function useCanCreate(postTypeSlug) {
|
|
@@ -569,37 +791,37 @@ function resetSiteContentHeaderCreateItems() {
|
|
|
569
791
|
}
|
|
570
792
|
|
|
571
793
|
// src/components/panel/content-panel-add-icon-button.tsx
|
|
572
|
-
var
|
|
794
|
+
var React4 = __toESM(require("react"));
|
|
573
795
|
var import_icons2 = require("@elementor/icons");
|
|
574
796
|
var import_ui = require("@elementor/ui");
|
|
575
797
|
var CONTENT_PANEL_ADD_ICON_SIZE = "tiny";
|
|
576
798
|
function ContentPanelAddIconButton(props) {
|
|
577
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ React4.createElement(import_ui.IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React4.createElement(import_icons2.PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
|
|
578
800
|
}
|
|
579
801
|
|
|
580
802
|
// src/components/panel/popups/popup-header-create-menu-item.tsx
|
|
581
|
-
var
|
|
582
|
-
var
|
|
803
|
+
var React6 = __toESM(require("react"));
|
|
804
|
+
var import_react7 = require("react");
|
|
583
805
|
var import_icons3 = require("@elementor/icons");
|
|
584
806
|
var import_ui3 = require("@elementor/ui");
|
|
585
|
-
var
|
|
807
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
586
808
|
|
|
587
809
|
// src/components/panel/popups/site-content-popups-promotion-chip.tsx
|
|
588
|
-
var
|
|
589
|
-
var
|
|
810
|
+
var React5 = __toESM(require("react"));
|
|
811
|
+
var import_react6 = require("react");
|
|
590
812
|
var import_editor_controls = require("@elementor/editor-controls");
|
|
591
813
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
592
814
|
var import_ui2 = require("@elementor/ui");
|
|
593
|
-
var
|
|
815
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
594
816
|
var TRACKING_DATA = {
|
|
595
817
|
target_name: "popups",
|
|
596
818
|
target_location: "widget_panel"
|
|
597
819
|
};
|
|
598
|
-
var SiteContentPopupsPromotionChip = (0,
|
|
599
|
-
const [isOpen, setIsOpen] = (0,
|
|
820
|
+
var SiteContentPopupsPromotionChip = (0, import_react6.forwardRef)((_, ref) => {
|
|
821
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
600
822
|
const upgradeUrl = env.popups?.upgrade_url ?? POPUP_SITE_CONTENT_UPGRADE_URL;
|
|
601
823
|
(0, import_editor_ui.useCanvasClickHandler)(isOpen, () => setIsOpen(false));
|
|
602
|
-
const toggle = (0,
|
|
824
|
+
const toggle = (0, import_react6.useCallback)(() => {
|
|
603
825
|
setIsOpen((previous) => {
|
|
604
826
|
if (!previous) {
|
|
605
827
|
(0, import_editor_controls.trackViewPromotion)(TRACKING_DATA);
|
|
@@ -607,14 +829,14 @@ var SiteContentPopupsPromotionChip = (0, import_react4.forwardRef)((_, ref) => {
|
|
|
607
829
|
return !previous;
|
|
608
830
|
});
|
|
609
831
|
}, []);
|
|
610
|
-
(0,
|
|
611
|
-
return /* @__PURE__ */
|
|
832
|
+
(0, import_react6.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
|
|
833
|
+
return /* @__PURE__ */ React5.createElement(
|
|
612
834
|
import_editor_ui.PromotionPopover,
|
|
613
835
|
{
|
|
614
836
|
open: isOpen,
|
|
615
|
-
title: (0,
|
|
616
|
-
content: (0,
|
|
617
|
-
ctaText: (0,
|
|
837
|
+
title: (0, import_i18n4.__)("Popups", "elementor"),
|
|
838
|
+
content: (0, import_i18n4.__)("Upgrade to continue creating and editing popups.", "elementor"),
|
|
839
|
+
ctaText: (0, import_i18n4.__)("Upgrade now", "elementor"),
|
|
618
840
|
ctaUrl: upgradeUrl,
|
|
619
841
|
onClose: (event) => {
|
|
620
842
|
event.stopPropagation();
|
|
@@ -622,7 +844,7 @@ var SiteContentPopupsPromotionChip = (0, import_react4.forwardRef)((_, ref) => {
|
|
|
622
844
|
},
|
|
623
845
|
onCtaClick: () => (0, import_editor_controls.trackUpgradePromotionClick)(TRACKING_DATA)
|
|
624
846
|
},
|
|
625
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ React5.createElement(
|
|
626
848
|
import_ui2.Box,
|
|
627
849
|
{
|
|
628
850
|
onClick: (event) => {
|
|
@@ -631,16 +853,16 @@ var SiteContentPopupsPromotionChip = (0, import_react4.forwardRef)((_, ref) => {
|
|
|
631
853
|
},
|
|
632
854
|
sx: { cursor: "pointer", display: "inline-flex" }
|
|
633
855
|
},
|
|
634
|
-
/* @__PURE__ */
|
|
856
|
+
/* @__PURE__ */ React5.createElement(import_editor_ui.PromotionChip, null)
|
|
635
857
|
)
|
|
636
858
|
);
|
|
637
859
|
});
|
|
638
860
|
|
|
639
861
|
// src/components/panel/popups/popup-header-create-menu-item.tsx
|
|
640
862
|
function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
641
|
-
const promotionRef = (0,
|
|
863
|
+
const promotionRef = (0, import_react7.useRef)(null);
|
|
642
864
|
const canCreate = env.popups?.can_use ?? false;
|
|
643
|
-
const label = (0,
|
|
865
|
+
const label = (0, import_i18n5.__)("Popup", "elementor");
|
|
644
866
|
const handleClick = () => {
|
|
645
867
|
if (!canCreate) {
|
|
646
868
|
promotionRef.current?.toggle();
|
|
@@ -648,7 +870,7 @@ function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
|
648
870
|
}
|
|
649
871
|
onSelect();
|
|
650
872
|
};
|
|
651
|
-
return /* @__PURE__ */
|
|
873
|
+
return /* @__PURE__ */ React6.createElement(import_ui3.MenuItem, { onClick: handleClick }, /* @__PURE__ */ React6.createElement(import_ui3.ListItemIcon, null, /* @__PURE__ */ React6.createElement(import_icons3.PopupTemplateIcon, { fontSize: "small", color: canCreate ? "action" : "disabled" })), /* @__PURE__ */ React6.createElement(
|
|
652
874
|
import_ui3.ListItemText,
|
|
653
875
|
{
|
|
654
876
|
primary: label,
|
|
@@ -657,7 +879,7 @@ function PopupHeaderCreateMenuItem({ onSelect }) {
|
|
|
657
879
|
color: canCreate ? "text.primary" : "text.disabled"
|
|
658
880
|
}
|
|
659
881
|
}
|
|
660
|
-
), !canCreate && /* @__PURE__ */
|
|
882
|
+
), !canCreate && /* @__PURE__ */ React6.createElement(import_ui3.Box, { sx: { flexShrink: 0, ml: "auto", pl: 1 } }, /* @__PURE__ */ React6.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })));
|
|
661
883
|
}
|
|
662
884
|
|
|
663
885
|
// src/components/panel/content-panel-header-add.tsx
|
|
@@ -669,7 +891,7 @@ function HeaderAddMenuItem({ slug, onSelect }) {
|
|
|
669
891
|
const canCreate = useCanCreate(slug);
|
|
670
892
|
const Icon = typeIcons[slug];
|
|
671
893
|
const singularName = postTypesMap[slug].labels.singular_name;
|
|
672
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ React7.createElement(import_ui4.MenuItem, { disabled: !canCreate, onClick: () => onSelect(slug) }, /* @__PURE__ */ React7.createElement(import_ui4.ListItemIcon, null, /* @__PURE__ */ React7.createElement(Icon, { fontSize: "small" })), /* @__PURE__ */ React7.createElement(import_ui4.ListItemText, { primary: singularName, primaryTypographyProps: { variant: "body2" } }));
|
|
673
895
|
}
|
|
674
896
|
function ContentPanelHeaderAdd() {
|
|
675
897
|
const { requestCreate } = useContentPanelCoordinator();
|
|
@@ -694,14 +916,14 @@ function ContentPanelHeaderAdd() {
|
|
|
694
916
|
requestCreate(POPUPS_SITE_CONTENT_SECTION_ID);
|
|
695
917
|
});
|
|
696
918
|
};
|
|
697
|
-
return /* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
698
920
|
ContentPanelAddIconButton,
|
|
699
921
|
{
|
|
700
|
-
"aria-label": (0,
|
|
922
|
+
"aria-label": (0, import_i18n6.__)("Add new", "elementor"),
|
|
701
923
|
...buttonProps,
|
|
702
924
|
disabled: !canAddAny
|
|
703
925
|
}
|
|
704
|
-
), /* @__PURE__ */
|
|
926
|
+
), /* @__PURE__ */ React7.createElement(import_ui4.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(() => {
|
|
705
927
|
popupState.close();
|
|
706
928
|
requestAnimationFrame(() => {
|
|
707
929
|
requestCreate(item.id);
|
|
@@ -709,65 +931,67 @@ function ContentPanelHeaderAdd() {
|
|
|
709
931
|
})))));
|
|
710
932
|
}
|
|
711
933
|
|
|
712
|
-
// src/components/panel/content-panel-
|
|
713
|
-
var
|
|
934
|
+
// src/components/panel/content-panel-section-header-actions.tsx
|
|
935
|
+
var React13 = __toESM(require("react"));
|
|
936
|
+
var import_ui10 = require("@elementor/ui");
|
|
937
|
+
|
|
938
|
+
// src/components/panel/content-panel-sort.tsx
|
|
939
|
+
var React10 = __toESM(require("react"));
|
|
714
940
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
715
941
|
var import_icons7 = require("@elementor/icons");
|
|
716
942
|
var import_ui7 = require("@elementor/ui");
|
|
717
|
-
var
|
|
943
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
718
944
|
|
|
719
945
|
// src/components/panel/content-panel-clear-filters-button.tsx
|
|
720
|
-
var
|
|
946
|
+
var React8 = __toESM(require("react"));
|
|
721
947
|
var import_icons5 = require("@elementor/icons");
|
|
722
948
|
var import_ui5 = require("@elementor/ui");
|
|
723
949
|
function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
|
|
724
|
-
return /* @__PURE__ */
|
|
950
|
+
return /* @__PURE__ */ React8.createElement(import_ui5.Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React8.createElement(import_ui5.Box, null, /* @__PURE__ */ React8.createElement(import_ui5.IconButton, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React8.createElement(import_icons5.BrushBigIcon, { fontSize: "tiny" }))));
|
|
725
951
|
}
|
|
726
952
|
|
|
727
|
-
// src/components/panel/content-panel-
|
|
728
|
-
var
|
|
953
|
+
// src/components/panel/content-panel-sort-list.tsx
|
|
954
|
+
var React9 = __toESM(require("react"));
|
|
729
955
|
var import_icons6 = require("@elementor/icons");
|
|
730
956
|
var import_ui6 = require("@elementor/ui");
|
|
731
|
-
var
|
|
732
|
-
function
|
|
733
|
-
const {
|
|
734
|
-
return /* @__PURE__ */
|
|
735
|
-
const
|
|
736
|
-
return /* @__PURE__ */
|
|
957
|
+
var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React9.createElement(import_ui6.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React9.createElement(import_ui6.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React9.createElement(import_icons6.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
958
|
+
function ContentPanelSortList() {
|
|
959
|
+
const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
960
|
+
return /* @__PURE__ */ React9.createElement(import_ui6.MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
|
|
961
|
+
const isSelected = siteContentSort === option;
|
|
962
|
+
return /* @__PURE__ */ React9.createElement(
|
|
737
963
|
import_ui6.MenuItem,
|
|
738
964
|
{
|
|
739
|
-
key:
|
|
740
|
-
|
|
741
|
-
onClick: () =>
|
|
742
|
-
|
|
965
|
+
key: option,
|
|
966
|
+
"aria-checked": isSelected,
|
|
967
|
+
onClick: () => setSiteContentSort(option),
|
|
968
|
+
role: "menuitemradio",
|
|
969
|
+
selected: isSelected
|
|
743
970
|
},
|
|
744
|
-
|
|
971
|
+
renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
|
|
745
972
|
);
|
|
746
973
|
}));
|
|
747
974
|
}
|
|
748
975
|
|
|
749
|
-
// src/components/panel/content-panel-
|
|
750
|
-
function
|
|
751
|
-
const {
|
|
976
|
+
// src/components/panel/content-panel-sort.tsx
|
|
977
|
+
function ContentPanelSort() {
|
|
978
|
+
const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
752
979
|
const popupState = (0, import_ui7.usePopupState)({
|
|
753
980
|
variant: "popover",
|
|
754
981
|
disableAutoFocus: true
|
|
755
982
|
});
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
const filterLabel = (0, import_i18n6.__)("Content types", "elementor");
|
|
760
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(import_ui7.Tooltip, { placement: "top", title: filterLabel }, /* @__PURE__ */ React9.createElement(
|
|
983
|
+
const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
|
|
984
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_ui7.Tooltip, { placement: "top", title: (0, import_i18n7.__)("Sort", "elementor") }, /* @__PURE__ */ React10.createElement(
|
|
761
985
|
import_ui7.ToggleButton,
|
|
762
986
|
{
|
|
763
|
-
"aria-label":
|
|
764
|
-
selected: popupState.isOpen ||
|
|
987
|
+
"aria-label": (0, import_i18n7.__)("Sort", "elementor"),
|
|
988
|
+
selected: popupState.isOpen || hasActiveSort,
|
|
765
989
|
size: "tiny",
|
|
766
|
-
value: "
|
|
990
|
+
value: "sort",
|
|
767
991
|
...(0, import_ui7.bindToggle)(popupState)
|
|
768
992
|
},
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
)), /* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ React10.createElement(import_icons7.ArrowsSortIcon, { fontSize: "tiny" })
|
|
994
|
+
)), /* @__PURE__ */ React10.createElement(
|
|
771
995
|
import_ui7.Popover,
|
|
772
996
|
{
|
|
773
997
|
anchorOrigin: {
|
|
@@ -775,7 +999,7 @@ function ContentPanelSectionsFilter() {
|
|
|
775
999
|
vertical: "top"
|
|
776
1000
|
},
|
|
777
1001
|
sx: {
|
|
778
|
-
maxWidth: `${
|
|
1002
|
+
maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
|
|
779
1003
|
},
|
|
780
1004
|
transformOrigin: {
|
|
781
1005
|
horizontal: -21,
|
|
@@ -783,36 +1007,214 @@ function ContentPanelSectionsFilter() {
|
|
|
783
1007
|
},
|
|
784
1008
|
...(0, import_ui7.bindPopover)(popupState)
|
|
785
1009
|
},
|
|
786
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ React10.createElement(
|
|
787
1011
|
import_editor_ui2.PopoverHeader,
|
|
788
1012
|
{
|
|
789
|
-
actions:
|
|
790
|
-
/* @__PURE__ */
|
|
1013
|
+
actions: hasActiveSort ? [
|
|
1014
|
+
/* @__PURE__ */ React10.createElement(
|
|
791
1015
|
ContentPanelClearFiltersButton,
|
|
792
1016
|
{
|
|
793
|
-
ariaLabel: (0,
|
|
794
|
-
key: "
|
|
795
|
-
onClear:
|
|
796
|
-
tooltipText: (0,
|
|
1017
|
+
ariaLabel: (0, import_i18n7.__)("Clear sort", "elementor"),
|
|
1018
|
+
key: "clear-sort",
|
|
1019
|
+
onClear: clearSiteContentSort,
|
|
1020
|
+
tooltipText: (0, import_i18n7.__)("Clear sort", "elementor")
|
|
797
1021
|
}
|
|
798
1022
|
)
|
|
799
1023
|
] : [],
|
|
800
|
-
icon: /* @__PURE__ */
|
|
1024
|
+
icon: /* @__PURE__ */ React10.createElement(import_icons7.ArrowsSortIcon, { fontSize: "tiny" }),
|
|
801
1025
|
onClose: popupState.close,
|
|
802
|
-
title:
|
|
1026
|
+
title: (0, import_i18n7.__)("Sort", "elementor")
|
|
803
1027
|
}
|
|
804
1028
|
),
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ React10.createElement(import_ui7.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1030
|
+
/* @__PURE__ */ React10.createElement(import_editor_ui2.PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React10.createElement(ContentPanelSortList, null))
|
|
807
1031
|
));
|
|
808
1032
|
}
|
|
809
1033
|
|
|
810
|
-
// src/components/panel/
|
|
811
|
-
var
|
|
1034
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
1035
|
+
var React12 = __toESM(require("react"));
|
|
1036
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1037
|
+
var import_icons9 = require("@elementor/icons");
|
|
1038
|
+
var import_ui9 = require("@elementor/ui");
|
|
1039
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
1040
|
+
|
|
1041
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1042
|
+
var React11 = __toESM(require("react"));
|
|
1043
|
+
var import_icons8 = require("@elementor/icons");
|
|
812
1044
|
var import_ui8 = require("@elementor/ui");
|
|
1045
|
+
|
|
1046
|
+
// src/hooks/use-site-content-status-filter-counts.ts
|
|
1047
|
+
var import_query2 = require("@elementor/query");
|
|
1048
|
+
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
1049
|
+
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
1050
|
+
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
1051
|
+
...siteContentStatusFilterCountsQueryKeyBase,
|
|
1052
|
+
postTypes.join(",")
|
|
1053
|
+
];
|
|
1054
|
+
var sumFulfilledTotals = (results) => {
|
|
1055
|
+
const fulfilled = results.filter(
|
|
1056
|
+
(result) => "fulfilled" === result.status
|
|
1057
|
+
);
|
|
1058
|
+
if (fulfilled.length !== results.length) {
|
|
1059
|
+
return void 0;
|
|
1060
|
+
}
|
|
1061
|
+
return fulfilled.reduce((sum, result) => sum + result.value, 0);
|
|
1062
|
+
};
|
|
1063
|
+
var fetchStatusFilterCounts = async (postTypes) => {
|
|
1064
|
+
const entries = await Promise.all(
|
|
1065
|
+
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
1066
|
+
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
1067
|
+
const total = sumFulfilledTotals(results);
|
|
1068
|
+
if (void 0 === total) {
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
return [status, total];
|
|
1072
|
+
})
|
|
1073
|
+
);
|
|
1074
|
+
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
1075
|
+
};
|
|
1076
|
+
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
1077
|
+
return (0, import_query2.useQuery)({
|
|
1078
|
+
enabled: enabled && postTypes.length > 0,
|
|
1079
|
+
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
1080
|
+
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
1081
|
+
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1086
|
+
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React11.createElement(import_ui8.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React11.createElement(import_ui8.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React11.createElement(import_icons8.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1087
|
+
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
1088
|
+
const {
|
|
1089
|
+
clearStatusFilters,
|
|
1090
|
+
statusFilterCountSlugs,
|
|
1091
|
+
statusFilterCounts: presetStatusCounts,
|
|
1092
|
+
statusFilterCountsPending,
|
|
1093
|
+
statusFilters,
|
|
1094
|
+
toggleStatusFilter
|
|
1095
|
+
} = useSiteContentSectionToolbar();
|
|
1096
|
+
const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
|
|
1097
|
+
const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
|
|
1098
|
+
statusFilterCountSlugs,
|
|
1099
|
+
shouldLoadPostTypeCounts
|
|
1100
|
+
);
|
|
1101
|
+
const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
|
|
1102
|
+
const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
|
|
1103
|
+
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
1104
|
+
const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
1105
|
+
(filter) => shouldShowSiteContentStatusFilterRow(
|
|
1106
|
+
statusCounts?.[filter],
|
|
1107
|
+
isLoadingCounts,
|
|
1108
|
+
statusFilters[filter]
|
|
1109
|
+
)
|
|
1110
|
+
);
|
|
1111
|
+
return /* @__PURE__ */ React11.createElement(import_ui8.MenuList, { dense: true }, /* @__PURE__ */ React11.createElement(
|
|
1112
|
+
import_ui8.MenuItem,
|
|
1113
|
+
{
|
|
1114
|
+
"aria-checked": isAllSelected,
|
|
1115
|
+
onClick: clearStatusFilters,
|
|
1116
|
+
role: "menuitemcheckbox",
|
|
1117
|
+
selected: isAllSelected
|
|
1118
|
+
},
|
|
1119
|
+
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
1120
|
+
), visibleFilters.map((filter) => {
|
|
1121
|
+
const isSelected = statusFilters[filter];
|
|
1122
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1123
|
+
import_ui8.MenuItem,
|
|
1124
|
+
{
|
|
1125
|
+
key: filter,
|
|
1126
|
+
"aria-checked": isSelected,
|
|
1127
|
+
onClick: () => toggleStatusFilter(filter),
|
|
1128
|
+
role: "menuitemcheckbox",
|
|
1129
|
+
selected: isSelected
|
|
1130
|
+
},
|
|
1131
|
+
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
1132
|
+
);
|
|
1133
|
+
}));
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// src/components/panel/content-panel-status-filter.tsx
|
|
1137
|
+
function ContentPanelStatusFilter() {
|
|
1138
|
+
const { clearStatusFilters, statusFilters } = useSiteContentSectionToolbar();
|
|
1139
|
+
const popupState = (0, import_ui9.usePopupState)({
|
|
1140
|
+
variant: "popover",
|
|
1141
|
+
disableAutoFocus: true
|
|
1142
|
+
});
|
|
1143
|
+
const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
|
|
1144
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_ui9.Tooltip, { placement: "top", title: (0, import_i18n8.__)("Filters", "elementor") }, /* @__PURE__ */ React12.createElement(
|
|
1145
|
+
import_ui9.ToggleButton,
|
|
1146
|
+
{
|
|
1147
|
+
"aria-label": (0, import_i18n8.__)("Filters", "elementor"),
|
|
1148
|
+
selected: popupState.isOpen || hasActiveFilters,
|
|
1149
|
+
size: "tiny",
|
|
1150
|
+
value: "filter",
|
|
1151
|
+
...(0, import_ui9.bindToggle)(popupState)
|
|
1152
|
+
},
|
|
1153
|
+
/* @__PURE__ */ React12.createElement(import_icons9.FilterIcon, { fontSize: "tiny" })
|
|
1154
|
+
)), /* @__PURE__ */ React12.createElement(
|
|
1155
|
+
import_ui9.Popover,
|
|
1156
|
+
{
|
|
1157
|
+
anchorOrigin: {
|
|
1158
|
+
horizontal: "right",
|
|
1159
|
+
vertical: "top"
|
|
1160
|
+
},
|
|
1161
|
+
sx: {
|
|
1162
|
+
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
1163
|
+
},
|
|
1164
|
+
transformOrigin: {
|
|
1165
|
+
horizontal: -21,
|
|
1166
|
+
vertical: "top"
|
|
1167
|
+
},
|
|
1168
|
+
...(0, import_ui9.bindPopover)(popupState)
|
|
1169
|
+
},
|
|
1170
|
+
/* @__PURE__ */ React12.createElement(
|
|
1171
|
+
import_editor_ui3.PopoverHeader,
|
|
1172
|
+
{
|
|
1173
|
+
actions: hasActiveFilters ? [
|
|
1174
|
+
/* @__PURE__ */ React12.createElement(
|
|
1175
|
+
ContentPanelClearFiltersButton,
|
|
1176
|
+
{
|
|
1177
|
+
ariaLabel: (0, import_i18n8.__)("Clear all", "elementor"),
|
|
1178
|
+
key: "clear-all-filters",
|
|
1179
|
+
onClear: clearStatusFilters,
|
|
1180
|
+
tooltipText: (0, import_i18n8.__)("Clear all", "elementor")
|
|
1181
|
+
}
|
|
1182
|
+
)
|
|
1183
|
+
] : [],
|
|
1184
|
+
icon: /* @__PURE__ */ React12.createElement(import_icons9.FilterIcon, { fontSize: "tiny" }),
|
|
1185
|
+
onClose: popupState.close,
|
|
1186
|
+
title: (0, import_i18n8.__)("Filters", "elementor")
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ React12.createElement(import_ui9.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1190
|
+
/* @__PURE__ */ React12.createElement(import_editor_ui3.PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React12.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
1191
|
+
));
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
// src/components/panel/content-panel-section-header-actions.tsx
|
|
1195
|
+
function ContentPanelSectionHeaderActions() {
|
|
1196
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1197
|
+
import_ui10.Stack,
|
|
1198
|
+
{
|
|
1199
|
+
alignItems: "center",
|
|
1200
|
+
direction: "row",
|
|
1201
|
+
spacing: 0.5,
|
|
1202
|
+
sx: {
|
|
1203
|
+
flexShrink: 0,
|
|
1204
|
+
marginInlineStart: "auto"
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
/* @__PURE__ */ React13.createElement(ContentPanelStatusFilter, null),
|
|
1208
|
+
/* @__PURE__ */ React13.createElement(ContentPanelSort, null)
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// src/components/panel/error-snackbar.tsx
|
|
1213
|
+
var React14 = __toESM(require("react"));
|
|
1214
|
+
var import_ui11 = require("@elementor/ui");
|
|
813
1215
|
var ErrorSnackbar = ({ open, onClose }) => {
|
|
814
|
-
return /* @__PURE__ */
|
|
815
|
-
|
|
1216
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1217
|
+
import_ui11.Snackbar,
|
|
816
1218
|
{
|
|
817
1219
|
open,
|
|
818
1220
|
onClose,
|
|
@@ -821,8 +1223,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
821
1223
|
horizontal: "left"
|
|
822
1224
|
}
|
|
823
1225
|
},
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
|
|
1226
|
+
/* @__PURE__ */ React14.createElement(import_ui11.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React14.createElement(
|
|
1227
|
+
import_ui11.Typography,
|
|
826
1228
|
{
|
|
827
1229
|
component: "span",
|
|
828
1230
|
sx: {
|
|
@@ -836,227 +1238,17 @@ var ErrorSnackbar = ({ open, onClose }) => {
|
|
|
836
1238
|
var error_snackbar_default = ErrorSnackbar;
|
|
837
1239
|
|
|
838
1240
|
// src/components/panel/shell-panel-body-content.tsx
|
|
839
|
-
var
|
|
1241
|
+
var React40 = __toESM(require("react"));
|
|
840
1242
|
var import_ui28 = require("@elementor/ui");
|
|
841
1243
|
|
|
842
|
-
// src/contexts/post-list-context.tsx
|
|
843
|
-
var React11 = __toESM(require("react"));
|
|
844
|
-
var import_react6 = require("react");
|
|
845
|
-
var defaultValues = {
|
|
846
|
-
type: "page",
|
|
847
|
-
editMode: { mode: "none", details: {} },
|
|
848
|
-
setEditMode: () => null,
|
|
849
|
-
resetEditMode: () => null,
|
|
850
|
-
setError: () => null
|
|
851
|
-
};
|
|
852
|
-
var PostListContext = (0, import_react6.createContext)(defaultValues);
|
|
853
|
-
var PostListContextProvider = ({
|
|
854
|
-
type,
|
|
855
|
-
setError,
|
|
856
|
-
children
|
|
857
|
-
}) => {
|
|
858
|
-
const [editMode, setEditMode] = (0, import_react6.useState)(defaultValues.editMode);
|
|
859
|
-
const resetEditMode = () => {
|
|
860
|
-
setEditMode(defaultValues.editMode);
|
|
861
|
-
};
|
|
862
|
-
return /* @__PURE__ */ React11.createElement(
|
|
863
|
-
PostListContext.Provider,
|
|
864
|
-
{
|
|
865
|
-
value: {
|
|
866
|
-
type,
|
|
867
|
-
editMode,
|
|
868
|
-
setEditMode,
|
|
869
|
-
resetEditMode,
|
|
870
|
-
setError
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
children
|
|
874
|
-
);
|
|
875
|
-
};
|
|
876
|
-
function usePostListContext() {
|
|
877
|
-
const context = (0, import_react6.useContext)(PostListContext);
|
|
878
|
-
if (!context) {
|
|
879
|
-
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
|
|
880
|
-
}
|
|
881
|
-
return context;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
1244
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
885
|
-
var
|
|
886
|
-
var
|
|
887
|
-
var
|
|
888
|
-
var
|
|
889
|
-
|
|
890
|
-
// src/contexts/site-content-section-toolbar.tsx
|
|
891
|
-
var React12 = __toESM(require("react"));
|
|
892
|
-
var import_react8 = require("react");
|
|
893
|
-
|
|
894
|
-
// src/hooks/use-site-content-section-list-controls.ts
|
|
895
|
-
var import_react7 = require("react");
|
|
896
|
-
|
|
897
|
-
// src/site-content-status-filter.ts
|
|
898
|
-
var import_i18n7 = require("@wordpress/i18n");
|
|
899
|
-
var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
|
|
900
|
-
"publish",
|
|
901
|
-
"draft",
|
|
902
|
-
"pending",
|
|
903
|
-
"private",
|
|
904
|
-
"future",
|
|
905
|
-
"trash"
|
|
906
|
-
];
|
|
907
|
-
var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
|
|
908
|
-
draft: false,
|
|
909
|
-
future: false,
|
|
910
|
-
pending: false,
|
|
911
|
-
private: false,
|
|
912
|
-
publish: false,
|
|
913
|
-
trash: false
|
|
914
|
-
};
|
|
915
|
-
var filterLabels = {
|
|
916
|
-
publish: (0, import_i18n7.__)("Published", "elementor"),
|
|
917
|
-
draft: (0, import_i18n7.__)("Drafts", "elementor"),
|
|
918
|
-
pending: (0, import_i18n7.__)("Pending", "elementor"),
|
|
919
|
-
private: (0, import_i18n7.__)("Private", "elementor"),
|
|
920
|
-
future: (0, import_i18n7.__)("Scheduled", "elementor"),
|
|
921
|
-
trash: (0, import_i18n7.__)("Trash", "elementor")
|
|
922
|
-
};
|
|
923
|
-
var SITE_CONTENT_ALL_FILTER_LABEL = (0, import_i18n7.__)("All", "elementor");
|
|
924
|
-
var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
|
|
925
|
-
function getSiteContentStatusFilterLabel(filter) {
|
|
926
|
-
return filterLabels[filter];
|
|
927
|
-
}
|
|
928
|
-
function hasActiveSiteContentStatusFilters(filters) {
|
|
929
|
-
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
|
|
930
|
-
}
|
|
931
|
-
function getActiveSiteContentStatusFilterKeys(filters) {
|
|
932
|
-
return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
|
|
933
|
-
}
|
|
934
|
-
var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
|
|
935
|
-
function getRestStatusForSiteContentFilters(filters) {
|
|
936
|
-
if (filters.trash) {
|
|
937
|
-
return "trash";
|
|
938
|
-
}
|
|
939
|
-
const active = getActiveSiteContentStatusFilterKeys(filters);
|
|
940
|
-
if (0 === active.length) {
|
|
941
|
-
return "any";
|
|
942
|
-
}
|
|
943
|
-
return active.join(",");
|
|
944
|
-
}
|
|
945
|
-
function isSiteContentTrashFilterActive(filters) {
|
|
946
|
-
return filters.trash;
|
|
947
|
-
}
|
|
948
|
-
function isSiteContentListNarrowed(filters, search) {
|
|
949
|
-
return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
|
|
950
|
-
}
|
|
951
|
-
function toggleSiteContentStatusFilter(filters, filter) {
|
|
952
|
-
if ("trash" === filter) {
|
|
953
|
-
const isTrashOn = !filters.trash;
|
|
954
|
-
return {
|
|
955
|
-
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
956
|
-
trash: isTrashOn
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
return {
|
|
960
|
-
...filters,
|
|
961
|
-
trash: false,
|
|
962
|
-
[filter]: !filters[filter]
|
|
963
|
-
};
|
|
964
|
-
}
|
|
965
|
-
function getSiteContentStatusFilterForCount(status) {
|
|
966
|
-
if ("trash" === status) {
|
|
967
|
-
return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
|
|
968
|
-
}
|
|
969
|
-
return {
|
|
970
|
-
...EMPTY_SITE_CONTENT_STATUS_FILTERS,
|
|
971
|
-
[status]: true
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
|
-
function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
|
|
975
|
-
if (isSelected) {
|
|
976
|
-
return true;
|
|
977
|
-
}
|
|
978
|
-
if (isLoadingCounts || void 0 === count) {
|
|
979
|
-
return false;
|
|
980
|
-
}
|
|
981
|
-
return count > 0;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
// src/hooks/use-site-content-section-list-controls.ts
|
|
985
|
-
var SEARCH_DEBOUNCE_MS = 300;
|
|
986
|
-
function useSiteContentSectionListControls() {
|
|
987
|
-
const [searchQuery, setSearchQuery] = (0, import_react7.useState)("");
|
|
988
|
-
const [debouncedSearch, setDebouncedSearch] = (0, import_react7.useState)("");
|
|
989
|
-
const [siteContentSort, setSiteContentSortState] = (0, import_react7.useState)(DEFAULT_SITE_CONTENT_SORT);
|
|
990
|
-
const [statusFilters, setStatusFilters] = (0, import_react7.useState)(
|
|
991
|
-
EMPTY_SITE_CONTENT_STATUS_FILTERS
|
|
992
|
-
);
|
|
993
|
-
const trimmedSearch = searchQuery.trim();
|
|
994
|
-
(0, import_react7.useEffect)(() => {
|
|
995
|
-
const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
|
|
996
|
-
return () => window.clearTimeout(handle);
|
|
997
|
-
}, [trimmedSearch]);
|
|
998
|
-
const clearActiveToolbarFilters = (0, import_react7.useCallback)(() => {
|
|
999
|
-
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
1000
|
-
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
1001
|
-
}, []);
|
|
1002
|
-
const clearSiteContentSort = (0, import_react7.useCallback)(() => {
|
|
1003
|
-
setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
|
|
1004
|
-
}, []);
|
|
1005
|
-
const clearStatusFilters = (0, import_react7.useCallback)(() => {
|
|
1006
|
-
setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
|
|
1007
|
-
}, []);
|
|
1008
|
-
const setSiteContentSort = (0, import_react7.useCallback)((sort) => {
|
|
1009
|
-
setSiteContentSortState(sort);
|
|
1010
|
-
}, []);
|
|
1011
|
-
const toggleStatusFilter = (0, import_react7.useCallback)((filter) => {
|
|
1012
|
-
setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
|
|
1013
|
-
}, []);
|
|
1014
|
-
return {
|
|
1015
|
-
clearActiveToolbarFilters,
|
|
1016
|
-
clearSiteContentSort,
|
|
1017
|
-
clearStatusFilters,
|
|
1018
|
-
debouncedSearch,
|
|
1019
|
-
searchQuery,
|
|
1020
|
-
setSearchQuery,
|
|
1021
|
-
setSiteContentSort,
|
|
1022
|
-
siteContentSort,
|
|
1023
|
-
statusFilters,
|
|
1024
|
-
toggleStatusFilter
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
// src/contexts/site-content-section-toolbar.tsx
|
|
1029
|
-
var SiteContentSectionToolbarContext = (0, import_react8.createContext)(null);
|
|
1030
|
-
function SiteContentSectionToolbarProvider({
|
|
1031
|
-
children,
|
|
1032
|
-
statusFilterCountSlugs = [],
|
|
1033
|
-
statusFilterCounts,
|
|
1034
|
-
statusFilterCountsPending = false
|
|
1035
|
-
}) {
|
|
1036
|
-
const controls = useSiteContentSectionListControls();
|
|
1037
|
-
const value = (0, import_react8.useMemo)(
|
|
1038
|
-
() => ({
|
|
1039
|
-
...controls,
|
|
1040
|
-
statusFilterCountSlugs,
|
|
1041
|
-
statusFilterCounts,
|
|
1042
|
-
statusFilterCountsPending
|
|
1043
|
-
}),
|
|
1044
|
-
[controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
|
|
1045
|
-
);
|
|
1046
|
-
return /* @__PURE__ */ React12.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
|
|
1047
|
-
}
|
|
1048
|
-
function useSiteContentSectionToolbar() {
|
|
1049
|
-
const context = (0, import_react8.useContext)(SiteContentSectionToolbarContext);
|
|
1050
|
-
if (!context) {
|
|
1051
|
-
throw new Error(
|
|
1052
|
-
"The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
return context;
|
|
1056
|
-
}
|
|
1245
|
+
var React37 = __toESM(require("react"));
|
|
1246
|
+
var import_react15 = require("react");
|
|
1247
|
+
var import_ui25 = require("@elementor/ui");
|
|
1248
|
+
var import_i18n26 = require("@wordpress/i18n");
|
|
1057
1249
|
|
|
1058
1250
|
// src/hooks/use-homepage.ts
|
|
1059
|
-
var
|
|
1251
|
+
var import_query3 = require("@elementor/query");
|
|
1060
1252
|
|
|
1061
1253
|
// src/api/settings.ts
|
|
1062
1254
|
var import_api_fetch3 = __toESM(require("@wordpress/api-fetch"));
|
|
@@ -1076,14 +1268,14 @@ var updateSettings = (settings) => {
|
|
|
1076
1268
|
// src/hooks/use-homepage.ts
|
|
1077
1269
|
var settingsQueryKey = () => ["site-navigation", "homepage"];
|
|
1078
1270
|
function useHomepage() {
|
|
1079
|
-
return (0,
|
|
1271
|
+
return (0, import_query3.useQuery)({
|
|
1080
1272
|
queryKey: settingsQueryKey(),
|
|
1081
1273
|
queryFn: () => getSettings()
|
|
1082
1274
|
});
|
|
1083
1275
|
}
|
|
1084
1276
|
|
|
1085
1277
|
// src/hooks/use-post-list-pagination.ts
|
|
1086
|
-
var
|
|
1278
|
+
var import_react8 = require("react");
|
|
1087
1279
|
function usePostListPagination({
|
|
1088
1280
|
fetchNextPage,
|
|
1089
1281
|
hasNextPage,
|
|
@@ -1092,13 +1284,13 @@ function usePostListPagination({
|
|
|
1092
1284
|
resetKey,
|
|
1093
1285
|
totalCount
|
|
1094
1286
|
}) {
|
|
1095
|
-
const [visibleCount, setVisibleCount] = (0,
|
|
1096
|
-
const pendingVisibleTargetRef = (0,
|
|
1097
|
-
(0,
|
|
1287
|
+
const [visibleCount, setVisibleCount] = (0, import_react8.useState)(POST_PER_PAGE);
|
|
1288
|
+
const pendingVisibleTargetRef = (0, import_react8.useRef)(null);
|
|
1289
|
+
(0, import_react8.useEffect)(() => {
|
|
1098
1290
|
setVisibleCount(POST_PER_PAGE);
|
|
1099
1291
|
pendingVisibleTargetRef.current = null;
|
|
1100
1292
|
}, [resetKey]);
|
|
1101
|
-
(0,
|
|
1293
|
+
(0, import_react8.useEffect)(() => {
|
|
1102
1294
|
const target = pendingVisibleTargetRef.current;
|
|
1103
1295
|
if (target === null) {
|
|
1104
1296
|
return;
|
|
@@ -1115,7 +1307,7 @@ function usePostListPagination({
|
|
|
1115
1307
|
}, [isFetchingNextPage, loadedCount]);
|
|
1116
1308
|
const canShowLess = visibleCount > POST_PER_PAGE;
|
|
1117
1309
|
const canLoadMore = visibleCount < loadedCount || hasNextPage;
|
|
1118
|
-
const handleLoadMore = (0,
|
|
1310
|
+
const handleLoadMore = (0, import_react8.useCallback)(() => {
|
|
1119
1311
|
if (isFetchingNextPage || !canLoadMore) {
|
|
1120
1312
|
return;
|
|
1121
1313
|
}
|
|
@@ -1133,7 +1325,7 @@ function usePostListPagination({
|
|
|
1133
1325
|
setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
|
|
1134
1326
|
}
|
|
1135
1327
|
}, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
|
|
1136
|
-
const handleShowLess = (0,
|
|
1328
|
+
const handleShowLess = (0, import_react8.useCallback)(() => {
|
|
1137
1329
|
pendingVisibleTargetRef.current = null;
|
|
1138
1330
|
setVisibleCount(POST_PER_PAGE);
|
|
1139
1331
|
}, []);
|
|
@@ -1147,7 +1339,7 @@ function usePostListPagination({
|
|
|
1147
1339
|
}
|
|
1148
1340
|
|
|
1149
1341
|
// src/hooks/use-posts.ts
|
|
1150
|
-
var
|
|
1342
|
+
var import_query4 = require("@elementor/query");
|
|
1151
1343
|
var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
|
|
1152
1344
|
var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any", sort = DEFAULT_SITE_CONTENT_SORT) => [...postsQueryKeyBase(postTypeSlug), restStatus, trimmedSearch, sort];
|
|
1153
1345
|
var flattenData = (data) => {
|
|
@@ -1170,20 +1362,20 @@ var flattenData = (data) => {
|
|
|
1170
1362
|
function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS, sort = DEFAULT_SITE_CONTENT_SORT) {
|
|
1171
1363
|
const trimmedSearch = search.trim();
|
|
1172
1364
|
const restStatus = getRestStatusForSiteContentFilters(statusFilters);
|
|
1173
|
-
const query = (0,
|
|
1365
|
+
const query = (0, import_query4.useInfiniteQuery)({
|
|
1174
1366
|
queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus, sort),
|
|
1175
1367
|
queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus, POST_PER_PAGE, sort),
|
|
1176
1368
|
initialPageParam: 1,
|
|
1177
1369
|
getNextPageParam: (lastPage) => {
|
|
1178
1370
|
return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
|
|
1179
1371
|
},
|
|
1180
|
-
placeholderData:
|
|
1372
|
+
placeholderData: import_query4.keepPreviousData
|
|
1181
1373
|
});
|
|
1182
1374
|
return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
|
|
1183
1375
|
}
|
|
1184
1376
|
|
|
1185
1377
|
// src/hooks/use-posts-baseline-total.ts
|
|
1186
|
-
var
|
|
1378
|
+
var import_query5 = require("@elementor/query");
|
|
1187
1379
|
var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
|
|
1188
1380
|
"site-navigation",
|
|
1189
1381
|
"posts-baseline-total",
|
|
@@ -1194,7 +1386,7 @@ var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
|
|
|
1194
1386
|
status
|
|
1195
1387
|
];
|
|
1196
1388
|
function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
1197
|
-
return (0,
|
|
1389
|
+
return (0, import_query5.useQuery)({
|
|
1198
1390
|
enabled,
|
|
1199
1391
|
queryFn: () => fetchPostsTotal(postTypeSlug, status),
|
|
1200
1392
|
queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
|
|
@@ -1202,13 +1394,13 @@ function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
|
|
|
1202
1394
|
}
|
|
1203
1395
|
|
|
1204
1396
|
// src/components/panel/content-panel-section-toolbar.tsx
|
|
1205
|
-
var
|
|
1206
|
-
var
|
|
1397
|
+
var React17 = __toESM(require("react"));
|
|
1398
|
+
var import_ui14 = require("@elementor/ui");
|
|
1207
1399
|
|
|
1208
1400
|
// src/components/panel/content-panel-active-filters.tsx
|
|
1209
|
-
var
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1401
|
+
var React15 = __toESM(require("react"));
|
|
1402
|
+
var import_ui12 = require("@elementor/ui");
|
|
1403
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
1212
1404
|
var contentPanelFilterChipSx = {
|
|
1213
1405
|
"& .MuiChip-deleteIcon": {
|
|
1214
1406
|
display: "none",
|
|
@@ -1226,16 +1418,16 @@ function ContentPanelActiveFilters() {
|
|
|
1226
1418
|
return null;
|
|
1227
1419
|
}
|
|
1228
1420
|
const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
|
|
1229
|
-
return /* @__PURE__ */
|
|
1230
|
-
|
|
1421
|
+
return /* @__PURE__ */ React15.createElement(import_ui12.Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React15.createElement(import_ui12.Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React15.createElement(
|
|
1422
|
+
import_ui12.Chip,
|
|
1231
1423
|
{
|
|
1232
1424
|
label: getSiteContentSortLabel(siteContentSort),
|
|
1233
1425
|
onDelete: () => setSiteContentSort(DEFAULT_SITE_CONTENT_SORT),
|
|
1234
1426
|
size: "tiny",
|
|
1235
1427
|
sx: contentPanelFilterChipSx
|
|
1236
1428
|
}
|
|
1237
|
-
), activeKeys.map((key) => /* @__PURE__ */
|
|
1238
|
-
|
|
1429
|
+
), activeKeys.map((key) => /* @__PURE__ */ React15.createElement(
|
|
1430
|
+
import_ui12.Chip,
|
|
1239
1431
|
{
|
|
1240
1432
|
key,
|
|
1241
1433
|
label: getSiteContentStatusFilterLabel(key),
|
|
@@ -1243,309 +1435,75 @@ function ContentPanelActiveFilters() {
|
|
|
1243
1435
|
size: "tiny",
|
|
1244
1436
|
sx: contentPanelFilterChipSx
|
|
1245
1437
|
}
|
|
1246
|
-
))), /* @__PURE__ */
|
|
1438
|
+
))), /* @__PURE__ */ React15.createElement(
|
|
1247
1439
|
ContentPanelClearFiltersButton,
|
|
1248
1440
|
{
|
|
1249
|
-
ariaLabel: (0,
|
|
1441
|
+
ariaLabel: (0, import_i18n9.__)("Clear Filters", "elementor"),
|
|
1250
1442
|
onClear: clearActiveToolbarFilters,
|
|
1251
1443
|
sx: { margin: "0 0 auto auto" },
|
|
1252
|
-
tooltipText: (0,
|
|
1444
|
+
tooltipText: (0, import_i18n9.__)("Clear Filters", "elementor")
|
|
1253
1445
|
}
|
|
1254
1446
|
));
|
|
1255
1447
|
}
|
|
1256
1448
|
|
|
1257
1449
|
// src/components/panel/content-panel-search.tsx
|
|
1258
|
-
var
|
|
1259
|
-
var
|
|
1260
|
-
var
|
|
1261
|
-
var
|
|
1450
|
+
var React16 = __toESM(require("react"));
|
|
1451
|
+
var import_icons10 = require("@elementor/icons");
|
|
1452
|
+
var import_ui13 = require("@elementor/ui");
|
|
1453
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
1262
1454
|
function ContentPanelSearch({ searchAriaLabel }) {
|
|
1263
1455
|
const { searchQuery, setSearchQuery } = useSiteContentSectionToolbar();
|
|
1264
|
-
const ariaLabel = searchAriaLabel ?? (0,
|
|
1265
|
-
return /* @__PURE__ */
|
|
1266
|
-
|
|
1456
|
+
const ariaLabel = searchAriaLabel ?? (0, import_i18n10.__)("Search site content", "elementor");
|
|
1457
|
+
return /* @__PURE__ */ React16.createElement(import_ui13.Box, { component: "search", "aria-label": ariaLabel }, /* @__PURE__ */ React16.createElement(
|
|
1458
|
+
import_ui13.TextField,
|
|
1267
1459
|
{
|
|
1268
1460
|
fullWidth: true,
|
|
1269
1461
|
size: "tiny",
|
|
1270
1462
|
value: searchQuery,
|
|
1271
|
-
placeholder: (0,
|
|
1463
|
+
placeholder: (0, import_i18n10.__)("Search", "elementor"),
|
|
1272
1464
|
onChange: (event) => setSearchQuery(event.target.value),
|
|
1273
1465
|
inputProps: {
|
|
1274
|
-
"aria-label": (0,
|
|
1466
|
+
"aria-label": (0, import_i18n10.__)("Search", "elementor")
|
|
1275
1467
|
},
|
|
1276
1468
|
InputProps: {
|
|
1277
|
-
startAdornment: /* @__PURE__ */
|
|
1469
|
+
startAdornment: /* @__PURE__ */ React16.createElement(import_ui13.InputAdornment, { position: "start" }, /* @__PURE__ */ React16.createElement(import_icons10.SearchIcon, { fontSize: "tiny" }))
|
|
1278
1470
|
}
|
|
1279
1471
|
}
|
|
1280
1472
|
));
|
|
1281
1473
|
}
|
|
1282
1474
|
|
|
1283
|
-
// src/components/panel/content-panel-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
var import_i18n10 = require("@wordpress/i18n");
|
|
1289
|
-
|
|
1290
|
-
// src/components/panel/content-panel-sort-list.tsx
|
|
1291
|
-
var React15 = __toESM(require("react"));
|
|
1292
|
-
var import_icons9 = require("@elementor/icons");
|
|
1293
|
-
var import_ui11 = require("@elementor/ui");
|
|
1294
|
-
var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React15.createElement(import_ui11.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React15.createElement(import_ui11.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React15.createElement(import_icons9.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1295
|
-
function ContentPanelSortList() {
|
|
1296
|
-
const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
1297
|
-
return /* @__PURE__ */ React15.createElement(import_ui11.MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
|
|
1298
|
-
const isSelected = siteContentSort === option;
|
|
1299
|
-
return /* @__PURE__ */ React15.createElement(
|
|
1300
|
-
import_ui11.MenuItem,
|
|
1475
|
+
// src/components/panel/content-panel-section-toolbar.tsx
|
|
1476
|
+
function ContentPanelSectionToolbar({ addAction, actionsInHeader, searchAriaLabel }) {
|
|
1477
|
+
if (actionsInHeader) {
|
|
1478
|
+
return /* @__PURE__ */ React17.createElement(import_ui14.Box, { sx: { display: "flex", flexDirection: "column", flexShrink: 0, width: "100%" } }, /* @__PURE__ */ React17.createElement(
|
|
1479
|
+
import_ui14.Stack,
|
|
1301
1480
|
{
|
|
1302
|
-
|
|
1303
|
-
"
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
},
|
|
1308
|
-
renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
|
|
1309
|
-
);
|
|
1310
|
-
}));
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
// src/components/panel/content-panel-sort.tsx
|
|
1314
|
-
function ContentPanelSort() {
|
|
1315
|
-
const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
|
|
1316
|
-
const popupState = (0, import_ui12.usePopupState)({
|
|
1317
|
-
variant: "popover",
|
|
1318
|
-
disableAutoFocus: true
|
|
1319
|
-
});
|
|
1320
|
-
const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
|
|
1321
|
-
return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(import_ui12.Tooltip, { placement: "top", title: (0, import_i18n10.__)("Sort", "elementor") }, /* @__PURE__ */ React16.createElement(
|
|
1322
|
-
import_ui12.ToggleButton,
|
|
1323
|
-
{
|
|
1324
|
-
"aria-label": (0, import_i18n10.__)("Sort", "elementor"),
|
|
1325
|
-
selected: popupState.isOpen || hasActiveSort,
|
|
1326
|
-
size: "tiny",
|
|
1327
|
-
value: "sort",
|
|
1328
|
-
...(0, import_ui12.bindToggle)(popupState)
|
|
1329
|
-
},
|
|
1330
|
-
/* @__PURE__ */ React16.createElement(import_icons10.ArrowsSortIcon, { fontSize: "tiny" })
|
|
1331
|
-
)), /* @__PURE__ */ React16.createElement(
|
|
1332
|
-
import_ui12.Popover,
|
|
1333
|
-
{
|
|
1334
|
-
anchorOrigin: {
|
|
1335
|
-
horizontal: "right",
|
|
1336
|
-
vertical: "top"
|
|
1337
|
-
},
|
|
1338
|
-
sx: {
|
|
1339
|
-
maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
|
|
1340
|
-
},
|
|
1341
|
-
transformOrigin: {
|
|
1342
|
-
horizontal: -21,
|
|
1343
|
-
vertical: "top"
|
|
1481
|
+
alignItems: "center",
|
|
1482
|
+
direction: "row",
|
|
1483
|
+
spacing: 1,
|
|
1484
|
+
width: "100%",
|
|
1485
|
+
sx: contentPanelFlatSectionToolbarRowSx
|
|
1344
1486
|
},
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
import_editor_ui3.PopoverHeader,
|
|
1349
|
-
{
|
|
1350
|
-
actions: hasActiveSort ? [
|
|
1351
|
-
/* @__PURE__ */ React16.createElement(
|
|
1352
|
-
ContentPanelClearFiltersButton,
|
|
1353
|
-
{
|
|
1354
|
-
ariaLabel: (0, import_i18n10.__)("Clear sort", "elementor"),
|
|
1355
|
-
key: "clear-sort",
|
|
1356
|
-
onClear: clearSiteContentSort,
|
|
1357
|
-
tooltipText: (0, import_i18n10.__)("Clear sort", "elementor")
|
|
1358
|
-
}
|
|
1359
|
-
)
|
|
1360
|
-
] : [],
|
|
1361
|
-
icon: /* @__PURE__ */ React16.createElement(import_icons10.ArrowsSortIcon, { fontSize: "tiny" }),
|
|
1362
|
-
onClose: popupState.close,
|
|
1363
|
-
title: (0, import_i18n10.__)("Sort", "elementor")
|
|
1364
|
-
}
|
|
1365
|
-
),
|
|
1366
|
-
/* @__PURE__ */ React16.createElement(import_ui12.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1367
|
-
/* @__PURE__ */ React16.createElement(import_editor_ui3.PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React16.createElement(ContentPanelSortList, null))
|
|
1368
|
-
));
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
// src/components/panel/content-panel-status-filter.tsx
|
|
1372
|
-
var React18 = __toESM(require("react"));
|
|
1373
|
-
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1374
|
-
var import_icons12 = require("@elementor/icons");
|
|
1375
|
-
var import_ui14 = require("@elementor/ui");
|
|
1376
|
-
var import_i18n11 = require("@wordpress/i18n");
|
|
1377
|
-
|
|
1378
|
-
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1379
|
-
var React17 = __toESM(require("react"));
|
|
1380
|
-
var import_icons11 = require("@elementor/icons");
|
|
1381
|
-
var import_ui13 = require("@elementor/ui");
|
|
1382
|
-
|
|
1383
|
-
// src/hooks/use-site-content-status-filter-counts.ts
|
|
1384
|
-
var import_query5 = require("@elementor/query");
|
|
1385
|
-
var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
|
|
1386
|
-
var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
|
|
1387
|
-
var siteContentStatusFilterCountsQueryKey = (postTypes) => [
|
|
1388
|
-
...siteContentStatusFilterCountsQueryKeyBase,
|
|
1389
|
-
postTypes.join(",")
|
|
1390
|
-
];
|
|
1391
|
-
var sumFulfilledTotals = (results) => {
|
|
1392
|
-
const fulfilled = results.filter(
|
|
1393
|
-
(result) => "fulfilled" === result.status
|
|
1394
|
-
);
|
|
1395
|
-
if (fulfilled.length !== results.length) {
|
|
1396
|
-
return void 0;
|
|
1487
|
+
/* @__PURE__ */ React17.createElement(import_ui14.Box, { sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React17.createElement(ContentPanelSearch, { searchAriaLabel })),
|
|
1488
|
+
addAction ? /* @__PURE__ */ React17.createElement(import_ui14.Box, { sx: { alignItems: "center", display: "flex", flexShrink: 0 } }, addAction) : null
|
|
1489
|
+
), /* @__PURE__ */ React17.createElement(import_ui14.Box, { sx: { px: 2, pb: 0.75 } }, /* @__PURE__ */ React17.createElement(ContentPanelActiveFilters, null)), /* @__PURE__ */ React17.createElement(import_ui14.Divider, { sx: { ...contentPanelFullBleedDividerSx, width: "100%" } }));
|
|
1397
1490
|
}
|
|
1398
|
-
return
|
|
1399
|
-
};
|
|
1400
|
-
var fetchStatusFilterCounts = async (postTypes) => {
|
|
1401
|
-
const entries = await Promise.all(
|
|
1402
|
-
SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
|
|
1403
|
-
const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
|
|
1404
|
-
const total = sumFulfilledTotals(results);
|
|
1405
|
-
if (void 0 === total) {
|
|
1406
|
-
return null;
|
|
1407
|
-
}
|
|
1408
|
-
return [status, total];
|
|
1409
|
-
})
|
|
1410
|
-
);
|
|
1411
|
-
return Object.fromEntries(entries.filter((entry) => null !== entry));
|
|
1412
|
-
};
|
|
1413
|
-
function useSiteContentStatusFilterCounts(postTypes, enabled) {
|
|
1414
|
-
return (0, import_query5.useQuery)({
|
|
1415
|
-
enabled: enabled && postTypes.length > 0,
|
|
1416
|
-
queryFn: () => fetchStatusFilterCounts(postTypes),
|
|
1417
|
-
queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
|
|
1418
|
-
staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
// src/components/panel/content-panel-status-filter-list.tsx
|
|
1423
|
-
var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React17.createElement(import_ui13.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui13.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React17.createElement(import_icons11.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
|
|
1424
|
-
function ContentPanelStatusFilterList({ loadCounts }) {
|
|
1425
|
-
const {
|
|
1426
|
-
clearStatusFilters,
|
|
1427
|
-
statusFilterCountSlugs,
|
|
1428
|
-
statusFilterCounts: presetStatusCounts,
|
|
1429
|
-
statusFilterCountsPending,
|
|
1430
|
-
statusFilters,
|
|
1431
|
-
toggleStatusFilter
|
|
1432
|
-
} = useSiteContentSectionToolbar();
|
|
1433
|
-
const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
|
|
1434
|
-
const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
|
|
1435
|
-
statusFilterCountSlugs,
|
|
1436
|
-
shouldLoadPostTypeCounts
|
|
1437
|
-
);
|
|
1438
|
-
const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
|
|
1439
|
-
const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
|
|
1440
|
-
const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
|
|
1441
|
-
const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
|
|
1442
|
-
(filter) => shouldShowSiteContentStatusFilterRow(
|
|
1443
|
-
statusCounts?.[filter],
|
|
1444
|
-
isLoadingCounts,
|
|
1445
|
-
statusFilters[filter]
|
|
1446
|
-
)
|
|
1447
|
-
);
|
|
1448
|
-
return /* @__PURE__ */ React17.createElement(import_ui13.MenuList, { dense: true }, /* @__PURE__ */ React17.createElement(
|
|
1449
|
-
import_ui13.MenuItem,
|
|
1450
|
-
{
|
|
1451
|
-
"aria-checked": isAllSelected,
|
|
1452
|
-
onClick: clearStatusFilters,
|
|
1453
|
-
role: "menuitemcheckbox",
|
|
1454
|
-
selected: isAllSelected
|
|
1455
|
-
},
|
|
1456
|
-
renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
|
|
1457
|
-
), visibleFilters.map((filter) => {
|
|
1458
|
-
const isSelected = statusFilters[filter];
|
|
1459
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1460
|
-
import_ui13.MenuItem,
|
|
1461
|
-
{
|
|
1462
|
-
key: filter,
|
|
1463
|
-
"aria-checked": isSelected,
|
|
1464
|
-
onClick: () => toggleStatusFilter(filter),
|
|
1465
|
-
role: "menuitemcheckbox",
|
|
1466
|
-
selected: isSelected
|
|
1467
|
-
},
|
|
1468
|
-
renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
|
|
1469
|
-
);
|
|
1470
|
-
}));
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
// src/components/panel/content-panel-status-filter.tsx
|
|
1474
|
-
function ContentPanelStatusFilter() {
|
|
1475
|
-
const { clearStatusFilters, statusFilters } = useSiteContentSectionToolbar();
|
|
1476
|
-
const popupState = (0, import_ui14.usePopupState)({
|
|
1477
|
-
variant: "popover",
|
|
1478
|
-
disableAutoFocus: true
|
|
1479
|
-
});
|
|
1480
|
-
const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
|
|
1481
|
-
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_ui14.Tooltip, { placement: "top", title: (0, import_i18n11.__)("Filters", "elementor") }, /* @__PURE__ */ React18.createElement(
|
|
1482
|
-
import_ui14.ToggleButton,
|
|
1483
|
-
{
|
|
1484
|
-
"aria-label": (0, import_i18n11.__)("Filters", "elementor"),
|
|
1485
|
-
selected: popupState.isOpen || hasActiveFilters,
|
|
1486
|
-
size: "tiny",
|
|
1487
|
-
value: "filter",
|
|
1488
|
-
...(0, import_ui14.bindToggle)(popupState)
|
|
1489
|
-
},
|
|
1490
|
-
/* @__PURE__ */ React18.createElement(import_icons12.FilterIcon, { fontSize: "tiny" })
|
|
1491
|
-
)), /* @__PURE__ */ React18.createElement(
|
|
1492
|
-
import_ui14.Popover,
|
|
1493
|
-
{
|
|
1494
|
-
anchorOrigin: {
|
|
1495
|
-
horizontal: "right",
|
|
1496
|
-
vertical: "top"
|
|
1497
|
-
},
|
|
1498
|
-
sx: {
|
|
1499
|
-
maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
|
|
1500
|
-
},
|
|
1501
|
-
transformOrigin: {
|
|
1502
|
-
horizontal: -21,
|
|
1503
|
-
vertical: "top"
|
|
1504
|
-
},
|
|
1505
|
-
...(0, import_ui14.bindPopover)(popupState)
|
|
1506
|
-
},
|
|
1507
|
-
/* @__PURE__ */ React18.createElement(
|
|
1508
|
-
import_editor_ui4.PopoverHeader,
|
|
1509
|
-
{
|
|
1510
|
-
actions: hasActiveFilters ? [
|
|
1511
|
-
/* @__PURE__ */ React18.createElement(
|
|
1512
|
-
ContentPanelClearFiltersButton,
|
|
1513
|
-
{
|
|
1514
|
-
ariaLabel: (0, import_i18n11.__)("Clear all", "elementor"),
|
|
1515
|
-
key: "clear-all-filters",
|
|
1516
|
-
onClear: clearStatusFilters,
|
|
1517
|
-
tooltipText: (0, import_i18n11.__)("Clear all", "elementor")
|
|
1518
|
-
}
|
|
1519
|
-
)
|
|
1520
|
-
] : [],
|
|
1521
|
-
icon: /* @__PURE__ */ React18.createElement(import_icons12.FilterIcon, { fontSize: "tiny" }),
|
|
1522
|
-
onClose: popupState.close,
|
|
1523
|
-
title: (0, import_i18n11.__)("Filters", "elementor")
|
|
1524
|
-
}
|
|
1525
|
-
),
|
|
1526
|
-
/* @__PURE__ */ React18.createElement(import_ui14.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
|
|
1527
|
-
/* @__PURE__ */ React18.createElement(import_editor_ui4.PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React18.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
|
|
1528
|
-
));
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
// src/components/panel/content-panel-section-toolbar.tsx
|
|
1532
|
-
function ContentPanelSectionToolbar({ addAction, searchAriaLabel }) {
|
|
1533
|
-
return /* @__PURE__ */ React19.createElement(import_ui15.Box, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React19.createElement(import_ui15.Stack, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React19.createElement(import_ui15.Stack, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React19.createElement(import_ui15.Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React19.createElement(ContentPanelSearch, { searchAriaLabel })), /* @__PURE__ */ React19.createElement(ContentPanelStatusFilter, null), /* @__PURE__ */ React19.createElement(ContentPanelSort, null), addAction), /* @__PURE__ */ React19.createElement(ContentPanelActiveFilters, null)));
|
|
1491
|
+
return /* @__PURE__ */ React17.createElement(import_ui14.Box, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React17.createElement(import_ui14.Stack, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui14.Box, { 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)));
|
|
1534
1492
|
}
|
|
1535
1493
|
|
|
1536
1494
|
// src/components/panel/section-add-button.tsx
|
|
1537
|
-
var
|
|
1538
|
-
var
|
|
1495
|
+
var React18 = __toESM(require("react"));
|
|
1496
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
1539
1497
|
function SectionAddButton({ onBeforeCreate }) {
|
|
1540
1498
|
const { type, setEditMode } = usePostListContext();
|
|
1541
1499
|
const canCreate = useCanCreate(type);
|
|
1542
1500
|
const singularName = postTypesMap[type].labels.singular_name;
|
|
1543
|
-
const ariaLabel = (0,
|
|
1501
|
+
const ariaLabel = (0, import_i18n11.sprintf)(
|
|
1544
1502
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
1545
|
-
(0,
|
|
1503
|
+
(0, import_i18n11.__)("New %s", "elementor"),
|
|
1546
1504
|
singularName
|
|
1547
1505
|
);
|
|
1548
|
-
return /* @__PURE__ */
|
|
1506
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1549
1507
|
ContentPanelAddIconButton,
|
|
1550
1508
|
{
|
|
1551
1509
|
"aria-label": ariaLabel,
|
|
@@ -1560,10 +1518,10 @@ function SectionAddButton({ onBeforeCreate }) {
|
|
|
1560
1518
|
}
|
|
1561
1519
|
|
|
1562
1520
|
// src/components/panel/posts-list/collapsible-list.tsx
|
|
1563
|
-
var
|
|
1564
|
-
var
|
|
1565
|
-
var
|
|
1566
|
-
var
|
|
1521
|
+
var React19 = __toESM(require("react"));
|
|
1522
|
+
var import_react9 = require("react");
|
|
1523
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
1524
|
+
var import_ui15 = require("@elementor/ui");
|
|
1567
1525
|
var sectionHeaderListItemButtonSx = {
|
|
1568
1526
|
flexGrow: 1,
|
|
1569
1527
|
justifyContent: "flex-start",
|
|
@@ -1587,14 +1545,14 @@ function CollapsibleList({
|
|
|
1587
1545
|
trailingActions,
|
|
1588
1546
|
children
|
|
1589
1547
|
}) {
|
|
1590
|
-
const id = (0,
|
|
1548
|
+
const id = (0, import_react9.useId)();
|
|
1591
1549
|
const labelId = `label-${id}`;
|
|
1592
1550
|
const contentId = `content-${id}`;
|
|
1593
1551
|
const chipLabel = countChipLabel ?? count.toString();
|
|
1594
1552
|
const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
|
|
1595
1553
|
const handleClick = () => onOpenChange(!isOpen);
|
|
1596
|
-
return /* @__PURE__ */
|
|
1597
|
-
|
|
1554
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
1555
|
+
import_ui15.Box,
|
|
1598
1556
|
{
|
|
1599
1557
|
sx: {
|
|
1600
1558
|
...contentPanelSectionHeaderSx,
|
|
@@ -1604,8 +1562,8 @@ function CollapsibleList({
|
|
|
1604
1562
|
width: "100%"
|
|
1605
1563
|
}
|
|
1606
1564
|
},
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
|
|
1565
|
+
/* @__PURE__ */ React19.createElement(
|
|
1566
|
+
import_ui15.ListItemButton,
|
|
1609
1567
|
{
|
|
1610
1568
|
ref: headerRef,
|
|
1611
1569
|
id: labelId,
|
|
@@ -1618,8 +1576,8 @@ function CollapsibleList({
|
|
|
1618
1576
|
onClick: handleClick,
|
|
1619
1577
|
sx: sectionHeaderListItemButtonSx
|
|
1620
1578
|
},
|
|
1621
|
-
/* @__PURE__ */
|
|
1622
|
-
|
|
1579
|
+
/* @__PURE__ */ React19.createElement(import_ui15.Stack, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React19.createElement(import_ui15.Stack, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React19.createElement(
|
|
1580
|
+
import_ui15.ListItemText,
|
|
1623
1581
|
{
|
|
1624
1582
|
secondary: title,
|
|
1625
1583
|
secondaryTypographyProps: {
|
|
@@ -1629,10 +1587,10 @@ function CollapsibleList({
|
|
|
1629
1587
|
},
|
|
1630
1588
|
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
1631
1589
|
}
|
|
1632
|
-
), /* @__PURE__ */
|
|
1590
|
+
), /* @__PURE__ */ React19.createElement(import_ui15.Chip, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React19.createElement(import_editor_ui4.CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
|
|
1633
1591
|
),
|
|
1634
|
-
trailingActions && /* @__PURE__ */
|
|
1635
|
-
|
|
1592
|
+
trailingActions && /* @__PURE__ */ React19.createElement(
|
|
1593
|
+
import_ui15.Stack,
|
|
1636
1594
|
{
|
|
1637
1595
|
alignItems: "center",
|
|
1638
1596
|
direction: "row",
|
|
@@ -1642,17 +1600,17 @@ function CollapsibleList({
|
|
|
1642
1600
|
},
|
|
1643
1601
|
trailingActions
|
|
1644
1602
|
)
|
|
1645
|
-
), isOpen && sectionToolbar, /* @__PURE__ */
|
|
1603
|
+
), isOpen && sectionToolbar, /* @__PURE__ */ React19.createElement(import_ui15.Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React19.createElement(import_ui15.List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React19.createElement(import_ui15.Divider, null));
|
|
1646
1604
|
}
|
|
1647
1605
|
|
|
1648
1606
|
// src/components/panel/posts-list/error-state.tsx
|
|
1649
|
-
var
|
|
1650
|
-
var
|
|
1651
|
-
var
|
|
1652
|
-
var
|
|
1607
|
+
var React20 = __toESM(require("react"));
|
|
1608
|
+
var import_icons11 = require("@elementor/icons");
|
|
1609
|
+
var import_ui16 = require("@elementor/ui");
|
|
1610
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
1653
1611
|
function ErrorState() {
|
|
1654
|
-
return /* @__PURE__ */
|
|
1655
|
-
|
|
1612
|
+
return /* @__PURE__ */ React20.createElement(
|
|
1613
|
+
import_ui16.Box,
|
|
1656
1614
|
{
|
|
1657
1615
|
sx: {
|
|
1658
1616
|
display: "flex",
|
|
@@ -1663,9 +1621,9 @@ function ErrorState() {
|
|
|
1663
1621
|
gap: "16px"
|
|
1664
1622
|
}
|
|
1665
1623
|
},
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
|
|
1624
|
+
/* @__PURE__ */ React20.createElement(import_icons11.Error404TemplateIcon, null),
|
|
1625
|
+
/* @__PURE__ */ React20.createElement(
|
|
1626
|
+
import_ui16.Box,
|
|
1669
1627
|
{
|
|
1670
1628
|
sx: {
|
|
1671
1629
|
display: "flex",
|
|
@@ -1675,19 +1633,19 @@ function ErrorState() {
|
|
|
1675
1633
|
gap: "8px"
|
|
1676
1634
|
}
|
|
1677
1635
|
},
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1636
|
+
/* @__PURE__ */ React20.createElement(import_ui16.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n12.__)("We couldn\u2019t display your pages.", "elementor")),
|
|
1637
|
+
/* @__PURE__ */ React20.createElement(import_ui16.Box, null, /* @__PURE__ */ React20.createElement(import_ui16.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React20.createElement(import_ui16.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React20.createElement(import_ui16.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
|
|
1680
1638
|
)
|
|
1681
1639
|
);
|
|
1682
1640
|
}
|
|
1683
1641
|
|
|
1684
1642
|
// src/components/panel/posts-list/post-list-item.tsx
|
|
1685
|
-
var
|
|
1643
|
+
var React35 = __toESM(require("react"));
|
|
1686
1644
|
|
|
1687
1645
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
1688
|
-
var
|
|
1646
|
+
var React22 = __toESM(require("react"));
|
|
1689
1647
|
var import_editor_documents = require("@elementor/editor-documents");
|
|
1690
|
-
var
|
|
1648
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
1691
1649
|
|
|
1692
1650
|
// src/hooks/use-posts-actions.ts
|
|
1693
1651
|
var import_query7 = require("@elementor/query");
|
|
@@ -1767,12 +1725,12 @@ function useInvalidatePosts(postTypeSlug) {
|
|
|
1767
1725
|
};
|
|
1768
1726
|
}
|
|
1769
1727
|
|
|
1770
|
-
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
1771
|
-
var
|
|
1772
|
-
var
|
|
1773
|
-
var
|
|
1774
|
-
var
|
|
1775
|
-
var
|
|
1728
|
+
// src/components/panel/posts-list/list-items/edit-mode-template.tsx
|
|
1729
|
+
var React21 = __toESM(require("react"));
|
|
1730
|
+
var import_react10 = require("react");
|
|
1731
|
+
var import_icons12 = require("@elementor/icons");
|
|
1732
|
+
var import_ui17 = require("@elementor/ui");
|
|
1733
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
1776
1734
|
var EDIT_ROW_FOCUS_BORDER_WIDTH_PX = 2;
|
|
1777
1735
|
var EDIT_ROW_MIN_HEIGHT_PX = 36;
|
|
1778
1736
|
var editModeListItemButtonSx = {
|
|
@@ -1812,11 +1770,11 @@ var editRowInputSx = {
|
|
|
1812
1770
|
function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
1813
1771
|
const { resetEditMode } = usePostListContext();
|
|
1814
1772
|
const dismissEditMode = onDismiss ?? resetEditMode;
|
|
1815
|
-
const [title, setTitle] = (0,
|
|
1816
|
-
const [touched, setTouched] = (0,
|
|
1817
|
-
const [inputError, setInputError] = (0,
|
|
1818
|
-
const closeButton = (0,
|
|
1819
|
-
const hasSubmittedRef = (0,
|
|
1773
|
+
const [title, setTitle] = (0, import_react10.useState)(postTitle);
|
|
1774
|
+
const [touched, setTouched] = (0, import_react10.useState)(false);
|
|
1775
|
+
const [inputError, setInputError] = (0, import_react10.useState)(null);
|
|
1776
|
+
const closeButton = (0, import_react10.useRef)();
|
|
1777
|
+
const hasSubmittedRef = (0, import_react10.useRef)(false);
|
|
1820
1778
|
const onBlur = (e) => {
|
|
1821
1779
|
if (closeButton.current === e.relatedTarget) {
|
|
1822
1780
|
return;
|
|
@@ -1850,32 +1808,32 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
|
1850
1808
|
}
|
|
1851
1809
|
const value = e.target.value;
|
|
1852
1810
|
if (!validateInput(value)) {
|
|
1853
|
-
setInputError((0,
|
|
1811
|
+
setInputError((0, import_i18n13.__)("Name is required", "elementor"));
|
|
1854
1812
|
} else {
|
|
1855
1813
|
setInputError(null);
|
|
1856
1814
|
}
|
|
1857
1815
|
setTitle(value);
|
|
1858
1816
|
};
|
|
1859
|
-
return /* @__PURE__ */
|
|
1860
|
-
|
|
1817
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(
|
|
1818
|
+
import_ui17.ListItem,
|
|
1861
1819
|
{
|
|
1862
1820
|
disablePadding: true,
|
|
1863
1821
|
sx: contentPanelListRowPaddingSx,
|
|
1864
|
-
secondaryAction: /* @__PURE__ */
|
|
1822
|
+
secondaryAction: /* @__PURE__ */ React21.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
|
|
1865
1823
|
},
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
-
|
|
1824
|
+
/* @__PURE__ */ React21.createElement(
|
|
1825
|
+
import_ui17.Box,
|
|
1868
1826
|
{
|
|
1869
1827
|
component: "form",
|
|
1870
1828
|
onSubmit: onFormSubmit,
|
|
1871
1829
|
sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
|
|
1872
1830
|
},
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
|
|
1831
|
+
/* @__PURE__ */ React21.createElement(import_ui17.Box, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React21.createElement(
|
|
1832
|
+
import_ui17.Box,
|
|
1875
1833
|
{
|
|
1876
1834
|
autoFocus: true,
|
|
1877
1835
|
"aria-invalid": !!inputError,
|
|
1878
|
-
"aria-label": (0,
|
|
1836
|
+
"aria-label": (0, import_i18n13.__)("Name", "elementor"),
|
|
1879
1837
|
component: "input",
|
|
1880
1838
|
disabled: isLoading,
|
|
1881
1839
|
onBlur,
|
|
@@ -1886,10 +1844,10 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
|
|
|
1886
1844
|
}
|
|
1887
1845
|
))
|
|
1888
1846
|
)
|
|
1889
|
-
), inputError && /* @__PURE__ */
|
|
1847
|
+
), inputError && /* @__PURE__ */ React21.createElement(import_ui17.ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React21.createElement(import_ui17.ListItemText, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
|
|
1890
1848
|
}
|
|
1891
1849
|
function CloseButton({ isLoading, closeButton, onDismiss }) {
|
|
1892
|
-
return /* @__PURE__ */
|
|
1850
|
+
return /* @__PURE__ */ React21.createElement(import_ui17.IconButton, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React21.createElement(import_ui17.CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React21.createElement(import_icons12.XIcon, { fontSize: "tiny" }));
|
|
1893
1851
|
}
|
|
1894
1852
|
|
|
1895
1853
|
// src/components/panel/posts-list/list-items/list-item-create.tsx
|
|
@@ -1912,12 +1870,12 @@ function ListItemCreate() {
|
|
|
1912
1870
|
resetEditMode();
|
|
1913
1871
|
}
|
|
1914
1872
|
};
|
|
1915
|
-
const newItemLabel = (0,
|
|
1873
|
+
const newItemLabel = (0, import_i18n14.sprintf)(
|
|
1916
1874
|
/* translators: %s: Post type singular name (e.g. Page, Post). */
|
|
1917
|
-
(0,
|
|
1875
|
+
(0, import_i18n14.__)("New %s", "elementor"),
|
|
1918
1876
|
postTypesMap[type].labels.singular_name
|
|
1919
1877
|
);
|
|
1920
|
-
return /* @__PURE__ */
|
|
1878
|
+
return /* @__PURE__ */ React22.createElement(
|
|
1921
1879
|
EditModeTemplate,
|
|
1922
1880
|
{
|
|
1923
1881
|
postTitle: newItemLabel,
|
|
@@ -1928,9 +1886,9 @@ function ListItemCreate() {
|
|
|
1928
1886
|
}
|
|
1929
1887
|
|
|
1930
1888
|
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx
|
|
1931
|
-
var
|
|
1889
|
+
var React23 = __toESM(require("react"));
|
|
1932
1890
|
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
1933
|
-
var
|
|
1891
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
1934
1892
|
function ListItemDuplicate() {
|
|
1935
1893
|
const { type, editMode, resetEditMode } = usePostListContext();
|
|
1936
1894
|
const navigateToDocument = (0, import_editor_documents2.__useNavigateToDocument)();
|
|
@@ -1953,10 +1911,10 @@ function ListItemDuplicate() {
|
|
|
1953
1911
|
resetEditMode();
|
|
1954
1912
|
}
|
|
1955
1913
|
};
|
|
1956
|
-
return /* @__PURE__ */
|
|
1914
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1957
1915
|
EditModeTemplate,
|
|
1958
1916
|
{
|
|
1959
|
-
postTitle: `${editMode.details.title} ${(0,
|
|
1917
|
+
postTitle: `${editMode.details.title} ${(0, import_i18n15.__)("copy", "elementor")}`,
|
|
1960
1918
|
isLoading: duplicatePost.isPending,
|
|
1961
1919
|
callback: duplicatePostCallback
|
|
1962
1920
|
}
|
|
@@ -1964,7 +1922,7 @@ function ListItemDuplicate() {
|
|
|
1964
1922
|
}
|
|
1965
1923
|
|
|
1966
1924
|
// src/components/panel/posts-list/list-items/list-item-rename.tsx
|
|
1967
|
-
var
|
|
1925
|
+
var React24 = __toESM(require("react"));
|
|
1968
1926
|
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
1969
1927
|
|
|
1970
1928
|
// src/hooks/use-rename-active-document.ts
|
|
@@ -2015,24 +1973,24 @@ function ListItemRename({ post }) {
|
|
|
2015
1973
|
resetEditMode();
|
|
2016
1974
|
}
|
|
2017
1975
|
};
|
|
2018
|
-
return /* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ React24.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
|
|
2019
1977
|
}
|
|
2020
1978
|
|
|
2021
1979
|
// src/components/panel/posts-list/list-items/list-item-view.tsx
|
|
2022
|
-
var
|
|
2023
|
-
var
|
|
1980
|
+
var React34 = __toESM(require("react"));
|
|
1981
|
+
var import_react14 = require("react");
|
|
2024
1982
|
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
2025
|
-
var
|
|
2026
|
-
var
|
|
2027
|
-
var
|
|
1983
|
+
var import_icons20 = require("@elementor/icons");
|
|
1984
|
+
var import_ui23 = require("@elementor/ui");
|
|
1985
|
+
var import_i18n24 = require("@wordpress/i18n");
|
|
2028
1986
|
|
|
2029
1987
|
// src/components/shared/page-title-and-status.tsx
|
|
2030
|
-
var
|
|
2031
|
-
var
|
|
2032
|
-
var
|
|
1988
|
+
var React25 = __toESM(require("react"));
|
|
1989
|
+
var import_ui18 = require("@elementor/ui");
|
|
1990
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2033
1991
|
|
|
2034
1992
|
// src/hooks/use-reverse-html-entities.ts
|
|
2035
|
-
var
|
|
1993
|
+
var import_react11 = require("react");
|
|
2036
1994
|
|
|
2037
1995
|
// src/utils/post-title-plain.ts
|
|
2038
1996
|
function getPostTitlePlain(renderedTitle) {
|
|
@@ -2046,7 +2004,7 @@ function getPostTitlePlain(renderedTitle) {
|
|
|
2046
2004
|
|
|
2047
2005
|
// src/hooks/use-reverse-html-entities.ts
|
|
2048
2006
|
function useReverseHtmlEntities(escapedHTML = "") {
|
|
2049
|
-
return (0,
|
|
2007
|
+
return (0, import_react11.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
|
|
2050
2008
|
}
|
|
2051
2009
|
|
|
2052
2010
|
// src/components/shared/page-title-and-status.tsx
|
|
@@ -2056,19 +2014,19 @@ function humanizeStatusSlug(status) {
|
|
|
2056
2014
|
var statusChipConfig = {
|
|
2057
2015
|
draft: {
|
|
2058
2016
|
color: "default",
|
|
2059
|
-
label: (0,
|
|
2017
|
+
label: (0, import_i18n16.__)("Draft", "elementor")
|
|
2060
2018
|
},
|
|
2061
2019
|
future: {
|
|
2062
2020
|
color: "default",
|
|
2063
|
-
label: (0,
|
|
2021
|
+
label: (0, import_i18n16.__)("Scheduled", "elementor")
|
|
2064
2022
|
},
|
|
2065
2023
|
pending: {
|
|
2066
2024
|
color: "warning",
|
|
2067
|
-
label: (0,
|
|
2025
|
+
label: (0, import_i18n16.__)("Pending Review", "elementor")
|
|
2068
2026
|
},
|
|
2069
2027
|
private: {
|
|
2070
2028
|
color: "default",
|
|
2071
|
-
label: (0,
|
|
2029
|
+
label: (0, import_i18n16.__)("Private", "elementor")
|
|
2072
2030
|
}
|
|
2073
2031
|
};
|
|
2074
2032
|
function getStatusChipConfig(status) {
|
|
@@ -2090,8 +2048,8 @@ var PageStatus = ({ status }) => {
|
|
|
2090
2048
|
}
|
|
2091
2049
|
const { color, label } = getStatusChipConfig(status);
|
|
2092
2050
|
const isKnownStatus = isKnownPanelStatus(status);
|
|
2093
|
-
return /* @__PURE__ */
|
|
2094
|
-
|
|
2051
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2052
|
+
import_ui18.Chip,
|
|
2095
2053
|
{
|
|
2096
2054
|
color,
|
|
2097
2055
|
component: "span",
|
|
@@ -2116,8 +2074,8 @@ var PageStatus = ({ status }) => {
|
|
|
2116
2074
|
var PageTitle = ({ status, title }) => {
|
|
2117
2075
|
const modifiedTitle = useReverseHtmlEntities(title);
|
|
2118
2076
|
const titleColor = "trash" === status ? "text.disabled" : "text.secondary";
|
|
2119
|
-
return /* @__PURE__ */
|
|
2120
|
-
|
|
2077
|
+
return /* @__PURE__ */ React25.createElement(
|
|
2078
|
+
import_ui18.Typography,
|
|
2121
2079
|
{
|
|
2122
2080
|
component: "span",
|
|
2123
2081
|
variant: "body2",
|
|
@@ -2136,51 +2094,51 @@ var PageTitle = ({ status, title }) => {
|
|
|
2136
2094
|
);
|
|
2137
2095
|
};
|
|
2138
2096
|
function PageTitleAndStatus({ title, status }) {
|
|
2139
|
-
return /* @__PURE__ */
|
|
2097
|
+
return /* @__PURE__ */ React25.createElement(import_ui18.Box, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React25.createElement(PageTitle, { status, title }), /* @__PURE__ */ React25.createElement(PageStatus, { status }));
|
|
2140
2098
|
}
|
|
2141
2099
|
|
|
2142
2100
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
2143
|
-
var
|
|
2144
|
-
var
|
|
2101
|
+
var React27 = __toESM(require("react"));
|
|
2102
|
+
var import_react12 = require("react");
|
|
2145
2103
|
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
2146
|
-
var
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2104
|
+
var import_icons13 = require("@elementor/icons");
|
|
2105
|
+
var import_ui20 = require("@elementor/ui");
|
|
2106
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2149
2107
|
|
|
2150
2108
|
// src/components/panel/actions-menu/action-menu-item.tsx
|
|
2151
|
-
var
|
|
2152
|
-
var
|
|
2109
|
+
var React26 = __toESM(require("react"));
|
|
2110
|
+
var import_ui19 = require("@elementor/ui");
|
|
2153
2111
|
function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
|
|
2154
|
-
return /* @__PURE__ */
|
|
2155
|
-
|
|
2112
|
+
return /* @__PURE__ */ React26.createElement(import_ui19.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ React26.createElement(
|
|
2113
|
+
import_ui19.ListItemIcon,
|
|
2156
2114
|
{
|
|
2157
2115
|
sx: {
|
|
2158
2116
|
color: "inherit"
|
|
2159
2117
|
}
|
|
2160
2118
|
},
|
|
2161
|
-
/* @__PURE__ */
|
|
2162
|
-
), /* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ React26.createElement(Icon, null)
|
|
2120
|
+
), /* @__PURE__ */ React26.createElement(import_ui19.ListItemText, { primary: title, secondary: description }));
|
|
2163
2121
|
}
|
|
2164
2122
|
|
|
2165
2123
|
// src/components/panel/actions-menu/actions/delete.tsx
|
|
2166
2124
|
function Delete({ post }) {
|
|
2167
|
-
const [isDialogOpen, setIsDialogOpen] = (0,
|
|
2125
|
+
const [isDialogOpen, setIsDialogOpen] = (0, import_react12.useState)(false);
|
|
2168
2126
|
const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
|
|
2169
2127
|
const isPostActive = activeDocument?.id === post.id;
|
|
2170
2128
|
const userCanDelete = post.user_can.delete;
|
|
2171
2129
|
const isDisabled = !userCanDelete || post.isHome || isPostActive;
|
|
2172
|
-
return /* @__PURE__ */
|
|
2130
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
|
|
2173
2131
|
ActionMenuItem,
|
|
2174
2132
|
{
|
|
2175
|
-
title: (0,
|
|
2176
|
-
icon:
|
|
2133
|
+
title: (0, import_i18n17.__)("Delete", "elementor"),
|
|
2134
|
+
icon: import_icons13.TrashIcon,
|
|
2177
2135
|
MenuItemProps: {
|
|
2178
2136
|
disabled: isDisabled,
|
|
2179
2137
|
onClick: () => setIsDialogOpen(true),
|
|
2180
2138
|
sx: { "&:hover": { color: "error.main" } }
|
|
2181
2139
|
}
|
|
2182
2140
|
}
|
|
2183
|
-
), isDialogOpen && /* @__PURE__ */
|
|
2141
|
+
), isDialogOpen && /* @__PURE__ */ React27.createElement(DeleteDialog, { post, setIsDialogOpen }));
|
|
2184
2142
|
}
|
|
2185
2143
|
function DeleteDialog({
|
|
2186
2144
|
post,
|
|
@@ -2189,11 +2147,11 @@ function DeleteDialog({
|
|
|
2189
2147
|
const { type } = usePostListContext();
|
|
2190
2148
|
const { deletePost } = usePostActions(type);
|
|
2191
2149
|
const { setError } = usePostListContext();
|
|
2192
|
-
const dialogTitle = (0,
|
|
2193
|
-
const dialogBody = type === "post" ? (0,
|
|
2150
|
+
const dialogTitle = (0, import_i18n17.sprintf)((0, import_i18n17.__)('Delete "%s"?', "elementor"), post.title.rendered);
|
|
2151
|
+
const dialogBody = type === "post" ? (0, import_i18n17.__)(
|
|
2194
2152
|
"The post and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
2195
2153
|
"elementor"
|
|
2196
|
-
) : (0,
|
|
2154
|
+
) : (0, import_i18n17.__)(
|
|
2197
2155
|
"The page and its content will be deleted forever and we won\u2019t be able to recover them.",
|
|
2198
2156
|
"elementor"
|
|
2199
2157
|
);
|
|
@@ -2211,22 +2169,22 @@ function DeleteDialog({
|
|
|
2211
2169
|
}
|
|
2212
2170
|
setIsDialogOpen(false);
|
|
2213
2171
|
};
|
|
2214
|
-
return /* @__PURE__ */
|
|
2215
|
-
|
|
2172
|
+
return /* @__PURE__ */ React27.createElement(import_ui20.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React27.createElement(import_ui20.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React27.createElement(import_ui20.Divider, null), /* @__PURE__ */ React27.createElement(import_ui20.DialogContent, null, /* @__PURE__ */ React27.createElement(import_ui20.DialogContentText, null, dialogBody)), /* @__PURE__ */ React27.createElement(import_ui20.DialogActions, null, /* @__PURE__ */ React27.createElement(
|
|
2173
|
+
import_ui20.Button,
|
|
2216
2174
|
{
|
|
2217
2175
|
variant: "contained",
|
|
2218
2176
|
color: "secondary",
|
|
2219
2177
|
onClick: handleCancel,
|
|
2220
2178
|
disabled: deletePost.isPending
|
|
2221
2179
|
},
|
|
2222
|
-
(0,
|
|
2223
|
-
), /* @__PURE__ */
|
|
2180
|
+
(0, import_i18n17.__)("Cancel", "elementor")
|
|
2181
|
+
), /* @__PURE__ */ React27.createElement(import_ui20.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n17.__)("Delete", "elementor") : /* @__PURE__ */ React27.createElement(import_ui20.CircularProgress, null))));
|
|
2224
2182
|
}
|
|
2225
2183
|
|
|
2226
2184
|
// src/components/panel/actions-menu/actions/duplicate.tsx
|
|
2227
|
-
var
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2185
|
+
var React28 = __toESM(require("react"));
|
|
2186
|
+
var import_icons14 = require("@elementor/icons");
|
|
2187
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2230
2188
|
function Duplicate({ post, popupState }) {
|
|
2231
2189
|
const { setEditMode, type } = usePostListContext();
|
|
2232
2190
|
const canCreate = useCanCreate(type);
|
|
@@ -2241,11 +2199,11 @@ function Duplicate({ post, popupState }) {
|
|
|
2241
2199
|
});
|
|
2242
2200
|
};
|
|
2243
2201
|
const isDisabled = !canCreate;
|
|
2244
|
-
return /* @__PURE__ */
|
|
2202
|
+
return /* @__PURE__ */ React28.createElement(
|
|
2245
2203
|
ActionMenuItem,
|
|
2246
2204
|
{
|
|
2247
|
-
title: (0,
|
|
2248
|
-
icon:
|
|
2205
|
+
title: (0, import_i18n18.__)("Duplicate", "elementor"),
|
|
2206
|
+
icon: import_icons14.CopyIcon,
|
|
2249
2207
|
MenuItemProps: {
|
|
2250
2208
|
disabled: isDisabled,
|
|
2251
2209
|
onClick
|
|
@@ -2255,25 +2213,25 @@ function Duplicate({ post, popupState }) {
|
|
|
2255
2213
|
}
|
|
2256
2214
|
|
|
2257
2215
|
// src/components/panel/actions-menu/actions/force-delete.tsx
|
|
2258
|
-
var
|
|
2259
|
-
var
|
|
2260
|
-
var
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2216
|
+
var React29 = __toESM(require("react"));
|
|
2217
|
+
var import_react13 = require("react");
|
|
2218
|
+
var import_icons15 = require("@elementor/icons");
|
|
2219
|
+
var import_ui21 = require("@elementor/ui");
|
|
2220
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2263
2221
|
function ForceDelete({ post }) {
|
|
2264
|
-
const [isDialogOpen, setIsDialogOpen] = (0,
|
|
2265
|
-
return /* @__PURE__ */
|
|
2222
|
+
const [isDialogOpen, setIsDialogOpen] = (0, import_react13.useState)(false);
|
|
2223
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
2266
2224
|
ActionMenuItem,
|
|
2267
2225
|
{
|
|
2268
|
-
icon:
|
|
2226
|
+
icon: import_icons15.TrashIcon,
|
|
2269
2227
|
MenuItemProps: {
|
|
2270
2228
|
disabled: !post.user_can.delete,
|
|
2271
2229
|
onClick: () => setIsDialogOpen(true),
|
|
2272
2230
|
sx: { "&:hover": { color: "error.main" } }
|
|
2273
2231
|
},
|
|
2274
|
-
title: (0,
|
|
2232
|
+
title: (0, import_i18n19.__)("Delete permanently", "elementor")
|
|
2275
2233
|
}
|
|
2276
|
-
), isDialogOpen && /* @__PURE__ */
|
|
2234
|
+
), isDialogOpen && /* @__PURE__ */ React29.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
|
|
2277
2235
|
}
|
|
2278
2236
|
function ForceDeleteDialog({
|
|
2279
2237
|
post,
|
|
@@ -2281,8 +2239,8 @@ function ForceDeleteDialog({
|
|
|
2281
2239
|
}) {
|
|
2282
2240
|
const { setError, type } = usePostListContext();
|
|
2283
2241
|
const { forceDeletePost } = usePostActions(type);
|
|
2284
|
-
const dialogTitle = (0,
|
|
2285
|
-
const dialogBody = (0,
|
|
2242
|
+
const dialogTitle = (0, import_i18n19.sprintf)((0, import_i18n19.__)('Delete "%s" permanently?', "elementor"), post.title.rendered);
|
|
2243
|
+
const dialogBody = (0, import_i18n19.__)("This will permanently delete the item. You cannot undo this action.", "elementor");
|
|
2286
2244
|
const handleDelete = async () => {
|
|
2287
2245
|
try {
|
|
2288
2246
|
await forceDeletePost.mutateAsync(post.id);
|
|
@@ -2298,38 +2256,38 @@ function ForceDeleteDialog({
|
|
|
2298
2256
|
}
|
|
2299
2257
|
setIsDialogOpen(false);
|
|
2300
2258
|
};
|
|
2301
|
-
return /* @__PURE__ */
|
|
2302
|
-
|
|
2259
|
+
return /* @__PURE__ */ React29.createElement(import_ui21.Dialog, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React29.createElement(import_ui21.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React29.createElement(import_ui21.Divider, null), /* @__PURE__ */ React29.createElement(import_ui21.DialogContent, null, /* @__PURE__ */ React29.createElement(import_ui21.DialogContentText, null, dialogBody)), /* @__PURE__ */ React29.createElement(import_ui21.DialogActions, null, /* @__PURE__ */ React29.createElement(
|
|
2260
|
+
import_ui21.Button,
|
|
2303
2261
|
{
|
|
2304
2262
|
variant: "contained",
|
|
2305
2263
|
color: "secondary",
|
|
2306
2264
|
onClick: handleCancel,
|
|
2307
2265
|
disabled: forceDeletePost.isPending
|
|
2308
2266
|
},
|
|
2309
|
-
(0,
|
|
2310
|
-
), /* @__PURE__ */
|
|
2311
|
-
|
|
2267
|
+
(0, import_i18n19.__)("Cancel", "elementor")
|
|
2268
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2269
|
+
import_ui21.Button,
|
|
2312
2270
|
{
|
|
2313
2271
|
variant: "contained",
|
|
2314
2272
|
color: "error",
|
|
2315
2273
|
onClick: () => void handleDelete(),
|
|
2316
2274
|
disabled: forceDeletePost.isPending
|
|
2317
2275
|
},
|
|
2318
|
-
!forceDeletePost.isPending ? (0,
|
|
2276
|
+
!forceDeletePost.isPending ? (0, import_i18n19.__)("Delete permanently", "elementor") : /* @__PURE__ */ React29.createElement(import_ui21.CircularProgress, null)
|
|
2319
2277
|
)));
|
|
2320
2278
|
}
|
|
2321
2279
|
|
|
2322
2280
|
// src/components/panel/actions-menu/actions/rename.tsx
|
|
2323
|
-
var
|
|
2324
|
-
var
|
|
2325
|
-
var
|
|
2281
|
+
var React30 = __toESM(require("react"));
|
|
2282
|
+
var import_icons16 = require("@elementor/icons");
|
|
2283
|
+
var import_i18n20 = require("@wordpress/i18n");
|
|
2326
2284
|
function Rename({ post }) {
|
|
2327
2285
|
const { setEditMode } = usePostListContext();
|
|
2328
|
-
return /* @__PURE__ */
|
|
2286
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2329
2287
|
ActionMenuItem,
|
|
2330
2288
|
{
|
|
2331
|
-
title: (0,
|
|
2332
|
-
icon:
|
|
2289
|
+
title: (0, import_i18n20.__)("Rename", "elementor"),
|
|
2290
|
+
icon: import_icons16.EraseIcon,
|
|
2333
2291
|
MenuItemProps: {
|
|
2334
2292
|
disabled: !post.user_can.edit,
|
|
2335
2293
|
onClick: () => {
|
|
@@ -2346,9 +2304,9 @@ function Rename({ post }) {
|
|
|
2346
2304
|
}
|
|
2347
2305
|
|
|
2348
2306
|
// src/components/panel/actions-menu/actions/restore.tsx
|
|
2349
|
-
var
|
|
2350
|
-
var
|
|
2351
|
-
var
|
|
2307
|
+
var React31 = __toESM(require("react"));
|
|
2308
|
+
var import_icons17 = require("@elementor/icons");
|
|
2309
|
+
var import_i18n21 = require("@wordpress/i18n");
|
|
2352
2310
|
function Restore({ post }) {
|
|
2353
2311
|
const { setError, type } = usePostListContext();
|
|
2354
2312
|
const { restorePost } = usePostActions(type);
|
|
@@ -2359,12 +2317,12 @@ function Restore({ post }) {
|
|
|
2359
2317
|
setError();
|
|
2360
2318
|
}
|
|
2361
2319
|
};
|
|
2362
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ React31.createElement(
|
|
2363
2321
|
ActionMenuItem,
|
|
2364
2322
|
{
|
|
2365
|
-
description: (0,
|
|
2366
|
-
title: (0,
|
|
2367
|
-
icon:
|
|
2323
|
+
description: (0, import_i18n21.__)("Restored as draft", "elementor"),
|
|
2324
|
+
title: (0, import_i18n21.__)("Restore", "elementor"),
|
|
2325
|
+
icon: import_icons17.RefreshIcon,
|
|
2368
2326
|
MenuItemProps: {
|
|
2369
2327
|
disabled: restorePost.isPending || !post.user_can.delete,
|
|
2370
2328
|
onClick: () => void handleClick()
|
|
@@ -2374,11 +2332,11 @@ function Restore({ post }) {
|
|
|
2374
2332
|
}
|
|
2375
2333
|
|
|
2376
2334
|
// src/components/panel/actions-menu/actions/set-home.tsx
|
|
2377
|
-
var
|
|
2378
|
-
var
|
|
2379
|
-
var
|
|
2380
|
-
var
|
|
2381
|
-
var
|
|
2335
|
+
var React32 = __toESM(require("react"));
|
|
2336
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
2337
|
+
var import_icons18 = require("@elementor/icons");
|
|
2338
|
+
var import_ui22 = require("@elementor/ui");
|
|
2339
|
+
var import_i18n22 = require("@wordpress/i18n");
|
|
2382
2340
|
|
|
2383
2341
|
// src/hooks/use-homepage-actions.ts
|
|
2384
2342
|
var import_query8 = require("@elementor/query");
|
|
@@ -2436,12 +2394,12 @@ function SetHome({ post, closeMenu, onRequestRemoveHomepage }) {
|
|
|
2436
2394
|
const isSetHomeDisabled = !canManageOptions || !isPostPublished || updateSettingsMutation.isPending;
|
|
2437
2395
|
const isRemoveHomeDisabled = !canManageOptions || updateSettingsMutation.isPending;
|
|
2438
2396
|
const isDisabled = isPostHomepage ? isRemoveHomeDisabled : isSetHomeDisabled;
|
|
2439
|
-
const title = isPostHomepage ? (0,
|
|
2440
|
-
return /* @__PURE__ */
|
|
2397
|
+
const title = isPostHomepage ? (0, import_i18n22.__)("Remove as homepage", "elementor") : (0, import_i18n22.__)("Set as homepage", "elementor");
|
|
2398
|
+
return /* @__PURE__ */ React32.createElement(
|
|
2441
2399
|
ActionMenuItem,
|
|
2442
2400
|
{
|
|
2443
2401
|
title,
|
|
2444
|
-
icon: !updateSettingsMutation.isPending ?
|
|
2402
|
+
icon: !updateSettingsMutation.isPending ? import_icons18.HomeIcon : import_ui22.CircularProgress,
|
|
2445
2403
|
MenuItemProps: {
|
|
2446
2404
|
disabled: isDisabled,
|
|
2447
2405
|
onClick: handleMenuClick
|
|
@@ -2474,12 +2432,12 @@ function RemoveHomepageDialog({ open, onClose }) {
|
|
|
2474
2432
|
}
|
|
2475
2433
|
};
|
|
2476
2434
|
const isPending = updateSettingsMutation.isPending;
|
|
2477
|
-
const removeHomepageLabel = (0,
|
|
2478
|
-
return /* @__PURE__ */
|
|
2435
|
+
const removeHomepageLabel = (0, import_i18n22.__)("Remove as homepage", "elementor");
|
|
2436
|
+
return /* @__PURE__ */ React32.createElement(import_editor_ui5.ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React32.createElement(import_editor_ui5.ConfirmationDialog.Title, { iconColor: "secondary" }, (0, import_i18n22.__)("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React32.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React32.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n22.__)(
|
|
2479
2437
|
"Your homepage will go back to showing your latest posts. You can set a page as your homepage again at any time.",
|
|
2480
2438
|
"elementor"
|
|
2481
|
-
))), /* @__PURE__ */
|
|
2482
|
-
|
|
2439
|
+
))), /* @__PURE__ */ React32.createElement(import_ui22.DialogActions, null, /* @__PURE__ */ React32.createElement(import_ui22.Button, { color: "secondary", disabled: isPending, onClick: handleCancel }, (0, import_i18n22.__)("Not now", "elementor")), /* @__PURE__ */ React32.createElement(
|
|
2440
|
+
import_ui22.Button,
|
|
2483
2441
|
{
|
|
2484
2442
|
color: "secondary",
|
|
2485
2443
|
disabled: isPending,
|
|
@@ -2487,22 +2445,22 @@ function RemoveHomepageDialog({ open, onClose }) {
|
|
|
2487
2445
|
sx: { ml: 1 },
|
|
2488
2446
|
variant: "contained"
|
|
2489
2447
|
},
|
|
2490
|
-
!isPending ? removeHomepageLabel : /* @__PURE__ */
|
|
2448
|
+
!isPending ? removeHomepageLabel : /* @__PURE__ */ React32.createElement(import_ui22.CircularProgress, null)
|
|
2491
2449
|
)));
|
|
2492
2450
|
}
|
|
2493
2451
|
|
|
2494
2452
|
// src/components/panel/actions-menu/actions/view.tsx
|
|
2495
|
-
var
|
|
2496
|
-
var
|
|
2497
|
-
var
|
|
2453
|
+
var React33 = __toESM(require("react"));
|
|
2454
|
+
var import_icons19 = require("@elementor/icons");
|
|
2455
|
+
var import_i18n23 = require("@wordpress/i18n");
|
|
2498
2456
|
function View({ post }) {
|
|
2499
2457
|
const { type } = usePostListContext();
|
|
2500
|
-
const title = (0,
|
|
2501
|
-
return /* @__PURE__ */
|
|
2458
|
+
const title = (0, import_i18n23.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
|
|
2459
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2502
2460
|
ActionMenuItem,
|
|
2503
2461
|
{
|
|
2504
2462
|
title,
|
|
2505
|
-
icon:
|
|
2463
|
+
icon: import_icons19.EyeIcon,
|
|
2506
2464
|
MenuItemProps: {
|
|
2507
2465
|
onClick: () => window.open(post.link, "_blank")
|
|
2508
2466
|
}
|
|
@@ -2525,17 +2483,17 @@ var DisabledPostTooltip = ({
|
|
|
2525
2483
|
postTypeSlug
|
|
2526
2484
|
}) => {
|
|
2527
2485
|
if (isDisabled) {
|
|
2528
|
-
const title = /* @__PURE__ */
|
|
2529
|
-
return /* @__PURE__ */
|
|
2486
|
+
const title = /* @__PURE__ */ React34.createElement(import_ui23.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React34.createElement("br", null), (0, import_i18n24.__)("To edit it directly, contact the site owner", "elementor"));
|
|
2487
|
+
return /* @__PURE__ */ React34.createElement(import_ui23.Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React34.createElement("span", null, children));
|
|
2530
2488
|
}
|
|
2531
|
-
return /* @__PURE__ */
|
|
2489
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, children);
|
|
2532
2490
|
};
|
|
2533
2491
|
function ListItemView({ post }) {
|
|
2534
2492
|
const { type } = usePostListContext();
|
|
2535
|
-
const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] = (0,
|
|
2493
|
+
const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] = (0, import_react14.useState)(false);
|
|
2536
2494
|
const activeDocument = (0, import_editor_documents5.__useActiveDocument)();
|
|
2537
2495
|
const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
|
|
2538
|
-
const popupState = (0,
|
|
2496
|
+
const popupState = (0, import_ui23.usePopupState)({
|
|
2539
2497
|
variant: "popover",
|
|
2540
2498
|
popupId: "post-actions",
|
|
2541
2499
|
disableAutoFocus: true
|
|
@@ -2546,24 +2504,32 @@ function ListItemView({ post }) {
|
|
|
2546
2504
|
const isTrashed = "trash" === post.status;
|
|
2547
2505
|
const isEditBlocked = !post.user_can.edit && !isTrashed;
|
|
2548
2506
|
const isRowDisabled = isEditBlocked || isTrashed;
|
|
2549
|
-
const menuTriggerProps = (0,
|
|
2507
|
+
const menuTriggerProps = (0, import_ui23.bindTrigger)(popupState);
|
|
2550
2508
|
const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
|
|
2551
2509
|
const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
|
|
2552
2510
|
const isHome = Boolean(post.isHome);
|
|
2553
2511
|
const trailingActionCount = 1 + (showListItemActions ? 1 : 0) + (isHome ? 1 : 0);
|
|
2554
2512
|
const allowRowHover = !isEditBlocked;
|
|
2555
|
-
const listRow = /* @__PURE__ */
|
|
2556
|
-
|
|
2513
|
+
const listRow = /* @__PURE__ */ React34.createElement(
|
|
2514
|
+
import_ui23.ListItem,
|
|
2557
2515
|
{
|
|
2558
2516
|
disablePadding: true,
|
|
2559
|
-
sx:
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2517
|
+
sx: getContentPanelListItemSx(trailingActionCount),
|
|
2518
|
+
secondaryAction: /* @__PURE__ */ React34.createElement(import_ui23.Stack, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React34.createElement(SiteContentListItemActionsSlot, { post, title }), isHome ? /* @__PURE__ */ React34.createElement(
|
|
2519
|
+
import_ui23.IconButton,
|
|
2520
|
+
{
|
|
2521
|
+
"aria-label": (0, import_i18n24.__)("Homepage", "elementor"),
|
|
2522
|
+
disableRipple: true,
|
|
2523
|
+
disabled: true,
|
|
2524
|
+
size: "tiny",
|
|
2525
|
+
sx: { pointerEvents: "none" },
|
|
2526
|
+
tabIndex: -1
|
|
2527
|
+
},
|
|
2528
|
+
/* @__PURE__ */ React34.createElement(import_icons20.HomeIcon, { color: "disabled", fontSize: "tiny" })
|
|
2529
|
+
) : null, /* @__PURE__ */ React34.createElement(
|
|
2530
|
+
import_ui23.IconButton,
|
|
2565
2531
|
{
|
|
2566
|
-
"aria-label": (0,
|
|
2532
|
+
"aria-label": (0, import_i18n24.__)("More actions", "elementor"),
|
|
2567
2533
|
size: "tiny",
|
|
2568
2534
|
...menuTriggerProps,
|
|
2569
2535
|
onClick: (event) => {
|
|
@@ -2571,11 +2537,11 @@ function ListItemView({ post }) {
|
|
|
2571
2537
|
menuTriggerProps.onClick?.(event);
|
|
2572
2538
|
}
|
|
2573
2539
|
},
|
|
2574
|
-
/* @__PURE__ */
|
|
2540
|
+
/* @__PURE__ */ React34.createElement(import_icons20.DotsVerticalIcon, { fontSize: "tiny" })
|
|
2575
2541
|
))
|
|
2576
2542
|
},
|
|
2577
|
-
/* @__PURE__ */
|
|
2578
|
-
|
|
2543
|
+
/* @__PURE__ */ React34.createElement(
|
|
2544
|
+
import_ui23.ListItemButton,
|
|
2579
2545
|
{
|
|
2580
2546
|
dense: true,
|
|
2581
2547
|
disableGutters: true,
|
|
@@ -2588,19 +2554,23 @@ function ListItemView({ post }) {
|
|
|
2588
2554
|
},
|
|
2589
2555
|
selected: isActive,
|
|
2590
2556
|
shape: "rounded",
|
|
2591
|
-
sx:
|
|
2557
|
+
sx: {
|
|
2558
|
+
...contentPanelListItemButtonSx,
|
|
2559
|
+
...getContentPanelListItemRowStateSx(isActive, allowRowHover),
|
|
2560
|
+
borderRadius: 1
|
|
2561
|
+
}
|
|
2592
2562
|
},
|
|
2593
|
-
/* @__PURE__ */
|
|
2563
|
+
/* @__PURE__ */ React34.createElement(import_ui23.ListItemText, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React34.createElement(PageTitleAndStatus, { title, status }))
|
|
2594
2564
|
)
|
|
2595
2565
|
);
|
|
2596
|
-
return /* @__PURE__ */
|
|
2597
|
-
|
|
2566
|
+
return /* @__PURE__ */ React34.createElement(React34.Fragment, null, isEditBlocked ? /* @__PURE__ */ React34.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React34.createElement(
|
|
2567
|
+
import_ui23.Menu,
|
|
2598
2568
|
{
|
|
2599
2569
|
PaperProps: { sx: { mt: 2, width: 200 } },
|
|
2600
2570
|
MenuListProps: { dense: true },
|
|
2601
|
-
...(0,
|
|
2571
|
+
...(0, import_ui23.bindMenu)(popupState)
|
|
2602
2572
|
},
|
|
2603
|
-
isTrashed ? /* @__PURE__ */
|
|
2573
|
+
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(import_ui23.Divider, null), /* @__PURE__ */ React34.createElement(
|
|
2604
2574
|
SetHome,
|
|
2605
2575
|
{
|
|
2606
2576
|
post,
|
|
@@ -2608,7 +2578,7 @@ function ListItemView({ post }) {
|
|
|
2608
2578
|
onRequestRemoveHomepage: () => setIsRemoveHomeDialogOpen(true)
|
|
2609
2579
|
}
|
|
2610
2580
|
)))
|
|
2611
|
-
), /* @__PURE__ */
|
|
2581
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2612
2582
|
RemoveHomepageDialog,
|
|
2613
2583
|
{
|
|
2614
2584
|
open: isRemoveHomeDialogOpen,
|
|
@@ -2621,25 +2591,25 @@ function ListItemView({ post }) {
|
|
|
2621
2591
|
function PostListItem({ post }) {
|
|
2622
2592
|
const { editMode } = usePostListContext();
|
|
2623
2593
|
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
|
|
2624
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ React35.createElement(ListItemRename, { post });
|
|
2625
2595
|
}
|
|
2626
2596
|
if ("create" === editMode.mode && !post) {
|
|
2627
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ React35.createElement(ListItemCreate, null);
|
|
2628
2598
|
}
|
|
2629
2599
|
if ("duplicate" === editMode.mode && !post) {
|
|
2630
|
-
return /* @__PURE__ */
|
|
2600
|
+
return /* @__PURE__ */ React35.createElement(ListItemDuplicate, null);
|
|
2631
2601
|
}
|
|
2632
2602
|
if (!post) {
|
|
2633
2603
|
return null;
|
|
2634
2604
|
}
|
|
2635
|
-
return /* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ React35.createElement(ListItemView, { post });
|
|
2636
2606
|
}
|
|
2637
2607
|
|
|
2638
2608
|
// src/components/panel/posts-list/post-list-pagination-actions.tsx
|
|
2639
|
-
var
|
|
2640
|
-
var
|
|
2641
|
-
var
|
|
2642
|
-
var
|
|
2609
|
+
var React36 = __toESM(require("react"));
|
|
2610
|
+
var import_editor_ui6 = require("@elementor/editor-ui");
|
|
2611
|
+
var import_ui24 = require("@elementor/ui");
|
|
2612
|
+
var import_i18n25 = require("@wordpress/i18n");
|
|
2643
2613
|
var listPaginationButtonProps = {
|
|
2644
2614
|
color: "secondary",
|
|
2645
2615
|
size: "small",
|
|
@@ -2656,28 +2626,28 @@ function PostListPaginationActions({
|
|
|
2656
2626
|
if (!canLoadMore && !canShowLess) {
|
|
2657
2627
|
return null;
|
|
2658
2628
|
}
|
|
2659
|
-
const loadMoreLabel = (0,
|
|
2660
|
-
const showLessLabel = (0,
|
|
2661
|
-
const loadMoreButton = /* @__PURE__ */
|
|
2662
|
-
|
|
2629
|
+
const loadMoreLabel = (0, import_i18n25.__)("Load more", "elementor");
|
|
2630
|
+
const showLessLabel = (0, import_i18n25.__)("Show less", "elementor");
|
|
2631
|
+
const loadMoreButton = /* @__PURE__ */ React36.createElement(
|
|
2632
|
+
import_ui24.Button,
|
|
2663
2633
|
{
|
|
2664
2634
|
...listPaginationButtonProps,
|
|
2665
2635
|
ref: loadMoreButtonRef,
|
|
2666
2636
|
"aria-label": loadMoreLabel,
|
|
2667
2637
|
disabled: isLoadingMore,
|
|
2668
|
-
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */
|
|
2638
|
+
endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React36.createElement(import_editor_ui6.CollapseIcon, { open: false }),
|
|
2669
2639
|
fullWidth: true,
|
|
2670
2640
|
onClick: onLoadMore,
|
|
2671
2641
|
sx: { flex: 1, my: 0.5 }
|
|
2672
2642
|
},
|
|
2673
|
-
isLoadingMore ? /* @__PURE__ */
|
|
2643
|
+
isLoadingMore ? /* @__PURE__ */ React36.createElement(import_ui24.CircularProgress, { size: 20 }) : loadMoreLabel
|
|
2674
2644
|
);
|
|
2675
|
-
const showLessButton = /* @__PURE__ */
|
|
2676
|
-
|
|
2645
|
+
const showLessButton = /* @__PURE__ */ React36.createElement(
|
|
2646
|
+
import_ui24.Button,
|
|
2677
2647
|
{
|
|
2678
2648
|
...listPaginationButtonProps,
|
|
2679
2649
|
"aria-label": showLessLabel,
|
|
2680
|
-
endIcon: /* @__PURE__ */
|
|
2650
|
+
endIcon: /* @__PURE__ */ React36.createElement(import_editor_ui6.CollapseIcon, { open: true }),
|
|
2681
2651
|
fullWidth: true,
|
|
2682
2652
|
onClick: onShowLess,
|
|
2683
2653
|
sx: { flex: 1, my: 0.5 }
|
|
@@ -2685,21 +2655,22 @@ function PostListPaginationActions({
|
|
|
2685
2655
|
showLessLabel
|
|
2686
2656
|
);
|
|
2687
2657
|
if (canShowLess && canLoadMore) {
|
|
2688
|
-
return /* @__PURE__ */
|
|
2658
|
+
return /* @__PURE__ */ React36.createElement(import_ui24.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React36.createElement(import_ui24.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
|
|
2689
2659
|
}
|
|
2690
|
-
return /* @__PURE__ */
|
|
2660
|
+
return /* @__PURE__ */ React36.createElement(import_ui24.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
|
|
2691
2661
|
}
|
|
2692
2662
|
|
|
2693
2663
|
// src/components/panel/posts-list/posts-collapsible-list.tsx
|
|
2694
|
-
function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
2664
|
+
function PostsCollapsibleListContent({ isOpenByDefault = false, layout = "accordion" }) {
|
|
2665
|
+
const isFlatLayout = layout === "flat";
|
|
2695
2666
|
const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
|
|
2696
2667
|
const { registerSection, unregisterSection } = useContentPanelCoordinator();
|
|
2697
2668
|
const { clearStatusFilters, debouncedSearch, siteContentSort, statusFilters } = useSiteContentSectionToolbar();
|
|
2698
|
-
const [isOpen, setIsOpen] = (0,
|
|
2699
|
-
const focusAfterShowLessRef = (0,
|
|
2700
|
-
const listTopRef = (0,
|
|
2701
|
-
const loadMoreButtonRef = (0,
|
|
2702
|
-
const sectionHeaderRef = (0,
|
|
2669
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(isFlatLayout || isOpenByDefault);
|
|
2670
|
+
const focusAfterShowLessRef = (0, import_react15.useRef)(false);
|
|
2671
|
+
const listTopRef = (0, import_react15.useRef)(null);
|
|
2672
|
+
const loadMoreButtonRef = (0, import_react15.useRef)(null);
|
|
2673
|
+
const sectionHeaderRef = (0, import_react15.useRef)(null);
|
|
2703
2674
|
const {
|
|
2704
2675
|
data: { posts, total },
|
|
2705
2676
|
isError: postsError,
|
|
@@ -2715,12 +2686,12 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2715
2686
|
const { data: homepageId } = useHomepage();
|
|
2716
2687
|
const isPageType = type === "page";
|
|
2717
2688
|
const statusFiltersKey = serializeSiteContentStatusFilters(statusFilters);
|
|
2718
|
-
(0,
|
|
2689
|
+
(0, import_react15.useEffect)(() => {
|
|
2719
2690
|
if (isTrashFilter) {
|
|
2720
2691
|
resetEditMode();
|
|
2721
2692
|
}
|
|
2722
2693
|
}, [isTrashFilter, resetEditMode]);
|
|
2723
|
-
(0,
|
|
2694
|
+
(0, import_react15.useEffect)(() => {
|
|
2724
2695
|
registerSection(type, {
|
|
2725
2696
|
setExpanded: setIsOpen,
|
|
2726
2697
|
startCreate: () => {
|
|
@@ -2732,7 +2703,7 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2732
2703
|
});
|
|
2733
2704
|
return () => unregisterSection(type);
|
|
2734
2705
|
}, [clearStatusFilters, registerSection, setEditMode, statusFilters, type, unregisterSection]);
|
|
2735
|
-
const filteredPosts = (0,
|
|
2706
|
+
const filteredPosts = (0, import_react15.useMemo)(() => {
|
|
2736
2707
|
if (!posts) {
|
|
2737
2708
|
return [];
|
|
2738
2709
|
}
|
|
@@ -2757,7 +2728,7 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2757
2728
|
resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}:${siteContentSort}`,
|
|
2758
2729
|
totalCount: total
|
|
2759
2730
|
});
|
|
2760
|
-
const displayedPosts = (0,
|
|
2731
|
+
const displayedPosts = (0, import_react15.useMemo)(
|
|
2761
2732
|
() => filteredPosts.slice(0, pagination.visibleCount),
|
|
2762
2733
|
[filteredPosts, pagination.visibleCount]
|
|
2763
2734
|
);
|
|
@@ -2769,7 +2740,7 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2769
2740
|
listTop.scrollIntoView({ block: "nearest" });
|
|
2770
2741
|
}
|
|
2771
2742
|
};
|
|
2772
|
-
(0,
|
|
2743
|
+
(0, import_react15.useEffect)(() => {
|
|
2773
2744
|
if (!focusAfterShowLessRef.current) {
|
|
2774
2745
|
return;
|
|
2775
2746
|
}
|
|
@@ -2781,27 +2752,56 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2781
2752
|
}
|
|
2782
2753
|
sectionHeaderRef.current?.focus();
|
|
2783
2754
|
}, [pagination.canLoadMore, pagination.visibleCount]);
|
|
2784
|
-
(0,
|
|
2755
|
+
(0, import_react15.useEffect)(() => {
|
|
2756
|
+
if (isFlatLayout) {
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2785
2759
|
if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
|
|
2786
2760
|
setIsOpen(true);
|
|
2787
2761
|
}
|
|
2788
|
-
}, [debouncedSearch, filteredPosts.length, statusFilters]);
|
|
2762
|
+
}, [debouncedSearch, filteredPosts.length, isFlatLayout, statusFilters]);
|
|
2789
2763
|
if (postsError) {
|
|
2790
|
-
return /* @__PURE__ */
|
|
2764
|
+
return /* @__PURE__ */ React37.createElement(ErrorState, null);
|
|
2791
2765
|
}
|
|
2792
2766
|
if (postsPending && !posts?.length) {
|
|
2793
|
-
return /* @__PURE__ */
|
|
2767
|
+
return /* @__PURE__ */ React37.createElement(import_ui25.Box, { sx: { px: 2 } }, /* @__PURE__ */ React37.createElement(import_ui25.Box, null, /* @__PURE__ */ React37.createElement(import_ui25.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React37.createElement(import_ui25.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React37.createElement(import_ui25.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React37.createElement(import_ui25.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
|
|
2794
2768
|
}
|
|
2795
2769
|
const displayCount = total;
|
|
2796
2770
|
const sectionTitle = postTypesMap[type].labels.plural_name;
|
|
2797
2771
|
const showNoResults = (debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length === 0;
|
|
2798
2772
|
const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
|
|
2799
|
-
const searchAriaLabel = (0,
|
|
2773
|
+
const searchAriaLabel = (0, import_i18n26.sprintf)(
|
|
2800
2774
|
/* translators: %s: document type plural label. */
|
|
2801
|
-
(0,
|
|
2775
|
+
(0, import_i18n26.__)("Search %s", "elementor"),
|
|
2802
2776
|
sectionTitle
|
|
2803
2777
|
);
|
|
2804
|
-
|
|
2778
|
+
const listBody = /* @__PURE__ */ React37.createElement(React37.Fragment, null, showNoResults && /* @__PURE__ */ React37.createElement(import_ui25.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React37.createElement(import_ui25.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n26.__)("No results found", "elementor"))), /* @__PURE__ */ React37.createElement(import_ui25.Box, { ref: listTopRef }), displayedPosts.map((post) => {
|
|
2779
|
+
return /* @__PURE__ */ React37.createElement(PostListItem, { key: post.id, post });
|
|
2780
|
+
}), !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React37.createElement(PostListItem, null), /* @__PURE__ */ React37.createElement(
|
|
2781
|
+
PostListPaginationActions,
|
|
2782
|
+
{
|
|
2783
|
+
canLoadMore: pagination.canLoadMore,
|
|
2784
|
+
canShowLess: pagination.canShowLess,
|
|
2785
|
+
isLoadingMore: isFetchingNextPage,
|
|
2786
|
+
loadMoreButtonRef,
|
|
2787
|
+
onLoadMore: pagination.handleLoadMore,
|
|
2788
|
+
onShowLess: handleShowLess
|
|
2789
|
+
}
|
|
2790
|
+
));
|
|
2791
|
+
const flatSectionAddAction = isTrashFilter ? void 0 : /* @__PURE__ */ React37.createElement(SectionAddButton, null);
|
|
2792
|
+
const accordionSectionAddAction = isTrashFilter ? void 0 : /* @__PURE__ */ React37.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) });
|
|
2793
|
+
const sectionToolbar = /* @__PURE__ */ React37.createElement(
|
|
2794
|
+
ContentPanelSectionToolbar,
|
|
2795
|
+
{
|
|
2796
|
+
addAction: isFlatLayout ? flatSectionAddAction : accordionSectionAddAction,
|
|
2797
|
+
actionsInHeader: isFlatLayout,
|
|
2798
|
+
searchAriaLabel
|
|
2799
|
+
}
|
|
2800
|
+
);
|
|
2801
|
+
if (isFlatLayout) {
|
|
2802
|
+
return /* @__PURE__ */ React37.createElement(import_ui25.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0, width: "100%" } }, sectionToolbar, /* @__PURE__ */ React37.createElement(import_ui25.Box, { sx: { flex: 1, minHeight: 0, overflow: "auto" } }, listBody));
|
|
2803
|
+
}
|
|
2804
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2805
2805
|
CollapsibleList,
|
|
2806
2806
|
{
|
|
2807
2807
|
count: displayCount,
|
|
@@ -2809,45 +2809,150 @@ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
|
|
|
2809
2809
|
headerRef: sectionHeaderRef,
|
|
2810
2810
|
isOpen,
|
|
2811
2811
|
onOpenChange: setIsOpen,
|
|
2812
|
-
sectionToolbar
|
|
2813
|
-
ContentPanelSectionToolbar,
|
|
2814
|
-
{
|
|
2815
|
-
addAction: isTrashFilter ? void 0 : /* @__PURE__ */ React39.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) }),
|
|
2816
|
-
searchAriaLabel
|
|
2817
|
-
}
|
|
2818
|
-
),
|
|
2812
|
+
sectionToolbar,
|
|
2819
2813
|
title: sectionTitle
|
|
2820
2814
|
},
|
|
2821
|
-
|
|
2822
|
-
/* @__PURE__ */ React39.createElement(import_ui26.Box, { ref: listTopRef }),
|
|
2823
|
-
displayedPosts.map((post) => {
|
|
2824
|
-
return /* @__PURE__ */ React39.createElement(PostListItem, { key: post.id, post });
|
|
2825
|
-
}),
|
|
2826
|
-
!isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React39.createElement(PostListItem, null),
|
|
2827
|
-
/* @__PURE__ */ React39.createElement(
|
|
2828
|
-
PostListPaginationActions,
|
|
2829
|
-
{
|
|
2830
|
-
canLoadMore: pagination.canLoadMore,
|
|
2831
|
-
canShowLess: pagination.canShowLess,
|
|
2832
|
-
isLoadingMore: isFetchingNextPage,
|
|
2833
|
-
loadMoreButtonRef,
|
|
2834
|
-
onLoadMore: pagination.handleLoadMore,
|
|
2835
|
-
onShowLess: handleShowLess
|
|
2836
|
-
}
|
|
2837
|
-
)
|
|
2815
|
+
listBody
|
|
2838
2816
|
);
|
|
2839
2817
|
}
|
|
2840
2818
|
function PostsCollapsibleList(props) {
|
|
2841
2819
|
const { type } = usePostListContext();
|
|
2842
|
-
|
|
2820
|
+
const isFlatLayout = props.layout === "flat";
|
|
2821
|
+
const content = /* @__PURE__ */ React37.createElement(PostsCollapsibleListContent, { ...props });
|
|
2822
|
+
if (isFlatLayout) {
|
|
2823
|
+
return content;
|
|
2824
|
+
}
|
|
2825
|
+
return /* @__PURE__ */ React37.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [type] }, content);
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
// src/components/panel/site-content-home.tsx
|
|
2829
|
+
var React38 = __toESM(require("react"));
|
|
2830
|
+
var import_icons21 = require("@elementor/icons");
|
|
2831
|
+
var import_ui26 = require("@elementor/ui");
|
|
2832
|
+
var import_i18n27 = require("@wordpress/i18n");
|
|
2833
|
+
|
|
2834
|
+
// src/site-content-panel-sections.ts
|
|
2835
|
+
function getSiteContentPanelSectionDescriptors(accessiblePostTypes) {
|
|
2836
|
+
const postTypeSections = accessiblePostTypes.map((slug) => ({
|
|
2837
|
+
id: slug,
|
|
2838
|
+
label: postTypesMap[slug].labels.plural_name
|
|
2839
|
+
}));
|
|
2840
|
+
const registeredSections2 = getSiteContentSections().map((section) => ({
|
|
2841
|
+
id: section.id,
|
|
2842
|
+
label: section.label ?? section.id
|
|
2843
|
+
}));
|
|
2844
|
+
return [...postTypeSections, ...registeredSections2];
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
// src/utils/keyboard-click.ts
|
|
2848
|
+
function onKeyboardClick(callback) {
|
|
2849
|
+
return (event) => {
|
|
2850
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
2851
|
+
event.preventDefault();
|
|
2852
|
+
callback();
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
// src/components/panel/site-content-home.tsx
|
|
2858
|
+
var POST_TYPE_ICONS = {
|
|
2859
|
+
page: import_icons21.PageTypeIcon,
|
|
2860
|
+
post: import_icons21.PostTypeIcon
|
|
2861
|
+
};
|
|
2862
|
+
var POST_TYPE_SUBTITLES = {
|
|
2863
|
+
page: (0, import_i18n27.__)("Website pages", "elementor"),
|
|
2864
|
+
post: (0, import_i18n27.__)("Blog & articles", "elementor")
|
|
2865
|
+
};
|
|
2866
|
+
function SiteContentHome({ accessiblePostTypes, onSelect }) {
|
|
2867
|
+
const isRtl = "rtl" === (0, import_ui26.useTheme)().direction;
|
|
2868
|
+
const items = getSiteContentPanelSectionDescriptors(accessiblePostTypes).map((descriptor) => {
|
|
2869
|
+
const isPostType = descriptor.id in postTypesMap;
|
|
2870
|
+
if (isPostType) {
|
|
2871
|
+
const slug = descriptor.id;
|
|
2872
|
+
const Icon = POST_TYPE_ICONS[slug];
|
|
2873
|
+
return {
|
|
2874
|
+
id: descriptor.id,
|
|
2875
|
+
title: descriptor.label,
|
|
2876
|
+
description: POST_TYPE_SUBTITLES[slug],
|
|
2877
|
+
icon: /* @__PURE__ */ React38.createElement(Icon, { fontSize: "small", color: "action" }),
|
|
2878
|
+
isPostType: true
|
|
2879
|
+
};
|
|
2880
|
+
}
|
|
2881
|
+
const RegisteredIcon = getIconsMap()[descriptor.id] ?? import_icons21.PageTypeIcon;
|
|
2882
|
+
const registeredSection = getSiteContentSectionById(descriptor.id);
|
|
2883
|
+
return {
|
|
2884
|
+
description: registeredSection?.description,
|
|
2885
|
+
hubCount: registeredSection?.renderHubCount?.(),
|
|
2886
|
+
id: descriptor.id,
|
|
2887
|
+
title: descriptor.label,
|
|
2888
|
+
icon: /* @__PURE__ */ React38.createElement(RegisteredIcon, { fontSize: "small", color: "action" }),
|
|
2889
|
+
isPostType: false
|
|
2890
|
+
};
|
|
2891
|
+
});
|
|
2892
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2893
|
+
import_ui26.Stack,
|
|
2894
|
+
{
|
|
2895
|
+
role: "list",
|
|
2896
|
+
"aria-label": (0, import_i18n27.__)("Site content sections", "elementor"),
|
|
2897
|
+
sx: {
|
|
2898
|
+
flex: 1,
|
|
2899
|
+
minHeight: 0,
|
|
2900
|
+
overflow: "auto",
|
|
2901
|
+
px: 2,
|
|
2902
|
+
py: 1.5,
|
|
2903
|
+
gap: 1
|
|
2904
|
+
}
|
|
2905
|
+
},
|
|
2906
|
+
items.map((item) => /* @__PURE__ */ React38.createElement(import_ui26.Box, { key: item.id, role: "listitem" }, /* @__PURE__ */ React38.createElement(HomeRow, { ...item, isRtl, onSelect: () => onSelect(item.id) })))
|
|
2907
|
+
);
|
|
2908
|
+
}
|
|
2909
|
+
function HomeRow({ hubCount, title, description, icon, id, isPostType, isRtl, onSelect }) {
|
|
2910
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2911
|
+
import_ui26.Box,
|
|
2912
|
+
{
|
|
2913
|
+
role: "button",
|
|
2914
|
+
tabIndex: 0,
|
|
2915
|
+
"aria-label": title,
|
|
2916
|
+
onClick: onSelect,
|
|
2917
|
+
onKeyDown: onKeyboardClick(onSelect),
|
|
2918
|
+
sx: {
|
|
2919
|
+
display: "flex",
|
|
2920
|
+
alignItems: "center",
|
|
2921
|
+
gap: 1.5,
|
|
2922
|
+
px: 1.5,
|
|
2923
|
+
py: 1.25,
|
|
2924
|
+
cursor: "pointer",
|
|
2925
|
+
borderRadius: 1,
|
|
2926
|
+
border: 1,
|
|
2927
|
+
borderColor: "divider",
|
|
2928
|
+
"&:hover": { bgcolor: "action.hover" },
|
|
2929
|
+
outline: "none",
|
|
2930
|
+
"&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
|
|
2931
|
+
}
|
|
2932
|
+
},
|
|
2933
|
+
icon,
|
|
2934
|
+
/* @__PURE__ */ React38.createElement(import_ui26.Stack, { sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React38.createElement(import_ui26.Typography, { variant: "body2", fontWeight: "bold" }, title), description ? /* @__PURE__ */ React38.createElement(import_ui26.Typography, { variant: "caption", color: "text.secondary" }, description) : null),
|
|
2935
|
+
isPostType ? /* @__PURE__ */ React38.createElement(HubCountBadge, { postTypeSlug: id }) : hubCount,
|
|
2936
|
+
/* @__PURE__ */ React38.createElement(import_ui26.Rotate, { in: isRtl }, /* @__PURE__ */ React38.createElement(import_icons21.ChevronRightIcon, { fontSize: "small", color: "action" }))
|
|
2937
|
+
);
|
|
2938
|
+
}
|
|
2939
|
+
function HubCountBadge({ postTypeSlug }) {
|
|
2940
|
+
const { data, isPending } = usePostsBaselineTotal(postTypeSlug, true, "any");
|
|
2941
|
+
if (isPending) {
|
|
2942
|
+
return /* @__PURE__ */ React38.createElement(import_ui26.Skeleton, { variant: "circular", width: 24, height: 24 });
|
|
2943
|
+
}
|
|
2944
|
+
if (data === void 0) {
|
|
2945
|
+
return null;
|
|
2946
|
+
}
|
|
2947
|
+
return /* @__PURE__ */ React38.createElement(import_ui26.Chip, { size: "tiny", variant: "default", label: String(data) });
|
|
2843
2948
|
}
|
|
2844
2949
|
|
|
2845
2950
|
// src/components/panel/user-load-error.tsx
|
|
2846
|
-
var
|
|
2951
|
+
var React39 = __toESM(require("react"));
|
|
2847
2952
|
var import_ui27 = require("@elementor/ui");
|
|
2848
2953
|
var import_i18n28 = require("@wordpress/i18n");
|
|
2849
2954
|
function UserLoadError() {
|
|
2850
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ React39.createElement(import_ui27.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React39.createElement(import_ui27.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n28.__)(
|
|
2851
2956
|
"We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
|
|
2852
2957
|
"elementor"
|
|
2853
2958
|
)));
|
|
@@ -2856,57 +2961,143 @@ function UserLoadError() {
|
|
|
2856
2961
|
// src/components/panel/shell-panel-body-content.tsx
|
|
2857
2962
|
function ShellPanelBodyContent({
|
|
2858
2963
|
accessiblePostTypes,
|
|
2964
|
+
currentView,
|
|
2859
2965
|
isUserPending,
|
|
2860
|
-
|
|
2966
|
+
onSelectSection,
|
|
2861
2967
|
showUserLoadError
|
|
2862
2968
|
}) {
|
|
2863
2969
|
if (isUserPending) {
|
|
2864
|
-
return /* @__PURE__ */
|
|
2970
|
+
return /* @__PURE__ */ React40.createElement(import_ui28.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React40.createElement(import_ui28.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React40.createElement(import_ui28.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
|
|
2865
2971
|
}
|
|
2866
2972
|
if (showUserLoadError) {
|
|
2867
|
-
return /* @__PURE__ */
|
|
2973
|
+
return /* @__PURE__ */ React40.createElement(UserLoadError, null);
|
|
2868
2974
|
}
|
|
2869
|
-
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
|
-
accessiblePostTypes
|
|
2873
|
-
onListError
|
|
2874
|
-
}) {
|
|
2875
|
-
const { isSectionVisible } = useSiteContentPanelSectionsFilter();
|
|
2975
|
+
if (currentView === null) {
|
|
2976
|
+
return /* @__PURE__ */ React40.createElement(SiteContentHome, { accessiblePostTypes, onSelect: onSelectSection });
|
|
2977
|
+
}
|
|
2978
|
+
const isPostTypeSection = accessiblePostTypes.includes(currentView);
|
|
2876
2979
|
const extraSections = getSiteContentSections();
|
|
2877
|
-
const
|
|
2878
|
-
|
|
2879
|
-
|
|
2980
|
+
const registeredSection = extraSections.find((section) => section.id === currentView);
|
|
2981
|
+
if (isPostTypeSection) {
|
|
2982
|
+
return /* @__PURE__ */ React40.createElement(PostsCollapsibleList, { layout: "flat" });
|
|
2983
|
+
}
|
|
2984
|
+
if (registeredSection) {
|
|
2985
|
+
return /* @__PURE__ */ React40.createElement(import_ui28.Box, { sx: { width: "100%", flex: 1, minHeight: 0 } }, registeredSection.render());
|
|
2986
|
+
}
|
|
2987
|
+
return /* @__PURE__ */ React40.createElement(SiteContentHome, { accessiblePostTypes, onSelect: onSelectSection });
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
// src/components/panel/site-content-section-header.tsx
|
|
2991
|
+
var React41 = __toESM(require("react"));
|
|
2992
|
+
var import_icons22 = require("@elementor/icons");
|
|
2993
|
+
var import_ui29 = require("@elementor/ui");
|
|
2994
|
+
var import_i18n29 = require("@wordpress/i18n");
|
|
2995
|
+
var POST_TYPE_ICONS2 = {
|
|
2996
|
+
page: import_icons22.PageTypeIcon,
|
|
2997
|
+
post: import_icons22.PostTypeIcon
|
|
2998
|
+
};
|
|
2999
|
+
function getSectionTitle(sectionId) {
|
|
3000
|
+
if (sectionId in postTypesMap) {
|
|
3001
|
+
return postTypesMap[sectionId].labels.plural_name;
|
|
3002
|
+
}
|
|
3003
|
+
const registered = getSiteContentSections().find((section) => section.id === sectionId);
|
|
3004
|
+
return registered?.label ?? sectionId;
|
|
3005
|
+
}
|
|
3006
|
+
function getSectionIcon(sectionId) {
|
|
3007
|
+
if (sectionId in POST_TYPE_ICONS2) {
|
|
3008
|
+
return POST_TYPE_ICONS2[sectionId];
|
|
3009
|
+
}
|
|
3010
|
+
return getIconsMap()[sectionId] ?? import_icons22.PageTypeIcon;
|
|
3011
|
+
}
|
|
3012
|
+
function SiteContentSectionHeader({ sectionId, onBack }) {
|
|
3013
|
+
const isRtl = "rtl" === (0, import_ui29.useTheme)().direction;
|
|
3014
|
+
const Icon = getSectionIcon(sectionId);
|
|
3015
|
+
return /* @__PURE__ */ React41.createElement(import_ui29.Stack, { direction: "row", alignItems: "center", spacing: 0.5, sx: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ React41.createElement(
|
|
3016
|
+
import_ui29.IconButton,
|
|
3017
|
+
{
|
|
3018
|
+
size: "small",
|
|
3019
|
+
"aria-label": (0, import_i18n29.__)("Back", "elementor"),
|
|
3020
|
+
onClick: onBack,
|
|
3021
|
+
sx: { flexShrink: 0 }
|
|
3022
|
+
},
|
|
3023
|
+
/* @__PURE__ */ React41.createElement(import_ui29.Rotate, { in: isRtl }, /* @__PURE__ */ React41.createElement(import_icons22.ArrowLeftIcon, { fontSize: "small" }))
|
|
3024
|
+
), /* @__PURE__ */ React41.createElement(Icon, { fontSize: "small", color: "action" }), /* @__PURE__ */ React41.createElement(import_ui29.Typography, { variant: "subtitle2", fontWeight: "bold", noWrap: true, sx: { flex: 1, minWidth: 0 } }, getSectionTitle(sectionId)));
|
|
2880
3025
|
}
|
|
2881
3026
|
|
|
2882
3027
|
// src/components/panel/shell.tsx
|
|
3028
|
+
function isPostTypeSectionView(view, accessiblePostTypes) {
|
|
3029
|
+
return view !== null && accessiblePostTypes.includes(view);
|
|
3030
|
+
}
|
|
2883
3031
|
var Shell = () => {
|
|
2884
3032
|
const sidebarPanelChrome = (0, import_editor_sidebar.isSidebarEnabled)();
|
|
2885
|
-
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0,
|
|
3033
|
+
const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react16.useState)(false);
|
|
2886
3034
|
const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
|
|
2887
|
-
|
|
2888
|
-
|
|
3035
|
+
const [currentView, setCurrentView] = (0, import_react16.useState)(() => getInitialSiteContentView());
|
|
3036
|
+
const clearPendingCreateRef = (0, import_react16.useRef)();
|
|
3037
|
+
const openSection = (0, import_react16.useCallback)((sectionId) => {
|
|
3038
|
+
clearPendingCreateRef.current?.();
|
|
3039
|
+
setCurrentView(sectionId);
|
|
3040
|
+
notifySiteContentViewChange(sectionId);
|
|
3041
|
+
}, []);
|
|
3042
|
+
const goHome = (0, import_react16.useCallback)(() => {
|
|
3043
|
+
clearPendingCreateRef.current?.();
|
|
3044
|
+
setCurrentView(null);
|
|
3045
|
+
notifySiteContentViewChange(null);
|
|
3046
|
+
}, []);
|
|
3047
|
+
(0, import_react16.useEffect)(() => {
|
|
3048
|
+
notifySiteContentViewChange(currentView);
|
|
3049
|
+
}, [currentView]);
|
|
3050
|
+
const showHome = currentView === null;
|
|
3051
|
+
const postTypeSection = isPostTypeSectionView(currentView, accessiblePostTypes);
|
|
3052
|
+
const registeredSection = currentView ? getSiteContentSectionById(currentView) : void 0;
|
|
3053
|
+
const usesDrillInToolbarShell = postTypeSection || Boolean(registeredSection?.usesDrillInToolbarShell);
|
|
3054
|
+
const panel2 = /* @__PURE__ */ React42.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React42.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React42.createElement(
|
|
3055
|
+
import_ui30.Stack,
|
|
2889
3056
|
{
|
|
2890
3057
|
alignItems: "center",
|
|
2891
3058
|
direction: "row",
|
|
2892
3059
|
spacing: 0.5,
|
|
3060
|
+
sx: getContentPanelShellHeaderStackSx(sidebarPanelChrome)
|
|
3061
|
+
},
|
|
3062
|
+
showHome ? /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n30.__)("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)
|
|
3063
|
+
)), /* @__PURE__ */ React42.createElement(import_ui30.Divider, null), /* @__PURE__ */ React42.createElement(
|
|
3064
|
+
import_editor_panels.PanelBody,
|
|
3065
|
+
{
|
|
2893
3066
|
sx: {
|
|
2894
|
-
|
|
2895
|
-
|
|
3067
|
+
display: "flex",
|
|
3068
|
+
flexDirection: "column",
|
|
3069
|
+
height: "100%",
|
|
3070
|
+
overflow: "hidden",
|
|
3071
|
+
minHeight: 0
|
|
2896
3072
|
}
|
|
2897
3073
|
},
|
|
2898
|
-
/* @__PURE__ */ React42.createElement(
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
3074
|
+
/* @__PURE__ */ React42.createElement(import_ui30.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0, overflow: "hidden" } }, /* @__PURE__ */ React42.createElement(
|
|
3075
|
+
ShellPanelBodyContent,
|
|
3076
|
+
{
|
|
3077
|
+
accessiblePostTypes,
|
|
3078
|
+
currentView,
|
|
3079
|
+
isUserPending,
|
|
3080
|
+
onSelectSection: openSection,
|
|
3081
|
+
showUserLoadError
|
|
3082
|
+
}
|
|
3083
|
+
)),
|
|
3084
|
+
/* @__PURE__ */ React42.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) })
|
|
3085
|
+
));
|
|
3086
|
+
const panelWithProviders = (() => {
|
|
3087
|
+
let resolvedPanel = registeredSection?.wrapDrillInPanel ? registeredSection.wrapDrillInPanel(panel2) : panel2;
|
|
3088
|
+
if (postTypeSection) {
|
|
3089
|
+
resolvedPanel = /* @__PURE__ */ React42.createElement(PostListContextProvider, { type: currentView, setError: () => setIsErrorSnackbarOpen(true) }, /* @__PURE__ */ React42.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [currentView] }, resolvedPanel));
|
|
2908
3090
|
}
|
|
2909
|
-
|
|
3091
|
+
return resolvedPanel;
|
|
3092
|
+
})();
|
|
3093
|
+
return /* @__PURE__ */ React42.createElement(
|
|
3094
|
+
ContentPanelCoordinatorProvider,
|
|
3095
|
+
{
|
|
3096
|
+
clearPendingCreateRef,
|
|
3097
|
+
onNavigateToSection: openSection
|
|
3098
|
+
},
|
|
3099
|
+
panelWithProviders
|
|
3100
|
+
);
|
|
2910
3101
|
};
|
|
2911
3102
|
var shell_default = Shell;
|
|
2912
3103
|
|
|
@@ -2920,23 +3111,23 @@ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.creat
|
|
|
2920
3111
|
var React47 = __toESM(require("react"));
|
|
2921
3112
|
var import_editor_documents8 = require("@elementor/editor-documents");
|
|
2922
3113
|
var import_icons25 = require("@elementor/icons");
|
|
2923
|
-
var
|
|
2924
|
-
var
|
|
3114
|
+
var import_ui35 = require("@elementor/ui");
|
|
3115
|
+
var import_i18n32 = require("@wordpress/i18n");
|
|
2925
3116
|
|
|
2926
3117
|
// src/components/top-bar/create-post-list-item.tsx
|
|
2927
3118
|
var React43 = __toESM(require("react"));
|
|
2928
3119
|
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
2929
3120
|
var import_events = require("@elementor/events");
|
|
2930
3121
|
var import_icons23 = require("@elementor/icons");
|
|
2931
|
-
var
|
|
2932
|
-
var
|
|
3122
|
+
var import_ui31 = require("@elementor/ui");
|
|
3123
|
+
var import_i18n31 = require("@wordpress/i18n");
|
|
2933
3124
|
|
|
2934
3125
|
// src/hooks/use-create-page.ts
|
|
2935
|
-
var
|
|
3126
|
+
var import_react17 = require("react");
|
|
2936
3127
|
var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
|
|
2937
3128
|
var endpointPath = "/elementor/v1/site-navigation/add-new-post";
|
|
2938
3129
|
function useCreatePage() {
|
|
2939
|
-
const [isLoading, setIsLoading] = (0,
|
|
3130
|
+
const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
|
|
2940
3131
|
return {
|
|
2941
3132
|
create: () => {
|
|
2942
3133
|
setIsLoading(true);
|
|
@@ -2960,7 +3151,7 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2960
3151
|
const { data: user } = useUser();
|
|
2961
3152
|
const { dispatchEvent, config } = (0, import_events.useMixpanel)();
|
|
2962
3153
|
return /* @__PURE__ */ React43.createElement(
|
|
2963
|
-
|
|
3154
|
+
import_ui31.MenuItem,
|
|
2964
3155
|
{
|
|
2965
3156
|
disabled: isLoading || !user?.capabilities?.edit_pages,
|
|
2966
3157
|
onClick: async () => {
|
|
@@ -2983,12 +3174,12 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2983
3174
|
},
|
|
2984
3175
|
...props
|
|
2985
3176
|
},
|
|
2986
|
-
/* @__PURE__ */ React43.createElement(
|
|
3177
|
+
/* @__PURE__ */ React43.createElement(import_ui31.ListItemIcon, null, isLoading ? /* @__PURE__ */ React43.createElement(import_ui31.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React43.createElement(import_icons23.PlusIcon, { fontSize: "small" })),
|
|
2987
3178
|
/* @__PURE__ */ React43.createElement(
|
|
2988
|
-
|
|
3179
|
+
import_ui31.ListItemText,
|
|
2989
3180
|
{
|
|
2990
3181
|
primaryTypographyProps: { variant: "body2" },
|
|
2991
|
-
primary: (0,
|
|
3182
|
+
primary: (0, import_i18n31.__)("Add new page", "elementor")
|
|
2992
3183
|
}
|
|
2993
3184
|
)
|
|
2994
3185
|
);
|
|
@@ -2996,13 +3187,13 @@ function CreatePostListItem({ closePopup, ...props }) {
|
|
|
2996
3187
|
|
|
2997
3188
|
// src/components/top-bar/indicator.tsx
|
|
2998
3189
|
var React44 = __toESM(require("react"));
|
|
2999
|
-
var
|
|
3190
|
+
var import_ui32 = require("@elementor/ui");
|
|
3000
3191
|
function Indicator({ title, status }) {
|
|
3001
|
-
return /* @__PURE__ */ React44.createElement(
|
|
3192
|
+
return /* @__PURE__ */ React44.createElement(Tooltip5, { title }, /* @__PURE__ */ React44.createElement(import_ui32.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React44.createElement(import_ui32.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React44.createElement(import_ui32.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
|
|
3002
3193
|
}
|
|
3003
|
-
function
|
|
3194
|
+
function Tooltip5(props) {
|
|
3004
3195
|
return /* @__PURE__ */ React44.createElement(
|
|
3005
|
-
|
|
3196
|
+
import_ui32.Tooltip,
|
|
3006
3197
|
{
|
|
3007
3198
|
PopperProps: {
|
|
3008
3199
|
sx: {
|
|
@@ -3020,18 +3211,18 @@ function Tooltip6(props) {
|
|
|
3020
3211
|
var React46 = __toESM(require("react"));
|
|
3021
3212
|
var import_editor_documents7 = require("@elementor/editor-documents");
|
|
3022
3213
|
var import_events2 = require("@elementor/events");
|
|
3023
|
-
var
|
|
3214
|
+
var import_ui34 = require("@elementor/ui");
|
|
3024
3215
|
|
|
3025
3216
|
// src/components/top-bar/chip-doc-type.tsx
|
|
3026
3217
|
var React45 = __toESM(require("react"));
|
|
3027
3218
|
var import_icons24 = require("@elementor/icons");
|
|
3028
|
-
var
|
|
3219
|
+
var import_ui33 = require("@elementor/ui");
|
|
3029
3220
|
var iconsMap2 = getIconsMap();
|
|
3030
3221
|
function DocTypeChip({ postType, docType, label }) {
|
|
3031
3222
|
const color = "elementor_library" === postType ? "global" : "accent";
|
|
3032
3223
|
const Icon = iconsMap2[docType] || import_icons24.PostTypeIcon;
|
|
3033
3224
|
return /* @__PURE__ */ React45.createElement(
|
|
3034
|
-
|
|
3225
|
+
import_ui33.Chip,
|
|
3035
3226
|
{
|
|
3036
3227
|
component: "span",
|
|
3037
3228
|
size: "small",
|
|
@@ -3051,7 +3242,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
3051
3242
|
const postTitle = useReverseHtmlEntities(post.title);
|
|
3052
3243
|
const { dispatchEvent, config } = (0, import_events2.useMixpanel)();
|
|
3053
3244
|
return /* @__PURE__ */ React46.createElement(
|
|
3054
|
-
|
|
3245
|
+
import_ui34.MenuItem,
|
|
3055
3246
|
{
|
|
3056
3247
|
disabled: !post.user_can.edit,
|
|
3057
3248
|
onClick: async () => {
|
|
@@ -3074,7 +3265,7 @@ function PostListItem2({ post, closePopup, ...props }) {
|
|
|
3074
3265
|
...props
|
|
3075
3266
|
},
|
|
3076
3267
|
/* @__PURE__ */ React46.createElement(
|
|
3077
|
-
|
|
3268
|
+
import_ui34.ListItemText,
|
|
3078
3269
|
{
|
|
3079
3270
|
sx: { flexGrow: 0 },
|
|
3080
3271
|
primaryTypographyProps: { variant: "body2", noWrap: true },
|
|
@@ -3098,7 +3289,7 @@ function RecentlyEdited() {
|
|
|
3098
3289
|
return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
|
|
3099
3290
|
};
|
|
3100
3291
|
const recentPosts = getRecentPosts();
|
|
3101
|
-
const popupState = (0,
|
|
3292
|
+
const popupState = (0, import_ui35.usePopupState)({
|
|
3102
3293
|
variant: "popover",
|
|
3103
3294
|
popupId: "elementor-v2-top-bar-recently-edited"
|
|
3104
3295
|
});
|
|
@@ -3106,9 +3297,9 @@ function RecentlyEdited() {
|
|
|
3106
3297
|
if (!document2) {
|
|
3107
3298
|
return null;
|
|
3108
3299
|
}
|
|
3109
|
-
const buttonProps = (0,
|
|
3300
|
+
const buttonProps = (0, import_ui35.bindTrigger)(popupState);
|
|
3110
3301
|
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement(
|
|
3111
|
-
|
|
3302
|
+
import_ui35.Button,
|
|
3112
3303
|
{
|
|
3113
3304
|
color: "inherit",
|
|
3114
3305
|
size: "small",
|
|
@@ -3133,38 +3324,38 @@ function RecentlyEdited() {
|
|
|
3133
3324
|
},
|
|
3134
3325
|
/* @__PURE__ */ React47.createElement(Indicator, { title: documentTitle, status: document2.status })
|
|
3135
3326
|
), /* @__PURE__ */ React47.createElement(
|
|
3136
|
-
|
|
3327
|
+
import_ui35.Menu,
|
|
3137
3328
|
{
|
|
3138
3329
|
MenuListProps: {
|
|
3139
|
-
subheader: /* @__PURE__ */ React47.createElement(
|
|
3330
|
+
subheader: /* @__PURE__ */ React47.createElement(import_ui35.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n32.__)("Recent", "elementor"))
|
|
3140
3331
|
},
|
|
3141
3332
|
PaperProps: { sx: { mt: 2.5, width: 320 } },
|
|
3142
|
-
...(0,
|
|
3333
|
+
...(0, import_ui35.bindMenu)(popupState)
|
|
3143
3334
|
},
|
|
3144
3335
|
recentPosts.map((post) => /* @__PURE__ */ React47.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
|
|
3145
|
-
recentPosts.length === 0 && /* @__PURE__ */ React47.createElement(
|
|
3146
|
-
|
|
3336
|
+
recentPosts.length === 0 && /* @__PURE__ */ React47.createElement(import_ui35.MenuItem, { disabled: true }, /* @__PURE__ */ React47.createElement(
|
|
3337
|
+
import_ui35.ListItemText,
|
|
3147
3338
|
{
|
|
3148
3339
|
primaryTypographyProps: {
|
|
3149
3340
|
variant: "caption",
|
|
3150
3341
|
fontStyle: "italic"
|
|
3151
3342
|
},
|
|
3152
|
-
primary: (0,
|
|
3343
|
+
primary: (0, import_i18n32.__)("There are no other pages or templates on this site yet.", "elementor")
|
|
3153
3344
|
}
|
|
3154
3345
|
)),
|
|
3155
|
-
/* @__PURE__ */ React47.createElement(
|
|
3346
|
+
/* @__PURE__ */ React47.createElement(import_ui35.Divider, { disabled: recentPosts.length === 0 }),
|
|
3156
3347
|
/* @__PURE__ */ React47.createElement(CreatePostListItem, { closePopup: popupState.close })
|
|
3157
3348
|
));
|
|
3158
3349
|
}
|
|
3159
3350
|
|
|
3160
3351
|
// src/hooks/use-toggle-button-props.ts
|
|
3161
3352
|
var import_icons26 = require("@elementor/icons");
|
|
3162
|
-
var
|
|
3353
|
+
var import_i18n33 = require("@wordpress/i18n");
|
|
3163
3354
|
function useToggleButtonProps() {
|
|
3164
3355
|
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
3165
3356
|
const { open, close } = usePanelActions();
|
|
3166
3357
|
return {
|
|
3167
|
-
title: (0,
|
|
3358
|
+
title: (0, import_i18n33.__)("Site content", "elementor"),
|
|
3168
3359
|
icon: import_icons26.PagesIcon,
|
|
3169
3360
|
onClick: () => {
|
|
3170
3361
|
const extendedWindow = window;
|
|
@@ -3209,21 +3400,21 @@ function registerButton() {
|
|
|
3209
3400
|
|
|
3210
3401
|
// src/components/panel/popups/popup-section-add-button.tsx
|
|
3211
3402
|
var React48 = __toESM(require("react"));
|
|
3212
|
-
var
|
|
3213
|
-
var
|
|
3214
|
-
var
|
|
3215
|
-
var PopupSectionAddButton = (0,
|
|
3403
|
+
var import_react18 = require("react");
|
|
3404
|
+
var import_ui36 = require("@elementor/ui");
|
|
3405
|
+
var import_i18n34 = require("@wordpress/i18n");
|
|
3406
|
+
var PopupSectionAddButton = (0, import_react18.forwardRef)(
|
|
3216
3407
|
({ disabled, onBeforeCreate, onCreate }, ref) => {
|
|
3217
|
-
const promotionRef = (0,
|
|
3408
|
+
const promotionRef = (0, import_react18.useRef)(null);
|
|
3218
3409
|
const canCreate = env.popups?.can_use ?? false;
|
|
3219
|
-
const togglePromotion = (0,
|
|
3410
|
+
const togglePromotion = (0, import_react18.useCallback)(() => {
|
|
3220
3411
|
promotionRef.current?.toggle();
|
|
3221
3412
|
}, []);
|
|
3222
|
-
(0,
|
|
3223
|
-
const ariaLabel = (0,
|
|
3413
|
+
(0, import_react18.useImperativeHandle)(ref, () => ({ togglePromotion }), [togglePromotion]);
|
|
3414
|
+
const ariaLabel = (0, import_i18n34.sprintf)(
|
|
3224
3415
|
/* translators: %s: Document type singular name. */
|
|
3225
|
-
(0,
|
|
3226
|
-
(0,
|
|
3416
|
+
(0, import_i18n34.__)("New %s", "elementor"),
|
|
3417
|
+
(0, import_i18n34.__)("Popup", "elementor")
|
|
3227
3418
|
);
|
|
3228
3419
|
if (canCreate) {
|
|
3229
3420
|
return /* @__PURE__ */ React48.createElement(
|
|
@@ -3240,7 +3431,7 @@ var PopupSectionAddButton = (0, import_react19.forwardRef)(
|
|
|
3240
3431
|
);
|
|
3241
3432
|
}
|
|
3242
3433
|
return /* @__PURE__ */ React48.createElement(
|
|
3243
|
-
|
|
3434
|
+
import_ui36.Stack,
|
|
3244
3435
|
{
|
|
3245
3436
|
alignItems: "center",
|
|
3246
3437
|
direction: "row",
|
|
@@ -3278,11 +3469,14 @@ var PopupSectionAddButton = (0, import_react19.forwardRef)(
|
|
|
3278
3469
|
contentPanelListRowPaddingSx,
|
|
3279
3470
|
env,
|
|
3280
3471
|
extendIconsMap,
|
|
3472
|
+
getActiveSiteContentView,
|
|
3281
3473
|
getContentPanelListItemRowStateSx,
|
|
3282
3474
|
getContentPanelListItemSx,
|
|
3475
|
+
getInitialSiteContentView,
|
|
3283
3476
|
getRestOrderForSiteContentSort,
|
|
3284
3477
|
getRestStatusForSiteContentFilters,
|
|
3285
3478
|
getSiteContentHeaderCreateItems,
|
|
3479
|
+
getSiteContentSectionById,
|
|
3286
3480
|
getSiteContentSections,
|
|
3287
3481
|
getSiteContentStatusFilterForCount,
|
|
3288
3482
|
hasActiveSiteContentStatusFilters,
|
|
@@ -3290,11 +3484,14 @@ var PopupSectionAddButton = (0, import_react19.forwardRef)(
|
|
|
3290
3484
|
injectIntoSiteContentListItemActions,
|
|
3291
3485
|
isSiteContentListNarrowed,
|
|
3292
3486
|
isSiteContentTrashFilterActive,
|
|
3487
|
+
notifySiteContentViewChange,
|
|
3293
3488
|
registerSiteContentHeaderCreateItem,
|
|
3294
3489
|
registerSiteContentSection,
|
|
3295
3490
|
resetSiteContentHeaderCreateItems,
|
|
3296
3491
|
resetSiteContentSections,
|
|
3297
3492
|
serializeSiteContentStatusFilters,
|
|
3493
|
+
setPendingSiteContentHome,
|
|
3494
|
+
setPendingSiteContentSection,
|
|
3298
3495
|
useContentPanelCoordinator,
|
|
3299
3496
|
usePostListPagination,
|
|
3300
3497
|
useSiteContentSectionToolbar
|