@bison-lab/payload-core 4.9.1 → 4.10.1
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/admin.d.mts +3 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +77 -58
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/admin.d.mts
CHANGED
|
@@ -265,7 +265,9 @@ declare function AdminNavItemRowLabel(): react_jsx_runtime0.JSX.Element;
|
|
|
265
265
|
/**
|
|
266
266
|
* Payload's select of collections or globals. Subscribes to sibling Type
|
|
267
267
|
* with `useField` so the list updates when Type changes — `getDataByPath`
|
|
268
|
-
* does not re-render this field.
|
|
268
|
+
* does not re-render this field. Offers only what Payload would paint for
|
|
269
|
+
* this login: the client config has no `admin.hidden`, so visibility
|
|
270
|
+
* comes from `useEntityVisibility`.
|
|
269
271
|
*/
|
|
270
272
|
declare const AdminNavEntityField: TextFieldClientComponent;
|
|
271
273
|
//#endregion
|
package/dist/admin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCpCpB,gBAAA;AAAA,iBAgDI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cCjD7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC4Bf,SAAA,EAAW,wBAAA;;;;;;;iBC3BR,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBCJ9C,YAAA,CAAA;EAAe,QAAA;EAAU;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;cCEhE,iBAAA,EAAmB,wBAAA;AAAA,iBAEhB,gBAAA,CAAA;EAAmB;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cCA1D,aAAA,EAAe,wBAAA;;;;;;;;cC8Cf,UAAA,EAAY,0BAAA;;;;;;;;cCpBZ,gBAAA,EAAkB,wBAAA;;;;;;;;;AvBxB/B;;cwB2Ca,mBAAA,EAAqB,yBAAA;;;;;;;;;AxB3ClC;cyBuJa,iBAAA,EAAmB,yBAAA;;;iBC5HhB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;iBC/B3D,eAAA,CAAA;EAAkB,GAAA;EAAK;AAAA;EAAc,GAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCOzE,iBAAA,CAAA;EAAoB;AAAA;EAAU,IAAA;AAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCmB3C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;A9BGpB;;;iB8B6CgB,QAAA,CAAA;EAAW;AAAA,GAAmB,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;iBCnD3C,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA
|
|
1
|
+
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCpCpB,gBAAA;AAAA,iBAgDI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cCjD7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC4Bf,SAAA,EAAW,wBAAA;;;;;;;iBC3BR,aAAA,CAAc,KAAA,EAAO,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;iBCJ9C,YAAA,CAAA;EAAe,QAAA;EAAU;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;cCEhE,iBAAA,EAAmB,wBAAA;AAAA,iBAEhB,gBAAA,CAAA;EAAmB;AAAA,GAAW,yBAAA,GAAyB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;cCA1D,aAAA,EAAe,wBAAA;;;;;;;;cC8Cf,UAAA,EAAY,0BAAA;;;;;;;;cCpBZ,gBAAA,EAAkB,wBAAA;;;;;;;;;AvBxB/B;;cwB2Ca,mBAAA,EAAqB,yBAAA;;;;;;;;;AxB3ClC;cyBuJa,iBAAA,EAAmB,yBAAA;;;iBC5HhB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;iBC/B3D,eAAA,CAAA;EAAkB,GAAA;EAAK;AAAA;EAAc,GAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCOzE,iBAAA,CAAA;EAAoB;AAAA;EAAU,IAAA;AAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;UCmB3C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;A9BGpB;;;iB8B6CgB,QAAA,CAAA;EAAW;AAAA,GAAmB,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;iBCnD3C,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;AhCGpC;ciCCa,mBAAA,EAAqB,wBAAA;;;;;;;;AjCDlC;UkCFiB,cAAA;;EAEf,MAAA;ElCyED;EkCvEC,IAAA;;EAEA,KAAA;EjCmBW;EiCjBX,MAAA;AAAA;AAAA,UAGe,eAAA;EjCiEhB;EiC/DC,IAAA;;EAEA,KAAA;EhCgBW;EgCdX,UAAA;;;;;EAKA,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;iBCyKO,aAAA,CACd,KAAA,EAAO,mBAAA;EAAwB,UAAA,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBChM1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBCkH7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/admin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as colorDocFromState, i as SYSTEM_COLOR_KEYS, n as pageEditorLooks, r as pageEditorTokens, s as stateFromColorDoc } from "./looks-BbL309kO.mjs";
|
|
3
|
-
import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAuth, useBulkUpload, useConfig, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
|
|
3
|
+
import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAuth, useBulkUpload, useConfig, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
|
|
4
4
|
import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, regenerateColorScale, setColorScaleInclude, updateColorScale } from "@bison-lab/tokens";
|
|
5
5
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1261,54 +1261,52 @@ const LibraryField = ({ field, path, readOnly }) => {
|
|
|
1261
1261
|
children: "Add color"
|
|
1262
1262
|
})]
|
|
1263
1263
|
}),
|
|
1264
|
-
adding ? /* @__PURE__ */ jsx(ThemePortal, { children: /* @__PURE__ */ jsx("div", {
|
|
1264
|
+
adding ? /* @__PURE__ */ jsx(ThemePortal, { children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(KitProvider, { children: /* @__PURE__ */ jsxs(Dialog, {
|
|
1265
1265
|
className: "bl-theme-dialog",
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
children:
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}) })
|
|
1311
|
-
}) }) : null,
|
|
1266
|
+
open: true,
|
|
1267
|
+
title: "New color",
|
|
1268
|
+
onCancel: () => {
|
|
1269
|
+
setAdding(false);
|
|
1270
|
+
setName("");
|
|
1271
|
+
setHex("");
|
|
1272
|
+
setSourceStep(500);
|
|
1273
|
+
},
|
|
1274
|
+
confirmLabel: "Create color scale",
|
|
1275
|
+
onConfirm: add,
|
|
1276
|
+
confirmDisabled: !slugify(name) || !isThemeHex(hex),
|
|
1277
|
+
children: [
|
|
1278
|
+
/* @__PURE__ */ jsx("p", { children: "Give it a useful name, enter your brand hex, then say which scale step that hex is." }),
|
|
1279
|
+
/* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(Label, { children: "Name" }), /* @__PURE__ */ jsx(Input, {
|
|
1280
|
+
"aria-label": "Name",
|
|
1281
|
+
value: name,
|
|
1282
|
+
placeholder: "e.g. Coral",
|
|
1283
|
+
onChange: (event) => setName(event.target.value)
|
|
1284
|
+
})] }),
|
|
1285
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
1286
|
+
as: "div",
|
|
1287
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "Brand hex" }), /* @__PURE__ */ jsx(BrandHexField, {
|
|
1288
|
+
name: "Brand",
|
|
1289
|
+
value: hex,
|
|
1290
|
+
onChange: setHex,
|
|
1291
|
+
picker: "inline"
|
|
1292
|
+
})]
|
|
1293
|
+
}),
|
|
1294
|
+
/* @__PURE__ */ jsxs(Field, {
|
|
1295
|
+
as: "div",
|
|
1296
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "This color is" }), /* @__PURE__ */ jsxs(Select, {
|
|
1297
|
+
value: String(sourceStep),
|
|
1298
|
+
onValueChange: (value) => setSourceStep(Number(value)),
|
|
1299
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1300
|
+
"aria-label": "This color is",
|
|
1301
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
1302
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: SHADE_STEPS.map((step) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1303
|
+
value: String(step),
|
|
1304
|
+
children: step
|
|
1305
|
+
}, step)) })]
|
|
1306
|
+
})]
|
|
1307
|
+
})
|
|
1308
|
+
]
|
|
1309
|
+
}) }) }) }) : null,
|
|
1312
1310
|
replacing ? /* @__PURE__ */ jsx(ThemePortal, { children: /* @__PURE__ */ jsx("div", {
|
|
1313
1311
|
className: "bl-library__modal",
|
|
1314
1312
|
role: "dialog",
|
|
@@ -1414,7 +1412,7 @@ const CSS$3 = `
|
|
|
1414
1412
|
.bl-library__actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem;margin-top:1rem}
|
|
1415
1413
|
.bl-library__actions button:last-child{border:0;background:#0f172a;color:#fff;font-weight:600}
|
|
1416
1414
|
.bl-library__actions button:last-child:disabled{opacity:.4;cursor:not-allowed}
|
|
1417
|
-
.bl-
|
|
1415
|
+
.bl-nav-kit__modal.bl-theme-dialog{z-index:10000}
|
|
1418
1416
|
`;
|
|
1419
1417
|
//#endregion
|
|
1420
1418
|
//#region src/admin/typography-pairing.tsx
|
|
@@ -4155,8 +4153,13 @@ function DocumentCreateNew({ path }) {
|
|
|
4155
4153
|
const ADMIN_NAV_SLUG = "admin-nav";
|
|
4156
4154
|
//#endregion
|
|
4157
4155
|
//#region src/admin-nav/resolve.ts
|
|
4158
|
-
|
|
4159
|
-
|
|
4156
|
+
/**
|
|
4157
|
+
* `group: false` and `hidden: true` are both "never on the sidebar".
|
|
4158
|
+
* A function `hidden` is per viewer and arrives as `visibleEntities`.
|
|
4159
|
+
*/
|
|
4160
|
+
function sidebarGroup(entity) {
|
|
4161
|
+
if (entity.admin?.group === false || entity.admin?.hidden === true) return false;
|
|
4162
|
+
const group = entity.admin?.group;
|
|
4160
4163
|
if (typeof group === "string") return group;
|
|
4161
4164
|
return "";
|
|
4162
4165
|
}
|
|
@@ -4175,13 +4178,13 @@ function catalog(config) {
|
|
|
4175
4178
|
type: "collection",
|
|
4176
4179
|
slug: entity.slug,
|
|
4177
4180
|
label: entityLabel(entity, "collection"),
|
|
4178
|
-
group: sidebarGroup(entity
|
|
4181
|
+
group: sidebarGroup(entity)
|
|
4179
4182
|
}));
|
|
4180
4183
|
const globals = (config.globals ?? []).map((entity) => ({
|
|
4181
4184
|
type: "global",
|
|
4182
4185
|
slug: entity.slug,
|
|
4183
4186
|
label: entityLabel(entity, "global"),
|
|
4184
|
-
group: sidebarGroup(entity
|
|
4187
|
+
group: sidebarGroup(entity)
|
|
4185
4188
|
}));
|
|
4186
4189
|
return [...collections, ...globals];
|
|
4187
4190
|
}
|
|
@@ -4366,12 +4369,25 @@ function entityType(type) {
|
|
|
4366
4369
|
return type === "global" ? "global" : "collection";
|
|
4367
4370
|
}
|
|
4368
4371
|
/**
|
|
4372
|
+
* `admin.hidden: true` is hidden for every login, so no sidebar can carry
|
|
4373
|
+
* it. A function `hidden` depends on the viewer and is left to
|
|
4374
|
+
* `visibleEntities`, which Payload evaluates per request.
|
|
4375
|
+
*/
|
|
4376
|
+
function isAlwaysHidden(entity) {
|
|
4377
|
+
return entity.admin?.group === false || entity.admin?.hidden === true;
|
|
4378
|
+
}
|
|
4379
|
+
/**
|
|
4369
4380
|
* Collections or globals a Developer may pin. Sibling Type decides which
|
|
4370
|
-
* list. `group: false`
|
|
4381
|
+
* list. `group: false` and `hidden: true` stay off — those entities are
|
|
4382
|
+
* not on the sidebar. `visibleEntities` (Payload's per-user list, from
|
|
4383
|
+
* `useEntityVisibility`) narrows it further when given: the client config
|
|
4384
|
+
* drops `admin.hidden`, so a function `hidden` is only known there.
|
|
4371
4385
|
*/
|
|
4372
|
-
function adminNavEntityOptions(config, type) {
|
|
4386
|
+
function adminNavEntityOptions(config, type, visibleEntities) {
|
|
4373
4387
|
const kind = entityType(type);
|
|
4374
|
-
|
|
4388
|
+
const entities = kind === "global" ? config.globals ?? [] : config.collections ?? [];
|
|
4389
|
+
const visible = visibleEntities ? new Set(kind === "global" ? visibleEntities.globals ?? [] : visibleEntities.collections ?? []) : null;
|
|
4390
|
+
return entities.filter((entity) => !isAlwaysHidden(entity)).filter((entity) => visible === null || visible.has(entity.slug)).map((entity) => ({
|
|
4375
4391
|
value: entity.slug,
|
|
4376
4392
|
label: kind === "global" ? typeof entity.label === "string" && entity.label ? entity.label : entity.slug : typeof entity.labels?.plural === "string" && entity.labels.plural ? entity.labels.plural : entity.slug
|
|
4377
4393
|
}));
|
|
@@ -4397,12 +4413,15 @@ function AdminNavItemRowLabel() {
|
|
|
4397
4413
|
/**
|
|
4398
4414
|
* Payload's select of collections or globals. Subscribes to sibling Type
|
|
4399
4415
|
* with `useField` so the list updates when Type changes — `getDataByPath`
|
|
4400
|
-
* does not re-render this field.
|
|
4416
|
+
* does not re-render this field. Offers only what Payload would paint for
|
|
4417
|
+
* this login: the client config has no `admin.hidden`, so visibility
|
|
4418
|
+
* comes from `useEntityVisibility`.
|
|
4401
4419
|
*/
|
|
4402
4420
|
const AdminNavEntityField = ({ field, path, permissions, readOnly, schemaPath }) => {
|
|
4403
4421
|
const { value: type } = useField({ path: path.replace(/\.slug$/, ".type") });
|
|
4404
4422
|
const { config } = useConfig();
|
|
4405
|
-
const
|
|
4423
|
+
const { visibleEntities } = useEntityVisibility();
|
|
4424
|
+
const options = adminNavEntityOptions(config, type, visibleEntities);
|
|
4406
4425
|
return /* @__PURE__ */ jsx(SelectField, {
|
|
4407
4426
|
field: {
|
|
4408
4427
|
name: field.name,
|