[SSE mobile] Fix Bug 59964
This commit is contained in:
		
							parent
							
								
									e749085682
								
							
						
					
					
						commit
						1be5ed94e7
					
				| 
						 | 
				
			
			@ -2,10 +2,13 @@ import React, {useEffect, useState} from 'react';
 | 
			
		|||
import {f7, List, Popover, Sheet, ListItem, Icon, Row, Button, ListButton, Page, Navbar, Segmented, BlockTitle, NavRight, Link, Toggle,View} from 'framework7-react';
 | 
			
		||||
import { useTranslation } from 'react-i18next';
 | 
			
		||||
import { Device } from '../../../../common/mobile/utils/device';
 | 
			
		||||
import {observer, inject} from "mobx-react";
 | 
			
		||||
 | 
			
		||||
const FilterOptions = (props) => {
 | 
			
		||||
const FilterOptions = inject('storeAppOptions')(observer(props => {
 | 
			
		||||
    const { t } = useTranslation();
 | 
			
		||||
    const _t = t('View.Edit', {returnObjects: true});
 | 
			
		||||
    const storeAppOptions = props.storeAppOptions;
 | 
			
		||||
    const canModifyFilter = storeAppOptions.canModifyFilter;
 | 
			
		||||
    let is_all_checked = props.listVal.every(item => item.check);
 | 
			
		||||
 | 
			
		||||
    const HandleClearFilter = () => {
 | 
			
		||||
| 
						 | 
				
			
			@ -27,57 +30,71 @@ const FilterOptions = (props) => {
 | 
			
		|||
            }).open();
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
        <View style={props.style}>
 | 
			
		||||
            <Page>
 | 
			
		||||
            <Navbar title={_t.textFilterOptions}>
 | 
			
		||||
            {Device.phone &&
 | 
			
		||||
                <NavRight>
 | 
			
		||||
                    <Link sheetClose=".picker__sheet">
 | 
			
		||||
                        <Icon icon='icon-expand-down'/>
 | 
			
		||||
                    </Link>
 | 
			
		||||
                </NavRight>
 | 
			
		||||
            }
 | 
			
		||||
           </Navbar>
 | 
			
		||||
 | 
			
		||||
           <List>
 | 
			
		||||
                <ListItem className='buttons'>
 | 
			
		||||
                    <Row>
 | 
			
		||||
                        <a className={'button' + (props.checkSort === 'down' ? ' active' : '')} onClick={() => {props.onSort('sortdown'); onValidChecked();}}>
 | 
			
		||||
                            <Icon slot="media" icon="sortdown"/>
 | 
			
		||||
                        </a>
 | 
			
		||||
                        <a className={'button' + (props.checkSort === 'up' ? ' active' : '')} onClick={() => {props.onSort('sortup'); onValidChecked();}}>
 | 
			
		||||
                            <Icon slot="media" icon="sortup"/>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </Row>
 | 
			
		||||
                </ListItem>
 | 
			
		||||
           </List>
 | 
			
		||||
 | 
			
		||||
           <List >
 | 
			
		||||
               <ListButton className={props.isValid || is_all_checked ? 'disabled' : ''} onClick={HandleClearFilter}>{_t.textClearFilter}</ListButton>
 | 
			
		||||
               <ListButton color="red" onClick={() => props.onDeleteFilter()} id="btn-delete-filter">{_t.textDeleteFilter}</ListButton>
 | 
			
		||||
           </List>
 | 
			
		||||
           <List>
 | 
			
		||||
               <ListItem className='radio-checkbox-item' onChange={e => {props.onUpdateCell('all', e.target.checked); onValidChecked();}} name='filter-cellAll' checkbox checked={is_all_checked}>{_t.textSelectAll}</ListItem>
 | 
			
		||||
               {props.listVal.map((value) =>
 | 
			
		||||
                   <ListItem className='radio-checkbox-item' onChange={e => {props.onUpdateCell(value.id, e.target.checked); onValidChecked();}}  key={value.value} name='filter-cell' value={value.value} title={value.cellvalue} checkbox checked={value.check} />
 | 
			
		||||
               )}
 | 
			
		||||
           </List>
 | 
			
		||||
                <Navbar title={_t.textFilterOptions}>
 | 
			
		||||
                    {Device.phone &&
 | 
			
		||||
                        <NavRight>
 | 
			
		||||
                            <Link sheetClose=".picker__sheet">
 | 
			
		||||
                                <Icon icon='icon-expand-down'/>
 | 
			
		||||
                            </Link>
 | 
			
		||||
                        </NavRight>
 | 
			
		||||
                    }
 | 
			
		||||
                </Navbar>
 | 
			
		||||
                <List>
 | 
			
		||||
                    <ListItem className='buttons'>
 | 
			
		||||
                        <Row>
 | 
			
		||||
                            <a className={'button' + (props.checkSort === 'down' ? ' active' : '')} onClick={() => {
 | 
			
		||||
                                props.onSort('sortdown');
 | 
			
		||||
                                onValidChecked();
 | 
			
		||||
                            }}>
 | 
			
		||||
                                <Icon slot="media" icon="sortdown"/>
 | 
			
		||||
                            </a>
 | 
			
		||||
                            <a className={'button' + (props.checkSort === 'up' ? ' active' : '')} onClick={() => {
 | 
			
		||||
                                props.onSort('sortup');
 | 
			
		||||
                                onValidChecked();
 | 
			
		||||
                            }}>
 | 
			
		||||
                                <Icon slot="media" icon="sortup"/>
 | 
			
		||||
                            </a>
 | 
			
		||||
                        </Row>
 | 
			
		||||
                    </ListItem>
 | 
			
		||||
                </List>
 | 
			
		||||
                <List>
 | 
			
		||||
                    <ListButton className={props.isValid || is_all_checked ? 'disabled' : ''}
 | 
			
		||||
                                onClick={HandleClearFilter}>{_t.textClearFilter}</ListButton>
 | 
			
		||||
                    <ListButton color="red" className={!canModifyFilter ? 'disabled' : ''}
 | 
			
		||||
                                onClick={() => props.onDeleteFilter()}
 | 
			
		||||
                                id="btn-delete-filter">{_t.textDeleteFilter}</ListButton>
 | 
			
		||||
                </List>
 | 
			
		||||
                <List>
 | 
			
		||||
                    <ListItem className='radio-checkbox-item' onChange={e => {
 | 
			
		||||
                        props.onUpdateCell('all', e.target.checked);
 | 
			
		||||
                        onValidChecked();
 | 
			
		||||
                    }} name='filter-cellAll' checkbox checked={is_all_checked}>{_t.textSelectAll}</ListItem>
 | 
			
		||||
                    {props.listVal.map((value) =>
 | 
			
		||||
                        <ListItem className='radio-checkbox-item' onChange={e => {
 | 
			
		||||
                            props.onUpdateCell(value.id, e.target.checked);
 | 
			
		||||
                            onValidChecked();
 | 
			
		||||
                        }} key={value.value} name='filter-cell' value={value.value} title={value.cellvalue} checkbox
 | 
			
		||||
                                  checked={value.check}/>
 | 
			
		||||
                    )}
 | 
			
		||||
                </List>
 | 
			
		||||
            </Page>
 | 
			
		||||
        </View>
 | 
			
		||||
    )
 | 
			
		||||
};
 | 
			
		||||
}));
 | 
			
		||||
 | 
			
		||||
const FilterView = (props) => {
 | 
			
		||||
    return (
 | 
			
		||||
        !Device.phone ?
 | 
			
		||||
        <Popover id="picker-popover" className="popover__titled popover-filter">
 | 
			
		||||
            <FilterOptions style={{height: '410px'}} {...props}></FilterOptions>
 | 
			
		||||
        </Popover> :
 | 
			
		||||
        <Sheet className="picker__sheet sheet-filter" push>
 | 
			
		||||
            <FilterOptions  {...props}></FilterOptions>
 | 
			
		||||
        </Sheet>
 | 
			
		||||
            <Popover id="picker-popover" className="popover__titled popover-filter">
 | 
			
		||||
                <FilterOptions style={{height: '410px'}} {...props}></FilterOptions>
 | 
			
		||||
            </Popover> :
 | 
			
		||||
            <Sheet className="picker__sheet sheet-filter" push>
 | 
			
		||||
                <FilterOptions  {...props}></FilterOptions>
 | 
			
		||||
            </Sheet>
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,10 +3,12 @@ import { inject, observer } from 'mobx-react';
 | 
			
		|||
import {List, ListItem, Icon} from 'framework7-react';
 | 
			
		||||
import { useTranslation } from 'react-i18next';
 | 
			
		||||
 | 
			
		||||
const AddOther = inject("storeFocusObjects")(observer(props => {
 | 
			
		||||
const AddOther = inject("storeFocusObjects", "storeAppOptions")(observer(props => {
 | 
			
		||||
    const { t } = useTranslation();
 | 
			
		||||
    const _t = t('View.Add', {returnObjects: true});
 | 
			
		||||
    const storeFocusObjects = props.storeFocusObjects;
 | 
			
		||||
    const storeAppOptions = props.storeAppOptions;
 | 
			
		||||
    const canModifyFilter = storeAppOptions.canModifyFilter;
 | 
			
		||||
    const isHyperLink = storeFocusObjects.selections.indexOf('hyperlink') > -1;
 | 
			
		||||
    const hideAddComment = props.hideAddComment();
 | 
			
		||||
    const wsProps = props.wsProps;
 | 
			
		||||
| 
						 | 
				
			
			@ -22,7 +24,7 @@ const AddOther = inject("storeFocusObjects")(observer(props => {
 | 
			
		|||
            }}>
 | 
			
		||||
                <Icon slot="media" icon="icon-insert-comment"></Icon>
 | 
			
		||||
            </ListItem>}
 | 
			
		||||
            <ListItem title={_t.textSortAndFilter} className={wsProps.Sort && 'disabled'} link={'/add-sort-and-filter/'}>
 | 
			
		||||
            <ListItem title={_t.textSortAndFilter} className={wsProps.Sort || !canModifyFilter ? 'disabled' : ''} link={'/add-sort-and-filter/'}>
 | 
			
		||||
                <Icon slot="media" icon="icon-sort"></Icon>
 | 
			
		||||
            </ListItem>
 | 
			
		||||
            <ListItem title={_t.textLink} className={wsProps.InsertHyperlinks && 'disabled'} link={isHyperLink ? '/edit-link/' : '/add-link/'} routeProps={{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue