Feature/location filter helper - #117
Open
delcroip wants to merge 7 commits into
Open
Conversation
- Replace direct prop references with shallow copies (`[...props.lXs]`) to avoid unintended state mutations across location levels (l0s–l3s) - Add null/undefined fallback (`? [...prop] : []`) when spreading location arrays into state to prevent runtime errors - Refactor list updates to use immutable `map` instead of mutating array elements directly via `delete` on filtered results - Guard against missing `state.action` or `state.location` before processing post-mutation state updates - Use spread to copy mutation object before journalizing - Add missing `location.addLocation` translation key to `en.json`
…tocomplete Refactor `HealthFacilityLegalFormPicker` and `HealthFacilitySubLevelPicker` from class-based components using static `ConstantBasedPicker` to functional components that fetch data dynamically via `useGraphqlQuery`. Both pickers now use the `Autocomplete` component and support `withNull`, `withLabel`, `withPlaceholder`, `readOnly`, and `required` props, providing a more flexible and data-driven approach instead of relying on hardcoded constants.
Replace `null` with `""` for Select component state values in `DeleteLocationDialog` and `MoveLocationDialog` to prevent React MUI controlled/uncontrolled component warnings. Additionally, auto-select the first available reassign location when switching to the reassign action in `DeleteLocationDialog`, and add value resolution logic in `MoveLocationDialog` to ensure object-based values are matched correctly against their list.
…onCascader - Import `getLocationLevel` utility to validate selection depth - Add `required` and `requiredLevel` props to enforce minimum location depth - Show error state and message when selection doesn't meet required level - Fix CSS specificity by adding `&` prefix to nested selectors - Add full-width styles to cascader root, `.rc-cascader`, and `.MuiFormControl-root` - Prevent clearing invalid selection state when user picks a partial path
… placement - Introduce `LocationCascaderMobile` component for small screens, rendered conditionally via `useMediaQuery` on the `sm` breakpoint - Add `CASCADER_BUILT_IN_PLACEMENTS` config to control dropdown overflow and alignment (adjustX/Y, shiftX/Y, htmlRegion scroll) - Implement `updatePlacement` to dynamically switch between `bottomLeft` and `bottomRight` based on available viewport space - Compute adaptive `columnWidth` relative to viewport width on open - Simplify `extractPathFromValue` to return only `uuids`, removing unused `names` array - Extract `isLevelValid`, `getLevelErrorMessage`, and `handleLevelErrorChange` as named helpers for improved readability
- Replace viewport-width-only mobile detection with a combined check
using both narrow viewport (`breakpoints.down("sm")`) and coarse
pointer media query, ensuring touch devices are correctly identified
regardless of screen size
- Remove manual placement calculation logic (`updatePlacement`,
`handleOpenChange`, `CASCADER_BUILT_IN_PLACEMENTS`, `columnWidth`
state) in favor of simpler built-in dropdown behavior
- Replace `dvh` units with `vh` fallback in `StyledDrawerPaper` and
use `@supports` progressive enhancement for dynamic viewport height,
improving compatibility with older browsers
- Add `handleActivate` in `LocationCascaderMobile` to prevent default
event behavior and guard against `readOnly` state on activation
- Add `noSsr: true` to `useMediaQuery` calls to avoid SSR mismatch
…ilters Introduce a new function that traverses a location's parent chain to generate filters for each level, enabling location-based filtering with configurable depth and anchor endpoint.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


#Thank you for your contribution to openIMIS!
#Please complete the sections below. Anything in comments is guidance and can be deleted.
Description
filter currently in insuree, would be better here
Type of Change
Related Issue(s) / Task(s)
Demo
Upload screenshots/gifs or link to any demo video here.
Checklist