- Clean webpack and babel configuration

- Babel configure to jsmodule
This commit is contained in:
Paulo Gustavo Veiga 2021-12-05 15:09:07 -08:00
parent 69054fcd9c
commit cd2236eca1
11 changed files with 26 additions and 51 deletions

View File

@ -6,13 +6,10 @@
"corejs": "3.15", "corejs": "3.15",
"useBuiltIns": "usage", "useBuiltIns": "usage",
"targets": { "targets": {
"browsers": [ "esmodules": true
"last 5 versions",
"ie >= 8"
]
} }
} }
] ]
], ],
"sourceType": "unambiguous" "sourceType": "unambiguous"
} }

View File

@ -6,10 +6,7 @@
"corejs": "3.15", "corejs": "3.15",
"useBuiltIns": "usage", "useBuiltIns": "usage",
"targets": { "targets": {
"browsers": [ "esmodules": true
"last 5 versions",
"ie >= 8"
]
} }
} }
] ]

View File

@ -4,14 +4,7 @@
"module": "commonjs", "module": "commonjs",
"paths": { "paths": {
"@libraries/*": ["../../libraries/*"], "@libraries/*": ["../../libraries/*"],
"@commands/*": ["./src/components/commands/*"], "@wisemapping/web2d": ["../web2d/*"]
"@layout/*": ["./src/components/layout/*"],
"@libs/*": ["./src/components/libraries/*"],
"@model/*": ["./src/components/model/*"],
"@persistence/*": ["./src/components/persistence/*"],
"@util/*": ["./src/components/util/*"],
"@widget/*": ["./src/components/widget/*"],
"@components/*": ["./src/components/*"]
} }
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]

View File

