[#6] Added file and directory picker widgets with single and multiple selection.#31
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (27)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 99.32% 99.39% +0.07%
==========================================
Files 67 68 +1
Lines 1769 1977 +208
==========================================
+ Hits 1757 1965 +208
Misses 12 12 ☔ View full report in Codecov by Harness. |
Closes #6
Summary
Adds a filesystem-browsing widget:
FilePickercollects a single path andMultiFilePickercollects a list of paths, both built on oneFilePickerWidgetthat navigates directories, type-filters entries, and supports files-only/directories-only/any selection via a newFilePickerModeenum, with an extension allow-list, a hidden-entries toggle, and self-scrolling for large directories.The widget resolves its keys through the repository's
ScopedKeyMap/Actionsystem rather than hardcoding them, so it honours the vim preset and any custom bindings, and its hint line is built from the live bindings instead of a fixed string.Both field types are wired through the builder, factory, headless input resolution, and JSON schema validation, and documented in the README with generated SVGs for all four display modes.
Changes
Widget
FilePickerWidget(src/Widget/FilePickerWidget.php): directory navigation (→enters the highlighted directory,←returns to its parent, bounded at the start directory), type-to-filter, files-only/directories-only/any selection viaFilePickerMode, a case-insensitive extension allow-list, a hidden-entries (dot-file) toggle, self-scrolling for large directories viaScroller, and multi-select accumulation across directories in multiple mode.FilePickerModeenum (src/Config/FilePickerMode.php) withAny,File, andDirectorycases; a directory always stays navigable so files beneath it remain reachable even in files-only mode.Key-map integration
DefaultKeyMapgains bindings for both picker scopes:Tabmaps toAction::Reveal(toggles hidden entries) on bothFilePickerandMultiFilePicker, andSpacemaps toAction::Toggleon the multiple picker.Scope::TEXT_ENTRYgainsFieldType::FilePickerandFieldType::MultiFilePicker, so typed printable characters filter the listing rather than being claimed by a binding.Scope::field()and looks up actions through the activeScopedKeyMap, and itshint()method renders the hint line from those same live bindings, so both behavior and on-screen hints follow whichever key map (default or vim preset) is active.Config, builder and factory wiring
FieldgainspickerMode,pickerStart,pickerExtensions, andpickerShowHiddenproperties.FieldBuildergainsstart(),filesOnly(),directoriesOnly(),extensions(), andshowHidden().PanelBuildergainsfilePicker()andmultiFilePicker().FieldTypegainsFilePickerandMultiFilePickercases.WidgetFactoryinstantiatesFilePickerWidgetfor both field types, passingmultiple: TRUEfor the list variant.InputResolver::coerce()andSchemaValidator(isType()/typeName()) treatMultiFilePickeras a list type alongsideMultiSelectandMultiSearch, so headless JSON/env collection and the generated JSON schema both handle the new field types.Docs and playground
FilePickerandMultiFilePickersubsections with usage snippets and four-display-mode SVG tables.playground/3-widgets/widget-filepicker.phpandwidget-multifilepicker.php, browsing a new fixture tree atplayground/3-widgets/filepicker-tree/.docs/util/update-assets.phpregisters the picker demos, with their own row counts and scripted interactions, so their SVGs regenerate alongside the rest of the widget gallery.Tests
tests/phpunit/Unit/Widget/FilePickerWidgetTest.php(vfsStream-backed) covering navigation, type-to-filter, selection modes, extension filtering, hidden entries, scrolling, and multi-select accumulation.FormTest,WidgetFactoryTest,InputResolverTest,SchemaValidatorTest, andKeyMapTestcovering the two new field types end to end, including their key bindings and text-entry scope classification.Before / After