Hypergrid v2.1.13
See also
In addition to the release notes below, please refer also to:
- Release Notes: v2.1.0 wiki page
- All release notes for
v2.1.2throughv2.1.10(below)
This patch release v2.1.13 supersedes v2.1.10
- Reflects PRs #722 (
v2.1.11) + #727 (v2.1.12) + #728 (v2.1.13) - Note that there were no releases
v2.1.1,v2.1.9,v2.1.11, or2.1.12
Published to npm
This release has been published as a module to the npm registry.
Pre-bundled build file
A bundled build of this release is available on the CDN.
Synopsis
- Support for non-US keyboard layouts (resolves Issues #621 and #623; supersedes PRs #622 and #626)
- Scrolling speed (resolves Issue #290; supersedes PR #620)
- Fix
fin-button-pressedevent handler in TestBench (demo) - Fix
Renderer.prototype.findCell - Add
config.clickRectwrite-only prop for cell renderer - Draw frame around last row or column selection
- Add "collapse cell selections" testbench feature
- Allow auto-row and -column selection without cell selection
- Improve
Textfieldcell editor - Improve cell editor base class (CellEditor.js)
- Fix and enhance testbench's
Timecell editor - New: demo/formatter-workbench
1. Support for non-US keyboard layouts
Hypergrid until now has depended on the long-deprecated KeyboardEvent#keyCode to infer the printable character. This assumes a particular keyboard layout and mapping of keyCode to physical keys.
Issue #621: Characters are wrongly mapped for non-US keyboards
This PR resolves this issue (Issue #621). The logic no longer depends on keyCode although the legacy logic is still in place and the legacy value is still available in event.legacyChar:
grid.canvas.getKeyChar(keyboardEvent)now returnskeyboardEvent.keyfor "printable" chars, include the space char.- printable chars are discriminated from non-printable characters when
key.length === 1 - for the event
epassed to eventsfin-keydown,fin-keyup,fin-editor-keydown,fin-editor-keypress, andfin-editor-keyup: e.charis still set as before bygrid.canvas.getKeyChar(e)but now contains the new resulte.legacyChar(new prop) is the olde.charvalue, when available (depends onkeyCodestill working and charMap coverage)- for non-printable chars (
e.legacyChar.length > 1),e.char === e.legacyChar(still)
There are two breaking changes:
- The space bar previously returned
e.char === 'SPACE'and therefore was considered a non-printable char. It is now considered a printable char, ande.char === ' 'instead. - On the Mac, option (aka meta) + printable char generally returns generates some exotic printable char. Like non-US keyboard characters, these were previously lost. Now however
e.charwill contain the exotic char whilee.legacyCharwill contain the old value (the regular character as if the meta key was not down).
Issue #623: Space key does not open cell editor
The first breaking change above has the side-effect of also resolving #623: Space key does not open cell editor
2. Scrolling speed (Issue #290)
Added two new properties which are multipliers for the mouse wheel:
wheelHFactor: 0.02- multiplier for horizontal mouse wheel movement, applied to values ofWheelEvent#deltaX(received by the horizontal scrollbar's listener).wheelVFactor: 0.05- multiplier for vertical mouse wheel movement, applied to values ofWheelEvent#deltaY(received by the vertical scrollbar's listener).
Caveat
Wheel granularity depends on the OS, the input device, and possibly the browser. Any setting you choose will work differently in different environments. If you don't know the user's environment, it is probably best to give users control of this setting so they can fine tune it themselves.
Default values
The particular default values shown above are a compromise. These settings seem to work well on the MacBook Pro trackpad. They also seem to work acceptably (though differently) with a mouse wheel on both Mac OS and Windows.
Be aware however that the trackpad scrolling speed can be adjusted by the Mac user at the OS level (System Preferences -> Accessibility -> Mouse & Trackpad -> Trackpad Options… -> Scrolling speed). Mouse wheel scrolling speed is also adjustable ( yada yada -> Mouse Options… -> Scrolling speed; or on Windows search for "Change mouse wheel settings" in the Start menu).
This setting feels good on trackpad (2-finger drag). It's much slower than it was, but the way it was was way to coarse and fast, scrolling hundreds of rows in a flash.
With this setting, a mouse connected to a Mac, the wheel requires 5 click-stops to scroll 1 row; the same mouse connected to Windows scrolls 5 rows per click-stop. (However, I may have changed the default settings on my machines; not sure.)
On Windows, the original vertical multiplier setting (i.e., 1.0) scrolled 100 grid rows on a single mouse wheel click-stop; the new default (0.05) scrolls 5 rows per click-stop. It stands to reason therefore that a setting of 0.01 will scroll 1:1 (1 row per 1 click-stop).
Hint
You can tell if the user is using a trackpad by listening for any deltaX (since a simple mouse wheel is deltaY only); and what OS by checking user agent.
3. Fix fin-button-pressed event handler in TestBench (demo)
Fixed an issue that prevented the fin-button-pressed event from being fired when user clicks on a cell rendered by the Button cell renderer.
Also retired the following core code which supported this event:
grid.renderer.buttonCellsobjectconfig.buttonCellsobject (reference togrid.renderer.buttonCellsgrid.renderer.isViewableButton(c, r)methodgrid.isViewableButton(c, r)method (stub that calls therendererversion)
The above code, intended for internal use only, tracked and identified the set of visible cells rendered by the Button cell renderer so that clicking them could dispatch the fin-button-pressed event. That solution may have been left over from an early release that lacked general column properties (much less cell properties). In any case, it has been updated to simply check the cell's cell renderer name (event.properties.renderer === 'button').
4. Fix Renderer.prototype.findCell
- Fixed a bug in
Renderer.prototype.findCellwhere thecellEvent[]pool size was being miscalculated because it was not accounting for row number column and/or tree column (when present). Previously, when these columns were present the algorithm was failing to scan enough elements and was therefore missing targets in the last 1 or 2 columns. - Upgraded
grid.renderer.getGridCellFromMousePointto return the actualcellEventfrom the pool (rather than a new one with the same coordinates) so that decorations added by the cell renderer are now available to mouse events, in particular the newclickRectproperty described below.
5. Add config.clickRect write-only prop for cell renderer
- Using local cell coordinates, cell renderers can now at their option define a
require('rectangular').Rectangleobject (akafin.Hypergrid.rectangular.Rectanglein thefin-hypergrid.jsbuild) in theconfig.clickRectproperty, which the grid renderer then copies back onto thecellEventobject. - The
fin-canvas-clickevent received from the canvas was previously always re-fired as thefin-clickevent. This event is now ignored however in the following cases:- This event is now ignored if the mouse button was released when the mouse was no longer hovering over the cell it was over when the mouse button was depressed. Previously this event was always fired regardless because as it was is actually triggered by the browser on the entire
<canvas>element, it fired even when the mouse was moved to another cell before releasing the mouse button. - When and only when a
clickRectsubrect was defined on the event by the cell renderer: This event is now ignored if the mouse button was released when the mouse was no longer hovering over theclickRect(as it was when it was the mouse button was depressed).
- This event is now ignored if the mouse button was released when the mouse was no longer hovering over the cell it was over when the mouse button was depressed. Previously this event was always fired regardless because as it was is actually triggered by the browser on the entire
- Note that
fin-mouseupandfin-double-clickare unaffected by this change.
6. Draw frame around last row or column selection
- Draw a frame around the visible portion of the last selection including row and column selections. Previously this feature only pertained to cell region selections. It now pertains to whatever was selected last. It is smart about deselecting.
- Copy operation now copies the last selection (thing with the frame now drawn around it). Previously cell region selections always had priority, then row selections, then column selections.
- Exception: The collapse cell region feature which collapses a cell region selection to a new row selection, continues to draw the frame around just the cells (the previous behavior). Note that this feature is only active when
grid.properties.singleRowSelectionMode && !grid.properties.multipleSelections(which are the default settings).
7. Add "collapse cell selections" testbench feature
This feature has been imported from the "testbench" demo as a new option collapseCellSelections but it now defaults to false. You can turn it back on in the Dashboard -> Selections panel.
This feature basically causes row selections to move the last cell selection to the new row selection.
This feature only works in single row selection mode when selecting one row at a time (singleRowSelectionMode && !multipleSelections).
8. Allow auto-row and -column selection without cell selection
Previously, autoRowSelection and/or autoColumnSelection caused cell selection to select the row and/or column. This had the sometimes undesirable effect of selecting a cell along with the row and/or column. Prior to this release, this cell was always framed. This was because cells always had priority for framing although this is no longer the case (see item 6 above). Although this is no longer the case, the cell is still framed if the collapseCellSelections feature is active (see item 7 above); or if the row is subsequently deselected with a CTRL-click in the row handle cell.
With this change, rows and/or columns are now auto-selectable per autoRowSelection and/or autoColumnSelection even when cell selection is off (cellSelection = false). This configuration is preferable when you don't need cell selections and it also permits row deselection via CTRL-click anywhere in the row — rather requiring the click to be in the row handle cell.
9. Improve Textfield cell editor
- Set
inputelement font to cell's font on instantiation
10. Improve cell editor base class (CellEditor.js)
- Prevent overlapping cell editor error effects which was distorting UI positioning
- Add
valueparam togetEditorValueandvalidateEditorValuemethods for developer convenience. (Called with valuethis.input.value.) - Now handles error thrown from the call to
localizer.invalidas an alternative to return value. (This aligns its functionality to that oflocalizer.parse.)
11. Fix and enhance testbench's Time cell editor
- Add a
keypresshandler to accept typing "AM" or "PM" to toggle AM/PM (in addition to existing functionality requiring clicking on it). After toggling, the input is discarded (by callingpreventDefault). - Reject (with error feedback effect) all other chars besides digits and colon.
- Fix the
hhmmlocalizer dependency:- Rename to
clock12. - Remove tow-way interdependency on
Timecell editor so localizer can stand alone. - Fix a bug by restoring missing
NOONconstant.
- Rename to
12. New: demo/formatter-workbench
- This app helps learn about localizers and cell editors and can be used to develop them.
- Includes examples.
- Includes comprehensive documentation page with a short tutorial using the examples.
Defunct issues and PRs
All the above mentioned Issues (#621, #623, #290) and competing pull requests (#622, #626, and #620) have been closed.