page-picker-modal.element.ts
Sidebar modal that displays a grid of PDF page thumbnails for selecting which pages to include in extraction.
What it does
Section titled “What it does”Renders all pages of a PDF as thumbnail images in a 4-column grid, with Umbraco-native selectable checkboxes. Users can select/deselect individual pages or use Select All/Deselect All. Returns the selected page numbers on confirm.
How it works
Section titled “How it works”- On
firstUpdated, fetches an auth token for PDF thumbnail rendering - Initialises selection: if
selectedPagesdata is provided, uses that; otherwise selects all pages - Renders a
uui-card-mediafor each page withselectable select-onlyattributes (checkbox in top-left corner, matching Umbraco media library pattern) - Each card contains an
up-doc-pdf-thumbnailcomponent that renders the actual PDF page via PDF.js - On confirm: if all pages selected, returns
null(meaning “all”); otherwise returns the sorted array of selected page numbers
UI layout
Section titled “UI layout”- Header toolbar: Selection count (“X of Y pages selected”) + Select All/Deselect All toggle button
- Page grid: 4-column CSS Grid of
uui-card-mediacards, each 200px thumbnail width - Actions: Cancel + Confirm button (disabled when no pages selected)
Key patterns
Section titled “Key patterns”- Uses
@selectedand@deselectedas separate event handlers onuui-card-media(not a single toggle event) - Selection tracked as
Set<number>with immutable updates (new Set on each change) for Lit reactivity - Confirm button label changes dynamically: “Include all pages” vs “Include X page(s)“
Custom element
Section titled “Custom element”<up-doc-page-picker-modal>
Registered in
Section titled “Registered in”manifest.ts— aliasUpDoc.PagePickerModal
Used by
Section titled “Used by”- Opened via
UMB_PAGE_PICKER_MODALtoken from:create-workflow-sidebar.element.ts(workflow creation flow)up-doc-workflow-source-view.element.ts(Source workspace tab)