Skip to content

Commit

Permalink
Added documentation into source code. handsontable#1972
Browse files Browse the repository at this point in the history
  • Loading branch information
budnix committed Mar 4, 2015
2 parents 8c10f2e + b17b702 commit f6913f2
Show file tree
Hide file tree
Showing 30 changed files with 2,385 additions and 437 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ node_modules
.idea
_SpecRunner.html
.grunt
.DS_Store
cars.sqlite
dev.html

1 change: 1 addition & 0 deletions src/3rdparty/copypaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* In future we may implement a better driver when better APIs are available.
*
* @constructor
* @private
*/
var CopyPaste = (function () {
var instance;
Expand Down
2 changes: 2 additions & 0 deletions src/3rdparty/walkontable/src/cellCoords.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function WalkontableCellCoords(row, col) {

/**
* Returns boolean information if given set of coordinates is valid in context of a given Walkontable instance
*
* @param instance
* @returns {boolean}
*/
Expand All @@ -35,6 +36,7 @@ WalkontableCellCoords.prototype.isValid = function (instance) {

/**
* Returns boolean information if this cell coords are the same as cell coords given as a parameter
*
* @param {WalkontableCellCoords} cellCoords
* @returns {boolean}
*/
Expand Down
6 changes: 6 additions & 0 deletions src/3rdparty/walkontable/src/cellRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ WalkontableCellRange.prototype.isSingle = function () {

/**
* Returns selected range height (in number of rows)
*
* @returns {number}
*/
WalkontableCellRange.prototype.getHeight = function () {
Expand All @@ -26,6 +27,7 @@ WalkontableCellRange.prototype.getHeight = function () {

/**
* Returns selected range width (in number of columns)
*
* @returns {number}
*/
WalkontableCellRange.prototype.getWidth = function () {
Expand All @@ -34,6 +36,7 @@ WalkontableCellRange.prototype.getWidth = function () {

/**
* Returns boolean information if given cell coords is within `from` and `to` cell coords of this range
*
* @param {WalkontableCellCoords} cellCoords
* @returns {boolean}
*/
Expand Down Expand Up @@ -66,6 +69,7 @@ WalkontableCellRange.prototype.isEqual = function (testedRange) {
/**
* Returns true if tested range overlaps with the range.
* Range A is considered to to be overlapping with range B if intersection of A and B or B and A is not empty.
*
* @param testedRange
* @returns {boolean}
*/
Expand All @@ -83,6 +87,7 @@ WalkontableCellRange.prototype.isNorthWestOf = function (testedCoords) {

/**
* Adds a cell to a range (only if exceeds corners of the range). Returns information if range was expanded
*
* @param {WalkontableCellCoords} cellCoords
* @returns {boolean}
*/
Expand Down Expand Up @@ -304,6 +309,7 @@ WalkontableCellRange.prototype.getAll = function () {

/**
* Runs a callback function against all cells in the range. You can break the iteration by returning false in the callback function
*
* @param callback {Function}
*/
WalkontableCellRange.prototype.forAll = function (callback) {
Expand Down
2 changes: 2 additions & 0 deletions src/3rdparty/walkontable/src/columnFilter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* WalkontableColumnFilter
*
* @constructor
* @private
*/
function WalkontableColumnFilter(offset,total, countTH) {
this.offset = offset;
Expand Down
2 changes: 2 additions & 0 deletions src/3rdparty/walkontable/src/columnStrategy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/**
* WalkontableColumnStrategy
*
* @param containerSizeFn
* @param sizeAtIndex
* @param strategy - all, last, none
* @constructor
* @private
*/
function WalkontableColumnStrategy(instance, containerSizeFn, sizeAtIndex, strategy) {
var size
Expand Down
7 changes: 6 additions & 1 deletion src/3rdparty/walkontable/src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function Walkontable(settings) {

/**
* Force rerender of Walkontable
*
* @param fastDraw {Boolean} When TRUE, try to refresh only the positions of borders without rerendering the data.
* It will only work if WalkontableTable.draw() does not force rendering anyway
* @returns {Walkontable}
Expand All @@ -64,6 +65,7 @@ Walkontable.prototype.draw = function (fastDraw) {
/**
* Returns the TD at coords. If topmost is set to true, returns TD from the topmost overlay layer,
* if not set or set to false, returns TD from the master table.
*
* @param {WalkontableCellCoords} coords
* @param {Boolean} topmost
* @returns {Object}
Expand Down Expand Up @@ -93,6 +95,7 @@ Walkontable.prototype.update = function (settings, value) {

/**
* Scroll the viewport to a row at the given index in the data source
*
* @param row
* @returns {Walkontable}
*/
Expand All @@ -104,7 +107,8 @@ Walkontable.prototype.scrollVertical = function (row) {

/**
* Scroll the viewport to a column at the given index in the data source
* @param row
*
* @param column
* @returns {Walkontable}
*/
Walkontable.prototype.scrollHorizontal = function (column) {
Expand All @@ -115,6 +119,7 @@ Walkontable.prototype.scrollHorizontal = function (column) {

/**
* Scrolls the viewport to a cell (rerenders if needed)
*
* @param {WalkontableCellCoords} coords
* @returns {Walkontable}
*/
Expand Down
2 changes: 2 additions & 0 deletions src/3rdparty/walkontable/src/debugOverlay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* A overlay that renders ALL available rows & columns positioned on top of the original Walkontable instance and all other overlays.
* Used for debugging purposes to see if the other overlays (that render only part of the rows & columns) are positioned correctly
*
* @param instance
* @constructor
* @private
*/
function WalkontableDebugOverlay(instance) {
this.instance = instance;
Expand Down
3 changes: 2 additions & 1 deletion src/3rdparty/walkontable/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function walkontableRangesIntersect() {

/**
* Generates a random hex string. Used as namespace for Walkontable instance events.
*
* @return {String} - 16 character random string: "92b1bfc74ec4"
*/
function walkontableRandomString() {
Expand All @@ -21,4 +22,4 @@ function walkontableRandomString() {
}

return s4() + s4() + s4() + s4();
}
}
2 changes: 2 additions & 0 deletions src/3rdparty/walkontable/src/rowFilter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
* WalkontableRowFilter
*
* @constructor
* @private
*/
function WalkontableRowFilter(offset, total, countTH) {
this.offset = offset;
Expand Down
1 change: 1 addition & 0 deletions src/3rdparty/walkontable/src/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function WalkontableScroll(instance) {

/**
* Scrolls viewport to a cell by minimum number of cells
*
* @param {WalkontableCellCoords} coords
*/
WalkontableScroll.prototype.scrollViewport = function (coords) {
Expand Down
1 change: 1 addition & 0 deletions src/3rdparty/walkontable/src/scrollbarNativeHorizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ WalkontableHorizontalScrollbarNative.prototype.applyToDOM = function () {

/**
* Scrolls horizontally to a column at the left edge of the viewport
*
* @param sourceCol {Number}
* @param beyondRendered {Boolean} if TRUE, scrolls according to the bottom edge (top edge is by default)
*/
Expand Down
9 changes: 7 additions & 2 deletions src/3rdparty/walkontable/src/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function WalkontableSelection(settings, cellRange) {

/**
* Each Walkontable clone requires it's own border for every selection. This method creates and returns selection borders per instance
*
* @param {Walkontable} instance
* @returns {WalkontableBorder}
*/
Expand All @@ -19,14 +20,16 @@ WalkontableSelection.prototype.getBorder = function (instance) {

/**
* Returns boolean information if selection is empty
* @returns {boolean}
*
* @returns {Boolean}
*/
WalkontableSelection.prototype.isEmpty = function () {
return this.cellRange === null;
};

/**
* Adds a cell coords to the selection
*
* @param {WalkontableCellCoords} coords
*/
WalkontableSelection.prototype.add = function (coords) {
Expand All @@ -40,9 +43,10 @@ WalkontableSelection.prototype.add = function (coords) {

/**
* If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean information about success
*
* @param {WalkontableCellCoords} oldCoords
* @param {WalkontableCellCoords} newCoords
* @return {boolean}
* @returns {Boolean}
*/
WalkontableSelection.prototype.replace = function (oldCoords, newCoords) {
if (!this.isEmpty()) {
Expand All @@ -67,6 +71,7 @@ WalkontableSelection.prototype.clear = function () {

/**
* Returns the top left (TL) and bottom right (BR) selection coordinates
*
* @returns {Object}
*/
WalkontableSelection.prototype.getCorners = function () {
Expand Down
1 change: 0 additions & 1 deletion src/3rdparty/walkontable/src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ function WalkontableSettings(instance, settings) {
/**
* generic methods
*/

WalkontableSettings.prototype.update = function (settings, value) {
if (value === void 0) { //settings is object
for (var i in settings) {
Expand Down
17 changes: 10 additions & 7 deletions src/3rdparty/walkontable/src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ WalkontableTable.prototype.isWorkingOnClone = function () {

/**
* Redraws the table
*
* @param fastDraw {Boolean} If TRUE, will try to avoid full redraw and only update the border positions. If FALSE or UNDEFINED, will perform a full redraw
* @returns {WalkontableTable}
*/
Expand Down Expand Up @@ -201,11 +202,11 @@ WalkontableTable.prototype.refreshSelections = function (fastDraw) {

/**
* getCell
*
* @param {WalkontableCellCoords} coords
* @return {Object} HTMLElement on success or {Number} one of the exit codes on error:
* @returns {Object} HTMLElement on success or {Number} one of the exit codes on error:
* -1 row before viewport
* -2 row after viewport
*
*/
WalkontableTable.prototype.getCell = function (coords) {
if (this.isRowBeforeRenderedRows(coords.row)) {
Expand All @@ -224,10 +225,10 @@ WalkontableTable.prototype.getCell = function (coords) {

/**
* getColumnHeader
*
* @param col
* @param level Header level (0 = most distant to the table)
* @return {Object} HTMLElement on success or undefined on error
*
* @returns {Object} HTMLElement on success or undefined on error
*/
WalkontableTable.prototype.getColumnHeader = function(col, level) {
if(!level) {
Expand All @@ -242,10 +243,10 @@ WalkontableTable.prototype.getColumnHeader = function(col, level) {

/**
* getRowHeader
*
* @param row
* @return {Object} HTMLElement on success or {Number} one of the exit codes on error:
* @returns {Object} HTMLElement on success or {Number} one of the exit codes on error:
* null table doesn't have row headers
*
*/
WalkontableTable.prototype.getRowHeader = function(row) {
if(this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) {
Expand All @@ -261,6 +262,7 @@ WalkontableTable.prototype.getRowHeader = function(row) {

/**
* Returns cell coords object for a given TD
*
* @param TD
* @returns {WalkontableCellCoords}
*/
Expand Down Expand Up @@ -379,8 +381,9 @@ WalkontableTable.prototype.allRowsInViewport = function () {

/**
* Checks if any of the row's cells content exceeds its initial height, and if so, returns the oversized height
*
* @param {Number} sourceRow
* @return {Number}
* @returns {Number}
*/
WalkontableTable.prototype.getRowHeight = function (sourceRow) {
var height = this.instance.wtSettings.settings.rowHeight(sourceRow);
Expand Down
7 changes: 5 additions & 2 deletions src/3rdparty/walkontable/src/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ WalkontableViewport.prototype.getViewportWidth = function () {
* Creates:
* - rowsRenderCalculator (before draw, to qualify rows for rendering)
* - rowsVisibleCalculator (after draw, to measure which rows are actually visible)
*
* @returns {WalkontableViewportRowsCalculator}
*/
WalkontableViewport.prototype.createRowsCalculator = function (visible) {
Expand Down Expand Up @@ -227,6 +228,7 @@ WalkontableViewport.prototype.createRowsCalculator = function (visible) {
* Creates:
* - columnsRenderCalculator (before draw, to qualify columns for rendering)
* - columnsVisibleCalculator (after draw, to measure which columns are actually visible)
*
* @returns {WalkontableViewportRowsCalculator}
*/
WalkontableViewport.prototype.createColumnsCalculator = function (visible) {
Expand Down Expand Up @@ -263,6 +265,7 @@ WalkontableViewport.prototype.createColumnsCalculator = function (visible) {

/**
* Creates rowsRenderCalculator and columnsRenderCalculator (before draw, to determine what rows and cols should be rendered)
*
* @param fastDraw {Boolean} If TRUE, will try to avoid full redraw and only update the border positions. If FALSE or UNDEFINED, will perform a full redraw
*/
WalkontableViewport.prototype.createRenderCalculators = function (fastDraw) {
Expand Down Expand Up @@ -300,7 +303,7 @@ WalkontableViewport.prototype.createVisibleCalculators = function () {
* Returns TRUE if all proposed visible rows are already rendered (meaning: redraw is not needed)
* Returns FALSE if at least one proposed visible row is not already rendered (meaning: redraw is needed)
*
* @returns {boolean}
* @returns {Boolean}
*/
WalkontableViewport.prototype.areAllProposedVisibleRowsAlreadyRendered = function (proposedRowsVisibleCalculator) {
if (this.rowsVisibleCalculator) {
Expand Down Expand Up @@ -328,7 +331,7 @@ WalkontableViewport.prototype.areAllProposedVisibleRowsAlreadyRendered = functio
* Returns TRUE if all proposed visible columns are already rendered (meaning: redraw is not needed)
* Returns FALSE if at least one proposed visible column is not already rendered (meaning: redraw is needed)
*
* @returns {boolean}
* @returns {Boolean}
*/
WalkontableViewport.prototype.areAllProposedVisibleColumnsAlreadyRendered = function (proposedColumnsVisibleCalculator) {
if (this.columnsVisibleCalculator) {
Expand Down
1 change: 1 addition & 0 deletions src/3rdparty/walkontable/src/viewportRowsCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @param overrideFn - function that changes calculated this.startRow, this.endRow (used by mergeCells.js plugin)
* @param onlyFullyVisible {bool} - if TRUE, only startRow and endRow will be indexes of rows that are FULLY in viewport
* @constructor
* @private
*/
function WalkontableViewportRowsCalculator(height, scrollOffset, totalRows, rowHeightFn, overrideFn, onlyFullyVisible) {
this.scrollOffset = scrollOffset;
Expand Down
Loading

0 comments on commit f6913f2

Please sign in to comment.