mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-12-25 21:03:50 +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
|
||||
*/
|
||||
onClick?: (event: any) => void;
|
||||
onClick?: (event: object) => void;
|
||||
/**
|
||||
* custom element for a menu entry
|
||||
*/
|
||||
|
@ -17,14 +17,14 @@
|
||||
*/
|
||||
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
||||
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { ReactElement, useEffect } from 'react';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param props text field props.
|
||||
* @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(() => {
|
||||
return () => DesignerKeyboard.resume();
|
||||
}, []);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import Box from '@mui/material/Box';
|
||||
import React from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import { CirclePicker as ReactColorPicker } from 'react-color';
|
||||
import colors from './colors.json';
|
||||
@ -24,7 +24,7 @@ import colors from './colors.json';
|
||||
/**
|
||||
* Color picker for toolbar
|
||||
*/
|
||||
const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }) => {
|
||||
const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }): ReactElement => {
|
||||
return (
|
||||
<Box component="div" sx={{ m: 2 }}>
|
||||
<ReactColorPicker
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Box from '@mui/material/Box';
|
||||
import React from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
import iconGroups from './iconGroups.json';
|
||||
import { SvgImageIcon } from '@wisemapping/mindplot';
|
||||
import NodeProperty from '../../../../../classes/model/node-property';
|
||||
@ -8,10 +8,10 @@ type IconImageTab = {
|
||||
iconModel: NodeProperty;
|
||||
triggerClose: () => void;
|
||||
};
|
||||
const IconImageTab = ({ iconModel, triggerClose }: IconImageTab) => {
|
||||
const IconImageTab = ({ iconModel, triggerClose }: IconImageTab): ReactElement => {
|
||||
return (
|
||||
<Box sx={{ width: '350px' }}>
|
||||
{iconGroups.map((family, i) => (
|
||||
{iconGroups.map((family) => (
|
||||
<span>
|
||||
{family.icons.map((icon) => (
|
||||
<img
|
||||
@ -22,7 +22,7 @@ const IconImageTab = ({ iconModel, triggerClose }: IconImageTab) => {
|
||||
iconModel.setValue(`image:${icon}`);
|
||||
triggerClose();
|
||||
}}
|
||||
></img>
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
))}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { ReactElement, useEffect } from 'react';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
|
||||
import DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
||||
@ -29,10 +29,10 @@ type IconPickerProp = {
|
||||
iconModel: NodeProperty;
|
||||
};
|
||||
|
||||
const IconPicker = ({ triggerClose, iconModel }: IconPickerProp) => {
|
||||
const IconPicker = ({ triggerClose, iconModel }: IconPickerProp): ReactElement => {
|
||||
const [checked, setChecked] = React.useState(true);
|
||||
|
||||
const handleCheck = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const handleCheck = () => {
|
||||
setChecked(!checked);
|
||||
};
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
const KeyboardShorcutsHelp = () => {
|
||||
const KeyboardShorcutsHelp = (): ReactElement => {
|
||||
return (
|
||||
<div id="keyboardTable">
|
||||
<table>
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { ReactElement, useEffect, useState } from 'react';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import MapInfo from '../../../../classes/model/map-info';
|
||||
@ -28,7 +28,7 @@ type MapTitleProp = {
|
||||
|
||||
type Status = 'disabled' | 'enabled' | 'active-edition';
|
||||
|
||||
const MapTitle = ({ mapInfo }: MapTitleProp) => {
|
||||
const MapTitle = ({ mapInfo }: MapTitleProp): ReactElement => {
|
||||
const [state, setState] = useState<Status>('disabled');
|
||||
const [title, setTitle] = useState<string>(mapInfo.getTitle());
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
import Box from '@mui/material/Box';
|
||||
import Button from '@mui/material/Button';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import React from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
@ -27,7 +27,7 @@ const SaveAndDelete = (props: {
|
||||
model: NodeProperty;
|
||||
closeModal: () => void;
|
||||
submitHandler: () => void;
|
||||
}) => {
|
||||
}): ReactElement => {
|
||||
return (
|
||||
<Box component="span">
|
||||
<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
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
import { ReactElement, useState } from 'react';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import Box from '@mui/material/Box';
|
||||
import React from 'react';
|
||||
@ -29,7 +29,7 @@ import { useIntl } from 'react-intl';
|
||||
/**
|
||||
* 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 intl = useIntl();
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* 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 MaterialAppBar from '@mui/material/AppBar';
|
||||
import { ToolbarMenuItem } from '../toolbar';
|
||||
@ -59,7 +59,13 @@ const keyTooltip = (msg: string, key: string): string => {
|
||||
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 intl = useIntl();
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import React, { ReactElement } from 'react';
|
||||
import ActionConfig from '../../classes/action/action-config';
|
||||
import Capability from '../../classes/action/capability';
|
||||
import Model from '../../classes/model/editor';
|
||||
@ -27,7 +27,7 @@ type EditorToolbarProps = {
|
||||
capability: Capability;
|
||||
};
|
||||
|
||||
const EditorToolbar = ({ model, capability }: EditorToolbarProps) => {
|
||||
const EditorToolbar = ({ model, capability }: EditorToolbarProps): ReactElement => {
|
||||
let config: ActionConfig[] | undefined;
|
||||
|
||||
if (!capability.isHidden('edition-toolbar') && model?.isMapLoadded()) {
|
||||
|
@ -11,7 +11,10 @@ export const fontSizes = [6, 8, 10, 15];
|
||||
* @param current the current vaule
|
||||
* @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;
|
||||
if (nextIndex === values.length) return current;
|
||||
return values[nextIndex];
|
||||
@ -23,7 +26,10 @@ export function getNextValue(values: any[], current: any): any {
|
||||
* @param current the current vaule
|
||||
* @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);
|
||||
if (currentIndex === 0) return current;
|
||||
if (currentIndex === -1) return values[values.length - 1];
|
||||
@ -36,7 +42,7 @@ export function getPreviousValue(values: any[], current: any): any {
|
||||
export function getTheUniqueValueOrNull(
|
||||
objectsArray: object[],
|
||||
propertyValueGetter: (object: object) => string | number,
|
||||
) {
|
||||
): string {
|
||||
let result;
|
||||
for (let i = 0; i < objectsArray.length; i++) {
|
||||
const value = propertyValueGetter(objectsArray[i]);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React, { ReactElement, useRef, useState } from 'react';
|
||||
import AppBar from '@mui/material/AppBar';
|
||||
import Divider from '@mui/material/Divider';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
@ -31,7 +31,7 @@ import ActionConfig from '../../classes/action/action-config';
|
||||
* @param props.configuration 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();
|
||||
return (
|
||||
<Tooltip
|
||||
@ -87,7 +87,7 @@ export const ToolbarSubmenu = (props: {
|
||||
configuration: ActionConfig;
|
||||
vertical?: boolean;
|
||||
elevation?: number;
|
||||
}) => {
|
||||
}): ReactElement => {
|
||||
const [open, setOpen] = useState(false);
|
||||
const itemRef = useRef(null);
|
||||
|
||||
@ -158,7 +158,7 @@ export const ToolbarMenuItem = (props: {
|
||||
configuration: ActionConfig | null;
|
||||
vertical?: boolean;
|
||||
elevation?: number;
|
||||
}) => {
|
||||
}): ReactElement => {
|
||||
if (props.configuration === null)
|
||||
return (
|
||||
<Divider
|
||||
@ -209,7 +209,7 @@ const Toolbar = (props: {
|
||||
configurations: ActionConfig[];
|
||||
position?: ToolbarPosition;
|
||||
rerender?: number;
|
||||
}) => {
|
||||
}): ReactElement => {
|
||||
const position = props.position || defaultPosition;
|
||||
return (
|
||||
<AppBar
|
||||
|
Loading…
Reference in New Issue
Block a user