handsontable 15.3.0 → 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 +53 -31
- 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
@@ -110,6 +110,67 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 330;
|
|
110
110
|
* hot.render();
|
111
111
|
* ```
|
112
112
|
* :::
|
113
|
+
*
|
114
|
+
* ::: only-for angular
|
115
|
+
* ```ts
|
116
|
+
* import { AfterViewInit, Component, ViewChild } from "@angular/core";
|
117
|
+
* import {
|
118
|
+
* GridSettings,
|
119
|
+
* HotTableModule,
|
120
|
+
* HotTableComponent,
|
121
|
+
* } from "@handsontable/angular-wrapper";
|
122
|
+
*
|
123
|
+
* `@Component`({
|
124
|
+
* selector: "app-example",
|
125
|
+
* standalone: true,
|
126
|
+
* imports: [HotTableModule],
|
127
|
+
* template: ` <div>
|
128
|
+
* <hot-table themeName="ht-theme-main" [settings]="gridSettings" />
|
129
|
+
* </div>`,
|
130
|
+
* })
|
131
|
+
* export class ExampleComponent implements AfterViewInit {
|
132
|
+
* `@ViewChild`(HotTableComponent, { static: false })
|
133
|
+
* readonly hotTable!: HotTableComponent;
|
134
|
+
*
|
135
|
+
* readonly gridSettings = <GridSettings>{
|
136
|
+
* data: this.getData(),
|
137
|
+
* // Hide selected rows on table initialization
|
138
|
+
* trimRows: [1, 2, 5],
|
139
|
+
* };
|
140
|
+
*
|
141
|
+
* ngAfterViewInit(): void {
|
142
|
+
* // Access the trimRows plugin instance
|
143
|
+
* const hot = this.hotTable.hotInstance;
|
144
|
+
* const trimRowsPlugin = hot.getPlugin("trimRows");
|
145
|
+
*
|
146
|
+
* // Hide a single row
|
147
|
+
* trimRowsPlugin.trimRow(1);
|
148
|
+
*
|
149
|
+
* // Hide multiple rows
|
150
|
+
* trimRowsPlugin.trimRow(1, 2, 9);
|
151
|
+
*
|
152
|
+
* // Or as an array
|
153
|
+
* trimRowsPlugin.trimRows([1, 2, 9]);
|
154
|
+
*
|
155
|
+
* // Show a single row
|
156
|
+
* trimRowsPlugin.untrimRow(1);
|
157
|
+
*
|
158
|
+
* // Show multiple rows
|
159
|
+
* trimRowsPlugin.untrimRow(1, 2, 9);
|
160
|
+
*
|
161
|
+
* // Or as an array
|
162
|
+
* trimRowsPlugin.untrimRows([1, 2, 9]);
|
163
|
+
*
|
164
|
+
* // Re-render table to see the changes
|
165
|
+
* hot.render();
|
166
|
+
* }
|
167
|
+
*
|
168
|
+
* private getData(): any[] {
|
169
|
+
* // Get some data
|
170
|
+
* }
|
171
|
+
* }
|
172
|
+
* ```
|
173
|
+
* :::
|
113
174
|
*/
|
114
175
|
var _TrimRows_brand = /*#__PURE__*/new WeakSet();
|
115
176
|
class TrimRows extends _base.BasePlugin {
|
@@ -107,6 +107,67 @@ export const PLUGIN_PRIORITY = 330;
|
|
107
107
|
* hot.render();
|
108
108
|
* ```
|
109
109
|
* :::
|
110
|
+
*
|
111
|
+
* ::: only-for angular
|
112
|
+
* ```ts
|
113
|
+
* import { AfterViewInit, Component, ViewChild } from "@angular/core";
|
114
|
+
* import {
|
115
|
+
* GridSettings,
|
116
|
+
* HotTableModule,
|
117
|
+
* HotTableComponent,
|
118
|
+
* } from "@handsontable/angular-wrapper";
|
119
|
+
*
|
120
|
+
* `@Component`({
|
121
|
+
* selector: "app-example",
|
122
|
+
* standalone: true,
|
123
|
+
* imports: [HotTableModule],
|
124
|
+
* template: ` <div>
|
125
|
+
* <hot-table themeName="ht-theme-main" [settings]="gridSettings" />
|
126
|
+
* </div>`,
|
127
|
+
* })
|
128
|
+
* export class ExampleComponent implements AfterViewInit {
|
129
|
+
* `@ViewChild`(HotTableComponent, { static: false })
|
130
|
+
* readonly hotTable!: HotTableComponent;
|
131
|
+
*
|
132
|
+
* readonly gridSettings = <GridSettings>{
|
133
|
+
* data: this.getData(),
|
134
|
+
* // Hide selected rows on table initialization
|
135
|
+
* trimRows: [1, 2, 5],
|
136
|
+
* };
|
137
|
+
*
|
138
|
+
* ngAfterViewInit(): void {
|
139
|
+
* // Access the trimRows plugin instance
|
140
|
+
* const hot = this.hotTable.hotInstance;
|
141
|
+
* const trimRowsPlugin = hot.getPlugin("trimRows");
|
142
|
+
*
|
143
|
+
* // Hide a single row
|
144
|
+
* trimRowsPlugin.trimRow(1);
|
145
|
+
*
|
146
|
+
* // Hide multiple rows
|
147
|
+
* trimRowsPlugin.trimRow(1, 2, 9);
|
148
|
+
*
|
149
|
+
* // Or as an array
|
150
|
+
* trimRowsPlugin.trimRows([1, 2, 9]);
|
151
|
+
*
|
152
|
+
* // Show a single row
|
153
|
+
* trimRowsPlugin.untrimRow(1);
|
154
|
+
*
|
155
|
+
* // Show multiple rows
|
156
|
+
* trimRowsPlugin.untrimRow(1, 2, 9);
|
157
|
+
*
|
158
|
+
* // Or as an array
|
159
|
+
* trimRowsPlugin.untrimRows([1, 2, 9]);
|
160
|
+
*
|
161
|
+
* // Re-render table to see the changes
|
162
|
+
* hot.render();
|
163
|
+
* }
|
164
|
+
*
|
165
|
+
* private getData(): any[] {
|
166
|
+
* // Get some data
|
167
|
+
* }
|
168
|
+
* }
|
169
|
+
* ```
|
170
|
+
* :::
|
110
171
|
*/
|
111
172
|
var _TrimRows_brand = /*#__PURE__*/new WeakSet();
|
112
173
|
export class TrimRows extends BasePlugin {
|
@@ -10,6 +10,7 @@ var _a11y = require("../../helpers/a11y");
|
|
10
10
|
*/
|
11
11
|
|
12
12
|
const RENDERER_TYPE = exports.RENDERER_TYPE = 'base';
|
13
|
+
const TEXT_ELLIPSIS_CLASS_NAME = 'htTextEllipsis';
|
13
14
|
|
14
15
|
/**
|
15
16
|
* @param {Core} hotInstance The Handsontable instance.
|
@@ -54,6 +55,9 @@ function baseRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
|
|
54
55
|
if (!value && cellProperties.placeholder) {
|
55
56
|
classesToAdd.push(cellProperties.placeholderCellClassName);
|
56
57
|
}
|
58
|
+
if (cellProperties.textEllipsis) {
|
59
|
+
classesToAdd.push(TEXT_ELLIPSIS_CLASS_NAME);
|
60
|
+
}
|
57
61
|
(0, _element.removeClass)(TD, classesToRemove);
|
58
62
|
(0, _element.addClass)(TD, classesToAdd);
|
59
63
|
(0, _element.removeAttribute)(TD, attributesToRemove);
|
@@ -5,6 +5,7 @@ import "core-js/modules/es.array.push.js";
|
|
5
5
|
import { addClass, removeAttribute, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
|
6
6
|
import { A11Y_INVALID, A11Y_READONLY } from "../../helpers/a11y.mjs";
|
7
7
|
export const RENDERER_TYPE = 'base';
|
8
|
+
const TEXT_ELLIPSIS_CLASS_NAME = 'htTextEllipsis';
|
8
9
|
|
9
10
|
/**
|
10
11
|
* @param {Core} hotInstance The Handsontable instance.
|
@@ -49,6 +50,9 @@ export function baseRenderer(hotInstance, TD, row, col, prop, value, cellPropert
|
|
49
50
|
if (!value && cellProperties.placeholder) {
|
50
51
|
classesToAdd.push(cellProperties.placeholderCellClassName);
|
51
52
|
}
|
53
|
+
if (cellProperties.textEllipsis) {
|
54
|
+
classesToAdd.push(TEXT_ELLIPSIS_CLASS_NAME);
|
55
|
+
}
|
52
56
|
removeClass(TD, classesToRemove);
|
53
57
|
addClass(TD, classesToAdd);
|
54
58
|
removeAttribute(TD, attributesToRemove);
|
package/renderers/registry.js
CHANGED
@@ -4,15 +4,14 @@ exports.__esModule = true;
|
|
4
4
|
exports.getRenderer = _getItem;
|
5
5
|
exports.registerRenderer = _register;
|
6
6
|
require("core-js/modules/es.error.cause.js");
|
7
|
-
var _staticRegister =
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
7
|
+
var _staticRegister = require("../utils/staticRegister");
|
9
8
|
const {
|
10
9
|
register,
|
11
10
|
getItem,
|
12
11
|
hasItem,
|
13
12
|
getNames,
|
14
13
|
getValues
|
15
|
-
} = (0, _staticRegister.
|
14
|
+
} = (0, _staticRegister.staticRegister)('renderers');
|
16
15
|
|
17
16
|
/**
|
18
17
|
* Retrieve renderer function.
|
package/renderers/registry.mjs
CHANGED
@@ -4,6 +4,9 @@ exports.__esModule = true;
|
|
4
4
|
exports.handleMouseEvent = handleMouseEvent;
|
5
5
|
exports.mouseDown = mouseDown;
|
6
6
|
exports.mouseOver = mouseOver;
|
7
|
+
exports.mouseUp = mouseUp;
|
8
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
9
|
+
require("core-js/modules/esnext.iterator.map.js");
|
7
10
|
var _event = require("./../helpers/dom/event");
|
8
11
|
/**
|
9
12
|
* MouseDown handler.
|
@@ -114,7 +117,48 @@ function mouseOver(_ref2) {
|
|
114
117
|
}
|
115
118
|
selection.markEndSource();
|
116
119
|
}
|
117
|
-
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Mouse up handler.
|
123
|
+
*
|
124
|
+
* @param {object} options The handler options.
|
125
|
+
* @param {boolean} options.isLeftClick Indicates that event was fired using the left mouse button.
|
126
|
+
* @param {Selection} options.selection The Selection class instance.
|
127
|
+
* @param {CellRangeToRenderableMapper} options.cellRangeMapper Mapper for converting cell ranges
|
128
|
+
* to renderable indexes.
|
129
|
+
*/
|
130
|
+
function mouseUp(_ref3) {
|
131
|
+
let {
|
132
|
+
isLeftClick,
|
133
|
+
selection,
|
134
|
+
cellRangeMapper
|
135
|
+
} = _ref3;
|
136
|
+
if (!isLeftClick || selection.settings.selectionMode !== 'multiple') {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
const selectionRange = selection.getSelectedRange();
|
140
|
+
const renderableRange = selectionRange.clone().map(range => cellRangeMapper.toRenderable(range));
|
141
|
+
const lastRenderableRange = renderableRange.current();
|
142
|
+
if (renderableRange.size() > 1 && !lastRenderableRange.isHeader() && !selection.isMultiple(lastRenderableRange)) {
|
143
|
+
const ranges = renderableRange.findAll(lastRenderableRange);
|
144
|
+
|
145
|
+
// if the last selection range is the same as the first one (case when the single cell
|
146
|
+
// is selected twice or more) remove duplicate ranges
|
147
|
+
if (ranges.length === renderableRange.size()) {
|
148
|
+
selectionRange.pop();
|
149
|
+
selection.refresh();
|
150
|
+
} else if (ranges.length > 1) {
|
151
|
+
selectionRange.removeLayers(ranges.map(_ref4 => {
|
152
|
+
let {
|
153
|
+
layer
|
154
|
+
} = _ref4;
|
155
|
+
return layer;
|
156
|
+
}));
|
157
|
+
selection.refresh();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
const handlers = new Map([['touchstart', mouseDown], ['mousedown', mouseDown], ['mouseover', mouseOver], ['mouseup', mouseUp]]);
|
118
162
|
|
119
163
|
/**
|
120
164
|
* Mouse handler for selection functionality.
|
@@ -127,20 +171,11 @@ const handlers = new Map([['mousedown', mouseDown], ['mouseover', mouseOver], ['
|
|
127
171
|
* operation will be performed in later selection stages.
|
128
172
|
* @param {Function} options.cellCoordsFactory The function factory for CellCoords objects.
|
129
173
|
*/
|
130
|
-
function handleMouseEvent(event,
|
131
|
-
let {
|
132
|
-
coords,
|
133
|
-
selection,
|
134
|
-
controller,
|
135
|
-
cellCoordsFactory
|
136
|
-
} = _ref3;
|
174
|
+
function handleMouseEvent(event, options) {
|
137
175
|
handlers.get(event.type)({
|
138
|
-
coords,
|
139
|
-
selection,
|
140
|
-
controller,
|
141
|
-
cellCoordsFactory,
|
142
176
|
isShiftKey: event.shiftKey,
|
143
177
|
isLeftClick: (0, _event.isLeftClick)(event) || event.type === 'touchstart',
|
144
|
-
isRightClick: (0, _event.isRightClick)(event)
|
178
|
+
isRightClick: (0, _event.isRightClick)(event),
|
179
|
+
...options
|
145
180
|
});
|
146
181
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
2
|
+
import "core-js/modules/esnext.iterator.map.js";
|
1
3
|
import { isRightClick as isRightClickEvent, isLeftClick as isLeftClickEvent } from "./../helpers/dom/event.mjs";
|
2
4
|
/**
|
3
5
|
* MouseDown handler.
|
@@ -108,7 +110,48 @@ export function mouseOver(_ref2) {
|
|
108
110
|
}
|
109
111
|
selection.markEndSource();
|
110
112
|
}
|
111
|
-
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Mouse up handler.
|
116
|
+
*
|
117
|
+
* @param {object} options The handler options.
|
118
|
+
* @param {boolean} options.isLeftClick Indicates that event was fired using the left mouse button.
|
119
|
+
* @param {Selection} options.selection The Selection class instance.
|
120
|
+
* @param {CellRangeToRenderableMapper} options.cellRangeMapper Mapper for converting cell ranges
|
121
|
+
* to renderable indexes.
|
122
|
+
*/
|
123
|
+
export function mouseUp(_ref3) {
|
124
|
+
let {
|
125
|
+
isLeftClick,
|
126
|
+
selection,
|
127
|
+
cellRangeMapper
|
128
|
+
} = _ref3;
|
129
|
+
if (!isLeftClick || selection.settings.selectionMode !== 'multiple') {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
const selectionRange = selection.getSelectedRange();
|
133
|
+
const renderableRange = selectionRange.clone().map(range => cellRangeMapper.toRenderable(range));
|
134
|
+
const lastRenderableRange = renderableRange.current();
|
135
|
+
if (renderableRange.size() > 1 && !lastRenderableRange.isHeader() && !selection.isMultiple(lastRenderableRange)) {
|
136
|
+
const ranges = renderableRange.findAll(lastRenderableRange);
|
137
|
+
|
138
|
+
// if the last selection range is the same as the first one (case when the single cell
|
139
|
+
// is selected twice or more) remove duplicate ranges
|
140
|
+
if (ranges.length === renderableRange.size()) {
|
141
|
+
selectionRange.pop();
|
142
|
+
selection.refresh();
|
143
|
+
} else if (ranges.length > 1) {
|
144
|
+
selectionRange.removeLayers(ranges.map(_ref4 => {
|
145
|
+
let {
|
146
|
+
layer
|
147
|
+
} = _ref4;
|
148
|
+
return layer;
|
149
|
+
}));
|
150
|
+
selection.refresh();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
const handlers = new Map([['touchstart', mouseDown], ['mousedown', mouseDown], ['mouseover', mouseOver], ['mouseup', mouseUp]]);
|
112
155
|
|
113
156
|
/**
|
114
157
|
* Mouse handler for selection functionality.
|
@@ -121,20 +164,11 @@ const handlers = new Map([['mousedown', mouseDown], ['mouseover', mouseOver], ['
|
|
121
164
|
* operation will be performed in later selection stages.
|
122
165
|
* @param {Function} options.cellCoordsFactory The function factory for CellCoords objects.
|
123
166
|
*/
|
124
|
-
export function handleMouseEvent(event,
|
125
|
-
let {
|
126
|
-
coords,
|
127
|
-
selection,
|
128
|
-
controller,
|
129
|
-
cellCoordsFactory
|
130
|
-
} = _ref3;
|
167
|
+
export function handleMouseEvent(event, options) {
|
131
168
|
handlers.get(event.type)({
|
132
|
-
coords,
|
133
|
-
selection,
|
134
|
-
controller,
|
135
|
-
cellCoordsFactory,
|
136
169
|
isShiftKey: event.shiftKey,
|
137
170
|
isLeftClick: isLeftClickEvent(event) || event.type === 'touchstart',
|
138
|
-
isRightClick: isRightClickEvent(event)
|
171
|
+
isRightClick: isRightClickEvent(event),
|
172
|
+
...options
|
139
173
|
});
|
140
174
|
}
|
package/selection/range.js
CHANGED
@@ -4,6 +4,9 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
6
|
require("core-js/modules/esnext.iterator.constructor.js");
|
7
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
8
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
9
|
+
require("core-js/modules/esnext.iterator.map.js");
|
7
10
|
require("core-js/modules/esnext.iterator.some.js");
|
8
11
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
9
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
@@ -66,11 +69,10 @@ class SelectionRange {
|
|
66
69
|
/**
|
67
70
|
* Removes from the stack the last added coordinates.
|
68
71
|
*
|
69
|
-
* @returns {
|
72
|
+
* @returns {CellRange}
|
70
73
|
*/
|
71
74
|
pop() {
|
72
|
-
this.ranges.pop();
|
73
|
-
return this;
|
75
|
+
return this.ranges.pop();
|
74
76
|
}
|
75
77
|
|
76
78
|
/**
|
@@ -92,14 +94,57 @@ class SelectionRange {
|
|
92
94
|
}
|
93
95
|
|
94
96
|
/**
|
95
|
-
* Returns `true` if coords is within selection coords. This method iterates through
|
96
|
-
* the coords object is within selection range.
|
97
|
+
* Returns `true` if coords is within any selection coords. This method iterates through
|
98
|
+
* all selection layers to check if the coords object is within selection range.
|
97
99
|
*
|
98
100
|
* @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
|
101
|
+
* @param {function(CellRange, number): boolean} [criteria] The function that allows injecting custom criteria.
|
99
102
|
* @returns {boolean}
|
100
103
|
*/
|
101
104
|
includes(coords) {
|
102
|
-
|
105
|
+
let criteria = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => true;
|
106
|
+
return this.ranges.some((cellRange, index) => cellRange.includes(coords) && criteria(cellRange, index));
|
107
|
+
}
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Find all ranges that are equal to the provided range.
|
111
|
+
*
|
112
|
+
* @param {CellRange} cellRange The CellRange instance with defined visual coordinates.
|
113
|
+
* @returns {Array<{range: CellRange, layer: number}>}
|
114
|
+
*/
|
115
|
+
findAll(cellRange) {
|
116
|
+
const result = [];
|
117
|
+
this.ranges.forEach((range, layer) => {
|
118
|
+
if (range.isEqual(cellRange)) {
|
119
|
+
result.push({
|
120
|
+
range,
|
121
|
+
layer
|
122
|
+
});
|
123
|
+
}
|
124
|
+
});
|
125
|
+
return result;
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Removes all ranges that are equal to the provided ranges.
|
130
|
+
*
|
131
|
+
* @param {CellRange[]} cellRanges The array of CellRange instances with defined visual coordinates.
|
132
|
+
* @returns {SelectionRange}
|
133
|
+
*/
|
134
|
+
remove(cellRanges) {
|
135
|
+
this.ranges = this.ranges.filter(range => !cellRanges.some(cellRange => cellRange.isEqual(range)));
|
136
|
+
return this;
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Removes the ranges based on the provided index layers (0 no N).
|
141
|
+
*
|
142
|
+
* @param {number[]} layerIndexes The array of indexes that will be removed from the selection.
|
143
|
+
* @returns {SelectionRange}
|
144
|
+
*/
|
145
|
+
removeLayers(layerIndexes) {
|
146
|
+
this.ranges = this.ranges.filter((_, index) => !layerIndexes.includes(index));
|
147
|
+
return this;
|
103
148
|
}
|
104
149
|
|
105
150
|
/**
|
@@ -121,6 +166,28 @@ class SelectionRange {
|
|
121
166
|
return this.ranges.length;
|
122
167
|
}
|
123
168
|
|
169
|
+
/**
|
170
|
+
* Creates a clone of this class.
|
171
|
+
*
|
172
|
+
* @returns {SelectionRange}
|
173
|
+
*/
|
174
|
+
clone() {
|
175
|
+
const clone = new SelectionRange(this.createCellRange);
|
176
|
+
clone.ranges = this.ranges.map(cellRange => cellRange.clone());
|
177
|
+
return clone;
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Allows applying custom index translations for any range within the class instance.
|
182
|
+
*
|
183
|
+
* @param {function(CellRange): CellRange} mapFunction The function that allows injecting custom index translation logic.
|
184
|
+
* @returns {SelectionRange}
|
185
|
+
*/
|
186
|
+
map(mapFunction) {
|
187
|
+
this.ranges = this.ranges.map((cellRange, index) => mapFunction(cellRange, index));
|
188
|
+
return this;
|
189
|
+
}
|
190
|
+
|
124
191
|
/**
|
125
192
|
* Peek the coordinates based on the index where that coordinate resides in the collection.
|
126
193
|
*
|
package/selection/range.mjs
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
3
|
import "core-js/modules/esnext.iterator.constructor.js";
|
4
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
5
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
6
|
+
import "core-js/modules/esnext.iterator.map.js";
|
4
7
|
import "core-js/modules/esnext.iterator.some.js";
|
5
8
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
6
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
@@ -63,11 +66,10 @@ class SelectionRange {
|
|
63
66
|
/**
|
64
67
|
* Removes from the stack the last added coordinates.
|
65
68
|
*
|
66
|
-
* @returns {
|
69
|
+
* @returns {CellRange}
|
67
70
|
*/
|
68
71
|
pop() {
|
69
|
-
this.ranges.pop();
|
70
|
-
return this;
|
72
|
+
return this.ranges.pop();
|
71
73
|
}
|
72
74
|
|
73
75
|
/**
|
@@ -89,14 +91,57 @@ class SelectionRange {
|
|
89
91
|
}
|
90
92
|
|
91
93
|
/**
|
92
|
-
* Returns `true` if coords is within selection coords. This method iterates through
|
93
|
-
* the coords object is within selection range.
|
94
|
+
* Returns `true` if coords is within any selection coords. This method iterates through
|
95
|
+
* all selection layers to check if the coords object is within selection range.
|
94
96
|
*
|
95
97
|
* @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
|
98
|
+
* @param {function(CellRange, number): boolean} [criteria] The function that allows injecting custom criteria.
|
96
99
|
* @returns {boolean}
|
97
100
|
*/
|
98
101
|
includes(coords) {
|
99
|
-
|
102
|
+
let criteria = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => true;
|
103
|
+
return this.ranges.some((cellRange, index) => cellRange.includes(coords) && criteria(cellRange, index));
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Find all ranges that are equal to the provided range.
|
108
|
+
*
|
109
|
+
* @param {CellRange} cellRange The CellRange instance with defined visual coordinates.
|
110
|
+
* @returns {Array<{range: CellRange, layer: number}>}
|
111
|
+
*/
|
112
|
+
findAll(cellRange) {
|
113
|
+
const result = [];
|
114
|
+
this.ranges.forEach((range, layer) => {
|
115
|
+
if (range.isEqual(cellRange)) {
|
116
|
+
result.push({
|
117
|
+
range,
|
118
|
+
layer
|
119
|
+
});
|
120
|
+
}
|
121
|
+
});
|
122
|
+
return result;
|
123
|
+
}
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Removes all ranges that are equal to the provided ranges.
|
127
|
+
*
|
128
|
+
* @param {CellRange[]} cellRanges The array of CellRange instances with defined visual coordinates.
|
129
|
+
* @returns {SelectionRange}
|
130
|
+
*/
|
131
|
+
remove(cellRanges) {
|
132
|
+
this.ranges = this.ranges.filter(range => !cellRanges.some(cellRange => cellRange.isEqual(range)));
|
133
|
+
return this;
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Removes the ranges based on the provided index layers (0 no N).
|
138
|
+
*
|
139
|
+
* @param {number[]} layerIndexes The array of indexes that will be removed from the selection.
|
140
|
+
* @returns {SelectionRange}
|
141
|
+
*/
|
142
|
+
removeLayers(layerIndexes) {
|
143
|
+
this.ranges = this.ranges.filter((_, index) => !layerIndexes.includes(index));
|
144
|
+
return this;
|
100
145
|
}
|
101
146
|
|
102
147
|
/**
|
@@ -118,6 +163,28 @@ class SelectionRange {
|
|
118
163
|
return this.ranges.length;
|
119
164
|
}
|
120
165
|
|
166
|
+
/**
|
167
|
+
* Creates a clone of this class.
|
168
|
+
*
|
169
|
+
* @returns {SelectionRange}
|
170
|
+
*/
|
171
|
+
clone() {
|
172
|
+
const clone = new SelectionRange(this.createCellRange);
|
173
|
+
clone.ranges = this.ranges.map(cellRange => cellRange.clone());
|
174
|
+
return clone;
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Allows applying custom index translations for any range within the class instance.
|
179
|
+
*
|
180
|
+
* @param {function(CellRange): CellRange} mapFunction The function that allows injecting custom index translation logic.
|
181
|
+
* @returns {SelectionRange}
|
182
|
+
*/
|
183
|
+
map(mapFunction) {
|
184
|
+
this.ranges = this.ranges.map((cellRange, index) => mapFunction(cellRange, index));
|
185
|
+
return this;
|
186
|
+
}
|
187
|
+
|
121
188
|
/**
|
122
189
|
* Peek the coordinates based on the index where that coordinate resides in the collection.
|
123
190
|
*
|