Fix eslint errors

This commit is contained in:
Paulo Gustavo Veiga 2021-12-19 09:56:22 -08:00
parent 48642f2dcf
commit 5e8be48916
8 changed files with 63 additions and 22 deletions

View File

@ -27,12 +27,11 @@ class LayoutManager extends Events {
super(); super();
$assert($defined(rootNodeId), 'rootNodeId can not be null'); $assert($defined(rootNodeId), 'rootNodeId can not be null');
$assert(rootSize, 'rootSize can not be null'); $assert(rootSize, 'rootSize can not be null');
var position = position || { x: 0, y: 0 };
this._treeSet = new RootedTreeSet(); this._treeSet = new RootedTreeSet();
this._layout = new OriginalLayout(this._treeSet); this._layout = new OriginalLayout(this._treeSet);
const rootNode = this._layout.createNode(rootNodeId, rootSize, position, 'root'); const rootNode = this._layout.createNode(rootNodeId, rootSize, { x: 0, y: 0 }, 'root');
this._treeSet.setRoot(rootNode); this._treeSet.setRoot(rootNode);
this._events = []; this._events = [];
} }

View File

@ -212,7 +212,9 @@ class OriginalLayout {
); );
siblingsToShift.forEach(((sibling) => { siblingsToShift.forEach(((sibling) => {
const overlappingOccurs = shiftedBranches.some(((shiftedBranch) => OriginalLayout._branchesOverlap(shiftedBranch, sibling, heightById))); const overlappingOccurs = shiftedBranches
// eslint-disable-next-line max-len
.some(((shiftedBranch) => OriginalLayout._branchesOverlap(shiftedBranch, sibling, heightById)));
if (!sibling.isFree() || overlappingOccurs) { if (!sibling.isFree() || overlappingOccurs) {
const sAmount = node.getFreeDisplacement().y; const sAmount = node.getFreeDisplacement().y;

View File

@ -1,3 +1,21 @@
/*
* 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 'jquery'; import $ from 'jquery';
import Options from '../../Options'; import Options from '../../Options';
import { $msg } from '../../Messages'; import { $msg } from '../../Messages';

View File

@ -1,4 +1,21 @@
import { $assert, $defined } from '@wisemapping/core-js'; /*
* 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 'jquery';
import BootstrapDialog from './BootstrapDialog'; import BootstrapDialog from './BootstrapDialog';
class BootstrapDialogRequest extends BootstrapDialog { class BootstrapDialogRequest extends BootstrapDialog {
@ -7,7 +24,8 @@ class BootstrapDialogRequest extends BootstrapDialog {
this.requestOptions = {}; this.requestOptions = {};
this.requestOptions.cache = false; this.requestOptions.cache = false;
const me = this; const me = this;
this.requestOptions.fail = function (xhr) {
this.requestOptions.fail = (xhr) => {
// Intercept form requests ... // Intercept form requests ...
console.log('Failure:'); console.log('Failure:');
console.log(xhr); console.log(xhr);
@ -32,7 +50,7 @@ class BootstrapDialogRequest extends BootstrapDialog {
me.acceptButton.unbind('click').click(() => { me.acceptButton.unbind('click').click(() => {
submitDialogForm(); submitDialogForm();
}); });
me._native.on('hidden.bs.modal', function () { me._native.on('hidden.bs.modal', () => {
$(this).remove(); $(this).remove();
}); });
me.show(); me.show();
@ -40,7 +58,7 @@ class BootstrapDialogRequest extends BootstrapDialog {
} }
onDialogShown() { onDialogShown() {
if (typeof (onDialogShown) === 'function') { if (onDialogShown instanceof Function) {
onDialogShown(); onDialogShown();
} }
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
/* /*
* Copyright [2015] [wisemapping] * Copyright [2015] [wisemapping]
@ -134,7 +135,7 @@ class IMindmap {
result = '{ '; result = '{ ';
const branches = this.getBranches(); const branches = this.getBranches();
result = `${result}version:${this.getVersion()}`; result = `${result} , version:${this.getVersion()}`;
result = `${result} , [`; result = `${result} , [`;
for (let i = 0; i < branches.length; i++) { for (let i = 0; i < branches.length; i++) {

View File

@ -250,6 +250,7 @@ class INodeModel {
} }
/** @abstract */ /** @abstract */
// eslint-disable-next-line no-unused-vars
append(node) { append(node) {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }
@ -316,11 +317,13 @@ class INodeModel {
} }
/** @abstract */ /** @abstract */
// eslint-disable-next-line no-unused-vars
putProperty(key, value) { putProperty(key, value) {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }
/** @abstract */ /** @abstract */
// eslint-disable-next-line no-unused-vars
setParent(parent) { setParent(parent) {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }
@ -363,6 +366,7 @@ class INodeModel {
} }
/** @abstract */ /** @abstract */
// eslint-disable-next-line no-unused-vars
removeChild(child) { removeChild(child) {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }

View File

@ -19,9 +19,9 @@ import { $defined } from '@wisemapping/core-js';
import ModelCodeName from './ModelCodeName'; import ModelCodeName from './ModelCodeName';
import Beta2PelaMigrator from './Beta2PelaMigrator'; import Beta2PelaMigrator from './Beta2PelaMigrator';
import Pela2TangoMigrator from './Pela2TangoMigrator'; import Pela2TangoMigrator from './Pela2TangoMigrator';
import XMLSerializer_Beta from './XMLSerializer_Beta'; import XMLSerializerBeta from './XMLSerializer_Beta';
import XMLSerializer_Pela from './XMLSerializer_Pela'; import XMLSerializerPela from './XMLSerializer_Pela';
import XMLSerializer_Tango from './XMLSerializer_Tango'; import XMLSerializerTango from './XMLSerializer_Tango';
/** /**
* @class mindplot.persistence.XMLSerializerFactory * @class mindplot.persistence.XMLSerializerFactory
@ -33,7 +33,7 @@ const XMLSerializerFactory = {};
* @return {mindplot.persistence.XMLSerializer_Beta|mindplot.persistence.XMLSerializer_Pela| * @return {mindplot.persistence.XMLSerializer_Beta|mindplot.persistence.XMLSerializer_Pela|
* mindplot.persistence.XMLSerializer_Tango} serializer corresponding to the mindmap's version * mindplot.persistence.XMLSerializer_Tango} serializer corresponding to the mindmap's version
*/ */
XMLSerializerFactory.getSerializerFromMindmap = function (mindmap) { XMLSerializerFactory.getSerializerFromMindmap = function getSerializerFromMindmap(mindmap) {
return XMLSerializerFactory.getSerializer(mindmap.getVersion()); return XMLSerializerFactory.getSerializer(mindmap.getVersion());
}; };
@ -41,7 +41,7 @@ XMLSerializerFactory.getSerializerFromMindmap = function (mindmap) {
* @param domDocument * @param domDocument
* @return serializer corresponding to the mindmap's version * @return serializer corresponding to the mindmap's version
*/ */
XMLSerializerFactory.getSerializerFromDocument = function (domDocument) { XMLSerializerFactory.getSerializerFromDocument = function getSerializerFromDocument(domDocument) {
const rootElem = domDocument.documentElement; const rootElem = domDocument.documentElement;
return XMLSerializerFactory.getSerializer(rootElem.getAttribute('version')); return XMLSerializerFactory.getSerializer(rootElem.getAttribute('version'));
}; };
@ -76,18 +76,18 @@ XMLSerializerFactory.getSerializer = function getSerializer(version) {
XMLSerializerFactory._codeNames = [ XMLSerializerFactory._codeNames = [
{ {
codeName: ModelCodeName.BETA, codeName: ModelCodeName.BETA,
serializer: XMLSerializer_Beta, serializer: XMLSerializerBeta,
migrator() { migrator() {
}, },
}, },
{ {
codeName: ModelCodeName.PELA, codeName: ModelCodeName.PELA,
serializer: XMLSerializer_Pela, serializer: XMLSerializerPela,
migrator: Beta2PelaMigrator, migrator: Beta2PelaMigrator,
}, },
{ {
codeName: ModelCodeName.TANGO, codeName: ModelCodeName.TANGO,
serializer: XMLSerializer_Tango, serializer: XMLSerializerTango,
migrator: Pela2TangoMigrator, migrator: Pela2TangoMigrator,
}, },
]; ];

View File

@ -68,13 +68,12 @@ class FloatingTip extends Events {
this.options = options; this.options = options;
if (this.addEvent) { if (this.addEvent) {
for (const option in options) { Object.keys(options).forEach((option) => {
if (typeof (options[option]) !== 'function' || !(/^on[A-Z]/).test(option)) { if (options[option] instanceof Function && (/^on[A-Z]/).test(option)) {
continue; this.addEvent(option, options[option]);
delete options[option];
} }
this.addEvent(option, options[option]); });
delete options[option];
}
} }
return this; return this;
} }