handsontable 15.3.0-next-175012b-20250429 → 16.0.0-next-f486b48-20250702
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/walkontable/src/core/_base.js +0 -3
- package/3rdparty/walkontable/src/core/_base.mjs +0 -3
- package/3rdparty/walkontable/src/core/clone.js +0 -1
- package/3rdparty/walkontable/src/core/clone.mjs +0 -1
- package/3rdparty/walkontable/src/core/core.js +0 -2
- package/3rdparty/walkontable/src/core/core.mjs +0 -2
- package/3rdparty/walkontable/src/facade/core.js +0 -3
- package/3rdparty/walkontable/src/facade/core.mjs +0 -3
- package/3rdparty/walkontable/src/index.js +1 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +1 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +17 -11
- package/3rdparty/walkontable/src/selection/border/border.mjs +17 -11
- package/3rdparty/walkontable/src/selection/border/utils.js +1 -1
- package/3rdparty/walkontable/src/selection/border/utils.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +3 -1
- package/3rdparty/walkontable/src/settings.mjs +3 -1
- package/3rdparty/walkontable/src/table.js +9 -6
- package/3rdparty/walkontable/src/table.mjs +9 -6
- package/3rdparty/walkontable/src/types.js +0 -1
- package/3rdparty/walkontable/src/types.mjs +0 -1
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/viewport.js +1 -1
- package/3rdparty/walkontable/src/viewport.mjs +1 -1
- package/CHANGELOG.md +23 -0
- package/README.md +10 -4
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/registry.js +2 -3
- package/cellTypes/registry.mjs +1 -1
- package/core/coordsMapper/rangeToRenderableMapper.js +124 -0
- package/core/coordsMapper/rangeToRenderableMapper.mjs +120 -0
- package/core/focusCatcher/focusDetector.js +2 -2
- package/core/focusCatcher/focusDetector.mjs +2 -2
- package/core/hooks/constants.js +259 -1
- package/core/hooks/constants.mjs +259 -1
- package/core.d.ts +2 -0
- package/core.js +202 -58
- package/core.mjs +202 -58
- package/dataMap/dataMap.js +16 -30
- package/dataMap/dataMap.mjs +16 -30
- package/dataMap/metaManager/metaSchema.js +58 -0
- package/dataMap/metaManager/metaSchema.mjs +58 -0
- package/dist/handsontable.css +30 -4
- package/dist/handsontable.full.css +30 -4
- package/dist/handsontable.full.js +6073 -4352
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +206 -206
- package/dist/handsontable.js +5751 -4037
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +41 -41
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fa-IR.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +5 -1
- package/editorManager.mjs +5 -1
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +0 -12
- package/editors/autocompleteEditor/autocompleteEditor.js +42 -69
- package/editors/autocompleteEditor/autocompleteEditor.mjs +43 -70
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +2 -8
- package/editors/dateEditor/dateEditor.mjs +3 -9
- package/editors/handsontableEditor/handsontableEditor.d.ts +8 -0
- package/editors/handsontableEditor/handsontableEditor.js +173 -17
- package/editors/handsontableEditor/handsontableEditor.mjs +173 -17
- package/editors/passwordEditor/passwordEditor.js +2 -0
- package/editors/passwordEditor/passwordEditor.mjs +2 -0
- package/editors/registry.js +2 -3
- package/editors/registry.mjs +1 -1
- package/editors/textEditor/textEditor.js +2 -0
- package/editors/textEditor/textEditor.mjs +2 -0
- package/helpers/a11y.js +2 -0
- package/helpers/a11y.mjs +1 -0
- package/helpers/dom/element.d.ts +1 -0
- package/helpers/dom/element.js +26 -1
- package/helpers/dom/element.mjs +25 -1
- package/helpers/mixed.js +4 -4
- package/helpers/mixed.mjs +4 -4
- package/i18n/languages/ar-AR.js +1 -2
- package/i18n/languages/cs-CZ.js +1 -2
- package/i18n/languages/de-CH.js +1 -2
- package/i18n/languages/de-DE.js +1 -2
- package/i18n/languages/en-US.js +1 -2
- package/i18n/languages/es-MX.js +1 -2
- package/i18n/languages/fa-IR.js +1 -2
- package/i18n/languages/fr-FR.js +1 -2
- package/i18n/languages/hr-HR.js +1 -2
- package/i18n/languages/it-IT.js +1 -2
- package/i18n/languages/ja-JP.js +1 -2
- package/i18n/languages/ko-KR.js +1 -2
- package/i18n/languages/lv-LV.js +1 -2
- package/i18n/languages/nb-NO.js +1 -2
- package/i18n/languages/nl-NL.js +1 -2
- package/i18n/languages/pl-PL.js +1 -2
- package/i18n/languages/pt-BR.js +1 -2
- package/i18n/languages/ru-RU.js +1 -2
- package/i18n/languages/sr-SP.js +1 -2
- package/i18n/languages/zh-CN.js +1 -2
- package/i18n/languages/zh-TW.js +1 -2
- package/i18n/phraseFormatters/index.js +2 -2
- package/i18n/phraseFormatters/index.mjs +1 -1
- package/i18n/registry.js +3 -4
- package/i18n/registry.mjs +1 -1
- package/index.js +1 -2
- package/package.json +10 -4
- package/plugins/autoColumnSize/autoColumnSize.js +47 -0
- package/plugins/autoColumnSize/autoColumnSize.mjs +47 -0
- package/plugins/autoRowSize/autoRowSize.js +45 -0
- package/plugins/autoRowSize/autoRowSize.mjs +45 -0
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +13 -0
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +13 -0
- package/plugins/collapsibleColumns/collapsibleColumns.js +31 -0
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +31 -0
- package/plugins/columnSorting/sortService/registry.js +3 -4
- package/plugins/columnSorting/sortService/registry.mjs +1 -1
- package/plugins/columnSummary/columnSummary.js +33 -0
- package/plugins/columnSummary/columnSummary.mjs +33 -0
- package/plugins/comments/commentEditor.js +8 -2
- package/plugins/comments/commentEditor.mjs +8 -2
- package/plugins/comments/comments.js +59 -15
- package/plugins/comments/comments.mjs +60 -16
- package/plugins/comments/contextMenuItem/addEditComment.js +1 -2
- package/plugins/comments/contextMenuItem/readOnlyComment.js +1 -2
- package/plugins/comments/contextMenuItem/removeComment.js +1 -2
- package/plugins/contextMenu/contextMenu.js +1 -1
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/plugins/contextMenu/menu/menu.js +12 -6
- package/plugins/contextMenu/menu/menu.mjs +13 -7
- package/plugins/contextMenu/predefinedItems/alignment.js +1 -2
- package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -2
- package/plugins/contextMenu/predefinedItems/columnLeft.js +1 -2
- package/plugins/contextMenu/predefinedItems/columnRight.js +1 -2
- package/plugins/contextMenu/predefinedItems/index.js +1 -2
- package/plugins/contextMenu/predefinedItems/readOnly.js +1 -2
- package/plugins/contextMenu/predefinedItems/redo.js +1 -2
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -2
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -2
- package/plugins/contextMenu/predefinedItems/rowAbove.js +1 -2
- package/plugins/contextMenu/predefinedItems/rowBelow.js +1 -2
- package/plugins/contextMenu/predefinedItems/undo.js +1 -2
- package/plugins/copyPaste/contextMenuItem/cut.js +1 -2
- package/plugins/customBorders/contextMenuItem/bottom.js +1 -2
- package/plugins/customBorders/contextMenuItem/left.js +1 -2
- package/plugins/customBorders/contextMenuItem/noBorders.js +1 -2
- package/plugins/customBorders/contextMenuItem/right.js +1 -2
- package/plugins/customBorders/contextMenuItem/top.js +1 -2
- package/plugins/customBorders/customBorders.js +1 -2
- package/plugins/dropdownMenu/dropdownMenu.js +16 -1
- package/plugins/dropdownMenu/dropdownMenu.mjs +16 -1
- package/plugins/exportFile/exportFile.js +59 -2
- package/plugins/exportFile/exportFile.mjs +58 -0
- package/plugins/filters/component/actionBar.js +1 -2
- package/plugins/filters/component/condition.js +1 -2
- package/plugins/filters/component/value.js +1 -2
- package/plugins/filters/condition/beginsWith.js +1 -2
- package/plugins/filters/condition/between.js +1 -2
- package/plugins/filters/condition/contains.js +1 -2
- package/plugins/filters/condition/date/after.js +1 -2
- package/plugins/filters/condition/date/before.js +1 -2
- package/plugins/filters/condition/date/today.js +1 -2
- package/plugins/filters/condition/date/tomorrow.js +1 -2
- package/plugins/filters/condition/date/yesterday.js +1 -2
- package/plugins/filters/condition/empty.js +1 -2
- package/plugins/filters/condition/endsWith.js +1 -2
- package/plugins/filters/condition/equal.js +1 -2
- package/plugins/filters/condition/greaterThan.js +1 -2
- package/plugins/filters/condition/greaterThanOrEqual.js +1 -2
- package/plugins/filters/condition/lessThan.js +1 -2
- package/plugins/filters/condition/lessThanOrEqual.js +1 -2
- package/plugins/filters/condition/none.js +1 -2
- package/plugins/filters/condition/notBetween.js +1 -2
- package/plugins/filters/condition/notContains.js +1 -2
- package/plugins/filters/condition/notEmpty.js +1 -2
- package/plugins/filters/condition/notEqual.js +1 -2
- package/plugins/filters/filters.js +76 -3
- package/plugins/filters/filters.mjs +75 -1
- package/plugins/filters/logicalOperations/conjunction.js +1 -2
- package/plugins/filters/logicalOperations/disjunction.js +1 -2
- package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +1 -2
- package/plugins/filters/ui/_base.js +1 -2
- package/plugins/filters/ui/multipleSelect.js +1 -7
- package/plugins/filters/ui/multipleSelect.mjs +0 -5
- package/plugins/filters/ui/select.js +1 -2
- package/plugins/formulas/engine/register.js +3 -4
- package/plugins/formulas/engine/register.mjs +1 -1
- package/plugins/formulas/formulas.js +40 -41
- package/plugins/formulas/formulas.mjs +39 -40
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -2
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -2
- package/plugins/hiddenColumns/hiddenColumns.js +64 -0
- package/plugins/hiddenColumns/hiddenColumns.mjs +64 -0
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -2
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -2
- package/plugins/hiddenRows/hiddenRows.js +64 -0
- package/plugins/hiddenRows/hiddenRows.mjs +64 -0
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -2
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -2
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +1 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -2
- package/plugins/mergeCells/mergeCells.js +56 -38
- package/plugins/mergeCells/mergeCells.mjs +56 -38
- package/plugins/mergeCells/utils.js +3 -4
- package/plugins/mergeCells/utils.mjs +3 -4
- package/plugins/nestedHeaders/nestedHeaders.js +37 -12
- package/plugins/nestedHeaders/nestedHeaders.mjs +37 -12
- package/plugins/nestedRows/nestedRows.js +12 -12
- package/plugins/nestedRows/nestedRows.mjs +12 -12
- package/plugins/nestedRows/ui/contextMenu.js +1 -2
- package/plugins/nestedRows/ui/headers.js +2 -3
- package/plugins/nestedRows/ui/headers.mjs +2 -3
- package/plugins/persistentState/persistentState.js +1 -1
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/stretchColumns/calculator.js +3 -2
- package/plugins/stretchColumns/calculator.mjs +3 -2
- package/plugins/stretchColumns/stretchColumns.js +13 -0
- package/plugins/stretchColumns/stretchColumns.mjs +13 -0
- package/plugins/trimRows/trimRows.js +61 -0
- package/plugins/trimRows/trimRows.mjs +61 -0
- package/renderers/baseRenderer/baseRenderer.js +4 -0
- package/renderers/baseRenderer/baseRenderer.mjs +4 -0
- package/renderers/registry.js +2 -3
- package/renderers/registry.mjs +1 -1
- package/selection/mouseEventHandler.js +48 -13
- package/selection/mouseEventHandler.mjs +47 -13
- package/selection/range.js +73 -6
- package/selection/range.mjs +73 -6
- package/selection/selection.js +46 -32
- package/selection/selection.mjs +45 -30
- package/settings.d.ts +1 -0
- package/styles/handsontable.css +131 -55
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +296 -181
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main.css +314 -205
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +9 -20
- package/tableView.mjs +9 -20
- package/translations/indexMapper.js +9 -5
- package/translations/indexMapper.mjs +9 -5
- package/utils/paginator.js +13 -0
- package/utils/paginator.mjs +13 -0
- package/utils/staticRegister.js +24 -2
- package/utils/staticRegister.mjs +23 -2
- package/{3rdparty/walkontable/src/utils → utils}/stylesHandler.js +16 -30
- package/{3rdparty/walkontable/src/utils → utils}/stylesHandler.mjs +16 -30
- package/validators/registry.js +2 -3
- package/validators/registry.mjs +1 -1
package/core.js
CHANGED
@@ -27,6 +27,7 @@ var _object = require("./helpers/object");
|
|
27
27
|
var _focusManager = require("./focusManager");
|
28
28
|
var _array = require("./helpers/array");
|
29
29
|
var _parseTable = require("./utils/parseTable");
|
30
|
+
var _staticRegister = require("./utils/staticRegister");
|
30
31
|
var _registry = require("./plugins/registry");
|
31
32
|
var _registry2 = require("./renderers/registry");
|
32
33
|
var _registry3 = require("./editors/registry");
|
@@ -49,6 +50,9 @@ var _uniqueMap = require("./utils/dataStructures/uniqueMap");
|
|
49
50
|
var _shortcuts = require("./shortcuts");
|
50
51
|
var _shortcutContexts = require("./shortcutContexts");
|
51
52
|
var _themes = require("./helpers/themes");
|
53
|
+
var _stylesHandler = require("./utils/stylesHandler");
|
54
|
+
var _console = require("./helpers/console");
|
55
|
+
var _rangeToRenderableMapper = require("./core/coordsMapper/rangeToRenderableMapper");
|
52
56
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
53
57
|
let activeGuid = null;
|
54
58
|
|
@@ -85,6 +89,12 @@ const deprecationWarns = new Set();
|
|
85
89
|
* by using React's `ref` feature (read more on the [Instance methods](@/guides/getting-started/react-methods/react-methods.md) page).
|
86
90
|
* :::
|
87
91
|
*
|
92
|
+
* ::: only-for angular
|
93
|
+
* To use these methods, associate a Handsontable instance with your instance
|
94
|
+
* of the [`HotTable` component](@/guides/getting-started/installation/installation.md#5-use-the-hottable-component),
|
95
|
+
* by using `@ViewChild` decorator (read more on the [Instance access](@/guides/getting-started/angular-hot-instance/angular-hot-instance.md) page).
|
96
|
+
* :::
|
97
|
+
*
|
88
98
|
* ## How to call a method
|
89
99
|
*
|
90
100
|
* ::: only-for javascript
|
@@ -115,11 +125,44 @@ const deprecationWarns = new Set();
|
|
115
125
|
* ```
|
116
126
|
* :::
|
117
127
|
*
|
118
|
-
*
|
128
|
+
* ::: only-for angular
|
129
|
+
* ```ts
|
130
|
+
* import { Component, ViewChild, AfterViewInit } from "@angular/core";
|
131
|
+
* import {
|
132
|
+
* GridSettings,
|
133
|
+
* HotTableComponent,
|
134
|
+
* HotTableModule,
|
135
|
+
* } from "@handsontable/angular-wrapper";
|
136
|
+
*
|
137
|
+
* `@Component`({
|
138
|
+
* standalone: true,
|
139
|
+
* imports: [HotTableModule],
|
140
|
+
* template: ` <div>
|
141
|
+
* <hot-table themeName="ht-theme-main" [settings]="gridSettings" />
|
142
|
+
* </div>`,
|
143
|
+
* })
|
144
|
+
* export class ExampleComponent implements AfterViewInit {
|
145
|
+
* `@ViewChild`(HotTableComponent, { static: false })
|
146
|
+
* readonly hotTable!: HotTableComponent;
|
147
|
+
*
|
148
|
+
* readonly gridSettings = <GridSettings>{
|
149
|
+
* columns: [{}],
|
150
|
+
* };
|
151
|
+
*
|
152
|
+
* ngAfterViewInit(): void {
|
153
|
+
* // Access the Handsontable instance
|
154
|
+
* // Call a method
|
155
|
+
* this.hotTable?.hotInstance?.setDataAtCell(0, 0, "new value");
|
156
|
+
* }
|
157
|
+
* }
|
158
|
+
* ```
|
159
|
+
* :::
|
160
|
+
*
|
161
|
+
* @param {HTMLElement} rootContainer The element to which the Handsontable instance is injected.
|
119
162
|
* @param {object} userSettings The user defined options.
|
120
163
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
121
164
|
*/
|
122
|
-
function Core(
|
165
|
+
function Core(rootContainer, userSettings) {
|
123
166
|
var _userSettings$layoutD,
|
124
167
|
_this = this;
|
125
168
|
let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
@@ -136,6 +179,30 @@ function Core(rootElement, userSettings) {
|
|
136
179
|
(0, _rootInstance.registerAsRootInstance)(this);
|
137
180
|
}
|
138
181
|
|
182
|
+
/**
|
183
|
+
* Reference to the root container.
|
184
|
+
*
|
185
|
+
* @private
|
186
|
+
* @type {HTMLElement}
|
187
|
+
*/
|
188
|
+
this.rootContainer = rootContainer;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Reference to the wrapper element.
|
192
|
+
*
|
193
|
+
* @private
|
194
|
+
* @type {HTMLElement}
|
195
|
+
*/
|
196
|
+
this.rootWrapperElement = undefined;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Reference to the portal element.
|
200
|
+
*
|
201
|
+
* @private
|
202
|
+
* @type {HTMLElement}
|
203
|
+
*/
|
204
|
+
this.rootPortalElement = undefined;
|
205
|
+
|
139
206
|
// TODO: check if references to DOM elements should be move to UI layer (Walkontable)
|
140
207
|
/**
|
141
208
|
* Reference to the container element.
|
@@ -143,14 +210,16 @@ function Core(rootElement, userSettings) {
|
|
143
210
|
* @private
|
144
211
|
* @type {HTMLElement}
|
145
212
|
*/
|
146
|
-
this.rootElement =
|
213
|
+
this.rootElement = (0, _rootInstance.isRootInstance)(this) ? rootContainer.ownerDocument.createElement('div') : rootContainer;
|
214
|
+
|
147
215
|
/**
|
148
216
|
* The nearest document over container.
|
149
217
|
*
|
150
218
|
* @private
|
151
219
|
* @type {Document}
|
152
220
|
*/
|
153
|
-
this.rootDocument =
|
221
|
+
this.rootDocument = rootContainer.ownerDocument;
|
222
|
+
|
154
223
|
/**
|
155
224
|
* Window object over container's document.
|
156
225
|
*
|
@@ -158,6 +227,17 @@ function Core(rootElement, userSettings) {
|
|
158
227
|
* @type {Window}
|
159
228
|
*/
|
160
229
|
this.rootWindow = this.rootDocument.defaultView;
|
230
|
+
if ((0, _rootInstance.isRootInstance)(this)) {
|
231
|
+
this.rootWrapperElement = this.rootDocument.createElement('div');
|
232
|
+
this.rootPortalElement = this.rootDocument.createElement('div');
|
233
|
+
(0, _element.addClass)(this.rootElement, 'ht-wrapper');
|
234
|
+
(0, _element.addClass)(this.rootWrapperElement, 'ht-root-wrapper');
|
235
|
+
this.rootWrapperElement.appendChild(this.rootElement);
|
236
|
+
this.rootContainer.appendChild(this.rootWrapperElement);
|
237
|
+
(0, _element.addClass)(this.rootPortalElement, 'ht-portal');
|
238
|
+
this.rootDocument.body.appendChild(this.rootPortalElement);
|
239
|
+
}
|
240
|
+
|
161
241
|
/**
|
162
242
|
* A boolean to tell if the Handsontable has been fully destroyed. This is set to `true`
|
163
243
|
* after `afterDestroy` hook is called.
|
@@ -167,6 +247,7 @@ function Core(rootElement, userSettings) {
|
|
167
247
|
* @type {boolean}
|
168
248
|
*/
|
169
249
|
this.isDestroyed = false;
|
250
|
+
|
170
251
|
/**
|
171
252
|
* The counter determines how many times the render suspending was called. It allows
|
172
253
|
* tracking the nested suspending calls. For each render suspend resuming call the
|
@@ -177,6 +258,7 @@ function Core(rootElement, userSettings) {
|
|
177
258
|
* @type {number}
|
178
259
|
*/
|
179
260
|
this.renderSuspendedCounter = 0;
|
261
|
+
|
180
262
|
/**
|
181
263
|
* The counter determines how many times the execution suspending was called. It allows
|
182
264
|
* tracking the nested suspending calls. For each execution suspend resuming call the
|
@@ -226,6 +308,14 @@ function Core(rootElement, userSettings) {
|
|
226
308
|
this.getDirectionFactor = function () {
|
227
309
|
return instance.isLtr() ? 1 : -1;
|
228
310
|
};
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Styles handler instance.
|
314
|
+
*
|
315
|
+
* @private
|
316
|
+
* @type {StylesHandler}
|
317
|
+
*/
|
318
|
+
this.stylesHandler = new _stylesHandler.StylesHandler(instance.rootElement, instance.rootDocument);
|
229
319
|
userSettings.language = (0, _registry5.getValidLanguageCode)(userSettings.language);
|
230
320
|
const settingsWithoutHooks = Object.fromEntries(Object.entries(userSettings).filter(_ref => {
|
231
321
|
let [key] = _ref;
|
@@ -236,10 +326,9 @@ function Core(rootElement, userSettings) {
|
|
236
326
|
const globalMeta = metaManager.getGlobalMeta();
|
237
327
|
const pluginsRegistry = (0, _uniqueMap.createUniqueMap)();
|
238
328
|
this.container = this.rootDocument.createElement('div');
|
239
|
-
rootElement.insertBefore(this.container, rootElement.firstChild);
|
329
|
+
this.rootElement.insertBefore(this.container, this.rootElement.firstChild);
|
240
330
|
if ((0, _rootInstance.isRootInstance)(this)) {
|
241
|
-
(0, _mixed._injectProductInfo)(userSettings.licenseKey,
|
242
|
-
(0, _element.addClass)(rootElement, 'ht-wrapper');
|
331
|
+
(0, _mixed._injectProductInfo)(userSettings.licenseKey, this.rootWrapperElement);
|
243
332
|
}
|
244
333
|
this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
|
245
334
|
|
@@ -253,6 +342,7 @@ function Core(rootElement, userSettings) {
|
|
253
342
|
* @type {IndexMapper}
|
254
343
|
*/
|
255
344
|
this.columnIndexMapper = new _translations.IndexMapper();
|
345
|
+
|
256
346
|
/**
|
257
347
|
* Instance of index mapper which is responsible for managing the row indexes.
|
258
348
|
*
|
@@ -271,6 +361,11 @@ function Core(rootElement, userSettings) {
|
|
271
361
|
instance.runHooks('beforeCompositionStart', event);
|
272
362
|
});
|
273
363
|
dataSource = new _dataSource.default(instance);
|
364
|
+
const moduleRegisterer = (0, _staticRegister.staticRegister)(this.guid);
|
365
|
+
moduleRegisterer.register('cellRangeMapper', new _rangeToRenderableMapper.CellRangeToRenderableMapper({
|
366
|
+
rowIndexMapper: this.rowIndexMapper,
|
367
|
+
columnIndexMapper: this.columnIndexMapper
|
368
|
+
}));
|
274
369
|
if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') {
|
275
370
|
this.rootElement.id = this.guid; // if root element does not have an id, assign a random id
|
276
371
|
}
|
@@ -386,11 +481,13 @@ function Core(rootElement, userSettings) {
|
|
386
481
|
} else {
|
387
482
|
(0, _element.removeClass)(this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
388
483
|
}
|
389
|
-
if (selection.getSelectionSource()
|
484
|
+
if (!['shift', 'refresh'].includes(selection.getSelectionSource())) {
|
390
485
|
editorManager.closeEditor(null);
|
391
486
|
}
|
392
|
-
|
393
|
-
|
487
|
+
if (selection.getSelectionSource() !== 'refresh') {
|
488
|
+
instance.view.render();
|
489
|
+
editorManager.prepareEditor();
|
490
|
+
}
|
394
491
|
});
|
395
492
|
this.selection.addLocalHook('beforeSetFocus', cellCoords => {
|
396
493
|
this.runHooks('beforeSelectionFocusSet', cellCoords.row, cellCoords.col);
|
@@ -413,6 +510,10 @@ function Core(rootElement, userSettings) {
|
|
413
510
|
} = cellRanges[selectionLayerLevel];
|
414
511
|
this.runHooks('afterSelectionEnd', from.row, from.col, to.row, to.col, selectionLayerLevel);
|
415
512
|
this.runHooks('afterSelectionEndByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), selectionLayerLevel);
|
513
|
+
if (selection.getSelectionSource() === 'refresh') {
|
514
|
+
instance.view.render();
|
515
|
+
editorManager.prepareEditor();
|
516
|
+
}
|
416
517
|
});
|
417
518
|
this.selection.addLocalHook('afterIsMultipleSelection', isMultiple => {
|
418
519
|
const changedIsMultiple = this.runHooks('afterIsMultipleSelection', isMultiple.value);
|
@@ -472,33 +573,33 @@ function Core(rootElement, userSettings) {
|
|
472
573
|
}
|
473
574
|
return _this.runHooks('afterModifyTransformStart', ...args);
|
474
575
|
}).addLocalHook('beforeModifyTransformFocus', function () {
|
475
|
-
for (var
|
476
|
-
args[
|
576
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
577
|
+
args[_key0] = arguments[_key0];
|
477
578
|
}
|
478
579
|
return _this.runHooks('modifyTransformFocus', ...args);
|
479
580
|
}).addLocalHook('afterModifyTransformFocus', function () {
|
480
|
-
for (var
|
481
|
-
args[
|
581
|
+
for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
582
|
+
args[_key1] = arguments[_key1];
|
482
583
|
}
|
483
584
|
return _this.runHooks('afterModifyTransformFocus', ...args);
|
484
585
|
}).addLocalHook('beforeModifyTransformEnd', function () {
|
485
|
-
for (var
|
486
|
-
args[
|
586
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
587
|
+
args[_key10] = arguments[_key10];
|
487
588
|
}
|
488
589
|
return _this.runHooks('modifyTransformEnd', ...args);
|
489
590
|
}).addLocalHook('afterModifyTransformEnd', function () {
|
490
|
-
for (var
|
491
|
-
args[
|
591
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
592
|
+
args[_key11] = arguments[_key11];
|
492
593
|
}
|
493
594
|
return _this.runHooks('afterModifyTransformEnd', ...args);
|
494
595
|
}).addLocalHook('beforeRowWrap', function () {
|
495
|
-
for (var
|
496
|
-
args[
|
596
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
597
|
+
args[_key12] = arguments[_key12];
|
497
598
|
}
|
498
599
|
return _this.runHooks('beforeRowWrap', ...args);
|
499
600
|
}).addLocalHook('beforeColumnWrap', function () {
|
500
|
-
for (var
|
501
|
-
args[
|
601
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
602
|
+
args[_key13] = arguments[_key13];
|
502
603
|
}
|
503
604
|
return _this.runHooks('beforeColumnWrap', ...args);
|
504
605
|
}).addLocalHook('insertRowRequire', totalRows => this.alter('insert_row_above', totalRows, 1, 'auto')).addLocalHook('insertColRequire', totalCols => this.alter('insert_col_start', totalCols, 1, 'auto'));
|
@@ -644,6 +745,9 @@ function Core(rootElement, userSettings) {
|
|
644
745
|
if (totalRows === 0) {
|
645
746
|
selection.deselect();
|
646
747
|
} else if (source === 'ContextMenu.removeRow') {
|
748
|
+
const selectionRange = selection.getSelectedRange();
|
749
|
+
const lastSelection = selectionRange.pop();
|
750
|
+
selectionRange.clear().set(lastSelection.from).current().setTo(lastSelection.to);
|
647
751
|
selection.refresh();
|
648
752
|
} else {
|
649
753
|
selection.shiftRows(groupIndex, -groupAmount);
|
@@ -692,6 +796,9 @@ function Core(rootElement, userSettings) {
|
|
692
796
|
if (totalColumns === 0) {
|
693
797
|
selection.deselect();
|
694
798
|
} else if (source === 'ContextMenu.removeColumn') {
|
799
|
+
const selectionRange = selection.getSelectedRange();
|
800
|
+
const lastSelection = selectionRange.pop();
|
801
|
+
selectionRange.clear().set(lastSelection.from).current().setTo(lastSelection.to);
|
695
802
|
selection.refresh();
|
696
803
|
} else {
|
697
804
|
selection.shiftColumns(groupIndex, -groupAmount);
|
@@ -1043,13 +1150,10 @@ function Core(rootElement, userSettings) {
|
|
1043
1150
|
}
|
1044
1151
|
this.updateSettings(userSettings, true);
|
1045
1152
|
this.view = new _tableView.default(this);
|
1046
|
-
const themeName = tableMeta.themeName || (0, _themes.getThemeClassName)(instance.
|
1153
|
+
const themeName = tableMeta.themeName || (0, _themes.getThemeClassName)(instance.rootContainer);
|
1047
1154
|
|
1048
|
-
// Use the theme defined as a root
|
1155
|
+
// Use the theme defined in the settings object or set as a root container class name (in that order).
|
1049
1156
|
instance.useTheme(themeName);
|
1050
|
-
|
1051
|
-
// Add the theme class name to the license info element.
|
1052
|
-
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
1053
1157
|
editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
|
1054
1158
|
viewportScroller = (0, _index.createViewportScroller)(instance);
|
1055
1159
|
focusManager = new _focusManager.FocusManager(instance);
|
@@ -1592,8 +1696,8 @@ function Core(rootElement, userSettings) {
|
|
1592
1696
|
* @returns {Array} Returns removed portion of columns.
|
1593
1697
|
*/
|
1594
1698
|
this.spliceCol = function (column, index, amount) {
|
1595
|
-
for (var
|
1596
|
-
elements[
|
1699
|
+
for (var _len14 = arguments.length, elements = new Array(_len14 > 3 ? _len14 - 3 : 0), _key14 = 3; _key14 < _len14; _key14++) {
|
1700
|
+
elements[_key14 - 3] = arguments[_key14];
|
1597
1701
|
}
|
1598
1702
|
return datamap.spliceCol(column, index, amount, ...elements);
|
1599
1703
|
};
|
@@ -1610,8 +1714,8 @@ function Core(rootElement, userSettings) {
|
|
1610
1714
|
* @returns {Array} Returns removed portion of rows.
|
1611
1715
|
*/
|
1612
1716
|
this.spliceRow = function (row, index, amount) {
|
1613
|
-
for (var
|
1614
|
-
elements[
|
1717
|
+
for (var _len15 = arguments.length, elements = new Array(_len15 > 3 ? _len15 - 3 : 0), _key15 = 3; _key15 < _len15; _key15++) {
|
1718
|
+
elements[_key15 - 3] = arguments[_key15];
|
1615
1719
|
}
|
1616
1720
|
return datamap.spliceRow(row, index, amount, ...elements);
|
1617
1721
|
};
|
@@ -2428,17 +2532,9 @@ function Core(rootElement, userSettings) {
|
|
2428
2532
|
instance.view._wt.exportSettingsAsClassNames();
|
2429
2533
|
const currentThemeName = instance.getCurrentThemeName();
|
2430
2534
|
const themeNameOptionExists = (0, _object.hasOwnProperty)(settings, 'themeName');
|
2431
|
-
if (
|
2432
|
-
instance.
|
2433
|
-
instance.view.removeClassNameFromLicenseElement(currentThemeName);
|
2535
|
+
if (themeNameOptionExists && currentThemeName !== settings.themeName) {
|
2536
|
+
instance.useTheme(settings.themeName);
|
2434
2537
|
}
|
2435
|
-
const themeName = themeNameOptionExists && settings.themeName || (0, _themes.getThemeClassName)(instance.rootElement);
|
2436
|
-
|
2437
|
-
// Use the theme defined as a root element class or in the settings (in that order).
|
2438
|
-
instance.useTheme(themeName);
|
2439
|
-
|
2440
|
-
// Add the theme class name to the license info element.
|
2441
|
-
instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
|
2442
2538
|
}
|
2443
2539
|
instance.runHooks('afterUpdateSettings', settings);
|
2444
2540
|
}
|
@@ -2880,8 +2976,8 @@ function Core(rootElement, userSettings) {
|
|
2880
2976
|
changeValue]);
|
2881
2977
|
});
|
2882
2978
|
}
|
2883
|
-
(0, _array.arrayEach)(input,
|
2884
|
-
let [changeRow, changeProp, changeValue] =
|
2979
|
+
(0, _array.arrayEach)(input, _ref0 => {
|
2980
|
+
let [changeRow, changeProp, changeValue] = _ref0;
|
2885
2981
|
dataSource.setAtCell(changeRow, changeProp, changeValue);
|
2886
2982
|
});
|
2887
2983
|
if (isThereAnySetSourceListener) {
|
@@ -3019,8 +3115,8 @@ function Core(rootElement, userSettings) {
|
|
3019
3115
|
*/
|
3020
3116
|
this.spliceCellsMeta = function (visualIndex) {
|
3021
3117
|
let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
3022
|
-
for (var
|
3023
|
-
cellMetaRows[
|
3118
|
+
for (var _len16 = arguments.length, cellMetaRows = new Array(_len16 > 2 ? _len16 - 2 : 0), _key16 = 2; _key16 < _len16; _key16++) {
|
3119
|
+
cellMetaRows[_key16 - 2] = arguments[_key16];
|
3024
3120
|
}
|
3025
3121
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
3026
3122
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
@@ -3578,7 +3674,7 @@ function Core(rootElement, userSettings) {
|
|
3578
3674
|
* @returns {number}
|
3579
3675
|
*/
|
3580
3676
|
this._getRowHeightFromSettings = function (row) {
|
3581
|
-
const defaultRowHeight =
|
3677
|
+
const defaultRowHeight = instance.stylesHandler.getDefaultRowHeight();
|
3582
3678
|
let height = tableMeta.rowHeights;
|
3583
3679
|
if (height !== undefined && height !== null) {
|
3584
3680
|
switch (typeof height) {
|
@@ -4233,27 +4329,27 @@ function Core(rootElement, userSettings) {
|
|
4233
4329
|
}
|
4234
4330
|
dataSource = null;
|
4235
4331
|
this.getShortcutManager().destroy();
|
4332
|
+
moduleRegisterer.clear();
|
4236
4333
|
metaManager.clearCache();
|
4237
4334
|
foreignHotInstances.delete(this.guid);
|
4238
|
-
if ((0, _rootInstance.isRootInstance)(instance)) {
|
4239
|
-
const licenseInfo = this.rootDocument.querySelector('.hot-display-license-info');
|
4240
|
-
if (licenseInfo) {
|
4241
|
-
licenseInfo.parentNode.removeChild(licenseInfo);
|
4242
|
-
}
|
4243
|
-
}
|
4244
|
-
(0, _element.empty)(instance.rootElement);
|
4245
4335
|
eventManager.destroy();
|
4246
4336
|
if (editorManager) {
|
4247
4337
|
editorManager.destroy();
|
4248
4338
|
}
|
4339
|
+
if (instance.rootContainer) {
|
4340
|
+
(0, _element.empty)(instance.rootContainer);
|
4341
|
+
}
|
4342
|
+
if (instance.rootPortalElement) {
|
4343
|
+
instance.rootPortalElement.remove();
|
4344
|
+
}
|
4249
4345
|
|
4250
4346
|
// The plugin's `destroy` method is called as a consequence and it should handle
|
4251
4347
|
// unregistration of plugin's maps. Some unregistered maps reset the cache.
|
4252
4348
|
instance.batchExecution(() => {
|
4253
4349
|
instance.rowIndexMapper.unregisterAll();
|
4254
4350
|
instance.columnIndexMapper.unregisterAll();
|
4255
|
-
pluginsRegistry.getItems().forEach(
|
4256
|
-
let [, plugin] =
|
4351
|
+
pluginsRegistry.getItems().forEach(_ref1 => {
|
4352
|
+
let [, plugin] = _ref1;
|
4257
4353
|
plugin.destroy();
|
4258
4354
|
});
|
4259
4355
|
pluginsRegistry.clear();
|
@@ -4654,8 +4750,32 @@ function Core(rootElement, userSettings) {
|
|
4654
4750
|
* @param {string|boolean|undefined} themeName The name of the theme to use.
|
4655
4751
|
*/
|
4656
4752
|
this.useTheme = themeName => {
|
4657
|
-
|
4658
|
-
this.
|
4753
|
+
const isFirstRun = !!firstRun;
|
4754
|
+
this.stylesHandler.useTheme(themeName);
|
4755
|
+
const validThemeName = this.stylesHandler.getThemeName();
|
4756
|
+
if ((0, _rootInstance.isRootInstance)(this)) {
|
4757
|
+
(0, _element.removeClass)(this.rootWrapperElement, /ht-theme-.*/g);
|
4758
|
+
(0, _element.removeClass)(this.rootPortalElement, /ht-theme-.*/g);
|
4759
|
+
if (validThemeName) {
|
4760
|
+
(0, _element.addClass)(this.rootWrapperElement, validThemeName);
|
4761
|
+
(0, _element.addClass)(this.rootPortalElement, validThemeName);
|
4762
|
+
if (!getComputedStyle(this.rootWrapperElement).getPropertyValue('--ht-line-height')) {
|
4763
|
+
(0, _console.warn)(`The "${validThemeName}" theme is enabled, but its stylesheets are missing or not imported correctly. \
|
4764
|
+
Import the correct CSS files in order to use that theme.`);
|
4765
|
+
}
|
4766
|
+
}
|
4767
|
+
}
|
4768
|
+
if (!isFirstRun) {
|
4769
|
+
instance.render();
|
4770
|
+
instance.scrollViewportTo(0, 0);
|
4771
|
+
if ((0, _themes.getThemeClassName)(this.rootContainer)) {
|
4772
|
+
(0, _element.removeClass)(this.rootContainer, /ht-theme-.*/g);
|
4773
|
+
if (validThemeName) {
|
4774
|
+
(0, _element.addClass)(this.rootContainer, validThemeName);
|
4775
|
+
}
|
4776
|
+
}
|
4777
|
+
}
|
4778
|
+
this.runHooks('afterSetTheme', validThemeName, isFirstRun);
|
4659
4779
|
};
|
4660
4780
|
|
4661
4781
|
/**
|
@@ -4667,7 +4787,31 @@ function Core(rootElement, userSettings) {
|
|
4667
4787
|
* @returns {string|undefined} The name of the currently used theme.
|
4668
4788
|
*/
|
4669
4789
|
this.getCurrentThemeName = () => {
|
4670
|
-
return this.
|
4790
|
+
return this.stylesHandler.getThemeName();
|
4791
|
+
};
|
4792
|
+
|
4793
|
+
/**
|
4794
|
+
* Gets the table's root container element height.
|
4795
|
+
*
|
4796
|
+
* @memberof Core#
|
4797
|
+
* @function getTableHeight
|
4798
|
+
* @since 16.0.0
|
4799
|
+
* @returns {number}
|
4800
|
+
*/
|
4801
|
+
this.getTableHeight = () => {
|
4802
|
+
return this.rootElement.offsetHeight;
|
4803
|
+
};
|
4804
|
+
|
4805
|
+
/**
|
4806
|
+
* Gets the table's root container element width.
|
4807
|
+
*
|
4808
|
+
* @memberof Core#
|
4809
|
+
* @function getTableWidth
|
4810
|
+
* @since 16.0.0
|
4811
|
+
* @returns {number}
|
4812
|
+
*/
|
4813
|
+
this.getTableWidth = () => {
|
4814
|
+
return this.rootElement.offsetWidth;
|
4671
4815
|
};
|
4672
4816
|
|
4673
4817
|
/**
|