-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github-chisom:dhis2/maintenance-app-beta int…
…o DHIS2-18143/category-option-group-set
- Loading branch information
Showing
16 changed files
with
145 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
35 changes: 35 additions & 0 deletions
35
src/components/sectionList/filters/filterSelectors/BooleanFilters.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import { CheckboxField } from '@dhis2/ui' | ||
import React from 'react' | ||
import { | ||
BooleanFilterKey, | ||
getTranslatedProperty, | ||
useSectionListFilter, | ||
} from '../../../../lib' | ||
|
||
type BooleanFilterProps = { | ||
label: string | ||
filterKey: BooleanFilterKey | ||
} | ||
|
||
export const BooleanFilter = ({ filterKey, label }: BooleanFilterProps) => { | ||
const [filter, setFilter] = useSectionListFilter(filterKey) | ||
|
||
return ( | ||
<CheckboxField | ||
checked={filter} | ||
name={filterKey} | ||
label={label} | ||
onChange={(payload) => setFilter(payload.checked)} | ||
/> | ||
) | ||
} | ||
|
||
export const IgnoreApprovalFilter = () => { | ||
return ( | ||
<BooleanFilter | ||
filterKey="ignoreApproval" | ||
label={getTranslatedProperty('ignoreApproval')} | ||
/> | ||
) | ||
} |
24 changes: 24 additions & 0 deletions
24
src/components/sectionList/filters/filterSelectors/CategoryOptionFilter.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import React from 'react' | ||
import { useSectionListFilter } from '../../../../lib' | ||
import { createFilterDataQuery } from './createFilterDataQuery' | ||
import { ModelFilterSelect } from './ModelFilter' | ||
|
||
const query = createFilterDataQuery('categoryOptions') | ||
|
||
export const CategoryOptionFilter = () => { | ||
const [filter, setFilter] = useSectionListFilter('categoryOption') | ||
|
||
const selected = filter?.[0] | ||
|
||
return ( | ||
<ModelFilterSelect | ||
placeholder={i18n.t('Category option')} | ||
query={query} | ||
selected={selected} | ||
onChange={({ selected }) => | ||
setFilter(selected ? [selected] : undefined) | ||
} | ||
/> | ||
) | ||
} |
4 changes: 2 additions & 2 deletions
4
src/components/sectionList/filters/filterSelectors/ConstantSelectionFilter.tsx
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export type * from './generated/utility' | ||
|
||
export type KeysOfValue<T, TCondition> = keyof { | ||
[K in keyof T as T[K] extends TCondition ? K : never]: K | ||
} |