handsontable 16.1.1 → 16.2.0-next-90d1117-20251117

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.
Files changed (296) hide show
  1. package/3rdparty/walkontable/src/overlays.js +1 -1
  2. package/3rdparty/walkontable/src/overlays.mjs +1 -1
  3. package/3rdparty/walkontable/src/selection/border/border.js +19 -3
  4. package/3rdparty/walkontable/src/selection/border/border.mjs +19 -3
  5. package/CHANGELOG.md +39 -0
  6. package/base.js +2 -2
  7. package/base.mjs +2 -2
  8. package/core/coordsMapper/index.js +11 -0
  9. package/core/coordsMapper/index.mjs +1 -0
  10. package/core/hooks/bucket.js +7 -1
  11. package/core/hooks/bucket.mjs +7 -1
  12. package/core/hooks/constants.js +54 -0
  13. package/core/hooks/constants.mjs +54 -0
  14. package/core/hooks/index.d.ts +6 -0
  15. package/core/index.js +10 -4
  16. package/core/index.mjs +2 -1
  17. package/core.d.ts +3 -2
  18. package/core.js +67 -26
  19. package/core.mjs +56 -15
  20. package/dataMap/metaManager/metaSchema.js +197 -20
  21. package/dataMap/metaManager/metaSchema.mjs +197 -20
  22. package/dist/handsontable.css +175 -3
  23. package/dist/handsontable.full.css +175 -3
  24. package/dist/handsontable.full.js +10864 -8426
  25. package/dist/handsontable.full.min.css +5 -4
  26. package/dist/handsontable.full.min.js +194 -193
  27. package/dist/handsontable.js +7126 -4827
  28. package/dist/handsontable.min.css +4 -4
  29. package/dist/handsontable.min.js +43 -42
  30. package/dist/languages/all.js +168 -21
  31. package/dist/languages/all.min.js +1 -1
  32. package/dist/languages/ar-AR.js +8 -1
  33. package/dist/languages/ar-AR.min.js +1 -1
  34. package/dist/languages/cs-CZ.js +8 -1
  35. package/dist/languages/cs-CZ.min.js +1 -1
  36. package/dist/languages/de-CH.js +8 -1
  37. package/dist/languages/de-CH.min.js +1 -1
  38. package/dist/languages/de-DE.js +8 -1
  39. package/dist/languages/de-DE.min.js +1 -1
  40. package/dist/languages/en-US.js +8 -1
  41. package/dist/languages/en-US.min.js +1 -1
  42. package/dist/languages/es-MX.js +8 -1
  43. package/dist/languages/es-MX.min.js +1 -1
  44. package/dist/languages/fa-IR.js +8 -1
  45. package/dist/languages/fa-IR.min.js +1 -1
  46. package/dist/languages/fr-FR.js +8 -1
  47. package/dist/languages/fr-FR.min.js +1 -1
  48. package/dist/languages/hr-HR.js +8 -1
  49. package/dist/languages/hr-HR.min.js +1 -1
  50. package/dist/languages/it-IT.js +8 -1
  51. package/dist/languages/it-IT.min.js +1 -1
  52. package/dist/languages/ja-JP.js +8 -1
  53. package/dist/languages/ja-JP.min.js +1 -1
  54. package/dist/languages/ko-KR.js +8 -1
  55. package/dist/languages/ko-KR.min.js +1 -1
  56. package/dist/languages/lv-LV.js +8 -1
  57. package/dist/languages/lv-LV.min.js +1 -1
  58. package/dist/languages/nb-NO.js +8 -1
  59. package/dist/languages/nb-NO.min.js +1 -1
  60. package/dist/languages/nl-NL.js +8 -1
  61. package/dist/languages/nl-NL.min.js +1 -1
  62. package/dist/languages/pl-PL.js +8 -1
  63. package/dist/languages/pl-PL.min.js +1 -1
  64. package/dist/languages/pt-BR.js +8 -1
  65. package/dist/languages/pt-BR.min.js +1 -1
  66. package/dist/languages/ru-RU.js +8 -1
  67. package/dist/languages/ru-RU.min.js +1 -1
  68. package/dist/languages/sr-SP.js +8 -1
  69. package/dist/languages/sr-SP.min.js +1 -1
  70. package/dist/languages/zh-CN.js +8 -1
  71. package/dist/languages/zh-CN.min.js +1 -1
  72. package/dist/languages/zh-TW.js +8 -1
  73. package/dist/languages/zh-TW.min.js +1 -1
  74. package/editors/autocompleteEditor/autocompleteEditor.js +21 -1
  75. package/editors/autocompleteEditor/autocompleteEditor.mjs +22 -2
  76. package/focusManager/constants.js +25 -0
  77. package/focusManager/constants.mjs +22 -0
  78. package/focusManager/eventListener.js +107 -0
  79. package/focusManager/eventListener.mjs +103 -0
  80. package/{focusManager.d.ts → focusManager/grid.d.ts} +1 -1
  81. package/{focusManager.js → focusManager/grid.js} +48 -17
  82. package/{focusManager.mjs → focusManager/grid.mjs} +47 -16
  83. package/focusManager/index.d.ts +2 -0
  84. package/focusManager/index.js +20 -0
  85. package/focusManager/index.mjs +20 -0
  86. package/focusManager/scope.js +133 -0
  87. package/focusManager/scope.mjs +129 -0
  88. package/focusManager/scopeManager.d.ts +19 -0
  89. package/focusManager/scopeManager.js +268 -0
  90. package/focusManager/scopeManager.mjs +263 -0
  91. package/focusManager/scopes/grid.js +120 -0
  92. package/focusManager/scopes/grid.mjs +116 -0
  93. package/focusManager/scopes/index.js +13 -0
  94. package/focusManager/scopes/index.mjs +9 -0
  95. package/{utils → focusManager/utils}/focusDetector.js +21 -31
  96. package/{utils → focusManager/utils}/focusDetector.mjs +21 -31
  97. package/focusManager/utils/utils.js +95 -0
  98. package/focusManager/utils/utils.mjs +89 -0
  99. package/helpers/dom/element.js +1 -1
  100. package/helpers/dom/element.mjs +2 -2
  101. package/helpers/dom/event.js +1 -1
  102. package/helpers/dom/event.mjs +1 -1
  103. package/helpers/mixed.js +2 -65
  104. package/helpers/mixed.mjs +2 -63
  105. package/i18n/constants.js +10 -1
  106. package/i18n/constants.mjs +10 -1
  107. package/i18n/languages/ar-AR.js +8 -1
  108. package/i18n/languages/ar-AR.mjs +8 -1
  109. package/i18n/languages/cs-CZ.js +8 -1
  110. package/i18n/languages/cs-CZ.mjs +8 -1
  111. package/i18n/languages/de-CH.js +8 -1
  112. package/i18n/languages/de-CH.mjs +8 -1
  113. package/i18n/languages/de-DE.js +8 -1
  114. package/i18n/languages/de-DE.mjs +8 -1
  115. package/i18n/languages/en-US.js +8 -1
  116. package/i18n/languages/en-US.mjs +8 -1
  117. package/i18n/languages/es-MX.js +8 -1
  118. package/i18n/languages/es-MX.mjs +8 -1
  119. package/i18n/languages/fa-IR.js +8 -1
  120. package/i18n/languages/fa-IR.mjs +8 -1
  121. package/i18n/languages/fr-FR.js +8 -1
  122. package/i18n/languages/fr-FR.mjs +8 -1
  123. package/i18n/languages/hr-HR.js +8 -1
  124. package/i18n/languages/hr-HR.mjs +8 -1
  125. package/i18n/languages/it-IT.js +8 -1
  126. package/i18n/languages/it-IT.mjs +8 -1
  127. package/i18n/languages/ja-JP.js +8 -1
  128. package/i18n/languages/ja-JP.mjs +8 -1
  129. package/i18n/languages/ko-KR.js +8 -1
  130. package/i18n/languages/ko-KR.mjs +8 -1
  131. package/i18n/languages/lv-LV.js +8 -1
  132. package/i18n/languages/lv-LV.mjs +8 -1
  133. package/i18n/languages/nb-NO.js +8 -1
  134. package/i18n/languages/nb-NO.mjs +8 -1
  135. package/i18n/languages/nl-NL.js +8 -1
  136. package/i18n/languages/nl-NL.mjs +8 -1
  137. package/i18n/languages/pl-PL.js +8 -1
  138. package/i18n/languages/pl-PL.mjs +8 -1
  139. package/i18n/languages/pt-BR.js +8 -1
  140. package/i18n/languages/pt-BR.mjs +8 -1
  141. package/i18n/languages/ru-RU.js +8 -1
  142. package/i18n/languages/ru-RU.mjs +8 -1
  143. package/i18n/languages/sr-SP.js +8 -1
  144. package/i18n/languages/sr-SP.mjs +8 -1
  145. package/i18n/languages/zh-CN.js +8 -1
  146. package/i18n/languages/zh-CN.mjs +8 -1
  147. package/i18n/languages/zh-TW.js +8 -1
  148. package/i18n/languages/zh-TW.mjs +8 -1
  149. package/index.d.ts +9 -0
  150. package/languages/all.js +168 -21
  151. package/languages/ar-AR.js +8 -1
  152. package/languages/ar-AR.mjs +8 -1
  153. package/languages/cs-CZ.js +8 -1
  154. package/languages/cs-CZ.mjs +8 -1
  155. package/languages/de-CH.js +8 -1
  156. package/languages/de-CH.mjs +8 -1
  157. package/languages/de-DE.js +8 -1
  158. package/languages/de-DE.mjs +8 -1
  159. package/languages/en-US.js +8 -1
  160. package/languages/en-US.mjs +8 -1
  161. package/languages/es-MX.js +8 -1
  162. package/languages/es-MX.mjs +8 -1
  163. package/languages/fa-IR.js +8 -1
  164. package/languages/fa-IR.mjs +8 -1
  165. package/languages/fr-FR.js +8 -1
  166. package/languages/fr-FR.mjs +8 -1
  167. package/languages/hr-HR.js +8 -1
  168. package/languages/hr-HR.mjs +8 -1
  169. package/languages/index.js +168 -21
  170. package/languages/it-IT.js +8 -1
  171. package/languages/it-IT.mjs +8 -1
  172. package/languages/ja-JP.js +8 -1
  173. package/languages/ja-JP.mjs +8 -1
  174. package/languages/ko-KR.js +8 -1
  175. package/languages/ko-KR.mjs +8 -1
  176. package/languages/lv-LV.js +8 -1
  177. package/languages/lv-LV.mjs +8 -1
  178. package/languages/nb-NO.js +8 -1
  179. package/languages/nb-NO.mjs +8 -1
  180. package/languages/nl-NL.js +8 -1
  181. package/languages/nl-NL.mjs +8 -1
  182. package/languages/pl-PL.js +8 -1
  183. package/languages/pl-PL.mjs +8 -1
  184. package/languages/pt-BR.js +8 -1
  185. package/languages/pt-BR.mjs +8 -1
  186. package/languages/ru-RU.js +8 -1
  187. package/languages/ru-RU.mjs +8 -1
  188. package/languages/sr-SP.js +8 -1
  189. package/languages/sr-SP.mjs +8 -1
  190. package/languages/zh-CN.js +8 -1
  191. package/languages/zh-CN.mjs +8 -1
  192. package/languages/zh-TW.js +8 -1
  193. package/languages/zh-TW.mjs +8 -1
  194. package/package.json +25 -7
  195. package/plugins/autoRowSize/autoRowSize.js +8 -1
  196. package/plugins/autoRowSize/autoRowSize.mjs +8 -1
  197. package/plugins/base/base.js +36 -10
  198. package/plugins/base/base.mjs +36 -10
  199. package/plugins/columnSummary/endpoints.js +13 -3
  200. package/plugins/columnSummary/endpoints.mjs +13 -3
  201. package/plugins/customBorders/customBorders.d.ts +1 -0
  202. package/plugins/customBorders/customBorders.js +32 -2
  203. package/plugins/customBorders/customBorders.mjs +32 -2
  204. package/plugins/dialog/constants.js +7 -0
  205. package/plugins/dialog/constants.mjs +4 -0
  206. package/plugins/dialog/dialog.d.ts +22 -2
  207. package/plugins/dialog/dialog.js +197 -81
  208. package/plugins/dialog/dialog.mjs +196 -81
  209. package/plugins/dialog/templates/base.js +60 -0
  210. package/plugins/dialog/templates/base.mjs +56 -0
  211. package/plugins/dialog/templates/confirm.js +106 -0
  212. package/plugins/dialog/templates/confirm.mjs +102 -0
  213. package/plugins/dialog/templates/index.js +6 -0
  214. package/plugins/dialog/templates/index.mjs +4 -0
  215. package/plugins/dialog/ui.js +125 -41
  216. package/plugins/dialog/ui.mjs +119 -35
  217. package/plugins/emptyDataState/emptyDataState.d.ts +24 -0
  218. package/plugins/emptyDataState/emptyDataState.js +526 -0
  219. package/plugins/emptyDataState/emptyDataState.mjs +521 -0
  220. package/plugins/emptyDataState/index.d.ts +1 -0
  221. package/plugins/emptyDataState/index.js +7 -0
  222. package/plugins/emptyDataState/index.mjs +1 -0
  223. package/plugins/emptyDataState/ui.js +282 -0
  224. package/plugins/emptyDataState/ui.mjs +278 -0
  225. package/plugins/filters/component/value.js +16 -1
  226. package/plugins/filters/component/value.mjs +16 -1
  227. package/plugins/filters/filters.d.ts +5 -1
  228. package/plugins/filters/filters.js +22 -1
  229. package/plugins/filters/filters.mjs +22 -1
  230. package/plugins/filters/ui/multipleSelect.js +90 -79
  231. package/plugins/filters/ui/multipleSelect.mjs +90 -79
  232. package/plugins/index.d.ts +3 -0
  233. package/plugins/index.js +3 -0
  234. package/plugins/index.mjs +3 -1
  235. package/plugins/mergeCells/utils.js +1 -5
  236. package/plugins/mergeCells/utils.mjs +1 -5
  237. package/plugins/pagination/pagination.js +37 -175
  238. package/plugins/pagination/pagination.mjs +37 -175
  239. package/plugins/pagination/strategies/autoPageSize.js +2 -2
  240. package/plugins/pagination/strategies/autoPageSize.mjs +2 -2
  241. package/plugins/pagination/ui.js +6 -10
  242. package/plugins/pagination/ui.mjs +7 -11
  243. package/plugins/stretchColumns/calculator.js +3 -1
  244. package/plugins/stretchColumns/calculator.mjs +3 -1
  245. package/plugins/undoRedo/undoRedo.js +16 -6
  246. package/plugins/undoRedo/undoRedo.mjs +16 -5
  247. package/renderers/checkboxRenderer/checkboxRenderer.js +12 -15
  248. package/renderers/checkboxRenderer/checkboxRenderer.mjs +12 -15
  249. package/selection/selection.js +1 -1
  250. package/selection/selection.mjs +1 -1
  251. package/settings.d.ts +3 -0
  252. package/shortcutContexts/commands/index.js +2 -1
  253. package/shortcutContexts/commands/index.mjs +2 -1
  254. package/shortcutContexts/commands/tabNavigation.js +51 -0
  255. package/shortcutContexts/commands/tabNavigation.mjs +48 -0
  256. package/shortcutContexts/constants.js +16 -1
  257. package/shortcutContexts/constants.mjs +16 -1
  258. package/shortcutContexts/editor.js +2 -2
  259. package/shortcutContexts/editor.mjs +3 -3
  260. package/shortcutContexts/grid.js +19 -3
  261. package/shortcutContexts/grid.mjs +20 -4
  262. package/shortcuts/manager.d.ts +1 -0
  263. package/shortcuts/manager.js +17 -2
  264. package/shortcuts/manager.mjs +17 -2
  265. package/styles/handsontable.css +192 -35
  266. package/styles/handsontable.min.css +3 -3
  267. package/styles/ht-icons-horizon.css +233 -0
  268. package/styles/ht-icons-horizon.min.css +30 -0
  269. package/styles/ht-icons-main.css +233 -0
  270. package/styles/ht-icons-main.min.css +30 -0
  271. package/styles/ht-theme-classic-no-icons.css +399 -0
  272. package/styles/ht-theme-classic-no-icons.min.css +30 -0
  273. package/styles/ht-theme-classic.css +308 -556
  274. package/styles/ht-theme-classic.min.css +3 -3
  275. package/styles/ht-theme-horizon-no-icons.css +405 -0
  276. package/styles/ht-theme-horizon-no-icons.min.css +30 -0
  277. package/styles/ht-theme-horizon.css +312 -556
  278. package/styles/ht-theme-horizon.min.css +3 -3
  279. package/styles/ht-theme-main-no-icons.css +396 -0
  280. package/styles/ht-theme-main-no-icons.min.css +30 -0
  281. package/styles/ht-theme-main.css +303 -556
  282. package/styles/ht-theme-main.min.css +3 -3
  283. package/tableView.js +23 -5
  284. package/tableView.mjs +23 -5
  285. package/utils/dataStructures/uniqueMap.js +10 -0
  286. package/utils/dataStructures/uniqueMap.mjs +10 -0
  287. package/utils/ghostTable.js +0 -3
  288. package/utils/ghostTable.mjs +0 -3
  289. package/utils/stylesHandler.js +19 -4
  290. package/utils/stylesHandler.mjs +19 -4
  291. package/core/focusCatcher/index.js +0 -131
  292. package/core/focusCatcher/index.mjs +0 -127
  293. package/core/focusCatcher/utils.js +0 -31
  294. package/core/focusCatcher/utils.mjs +0 -27
  295. package/plugins/pagination/focusController.js +0 -27
  296. package/plugins/pagination/focusController.mjs +0 -23
@@ -2,6 +2,7 @@ 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
4
  import "core-js/modules/esnext.iterator.for-each.js";
5
+ import "core-js/modules/esnext.iterator.map.js";
5
6
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
6
7
  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; }
7
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -203,32 +204,57 @@ export class BasePlugin {
203
204
  * @returns {*}
204
205
  */
205
206
  getSetting(settingName) {
207
+ var _this = this;
206
208
  const defaultSettings = this.constructor.DEFAULT_SETTINGS;
209
+ const settingsValidators = this.constructor.SETTINGS_VALIDATORS;
207
210
  if (settingName === undefined) {
208
211
  if (isObject(_classPrivateFieldGet(_pluginSettings, this))) {
209
212
  return assignObjectDefaults(_classPrivateFieldGet(_pluginSettings, this), defaultSettings);
210
213
  }
211
214
  return _classPrivateFieldGet(_pluginSettings, this);
212
215
  }
216
+ let settingValue;
213
217
  if ((Array.isArray(_classPrivateFieldGet(_pluginSettings, this)) || isObject(_classPrivateFieldGet(_pluginSettings, this))) && defaultSettings[defaultMainSettingSymbol] === settingName) {
214
- var _classPrivateFieldGet2;
215
218
  if (Array.isArray(_classPrivateFieldGet(_pluginSettings, this))) {
216
- return _classPrivateFieldGet(_pluginSettings, this);
219
+ settingValue = _classPrivateFieldGet(_pluginSettings, this);
220
+ } else {
221
+ var _classPrivateFieldGet2;
222
+ settingValue = (_classPrivateFieldGet2 = _classPrivateFieldGet(_pluginSettings, this)[settingName]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : defaultSettings[settingName];
217
223
  }
218
- return (_classPrivateFieldGet2 = _classPrivateFieldGet(_pluginSettings, this)[settingName]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : defaultSettings[settingName];
219
- }
220
- if (settingName.includes('.')) {
224
+ } else if (settingName.includes('.')) {
221
225
  const pluginValue = getProperty(_classPrivateFieldGet(_pluginSettings, this), settingName);
222
226
  const defaultValue = getProperty(defaultSettings, settingName);
223
227
  if (isObject(pluginValue)) {
224
- return assignObjectDefaults(pluginValue, defaultValue);
228
+ settingValue = assignObjectDefaults(pluginValue, defaultValue);
229
+ } else {
230
+ settingValue = pluginValue !== undefined ? pluginValue : defaultValue;
225
231
  }
226
- return pluginValue !== undefined ? pluginValue : defaultValue;
232
+ } else if (isObject(_classPrivateFieldGet(_pluginSettings, this))) {
233
+ settingValue = assignObjectDefaults(_classPrivateFieldGet(_pluginSettings, this), defaultSettings)[settingName];
234
+ } else {
235
+ settingValue = defaultSettings[settingName];
227
236
  }
228
- if (isObject(_classPrivateFieldGet(_pluginSettings, this))) {
229
- return assignObjectDefaults(_classPrivateFieldGet(_pluginSettings, this), defaultSettings)[settingName];
237
+ if (typeof settingValue === 'function' && settingsValidators && typeof settingsValidators === 'object') {
238
+ const validator = settingsValidators[settingName];
239
+ if (validator && typeof validator === 'function') {
240
+ return function () {
241
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
242
+ args[_key] = arguments[_key];
243
+ }
244
+ const result = settingValue(...args);
245
+ const isValid = validator(result);
246
+ if (isValid === false) {
247
+ const formattedArgs = args.map(arg => typeof arg === 'string' ? `"${arg}"` : '').join(', ');
248
+ const source = args.length > 0 ? formattedArgs : '';
249
+ warn(`${_this.pluginName} Plugin: "${settingName}" function (${source}) result \
250
+ is not valid and will be ignored.`);
251
+ return;
252
+ }
253
+ return result;
254
+ };
255
+ }
230
256
  }
231
- return defaultSettings[settingName];
257
+ return settingValue;
232
258
  }
233
259
 
234
260
  /**
@@ -230,6 +230,10 @@ class Endpoints {
230
230
  */
231
231
  resetSetupAfterStructureAlteration(action, index, number, logicRows, source) {
232
232
  let forceRefresh = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
233
+ // Automatic row/column creation (`minSpareRows`/`minSpareCols`) should not trigger the endpoint recalculation.
234
+ if (source === 'auto') {
235
+ return;
236
+ }
233
237
  if (this.settingsType === 'function') {
234
238
  // We need to run it on a next avaiable hook, because the TrimRows' `afterCreateRow` hook triggers after this one,
235
239
  // and it needs to be run to properly calculate the endpoint value.
@@ -399,7 +403,9 @@ class Endpoints {
399
403
  (0, _array.arrayEach)(endpoints, endpoint => {
400
404
  this.resetEndpointValue(endpoint, useOffset);
401
405
  });
402
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
406
+ if (this.cellsToSetCache.length) {
407
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
408
+ }
403
409
  this.cellsToSetCache = [];
404
410
  }
405
411
 
@@ -414,7 +420,9 @@ class Endpoints {
414
420
  this.setEndpointValue(value, 'init');
415
421
  });
416
422
  this.currentEndpoint = null;
417
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
423
+ if (this.cellsToSetCache.length) {
424
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
425
+ }
418
426
  this.cellsToSetCache = [];
419
427
  }
420
428
 
@@ -440,7 +448,9 @@ class Endpoints {
440
448
  (0, _array.arrayEach)(needToRefresh, value => {
441
449
  this.refreshEndpoint(this.getEndpoint(value));
442
450
  });
443
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
451
+ if (this.cellsToSetCache.length) {
452
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
453
+ }
444
454
  this.cellsToSetCache = [];
445
455
  }
446
456
 
@@ -227,6 +227,10 @@ class Endpoints {
227
227
  */
228
228
  resetSetupAfterStructureAlteration(action, index, number, logicRows, source) {
229
229
  let forceRefresh = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
230
+ // Automatic row/column creation (`minSpareRows`/`minSpareCols`) should not trigger the endpoint recalculation.
231
+ if (source === 'auto') {
232
+ return;
233
+ }
230
234
  if (this.settingsType === 'function') {
231
235
  // We need to run it on a next avaiable hook, because the TrimRows' `afterCreateRow` hook triggers after this one,
232
236
  // and it needs to be run to properly calculate the endpoint value.
@@ -396,7 +400,9 @@ class Endpoints {
396
400
  arrayEach(endpoints, endpoint => {
397
401
  this.resetEndpointValue(endpoint, useOffset);
398
402
  });
399
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
403
+ if (this.cellsToSetCache.length) {
404
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
405
+ }
400
406
  this.cellsToSetCache = [];
401
407
  }
402
408
 
@@ -411,7 +417,9 @@ class Endpoints {
411
417
  this.setEndpointValue(value, 'init');
412
418
  });
413
419
  this.currentEndpoint = null;
414
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
420
+ if (this.cellsToSetCache.length) {
421
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
422
+ }
415
423
  this.cellsToSetCache = [];
416
424
  }
417
425
 
@@ -437,7 +445,9 @@ class Endpoints {
437
445
  arrayEach(needToRefresh, value => {
438
446
  this.refreshEndpoint(this.getEndpoint(value));
439
447
  });
440
- this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
448
+ if (this.cellsToSetCache.length) {
449
+ this.hot.setDataAtCell(this.cellsToSetCache, 'ColumnSummary.reset');
450
+ }
441
451
  this.cellsToSetCache = [];
442
452
  }
443
453
 
@@ -7,6 +7,7 @@ export interface BorderOptions {
7
7
  width?: number;
8
8
  color?: string;
9
9
  hide?: boolean;
10
+ style?: 'dashed' | 'dotted' | 'solid';
10
11
  }
11
12
  export interface BorderRange {
12
13
  range: {
@@ -3,14 +3,18 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
+ require("core-js/modules/esnext.iterator.constructor.js");
7
+ require("core-js/modules/esnext.iterator.for-each.js");
6
8
  var _base = require("../base");
7
9
  var _object = require("../../helpers/object");
10
+ var _console = require("../../helpers/console");
8
11
  var _number = require("../../helpers/number");
9
12
  var _array = require("../../helpers/array");
10
13
  var C = _interopRequireWildcard(require("../../i18n/constants"));
11
14
  var _contextMenuItem = require("./contextMenuItem");
12
15
  var _utils = require("./utils");
13
16
  var _selection = require("../../selection");
17
+ var _mixed = require("../../helpers/mixed");
14
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
19
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
16
20
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -20,6 +24,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
20
24
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
21
25
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'customBorders';
22
26
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 90;
27
+ const SUPPORTED_STYLES = ['dashed', 'dotted', 'solid'];
23
28
 
24
29
  /* eslint-disable jsdoc/require-description-complete-sentence */
25
30
 
@@ -65,10 +70,12 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 90;
65
70
  * start: {
66
71
  * width: 2,
67
72
  * color: 'red',
73
+ * style: 'dotted'
68
74
  * },
69
75
  * end: {
70
76
  * width: 1,
71
77
  * color: 'green',
78
+ * style: 'dashed'
72
79
  * },
73
80
  * top: '',
74
81
  * bottom: '',
@@ -81,9 +88,10 @@ class CustomBorders extends _base.BasePlugin {
81
88
  constructor() {
82
89
  super(...arguments);
83
90
  /**
84
- * Add border options to context menu.
91
+ * Validate the style settings. If the style value is not supported, the property is removed from the configuration.
85
92
  *
86
- * @param {object} defaultOptions Context menu items.
93
+ * @private
94
+ * @param {object[]} customBorders The user defined custom border objects array.
87
95
  */
88
96
  _classPrivateMethodInitSpec(this, _CustomBorders_brand);
89
97
  /**
@@ -700,6 +708,7 @@ class CustomBorders extends _base.BasePlugin {
700
708
  if (this.hot.isRtl() && hasLeftOrRight) {
701
709
  throw new Error('The "left"/"right" properties are not supported for RTL. Please use option "start"/"end".');
702
710
  }
711
+ _assertClassBrand(_CustomBorders_brand, this, _validateStyleSettings).call(this, customBorders);
703
712
  }
704
713
  /**
705
714
  * Destroys the plugin instance.
@@ -709,6 +718,27 @@ class CustomBorders extends _base.BasePlugin {
709
718
  }
710
719
  }
711
720
  exports.CustomBorders = CustomBorders;
721
+ function _validateStyleSettings(customBorders) {
722
+ customBorders.forEach(customBorder => {
723
+ Object.keys(customBorder).forEach(key => {
724
+ const style = customBorder[key].style;
725
+ if ((0, _mixed.isDefined)(style) && !SUPPORTED_STYLES.includes(style)) {
726
+ // eslint-disable-next-line max-len
727
+ (0, _console.warn)(`The "${style}" border style is not supported. Please use one of the following styles: ${SUPPORTED_STYLES.join(', ')}.
728
+ The border style will be ignored.`);
729
+ delete customBorder[key].style;
730
+ } else if ((0, _mixed.isDefined)(style) && style === 'solid') {
731
+ // 'solid' is the default style
732
+ delete customBorder[key].style;
733
+ }
734
+ });
735
+ });
736
+ }
737
+ /**
738
+ * Add border options to context menu.
739
+ *
740
+ * @param {object} defaultOptions Context menu items.
741
+ */
712
742
  function _onAfterContextMenuDefaultOptions(defaultOptions) {
713
743
  if (!this.hot.getSettings()[PLUGIN_KEY]) {
714
744
  return;
@@ -1,5 +1,7 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/esnext.iterator.constructor.js";
4
+ import "core-js/modules/esnext.iterator.for-each.js";
3
5
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
4
6
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
5
7
  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; }
@@ -8,14 +10,17 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
8
10
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
11
  import { BasePlugin } from "../base/index.mjs";
10
12
  import { hasOwnProperty, deepClone } from "../../helpers/object.mjs";
13
+ import { warn } from "../../helpers/console.mjs";
11
14
  import { rangeEach } from "../../helpers/number.mjs";
12
15
  import { arrayEach, arrayReduce, arrayMap } from "../../helpers/array.mjs";
13
16
  import * as C from "../../i18n/constants.mjs";
14
17
  import { top as menuItemTop, bottom as menuItemBottom, left as menuItemLeft, right as menuItemRight, noBorders as menuItemNoBorders } from "./contextMenuItem/index.mjs";
15
18
  import { createId, createDefaultCustomBorder, createSingleEmptyBorder, createEmptyBorders, extendDefaultBorder, hasLeftRightTypeOptions, hasStartEndTypeOptions, toInlinePropName, normalizeBorder, denormalizeBorder } from "./utils.mjs";
16
19
  import { detectSelectionType, normalizeSelectionFactory } from "../../selection/index.mjs";
20
+ import { isDefined } from "../../helpers/mixed.mjs";
17
21
  export const PLUGIN_KEY = 'customBorders';
18
22
  export const PLUGIN_PRIORITY = 90;
23
+ const SUPPORTED_STYLES = ['dashed', 'dotted', 'solid'];
19
24
 
20
25
  /* eslint-disable jsdoc/require-description-complete-sentence */
21
26
 
@@ -61,10 +66,12 @@ export const PLUGIN_PRIORITY = 90;
61
66
  * start: {
62
67
  * width: 2,
63
68
  * color: 'red',
69
+ * style: 'dotted'
64
70
  * },
65
71
  * end: {
66
72
  * width: 1,
67
73
  * color: 'green',
74
+ * style: 'dashed'
68
75
  * },
69
76
  * top: '',
70
77
  * bottom: '',
@@ -77,9 +84,10 @@ export class CustomBorders extends BasePlugin {
77
84
  constructor() {
78
85
  super(...arguments);
79
86
  /**
80
- * Add border options to context menu.
87
+ * Validate the style settings. If the style value is not supported, the property is removed from the configuration.
81
88
  *
82
- * @param {object} defaultOptions Context menu items.
89
+ * @private
90
+ * @param {object[]} customBorders The user defined custom border objects array.
83
91
  */
84
92
  _classPrivateMethodInitSpec(this, _CustomBorders_brand);
85
93
  /**
@@ -696,6 +704,7 @@ export class CustomBorders extends BasePlugin {
696
704
  if (this.hot.isRtl() && hasLeftOrRight) {
697
705
  throw new Error('The "left"/"right" properties are not supported for RTL. Please use option "start"/"end".');
698
706
  }
707
+ _assertClassBrand(_CustomBorders_brand, this, _validateStyleSettings).call(this, customBorders);
699
708
  }
700
709
  /**
701
710
  * Destroys the plugin instance.
@@ -704,6 +713,27 @@ export class CustomBorders extends BasePlugin {
704
713
  super.destroy();
705
714
  }
706
715
  }
716
+ function _validateStyleSettings(customBorders) {
717
+ customBorders.forEach(customBorder => {
718
+ Object.keys(customBorder).forEach(key => {
719
+ const style = customBorder[key].style;
720
+ if (isDefined(style) && !SUPPORTED_STYLES.includes(style)) {
721
+ // eslint-disable-next-line max-len
722
+ warn(`The "${style}" border style is not supported. Please use one of the following styles: ${SUPPORTED_STYLES.join(', ')}.
723
+ The border style will be ignored.`);
724
+ delete customBorder[key].style;
725
+ } else if (isDefined(style) && style === 'solid') {
726
+ // 'solid' is the default style
727
+ delete customBorder[key].style;
728
+ }
729
+ });
730
+ });
731
+ }
732
+ /**
733
+ * Add border options to context menu.
734
+ *
735
+ * @param {object} defaultOptions Context menu items.
736
+ */
707
737
  function _onAfterContextMenuDefaultOptions(defaultOptions) {
708
738
  if (!this.hot.getSettings()[PLUGIN_KEY]) {
709
739
  return;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ /**
5
+ * The main class name for the dialog-related modal elements.
6
+ */
7
+ const DIALOG_CLASS_NAME = exports.DIALOG_CLASS_NAME = 'ht-dialog';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The main class name for the dialog-related modal elements.
3
+ */
4
+ export const DIALOG_CLASS_NAME = 'ht-dialog';
@@ -2,22 +2,42 @@ import Core from '../../core';
2
2
  import { BasePlugin } from '../base';
3
3
 
4
4
  export interface DialogConfig {
5
+ template?: {
6
+ type: 'confirm';
7
+ title: string;
8
+ description?: string;
9
+ buttons?: {
10
+ text: string;
11
+ type: 'primary' | 'secondary';
12
+ callback?: (event: MouseEvent) => void;
13
+ }[];
14
+ };
5
15
  content?: string | HTMLElement;
6
16
  customClassName?: string;
7
17
  background?: 'solid' | 'semi-transparent';
8
18
  contentBackground?: boolean;
9
19
  animation?: boolean;
10
20
  closable?: boolean;
21
+ a11y?: {
22
+ role?: 'dialog' | 'alertdialog';
23
+ ariaLabel?: string;
24
+ ariaLabelledby?: string;
25
+ ariaDescribedby?: string;
26
+ };
11
27
  }
12
28
 
13
29
  export type Settings = boolean | DialogConfig;
14
30
 
15
- export class Dialog extends BasePlugin {
31
+ type TemplateOptions = string | { title: string, description?: string };
16
32
 
33
+ export class Dialog extends BasePlugin {
17
34
  constructor(hotInstance: Core);
35
+
18
36
  isVisible(): boolean;
19
37
  show(config?: DialogConfig): void;
20
38
  hide(): void;
21
39
  update(config: DialogConfig): void;
40
+ showAlert(message?: TemplateOptions, callback?: (event: MouseEvent) => void): void;
41
+ showConfirm(message?: TemplateOptions, onOk?: (event: MouseEvent) => void, onCancel?: (event: MouseEvent) => void): void;
22
42
  focus(): void;
23
- }
43
+ }