@emdash-cms/admin 0.17.2 → 0.19.0
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/{LocaleDirectionProvider-LB7Qjnv1.js → LocaleDirectionProvider-xsHb49dm.js} +19 -19
- package/dist/{LocaleDirectionProvider-LB7Qjnv1.js.map → LocaleDirectionProvider-xsHb49dm.js.map} +1 -1
- package/dist/index.d.ts +83 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +414 -89
- package/dist/index.js.map +1 -1
- package/dist/locales/ar/messages.mjs +1 -1
- package/dist/locales/de/messages.mjs +1 -1
- package/dist/locales/en/messages.mjs +1 -1
- package/dist/locales/es-419/messages.mjs +1 -1
- package/dist/locales/es-ES/messages.mjs +1 -1
- package/dist/locales/eu/messages.mjs +1 -1
- package/dist/locales/fa/messages.mjs +1 -1
- package/dist/locales/fr/messages.mjs +1 -1
- package/dist/locales/id/messages.mjs +1 -1
- package/dist/locales/index.js +1 -1
- package/dist/locales/ja/messages.mjs +1 -1
- package/dist/locales/ko/messages.mjs +1 -1
- package/dist/locales/nb/messages.mjs +1 -1
- package/dist/locales/pl/messages.mjs +1 -1
- package/dist/locales/pseudo/messages.mjs +1 -1
- package/dist/locales/pt-BR/messages.mjs +1 -1
- package/dist/locales/th/messages.mjs +1 -1
- package/dist/locales/zh-CN/messages.mjs +1 -1
- package/dist/locales/zh-TW/messages.mjs +1 -1
- package/dist/messages-BMitdYCD.js +6 -0
- package/dist/messages-BMitdYCD.js.map +1 -0
- package/dist/messages-BQ-MRpT8.js +6 -0
- package/dist/messages-BQ-MRpT8.js.map +1 -0
- package/dist/messages-BXYYYOd2.js +6 -0
- package/dist/messages-BXYYYOd2.js.map +1 -0
- package/dist/messages-Bg8kLtZI.js +6 -0
- package/dist/messages-Bg8kLtZI.js.map +1 -0
- package/dist/messages-BwRtFSRk.js +6 -0
- package/dist/messages-BwRtFSRk.js.map +1 -0
- package/dist/messages-C1IVcXec.js +6 -0
- package/dist/messages-C1IVcXec.js.map +1 -0
- package/dist/messages-C5P0RJYN.js +6 -0
- package/dist/messages-C5P0RJYN.js.map +1 -0
- package/dist/messages-CH9Gmcpo.js +6 -0
- package/dist/messages-CH9Gmcpo.js.map +1 -0
- package/dist/messages-CJgGf1T1.js +6 -0
- package/dist/messages-CJgGf1T1.js.map +1 -0
- package/dist/messages-CWew0hcG.js +6 -0
- package/dist/messages-CWew0hcG.js.map +1 -0
- package/dist/messages-CmMy_HWT.js +6 -0
- package/dist/messages-CmMy_HWT.js.map +1 -0
- package/dist/messages-CzJu5dYn.js +6 -0
- package/dist/messages-CzJu5dYn.js.map +1 -0
- package/dist/messages-DQ5ZXmj9.js +6 -0
- package/dist/messages-DQ5ZXmj9.js.map +1 -0
- package/dist/messages-DYT85mDk.js +6 -0
- package/dist/messages-DYT85mDk.js.map +1 -0
- package/dist/messages-DinvbD0I.js +6 -0
- package/dist/messages-DinvbD0I.js.map +1 -0
- package/dist/messages-Dj-5xKz6.js +6 -0
- package/dist/messages-Dj-5xKz6.js.map +1 -0
- package/dist/messages-DnhGgBnH.js +6 -0
- package/dist/messages-DnhGgBnH.js.map +1 -0
- package/dist/messages-Tf8h9nIJ.js +6 -0
- package/dist/messages-Tf8h9nIJ.js.map +1 -0
- package/package.json +4 -4
- package/dist/messages-BKmEGNNr.js +0 -6
- package/dist/messages-BKmEGNNr.js.map +0 -1
- package/dist/messages-BLyCd3bH.js +0 -6
- package/dist/messages-BLyCd3bH.js.map +0 -1
- package/dist/messages-BPzwf13U.js +0 -6
- package/dist/messages-BPzwf13U.js.map +0 -1
- package/dist/messages-BunNlQic.js +0 -6
- package/dist/messages-BunNlQic.js.map +0 -1
- package/dist/messages-C3wS1VMq.js +0 -6
- package/dist/messages-C3wS1VMq.js.map +0 -1
- package/dist/messages-C4ONkHEI.js +0 -6
- package/dist/messages-C4ONkHEI.js.map +0 -1
- package/dist/messages-C55KydOS.js +0 -6
- package/dist/messages-C55KydOS.js.map +0 -1
- package/dist/messages-CjirHcRw.js +0 -6
- package/dist/messages-CjirHcRw.js.map +0 -1
- package/dist/messages-CkDIrR_T.js +0 -6
- package/dist/messages-CkDIrR_T.js.map +0 -1
- package/dist/messages-ClrLd7GR.js +0 -6
- package/dist/messages-ClrLd7GR.js.map +0 -1
- package/dist/messages-DM8WFh_S.js +0 -6
- package/dist/messages-DM8WFh_S.js.map +0 -1
- package/dist/messages-DW5uspYc.js +0 -6
- package/dist/messages-DW5uspYc.js.map +0 -1
- package/dist/messages-DrMj1Hby.js +0 -6
- package/dist/messages-DrMj1Hby.js.map +0 -1
- package/dist/messages-Du-_Uh8B.js +0 -6
- package/dist/messages-Du-_Uh8B.js.map +0 -1
- package/dist/messages-DzQ203Bb.js +0 -6
- package/dist/messages-DzQ203Bb.js.map +0 -1
- package/dist/messages-amIeQ8HY.js +0 -6
- package/dist/messages-amIeQ8HY.js.map +0 -1
- package/dist/messages-ngvpRuG5.js +0 -6
- package/dist/messages-ngvpRuG5.js.map +0 -1
- package/dist/messages-rxZmXkNz.js +0 -6
- package/dist/messages-rxZmXkNz.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as fetchAuthMode, d as throwResponseError, i as fetchPlugins, l as fetchManifest, n as enablePlugin, o as API_BASE, r as fetchPlugin, s as apiFetch, t as disablePlugin, u as parseApiResponse } from "./plugins-BZzztFdK.js";
|
|
2
|
-
import { a as SUPPORTED_LOCALES, i as DEFAULT_LOCALE, l as resolveLocale, n as useLocale, o as SUPPORTED_LOCALE_CODES, t as LocaleDirectionProvider } from "./LocaleDirectionProvider-
|
|
2
|
+
import { a as SUPPORTED_LOCALES, i as DEFAULT_LOCALE, l as resolveLocale, n as useLocale, o as SUPPORTED_LOCALE_CODES, t as LocaleDirectionProvider } from "./LocaleDirectionProvider-xsHb49dm.js";
|
|
3
3
|
import "./locales/index.js";
|
|
4
4
|
import { Autocomplete, Badge, Button, Checkbox, CommandPalette, Dialog, Input, InputArea, Label, LinkButton, Loader, Popover, Select, Sidebar as KumoSidebar, Switch, Tabs, Toast, Toasty, Tooltip, buttonVariants, useSidebar } from "@cloudflare/kumo";
|
|
5
5
|
import { i18n } from "@lingui/core";
|
|
@@ -1181,9 +1181,6 @@ function getDraftStatus(item) {
|
|
|
1181
1181
|
async function fetchTranslations(collection, id) {
|
|
1182
1182
|
return parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/translations`), "Failed to fetch translations");
|
|
1183
1183
|
}
|
|
1184
|
-
/**
|
|
1185
|
-
* Fetch content list
|
|
1186
|
-
*/
|
|
1187
1184
|
async function fetchContentList(collection, options) {
|
|
1188
1185
|
const params = new URLSearchParams();
|
|
1189
1186
|
if (options?.cursor) params.set("cursor", options.cursor);
|
|
@@ -1193,13 +1190,29 @@ async function fetchContentList(collection, options) {
|
|
|
1193
1190
|
if (options?.orderBy) params.set("orderBy", options.orderBy);
|
|
1194
1191
|
if (options?.order) params.set("order", options.order);
|
|
1195
1192
|
if (options?.search) params.set("q", options.search);
|
|
1193
|
+
if (options?.authorId) params.set("authorId", options.authorId);
|
|
1194
|
+
if (options?.dateField && (options.dateFrom || options.dateTo)) {
|
|
1195
|
+
params.set("dateField", options.dateField);
|
|
1196
|
+
if (options.dateFrom) params.set("dateFrom", options.dateFrom);
|
|
1197
|
+
if (options.dateTo) params.set("dateTo", options.dateTo);
|
|
1198
|
+
}
|
|
1196
1199
|
return parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}${params.toString() ? `?${params}` : ""}`), "Failed to fetch content");
|
|
1197
1200
|
}
|
|
1198
1201
|
/**
|
|
1202
|
+
* Fetch the distinct authors of a collection's content. Gated on
|
|
1203
|
+
* `content:read`, so unlike the user-management API it's available to any
|
|
1204
|
+
* editor. Returns only users who have authored at least one live entry.
|
|
1205
|
+
*/
|
|
1206
|
+
async function fetchContentAuthors(collection) {
|
|
1207
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/authors`), "Failed to fetch content authors")).items;
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1199
1210
|
* Fetch single content item
|
|
1200
1211
|
*/
|
|
1201
|
-
async function fetchContent(collection, id) {
|
|
1202
|
-
|
|
1212
|
+
async function fetchContent(collection, id, options) {
|
|
1213
|
+
const params = new URLSearchParams();
|
|
1214
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1215
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}${params.toString() ? `?${params}` : ""}`), "Failed to fetch content")).item;
|
|
1203
1216
|
}
|
|
1204
1217
|
/**
|
|
1205
1218
|
* Create content
|
|
@@ -1221,8 +1234,10 @@ async function createContent(collection, input) {
|
|
|
1221
1234
|
/**
|
|
1222
1235
|
* Update content
|
|
1223
1236
|
*/
|
|
1224
|
-
async function updateContent(collection, id, input) {
|
|
1225
|
-
|
|
1237
|
+
async function updateContent(collection, id, input, options) {
|
|
1238
|
+
const params = new URLSearchParams();
|
|
1239
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1240
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}${params.toString() ? `?${params}` : ""}`, {
|
|
1226
1241
|
method: "PUT",
|
|
1227
1242
|
headers: { "Content-Type": "application/json" },
|
|
1228
1243
|
body: JSON.stringify(input)
|
|
@@ -1231,8 +1246,10 @@ async function updateContent(collection, id, input) {
|
|
|
1231
1246
|
/**
|
|
1232
1247
|
* Delete content (moves to trash)
|
|
1233
1248
|
*/
|
|
1234
|
-
async function deleteContent(collection, id) {
|
|
1235
|
-
const
|
|
1249
|
+
async function deleteContent(collection, id, options) {
|
|
1250
|
+
const params = new URLSearchParams();
|
|
1251
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1252
|
+
const response = await apiFetch(`${API_BASE}/content/${collection}/${id}${params.toString() ? `?${params}` : ""}`, { method: "DELETE" });
|
|
1236
1253
|
if (!response.ok) await throwResponseError(response, i18n._({
|
|
1237
1254
|
id: "t5wtI+",
|
|
1238
1255
|
message: "Failed to delete content"
|
|
@@ -1276,8 +1293,10 @@ async function duplicateContent(collection, id) {
|
|
|
1276
1293
|
/**
|
|
1277
1294
|
* Schedule content for future publishing
|
|
1278
1295
|
*/
|
|
1279
|
-
async function scheduleContent(collection, id, scheduledAt) {
|
|
1280
|
-
|
|
1296
|
+
async function scheduleContent(collection, id, scheduledAt, options) {
|
|
1297
|
+
const params = new URLSearchParams();
|
|
1298
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1299
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/schedule${params.toString() ? `?${params}` : ""}`, {
|
|
1281
1300
|
method: "POST",
|
|
1282
1301
|
headers: { "Content-Type": "application/json" },
|
|
1283
1302
|
body: JSON.stringify({ scheduledAt })
|
|
@@ -1286,8 +1305,10 @@ async function scheduleContent(collection, id, scheduledAt) {
|
|
|
1286
1305
|
/**
|
|
1287
1306
|
* Unschedule content (revert to draft)
|
|
1288
1307
|
*/
|
|
1289
|
-
async function unscheduleContent(collection, id) {
|
|
1290
|
-
|
|
1308
|
+
async function unscheduleContent(collection, id, options) {
|
|
1309
|
+
const params = new URLSearchParams();
|
|
1310
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1311
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/schedule${params.toString() ? `?${params}` : ""}`, { method: "DELETE" }), "Failed to unschedule content")).item;
|
|
1291
1312
|
}
|
|
1292
1313
|
/**
|
|
1293
1314
|
* Get a preview URL for content
|
|
@@ -1317,20 +1338,26 @@ async function getPreviewUrl(collection, id, options) {
|
|
|
1317
1338
|
/**
|
|
1318
1339
|
* Publish content - promotes current draft to live
|
|
1319
1340
|
*/
|
|
1320
|
-
async function publishContent(collection, id) {
|
|
1321
|
-
|
|
1341
|
+
async function publishContent(collection, id, options) {
|
|
1342
|
+
const params = new URLSearchParams();
|
|
1343
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1344
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/publish${params.toString() ? `?${params}` : ""}`, { method: "POST" }), "Failed to publish content")).item;
|
|
1322
1345
|
}
|
|
1323
1346
|
/**
|
|
1324
1347
|
* Unpublish content - removes from public, preserves draft
|
|
1325
1348
|
*/
|
|
1326
|
-
async function unpublishContent(collection, id) {
|
|
1327
|
-
|
|
1349
|
+
async function unpublishContent(collection, id, options) {
|
|
1350
|
+
const params = new URLSearchParams();
|
|
1351
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1352
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/unpublish${params.toString() ? `?${params}` : ""}`, { method: "POST" }), "Failed to unpublish content")).item;
|
|
1328
1353
|
}
|
|
1329
1354
|
/**
|
|
1330
1355
|
* Discard draft changes - reverts to live version
|
|
1331
1356
|
*/
|
|
1332
|
-
async function discardDraft(collection, id) {
|
|
1333
|
-
|
|
1357
|
+
async function discardDraft(collection, id, options) {
|
|
1358
|
+
const params = new URLSearchParams();
|
|
1359
|
+
if (options?.locale) params.set("locale", options.locale);
|
|
1360
|
+
return (await parseApiResponse(await apiFetch(`${API_BASE}/content/${collection}/${id}/discard-draft${params.toString() ? `?${params}` : ""}`, { method: "POST" }), "Failed to discard draft")).item;
|
|
1334
1361
|
}
|
|
1335
1362
|
/**
|
|
1336
1363
|
* Compare live and draft revisions
|
|
@@ -7550,7 +7577,7 @@ function convertPMNode(node) {
|
|
|
7550
7577
|
default: return null;
|
|
7551
7578
|
}
|
|
7552
7579
|
}
|
|
7553
|
-
function convertList(items, listItem) {
|
|
7580
|
+
function convertList(items, listItem, level = 1) {
|
|
7554
7581
|
const blocks = [];
|
|
7555
7582
|
const typedItems = items;
|
|
7556
7583
|
for (const item of typedItems) if (item.type === "listItem") {
|
|
@@ -7562,11 +7589,12 @@ function convertList(items, listItem) {
|
|
|
7562
7589
|
_key: generateKey(),
|
|
7563
7590
|
style: "normal",
|
|
7564
7591
|
listItem,
|
|
7565
|
-
level
|
|
7592
|
+
level,
|
|
7566
7593
|
children,
|
|
7567
7594
|
markDefs: markDefs.length > 0 ? markDefs : void 0
|
|
7568
7595
|
});
|
|
7569
|
-
}
|
|
7596
|
+
} else if (child.type === "bulletList") blocks.push(...convertList(child.content || [], "bullet", level + 1));
|
|
7597
|
+
else if (child.type === "orderedList") blocks.push(...convertList(child.content || [], "number", level + 1));
|
|
7570
7598
|
}
|
|
7571
7599
|
return blocks;
|
|
7572
7600
|
}
|
|
@@ -7655,7 +7683,8 @@ function portableTextToProsemirror(blocks) {
|
|
|
7655
7683
|
const listType = block.listItem;
|
|
7656
7684
|
while (i < blocks.length) {
|
|
7657
7685
|
const current = blocks[i];
|
|
7658
|
-
if (isTextBlock(current)
|
|
7686
|
+
if (!isTextBlock(current) || !current.listItem) break;
|
|
7687
|
+
if ((current.level || 1) > 1 || current.listItem === listType) {
|
|
7659
7688
|
listBlocks.push(current);
|
|
7660
7689
|
i++;
|
|
7661
7690
|
} else break;
|
|
@@ -7787,19 +7816,61 @@ function convertPTBlock(block) {
|
|
|
7787
7816
|
}
|
|
7788
7817
|
}
|
|
7789
7818
|
function convertPTList(items, listType) {
|
|
7790
|
-
const
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7819
|
+
const rootItems = [];
|
|
7820
|
+
let i = 0;
|
|
7821
|
+
while (i < items.length) {
|
|
7822
|
+
const item = items[i];
|
|
7823
|
+
if ((item.level || 1) === 1) {
|
|
7824
|
+
const nestedItems = [];
|
|
7825
|
+
i++;
|
|
7826
|
+
while (i < items.length && (items[i].level || 1) > 1) {
|
|
7827
|
+
nestedItems.push(items[i]);
|
|
7828
|
+
i++;
|
|
7829
|
+
}
|
|
7830
|
+
rootItems.push(convertPTListItem(item, nestedItems, listType));
|
|
7831
|
+
} else {
|
|
7832
|
+
rootItems.push(convertPTListItem(item, [], listType));
|
|
7833
|
+
i++;
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7800
7836
|
return {
|
|
7801
7837
|
type: listType === "bullet" ? "bulletList" : "orderedList",
|
|
7802
|
-
content:
|
|
7838
|
+
content: rootItems
|
|
7839
|
+
};
|
|
7840
|
+
}
|
|
7841
|
+
function convertPTListItem(item, nestedItems, parentListType) {
|
|
7842
|
+
const content = [];
|
|
7843
|
+
const pmContent = convertPTSpans(item.children, item.markDefs || []);
|
|
7844
|
+
content.push({
|
|
7845
|
+
type: "paragraph",
|
|
7846
|
+
content: pmContent.length > 0 ? pmContent : void 0
|
|
7847
|
+
});
|
|
7848
|
+
if (nestedItems.length > 0) {
|
|
7849
|
+
let minLevel = Infinity;
|
|
7850
|
+
for (const ni of nestedItems) {
|
|
7851
|
+
const level = ni.level || 2;
|
|
7852
|
+
if (level < minLevel) minLevel = level;
|
|
7853
|
+
}
|
|
7854
|
+
let j = 0;
|
|
7855
|
+
while (j < nestedItems.length) {
|
|
7856
|
+
const anchorType = nestedItems[j].listItem || parentListType;
|
|
7857
|
+
const nestedGroup = [];
|
|
7858
|
+
do {
|
|
7859
|
+
nestedGroup.push(nestedItems[j]);
|
|
7860
|
+
j++;
|
|
7861
|
+
} while (j < nestedItems.length && ((nestedItems[j].level || 2) > minLevel || (nestedItems[j].listItem || parentListType) === anchorType));
|
|
7862
|
+
if (nestedGroup.length > 0) {
|
|
7863
|
+
const adjustedGroup = nestedGroup.map((ni) => ({
|
|
7864
|
+
...ni,
|
|
7865
|
+
level: (ni.level || 2) - 1
|
|
7866
|
+
}));
|
|
7867
|
+
content.push(convertPTList(adjustedGroup, anchorType));
|
|
7868
|
+
}
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
return {
|
|
7872
|
+
type: "listItem",
|
|
7873
|
+
content
|
|
7803
7874
|
};
|
|
7804
7875
|
}
|
|
7805
7876
|
function convertPTSpans(spans, markDefs) {
|
|
@@ -9751,6 +9822,20 @@ function EditorToolbar({ editor, focusMode, onFocusModeChange }) {
|
|
|
9751
9822
|
"aria-hidden": "true"
|
|
9752
9823
|
})
|
|
9753
9824
|
}),
|
|
9825
|
+
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
9826
|
+
onClick: () => editor.chain().focus().insertContent({
|
|
9827
|
+
type: "htmlBlock",
|
|
9828
|
+
attrs: { html: "" }
|
|
9829
|
+
}).run(),
|
|
9830
|
+
title: _t9({
|
|
9831
|
+
id: "k76x3g",
|
|
9832
|
+
message: "Insert HTML"
|
|
9833
|
+
}),
|
|
9834
|
+
children: /* @__PURE__ */ jsx(BracketsAngle, {
|
|
9835
|
+
className: "h-4 w-4",
|
|
9836
|
+
"aria-hidden": "true"
|
|
9837
|
+
})
|
|
9838
|
+
}),
|
|
9754
9839
|
/* @__PURE__ */ jsx(ToolbarButton, {
|
|
9755
9840
|
onClick: () => editor.chain().focus().setHorizontalRule().run(),
|
|
9756
9841
|
title: _t9({
|
|
@@ -10422,8 +10507,11 @@ function SeoPanel({ contentKey, seo, onChange }) {
|
|
|
10422
10507
|
}
|
|
10423
10508
|
}, []);
|
|
10424
10509
|
const flushPendingDraft = React$1.useCallback(() => {
|
|
10510
|
+
const nextDraft = currentDraftRef.current;
|
|
10511
|
+
const nextSnapshot = serializeDraft(nextDraft);
|
|
10425
10512
|
clearPendingTextFlush();
|
|
10426
|
-
|
|
10513
|
+
if (nextSnapshot === lastEmittedSnapshotRef.current) return;
|
|
10514
|
+
emitChange(nextDraft);
|
|
10427
10515
|
}, [clearPendingTextFlush, emitChange]);
|
|
10428
10516
|
React$1.useEffect(() => {
|
|
10429
10517
|
if (activeContentKeyRef.current === contentKey) {
|
|
@@ -11845,7 +11933,8 @@ function ContentEditor({ collection, collectionLabel, item, fields, isNew, entry
|
|
|
11845
11933
|
params: {
|
|
11846
11934
|
collection,
|
|
11847
11935
|
id: tr.id
|
|
11848
|
-
}
|
|
11936
|
+
},
|
|
11937
|
+
search: { locale: tr.locale }
|
|
11849
11938
|
}),
|
|
11850
11939
|
onCreate: onTranslate
|
|
11851
11940
|
})
|
|
@@ -13023,6 +13112,12 @@ function useI18nConfig(manifest) {
|
|
|
13023
13112
|
|
|
13024
13113
|
//#endregion
|
|
13025
13114
|
//#region src/components/ContentList.tsx
|
|
13115
|
+
/** An empty (inactive) date filter, defaulting to the created-at column. */
|
|
13116
|
+
const EMPTY_DATE_FILTER = {
|
|
13117
|
+
field: "createdAt",
|
|
13118
|
+
from: "",
|
|
13119
|
+
to: ""
|
|
13120
|
+
};
|
|
13026
13121
|
const PAGE_SIZE = 20;
|
|
13027
13122
|
function getItemTitle$1(item) {
|
|
13028
13123
|
const rawTitle = item.data.title;
|
|
@@ -13032,7 +13127,7 @@ function getItemTitle$1(item) {
|
|
|
13032
13127
|
/**
|
|
13033
13128
|
* Content list view with table display and trash tab
|
|
13034
13129
|
*/
|
|
13035
|
-
function ContentList({ collection, collectionLabel, items, trashedItems = [], isLoading, isTrashedLoading, onDelete, onDuplicate, onRestore, onPermanentDelete, onLoadMore, onLoadMoreTrashed, hasMore, hasMoreTrashed, trashedCount = 0, i18n, activeLocale, onLocaleChange, urlPattern, sort, onSortChange, total, onSearchChange }) {
|
|
13130
|
+
function ContentList({ collection, collectionLabel, items, trashedItems = [], isLoading, isTrashedLoading, onDelete, onDuplicate, onRestore, onPermanentDelete, onLoadMore, onLoadMoreTrashed, hasMore, hasMoreTrashed, trashedCount = 0, i18n, activeLocale, onLocaleChange, urlPattern, sort, onSortChange, total, onSearchChange, statusFilter = "all", onStatusFilterChange, authors, authorFilter = "", onAuthorFilterChange, dateFilter = EMPTY_DATE_FILTER, onDateFilterChange }) {
|
|
13036
13131
|
const { _: _t } = useLingui();
|
|
13037
13132
|
const [activeTab, setActiveTab] = React$1.useState("all");
|
|
13038
13133
|
const [searchQuery, setSearchQuery] = React$1.useState("");
|
|
@@ -13152,6 +13247,15 @@ function ContentList({ collection, collectionLabel, items, trashedItems = [], is
|
|
|
13152
13247
|
}]
|
|
13153
13248
|
}),
|
|
13154
13249
|
activeTab === "all" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13250
|
+
onStatusFilterChange && /* @__PURE__ */ jsx(FilterBar, {
|
|
13251
|
+
statusFilter,
|
|
13252
|
+
onStatusFilterChange,
|
|
13253
|
+
authors,
|
|
13254
|
+
authorFilter,
|
|
13255
|
+
onAuthorFilterChange,
|
|
13256
|
+
dateFilter,
|
|
13257
|
+
onDateFilterChange
|
|
13258
|
+
}),
|
|
13155
13259
|
/* @__PURE__ */ jsx("div", {
|
|
13156
13260
|
className: "rounded-md border bg-kumo-base overflow-x-auto",
|
|
13157
13261
|
children: /* @__PURE__ */ jsxs("table", {
|
|
@@ -13405,6 +13509,171 @@ function ContentList({ collection, collectionLabel, items, trashedItems = [], is
|
|
|
13405
13509
|
});
|
|
13406
13510
|
}
|
|
13407
13511
|
/**
|
|
13512
|
+
* Filter controls for the content list: status, author, and a date range over
|
|
13513
|
+
* a chosen timestamp column (#1288). All controls report changes to the
|
|
13514
|
+
* parent, which owns the state and refetches. Filtering happens server-side,
|
|
13515
|
+
* so it works across the whole collection rather than the loaded page.
|
|
13516
|
+
*/
|
|
13517
|
+
function FilterBar({ statusFilter, onStatusFilterChange, authors, authorFilter, onAuthorFilterChange, dateFilter, onDateFilterChange }) {
|
|
13518
|
+
const { _: _t2 } = useLingui();
|
|
13519
|
+
const showAuthorFilter = !!onAuthorFilterChange && !!authors && authors.length > 0;
|
|
13520
|
+
const showDateFilter = !!onDateFilterChange;
|
|
13521
|
+
const statusItems = {
|
|
13522
|
+
all: _t2({
|
|
13523
|
+
id: "jBtpMP",
|
|
13524
|
+
message: "All statuses"
|
|
13525
|
+
}),
|
|
13526
|
+
published: _t2({
|
|
13527
|
+
id: "u3wRF+",
|
|
13528
|
+
message: "Published"
|
|
13529
|
+
}),
|
|
13530
|
+
draft: _t2({
|
|
13531
|
+
id: "eneWvv",
|
|
13532
|
+
message: "Draft"
|
|
13533
|
+
}),
|
|
13534
|
+
scheduled: _t2({
|
|
13535
|
+
id: "4ba0NE",
|
|
13536
|
+
message: "Scheduled"
|
|
13537
|
+
}),
|
|
13538
|
+
archived: _t2({
|
|
13539
|
+
id: "TdfEV7",
|
|
13540
|
+
message: "Archived"
|
|
13541
|
+
})
|
|
13542
|
+
};
|
|
13543
|
+
const dateFieldItems = {
|
|
13544
|
+
createdAt: _t2({
|
|
13545
|
+
id: "d+F6q9",
|
|
13546
|
+
message: "Created"
|
|
13547
|
+
}),
|
|
13548
|
+
updatedAt: _t2({
|
|
13549
|
+
id: "+b7T3G",
|
|
13550
|
+
message: "Updated"
|
|
13551
|
+
}),
|
|
13552
|
+
publishedAt: _t2({
|
|
13553
|
+
id: "u3wRF+",
|
|
13554
|
+
message: "Published"
|
|
13555
|
+
})
|
|
13556
|
+
};
|
|
13557
|
+
const hasActiveFilter = statusFilter !== "all" || authorFilter !== "" || !!dateFilter.from || !!dateFilter.to;
|
|
13558
|
+
const handleClear = () => {
|
|
13559
|
+
onStatusFilterChange("all");
|
|
13560
|
+
onAuthorFilterChange?.("");
|
|
13561
|
+
onDateFilterChange?.(EMPTY_DATE_FILTER);
|
|
13562
|
+
};
|
|
13563
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13564
|
+
className: "flex flex-wrap items-end gap-3",
|
|
13565
|
+
children: [
|
|
13566
|
+
/* @__PURE__ */ jsx(Select, {
|
|
13567
|
+
size: "sm",
|
|
13568
|
+
"aria-label": _t2({
|
|
13569
|
+
id: "KwybLi",
|
|
13570
|
+
message: "Filter by status"
|
|
13571
|
+
}),
|
|
13572
|
+
value: statusFilter,
|
|
13573
|
+
onValueChange: (v) => onStatusFilterChange(v ?? "all"),
|
|
13574
|
+
items: statusItems,
|
|
13575
|
+
children: Object.entries(statusItems).map(([value, label]) => /* @__PURE__ */ jsx(Select.Option, {
|
|
13576
|
+
value,
|
|
13577
|
+
children: label
|
|
13578
|
+
}, value))
|
|
13579
|
+
}),
|
|
13580
|
+
showAuthorFilter && /* @__PURE__ */ jsxs(Select, {
|
|
13581
|
+
size: "sm",
|
|
13582
|
+
"aria-label": _t2({
|
|
13583
|
+
id: "Z7V4V+",
|
|
13584
|
+
message: "Filter by author"
|
|
13585
|
+
}),
|
|
13586
|
+
value: authorFilter,
|
|
13587
|
+
onValueChange: (v) => onAuthorFilterChange?.(v ?? ""),
|
|
13588
|
+
items: {
|
|
13589
|
+
"": _t2({
|
|
13590
|
+
id: "35E2My",
|
|
13591
|
+
message: "All authors"
|
|
13592
|
+
}),
|
|
13593
|
+
...Object.fromEntries(authors.map((a) => [a.id, a.name || a.email]))
|
|
13594
|
+
},
|
|
13595
|
+
children: [/* @__PURE__ */ jsx(Select.Option, {
|
|
13596
|
+
value: "",
|
|
13597
|
+
children: _t2({
|
|
13598
|
+
id: "35E2My",
|
|
13599
|
+
message: "All authors"
|
|
13600
|
+
})
|
|
13601
|
+
}), authors.map((a) => /* @__PURE__ */ jsx(Select.Option, {
|
|
13602
|
+
value: a.id,
|
|
13603
|
+
children: a.name || a.email
|
|
13604
|
+
}, a.id))]
|
|
13605
|
+
}),
|
|
13606
|
+
showDateFilter && /* @__PURE__ */ jsxs("div", {
|
|
13607
|
+
className: "flex flex-wrap items-end gap-2",
|
|
13608
|
+
children: [
|
|
13609
|
+
/* @__PURE__ */ jsx(Select, {
|
|
13610
|
+
size: "sm",
|
|
13611
|
+
"aria-label": _t2({
|
|
13612
|
+
id: "unVZzy",
|
|
13613
|
+
message: "Date field to filter on"
|
|
13614
|
+
}),
|
|
13615
|
+
value: dateFilter.field,
|
|
13616
|
+
onValueChange: (v) => onDateFilterChange?.({
|
|
13617
|
+
...dateFilter,
|
|
13618
|
+
field: v ?? "createdAt"
|
|
13619
|
+
}),
|
|
13620
|
+
items: dateFieldItems,
|
|
13621
|
+
children: Object.entries(dateFieldItems).map(([value, label]) => /* @__PURE__ */ jsx(Select.Option, {
|
|
13622
|
+
value,
|
|
13623
|
+
children: label
|
|
13624
|
+
}, value))
|
|
13625
|
+
}),
|
|
13626
|
+
/* @__PURE__ */ jsx(Input, {
|
|
13627
|
+
type: "date",
|
|
13628
|
+
size: "sm",
|
|
13629
|
+
"aria-label": _t2({
|
|
13630
|
+
id: "xRJSOj",
|
|
13631
|
+
message: "From date"
|
|
13632
|
+
}),
|
|
13633
|
+
value: dateFilter.from,
|
|
13634
|
+
max: dateFilter.to || void 0,
|
|
13635
|
+
onChange: (e) => onDateFilterChange?.({
|
|
13636
|
+
...dateFilter,
|
|
13637
|
+
from: e.target.value
|
|
13638
|
+
})
|
|
13639
|
+
}),
|
|
13640
|
+
/* @__PURE__ */ jsx("span", {
|
|
13641
|
+
className: "pb-2 text-sm text-kumo-subtle",
|
|
13642
|
+
children: _t2({
|
|
13643
|
+
id: "dMtLDE",
|
|
13644
|
+
message: "to"
|
|
13645
|
+
})
|
|
13646
|
+
}),
|
|
13647
|
+
/* @__PURE__ */ jsx(Input, {
|
|
13648
|
+
type: "date",
|
|
13649
|
+
size: "sm",
|
|
13650
|
+
"aria-label": _t2({
|
|
13651
|
+
id: "w4eKlT",
|
|
13652
|
+
message: "To date"
|
|
13653
|
+
}),
|
|
13654
|
+
value: dateFilter.to,
|
|
13655
|
+
min: dateFilter.from || void 0,
|
|
13656
|
+
onChange: (e) => onDateFilterChange?.({
|
|
13657
|
+
...dateFilter,
|
|
13658
|
+
to: e.target.value
|
|
13659
|
+
})
|
|
13660
|
+
})
|
|
13661
|
+
]
|
|
13662
|
+
}),
|
|
13663
|
+
hasActiveFilter && /* @__PURE__ */ jsx(Button, {
|
|
13664
|
+
variant: "ghost",
|
|
13665
|
+
size: "sm",
|
|
13666
|
+
onClick: handleClear,
|
|
13667
|
+
icon: /* @__PURE__ */ jsx(X, {}),
|
|
13668
|
+
children: _t2({
|
|
13669
|
+
id: "u8JHrO",
|
|
13670
|
+
message: "Clear filters"
|
|
13671
|
+
})
|
|
13672
|
+
})
|
|
13673
|
+
]
|
|
13674
|
+
});
|
|
13675
|
+
}
|
|
13676
|
+
/**
|
|
13408
13677
|
* Table header that doubles as a sort control when the parent opted in by
|
|
13409
13678
|
* passing `onSortChange`. When no callback is provided we fall back to a
|
|
13410
13679
|
* plain `<th>` so legacy callers (and screen readers) see exactly the same
|
|
@@ -13488,7 +13757,7 @@ function renderItemCount({ searchQuery, filteredCount, total, hasMore, serverSea
|
|
|
13488
13757
|
});
|
|
13489
13758
|
}
|
|
13490
13759
|
function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale, urlPattern }) {
|
|
13491
|
-
const { _:
|
|
13760
|
+
const { _: _t3 } = useLingui();
|
|
13492
13761
|
const title = getItemTitle$1(item);
|
|
13493
13762
|
const date = new Date(item.updatedAt || item.createdAt);
|
|
13494
13763
|
return /* @__PURE__ */ jsxs("tr", {
|
|
@@ -13502,6 +13771,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13502
13771
|
collection,
|
|
13503
13772
|
id: item.id
|
|
13504
13773
|
},
|
|
13774
|
+
search: { locale: item.locale },
|
|
13505
13775
|
className: "font-medium hover:text-kumo-brand",
|
|
13506
13776
|
children: title
|
|
13507
13777
|
})
|
|
@@ -13534,7 +13804,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13534
13804
|
external: true,
|
|
13535
13805
|
variant: "ghost",
|
|
13536
13806
|
shape: "square",
|
|
13537
|
-
"aria-label":
|
|
13807
|
+
"aria-label": _t3({
|
|
13538
13808
|
id: "fB86ir",
|
|
13539
13809
|
message: "View published {title}",
|
|
13540
13810
|
values: { title }
|
|
@@ -13547,7 +13817,8 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13547
13817
|
collection,
|
|
13548
13818
|
id: item.id
|
|
13549
13819
|
},
|
|
13550
|
-
|
|
13820
|
+
search: { locale: item.locale },
|
|
13821
|
+
"aria-label": _t3({
|
|
13551
13822
|
id: "8mPwRM",
|
|
13552
13823
|
message: "Edit {title}",
|
|
13553
13824
|
values: { title }
|
|
@@ -13559,7 +13830,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13559
13830
|
/* @__PURE__ */ jsx(Button, {
|
|
13560
13831
|
variant: "ghost",
|
|
13561
13832
|
shape: "square",
|
|
13562
|
-
"aria-label":
|
|
13833
|
+
"aria-label": _t3({
|
|
13563
13834
|
id: "JPNGWC",
|
|
13564
13835
|
message: "Duplicate {title}",
|
|
13565
13836
|
values: { title }
|
|
@@ -13576,7 +13847,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13576
13847
|
...p,
|
|
13577
13848
|
variant: "ghost",
|
|
13578
13849
|
shape: "square",
|
|
13579
|
-
"aria-label":
|
|
13850
|
+
"aria-label": _t3({
|
|
13580
13851
|
id: "+ijHsD",
|
|
13581
13852
|
message: "Move {title} to trash",
|
|
13582
13853
|
values: { title }
|
|
@@ -13591,14 +13862,14 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13591
13862
|
children: [
|
|
13592
13863
|
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
13593
13864
|
className: "text-lg font-semibold",
|
|
13594
|
-
children:
|
|
13865
|
+
children: _t3({
|
|
13595
13866
|
id: "eAnjuA",
|
|
13596
13867
|
message: "Move to Trash?"
|
|
13597
13868
|
})
|
|
13598
13869
|
}),
|
|
13599
13870
|
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
13600
13871
|
className: "text-kumo-subtle",
|
|
13601
|
-
children:
|
|
13872
|
+
children: _t3({
|
|
13602
13873
|
id: "Zrd4Eo",
|
|
13603
13874
|
message: "Move \"{title}\" to trash? You can restore it later.",
|
|
13604
13875
|
values: { title }
|
|
@@ -13609,7 +13880,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13609
13880
|
children: [/* @__PURE__ */ jsx(Dialog.Close, { render: (p) => /* @__PURE__ */ jsx(Button, {
|
|
13610
13881
|
...p,
|
|
13611
13882
|
variant: "secondary",
|
|
13612
|
-
children:
|
|
13883
|
+
children: _t3({
|
|
13613
13884
|
id: "dEgA5A",
|
|
13614
13885
|
message: "Cancel"
|
|
13615
13886
|
})
|
|
@@ -13617,7 +13888,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13617
13888
|
...p,
|
|
13618
13889
|
variant: "destructive",
|
|
13619
13890
|
onClick: () => onDelete?.(item.id),
|
|
13620
|
-
children:
|
|
13891
|
+
children: _t3({
|
|
13621
13892
|
id: "q3TWG7",
|
|
13622
13893
|
message: "Move to Trash"
|
|
13623
13894
|
})
|
|
@@ -13633,7 +13904,7 @@ function ContentListItem({ item, collection, onDelete, onDuplicate, showLocale,
|
|
|
13633
13904
|
});
|
|
13634
13905
|
}
|
|
13635
13906
|
function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
13636
|
-
const { _:
|
|
13907
|
+
const { _: _t4 } = useLingui();
|
|
13637
13908
|
const title = getItemTitle$1(item);
|
|
13638
13909
|
const deletedDate = new Date(item.deletedAt);
|
|
13639
13910
|
return /* @__PURE__ */ jsxs("tr", {
|
|
@@ -13657,7 +13928,7 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13657
13928
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
13658
13929
|
variant: "ghost",
|
|
13659
13930
|
shape: "square",
|
|
13660
|
-
"aria-label":
|
|
13931
|
+
"aria-label": _t4({
|
|
13661
13932
|
id: "+Ss4nB",
|
|
13662
13933
|
message: "Restore {title}",
|
|
13663
13934
|
values: { title }
|
|
@@ -13673,7 +13944,7 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13673
13944
|
...p,
|
|
13674
13945
|
variant: "ghost",
|
|
13675
13946
|
shape: "square",
|
|
13676
|
-
"aria-label":
|
|
13947
|
+
"aria-label": _t4({
|
|
13677
13948
|
id: "V7GDXC",
|
|
13678
13949
|
message: "Permanently delete {title}",
|
|
13679
13950
|
values: { title }
|
|
@@ -13688,14 +13959,14 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13688
13959
|
children: [
|
|
13689
13960
|
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
13690
13961
|
className: "text-lg font-semibold",
|
|
13691
|
-
children:
|
|
13962
|
+
children: _t4({
|
|
13692
13963
|
id: "rXL/I6",
|
|
13693
13964
|
message: "Delete Permanently?"
|
|
13694
13965
|
})
|
|
13695
13966
|
}),
|
|
13696
13967
|
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
13697
13968
|
className: "text-kumo-subtle",
|
|
13698
|
-
children:
|
|
13969
|
+
children: _t4({
|
|
13699
13970
|
id: "7w6TBl",
|
|
13700
13971
|
message: "Permanently delete \"{title}\"? This cannot be undone.",
|
|
13701
13972
|
values: { title }
|
|
@@ -13706,7 +13977,7 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13706
13977
|
children: [/* @__PURE__ */ jsx(Dialog.Close, { render: (p) => /* @__PURE__ */ jsx(Button, {
|
|
13707
13978
|
...p,
|
|
13708
13979
|
variant: "secondary",
|
|
13709
|
-
children:
|
|
13980
|
+
children: _t4({
|
|
13710
13981
|
id: "dEgA5A",
|
|
13711
13982
|
message: "Cancel"
|
|
13712
13983
|
})
|
|
@@ -13714,7 +13985,7 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13714
13985
|
...p,
|
|
13715
13986
|
variant: "destructive",
|
|
13716
13987
|
onClick: () => onPermanentDelete?.(item.id),
|
|
13717
|
-
children:
|
|
13988
|
+
children: _t4({
|
|
13718
13989
|
id: "UBv8UK",
|
|
13719
13990
|
message: "Delete Permanently"
|
|
13720
13991
|
})
|
|
@@ -13729,17 +14000,17 @@ function TrashedListItem({ item, onRestore, onPermanentDelete }) {
|
|
|
13729
14000
|
});
|
|
13730
14001
|
}
|
|
13731
14002
|
function StatusBadge({ status, hasPendingChanges }) {
|
|
13732
|
-
const { _:
|
|
13733
|
-
const statusLabel = status === "published" ?
|
|
14003
|
+
const { _: _t5 } = useLingui();
|
|
14004
|
+
const statusLabel = status === "published" ? _t5({
|
|
13734
14005
|
id: "7wML9s",
|
|
13735
14006
|
message: "published"
|
|
13736
|
-
}) : status === "draft" ?
|
|
14007
|
+
}) : status === "draft" ? _t5({
|
|
13737
14008
|
id: "eHnlVy",
|
|
13738
14009
|
message: "draft"
|
|
13739
|
-
}) : status === "scheduled" ?
|
|
14010
|
+
}) : status === "scheduled" ? _t5({
|
|
13740
14011
|
id: "0p6/4o",
|
|
13741
14012
|
message: "scheduled"
|
|
13742
|
-
}) : status === "archived" ?
|
|
14013
|
+
}) : status === "archived" ? _t5({
|
|
13743
14014
|
id: "NXn85g",
|
|
13744
14015
|
message: "archived"
|
|
13745
14016
|
}) : status;
|
|
@@ -13750,7 +14021,7 @@ function StatusBadge({ status, hasPendingChanges }) {
|
|
|
13750
14021
|
children: statusLabel
|
|
13751
14022
|
}), hasPendingChanges && /* @__PURE__ */ jsx(Badge, {
|
|
13752
14023
|
variant: "secondary",
|
|
13753
|
-
children:
|
|
14024
|
+
children: _t5({
|
|
13754
14025
|
id: "S48xcO",
|
|
13755
14026
|
message: "pending"
|
|
13756
14027
|
})
|
|
@@ -31188,10 +31459,11 @@ function TermFormDialog({ open, onClose, taxonomyName, taxonomyDef, term, allTer
|
|
|
31188
31459
|
}
|
|
31189
31460
|
},
|
|
31190
31461
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
31191
|
-
className: "p-6",
|
|
31462
|
+
className: "p-6 max-h-[85vh] flex flex-col",
|
|
31192
31463
|
size: "lg",
|
|
31193
31464
|
children: /* @__PURE__ */ jsxs("form", {
|
|
31194
31465
|
onSubmit: handleSubmit,
|
|
31466
|
+
className: "flex flex-col flex-1 min-h-0",
|
|
31195
31467
|
children: [
|
|
31196
31468
|
/* @__PURE__ */ jsxs("div", {
|
|
31197
31469
|
className: "flex items-start justify-between gap-4 mb-4",
|
|
@@ -31251,7 +31523,7 @@ function TermFormDialog({ open, onClose, taxonomyName, taxonomyDef, term, allTer
|
|
|
31251
31523
|
})]
|
|
31252
31524
|
}),
|
|
31253
31525
|
/* @__PURE__ */ jsxs("div", {
|
|
31254
|
-
className: "space-y-4 py-4",
|
|
31526
|
+
className: "space-y-4 py-4 flex-1 overflow-y-auto -mx-1 px-1 min-h-0",
|
|
31255
31527
|
children: [
|
|
31256
31528
|
/* @__PURE__ */ jsx(Input, {
|
|
31257
31529
|
label: _t3({
|
|
@@ -38601,7 +38873,7 @@ function UsersPage() {
|
|
|
38601
38873
|
* Defines all admin routes and their components.
|
|
38602
38874
|
*/
|
|
38603
38875
|
function patchAutosaveQueries(queryClient, params) {
|
|
38604
|
-
const { collection, id, savedItem, payload } = params;
|
|
38876
|
+
const { collection, id, savedItem, payload, locale } = params;
|
|
38605
38877
|
const draftRevisionId = savedItem.draftRevisionId;
|
|
38606
38878
|
if (draftRevisionId) queryClient.setQueryData(["revision", draftRevisionId], (existing) => {
|
|
38607
38879
|
const nextData = {
|
|
@@ -38618,7 +38890,12 @@ function patchAutosaveQueries(queryClient, params) {
|
|
|
38618
38890
|
createdAt: existing?.createdAt ?? savedItem.updatedAt
|
|
38619
38891
|
};
|
|
38620
38892
|
});
|
|
38621
|
-
queryClient.setQueryData([
|
|
38893
|
+
queryClient.setQueryData(locale ? [
|
|
38894
|
+
"content",
|
|
38895
|
+
collection,
|
|
38896
|
+
id,
|
|
38897
|
+
{ locale }
|
|
38898
|
+
] : [
|
|
38622
38899
|
"content",
|
|
38623
38900
|
collection,
|
|
38624
38901
|
id
|
|
@@ -38716,6 +38993,26 @@ function ContentListPage() {
|
|
|
38716
38993
|
direction: "desc"
|
|
38717
38994
|
});
|
|
38718
38995
|
const [searchTerm, setSearchTerm] = React$1.useState("");
|
|
38996
|
+
const [statusFilter, setStatusFilter] = React$1.useState("all");
|
|
38997
|
+
const [authorFilter, setAuthorFilter] = React$1.useState("");
|
|
38998
|
+
const [dateFilter, setDateFilter] = React$1.useState(EMPTY_DATE_FILTER);
|
|
38999
|
+
const dateApiParams = React$1.useMemo(() => {
|
|
39000
|
+
if (!(!!dateFilter.from || !!dateFilter.to)) return void 0;
|
|
39001
|
+
return {
|
|
39002
|
+
dateField: dateFilter.field,
|
|
39003
|
+
dateFrom: dateFilter.from ? `${dateFilter.from}T00:00:00.000Z` : void 0,
|
|
39004
|
+
dateTo: dateFilter.to ? `${dateFilter.to}T23:59:59.999Z` : void 0
|
|
39005
|
+
};
|
|
39006
|
+
}, [dateFilter]);
|
|
39007
|
+
const { data: authors } = useQuery({
|
|
39008
|
+
queryKey: [
|
|
39009
|
+
"content",
|
|
39010
|
+
collection,
|
|
39011
|
+
"authors"
|
|
39012
|
+
],
|
|
39013
|
+
queryFn: () => fetchContentAuthors(collection),
|
|
39014
|
+
enabled: !!manifest
|
|
39015
|
+
});
|
|
38719
39016
|
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, error } = useInfiniteQuery({
|
|
38720
39017
|
queryKey: [
|
|
38721
39018
|
"content",
|
|
@@ -38723,7 +39020,10 @@ function ContentListPage() {
|
|
|
38723
39020
|
{
|
|
38724
39021
|
locale: activeLocale,
|
|
38725
39022
|
sort,
|
|
38726
|
-
search: searchTerm
|
|
39023
|
+
search: searchTerm,
|
|
39024
|
+
status: statusFilter,
|
|
39025
|
+
author: authorFilter,
|
|
39026
|
+
date: dateApiParams
|
|
38727
39027
|
}
|
|
38728
39028
|
],
|
|
38729
39029
|
queryFn: ({ pageParam }) => fetchContentList(collection, {
|
|
@@ -38732,7 +39032,10 @@ function ContentListPage() {
|
|
|
38732
39032
|
limit: 100,
|
|
38733
39033
|
orderBy: sort.field,
|
|
38734
39034
|
order: sort.direction,
|
|
38735
|
-
search: searchTerm || void 0
|
|
39035
|
+
search: searchTerm || void 0,
|
|
39036
|
+
status: statusFilter === "all" ? void 0 : statusFilter,
|
|
39037
|
+
authorId: authorFilter || void 0,
|
|
39038
|
+
...dateApiParams
|
|
38736
39039
|
}),
|
|
38737
39040
|
initialPageParam: void 0,
|
|
38738
39041
|
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
|
@@ -38872,7 +39175,14 @@ function ContentListPage() {
|
|
|
38872
39175
|
sort,
|
|
38873
39176
|
onSortChange: setSort,
|
|
38874
39177
|
total,
|
|
38875
|
-
onSearchChange: setSearchTerm
|
|
39178
|
+
onSearchChange: setSearchTerm,
|
|
39179
|
+
statusFilter,
|
|
39180
|
+
onStatusFilterChange: setStatusFilter,
|
|
39181
|
+
authors,
|
|
39182
|
+
authorFilter,
|
|
39183
|
+
onAuthorFilterChange: setAuthorFilter,
|
|
39184
|
+
dateFilter,
|
|
39185
|
+
onDateFilterChange: setDateFilter
|
|
38876
39186
|
});
|
|
38877
39187
|
}
|
|
38878
39188
|
const contentNewRoute = createRoute({
|
|
@@ -38904,7 +39214,8 @@ function ContentNewPage() {
|
|
|
38904
39214
|
params: {
|
|
38905
39215
|
collection,
|
|
38906
39216
|
id: result.id
|
|
38907
|
-
}
|
|
39217
|
+
},
|
|
39218
|
+
search: { locale: result.locale }
|
|
38908
39219
|
});
|
|
38909
39220
|
}
|
|
38910
39221
|
});
|
|
@@ -38976,7 +39287,10 @@ const contentEditRoute = createRoute({
|
|
|
38976
39287
|
getParentRoute: () => adminLayoutRoute,
|
|
38977
39288
|
path: "/content/$collection/$id",
|
|
38978
39289
|
component: ContentEditPage,
|
|
38979
|
-
validateSearch: (search) => ({
|
|
39290
|
+
validateSearch: (search) => ({
|
|
39291
|
+
...typeof search.field === "string" && { field: search.field },
|
|
39292
|
+
...typeof search.locale === "string" && { locale: search.locale }
|
|
39293
|
+
})
|
|
38980
39294
|
});
|
|
38981
39295
|
const ROLE_EDITOR = 40;
|
|
38982
39296
|
function ContentEditPage() {
|
|
@@ -38991,13 +39305,16 @@ function ContentEditPage() {
|
|
|
38991
39305
|
queryFn: fetchManifest
|
|
38992
39306
|
});
|
|
38993
39307
|
const i18n = manifest?.i18n;
|
|
39308
|
+
const activeLocale = i18n ? searchParams.locale ?? i18n.defaultLocale : void 0;
|
|
38994
39309
|
const { data: rawItem, isLoading } = useQuery({
|
|
38995
39310
|
queryKey: [
|
|
38996
39311
|
"content",
|
|
38997
39312
|
collection,
|
|
38998
|
-
id
|
|
39313
|
+
id,
|
|
39314
|
+
{ locale: activeLocale }
|
|
38999
39315
|
],
|
|
39000
|
-
queryFn: () => fetchContent(collection, id)
|
|
39316
|
+
queryFn: () => fetchContent(collection, id, { locale: activeLocale }),
|
|
39317
|
+
enabled: !i18n || !!activeLocale
|
|
39001
39318
|
});
|
|
39002
39319
|
React$1.useEffect(() => {
|
|
39003
39320
|
if (typeof searchParams.field !== "string" || isLoading) return;
|
|
@@ -39100,12 +39417,13 @@ function ContentEditPage() {
|
|
|
39100
39417
|
}
|
|
39101
39418
|
});
|
|
39102
39419
|
const updateMutation = useMutation({
|
|
39103
|
-
mutationFn: (data) => updateContent(collection, id, data),
|
|
39420
|
+
mutationFn: (data) => updateContent(collection, id, data, { locale: rawItem?.locale ?? activeLocale }),
|
|
39104
39421
|
onSuccess: () => {
|
|
39105
39422
|
queryClient.invalidateQueries({ queryKey: [
|
|
39106
39423
|
"content",
|
|
39107
39424
|
collection,
|
|
39108
|
-
id
|
|
39425
|
+
id,
|
|
39426
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39109
39427
|
] });
|
|
39110
39428
|
queryClient.invalidateQueries({ queryKey: [
|
|
39111
39429
|
"revisions",
|
|
@@ -39133,7 +39451,7 @@ function ContentEditPage() {
|
|
|
39133
39451
|
mutationFn: (data) => updateContent(collection, id, {
|
|
39134
39452
|
...data,
|
|
39135
39453
|
skipRevision: true
|
|
39136
|
-
}),
|
|
39454
|
+
}, { locale: rawItem?.locale ?? activeLocale }),
|
|
39137
39455
|
onSuccess: (savedItem, variables) => {
|
|
39138
39456
|
patchAutosaveQueries(queryClient, {
|
|
39139
39457
|
collection,
|
|
@@ -39142,7 +39460,8 @@ function ContentEditPage() {
|
|
|
39142
39460
|
payload: {
|
|
39143
39461
|
data: variables.data,
|
|
39144
39462
|
slug: variables.slug
|
|
39145
|
-
}
|
|
39463
|
+
},
|
|
39464
|
+
locale: rawItem?.locale ?? activeLocale
|
|
39146
39465
|
});
|
|
39147
39466
|
setLastAutosaveAt(/* @__PURE__ */ new Date());
|
|
39148
39467
|
},
|
|
@@ -39161,12 +39480,13 @@ function ContentEditPage() {
|
|
|
39161
39480
|
}
|
|
39162
39481
|
});
|
|
39163
39482
|
const publishMutation = useMutation({
|
|
39164
|
-
mutationFn: () => publishContent(collection, id),
|
|
39483
|
+
mutationFn: () => publishContent(collection, id, { locale: rawItem?.locale ?? activeLocale }),
|
|
39165
39484
|
onSuccess: () => {
|
|
39166
39485
|
queryClient.invalidateQueries({ queryKey: [
|
|
39167
39486
|
"content",
|
|
39168
39487
|
collection,
|
|
39169
|
-
id
|
|
39488
|
+
id,
|
|
39489
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39170
39490
|
] });
|
|
39171
39491
|
queryClient.invalidateQueries({ queryKey: [
|
|
39172
39492
|
"revisions",
|
|
@@ -39199,12 +39519,13 @@ function ContentEditPage() {
|
|
|
39199
39519
|
}
|
|
39200
39520
|
});
|
|
39201
39521
|
const unpublishMutation = useMutation({
|
|
39202
|
-
mutationFn: () => unpublishContent(collection, id),
|
|
39522
|
+
mutationFn: () => unpublishContent(collection, id, { locale: rawItem?.locale ?? activeLocale }),
|
|
39203
39523
|
onSuccess: () => {
|
|
39204
39524
|
queryClient.invalidateQueries({ queryKey: [
|
|
39205
39525
|
"content",
|
|
39206
39526
|
collection,
|
|
39207
|
-
id
|
|
39527
|
+
id,
|
|
39528
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39208
39529
|
] });
|
|
39209
39530
|
queryClient.invalidateQueries({ queryKey: [
|
|
39210
39531
|
"revisions",
|
|
@@ -39237,12 +39558,13 @@ function ContentEditPage() {
|
|
|
39237
39558
|
}
|
|
39238
39559
|
});
|
|
39239
39560
|
const discardDraftMutation = useMutation({
|
|
39240
|
-
mutationFn: () => discardDraft(collection, id),
|
|
39561
|
+
mutationFn: () => discardDraft(collection, id, { locale: rawItem?.locale ?? activeLocale }),
|
|
39241
39562
|
onSuccess: () => {
|
|
39242
39563
|
queryClient.invalidateQueries({ queryKey: [
|
|
39243
39564
|
"content",
|
|
39244
39565
|
collection,
|
|
39245
|
-
id
|
|
39566
|
+
id,
|
|
39567
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39246
39568
|
] });
|
|
39247
39569
|
queryClient.invalidateQueries({ queryKey: [
|
|
39248
39570
|
"revisions",
|
|
@@ -39275,12 +39597,13 @@ function ContentEditPage() {
|
|
|
39275
39597
|
}
|
|
39276
39598
|
});
|
|
39277
39599
|
const scheduleMutation = useMutation({
|
|
39278
|
-
mutationFn: (scheduledAt) => scheduleContent(collection, id, scheduledAt),
|
|
39600
|
+
mutationFn: (scheduledAt) => scheduleContent(collection, id, scheduledAt, { locale: rawItem?.locale ?? activeLocale }),
|
|
39279
39601
|
onSuccess: () => {
|
|
39280
39602
|
queryClient.invalidateQueries({ queryKey: [
|
|
39281
39603
|
"content",
|
|
39282
39604
|
collection,
|
|
39283
|
-
id
|
|
39605
|
+
id,
|
|
39606
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39284
39607
|
] });
|
|
39285
39608
|
toastManager.add({
|
|
39286
39609
|
title: _t3({
|
|
@@ -39308,12 +39631,13 @@ function ContentEditPage() {
|
|
|
39308
39631
|
}
|
|
39309
39632
|
});
|
|
39310
39633
|
const unscheduleMutation = useMutation({
|
|
39311
|
-
mutationFn: () => unscheduleContent(collection, id),
|
|
39634
|
+
mutationFn: () => unscheduleContent(collection, id, { locale: rawItem?.locale ?? activeLocale }),
|
|
39312
39635
|
onSuccess: () => {
|
|
39313
39636
|
queryClient.invalidateQueries({ queryKey: [
|
|
39314
39637
|
"content",
|
|
39315
39638
|
collection,
|
|
39316
|
-
id
|
|
39639
|
+
id,
|
|
39640
|
+
{ locale: rawItem?.locale ?? activeLocale }
|
|
39317
39641
|
] });
|
|
39318
39642
|
toastManager.add({
|
|
39319
39643
|
title: _t3({
|
|
@@ -39359,7 +39683,8 @@ function ContentEditPage() {
|
|
|
39359
39683
|
params: {
|
|
39360
39684
|
collection,
|
|
39361
39685
|
id: result.id
|
|
39362
|
-
}
|
|
39686
|
+
},
|
|
39687
|
+
search: { locale: result.locale }
|
|
39363
39688
|
});
|
|
39364
39689
|
toastManager.add({
|
|
39365
39690
|
title: _t3({
|
|
@@ -39391,7 +39716,7 @@ function ContentEditPage() {
|
|
|
39391
39716
|
}
|
|
39392
39717
|
});
|
|
39393
39718
|
const deleteMutation = useMutation({
|
|
39394
|
-
mutationFn: () => deleteContent(collection, id),
|
|
39719
|
+
mutationFn: () => deleteContent(collection, id, { locale: rawItem?.locale ?? activeLocale }),
|
|
39395
39720
|
onSuccess: () => {
|
|
39396
39721
|
queryClient.invalidateQueries({ queryKey: ["content", collection] });
|
|
39397
39722
|
queryClient.invalidateQueries({ queryKey: [
|
|
@@ -39402,7 +39727,7 @@ function ContentEditPage() {
|
|
|
39402
39727
|
navigate({
|
|
39403
39728
|
to: "/content/$collection",
|
|
39404
39729
|
params: { collection },
|
|
39405
|
-
search: { locale:
|
|
39730
|
+
search: { locale: activeLocale }
|
|
39406
39731
|
});
|
|
39407
39732
|
},
|
|
39408
39733
|
onError: (error) => {
|
|
@@ -40283,5 +40608,5 @@ function AdminApp({ pluginAdmins = EMPTY_PLUGINS, authProviders = EMPTY_AUTH_PRO
|
|
|
40283
40608
|
}
|
|
40284
40609
|
|
|
40285
40610
|
//#endregion
|
|
40286
|
-
export { API_BASE, API_TOKEN_SCOPES, AdminApp, AdminApp as App, AuthProviderProvider, CAPABILITY_LABELS, ContentEditor, ContentList, DEFAULT_LOCALE, Dashboard, EditorHeader, Header, Link, LoginPage, MEDIA_SEARCH_MAX_LENGTH, MediaLibrary, MediaPickerModal, PasskeyLogin, PasskeyRegistration, PluginAdminProvider, PortableTextEditor, SUPPORTED_LOCALES, SUPPORTED_LOCALE_CODES, SaveButton, Settings, SetupWizard, Shell, KumoSidebar as Sidebar, SidebarNav, analyzeWpPluginSite, analyzeWxr, apiFetch, bulkCommentAction, checkPluginUpdates, cn, compareRevisions, completeSignup, createAdminRouter, createAllowedDomain, createApiToken, createByline, createBylineField, createBylineTranslation, createCollection, createContent, createField, createMenu, createMenuItem, createMenuTranslation, createRedirect, createSection, createTaxonomy, createTerm, createTermTranslation, createWidget, createWidgetArea, deleteAllowedDomain, deleteByline, deleteBylineField, deleteCollection, deleteComment, deleteContent, deleteField, deleteFromProvider, deleteMedia, deleteMenu, deleteMenuItem, deletePasskey, deleteRedirect, deleteSection, deleteTerm, deleteWidget, deleteWidgetArea, describeCapability, disablePlugin, disableUser, discardDraft, duplicateContent, enablePlugin, enableUser, executeWpPluginImport, executeWxrImport, fetch404Summary, fetchAllowedDomains, fetchApiTokens, fetchAuthMode, fetchByline, fetchBylineTranslations, fetchBylines, fetchCollection, fetchCollections, fetchComment, fetchCommentCounts, fetchComments, fetchContent, fetchContentList, fetchDashboardStats, fetchEmailSettings, fetchFields, fetchManifest, fetchMarketplacePlugin, fetchMediaList, fetchMediaProviders, fetchMenu, fetchMenuTranslations, fetchMenus, fetchOrphanedTables, fetchPasskeys, fetchPlugin, fetchPlugins, fetchProviderMedia, fetchRedirects, fetchRevision, fetchRevisions, fetchSection, fetchSections, fetchSettings, fetchTaxonomyDef, fetchTaxonomyDefs, fetchTermTranslations, fetchTerms, fetchTheme, fetchTranslations, fetchTrashedContent, fetchUser, fetchUsers, fetchWidgetArea, fetchWidgetAreas, fetchWidgetComponents, generatePreviewUrl, getBylineFieldUsage, getDraftStatus, getPreviewUrl, hasAllowedDomains, importWxrMedia, installMarketplacePlugin, inviteUser, listBylineFields, parseApiResponse, permanentDeleteContent, prepareWxrImport, probeImportUrl, publishContent, registerOrphanedTable, renamePasskey, reorderBylineFields, reorderFields, reorderMenuItems, reorderWidgets, requestSignup, resolveLocale, restoreContent, restoreRevision, revokeApiToken, rewriteContentUrls, scheduleContent, searchMarketplace, searchThemes, sendRecoveryLink, sendTestEmail, setSearchEnabled, throwResponseError, uninstallMarketplacePlugin, unpublishContent, unscheduleContent, updateAllowedDomain, updateByline, updateBylineField, updateCollection, updateCommentStatus, updateContent, updateField, updateMarketplacePlugin, updateMedia, updateMenu, updateMenuItem, updateRedirect, updateSection, updateSettings, updateTerm, updateUser, updateWidget, uploadMedia, uploadToProvider, useAuthProviderList, useAuthProviders, useCurrentUser, useLocale, useNavigate, useParams, usePluginAdmins, usePluginField, usePluginHasPages, usePluginHasWidgets, usePluginPage, usePluginWidget, validateInviteToken, verifySignupToken };
|
|
40611
|
+
export { API_BASE, API_TOKEN_SCOPES, AdminApp, AdminApp as App, AuthProviderProvider, CAPABILITY_LABELS, ContentEditor, ContentList, DEFAULT_LOCALE, Dashboard, EditorHeader, Header, Link, LoginPage, MEDIA_SEARCH_MAX_LENGTH, MediaLibrary, MediaPickerModal, PasskeyLogin, PasskeyRegistration, PluginAdminProvider, PortableTextEditor, SUPPORTED_LOCALES, SUPPORTED_LOCALE_CODES, SaveButton, Settings, SetupWizard, Shell, KumoSidebar as Sidebar, SidebarNav, analyzeWpPluginSite, analyzeWxr, apiFetch, bulkCommentAction, checkPluginUpdates, cn, compareRevisions, completeSignup, createAdminRouter, createAllowedDomain, createApiToken, createByline, createBylineField, createBylineTranslation, createCollection, createContent, createField, createMenu, createMenuItem, createMenuTranslation, createRedirect, createSection, createTaxonomy, createTerm, createTermTranslation, createWidget, createWidgetArea, deleteAllowedDomain, deleteByline, deleteBylineField, deleteCollection, deleteComment, deleteContent, deleteField, deleteFromProvider, deleteMedia, deleteMenu, deleteMenuItem, deletePasskey, deleteRedirect, deleteSection, deleteTerm, deleteWidget, deleteWidgetArea, describeCapability, disablePlugin, disableUser, discardDraft, duplicateContent, enablePlugin, enableUser, executeWpPluginImport, executeWxrImport, fetch404Summary, fetchAllowedDomains, fetchApiTokens, fetchAuthMode, fetchByline, fetchBylineTranslations, fetchBylines, fetchCollection, fetchCollections, fetchComment, fetchCommentCounts, fetchComments, fetchContent, fetchContentAuthors, fetchContentList, fetchDashboardStats, fetchEmailSettings, fetchFields, fetchManifest, fetchMarketplacePlugin, fetchMediaList, fetchMediaProviders, fetchMenu, fetchMenuTranslations, fetchMenus, fetchOrphanedTables, fetchPasskeys, fetchPlugin, fetchPlugins, fetchProviderMedia, fetchRedirects, fetchRevision, fetchRevisions, fetchSection, fetchSections, fetchSettings, fetchTaxonomyDef, fetchTaxonomyDefs, fetchTermTranslations, fetchTerms, fetchTheme, fetchTranslations, fetchTrashedContent, fetchUser, fetchUsers, fetchWidgetArea, fetchWidgetAreas, fetchWidgetComponents, generatePreviewUrl, getBylineFieldUsage, getDraftStatus, getPreviewUrl, hasAllowedDomains, importWxrMedia, installMarketplacePlugin, inviteUser, listBylineFields, parseApiResponse, permanentDeleteContent, prepareWxrImport, probeImportUrl, publishContent, registerOrphanedTable, renamePasskey, reorderBylineFields, reorderFields, reorderMenuItems, reorderWidgets, requestSignup, resolveLocale, restoreContent, restoreRevision, revokeApiToken, rewriteContentUrls, scheduleContent, searchMarketplace, searchThemes, sendRecoveryLink, sendTestEmail, setSearchEnabled, throwResponseError, uninstallMarketplacePlugin, unpublishContent, unscheduleContent, updateAllowedDomain, updateByline, updateBylineField, updateCollection, updateCommentStatus, updateContent, updateField, updateMarketplacePlugin, updateMedia, updateMenu, updateMenuItem, updateRedirect, updateSection, updateSettings, updateTerm, updateUser, updateWidget, uploadMedia, uploadToProvider, useAuthProviderList, useAuthProviders, useCurrentUser, useLocale, useNavigate, useParams, usePluginAdmins, usePluginField, usePluginHasPages, usePluginHasWidgets, usePluginPage, usePluginWidget, validateInviteToken, verifySignupToken };
|
|
40287
40612
|
//# sourceMappingURL=index.js.map
|