Add missing copyright headers.

This commit is contained in:
Paulo Gustavo Veiga 2022-10-07 21:52:39 -07:00
parent 99cec1bd54
commit 54ed067288
27 changed files with 657 additions and 235 deletions

View File

@ -1,3 +1,21 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** /**
* Interface for menu configuration. * Interface for menu configuration.
* One of these properties must be set: onClick, render or options. * One of these properties must be set: onClick, render or options.

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { import {
WidgetManager, WidgetManager,

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'; import React from 'react';
import TopicLink from '../../components/action-widget/pane/topic-link'; import TopicLink from '../../components/action-widget/pane/topic-link';
import TopicNote from '../../components/action-widget/pane/topic-note'; import TopicNote from '../../components/action-widget/pane/topic-note';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import FR from './../../compiled-lang/fr.json'; import FR from './../../compiled-lang/fr.json';
import ES from './../../compiled-lang/es.json'; import ES from './../../compiled-lang/es.json';
import EN from './../../compiled-lang/en.json'; import EN from './../../compiled-lang/en.json';

View File

@ -0,0 +1,211 @@
import { Designer } from '@wisemapping/mindplot';
import NodeProperty from '../node-property';
import {
getTheUniqueValueOrNull,
SwitchValueDirection,
getPreviousValue,
fontSizes,
getNextValue,
} from '../../../components/toolbar/ToolbarValueModelBuilder';
/**
* Given a designer build NodePropertyValueModel instances for the mindplot node properties
*/
class NodePropertyBuilder {
designer: Designer;
fontSizeModel: NodeProperty;
selectedTopicColorModel: NodeProperty;
fontFamilyModel: NodeProperty;
fontStyleModel: NodeProperty;
borderColorModel: NodeProperty;
fontColorModel: NodeProperty;
topicShapeModel: NodeProperty;
topicIconModel: NodeProperty;
noteModel: NodeProperty;
linkModel: NodeProperty;
/**
*
* @param designer designer to change node properties values
*/
constructor(designer: Designer) {
this.designer = designer;
}
private selectedTopic() {
return designer.getModel().selectedTopic();
}
private getFontSize() {
return designer.getModel().selectedTopic()?.getFontSize();
}
private uniqueOrNull(propertyGetter: (Topic) => any | null) {
const nodes = designer.getModel().filterSelectedTopics();
return getTheUniqueValueOrNull(nodes, propertyGetter);
}
/**
*
* @returns model to and switch font weigth
*/
fontWeigthModel(): NodeProperty {
return {
getValue: () => designer.getModel().selectedTopic()?.getFontWeight(),
switchValue: () => designer.changeFontWeight(),
};
}
/**
*
* @returns model to and switch font size in both directions. Font sizes used to iterate: [6, 8, 10, 15]
*/
getFontSizeModel(): NodeProperty {
if (!this.fontSizeModel)
this.fontSizeModel = {
getValue: () => this.getFontSize(),
switchValue: (direction?) => {
let newValue = undefined;
if (direction === SwitchValueDirection.down) {
newValue = getPreviousValue(fontSizes, this.getFontSize());
}
if (direction === SwitchValueDirection.up) {
newValue = getNextValue(fontSizes, this.getFontSize());
}
designer.changeFontSize(newValue);
},
};
return this.fontSizeModel;
}
/**
*
* @returns model to get and set topic color
*/
getSelectedTopicColorModel(): NodeProperty {
if (!this.selectedTopicColorModel)
this.selectedTopicColorModel = {
getValue: () => designer.getModel().selectedTopic()?.getBackgroundColor(),
setValue: (color) => designer.changeBackgroundColor(color),
};
return this.selectedTopicColorModel;
}
/**
*
* @returns model to get and set the node link
*/
getLinkModel(): NodeProperty {
// const selected = this.selectedTopic();
if (!this.linkModel)
this.linkModel = {
getValue: (): string => this.selectedTopic()?.getLinkValue(),
setValue: (value: string) => {
if (value && value.trim() !== '') {
this.selectedTopic().setLinkValue(value);
} else {
this.selectedTopic().setLinkValue(undefined);
}
},
};
return this.linkModel;
}
/**
*
* @returns model to get and set topic border color
*/
getColorBorderModel(): NodeProperty {
if (!this.borderColorModel)
this.borderColorModel = {
getValue: () => this.uniqueOrNull((node) => node.getBorderColor()),
setValue: (hex: string) => designer.changeBorderColor(hex),
};
return this.borderColorModel;
}
/**
*
* @returns model to get and set topic font color
*/
getFontColorModel(): NodeProperty {
if (!this.fontColorModel)
this.fontColorModel = {
getValue: () => this.uniqueOrNull((node) => node.getFontColor()),
setValue: (hex: string) => designer.changeFontColor(hex),
};
return this.fontColorModel;
}
/**
*
* @returns model to get and set topic icon
*/
getTopicIconModel(): NodeProperty {
if (!this.topicIconModel)
this.topicIconModel = {
getValue: () => null,
setValue: (value: string) => designer.addIconType(value),
};
return this.topicIconModel;
}
/**
*
* @returns model to get and set topic note
*/
getNoteModel(): NodeProperty {
if (!this.noteModel)
this.noteModel = {
getValue: (): string => this.selectedTopic()?.getNoteValue(),
setValue: (value: string) => {
const note = value && value.trim() !== '' ? value : undefined;
this.selectedTopic()?.setNoteValue(note);
},
};
return this.noteModel;
}
/**
*
* @returns model to get and set topic font family
*/
getFontFamilyModel(): NodeProperty {
if (!this.fontFamilyModel)
this.fontFamilyModel = {
getValue: () => this.uniqueOrNull((node) => node.getFontFamily()),
setValue: (value: string) => designer.changeFontFamily(value),
};
return this.fontFamilyModel;
}
/**
*
* @returns model to get and switch topic style
*/
getFontStyleModel(): NodeProperty {
if (!this.fontStyleModel)
this.fontStyleModel = {
getValue: () => this.selectedTopic()?.getFontStyle(),
switchValue: () => designer.changeFontStyle(),
};
return this.fontStyleModel;
}
/**
*
* @returns model to get and set topic shape
*/
getTopicShapeModel(): NodeProperty {
if (!this.topicShapeModel)
this.topicShapeModel = {
getValue: () => this.uniqueOrNull((node) => node.getShapeType()),
setValue: (value: string) => designer.changeTopicShape(value),
};
return this.topicShapeModel;
}
}
export default NodePropertyBuilder;

View File

@ -0,0 +1,21 @@
import { SwitchValueDirection } from '../../../components/toolbar/ToolbarValueModelBuilder';
/**
* Interface to get and set a property of the mindplot selected node
*/
interface NodeProperty {
/**
* get the property value
*/
getValue: () => any;
/**
* set the property value
*/
setValue?: (value: any) => void;
/**
* toogle boolean values or change for next/previous in reduced lists of values
*/
switchValue?: (direction?: SwitchValueDirection) => void;
}
export default NodeProperty;

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'; import React from 'react';
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import FormControl from '@mui/material/FormControl'; import FormControl from '@mui/material/FormControl';
@ -5,12 +22,12 @@ import MenuItem from '@mui/material/MenuItem';
import Select, { SelectChangeEvent } from '@mui/material/Select'; import Select, { SelectChangeEvent } from '@mui/material/Select';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; import NodeProperty from '../../../../classes/model/node-property';
/** /**
* Font family selector for editor toolbar * Font family selector for editor toolbar
*/ */
const FontFamilySelect = (props: { fontFamilyModel: NodePropertyValueModel }) => { const FontFamilySelect = (props: { fontFamilyModel: NodeProperty }) => {
const [font, setFont] = React.useState(props.fontFamilyModel.getValue()); const [font, setFont] = React.useState(props.fontFamilyModel.getValue());
const handleChange = (event: SelectChangeEvent) => { const handleChange = (event: SelectChangeEvent) => {

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import ActionConfig from '../../../../classes/action-config'; import ActionConfig from '../../../../classes/action-config';
import { ToolbarMenuItem } from '../../../toolbar/Toolbar'; import { ToolbarMenuItem } from '../../../toolbar/Toolbar';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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, { useEffect } from 'react';

View File

@ -1,13 +1,30 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import React from 'react'; import React from 'react';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; 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';
/** /**
* Color picker for toolbar * Color picker for toolbar
*/ */
const ColorPicker = (props: { closeModal: () => void; colorModel: NodePropertyValueModel }) => { const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }) => {
return ( return (
<Box component="div" sx={{ m: 2 }}> <Box component="div" sx={{ m: 2 }}>
<ReactColorPicker <ReactColorPicker

View File

@ -1,15 +1,32 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import Tab from '@mui/material/Tab'; import Tab from '@mui/material/Tab';
import Tabs from '@mui/material/Tabs'; import Tabs from '@mui/material/Tabs';
import React from 'react'; import React from 'react';
import iconGroups from './iconGroups.json'; import iconGroups from './iconGroups.json';
import { ImageIcon } from '@wisemapping/mindplot'; import { ImageIcon } from '@wisemapping/mindplot';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; import NodeProperty from '../../../../classes/model/node-property';
/** /**
* emoji picker for editor toolbar * emoji picker for editor toolbar
*/ */
const IconPicker = (props: { closeModal: () => void; iconModel: NodePropertyValueModel }) => { const IconPicker = (props: { closeModal: () => void; iconModel: NodeProperty }) => {
const [value, setValue] = React.useState(0); const [value, setValue] = React.useState(0);
const handleChange = (event: React.SyntheticEvent, newValue: number) => { const handleChange = (event: React.SyntheticEvent, newValue: number) => {

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $msg } from '@wisemapping/mindplot'; import { $msg } from '@wisemapping/mindplot';
import React from 'react'; import React from 'react';

View File

@ -1,13 +1,30 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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 { $msg } from '@wisemapping/mindplot'; import { $msg } from '@wisemapping/mindplot';
import React from 'react'; import React from 'react';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; import NodeProperty from '../../../../classes/model/node-property';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined'; import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
const SaveAndDelete = (props: { const SaveAndDelete = (props: {
model: NodePropertyValueModel; model: NodeProperty;
closeModal: () => void; closeModal: () => void;
submitHandler: () => void; submitHandler: () => void;
}) => { }) => {

View File

@ -1,6 +1,23 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useState } from 'react'; import { useState } from 'react';
import { $msg } from '@wisemapping/mindplot'; import { $msg } from '@wisemapping/mindplot';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; 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';
import Input from '../../input'; import Input from '../../input';
@ -12,7 +29,7 @@ import OpenInNewOutlinedIcon from '@mui/icons-material/OpenInNewOutlined';
/** /**
* Url form for toolbar and node contextual editor * Url form for toolbar and node contextual editor
*/ */
const TopicLink = (props: { closeModal: () => void; urlModel: NodePropertyValueModel }) => { const TopicLink = (props: { closeModal: () => void; urlModel: NodeProperty }) => {
const [url, setUrl] = useState(props.urlModel.getValue()); const [url, setUrl] = useState(props.urlModel.getValue());
/** /**

View File

@ -1,14 +1,31 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import { $msg } from '@wisemapping/mindplot'; import { $msg } from '@wisemapping/mindplot';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder'; import NodeProperty from '../../../../classes/model/node-property';
import Input from '../../input'; import Input from '../../input';
import SaveAndDelete from '../save-and-delete'; import SaveAndDelete from '../save-and-delete';
/** /**
* Note form for toolbar and node contextual editor * Note form for toolbar and node contextual editor
*/ */
const TopicNote = (props: { closeModal: () => void; noteModel: NodePropertyValueModel | null }) => { const TopicNote = (props: { closeModal: () => void; noteModel: NodeProperty | null }) => {
const [note, setNote] = useState(props.noteModel.getValue()); const [note, setNote] = useState(props.noteModel.getValue());
const submitHandler = () => { const submitHandler = () => {

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'; import React from 'react';
import ActionConfig from '../../classes/action-config'; import ActionConfig from '../../classes/action-config';
import MaterialToolbar from '@mui/material/Toolbar'; import MaterialToolbar from '@mui/material/Toolbar';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Notifier } from './styled'; import { Notifier } from './styled';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import styled from 'styled-components'; import styled from 'styled-components';
import { times } from '../size'; import { times } from '../size';
import LogoTextBlackSvg from '../../../images/logo-text-black.svg'; import LogoTextBlackSvg from '../../../images/logo-text-black.svg';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import Popover from '@mui/material/Popover'; import Popover from '@mui/material/Popover';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useRef, useState } from 'react'; import React, { 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';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** /**
* Configure position of a toolbar * Configure position of a toolbar
*/ */

View File

@ -1,29 +1,9 @@
import { Designer } from '@wisemapping/mindplot';
export enum SwitchValueDirection { export enum SwitchValueDirection {
'up', 'up',
'down', 'down',
} }
const fontSizes = [6, 8, 10, 15]; export const fontSizes = [6, 8, 10, 15];
/**
* Interface to get and set a property of the mindplot selected node
*/
export interface NodePropertyValueModel {
/**
* get the property value
*/
getValue: () => any;
/**
* set the property value
*/
setValue?: (value: any) => void;
/**
* toogle boolean values or change for next/previous in reduced lists of values
*/
switchValue?: (direction?: SwitchValueDirection) => void;
}
/** /**
* Given an array and the current value it return the next posible value * Given an array and the current value it return the next posible value
@ -68,203 +48,3 @@ export function getTheUniqueValueOrNull(
} }
return result; return result;
} }
/**
* Given a designer build NodePropertyValueModel instances for the mindplot node properties
*/
export class NodePropertyValueModelBuilder {
designer: Designer;
fontSizeModel: NodePropertyValueModel;
selectedTopicColorModel: NodePropertyValueModel;
fontFamilyModel: NodePropertyValueModel;
fontStyleModel: NodePropertyValueModel;
borderColorModel: NodePropertyValueModel;
fontColorModel: NodePropertyValueModel;
topicShapeModel: NodePropertyValueModel;
topicIconModel: NodePropertyValueModel;
noteModel: NodePropertyValueModel;
linkModel: NodePropertyValueModel;
/**
*
* @param designer designer to change node properties values
*/
constructor(designer: Designer) {
this.designer = designer;
}
private selectedTopic() {
return designer.getModel().selectedTopic();
}
private getFontSize() {
return designer.getModel().selectedTopic()?.getFontSize();
}
private uniqueOrNull(propertyGetter: (Topic) => any | null) {
const nodes = designer.getModel().filterSelectedTopics();
return getTheUniqueValueOrNull(nodes, propertyGetter);
}
/**
*
* @returns model to and switch font weigth
*/
fontWeigthModel(): NodePropertyValueModel {
return {
getValue: () => designer.getModel().selectedTopic()?.getFontWeight(),
switchValue: () => designer.changeFontWeight(),
};
}
/**
*
* @returns model to and switch font size in both directions. Font sizes used to iterate: [6, 8, 10, 15]
*/
getFontSizeModel(): NodePropertyValueModel {
if (!this.fontSizeModel)
this.fontSizeModel = {
getValue: () => this.getFontSize(),
switchValue: (direction?) => {
let newValue = undefined;
if (direction === SwitchValueDirection.down) {
newValue = getPreviousValue(fontSizes, this.getFontSize());
}
if (direction === SwitchValueDirection.up) {
newValue = getNextValue(fontSizes, this.getFontSize());
}
designer.changeFontSize(newValue);
},
};
return this.fontSizeModel;
}
/**
*
* @returns model to get and set topic color
*/
getSelectedTopicColorModel(): NodePropertyValueModel {
if (!this.selectedTopicColorModel)
this.selectedTopicColorModel = {
getValue: () => designer.getModel().selectedTopic()?.getBackgroundColor(),
setValue: (color) => designer.changeBackgroundColor(color),
};
return this.selectedTopicColorModel;
}
/**
*
* @returns model to get and set the node link
*/
getLinkModel(): NodePropertyValueModel {
// const selected = this.selectedTopic();
if (!this.linkModel)
this.linkModel = {
getValue: (): string => this.selectedTopic()?.getLinkValue(),
setValue: (value: string) => {
if (value && value.trim() !== '') {
this.selectedTopic().setLinkValue(value);
} else {
this.selectedTopic().setLinkValue(undefined);
}
},
};
return this.linkModel;
}
/**
*
* @returns model to get and set topic border color
*/
getColorBorderModel(): NodePropertyValueModel {
if (!this.borderColorModel)
this.borderColorModel = {
getValue: () => this.uniqueOrNull((node) => node.getBorderColor()),
setValue: (hex: string) => designer.changeBorderColor(hex),
};
return this.borderColorModel;
}
/**
*
* @returns model to get and set topic font color
*/
getFontColorModel(): NodePropertyValueModel {
if (!this.fontColorModel)
this.fontColorModel = {
getValue: () => this.uniqueOrNull((node) => node.getFontColor()),
setValue: (hex: string) => designer.changeFontColor(hex),
};
return this.fontColorModel;
}
/**
*
* @returns model to get and set topic icon
*/
getTopicIconModel(): NodePropertyValueModel {
if (!this.topicIconModel)
this.topicIconModel = {
getValue: () => null,
setValue: (value: string) => designer.addIconType(value),
};
return this.topicIconModel;
}
/**
*
* @returns model to get and set topic note
*/
getNoteModel(): NodePropertyValueModel {
if (!this.noteModel)
this.noteModel = {
getValue: (): string => this.selectedTopic()?.getNoteValue(),
setValue: (value: string) => {
const note = value && value.trim() !== '' ? value : undefined;
this.selectedTopic()?.setNoteValue(note);
},
};
return this.noteModel;
}
/**
*
* @returns model to get and set topic font family
*/
getFontFamilyModel(): NodePropertyValueModel {
if (!this.fontFamilyModel)
this.fontFamilyModel = {
getValue: () => this.uniqueOrNull((node) => node.getFontFamily()),
setValue: (value: string) => designer.changeFontFamily(value),
};
return this.fontFamilyModel;
}
/**
*
* @returns model to get and switch topic style
*/
getFontStyleModel(): NodePropertyValueModel {
if (!this.fontStyleModel)
this.fontStyleModel = {
getValue: () => this.selectedTopic()?.getFontStyle(),
switchValue: () => designer.changeFontStyle(),
};
return this.fontStyleModel;
}
/**
*
* @returns model to get and set topic shape
*/
getTopicShapeModel(): NodePropertyValueModel {
if (!this.topicShapeModel)
this.topicShapeModel = {
getValue: () => this.uniqueOrNull((node) => node.getShapeType()),
setValue: (value: string) => designer.changeTopicShape(value),
};
return this.topicShapeModel;
}
}

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Toolbar from './Toolbar'; import Toolbar from './Toolbar';
import { horizontalPosition } from './ToolbarPositionInterface'; import { horizontalPosition } from './ToolbarPositionInterface';
import Header from '../app-bar'; import Header from '../app-bar';

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import styled from 'styled-components'; import styled from 'styled-components';
export const HeaderContainer = styled.div` export const HeaderContainer = styled.div`

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'; import React from 'react';
import BrushOutlinedIcon from '@mui/icons-material/BrushOutlined'; import BrushOutlinedIcon from '@mui/icons-material/BrushOutlined';
import FontDownloadOutlinedIcon from '@mui/icons-material/FontDownloadOutlined'; import FontDownloadOutlinedIcon from '@mui/icons-material/FontDownloadOutlined';
@ -35,7 +52,8 @@ import Palette from '@mui/icons-material/Square';
import SquareOutlined from '@mui/icons-material/SquareOutlined'; import SquareOutlined from '@mui/icons-material/SquareOutlined';
import { $msg, Designer } from '@wisemapping/mindplot'; import { $msg, Designer } from '@wisemapping/mindplot';
import ActionConfig from '../../classes/action-config'; import ActionConfig from '../../classes/action-config';
import { SwitchValueDirection, NodePropertyValueModelBuilder } from './ToolbarValueModelBuilder'; import { SwitchValueDirection } from './ToolbarValueModelBuilder';
import NodePropertyBuilder from '../../classes/model/node-property-builder';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { ToolbarActionType } from '.'; import { ToolbarActionType } from '.';
import KeyboardOutlined from '@mui/icons-material/KeyboardOutlined'; import KeyboardOutlined from '@mui/icons-material/KeyboardOutlined';
@ -59,7 +77,7 @@ export function buildToolbarCongiruation(designer: Designer): ActionConfig[] {
/** /**
* model builder * model builder
*/ */
const toolbarValueModelBuilder = new NodePropertyValueModelBuilder(designer); const toolbarValueModelBuilder = new NodePropertyBuilder(designer);
// <div id="rectagle" model="rectagle"><img src="${RectangleImage}" alt="Rectangle"></div> // <div id="rectagle" model="rectagle"><img src="${RectangleImage}" alt="Rectangle"></div>
// <div id="rounded_rectagle" model="rounded rectagle" ><img src="${RectangleRoundImage}" alt="Rounded Rectangle"></div> // <div id="rounded_rectagle" model="rounded rectagle" ><img src="${RectangleRoundImage}" alt="Rounded Rectangle"></div>

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react'; import React from 'react';
import { import {

View File

@ -1,3 +1,20 @@
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { createTheme, Theme } from '@mui/material/styles'; import { createTheme, Theme } from '@mui/material/styles';
const theme: Theme = createTheme({ const theme: Theme = createTheme({