handsontable 0.0.0-next-ff8465d-20231006 → 0.0.0-next-b0a4ea2-20231024

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.

Files changed (117) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/cellTypes/dateType/dateType.d.ts +3 -3
  4. package/cellTypes/dateType/dateType.js +2 -2
  5. package/cellTypes/dateType/dateType.mjs +2 -2
  6. package/cellTypes/handsontableType/handsontableType.d.ts +3 -3
  7. package/cellTypes/handsontableType/handsontableType.js +2 -2
  8. package/cellTypes/handsontableType/handsontableType.mjs +2 -2
  9. package/core.d.ts +1 -1
  10. package/core.js +10 -5
  11. package/core.mjs +10 -5
  12. package/dataMap/metaManager/metaSchema.js +1 -1
  13. package/dataMap/metaManager/metaSchema.mjs +1 -1
  14. package/dist/handsontable.css +13 -12
  15. package/dist/handsontable.full.css +13 -12
  16. package/dist/handsontable.full.js +2260 -1403
  17. package/dist/handsontable.full.min.css +5 -5
  18. package/dist/handsontable.full.min.js +10 -10
  19. package/dist/handsontable.js +2260 -1403
  20. package/dist/handsontable.min.css +5 -5
  21. package/dist/handsontable.min.js +24 -24
  22. package/dist/languages/all.js +6 -2
  23. package/dist/languages/all.min.js +1 -1
  24. package/dist/languages/en-US.js +3 -1
  25. package/dist/languages/en-US.min.js +1 -1
  26. package/dist/languages/pl-PL.js +3 -1
  27. package/dist/languages/pl-PL.min.js +1 -1
  28. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  29. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  30. package/editors/dateEditor/dateEditor.js +26 -7
  31. package/editors/dateEditor/dateEditor.mjs +27 -8
  32. package/editors/handsontableEditor/handsontableEditor.js +7 -0
  33. package/editors/handsontableEditor/handsontableEditor.mjs +8 -1
  34. package/helpers/a11y.js +3 -1
  35. package/helpers/a11y.mjs +2 -1
  36. package/helpers/mixed.js +1 -1
  37. package/helpers/mixed.mjs +1 -1
  38. package/i18n/constants.js +7 -1
  39. package/i18n/constants.mjs +4 -1
  40. package/i18n/languages/en-US.js +3 -1
  41. package/i18n/languages/en-US.mjs +3 -1
  42. package/i18n/languages/pl-PL.js +3 -1
  43. package/i18n/languages/pl-PL.mjs +3 -1
  44. package/languages/all.js +6 -2
  45. package/languages/en-US.js +3 -1
  46. package/languages/en-US.mjs +3 -1
  47. package/languages/index.js +6 -2
  48. package/languages/pl-PL.js +3 -1
  49. package/languages/pl-PL.mjs +3 -1
  50. package/package.json +11 -1
  51. package/pluginHooks.js +1 -1
  52. package/pluginHooks.mjs +1 -1
  53. package/plugins/contextMenu/menu/defaultShortcutsList.js +88 -0
  54. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +84 -0
  55. package/plugins/contextMenu/menu/menu.js +87 -151
  56. package/plugins/contextMenu/menu/menu.mjs +90 -154
  57. package/plugins/contextMenu/menu/menuItemRenderer.js +58 -0
  58. package/plugins/contextMenu/menu/menuItemRenderer.mjs +54 -0
  59. package/plugins/contextMenu/menu/navigator.js +19 -144
  60. package/plugins/contextMenu/menu/navigator.mjs +18 -143
  61. package/plugins/contextMenu/menu/shortcuts.js +114 -0
  62. package/plugins/contextMenu/menu/shortcuts.mjs +110 -0
  63. package/plugins/dropdownMenu/dropdownMenu.js +32 -4
  64. package/plugins/dropdownMenu/dropdownMenu.mjs +33 -5
  65. package/plugins/filters/component/_base.js +23 -8
  66. package/plugins/filters/component/_base.mjs +23 -8
  67. package/plugins/filters/component/actionBar.js +29 -27
  68. package/plugins/filters/component/actionBar.mjs +26 -23
  69. package/plugins/filters/component/condition.js +46 -59
  70. package/plugins/filters/component/condition.mjs +40 -52
  71. package/plugins/filters/component/operators.js +21 -22
  72. package/plugins/filters/component/operators.mjs +18 -18
  73. package/plugins/filters/component/value.js +35 -26
  74. package/plugins/filters/component/value.mjs +32 -22
  75. package/plugins/filters/filters.js +75 -48
  76. package/plugins/filters/filters.mjs +68 -41
  77. package/plugins/filters/menu/focusController.js +123 -0
  78. package/plugins/filters/menu/focusController.mjs +119 -0
  79. package/plugins/filters/menu/focusNavigator.js +30 -0
  80. package/plugins/filters/menu/focusNavigator.mjs +26 -0
  81. package/plugins/filters/ui/_base.js +35 -13
  82. package/plugins/filters/ui/_base.mjs +35 -13
  83. package/plugins/filters/ui/input.js +43 -32
  84. package/plugins/filters/ui/input.mjs +42 -30
  85. package/plugins/filters/ui/link.js +44 -12
  86. package/plugins/filters/ui/link.mjs +44 -11
  87. package/plugins/filters/ui/multipleSelect.js +234 -129
  88. package/plugins/filters/ui/multipleSelect.mjs +232 -127
  89. package/plugins/filters/ui/radioInput.js +42 -18
  90. package/plugins/filters/ui/radioInput.mjs +42 -17
  91. package/plugins/filters/ui/select.js +144 -75
  92. package/plugins/filters/ui/select.mjs +140 -70
  93. package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
  94. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
  95. package/renderers/checkboxRenderer/checkboxRenderer.js +3 -3
  96. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  97. package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
  98. package/renderers/dateRenderer/dateRenderer.js +29 -0
  99. package/renderers/dateRenderer/dateRenderer.mjs +24 -0
  100. package/renderers/dateRenderer/index.d.ts +1 -0
  101. package/renderers/dateRenderer/index.js +6 -0
  102. package/renderers/dateRenderer/index.mjs +1 -0
  103. package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
  104. package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
  105. package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
  106. package/renderers/handsontableRenderer/index.d.ts +1 -0
  107. package/renderers/handsontableRenderer/index.js +6 -0
  108. package/renderers/handsontableRenderer/index.mjs +1 -0
  109. package/renderers/index.d.ts +6 -0
  110. package/renderers/selectRenderer/selectRenderer.js +2 -1
  111. package/renderers/selectRenderer/selectRenderer.mjs +2 -1
  112. package/selection/selection.js +2 -2
  113. package/selection/selection.mjs +2 -2
  114. package/shortcuts/context.js +3 -2
  115. package/shortcuts/context.mjs +3 -2
  116. package/utils/paginator.js +151 -0
  117. package/utils/paginator.mjs +147 -0
