handsontable 14.0.0-next-23212d5-20231127 → 14.0.0-next-88de277-20231127

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.
@@ -3,6 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  var _textEditor = require("../textEditor");
5
5
  var _element = require("../../helpers/dom/element");
6
+ var _a11y = require("../../helpers/a11y");
6
7
  const EDITOR_TYPE = exports.EDITOR_TYPE = 'password';
7
8
 
8
9
  /**
@@ -22,6 +23,9 @@ class PasswordEditor extends _textEditor.TextEditor {
22
23
  this.textareaStyle = this.TEXTAREA.style;
23
24
  this.textareaStyle.width = 0;
24
25
  this.textareaStyle.height = 0;
26
+ if (this.hot.getSettings().ariaTags) {
27
+ (0, _element.setAttribute)(this.TEXTAREA, [(0, _a11y.A11Y_HIDDEN)()]);
28
+ }
25
29
  (0, _element.empty)(this.TEXTAREA_PARENT);
26
30
  this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
27
31
  }
@@ -1,5 +1,6 @@
1
1
  import { TextEditor } from "../textEditor/index.mjs";
2
- import { empty } from "../../helpers/dom/element.mjs";
2
+ import { empty, setAttribute } from "../../helpers/dom/element.mjs";
3
+ import { A11Y_HIDDEN } from "../../helpers/a11y.mjs";
3
4
  export const EDITOR_TYPE = 'password';
4
5
 
5
6
  /**
@@ -19,6 +20,9 @@ export class PasswordEditor extends TextEditor {
19
20
  this.textareaStyle = this.TEXTAREA.style;
20
21
  this.textareaStyle.width = 0;
21
22
  this.textareaStyle.height = 0;
23
+ if (this.hot.getSettings().ariaTags) {
24
+ setAttribute(this.TEXTAREA, [A11Y_HIDDEN()]);
25
+ }
22
26
  empty(this.TEXTAREA_PARENT);
23
27
  this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
24
28
  }
package/helpers/a11y.js CHANGED
@@ -11,6 +11,8 @@ const A11Y_GRIDCELL = () => ['role', 'gridcell'];
11
11
  exports.A11Y_GRIDCELL = A11Y_GRIDCELL;
12
12
  const A11Y_ROWHEADER = () => ['role', 'rowheader'];
13
13
  exports.A11Y_ROWHEADER = A11Y_ROWHEADER;
14
+ const A11Y_ROWGROUP = () => ['role', 'rowgroup'];
15
+ exports.A11Y_ROWGROUP = A11Y_ROWGROUP;
14
16
  const A11Y_COLUMNHEADER = () => ['role', 'columnheader'];
15
17
  exports.A11Y_COLUMNHEADER = A11Y_COLUMNHEADER;
16
18
  const A11Y_ROW = () => ['role', 'row'];
package/helpers/a11y.mjs CHANGED
@@ -3,6 +3,7 @@ export const A11Y_TREEGRID = () => ['role', 'treegrid'];
3
3
  export const A11Y_PRESENTATION = () => ['role', 'presentation'];
4
4
  export const A11Y_GRIDCELL = () => ['role', 'gridcell'];
5
5
  export const A11Y_ROWHEADER = () => ['role', 'rowheader'];
6
+ export const A11Y_ROWGROUP = () => ['role', 'rowgroup'];
6
7
  export const A11Y_COLUMNHEADER = () => ['role', 'columnheader'];
7
8
  export const A11Y_ROW = () => ['role', 'row'];
8
9
  export const A11Y_MENU = () => ['role', 'menu'];
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 = "14.0.0-next-23212d5-20231127";
137
+ const hotVersion = "14.0.0-next-88de277-20231127";
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)("22/11/2023", 'DD/MM/YYYY');
145
+ const releaseDate = (0, _moment.default)("29/11/2023", '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 = "14.0.0-next-23212d5-20231127";
127
+ const hotVersion = "14.0.0-next-88de277-20231127";
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("22/11/2023", 'DD/MM/YYYY');
135
+ const releaseDate = moment("29/11/2023", '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": "14.0.0-next-23212d5-20231127",
13
+ "version": "14.0.0-next-88de277-20231127",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -294,7 +294,6 @@ function createInput(rootDocument) {
294
294
  const input = rootDocument.createElement('input');
295
295
  input.className = 'htCheckboxRendererInput';
296
296
  input.type = 'checkbox';
297
- input.setAttribute('autocomplete', 'off');
298
297
  input.setAttribute('tabindex', '-1');
299
298
  return input.cloneNode(false);
300
299
  }
@@ -289,7 +289,6 @@ function createInput(rootDocument) {
289
289
  const input = rootDocument.createElement('input');
290
290
  input.className = 'htCheckboxRendererInput';
291
291
  input.type = 'checkbox';
292
- input.setAttribute('autocomplete', 'off');
293
292
  input.setAttribute('tabindex', '-1');
294
293
  return input.cloneNode(false);
295
294
  }
package/tableView.js CHANGED
@@ -11,11 +11,13 @@ var _mouseEventHandler = require("./selection/mouseEventHandler");
11
11
  var _rootInstance = require("./utils/rootInstance");
12
12
  var _a11y = require("./helpers/a11y");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
14
15
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
15
16
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
16
17
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
18
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
19
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
19
21
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
20
22
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
21
23
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
@@ -32,11 +34,25 @@ var _mouseDown = /*#__PURE__*/new WeakMap();
32
34
  var _table = /*#__PURE__*/new WeakMap();
33
35
  var _lastWidth = /*#__PURE__*/new WeakMap();
34
36
  var _lastHeight = /*#__PURE__*/new WeakMap();
37
+ var _getAriaColcount = /*#__PURE__*/new WeakSet();
38
+ var _updateAriaColcount = /*#__PURE__*/new WeakSet();
35
39
  class TableView {
36
40
  /**
37
41
  * @param {Hanstontable} hotInstance Instance of {@link Handsontable}.
38
42
  */
39
43
  constructor(hotInstance) {
44
+ /**
45
+ * Update the `aria-colcount` attribute by the provided value.
46
+ *
47
+ * @param {number} delta The number of columns to add or remove to the aria tag.
48
+ */
49
+ _classPrivateMethodInitSpec(this, _updateAriaColcount);
50
+ /**
51
+ * Return the value of the `aria-colcount` attribute.
52
+ *
53
+ * @returns {number} The value of the `aria-colcount` attribute.
54
+ */
55
+ _classPrivateMethodInitSpec(this, _getAriaColcount);
40
56
  /**
41
57
  * Instance of {@link Handsontable}.
42
58
  *
@@ -273,7 +289,7 @@ class TableView {
273
289
  }
274
290
  if (this.settings.ariaTags) {
275
291
  (0, _element.setAttribute)(_classPrivateFieldGet(this, _table), [(0, _a11y.A11Y_PRESENTATION)()]);
276
- (0, _element.setAttribute)(rootElement, [(0, _a11y.A11Y_TREEGRID)(), (0, _a11y.A11Y_ROWCOUNT)(this.hot.countRows()), (0, _a11y.A11Y_COLCOUNT)(this.hot.countCols()), (0, _a11y.A11Y_MULTISELECTABLE)()]);
292
+ (0, _element.setAttribute)(rootElement, [(0, _a11y.A11Y_TREEGRID)(), (0, _a11y.A11Y_ROWCOUNT)(-1), (0, _a11y.A11Y_COLCOUNT)(this.hot.countCols()), (0, _a11y.A11Y_MULTISELECTABLE)()]);
277
293
  }
278
294
  this.THEAD = rootDocument.createElement('THEAD');
279
295
  _classPrivateFieldGet(this, _table).appendChild(this.THEAD);
@@ -666,6 +682,13 @@ class TableView {
666
682
  }
667
683
  this.hot.runHooks('afterGetRowHeaderRenderers', headerRenderers);
668
684
  _classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
685
+ if (this.hot.getSettings().ariaTags) {
686
+ // Update the aria-colcount attribute.
687
+ // Only needs to be done once after initialization/data update.
688
+ if (_classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) === this.hot.countCols()) {
689
+ _classPrivateMethodGet(this, _updateAriaColcount, _updateAriaColcount2).call(this, _classPrivateFieldGet(this, _rowHeadersCount));
690
+ }
691
+ }
669
692
  return headerRenderers;
670
693
  },
671
694
  columnHeaders: () => {
@@ -1305,7 +1328,6 @@ class TableView {
1305
1328
  getRowHeadersCount() {
1306
1329
  return _classPrivateFieldGet(this, _rowHeadersCount);
1307
1330
  }
1308
-
1309
1331
  /**
1310
1332
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1311
1333
  *
@@ -1316,4 +1338,11 @@ class TableView {
1316
1338
  this.eventManager.destroy();
1317
1339
  }
1318
1340
  }
1341
+ function _getAriaColcount2() {
1342
+ return parseInt(this.hot.rootElement.getAttribute((0, _a11y.A11Y_COLCOUNT)()[0]), 10);
1343
+ }
1344
+ function _updateAriaColcount2(delta) {
1345
+ const colCount = _classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) + delta;
1346
+ (0, _element.setAttribute)(this.hot.rootElement, ...(0, _a11y.A11Y_COLCOUNT)(colCount));
1347
+ }
1319
1348
  var _default = exports.default = TableView;
package/tableView.mjs CHANGED
@@ -1,10 +1,12 @@
1
1
  import "core-js/modules/es.array.push.js";
2
2
  import "core-js/modules/es.error.cause.js";
3
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
4
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
5
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
7
8
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
8
10
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
9
11
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
10
12
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
@@ -28,11 +30,25 @@ var _mouseDown = /*#__PURE__*/new WeakMap();
28
30
  var _table = /*#__PURE__*/new WeakMap();
29
31
  var _lastWidth = /*#__PURE__*/new WeakMap();
30
32
  var _lastHeight = /*#__PURE__*/new WeakMap();
33
+ var _getAriaColcount = /*#__PURE__*/new WeakSet();
34
+ var _updateAriaColcount = /*#__PURE__*/new WeakSet();
31
35
  class TableView {
32
36
  /**
33
37
  * @param {Hanstontable} hotInstance Instance of {@link Handsontable}.
34
38
  */
35
39
  constructor(hotInstance) {
40
+ /**
41
+ * Update the `aria-colcount` attribute by the provided value.
42
+ *
43
+ * @param {number} delta The number of columns to add or remove to the aria tag.
44
+ */
45
+ _classPrivateMethodInitSpec(this, _updateAriaColcount);
46
+ /**
47
+ * Return the value of the `aria-colcount` attribute.
48
+ *
49
+ * @returns {number} The value of the `aria-colcount` attribute.
50
+ */
51
+ _classPrivateMethodInitSpec(this, _getAriaColcount);
36
52
  /**
37
53
  * Instance of {@link Handsontable}.
38
54
  *
@@ -269,7 +285,7 @@ class TableView {
269
285
  }
270
286
  if (this.settings.ariaTags) {
271
287
  setAttribute(_classPrivateFieldGet(this, _table), [A11Y_PRESENTATION()]);
272
- setAttribute(rootElement, [A11Y_TREEGRID(), A11Y_ROWCOUNT(this.hot.countRows()), A11Y_COLCOUNT(this.hot.countCols()), A11Y_MULTISELECTABLE()]);
288
+ setAttribute(rootElement, [A11Y_TREEGRID(), A11Y_ROWCOUNT(-1), A11Y_COLCOUNT(this.hot.countCols()), A11Y_MULTISELECTABLE()]);
273
289
  }
274
290
  this.THEAD = rootDocument.createElement('THEAD');
275
291
  _classPrivateFieldGet(this, _table).appendChild(this.THEAD);
@@ -662,6 +678,13 @@ class TableView {
662
678
  }
663
679
  this.hot.runHooks('afterGetRowHeaderRenderers', headerRenderers);
664
680
  _classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
681
+ if (this.hot.getSettings().ariaTags) {
682
+ // Update the aria-colcount attribute.
683
+ // Only needs to be done once after initialization/data update.
684
+ if (_classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) === this.hot.countCols()) {
685
+ _classPrivateMethodGet(this, _updateAriaColcount, _updateAriaColcount2).call(this, _classPrivateFieldGet(this, _rowHeadersCount));
686
+ }
687
+ }
665
688
  return headerRenderers;
666
689
  },
667
690
  columnHeaders: () => {
@@ -1301,7 +1324,6 @@ class TableView {
1301
1324
  getRowHeadersCount() {
1302
1325
  return _classPrivateFieldGet(this, _rowHeadersCount);
1303
1326
  }
1304
-
1305
1327
  /**
1306
1328
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1307
1329
  *
@@ -1312,4 +1334,11 @@ class TableView {
1312
1334
  this.eventManager.destroy();
1313
1335
  }
1314
1336
  }
1337
+ function _getAriaColcount2() {
1338
+ return parseInt(this.hot.rootElement.getAttribute(A11Y_COLCOUNT()[0]), 10);
1339
+ }
1340
+ function _updateAriaColcount2(delta) {
1341
+ const colCount = _classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) + delta;
1342
+ setAttribute(this.hot.rootElement, ...A11Y_COLCOUNT(colCount));
1343
+ }
1315
1344
  export default TableView;