@ -20,10 +20,6 @@ import Topic from './Topic';
import Shape from './util/Shape'; import Shape from './util/Shape';
class CentralTopic extends Topic { class CentralTopic extends Topic {
constructor(model, options) {
super(model, options);
}
_registerEvents() { _registerEvents() {
super._registerEvents(); super._registerEvents();

View File

@ -135,7 +135,7 @@ const RootedTreeSet = new Class(
}, },
_find(id, parent) { _find(id, parent) {
if (parent.getId() == id) { if (parent.getId() === id) {
return parent; return parent;
} }
@ -203,7 +203,7 @@ const RootedTreeSet = new Class(
if (!$defined(node._parent)) { if (!$defined(node._parent)) {
return []; return [];
} }
const siblings = node._parent._children.filter((child) => child != node); const siblings = node._parent._children.filter((child) => child !== node);
return siblings; return siblings;
}, },
@ -220,18 +220,18 @@ const RootedTreeSet = new Class(
_hasSinglePathToSingleLeaf(node) { _hasSinglePathToSingleLeaf(node) {
const children = this.getChildren(node); const children = this.getChildren(node);
if (children.length == 1) { if (children.length === 1) {
return this._hasSinglePathToSingleLeaf(children[0]); return this._hasSinglePathToSingleLeaf(children[0]);
} }
return children.length == 0; return children.length === 0;
}, },
/** /**
* @param node * @param node
* @return {Boolean} whether the node is the start of a subbranch */ * @return {Boolean} whether the node is the start of a subbranch */
isStartOfSubBranch(node) { isStartOfSubBranch(node) {
return this.getSiblings(node).length > 0 && this.getChildren(node).length == 1; return this.getSiblings(node).length > 0 && this.getChildren(node).length === 1;
}, },
/** /**
@ -241,7 +241,7 @@ const RootedTreeSet = new Class(
*/ */
isLeaf(node) { isLeaf(node) {
$assert(node, 'node cannot be null'); $assert(node, 'node cannot be null');
return this.getChildren(node).length == 0; return this.getChildren(node).length === 0;
}, },
/** /**
@ -375,7 +375,7 @@ const RootedTreeSet = new Class(
const children = this.getChildren(node); const children = this.getChildren(node);
const me = this; const me = this;
children.forEach( (child) => { children.forEach((child) => {
me.shiftBranchPosition(child, xOffset, yOffset); me.shiftBranchPosition(child, xOffset, yOffset);
}); });
}, },
@ -397,10 +397,10 @@ const RootedTreeSet = new Class(
}, },
/** /**
* @param node * @param node
* @param yOffset * @param yOffset
* @return siblings in the offset (vertical) direction, i.e. with lower or higher order, respectively * @return siblings in the offset (vertical) direction, i.e. with lower or higher order, respectively
*/ */
getSiblingsInVerticalDirection(node, yOffset) { getSiblingsInVerticalDirection(node, yOffset) {
// siblings with lower or higher order, depending on the direction of the offset and on the same side as their parent // siblings with lower or higher order, depending on the direction of the offset and on the same side as their parent
const parent = this.getParent(node); const parent = this.getParent(node);
@ -431,9 +431,9 @@ const RootedTreeSet = new Class(
// direct descendants of the root that do not contain the node and are on the same side // direct descendants of the root that do not contain the node and are on the same side
// and on the direction of the offset // and on the direction of the offset
const rootNode = this.getRootNode(node); const rootNode = this.getRootNode(node);
const branches = this.getChildren(rootNode).filter(function (child) { const branches = this.getChildren(rootNode).filter(((child) => {
return this._find(node.getId(), child); return this._find(node.getId(), child);
}, this); }).bind(this));
const branch = branches[0]; const branch = branches[0];
const rootDescendants = this.getSiblings(branch).filter((sibling) => { const rootDescendants = this.getSiblings(branch).filter((sibling) => {

View File

@ -35,12 +35,12 @@ class IconPanel extends ToolbarPaneItem {
const familyIcons = ImageIcon.prototype.ICON_FAMILIES[i].icons; const familyIcons = ImageIcon.prototype.ICON_FAMILIES[i].icons;
for (let j = 0; j < familyIcons.length; j += 1) { for (let j = 0; j < familyIcons.length; j += 1) {
// Separate icons by line ... // Separate icons by line ...
var familyContent; let familyContent;
if ((count % 12) == 0) { if ((count % 12) == 0) {
familyContent = $('<div></div>'); familyContent = $('<div></div>');
content.append(familyContent); content.append(familyContent);
} }
const iconId = familyIcons[j]; const iconId = familyIcons[j];
const img = $('<img>') const img = $('<img>')
.attr('id', iconId) .attr('id', iconId)
@ -51,10 +51,10 @@ class IconPanel extends ToolbarPaneItem {
const panel = this; const panel = this;
const model = this.getModel(); const model = this.getModel();
img.on('click', function (event) { img.on('click', ((event) => {
model.setValue($(this).attr('id')); model.setValue($(this).attr('id'));
panel.hide(); panel.hide();
}); }).bind(this));
count += 1; count += 1;
} }

View File

@ -15,20 +15,19 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import jQuery from 'jquery';
import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog'; import BootstrapDialog from '../libraries/bootstrap/BootstrapDialog';
class NoteEditor extends BootstrapDialog{ class NoteEditor extends BootstrapDialog {
constructor(model) { constructor(model) {
$assert(model, 'model can not be null'); $assert(model, 'model can not be null');
this._model = model;
super($msg('Note'), { super($msg('Note'), {
cancelButton: true, cancelButton: true,
closeButton: true, closeButton: true,
acceptButton: true, acceptButton: true,
removeButton: typeof model.getValue() !== 'undefined', removeButton: typeof model.getValue() !== 'undefined',
onEventData: { model: this._model } onEventData: { model: model },
}); });
this._model = model;
this.css({ margin: '150px auto' }); this.css({ margin: '150px auto' });
const panel = this._buildPanel(model); const panel = this._buildPanel(model);
this.setContent(panel); this.setContent(panel);

View File

@ -19,7 +19,6 @@ module.exports = {
exclude: [ exclude: [
/node_modules/, /node_modules/,
path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'), path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'),
path.resolve(__dirname, '../../libraries/underscore-min'),
], ],
}, },
], ],
@ -28,6 +27,7 @@ module.exports = {
resolve: { resolve: {
alias: { alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'), '@libraries': path.resolve(__dirname, '../../libraries/'),
'@wisemapping/web2d': path.resolve(__dirname, '../web2d/'),
}, },
extensions: ['.js', '.json'], extensions: ['.js', '.json'],
}, },

View File

@ -35,7 +35,6 @@ module.exports = {
exclude: [ exclude: [
/node_modules/, /node_modules/,
path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'), path.resolve(__dirname, '../../libraries/mootools-core-1.4.5'),
path.resolve(__dirname, '../../libraries/underscore-min'),
/lib\/raphael/ig, /lib\/raphael/ig,
], ],
}, },

View File

@ -6,10 +6,7 @@
"corejs": "3.15", "corejs": "3.15",
"useBuiltIns": "usage", "useBuiltIns": "usage",
"targets": { "targets": {
"browsers": [ "esmodules": true
"last 5 versions",
"ie >= 8"
]
} }
} }
] ]

View File

@ -2,9 +2,6 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"module": "commonjs", "module": "commonjs",
"paths": {
"@libraries/*": ["../../libraries/*"]
}
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }