Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

lint timeline component #3311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/timeline/component/BackgroundGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var util = require('../../util');
var Group = require('./Group');

/**
Expand All @@ -25,7 +24,7 @@ BackgroundGroup.prototype = Object.create(Group.prototype);
* @param {boolean} [forceRestack=false] Force restacking of all items
* @return {boolean} Returns true if the group is resized
*/
BackgroundGroup.prototype.redraw = function(range, margin, forceRestack) {
BackgroundGroup.prototype.redraw = function(range, margin, forceRestack) { // eslint-disable-line no-unused-vars
var resized = false;

this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range);
Expand Down
2 changes: 1 addition & 1 deletion lib/timeline/component/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var util = require('../../util');
* @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body]
* @param {Object} [options]
*/
function Component (body, options) {
function Component (body, options) { // eslint-disable-line no-unused-vars
this.options = null;
this.props = null;
}
Expand Down
4 changes: 0 additions & 4 deletions lib/timeline/component/DataScale.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* Created by ludo on 25-1-16.
*/

function DataScale(start, end, autoScaleStart, autoScaleEnd, containerHeight, majorCharHeight, zeroAlign = false, formattingFunction=false) {
this.majorSteps = [1, 2, 5, 10];
Expand Down Expand Up @@ -167,7 +164,6 @@ DataScale.prototype.followScale = function (other) {
}

//Get masters stats:
var lines = other.getLines();
var otherZero = other.convertValue(0);
var otherStep = other.getStep() * other.scale;

Expand Down
1 change: 0 additions & 1 deletion lib/timeline/component/GraphGroup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var util = require('../../util');
var DOMutil = require('../../DOMutil');
var Bars = require('./graph2d_types/bar');
var Lines = require('./graph2d_types/line');
var Points = require('./graph2d_types/points');
Expand Down
24 changes: 12 additions & 12 deletions lib/timeline/component/Group.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var util = require('../../util');
var stack = require('../Stack');
var RangeItem = require('./item/RangeItem');

/**
* @constructor Group
Expand Down Expand Up @@ -157,8 +156,7 @@ Group.prototype.setData = function(data) {
}
} else if (this.nestedGroups) {
this.nestedGroups = null;

var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'
collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'
util.removeClassName(this.dom.label, collapsedDirClassName);
util.removeClassName(this.dom.label, 'expanded');
util.removeClassName(this.dom.label, 'vis-nesting-group');
Expand Down Expand Up @@ -290,7 +288,7 @@ Group.prototype.redraw = function(range, margin, forceRestack) {
var height = this._calculateHeight(margin);

// calculate actual size and position
var foreground = this.dom.foreground;
foreground = this.dom.foreground;
this.top = foreground.offsetTop;
this.right = foreground.offsetLeft;
this.width = foreground.offsetWidth;
Expand Down Expand Up @@ -505,16 +503,17 @@ Group.prototype._updateSubgroupsSizes = function () {
Group.prototype.orderSubgroups = function() {
if (this.subgroupOrderer !== undefined) {
var sortArray = [];
var subgroup;
if (typeof this.subgroupOrderer == 'string') {
for (var subgroup in this.subgroups) {
for (subgroup in this.subgroups) {
sortArray.push({subgroup: subgroup, sortField: this.subgroups[subgroup].items[0].data[this.subgroupOrderer]})
}
sortArray.sort(function (a, b) {
return a.sortField - b.sortField;
})
}
else if (typeof this.subgroupOrderer == 'function') {
for (var subgroup in this.subgroups) {
for (subgroup in this.subgroups) {
sortArray.push(this.subgroups[subgroup].items[0].data);
}
sortArray.sort(this.subgroupOrderer);
Expand Down Expand Up @@ -629,7 +628,7 @@ Group.prototype._updateItemsInRange = function(orderedItems, oldVisibleItems, ra
if (value < lowerBound) {return -1;}
else if (value <= upperBound) {return 0;}
else {return 1;}
}
};

// first check if the items that were in view previously are still in view.
// IMPORTANT: this handles the case for the items with startdate before the window and enddate after the window!
Expand Down Expand Up @@ -667,7 +666,7 @@ Group.prototype._updateItemsInRange = function(orderedItems, oldVisibleItems, ra
}

// finally, we reposition all the visible items.
for (var i = 0; i < visibleItems.length; i++) {
for (i = 0; i < visibleItems.length; i++) {
var item = visibleItems[i];
if (!item.displayed) item.show();
// reposition item horizontally
Expand All @@ -679,8 +678,9 @@ Group.prototype._updateItemsInRange = function(orderedItems, oldVisibleItems, ra

Group.prototype._traceVisible = function (initialPos, items, visibleItems, visibleItemsLookup, breakCondition) {
if (initialPos != -1) {
for (var i = initialPos; i >= 0; i--) {
var item = items[i];
var i, item;
for (i = initialPos; i >= 0; i--) {
item = items[i];
if (breakCondition(item)) {
break;
}
Expand All @@ -692,8 +692,8 @@ Group.prototype._traceVisible = function (initialPos, items, visibleItems, visib
}
}

for (var i = initialPos + 1; i < items.length; i++) {
var item = items[i];
for (i = initialPos + 1; i < items.length; i++) {
item = items[i];
if (breakCondition(item)) {
break;
}
Expand Down
Loading