Socket
Socket
Sign inDemoInstall

fin-hypergrid

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fin-hypergrid - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

images/images.js

@@ -1,2 +0,2 @@

module.exports = { // This file generated by gulp-imagine-64 at 5:40:02 PM on 5/12/2016
module.exports = { // This file generated by gulp-imagine-64 at 9:28:56 PM on 5/12/2016
"calendar": {

@@ -3,0 +3,0 @@ type: "image/png",

@@ -45,3 +45,3 @@ # P R E L I M I N A R Y   D O C U M E N T A T I O N

*Data cells* may be associated with cell editors _declaratively_ or _programmatically_. Both these methods are explained below. Note that a declaratively association can be overridden programmatically.
*Data cells* may be associated with cell editors _declaratively_ or _programmatically_. Both these methods are explained below. Note that a declarative association can be overridden programmatically.

@@ -52,20 +52,16 @@ Failure to associate a cell editor with a data cell means that the cell will not be editable.

*Definition.* By _declarative,_ we mean statements involving JavaScript object literals. Although technically such literals are executed at run-time, they mimic compile-time literal (constant) _declarations_ in other programming languages. These object literals supply property values to Hypergrid's various _set properties_ methods.
*Definition.* By _declarative,_ we mean statements that (typically) use JavaScript object literals to supply property values to Hypergrid's various _set properties_ methods.
*String referects.* Cell editor references in these declarations are always given in string form. That is, rather than a direct reference to a cell editor "class," we use a string containing the name of the constructor function. This facilitates persisting declarative data because such references are pre-_stringified._ It also allows format names to be used to reference cell editors (more on this below).
NOTE: Cell editor string references are _case insensitive._ For example, `'textfield'` and `'TextField'` both refer to the `Textfield` cell editor. While this may help simplify things for the application developer, the real reason for this relaxation in the naming rules is, again, to facilitate the use of format names to refer to cell editors.
*Cell editor names.* Cell editor references in these declarations are always given in string form, a case-insensitive stringification of the cell editor's name (_i.e., the name of its constructor function). This facilitates persisting declarative data because such references are pre-_stringified._ It also allows format names and type names to be used to reference cell editors (more on this below).
For declarative cell editor association, there are two such properties of interest, `format` and `editor`. A simple algorithm (in `DataModel.prototype.getCellEditorAt`) searches for a cell editor name as follows:
When the user initiates cell editing on a data cell, the data model's `getCellEditorAt` method is invoked with the cell coordinates. Unless overridden, `DataModel.prototype.getCellEditorAt` looks for a cell editor name in the following places in the following priority order:
1. Cell property `editor`; _if undefined, then..._
2. Column property `editor`; _if undefined, then..._
3. Grid property `editor`; _if undefined, then..._
4. Cell property `format`; _if undefined, then..._
5. Column property `format`; _if undefined, then..._
6. Grid property `format`; _if undefined, then..._
7. Cell editor is undefined.
If a cell editor value could not be determnined, it remains `undefined` and the cell will be _non-editable..._ Unless, that is, a cell editor is associated programmatically at run-time, as described in the next section.
1. The `editor` cell property, if any
2. The `format` cell property, if any
3. The column's type name, if any
If a cell editor name was found _and_ it was the name or synonym of a registered cell editor, the cell editor is associated with the cell. Otherwise, the cell will be _non-editable_ unless a cell editor is associated programmatically at run-time, as described in the next section.
NOTE: Rule 3 works because there already are cell editors with names matching the type names "number" and "date"; and in addition the name "string" is registered as a synonym for the "textfield" cell editor. The implication here is that without specifying either of the cell properties in rules 1 and 2,
#### Programmatic cell editor association

@@ -72,0 +68,0 @@

{
"name": "fin-hypergrid",
"version": "1.0.2",
"version": "1.0.3",
"description": "Canvas-based high-performance spreadsheet",

@@ -5,0 +5,0 @@ "repository": {

@@ -11,3 +11,3 @@ **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.

See the version 1.0 [demo](https://openfin.github.io/fin-hypergrid/demo/index.html).
See the version 1.0 [demo](https://openfin.github.io/fin-hypergrid).

@@ -14,0 +14,0 @@ The prototype version's [demos](http://openfin.github.io/fin-hypergrid/components/fin-hypergrid/demo.html) had some nice applications you may wish to look at for inspiration of what you can do with hypergrid and to give you some idea of the speed and responsiveness of the engine.

@@ -19,7 +19,14 @@ /**

/**
* @summary Register a cell editor (class).
* @desc Adds a custom cell editor to the `constructors` hash using the provided name (or the class name) converted to all lower case.
* @summary Register a cell editor (class) or a synonym of an already-registered cell editor.
* @desc Adds a custom cell editor to the `constructors` hash using the provided name (or the class name), converted to all lower case.
*
* > All native cell editors are "preregistered" by constructor. If you plan to instantiate a number of grids, rather than registering all your custom cell editor(s) on all your grids, if that's what you were going to do, you might instead let them "go native" by adding them to `cellEditors` hash _before_ instantiating your grids so the constructor will do the work for you on each grid.
* To register a syonym for an already-registered cell editor, use the following construct:
* ```
* var cellEditors = require('./cellEditors');
* cellEditors.register(cellEditors.get('spinner'), 'elevator');
* ```
* This makes a synonym "elevator" for the "spinner" cell editor.
*
* > All native cell editors are "preregistered" in cellEditors/index.js.
*
* @param {YourCellEditor.prototype.constructor} Constructor - A constructor, typically extended from `CellEditor` (or a descendant therefrom).

@@ -42,2 +49,11 @@ *

/**
* @param {string} editorName
* @returns {*}
*/
function get(editorName) {
return constructors[editorName && editorName.toLowerCase()];
}
/**
* Must be called with YOUR Hypergrid object as context!

@@ -50,4 +66,3 @@ * @returns {CellEditor} New instance of the named cell editor.

function instantiate(editorName) {
editorName = editorName && editorName.toLowerCase();
var CellEditorConstructor = constructors[editorName];
var CellEditorConstructor = get(editorName);
return CellEditorConstructor && new CellEditorConstructor(this);

@@ -82,10 +97,3 @@ }

module.exports = {
constructors: constructors,
register: register,
instantiate: instantiate,
extend: extend
};
// register standard cell editors
register(require('./CellEditor'));

@@ -95,7 +103,23 @@ register(require('./ComboBox'));

register(require('./Color'));
exports.date = register(require('./Date')); // `date` defined here for column.type fallback
register(require('./Date'));
register(require('./FilterBox'));
exports.number = register(require('./Number')); // `number` defined here for column.type fallback
register(require('./Number'));
register(require('./Slider'));
register(require('./Spinner'));
exports.string = register(require('./Textfield')); // `string` defined here for column.type fallback
register(require('./Textfield'));
// Register synonyms for standard type names.
// It is unnecessary to set up synonyms for 'date' and 'number' because there are already suitable cell editor resitrations matching those names.
register(constructors.number, 'int');
register(constructors.number, 'float');
register(constructors.textfield, 'string');
module.exports = {
constructors: constructors,
register: register,
get: get,
instantiate: instantiate,
extend: extend
};

@@ -77,9 +77,14 @@ 'use strict';

return this.grid.createCellEditor(
(cellProperties = column.getCellProperties(y) || {}).editor ||
(columnProperties = column.getProperties()).editor ||
cellProperties.format ||
columnProperties.format ||
column.getType()
);
var editorName = (cellProperties = column.getCellProperties(y) || {}).editor ||
(columnProperties = column.getProperties()).editor;
if (!editorName && editorName !== null) { // null means don't fallback to format
editorName = cellProperties.format || columnProperties.format;
}
if (!editorName && editorName !== null) { // null means don't fallback to type
editorName = column.getType();
}
return this.grid.createCellEditor(editorName);
}

@@ -86,0 +91,0 @@

@@ -660,10 +660,19 @@ /* eslint-env browser */

/** Name of a formatter for cell text.
* The default (`null`) does no formatting.
* The default (`undefined`) falls back to `column.type`.
* The value `null` does no formatting.
* @default undefined
* @type {undefined|string}
* @type {undefined|null|string}
* @see /lib/localizers.js
*/
format: null,
editor: null,
format: undefined,
/** Name of a cell formatter for cell text.
* The default (`undefined`) falls back to `format`.
* The value `null` does no formatting.
* @default undefined
* @type {undefined|null|string}
* @see /lib/localizers.js
*/
editor: undefined,
/********** HOVER COLORS **********/

@@ -670,0 +679,0 @@

@@ -324,2 +324,4 @@ /* eslint-env browser */

localizers.int = localizers.float = localizers.number;
/**

@@ -326,0 +328,0 @@ * @param {string} localizerName

@@ -1069,3 +1069,4 @@ /* eslint-env browser */

var cell = behavior.getCellRenderer(cellProperties, c, r);
var overrides = behavior.getCellProperties(behavior.getVisibleColumn(c).index, r);
var column = behavior.getVisibleColumn(c);
var overrides = behavior.getCellProperties(column.index, r);

@@ -1077,3 +1078,8 @@ //declarative cell properties

cellProperties.buttonCells = this.buttonCells;
var formatName = cellProperties.isUserDataArea && cellProperties.format;
if (cellProperties.isUserDataArea) {
var formatName = cellProperties.format;
if (!formatName && formatName !== null) { // null means don't fallback to type
formatName = column.getType();
}
}
cellProperties.formatValue = grid.getFormatter(formatName);

@@ -1080,0 +1086,0 @@ cell.paint(gc, cellProperties);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc