- Removed mxUtils.indexOf().
parent
654736d23d
commit
c5899e0955
|
@ -8,7 +8,6 @@
|
||||||
import mxDictionary from '../../../util/datatypes/mxDictionary';
|
import mxDictionary from '../../../util/datatypes/mxDictionary';
|
||||||
import mxGraphHierarchyNode from './mxGraphHierarchyNode';
|
import mxGraphHierarchyNode from './mxGraphHierarchyNode';
|
||||||
import mxGraphHierarchyEdge from './mxGraphHierarchyEdge';
|
import mxGraphHierarchyEdge from './mxGraphHierarchyEdge';
|
||||||
import mxUtils from '../../../util/mxUtils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: mxGraphHierarchyModel
|
* Class: mxGraphHierarchyModel
|
||||||
|
@ -94,12 +93,7 @@ class mxGraphHierarchyModel {
|
||||||
internalTargetCell.connectsAsTarget = [];
|
internalTargetCell.connectsAsTarget = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (internalTargetCell.connectsAsTarget.indexOf(internalEdge) < 0) {
|
||||||
mxUtils.indexOf(
|
|
||||||
internalTargetCell.connectsAsTarget,
|
|
||||||
internalEdge
|
|
||||||
) < 0
|
|
||||||
) {
|
|
||||||
internalTargetCell.connectsAsTarget.push(internalEdge);
|
internalTargetCell.connectsAsTarget.push(internalEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,12 +253,7 @@ class mxGraphHierarchyModel {
|
||||||
|
|
||||||
internalEdge.source = internalVertices[i];
|
internalEdge.source = internalVertices[i];
|
||||||
|
|
||||||
if (
|
if (internalVertices[i].connectsAsSource.indexOf(internalEdge) < 0) {
|
||||||
mxUtils.indexOf(
|
|
||||||
internalVertices[i].connectsAsSource,
|
|
||||||
internalEdge
|
|
||||||
) < 0
|
|
||||||
) {
|
|
||||||
internalVertices[i].connectsAsSource.push(internalEdge);
|
internalVertices[i].connectsAsSource.push(internalEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,12 +93,7 @@ class mxSwimlaneModel {
|
||||||
internalTargetCell.connectsAsTarget = [];
|
internalTargetCell.connectsAsTarget = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (internalTargetCell.connectsAsTarget.indexOf(internalEdge) < 0) {
|
||||||
mxUtils.indexOf(
|
|
||||||
internalTargetCell.connectsAsTarget,
|
|
||||||
internalEdge
|
|
||||||
) < 0
|
|
||||||
) {
|
|
||||||
internalTargetCell.connectsAsTarget.push(internalEdge);
|
internalTargetCell.connectsAsTarget.push(internalEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,12 +269,7 @@ class mxSwimlaneModel {
|
||||||
|
|
||||||
internalEdge.source = internalVertices[i];
|
internalEdge.source = internalVertices[i];
|
||||||
|
|
||||||
if (
|
if (internalVertices[i].connectsAsSource.indexOf(internalEdge) < 0) {
|
||||||
mxUtils.indexOf(
|
|
||||||
internalVertices[i].connectsAsSource,
|
|
||||||
internalEdge
|
|
||||||
) < 0
|
|
||||||
) {
|
|
||||||
internalVertices[i].connectsAsSource.push(internalEdge);
|
internalVertices[i].connectsAsSource.push(internalEdge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
import mxChildChange from '../atomic_changes/mxChildChange';
|
import mxChildChange from '../atomic_changes/mxChildChange';
|
||||||
import mxObjectCodec from './mxObjectCodec';
|
import mxObjectCodec from './mxObjectCodec';
|
||||||
import mxCodecRegistry from './mxCodecRegistry';
|
import mxCodecRegistry from './mxCodecRegistry';
|
||||||
import mxUtils from '../util/mxUtils';
|
|
||||||
import mxConstants from '../util/mxConstants';
|
import mxConstants from '../util/mxConstants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +49,7 @@ class mxChildChangeCodec extends mxObjectCodec {
|
||||||
if (attr === 'child' && (!isWrite || obj.model.contains(obj.previous))) {
|
if (attr === 'child' && (!isWrite || obj.model.contains(obj.previous))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return mxUtils.indexOf(this.idrefs, attr) >= 0;
|
return this.idrefs.indexOf(attr) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -314,7 +314,7 @@ class mxObjectCodec {
|
||||||
isExcluded(obj, attr, value, write) {
|
isExcluded(obj, attr, value, write) {
|
||||||
return (
|
return (
|
||||||
attr == mxObjectIdentity.FIELD_NAME ||
|
attr == mxObjectIdentity.FIELD_NAME ||
|
||||||
mxUtils.indexOf(this.exclude, attr) >= 0
|
this.exclude.indexOf(attr) >= 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class mxObjectCodec {
|
||||||
*/
|
*/
|
||||||
// isReference(obj: any, attr: string, value: any, write?: boolean): boolean;
|
// isReference(obj: any, attr: string, value: any, write?: boolean): boolean;
|
||||||
isReference(obj, attr, value, write) {
|
isReference(obj, attr, value, write) {
|
||||||
return mxUtils.indexOf(this.idrefs, attr) >= 0;
|
return this.idrefs.indexOf(attr) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1045,7 +1045,7 @@ class mxShape {
|
||||||
if (
|
if (
|
||||||
rounded &&
|
rounded &&
|
||||||
(dx !== 0 || dy !== 0) &&
|
(dx !== 0 || dy !== 0) &&
|
||||||
(exclude == null || mxUtils.indexOf(exclude, i - 1) < 0)
|
(exclude == null || exclude.indexOf(i - 1) < 0)
|
||||||
) {
|
) {
|
||||||
// Draws a line from the last point to the current
|
// Draws a line from the last point to the current
|
||||||
// point with a spacing of size off the current point
|
// point with a spacing of size off the current point
|
||||||
|
|
|
@ -109,7 +109,7 @@ const mxResources = {
|
||||||
*/
|
*/
|
||||||
isLanguageSupported: lan => {
|
isLanguageSupported: lan => {
|
||||||
if (mxClient.languages != null) {
|
if (mxClient.languages != null) {
|
||||||
return mxUtils.indexOf(mxClient.languages, lan) >= 0;
|
return mxClient.languages.indexOf(lan) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -189,29 +189,6 @@ const mxUtils = {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Function: indexOf
|
|
||||||
*
|
|
||||||
* Returns the index of obj in array or -1 if the array does not contain
|
|
||||||
* the given object.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* array - Array to check for the given obj.
|
|
||||||
* obj - Object to find in the given array.
|
|
||||||
*/
|
|
||||||
indexOf: (array, obj) => {
|
|
||||||
if (array != null && obj != null) {
|
|
||||||
for (let i = 0; i < array.length; i += 1) {
|
|
||||||
if (array[i] == obj) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: forEach
|
* Function: forEach
|
||||||
*
|
*
|
||||||
|
@ -254,12 +231,12 @@ const mxUtils = {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
if (typeof array === 'object') {
|
if (typeof array === 'object') {
|
||||||
let index = mxUtils.indexOf(array, obj);
|
let index = array.indexOf(obj);
|
||||||
|
|
||||||
while (index >= 0) {
|
while (index >= 0) {
|
||||||
array.splice(index, 1);
|
array.splice(index, 1);
|
||||||
result = obj;
|
result = obj;
|
||||||
index = mxUtils.indexOf(array, obj);
|
index = array.indexOf(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,8 @@ class mxCell {
|
||||||
*/
|
*/
|
||||||
// getIndex(child: mxCell): number;
|
// getIndex(child: mxCell): number;
|
||||||
getIndex(child: mxCell | null): number {
|
getIndex(child: mxCell | null): number {
|
||||||
return mxUtils.indexOf(this.children, child);
|
if (child === null || !this.children) return -1;
|
||||||
|
return this.children.indexOf(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -540,7 +541,8 @@ class mxCell {
|
||||||
*/
|
*/
|
||||||
// getEdgeIndex(edge: mxCell): number;
|
// getEdgeIndex(edge: mxCell): number;
|
||||||
getEdgeIndex(edge: mxCell): number {
|
getEdgeIndex(edge: mxCell): number {
|
||||||
return mxUtils.indexOf(this.edges, edge);
|
if (!this.edges) return -1;
|
||||||
|
return this.edges.indexOf(edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -573,7 +575,7 @@ class mxCell {
|
||||||
if (
|
if (
|
||||||
this.edges == null ||
|
this.edges == null ||
|
||||||
edge.getTerminal(!isOutgoing) !== this ||
|
edge.getTerminal(!isOutgoing) !== this ||
|
||||||
mxUtils.indexOf(this.edges, edge) < 0
|
this.edges.indexOf(edge) < 0
|
||||||
) {
|
) {
|
||||||
if (this.edges == null) {
|
if (this.edges == null) {
|
||||||
this.edges = [];
|
this.edges = [];
|
||||||
|
|
|
@ -316,7 +316,7 @@ class mxCellRenderer {
|
||||||
];
|
];
|
||||||
|
|
||||||
for (let i = 0; i < styles.length; i += 1) {
|
for (let i = 0; i < styles.length; i += 1) {
|
||||||
if (mxUtils.indexOf(values, state.style[styles[i]]) >= 0) {
|
if (values.indexOf(state.style[styles[i]]) >= 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1511,7 +1511,7 @@ class mxGraph extends mxEventSource {
|
||||||
if (overlay == null) {
|
if (overlay == null) {
|
||||||
this.removeCellOverlays(cell);
|
this.removeCellOverlays(cell);
|
||||||
} else {
|
} else {
|
||||||
const index = mxUtils.indexOf(cell.overlays, overlay);
|
const index = cell.overlays ? cell.overlays.indexOf(overlay) : -1;
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
(<mxCellOverlay[]>cell.overlays).splice(index, 1);
|
(<mxCellOverlay[]>cell.overlays).splice(index, 1);
|
||||||
|
@ -6708,7 +6708,7 @@ class mxGraph extends mxEventSource {
|
||||||
geo.height
|
geo.height
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mxUtils.indexOf(cells, parent) >= 0) {
|
if (cells.indexOf(parent) >= 0) {
|
||||||
bbox.x += tmp.x;
|
bbox.x += tmp.x;
|
||||||
bbox.y += tmp.y;
|
bbox.y += tmp.y;
|
||||||
}
|
}
|
||||||
|
@ -6719,7 +6719,7 @@ class mxGraph extends mxEventSource {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parent.isVertex() &&
|
parent.isVertex() &&
|
||||||
mxUtils.indexOf(cells, parent) >= 0
|
cells.indexOf(parent) >= 0
|
||||||
) {
|
) {
|
||||||
tmp = this.getBoundingBoxFromGeometry([parent], false);
|
tmp = this.getBoundingBoxFromGeometry([parent], false);
|
||||||
|
|
||||||
|
@ -9766,7 +9766,7 @@ class mxGraph extends mxEventSource {
|
||||||
// Checks if parent is dropped into child if not cloning
|
// Checks if parent is dropped into child if not cloning
|
||||||
if (!clone) {
|
if (!clone) {
|
||||||
let parent = cell;
|
let parent = cell;
|
||||||
while (parent != null && mxUtils.indexOf(cells, parent) < 0) {
|
while (parent != null && cells.indexOf(parent) < 0) {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class mxGraphSelectionModel extends mxEventSource {
|
||||||
// isSelected(cell: mxCell): boolean;
|
// isSelected(cell: mxCell): boolean;
|
||||||
isSelected(cell: mxCell): boolean {
|
isSelected(cell: mxCell): boolean {
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
return mxUtils.indexOf(this.cells, cell) >= 0;
|
return this.cells.indexOf(cell) >= 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ class mxGraphSelectionModel extends mxEventSource {
|
||||||
// cellRemoved(cell: mxCell): void;
|
// cellRemoved(cell: mxCell): void;
|
||||||
cellRemoved(cell: mxCell): void {
|
cellRemoved(cell: mxCell): void {
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
const index = mxUtils.indexOf(this.cells, cell);
|
const index = this.cells.indexOf(cell);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.cells.splice(index, 1);
|
this.cells.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,15 +282,13 @@ const Template = ({ label, ...args }) => {
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
data =
|
data =
|
||||||
mxUtils.indexOf(provider.types, 'text/html') >= 0
|
provider.types.indexOf('text/html') >= 0
|
||||||
? provider.getData('text/html')
|
? provider.getData('text/html')
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
mxUtils.indexOf(
|
provider.types.indexOf('text/plain')
|
||||||
provider.types,
|
&& (data == null || data.length === 0)
|
||||||
'text/plain' && (data == null || data.length === 0)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
data = provider.getData('text/plain');
|
data = provider.getData('text/plain');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue