[SSE mobile] Correct protection sheet v.2
This commit is contained in:
		
							parent
							
								
									d1072fd3f9
								
							
						
					
					
						commit
						1508b2ee64
					
				| 
						 | 
				
			
			@ -409,33 +409,29 @@ class MainController extends Component {
 | 
			
		|||
        const storeWorksheets = this.props.storeWorksheets;
 | 
			
		||||
        let props = this.getWSProps(true);
 | 
			
		||||
    
 | 
			
		||||
        storeWorksheets.setWorksheetProtection(props);
 | 
			
		||||
        storeWorksheets.setWsProps(props);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getWSProps(update) {
 | 
			
		||||
        const storeAppOptions = this.props.storeAppOptions;
 | 
			
		||||
        let protection = {};
 | 
			
		||||
        let wsProps = {};
 | 
			
		||||
        if (!storeAppOptions.config || !storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit) return;
 | 
			
		||||
 | 
			
		||||
        if (update) {
 | 
			
		||||
            let wsProtected = !!this.api.asc_isProtectedSheet();
 | 
			
		||||
            let arr = {};
 | 
			
		||||
            if (wsProtected) {
 | 
			
		||||
                // arr = [];
 | 
			
		||||
                let props = this.api.asc_getProtectedSheet();
 | 
			
		||||
                props && this.wsLockOptions.forEach(function(item){
 | 
			
		||||
                    arr[item] = props['asc_get' + item] ? props['asc_get' + item]() : false;
 | 
			
		||||
                    wsProps[item] = props['asc_get' + item] ? props['asc_get' + item]() : false;
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
                this.wsLockOptions.forEach(function(item){
 | 
			
		||||
                    arr[item] = false;
 | 
			
		||||
                    wsProps[item] = false;
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            protection = {wsLock: wsProtected, wsProps: arr};
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return protection;
 | 
			
		||||
        return wsProps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _onLongActionEnd(type, id) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn
 | 
			
		|||
    const _t = t("Toolbar", { returnObjects: true });
 | 
			
		||||
 | 
			
		||||
    const storeWorksheets = props.storeWorksheets;
 | 
			
		||||
    const worksheetProtection = storeWorksheets.worksheetProtection;
 | 
			
		||||
    const wsProps = storeWorksheets.wsProps;
 | 
			
		||||
 | 
			
		||||
    const appOptions = props.storeAppOptions;
 | 
			
		||||
    const isDisconnected = props.users.isDisconnected;
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +157,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn
 | 
			
		|||
                     showEditDocument={showEditDocument}
 | 
			
		||||
                     onEditDocument={onEditDocument}
 | 
			
		||||
                     isDisconnected={isDisconnected}
 | 
			
		||||
                     worksheetProtection={worksheetProtection}
 | 
			
		||||
                     wsProps={wsProps}
 | 
			
		||||
                     focusOn={focusOn}
 | 
			
		||||
        />
 | 
			
		||||
    )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,9 +89,7 @@ class MainPage extends Component {
 | 
			
		|||
  render() {
 | 
			
		||||
      const appOptions = this.props.storeAppOptions;
 | 
			
		||||
      const storeWorksheets = this.props.storeWorksheets;
 | 
			
		||||
      const worksheetProtection = storeWorksheets.worksheetProtection;
 | 
			
		||||
      const wsLock = worksheetProtection.wsLock;
 | 
			
		||||
      const wsProps = worksheetProtection.wsProps;
 | 
			
		||||
      const wsProps = storeWorksheets.wsProps;
 | 
			
		||||
      const config = appOptions.config;
 | 
			
		||||
      const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
 | 
			
		||||
      const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,8 +38,8 @@ export class storeWorksheets {
 | 
			
		|||
            isProtectedWorkbook: observable,
 | 
			
		||||
            setProtectedWorkbook: action,
 | 
			
		||||
 | 
			
		||||
            worksheetProtection: observable,
 | 
			
		||||
            setWorksheetProtection: action
 | 
			
		||||
            wsProps: observable,
 | 
			
		||||
            setWsProps: action
 | 
			
		||||
        });
 | 
			
		||||
        this.sheets = [];
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -101,8 +101,8 @@ export class storeWorksheets {
 | 
			
		|||
        this.isProtectedWorkbook = value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    worksheetProtection = {wsLock: false, wsProps: ''};
 | 
			
		||||
    setWorksheetProtection(value) {
 | 
			
		||||
        this.worksheetProtection = value;
 | 
			
		||||
    wsProps;
 | 
			
		||||
    setWsProps(value) {
 | 
			
		||||
        this.wsProps = value;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ import EditorUIController from '../lib/patch'
 | 
			
		|||
 | 
			
		||||
const ToolbarView = props => {
 | 
			
		||||
    const isDisconnected = props.isDisconnected;
 | 
			
		||||
    const worksheetProtection = props.worksheetProtection;
 | 
			
		||||
    const wsProps = props.wsProps;
 | 
			
		||||
    const focusOn = props.focusOn;
 | 
			
		||||
    const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({
 | 
			
		||||
            disabledUndo: !props.isCanUndo || isDisconnected,
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ const ToolbarView = props => {
 | 
			
		|||
                }
 | 
			
		||||
                {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({
 | 
			
		||||
                    disabled: props.disabledEditControls || props.disabledControls || isDisconnected,
 | 
			
		||||
                    worksheetProtection,
 | 
			
		||||
                    wsProps,
 | 
			
		||||
                    focusOn,
 | 
			
		||||
                    onEditClick: () => props.openOptions('edit'),
 | 
			
		||||
                    onAddClick: () => props.openOptions('add')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,9 +12,7 @@ const EditCell = props => {
 | 
			
		|||
    const _t = t('View.Edit', {returnObjects: true});
 | 
			
		||||
    const storeCellSettings = props.storeCellSettings;
 | 
			
		||||
    const storeWorksheets = props.storeWorksheets;
 | 
			
		||||
    const worksheetProtection = storeWorksheets.worksheetProtection;
 | 
			
		||||
    const wsLock = worksheetProtection.wsLock;
 | 
			
		||||
    const wsProps = worksheetProtection.wsProps;
 | 
			
		||||
    const wsProps = storeWorksheets.wsProps;
 | 
			
		||||
    const cellStyles = storeCellSettings.cellStyles;
 | 
			
		||||
    const styleName = storeCellSettings.styleName;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +42,7 @@ const EditCell = props => {
 | 
			
		|||
                    onFontSize: props.onFontSize,
 | 
			
		||||
                    onFontClick: props.onFontClick
 | 
			
		||||
                }}/>
 | 
			
		||||
                {(!wsLock || !wsProps.FormatCells) && 
 | 
			
		||||
                {!wsProps.FormatCells && 
 | 
			
		||||
                <>
 | 
			
		||||
                    <List>
 | 
			
		||||
                        <ListItem className='buttons'>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -198,9 +198,7 @@ const PageSpreadsheetSettings = props => {
 | 
			
		|||
    const _t = t('View.Settings', {returnObjects: true});
 | 
			
		||||
    const storeSpreadsheetSettings = props.storeSpreadsheetSettings;
 | 
			
		||||
    const storeWorksheets = props.storeWorksheets;
 | 
			
		||||
    const worksheetProtection = storeWorksheets.worksheetProtection;
 | 
			
		||||
    const wsLock = worksheetProtection.wsLock;
 | 
			
		||||
    const wsProps = worksheetProtection.wsProps;
 | 
			
		||||
    const wsProps = storeWorksheets.wsProps;
 | 
			
		||||
    const isPortrait = storeSpreadsheetSettings.isPortrait;
 | 
			
		||||
    const isHideHeadings = storeSpreadsheetSettings.isHideHeadings;
 | 
			
		||||
    const isHideGridlines = storeSpreadsheetSettings.isHideGridlines;
 | 
			
		||||
| 
						 | 
				
			
			@ -257,7 +255,7 @@ const PageSpreadsheetSettings = props => {
 | 
			
		|||
                </ListItem>
 | 
			
		||||
            </List>
 | 
			
		||||
            <List>
 | 
			
		||||
                <ListItem title={_t.textColorSchemes} className={wsLock && wsProps.FormatCells ? 'disabled' : ''} link="/color-schemes/" routeProps={{
 | 
			
		||||
                <ListItem title={_t.textColorSchemes} className={wsProps.FormatCells ? 'disabled' : ''} link="/color-schemes/" routeProps={{
 | 
			
		||||
                    onColorSchemeChange: props.onColorSchemeChange,
 | 
			
		||||
                    initPageColorSchemes: props.initPageColorSchemes
 | 
			
		||||
                }}></ListItem>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue