handsontable 0.0.0-next-eaf150e-20240823 → 0.0.0-next-0306a1a-20240826
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/constants.js +26 -0
- package/3rdparty/walkontable/src/calculator/constants.mjs +23 -0
- package/3rdparty/walkontable/src/calculator/index.js +17 -18
- package/3rdparty/walkontable/src/calculator/index.mjs +6 -11
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.js → renderAllColumns.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.mjs → renderAllColumns.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.mjs → renderAllRows.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +145 -51
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +145 -51
- package/3rdparty/walkontable/src/calculator/viewportRows.js +141 -59
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +141 -59
- package/3rdparty/walkontable/src/index.js +0 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +11 -5
- package/3rdparty/walkontable/src/table.mjs +11 -5
- package/3rdparty/walkontable/src/utils/column.js +1 -2
- package/3rdparty/walkontable/src/utils/column.mjs +1 -2
- package/3rdparty/walkontable/src/utils/columnStretching.js +19 -10
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +19 -10
- package/3rdparty/walkontable/src/viewport.js +46 -35
- package/3rdparty/walkontable/src/viewport.mjs +47 -36
- package/CHANGELOG.md +0 -27
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -1
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +6 -5
- package/dataMap/metaManager/metaSchema.mjs +6 -5
- package/dist/handsontable.css +20 -32
- package/dist/handsontable.full.css +20 -32
- package/dist/handsontable.full.js +2091 -2741
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2092 -2742
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +32 -32
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
- package/helpers/a11y.js +0 -2
- package/helpers/a11y.mjs +0 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +1 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/autoRowSize/autoRowSize.js +2 -1
- package/plugins/autoRowSize/autoRowSize.mjs +2 -1
- package/plugins/columnSorting/columnSorting.js +1 -10
- package/plugins/columnSorting/columnSorting.mjs +1 -10
- package/plugins/contextMenu/menu/menuItemRenderer.js +4 -3
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +6 -5
- package/plugins/contextMenu/menu/positioner.js +12 -4
- package/plugins/contextMenu/menu/positioner.mjs +12 -4
- package/plugins/contextMenu/menu/utils.js +0 -11
- package/plugins/contextMenu/menu/utils.mjs +0 -10
- package/plugins/contextMenu/predefinedItems/alignment.js +49 -67
- package/plugins/contextMenu/predefinedItems/alignment.mjs +50 -68
- package/plugins/contextMenu/predefinedItems/readOnly.js +0 -11
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -11
- package/plugins/contextMenu/utils.js +0 -26
- package/plugins/contextMenu/utils.mjs +0 -24
- package/plugins/copyPaste/copyPaste.js +14 -14
- package/plugins/copyPaste/copyPaste.mjs +14 -14
- package/plugins/dropdownMenu/dropdownMenu.js +4 -10
- package/plugins/dropdownMenu/dropdownMenu.mjs +4 -10
- package/plugins/filters/component/condition.js +1 -6
- package/plugins/filters/component/condition.mjs +1 -6
- package/plugins/filters/component/value.js +1 -6
- package/plugins/filters/component/value.mjs +1 -6
- package/plugins/filters/conditionCollection.d.ts +3 -4
- package/plugins/filters/conditionCollection.js +0 -26
- package/plugins/filters/conditionCollection.mjs +0 -26
- package/plugins/filters/filters.js +1 -2
- package/plugins/filters/filters.mjs +1 -2
- package/plugins/filters/ui/multipleSelect.js +9 -7
- package/plugins/filters/ui/multipleSelect.mjs +9 -7
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +9 -11
- package/plugins/mergeCells/cellsCollection.mjs +10 -12
- package/plugins/undoRedo/undoRedo.js +5 -9
- package/plugins/undoRedo/undoRedo.mjs +5 -9
- package/shortcuts/utils.js +1 -3
- package/shortcuts/utils.mjs +1 -3
- package/utils/ghostTable.js +9 -11
- package/utils/ghostTable.mjs +10 -12
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +0 -126
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +0 -122
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +0 -119
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +0 -115
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +0 -125
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +0 -121
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +0 -118
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +0 -114
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/viewportBase.js +0 -92
- package/3rdparty/walkontable/src/calculator/viewportBase.mjs +0 -88
@@ -17,7 +17,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
17
17
|
limitDropdownIfNeeded(spaceAvailable: number, dropdownHeight: number): void;
|
18
18
|
flipDropdown(dropdownHeight: number): void;
|
19
19
|
unflipDropdown(): void;
|
20
|
-
|
20
|
+
updateDropdownHeight(): void;
|
21
21
|
setDropdownHeight(height: number): void;
|
22
22
|
highlightBestMatchingChoice(index?: number): void;
|
23
23
|
getDropdownHeight(): number;
|
package/helpers/a11y.js
CHANGED
@@ -21,8 +21,6 @@ const A11Y_MENU = () => ['role', 'menu'];
|
|
21
21
|
exports.A11Y_MENU = A11Y_MENU;
|
22
22
|
const A11Y_MENU_ITEM = () => ['role', 'menuitem'];
|
23
23
|
exports.A11Y_MENU_ITEM = A11Y_MENU_ITEM;
|
24
|
-
const A11Y_MENU_ITEM_CHECKBOX = () => ['role', 'menuitemcheckbox'];
|
25
|
-
exports.A11Y_MENU_ITEM_CHECKBOX = A11Y_MENU_ITEM_CHECKBOX;
|
26
24
|
const A11Y_COMBOBOX = () => ['role', 'combobox'];
|
27
25
|
exports.A11Y_COMBOBOX = A11Y_COMBOBOX;
|
28
26
|
const A11Y_LISTBOX = () => ['role', 'listbox'];
|
package/helpers/a11y.mjs
CHANGED
@@ -8,7 +8,6 @@ export const A11Y_COLUMNHEADER = () => ['role', 'columnheader'];
|
|
8
8
|
export const A11Y_ROW = () => ['role', 'row'];
|
9
9
|
export const A11Y_MENU = () => ['role', 'menu'];
|
10
10
|
export const A11Y_MENU_ITEM = () => ['role', 'menuitem'];
|
11
|
-
export const A11Y_MENU_ITEM_CHECKBOX = () => ['role', 'menuitemcheckbox'];
|
12
11
|
export const A11Y_COMBOBOX = () => ['role', 'combobox'];
|
13
12
|
export const A11Y_LISTBOX = () => ['role', 'listbox'];
|
14
13
|
export const A11Y_OPTION = () => ['role', 'option'];
|
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-0306a1a-20240826";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
@@ -142,7 +142,7 @@ function _injectProductInfo(key, element) {
|
|
142
142
|
const schemaValidity = _checkKeySchema(key);
|
143
143
|
if (hasValidType || isNonCommercial || schemaValidity) {
|
144
144
|
if (schemaValidity) {
|
145
|
-
const releaseDate = (0, _moment.default)("
|
145
|
+
const releaseDate = (0, _moment.default)("11/06/2024", 'DD/MM/YYYY');
|
146
146
|
const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
|
147
147
|
const keyValidityDays = _extractTime(key);
|
148
148
|
keyValidityDate = (0, _moment.default)((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-0306a1a-20240826";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
@@ -132,7 +132,7 @@ export function _injectProductInfo(key, element) {
|
|
132
132
|
const schemaValidity = _checkKeySchema(key);
|
133
133
|
if (hasValidType || isNonCommercial || schemaValidity) {
|
134
134
|
if (schemaValidity) {
|
135
|
-
const releaseDate = moment("
|
135
|
+
const releaseDate = moment("11/06/2024", 'DD/MM/YYYY');
|
136
136
|
const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
|
137
137
|
const keyValidityDays = _extractTime(key);
|
138
138
|
keyValidityDate = moment((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-0306a1a-20240826",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
package/pluginHooks.d.ts
CHANGED
@@ -180,7 +180,7 @@ export interface Events {
|
|
180
180
|
beforeDrawBorders?: (corners: number[], borderClassName: 'current' | 'area' | 'highlight' | undefined) => void;
|
181
181
|
beforeDropdownMenuSetItems?: (menuItems: ContextMenuMenuItemConfig[]) => void;
|
182
182
|
beforeDropdownMenuShow?: (instance: DropdownMenu) => void;
|
183
|
-
beforeFilter?: (conditionsStack: FiltersColumnConditions[]
|
183
|
+
beforeFilter?: (conditionsStack: FiltersColumnConditions[]) => void | boolean;
|
184
184
|
beforeGetCellMeta?: (row: number, column: number, cellProperties: CellProperties) => void;
|
185
185
|
beforeHideColumns?: (currentHideConfig: number[], destinationHideConfig: number[], actionPossible: boolean) => void | boolean;
|
186
186
|
beforeHideRows?: (currentHideConfig: number[], destinationHideConfig: number[], actionPossible: boolean) => void | boolean;
|
package/pluginHooks.js
CHANGED
@@ -609,6 +609,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
|
|
609
609
|
* @param {object} preventScrolling A reference to the observable object with the `value` property.
|
610
610
|
* Property `preventScrolling.value` expects a boolean value that
|
611
611
|
* Handsontable uses to control scroll behavior after selection.
|
612
|
+
* @param {object} preventScrolling Object with `value` property where its value change will be observed.
|
612
613
|
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
|
613
614
|
* @example
|
614
615
|
* ::: only-for javascript
|
@@ -2004,7 +2005,6 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
|
|
2004
2005
|
*
|
2005
2006
|
* @event Hooks#beforeFilter
|
2006
2007
|
* @param {object[]} conditionsStack An array of objects with your [column filters](@/api/filters.md#addcondition).
|
2007
|
-
* @param {object[]|null} previousConditionsStack An array of objects with your previous [column filters](@/api/filters.md#addcondition). It can also be `null` if there was no previous filters applied or the conditions did not change between performing the `filter` action.
|
2008
2008
|
* @returns {boolean} To perform server-side filtering (i.e., to not apply filtering to Handsontable's UI), return `false`.
|
2009
2009
|
*/
|
2010
2010
|
'beforeFilter',
|
package/pluginHooks.mjs
CHANGED
@@ -605,6 +605,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
|
|
605
605
|
* @param {object} preventScrolling A reference to the observable object with the `value` property.
|
606
606
|
* Property `preventScrolling.value` expects a boolean value that
|
607
607
|
* Handsontable uses to control scroll behavior after selection.
|
608
|
+
* @param {object} preventScrolling Object with `value` property where its value change will be observed.
|
608
609
|
* @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
|
609
610
|
* @example
|
610
611
|
* ::: only-for javascript
|
@@ -2000,7 +2001,6 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
|
|
2000
2001
|
*
|
2001
2002
|
* @event Hooks#beforeFilter
|
2002
2003
|
* @param {object[]} conditionsStack An array of objects with your [column filters](@/api/filters.md#addcondition).
|
2003
|
-
* @param {object[]|null} previousConditionsStack An array of objects with your previous [column filters](@/api/filters.md#addcondition). It can also be `null` if there was no previous filters applied or the conditions did not change between performing the `filter` action.
|
2004
2004
|
* @returns {boolean} To perform server-side filtering (i.e., to not apply filtering to Handsontable's UI), return `false`.
|
2005
2005
|
*/
|
2006
2006
|
'beforeFilter',
|
@@ -482,7 +482,7 @@ class AutoColumnSize extends _base.BasePlugin {
|
|
482
482
|
if (width === undefined) {
|
483
483
|
width = this.columnWidthsMap.getValueAtIndex(this.hot.toPhysicalColumn(column));
|
484
484
|
if (keepMinimum && typeof width === 'number') {
|
485
|
-
width = Math.max(width, _src.
|
485
|
+
width = Math.max(width, _src.ViewportColumnsCalculator.DEFAULT_WIDTH);
|
486
486
|
}
|
487
487
|
}
|
488
488
|
return width;
|
@@ -17,7 +17,7 @@ import { isObject, hasOwnProperty } from "../../helpers/object.mjs";
|
|
17
17
|
import { valueAccordingPercent, rangeEach } from "../../helpers/number.mjs";
|
18
18
|
import SamplesGenerator from "../../utils/samplesGenerator.mjs";
|
19
19
|
import { isPercentValue } from "../../helpers/string.mjs";
|
20
|
-
import {
|
20
|
+
import { ViewportColumnsCalculator } from "../../3rdparty/walkontable/src/index.mjs";
|
21
21
|
import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
|
22
22
|
Hooks.getSingleton().register('modifyAutoColumnSizeSeed');
|
23
23
|
export const PLUGIN_KEY = 'autoColumnSize';
|
@@ -478,7 +478,7 @@ export class AutoColumnSize extends BasePlugin {
|
|
478
478
|
if (width === undefined) {
|
479
479
|
width = this.columnWidthsMap.getValueAtIndex(this.hot.toPhysicalColumn(column));
|
480
480
|
if (keepMinimum && typeof width === 'number') {
|
481
|
-
width = Math.max(width,
|
481
|
+
width = Math.max(width, ViewportColumnsCalculator.DEFAULT_WIDTH);
|
482
482
|
}
|
483
483
|
}
|
484
484
|
return width;
|
@@ -37,7 +37,8 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
|
|
37
37
|
* resize the rows accordingly.
|
38
38
|
* If you experience problems with the performance, try turning this feature off and declaring the row heights manually.
|
39
39
|
*
|
40
|
-
* But, to display Handsontable's scrollbar
|
40
|
+
* But, to display Handsontable's [scrollbar](https://handsontable.com/docs/8.0.0/demo-scrolling.html)
|
41
|
+
* in a proper size, you need to enable the `AutoRowSize` plugin,
|
41
42
|
* by setting the [`autoRowSize`](@/api/options.md#autoRowSize) option to `true`.
|
42
43
|
*
|
43
44
|
* Row height calculations are divided into sync and async part. Each of this parts has their own advantages and
|
@@ -33,7 +33,8 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
|
|
33
33
|
* resize the rows accordingly.
|
34
34
|
* If you experience problems with the performance, try turning this feature off and declaring the row heights manually.
|
35
35
|
*
|
36
|
-
* But, to display Handsontable's scrollbar
|
36
|
+
* But, to display Handsontable's [scrollbar](https://handsontable.com/docs/8.0.0/demo-scrolling.html)
|
37
|
+
* in a proper size, you need to enable the `AutoRowSize` plugin,
|
37
38
|
* by setting the [`autoRowSize`](@/api/options.md#autoRowSize) option to `true`.
|
38
39
|
*
|
39
40
|
* Row height calculations are divided into sync and async part. Each of this parts has their own advantages and
|
@@ -722,16 +722,7 @@ class ColumnSorting extends _base.BasePlugin {
|
|
722
722
|
this.hot.deselectCell();
|
723
723
|
this.hot.selectColumns(coords.col);
|
724
724
|
}
|
725
|
-
|
726
|
-
const nextConfig = this.getColumnNextConfig(coords.col);
|
727
|
-
if (activeEditor !== null && activeEditor !== void 0 && activeEditor.isOpened() && this.hot.getCellValidator(activeEditor.row, activeEditor.col)) {
|
728
|
-
// Postpone sorting until the cell's value is validated and saved.
|
729
|
-
this.hot.addHookOnce('postAfterValidate', () => {
|
730
|
-
this.sort(nextConfig);
|
731
|
-
});
|
732
|
-
} else {
|
733
|
-
this.sort(nextConfig);
|
734
|
-
}
|
725
|
+
this.sort(this.getColumnNextConfig(coords.col));
|
735
726
|
}
|
736
727
|
}
|
737
728
|
|
@@ -718,16 +718,7 @@ export class ColumnSorting extends BasePlugin {
|
|
718
718
|
this.hot.deselectCell();
|
719
719
|
this.hot.selectColumns(coords.col);
|
720
720
|
}
|
721
|
-
|
722
|
-
const nextConfig = this.getColumnNextConfig(coords.col);
|
723
|
-
if (activeEditor !== null && activeEditor !== void 0 && activeEditor.isOpened() && this.hot.getCellValidator(activeEditor.row, activeEditor.col)) {
|
724
|
-
// Postpone sorting until the cell's value is validated and saved.
|
725
|
-
this.hot.addHookOnce('postAfterValidate', () => {
|
726
|
-
this.sort(nextConfig);
|
727
|
-
});
|
728
|
-
} else {
|
729
|
-
this.sort(nextConfig);
|
730
|
-
}
|
721
|
+
this.sort(this.getColumnNextConfig(coords.col));
|
731
722
|
}
|
732
723
|
}
|
733
724
|
|
@@ -25,16 +25,17 @@ function createMenuItemRenderer(mainTableHot) {
|
|
25
25
|
* @param {string} value The cell value.
|
26
26
|
*/
|
27
27
|
return (menuHot, TD, row, col, prop, value) => {
|
28
|
+
if (TD.hasAttribute('ghost-table')) {
|
29
|
+
return;
|
30
|
+
}
|
28
31
|
const item = menuHot.getSourceDataAtRow(row);
|
29
32
|
const wrapper = mainTableHot.rootDocument.createElement('div');
|
30
33
|
const itemValue = typeof value === 'function' ? value.call(mainTableHot) : value;
|
31
|
-
const ariaLabel = typeof item.ariaLabel === 'function' ? item.ariaLabel.call(mainTableHot) : item.ariaLabel;
|
32
|
-
const ariaChecked = typeof item.ariaChecked === 'function' ? item.ariaChecked.call(mainTableHot) : item.ariaChecked;
|
33
34
|
(0, _element.empty)(TD);
|
34
35
|
(0, _element.addClass)(wrapper, 'htItemWrapper');
|
35
36
|
if (mainTableHot.getSettings().ariaTags) {
|
36
37
|
const isFocusable = !(0, _utils.isItemDisabled)(item, mainTableHot) && !(0, _utils.isItemSelectionDisabled)(item) && !(0, _utils.isItemSeparator)(item);
|
37
|
-
(0, _element.setAttribute)(TD, [
|
38
|
+
(0, _element.setAttribute)(TD, [(0, _a11y.A11Y_MENU_ITEM)(), (0, _a11y.A11Y_LABEL)(itemValue), ...(isFocusable ? [(0, _a11y.A11Y_TABINDEX)(-1)] : []), ...((0, _utils.isItemDisabled)(item, mainTableHot) ? [(0, _a11y.A11Y_DISABLED)()] : []), ...((0, _utils.isItemSubMenu)(item) ? [(0, _a11y.A11Y_EXPANDED)(false)] : [])]);
|
38
39
|
}
|
39
40
|
TD.className = '';
|
40
41
|
TD.appendChild(wrapper);
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { isItemSubMenu, isItemDisabled, isItemSelectionDisabled, isItemSeparator
|
1
|
+
import { isItemSubMenu, isItemDisabled, isItemSelectionDisabled, isItemSeparator } from "./utils.mjs";
|
2
2
|
import { addClass, empty, fastInnerHTML, setAttribute } from "../../../helpers/dom/element.mjs";
|
3
|
-
import {
|
3
|
+
import { A11Y_DISABLED, A11Y_EXPANDED, A11Y_LABEL, A11Y_MENU_ITEM, A11Y_TABINDEX } from "../../../helpers/a11y.mjs";
|
4
4
|
/**
|
5
5
|
* Creates the menu renderer function.
|
6
6
|
*
|
@@ -21,16 +21,17 @@ export function createMenuItemRenderer(mainTableHot) {
|
|
21
21
|
* @param {string} value The cell value.
|
22
22
|
*/
|
23
23
|
return (menuHot, TD, row, col, prop, value) => {
|
24
|
+
if (TD.hasAttribute('ghost-table')) {
|
25
|
+
return;
|
26
|
+
}
|
24
27
|
const item = menuHot.getSourceDataAtRow(row);
|
25
28
|
const wrapper = mainTableHot.rootDocument.createElement('div');
|
26
29
|
const itemValue = typeof value === 'function' ? value.call(mainTableHot) : value;
|
27
|
-
const ariaLabel = typeof item.ariaLabel === 'function' ? item.ariaLabel.call(mainTableHot) : item.ariaLabel;
|
28
|
-
const ariaChecked = typeof item.ariaChecked === 'function' ? item.ariaChecked.call(mainTableHot) : item.ariaChecked;
|
29
30
|
empty(TD);
|
30
31
|
addClass(wrapper, 'htItemWrapper');
|
31
32
|
if (mainTableHot.getSettings().ariaTags) {
|
32
33
|
const isFocusable = !isItemDisabled(item, mainTableHot) && !isItemSelectionDisabled(item) && !isItemSeparator(item);
|
33
|
-
setAttribute(TD, [
|
34
|
+
setAttribute(TD, [A11Y_MENU_ITEM(), A11Y_LABEL(itemValue), ...(isFocusable ? [A11Y_TABINDEX(-1)] : []), ...(isItemDisabled(item, mainTableHot) ? [A11Y_DISABLED()] : []), ...(isItemSubMenu(item) ? [A11Y_EXPANDED(false)] : [])]);
|
34
35
|
}
|
35
36
|
TD.className = '';
|
36
37
|
TD.appendChild(wrapper);
|
@@ -165,8 +165,12 @@ class Positioner {
|
|
165
165
|
setPositionOnRightOfCursor() {
|
166
166
|
let left = _classPrivateFieldGet(_cursor, this).left;
|
167
167
|
if (_classPrivateFieldGet(_parentContainer, this)) {
|
168
|
-
const
|
169
|
-
|
168
|
+
const {
|
169
|
+
right: parentMenuRight
|
170
|
+
} = _classPrivateFieldGet(_parentContainer, this).getBoundingClientRect();
|
171
|
+
|
172
|
+
// move the sub menu by the width of the parent's border (usually by 1-2 pixels)
|
173
|
+
left += _classPrivateFieldGet(_cursor, this).cellWidth + parentMenuRight - (_classPrivateFieldGet(_cursor, this).left + _classPrivateFieldGet(_cursor, this).cellWidth);
|
170
174
|
} else {
|
171
175
|
left += _classPrivateFieldGet(_offset, this).right;
|
172
176
|
}
|
@@ -179,8 +183,12 @@ class Positioner {
|
|
179
183
|
setPositionOnLeftOfCursor() {
|
180
184
|
let left = _classPrivateFieldGet(_offset, this).left + _classPrivateFieldGet(_cursor, this).left - _classPrivateFieldGet(_container, this).offsetWidth;
|
181
185
|
if (_classPrivateFieldGet(_parentContainer, this)) {
|
182
|
-
const
|
183
|
-
|
186
|
+
const {
|
187
|
+
left: parentMenuLeft
|
188
|
+
} = _classPrivateFieldGet(_parentContainer, this).getBoundingClientRect();
|
189
|
+
|
190
|
+
// move the sub menu by the width of the parent's border (usually by 1-2 pixels)
|
191
|
+
left -= _classPrivateFieldGet(_cursor, this).left - parentMenuLeft;
|
184
192
|
}
|
185
193
|
_classPrivateFieldGet(_container, this).style.left = `${left}px`;
|
186
194
|
}
|
@@ -162,8 +162,12 @@ export class Positioner {
|
|
162
162
|
setPositionOnRightOfCursor() {
|
163
163
|
let left = _classPrivateFieldGet(_cursor, this).left;
|
164
164
|
if (_classPrivateFieldGet(_parentContainer, this)) {
|
165
|
-
const
|
166
|
-
|
165
|
+
const {
|
166
|
+
right: parentMenuRight
|
167
|
+
} = _classPrivateFieldGet(_parentContainer, this).getBoundingClientRect();
|
168
|
+
|
169
|
+
// move the sub menu by the width of the parent's border (usually by 1-2 pixels)
|
170
|
+
left += _classPrivateFieldGet(_cursor, this).cellWidth + parentMenuRight - (_classPrivateFieldGet(_cursor, this).left + _classPrivateFieldGet(_cursor, this).cellWidth);
|
167
171
|
} else {
|
168
172
|
left += _classPrivateFieldGet(_offset, this).right;
|
169
173
|
}
|
@@ -176,8 +180,12 @@ export class Positioner {
|
|
176
180
|
setPositionOnLeftOfCursor() {
|
177
181
|
let left = _classPrivateFieldGet(_offset, this).left + _classPrivateFieldGet(_cursor, this).left - _classPrivateFieldGet(_container, this).offsetWidth;
|
178
182
|
if (_classPrivateFieldGet(_parentContainer, this)) {
|
179
|
-
const
|
180
|
-
|
183
|
+
const {
|
184
|
+
left: parentMenuLeft
|
185
|
+
} = _classPrivateFieldGet(_parentContainer, this).getBoundingClientRect();
|
186
|
+
|
187
|
+
// move the sub menu by the width of the parent's border (usually by 1-2 pixels)
|
188
|
+
left -= _classPrivateFieldGet(_cursor, this).left - parentMenuLeft;
|
181
189
|
}
|
182
190
|
_classPrivateFieldGet(_container, this).style.left = `${left}px`;
|
183
191
|
}
|
@@ -4,7 +4,6 @@ exports.__esModule = true;
|
|
4
4
|
exports.filterSeparators = filterSeparators;
|
5
5
|
exports.hasSubMenu = hasSubMenu;
|
6
6
|
exports.isDisabled = isDisabled;
|
7
|
-
exports.isItemCheckable = isItemCheckable;
|
8
7
|
exports.isItemDisabled = isItemDisabled;
|
9
8
|
exports.isItemHidden = isItemHidden;
|
10
9
|
exports.isItemSelectionDisabled = isItemSelectionDisabled;
|
@@ -175,14 +174,4 @@ function filterSeparators(items) {
|
|
175
174
|
result = popSeparators(result, separator);
|
176
175
|
result = removeDuplicatedSeparators(result);
|
177
176
|
return result;
|
178
|
-
}
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Check if the provided element presents the checkboxable menu item.
|
182
|
-
*
|
183
|
-
* @param {object} itemToTest Item element.
|
184
|
-
* @returns {boolean}
|
185
|
-
*/
|
186
|
-
function isItemCheckable(itemToTest) {
|
187
|
-
return itemToTest.checkable === true;
|
188
177
|
}
|
@@ -160,14 +160,4 @@ export function filterSeparators(items) {
|
|
160
160
|
result = popSeparators(result, separator);
|
161
161
|
result = removeDuplicatedSeparators(result);
|
162
162
|
return result;
|
163
|
-
}
|
164
|
-
|
165
|
-
/**
|
166
|
-
* Check if the provided element presents the checkboxable menu item.
|
167
|
-
*
|
168
|
-
* @param {object} itemToTest Item element.
|
169
|
-
* @returns {boolean}
|
170
|
-
*/
|
171
|
-
export function isItemCheckable(itemToTest) {
|
172
|
-
return itemToTest.checkable === true;
|
173
163
|
}
|
@@ -9,17 +9,6 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
9
9
|
function _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; }
|
10
10
|
const KEY = exports.KEY = 'alignment';
|
11
11
|
|
12
|
-
/**
|
13
|
-
* @param {object} hot The current Handsontable instance.
|
14
|
-
* @param {string} rawName The raw name of the menu item.
|
15
|
-
* @param {string} htClassName The class name to check.
|
16
|
-
* @returns {string} The value of aria-label parameter.
|
17
|
-
*/
|
18
|
-
function ariaLabel(hot, rawName, htClassName) {
|
19
|
-
const checkboxState = (0, _utils.hasSelectionAClass)(hot, htClassName) ? hot.getTranslatedPhrase(C.CHECKBOX_CHECKED) : hot.getTranslatedPhrase(C.CHECKBOX_UNCHECKED);
|
20
|
-
return `${rawName} ${checkboxState.toLowerCase()}`;
|
21
|
-
}
|
22
|
-
|
23
12
|
/**
|
24
13
|
* @returns {object}
|
25
14
|
*/
|
@@ -45,16 +34,15 @@ function alignmentItem() {
|
|
45
34
|
submenu: {
|
46
35
|
items: [{
|
47
36
|
key: `${KEY}:left`,
|
48
|
-
checkable: true,
|
49
|
-
ariaLabel() {
|
50
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT), 'htLeft');
|
51
|
-
},
|
52
|
-
ariaChecked() {
|
53
|
-
return (0, _utils.hasSelectionAClass)(this, 'htLeft');
|
54
|
-
},
|
55
37
|
name() {
|
56
38
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
|
57
|
-
|
39
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
40
|
+
const className = this.getCellMeta(row, col).className;
|
41
|
+
if (className && className.indexOf('htLeft') !== -1) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
});
|
45
|
+
if (hasClass) {
|
58
46
|
label = (0, _utils.markLabelAsSelected)(label);
|
59
47
|
}
|
60
48
|
return label;
|
@@ -71,16 +59,15 @@ function alignmentItem() {
|
|
71
59
|
disabled: false
|
72
60
|
}, {
|
73
61
|
key: `${KEY}:center`,
|
74
|
-
checkable: true,
|
75
|
-
ariaLabel() {
|
76
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER), 'htCenter');
|
77
|
-
},
|
78
|
-
ariaChecked() {
|
79
|
-
return (0, _utils.hasSelectionAClass)(this, 'htCenter');
|
80
|
-
},
|
81
62
|
name() {
|
82
63
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
|
83
|
-
|
64
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
65
|
+
const className = this.getCellMeta(row, col).className;
|
66
|
+
if (className && className.indexOf('htCenter') !== -1) {
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
if (hasClass) {
|
84
71
|
label = (0, _utils.markLabelAsSelected)(label);
|
85
72
|
}
|
86
73
|
return label;
|
@@ -97,16 +84,15 @@ function alignmentItem() {
|
|
97
84
|
disabled: false
|
98
85
|
}, {
|
99
86
|
key: `${KEY}:right`,
|
100
|
-
checkable: true,
|
101
|
-
ariaLabel() {
|
102
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT), 'htRight');
|
103
|
-
},
|
104
|
-
ariaChecked() {
|
105
|
-
return (0, _utils.hasSelectionAClass)(this, 'htRight');
|
106
|
-
},
|
107
87
|
name() {
|
108
88
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
|
109
|
-
|
89
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
90
|
+
const className = this.getCellMeta(row, col).className;
|
91
|
+
if (className && className.indexOf('htRight') !== -1) {
|
92
|
+
return true;
|
93
|
+
}
|
94
|
+
});
|
95
|
+
if (hasClass) {
|
110
96
|
label = (0, _utils.markLabelAsSelected)(label);
|
111
97
|
}
|
112
98
|
return label;
|
@@ -123,16 +109,15 @@ function alignmentItem() {
|
|
123
109
|
disabled: false
|
124
110
|
}, {
|
125
111
|
key: `${KEY}:justify`,
|
126
|
-
checkable: true,
|
127
|
-
ariaLabel() {
|
128
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY), 'htJustify');
|
129
|
-
},
|
130
|
-
ariaChecked() {
|
131
|
-
return (0, _utils.hasSelectionAClass)(this, 'htJustify');
|
132
|
-
},
|
133
112
|
name() {
|
134
113
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
|
135
|
-
|
114
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
115
|
+
const className = this.getCellMeta(row, col).className;
|
116
|
+
if (className && className.indexOf('htJustify') !== -1) {
|
117
|
+
return true;
|
118
|
+
}
|
119
|
+
});
|
120
|
+
if (hasClass) {
|
136
121
|
label = (0, _utils.markLabelAsSelected)(label);
|
137
122
|
}
|
138
123
|
return label;
|
@@ -151,16 +136,15 @@ function alignmentItem() {
|
|
151
136
|
name: _separator.KEY
|
152
137
|
}, {
|
153
138
|
key: `${KEY}:top`,
|
154
|
-
checkable: true,
|
155
|
-
ariaLabel() {
|
156
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP), 'htTop');
|
157
|
-
},
|
158
|
-
ariaChecked() {
|
159
|
-
return (0, _utils.hasSelectionAClass)(this, 'htTop');
|
160
|
-
},
|
161
139
|
name() {
|
162
140
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
|
163
|
-
|
141
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
142
|
+
const className = this.getCellMeta(row, col).className;
|
143
|
+
if (className && className.indexOf('htTop') !== -1) {
|
144
|
+
return true;
|
145
|
+
}
|
146
|
+
});
|
147
|
+
if (hasClass) {
|
164
148
|
label = (0, _utils.markLabelAsSelected)(label);
|
165
149
|
}
|
166
150
|
return label;
|
@@ -177,16 +161,15 @@ function alignmentItem() {
|
|
177
161
|
disabled: false
|
178
162
|
}, {
|
179
163
|
key: `${KEY}:middle`,
|
180
|
-
checkable: true,
|
181
|
-
ariaLabel() {
|
182
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE), 'htMiddle');
|
183
|
-
},
|
184
|
-
ariaChecked() {
|
185
|
-
return (0, _utils.hasSelectionAClass)(this, 'htMiddle');
|
186
|
-
},
|
187
164
|
name() {
|
188
165
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
|
189
|
-
|
166
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
167
|
+
const className = this.getCellMeta(row, col).className;
|
168
|
+
if (className && className.indexOf('htMiddle') !== -1) {
|
169
|
+
return true;
|
170
|
+
}
|
171
|
+
});
|
172
|
+
if (hasClass) {
|
190
173
|
label = (0, _utils.markLabelAsSelected)(label);
|
191
174
|
}
|
192
175
|
return label;
|
@@ -203,16 +186,15 @@ function alignmentItem() {
|
|
203
186
|
disabled: false
|
204
187
|
}, {
|
205
188
|
key: `${KEY}:bottom`,
|
206
|
-
checkable: true,
|
207
|
-
ariaLabel() {
|
208
|
-
return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM), 'htBottom');
|
209
|
-
},
|
210
|
-
ariaChecked() {
|
211
|
-
return (0, _utils.hasSelectionAClass)(this, 'htBottom');
|
212
|
-
},
|
213
189
|
name() {
|
214
190
|
let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
|
215
|
-
|
191
|
+
const hasClass = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => {
|
192
|
+
const className = this.getCellMeta(row, col).className;
|
193
|
+
if (className && className.indexOf('htBottom') !== -1) {
|
194
|
+
return true;
|
195
|
+
}
|
196
|
+
});
|
197
|
+
if (hasClass) {
|
216
198
|
label = (0, _utils.markLabelAsSelected)(label);
|
217
199
|
}
|
218
200
|
return label;
|