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

View File

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

View File

@ -15,51 +15,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import Events from './Events';
const DesignerModel = new Class(/** @lends DesignerModel */{
Implements: [Events],
/**
* @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) {
class DesignerModel extends Events {
constructor(options) {
super();
this._zoom = options.zoom;
this._topics = [];
this._relationships = [];
},
}
/** @return {Number} zoom between 0.3 (largest text) and 1.9 */
getZoom() {
return this._zoom;
},
}
/** @param {Number} zoom number between 0.3 and 1.9 to set the zoom to */
setZoom(zoom) {
this._zoom = zoom;
},
}
/** @return {@link mindplot.Topic[]} all topics */
getTopics() {
return this._topics;
},
}
/** @return {mindplot.Relationship[]} all relationships */
getRelationships() {
return this._relationships;
},
}
/** @return {mindplot.CentralTopic} the central topic */
getCentralTopic() {
const topics = this.getTopics();
return topics[0];
},
}
/** @return {mindplot.Topic[]} selected topics */
filterSelectedTopics() {
@ -70,7 +61,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
}
}
return result;
},
}
/**
* @return {mindplot.Relationship[]} selected relationships
@ -83,7 +74,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
}
}
return result;
},
}
/**
* @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);
result.append(this._relationships);
return result;
},
}
/**
* removes occurrences of the given topic from the topic array
@ -101,7 +92,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
removeTopic(topic) {
$assert(topic, 'topic can not be null');
this._topics.erase(topic);
},
}
/**
* removes occurrences of the given relationship from the relationship array
@ -110,7 +101,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
removeRelationship(rel) {
$assert(rel, 'rel can not be null');
this._relationships.erase(rel);
},
}
/**
* 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(typeof topic.getId() === 'number', `id is not a number:${topic.getId()}`);
this._topics.push(topic);
},
}
/**
* adds the given relationship to the relationship array
@ -132,7 +123,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
addRelationship(rel) {
$assert(rel, 'rel can not be null');
this._relationships.push(rel);
},
}
/**
* @param {Function=} validate a function to validate nodes
@ -158,7 +149,7 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
}
}
return result;
},
}
/**
* @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() {
const topics = this.filterSelectedTopics();
return (topics.length > 0) ? topics[0] : null;
},
}
/**
* @param {String} id the id of the topic to be retrieved
@ -177,13 +168,13 @@ const DesignerModel = new Class(/** @lends DesignerModel */{
let result = null;
for (let i = 0; i < this._topics.length; i++) {
const topic = this._topics[i];
if (topic.getId() == id) {
if (topic.getId() === id) {
result = topic;
break;
}
}
return result;
},
});
}
}
export default DesignerModel;

