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
@@ -0,0 +1,521 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.at.js";
3
+ import "core-js/modules/es.string.at-alternative.js";
4
+ import "core-js/modules/esnext.iterator.constructor.js";
5
+ import "core-js/modules/esnext.iterator.every.js";
6
+ import "core-js/modules/esnext.iterator.filter.js";
7
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
8
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
9
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
10
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
11
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
12
+ 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"); }
13
+ import { BasePlugin } from "../base/index.mjs";
14
+ import { EmptyDataStateUI } from "./ui.mjs";
15
+ import { isObject } from "../../helpers/object.mjs";
16
+ import * as C from "../../i18n/constants.mjs";
17
+ export const PLUGIN_KEY = 'emptyDataState';
18
+ export const PLUGIN_PRIORITY = 370;
19
+ export const EMPTY_DATA_STATE_CLASS_NAME = `ht-${PLUGIN_KEY}`;
20
+ const SOURCE = Object.freeze({
21
+ UNKNOWN: 'unknown',
22
+ FILTERS: 'filters'
23
+ });
24
+ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
25
+
26
+ /**
27
+ * @plugin EmptyDataState
28
+ * @class EmptyDataState
29
+ *
30
+ * @description
31
+ * The empty data state plugin provides a empty data state overlay system for Handsontable.
32
+ * It displays a empty data state overlay with customizable message.
33
+ *
34
+ * In order to enable the empty data state mechanism, {@link Options#emptyDataState} option must be set to `true`.
35
+ *
36
+ * The plugin provides several configuration options to customize the empty data state behavior and appearance:
37
+ * - `message`: Message to display in the empty data state overlay.
38
+ * - `title`: Title to display in the empty data state overlay.
39
+ * - `description`: Description to display in the empty data state overlay.
40
+ * - `buttons`: Buttons to display in the empty data state overlay.
41
+ * - `text`: Text to display in the button.
42
+ * - `type`: Type of the button.
43
+ * - `callback`: Callback function to call when the button is clicked.
44
+ *
45
+ * @example
46
+ * ::: only-for javascript
47
+ * ```javascript
48
+ * // Enable empty data state plugin with default messages
49
+ * emptyDataState: true,
50
+ *
51
+ * // Enable empty data state plugin with custom message
52
+ * emptyDataState: {
53
+ * message: 'No data available',
54
+ * },
55
+ *
56
+ * // Enable empty data state plugin with custom message and buttons for any source
57
+ * emptyDataState: {
58
+ * message: {
59
+ * title: 'No data available',
60
+ * description: 'There’s nothing to display yet.',
61
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
62
+ * },
63
+ * },
64
+ *
65
+ * // Enable empty data state plugin with custom message and buttons for specific source
66
+ * emptyDataState: {
67
+ * message: (source) => {
68
+ * switch (source) {
69
+ * case "filters":
70
+ * return {
71
+ * title: 'No data available',
72
+ * description: 'There’s nothing to display yet.',
73
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
74
+ * };
75
+ * default:
76
+ * return {
77
+ * title: 'No data available',
78
+ * description: 'There’s nothing to display yet.',
79
+ * };
80
+ * }
81
+ * },
82
+ * },
83
+ * ```
84
+ * :::
85
+ *
86
+ * ::: only-for react
87
+ * ```jsx
88
+ * // Enable empty data state plugin with default messages
89
+ * <HotTable emptyDataState={true} />;
90
+ *
91
+ * // Enable empty data state plugin with custom message
92
+ * <HotTable emptyDataState={{ message: 'No data available' }} />;
93
+ *
94
+ * // Enable empty data state plugin with custom message and buttons for any source
95
+ * <HotTable emptyDataState={{
96
+ * message: {
97
+ * title: 'No data available',
98
+ * description: 'There’s nothing to display yet.',
99
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
100
+ * }
101
+ * }} />;
102
+ *
103
+ * // Enable empty data state plugin with custom message and buttons for specific source
104
+ * <HotTable emptyDataState={{
105
+ * message: (source) => {
106
+ * switch (source) {
107
+ * case "filters":
108
+ * return {
109
+ * title: 'No data available',
110
+ * description: 'There’s nothing to display yet.',
111
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
112
+ * };
113
+ * default:
114
+ * return {
115
+ * title: 'No data available',
116
+ * description: 'There’s nothing to display yet.',
117
+ * };
118
+ * }
119
+ * }
120
+ * }} />;
121
+ * ```
122
+ * :::
123
+ *
124
+ * ::: only-for angular
125
+ * ```ts
126
+ * // Enable empty data state plugin with default messages
127
+ * hotSettings: Handsontable.GridSettings = {
128
+ * emptyDataState: true
129
+ * }
130
+ *
131
+ * // Enable empty data state plugin with custom message
132
+ * hotSettings: Handsontable.GridSettings = {
133
+ * emptyDataState: {
134
+ * message: 'No data available'
135
+ * }
136
+ * }
137
+ *
138
+ * // Enable empty data state plugin with custom message and buttons for any source
139
+ * hotSettings: Handsontable.GridSettings = {
140
+ * emptyDataState: {
141
+ * message: {
142
+ * title: 'No data available',
143
+ * description: 'There’s nothing to display yet.',
144
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
145
+ * },
146
+ * },
147
+ * },
148
+ *
149
+ * // Enable empty data state plugin with custom message and buttons for specific source
150
+ * hotSettings: Handsontable.GridSettings = {
151
+ * emptyDataState: {
152
+ * message: (source) => {
153
+ * switch (source) {
154
+ * case "filters":
155
+ * return {
156
+ * title: 'No data available for filters',
157
+ * description: 'There’s nothing to display yet.',
158
+ * buttons: [{ text: 'Reset filters', type: 'secondary', callback: () => {} }],
159
+ * };
160
+ * default:
161
+ * return {
162
+ * title: 'No data available',
163
+ * description: 'There’s nothing to display yet.',
164
+ * };
165
+ * }
166
+ * }
167
+ * }
168
+ * }
169
+ * ```
170
+ *
171
+ * ```html
172
+ * <hot-table [settings]="hotSettings"></hot-table>
173
+ * ```
174
+ * :::
175
+ */
176
+ var _isVisible = /*#__PURE__*/new WeakMap();
177
+ var _ui = /*#__PURE__*/new WeakMap();
178
+ var _observer = /*#__PURE__*/new WeakMap();
179
+ var _hasFilterConditions = /*#__PURE__*/new WeakMap();
180
+ var _selectionState = /*#__PURE__*/new WeakMap();
181
+ var _EmptyDataState_brand = /*#__PURE__*/new WeakSet();
182
+ export class EmptyDataState extends BasePlugin {
183
+ constructor() {
184
+ super(...arguments);
185
+ /**
186
+ * Registers the DOM listeners.
187
+ */
188
+ _classPrivateMethodInitSpec(this, _EmptyDataState_brand);
189
+ /**
190
+ * Flag indicating if emptyDataState is currently visible.
191
+ *
192
+ * @type {boolean}
193
+ */
194
+ _classPrivateFieldInitSpec(this, _isVisible, false);
195
+ /**
196
+ * UI instance of the emptyDataState plugin.
197
+ *
198
+ * @type {EmptyDataStateUI}
199
+ */
200
+ _classPrivateFieldInitSpec(this, _ui, null);
201
+ /**
202
+ * MutationObserver instance for monitoring DOM changes.
203
+ *
204
+ * @type {MutationObserver}
205
+ */
206
+ _classPrivateFieldInitSpec(this, _observer, null);
207
+ /**
208
+ * Flag indicating if there are filter conditions.
209
+ *
210
+ * @type {number}
211
+ */
212
+ _classPrivateFieldInitSpec(this, _hasFilterConditions, false);
213
+ /**
214
+ * Keeps the selection state that will be restored after the overlay is closed.
215
+ *
216
+ * @type {SelectionState | null}
217
+ */
218
+ _classPrivateFieldInitSpec(this, _selectionState, null);
219
+ }
220
+ static get PLUGIN_KEY() {
221
+ return PLUGIN_KEY;
222
+ }
223
+ static get PLUGIN_PRIORITY() {
224
+ return PLUGIN_PRIORITY;
225
+ }
226
+ static get DEFAULT_SETTINGS() {
227
+ return {
228
+ message: undefined
229
+ };
230
+ }
231
+ static get SETTINGS_VALIDATORS() {
232
+ return {
233
+ message: value => typeof value === 'string' || typeof value === 'function' || isObject(value) && (typeof (value === null || value === void 0 ? void 0 : value.title) === 'undefined' || typeof (value === null || value === void 0 ? void 0 : value.title) === 'string') && (typeof (value === null || value === void 0 ? void 0 : value.description) === 'undefined' || typeof (value === null || value === void 0 ? void 0 : value.description) === 'string') && (typeof (value === null || value === void 0 ? void 0 : value.buttons) === 'undefined' || Array.isArray(value === null || value === void 0 ? void 0 : value.buttons) && (value === null || value === void 0 ? void 0 : value.buttons.every(item => typeof item === 'object' && typeof item.text === 'string' && typeof item.type === 'string' && ['primary', 'secondary'].includes(item.type) && typeof item.callback === 'function'))) || value === undefined
234
+ };
235
+ }
236
+ /**
237
+ * Check if the plugin is enabled in the handsontable settings.
238
+ *
239
+ * @returns {boolean}
240
+ */
241
+ isEnabled() {
242
+ return !!this.hot.getSettings()[PLUGIN_KEY];
243
+ }
244
+
245
+ /**
246
+ * Enable plugin for this Handsontable instance.
247
+ */
248
+ enablePlugin() {
249
+ if (this.enabled) {
250
+ return;
251
+ }
252
+ if (!_classPrivateFieldGet(_ui, this)) {
253
+ _classPrivateFieldSet(_ui, this, new EmptyDataStateUI({
254
+ rootElement: this.hot.rootGridElement,
255
+ rootDocument: this.hot.rootDocument
256
+ }));
257
+ _assertClassBrand(_EmptyDataState_brand, this, _registerFocusScope).call(this);
258
+ _assertClassBrand(_EmptyDataState_brand, this, _registerEvents).call(this);
259
+ _assertClassBrand(_EmptyDataState_brand, this, _registerObservers).call(this);
260
+ }
261
+ this.addHook('afterInit', () => _assertClassBrand(_EmptyDataState_brand, this, _onAfterInit).call(this));
262
+ this.addHook('afterRender', () => _assertClassBrand(_EmptyDataState_brand, this, _onAfterRender).call(this));
263
+ this.addHook('afterRowSequenceCacheUpdate', () => _assertClassBrand(_EmptyDataState_brand, this, _toggleEmptyDataState).call(this));
264
+ this.addHook('afterColumnSequenceCacheUpdate', () => _assertClassBrand(_EmptyDataState_brand, this, _toggleEmptyDataState).call(this));
265
+ this.addHook('beforeFilter', conditions => _assertClassBrand(_EmptyDataState_brand, this, _onBeforeFilter).call(this, conditions));
266
+ super.enablePlugin();
267
+ }
268
+
269
+ /**
270
+ * Update plugin state after Handsontable settings update.
271
+ */
272
+ updatePlugin() {
273
+ this.disablePlugin();
274
+ this.enablePlugin();
275
+ _assertClassBrand(_EmptyDataState_brand, this, _update).call(this);
276
+ if (this.isVisible()) {
277
+ _classPrivateFieldGet(_ui, this).show();
278
+ }
279
+ super.updatePlugin();
280
+ }
281
+
282
+ /**
283
+ * Disable plugin for this Handsontable instance.
284
+ */
285
+ disablePlugin() {
286
+ _assertClassBrand(_EmptyDataState_brand, this, _unregisterFocusScope).call(this);
287
+ _assertClassBrand(_EmptyDataState_brand, this, _disconnectObservers).call(this);
288
+ _classPrivateFieldGet(_ui, this).destroy();
289
+ _classPrivateFieldSet(_ui, this, null);
290
+ super.disablePlugin();
291
+ }
292
+
293
+ /**
294
+ * Check if the plugin is currently visible.
295
+ *
296
+ * @returns {boolean}
297
+ */
298
+ isVisible() {
299
+ return _classPrivateFieldGet(_isVisible, this);
300
+ }
301
+ /**
302
+ * Destroy plugin instance.
303
+ */
304
+ destroy() {
305
+ var _classPrivateFieldGet2;
306
+ _classPrivateFieldSet(_isVisible, this, false);
307
+ (_classPrivateFieldGet2 = _classPrivateFieldGet(_ui, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.destroy();
308
+ _classPrivateFieldSet(_ui, this, null);
309
+ _classPrivateFieldSet(_observer, this, null);
310
+ _classPrivateFieldSet(_hasFilterConditions, this, false);
311
+ _classPrivateFieldSet(_selectionState, this, null);
312
+ super.destroy();
313
+ }
314
+ }
315
+ function _registerEvents() {
316
+ this.eventManager.addEventListener(_classPrivateFieldGet(_ui, this).getElement(), 'wheel', event => _assertClassBrand(_EmptyDataState_brand, this, _onMouseWheel).call(this, event));
317
+ }
318
+ /**
319
+ * Registers the mutation observers for the emptyDataState plugin.
320
+ */
321
+ function _registerObservers() {
322
+ // Observe the root element for changes and move the emptyDataState element to the correct position
323
+ _classPrivateFieldSet(_observer, this, new MutationObserver(() => {
324
+ if (!this.hot) {
325
+ return;
326
+ }
327
+ const element = _classPrivateFieldGet(_ui, this).getElement();
328
+ if (this.hot.rootGridElement.nextElementSibling !== element) {
329
+ this.hot.rootGridElement.after(element);
330
+ }
331
+ }));
332
+ _classPrivateFieldGet(_observer, this).observe(this.hot.rootWrapperElement, {
333
+ childList: true
334
+ });
335
+ }
336
+ /**
337
+ * Disconnects the mutation observers for the emptyDataState plugin.
338
+ */
339
+ function _disconnectObservers() {
340
+ _classPrivateFieldGet(_observer, this).disconnect();
341
+ _classPrivateFieldSet(_observer, this, null);
342
+ }
343
+ /**
344
+ * Registers the focus scope for the emptyDataState plugin.
345
+ */
346
+ function _registerFocusScope() {
347
+ this.hot.getFocusScopeManager().registerScope(PLUGIN_KEY, _classPrivateFieldGet(_ui, this).getElement(), {
348
+ shortcutsContextName: SHORTCUTS_CONTEXT_NAME,
349
+ runOnlyIf: () => this.isVisible(),
350
+ onActivate: focusSource => {
351
+ var _classPrivateFieldGet3;
352
+ const focusableElements = (_classPrivateFieldGet3 = _classPrivateFieldGet(_ui, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.getFocusableElements();
353
+ if (focusableElements.length > 0) {
354
+ if (focusSource === 'tab_from_above') {
355
+ focusableElements.at(0).focus();
356
+ } else if (focusSource === 'tab_from_below') {
357
+ focusableElements.at(-1).focus();
358
+ }
359
+ }
360
+ }
361
+ });
362
+ }
363
+ /**
364
+ * Unregisters the focus scope for the emptyDataState plugin.
365
+ */
366
+ function _unregisterFocusScope() {
367
+ this.hot.getFocusScopeManager().unregisterScope(PLUGIN_KEY);
368
+ }
369
+ /**
370
+ * Get the message by the source for the emptyDataState.
371
+ *
372
+ * @param {string} source - The source.
373
+ * @returns {object} The message.
374
+ */
375
+ function _getMessage(source) {
376
+ var _message, _message2, _message3;
377
+ let message;
378
+ if (typeof this.getSetting('message') === 'function') {
379
+ message = this.getSetting('message')(source);
380
+ } else {
381
+ message = this.getSetting('message');
382
+ }
383
+
384
+ // If the message is a string, set the title
385
+ if (typeof message === 'string') {
386
+ message = {
387
+ title: message
388
+ };
389
+ }
390
+
391
+ // If the message is not set, set the default message object
392
+ if (!((_message = message) !== null && _message !== void 0 && _message.title) && !((_message2 = message) !== null && _message2 !== void 0 && _message2.description) && !((_message3 = message) !== null && _message3 !== void 0 && _message3.buttons)) {
393
+ message = {};
394
+ if (source === SOURCE.FILTERS) {
395
+ message.title = this.hot.getTranslatedPhrase(C.EMPTY_DATA_STATE_TITLE_FILTERS);
396
+ message.description = this.hot.getTranslatedPhrase(C.EMPTY_DATA_STATE_DESCRIPTION_FILTERS);
397
+ message.buttons = [{
398
+ text: this.hot.getTranslatedPhrase(C.EMPTY_DATA_STATE_BUTTONS_FILTERS_RESET),
399
+ type: 'secondary',
400
+ callback: () => {
401
+ const filtersPlugin = this.hot.getPlugin('filters');
402
+ if (filtersPlugin) {
403
+ filtersPlugin.clearConditions();
404
+ filtersPlugin.filter();
405
+ }
406
+ }
407
+ }];
408
+ } else {
409
+ message.title = this.hot.getTranslatedPhrase(C.EMPTY_DATA_STATE_TITLE);
410
+ message.description = this.hot.getTranslatedPhrase(C.EMPTY_DATA_STATE_DESCRIPTION);
411
+ }
412
+ }
413
+ return message;
414
+ }
415
+ /**
416
+ * Toggle visibility and content of the emptyDataState.
417
+ *
418
+ * Shows emptyDataState when table has no data or when all data is hidden by filters.
419
+ *
420
+ */
421
+ function _toggleEmptyDataState() {
422
+ if (!this.hot.view) {
423
+ return;
424
+ }
425
+ if (this.hot.view.countRenderableColumns() === 0 || this.hot.view.countRenderableRows() === 0) {
426
+ _assertClassBrand(_EmptyDataState_brand, this, _show).call(this);
427
+ } else {
428
+ _assertClassBrand(_EmptyDataState_brand, this, _hide).call(this);
429
+ }
430
+ }
431
+ /**
432
+ * Shows the emptyDataState overlay.
433
+ */
434
+ function _show() {
435
+ if (_classPrivateFieldGet(_isVisible, this)) {
436
+ return;
437
+ }
438
+ this.hot.runHooks('beforeEmptyDataStateShow');
439
+ _assertClassBrand(_EmptyDataState_brand, this, _update).call(this);
440
+ _classPrivateFieldGet(_ui, this).show();
441
+ _classPrivateFieldSet(_isVisible, this, true);
442
+ _classPrivateFieldSet(_selectionState, this, this.hot.selection.exportSelection());
443
+ this.hot.getFocusScopeManager().activateScope(PLUGIN_KEY);
444
+ this.hot.runHooks('afterEmptyDataStateShow');
445
+ }
446
+ /**
447
+ * Updates the content of the emptyDataState overlay.
448
+ */
449
+ function _update() {
450
+ if (_classPrivateFieldGet(_hasFilterConditions, this)) {
451
+ _classPrivateFieldGet(_ui, this).updateContent(_assertClassBrand(_EmptyDataState_brand, this, _getMessage).call(this, SOURCE.FILTERS));
452
+ } else {
453
+ _classPrivateFieldGet(_ui, this).updateContent(_assertClassBrand(_EmptyDataState_brand, this, _getMessage).call(this, SOURCE.UNKNOWN));
454
+ }
455
+ }
456
+ /**
457
+ * Hides the emptyDataState overlay.
458
+ */
459
+ function _hide() {
460
+ var _classPrivateFieldGet4;
461
+ if (!_classPrivateFieldGet(_isVisible, this)) {
462
+ return;
463
+ }
464
+ this.hot.runHooks('beforeEmptyDataStateHide');
465
+ _classPrivateFieldGet(_ui, this).hide();
466
+ _classPrivateFieldSet(_isVisible, this, false);
467
+ this.hot.getFocusScopeManager().deactivateScope(PLUGIN_KEY);
468
+ if (((_classPrivateFieldGet4 = _classPrivateFieldGet(_selectionState, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.ranges.length) > 0) {
469
+ this.hot.selection.importSelection(_classPrivateFieldGet(_selectionState, this));
470
+ this.hot.view.render();
471
+ _classPrivateFieldSet(_selectionState, this, null);
472
+ } else {
473
+ this.hot.selectCell(0, 0);
474
+ }
475
+ this.hot.runHooks('afterEmptyDataStateHide');
476
+ }
477
+ /**
478
+ * Handles the mouse wheel event.
479
+ *
480
+ * @param {WheelEvent} event - The wheel event.
481
+ */
482
+ function _onMouseWheel(event) {
483
+ const deltaX = Number.isNaN(event.deltaX) ? -1 * event.wheelDeltaX : event.deltaX;
484
+ if (deltaX !== 0 && this.hot.view.hasHorizontalScroll() && !this.hot.view.isHorizontallyScrollableByWindow()) {
485
+ this.hot.view.setTableScrollPosition({
486
+ left: this.hot.view.getTableScrollPosition().left + deltaX
487
+ });
488
+ event.preventDefault();
489
+ }
490
+ }
491
+ /**
492
+ * Called after the initialization of the table is completed.
493
+ * It toggles the emptyDataState.
494
+ */
495
+ function _onAfterInit() {
496
+ _assertClassBrand(_EmptyDataState_brand, this, _toggleEmptyDataState).call(this);
497
+ this.hot.render();
498
+ }
499
+ /**
500
+ * Called after the rendering of the table is completed.
501
+ * It updates the height and class names of the emptyDataState element.
502
+ */
503
+ function _onAfterRender() {
504
+ var _classPrivateFieldGet5;
505
+ if ((_classPrivateFieldGet5 = _classPrivateFieldGet(_ui, this)) !== null && _classPrivateFieldGet5 !== void 0 && _classPrivateFieldGet5.getElement() && this.isVisible()) {
506
+ _classPrivateFieldGet(_ui, this).updateSize(this.hot.view);
507
+ _classPrivateFieldGet(_ui, this).updateClassNames(this.hot.view);
508
+ }
509
+ }
510
+ /**
511
+ * Called before the filtering of the table is completed.
512
+ * It updates the flag indicating if there are filter conditions.
513
+ *
514
+ * @param {Array} conditions - The filter conditions.
515
+ */
516
+ function _onBeforeFilter(conditions) {
517
+ _classPrivateFieldSet(_hasFilterConditions, this, (conditions === null || conditions === void 0 ? void 0 : conditions.length) > 0);
518
+ if (this.isVisible()) {
519
+ _assertClassBrand(_EmptyDataState_brand, this, _update).call(this);
520
+ }
521
+ }
@@ -0,0 +1 @@
1
+ export * from './emptyDataState';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _emptyDataState = require("./emptyDataState");
5
+ exports.PLUGIN_KEY = _emptyDataState.PLUGIN_KEY;
6
+ exports.PLUGIN_PRIORITY = _emptyDataState.PLUGIN_PRIORITY;
7
+ exports.EmptyDataState = _emptyDataState.EmptyDataState;
@@ -0,0 +1 @@
1
+ export { PLUGIN_KEY, PLUGIN_PRIORITY, EmptyDataState } from "./emptyDataState.mjs";