Handsontable Manager

This module provides api to run any example in any handsontable version with selected preset. Secondary, it manages instances and allows to destroy them all.

API:

applyToWindow()

Apply useHandsontable and instanceRegister into window objects, which makes them global.

getDependencies(version, preset)

Return array of dependencies. Each dependency has 2 or 3 elements: [scriptUrl,[variables],stylesUrl?] Where variables mean which vars should be clean up if the dependency being unloaded.

instanceRegister.listen()

Add global hook into Handsontable, which save all instances;

instanceRegister.destroyAll()

Destroy all instances.

useHandsontable(version, callback, preset='hot')

Add into head section all needed dependencies (js and css) for selected preset, and then run callback.

useHandsontable('8.3.1', () => {
    const hot = new Handsontable(/* ... */);
    /* ... */
},'react-redux');

Dependency flow

PlantUML code

Edit

@startuml

package "handsontable-manager" {
    [dependencies.js]
    [register.js]
    [use-handsontable.js]
}
interface "useHandsontable"
interface "instanceRegister"
interface "getDependencies"


[use-handsontable.js] -up-> [dependencies.js]
[use-handsontable.js] -up-> [register.js]

[getDependencies] -up- [use-handsontable.js]
[useHandsontable] --up- [dependencies.js]
[instanceRegister] --up- [register.js]

@enduml

Dependency flow