View File

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

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import web2d from '@wisemapping/web2d';
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());
},
}
addEvent(type, fn, internal) {
type = this._removeOn(type);
type = Events._removeOn(type);
this.$events[type] = (this.$events[type] || []).include(fn);
if (internal) fn.internal = true;
return this;
},
}
fireEvent(type, args, delay) {
type = this._removeOn(type);
type = Events._removeOn(type);
const events = this.$events[type];
if (!events) return this;
args = Array.isArray(args) ? args : [args];
@ -27,17 +48,17 @@ const Events = new Class({
this,
);
return this;
},
}
removeEvent(type, fn) {
type = this._removeOn(type);
type = Events._removeOn(type);
const events = this.$events[type];
if (events && !fn.internal) {
const index = events.indexOf(fn);
if (index != -1) events.splice(index, 1);
if (index !== -1) events.splice(index, 1);
}
return this;
},
});
}
}
export default Events;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,42 +30,35 @@ import ChangeFeatureToTopicCommand from './commands/ChangeFeatureToTopicCommand'
import NodeModel from './model/NodeModel';
import EventBus from './layout/EventBus';
const StandaloneActionDispatcher = new Class(
/** @lends StandaloneActionDispatcher */ {
Extends: ActionDispatcher,
/**
* @extends mindplot.ActionDispatcher
* @constructs
* @param {mindplot.CommandContext} commandContext
*/
initialize(commandContext) {
this.parent(commandContext);
class StandaloneActionDispatcher extends ActionDispatcher {
constructor(commandContext) {
super(commandContext);
this._actionRunner = new DesignerActionRunner(commandContext, this);
},
}
/** */
addTopics(models, parentTopicsId) {
const command = new AddTopicCommand(models, parentTopicsId);
this.execute(command);
},
}
/** */
addRelationship(model) {
const command = new AddRelationshipCommand(model);
this.execute(command);
},
}
/** */
deleteEntities(topicsIds, relIds) {
const command = new DeleteCommand(topicsIds, relIds);
this.execute(command);
},
}
/** */
dragTopic(topicId, position, order, parentTopic) {
const command = new DragTopicCommand(topicId, position, order, parentTopic);
this.execute(command);
},
}
/** */
moveTopic(topicId, position) {
@ -83,13 +76,13 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicId, position);
this.execute(command);
},
}
/** */
moveControlPoint(ctrlPoint, point) {
const command = new MoveControlPointCommand(ctrlPoint, point);
this.execute(command);
},
}
/** */
changeFontStyleToTopic(topicsIds) {
@ -101,7 +94,7 @@ const StandaloneActionDispatcher = new Class(
};
const command = new GenericFunctionCommand(commandFunc, topicsIds);
this.execute(command);
},
}
/** */
changeTextToTopic(topicsIds, text) {
@ -116,7 +109,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, text);
this.execute(command);
},
}
/** */
changeFontFamilyToTopic(topicIds, fontFamily) {
@ -133,7 +126,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicIds, fontFamily);
this.execute(command);
},
}
/** */
changeFontColorToTopic(topicsIds, color) {
@ -149,7 +142,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'fontColorCommandId';
this.execute(command);
},
}
/** */
changeBackgroundColorToTopic(topicsIds, color) {
@ -165,7 +158,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'backColor';
this.execute(command);
},
}
/** */
changeBorderColorToTopic(topicsIds, color) {
@ -181,7 +174,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, color);
command.discardDuplicated = 'borderColorCommandId';
this.execute(command);
},
}
/** */
changeFontSizeToTopic(topicsIds, size) {
@ -198,7 +191,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, size);
this.execute(command);
},
}
/** */
changeShapeTypeToTopic(topicsIds, shapeType) {
@ -213,7 +206,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, shapeType);
this.execute(command);
},
}
/** */
changeFontWeightToTopic(topicsIds) {
@ -230,7 +223,7 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds);
this.execute(command);
},
}
/** */
shrinkBranch(topicsIds, collapse) {
@ -243,132 +236,32 @@ const StandaloneActionDispatcher = new Class(
const command = new GenericFunctionCommand(commandFunc, topicsIds, collapse);
this.execute(command, false);
},
}
/** */
addFeatureToTopic(topicId, featureType, attributes) {
const command = new AddFeatureToTopicCommand(topicId, featureType, attributes);
this.execute(command);
},
}
/** */
changeFeatureToTopic(topicId, featureId, attributes) {
const command = new ChangeFeatureToTopicCommand(topicId, featureId, attributes);
this.execute(command);
},
}
/** */
removeFeatureFromTopic(topicId, featureId) {
const command = new RemoveFeatureFromTopicCommand(topicId, featureId);
this.execute(command);
},
}
/** */
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;
},
/** */
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 };
export default StandaloneActionDispatcher ;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import AbstractBasicSorter from './AbstractBasicSorter';
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 */
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
_fixUrl(url) {
static _fixUrl(url) {
let result = url;
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
result = `http://${result}`;

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import IMindmap from './IMindmap';
import INodeModel from './INodeModel';
import NodeModel from './NodeModel';
@ -71,10 +72,10 @@ class Mindmap extends IMindmap {
$assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects');
const branches = this.getBranches();
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);
} 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);

View File

