[SSE mobile] Added protection for cells and objects
This commit is contained in:
parent
da148ca430
commit
0c145e9b6f
|
@ -4,10 +4,13 @@ import { f7 } from 'framework7-react';
|
|||
import { useTranslation } from 'react-i18next';
|
||||
import ToolbarView from "../view/Toolbar";
|
||||
|
||||
const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings')(observer(props => {
|
||||
const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings', 'storeWorksheets')(observer(props => {
|
||||
const {t} = useTranslation();
|
||||
const _t = t("Toolbar", { returnObjects: true });
|
||||
|
||||
const storeWorksheets = props.storeWorksheets;
|
||||
const worksheetProtection = storeWorksheets.worksheetProtection;
|
||||
|
||||
const appOptions = props.storeAppOptions;
|
||||
const isDisconnected = props.users.isDisconnected;
|
||||
|
||||
|
@ -153,6 +156,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn
|
|||
showEditDocument={showEditDocument}
|
||||
onEditDocument={onEditDocument}
|
||||
isDisconnected={isDisconnected}
|
||||
worksheetProtection={worksheetProtection}
|
||||
/>
|
||||
)
|
||||
}));
|
||||
|
|
|
@ -101,7 +101,7 @@ export class storeWorksheets {
|
|||
this.isProtectedWorkbook = value;
|
||||
}
|
||||
|
||||
worksheetProtection;
|
||||
worksheetProtection = {wsLock: false, wsProps: ''};
|
||||
setWorksheetProtection(value) {
|
||||
this.worksheetProtection = value;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ import EditorUIController from '../lib/patch'
|
|||
|
||||
const ToolbarView = props => {
|
||||
const isDisconnected = props.isDisconnected;
|
||||
const worksheetProtection = props.worksheetProtection;
|
||||
const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({
|
||||
disabledUndo: !props.isCanUndo || isDisconnected,
|
||||
disabledRedo: !props.isCanRedo || isDisconnected,
|
||||
onUndoClick: props.onUndo,
|
||||
onRedoClick: props.onRedo
|
||||
}) : null;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<NavLeft>
|
||||
|
@ -25,6 +27,7 @@ const ToolbarView = props => {
|
|||
}
|
||||
{props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({
|
||||
disabled: props.disabledEditControls || props.disabledControls || isDisconnected,
|
||||
worksheetProtection,
|
||||
onEditClick: () => props.openOptions('edit'),
|
||||
onAddClick: () => props.openOptions('add')
|
||||
})}
|
||||
|
|
|
@ -44,54 +44,56 @@ const EditCell = props => {
|
|||
onFontSize: props.onFontSize,
|
||||
onFontClick: props.onFontClick
|
||||
}}/>
|
||||
{!wsLock && !wsProps.FormatCells &&
|
||||
{!wsLock || !wsProps.FormatCells &&
|
||||
<>
|
||||
<ListItem className='buttons'>
|
||||
<Row>
|
||||
<a className={'button' + (isBold ? ' active' : '')} onClick={() => {props.toggleBold(!isBold)}}><b>B</b></a>
|
||||
<a className={'button' + (isItalic ? ' active' : '')} onClick={() => {props.toggleItalic(!isItalic)}}><i>I</i></a>
|
||||
<a className={'button' + (isUnderline ? ' active' : '')} onClick={() => {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U</a>
|
||||
</Row>
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextColor} link="/edit-cell-text-color/" routeProps={{
|
||||
onTextColor: props.onTextColor
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-color">{fontColorPreview}</Icon> :
|
||||
fontColorPreview
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textFillColor} link="/edit-cell-fill-color/" routeProps={{
|
||||
onFillColor: props.onFillColor
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-fill-color">{fillColorPreview}</Icon> :
|
||||
fillColorPreview
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextFormat} link="/edit-cell-text-format/" routeProps={{
|
||||
onHAlignChange: props.onHAlignChange,
|
||||
onVAlignChange: props.onVAlignChange,
|
||||
onWrapTextChange: props.onWrapTextChange
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-align-left"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextOrientation} link="/edit-cell-text-orientation/" routeProps={{
|
||||
onTextOrientationChange: props.onTextOrientationChange
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-orientation-horizontal"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textBorderStyle} link="/edit-cell-border-style/" routeProps={{
|
||||
onBorderStyle: props.onBorderStyle
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-table-borders-all"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
<List>
|
||||
<ListItem className='buttons'>
|
||||
<Row>
|
||||
<a className={'button' + (isBold ? ' active' : '')} onClick={() => {props.toggleBold(!isBold)}}><b>B</b></a>
|
||||
<a className={'button' + (isItalic ? ' active' : '')} onClick={() => {props.toggleItalic(!isItalic)}}><i>I</i></a>
|
||||
<a className={'button' + (isUnderline ? ' active' : '')} onClick={() => {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U</a>
|
||||
</Row>
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextColor} link="/edit-cell-text-color/" routeProps={{
|
||||
onTextColor: props.onTextColor
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-color">{fontColorPreview}</Icon> :
|
||||
fontColorPreview
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textFillColor} link="/edit-cell-fill-color/" routeProps={{
|
||||
onFillColor: props.onFillColor
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-fill-color">{fillColorPreview}</Icon> :
|
||||
fillColorPreview
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextFormat} link="/edit-cell-text-format/" routeProps={{
|
||||
onHAlignChange: props.onHAlignChange,
|
||||
onVAlignChange: props.onVAlignChange,
|
||||
onWrapTextChange: props.onWrapTextChange
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-align-left"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textTextOrientation} link="/edit-cell-text-orientation/" routeProps={{
|
||||
onTextOrientationChange: props.onTextOrientationChange
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-text-orientation-horizontal"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
<ListItem title={_t.textBorderStyle} link="/edit-cell-border-style/" routeProps={{
|
||||
onBorderStyle: props.onBorderStyle
|
||||
}}>
|
||||
{!isAndroid ?
|
||||
<Icon slot="media" icon="icon-table-borders-all"></Icon> : null
|
||||
}
|
||||
</ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{
|
||||
onCellFormat: props.onCellFormat,
|
||||
|
|
|
@ -197,6 +197,10 @@ const PageSpreadsheetSettings = props => {
|
|||
const { t } = useTranslation();
|
||||
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 isPortrait = storeSpreadsheetSettings.isPortrait;
|
||||
const isHideHeadings = storeSpreadsheetSettings.isHideHeadings;
|
||||
const isHideGridlines = storeSpreadsheetSettings.isHideGridlines;
|
||||
|
@ -253,7 +257,7 @@ const PageSpreadsheetSettings = props => {
|
|||
</ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem title={_t.textColorSchemes} link="/color-schemes/" routeProps={{
|
||||
<ListItem title={_t.textColorSchemes} className={wsLock && wsProps.FormatCells ? 'disabled' : ''} link="/color-schemes/" routeProps={{
|
||||
onColorSchemeChange: props.onColorSchemeChange,
|
||||
initPageColorSchemes: props.initPageColorSchemes
|
||||
}}></ListItem>
|
||||
|
@ -264,7 +268,7 @@ const PageSpreadsheetSettings = props => {
|
|||
|
||||
const SpreadsheetFormats = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetFormats));
|
||||
const SpreadsheetMargins = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetMargins));
|
||||
const SpreadsheetSettings = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetSettings));
|
||||
const SpreadsheetSettings = inject("storeSpreadsheetSettings", "storeWorksheets")(observer(PageSpreadsheetSettings));
|
||||
const SpreadsheetColorSchemes = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetColorSchemes));
|
||||
|
||||
export {
|
||||
|
|
Loading…
Reference in a new issue