@bison-lab/payload-core 4.7.0 → 4.9.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/README.md +12 -3
- package/dist/admin.d.mts +15 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +109 -27
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +42 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +121 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ lockstep.
|
|
|
22
22
|
|
|
23
23
|
| Import | Contents | Runs where |
|
|
24
24
|
| ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
|
|
25
|
-
| `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createBlockLibrary`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createQuestions`, `createTaxonomy`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
|
|
25
|
+
| `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createBlockLibrary`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createQuestions`, `createTaxonomy`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `listAlign`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
|
|
26
26
|
| `@bison-lab/payload-core/metadata` | `pageMetadata`, the title helpers, the same types | Server. What a page route imports; it does not load the plugin. |
|
|
27
27
|
| `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead`, `themeHeadFromDoc` | Server. What a root layout imports; it does not load the plugin or React. |
|
|
28
28
|
| `@bison-lab/payload-core/navigation` | `getNavigation`, the Header and Footer slugs | Server. What a site header imports; it does not load the plugin or React. |
|
|
@@ -384,7 +384,7 @@ edit availability. Then `payload generate:importmap` and `payload migrate:create
|
|
|
384
384
|
## Pages, users, and media
|
|
385
385
|
|
|
386
386
|
`createPages`, `createUsers`, `createMedia`, `slugField`,
|
|
387
|
-
`createRedirects`, `adminOnlyApiTab`, and `
|
|
387
|
+
`createRedirects`, `adminOnlyApiTab`, `documentTitleActions`, and `listAlign` ship from the same
|
|
388
388
|
React-free entry. Pages take the
|
|
389
389
|
site's hero and layout blocks, reserved-slug predicate, preview
|
|
390
390
|
path, and optional `folderRoots` (`patients`, `providers`, …). Parent
|
|
@@ -422,7 +422,16 @@ set `saveToJWT: true`. The checklist labels are the editable names.
|
|
|
422
422
|
primary actions on the title row — the same slot collection lists use
|
|
423
423
|
for Create New — and hides the dead Edit tab when it has no sibling.
|
|
424
424
|
One-list Globals pass `documentCreateNew("roles")` (or a site field
|
|
425
|
-
path) so Create New uses those same words, with no icon.
|
|
425
|
+
path) so Create New uses those same words, with no icon.
|
|
426
|
+
`listAlign()` keeps a list column's header and cells together: a field
|
|
427
|
+
declares `admin: { custom: { listAlign: "center" | "end" } }` and the
|
|
428
|
+
plugin writes one stylesheet (`listAlignCss`) from every collection's
|
|
429
|
+
fields, mounted as the `LIST_ALIGN` provider. Payload's header holds a
|
|
430
|
+
full-width flex `.sort-column`, so `text-align` alone never moves it;
|
|
431
|
+
centered, the label shrinks to its word and the sort arrows hang outside
|
|
432
|
+
it, and end-aligned, the arrows lead. Never write a per-column selector
|
|
433
|
+
in a site stylesheet. The kit `Table` takes the same idea as
|
|
434
|
+
`align={[…]}`, one entry per column track. Overlay
|
|
426
435
|
settings (Better Editor) take `developerOnlyAccess` and
|
|
427
436
|
`hideUnlessDeveloper` on the site — the package does not add that
|
|
428
437
|
plugin as a peer.
|
package/dist/admin.d.mts
CHANGED
|
@@ -208,6 +208,20 @@ declare function DocumentTitleActions({
|
|
|
208
208
|
children?: ReactNode;
|
|
209
209
|
}): react_jsx_runtime0.JSX.Element;
|
|
210
210
|
//#endregion
|
|
211
|
+
//#region src/admin/list-align-styles.d.ts
|
|
212
|
+
/**
|
|
213
|
+
* The stylesheet `listAlign()` built from each field's
|
|
214
|
+
* `admin.custom.listAlign`. Computed once at config time and handed in
|
|
215
|
+
* as `clientProps`, so the admin does no walking at render.
|
|
216
|
+
*/
|
|
217
|
+
declare function ListAlignStyles({
|
|
218
|
+
css,
|
|
219
|
+
children
|
|
220
|
+
}: {
|
|
221
|
+
css?: string;
|
|
222
|
+
children?: ReactNode;
|
|
223
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
224
|
+
//#endregion
|
|
211
225
|
//#region src/admin/document-create-new.d.ts
|
|
212
226
|
declare function DocumentCreateNew({
|
|
213
227
|
path
|
|
@@ -307,5 +321,5 @@ declare function MediaAltAutofill({
|
|
|
307
321
|
//#region src/admin/media-list-view.d.ts
|
|
308
322
|
declare function MediaListView(props: ListViewClientProps): react_jsx_runtime0.JSX.Element;
|
|
309
323
|
//#endregion
|
|
310
|
-
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
324
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
311
325
|
//# sourceMappingURL=admin.d.mts.map
|
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/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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,EAAqB,yBAAA;;;;;;;;;AxB3ClC;cyBuJa,iBAAA,EAAmB,yBAAA;;;iBC5HhB,oBAAA,CAAA;EAAuB;AAAA;EAAc,QAAA,GAAW,SAAA;AAAA,IAAW,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,0B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AAkB,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;;;;;;;;cCEvB,mBAAA,EAAqB,wBAAA;;;;;;;;AjCClC;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,10 +1,10 @@
|
|
|
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, 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, 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";
|
|
7
|
-
import { Badge, Button as Button$1, Checkbox, Chip, ConfirmDialog, DeleteGlyph, Dialog, EditGlyph, Field, Fold, Input, KitProvider, Label, LockGlyph, MainHead, Page, Pagination, Popover, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Stack, Switch, Table, TableActions, TableCell, TableHead, TableRow, Thumbnail } from "@bison-lab/admin-ui";
|
|
7
|
+
import { Badge, Button as Button$1, CancelGlyph, Checkbox, Chip, ConfirmDialog, DeleteGlyph, Dialog, EditGlyph, Field, Fold, Input, KitProvider, Label, LockGlyph, MainHead, Page, Pagination, Popover, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Stack, Switch, Table, TableActions, TableCell, TableHead, TableRow, Thumbnail } from "@bison-lab/admin-ui";
|
|
8
8
|
import { HexColorPicker } from "react-colorful";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
10
|
import { findFont, fontFaceCss, isFontId } from "@bison-lab/fonts";
|
|
@@ -4101,6 +4101,20 @@ function DocumentTitleActions({ children }) {
|
|
|
4101
4101
|
}), children] });
|
|
4102
4102
|
}
|
|
4103
4103
|
//#endregion
|
|
4104
|
+
//#region src/admin/list-align-styles.tsx
|
|
4105
|
+
/**
|
|
4106
|
+
* The stylesheet `listAlign()` built from each field's
|
|
4107
|
+
* `admin.custom.listAlign`. Computed once at config time and handed in
|
|
4108
|
+
* as `clientProps`, so the admin does no walking at render.
|
|
4109
|
+
*/
|
|
4110
|
+
function ListAlignStyles({ css, children }) {
|
|
4111
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [css ? /* @__PURE__ */ jsx("style", {
|
|
4112
|
+
href: "bl-list-align",
|
|
4113
|
+
precedence: "default",
|
|
4114
|
+
children: css
|
|
4115
|
+
}) : null, children] });
|
|
4116
|
+
}
|
|
4117
|
+
//#endregion
|
|
4104
4118
|
//#region src/admin/document-create-new.tsx
|
|
4105
4119
|
/**
|
|
4106
4120
|
* Same words as a collection list Create New — no icon, no "Area" or
|
|
@@ -4429,8 +4443,8 @@ const QUESTIONS_LIST_CSS = `
|
|
|
4429
4443
|
.bl-faq-library__search .bl-nav-kit__input{padding-left:34px}
|
|
4430
4444
|
.bl-faq-library__filter{width:auto;min-width:150px}
|
|
4431
4445
|
.bl-faq-library__table{box-shadow:0 1px 2px rgba(20,25,35,.04),0 8px 28px rgba(20,25,35,.05)}
|
|
4432
|
-
.bl-faq-library__table .bl-nav-kit__table-row{align-items:flex-start;padding:14px}
|
|
4433
|
-
.bl-faq-library__table .bl-nav-kit__table-head{align-items:center;padding:11px
|
|
4446
|
+
.bl-faq-library__table .bl-nav-kit__table-row{align-items:flex-start;padding-block:14px}
|
|
4447
|
+
.bl-faq-library__table .bl-nav-kit__table-head{align-items:center;padding-block:11px}
|
|
4434
4448
|
.bl-faq-library__question{font-weight:700;margin:0 0 4px}
|
|
4435
4449
|
.bl-faq-library__answer{margin:0;color:var(--bl-kit-ink-muted);max-width:640px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
4436
4450
|
.bl-faq-library__chips{display:flex;flex-wrap:wrap;gap:5px}
|
|
@@ -5515,7 +5529,6 @@ const LIST_CSS = `
|
|
|
5515
5529
|
.bl-media-list__sort-mark[data-dir="asc"] svg:first-child,.bl-media-list__sort-mark[data-dir="desc"] svg:last-child{opacity:1;color:var(--bl-kit-accent,#2563eb)}
|
|
5516
5530
|
.bl-media-list .bl-nav-kit__table-row:not(.bl-nav-kit__table-head):nth-child(even){--bl-table-row-bg:var(--bl-kit-surface-well);background-color:var(--bl-table-row-bg)}
|
|
5517
5531
|
.bl-media-list .bl-nav-kit__table-cell--shade.bl-nav-kit__table-cell--pin-start{min-width:0;overflow:hidden}
|
|
5518
|
-
.bl-media-list .bl-nav-kit__table-cell--pin-end{justify-content:center}
|
|
5519
5532
|
.bl-media-list .bl-nav-kit__table-cell--pin-end .bl-nav-kit__table-actions{justify-content:center;width:max-content}
|
|
5520
5533
|
.bl-media-list__empty{padding:48px 16px;text-align:center;color:var(--bl-kit-ink-muted)}
|
|
5521
5534
|
.bl-media-list__checks{display:flex;flex-direction:column;gap:2px}
|
|
@@ -5531,6 +5544,11 @@ const LIST_CSS = `
|
|
|
5531
5544
|
.bl-media-list__inuse{display:grid;place-items:center;color:var(--theme-success-500,#3cbf7a)}
|
|
5532
5545
|
.bl-media-list__inuse svg{display:block}
|
|
5533
5546
|
.bl-media-list .bl-nav-kit__chips{margin:0 0 18px}
|
|
5547
|
+
.bl-media-list--drawer{padding-top:calc(var(--base,20px) * 2.5)}
|
|
5548
|
+
.bl-media-list__pick{display:flex;align-items:center;gap:12px;width:100%;min-width:0;border:0;background:none;padding:0;color:inherit;font:inherit;text-align:left;cursor:pointer}
|
|
5549
|
+
.bl-media-list__pick:hover .bl-media-list__filename{color:var(--bl-kit-accent,#2563eb)}
|
|
5550
|
+
.bl-media-list__pick:focus-visible{outline:var(--bl-kit-focus);outline-offset:2px;border-radius:var(--bl-kit-radius-xs)}
|
|
5551
|
+
@media(max-width:1024px){.bl-media-list--drawer{padding-top:calc(var(--base,20px) * 1.5)}}
|
|
5534
5552
|
@media(max-width:700px){
|
|
5535
5553
|
.bl-media-list .bl-workspace__main-head{flex-direction:column}
|
|
5536
5554
|
.bl-media-list__toolbar{flex-wrap:wrap}
|
|
@@ -5540,9 +5558,13 @@ const LIST_CSS = `
|
|
|
5540
5558
|
function MediaListView(props) {
|
|
5541
5559
|
return /* @__PURE__ */ jsx(ThemeKitAccent, { children: /* @__PURE__ */ jsx(MediaListPage, { ...props }) });
|
|
5542
5560
|
}
|
|
5543
|
-
function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermission, newDocumentURL }) {
|
|
5561
|
+
function MediaListPage({ collectionSlug, enableRowSelections, hasCreatePermission, hasDeletePermission, newDocumentURL }) {
|
|
5544
5562
|
const { setStepNav } = useStepNav();
|
|
5545
|
-
const { openModal } = useModal();
|
|
5563
|
+
const { closeModal, openModal } = useModal();
|
|
5564
|
+
const { allowCreate, createNewDrawerSlug, drawerSlug: listDrawerSlug, isInDrawer, onBulkSelect, onSelect } = useListDrawerContext();
|
|
5565
|
+
const picking = Boolean(isInDrawer && listDrawerSlug);
|
|
5566
|
+
const bulkPicking = picking && Boolean(enableRowSelections) && typeof onBulkSelect === "function";
|
|
5567
|
+
const showChecks = !picking || bulkPicking;
|
|
5546
5568
|
const { drawerSlug, setCollectionSlug, setOnSuccess } = useBulkUpload();
|
|
5547
5569
|
const { config: { routes: { admin: adminRoute, api }, serverURL }, getEntityConfig } = useConfig();
|
|
5548
5570
|
const { data, query, handleSearchChange, handlePageChange, handlePerPageChange, handleSortChange, handleWhereChange, refineListData } = useListQuery();
|
|
@@ -5557,6 +5579,7 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5557
5579
|
const [advancedOpen, setAdvancedOpen] = useState(Boolean(draftFromWhere(query.where).advValue));
|
|
5558
5580
|
const [selected, setSelected] = useState(/* @__PURE__ */ new Set());
|
|
5559
5581
|
const [selectedLabels, setSelectedLabels] = useState(/* @__PURE__ */ new Map());
|
|
5582
|
+
const selectedIds = useRef(/* @__PURE__ */ new Map());
|
|
5560
5583
|
const [inUse, setInUse] = useState(/* @__PURE__ */ new Set());
|
|
5561
5584
|
const [inUseScanFailed, setInUseScanFailed] = useState(false);
|
|
5562
5585
|
const [confirm, setConfirm] = useState(null);
|
|
@@ -5570,8 +5593,8 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5570
5593
|
const searchQuery = typeof query.search === "string" ? query.search : "";
|
|
5571
5594
|
const pendingSearches = useRef(/* @__PURE__ */ new Set());
|
|
5572
5595
|
useEffect(() => {
|
|
5573
|
-
setStepNav([{ label: "Media" }]);
|
|
5574
|
-
}, [setStepNav]);
|
|
5596
|
+
if (!isInDrawer) setStepNav([{ label: "Media" }]);
|
|
5597
|
+
}, [isInDrawer, setStepNav]);
|
|
5575
5598
|
useEffect(() => {
|
|
5576
5599
|
const next = typeof query.search === "string" ? query.search : "";
|
|
5577
5600
|
if (pendingSearches.current.has(next)) {
|
|
@@ -5645,6 +5668,19 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5645
5668
|
setCollectionSlug,
|
|
5646
5669
|
setOnSuccess
|
|
5647
5670
|
]);
|
|
5671
|
+
const pick = (doc) => {
|
|
5672
|
+
onSelect?.({
|
|
5673
|
+
collectionSlug,
|
|
5674
|
+
doc,
|
|
5675
|
+
docID: String(doc.id)
|
|
5676
|
+
});
|
|
5677
|
+
};
|
|
5678
|
+
const pickSelected = () => {
|
|
5679
|
+
if (!onBulkSelect || selected.size === 0) return;
|
|
5680
|
+
const picked = /* @__PURE__ */ new Map();
|
|
5681
|
+
for (const id of selected) picked.set(selectedIds.current.get(id) ?? id, true);
|
|
5682
|
+
onBulkSelect(picked, collectionSlug);
|
|
5683
|
+
};
|
|
5648
5684
|
const editUrl = (id) => formatAdminURL({
|
|
5649
5685
|
adminRoute,
|
|
5650
5686
|
path: `/collections/${collectionSlug}/${id}`
|
|
@@ -5682,7 +5718,15 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5682
5718
|
};
|
|
5683
5719
|
const chips = useMemo(() => chipsFrom(applied), [applied]);
|
|
5684
5720
|
const shown = COLUMN_KEYS.filter((key) => visible[key]);
|
|
5685
|
-
const columns = gridColumns(shown
|
|
5721
|
+
const columns = gridColumns(shown, {
|
|
5722
|
+
checks: showChecks,
|
|
5723
|
+
actions: !picking
|
|
5724
|
+
});
|
|
5725
|
+
const align = [
|
|
5726
|
+
...showChecks ? [void 0] : [],
|
|
5727
|
+
...shown.map((key) => key === "inUse" ? "center" : void 0),
|
|
5728
|
+
...picking ? [] : ["center"]
|
|
5729
|
+
];
|
|
5686
5730
|
useLayoutEffect(() => {
|
|
5687
5731
|
const root = rootRef.current;
|
|
5688
5732
|
const table = root?.querySelector(".bl-nav-kit__table");
|
|
@@ -5719,8 +5763,10 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5719
5763
|
for (const doc of docs) {
|
|
5720
5764
|
const id = String(doc.id);
|
|
5721
5765
|
if (!pageIds.includes(id)) continue;
|
|
5722
|
-
if (on)
|
|
5723
|
-
|
|
5766
|
+
if (on) {
|
|
5767
|
+
next.set(id, doc.filename || id);
|
|
5768
|
+
selectedIds.current.set(id, doc.id);
|
|
5769
|
+
} else next.delete(id);
|
|
5724
5770
|
}
|
|
5725
5771
|
return next;
|
|
5726
5772
|
});
|
|
@@ -5770,7 +5816,7 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5770
5816
|
precedence: "default",
|
|
5771
5817
|
children: LIST_CSS
|
|
5772
5818
|
}), /* @__PURE__ */ jsx(Page, {
|
|
5773
|
-
className: "bl-media-list",
|
|
5819
|
+
className: ["bl-media-list", picking ? "bl-media-list--drawer" : void 0].filter(Boolean).join(" "),
|
|
5774
5820
|
children: /* @__PURE__ */ jsxs("div", {
|
|
5775
5821
|
ref: rootRef,
|
|
5776
5822
|
children: [
|
|
@@ -5783,7 +5829,29 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
5783
5829
|
totalDocs === 1 ? "file" : "files"
|
|
5784
5830
|
]
|
|
5785
5831
|
})] }),
|
|
5786
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
5832
|
+
children: picking ? /* @__PURE__ */ jsxs("div", {
|
|
5833
|
+
className: "bl-media-list__actions",
|
|
5834
|
+
children: [
|
|
5835
|
+
hasCreatePermission && allowCreate !== false && createNewDrawerSlug ? /* @__PURE__ */ jsx(Button$1, {
|
|
5836
|
+
variant: "primary",
|
|
5837
|
+
onClick: () => openModal(createNewDrawerSlug),
|
|
5838
|
+
children: "Create New"
|
|
5839
|
+
}) : null,
|
|
5840
|
+
bulkPicking ? /* @__PURE__ */ jsx(Button$1, {
|
|
5841
|
+
variant: "outline",
|
|
5842
|
+
disabled: selected.size === 0,
|
|
5843
|
+
onClick: pickSelected,
|
|
5844
|
+
children: selected.size > 0 ? `Select ${selected.size}` : "Select"
|
|
5845
|
+
}) : null,
|
|
5846
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
5847
|
+
size: "icon",
|
|
5848
|
+
variant: "ghost",
|
|
5849
|
+
"aria-label": "Close",
|
|
5850
|
+
onClick: () => listDrawerSlug && closeModal(listDrawerSlug),
|
|
5851
|
+
children: /* @__PURE__ */ jsx(CancelGlyph, {})
|
|
5852
|
+
})
|
|
5853
|
+
]
|
|
5854
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
5787
5855
|
className: "bl-media-list__actions",
|
|
5788
5856
|
children: [
|
|
5789
5857
|
/* @__PURE__ */ jsx(Button$1, {
|
|
@@ -6030,19 +6098,20 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
6030
6098
|
}) : null,
|
|
6031
6099
|
/* @__PURE__ */ jsxs(Table, {
|
|
6032
6100
|
columns,
|
|
6101
|
+
align,
|
|
6033
6102
|
children: [/* @__PURE__ */ jsxs(TableHead, { children: [
|
|
6034
|
-
/* @__PURE__ */ jsx(TableCell, {
|
|
6103
|
+
showChecks ? /* @__PURE__ */ jsx(TableCell, {
|
|
6035
6104
|
pin: "start",
|
|
6036
6105
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
6037
6106
|
checked: allPageSelected,
|
|
6038
6107
|
onCheckedChange: (value) => toggleAll(value === true),
|
|
6039
6108
|
"aria-label": "Select all on this page"
|
|
6040
6109
|
})
|
|
6041
|
-
}),
|
|
6110
|
+
}) : null,
|
|
6042
6111
|
shown.map((key) => /* @__PURE__ */ jsx(TableCell, {
|
|
6043
6112
|
pin: key === "filename" ? "start" : void 0,
|
|
6044
6113
|
shade: key === "filename",
|
|
6045
|
-
style: key === "filename" ? FILE_PIN_LEFT : void 0,
|
|
6114
|
+
style: key === "filename" && showChecks ? FILE_PIN_LEFT : void 0,
|
|
6046
6115
|
children: sortable(key) ? /* @__PURE__ */ jsxs("button", {
|
|
6047
6116
|
type: "button",
|
|
6048
6117
|
className: "bl-media-list__sort",
|
|
@@ -6050,7 +6119,7 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
6050
6119
|
children: [columnLabel(key), /* @__PURE__ */ jsx(SortChevrons, { dir: sortDir(sort, key) })]
|
|
6051
6120
|
}) : columnLabel(key)
|
|
6052
6121
|
}, key)),
|
|
6053
|
-
/* @__PURE__ */ jsx(TableCell, {
|
|
6122
|
+
picking ? null : /* @__PURE__ */ jsx(TableCell, {
|
|
6054
6123
|
pin: "end",
|
|
6055
6124
|
shade: true,
|
|
6056
6125
|
children: "Actions"
|
|
@@ -6059,7 +6128,7 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
6059
6128
|
const id = String(doc.id);
|
|
6060
6129
|
const name = doc.filename || id;
|
|
6061
6130
|
return /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
6062
|
-
/* @__PURE__ */ jsx(TableCell, {
|
|
6131
|
+
showChecks ? /* @__PURE__ */ jsx(TableCell, {
|
|
6063
6132
|
pin: "start",
|
|
6064
6133
|
children: /* @__PURE__ */ jsx(Checkbox, {
|
|
6065
6134
|
checked: selected.has(id),
|
|
@@ -6076,15 +6145,28 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
6076
6145
|
else next.delete(id);
|
|
6077
6146
|
return next;
|
|
6078
6147
|
});
|
|
6148
|
+
if (value === true) selectedIds.current.set(id, doc.id);
|
|
6079
6149
|
},
|
|
6080
6150
|
"aria-label": `Select ${name}`
|
|
6081
6151
|
})
|
|
6082
|
-
}),
|
|
6152
|
+
}) : null,
|
|
6083
6153
|
shown.map((key) => /* @__PURE__ */ jsx(TableCell, {
|
|
6084
6154
|
pin: key === "filename" ? "start" : void 0,
|
|
6085
6155
|
shade: key === "filename",
|
|
6086
|
-
style: key === "filename" ? FILE_PIN_LEFT : void 0,
|
|
6087
|
-
children: key === "filename" ? /* @__PURE__ */ jsxs("
|
|
6156
|
+
style: key === "filename" && showChecks ? FILE_PIN_LEFT : void 0,
|
|
6157
|
+
children: key === "filename" ? picking ? /* @__PURE__ */ jsxs("button", {
|
|
6158
|
+
type: "button",
|
|
6159
|
+
className: "bl-media-list__pick",
|
|
6160
|
+
onClick: () => pick(doc),
|
|
6161
|
+
children: [/* @__PURE__ */ jsx(Thumbnail, {
|
|
6162
|
+
size: "sm",
|
|
6163
|
+
src: doc.thumbnailURL || doc.url,
|
|
6164
|
+
alt: ""
|
|
6165
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
6166
|
+
className: "bl-media-list__filename",
|
|
6167
|
+
children: name
|
|
6168
|
+
})]
|
|
6169
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
6088
6170
|
className: "bl-media-list__file",
|
|
6089
6171
|
children: [/* @__PURE__ */ jsx(Thumbnail, {
|
|
6090
6172
|
size: "sm",
|
|
@@ -6107,7 +6189,7 @@ function MediaListPage({ collectionSlug, hasCreatePermission, hasDeletePermissio
|
|
|
6107
6189
|
children: formatWhen(doc.createdAt)
|
|
6108
6190
|
}) : key === "filesize" ? doc.filesize != null ? formatFilesize(doc.filesize) : "—" : doc.width && doc.height ? `${doc.width} × ${doc.height}` : "—"
|
|
6109
6191
|
}, key)),
|
|
6110
|
-
/* @__PURE__ */ jsx(TableCell, {
|
|
6192
|
+
picking ? null : /* @__PURE__ */ jsx(TableCell, {
|
|
6111
6193
|
pin: "end",
|
|
6112
6194
|
shade: true,
|
|
6113
6195
|
children: /* @__PURE__ */ jsxs(TableActions, { children: [/* @__PURE__ */ jsx(Button$1, {
|
|
@@ -6190,11 +6272,11 @@ function pinTrackWidth(cell, innerSelector) {
|
|
|
6190
6272
|
const pad = (Number.parseFloat(styles.paddingLeft) || 0) + (Number.parseFloat(styles.paddingRight) || 0);
|
|
6191
6273
|
return (inner ? inner.scrollWidth : Math.max(0, cell.scrollWidth - pad)) + pad;
|
|
6192
6274
|
}
|
|
6193
|
-
function gridColumns(shown) {
|
|
6275
|
+
function gridColumns(shown, { checks = true, actions = true } = {}) {
|
|
6194
6276
|
return [
|
|
6195
|
-
CHECK_COL,
|
|
6277
|
+
...checks ? [CHECK_COL] : [],
|
|
6196
6278
|
...shown.map((key) => key === "filename" ? FILE_COL : key === "inUse" ? "72px" : key === "updatedAt" || key === "createdAt" ? "148px" : "minmax(120px,1fr)"),
|
|
6197
|
-
ACTIONS_COL
|
|
6279
|
+
...actions ? [ACTIONS_COL] : []
|
|
6198
6280
|
].join(" ");
|
|
6199
6281
|
}
|
|
6200
6282
|
function chipsFrom(applied) {
|
|
@@ -6341,6 +6423,6 @@ function ChevronMark() {
|
|
|
6341
6423
|
});
|
|
6342
6424
|
}
|
|
6343
6425
|
//#endregion
|
|
6344
|
-
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
6426
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RoleNameField, RoleSlugField, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, setThemePreviewMode };
|
|
6345
6427
|
|
|
6346
6428
|
//# sourceMappingURL=admin.mjs.map
|