Keep class migration

This commit is contained in:
Paulo Gustavo Veiga 2021-12-03 16:11:17 -08:00
parent a95dc597f9
commit 025e4714e9
79 changed files with 2203 additions and 19766 deletions

View File

@ -1,4 +1,4 @@
/* eslint-disable no-unused-vars */ /* eslint-disable class-methods-use-this */
/* /*
* Copyright [2015] [wisemapping] * Copyright [2015] [wisemapping]
* *
@ -19,89 +19,88 @@
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import Events from './Events'; import Events from './Events';
// noinspection JSUnusedLocalSymbols class ActionDispatcher extends Events {
const ActionDispatcher = new Class({ constructor(commandContext) {
Implements: [Events],
initialize(commandContext) {
$assert(commandContext, 'commandContext can not be null'); $assert(commandContext, 'commandContext can not be null');
}, super();
}
addRelationship(model, mindmap) { addRelationship(model, mindmap) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
addTopics(models, parentTopicId) { addTopics(models, parentTopicId) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
deleteEntities(topicsIds, relIds) { deleteEntities(topicsIds, relIds) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
dragTopic(topicId, position, order, parentTopic) { dragTopic(topicId, position, order, parentTopic) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
moveTopic(topicId, position) { moveTopic(topicId, position) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
moveControlPoint(ctrlPoint, point) { moveControlPoint(ctrlPoint, point) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFontFamilyToTopic(topicIds, fontFamily) { changeFontFamilyToTopic(topicIds, fontFamily) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFontStyleToTopic(topicsIds) { changeFontStyleToTopic(topicsIds) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFontColorToTopic(topicsIds, color) { changeFontColorToTopic(topicsIds, color) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFontSizeToTopic(topicsIds, size) { changeFontSizeToTopic(topicsIds, size) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeBackgroundColorToTopic(topicsIds, color) { changeBackgroundColorToTopic(topicsIds, color) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeBorderColorToTopic(topicsIds, color) { changeBorderColorToTopic(topicsIds, color) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeShapeTypeToTopic(topicsIds, shapeType) { changeShapeTypeToTopic(topicsIds, shapeType) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFontWeightToTopic(topicsIds) { changeFontWeightToTopic(topicsIds) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeTextToTopic(topicsIds, text) { changeTextToTopic(topicsIds, text) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
shrinkBranch(topicsIds, collapse) { shrinkBranch(topicsIds, collapse) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
addFeatureToTopic(topicId, type, attributes) { addFeatureToTopic(topicId, type, attributes) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
changeFeatureToTopic(topicId, featureId, attributes) { changeFeatureToTopic(topicId, featureId, attributes) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
removeFeatureFromTopic(topicId, featureId) { removeFeatureFromTopic(topicId, featureId) {
throw new Error('method must be implemented.'); throw new Error('method must be implemented.');
}, }
}); }
ActionDispatcher.setInstance = (dispatcher) => { ActionDispatcher.setInstance = (dispatcher) => {
ActionDispatcher._instance = dispatcher; ActionDispatcher._instance = dispatcher;

View File

@ -0,0 +1,115 @@
/*
* Copyright [2015] [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 { $assert } from "@wisemapping/core-js";
class CommandContext {
constructor(designer) {
$assert(designer, 'designer can not be null');
this._designer = designer;
}
/** */
findTopics(topicsIds) {
$assert($defined(topicsIds), 'topicsIds can not be null');
if (!(topicsIds instanceof Array)) {
topicsIds = [topicsIds];
}
const designerTopics = this._designer.getModel().getTopics();
const result = designerTopics.filter((topic) => topicsIds.contains(topic.getId()));
if (result.length !== topicsIds.length) {
const ids = designerTopics.map((topic) => topic.getId());
$assert(
result.length === topicsIds.length,
`Could not find topic. Result:${result
} Filter Criteria:${topicsIds
} Current Topics: [${ids
}]`,
);
}
return result;
}
/** */
deleteTopic(topic) {
this._designer.removeTopic(topic);
}
/** */
createTopic(model) {
$assert(model, 'model can not be null');
return this._designer.nodeModelToNodeGraph(model);
}
/** */
createModel() {
const mindmap = this._designer.getMindmap();
return mindmap.createNode(NodeModel.MAIN_TOPIC_TYPE);
}
/** */
addTopic(topic) {
const mindmap = this._designer.getMindmap();
return mindmap.addBranch(topic.getModel());
}
/** */
connect(childTopic, parentTopic) {
childTopic.connectTo(parentTopic, this._designer._workspace);
}
/** */
disconnect(topic) {
topic.disconnect(this._designer._workspace);
}
/** */
addRelationship(model) {
$assert(model, 'model cannot be null');
return this._designer.addRelationship(model);
}
/** */
deleteRelationship(relationship) {
this._designer.deleteRelationship(relationship);
}
/** */
findRelationships(relIds) {
$assert($defined(relIds), 'relId can not be null');
if (!(relIds instanceof Array)) {
relIds = [relIds];
}
const designerRel = this._designer.getModel().getRelationships();
return designerRel.filter((rel) => relIds.contains(rel.getId()));
}
/** */
moveTopic(topic, position) {
$assert(topic, 'topic cannot be null');
$assert(position, 'position cannot be null');
EventBus.instance.fireEvent(EventBus.events.NodeMoveEvent, {
node: topic.getModel(),
position,
});
}
}
// eslint-disable-next-line import/prefer-default-export
export default CommandContext;

View File

