mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Add missing copyright headers.
This commit is contained in:
parent
99cec1bd54
commit
54ed067288
@ -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.
|
||||
* One of these properties must be set: onClick, render or options.
|
||||
|
@ -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 {
|
||||
WidgetManager,
|
||||
|
@ -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 TopicLink from '../../components/action-widget/pane/topic-link';
|
||||
import TopicNote from '../../components/action-widget/pane/topic-note';
|
||||
|
@ -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 ES from './../../compiled-lang/es.json';
|
||||
import EN from './../../compiled-lang/en.json';
|
||||
|
211
packages/editor/src/classes/model/node-property-builder/index.ts
Normal file
211
packages/editor/src/classes/model/node-property-builder/index.ts
Normal 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;
|
21
packages/editor/src/classes/model/node-property/index.ts
Normal file
21
packages/editor/src/classes/model/node-property/index.ts
Normal 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;
|
@ -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 Box from '@mui/material/Box';
|
||||
import FormControl from '@mui/material/FormControl';
|
||||
@ -5,12 +22,12 @@ import MenuItem from '@mui/material/MenuItem';
|
||||
import Select, { SelectChangeEvent } from '@mui/material/Select';
|
||||
import Typography from '@mui/material/Typography';
|
||||
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
|
||||
/**
|
||||
* 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 handleChange = (event: SelectChangeEvent) => {
|
||||
|
@ -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 ActionConfig from '../../../../classes/action-config';
|
||||
import { ToolbarMenuItem } from '../../../toolbar/Toolbar';
|
||||
|
@ -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 DesignerKeyboard from '@wisemapping/mindplot/src/components/DesignerKeyboard';
|
||||
import React, { useEffect } from 'react';
|
||||
|
@ -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 React from 'react';
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import { CirclePicker as ReactColorPicker } from 'react-color';
|
||||
import colors from './colors.json';
|
||||
|
||||
/**
|
||||
* Color picker for toolbar
|
||||
*/
|
||||
const ColorPicker = (props: { closeModal: () => void; colorModel: NodePropertyValueModel }) => {
|
||||
const ColorPicker = (props: { closeModal: () => void; colorModel: NodeProperty }) => {
|
||||
return (
|
||||
<Box component="div" sx={{ m: 2 }}>
|
||||
<ReactColorPicker
|
||||
|
@ -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 Tab from '@mui/material/Tab';
|
||||
import Tabs from '@mui/material/Tabs';
|
||||
import React from 'react';
|
||||
import iconGroups from './iconGroups.json';
|
||||
import { ImageIcon } from '@wisemapping/mindplot';
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
|
||||
/**
|
||||
* 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 handleChange = (event: React.SyntheticEvent, newValue: number) => {
|
||||
|
@ -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 React from 'react';
|
||||
|
||||
|
@ -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 Button from '@mui/material/Button';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import { $msg } from '@wisemapping/mindplot';
|
||||
import React from 'react';
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
|
||||
|
||||
const SaveAndDelete = (props: {
|
||||
model: NodePropertyValueModel;
|
||||
model: NodeProperty;
|
||||
closeModal: () => void;
|
||||
submitHandler: () => void;
|
||||
}) => {
|
||||
|
@ -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 { $msg } from '@wisemapping/mindplot';
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import Box from '@mui/material/Box';
|
||||
import React from 'react';
|
||||
import Input from '../../input';
|
||||
@ -12,7 +29,7 @@ import OpenInNewOutlinedIcon from '@mui/icons-material/OpenInNewOutlined';
|
||||
/**
|
||||
* 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());
|
||||
|
||||
/**
|
||||
|
@ -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 { $msg } from '@wisemapping/mindplot';
|
||||
import React, { useState } from 'react';
|
||||
import { NodePropertyValueModel } from '../../../toolbar/ToolbarValueModelBuilder';
|
||||
import NodeProperty from '../../../../classes/model/node-property';
|
||||
import Input from '../../input';
|
||||
import SaveAndDelete from '../save-and-delete';
|
||||
|
||||
/**
|
||||
* 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 submitHandler = () => {
|
||||
|
@ -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 ActionConfig from '../../classes/action-config';
|
||||
import MaterialToolbar from '@mui/material/Toolbar';
|
||||
|
@ -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 { Notifier } from './styled';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
@ -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 { times } from '../size';
|
||||
import LogoTextBlackSvg from '../../../images/logo-text-black.svg';
|
||||
|
@ -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 Popover from '@mui/material/Popover';
|
||||
|
||||
|
@ -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 AppBar from '@mui/material/AppBar';
|
||||
import Divider from '@mui/material/Divider';
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -1,29 +1,9 @@
|
||||
import { Designer } from '@wisemapping/mindplot';
|
||||
|
||||
export enum SwitchValueDirection {
|
||||
'up',
|
||||
'down',
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
export const fontSizes = [6, 8, 10, 15];
|
||||
|
||||
/**
|
||||
* Given an array and the current value it return the next posible value
|
||||
@ -68,203 +48,3 @@ export function getTheUniqueValueOrNull(
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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 { horizontalPosition } from './ToolbarPositionInterface';
|
||||
import Header from '../app-bar';
|
||||
|
@ -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';
|
||||
|
||||
export const HeaderContainer = styled.div`
|
||||
|
@ -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 BrushOutlinedIcon from '@mui/icons-material/BrushOutlined';
|
||||
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 { $msg, Designer } from '@wisemapping/mindplot';
|
||||
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 { ToolbarActionType } from '.';
|
||||
import KeyboardOutlined from '@mui/icons-material/KeyboardOutlined';
|
||||
@ -59,7 +77,7 @@ export function buildToolbarCongiruation(designer: Designer): ActionConfig[] {
|
||||
/**
|
||||
* 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="rounded_rectagle" model="rounded rectagle" ><img src="${RectangleRoundImage}" alt="Rounded Rectangle"></div>
|
||||
|
@ -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 {
|
||||
|
@ -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';
|
||||
|
||||
const theme: Theme = createTheme({
|
||||
|
Loading…
Reference in New Issue
Block a user