mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
Fix lint errors.
This commit is contained in:
parent
d42ffe3998
commit
926eb51405
@ -34,7 +34,7 @@ interface ActionConfig {
|
|||||||
/**
|
/**
|
||||||
* the event handler for a common button
|
* the event handler for a common button
|
||||||
*/
|
*/
|
||||||
onClick?: (event: any) => void;
|
onClick?: (event: object) => void;
|
||||||
/**
|
/**
|
||||||
* custom element for a menu entry
|
* custom element for a menu entry
|
||||||
*/
|
*/
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
||||||
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
||||||
import React, { useEffect } from 'react';
|
import React, { ReactElement, useEffect } from 'react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param props text field props.
|
* @param props text field props.
|
||||||
* @returns wrapped mui TextField, that disable mindplot keyboard events on focus and enable it on blur
|
* @returns wrapped mui TextField, that disable mindplot keyboard events on focus and enable it on blur
|
||||||
*/
|
*/
|
||||||
const Input = (props: TextFieldProps) => {
|
const Input = (props: TextFieldProps): ReactElement => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => DesignerKeyboard.resume();
|
return () => DesignerKeyboard.resume();
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import React from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import NodeProperty from '../../../../classes/model/node-property';
|
import NodeProperty from '../../../../classes/model/node-property';
|
||||||
import { CirclePicker as ReactColorPicker } from 'react-color';
|
import { CirclePicker as ReactColorPicker } from 'react-color';
|
||||||
import colors from './colors.json';
|
import colors from './colors.json';
|
||||||
@ -24,7 +24,7 @@ import colors from './colors.json';
|
|||||||
/**
|
/**
|
||||||
* Color picker for toolbar
|
* Color picker for toolbar
|
||||||
*/
|
*/
|
||||||
const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }) => {
|
const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<Box component="div" sx={{ m: 2 }}>
|
<Box component="div" sx={{ m: 2 }}>
|
||||||
<ReactColorPicker
|
<ReactColorPicker
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import React from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import iconGroups from './iconGroups.json';
|
import iconGroups from './iconGroups.json';
|
||||||
import { SvgImageIcon } from '@wisemapping/mindplot';
|
import { SvgImageIcon } from '@wisemapping/mindplot';
|
||||||
import NodeProperty from '../../../../../classes/model/node-property';
|
import NodeProperty from '../../../../../classes/model/node-property';
|
||||||
@ -8,10 +8,10 @@ type IconImageTab = {
|
|||||||
iconModel: NodeProperty;
|
iconModel: NodeProperty;
|
||||||
triggerClose: () => void;
|
triggerClose: () => void;
|
||||||
};
|
};
|
||||||
const IconImageTab = ({ iconModel, triggerClose }: IconImageTab) => {
|
const IconImageTab = ({ iconModel, triggerClose }: IconImageTab): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<Box sx={{ width: '350px' }}>
|
<Box sx={{ width: '350px' }}>
|
||||||
{iconGroups.map((family, i) => (
|
{iconGroups.map((family) => (
|
||||||
<span>
|
<span>
|
||||||
{family.icons.map((icon) => (
|
{family.icons.map((icon) => (
|
||||||
<img
|
<img
|
||||||
@ -22,7 +22,7 @@ const IconImageTab = ({ iconModel, triggerClose }: IconImageTab) => {
|
|||||||
iconModel.setValue(`image:${icon}`);
|
iconModel.setValue(`image:${icon}`);
|
||||||
triggerClose();
|
triggerClose();
|
||||||
}}
|
}}
|
||||||
></img>
|
/>
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useEffect } from 'react';
|
import React, { ReactElement, useEffect } from 'react';
|
||||||
import NodeProperty from '../../../../classes/model/node-property';
|
import NodeProperty from '../../../../classes/model/node-property';
|
||||||
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
|
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
|
||||||
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
||||||
@ -29,10 +29,10 @@ type IconPickerProp = {
|
|||||||
iconModel: NodeProperty;
|
iconModel: NodeProperty;
|
||||||
};
|
};
|
||||||
|
|
||||||
const IconPicker = ({ triggerClose, iconModel }: IconPickerProp) => {
|
const IconPicker = ({ triggerClose, iconModel }: IconPickerProp): ReactElement => {
|
||||||
const [checked, setChecked] = React.useState(true);
|
const [checked, setChecked] = React.useState(true);
|
||||||
|
|
||||||
const handleCheck = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleCheck = () => {
|
||||||
setChecked(!checked);
|
setChecked(!checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
const KeyboardShorcutsHelp = () => {
|
const KeyboardShorcutsHelp = (): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<div id="keyboardTable">
|
<div id="keyboardTable">
|
||||||
<table>
|
<table>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { ReactElement, useEffect, useState } from 'react';
|
||||||
import Tooltip from '@mui/material/Tooltip';
|
import Tooltip from '@mui/material/Tooltip';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import MapInfo from '../../../../classes/model/map-info';
|
import MapInfo from '../../../../classes/model/map-info';
|
||||||
@ -28,7 +28,7 @@ type MapTitleProp = {
|
|||||||
|
|
||||||
type Status = 'disabled' | 'enabled' | 'active-edition';
|
type Status = 'disabled' | 'enabled' | 'active-edition';
|
||||||
|
|
||||||
const MapTitle = ({ mapInfo }: MapTitleProp) => {
|
const MapTitle = ({ mapInfo }: MapTitleProp): ReactElement => {
|
||||||
const [state, setState] = useState<Status>('disabled');
|
const [state, setState] = useState<Status>('disabled');
|
||||||
const [title, setTitle] = useState<string>(mapInfo.getTitle());
|
const [title, setTitle] = useState<string>(mapInfo.getTitle());
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
import React from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import NodeProperty from '../../../../classes/model/node-property';
|
import NodeProperty from '../../../../classes/model/node-property';
|
||||||
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
|
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
@ -27,7 +27,7 @@ const SaveAndDelete = (props: {
|
|||||||
model: NodeProperty;
|
model: NodeProperty;
|
||||||
closeModal: () => void;
|
closeModal: () => void;
|
||||||
submitHandler: () => void;
|
submitHandler: () => void;
|
||||||
}) => {
|
}): ReactElement => {
|
||||||
return (
|
return (
|
||||||
<Box component="span">
|
<Box component="span">
|
||||||
<Button color="primary" variant="contained" onClick={props.submitHandler} sx={{ mr: 1 }}>
|
<Button color="primary" variant="contained" onClick={props.submitHandler} sx={{ mr: 1 }}>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { useState } from 'react';
|
import { ReactElement, useState } from 'react';
|
||||||
import NodeProperty from '../../../../classes/model/node-property';
|
import NodeProperty from '../../../../classes/model/node-property';
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@ -29,7 +29,7 @@ import { useIntl } from 'react-intl';
|
|||||||
/**
|
/**
|
||||||
* Url form for toolbar and node contextual editor
|
* Url form for toolbar and node contextual editor
|
||||||
*/
|
*/
|
||||||
const TopicLink = (props: { closeModal: () => void; urlModel: NodeProperty }) => {
|
const TopicLink = (props: { closeModal: () => void; urlModel: NodeProperty }): ReactElement => {
|
||||||
const [url, setUrl] = useState(props.urlModel.getValue());
|
const [url, setUrl] = useState(props.urlModel.getValue());
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { ReactElement, ReactElement, useEffect, useState } from 'react';
|
||||||
import MaterialToolbar from '@mui/material/Toolbar';
|
import MaterialToolbar from '@mui/material/Toolbar';
|
||||||
import MaterialAppBar from '@mui/material/AppBar';
|
import MaterialAppBar from '@mui/material/AppBar';
|
||||||
import { ToolbarMenuItem } from '../toolbar';
|
import { ToolbarMenuItem } from '../toolbar';
|
||||||
@ -59,7 +59,13 @@ const keyTooltip = (msg: string, key: string): string => {
|
|||||||
return `${msg} (${isMac ? '⌘' : 'Ctrl'} + ${key})`;
|
return `${msg} (${isMac ? '⌘' : 'Ctrl'} + ${key})`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AppBar = ({ model, mapInfo, capability, onAction, accountConfig }: AppBarProps) => {
|
const AppBar = ({
|
||||||
|
model,
|
||||||
|
mapInfo,
|
||||||
|
capability,
|
||||||
|
onAction,
|
||||||
|
accountConfig,
|
||||||
|
}: AppBarProps): ReactElement => {
|
||||||
const [isStarred, setStarred] = useState<undefined | boolean>(undefined);
|
const [isStarred, setStarred] = useState<undefined | boolean>(undefined);
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import ActionConfig from '../../classes/action/action-config';
|
import ActionConfig from '../../classes/action/action-config';
|
||||||
import Capability from '../../classes/action/capability';
|
import Capability from '../../classes/action/capability';
|
||||||
import Model from '../../classes/model/editor';
|
import Model from '../../classes/model/editor';
|
||||||
@ -27,7 +27,7 @@ type EditorToolbarProps = {
|
|||||||
capability: Capability;
|
capability: Capability;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EditorToolbar = ({ model, capability }: EditorToolbarProps) => {
|
const EditorToolbar = ({ model, capability }: EditorToolbarProps): ReactElement => {
|
||||||
let config: ActionConfig[] | undefined;
|
let config: ActionConfig[] | undefined;
|
||||||
|
|
||||||
if (!capability.isHidden('edition-toolbar') && model?.isMapLoadded()) {
|
if (!capability.isHidden('edition-toolbar') && model?.isMapLoadded()) {
|
||||||
|
@ -11,7 +11,10 @@ export const fontSizes = [6, 8, 10, 15];
|
|||||||
* @param current the current vaule
|
* @param current the current vaule
|
||||||
* @returns the next vaule in the array or same if is the last
|
* @returns the next vaule in the array or same if is the last
|
||||||
*/
|
*/
|
||||||
export function getNextValue(values: any[], current: any): any {
|
export function getNextValue(
|
||||||
|
values: (string | number)[],
|
||||||
|
current: string | number,
|
||||||
|
): string | number {
|
||||||
const nextIndex = values.indexOf(current) + 1;
|
const nextIndex = values.indexOf(current) + 1;
|
||||||
if (nextIndex === values.length) return current;
|
if (nextIndex === values.length) return current;
|
||||||
return values[nextIndex];
|
return values[nextIndex];
|
||||||
@ -23,7 +26,10 @@ export function getNextValue(values: any[], current: any): any {
|
|||||||
* @param current the current vaule
|
* @param current the current vaule
|
||||||
* @returns the previous vaule in the array or same if is the first
|
* @returns the previous vaule in the array or same if is the first
|
||||||
*/
|
*/
|
||||||
export function getPreviousValue(values: any[], current: any): any {
|
export function getPreviousValue(
|
||||||
|
values: (string | number)[],
|
||||||
|
current: string | number,
|
||||||
|
): string | number {
|
||||||
const currentIndex = values.indexOf(current);
|
const currentIndex = values.indexOf(current);
|
||||||
if (currentIndex === 0) return current;
|
if (currentIndex === 0) return current;
|
||||||
if (currentIndex === -1) return values[values.length - 1];
|
if (currentIndex === -1) return values[values.length - 1];
|
||||||
@ -36,7 +42,7 @@ export function getPreviousValue(values: any[], current: any): any {
|
|||||||
export function getTheUniqueValueOrNull(
|
export function getTheUniqueValueOrNull(
|
||||||
objectsArray: object[],
|
objectsArray: object[],
|
||||||
propertyValueGetter: (object: object) => string | number,
|
propertyValueGetter: (object: object) => string | number,
|
||||||
) {
|
): string {
|
||||||
let result;
|
let result;
|
||||||
for (let i = 0; i < objectsArray.length; i++) {
|
for (let i = 0; i < objectsArray.length; i++) {
|
||||||
const value = propertyValueGetter(objectsArray[i]);
|
const value = propertyValueGetter(objectsArray[i]);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useRef, useState } from 'react';
|
import React, { ReactElement, useRef, useState } from 'react';
|
||||||
import AppBar from '@mui/material/AppBar';
|
import AppBar from '@mui/material/AppBar';
|
||||||
import Divider from '@mui/material/Divider';
|
import Divider from '@mui/material/Divider';
|
||||||
import IconButton from '@mui/material/IconButton';
|
import IconButton from '@mui/material/IconButton';
|
||||||
@ -31,7 +31,7 @@ import ActionConfig from '../../classes/action/action-config';
|
|||||||
* @param props.configuration the configuration
|
* @param props.configuration the configuration
|
||||||
* @returns common button menu entry that uses the onClick of the configuration.
|
* @returns common button menu entry that uses the onClick of the configuration.
|
||||||
*/
|
*/
|
||||||
export const ToolbarButtonOption = (props: { configuration: ActionConfig }) => {
|
export const ToolbarButtonOption = (props: { configuration: ActionConfig }): ReactElement => {
|
||||||
const selected = props.configuration.selected && props.configuration.selected();
|
const selected = props.configuration.selected && props.configuration.selected();
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@ -87,7 +87,7 @@ export const ToolbarSubmenu = (props: {
|
|||||||
configuration: ActionConfig;
|
configuration: ActionConfig;
|
||||||
vertical?: boolean;
|
vertical?: boolean;
|
||||||
elevation?: number;
|
elevation?: number;
|
||||||
}) => {
|
}): ReactElement => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const itemRef = useRef(null);
|
const itemRef = useRef(null);
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ export const ToolbarMenuItem = (props: {
|
|||||||
configuration: ActionConfig | null;
|
configuration: ActionConfig | null;
|
||||||
vertical?: boolean;
|
vertical?: boolean;
|
||||||
elevation?: number;
|
elevation?: number;
|
||||||
}) => {
|
}): ReactElement => {
|
||||||
if (props.configuration === null)
|
if (props.configuration === null)
|
||||||
return (
|
return (
|
||||||
<Divider
|
<Divider
|
||||||
@ -209,7 +209,7 @@ const Toolbar = (props: {
|
|||||||
configurations: ActionConfig[];
|
configurations: ActionConfig[];
|
||||||
position?: ToolbarPosition;
|
position?: ToolbarPosition;
|
||||||
rerender?: number;
|
rerender?: number;
|
||||||
}) => {
|
}): ReactElement => {
|
||||||
const position = props.position || defaultPosition;
|
const position = props.position || defaultPosition;
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
|
Loading…
Reference in New Issue
Block a user