@ -15,12 +15,15 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import $ from '@libraries/jquery-2.1.0';
import _ from '@libraries/underscore-min';
import Events from './Events'; import Events from './Events';
import Messages from './Messages'; import Messages from './Messages';
import StandaloneActionDispatcher from './StandaloneActionDispatcher';
import { StandaloneActionDispatcher, CommandContext } from './StandaloneActionDispatcher'; import CommandContext from './CommandContext';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';
import DesignerModel from './DesignerModel'; import DesignerModel from './DesignerModel';
@ -45,20 +48,13 @@ import LayoutManager from './layout/LayoutManager';
import INodeModel, { TopicShape } from './model/INodeModel'; import INodeModel, { TopicShape } from './model/INodeModel';
const Designer = new Class( class Designer extends Events {
/** @lends Designer */ { constructor(options, divElement) {
Extends: Events,
/**
* @constructs
* @param {Object} options
* @param {HTMLElement} divElement
* @extends mindplot.Events
*/
initialize(options, divElement) {
$assert(options, 'options must be defined'); $assert(options, 'options must be defined');
$assert(options.zoom, 'zoom must be defined'); $assert(options.zoom, 'zoom must be defined');
$assert(options.size, 'size must be defined'); $assert(options.size, 'size must be defined');
$assert(divElement, 'divElement must be defined'); $assert(divElement, 'divElement must be defined');
super();
// Set up i18n location ... // Set up i18n location ...
Messages.init(options.locale); Messages.init(options.locale);
@ -106,7 +102,7 @@ const Designer = new Class(
TopicEventDispatcher.configure(this.isReadOnly()); TopicEventDispatcher.configure(this.isReadOnly());
this._clipboard = []; this._clipboard = [];
}, }
/** /**
* @private * @private
@ -123,7 +119,7 @@ const Designer = new Class(
} }
event.preventDefault(); event.preventDefault();
}); });
}, }
/** /**
* @param {String} type the event type * @param {String} type the event type
@ -135,9 +131,9 @@ const Designer = new Class(
const editor = TopicEventDispatcher.getInstance(); const editor = TopicEventDispatcher.getInstance();
editor.addEvent(type, listener); editor.addEvent(type, listener);
} else { } else {
this.parent(type, listener); super.addEvent(type, listener);
}
} }
},
/** /**
* @private * @private
@ -178,7 +174,7 @@ const Designer = new Class(
evt.stopPropagation(); evt.stopPropagation();
evt.preventDefault(); evt.preventDefault();
} }
}, }
/** /**
* @private * @private
@ -219,7 +215,7 @@ const Designer = new Class(
}); });
return dragManager; return dragManager;
}, }
/** /**
* @param {{width:Number, height:Number}} size * @param {{width:Number, height:Number}} size
@ -229,7 +225,7 @@ const Designer = new Class(
this._workspace.setViewPort(size); this._workspace.setViewPort(size);
const model = this.getModel(); const model = this.getModel();
this._workspace.setZoom(model.getZoom(), true); this._workspace.setZoom(model.getZoom(), true);
}, }
/** /**
* @private * @private
@ -297,7 +293,7 @@ const Designer = new Class(
}); });
return topic; return topic;
}, }
/** /**
* @param {?mindplot.Topic} currentObject * @param {?mindplot.Topic} currentObject
@ -322,7 +318,7 @@ const Designer = new Class(
} }
} }
}); });
}, }
/** sets focus to all model entities, i.e. relationships and topics */ /** sets focus to all model entities, i.e. relationships and topics */
selectAll() { selectAll() {
@ -331,7 +327,7 @@ const Designer = new Class(
_.each(objects, (object) => { _.each(objects, (object) => {
object.setOnFocus(true); object.setOnFocus(true);
}); });
}, }
/** removes focus from all model entities, i.e. relationships and topics */ /** removes focus from all model entities, i.e. relationships and topics */
deselectAll() { deselectAll() {
@ -339,7 +335,7 @@ const Designer = new Class(
_.each(objects, (object) => { _.each(objects, (object) => {
object.setOnFocus(false); object.setOnFocus(false);
}); });
}, }
/** /**
* Set the zoom of the map * Set the zoom of the map
@ -352,7 +348,7 @@ const Designer = new Class(
} }
this.getModel().setZoom(zoom); this.getModel().setZoom(zoom);
this._workspace.setZoom(zoom); this._workspace.setZoom(zoom);
}, }
/** /**
* @param {Number=} factor * @param {Number=} factor
@ -371,7 +367,7 @@ const Designer = new Class(
} else { } else {
$notify($msg('ZOOM_ERROR')); $notify($msg('ZOOM_ERROR'));
} }
}, }
/** /**
* @param {Number=} factor * @param {Number=} factor
@ -389,7 +385,7 @@ const Designer = new Class(
} else { } else {
$notify($msg('ZOOM_ERROR')); $notify($msg('ZOOM_ERROR'));
} }
}, }
/** copy selected topics to a private clipboard */ /** copy selected topics to a private clipboard */
copyToClipboard() { copyToClipboard() {
@ -414,7 +410,7 @@ const Designer = new Class(
}); });
$notify($msg('SELECTION_COPIED_TO_CLIPBOARD')); $notify($msg('SELECTION_COPIED_TO_CLIPBOARD'));
}, }
/** paste clipboard contents to the mindmap */ /** paste clipboard contents to the mindmap */
pasteClipboard() { pasteClipboard() {
@ -424,12 +420,12 @@ const Designer = new Class(
} }
this._actionDispatcher.addTopics(this._clipboard); this._actionDispatcher.addTopics(this._clipboard);
this._clipboard = []; this._clipboard = [];
}, }
/** @return {mindplot.DesignerModel} model */ /** @return {mindplot.DesignerModel} model */
getModel() { getModel() {
return this._model; return this._model;
}, }
/** collapse the subtree of the selected topic */ /** collapse the subtree of the selected topic */
shrinkSelectedBranch() { shrinkSelectedBranch() {
@ -444,7 +440,7 @@ const Designer = new Class(
if (topic.getType() !== INodeModel.CENTRAL_TOPIC_TYPE) { if (topic.getType() !== INodeModel.CENTRAL_TOPIC_TYPE) {
this._actionDispatcher.shrinkBranch([topic.getId()], !topic.areChildrenShrunken()); this._actionDispatcher.shrinkBranch([topic.getId()], !topic.areChildrenShrunken());
} }
}, }
/** create a NodeModel for the selected node's child and add it via the ActionDispatcher */ /** create a NodeModel for the selected node's child and add it via the ActionDispatcher */
createChildForSelectedNode() { createChildForSelectedNode() {
@ -467,7 +463,7 @@ const Designer = new Class(
// Execute event ... // Execute event ...
this._actionDispatcher.addTopics([childModel], [parentTopicId]); this._actionDispatcher.addTopics([childModel], [parentTopicId]);
}, }
/** /**
* @private * @private
@ -515,7 +511,7 @@ const Designer = new Class(
if (backgroundColor) { if (backgroundColor) {
targetModel.setBackgroundColor(backgroundColor); targetModel.setBackgroundColor(backgroundColor);
} }
}, }
/** /**
* @private * @private
@ -540,13 +536,8 @@ const Designer = new Class(
this._copyNodeProps(parentModel, childModel); this._copyNodeProps(parentModel, childModel);
return childModel; return childModel;
}, }
/**
* @param {Events} event
* @param {mindplot.model.NodeModel} model
* @todo not used
*/
addDraggedNode(event, model) { addDraggedNode(event, model) {
$assert(event, 'event can not be null'); $assert(event, 'event can not be null');
$assert(model, 'model can not be null'); $assert(model, 'model can not be null');
@ -559,7 +550,7 @@ const Designer = new Class(
// Simulate a mouse down event to start the dragging ... // Simulate a mouse down event to start the dragging ...
topic.fireEvent('mousedown', event); topic.fireEvent('mousedown', event);
}, }
/** /**
* creates a sibling or child node of the selected node, if the selected node is the * creates a sibling or child node of the selected node, if the selected node is the
@ -596,7 +587,7 @@ const Designer = new Class(
const parentTopicId = parentTopic.getId(); const parentTopicId = parentTopic.getId();
this._actionDispatcher.addTopics([siblingModel], [parentTopicId]); this._actionDispatcher.addTopics([siblingModel], [parentTopicId]);
} }
}, }
/** /**
* @private * @private
@ -622,7 +613,7 @@ const Designer = new Class(
this._copyNodeProps(model, result); this._copyNodeProps(model, result);
return result; return result;
}, }
/** /**
* @param {Event} event * @param {Event} event
@ -641,13 +632,13 @@ const Designer = new Class(
// create a connection ... // create a connection ...
this._relPivot.start(nodes[0], pos); this._relPivot.start(nodes[0], pos);
}, }
/** @return {{zoom:Number}} the zoom */ /** @return {{zoom:Number}} the zoom */
getMindmapProperties() { getMindmapProperties() {
const model = this.getModel(); const model = this.getModel();
return { zoom: model.getZoom() }; return { zoom: model.getZoom() };
}, }
/** /**
* @param {mindplot.Mindmap} mindmapModel * @param {mindplot.Mindmap} mindmapModel
@ -693,28 +684,28 @@ const Designer = new Class(
EventBus.instance.fireEvent(EventBus.events.DoLayout); EventBus.instance.fireEvent(EventBus.events.DoLayout);
this.fireEvent('loadSuccess'); this.fireEvent('loadSuccess');
}, }
/** */ /** */
getMindmap() { getMindmap() {
return this._mindmap; return this._mindmap;
}, }
/** */ /** */
undo() { undo() {
// @Todo: This is a hack... // @Todo: This is a hack...
this._actionDispatcher._actionRunner.undo(); this._actionDispatcher._actionRunner.undo();
}, }
/** */ /** */
redo() { redo() {
this._actionDispatcher._actionRunner.redo(); this._actionDispatcher._actionRunner.redo();
}, }
/** */ /** */
isReadOnly() { isReadOnly() {
return this._options.readOnly; return this._options.readOnly;
}, }
/** /**
* @param {mindplot.model.NodeModel} nodeModel * @param {mindplot.model.NodeModel} nodeModel
@ -735,7 +726,7 @@ const Designer = new Class(
} }
return nodeGraph; return nodeGraph;
}, }
/** /**
* @private * @private
@ -758,7 +749,7 @@ const Designer = new Class(
this._workspace.append(result); this._workspace.append(result);
return result; return result;
}, }
/** /**
* @param {mindplot.model.RelationshipModel} model * @param {mindplot.model.RelationshipModel} model
@ -768,7 +759,7 @@ const Designer = new Class(
const mindmap = this.getMindmap(); const mindmap = this.getMindmap();
mindmap.addRelationship(model); mindmap.addRelationship(model);
return this._relationshipModelToRelationship(model); return this._relationshipModelToRelationship(model);
}, }
/** /**
* deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap * deletes the relationship from the linked topics, DesignerModel, Workspace and Mindmap
@ -786,7 +777,7 @@ const Designer = new Class(
const mindmap = this.getMindmap(); const mindmap = this.getMindmap();
mindmap.deleteRelationship(rel.getModel()); mindmap.deleteRelationship(rel.getModel());
}, }
/** /**
* @private * @private
@ -835,7 +826,7 @@ const Designer = new Class(
dmodel.addRelationship(result); dmodel.addRelationship(result);
return result; return result;
}, }
/** /**
* @param {mindplot.Topic} node the topic to remove * @param {mindplot.Topic} node the topic to remove
@ -862,7 +853,7 @@ const Designer = new Class(
this.goToNode(parent); this.goToNode(parent);
} }
} }
}, }
/** /**
* @private * @private
@ -872,7 +863,7 @@ const Designer = new Class(
screenManager.fireEvent('update'); screenManager.fireEvent('update');
screenManager.fireEvent('mouseup'); screenManager.fireEvent('mouseup');
this._relPivot.dispose(); this._relPivot.dispose();
}, }
/** */ /** */
deleteSelectedEntities() { deleteSelectedEntities() {
@ -902,7 +893,7 @@ const Designer = new Class(
if (topicIds.length > 0 || relIds.length > 0) { if (topicIds.length > 0 || relIds.length > 0) {
this._actionDispatcher.deleteEntities(topicIds, relIds); this._actionDispatcher.deleteEntities(topicIds, relIds);
} }
}, }
/** */ /** */
changeFontFamily(font) { changeFontFamily(font) {
@ -910,7 +901,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontFamilyToTopic(topicsIds, font); this._actionDispatcher.changeFontFamilyToTopic(topicsIds, font);
} }
}, }
/** */ /** */
changeFontStyle() { changeFontStyle() {
@ -918,7 +909,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontStyleToTopic(topicsIds); this._actionDispatcher.changeFontStyleToTopic(topicsIds);
} }
}, }
/** */ /** */
changeFontColor(color) { changeFontColor(color) {
@ -928,7 +919,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontColorToTopic(topicsIds, color); this._actionDispatcher.changeFontColorToTopic(topicsIds, color);
} }
}, }
/** */ /** */
changeBackgroundColor(color) { changeBackgroundColor(color) {
@ -939,7 +930,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeBackgroundColorToTopic(topicsIds, color); this._actionDispatcher.changeBackgroundColorToTopic(topicsIds, color);
} }
}, }
/** */ /** */
changeBorderColor(color) { changeBorderColor(color) {
@ -949,7 +940,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeBorderColorToTopic(topicsIds, color); this._actionDispatcher.changeBorderColorToTopic(topicsIds, color);
} }
}, }
/** */ /** */
changeFontSize(size) { changeFontSize(size) {
@ -957,7 +948,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size); this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);
} }
}, }
/** */ /** */
changeTopicShape(shape) { changeTopicShape(shape) {
@ -969,7 +960,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeShapeTypeToTopic(topicsIds, shape); this._actionDispatcher.changeShapeTypeToTopic(topicsIds, shape);
} }
}, }
/** */ /** */
changeFontWeight() { changeFontWeight() {
@ -977,7 +968,7 @@ const Designer = new Class(
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontWeightToTopic(topicsIds); this._actionDispatcher.changeFontWeightToTopic(topicsIds);
} }
}, }
/** */ /** */
addIconType(iconType) { addIconType(iconType) {
@ -987,7 +978,7 @@ const Designer = new Class(
id: iconType, id: iconType,
}); });
} }
}, }
/** /**
* lets the selected topic open the link editor where the user can define or modify an * lets the selected topic open the link editor where the user can define or modify an
@ -1000,7 +991,7 @@ const Designer = new Class(
topic.showLinkEditor(); topic.showLinkEditor();
this.onObjectFocusEvent(); this.onObjectFocusEvent();
} }
}, }
/** */ /** */
addNote() { addNote() {
@ -1010,7 +1001,7 @@ const Designer = new Class(
topic.showNoteEditor(); topic.showNoteEditor();
this.onObjectFocusEvent(); this.onObjectFocusEvent();
} }
}, }
/** /**
* @param {mindplot.Topic} node * @param {mindplot.Topic} node
@ -1019,13 +1010,12 @@ const Designer = new Class(
goToNode(node) { goToNode(node) {
node.setOnFocus(true); node.setOnFocus(true);
this.onObjectFocusEvent(node); this.onObjectFocusEvent(node);
}, }
/** @return {mindplot.Workspace} */ /** @return {mindplot.Workspace} */
getWorkSpace() { getWorkSpace() {
return this._workspace; return this._workspace;
}, }
}, }
);
export default Designer; export default Designer;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import Keyboard from './Keyboard'; import Keyboard from './Keyboard';
const DesignerKeyboard = new Class({ const DesignerKeyboard = new Class({

View File

@ -15,51 +15,42 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import Events from './Events'; import Events from './Events';
const DesignerModel = new Class(/** @lends DesignerModel */{ class DesignerModel extends Events {
Implements: [Events], constructor(options) {
/** super();
* @implements {mindplot.Events}
* @constructs
* @param {{readOnly: Boolean, zoom: Number, saveOnLoad: Boolean, size: {width: Number,
* height: Number}, viewPort: {width: Number, height: Number}, container: String,
* persistenceManager: String, mapId: String, locale: String}} options
* options loaded from json config
* @see {@link ConfigParameters.md}
* @see {@link editor.html}
*/
initialize(options) {
this._zoom = options.zoom; this._zoom = options.zoom;
this._topics = []; this._topics = [];
this._relationships = []; this._relationships = [];
}, }
/** @return {Number} zoom between 0.3 (largest text) and 1.9 */ /** @return {Number} zoom between 0.3 (largest text) and 1.9 */
getZoom() { getZoom() {
return this._zoom; return this._zoom;
}, }
/** @param {Number} zoom number between 0.3 and 1.9 to set the zoom to */ /** @param {Number} zoom number between 0.3 and 1.9 to set the zoom to */
setZoom(zoom) { setZoom(zoom) {
this._zoom = zoom; this._zoom = zoom;
}, }
/** @return {@link mindplot.Topic[]} all topics */ /** @return {@link mindplot.Topic[]} all topics */
getTopics() { getTopics() {
return this._topics; return this._topics;
}, }
/** @return {mindplot.Relationship[]} all relationships */ /** @return {mindplot.Relationship[]} all relationships */
getRelationships() { getRelationships() {
return this._relationships; return this._relationships;
}, }
/** @return {mindplot.CentralTopic} the central topic */ /** @return {mindplot.CentralTopic} the central topic */
getCentralTopic() { getCentralTopic() {
const topics = this.getTopics(); const topics = this.getTopics();
return topics[0]; return topics[0];
}, }
/** @return {mindplot.Topic[]} selected topics */ /** @return {mindplot.Topic[]} selected topics */
filterSelectedTopics() { filterSelectedTopics() {
@ -70,7 +61,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
} }
} }
return result; return result;
}, }
/** /**
* @return {mindplot.Relationship[]} selected relationships * @return {mindplot.Relationship[]} selected relationships
@ -83,7 +74,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
} }
} }
return result; return result;
}, }
/** /**
* @return {Array.<mindplot.Relationship, mindplot.Topic>} all topics and relationships * @return {Array.<mindplot.Relationship, mindplot.Topic>} all topics and relationships
@ -92,7 +83,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
const result = [].append(this._topics); const result = [].append(this._topics);
result.append(this._relationships); result.append(this._relationships);
return result; return result;
}, }
/** /**
* removes occurrences of the given topic from the topic array * removes occurrences of the given topic from the topic array
@ -101,7 +92,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
removeTopic(topic) { removeTopic(topic) {
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
this._topics.erase(topic); this._topics.erase(topic);
}, }
/** /**
* removes occurrences of the given relationship from the relationship array * removes occurrences of the given relationship from the relationship array
@ -110,7 +101,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
removeRelationship(rel) { removeRelationship(rel) {
$assert(rel, 'rel can not be null'); $assert(rel, 'rel can not be null');
this._relationships.erase(rel); this._relationships.erase(rel);
}, }
/** /**
* adds the given topic to the topic array * adds the given topic to the topic array
@ -122,7 +113,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
$assert(typeof topic.getId() === 'number', `id is not a number:${topic.getId()}`); $assert(typeof topic.getId() === 'number', `id is not a number:${topic.getId()}`);
this._topics.push(topic); this._topics.push(topic);
}, }
/** /**
* adds the given relationship to the relationship array * adds the given relationship to the relationship array
@ -132,7 +123,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
addRelationship(rel) { addRelationship(rel) {
$assert(rel, 'rel can not be null'); $assert(rel, 'rel can not be null');
this._relationships.push(rel); this._relationships.push(rel);
}, }
/** /**
* @param {Function=} validate a function to validate nodes * @param {Function=} validate a function to validate nodes
@ -158,7 +149,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
} }
} }
return result; return result;
}, }
/** /**
* @return {mindplot.Topic} the first selected topic if one or more are found by the * @return {mindplot.Topic} the first selected topic if one or more are found by the
@ -167,7 +158,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
selectedTopic() { selectedTopic() {
const topics = this.filterSelectedTopics(); const topics = this.filterSelectedTopics();
return (topics.length > 0) ? topics[0] : null; return (topics.length > 0) ? topics[0] : null;
}, }
/** /**
* @param {String} id the id of the topic to be retrieved * @param {String} id the id of the topic to be retrieved
@ -177,13 +168,13 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
let result = null; let result = null;
for (let i = 0; i < this._topics.length; i++) { for (let i = 0; i < this._topics.length; i++) {
const topic = this._topics[i]; const topic = this._topics[i];
if (topic.getId() == id) { if (topic.getId() === id) {
result = topic; result = topic;
break; break;
} }
} }
return result; return result;
}, }
}); }
export default DesignerModel; export default DesignerModel;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
const DesignerUndoManager = new Class({ const DesignerUndoManager = new Class({
initialize(fireChange) { initialize(fireChange) {

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
const DragConnector = new Class({ const DragConnector = new Class({
initialize(designerModel, workspace) { initialize(designerModel, workspace) {
$assert(designerModel, 'designerModel can not be null'); $assert(designerModel, 'designerModel can not be null');

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import DragTopic from './DragTopic'; import DragTopic from './DragTopic';
const DragManager = new Class({ const DragManager = new Class({

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import DragTopicConfig from './DragTopicConfig'; import DragTopicConfig from './DragTopicConfig';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';

View File

@ -1,20 +1,41 @@
const Events = new Class({ /*
$events: {}, * Copyright [2015] [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 _ from '@libraries/underscore-min';
_removeOn(string) { class Events {
constructor() {
this.$events = {};
}
static _removeOn(string) {
return string.replace(/^on([A-Z])/, (full, first) => first.toLowerCase()); return string.replace(/^on([A-Z])/, (full, first) => first.toLowerCase());
}, }
addEvent(type, fn, internal) { addEvent(type, fn, internal) {
type = this._removeOn(type); type = Events._removeOn(type);
this.$events[type] = (this.$events[type] || []).include(fn); this.$events[type] = (this.$events[type] || []).include(fn);
if (internal) fn.internal = true; if (internal) fn.internal = true;
return this; return this;
}, }
fireEvent(type, args, delay) { fireEvent(type, args, delay) {
type = this._removeOn(type); type = Events._removeOn(type);
const events = this.$events[type]; const events = this.$events[type];
if (!events) return this; if (!events) return this;
args = Array.isArray(args) ? args : [args]; args = Array.isArray(args) ? args : [args];
@ -27,17 +48,17 @@ const Events = new Class({
this, this,
); );
return this; return this;
}, }
removeEvent(type, fn) { removeEvent(type, fn) {
type = this._removeOn(type); type = Events._removeOn(type);
const events = this.$events[type]; const events = this.$events[type];
if (events && !fn.internal) { if (events && !fn.internal) {
const index = events.indexOf(fn); const index = events.indexOf(fn);
if (index != -1) events.splice(index, 1); if (index !== -1) events.splice(index, 1);
} }
return this; return this;
}, }
}); }
export default Events; export default Events;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import Icon from './Icon'; import Icon from './Icon';

View File

@ -16,11 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
const Keyboard = new Class({ class Keyboard {
// eslint-disable-next-line class-methods-use-this
initialize() {
},
addShortcut(shortcuts, callback) { addShortcut(shortcuts, callback) {
if (!$.isArray(shortcuts)) { if (!$.isArray(shortcuts)) {
shortcuts = [shortcuts]; shortcuts = [shortcuts];
@ -28,8 +25,7 @@ const Keyboard = new Class({
_.each(shortcuts, (shortcut) => { _.each(shortcuts, (shortcut) => {
$(document).bind('keydown', shortcut, callback); $(document).bind('keydown', shortcut, callback);
}); });
}, }
}
});
export default Keyboard; export default Keyboard;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import Icon from './Icon'; import Icon from './Icon';
import LinkIconTooltip from './widget/LinkIconTooltip'; import LinkIconTooltip from './widget/LinkIconTooltip';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import Topic from './Topic'; import Topic from './Topic';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import TopicConfig from './TopicConfig'; import TopicConfig from './TopicConfig';
import DragTopic from './DragTopic'; import DragTopic from './DragTopic';

View File

@ -1,3 +1,5 @@
import { $assert } from '@wisemapping/core-js';
import CentralTopic from './CentralTopic'; import CentralTopic from './CentralTopic';
import MainTopic from './MainTopic'; import MainTopic from './MainTopic';
import INodeModel from './model/INodeModel'; import INodeModel from './model/INodeModel';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import Icon from './Icon'; import Icon from './Icon';
import FloatingTip from './widget/FloatingTip'; import FloatingTip from './widget/FloatingTip';

View File

@ -16,6 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import { $assert, $defined } from '@wisemapping/core-js';
import ConnectionLine from './ConnectionLine'; import ConnectionLine from './ConnectionLine';
import ControlPoint from './ControlPoint'; import ControlPoint from './ControlPoint';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import PersistenceManager from './PersistenceManager'; import PersistenceManager from './PersistenceManager';
const RESTPersistenceManager = new Class({ const RESTPersistenceManager = new Class({

View File

@ -30,42 +30,35 @@ import ChangeFeatureToTopicCommand from './commands/ChangeFeatureToTopicCommand'
import NodeModel from './model/NodeModel'; import NodeModel from './model/NodeModel';
import EventBus from './layout/EventBus'; import EventBus from './layout/EventBus';
const StandaloneActionDispatcher = new Class( class StandaloneActionDispatcher extends ActionDispatcher {
/** @lends StandaloneActionDispatcher */ { constructor(commandContext) {
Extends: ActionDispatcher, super(commandContext);
/**
* @extends mindplot.ActionDispatcher
* @constructs
* @param {mindplot.CommandContext} commandContext
*/
initialize(commandContext) {
this.parent(commandContext);
this._actionRunner = new DesignerActionRunner(commandContext, this); this._actionRunner = new DesignerActionRunner(commandContext, this);
}, }
/** */ /** */
addTopics(models, parentTopicsId) { addTopics(models, parentTopicsId) {
const command = new AddTopicCommand(models, parentTopicsId); const command = new AddTopicCommand(models, parentTopicsId);
this.execute(command); this.execute(command);
}, }
/** */ /** */
addRelationship(model) { addRelationship(model) {
const command = new AddRelationshipCommand(model); const command = new AddRelationshipCommand(model);
this.execute(command); this.execute(command);
}, }
/** */ /** */
deleteEntities(topicsIds, relIds) { deleteEntities(topicsIds, relIds) {
const command = new DeleteCommand(topicsIds, relIds); const command = new DeleteCommand(topicsIds, relIds);
this.execute(command); this.execute(command);
}, }
/** */ /** */
dragTopic(topicId, position, order, parentTopic) { dragTopic(topicId, position, order, parentTopic) {
const command = new DragTopicCommand(topicId, position, order, parentTopic); const command = new DragTopicCommand(topicId, position, order, parentTopic);
this.execute(command); this.execute(command);
}, }
/** */ /** */
moveTopic(topicId, position) { moveTopic(topicId, position) {
@ -83,13 +76,13 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicId, position); const command = new GenericFunctionCommand(commandFunc, topicId, position);
this.execute(command); this.execute(command);
}, }
/** */ /** */
moveControlPoint(ctrlPoint, point) { moveControlPoint(ctrlPoint, point) {
const command = new MoveControlPointCommand(ctrlPoint, point); const command = new MoveControlPointCommand(ctrlPoint, point);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFontStyleToTopic(topicsIds) { changeFontStyleToTopic(topicsIds) {
@ -101,7 +94,7 @@ const StandaloneActionDispatcher = new Class(
}; };
const command = new GenericFunctionCommand(commandFunc, topicsIds); const command = new GenericFunctionCommand(commandFunc, topicsIds);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeTextToTopic(topicsIds, text) { changeTextToTopic(topicsIds, text) {
@ -116,7 +109,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, text); const command = new GenericFunctionCommand(commandFunc, topicsIds, text);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFontFamilyToTopic(topicIds, fontFamily) { changeFontFamilyToTopic(topicIds, fontFamily) {
@ -133,7 +126,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicIds, fontFamily); const command = new GenericFunctionCommand(commandFunc, topicIds, fontFamily);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFontColorToTopic(topicsIds, color) { changeFontColorToTopic(topicsIds, color) {
@ -149,7 +142,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color); const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'fontColorCommandId'; command.discardDuplicated = 'fontColorCommandId';
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeBackgroundColorToTopic(topicsIds, color) { changeBackgroundColorToTopic(topicsIds, color) {
@ -165,7 +158,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color); const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'backColor'; command.discardDuplicated = 'backColor';
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeBorderColorToTopic(topicsIds, color) { changeBorderColorToTopic(topicsIds, color) {
@ -181,7 +174,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color); const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'borderColorCommandId'; command.discardDuplicated = 'borderColorCommandId';
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFontSizeToTopic(topicsIds, size) { changeFontSizeToTopic(topicsIds, size) {
@ -198,7 +191,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, size); const command = new GenericFunctionCommand(commandFunc, topicsIds, size);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeShapeTypeToTopic(topicsIds, shapeType) { changeShapeTypeToTopic(topicsIds, shapeType) {
@ -213,7 +206,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, shapeType); const command = new GenericFunctionCommand(commandFunc, topicsIds, shapeType);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFontWeightToTopic(topicsIds) { changeFontWeightToTopic(topicsIds) {
@ -230,7 +223,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds); const command = new GenericFunctionCommand(commandFunc, topicsIds);
this.execute(command); this.execute(command);
}, }
/** */ /** */
shrinkBranch(topicsIds, collapse) { shrinkBranch(topicsIds, collapse) {
@ -243,132 +236,32 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, collapse); const command = new GenericFunctionCommand(commandFunc, topicsIds, collapse);
this.execute(command, false); this.execute(command, false);
}, }
/** */ /** */
addFeatureToTopic(topicId, featureType, attributes) { addFeatureToTopic(topicId, featureType, attributes) {
const command = new AddFeatureToTopicCommand(topicId, featureType, attributes); const command = new AddFeatureToTopicCommand(topicId, featureType, attributes);
this.execute(command); this.execute(command);
}, }
/** */ /** */
changeFeatureToTopic(topicId, featureId, attributes) { changeFeatureToTopic(topicId, featureId, attributes) {
const command = new ChangeFeatureToTopicCommand(topicId, featureId, attributes); const command = new ChangeFeatureToTopicCommand(topicId, featureId, attributes);
this.execute(command); this.execute(command);
}, }
/** */ /** */
removeFeatureFromTopic(topicId, featureId) { removeFeatureFromTopic(topicId, featureId) {
const command = new RemoveFeatureFromTopicCommand(topicId, featureId); const command = new RemoveFeatureFromTopicCommand(topicId, featureId);
this.execute(command); this.execute(command);
}, }
/** */ /** */
execute(command) { execute(command) {
this._actionRunner.execute(command); this._actionRunner.execute(command);
},
},
);
const CommandContext = new Class(
/** @lends CommandContext */ {
/**
* @constructs
* @param {mindplot.Designer} designer
*/
initialize(designer) {
$assert(designer, 'designer can not be null');
this._designer = designer;
},
/** */
findTopics(topicsIds) {
$assert($defined(topicsIds), 'topicsIds can not be null');
if (!(topicsIds instanceof Array)) {
topicsIds = [topicsIds];
} }
}
const designerTopics = this._designer.getModel().getTopics();
const result = designerTopics.filter((topic) => topicsIds.contains(topic.getId()));
if (result.length !== topicsIds.length) {
const ids = designerTopics.map((topic) => topic.getId());
$assert(
result.length === topicsIds.length,
`Could not find topic. Result:${result
}, Filter Criteria:${topicsIds
}, Current Topics: [${ids
}]`,
);
}
return result;
},
/** */ export default StandaloneActionDispatcher ;
deleteTopic(topic) {
this._designer.removeTopic(topic);
},
/** */
createTopic(model) {
$assert(model, 'model can not be null');
return this._designer.nodeModelToNodeGraph(model);
},
/** */
createModel() {
const mindmap = this._designer.getMindmap();
return mindmap.createNode(NodeModel.MAIN_TOPIC_TYPE);
},
/** */
addTopic(topic) {
const mindmap = this._designer.getMindmap();
return mindmap.addBranch(topic.getModel());
},
/** */
connect(childTopic, parentTopic) {
childTopic.connectTo(parentTopic, this._designer._workspace);
},
/** */
disconnect(topic) {
topic.disconnect(this._designer._workspace);
},
/** */
addRelationship(model) {
$assert(model, 'model cannot be null');
return this._designer.addRelationship(model);
},
/** */
deleteRelationship(relationship) {
this._designer.deleteRelationship(relationship);
},
/** */
findRelationships(relIds) {
$assert($defined(relIds), 'relId can not be null');
if (!(relIds instanceof Array)) {
relIds = [relIds];
}
const designerRel = this._designer.getModel().getRelationships();
return designerRel.filter((rel) => relIds.contains(rel.getId()));
},
/** */
moveTopic(topic, position) {
$assert(topic, 'topic cannot be null');
$assert(position, 'position cannot be null');
EventBus.instance.fireEvent(EventBus.events.NodeMoveEvent, {
node: topic.getModel(),
position,
});
},
},
);
export { StandaloneActionDispatcher, CommandContext };

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';
// FIXME: Not used! // FIXME: Not used!

View File

@ -15,6 +15,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import { _ } from '@libraries/underscore-min';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
import NodeGraph from './NodeGraph'; import NodeGraph from './NodeGraph';
@ -192,7 +194,7 @@ const Topic = new Class(
return model.getImageSize(); return model.getImageSize();
}; };
result.setPosition = function () {}; result.setPosition = function () { };
} else if (shapeType === TopicShape.ELLIPSE) { } else if (shapeType === TopicShape.ELLIPSE) {
result = new web2d.Rect(0.9, attributes); result = new web2d.Rect(0.9, attributes);
} else if (shapeType === TopicShape.ROUNDED_RECT) { } else if (shapeType === TopicShape.ROUNDED_RECT) {
@ -213,11 +215,11 @@ const Topic = new Class(
return this.size; return this.size;
}; };
result.setPosition = function () {}; result.setPosition = function () { };
result.setFill = function () {}; result.setFill = function () { };
result.setStroke = function () {}; result.setStroke = function () { };
} else { } else {
$assert(false, `Unsupported figure shapeType:${shapeType}`); $assert(false, `Unsupported figure shapeType:${shapeType}`);
} }

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import Events from './Events'; import Events from './Events';
import MultilineTextEditor from './MultilineTextEditor'; import MultilineTextEditor from './MultilineTextEditor';
import { TopicShape } from './model/INodeModel'; import { TopicShape } from './model/INodeModel';

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
/** */ import { $assert } from '@wisemapping/core-js';
import IconModel from './model/IconModel'; import IconModel from './model/IconModel';
import ImageIcon from './ImageIcon'; import ImageIcon from './ImageIcon';
import LinkModel from './model/LinkModel'; import LinkModel from './model/LinkModel';

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import { TopicShape } from './model/INodeModel'; import { TopicShape } from './model/INodeModel';
const TopicStyle = new Class({}); const TopicStyle = new Class({});

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d'; import web2d from '@wisemapping/web2d';
class Workspace { class Workspace {

View File

@ -1,35 +0,0 @@
/*
* Copyright [2015] [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.
*/
const mindplot = {};
mindplot.util = {};
mindplot.commands = {};
mindplot.layout = {};
mindplot.layout.boards = {};
mindplot.layout.boards.original = {};
mindplot.widget = {};
mindplot.model = {};
mindplot.collaboration = {};
mindplot.collaboration.framework = {};
mindplot.persistence = {};
mindplot.layout = {};
Class.Mutators.Static = function (items) {
this.extend(items);
};

View File

@ -1,95 +0,0 @@
import actionDispatcher from './ActionDispatcher';
import actionIcon from './ActionIcon';
import centralTopic from './CentralTopic';
import command from './Command';
import connectionLine from './ConnectionLine';
import controlPoint from './ControlPoint';
import designer from './Designer';
import designerActionRunner from './DesignerActionRunner';
import designerKeyboard from './DesignerKeyboard';
import designerModal from './DesignerModel';
import designerUndoManager from './DesignerUndoManager';
import dragConnector from './DragConnector';
import dragManager from './DragManager';
import dragPivot from './DragPivot';
import dragTopic from './DragTopic';
import editorOptions from './EditorOptions';
import editorProperties from './EditorProperties';
import events from './Events';
import footer from './footer';
import header from './header';
import icon from './Icon';
import iconGroup from './IconGroup';
import imageIcon from './ImageIcon';
import keyboard from './Keyboard';
import linkIcon from './LinkIcon';
import localSorageManager from './LocalStorageManager';
import mainTopic from './MainTopic';
import messages from './Messages';
import multilineTextEditor from './MultilineTextEditor';
import nodeGraph from './NodeGraph';
import noteIcon from './NoteIcon';
import options from './Options';
import persistenceManager from './PersistenceManager';
import relationship from './Relationship';
import relationshipPivot from './RelationshipPivot';
import resetPersistenceManager from './RestPersistenceManager';
import screenManager from './ScreenManager';
import shrinkConnector from './ShrinkConnector';
import standaloneActionDispatcher from './StandaloneActionDispatcher';
import textEditor from './TextEditor';
import textEditorFactory from './TextEditorFactory';
import topic from './Topic';
import topicEventDispatcher from './TopicEventDispatcher';
import topicFeature from './TopicFeature';
import topicStyle from './TopicStyle';
import workspace from './Workspace';
export default {
ActionDispatcher: actionDispatcher,
ActionIcon: actionIcon,
CentralTopic: centralTopic,
Command: command,
ConnectionLine: connectionLine,
ControlPoint: controlPoint,
Designer: designer,
DesignerActionRunner: designerActionRunner,
DesignerKeyboard: designerKeyboard,
DesignerModel: designerModal,
DesignerUndoManager: designerUndoManager,
DragConnector: dragConnector,
DragManager: dragManager,
DragPivot: dragPivot,
DragTopic: dragTopic,
EditorOptions: editorOptions,
EditorProperties: editorProperties,
Events: events,
Footer: footer,
Header: header,
Icon: icon,
IconGroup: iconGroup,
ImageIcon: imageIcon,
Keyboard: keyboard,
LinkIcon: linkIcon,
LocalStorageManager: localSorageManager,
MainTopic: mainTopic,
Messages: messages,
MultilineTextEditor: multilineTextEditor,
NodeGraph: nodeGraph,
NoteIcon: noteIcon,
Options: options,
PersistenceManager: persistenceManager,
Relationship: relationship,
RelationshipPivot: relationshipPivot,
RestPersistenceManager: resetPersistenceManager,
ScreenManager: screenManager,
ShrinkConnector: shrinkConnector,
StandaloneActionDispatcher: standaloneActionDispatcher,
TextEditor: textEditor,
TextEditorFactory: textEditorFactory,
Topic: topic,
TopicEventDispatcher: topicEventDispatcher,
TopicFeature: topicFeature,
TopicStyle: topicStyle,
Workspace: workspace,
};

View File

@ -15,6 +15,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import _ from '@libraries/underscore-min';
import { $assert, $defined } from '@wisemapping/core-js';
import AbstractBasicSorter from './AbstractBasicSorter'; import AbstractBasicSorter from './AbstractBasicSorter';
const BalancedSorter = new Class( const BalancedSorter = new Class(

View File

@ -15,34 +15,30 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
const ChangeEvent = new Class(/** @lends ChangeEvent */{ class ChangeEvent {
/** constructor(id) {
* @constructs $assert(!Number.isNaN(id), 'id can not be null');
* @param {} id
* @throws will throw an error if the given id is not/cannot be converted to a numerical value
*/
initialize(id) {
$assert(!isNaN(id), 'id can not be null');
this._id = id; this._id = id;
this._position = null; this._position = null;
this._order = null; this._order = null;
}, }
/** @return id */ /** @return id */
getId() { getId() {
return this._id; return this._id;
}, }
/** @return order */ /** @return order */
getOrder() { getOrder() {
return this._order; return this._order;
}, }
/** @return position */ /** @return position */
getPosition() { getPosition() {
return this._position; return this._position;
}, }
/** /**
* @param {} value the order to set * @param {} value the order to set
@ -50,21 +46,21 @@ const ChangeEvent = new Class(/** @lends ChangeEvent */{
* value * value
*/ */
setOrder(value) { setOrder(value) {
$assert(!isNaN(value), 'value can not be null'); $assert(!Number.isNaN(value), 'value can not be null');
this._order = value; this._order = value;
}, }
/** @param {} value /** @param {} value
* @throws will throw an error if the value is null or undefined */ * @throws will throw an error if the value is null or undefined */
setPosition(value) { setPosition(value) {
$assert(value, 'value can not be null'); $assert(value, 'value can not be null');
this._position = value; this._position = value;
}, }
/** @return {String} order and position */ /** @return {String} order and position */
toString() { toString() {
return `[order:${this.getOrder()}, position: {${this.getPosition().x},${this.getPosition().y}}]`; return `[order:${this.getOrder()}, position: {${this.getPosition().x},${this.getPosition().y}}]`;
}, }
}); }
export default ChangeEvent; export default ChangeEvent;

View File

@ -17,15 +17,8 @@
*/ */
import Events from '../Events'; import Events from '../Events';
const EventBus = new Class(/** @lends EventBus */{ class EventBus extends Events {
Implements: Events, }
/**
* @constructs
* @implements mindplot.Events
*/
initialize() {
},
});
/** /**
* Enum for events * Enum for events

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js';
import AbstractBasicSorter from './AbstractBasicSorter'; import AbstractBasicSorter from './AbstractBasicSorter';
/** /**

View File

@ -15,23 +15,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import _ from '@libraries/underscore-min';
import $ from '@libraries/jquery-2.1.0';
import { $assert, $defined } from '@wisemapping/core-js';
import Events from '../Events'; import Events from '../Events';
import RootedTreeSet from './RootedTreeSet'; import RootedTreeSet from './RootedTreeSet';
import OriginalLayout from './OriginalLayout'; import OriginalLayout from './OriginalLayout';
import ChangeEvent from './ChangeEvent'; import ChangeEvent from './ChangeEvent';
const LayoutManager = new Class( class LayoutManager extends Events {
/** @lends LayoutManager */ { constructor(rootNodeId, rootSize) {
Extends: Events, super();
/**
* @constructs
* @extends mindplot.Events
* @param {} rootNodeId
* @param {} rootSize
* @throws will throw an error if the root node id is null or undefined
* @throws will throw an error if the root size is null
*/
initialize(rootNodeId, rootSize) {
$assert($defined(rootNodeId), 'rootNodeId can not be null'); $assert($defined(rootNodeId), 'rootNodeId can not be null');
$assert(rootSize, 'rootSize can not be null'); $assert(rootSize, 'rootSize can not be null');
var position = position || { x: 0, y: 0 }; var position = position || { x: 0, y: 0 };
@ -42,7 +36,7 @@ const LayoutManager = new Class(
const rootNode = this._layout.createNode(rootNodeId, rootSize, position, 'root'); const rootNode = this._layout.createNode(rootNodeId, rootSize, position, 'root');
this._treeSet.setRoot(rootNode); this._treeSet.setRoot(rootNode);
this._events = []; this._events = [];
}, }
/** /**
* @param id * @param id
@ -54,7 +48,7 @@ const LayoutManager = new Class(
const node = this._treeSet.find(id); const node = this._treeSet.find(id);
node.setSize(size); node.setSize(size);
}, }
/** /**
* @param id * @param id
@ -71,7 +65,7 @@ const LayoutManager = new Class(
node.setShrunken(value); node.setShrunken(value);
return this; return this;
}, }
/** /**
* @param id * @param id
@ -79,7 +73,7 @@ const LayoutManager = new Class(
*/ */
find(id) { find(id) {
return this._treeSet.find(id); return this._treeSet.find(id);
}, }
/** /**
* @param id * @param id
@ -100,7 +94,7 @@ const LayoutManager = new Class(
// node.setFree(true); // node.setFree(true);
// node.setFreeDisplacement({x:position.x - node.getPosition().x, y:position.y - node.getPosition().y}); // node.setFreeDisplacement({x:position.x - node.getPosition().x, y:position.y - node.getPosition().y});
node.setPosition(position); node.setPosition(position);
}, }
/** /**
* @param parentId * @param parentId
@ -119,7 +113,7 @@ const LayoutManager = new Class(
this._layout.connectNode(parentId, childId, order); this._layout.connectNode(parentId, childId, order);
return this; return this;
}, }
/** /**
* @param id * @param id
@ -131,7 +125,7 @@ const LayoutManager = new Class(
this._layout.disconnectNode(id); this._layout.disconnectNode(id);
return this; return this;
}, }
/** /**
* @param id * @param id
@ -146,7 +140,7 @@ const LayoutManager = new Class(
this._treeSet.add(result); this._treeSet.add(result);
return this; return this;
}, }
/** /**
* removes a node and its connection to parent if existing * removes a node and its connection to parent if existing
@ -167,7 +161,7 @@ const LayoutManager = new Class(
this._treeSet.remove(id); this._treeSet.remove(id);
return this; return this;
}, }
/** /**
* @param {Number} parentId * @param {Number} parentId
@ -186,14 +180,14 @@ const LayoutManager = new Class(
const result = sorter.predict(this._treeSet, parent, node, position, free); const result = sorter.predict(this._treeSet, parent, node, position, free);
return { order: result[0], position: result[1] }; return { order: result[0], position: result[1] };
}, }
/** /**
* logs dump to console * logs dump to console
*/ */
dump() { dump() {
console.log(this._treeSet.dump()); console.log(this._treeSet.dump());
}, }
/** /**
* @param containerId * @param containerId
@ -222,7 +216,7 @@ const LayoutManager = new Class(
this._treeSet.plot(canvas); this._treeSet.plot(canvas);
return canvas; return canvas;
}, }
/** /**
* initializes the layout to be updated * initializes the layout to be updated
@ -241,7 +235,7 @@ const LayoutManager = new Class(
} }
return this; return this;
}, }
_flushEvents() { _flushEvents() {
_.each( _.each(
@ -252,10 +246,12 @@ const LayoutManager = new Class(
this, this,
); );
this._events = []; this._events = [];
}, }
_collectChanges(nodes) { _collectChanges(nodes) {
if (!nodes) nodes = this._treeSet.getTreeRoots(); if (!nodes) {
nodes = this._treeSet.getTreeRoots();
}
_.each( _.each(
nodes, nodes,
@ -281,8 +277,7 @@ const LayoutManager = new Class(
}, },
this, this,
); );
}, }
}, }
);
export default LayoutManager; export default LayoutManager;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
const Node = new Class( const Node = new Class(
/** @lends Node */ { /** @lends Node */ {
@ -30,7 +31,7 @@ const Node = new Class(
* @throws will throw an error if sorter is null or undefined * @throws will throw an error if sorter is null or undefined
*/ */
initialize(id, size, position, sorter) { initialize(id, size, position, sorter) {
$assert(typeof id === 'number' && isFinite(id), 'id can not be null'); $assert(typeof id === 'number' && Number.isFinite(id), 'id can not be null');
$assert(size, 'size can not be null'); $assert(size, 'size can not be null');
$assert(position, 'position can not be null'); $assert(position, 'position can not be null');
$assert(sorter, 'sorter can not be null'); $assert(sorter, 'sorter can not be null');
@ -82,7 +83,7 @@ const Node = new Class(
/** */ /** */
setOrder(order) { setOrder(order) {
$assert( $assert(
typeof order === 'number' && isFinite(order), typeof order === 'number' && Number.isFinite(order),
`Order can not be null. Value:${order}`, `Order can not be null. Value:${order}`,
); );
this._setProperty('order', order); this._setProperty('order', order);
@ -199,7 +200,7 @@ const Node = new Class(
} }
// Only update if the property has changed ... // Only update if the property has changed ...
if (JSON.stringify(prop.value) != JSON.stringify(value)) { if (JSON.stringify(prop.value) !== JSON.stringify(value)) {
prop.oldValue = prop.value; prop.oldValue = prop.value;
prop.value = value; prop.value = value;
prop.hasChanged = true; prop.hasChanged = true;

View File

@ -15,17 +15,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import _ from '@libraries/underscore-min';
import { $assert, $defined } from '@wisemapping/core-js';
import Node from './Node'; import Node from './Node';
import SymmetricSorter from './SymmetricSorter'; import SymmetricSorter from './SymmetricSorter';
import BalancedSorter from './BalancedSorter'; import BalancedSorter from './BalancedSorter';
const OriginalLayout = new Class( const OriginalLayout = new Class({
/** @lends OriginalLayout */ {
/**
* @constructs
* @param treeSet
*/
initialize(treeSet) { initialize(treeSet) {
this._treeSet = treeSet; this._treeSet = treeSet;
}, },
@ -109,7 +105,7 @@ const OriginalLayout = new Class(
const newBranchHeight = heightById[nodeId]; const newBranchHeight = heightById[nodeId];
const parentHeightChanged = $defined(parent) ? parent._heightChanged : false; const parentHeightChanged = $defined(parent) ? parent._heightChanged : false;
const heightChanged = node._branchHeight != newBranchHeight; const heightChanged = node._branchHeight !== newBranchHeight;
node._heightChanged = heightChanged || parentHeightChanged; node._heightChanged = heightChanged || parentHeightChanged;
if (childrenOrderMoved || childrenSizeChanged || heightChanged || parentHeightChanged) { if (childrenOrderMoved || childrenSizeChanged || heightChanged || parentHeightChanged) {
@ -262,7 +258,7 @@ const OriginalLayout = new Class(
_branchesOverlap(branchA, branchB, heightById) { _branchesOverlap(branchA, branchB, heightById) {
// a branch doesn't really overlap with itself // a branch doesn't really overlap with itself
if (branchA == branchB) { if (branchA === branchB) {
return false; return false;
} }
@ -273,7 +269,7 @@ const OriginalLayout = new Class(
return !(topA >= bottomB || bottomA <= topB); return !(topA >= bottomB || bottomA <= topB);
}, },
}, },
); );
/** /**

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
const RootedTreeSet = new Class( const RootedTreeSet = new Class(
/** @lends RootedTreeSet */ { /** @lends RootedTreeSet */ {

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import AbstractBasicSorter from './AbstractBasicSorter'; import AbstractBasicSorter from './AbstractBasicSorter';
const SymmetricSorter = new Class( const SymmetricSorter = new Class(

View File

@ -1,27 +0,0 @@
import abstractBasicSorter from './AbstractBasicSorter';
import balancedSorter from './BalancedSorter';
import changeEvent from './ChangeEvent';
import childrenSorterStrategy from './ChildrenSorterStrategy';
import eventBus from './EventBus';
import eventBusDispatcher from './EventBusDispatcher';
import gridSorter from './GridSorter';
import layoutManager from './LayoutManager';
import node from './Node';
import originalLayout from './OriginalLayout';
import rootedTreeSet from './RootedTreeSet';
import symmetricSorter from './SymmetricSorter';
export default {
AbstractBasicSorter: abstractBasicSorter,
BalancedSorter: balancedSorter,
ChangeEvent: changeEvent,
ChildrenSorterStrategy: childrenSorterStrategy,
EventBus: eventBus,
EventBusDispatcher: eventBusDispatcher,
GridSorter: gridSorter,
LayoutManager: layoutManager,
Node: node,
OriginalLayout: originalLayout,
RootedTreeSet: rootedTreeSet,
SymmetricSorter: symmetricSorter,
};

View File

@ -1,172 +0,0 @@
/*
* jQuery Hotkeys Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Based upon the plugin by Tzury Bar Yochay:
* http://github.com/tzuryby/hotkeys
*
* Original idea by:
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
*/
/*
* One small change is: now keys are passed by object { keys: '...' }
* Might be useful, when you want to pass some other data to your handler
*/
(function (jQuery) {
jQuery.hotkeys = {
version: '0.8',
specialKeys: {
8: 'backspace',
9: 'tab',
10: 'return',
13: 'enter',
16: 'shift',
17: 'ctrl',
18: 'alt',
19: 'pause',
20: 'capslock',
27: 'esc',
32: 'space',
33: 'pageup',
34: 'pagedown',
35: 'end',
36: 'home',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
45: 'insert',
46: 'del',
96: '0',
97: '1',
98: '2',
99: '3',
100: '4',
101: '5',
102: '6',
103: '7',
104: '8',
105: '9',
106: '*',
107: '+',
109: '-',
110: '.',
111: '/',
112: 'f1',
113: 'f2',
114: 'f3',
115: 'f4',
116: 'f5',
117: 'f6',
118: 'f7',
119: 'f8',
120: 'f9',
121: 'f10',
122: 'f11',
123: 'f12',
144: 'numlock',
145: 'scroll',
186: ';',
191: '/',
220: '\\',
222: "'",
224: 'meta',
},
shiftNums: {
'`': '~',
1: '!',
2: '@',
3: '#',
4: '$',
5: '%',
6: '^',
7: '&',
8: '*',
9: '(',
0: ')',
'-': '_',
'=': '+',
';': ': ',
"'": '"',
',': '<',
'.': '>',
'/': '?',
'\\': '|',
},
};
function keyHandler(handleObj) {
if (typeof handleObj.data === 'string') {
handleObj.data = { keys: handleObj.data };
}
// Only care when a possible input has been specified
if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== 'string') {
return;
}
const origHandler = handleObj.handler;
const keys = handleObj.data.keys.toLowerCase().split(' ');
const textAcceptingInputTypes = ['text', 'password', 'number', 'email', 'url', 'range', 'date', 'month', 'week', 'time', 'datetime', 'datetime-local', 'search', 'color', 'tel'];
handleObj.handler = function (event) {
// Don't fire in text-accepting inputs that we didn't directly bind to
if (this !== event.target && (/textarea|select/i.test(event.target.nodeName)
|| jQuery.inArray(event.target.type, textAcceptingInputTypes) > -1)) {
return;
}
const special = jQuery.hotkeys.specialKeys[event.keyCode];
const character = String.fromCharCode(event.which).toLowerCase();
let modif = ''; const
possible = {};
// check combinations (alt|ctrl|shift+anything)
if (event.altKey && special !== 'alt') {
modif += 'alt+';
}
if (event.ctrlKey && special !== 'ctrl') {
modif += 'ctrl+';
}
// TODO: Need to make sure this works consistently across platforms
if (event.metaKey && !event.ctrlKey && special !== 'meta') {
modif += 'meta+';
}
if (event.shiftKey && special !== 'shift') {
modif += 'shift+';
}
if (special) {
possible[modif + special] = true;
}
if (character) {
possible[modif + character] = true;
possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
if (modif === 'shift+') {
possible[jQuery.hotkeys.shiftNums[character]] = true;
}
}
for (let i = 0, l = keys.length; i < l; i++) {
if (possible[keys[i]]) {
return origHandler.apply(this, arguments);
}
}
};
}
jQuery.each(['keydown', 'keyup', 'keypress'], function () {
jQuery.event.special[this] = { add: keyHandler };
});
}(this.jQuery));

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,12 +0,0 @@
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 3.1.11
*
* Requires: jQuery 1.2.2+
*/
!(function (a) { typeof define === 'function' && define.amd ? define(['jquery'], a) : typeof exports === 'object' ? module.exports = a : a(jQuery); }((a) => {
function b(b) { const g = b || window.event; const h = i.call(arguments, 1); let j = 0; let l = 0; let m = 0; let n = 0; let o = 0; let p = 0; if (b = a.event.fix(g), b.type = 'mousewheel', 'detail' in g && (m = -1 * g.detail), 'wheelDelta' in g && (m = g.wheelDelta), 'wheelDeltaY' in g && (m = g.wheelDeltaY), 'wheelDeltaX' in g && (l = -1 * g.wheelDeltaX), 'axis' in g && g.axis === g.HORIZONTAL_AXIS && (l = -1 * m, m = 0), j = m === 0 ? l : m, 'deltaY' in g && (m = -1 * g.deltaY, j = m), 'deltaX' in g && (l = g.deltaX, m === 0 && (j = -1 * l)), m !== 0 || l !== 0) { if (g.deltaMode === 1) { const q = a.data(this, 'mousewheel-line-height'); j *= q, m *= q, l *= q; } else if (g.deltaMode === 2) { const r = a.data(this, 'mousewheel-page-height'); j *= r, m *= r, l *= r; } if (n = Math.max(Math.abs(m), Math.abs(l)), (!f || f > n) && (f = n, d(g, n) && (f /= 40)), d(g, n) && (j /= 40, l /= 40, m /= 40), j = Math[j >= 1 ? 'floor' : 'ceil'](j / f), l = Math[l >= 1 ? 'floor' : 'ceil'](l / f), m = Math[m >= 1 ? 'floor' : 'ceil'](m / f), k.settings.normalizeOffset && this.getBoundingClientRect) { const s = this.getBoundingClientRect(); o = b.clientX - s.left, p = b.clientY - s.top; } return b.deltaX = l, b.deltaY = m, b.deltaFactor = f, b.offsetX = o, b.offsetY = p, b.deltaMode = 0, h.unshift(b, j, l, m), e && clearTimeout(e), e = setTimeout(c, 200), (a.event.dispatch || a.event.handle).apply(this, h); } } function c() { f = null; } function d(a, b) { return k.settings.adjustOldDeltas && a.type === 'mousewheel' && b % 120 === 0; } let e; let f; const g = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; const h = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; var i = Array.prototype.slice; if (a.event.fixHooks) for (let j = g.length; j;)a.event.fixHooks[g[--j]] = a.event.mouseHooks; var k = a.event.special.mousewheel = {
version: '3.1.11', setup() { if (this.addEventListener) for (let c = h.length; c;) this.addEventListener(h[--c], b, !1); else this.onmousewheel = b; a.data(this, 'mousewheel-line-height', k.getLineHeight(this)), a.data(this, 'mousewheel-page-height', k.getPageHeight(this)); }, teardown() { if (this.removeEventListener) for (let c = h.length; c;) this.removeEventListener(h[--c], b, !1); else this.onmousewheel = null; a.removeData(this, 'mousewheel-line-height'), a.removeData(this, 'mousewheel-page-height'); }, getLineHeight(b) { let c = a(b)['offsetParent' in a.fn ? 'offsetParent' : 'parent'](); return c.length || (c = a('body')), parseInt(c.css('fontSize'), 10); }, getPageHeight(b) { return a(b).height(); }, settings: { adjustOldDeltas: !0, normalizeOffset: !0 },
}; a.fn.extend({ mousewheel(a) { return a ? this.bind('mousewheel', a) : this.trigger('mousewheel'); }, unmousewheel(a) { return this.unbind('mousewheel', a); } });
}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,596 +0,0 @@
/*
---
MooTools: the javascript framework
web build:
- http://mootools.net/core/b28139f033891d55fabb70ffafd6813b
packager build:
- packager build Core/Core Core/Array Core/Class Core/Class.Extras
copyrights:
- [MooTools](http://mootools.net)
licenses:
- [MIT License](http://mootools.net/license.txt)
...
*/
(function () {
this.MooTools = { version: '1.4.5', build: 'ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0' };
const o = this.typeOf = function (i) {
if (i == null) {
return 'null';
}
if (i.$family != null) {
return i.$family();
}
if (i.nodeName) {
if (i.nodeType == 1) {
return 'element';
}
if (i.nodeType == 3) {
return (/\S/).test(i.nodeValue) ? 'textnode' : 'whitespace';
}
} else if (typeof i.length === 'number') {
if (i.callee) {
return 'arguments';
}
if ('item' in i) {
return 'collection';
}
}
return typeof i;
};
this.instanceOf = function (t, i) {
if (t == null) {
return false;
}
let s = t.$constructor || t.constructor;
while (s) {
if (s === i) {
return true;
}
s = s.parent;
}
if (!t.hasOwnProperty) {
return false;
}
return t instanceof i;
};
const f = this.Function;
let p = true;
for (const k in { toString: 1 }) {
p = null;
}
if (p) {
p = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
}
f.prototype.overloadSetter = function (s) {
const i = this;
return function (u, t) {
if (u == null) {
return this;
}
if (s || typeof u !== 'string') {
for (var v in u) {
i.call(this, v, u[v]);
}
if (p) {
for (let w = p.length; w--;) {
v = p[w];
if (u.hasOwnProperty(v)) {
i.call(this, v, u[v]);
}
}
}
} else {
i.call(this, u, t);
}
return this;
};
};
f.prototype.extend = function (i, s) {
this[i] = s;
}.overloadSetter();
f.prototype.implement = function (i, s) {
this.prototype[i] = s;
}.overloadSetter();
const n = Array.prototype.slice;
Array.from = function (i) {
if (i == null) {
return [];
}
return (a.isEnumerable(i) && typeof i !== 'string') ? (o(i) == 'array') ? i : n.call(i) : [i];
};
f.implement({
hide() {
this.$hidden = true;
return this;
},
protect() {
this.$protected = true;
return this;
},
});
var a = this.Type = function (u, t) {
if (u) {
const s = u.toLowerCase();
const i = function (v) {
return (o(v) == s);
};
a[`is${u}`] = i;
if (t != null) {
t.prototype.$family = (function () {
return s;
}).hide();
}
}
if (t == null) {
return null;
}
t.extend(this);
t.$constructor = a;
t.prototype.$constructor = t;
return t;
};
const e = Object.prototype.toString;
a.isEnumerable = function (i) {
return (i != null && typeof i.length === 'number' && e.call(i) != '[object Function]');
};
const q = {};
const r = function (i) {
const s = o(i.prototype);
return q[s] || (q[s] = []);
};
var b = function (t, x) {
if (x && x.$hidden) {
return;
}
const s = r(this);
for (let u = 0; u < s.length;
u++) {
const w = s[u];
if (o(w) == 'type') {
b.call(w, t, x);
} else {
w.call(this, t, x);
}
}
const v = this.prototype[t];
if (v == null || !v.$protected) {
this.prototype[t] = x;
}
if (this[t] == null && o(x) == 'function') {
m.call(this, t, function (i) {
return x.apply(i, n.call(arguments, 1));
});
}
};
var m = function (i, t) {
if (t && t.$hidden) {
return;
}
const s = this[i];
if (s == null || !s.$protected) {
this[i] = t;
}
};
a.implement({
implement: b.overloadSetter(),
extend: m.overloadSetter(),
alias: function (i, s) {
b.call(this, i, this.prototype[s]);
}.overloadSetter(),
mirror(i) {
r(this).push(i);
return this;
},
});
new a('Type', a);
var d = function (s, x, v) {
const u = (x != Object); const
B = x.prototype;
if (u) {
x = new a(s, x);
}
for (let y = 0, w = v.length; y < w; y++) {
const C = v[y]; const A = x[C]; const
z = B[C];
if (A) {
A.protect();
}
if (u && z) {
x.implement(C, z.protect());
}
}
if (u) {
const t = B.propertyIsEnumerable(v[0]);
x.forEachMethod = function (G) {
if (!t) {
for (let F = 0, D = v.length; F < D; F++) {
G.call(B, B[v[F]], v[F]);
}
}
for (const E in B) {
G.call(B, B[E], E);
}
};
}
return d;
};
d('String', String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'])('Array', Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight'])('Number', Number, ['toExponential', 'toFixed', 'toLocaleString', 'toPrecision'])('Function', f, ['apply', 'call', 'bind'])('RegExp', RegExp, ['exec', 'test'])('Object', Object, ['create', 'defineProperty', 'defineProperties', 'keys', 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'])('Date', Date, ['now']);
Object.extend = m.overloadSetter();
Date.extend('now', () => +(new Date()));
new a('Boolean', Boolean);
Number.prototype.$family = function () {
return isFinite(this) ? 'number' : 'null';
}.hide();
Number.extend('random', (s, i) => Math.floor(Math.random() * (i - s + 1) + s));
const g = Object.prototype.hasOwnProperty;
Object.extend('forEach', (i, t, u) => {
for (const s in i) {
if (g.call(i, s)) {
t.call(u, i[s], s, i);
}
}
});
Object.each = Object.forEach;
Array.implement({
forEach(u, v) {
for (let t = 0, s = this.length; t < s; t++) {
if (t in this) {
u.call(v, this[t], t, this);
}
}
},
each(i, s) {
Array.forEach(this, i, s);
return this;
},
});
const l = function (i) {
switch (o(i)) {
case 'array':
return i.clone();
case 'object':
return Object.clone(i);
default:
return i;
}
};
Array.implement('clone', function () {
let s = this.length; const
t = new Array(s);
while (s--) {
t[s] = l(this[s]);
}
return t;
});
const h = function (s, i, t) {
switch (o(t)) {
case 'object':
if (o(s[i]) == 'object') {
Object.merge(s[i], t);
} else {
s[i] = Object.clone(t);
}
break;
case 'array':
s[i] = t.clone();
break;
default:
s[i] = t;
}
return s;
};
Object.extend({
merge(z, u, t) {
if (o(u) == 'string') {
return h(z, u, t);
}
for (let y = 1, s = arguments.length;
y < s; y++) {
const w = arguments[y];
for (const x in w) {
h(z, x, w[x]);
}
}
return z;
},
clone(i) {
const t = {};
for (const s in i) {
t[s] = l(i[s]);
}
return t;
},
append(w) {
for (let v = 1, t = arguments.length;
v < t; v++) {
const s = arguments[v] || {};
for (const u in s) {
w[u] = s[u];
}
}
return w;
},
});
['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each((i) => {
new a(i);
});
let c = Date.now();
String.extend('uniqueID', () => (c++).toString(36));
}());
Array.implement({
filter(d, f) {
const c = [];
for (var e, b = 0, a = this.length >>> 0; b < a; b++) {
if (b in this) {
e = this[b];
if (d.call(f, e, b, this)) {
c.push(e);
}
}
}
return c;
},
indexOf(c, d) {
const b = this.length >>> 0;
for (let a = (d < 0) ? Math.max(0, b + d) : d || 0; a < b; a++) {
if (this[a] === c) {
return a;
}
}
return -1;
},
map(c, e) {
const d = this.length >>> 0; const
b = Array(d);
for (let a = 0; a < d; a++) {
if (a in this) {
b[a] = c.call(e, this[a], a, this);
}
}
return b;
},
some(c, d) {
for (let b = 0, a = this.length >>> 0;
b < a; b++) {
if ((b in this) && c.call(d, this[b], b, this)) {
return true;
}
}
return false;
},
clean() {
return this.filter((a) => a != null);
},
contains(a, b) {
return this.indexOf(a, b) != -1;
},
append(a) {
this.push.apply(this, a);
return this;
},
getLast() {
return (this.length) ? this[this.length - 1] : null;
},
include(a) {
if (!this.contains(a)) {
this.push(a);
}
return this;
},
erase(b) {
for (let a = this.length; a--;) {
if (this[a] === b) {
this.splice(a, 1);
}
}
return this;
},
empty() {
this.length = 0;
return this;
},
flatten() {
let d = [];
for (let b = 0, a = this.length; b < a; b++) {
const c = typeOf(this[b]);
if (c == 'null') {
continue;
}
d = d.concat((c == 'array' || c == 'collection' || c == 'arguments' || instanceOf(this[b], Array)) ? Array.flatten(this[b]) : this[b]);
}
return d;
},
pick() {
for (let b = 0, a = this.length; b < a; b++) {
if (this[b] != null) {
return this[b];
}
}
return null;
},
rgbToHex(d) {
if (this.length < 3) {
return null;
}
if (this.length == 4 && this[3] == 0 && !d) {
return 'transparent';
}
const b = [];
for (let a = 0; a < 3; a++) {
const c = (this[a] - 0).toString(16);
b.push((c.length == 1) ? `0${c}` : c);
}
return (d) ? b : `#${b.join('')}`;
},
});
String.implement({
test(a, b) {
return ((typeOf(a) == 'regexp') ? a : new RegExp(`${a}`, b)).test(this);
},
contains(a, b) {
return (b) ? (b + this + b).indexOf(b + a + b) > -1 : String(this).indexOf(a) > -1;
},
capitalize() {
return String(this).replace(/\b[a-z]/g, (a) => a.toUpperCase());
},
rgbToHex(b) {
const a = String(this).match(/\d{1,3}/g);
return (a) ? a.rgbToHex(b) : null;
},
});
Function.implement({
bind(e) {
const a = this; const b = arguments.length > 1 ? Array.slice(arguments, 1) : null; const
d = function () {
};
var c = function () {
let g = e; const
h = arguments.length;
if (this instanceof c) {
d.prototype = a.prototype;
g = new d();
}
const f = (!b && !h) ? a.call(g) : a.apply(g, b && h ? b.concat(Array.slice(arguments)) : b || arguments);
return g == e ? f : g;
};
return c;
},
pass(b, c) {
const a = this;
if (b != null) {
b = Array.from(b);
}
return function () {
return a.apply(c, b || arguments);
};
},
delay(b, c, a) {
return setTimeout(this.pass((a == null ? [] : a), c), b);
},
});
Number.alias('each', 'times');
(function (b) {
const a = {};
b.each((c) => {
if (!Number[c]) {
a[c] = function () {
return Math[c].apply(null, [this].concat(Array.from(arguments)));
};
}
});
Number.implement(a);
}(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']));
(function () {
var a = this.Class = new Type('Class', function (h) {
if (instanceOf(h, Function)) {
h = { initialize: h };
}
var g = function () {
e(this);
if (g.$prototyping) {
return this;
}
this.$caller = null;
const i = (this.initialize) ? this.initialize.apply(this, arguments) : this;
this.$caller = this.caller = null;
return i;
}.extend(this).implement(h);
g.$constructor = a;
g.prototype.$constructor = g;
g.prototype.parent = c;
return g;
});
var c = function () {
if (!this.$caller) {
throw new Error('The method "parent" cannot be called.');
}
const g = this.$caller.$name; const h = this.$caller.$owner.parent; const
i = (h) ? h.prototype[g] : null;
if (!i) {
throw new Error(`The method "${g}" has no parent.`);
}
return i.apply(this, arguments);
};
var e = function (g) {
for (const h in g) {
const j = g[h];
switch (typeOf(j)) {
case 'object':
var i = function () {
};
i.prototype = j;
g[h] = e(new i());
break;
case 'array':
g[h] = j.clone();
break;
}
}
return g;
};
const b = function (g, h, j) {
if (j.$origin) {
j = j.$origin;
}
var i = function () {
if (j.$protected && this.$caller == null) {
throw new Error(`The method "${h}" cannot be called.`);
}
const l = this.caller; const
m = this.$caller;
this.caller = m;
this.$caller = i;
const k = j.apply(this, arguments);
this.$caller = m;
this.caller = l;
return k;
}.extend({ $owner: g, $origin: j, $name: h });
return i;
};
const f = function (h, i, g) {
if (a.Mutators.hasOwnProperty(h)) {
i = a.Mutators[h].call(this, i);
if (i == null) {
return this;
}
}
if (typeOf(i) == 'function') {
if (i.$hidden) {
return this;
}
this.prototype[h] = (g) ? i : b(this, h, i);
} else {
Object.merge(this.prototype, h, i);
}
return this;
};
const d = function (g) {
g.$prototyping = true;
const h = new g();
delete g.$prototyping;
return h;
};
a.implement('implement', f.overloadSetter());
a.Mutators = {
Extends(g) {
this.parent = g;
this.prototype = d(g);
},
Implements(g) {
Array.from(g).each(function (j) {
const h = new j();
for (const i in h) {
f.call(this, i, h[i], true);
}
}, this);
},
};
}());

View File

@ -1,271 +0,0 @@
/*
---
MooTools: the javascript framework
web build:
- http://mootools.net/core/b28139f033891d55fabb70ffafd6813b
packager build:
- packager build Core/Core Core/Array Core/Class Core/Class.Extras
copyrights:
- [MooTools](http://mootools.net)
licenses:
- [MIT License](http://mootools.net/license.txt)
...
*/
(function () {
this.MooTools = { version: '1.4.5', build: 'ab8ea8824dc3b24b6666867a2c4ed58ebb762cf0' }; const o = this.typeOf = function (i) {
if (i == null) { return 'null'; } if (i.$family != null) {
return i.$family();
} if (i.nodeName) { if (i.nodeType == 1) { return 'element'; } if (i.nodeType == 3) { return (/\S/).test(i.nodeValue) ? 'textnode' : 'whitespace'; } } else if (typeof i.length === 'number') {
if (i.callee) {
return 'arguments';
} if ('item' in i) { return 'collection'; }
} return typeof i;
}; const j = this.instanceOf = function (t, i) {
if (t == null) { return false; } let s = t.$constructor || t.constructor;
while (s) { if (s === i) { return true; }s = s.parent; } if (!t.hasOwnProperty) { return false; } return t instanceof i;
}; const f = this.Function; let p = true; for (const k in { toString: 1 }) {
p = null;
} if (p) { p = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; }f.prototype.overloadSetter = function (s) {
const i = this;
return function (u, t) {
if (u == null) { return this; } if (s || typeof u !== 'string') {
for (var v in u) { i.call(this, v, u[v]); } if (p) {
for (let w = p.length; w--;) {
v = p[w]; if (u.hasOwnProperty(v)) {
i.call(this, v, u[v]);
}
}
}
} else { i.call(this, u, t); } return this;
};
}; f.prototype.overloadGetter = function (s) {
const i = this; return function (u) {
let v; let t; if (typeof u !== 'string') { v = u; } else if (arguments.length > 1) {
v = arguments;
} else if (s) { v = [u]; } if (v) { t = {}; for (let w = 0; w < v.length; w++) { t[v[w]] = i.call(this, v[w]); } } else { t = i.call(this, u); } return t;
};
}; f.prototype.extend = function (i, s) {
this[i] = s;
}.overloadSetter(); f.prototype.implement = function (i, s) { this.prototype[i] = s; }.overloadSetter(); const n = Array.prototype.slice; f.from = function (i) {
return (o(i) == 'function') ? i : function () {
return i;
};
}; Array.from = function (i) { if (i == null) { return []; } return (a.isEnumerable(i) && typeof i !== 'string') ? (o(i) == 'array') ? i : n.call(i) : [i]; }; Number.from = function (s) {
const i = parseFloat(s);
return isFinite(i) ? i : null;
}; String.from = function (i) { return `${i}`; }; f.implement({
hide() { this.$hidden = true; return this; },
protect() {
this.$protected = true;
return this;
},
}); var a = this.Type = function (u, t) {
if (u) {
const s = u.toLowerCase(); const i = function (v) { return (o(v) == s); }; a[`is${u}`] = i; if (t != null) {
t.prototype.$family = (function () {
return s;
}).hide();
}
} if (t == null) { return null; }t.extend(this); t.$constructor = a; t.prototype.$constructor = t; return t;
}; const e = Object.prototype.toString; a.isEnumerable = function (i) {
return (i != null && typeof i.length === 'number' && e.call(i) != '[object Function]');
}; const q = {}; const r = function (i) { const s = o(i.prototype); return q[s] || (q[s] = []); }; var b = function (t, x) {
if (x && x.$hidden) { return; } const s = r(this); for (let u = 0; u < s.length;
u++) { const w = s[u]; if (o(w) == 'type') { b.call(w, t, x); } else { w.call(this, t, x); } } const v = this.prototype[t]; if (v == null || !v.$protected) { this.prototype[t] = x; } if (this[t] == null && o(x) == 'function') {
m.call(this, t, function (i) {
return x.apply(i, n.call(arguments, 1));
});
}
}; var m = function (i, t) { if (t && t.$hidden) { return; } const s = this[i]; if (s == null || !s.$protected) { this[i] = t; } }; a.implement({
implement: b.overloadSetter(),
extend: m.overloadSetter(),
alias: function (i, s) {
b.call(this, i, this.prototype[s]);
}.overloadSetter(),
mirror(i) { r(this).push(i); return this; },
}); new a('Type', a); var d = function (s, x, v) {
const u = (x != Object); const B = x.prototype; if (u) {
x = new a(s, x);
} for (let y = 0, w = v.length; y < w; y++) { const C = v[y]; const A = x[C]; const z = B[C]; if (A) { A.protect(); } if (u && z) { x.implement(C, z.protect()); } } if (u) {
const t = B.propertyIsEnumerable(v[0]);
x.forEachMethod = function (G) { if (!t) { for (let F = 0, D = v.length; F < D; F++) { G.call(B, B[v[F]], v[F]); } } for (const E in B) { G.call(B, B[E], E); } };
} return d;
}; d('String', String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'])('Array', Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight'])('Number', Number, ['toExponential', 'toFixed', 'toLocaleString', 'toPrecision'])('Function', f, ['apply', 'call', 'bind'])('RegExp', RegExp, ['exec', 'test'])('Object', Object, ['create', 'defineProperty', 'defineProperties', 'keys', 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'])('Date', Date, ['now']);
Object.extend = m.overloadSetter(); Date.extend('now', () => +(new Date())); new a('Boolean', Boolean); Number.prototype.$family = function () {
return isFinite(this) ? 'number' : 'null';
}.hide(); Number.extend('random', (s, i) => Math.floor(Math.random() * (i - s + 1) + s)); const g = Object.prototype.hasOwnProperty; Object.extend('forEach', (i, t, u) => {
for (const s in i) {
if (g.call(i, s)) {
t.call(u, i[s], s, i);
}
}
}); Object.each = Object.forEach; Array.implement({
forEach(u, v) { for (let t = 0, s = this.length; t < s; t++) { if (t in this) { u.call(v, this[t], t, this); } } },
each(i, s) {
Array.forEach(this, i, s);
return this;
},
}); const l = function (i) { switch (o(i)) { case 'array': return i.clone(); case 'object': return Object.clone(i); default: return i; } }; Array.implement('clone', function () {
let s = this.length; const t = new Array(s);
while (s--) { t[s] = l(this[s]); } return t;
}); const h = function (s, i, t) {
switch (o(t)) {
case 'object': if (o(s[i]) == 'object') { Object.merge(s[i], t); } else {
s[i] = Object.clone(t);
} break; case 'array': s[i] = t.clone(); break; default: s[i] = t;
} return s;
}; Object.extend({
merge(z, u, t) {
if (o(u) == 'string') { return h(z, u, t); } for (let y = 1, s = arguments.length;
y < s; y++) { const w = arguments[y]; for (const x in w) { h(z, x, w[x]); } } return z;
},
clone(i) { const t = {}; for (const s in i) { t[s] = l(i[s]); } return t; },
append(w) {
for (let v = 1, t = arguments.length;
v < t; v++) { const s = arguments[v] || {}; for (const u in s) { w[u] = s[u]; } } return w;
},
}); ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each((i) => {
new a(i);
}); let c = Date.now(); String.extend('uniqueID', () => (c++).toString(36));
}()); Array.implement({
every(c, d) {
for (let b = 0, a = this.length >>> 0;
b < a; b++) { if ((b in this) && !c.call(d, this[b], b, this)) { return false; } } return true;
},
filter(d, f) {
const c = []; for (var e, b = 0, a = this.length >>> 0; b < a; b++) {
if (b in this) {
e = this[b];
if (d.call(f, e, b, this)) { c.push(e); }
}
} return c;
},
indexOf(c, d) {
const b = this.length >>> 0; for (let a = (d < 0) ? Math.max(0, b + d) : d || 0; a < b; a++) {
if (this[a] === c) {
return a;
}
} return -1;
},
map(c, e) { const d = this.length >>> 0; const b = Array(d); for (let a = 0; a < d; a++) { if (a in this) { b[a] = c.call(e, this[a], a, this); } } return b; },
some(c, d) {
for (let b = 0, a = this.length >>> 0;
b < a; b++) { if ((b in this) && c.call(d, this[b], b, this)) { return true; } } return false;
},
clean() { return this.filter((a) => a != null); },
invoke(a) {
const b = Array.slice(arguments, 1);
return this.map((c) => c[a].apply(c, b));
},
associate(c) {
const d = {}; const b = Math.min(this.length, c.length); for (let a = 0; a < b; a++) {
d[c[a]] = this[a];
} return d;
},
link(c) { const a = {}; for (let e = 0, b = this.length; e < b; e++) { for (const d in c) { if (c[d](this[e])) { a[d] = this[e]; delete c[d]; break; } } } return a; },
contains(a, b) {
return this.indexOf(a, b) != -1;
},
append(a) { this.push.apply(this, a); return this; },
getLast() { return (this.length) ? this[this.length - 1] : null; },
getRandom() {
return (this.length) ? this[Number.random(0, this.length - 1)] : null;
},
include(a) { if (!this.contains(a)) { this.push(a); } return this; },
combine(c) {
for (let b = 0, a = c.length; b < a; b++) { this.include(c[b]); } return this;
},
erase(b) { for (let a = this.length; a--;) { if (this[a] === b) { this.splice(a, 1); } } return this; },
empty() { this.length = 0; return this; },
flatten() {
let d = [];
for (let b = 0, a = this.length; b < a; b++) {
const c = typeOf(this[b]); if (c == 'null') { continue; }d = d.concat((c == 'array' || c == 'collection' || c == 'arguments' || instanceOf(this[b], Array)) ? Array.flatten(this[b]) : this[b]);
} return d;
},
pick() { for (let b = 0, a = this.length; b < a; b++) { if (this[b] != null) { return this[b]; } } return null; },
rgbToHex(d) {
if (this.length < 3) { return null; } if (this.length == 4 && this[3] == 0 && !d) {
return 'transparent';
} const b = []; for (let a = 0; a < 3; a++) { const c = (this[a] - 0).toString(16); b.push((c.length == 1) ? `0${c}` : c); } return (d) ? b : `#${b.join('')}`;
},
}); String.implement({
test(a, b) {
return ((typeOf(a) == 'regexp') ? a : new RegExp(`${a}`, b)).test(this);
},
contains(a, b) { return (b) ? (b + this + b).indexOf(b + a + b) > -1 : String(this).indexOf(a) > -1; },
trim() {
return String(this).replace(/^\s+|\s+$/g, '');
},
clean() { return String(this).replace(/\s+/g, ' ').trim(); },
camelCase() {
return String(this).replace(/-\D/g, (a) => a.charAt(1).toUpperCase());
},
hyphenate() { return String(this).replace(/[A-Z]/g, (a) => (`-${a.charAt(0).toLowerCase()}`)); },
capitalize() {
return String(this).replace(/\b[a-z]/g, (a) => a.toUpperCase());
},
escapeRegExp() { return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); },
rgbToHex(b) {
const a = String(this).match(/\d{1,3}/g);
return (a) ? a.rgbToHex(b) : null;
},
substitute(a, b) {
return String(this).replace(b || (/\\?\{([^{}]+)\}/g), (d, c) => {
if (d.charAt(0) == '\\') {
return d.slice(1);
} return (a[c] != null) ? a[c] : '';
});
},
});
Function.implement({ bind(e) { const a = this; const b = arguments.length > 1 ? Array.slice(arguments, 1) : null; const d = function () {}; var c = function () { let g = e; const h = arguments.length; if (this instanceof c) { d.prototype = a.prototype; g = new d(); } const f = (!b && !h) ? a.call(g) : a.apply(g, b && h ? b.concat(Array.slice(arguments)) : b || arguments); return g == e ? f : g; }; return c; }, pass(b, c) { const a = this; if (b != null) { b = Array.from(b); } return function () { return a.apply(c, b || arguments); }; }, delay(b, c, a) { return setTimeout(this.pass((a == null ? [] : a), c), b); } });
Number.alias('each', 'times'); (function (b) {
const a = {}; b.each((c) => {
if (!Number[c]) {
a[c] = function () {
return Math[c].apply(null, [this].concat(Array.from(arguments)));
};
}
}); Number.implement(a);
}(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan'])); (function () {
var a = this.Class = new Type('Class', function (h) {
if (instanceOf(h, Function)) {
h = { initialize: h };
} var g = function () {
e(this); if (g.$prototyping) { return this; } this.$caller = null; const i = (this.initialize) ? this.initialize.apply(this, arguments) : this; this.$caller = this.caller = null;
return i;
}.extend(this).implement(h); g.$constructor = a; g.prototype.$constructor = g; g.prototype.parent = c; return g;
}); var c = function () {
if (!this.$caller) {
throw new Error('The method "parent" cannot be called.');
} const g = this.$caller.$name; const h = this.$caller.$owner.parent; const i = (h) ? h.prototype[g] : null; if (!i) { throw new Error(`The method "${g}" has no parent.`); } return i.apply(this, arguments);
}; var e = function (g) {
for (const h in g) {
const j = g[h]; switch (typeOf(j)) {
case 'object': var i = function () {}; i.prototype = j; g[h] = e(new i()); break; case 'array': g[h] = j.clone();
break;
}
} return g;
}; const b = function (g, h, j) {
if (j.$origin) { j = j.$origin; } var i = function () {
if (j.$protected && this.$caller == null) {
throw new Error(`The method "${h}" cannot be called.`);
} const l = this.caller; const m = this.$caller; this.caller = m; this.$caller = i; const k = j.apply(this, arguments); this.$caller = m; this.caller = l; return k;
}.extend({ $owner: g, $origin: j, $name: h });
return i;
}; const f = function (h, i, g) {
if (a.Mutators.hasOwnProperty(h)) { i = a.Mutators[h].call(this, i); if (i == null) { return this; } } if (typeOf(i) == 'function') {
if (i.$hidden) {
return this;
} this.prototype[h] = (g) ? i : b(this, h, i);
} else { Object.merge(this.prototype, h, i); } return this;
}; const d = function (g) {
g.$prototyping = true; const h = new g(); delete g.$prototyping;
return h;
}; a.implement('implement', f.overloadSetter()); a.Mutators = { Extends(g) { this.parent = g; this.prototype = d(g); }, Implements(g) { Array.from(g).each(function (j) { const h = new j(); for (const i in h) { f.call(this, i, h[i], true); } }, this); } };
}());

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -363,7 +363,7 @@ class INodeModel {
/** @abstract */ /** @abstract */
removeChild(child) { removeChild(child) {
throw 'Unsupported operation'; throw new Error('Unsupported operation');
} }
} }

View File

@ -43,7 +43,7 @@ class LinkModel extends FeatureModel {
} }
// url format is already checked in LinkEditor.checkUrl // url format is already checked in LinkEditor.checkUrl
_fixUrl(url) { static _fixUrl(url) {
let result = url; let result = url;
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) { if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
result = `http://${result}`; result = `http://${result}`;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import IMindmap from './IMindmap'; import IMindmap from './IMindmap';
import INodeModel from './INodeModel'; import INodeModel from './INodeModel';
import NodeModel from './NodeModel'; import NodeModel from './NodeModel';
@ -71,10 +72,10 @@ class Mindmap extends IMindmap {
$assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects'); $assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects');
const branches = this.getBranches(); const branches = this.getBranches();
if (branches.length === 0) { if (branches.length === 0) {
$assert(nodeModel.getType() == INodeModel.CENTRAL_TOPIC_TYPE, 'First element must be the central topic'); $assert(nodeModel.getType() === INodeModel.CENTRAL_TOPIC_TYPE, 'First element must be the central topic');
nodeModel.setPosition(0, 0); nodeModel.setPosition(0, 0);
} else { } else {
$assert(nodeModel.getType() != INodeModel.CENTRAL_TOPIC_TYPE, 'Mindmaps only have one cental topic'); $assert(nodeModel.getType() !== INodeModel.CENTRAL_TOPIC_TYPE, 'Mindmaps only have one cental topic');
} }
this._branches.push(nodeModel); this._branches.push(nodeModel);

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js';
import INodeModel from './INodeModel'; import INodeModel from './INodeModel';
import TopicFeature from '../TopicFeature'; import TopicFeature from '../TopicFeature';
@ -63,7 +64,7 @@ class NodeModel extends INodeModel {
removeFeature(feature) { removeFeature(feature) {
$assert(feature, 'feature can not be null'); $assert(feature, 'feature can not be null');
const size = this._feature.length; const size = this._feature.length;
this._feature = this._feature.filter((f) => feature.getId() != f.getId()); this._feature = this._feature.filter((f) => feature.getId() !== f.getId());
$assert(size - 1 === this._feature.length, 'Could not be removed ...'); $assert(size - 1 === this._feature.length, 'Could not be removed ...');
} }
@ -190,7 +191,7 @@ class NodeModel extends INodeModel {
_isChildNode(node) { _isChildNode(node) {
let result = false; let result = false;
if (node == this) { if (node === this) {
result = true; result = true;
} else { } else {
const children = this.getChildren(); const children = this.getChildren();
@ -211,7 +212,7 @@ class NodeModel extends INodeModel {
*/ */
findNodeById(id) { findNodeById(id) {
let result = null; let result = null;
if (this.getId() == id) { if (this.getId() === id) {
result = this; result = this;
} else { } else {
const children = this.getChildren(); const children = this.getChildren();

View File

@ -1,21 +0,0 @@
import featureModel from './FeatureModel';
import iconModel from './IconModel';
import iMindmap from './IMindmap';
import iNodeModel from './INodeModel';
import linkModel from './LinkModel';
import noteModel from './NoteModel';
import mindmap from './Mindmap';
import nodeModel from './NodeModel';
import relationshipModel from './RelationshipModel';
export default {
FeatureModel: featureModel,
IconModel: iconModel,
IMindmap: iMindmap,
INodeModel: iNodeModel,
LinkModel: linkModel,
NoteModel: noteModel,
Mindmap: mindmap,
NodeModel: nodeModel,
RelationshipModel: relationshipModel,
};

View File

@ -15,17 +15,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import _ from '@libraries/underscore-min';
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import ToolbarPaneItem from './ToolbarPaneItem'; import ToolbarPaneItem from './ToolbarPaneItem';
const ColorPalettePanel = new Class({ class ColorPalettePanel extends ToolbarPaneItem {
Extends: ToolbarPaneItem, constructor(buttonId, model, baseUrl) {
super(buttonId, model);
initialize(buttonId, model, baseUrl) {
this._baseUrl = baseUrl; this._baseUrl = baseUrl;
this.parent(buttonId, model);
$assert($defined(baseUrl), 'baseUrl can not be null'); $assert($defined(baseUrl), 'baseUrl can not be null');
}, }
_load() { _load() {
if (!ColorPalettePanel._panelContent) { if (!ColorPalettePanel._panelContent) {
@ -52,7 +52,7 @@ const ColorPalettePanel = new Class({
ColorPalettePanel._panelContent = result; ColorPalettePanel._panelContent = result;
} }
return ColorPalettePanel._panelContent; return ColorPalettePanel._panelContent;
}, }
buildPanel() { buildPanel() {
const content = $('<div class="toolbarPanel"></div>').attr( const content = $('<div class="toolbarPanel"></div>').attr(
@ -74,7 +74,7 @@ const ColorPalettePanel = new Class({
}); });
return content; return content;
}, }
_updateSelectedItem() { _updateSelectedItem() {
const panelElem = this.getPanelElem(); const panelElem = this.getPanelElem();
@ -99,7 +99,7 @@ const ColorPalettePanel = new Class({
} }
}); });
return panelElem; return panelElem;
}, }
}); }
export default ColorPalettePanel; export default ColorPalettePanel;

View File

@ -15,32 +15,29 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Options from '../Options';
import Events from '../Events'; import Events from '../Events';
const FloatingTip = new Class({ // const options = {
Implements: [Options, Events], // animation: true,
// html: false,
// placement: 'right',
// selector: false,
// trigger: 'hover',
// title: '',
// content: '',
// delay: 0,
// container: false,
// destroyOnExit: false,
// };
options: { class FloatingTip extends Events {
animation: true, constructor(element, options) {
html: false, super(element, options);
placement: 'right',
selector: false,
trigger: 'hover',
title: '',
content: '',
delay: 0,
container: false,
destroyOnExit: false,
},
initialize(element, options) {
this.setOptions(options); this.setOptions(options);
this.element = element; this.element = element;
this._createPopover(); this._createPopover();
}, }
// FIXME: find a better way to do that...
_createPopover() { _createPopover() {
this.element.popover(this.options); this.element.popover(this.options);
const me = this; const me = this;
@ -50,19 +47,30 @@ const FloatingTip = new Class({
me._createPopover(); me._createPopover();
}); });
} }
}, }
show() { show() {
this.element.popover('show'); this.element.popover('show');
this.fireEvent('show'); this.fireEvent('show');
return this; return this;
}, }
hide() { hide() {
this.element.popover('hide'); this.element.popover('hide');
this.fireEvent('hide'); this.fireEvent('hide');
return this; return this;
}, }
});
setOptions() {
const options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments));
if (this.addEvent) {
for (const option in options) {
if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue;
this.addEvent(option, options[option]);
delete options[option];
}
}
return this;
}
}
export default FloatingTip; export default FloatingTip;

View File

@ -15,14 +15,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import ListToolbarPanel from './ListToolbarPanel'; import ListToolbarPanel from './ListToolbarPanel';
const FontFamilyPanel = new Class({ class FontFamilyPanel extends ListToolbarPanel {
Extends: ListToolbarPanel, // eslint-disable-next-line class-methods-use-this
initialize(buttonId, model) {
this.parent(buttonId, model);
},
buildPanel() { buildPanel() {
const content = $("<div class='toolbarPanel' id='fontFamilyPanel'></div>"); const content = $("<div class='toolbarPanel' id='fontFamilyPanel'></div>");
content.html( content.html(
@ -32,7 +29,7 @@ const FontFamilyPanel = new Class({
+ '<div id="verdana" model="Verdana" style="font-family:verdana;">Verdana</div>', + '<div id="verdana" model="Verdana" style="font-family:verdana;">Verdana</div>',
); );
return content; return content;
}, }
}); }
export default FontFamilyPanel; export default FontFamilyPanel;

View File

@ -16,13 +16,10 @@
* limitations under the License. * limitations under the License.
*/ */
import ListToolbarPanel from './ListToolbarPanel'; import ListToolbarPanel from './ListToolbarPanel';
import $ from '@libraries/jquery-2.1.0';
const FontSizePanel = new Class({ class FontSizePanel extends ListToolbarPanel {
Extends: ListToolbarPanel, // eslint-disable-next-line class-methods-use-this
initialize(buttonId, model) {
this.parent(buttonId, model);
},
buildPanel() { buildPanel() {
const content = $("<div class='toolbarPanel' id='fontSizePanel'></div>"); const content = $("<div class='toolbarPanel' id='fontSizePanel'></div>");
content[0].innerHTML = '' content[0].innerHTML = ''
@ -32,7 +29,7 @@ const FontSizePanel = new Class({
+ '<div id="huge" model="15" style="font-size:24px">Huge</div>'; + '<div id="huge" model="15" style="font-size:24px">Huge</div>';
return content; return content;
}, }
}); }
export default FontSizePanel; export default FontSizePanel;

View File

@ -15,18 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import ToolbarPaneItem from './ToolbarPaneItem'; import ToolbarPaneItem from './ToolbarPaneItem';
import ImageIcon from '../ImageIcon'; import ImageIcon from '../ImageIcon';
const IconPanel = new Class({ class IconPanel extends ToolbarPaneItem {
Extends: ToolbarPaneItem,
initialize(buttonId, model) {
this.parent(buttonId, model);
},
_updateSelectedItem() { _updateSelectedItem() {
return this.getPanelElem(); return this.getPanelElem();
}, }
buildPanel() { buildPanel() {
const content = $('<div class="toolbarPanel" id="IconsPanel"></div>').css({ width: 245, height: 230 }); const content = $('<div class="toolbarPanel" id="IconsPanel"></div>').css({ width: 245, height: 230 });
@ -53,8 +49,8 @@ const IconPanel = new Class({
familyContent.append(img); familyContent.append(img);
var panel = this; const panel = this;
var model = this.getModel(); const model = this.getModel();
img.on('click', function (event) { img.on('click', function (event) {
model.setValue($(this).attr('id')); model.setValue($(this).attr('id'));
panel.hide(); panel.hide();
@ -64,7 +60,7 @@ const IconPanel = new Class({
} }
} }
return content; return content;
}, }
}); }
export default IconPanel; export default IconPanel;

View File

@ -15,16 +15,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import FloatingTip from './FloatingTip'; import FloatingTip from './FloatingTip';
const KeyboardShortcutTooltip = new Class({ class KeyboardShortcutTooltip extends FloatingTip {
Extends: FloatingTip, constructor(buttonElem, text) {
initialize(buttonElem, text) {
$assert(buttonElem, 'buttonElem can not be null'); $assert(buttonElem, 'buttonElem can not be null');
$assert(text, 'text can not be null'); $assert(text, 'text can not be null');
this._text = text;
const children = buttonElem.children().first(); const children = buttonElem.children().first();
const tipElemId = `${buttonElem.attr('id')}Tip`; const tipElemId = `${buttonElem.attr('id')}Tip`;
@ -32,21 +30,21 @@ const KeyboardShortcutTooltip = new Class({
tipDiv.append(children); tipDiv.append(children);
buttonElem.append(tipDiv); buttonElem.append(tipDiv);
this.parent(tipDiv, { super(tipDiv, {
// Content can also be a function of the target element! // Content can also be a function of the target element!
content: this._buildContent(), content: KeyboardShortcutTooltip._buildContent(),
html: true, html: true,
placement: 'bottom', placement: 'bottom',
className: 'keyboardShortcutTip', className: 'keyboardShortcutTip',
template: '<div class="popover popoverBlack" role="tooltip"><div class="arrow arrowBlack"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>', template: '<div class="popover popoverBlack" role="tooltip"><div class="arrow arrowBlack"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>',
}); });
this._text = text;
tipDiv.on('click', (e) => { tipDiv.on('click', (e) => {
tipDiv.trigger('mouseleave', e); tipDiv.trigger('mouseleave', e);
}); });
}, }
_buildContent() { static _buildContent() {
const result = $('<div></div>'); const result = $('<div></div>');
result.css({ result.css({
padding: '3px 0px', padding: '3px 0px',
@ -64,7 +62,7 @@ const KeyboardShortcutTooltip = new Class({
result.append(textContainer); result.append(textContainer);
return result; return result;
}, }
}); }
export default KeyboardShortcutTooltip; export default KeyboardShortcutTooltip;

View File

@ -17,15 +17,13 @@
*/ */
import FloatingTip from './FloatingTip'; import FloatingTip from './FloatingTip';
const LinkIconTooltip = new Class({ class LinkIconTooltip extends FloatingTip {
Extends: FloatingTip, constructor(linkIcon) {
initialize(linkIcon) {
$assert(linkIcon, 'linkIcon can not be null'); $assert(linkIcon, 'linkIcon can not be null');
const nativeElement = $(linkIcon.getImage().peer._native); const nativeElement = $(linkIcon.getImage().peer._native);
this.parent(nativeElement, { super(nativeElement, {
// Content can also be a function of the target element! // Content can also be a function of the target element!
content: this._buildContent(linkIcon), content: LinkIconTooltip._buildContent(linkIcon),
html: true, html: true,
placement: 'bottom', placement: 'bottom',
container: 'body', container: 'body',
@ -33,9 +31,9 @@ const LinkIconTooltip = new Class({
trigger: 'manual', trigger: 'manual',
template: '<div id="linkPopover" class="popover" onmouseover="$(this).mouseleave(function() {$(this).fadeOut(200); });" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>', template: '<div id="linkPopover" class="popover" onmouseover="$(this).mouseleave(function() {$(this).fadeOut(200); });" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>',
}); });
}, }
_buildContent(linkIcon) { static _buildContent(linkIcon) {
const result = $('<div></div>').css({ const result = $('<div></div>').css({
padding: '5px', padding: '5px',
width: '100%', width: '100%',
@ -73,7 +71,7 @@ const LinkIconTooltip = new Class({
imgContainer.append(link); imgContainer.append(link);
result.append(imgContainer); result.append(imgContainer);
return result; return result;
}, }
}); }
export default LinkIconTooltip; export default LinkIconTooltip;

View File

@ -17,12 +17,11 @@
*/ */
import ToolbarPaneItem from './ToolbarPaneItem'; import ToolbarPaneItem from './ToolbarPaneItem';
const ListToolbarPanel = new Class({ class ListToolbarPanel extends ToolbarPaneItem {
Extends: ToolbarPaneItem, constructor(buttonId, model) {
initialize(buttonId, model) { super(buttonId, model);
this.parent(buttonId, model);
this._initPanel(); this._initPanel();
}, }
_initPanel() { _initPanel() {
// Register on toolbar elements ... // Register on toolbar elements ...
@ -33,7 +32,7 @@ const ListToolbarPanel = new Class({
const value = $defined($(this).attr('model')) ? $(this).attr('model') : $(this).attr('id'); const value = $defined($(this).attr('model')) ? $(this).attr('model') : $(this).attr('id');
me.getModel().setValue(value); me.getModel().setValue(value);
}); });
}, }
_updateSelectedItem() { _updateSelectedItem() {
const panelElem = this.getPanelElem(); const panelElem = this.getPanelElem();
@ -42,11 +41,11 @@ const ListToolbarPanel = new Class({
_.each(menuElems, (elem) => { _.each(menuElems, (elem) => {
const elemValue = $defined($(elem).attr('model')) ? $(elem).attr('model') : $(elem).attr('id'); const elemValue = $defined($(elem).attr('model')) ? $(elem).attr('model') : $(elem).attr('id');
$assert(elemValue, 'elemValue can not be null'); $assert(elemValue, 'elemValue can not be null');
if (elemValue == value) $(elem).attr('class', 'toolbarPanelLinkSelectedLink'); if (elemValue === value) $(elem).attr('class', 'toolbarPanelLinkSelectedLink');
else $(elem).attr('class', 'toolbarPanelLink'); else $(elem).attr('class', 'toolbarPanelLink');
}); });
return panelElem; return panelElem;
}, }
}); }
export default ListToolbarPanel; export default ListToolbarPanel;

View File

@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import _ from '@libraries/underscore-min';
import { $defined } from '@wisemapping/core-js'; import { $defined } from '@wisemapping/core-js';
import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog'; import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog';
import IMenu from './IMenu'; import IMenu from './IMenu';
@ -26,11 +29,10 @@ import ColorPalettePanel from './ColorPalettePanel';
import ToolbarItem from './ToolbarItem'; import ToolbarItem from './ToolbarItem';
import KeyboardShortcutTooltip from './KeyboardShortcutTooltip'; import KeyboardShortcutTooltip from './KeyboardShortcutTooltip';
const Menu = new Class({ class Menu extends IMenu {
Extends: IMenu, constructor(designer, containerId, mapId, readOnly, baseUrl) {
super(designer, containerId, mapId);
initialize(designer, containerId, mapId, readOnly, baseUrl) { const saveElem = $('#save');
this.parent(designer, containerId, mapId);
baseUrl = !$defined(baseUrl) ? '' : baseUrl; baseUrl = !$defined(baseUrl) ? '' : baseUrl;
const widgetsBaseUrl = `${baseUrl}css/widget`; const widgetsBaseUrl = `${baseUrl}css/widget`;
@ -57,7 +59,7 @@ const Menu = new Class({
let result = null; let result = null;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const fontFamily = nodes[i].getFontFamily(); const fontFamily = nodes[i].getFontFamily();
if (result != null && result != fontFamily) { if (result != null && result !== fontFamily) {
result = null; result = null;
break; break;
} }
@ -71,7 +73,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new FontFamilyPanel('fontFamily', fontFamilyModel)); this._toolbarElems.push(new FontFamilyPanel('fontFamily', fontFamilyModel));
this._registerTooltip('fontFamily', $msg('FONT_FAMILY')); Menu._registerTooltip('fontFamily', $msg('FONT_FAMILY'));
} }
const fontSizeBtn = $('#fontSize'); const fontSizeBtn = $('#fontSize');
@ -82,7 +84,7 @@ const Menu = new Class({
let result = null; let result = null;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const fontSize = nodes[i].getFontSize(); const fontSize = nodes[i].getFontSize();
if (result != null && result != fontSize) { if (result != null && result !== fontSize) {
result = null; result = null;
break; break;
} }
@ -95,7 +97,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new FontSizePanel('fontSize', fontSizeModel)); this._toolbarElems.push(new FontSizePanel('fontSize', fontSizeModel));
this._registerTooltip('fontSize', $msg('FONT_SIZE')); Menu._registerTooltip('fontSize', $msg('FONT_SIZE'));
} }
const topicShapeBtn = $('#topicShape'); const topicShapeBtn = $('#topicShape');
@ -106,7 +108,7 @@ const Menu = new Class({
let result = null; let result = null;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const shapeType = nodes[i].getShapeType(); const shapeType = nodes[i].getShapeType();
if (result != null && result != shapeType) { if (result != null && result !== shapeType) {
result = null; result = null;
break; break;
} }
@ -119,7 +121,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new TopicShapePanel('topicShape', topicShapeModel)); this._toolbarElems.push(new TopicShapePanel('topicShape', topicShapeModel));
this._registerTooltip('topicShape', $msg('TOPIC_SHAPE')); Menu._registerTooltip('topicShape', $msg('TOPIC_SHAPE'));
} }
const topicIconBtn = $('#topicIcon'); const topicIconBtn = $('#topicIcon');
@ -134,7 +136,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new IconPanel('topicIcon', topicIconModel)); this._toolbarElems.push(new IconPanel('topicIcon', topicIconModel));
this._registerTooltip('topicIcon', $msg('TOPIC_ICON')); Menu._registerTooltip('topicIcon', $msg('TOPIC_ICON'));
} }
// Topic color item ... // Topic color item ...
@ -146,7 +148,7 @@ const Menu = new Class({
let result = null; let result = null;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const color = nodes[i].getBackgroundColor(); const color = nodes[i].getBackgroundColor();
if (result != null && result != color) { if (result != null && result !== color) {
result = null; result = null;
break; break;
} }
@ -159,7 +161,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl)); this._toolbarElems.push(new ColorPalettePanel('topicColor', topicColorModel, widgetsBaseUrl));
this._registerTooltip('topicColor', $msg('TOPIC_COLOR')); Menu._registerTooltip('topicColor', $msg('TOPIC_COLOR'));
} }
// Border color item ... // Border color item ...
@ -171,7 +173,7 @@ const Menu = new Class({
let result = null; let result = null;
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const color = nodes[i].getBorderColor(); const color = nodes[i].getBorderColor();
if (result != null && result != color) { if (result != null && result !== color) {
result = null; result = null;
break; break;
} }
@ -184,7 +186,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl)); this._toolbarElems.push(new ColorPalettePanel('topicBorder', borderColorModel, widgetsBaseUrl));
this._registerTooltip('topicBorder', $msg('TOPIC_BORDER_COLOR')); Menu._registerTooltip('topicBorder', $msg('TOPIC_BORDER_COLOR'));
} }
// Font color item ... // Font color item ...
@ -196,7 +198,7 @@ const Menu = new Class({
const nodes = designerModel.filterSelectedTopics(); const nodes = designerModel.filterSelectedTopics();
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
const color = nodes[i].getFontColor(); const color = nodes[i].getFontColor();
if (result != null && result != color) { if (result != null && result !== color) {
result = null; result = null;
break; break;
} }
@ -209,7 +211,7 @@ const Menu = new Class({
}, },
}; };
this._toolbarElems.push(new ColorPalettePanel('fontColor', fontColorModel, baseUrl)); this._toolbarElems.push(new ColorPalettePanel('fontColor', fontColorModel, baseUrl));
this._registerTooltip('fontColor', $msg('FONT_COLOR')); Menu._registerTooltip('fontColor', $msg('FONT_COLOR'));
} }
this._addButton('export', false, false, () => { this._addButton('export', false, false, () => {
@ -218,7 +220,7 @@ const Menu = new Class({
closeButton: true, closeButton: true,
}); });
}); });
this._registerTooltip('export', $msg('EXPORT')); Menu._registerTooltip('export', $msg('EXPORT'));
const me = this; const me = this;
@ -228,17 +230,17 @@ const Menu = new Class({
window.open(`${baseUrl}c/maps/${mapId}/print`); window.open(`${baseUrl}c/maps/${mapId}/print`);
}); });
this._registerTooltip('print', $msg('PRINT')); Menu._registerTooltip('print', $msg('PRINT'));
this._addButton('zoomIn', false, false, () => { this._addButton('zoomIn', false, false, () => {
designer.zoomIn(); designer.zoomIn();
}); });
this._registerTooltip('zoomIn', $msg('ZOOM_IN')); Menu._registerTooltip('zoomIn', $msg('ZOOM_IN'));
this._addButton('zoomOut', false, false, () => { this._addButton('zoomOut', false, false, () => {
designer.zoomOut(); designer.zoomOut();
}); });
this._registerTooltip('zoomOut', $msg('ZOOM_OUT')); Menu._registerTooltip('zoomOut', $msg('ZOOM_OUT'));
const undoButton = this._addButton('undoEdition', false, false, () => { const undoButton = this._addButton('undoEdition', false, false, () => {
designer.undo(); designer.undo();
@ -246,7 +248,7 @@ const Menu = new Class({
if (undoButton) { if (undoButton) {
undoButton.disable(); undoButton.disable();
} }
this._registerTooltip('undoEdition', $msg('UNDO'), 'meta+Z'); Menu._registerTooltip('undoEdition', $msg('UNDO'), 'meta+Z');
const redoButton = this._addButton('redoEdition', false, false, () => { const redoButton = this._addButton('redoEdition', false, false, () => {
designer.redo(); designer.redo();
@ -254,7 +256,7 @@ const Menu = new Class({
if (redoButton) { if (redoButton) {
redoButton.disable(); redoButton.disable();
} }
this._registerTooltip('redoEdition', $msg('REDO'), 'meta+shift+Z'); Menu._registerTooltip('redoEdition', $msg('REDO'), 'meta+shift+Z');
if (redoButton && undoButton) { if (redoButton && undoButton) {
designer.addEvent('modelUpdate', (event) => { designer.addEvent('modelUpdate', (event) => {
@ -274,45 +276,44 @@ const Menu = new Class({
this._addButton('addTopic', true, false, () => { this._addButton('addTopic', true, false, () => {
designer.createSiblingForSelectedNode(); designer.createSiblingForSelectedNode();
}); });
this._registerTooltip('addTopic', $msg('ADD_TOPIC'), 'Enter'); Menu._registerTooltip('addTopic', $msg('ADD_TOPIC'), 'Enter');
this._addButton('deleteTopic', true, true, () => { this._addButton('deleteTopic', true, true, () => {
designer.deleteSelectedEntities(); designer.deleteSelectedEntities();
}); });
this._registerTooltip('deleteTopic', $msg('TOPIC_DELETE'), 'Delete'); Menu._registerTooltip('deleteTopic', $msg('TOPIC_DELETE'), 'Delete');
this._addButton('topicLink', true, false, () => { this._addButton('topicLink', true, false, () => {
designer.addLink(); designer.addLink();
}); });
this._registerTooltip('topicLink', $msg('TOPIC_LINK')); Menu._registerTooltip('topicLink', $msg('TOPIC_LINK'));
this._addButton('topicRelation', true, false, (event) => { this._addButton('topicRelation', true, false, (event) => {
designer.showRelPivot(event); designer.showRelPivot(event);
}); });
this._registerTooltip('topicRelation', $msg('TOPIC_RELATIONSHIP')); Menu._registerTooltip('topicRelation', $msg('TOPIC_RELATIONSHIP'));
this._addButton('topicNote', true, false, () => { this._addButton('topicNote', true, false, () => {
designer.addNote(); designer.addNote();
}); });
this._registerTooltip('topicNote', $msg('TOPIC_NOTE')); Menu._registerTooltip('topicNote', $msg('TOPIC_NOTE'));
this._addButton('fontBold', true, false, () => { this._addButton('fontBold', true, false, () => {
designer.changeFontWeight(); designer.changeFontWeight();
}); });
this._registerTooltip('fontBold', $msg('FONT_BOLD'), 'meta+B'); Menu._registerTooltip('fontBold', $msg('FONT_BOLD'), 'meta+B');
this._addButton('fontItalic', true, false, () => { this._addButton('fontItalic', true, false, () => {
designer.changeFontStyle(); designer.changeFontStyle();
}); });
this._registerTooltip('fontItalic', $msg('FONT_ITALIC'), 'meta+I'); Menu._registerTooltip('fontItalic', $msg('FONT_ITALIC'), 'meta+I');
var saveElem = $('#save');
if (saveElem) { if (saveElem) {
this._addButton('save', false, false, this._addButton('save', false, false,
() => { () => {
me.save(saveElem, designer, true); me.save(saveElem, designer, true);
}); });
this._registerTooltip('save', $msg('SAVE'), 'meta+S'); Menu._registerTooltip('save', $msg('SAVE'), 'meta+S');
if (!readOnly) { if (!readOnly) {
// To prevent the user from leaving the page with changes ... // To prevent the user from leaving the page with changes ...
@ -340,7 +341,7 @@ const Menu = new Class({
this._addButton('discard', false, false, () => { this._addButton('discard', false, false, () => {
me.discardChanges(designer); me.discardChanges(designer);
}); });
this._registerTooltip('discard', $msg('DISCARD_CHANGES')); Menu._registerTooltip('discard', $msg('DISCARD_CHANGES'));
} }
const shareElem = $('#shareIt'); const shareElem = $('#shareIt');
@ -352,7 +353,7 @@ const Menu = new Class({
}); });
designer.onObjectFocusEvent(); designer.onObjectFocusEvent();
}); });
this._registerTooltip('shareIt', $msg('COLLABORATE')); Menu._registerTooltip('shareIt', $msg('COLLABORATE'));
} }
const publishElem = $('#publishIt'); const publishElem = $('#publishIt');
@ -364,7 +365,7 @@ const Menu = new Class({
}); });
designer.onObjectFocusEvent(); designer.onObjectFocusEvent();
}); });
this._registerTooltip('publishIt', $msg('PUBLISH')); Menu._registerTooltip('publishIt', $msg('PUBLISH'));
} }
const historyElem = $('#history'); const historyElem = $('#history');
@ -376,7 +377,7 @@ const Menu = new Class({
}); });
designer.onObjectFocusEvent(); designer.onObjectFocusEvent();
}); });
this._registerTooltip('history', $msg('HISTORY')); Menu._registerTooltip('history', $msg('HISTORY'));
} }
this._registerEvents(designer); this._registerEvents(designer);
@ -406,7 +407,7 @@ const Menu = new Class({
event.preventDefault(); event.preventDefault();
}); });
} }
}, }
_registerEvents(designer) { _registerEvents(designer) {
const me = this; const me = this;
@ -454,7 +455,7 @@ const Menu = new Class({
} }
}); });
}); });
}, }
_addButton(buttonId, topic, rel, fn) { _addButton(buttonId, topic, rel, fn) {
const me = this; const me = this;
@ -470,18 +471,18 @@ const Menu = new Class({
result = button; result = button;
} }
return result; return result;
}, }
_registerTooltip(buttonId, text, shortcut) { static _registerTooltip(buttonId, text, shortcut) {
if ($(`#${buttonId}`)) { if ($(`#${buttonId}`)) {
let tooltip = text; let tooltip = text;
if (shortcut) { if (shortcut) {
shortcut = navigator.appVersion.indexOf('Mac') != -1 ? shortcut.replace('meta+', '⌘') : shortcut.replace('meta+', 'ctrl+'); shortcut = navigator.appVersion.indexOf('Mac') !== -1 ? shortcut.replace('meta+', '⌘') : shortcut.replace('meta+', 'ctrl+');
tooltip = `${tooltip} (${shortcut})`; tooltip = `${tooltip} (${shortcut})`;
} }
new KeyboardShortcutTooltip($(`#${buttonId}`), tooltip); new KeyboardShortcutTooltip($(`#${buttonId}`), tooltip);
} }
}, }
}); }
export default Menu; export default Menu;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import jQuery from '@libraries/jquery-2.1.0';
import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog'; import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog';
const NoteEditor = new Class({ const NoteEditor = new Class({

View File

@ -15,42 +15,49 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import Events from '../Events'; import Events from '../Events';
const ToolbarItem = new Class({ class ToolbarItem extends Events {
Implements: Events, // FIXME: should be extends? constructor(buttonId, fn, options) {
initialize(buttonId, fn, options) {
$assert(buttonId, 'buttonId can not be null'); $assert(buttonId, 'buttonId can not be null');
$assert(fn, 'fn can not be null'); super();
this._buttonId = buttonId; this._buttonId = buttonId;
this._fn = fn;
this._options = options; this._options = options;
if (fn) {
this.setEventHandler(fn);
}
}
setEventHandler(fn) {
$assert(fn, 'fn can not be null');
this._fn = fn;
this._enable = false; this._enable = false;
this.enable(); this.enable();
}, }
getButtonElem: function () { getButtonElem() {
const elem = $(`#${this._buttonId}`); const elem = $(`#${this._buttonId}`);
$assert(elem, `Could not find element for ${this._buttonId}`); $assert(elem, `Could not find element for ${this._buttonId}`);
return elem; return elem;
}.protect(), }
show() { show() {
this.fireEvent('show'); this.fireEvent('show');
}, }
hide() { hide() {
this.fireEvent('hide'); this.fireEvent('hide');
}, }
isTopicAction() { isTopicAction() {
return this._options.topicAction; return this._options.topicAction;
}, }
isRelAction() { isRelAction() {
return this._options.relAction; return this._options.relAction;
}, }
disable() { disable() {
const elem = this.getButtonElem(); const elem = this.getButtonElem();
@ -60,7 +67,7 @@ const ToolbarItem = new Class({
elem.addClass('buttonOff'); elem.addClass('buttonOff');
this._enable = false; this._enable = false;
} }
}, }
enable() { enable() {
const elem = this.getButtonElem(); const elem = this.getButtonElem();
@ -70,11 +77,11 @@ const ToolbarItem = new Class({
elem.addClass('buttonOn'); elem.addClass('buttonOn');
this._enable = true; this._enable = true;
} }
}, }
getTip: function () { getTip() {
return this._tip; return this._tip;
}.protect(), }
}); }
export default ToolbarItem; export default ToolbarItem;

View File

@ -19,21 +19,18 @@ import { $assert } from '@wisemapping/core-js';
import ToolbarItem from './ToolbarItem'; import ToolbarItem from './ToolbarItem';
import FloatingTip from './FloatingTip'; import FloatingTip from './FloatingTip';
const ToolbarPaneItem = new Class({ class ToolbarPaneItem extends ToolbarItem {
Extends: ToolbarItem, constructor(buttonId, model) {
initialize(buttonId, model) {
$assert(buttonId, 'buttonId can not be null'); $assert(buttonId, 'buttonId can not be null');
$assert(model, 'model can not be null'); $assert(model, 'model can not be null');
this._model = model; super(buttonId, null, { topicAction: true, relAction: false });
const me = this;
const fn = () => {
return me.isVisible() ? me.hide() : me.show();
};
this.parent(buttonId, fn, { topicAction: true, relAction: false }); const handler = () => (this.isVisible() ? this.hide() : this.show());
this.setEventHandler(handler);
this._model = model;
this._panelElem = this._init(); this._panelElem = this._init();
this._visible = false; this._visible = false;
}, }
_init() { _init() {
// Load the context of the panel ... // Load the context of the panel ...
@ -63,15 +60,15 @@ const ToolbarPaneItem = new Class({
}); });
return panelElem; return panelElem;
}, }
getModel() { getModel() {
return this._model; return this._model;
}, }
getPanelElem: function () { getPanelElem() {
return this._panelElem; return this._panelElem;
}.protect(), }
show() { show() {
if (!this.isVisible()) { if (!this.isVisible()) {
@ -79,7 +76,7 @@ const ToolbarPaneItem = new Class({
this._tip.show(); this._tip.show();
this.getButtonElem().className = 'buttonExtActive'; this.getButtonElem().className = 'buttonExtActive';
} }
}, }
hide() { hide() {
if (this.isVisible()) { if (this.isVisible()) {
@ -87,11 +84,11 @@ const ToolbarPaneItem = new Class({
this._tip.hide(); this._tip.hide();
this.getButtonElem().className = 'buttonExtOn'; this.getButtonElem().className = 'buttonExtOn';
} }
}, }
isVisible() { isVisible() {
return this._visible; return this._visible;
}, }
disable() { disable() {
this.hide(); this.hide();
@ -106,7 +103,7 @@ const ToolbarPaneItem = new Class({
elem.addClass('buttonExtOff'); elem.addClass('buttonExtOff');
this._enable = false; this._enable = false;
} }
}, }
enable() { enable() {
const elem = this.getButtonElem(); const elem = this.getButtonElem();
@ -116,11 +113,12 @@ const ToolbarPaneItem = new Class({
elem.addClass('buttonExtOn'); elem.addClass('buttonExtOn');
this._enable = true; this._enable = true;
} }
}, }
buildPanel: function () { // eslint-disable-next-line class-methods-use-this
buildPanel() {
throw new Error('Method must be implemented'); throw new Error('Method must be implemented');
}.protect(), }
}); }
export default ToolbarPaneItem; export default ToolbarPaneItem;

View File

@ -15,14 +15,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import $ from '@libraries/jquery-2.1.0';
import ListToolbarPanel from './ListToolbarPanel'; import ListToolbarPanel from './ListToolbarPanel';
const TopicShapePanel = new Class({ class TopicShapePanel extends ListToolbarPanel {
Extends: ListToolbarPanel, // eslint-disable-next-line class-methods-use-this
initialize(buttonId, model) {
this.parent(buttonId, model);
},
buildPanel() { buildPanel() {
const content = $("<div class='toolbarPanel' id='topicShapePanel'></div>"); const content = $("<div class='toolbarPanel' id='topicShapePanel'></div>");
content[0].innerHTML = '' content[0].innerHTML = ''
@ -32,7 +29,7 @@ const TopicShapePanel = new Class({
+ '<div id="elipse" model="elipse"><img src="images/shape-circle.png"></div>'; + '<div id="elipse" model="elipse"><img src="images/shape-circle.png"></div>';
return content; return content;
}, }
}); }
export default TopicShapePanel; export default TopicShapePanel;

View File

@ -1,37 +0,0 @@
import colorPalettePanel from './ColorPalettePanel';
import floatingTip from './FloatingTip';
import fontFamilyPanel from './FontFamilyPanel';
import fontSizePanel from './FontSizePanel';
import iconPanel from './IconPanel';
import iMenu from './IMenu';
import keyboardShortcutTooltip from './KeyboardShortcutTooltip';
import linkEditor from './LinkEditor';
import linkIconTooltip from './LinkIconTooltip';
import listToolbarPanel from './ListToolbarPanel';
import menu from './Menu';
import modalDialogNotifier from './ModalDialogNotifier';
import noteEditor from './NoteEditor';
import toolbarItem from './ToolbarItem';
import toolbarNotifier from './ToolbarNotifier';
import toolbarPanelItem from './ToolbarPaneItem';
import topicShapePanel from './TopicShapePanel';
export default {
ColorPalettePanel: colorPalettePanel,
FloatingTip: floatingTip,
FontFamilyPanel: fontFamilyPanel,
FontSizePanel: fontSizePanel,
IconPanel: iconPanel,
IMenu: iMenu,
KeyboardShortcutTooltip: keyboardShortcutTooltip,
LinkEditor: linkEditor,
LinkIconTooltip: linkIconTooltip,
ListToolbarPanel: listToolbarPanel,
Menu: menu,
ModalDialogNotifier: modalDialogNotifier,
NoteEditor: noteEditor,
ToolbarItem: toolbarItem,
ToolbarNotifier: toolbarNotifier,
ToolbarPaneItem: toolbarPanelItem,
TopicShapePanel: topicShapePanel,
};

View File

@ -0,0 +1,13 @@
/* eslint-disable no-unused-vars */
import '@libraries/mootools-core-1.4.5';
import _ from '@libraries/underscore-min';
import Mindmap from './components/model/Mindmap';
import PersistenceManager from './components/PersistenceManager';
import Designer from './components/Designer';
import LocalStorageManager from './components/LocalStorageManager';
import Menu from './components/widget/Menu';
export {
Mindmap, PersistenceManager, Designer, LocalStorageManager, Menu,
};

View File

@ -1,6 +0,0 @@
/* eslint-disable no-unused-vars */
import '@libraries/mootools-core-1.4.5';
import _ from '@libraries/underscore-min';
import Mindmap from './components/model/Mindmap';
import PersistenceManager from './components/PersistenceManager';

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import TestSuite from './TestSuite'; import TestSuite from './TestSuite';
import mindplot from '../../../src/mindplot'; import LayoutManager from '../../../src/components/layout/LayoutManager';
const BalancedTestSuite = new Class({ const BalancedTestSuite = new Class({
Extends: TestSuite, Extends: TestSuite,
@ -33,7 +33,7 @@ const BalancedTestSuite = new Class({
console.log('testBalanced:'); console.log('testBalanced:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const plotsize = { width: 1000, height: 200 }; const plotsize = { width: 1000, height: 200 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.connectNode(0, 1, 0); manager.connectNode(0, 1, 0);
@ -181,7 +181,7 @@ const BalancedTestSuite = new Class({
testBalancedPredict() { testBalancedPredict() {
console.log('testBalancedPredict:'); console.log('testBalancedPredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -340,7 +340,7 @@ const BalancedTestSuite = new Class({
testBalancedNodeDragPredict() { testBalancedNodeDragPredict() {
console.log('testBalancedNodeDragPredict:'); console.log('testBalancedNodeDragPredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Graph 1 // Graph 1
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import TestSuite from './TestSuite'; import TestSuite from './TestSuite';
import mindplot from '../../../src/mindplot'; import LayoutManager from '../../../src/components/layout/LayoutManager';
const FreeTestSuite = new Class({ const FreeTestSuite = new Class({
Extends: TestSuite, Extends: TestSuite,
@ -37,7 +37,7 @@ const FreeTestSuite = new Class({
testFreePosition() { testFreePosition() {
console.log('testFreePosition:'); console.log('testFreePosition:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -147,7 +147,7 @@ const FreeTestSuite = new Class({
testFreePredict() { testFreePredict() {
console.log('testFreePredict:'); console.log('testFreePredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -217,7 +217,7 @@ const FreeTestSuite = new Class({
testReconnectFreeNode() { testReconnectFreeNode() {
console.log('testReconnectFreeNode:'); console.log('testReconnectFreeNode:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -307,7 +307,7 @@ const FreeTestSuite = new Class({
testSiblingOverlapping() { testSiblingOverlapping() {
console.log('testSiblingOverlapping:'); console.log('testSiblingOverlapping:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
@ -340,7 +340,7 @@ const FreeTestSuite = new Class({
testRootNodeChildrenPositioning() { testRootNodeChildrenPositioning() {
console.log('testRootNodeChildrenPositioning:'); console.log('testRootNodeChildrenPositioning:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
@ -383,7 +383,7 @@ const FreeTestSuite = new Class({
testBalancedFreePredict() { testBalancedFreePredict() {
console.log('testBalancedFreePredict:'); console.log('testBalancedFreePredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
@ -403,7 +403,7 @@ const FreeTestSuite = new Class({
testFreeReorder() { testFreeReorder() {
console.log('testFreeReorder:'); console.log('testFreeReorder:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
@ -440,7 +440,7 @@ const FreeTestSuite = new Class({
testFreeOverlap() { testFreeOverlap() {
console.log('testFreeOverlap:'); console.log('testFreeOverlap:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
@ -481,17 +481,12 @@ const FreeTestSuite = new Class({
const node = manager.find(id); const node = manager.find(id);
$assert( $assert(
node.getPosition().x == position.x && node.getPosition().y == position.y, node.getPosition().x == position.x && node.getPosition().y == position.y,
`Freely moved node ${ `Freely moved node ${id
id } is not left at free position (${position.x
} is not left at free position (${ },${position.y
position.x
},${
position.y
}). ` }). `
+ `Actual position: (${ + `Actual position: (${node.getPosition().x
node.getPosition().x },${node.getPosition().y
},${
node.getPosition().y
})`, })`,
); );
} }

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import TestSuite from './TestSuite'; import TestSuite from './TestSuite';
import mindplot from '../../../src/mindplot'; import LayoutManager from '../../../src/components/layout/LayoutManager';
const SymmetricTestSuite = new Class({ const SymmetricTestSuite = new Class({
Extends: TestSuite, Extends: TestSuite,
@ -32,7 +32,7 @@ const SymmetricTestSuite = new Class({
testSymmetry() { testSymmetry() {
console.log('testSymmetry:'); console.log('testSymmetry:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -68,16 +68,16 @@ const SymmetricTestSuite = new Class({
// All nodes should be positioned symmetrically with respect to their common ancestors // All nodes should be positioned symmetrically with respect to their common ancestors
$assert( $assert(
manager.find(14).getPosition().y == manager.find(13).getPosition().y, manager.find(14).getPosition().y === manager.find(13).getPosition().y,
'Symmetry is not respected', 'Symmetry is not respected',
); );
$assert( $assert(
manager.find(5).getPosition().y == manager.find(10).getPosition().y, manager.find(5).getPosition().y === manager.find(10).getPosition().y,
'Symmetry is not respected', 'Symmetry is not respected',
); );
$assert( $assert(
manager.find(11).getPosition().y - manager.find(6).getPosition().y manager.find(11).getPosition().y - manager.find(6).getPosition().y
== -(manager.find(12).getPosition().y - manager.find(6).getPosition().y), === -(manager.find(12).getPosition().y - manager.find(6).getPosition().y),
'Symmetry is not respected', 'Symmetry is not respected',
); );
$assert( $assert(
@ -97,7 +97,7 @@ const SymmetricTestSuite = new Class({
testSymmetricPredict() { testSymmetricPredict() {
console.log('testSymmetricPredict:'); console.log('testSymmetricPredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -281,7 +281,7 @@ const SymmetricTestSuite = new Class({
testSymmetricDragPredict() { testSymmetricDragPredict() {
console.log('testSymmetricDragPredict:'); console.log('testSymmetricDragPredict:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 1); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 1);
manager.addNode(2, TestSuite.NODE_SIZE, position).connectNode(1, 2, 0); manager.addNode(2, TestSuite.NODE_SIZE, position).connectNode(1, 2, 0);

View File

@ -15,10 +15,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import mindplot from '../../../src/mindplot'; import LayoutManager from '../../../src/components/layout/LayoutManager';
const TestSuite = new Class({ const TestSuite = new Class({
Extends: mindplot.layout.ChildrenSorterStrategy, Extends: ChildrenSorterStrategy,
initialize() { initialize() {
$('#basicTest').css('display', 'block'); $('#basicTest').css('display', 'block');
@ -37,7 +37,7 @@ const TestSuite = new Class({
testAligned() { testAligned() {
console.log('testAligned:'); console.log('testAligned:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
manager.addNode(2, TestSuite.NODE_SIZE, position).connectNode(1, 2, 0); manager.addNode(2, TestSuite.NODE_SIZE, position).connectNode(1, 2, 0);
@ -84,7 +84,7 @@ const TestSuite = new Class({
testBaselineAligned1() { testBaselineAligned1() {
console.log('testBaselineAligned1:'); console.log('testBaselineAligned1:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
manager.addNode(3, TestSuite.NODE_SIZE, position).connectNode(1, 3, 0); manager.addNode(3, TestSuite.NODE_SIZE, position).connectNode(1, 3, 0);
@ -130,7 +130,7 @@ const TestSuite = new Class({
testBaselineAligned2() { testBaselineAligned2() {
console.log('testBaselineAligned2:'); console.log('testBaselineAligned2:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
manager.addNode(2, { width: 130, height: 200 }, position).connectNode(1, 2, 0); manager.addNode(2, { width: 130, height: 200 }, position).connectNode(1, 2, 0);
@ -148,7 +148,7 @@ const TestSuite = new Class({
testEvents() { testEvents() {
console.log('testEvents:'); console.log('testEvents:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -161,14 +161,10 @@ const TestSuite = new Class({
const events = []; const events = [];
manager.addEvent('change', (event) => { manager.addEvent('change', (event) => {
console.log( console.log(
`\tUpdated nodes: {id:${ `\tUpdated nodes: {id:${event.getId()
event.getId() }, order: ${event.getOrder()
}, order: ${ },position: {${event.getPosition().x
event.getOrder() },${event.getPosition().y
},position: {${
event.getPosition().x
},${
event.getPosition().y
}}`, }}`,
); );
events.push(event); events.push(event);
@ -190,7 +186,7 @@ const TestSuite = new Class({
testEventsComplex() { testEventsComplex() {
console.log('testEventsComplex:'); console.log('testEventsComplex:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -207,14 +203,10 @@ const TestSuite = new Class({
const events = []; const events = [];
manager.addEvent('change', (event) => { manager.addEvent('change', (event) => {
console.log( console.log(
`\tUpdated nodes: {id:${ `\tUpdated nodes: {id:${event.getId()
event.getId() }, order: ${event.getOrder()
}, order: ${ },position: {${event.getPosition().x
event.getOrder() },${event.getPosition().y
},position: {${
event.getPosition().x
},${
event.getPosition().y
}}`, }}`,
); );
events.push(event); events.push(event);
@ -242,7 +234,7 @@ const TestSuite = new Class({
testDisconnect() { testDisconnect() {
console.log('testDisconnect:'); console.log('testDisconnect:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -265,10 +257,8 @@ const TestSuite = new Class({
const posStr = pos ? `,position: {${pos.x},${pos.y}` : ''; const posStr = pos ? `,position: {${pos.x},${pos.y}` : '';
const node = manager.find(event.getId()); const node = manager.find(event.getId());
console.log( console.log(
`\tUpdated nodes: {id:${ `\tUpdated nodes: {id:${event.getId()
event.getId() }, order: ${event.getOrder()
}, order: ${
event.getOrder()
}${posStr }${posStr
}}`, }}`,
); );
@ -305,7 +295,7 @@ const TestSuite = new Class({
testReconnect() { testReconnect() {
console.log('testReconnect:'); console.log('testReconnect:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -367,7 +357,7 @@ const TestSuite = new Class({
testRemoveNode() { testRemoveNode() {
console.log('testRemoveNode:'); console.log('testRemoveNode:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -437,7 +427,7 @@ const TestSuite = new Class({
testSize() { testSize() {
console.log('testSize:'); console.log('testSize:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, { width: 60, height: 60 }, position); manager.addNode(1, { width: 60, height: 60 }, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -534,7 +524,7 @@ const TestSuite = new Class({
testReconnectSingleNode() { testReconnectSingleNode() {
console.log('testReconnectSingleNode:'); console.log('testReconnectSingleNode:');
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
// Prepare a sample graph ... // Prepare a sample graph ...
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
@ -565,19 +555,16 @@ const TestSuite = new Class({
}, },
_plotPrediction(canvas, prediction) { _plotPrediction(canvas, prediction) {
if(!canvas) { if (!canvas) {
console.warn('no canvas in _plotPrediction. Remove this method if plot() not in use'); console.warn('no canvas in _plotPrediction. Remove this method if plot() not in use');
return; return;
} }
const { position } = prediction; const { position } = prediction;
const { order } = prediction; const { order } = prediction;
console.log( console.log(
`\t\tprediction {order:${ `\t\tprediction {order:${order
order }, position: (${position.x
}, position: (${ },${position.y
position.x
},${
position.y
})}`, })}`,
); );
const cx = position.x + canvas.width / 2 - TestSuite.NODE_SIZE.width / 2; const cx = position.x + canvas.width / 2 - TestSuite.NODE_SIZE.width / 2;
@ -587,6 +574,6 @@ const TestSuite = new Class({
}); });
(TestSuite.NODE_SIZE = { width: 80, height: 30 }), (TestSuite.NODE_SIZE = { width: 80, height: 30 }),
(TestSuite.ROOT_NODE_SIZE = { width: 120, height: 40 }); (TestSuite.ROOT_NODE_SIZE = { width: 120, height: 40 });
export default TestSuite; export default TestSuite;

View File

@ -1,23 +1,21 @@
BootstrapDialog.Request = new Class({ BootstrapDialog.Request = new Class({
Extends: BootstrapDialog, Extends: BootstrapDialog,
initialize: function (url, title, options) {
initialize: function(url, title, options) {
this.parent(title, options); this.parent(title, options);
this.requestOptions = {}; this.requestOptions = {};
this.requestOptions.cache = false; this.requestOptions.cache = false;
var me = this; var me = this;
this.requestOptions.fail = function(xhr) { this.requestOptions.fail = function (xhr) {
// Intercept form requests ... // Intercept form requests ...
console.log("Failure:"); console.log("Failure:");
console.log(xhr); console.log(xhr);
}; };
this.requestOptions.success = function() { this.requestOptions.success = function () {
// Intercept form requests ... // Intercept form requests ...
var forms = me._native.find('form'); var forms = me._native.find('form');
_.each(forms, function(form) { _.each(forms, function (form) {
$(form).on('submit', function(event) { $(form).on('submit', function (event) {
// Intercept form ... // Intercept form ...
me.requestOptions.url = form.action; me.requestOptions.url = form.action;
me.requestOptions.method = form.method ? form.method : 'post'; me.requestOptions.method = form.method ? form.method : 'post';
@ -39,8 +37,8 @@ BootstrapDialog.Request = new Class({
}); });
}, },
onDialogShown: function() { onDialogShown: function () {
if (typeof(onDialogShown) == "function") { if (typeof (onDialogShown) == "function") {
onDialogShown(); onDialogShown();
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -16,9 +16,10 @@
* limitations under the License. * limitations under the License.
*/ */
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import Mindmap from '../../../../src/components/model/Mindmap'; import { Mindmap, PersistenceManager, Designer, LocalStorageManager, Menu } from '../../../../src/';
import PersistenceManager from '../../../../src/components/PersistenceManager';
import $ from '@libraries/jquery-2.1.0' import $ from '@libraries/jquery-2.1.0';
global.jQuery = $;
let designer = null; let designer = null;
@ -48,7 +49,7 @@ function buildDesigner(options) {
$assert(container, 'container could not be null'); $assert(container, 'container could not be null');
// Register load events ... // Register load events ...
designer = new mindplot.Designer(options, container); designer = new Designer(options, container);
designer.addEvent('loadSuccess', () => { designer.addEvent('loadSuccess', () => {
window.waitDialog.close(); window.waitDialog.close();
window.waitDialog = null; window.waitDialog = null;
@ -109,13 +110,13 @@ function buildDesigner(options) {
persistence = options.persistenceManager; persistence = options.persistenceManager;
} }
} else { } else {
persistence = new mindplot.LocalStorageManager('samples/{id}.xml'); persistence = new LocalStorageManager('samples/{id}.xml');
} }
mindplot.PersistenceManager.init(persistence); PersistenceManager.init(persistence);
// Register toolbar event ... // Register toolbar event ...
if ($('#toolbar')) { if ($('#toolbar')) {
const menu = new mindplot.widget.Menu(designer, 'toolbar', options.mapId, ''); const menu = new Menu(designer, 'toolbar', options.mapId, '');
// If a node has focus, focus can be move to another node using the keys. // If a node has focus, focus can be move to another node using the keys.
designer._cleanScreen = function () { designer._cleanScreen = function () {
@ -193,7 +194,7 @@ global.editor.WaitDialog = new Class({
// Show loading dialog ... // Show loading dialog ...
$(() => { $(() => {
import('./bootstrap').then(() => { import('../../../../../../libraries/bootstrap').then(() => {
global.waitDialog = new global.editor.WaitDialog(); global.waitDialog = new global.editor.WaitDialog();
global.waitDialog.show(); global.waitDialog.show();

View File

@ -1,7 +1,9 @@
import LayoutManager from '../../../src/components/layout/LayoutManager';
describe('Balanced Test Suite', () => { describe('Balanced Test Suite', () => {
it('balancedTest', () => { it('balancedTest', () => {
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.connectNode(0, 1, 0); manager.connectNode(0, 1, 0);
manager.layout(); manager.layout();
@ -96,7 +98,7 @@ describe('Balanced Test Suite', () => {
it('balancedPredictTest', () => { it('balancedPredictTest', () => {
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position); manager.addNode(1, TestSuite.NODE_SIZE, position);
manager.addNode(2, TestSuite.NODE_SIZE, position); manager.addNode(2, TestSuite.NODE_SIZE, position);
@ -198,7 +200,7 @@ describe('Balanced Test Suite', () => {
it('balancedNodeDragPredictTest', () => { it('balancedNodeDragPredictTest', () => {
const position = { x: 0, y: 0 }; const position = { x: 0, y: 0 };
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE); const manager = new LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0); manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);
manager.layout(); manager.layout();

View File

@ -3,7 +3,6 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */ /** @type {import('webpack').Configuration} */
module.exports = { module.exports = {
entry: './src/mindplot',
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: '[name].js', filename: '[name].js',
@ -29,14 +28,6 @@ module.exports = {
resolve: { resolve: {
alias: { alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'), '@libraries': path.resolve(__dirname, '../../libraries/'),
'@commands': path.resolve(__dirname, './src/components/commands/'),
'@layout': path.resolve(__dirname, './src/components/layout/'),
'@libs': path.resolve(__dirname, './src/components/libraries/'),
'@model': path.resolve(__dirname, './src/components/model'),
'@persistence': path.resolve(__dirname, './src/components/persistence/'),
'@util': path.resolve(__dirname, './src/components/util/'),
'@widget': path.resolve(__dirname, './src/components/widget/'),
'@components': path.resolve(__dirname, './src/components/'),
}, },
extensions: ['.js', '.json'], extensions: ['.js', '.json'],
}, },