mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary * End every line with a semicolon * Spacing and formatting * Enabled semi-spacing * Applies npm run lint:fix to code after master merge * Fix merge issues * Switched operator-linebreak to 'before' Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
@ -80,6 +80,7 @@ define(
|
||||
template: function (element, attrs) {
|
||||
var key = attrs.key,
|
||||
container = containerMap[key];
|
||||
|
||||
return container ? container.template : "";
|
||||
}
|
||||
};
|
||||
|
@ -113,6 +113,7 @@ define(
|
||||
|
||||
// Don't show selection highlights, etc
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -133,6 +134,7 @@ define(
|
||||
|
||||
// Don't show selection highlights, etc
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -61,21 +61,22 @@ define(
|
||||
|
||||
// Determine how long to wait before the next update
|
||||
function currentInterval() {
|
||||
return attrs.mctResizeInterval ?
|
||||
scope.$eval(attrs.mctResizeInterval) :
|
||||
DEFAULT_INTERVAL;
|
||||
return attrs.mctResizeInterval
|
||||
? scope.$eval(attrs.mctResizeInterval)
|
||||
: DEFAULT_INTERVAL;
|
||||
}
|
||||
|
||||
// Evaluate mct-resize with the current bounds
|
||||
function fireEval(bounds) {
|
||||
// Only update when bounds actually change
|
||||
if (!lastBounds ||
|
||||
lastBounds.width !== bounds.width ||
|
||||
lastBounds.height !== bounds.height) {
|
||||
if (!lastBounds
|
||||
|| lastBounds.width !== bounds.width
|
||||
|| lastBounds.height !== bounds.height) {
|
||||
scope.$eval(attrs.mctResize, { bounds: bounds });
|
||||
if (!linking) { // Avoid apply-in-a-digest
|
||||
scope.$apply();
|
||||
}
|
||||
|
||||
lastBounds = bounds;
|
||||
}
|
||||
}
|
||||
@ -86,6 +87,7 @@ define(
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
|
||||
fireEval({
|
||||
width: element[0].offsetWidth,
|
||||
height: element[0].offsetHeight
|
||||
|
@ -66,7 +66,6 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -102,17 +102,17 @@ define(
|
||||
position,
|
||||
splitterSize,
|
||||
|
||||
alias = $attrs.alias !== undefined ?
|
||||
"mctSplitPane-" + $attrs.alias : undefined,
|
||||
alias = $attrs.alias !== undefined
|
||||
? "mctSplitPane-" + $attrs.alias : undefined,
|
||||
|
||||
//convert string to number from localStorage
|
||||
userWidthPreference = $window.localStorage.getItem(alias) === null ?
|
||||
undefined : Number($window.localStorage.getItem(alias));
|
||||
userWidthPreference = $window.localStorage.getItem(alias) === null
|
||||
? undefined : Number($window.localStorage.getItem(alias));
|
||||
|
||||
// Get relevant size (height or width) of DOM element
|
||||
function getSize(domElement) {
|
||||
return (anchor.orientation === 'vertical' ?
|
||||
domElement.offsetWidth : domElement.offsetHeight);
|
||||
return (anchor.orientation === 'vertical'
|
||||
? domElement.offsetWidth : domElement.offsetHeight);
|
||||
}
|
||||
|
||||
// Apply styles to child elements
|
||||
@ -146,9 +146,10 @@ define(
|
||||
var children = $element.children();
|
||||
|
||||
// Check to make sure contents are well-formed
|
||||
if (children.length !== 3 ||
|
||||
children[1].nodeName.toLowerCase() !== 'mct-splitter') {
|
||||
if (children.length !== 3
|
||||
|| children[1].nodeName.toLowerCase() !== 'mct-splitter') {
|
||||
$log.warn(CHILDREN_WARNING_MESSAGE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -202,6 +203,7 @@ define(
|
||||
$log.warn(ANCHOR_WARNING_MESSAGE);
|
||||
anchorKey = DEFAULT_ANCHOR;
|
||||
}
|
||||
|
||||
anchor = ANCHORS[anchorKey];
|
||||
|
||||
$scope.$watch($attrs.position, getSetPosition);
|
||||
@ -223,7 +225,6 @@ define(
|
||||
$interval.cancel(activeInterval);
|
||||
});
|
||||
|
||||
|
||||
// Interface exposed by controller, for mct-splitter to user
|
||||
return {
|
||||
anchor: function () {
|
||||
@ -235,6 +236,7 @@ define(
|
||||
}
|
||||
|
||||
setUserWidthPreference(newPosition);
|
||||
|
||||
return getSetPosition(newPosition);
|
||||
},
|
||||
startResizing: function () {
|
||||
@ -254,6 +256,7 @@ define(
|
||||
controller: ['$scope', '$element', '$attrs', controller]
|
||||
};
|
||||
}
|
||||
|
||||
return MCTSplitPane;
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,10 @@ define(
|
||||
function () {
|
||||
|
||||
// Pixel width to allocate for the splitter itself
|
||||
var SPLITTER_TEMPLATE = "<div class='abs'" +
|
||||
"mct-drag-down=\"splitter.startMove()\" " +
|
||||
"mct-drag=\"splitter.move(delta)\" " +
|
||||
"mct-drag-up=\"splitter.endMove()\"></div>";
|
||||
var SPLITTER_TEMPLATE = "<div class='abs'"
|
||||
+ "mct-drag-down=\"splitter.startMove()\" "
|
||||
+ "mct-drag=\"splitter.move(delta)\" "
|
||||
+ "mct-drag-up=\"splitter.endMove()\"></div>";
|
||||
|
||||
/**
|
||||
* Implements `mct-splitter` directive.
|
||||
@ -52,11 +52,11 @@ define(
|
||||
move: function (delta) {
|
||||
var anchor = mctSplitPane.anchor(),
|
||||
index = anchor.orientation === "vertical" ? 0 : 1,
|
||||
pixelDelta = delta[index] *
|
||||
(anchor.reversed ? -1 : 1);
|
||||
pixelDelta = delta[index]
|
||||
* (anchor.reversed ? -1 : 1);
|
||||
|
||||
// Update the position of this splitter
|
||||
newPosition = initialPosition + pixelDelta;
|
||||
newPosition = initialPosition + pixelDelta;
|
||||
|
||||
if (initialPosition !== newPosition) {
|
||||
mctSplitPane.position(newPosition);
|
||||
|
@ -31,6 +31,7 @@ define([
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
if (!scope.onSelection) {
|
||||
scope.onSelection = function () {};
|
||||
}
|
||||
@ -42,10 +43,13 @@ define([
|
||||
if (currentSelection === domainObject) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scope.allowSelection(domainObject)) {
|
||||
treeView.value(currentSelection);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
currentSelection = domainObject;
|
||||
scope.onSelection(domainObject);
|
||||
scope.selectedObject = domainObject;
|
||||
|
Reference in New Issue
Block a user