fin-hypergrid
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -19,3 +19,3 @@ /* eslint-env browser */ | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/calendar.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/calendar.png"> | ||
* @name calendar | ||
@@ -26,3 +26,3 @@ * @memberOf module:images | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/checked.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/checked.png"> | ||
* @name checked | ||
@@ -33,3 +33,3 @@ * @memberOf module:images | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/unchecked.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/unchecked.png"> | ||
* @name unchecked | ||
@@ -40,3 +40,3 @@ * @memberOf module:images | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/filter-off.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/filter-off.png"> | ||
* @name filter-off | ||
@@ -47,3 +47,3 @@ * @memberOf module:images | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/filter-on.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/filter-on.png"> | ||
* @name filter-on | ||
@@ -54,3 +54,3 @@ * @memberOf module:images | ||
/** | ||
* <img src="https://raw.githubusercontent.com/openfin/fin-hypergrid/master/images/up-down.png"> | ||
* <img src="https://raw.githubusercontent.com/fin-hypergrid/core/master/images/up-down.png"> | ||
* @name up-down | ||
@@ -57,0 +57,0 @@ * @memberOf module:images |
{ | ||
"name": "fin-hypergrid", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Canvas-based high-performance grid", | ||
@@ -10,3 +10,9 @@ "main": "src/Hypergrid", | ||
}, | ||
"author": "SWirts, JEiten, DJones, NMichaud", | ||
"author": "Steve Wirts (https://github.com/stevewirts)", | ||
"contributors": [ | ||
"Jonathan Eiten (https://github.com/joneit)", | ||
"Dwayne Jones (https://github.com/dwaynekj)", | ||
"Naveen Michaud-Agrawal (https://github.com/nmichaud)", | ||
"Hugo Nogueira (https://github.com/hugoeanogueira)" | ||
], | ||
"license": "MIT", | ||
@@ -23,3 +29,3 @@ "readmeFilename": "README.md", | ||
"extend-me": "^2.7.0", | ||
"finbars": "^1.6.0", | ||
"finbars": "^2.0.0", | ||
"inject-stylesheet-template": "^1.0.1", | ||
@@ -26,0 +32,0 @@ "mustache": "^2.3.0", |
@@ -1,7 +0,5 @@ | ||
[![Build Status](https://travis-ci.org/openfin/fin-hypergrid.svg?branch=develop)](https://travis-ci.org/openfin/fin-hypergrid) | ||
**fin-hypergrid** is an ultra-fast HTML5 grid presentation layer, achieving its speed by rendering (in a canvas tag) only the currently visible portion of your (virtual) grid, thus avoiding the latency and life-cycle issues of building, walking, and maintaining a complex DOM structure. Please be sure to checkout our [design overview](OVERVIEW.md) | ||
Below is an example custom application built on top of the Hypergrid API tooling. | ||
It also highlights a DOM-based custom external editor triggered via hypergrid events as well as interaction with Hypergrid's column ordering API | ||
It also highlights a DOM-based custom external editor triggered via hypergrid events as well as interaction with Hypergrid’s column ordering API. | ||
@@ -20,5 +18,5 @@ <img src="images/README/gridshot04.gif"> | ||
### Current Release (3.0.3 - 25 September 2018) | ||
### Current Release (3.1.0 - 29 September 2018) | ||
**Hypergrid 3.0 includes a revised data model with some breaking changes.** | ||
**Hypergrid 3.1 includes 3.0’s revised data model with some breaking changes.** | ||
@@ -31,3 +29,3 @@ _For a complete list of changes, see the [release notes](https://github.com/fin-hypergrid/core/releases)._ | ||
Published as a CommonJS module to npmjs.org. | ||
Specify a <a href="https://semver.org/">SEMVER</a> of `"fin-hypergrid": "3.0.3"` (or `"^3.0.3"`) in your package.json file, | ||
Specify a <a href="https://semver.org/">SEMVER</a> of `"fin-hypergrid": "3.1.0"` (or `"^3.1.0"`) in your package.json file, | ||
issue the `npm install` command, and let your bundler (<a target="webpack" href="https://webpack.js.org/">wepback</a>, | ||
@@ -74,7 +72,7 @@ <a target="browserify" href="http://browserify.org/">Browserify</a>) create a single file containing both Hypergrid and your application. | ||
##### Hyperblotter | ||
##### AdaptableBlotter.JS | ||
[Openfin](http://openfin.co)'s Hyperblotter ([installer](https://dl.openfin.co/services/download?fileName=Hyperblotter&config=http://cdn.openfin.co/demos/hyperblotter/app.json)) is a demo app that shows the capabilities of both OpenFin and Hypergrid. | ||
[Openfin](http://openfin.co)’s AdaptableBlotter.JS ([installer](https://install.openfin.co/download/?fileName=adaptable_blotter_openfin&config=http://beta.adaptableblotter.com/app-beta.json)) is a demo app that shows the capabilities of both Openfin and Hypergrid. | ||
![](images/README/Hyperblotter%20Tabled%20Reduced%20Rows.png) | ||
![](images/README/partner-adaptableblotter_image-01@2x-667x375@2x.png) | ||
@@ -87,3 +85,3 @@ ### Features | ||
Please use github [issues](https://github.com/fin-hypergrid/core/issues) to report problems | ||
Please use github [issues](https://github.com/fin-hypergrid/core/issues/new) to report problems | ||
@@ -90,0 +88,0 @@ We invite everyone to test the alpha branch for changes going into the next release |
@@ -191,3 +191,3 @@ /* eslint-env browser */ | ||
setWidth: function(width) { | ||
width = Math.max(this.properties.minimumColumnWidth, width); | ||
width = Math.min(Math.max(this.properties.minimumColumnWidth, width), this.properties.maximumColumnWidth || Infinity); | ||
if (width !== this.properties.width) { | ||
@@ -194,0 +194,0 @@ this.properties.width = width; |
@@ -751,2 +751,4 @@ 'use strict'; | ||
/** | ||
* This default column width is used when `width` property is undefined. | ||
* (`width` is defined on column creation unless {@link module:defaults.columnAutosizing columnAutosizing} has been set to `false`.) | ||
* @default | ||
@@ -759,2 +761,6 @@ * @type {number} | ||
/** | ||
* Minimum column width. | ||
* Adjust this value for different fonts/sizes or exotic cell renderers. | ||
* _Must be defined._ | ||
* The default (`5`) is enough room for an ellipsis with default font size. | ||
* @default | ||
@@ -767,2 +773,14 @@ * @type {number} | ||
/** | ||
* Maximum column width. | ||
* _When defined,_ column width is clamped to this value by {@link Column#setWidth setWidth}). | ||
* Ignored when falsy. | ||
* Respects {@link module:defaults.resizeColumnInPlace resizeColumnInPlace} but may cause user confusion when | ||
* user can't make column narrower due to next column having reached its maximum. | ||
* @default | ||
* @type {number} | ||
* @memberOf module:defaults | ||
*/ | ||
maximumColumnWidth: undefined, | ||
/** | ||
* Resizing a column through the UI (by clicking and dragging on the column's | ||
@@ -775,8 +793,8 @@ * right border in the column header row) normally affects the width of the whole grid. | ||
* | ||
* This is a _column propert_ and may be set for selected columns (`myColumn.properties.resizeColumnInPlace`) | ||
* or for all columns by setting it at the grid level. (`myGrid.properties.resizeColumnInPlace`). | ||
* This is a _column property_ and may be set for selected columns (`myColumn.properties.resizeColumnInPlace`) | ||
* or for all columns by setting it at the grid level (`myGrid.properties.resizeColumnInPlace`). | ||
* | ||
* Note that the implementation of this property does not allow expanding a | ||
* column beyond the width it can borrow from the next column. | ||
* The last column, however, is unconstrained and resizing it will affect the total grid width. | ||
* The last column, however, is unconstrained, and resizing of course affects the total grid width. | ||
* @default | ||
@@ -783,0 +801,0 @@ * @type {boolean} |
@@ -66,13 +66,19 @@ 'use strict'; | ||
if (this.dragColumn) { | ||
var delta = this.getMouseValue(event) - this.dragStart; | ||
var dragWidth = this.dragStartWidth + delta; | ||
if (!this.nextColumn) { | ||
var delta = this.getMouseValue(event) - this.dragStart, | ||
dragWidth = this.dragStartWidth + delta, | ||
nextWidth = this.nextStartWidth - delta; | ||
if (!this.nextColumn) { // nextColumn et al instance vars defined when resizeColumnInPlace (by handleMouseDown) | ||
grid.behavior.setColumnWidth(this.dragColumn, dragWidth); | ||
} else if ( | ||
0 < delta && delta <= (this.nextStartWidth - this.nextColumn.properties.minimumColumnWidth) || | ||
0 > delta && delta >= -(this.dragStartWidth - this.dragColumn.properties.minimumColumnWidth) | ||
) { | ||
var nextWidth = this.nextStartWidth - delta; | ||
grid.behavior.setColumnWidth(this.dragColumn, dragWidth); | ||
grid.behavior.setColumnWidth(this.nextColumn, nextWidth); | ||
} else { | ||
var np = this.nextColumn.properties, dp = this.dragColumn.properties; | ||
if ( | ||
0 < delta && delta <= (this.nextStartWidth - np.minimumColumnWidth) && | ||
(!dp.maximumColumnWidth || dragWidth <= dp.maximumColumnWidth) | ||
|| | ||
0 > delta && delta >= -(this.dragStartWidth - dp.minimumColumnWidth) && | ||
(!np.maximumColumnWidth || nextWidth < np.maximumColumnWidth) | ||
) { | ||
grid.behavior.setColumnWidth(this.dragColumn, dragWidth); | ||
grid.behavior.setColumnWidth(this.nextColumn, nextWidth); | ||
} | ||
} | ||
@@ -79,0 +85,0 @@ } else if (this.next) { |
@@ -29,2 +29,3 @@ 'use strict'; | ||
'extend-me': {value: require('extend-me') }, | ||
finbars: { value: require('finbars') }, | ||
'object-iterators': { value: require('object-iterators') }, | ||
@@ -31,0 +32,0 @@ overrider: { value: require('overrider') }, |
@@ -264,3 +264,3 @@ 'use strict'; | ||
/** | ||
* App developers are free to add in additional themes, such as those in {@link https://openfin.github.com/fin-hypergrid-themes/themes}: | ||
* App developers are free to add in additional themes, such as those in {@link https://github.com/fin-hypergrid/themes/tree/master/js}: | ||
* ```javascript | ||
@@ -267,0 +267,0 @@ * Hypergrind.registerThemes(require('fin-hypergrid-themes')); |
@@ -338,3 +338,3 @@ /* eslint-env browser */ | ||
detail.mouse = this.mouseLocation; | ||
detail.keys = this.currentKeys; | ||
defKeysProp.call(this, event, 'keys', detail); | ||
return this.dispatchNewEvent(event, name, detail); | ||
@@ -456,8 +456,4 @@ }, | ||
// prevent TAB from moving focus off the canvas element | ||
if (e.keyCode === 9) { | ||
e.preventDefault(); | ||
} | ||
var keyChar = updateCurrentKeys.call(this, e, true); | ||
var keyChar = this.getKeyChar(e); | ||
if (e.repeat) { | ||
@@ -475,7 +471,4 @@ if (this.repeatKey === keyChar) { | ||
} | ||
if (this.currentKeys.indexOf(keyChar) === -1) { | ||
this.currentKeys.push(keyChar); | ||
} | ||
this.dispatchNewEvent(e, 'fin-canvas-keydown', { | ||
this.dispatchNewEvent(e, 'fin-canvas-keydown', defKeysProp.call(this, e, 'currentKeys', { | ||
alt: e.altKey, | ||
@@ -491,5 +484,4 @@ ctrl: e.ctrlKey, | ||
shift: e.shiftKey, | ||
identifier: e.key, | ||
currentKeys: this.currentKeys.slice(0) | ||
}); | ||
identifier: e.key | ||
})); | ||
}, | ||
@@ -502,13 +494,8 @@ | ||
// prevent TAB from moving focus off the canvas element | ||
if (e.keyCode === 9) { | ||
e.preventDefault(); | ||
} | ||
var keyChar = updateCurrentKeys.call(this, e, false); | ||
var keyChar = this.getKeyChar(e); | ||
this.currentKeys.splice(this.currentKeys.indexOf(keyChar), 1); | ||
this.repeatKeyCount = 0; | ||
this.repeatKey = null; | ||
this.repeatKeyStartTime = 0; | ||
this.dispatchNewEvent(e, 'fin-canvas-keyup', { | ||
this.dispatchNewEvent(e, 'fin-canvas-keyup', defKeysProp.call(this, e, 'currentKeys', { | ||
alt: e.altKey, | ||
@@ -525,3 +512,3 @@ ctrl: e.ctrlKey, | ||
currentKeys: this.currentKeys.slice(0) | ||
}); | ||
})); | ||
}, | ||
@@ -800,2 +787,68 @@ | ||
function updateCurrentKeys(e, keydown) { | ||
var keyChar = this.getKeyChar(e); | ||
// prevent TAB from moving focus off the canvas element | ||
switch (keyChar) { | ||
case 'TAB': | ||
case 'TABSHIFT': | ||
case 'Tab': | ||
e.preventDefault(); | ||
} | ||
fixCurrentKeys.call(this, keyChar, keydown); | ||
return keyChar; | ||
} | ||
function fixCurrentKeys(keyChar, keydown) { | ||
var index = this.currentKeys.indexOf(keyChar); | ||
if (!keydown && index >= 0) { | ||
this.currentKeys.splice(index, 1); | ||
} | ||
if (keyChar === 'SHIFT') { | ||
// on keydown, replace unshifted keys with shifted keys | ||
// on keyup, vice-versa | ||
this.currentKeys.forEach(function(key, index, currentKeys) { | ||
var pair = charMap.find(function(pair) { | ||
return pair[keydown ? 0 : 1] === key; | ||
}); | ||
if (pair) { | ||
currentKeys[index] = pair[keydown ? 1 : 0]; | ||
} | ||
}); | ||
} | ||
if (keydown && index < 0) { | ||
this.currentKeys.push(keyChar); | ||
} | ||
} | ||
function defKeysProp(event, propName, object) { | ||
var canvas = this; | ||
Object.defineProperty(object, propName, { | ||
configurable: true, | ||
ennumerable: true, | ||
get: function() { | ||
var shiftKey; | ||
if ('shiftKey' in event) { | ||
fixCurrentKeys.call(canvas, 'SHIFT', shiftKey = event.shiftKey); | ||
} else { | ||
shiftKey = canvas.currentKeys.indexOf('SHIFT') >= 0; | ||
} | ||
var SHIFT = shiftKey ? 'SHIFT' : ''; | ||
if ('ctrlKey' in event) { | ||
fixCurrentKeys.call(canvas, 'CTRL' + SHIFT, event.ctrlKey); | ||
} | ||
if ('altKey' in event) { | ||
fixCurrentKeys.call(canvas, 'ALT' + SHIFT, event.altKey); | ||
} | ||
return canvas.currentKeys.slice(); | ||
} | ||
}); | ||
return object; | ||
} | ||
function getCachedContext(canvasElement, contextAttributes) { | ||
@@ -802,0 +855,0 @@ var gc = canvasElement.getContext('2d', contextAttributes), |
@@ -447,7 +447,6 @@ 'use strict'; | ||
if (this.areAllRowsSelected()) { | ||
var headerRows = this.grid.getHeaderRowCount(); | ||
var rowCount = this.grid.getRowCount() - headerRows; | ||
var rowCount = this.grid.getRowCount(); | ||
var result = new Array(rowCount); | ||
for (var i = 0; i < rowCount; i++) { | ||
result[i] = i + headerRows; | ||
result[i] = i; | ||
} | ||
@@ -454,0 +453,0 @@ return result; |
@@ -616,4 +616,4 @@ /* eslint-env browser */ | ||
var vci = this.visibleColumnsByIndex, | ||
vri = this.visibleRowsByDataRowIndex, | ||
var vc, vci = this.visibleColumnsByIndex, | ||
vr, vri = this.visibleRowsByDataRowIndex, | ||
lastScrollableColumn = this.visibleColumns[this.visibleColumns.length - 1], // last column in scrollable section | ||
@@ -629,21 +629,29 @@ lastScrollableRow = this.visibleRows[this.visibleRows.length - 1], // last row in scrollable data section | ||
// entire selection scrolled out of view to left of visible columns; or | ||
selection.corner.x < this.visibleColumns[0].columnIndex || | ||
(vc = this.visibleColumns[0]) && | ||
selection.corner.x < vc.columnIndex || | ||
// entire selection scrolled out of view between fixed columns and scrollable columns; or | ||
fixedColumnCount && | ||
selection.origin.x > this.visibleColumns[fixedColumnCount - 1].columnIndex && | ||
firstScrollableColumn && | ||
(vc = this.visibleColumns[fixedColumnCount - 1]) && | ||
selection.origin.x > vc.columnIndex && | ||
selection.corner.x < firstScrollableColumn.columnIndex || | ||
// entire selection scrolled out of view to right of visible columns; or | ||
lastScrollableColumn && | ||
selection.origin.x > lastScrollableColumn.columnIndex || | ||
// entire selection scrolled out of view above visible rows; or | ||
selection.corner.y < this.visibleRows[headerRowCount].rowIndex || | ||
(vr = this.visibleRows[headerRowCount]) && | ||
selection.corner.y < vr.rowIndex || | ||
// entire selection scrolled out of view between fixed rows and scrollable rows; or | ||
fixedRowCount && | ||
selection.origin.y > this.visibleRows[headerRowCount + fixedRowCount - 1].rowIndex && | ||
firstScrollableRow && | ||
(vr = this.visibleRows[headerRowCount + fixedRowCount - 1]) && | ||
selection.origin.y > vr.rowIndex && | ||
selection.corner.y < firstScrollableRow.rowIndex || | ||
// entire selection scrolled out of view below visible rows | ||
lastScrollableRow && | ||
selection.origin.y > lastScrollableRow.rowIndex | ||
@@ -659,2 +667,6 @@ ) { | ||
if (!(vcOrigin && vrOrigin && vcCorner && vrCorner)) { | ||
return; | ||
} | ||
// Render the selection model around the bounds | ||
@@ -661,0 +673,0 @@ var config = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
741710
18388
107
+ Addedfinbars@2.0.0(transitive)
- Removedfinbars@1.6.3(transitive)
Updatedfinbars@^2.0.0