-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Boolean felttyper vises feil og filtreres ikke korrekt #1579
- Loading branch information
Showing
6 changed files
with
30 additions
and
6 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
6 changes: 4 additions & 2 deletions
6
SharePointFramework/shared-library/src/components/FilterPanel/FilterItem/FilterItem.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
2 changes: 2 additions & 0 deletions
2
SharePointFramework/shared-library/src/components/FilterPanel/FilterItem/types.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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import { IColumn } from '@fluentui/react' | ||
import { CheckboxProps } from '@fluentui/react-components' | ||
|
||
export interface IFilterItemProps extends Pick<CheckboxProps, 'onChange'> { | ||
name: string | ||
value: string | ||
selected?: boolean | ||
column?: IColumn | ||
} |
16 changes: 16 additions & 0 deletions
16
SharePointFramework/shared-library/src/components/FilterPanel/FilterItem/useFilterItem.ts
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,16 @@ | ||
import strings from 'SharedLibraryStrings' | ||
import _ from 'lodash' | ||
import { IFilterItemProps } from './types' | ||
|
||
export function useFilterItem(props: IFilterItemProps) { | ||
switch (props.column.data.renderAs) { | ||
case 'boolean': { | ||
const valueIfTrue = _.get(props, 'column.data.dataTypeProperties.valueIfTrue', strings.BooleanYes) | ||
const valueIfFalse = _.get(props, 'column.data.dataTypeProperties.valueIfFalse', strings.BooleanNo) | ||
return { label: parseInt(props.value) === 1 ? valueIfTrue : valueIfFalse } | ||
} | ||
default: { | ||
return { label: props.name } | ||
} | ||
} | ||
} |
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