@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert, $defined } from '@wisemapping/core-js';
import INodeModel from './INodeModel';
import TopicFeature from '../TopicFeature';
@ -63,7 +64,7 @@ class NodeModel extends INodeModel {
removeFeature(feature) {
$assert(feature, 'feature can not be null');
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 ...');
}
@ -190,7 +191,7 @@ class NodeModel extends INodeModel {
_isChildNode(node) {
let result = false;
if (node == this) {
if (node === this) {
result = true;
} else {
const children = this.getChildren();
@ -211,7 +212,7 @@ class NodeModel extends INodeModel {
*/
findNodeById(id) {
let result = null;
if (this.getId() == id) {
if (this.getId() === id) {
result = this;
} else {
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
* limitations under the License.
*/
import $ from '@libraries/jquery-2.1.0';
import _ from '@libraries/underscore-min';
import { $assert, $defined } from '@wisemapping/core-js';
import ToolbarPaneItem from './ToolbarPaneItem';
const ColorPalettePanel = new Class({
Extends: ToolbarPaneItem,
initialize(buttonId, model, baseUrl) {
class ColorPalettePanel extends ToolbarPaneItem {
constructor(buttonId, model, baseUrl) {
super(buttonId, model);
this._baseUrl = baseUrl;
this.parent(buttonId, model);
$assert($defined(baseUrl), 'baseUrl can not be null');
},
}
_load() {
if (!ColorPalettePanel._panelContent) {
@ -52,7 +52,7 @@ const ColorPalettePanel = new Class({
ColorPalettePanel._panelContent = result;
}
return ColorPalettePanel._panelContent;
},
}
buildPanel() {
const content = $('<div class="toolbarPanel"></div>').attr(
@ -74,7 +74,7 @@ const ColorPalettePanel = new Class({
});
return content;
},
}
_updateSelectedItem() {
const panelElem = this.getPanelElem();
@ -99,7 +99,7 @@ const ColorPalettePanel = new Class({
}
});
return panelElem;
},
});
}
}
export default ColorPalettePanel;

View File

@ -15,32 +15,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Options from '../Options';
import Events from '../Events';
const FloatingTip = new Class({
Implements: [Options, Events],
// const options = {
// animation: true,
// html: false,
// placement: 'right',
// selector: false,
// trigger: 'hover',
// title: '',
// content: '',
// delay: 0,
// container: false,
// destroyOnExit: false,
// };
options: {
animation: true,
html: false,
placement: 'right',
selector: false,
trigger: 'hover',
title: '',
content: '',
delay: 0,
container: false,
destroyOnExit: false,
},
initialize(element, options) {
class FloatingTip extends Events {
constructor(element, options) {
super(element, options);
this.setOptions(options);
this.element = element;
this._createPopover();
},
}
// FIXME: find a better way to do that...
_createPopover() {
this.element.popover(this.options);
const me = this;
@ -50,19 +47,30 @@ const FloatingTip = new Class({
me._createPopover();
});
}
},
}
show() {
this.element.popover('show');
this.fireEvent('show');
return this;
},
}
hide() {
this.element.popover('hide');
this.fireEvent('hide');
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,14 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import $ from '@libraries/jquery-2.1.0';
import ListToolbarPanel from './ListToolbarPanel';
const TopicShapePanel = new Class({
Extends: ListToolbarPanel,
initialize(buttonId, model) {
this.parent(buttonId, model);
},
class TopicShapePanel extends ListToolbarPanel {
// eslint-disable-next-line class-methods-use-this
buildPanel() {
const content = $("<div class='toolbarPanel' id='topicShapePanel'></div>");
content[0].innerHTML = ''
@ -32,7 +29,7 @@ const TopicShapePanel = new Class({
+ '<div id="elipse" model="elipse"><img src="images/shape-circle.png"></div>';
return content;
},
});
}
}
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.
*/
import TestSuite from './TestSuite';
import mindplot from '../../../src/mindplot';
import LayoutManager from '../../../src/components/layout/LayoutManager';
const BalancedTestSuite = new Class({
Extends: TestSuite,
@ -33,7 +33,7 @@ const BalancedTestSuite = new Class({
console.log('testBalanced:');
const position = { x: 0, y: 0 };
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.connectNode(0, 1, 0);
@ -181,7 +181,7 @@ const BalancedTestSuite = new Class({
testBalancedPredict() {
console.log('testBalancedPredict:');
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(2, TestSuite.NODE_SIZE, position);
@ -340,7 +340,7 @@ const BalancedTestSuite = new Class({
testBalancedNodeDragPredict() {
console.log('testBalancedNodeDragPredict:');
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
manager.addNode(1, TestSuite.NODE_SIZE, position).connectNode(0, 1, 0);

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1,7 +1,9 @@
import LayoutManager from '../../../src/components/layout/LayoutManager';
describe('Balanced Test Suite', () => {
it('balancedTest', () => {
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.connectNode(0, 1, 0);
manager.layout();
@ -96,7 +98,7 @@ describe('Balanced Test Suite', () => {
it('balancedPredictTest', () => {
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(2, TestSuite.NODE_SIZE, position);
@ -198,7 +200,7 @@ describe('Balanced Test Suite', () => {
it('balancedNodeDragPredictTest', () => {
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.layout();

View File

@ -3,7 +3,6 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = {
entry: './src/mindplot',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
@ -29,14 +28,6 @@ module.exports = {
resolve: {
alias: {
'@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'],
},