UNPKG

7.47 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4var _base = _interopRequireWildcard(require("./base"));
5exports.CellCoords = _base.CellCoords;
6exports.CellRange = _base.CellRange;
7var _registry = require("./registry");
8var _eventManager = _interopRequireWildcard(require("./eventManager"));
9var _translations = require("./translations");
10var _jquery = _interopRequireDefault(require("./helpers/wrappers/jquery"));
11var _ghostTable = _interopRequireDefault(require("./utils/ghostTable"));
12var parseTableHelpers = _interopRequireWildcard(require("./utils/parseTable"));
13var arrayHelpers = _interopRequireWildcard(require("./helpers/array"));
14var browserHelpers = _interopRequireWildcard(require("./helpers/browser"));
15var dataHelpers = _interopRequireWildcard(require("./helpers/data"));
16var dateHelpers = _interopRequireWildcard(require("./helpers/date"));
17var featureHelpers = _interopRequireWildcard(require("./helpers/feature"));
18var functionHelpers = _interopRequireWildcard(require("./helpers/function"));
19var mixedHelpers = _interopRequireWildcard(require("./helpers/mixed"));
20var numberHelpers = _interopRequireWildcard(require("./helpers/number"));
21var objectHelpers = _interopRequireWildcard(require("./helpers/object"));
22var stringHelpers = _interopRequireWildcard(require("./helpers/string"));
23var unicodeHelpers = _interopRequireWildcard(require("./helpers/unicode"));
24var domHelpers = _interopRequireWildcard(require("./helpers/dom/element"));
25var domEventHelpers = _interopRequireWildcard(require("./helpers/dom/event"));
26var _registry2 = require("./editors/registry");
27var _registry3 = require("./renderers/registry");
28var _registry4 = require("./validators/registry");
29var _registry5 = require("./cellTypes/registry");
30var _registry6 = require("./plugins/registry");
31var _base2 = require("./plugins/base");
32var _Handsontable$cellTyp, _Handsontable$editors, _Handsontable$rendere, _Handsontable$validat, _Handsontable$plugins;
33function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
34function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
35function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
36(0, _registry.registerAllModules)();
37(0, _jquery.default)(_base.default);
38
39// TODO: Remove this exports after rewrite tests about this module
40_base.default.__GhostTable = _ghostTable.default;
41_base.default._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests
42_base.default._getRegisteredMapsCounter = _translations.getRegisteredMapsCounter; // For MemoryLeak tests
43_base.default.EventManager = _eventManager.default;
44
45// Export all helpers to the Handsontable object
46const HELPERS = [arrayHelpers, browserHelpers, dataHelpers, dateHelpers, featureHelpers, functionHelpers, mixedHelpers, numberHelpers, objectHelpers, stringHelpers, unicodeHelpers, parseTableHelpers];
47const DOM = [domHelpers, domEventHelpers];
48_base.default.helper = {};
49_base.default.dom = {};
50
51// Fill general helpers.
52arrayHelpers.arrayEach(HELPERS, helper => {
53 arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), key => {
54 if (key.charAt(0) !== '_') {
55 _base.default.helper[key] = helper[key];
56 }
57 });
58});
59
60// Fill DOM helpers.
61arrayHelpers.arrayEach(DOM, helper => {
62 arrayHelpers.arrayEach(Object.getOwnPropertyNames(helper), key => {
63 if (key.charAt(0) !== '_') {
64 _base.default.dom[key] = helper[key];
65 }
66 });
67});
68
69// Export cell types.
70_base.default.cellTypes = (_Handsontable$cellTyp = _base.default.cellTypes) !== null && _Handsontable$cellTyp !== void 0 ? _Handsontable$cellTyp : {};
71arrayHelpers.arrayEach((0, _registry5.getRegisteredCellTypeNames)(), cellTypeName => {
72 _base.default.cellTypes[cellTypeName] = (0, _registry5.getCellType)(cellTypeName);
73});
74_base.default.cellTypes.registerCellType = _registry5.registerCellType;
75_base.default.cellTypes.getCellType = _registry5.getCellType;
76
77// Export all registered editors from the Handsontable.
78_base.default.editors = (_Handsontable$editors = _base.default.editors) !== null && _Handsontable$editors !== void 0 ? _Handsontable$editors : {};
79arrayHelpers.arrayEach((0, _registry2.getRegisteredEditorNames)(), editorName => {
80 _base.default.editors[`${stringHelpers.toUpperCaseFirst(editorName)}Editor`] = (0, _registry2.getEditor)(editorName);
81});
82_base.default.editors.registerEditor = _registry2.registerEditor;
83_base.default.editors.getEditor = _registry2.getEditor;
84
85// Export all registered renderers from the Handsontable.
86_base.default.renderers = (_Handsontable$rendere = _base.default.renderers) !== null && _Handsontable$rendere !== void 0 ? _Handsontable$rendere : {};
87arrayHelpers.arrayEach((0, _registry3.getRegisteredRendererNames)(), rendererName => {
88 const renderer = (0, _registry3.getRenderer)(rendererName);
89 if (rendererName === 'base') {
90 _base.default.renderers.cellDecorator = renderer;
91 }
92 _base.default.renderers[`${stringHelpers.toUpperCaseFirst(rendererName)}Renderer`] = renderer;
93});
94_base.default.renderers.registerRenderer = _registry3.registerRenderer;
95_base.default.renderers.getRenderer = _registry3.getRenderer;
96
97// Export all registered validators from the Handsontable.
98_base.default.validators = (_Handsontable$validat = _base.default.validators) !== null && _Handsontable$validat !== void 0 ? _Handsontable$validat : {};
99arrayHelpers.arrayEach((0, _registry4.getRegisteredValidatorNames)(), validatorName => {
100 _base.default.validators[`${stringHelpers.toUpperCaseFirst(validatorName)}Validator`] = (0, _registry4.getValidator)(validatorName);
101});
102_base.default.validators.registerValidator = _registry4.registerValidator;
103_base.default.validators.getValidator = _registry4.getValidator;
104
105// Export all registered plugins from the Handsontable.
106// Make sure to initialize the plugin dictionary as an empty object. Otherwise, while
107// transpiling the files into ES and CommonJS format, the injected CoreJS helper
108// `import "core-js/modules/es.object.get-own-property-names";` won't be processed
109// by the `./config/plugin/babel/add-import-extension` babel plugin. Thus, the distribution
110// files will be broken. The reason is not known right now (probably it's caused by bug in
111// the Babel or missing something in the plugin).
112_base.default.plugins = (_Handsontable$plugins = _base.default.plugins) !== null && _Handsontable$plugins !== void 0 ? _Handsontable$plugins : {};
113arrayHelpers.arrayEach((0, _registry6.getPluginsNames)(), pluginName => {
114 _base.default.plugins[pluginName] = (0, _registry6.getPlugin)(pluginName);
115});
116_base.default.plugins[`${stringHelpers.toUpperCaseFirst(_base2.BasePlugin.PLUGIN_KEY)}Plugin`] = _base2.BasePlugin;
117_base.default.plugins.registerPlugin = _registry6.registerPlugin;
118_base.default.plugins.getPlugin = _registry6.getPlugin;
119var _default = exports.default = _base.default;
\No newline at end of file