Skip to content

Hypergrid v3.0.2

Compare
Choose a tag to compare
@joneit joneit released this 29 Aug 11:35
· 79 commits to master since this release
e2b642e

This patch release v3.0.2:

  • Reflects:
    • core repo: PR #742
    • build repo: all direct commits since the 3.0.1 release (for item # 4 below)
  • Supersedes:

Synopsis

  1. Regression when no data rows (Issue #741)
  2. Fix linter errors in columnEnum.js
  3. Avoid throwing error on a mouse event received before columns are created
  4. Expose registries to fin.Hypergrid.require()
  5. DataModel instantiation option now accepts array
  6. Remove finbars.css from <head> section
  7. New column property: resizeColumnInPlace (Issue #749)
  8. Fix editOnNextCell feature (Issue #745)
  9. Avoid throwing error when dragging a column and column(s) selected (Issue #751)
  10. Demos

1. Regression when no data rows (Issue #741)

Solution was to properly handle edge cases in grid.renderer.paintGridLines:

  • No data rows
  • No header rows

2. Fix linter errors in columnEnum.js

3. Avoid throwing error on a mouse event received before columns are created

This annoying error happened if the mouse was moved over the grid during a page reload.

4. Expose registries to fin.Hypergrid.require()

The fin.Hypergrid.require() function is a feature of the build files only. (It is not needed with the fin-hypergrid npm module when a CommonJS-like require() function is already available.) As such, it is found in the build repo; the commits for these changes can therefore be found there. The changes are listed here because the build files (as well as the npm module) are published whenever the latest version is merged (see below).

The following expressions are now valid:

  • fin.Hypergrid.require('fin-hypergrid/src/cellEditors')
  • fin.Hypergrid.require('fin-hypergrid/src/cellRenderers')
  • fin.Hypergrid.require('fin-hypergrid/src/dataModels')
  • fin.Hypergrid.require('fin-hypergrid/src/features')

These expressions return the four currently defined registry objects.

Previously, fin.Hypergrid.require() only accepted fully qualified paths, ending in a module filename (e.g., fin.Hypergrid.require('fin-hypergrid/src/cellEditors/SimpleCell'). Now the registries are exposed so new modules can be added (with Registry.prototype.add) and existing modules can be referenced (with Registry.prototype.get) for use as base classes for the new modules. Registries are instantiated at load time and are therefore available before the first grid instantiation. (Previously grid.cellEditors, grid.cellRenderers, and grid.behavior.featureRegistry were accessible, but only after instantiation. The dataModels registry was not previously accessible.)

5. DataModel instantiation option now accepts array

As a convenience feature, when an array, instantiates a multi-stage data model as a data source stack. Each data source is instantiated in turn, passing the previous stack tip to the next constructor, forming a linked list. Each is data source module is a subclass of datasaur-base, which implements method inheritance on the stack.

Previously: Single-stage data model

var MyDataModel = require('./my-data-model');
var options = { DataModel: MyDataModel };
var grid = new Hypergrid(options); 

Alternatively, the following produces the same result:

var options = { dataModel: new MyDataModel };
var grid = new Hypergrid(options); 

Previously: Multi-stage data model

var dataModel = new (require('datasaur-indexed'))();
dataModel = new (require('datasaur-indexed'))(dataModel);
var grid = new Hypergrid({ dataModel: dataModel }); 

Now, with this enhancement: Multi-stage data model

The following is a short hand for the above

var DataModel = [ require('datasaur-local'), require('datasaur-indexed') ];
var grid = new Hypergrid({ DataModel: DataModel });

6. Remove finbars.css from <head> section

This stylesheet was being completely overridden by the duplicate in the <body> section (which remains).

7. New column property: resizeColumnInPlace (Issue #749)

Resizing a column through the UI (by clicking and dragging on the column's
right border in the column header row) normally affects the width of the whole grid.

Set this new property to truthy to inversely resize the next column.
In other words, if user expands (say) the third column, then the fourth column will contract —
and vice versa — without therefore affecting the width of the grid.

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.

8. Fix editOnNextCell feature (Issue #745)

Issue was new cellEvent failed to define its gridCell.y prop.

9. Avoid throwing error when dragging a column and column(s) selected (Issue #751)

Fixed. This was due to improperly clearing existing selections in SelectionModel.prototype.clear.

This commit also blocks dragging column on right-click.

10. Demos

These demo commits are actually in the build repo. The changes are listed here because the live demos are published along with the bundled builds (see below).

Testbench demo

Restored the regressed "top-level global vars" help tip.

Formatter Workbench demo

Collapsed the four text areas into one using a tab bar (curvy-tabs) and incorporated the instructions onto the same page. (Compare v3.0.1 vs. v3.0.2 to see the difference.)

Note: The tutorial is still a work-in-progress

Cell borders

A new cell-borders demo contains sample code that shows how to implement cell borders using an overlay cell renderer (called Borders) for the purpose. Cell borders are line segments drawn on the edges of cells to form rule lines between cells.

Caveats: This method of drawing rules between cells cannot be used simultaneously with the current grid lines feature. Note also that it is not performant and not recommended when performance is paramount unless restricted to a small handful of cells.

Published to npm

This release has been published (as of 8/28/2018) as a module to the npm registry.

Pre-bundled build files

A bundled build of this release is available on the CDN.