@@ -1,3 +1,7 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ 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; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
+ 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); }
1
5
  import { clone, extend, mixin, objectEach } from "../../../helpers/object.mjs";
2
6
  import localHooks from "../../../mixins/localHooks.mjs";
3
7
  import EventManager from "../../../eventManager.mjs";
@@ -11,7 +15,7 @@ const EVENTS_TO_REGISTER = ['click', 'input', 'keydown', 'keypress', 'keyup', 'f
11
15
  /**
12
16
  * @private
13
17
  */
14
- class BaseUI {
18
+ export class BaseUI {
15
19
  static get DEFAULTS() {
16
20
  return clone({
17
21
  className: '',
@@ -21,38 +25,43 @@ class BaseUI {
21
25
  wrapIt: true
22
26
  });
23
27
  }
28
+
29
+ /**
30
+ * Instance of Handsontable.
31
+ *
32
+ * @type {Core}
33
+ */
34
+
24
35
  constructor(hotInstance, options) {
25
- /**
26
- * Instance of Handsontable.
27
- *
28
- * @type {Core}
29
- */
30
- this.hot = hotInstance;
36
+ _defineProperty(this, "hot", void 0);
31
37
  /**
32
38
  * Instance of EventManager.
33
39
  *
34
40
  * @type {EventManager}
35
41
  */
36
- this.eventManager = new EventManager(this);
42
+ _defineProperty(this, "eventManager", new EventManager(this));
37
43
  /**
38
44
  * List of element options.
39
45
  *
40
46
  * @type {object}
41
47
  */
42
- this.options = extend(BaseUI.DEFAULTS, options);
48
+ _defineProperty(this, "options", void 0);
43
49
  /**
44
50
  * Build root DOM element.
45
51
  *
46
52
  * @type {Element}
47
53
  * @private
48
54
  */
49
- this._element = this.hot.rootDocument.createElement(this.options.wrapIt ? 'div' : this.options.tagName);
55
+ _defineProperty(this, "_element", void 0);
50
56
  /**
51
57
  * Flag which determines build state of element.
52
58
  *
53
59
  * @type {string}
54
60
  */
55
- this.buildState = null;
61
+ _defineProperty(this, "buildState", void 0);
62
+ this.hot = hotInstance;
63
+ this.options = extend(BaseUI.DEFAULTS, options);
64
+ this._element = this.hot.rootDocument.createElement(this.options.wrapIt ? 'div' : this.options.tagName);
56
65
  }
57
66
 
58
67
  /**
@@ -125,6 +134,16 @@ class BaseUI {
125
134
  if (!this.buildState) {
126
135
  this.buildState = STATE_BUILDING;
127
136
  }
137
+
138
+ // prevents "hot.unlisten()" call when clicked
139
+ // (https://github.com/handsontable/handsontable/blob/master/handsontable/src/tableView.js#L317-L321)
140
+ this._element.setAttribute('data-hot-input', true);
141
+ if (this.options.tabIndex !== undefined) {
142
+ this._element.setAttribute('tabindex', this.options.tabIndex);
143
+ }
144
+ if (this.options.role !== undefined) {
145
+ this._element.setAttribute('role', this.options.role);
146
+ }
128
147
  if (this.options.className) {
129
148
  addClass(this._element, this.options.className);
130
149
  }
@@ -132,6 +151,10 @@ class BaseUI {
132
151
  arrayEach(this.options.children, element => this._element.appendChild(element.element));
133
152
  } else if (this.options.wrapIt) {
134
153
  const element = this.hot.rootDocument.createElement(this.options.tagName);
154
+
155
+ // prevents "hot.unlisten()" call when clicked
156
+ // (https://github.com/handsontable/handsontable/blob/master/handsontable/src/tableView.js#L317-L321)
157
+ element.setAttribute('data-hot-input', true);
135
158
  objectEach(this.options, (value, key) => {
136
159
  if (element[key] !== void 0 && key !== 'className' && key !== 'tagName' && key !== 'children') {
137
160
  element[key] = this.translateIfPossible(value);
@@ -185,5 +208,4 @@ class BaseUI {
185
208
  this._element = null;
186
209
  }
187
210
  }
188
- mixin(BaseUI, localHooks);
189
- export default BaseUI;
211
+ mixin(BaseUI, localHooks);
@@ -1,27 +1,53 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
4
5
  var _element = require("../../../helpers/dom/element");
5
6
  var _object = require("../../../helpers/object");
6
- var _base = _interopRequireDefault(require("./_base"));
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
- const privatePool = new WeakMap();
9
-
7
+ var _base = require("./_base");
8
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
9
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
10
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
11
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
12
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
13
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
14
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
15
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
16
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
10
17
  /**
11
18
  * @private
12
19
  * @class InputUI
13
20
  */
14
- class InputUI extends _base.default {
21
+ var _input = /*#__PURE__*/new WeakMap();
22
+ var _onKeyup = /*#__PURE__*/new WeakSet();
23
+ class InputUI extends _base.BaseUI {
15
24
  static get DEFAULTS() {
16
25
  return (0, _object.clone)({
17
26
  placeholder: '',
18
27
  type: 'text',
19
- tagName: 'input'
28
+ tagName: 'input',
29
+ tabIndex: -1
20
30
  });
21
31
  }
32
+
33
+ /**
34
+ * The reference to the input element.
35
+ *
36
+ * @type {HTMLInputElement}
37
+ */
38
+
22
39
  constructor(hotInstance, options) {
23
40
  super(hotInstance, (0, _object.extend)(InputUI.DEFAULTS, options));
24
- privatePool.set(this, {});
41
+ /**
42
+ * OnKeyup listener.
43
+ *
44
+ * @param {Event} event The mouse event object.
45
+ */
46
+ _classPrivateMethodInitSpec(this, _onKeyup);
47
+ _classPrivateFieldInitSpec(this, _input, {
48
+ writable: true,
49
+ value: void 0
50
+ });
25
51
  this.registerHooks();
26
52
  }
27
53
 
@@ -29,8 +55,7 @@ class InputUI extends _base.default {
29
55
  * Register all necessary hooks.
30
56
  */
31
57
  registerHooks() {
32
- this.addLocalHook('click', () => this.onClick());
33
- this.addLocalHook('keyup', event => this.onKeyup(event));
58
+ this.addLocalHook('keyup', event => _classPrivateMethodGet(this, _onKeyup, _onKeyup2).call(this, event));
34
59
  }
35
60
 
36
61
  /**
@@ -38,9 +63,8 @@ class InputUI extends _base.default {
38
63
  */
39
64
  build() {
40
65
  super.build();
41
- const priv = privatePool.get(this);
42
66
  const icon = this.hot.rootDocument.createElement('div');
43
- priv.input = this._element.firstChild;
67
+ _classPrivateFieldSet(this, _input, this._element.firstChild);
44
68
  (0, _element.addClass)(this._element, 'htUIInput');
45
69
  (0, _element.addClass)(icon, 'htUIInputIcon');
46
70
  this._element.appendChild(icon);
@@ -54,10 +78,9 @@ class InputUI extends _base.default {
54
78
  if (!this.isBuilt()) {
55
79
  return;
56
80
  }
57
- const input = privatePool.get(this).input;
58
- input.type = this.options.type;
59
- input.placeholder = this.translateIfPossible(this.options.placeholder);
60
- input.value = this.translateIfPossible(this.options.value);
81
+ _classPrivateFieldGet(this, _input).type = this.options.type;
82
+ _classPrivateFieldGet(this, _input).placeholder = this.translateIfPossible(this.options.placeholder);
83
+ _classPrivateFieldGet(this, _input).value = this.translateIfPossible(this.options.value);
61
84
  }
62
85
 
63
86
  /**
@@ -65,23 +88,11 @@ class InputUI extends _base.default {
65
88
  */
66
89
  focus() {
67
90
  if (this.isBuilt()) {
68
- privatePool.get(this).input.focus();
91
+ _classPrivateFieldGet(this, _input).focus();
69
92
  }
70
93
  }
71
-
72
- /**
73
- * OnClick listener.
74
- */
75
- onClick() {}
76
-
77
- /**
78
- * OnKeyup listener.
79
- *
80
- * @param {Event} event The mouse event object.
81
- */
82
- onKeyup(event) {
83
- this.options.value = event.target.value;
84
- }
85
94
  }
86
- var _default = InputUI;
87
- exports.default = _default;
95
+ exports.InputUI = InputUI;
96
+ function _onKeyup2(event) {
97
+ this.options.value = event.target.value;
98
+ }
@@ -1,23 +1,50 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
5
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
6
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
7
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
8
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
9
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
10
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
1
11
  import { addClass } from "../../../helpers/dom/element.mjs";
2
12
  import { clone, extend } from "../../../helpers/object.mjs";
3
- import BaseUI from "./_base.mjs";
4
- const privatePool = new WeakMap();
5
-
13
+ import { BaseUI } from "./_base.mjs";
6
14
  /**
7
15
  * @private
8
16
  * @class InputUI
9
17
  */
10
- class InputUI extends BaseUI {
18
+ var _input = /*#__PURE__*/new WeakMap();
19
+ var _onKeyup = /*#__PURE__*/new WeakSet();
20
+ export class InputUI extends BaseUI {
11
21
  static get DEFAULTS() {
12
22
  return clone({
13
23
  placeholder: '',
14
24
  type: 'text',
15
- tagName: 'input'
25
+ tagName: 'input',
26
+ tabIndex: -1
16
27
  });
17
28
  }
29
+
30
+ /**
31
+ * The reference to the input element.
32
+ *
33
+ * @type {HTMLInputElement}
34
+ */
35
+
18
36
  constructor(hotInstance, options) {
19
37
  super(hotInstance, extend(InputUI.DEFAULTS, options));
20
- privatePool.set(this, {});
38
+ /**
39
+ * OnKeyup listener.
40
+ *
41
+ * @param {Event} event The mouse event object.
42
+ */
43
+ _classPrivateMethodInitSpec(this, _onKeyup);
44
+ _classPrivateFieldInitSpec(this, _input, {
45
+ writable: true,
46
+ value: void 0
47
+ });
21
48
  this.registerHooks();
22
49
  }
23
50
 
@@ -25,8 +52,7 @@ class InputUI extends BaseUI {
25
52
  * Register all necessary hooks.
26
53
  */
27
54
  registerHooks() {
28
- this.addLocalHook('click', () => this.onClick());
29
- this.addLocalHook('keyup', event => this.onKeyup(event));
55
+ this.addLocalHook('keyup', event => _classPrivateMethodGet(this, _onKeyup, _onKeyup2).call(this, event));
30
56
  }
31
57
 
32
58
  /**
@@ -34,9 +60,8 @@ class InputUI extends BaseUI {
34
60
  */
35
61
  build() {
36
62
  super.build();
37
- const priv = privatePool.get(this);
38
63
  const icon = this.hot.rootDocument.createElement('div');
39
- priv.input = this._element.firstChild;
64
+ _classPrivateFieldSet(this, _input, this._element.firstChild);
40
65
  addClass(this._element, 'htUIInput');
41
66
  addClass(icon, 'htUIInputIcon');
42
67
  this._element.appendChild(icon);
@@ -50,10 +75,9 @@ class InputUI extends BaseUI {
50
75
  if (!this.isBuilt()) {
51
76
  return;
52
77
  }
53
- const input = privatePool.get(this).input;
54
- input.type = this.options.type;
55
- input.placeholder = this.translateIfPossible(this.options.placeholder);
56
- input.value = this.translateIfPossible(this.options.value);
78
+ _classPrivateFieldGet(this, _input).type = this.options.type;
79
+ _classPrivateFieldGet(this, _input).placeholder = this.translateIfPossible(this.options.placeholder);
80
+ _classPrivateFieldGet(this, _input).value = this.translateIfPossible(this.options.value);
57
81
  }
58
82
 
59
83
  /**
@@ -61,22 +85,10 @@ class InputUI extends BaseUI {
61
85
  */
62
86
  focus() {
63
87
  if (this.isBuilt()) {
64
- privatePool.get(this).input.focus();
88
+ _classPrivateFieldGet(this, _input).focus();
65
89
  }
66
90
  }
67
-
68
- /**
69
- * OnClick listener.
70
- */
71
- onClick() {}
72
-
73
- /**
74
- * OnKeyup listener.
75
- *
76
- * @param {Event} event The mouse event object.
77
- */
78
- onKeyup(event) {
79
- this.options.value = event.target.value;
80
- }
81
91
  }
82
- export default InputUI;
92
+ function _onKeyup2(event) {
93
+ this.options.value = event.target.value;
94
+ }
@@ -1,25 +1,43 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
4
5
  var _object = require("../../../helpers/object");
5
- var _base = _interopRequireDefault(require("./_base"));
6
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
- const privatePool = new WeakMap();
8
-
6
+ var _base = require("./_base");
7
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
8
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
10
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
11
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
12
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
13
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
9
14
  /**
10
15
  * @private
11
16
  * @class LinkUI
12
17
  */
13
- class LinkUI extends _base.default {
18
+ var _link = /*#__PURE__*/new WeakMap();
19
+ class LinkUI extends _base.BaseUI {
14
20
  static get DEFAULTS() {
15
21
  return (0, _object.clone)({
16
22
  href: '#',
17
- tagName: 'a'
23
+ tagName: 'a',
24
+ tabIndex: -1,
25
+ role: 'button'
18
26
  });
19
27
  }
28
+
29
+ /**
30
+ * The reference to the link element.
31
+ *
32
+ * @type {HTMLLinkElement}
33
+ */
34
+
20
35
  constructor(hotInstance, options) {
21
36
  super(hotInstance, (0, _object.extend)(LinkUI.DEFAULTS, options));
22
- privatePool.set(this, {});
37
+ _classPrivateFieldInitSpec(this, _link, {
38
+ writable: true,
39
+ value: void 0
40
+ });
23
41
  }
24
42
 
25
43
  /**
@@ -27,8 +45,7 @@ class LinkUI extends _base.default {
27
45
  */
28
46
  build() {
29
47
  super.build();
30
- const priv = privatePool.get(this);
31
- priv.link = this._element.firstChild;
48
+ _classPrivateFieldSet(this, _link, this._element.firstChild);
32
49
  }
33
50
 
34
51
  /**
@@ -38,8 +55,23 @@ class LinkUI extends _base.default {
38
55
  if (!this.isBuilt()) {
39
56
  return;
40
57
  }
41
- privatePool.get(this).link.textContent = this.translateIfPossible(this.options.textContent);
58
+ _classPrivateFieldGet(this, _link).textContent = this.translateIfPossible(this.options.textContent);
59
+ }
60
+
61
+ /**
62
+ * Focus element.
63
+ */
64
+ focus() {
65
+ if (this.isBuilt()) {
66
+ _classPrivateFieldGet(this, _link).focus();
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Activate the element.
72
+ */
73
+ activate() {
74
+ _classPrivateFieldGet(this, _link).click();
42
75
  }
43
76
  }
44
- var _default = LinkUI;
45
- exports.default = _default;
77
+ exports.LinkUI = LinkUI;
@@ -1,21 +1,40 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
3
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
4
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
5
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
6
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
7
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
8
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
1
9
  import { clone, extend } from "../../../helpers/object.mjs";
2
- import BaseUI from "./_base.mjs";
3
- const privatePool = new WeakMap();
4
-
10
+ import { BaseUI } from "./_base.mjs";
5
11
  /**
6
12
  * @private
7
13
  * @class LinkUI
8
14
  */
9
- class LinkUI extends BaseUI {
15
+ var _link = /*#__PURE__*/new WeakMap();
16
+ export class LinkUI extends BaseUI {
10
17
  static get DEFAULTS() {
11
18
  return clone({
12
19
  href: '#',
13
- tagName: 'a'
20
+ tagName: 'a',
21
+ tabIndex: -1,
22
+ role: 'button'
14
23
  });
15
24
  }
25
+
26
+ /**
27
+ * The reference to the link element.
28
+ *
29
+ * @type {HTMLLinkElement}
30
+ */
31
+
16
32
  constructor(hotInstance, options) {
17
33
  super(hotInstance, extend(LinkUI.DEFAULTS, options));
18
- privatePool.set(this, {});
34
+ _classPrivateFieldInitSpec(this, _link, {
35
+ writable: true,
36
+ value: void 0
37
+ });
19
38
  }
20
39
 
21
40
  /**
@@ -23,8 +42,7 @@ class LinkUI extends BaseUI {
23
42
  */
24
43
  build() {
25
44
  super.build();
26
- const priv = privatePool.get(this);
27
- priv.link = this._element.firstChild;
45
+ _classPrivateFieldSet(this, _link, this._element.firstChild);
28
46
  }
29
47
 
30
48
  /**
@@ -34,7 +52,22 @@ class LinkUI extends BaseUI {
34
52
  if (!this.isBuilt()) {
35
53
  return;
36
54
  }
37
- privatePool.get(this).link.textContent = this.translateIfPossible(this.options.textContent);
55
+ _classPrivateFieldGet(this, _link).textContent = this.translateIfPossible(this.options.textContent);
56
+ }
57
+
58
+ /**
59
+ * Focus element.
60
+ */
61
+ focus() {
62
+ if (this.isBuilt()) {
63
+ _classPrivateFieldGet(this, _link).focus();
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Activate the element.
69
+ */
70
+ activate() {
71
+ _classPrivateFieldGet(this, _link).click();
38
72
  }
39
- }
40
- export default LinkUI;
73
+ }