(props: Props)
| 35 | } |
| 36 | |
| 37 | export function DataBrowser(props: Props) { |
| 38 | function activateRecord(newIndex: number) { |
| 39 | props.onActivate(props.data[newIndex], newIndex); |
| 40 | } |
| 41 | const { index } = props; |
| 42 | const length = props.data && props.data.length || 0; |
| 43 | |
| 44 | const dropdownRef = base.react.createRef<FluentUITypes.IDropdown>(); |
| 45 | props.explorer.dialogFocusHandler.focus = ()=> dropdownRef.current?.focus(); |
| 46 | |
| 47 | return ( |
| 48 | <Group label={strings.labelDataBrowser} className="sanddance-dataIndex"> |
| 49 | <Dropdown |
| 50 | componentRef={dropdownRef} |
| 51 | label={strings.labelDataScope} |
| 52 | collapseLabel={true} |
| 53 | options={[ |
| 54 | { |
| 55 | key: DataScopeId.AllData, |
| 56 | text: strings.selectDataSpanAll, |
| 57 | isSelected: props.selectedDataScope === DataScopeId.AllData, |
| 58 | }, |
| 59 | { |
| 60 | key: DataScopeId.FilteredData, |
| 61 | text: strings.selectDataSpanFilter, |
| 62 | isSelected: props.selectedDataScope === DataScopeId.FilteredData, |
| 63 | }, |
| 64 | { |
| 65 | key: DataScopeId.SelectedData, |
| 66 | text: strings.selectDataSpanSelection, |
| 67 | isSelected: props.selectedDataScope === DataScopeId.SelectedData, |
| 68 | }, |
| 69 | ]} |
| 70 | onChange={(e, o) => { |
| 71 | props.onDataScopeClick(o.key as DataScopeId); |
| 72 | }} |
| 73 | /> |
| 74 | {!props.data && <div dangerouslySetInnerHTML={{ __html: props.nullMessage }}></div>} |
| 75 | {props.data && !props.data.length && <div>{props.zeroMessage}</div>} |
| 76 | {!!length && <div> |
| 77 | <div className="index"> |
| 78 | <IconButton |
| 79 | themePalette={props.themePalette} |
| 80 | iconName="ChevronLeftMed" |
| 81 | onClick={e => activateRecord(index <= 0 ? length - 1 : index - 1)} |
| 82 | disabled={props.disabled || length === 1} |
| 83 | title={strings.buttonPrevDataItem} |
| 84 | /> |
| 85 | <span>{strings.record(index + 1, length)}</span> |
| 86 | <IconButton |
| 87 | themePalette={props.themePalette} |
| 88 | iconName="ChevronRightMed" |
| 89 | onClick={e => activateRecord(index >= length - 1 ? 0 : index + 1)} |
| 90 | disabled={props.disabled || length === 1} |
| 91 | title={strings.buttonNextDataItem} |
| 92 | /> |
| 93 | </div> |
| 94 | {!props.itemVisible && <div className="item-filtered">{strings.labelDataItemIsFiltered}</div>} |
nothing calls this directly
no test coverage detected