mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
Fix eslint compilation
This commit is contained in:
parent
f91af2220d
commit
391974e727
@ -67,7 +67,7 @@ const initMindplot = () => {
|
|||||||
|
|
||||||
// Load map from XML file persisted on disk...
|
// Load map from XML file persisted on disk...
|
||||||
const instance = PersistenceManager.getInstance();
|
const instance = PersistenceManager.getInstance();
|
||||||
const mindmap = instance.load(global.mapId);
|
const mindmap = instance.load(String(global.mapId));
|
||||||
designer.loadMap(mindmap);
|
designer.loadMap(mindmap);
|
||||||
|
|
||||||
if (global.mindmapLocked) {
|
if (global.mindmapLocked) {
|
||||||
|
@ -28,16 +28,12 @@
|
|||||||
"max-len": [1,300],
|
"max-len": [1,300],
|
||||||
"class-methods-use-this": "off",
|
"class-methods-use-this": "off",
|
||||||
"no-console" : "off",
|
"no-console" : "off",
|
||||||
"no-unused-vars": ["error", { "args": "none" }],
|
|
||||||
"import/extensions": ["error", {
|
|
||||||
"ts": "never"
|
|
||||||
}],
|
|
||||||
// codebase contains many this aliases, fix in the future?
|
// codebase contains many this aliases, fix in the future?
|
||||||
"@typescript-eslint/no-this-alias": "off",
|
"@typescript-eslint/no-this-alias": "off",
|
||||||
// no-unused-vars already used
|
// Remove once migration is completed ...
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-explicit-any": "warn",
|
||||||
"@typescript-eslint/ban-ts-comment": "warn",
|
"import/extensions": "warn"
|
||||||
"import/no-extraneous-dependencies": ["warn", {"packageDir": "./", "devDependencies": false, "optionalDependencies": false, "peerDependencies": false}]
|
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"import/resolver": {
|
"import/resolver": {
|
||||||
|
@ -27,56 +27,56 @@ import RelationshipModel from './model/RelationshipModel';
|
|||||||
import Topic from './Topic';
|
import Topic from './Topic';
|
||||||
|
|
||||||
abstract class ActionDispatcher extends Events {
|
abstract class ActionDispatcher extends Events {
|
||||||
static _instance: ActionDispatcher;
|
private static _instance: ActionDispatcher;
|
||||||
|
|
||||||
constructor(commandContext: CommandContext) {
|
constructor(commandContext: CommandContext) {
|
||||||
$assert(commandContext, 'commandContext can not be null');
|
$assert(commandContext, 'commandContext can not be null');
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap);
|
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap): void;
|
||||||
|
|
||||||
abstract addTopics(models: NodeModel[], parentTopicId: any[]);
|
abstract addTopics(models: NodeModel[], parentTopicId: number[]): void;
|
||||||
|
|
||||||
abstract deleteEntities(topicsIds: number[], relIds: number[]);
|
abstract deleteEntities(topicsIds: number[], relIds: number[]): void;
|
||||||
|
|
||||||
abstract dragTopic(topicId: number, position: Point, order: number, parentTopic: Topic);
|
abstract dragTopic(topicId: number, position: Point, order: number, parentTopic: Topic): void;
|
||||||
|
|
||||||
abstract moveTopic(topicId: number, position: any);
|
abstract moveTopic(topicId: number, position: Point): void;
|
||||||
|
|
||||||
abstract moveControlPoint(ctrlPoint: this, point: any);
|
abstract moveControlPoint(ctrlPoint: this, point: Point): void;
|
||||||
|
|
||||||
abstract changeFontFamilyToTopic(topicIds: number[], fontFamily: string);
|
abstract changeFontFamilyToTopic(topicIds: number[], fontFamily: string): void;
|
||||||
|
|
||||||
abstract changeFontStyleToTopic(topicsIds: number[]);
|
abstract changeFontStyleToTopic(topicsIds: number[]): void;
|
||||||
|
|
||||||
abstract changeFontColorToTopic(topicsIds: number[], color: string);
|
abstract changeFontColorToTopic(topicsIds: number[], color: string): void;
|
||||||
|
|
||||||
abstract changeFontSizeToTopic(topicsIds: number[], size: number);
|
abstract changeFontSizeToTopic(topicsIds: number[], size: number): void;
|
||||||
|
|
||||||
abstract changeBackgroundColorToTopic(topicsIds: number[], color: string);
|
abstract changeBackgroundColorToTopic(topicsIds: number[], color: string): void;
|
||||||
|
|
||||||
abstract changeBorderColorToTopic(topicsIds: number[], color: string);
|
abstract changeBorderColorToTopic(topicsIds: number[], color: string): void;
|
||||||
|
|
||||||
abstract changeShapeTypeToTopic(topicsIds: number[], shapeType: string);
|
abstract changeShapeTypeToTopic(topicsIds: number[], shapeType: string): void;
|
||||||
|
|
||||||
abstract changeFontWeightToTopic(topicsIds: number[]);
|
abstract changeFontWeightToTopic(topicsIds: number[]): void;
|
||||||
|
|
||||||
abstract changeTextToTopic(topicsIds: number[], text: string);
|
abstract changeTextToTopic(topicsIds: number[], text: string): void;
|
||||||
|
|
||||||
abstract shrinkBranch(topicsIds: number[], collapse: boolean);
|
abstract shrinkBranch(topicsIds: number[], collapse: boolean): void;
|
||||||
|
|
||||||
abstract addFeatureToTopic(topicId: number, type: string, attributes: object);
|
abstract addFeatureToTopic(topicId: number, type: string, attributes: object): void;
|
||||||
|
|
||||||
abstract changeFeatureToTopic(topicId: number, featureId: any, attributes: object);
|
abstract changeFeatureToTopic(topicId: number, featureId: number, attributes: object): void;
|
||||||
|
|
||||||
abstract removeFeatureFromTopic(topicId: number, featureId: number);
|
abstract removeFeatureFromTopic(topicId: number, featureId: number): void;
|
||||||
|
|
||||||
static setInstance = (dispatcher: ActionDispatcher) => {
|
static setInstance = (dispatcher: ActionDispatcher) => {
|
||||||
this._instance = dispatcher;
|
this._instance = dispatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
static getInstance = (): ActionDispatcher => ActionDispatcher._instance;
|
static getInstance = (): ActionDispatcher => ActionDispatcher._instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ActionDispatcher;
|
export default ActionDispatcher;
|
||||||
|
@ -151,14 +151,14 @@ class Designer extends Events {
|
|||||||
return this._actionDispatcher;
|
return this._actionDispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
addEvent(type: string, listener): Events {
|
||||||
addEvent(type: string, listener: any): void {
|
|
||||||
if (type === TopicEvent.EDIT || type === TopicEvent.CLICK) {
|
if (type === TopicEvent.EDIT || type === TopicEvent.CLICK) {
|
||||||
const editor = TopicEventDispatcher.getInstance();
|
const editor = TopicEventDispatcher.getInstance();
|
||||||
editor.addEvent(type, listener);
|
editor.addEvent(type, listener);
|
||||||
} else {
|
} else {
|
||||||
super.addEvent(type, listener);
|
super.addEvent(type, listener);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _registerMouseEvents() {
|
private _registerMouseEvents() {
|
||||||
@ -186,7 +186,7 @@ class Designer extends Events {
|
|||||||
screenManager.addEvent('dblclick', (event: MouseEvent) => {
|
screenManager.addEvent('dblclick', (event: MouseEvent) => {
|
||||||
if (workspace.isWorkspaceEventsEnabled()) {
|
if (workspace.isWorkspaceEventsEnabled()) {
|
||||||
const mousePos = screenManager.getWorkspaceMousePosition(event);
|
const mousePos = screenManager.getWorkspaceMousePosition(event);
|
||||||
const centralTopic:CentralTopic = me.getModel()
|
const centralTopic: CentralTopic = me.getModel()
|
||||||
.getCentralTopic();
|
.getCentralTopic();
|
||||||
|
|
||||||
const model = me._createChildModel(centralTopic, mousePos);
|
const model = me._createChildModel(centralTopic, mousePos);
|
||||||
@ -208,7 +208,7 @@ class Designer extends Events {
|
|||||||
|
|
||||||
dragManager.addEvent('dragging', (event: MouseEvent, dragTopic: DragTopic) => {
|
dragManager.addEvent('dragging', (event: MouseEvent, dragTopic: DragTopic) => {
|
||||||
dragTopic.updateFreeLayout(event);
|
dragTopic.updateFreeLayout(event);
|
||||||
if (!dragTopic.isFreeLayoutOn(event)) {
|
if (!dragTopic.isFreeLayoutOn()) {
|
||||||
// The node is being drag. Is the connection still valid ?
|
// The node is being drag. Is the connection still valid ?
|
||||||
dragConnector.checkConnection(dragTopic);
|
dragConnector.checkConnection(dragTopic);
|
||||||
|
|
||||||
|
@ -33,25 +33,14 @@ export function buildDesigner(options: DesignerOptions): Designer {
|
|||||||
// Register load events ...
|
// Register load events ...
|
||||||
designer = new Designer(options, divContainer);
|
designer = new Designer(options, divContainer);
|
||||||
designer.addEvent('loadSuccess', () => {
|
designer.addEvent('loadSuccess', () => {
|
||||||
// @ts-ignore
|
globalThis.mindmapLoadReady = true;
|
||||||
window.mindmapLoadReady = true;
|
|
||||||
console.log('Map loadded successfully');
|
console.log('Map loadded successfully');
|
||||||
});
|
});
|
||||||
|
|
||||||
const onerrorFn = (message: string, url, lineNo) => {
|
const onerrorFn = () => {
|
||||||
// Close loading dialog ...
|
|
||||||
// @ts-ignore
|
|
||||||
if (window.waitDialog) {
|
|
||||||
// @ts-ignore
|
|
||||||
window.waitDialog.close();
|
|
||||||
// @ts-ignore
|
|
||||||
window.waitDialog = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open error dialog only in case of mindmap loading errors. The rest of the error are reported but not display the dialog.
|
// Open error dialog only in case of mindmap loading errors. The rest of the error are reported but not display the dialog.
|
||||||
// Remove this in the near future.
|
// Remove this in the near future.
|
||||||
// @ts-ignore
|
if (!globalThis.mindmapLoadReady) {
|
||||||
if (!window.mindmapLoadReady) {
|
|
||||||
$notifyModal($msg('UNEXPECTED_ERROR_LOADING'));
|
$notifyModal($msg('UNEXPECTED_ERROR_LOADING'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -210,9 +210,7 @@ class DragTopic {
|
|||||||
return this.getConnectedToTopic() != null;
|
return this.getConnectedToTopic() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isFreeLayoutOn(dragTopic) {
|
isFreeLayoutOn() {
|
||||||
// return this._isFreeLayoutEnabled;
|
|
||||||
// Disable free layout ...
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Events {
|
class Events {
|
||||||
|
private $events;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.$events = {};
|
this.$events = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static _removeOn(string) {
|
static _removeOn(string: string) {
|
||||||
return string.replace(/^on([A-Z])/, (full, first) => first.toLowerCase());
|
return string.replace(/^on([A-Z])/, (full, first) => first.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent(typeName, fn, internal) {
|
addEvent(typeName: string, fn?, internal?: boolean): Events {
|
||||||
const type = Events._removeOn(typeName);
|
const type = Events._removeOn(typeName);
|
||||||
|
|
||||||
// Add function had not been added yet
|
// Add function had not been added yet
|
||||||
@ -36,12 +38,11 @@ class Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark reference ...
|
// Mark reference ...
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
fn.internal = Boolean(internal);
|
fn.internal = Boolean(internal);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fireEvent(typeName, eventArgs, delay) {
|
fireEvent(typeName: string, eventArgs?, delay?: boolean): Events {
|
||||||
const type = Events._removeOn(typeName);
|
const type = Events._removeOn(typeName);
|
||||||
const events = this.$events[type];
|
const events = this.$events[type];
|
||||||
if (!events) return this;
|
if (!events) return this;
|
||||||
@ -57,7 +58,7 @@ class Events {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEvent(typeName, fn) {
|
removeEvent(typeName: string, fn?): Events {
|
||||||
const type = Events._removeOn(typeName);
|
const type = Events._removeOn(typeName);
|
||||||
const events = this.$events[type];
|
const events = this.$events[type];
|
||||||
if (events && !fn.internal) {
|
if (events && !fn.internal) {
|
@ -16,24 +16,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
|
import { Mindmap } from '..';
|
||||||
import PersistenceManager from './PersistenceManager';
|
import PersistenceManager from './PersistenceManager';
|
||||||
|
|
||||||
class LocalStorageManager extends PersistenceManager {
|
class LocalStorageManager extends PersistenceManager {
|
||||||
|
private documentUrl: string;
|
||||||
|
|
||||||
|
private forceLoad: boolean;
|
||||||
|
|
||||||
constructor(documentUrl, forceLoad) {
|
constructor(documentUrl, forceLoad) {
|
||||||
super();
|
super();
|
||||||
this.documentUrl = documentUrl;
|
this.documentUrl = documentUrl;
|
||||||
this.forceLoad = forceLoad;
|
this.forceLoad = forceLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveMapXml(mapId, mapXml, pref, saveHistory, events) {
|
saveMapXml(mapId: string, mapXml: string) {
|
||||||
localStorage.setItem(`${mapId}-xml`, mapXml);
|
localStorage.setItem(`${mapId}-xml`, mapXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
discardChanges(mapId) {
|
discardChanges(mapId: string) {
|
||||||
localStorage.removeItem(`${mapId}-xml`);
|
localStorage.removeItem(`${mapId}-xml`);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMapDom(mapId) {
|
loadMapDom(mapId: string) {
|
||||||
let xml = localStorage.getItem(`${mapId}-xml`);
|
let xml = localStorage.getItem(`${mapId}-xml`);
|
||||||
if (xml == null || this.forceLoad) {
|
if (xml == null || this.forceLoad) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -58,7 +63,7 @@ class LocalStorageManager extends PersistenceManager {
|
|||||||
return $.parseXML(xml);
|
return $.parseXML(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlockMap(mindmap) {
|
unlockMap(mindmap: Mindmap) {
|
||||||
// Ignore, no implementation required ...
|
// Ignore, no implementation required ...
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,10 +17,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { $assert } from '@wisemapping/core-js';
|
import { $assert } from '@wisemapping/core-js';
|
||||||
|
import { Mindmap } from '..';
|
||||||
import XMLSerializerFactory from './persistence/XMLSerializerFactory';
|
import XMLSerializerFactory from './persistence/XMLSerializerFactory';
|
||||||
|
|
||||||
class PersistenceManager {
|
abstract class PersistenceManager {
|
||||||
save(mindmap, editorProperties, saveHistory, events, sync) {
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
static _instance: PersistenceManager;
|
||||||
|
|
||||||
|
save(mindmap: Mindmap, editorProperties, saveHistory: boolean, events, sync: boolean) {
|
||||||
$assert(mindmap, 'mindmap can not be null');
|
$assert(mindmap, 'mindmap can not be null');
|
||||||
$assert(editorProperties, 'editorProperties can not be null');
|
$assert(editorProperties, 'editorProperties can not be null');
|
||||||
|
|
||||||
@ -36,45 +40,39 @@ class PersistenceManager {
|
|||||||
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
|
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
events.onError(this._buildError());
|
events.onError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
load(mapId) {
|
load(mapId: string) {
|
||||||
$assert(mapId, 'mapId can not be null');
|
$assert(mapId, 'mapId can not be null');
|
||||||
const domDocument = this.loadMapDom(mapId);
|
const domDocument = this.loadMapDom(mapId);
|
||||||
return PersistenceManager.loadFromDom(mapId, domDocument);
|
return PersistenceManager.loadFromDom(mapId, domDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
discardChanges(mapId) {
|
abstract discardChanges(mapId: string): void;
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
|
abstract loadMapDom(mapId: string): Document;
|
||||||
|
|
||||||
|
abstract saveMapXml(mapId: string, mapXml, pref, saveHistory, events, sync);
|
||||||
|
|
||||||
|
abstract unlockMap(mindmap: Mindmap): void;
|
||||||
|
|
||||||
|
static init = (instance: PersistenceManager) => {
|
||||||
|
this._instance = instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
static getInstance(): PersistenceManager {
|
||||||
|
return this._instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMapDom(mapId) {
|
static loadFromDom(mapId: string, mapDom: Document) {
|
||||||
throw new Error('Method must be implemented');
|
$assert(mapId, 'mapId can not be null');
|
||||||
}
|
$assert(mapDom, 'mapDom can not be null');
|
||||||
|
|
||||||
saveMapXml(mapId, mapXml, pref, saveHistory, events, sync) {
|
const serializer = XMLSerializerFactory.createInstanceFromDocument(mapDom);
|
||||||
throw new Error('Method must be implemented');
|
return serializer.loadFromDom(mapDom, mapId);
|
||||||
}
|
|
||||||
|
|
||||||
unlockMap(mindmap) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistenceManager.init = (instance) => {
|
|
||||||
PersistenceManager._instance = instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
PersistenceManager.getInstance = () => PersistenceManager._instance;
|
|
||||||
|
|
||||||
PersistenceManager.loadFromDom = function loadFromDom(mapId, mapDom) {
|
|
||||||
$assert(mapId, 'mapId can not be null');
|
|
||||||
$assert(mapDom, 'mapDom can not be null');
|
|
||||||
|
|
||||||
const serializer = XMLSerializerFactory.createInstanceFromDocument(mapDom);
|
|
||||||
return serializer.loadFromDom(mapDom, mapId);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default PersistenceManager;
|
export default PersistenceManager;
|
@ -64,11 +64,11 @@ class RESTPersistenceManager extends PersistenceManager {
|
|||||||
contentType: 'application/json; charset=utf-8',
|
contentType: 'application/json; charset=utf-8',
|
||||||
async: !sync,
|
async: !sync,
|
||||||
|
|
||||||
success(successData, textStatus, jqXHRresponseText) {
|
success(successData) {
|
||||||
persistence.timestamp = successData;
|
persistence.timestamp = successData;
|
||||||
events.onSuccess();
|
events.onSuccess();
|
||||||
},
|
},
|
||||||
error(jqXHR, textStatus, errorThrown) {
|
error() {
|
||||||
events.onError(persistence._buildError());
|
events.onError(persistence._buildError());
|
||||||
},
|
},
|
||||||
complete() {
|
complete() {
|
||||||
@ -78,7 +78,7 @@ class RESTPersistenceManager extends PersistenceManager {
|
|||||||
}
|
}
|
||||||
persistence.onSave = false;
|
persistence.onSave = false;
|
||||||
},
|
},
|
||||||
fail(xhr, textStatus) {
|
fail(xhr) {
|
||||||
const { responseText } = xhr;
|
const { responseText } = xhr;
|
||||||
let userMsg = { severity: 'SEVERE', message: $msg('SAVE_COULD_NOT_BE_COMPLETED') };
|
let userMsg = { severity: 'SEVERE', message: $msg('SAVE_COULD_NOT_BE_COMPLETED') };
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class ScreenManager {
|
|||||||
|
|
||||||
private _padding: { x: number; y: number; };
|
private _padding: { x: number; y: number; };
|
||||||
|
|
||||||
private _clickEvents: ((event: UIEvent) => void)[];
|
private _clickEvents;
|
||||||
|
|
||||||
private _scale: number;
|
private _scale: number;
|
||||||
|
|
||||||
@ -60,14 +60,13 @@ class ScreenManager {
|
|||||||
this._scale = scale;
|
this._scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent(eventType: string, listener: any) {
|
addEvent(eventType: string, listener) {
|
||||||
if (eventType === 'click') this._clickEvents.push(listener);
|
if (eventType === 'click') this._clickEvents.push(listener);
|
||||||
else this._divContainer.bind(eventType, listener);
|
else this._divContainer.bind(eventType, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEvent(event: string, listener: any) {
|
removeEvent(event: string, listener) {
|
||||||
if (event === 'click') {
|
if (event === 'click') {
|
||||||
// @ts-ignore @Todo: needs review ...
|
|
||||||
this._clickEvents.remove(listener);
|
this._clickEvents.remove(listener);
|
||||||
} else {
|
} else {
|
||||||
this._divContainer.unbind(event, listener);
|
this._divContainer.unbind(event, listener);
|
||||||
|
@ -23,6 +23,7 @@ class SVGExporter implements Exporter {
|
|||||||
|
|
||||||
private prolog = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n';
|
private prolog = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n';
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
constructor(mindmap: Mindmap, svgElement: Element, centerImgage = false) {
|
constructor(mindmap: Mindmap, svgElement: Element, centerImgage = false) {
|
||||||
this.svgElement = svgElement;
|
this.svgElement = svgElement;
|
||||||
}
|
}
|
||||||
|
@ -17,45 +17,22 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
class ChildrenSorterStrategy {
|
abstract class ChildrenSorterStrategy {
|
||||||
computeChildrenIdByHeights(treeSet, node) {
|
abstract computeChildrenIdByHeights(treeSet, node);
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract computeOffsets(treeSet, node);
|
||||||
computeOffsets(treeSet, node) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract insert(treeSet, parent, child, order);
|
||||||
insert(treeSet, parent, child, order) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract detach(treeSet, node);
|
||||||
detach(treeSet, node) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract predict(treeSet, parent, node, position, free);
|
||||||
predict(treeSet, parent, node, position, free) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract verify(treeSet, node);
|
||||||
verify(treeSet, node) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract getChildDirection(treeSet, node);
|
||||||
getChildDirection(treeSet, node) {
|
|
||||||
throw new Error('Method must be implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @abstract */
|
abstract toString();
|
||||||
toString() {
|
|
||||||
throw new Error('Method must be implemented: print name');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ChildrenSorterStrategy;
|
export default ChildrenSorterStrategy;
|
@ -280,7 +280,6 @@ abstract class INodeModel {
|
|||||||
parent.removeChild(this);
|
parent.removeChild(this);
|
||||||
} else {
|
} else {
|
||||||
// If it has not parent, it must be an isolate topic ...
|
// If it has not parent, it must be an isolate topic ...
|
||||||
// @ts-ignore
|
|
||||||
mindmap.removeBranch(this);
|
mindmap.removeBranch(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ class Mindmap extends IMindmap {
|
|||||||
/**
|
/**
|
||||||
* @param nodeModel
|
* @param nodeModel
|
||||||
*/
|
*/
|
||||||
removeBranch(nodeModel: NodeModel): void {
|
removeBranch(nodeModel: INodeModel): void {
|
||||||
$assert(nodeModel && nodeModel.isNodeModel(), 'Remove node must be invoked with model objects');
|
$assert(nodeModel && nodeModel.isNodeModel(), 'Remove node must be invoked with model objects');
|
||||||
this._branches = this._branches.filter((b) => b !== nodeModel);
|
this._branches = this._branches.filter((b) => b !== nodeModel);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class NodeModel extends INodeModel {
|
|||||||
* @param attributes
|
* @param attributes
|
||||||
* @return {mindplot.model.FeatureModel} the created feature model
|
* @return {mindplot.model.FeatureModel} the created feature model
|
||||||
*/
|
*/
|
||||||
createFeature(type: FeatureType, attributes: any): FeatureModel {
|
createFeature(type: FeatureType, attributes): FeatureModel {
|
||||||
return FeatureModelFactory.createModel(type, attributes);
|
return FeatureModelFactory.createModel(type, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import XMLSerializerTango from './XMLSerializerTango';
|
|||||||
import Mindmap from '../model/Mindmap';
|
import Mindmap from '../model/Mindmap';
|
||||||
import XMLMindmapSerializer from './XMLMindmapSerializer';
|
import XMLMindmapSerializer from './XMLMindmapSerializer';
|
||||||
|
|
||||||
const codeToSerializer = [
|
const codeToSerializer: { codeName: string, serializer, migrator }[] = [
|
||||||
{
|
{
|
||||||
codeName: ModelCodeName.BETA,
|
codeName: ModelCodeName.BETA,
|
||||||
serializer: XMLSerializerBeta,
|
serializer: XMLSerializerBeta,
|
||||||
@ -86,9 +86,9 @@ class XMLSerializerFactory {
|
|||||||
// eslint-disable-next-line new-cap
|
// eslint-disable-next-line new-cap
|
||||||
if (found) result = new (codeToSerializer[i].serializer)();
|
if (found) result = new (codeToSerializer[i].serializer)();
|
||||||
} else {
|
} else {
|
||||||
const { migrator: Migrator } = codeToSerializer[i];
|
const { migrator } = codeToSerializer[i];
|
||||||
// @ts-ignore
|
// eslint-disable-next-line new-cap
|
||||||
result = new Migrator(result);
|
result = new migrator(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$assert(result, `Cound not find serialized for ${version}`);
|
$assert(result, `Cound not find serialized for ${version}`);
|
||||||
|
@ -36,8 +36,8 @@ import {
|
|||||||
} from './components/widget/ToolbarNotifier';
|
} from './components/widget/ToolbarNotifier';
|
||||||
|
|
||||||
// This hack is required to initialize Bootstrap. In future, this should be removed.
|
// This hack is required to initialize Bootstrap. In future, this should be removed.
|
||||||
// @ts-ignore
|
const globalAny: any = global;
|
||||||
global.jQuery = jquery;
|
globalAny.jQuery = jquery;
|
||||||
require('../../../libraries/bootstrap/js/bootstrap.min');
|
require('../../../libraries/bootstrap/js/bootstrap.min');
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
/* eslint-disable import/no-unresolved */
|
|
||||||
/* eslint-disable no-undef */
|
|
||||||
/* eslint-disable vars-on-top */
|
|
||||||
/*
|
/*
|
||||||
* Copyright [2021] [wisemapping]
|
* Copyright [2021] [wisemapping]
|
||||||
*
|
*
|
||||||
@ -31,12 +28,12 @@ import LocalStorageManager from './components/LocalStorageManager';
|
|||||||
import DesignerOptionsBuilder from './components/DesignerOptionsBuilder';
|
import DesignerOptionsBuilder from './components/DesignerOptionsBuilder';
|
||||||
|
|
||||||
// This hack is required to initialize Bootstrap. In future, this should be removed.
|
// This hack is required to initialize Bootstrap. In future, this should be removed.
|
||||||
// @ts-ignore
|
const globalAny: any = global;
|
||||||
global.jQuery = jquery;
|
globalAny.jQuery = jquery;
|
||||||
require('../../../libraries/bootstrap/js/bootstrap.min');
|
require('../../../libraries/bootstrap/js/bootstrap.min');
|
||||||
|
|
||||||
// Configure designer options ...
|
// Configure designer options ...
|
||||||
let persistence:PersistenceManager;
|
let persistence: PersistenceManager;
|
||||||
if (!global.memoryPersistence && !global.readOnly) {
|
if (!global.memoryPersistence && !global.readOnly) {
|
||||||
persistence = new RESTPersistenceManager({
|
persistence = new RESTPersistenceManager({
|
||||||
documentUrl: '/c/restful/maps/{id}/document',
|
documentUrl: '/c/restful/maps/{id}/document',
|
||||||
|
@ -17,13 +17,17 @@
|
|||||||
"ecmaVersion": 12,
|
"ecmaVersion": 12,
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
|
"ignorePatterns": [
|
||||||
|
"**/packages/mindplot/**/*",
|
||||||
|
"**/dist/**/*"
|
||||||
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react",
|
"react",
|
||||||
"@typescript-eslint"
|
"@typescript-eslint"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
"@typescript-eslint/explicit-module-boundary-types": "error",
|
"@typescript-eslint/explicit-module-boundary-types": "error",
|
||||||
"@typescript-eslint/no-unused-vars": "error"
|
"@typescript-eslint/no-unused-vars": "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user