@revolist/revogrid 4.9.9 → 4.9.11

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 (193) hide show
  1. package/dist/cjs/column.drag.plugin-e636b5af.js +1686 -0
  2. package/dist/cjs/column.drag.plugin-e636b5af.js.map +1 -0
  3. package/dist/cjs/{column.service-bfaba0e0.js → column.service-15c8352d.js} +443 -56
  4. package/dist/cjs/column.service-15c8352d.js.map +1 -0
  5. package/dist/cjs/{toNumber-838e6ff5.js → debounce-cb5f4e35.js} +229 -12
  6. package/dist/cjs/debounce-cb5f4e35.js.map +1 -0
  7. package/dist/cjs/{edit.utils-983f1a82.js → edit.utils-1172677c.js} +2 -2
  8. package/dist/cjs/{edit.utils-983f1a82.js.map → edit.utils-1172677c.js.map} +1 -1
  9. package/dist/cjs/{header-cell-renderer-53e4fd75.js → header-cell-renderer-375a879f.js} +42 -4
  10. package/dist/cjs/header-cell-renderer-375a879f.js.map +1 -0
  11. package/dist/cjs/{index-464d1aaf.js → index-28b6fdfb.js} +31 -31
  12. package/dist/cjs/{index-464d1aaf.js.map → index-28b6fdfb.js.map} +1 -1
  13. package/dist/cjs/index.cjs.js +39 -28
  14. package/dist/cjs/index.cjs.js.map +1 -1
  15. package/dist/cjs/{key.utils-12715159.js → key.utils-c62ab1e1.js} +2 -12
  16. package/dist/cjs/key.utils-c62ab1e1.js.map +1 -0
  17. package/dist/cjs/revo-grid.cjs.entry.js +704 -2034
  18. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  19. package/dist/cjs/revogr-attribution_6.cjs.entry.js +17 -18
  20. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  21. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +6 -77
  22. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  23. package/dist/cjs/revogr-data_4.cjs.entry.js +117 -123
  24. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  25. package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -2
  26. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  27. package/dist/cjs/{row-header-utils-e71dc7bf.js → row-header-utils-22ffee54.js} +2 -2
  28. package/dist/cjs/{row-header-utils-e71dc7bf.js.map → row-header-utils-22ffee54.js.map} +1 -1
  29. package/dist/cjs/sorting.sign-8bf92449.js +19 -0
  30. package/dist/cjs/sorting.sign-8bf92449.js.map +1 -0
  31. package/dist/cjs/text-editor-91a9f5b5.js +82 -0
  32. package/dist/cjs/text-editor-91a9f5b5.js.map +1 -0
  33. package/dist/cjs/{throttle-c893457e.js → throttle-5da5df51.js} +4 -5
  34. package/dist/cjs/throttle-5da5df51.js.map +1 -0
  35. package/dist/cjs/viewport.helpers-e59a544e.js +58 -0
  36. package/dist/cjs/viewport.helpers-e59a544e.js.map +1 -0
  37. package/dist/collection/components/editors/text-editor.js.map +1 -1
  38. package/dist/collection/components/header/revogr-header.js +1 -1
  39. package/dist/collection/components/overlay/keyboard.service.js +2 -2
  40. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  41. package/dist/collection/components/revoGrid/revo-grid-style.css +6 -0
  42. package/dist/collection/index.js +2 -2
  43. package/dist/collection/index.js.map +1 -1
  44. package/dist/collection/plugins/index.js +16 -0
  45. package/dist/collection/plugins/index.js.map +1 -0
  46. package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
  47. package/dist/collection/types/selection.js.map +1 -1
  48. package/dist/collection/utils/key.utils.js +0 -9
  49. package/dist/collection/utils/key.utils.js.map +1 -1
  50. package/dist/esm/column.drag.plugin-30dc4e24.js +1665 -0
  51. package/dist/esm/column.drag.plugin-30dc4e24.js.map +1 -0
  52. package/dist/esm/{column.service-6f1faf2d.js → column.service-414e9cba.js} +435 -51
  53. package/dist/esm/column.service-414e9cba.js.map +1 -0
  54. package/dist/esm/{toNumber-8de324a7.js → debounce-e8e9464a.js} +229 -13
  55. package/dist/esm/debounce-e8e9464a.js.map +1 -0
  56. package/dist/esm/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
  57. package/dist/esm/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +1 -1
  58. package/dist/esm/{header-cell-renderer-66d01daa.js → header-cell-renderer-ca570fcf.js} +40 -4
  59. package/dist/esm/header-cell-renderer-ca570fcf.js.map +1 -0
  60. package/dist/esm/{index-c428acf6.js → index-74b9801b.js} +3 -3
  61. package/dist/esm/{index-c428acf6.js.map → index-74b9801b.js.map} +1 -1
  62. package/dist/esm/index.js +10 -7
  63. package/dist/esm/index.js.map +1 -1
  64. package/dist/esm/{key.utils-b1f93f7e.js → key.utils-d3df5db8.js} +3 -12
  65. package/dist/esm/key.utils-d3df5db8.js.map +1 -0
  66. package/dist/esm/revo-grid.entry.js +675 -2005
  67. package/dist/esm/revo-grid.entry.js.map +1 -1
  68. package/dist/esm/revogr-attribution_6.entry.js +9 -10
  69. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  70. package/dist/esm/revogr-clipboard_3.entry.js +5 -76
  71. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  72. package/dist/esm/revogr-data_4.entry.js +50 -56
  73. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  74. package/dist/esm/revogr-filter-panel.entry.js +1 -2
  75. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  76. package/dist/esm/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
  77. package/dist/esm/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +1 -1
  78. package/dist/esm/sorting.sign-1afddea1.js +15 -0
  79. package/dist/esm/sorting.sign-1afddea1.js.map +1 -0
  80. package/dist/esm/text-editor-96d69516.js +80 -0
  81. package/dist/esm/text-editor-96d69516.js.map +1 -0
  82. package/dist/esm/{throttle-f9cda5b0.js → throttle-262c3ed2.js} +3 -4
  83. package/dist/esm/throttle-262c3ed2.js.map +1 -0
  84. package/dist/esm/viewport.helpers-7e7f9dad.js +52 -0
  85. package/dist/esm/viewport.helpers-7e7f9dad.js.map +1 -0
  86. package/dist/revo-grid/column.drag.plugin-30dc4e24.js +5 -0
  87. package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +1 -0
  88. package/dist/revo-grid/column.service-414e9cba.js +5 -0
  89. package/dist/revo-grid/column.service-414e9cba.js.map +1 -0
  90. package/dist/revo-grid/debounce-e8e9464a.js +5 -0
  91. package/dist/revo-grid/debounce-e8e9464a.js.map +1 -0
  92. package/dist/revo-grid/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
  93. package/dist/revo-grid/header-cell-renderer-ca570fcf.js +5 -0
  94. package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +1 -0
  95. package/dist/revo-grid/{index-c428acf6.js → index-74b9801b.js} +2 -2
  96. package/dist/revo-grid/index.esm.js +1 -1
  97. package/dist/revo-grid/key.utils-d3df5db8.js +5 -0
  98. package/dist/revo-grid/key.utils-d3df5db8.js.map +1 -0
  99. package/dist/revo-grid/revo-grid.entry.js +1 -1
  100. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  101. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  102. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  103. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  104. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  105. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  106. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  107. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  108. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  109. package/dist/revo-grid/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
  110. package/dist/revo-grid/sorting.sign-1afddea1.js +5 -0
  111. package/dist/revo-grid/sorting.sign-1afddea1.js.map +1 -0
  112. package/dist/revo-grid/text-editor-96d69516.js +5 -0
  113. package/dist/revo-grid/text-editor-96d69516.js.map +1 -0
  114. package/dist/revo-grid/throttle-262c3ed2.js +5 -0
  115. package/dist/revo-grid/{throttle-f9cda5b0.js.map → throttle-262c3ed2.js.map} +1 -1
  116. package/dist/revo-grid/viewport.helpers-7e7f9dad.js +5 -0
  117. package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -0
  118. package/dist/types/components/editors/text-editor.d.ts +2 -2
  119. package/dist/types/index.d.ts +2 -2
  120. package/dist/types/plugins/index.d.ts +12 -0
  121. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +1 -13
  122. package/dist/types/types/selection.d.ts +1 -1
  123. package/dist/types/utils/key.utils.d.ts +0 -1
  124. package/hydrate/index.js +2 -11
  125. package/hydrate/index.mjs +2 -11
  126. package/package.json +1 -1
  127. package/standalone/_stringToPath.js +1 -1
  128. package/standalone/column.service.js +1 -1
  129. package/standalone/data.store.js +2 -2
  130. package/standalone/debounce.js +1 -1
  131. package/standalone/dimension.helpers.js +1 -1
  132. package/standalone/index.js +7 -5
  133. package/standalone/index.js.map +1 -1
  134. package/standalone/isObjectLike.js +1 -1
  135. package/standalone/revo-grid.js +1948 -1948
  136. package/standalone/revo-grid.js.map +1 -1
  137. package/standalone/revogr-edit.js +1 -1
  138. package/standalone/revogr-edit2.js +1 -10
  139. package/standalone/revogr-edit2.js.map +1 -1
  140. package/standalone/revogr-header.js +1 -1
  141. package/standalone/revogr-header2.js +54 -52
  142. package/standalone/revogr-header2.js.map +1 -1
  143. package/standalone/revogr-overlay-selection2.js +2 -2
  144. package/standalone/revogr-overlay-selection2.js.map +1 -1
  145. package/standalone/revogr-row-headers2.js +1 -1
  146. package/standalone/throttle.js +1 -1
  147. package/standalone/toNumber.js +1 -1
  148. package/dist/cjs/column.service-bfaba0e0.js.map +0 -1
  149. package/dist/cjs/column.utils-4a450d27.js +0 -345
  150. package/dist/cjs/column.utils-4a450d27.js.map +0 -1
  151. package/dist/cjs/debounce-e2b7c6fb.js +0 -226
  152. package/dist/cjs/debounce-e2b7c6fb.js.map +0 -1
  153. package/dist/cjs/dispatcher-998aa470.js +0 -46
  154. package/dist/cjs/dispatcher-998aa470.js.map +0 -1
  155. package/dist/cjs/header-cell-renderer-53e4fd75.js.map +0 -1
  156. package/dist/cjs/key.utils-12715159.js.map +0 -1
  157. package/dist/cjs/selection.helpers-2c90d546.js +0 -450
  158. package/dist/cjs/selection.helpers-2c90d546.js.map +0 -1
  159. package/dist/cjs/throttle-c893457e.js.map +0 -1
  160. package/dist/cjs/toNumber-838e6ff5.js.map +0 -1
  161. package/dist/esm/column.service-6f1faf2d.js.map +0 -1
  162. package/dist/esm/column.utils-1a402ff9.js +0 -333
  163. package/dist/esm/column.utils-1a402ff9.js.map +0 -1
  164. package/dist/esm/debounce-7781346d.js +0 -224
  165. package/dist/esm/debounce-7781346d.js.map +0 -1
  166. package/dist/esm/dispatcher-ea08404f.js +0 -43
  167. package/dist/esm/dispatcher-ea08404f.js.map +0 -1
  168. package/dist/esm/header-cell-renderer-66d01daa.js.map +0 -1
  169. package/dist/esm/key.utils-b1f93f7e.js.map +0 -1
  170. package/dist/esm/selection.helpers-ac4368b0.js +0 -441
  171. package/dist/esm/selection.helpers-ac4368b0.js.map +0 -1
  172. package/dist/esm/throttle-f9cda5b0.js.map +0 -1
  173. package/dist/esm/toNumber-8de324a7.js.map +0 -1
  174. package/dist/revo-grid/column.service-6f1faf2d.js +0 -5
  175. package/dist/revo-grid/column.service-6f1faf2d.js.map +0 -1
  176. package/dist/revo-grid/column.utils-1a402ff9.js +0 -5
  177. package/dist/revo-grid/column.utils-1a402ff9.js.map +0 -1
  178. package/dist/revo-grid/debounce-7781346d.js +0 -5
  179. package/dist/revo-grid/debounce-7781346d.js.map +0 -1
  180. package/dist/revo-grid/dispatcher-ea08404f.js +0 -5
  181. package/dist/revo-grid/dispatcher-ea08404f.js.map +0 -1
  182. package/dist/revo-grid/header-cell-renderer-66d01daa.js +0 -5
  183. package/dist/revo-grid/header-cell-renderer-66d01daa.js.map +0 -1
  184. package/dist/revo-grid/key.utils-b1f93f7e.js +0 -5
  185. package/dist/revo-grid/key.utils-b1f93f7e.js.map +0 -1
  186. package/dist/revo-grid/selection.helpers-ac4368b0.js +0 -5
  187. package/dist/revo-grid/selection.helpers-ac4368b0.js.map +0 -1
  188. package/dist/revo-grid/throttle-f9cda5b0.js +0 -5
  189. package/dist/revo-grid/toNumber-8de324a7.js +0 -5
  190. package/dist/revo-grid/toNumber-8de324a7.js.map +0 -1
  191. /package/dist/revo-grid/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +0 -0
  192. /package/dist/revo-grid/{index-c428acf6.js.map → index-74b9801b.js.map} +0 -0
  193. /package/dist/revo-grid/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +0 -0
@@ -3,10 +3,440 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const index = require('./index-464d1aaf.js');
7
- require('./toNumber-838e6ff5.js');
6
+ const index = require('./index-28b6fdfb.js');
7
+ require('./debounce-cb5f4e35.js');
8
8
  require('./index-10d10c55.js');
9
- const selection_helpers = require('./selection.helpers-2c90d546.js');
9
+
10
+ /**
11
+ * Selection store
12
+ */
13
+ function defaultState() {
14
+ return {
15
+ range: null,
16
+ tempRange: null,
17
+ tempRangeType: null,
18
+ focus: null,
19
+ edit: null,
20
+ lastCell: null,
21
+ nextFocus: null,
22
+ };
23
+ }
24
+ class SelectionStore {
25
+ constructor() {
26
+ this.unsubscribe = [];
27
+ this.store = index.createStore(defaultState());
28
+ this.store.on('set', (key, newVal) => {
29
+ if (key === 'tempRange' && !newVal) {
30
+ this.store.set('tempRangeType', null);
31
+ }
32
+ });
33
+ }
34
+ onChange(propName, cb) {
35
+ this.unsubscribe.push(this.store.onChange(propName, cb));
36
+ }
37
+ clearFocus() {
38
+ index.setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
39
+ }
40
+ setFocus(focus, end) {
41
+ if (!end) {
42
+ index.setStore(this.store, { focus });
43
+ }
44
+ else {
45
+ index.setStore(this.store, {
46
+ focus,
47
+ range: getRange(focus, end),
48
+ edit: null,
49
+ tempRange: null,
50
+ });
51
+ }
52
+ }
53
+ setNextFocus(focus) {
54
+ index.setStore(this.store, { nextFocus: focus });
55
+ }
56
+ setTempArea(range) {
57
+ index.setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
58
+ }
59
+ clearTemp() {
60
+ index.setStore(this.store, { tempRange: null });
61
+ }
62
+ /** Can be applied from selection change or from simple keyboard change clicks */
63
+ setRangeArea(range) {
64
+ index.setStore(this.store, { range, edit: null, tempRange: null });
65
+ }
66
+ setRange(start, end) {
67
+ const range = getRange(start, end);
68
+ this.setRangeArea(range);
69
+ }
70
+ setLastCell(lastCell) {
71
+ index.setStore(this.store, { lastCell });
72
+ }
73
+ setEdit(val) {
74
+ const focus = this.store.get('focus');
75
+ if (focus && typeof val === 'string') {
76
+ index.setStore(this.store, {
77
+ edit: { x: focus.x, y: focus.y, val },
78
+ });
79
+ return;
80
+ }
81
+ index.setStore(this.store, { edit: null });
82
+ }
83
+ dispose() {
84
+ this.unsubscribe.forEach(f => f());
85
+ this.store.dispose();
86
+ }
87
+ }
88
+
89
+ const EMPTY_INDEX = -1;
90
+ class SelectionStoreConnector {
91
+ constructor() {
92
+ // dirty flag required to cleanup whole store in case visibility of panels changed
93
+ this.dirty = false;
94
+ this.stores = {};
95
+ this.columnStores = {};
96
+ this.rowStores = {};
97
+ /**
98
+ * Helpers for data conversion
99
+ */
100
+ this.storesByType = {};
101
+ this.storesXToType = {};
102
+ this.storesYToType = {};
103
+ this.sections = [];
104
+ }
105
+ get focusedStore() {
106
+ var _a;
107
+ for (let y in this.stores) {
108
+ for (let x in this.stores[y]) {
109
+ const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
110
+ if (focused) {
111
+ return {
112
+ entity: this.stores[y][x],
113
+ cell: focused,
114
+ position: {
115
+ x: parseInt(x, 10),
116
+ y: parseInt(y, 10),
117
+ },
118
+ };
119
+ }
120
+ }
121
+ }
122
+ return null;
123
+ }
124
+ get edit() {
125
+ var _a;
126
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
127
+ }
128
+ get focused() {
129
+ var _a;
130
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
131
+ }
132
+ get selectedRange() {
133
+ var _a;
134
+ return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
135
+ }
136
+ registerSection(e) {
137
+ if (!e) {
138
+ this.sections.length = 0;
139
+ // some elements removed, rebuild stores
140
+ this.dirty = true;
141
+ return;
142
+ }
143
+ if (this.sections.indexOf(e) === -1) {
144
+ this.sections.push(e);
145
+ }
146
+ }
147
+ // check if require to cleanup all stores
148
+ beforeUpdate() {
149
+ if (this.dirty) {
150
+ for (let y in this.stores) {
151
+ for (let x in this.stores[y]) {
152
+ this.stores[y][x].dispose();
153
+ }
154
+ }
155
+ this.dirty = false;
156
+ }
157
+ }
158
+ registerColumn(x, type) {
159
+ // if hidden just create store but no operations needed
160
+ if (isHiddenStore(x)) {
161
+ return new SelectionStore();
162
+ }
163
+ if (this.columnStores[x]) {
164
+ return this.columnStores[x];
165
+ }
166
+ this.columnStores[x] = new SelectionStore();
167
+ // build cross-linking type to position
168
+ this.storesByType[type] = x;
169
+ this.storesXToType[x] = type;
170
+ return this.columnStores[x];
171
+ }
172
+ registerRow(y, type) {
173
+ // if hidden just create store
174
+ if (isHiddenStore(y)) {
175
+ return new SelectionStore();
176
+ }
177
+ if (this.rowStores[y]) {
178
+ return this.rowStores[y];
179
+ }
180
+ this.rowStores[y] = new SelectionStore();
181
+ // build cross linking type to position
182
+ this.storesByType[type] = y;
183
+ this.storesYToType[y] = type;
184
+ return this.rowStores[y];
185
+ }
186
+ /**
187
+ * Cross store proxy, based on multiple dimensions
188
+ */
189
+ register({ x, y }) {
190
+ var _a, _b;
191
+ // if hidden just create store
192
+ if (isHiddenStore(x) || isHiddenStore(y)) {
193
+ return new SelectionStore();
194
+ }
195
+ if (!this.stores[y]) {
196
+ this.stores[y] = {};
197
+ }
198
+ if (this.stores[y][x]) {
199
+ // Store already registered. Do not register twice
200
+ return this.stores[y][x];
201
+ }
202
+ this.stores[y][x] = new SelectionStore();
203
+ // proxy update, column store trigger only range area
204
+ (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
205
+ this.columnStores[x].setRangeArea(c);
206
+ this.rowStores[y].setRangeArea(c);
207
+ });
208
+ // clean up on remove
209
+ (_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
210
+ return this.stores[y][x];
211
+ }
212
+ destroy(x, y) {
213
+ var _a, _b;
214
+ (_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
215
+ (_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
216
+ delete this.rowStores[y];
217
+ delete this.columnStores[x];
218
+ // clear x cross-link
219
+ if (this.storesXToType[x]) {
220
+ const type = this.storesXToType[x];
221
+ delete this.storesXToType[x];
222
+ delete this.storesByType[type];
223
+ }
224
+ // clear y cross-link
225
+ if (this.storesYToType[y]) {
226
+ const type = this.storesYToType[y];
227
+ delete this.storesYToType[y];
228
+ delete this.storesByType[type];
229
+ }
230
+ if (this.stores[y]) {
231
+ delete this.stores[y][x];
232
+ }
233
+ // clear empty rows
234
+ if (!Object.keys(this.stores[y] || {}).length) {
235
+ delete this.stores[y];
236
+ }
237
+ }
238
+ setEditByCell(storePos, editCell) {
239
+ this.focusByCell(storePos, editCell, editCell);
240
+ this.setEdit('');
241
+ }
242
+ /**
243
+ * Sets the next focus cell before the current one.
244
+ *
245
+ * @param focus - The cell to set as the next focus.
246
+ */
247
+ beforeNextFocusCell(focus) {
248
+ var _a;
249
+ // If there is no focused store, return early.
250
+ if (!this.focusedStore) {
251
+ return;
252
+ }
253
+ // Get the next store based on the current focus and the last cell.
254
+ const lastCell = this.focusedStore.entity.store.get('lastCell');
255
+ const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
256
+ // Set the next focus cell in the store.
257
+ (_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
258
+ }
259
+ focusByCell(storePos, start, end) {
260
+ const store = this.stores[storePos.y][storePos.x];
261
+ this.focus(store, { focus: start, end });
262
+ }
263
+ focus(store, { focus, end }) {
264
+ const currentStorePointer = this.getCurrentStorePointer(store);
265
+ if (!currentStorePointer) {
266
+ return null;
267
+ }
268
+ // check for the focus in nearby store/viewport
269
+ const lastCell = store.store.get('lastCell');
270
+ const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
271
+ // if next store present - update
272
+ if (next === null || next === void 0 ? void 0 : next.store) {
273
+ const item = Object.assign(Object.assign({}, focus), next.item);
274
+ this.focus(next.store, { focus: item, end: item });
275
+ return null;
276
+ }
277
+ if (lastCell) {
278
+ focus = cropCellToMax(focus, lastCell);
279
+ end = cropCellToMax(end, lastCell);
280
+ }
281
+ store.setFocus(focus, end);
282
+ return focus;
283
+ }
284
+ /**
285
+ * Retrieves the current store pointer based on the active store.
286
+ * Clears focus from all stores except the active one.
287
+ */
288
+ getCurrentStorePointer(store) {
289
+ let currentStorePointer;
290
+ // Iterate through all stores
291
+ for (let y in this.stores) {
292
+ for (let x in this.stores[y]) {
293
+ const s = this.stores[y][x];
294
+ // Clear focus from stores other than the active one
295
+ if (s !== store) {
296
+ s.clearFocus();
297
+ }
298
+ else {
299
+ // Update the current store pointer with the active store coordinates
300
+ currentStorePointer = {
301
+ x: parseInt(x, 10),
302
+ y: parseInt(y, 10)
303
+ };
304
+ }
305
+ }
306
+ }
307
+ return currentStorePointer;
308
+ }
309
+ /**
310
+ * Retrieves the next store based on the focus cell and current store pointer.
311
+ * If the next store exists, returns an object with the next store and the item in the new store.
312
+ * If the next store does not exist, returns null.
313
+ */
314
+ getNextStore(focus, currentStorePointer, lastCell) {
315
+ // item in new store
316
+ const nextItem = nextCell(focus, lastCell);
317
+ let nextStore;
318
+ if (nextItem) {
319
+ Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
320
+ let stores;
321
+ switch (type) {
322
+ case 'x':
323
+ // Get the X stores for the current Y coordinate of the current store pointer
324
+ stores = this.getXStores(currentStorePointer.y);
325
+ break;
326
+ case 'y':
327
+ // Get the Y stores for the current X coordinate of the current store pointer
328
+ stores = this.getYStores(currentStorePointer.x);
329
+ break;
330
+ }
331
+ // Get the next store based on the item in the new store
332
+ if (nextItemCoord >= 0) {
333
+ nextStore = stores[++currentStorePointer[type]];
334
+ }
335
+ else {
336
+ nextStore = stores[--currentStorePointer[type]];
337
+ const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
338
+ if (nextLastCell) {
339
+ nextItem[type] = nextLastCell[type] + nextItemCoord;
340
+ }
341
+ }
342
+ });
343
+ }
344
+ return {
345
+ store: nextStore,
346
+ item: nextItem,
347
+ };
348
+ }
349
+ clearAll() {
350
+ var _a;
351
+ for (let y in this.stores) {
352
+ for (let x in this.stores[y]) {
353
+ (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
354
+ }
355
+ }
356
+ }
357
+ setEdit(val) {
358
+ if (!this.focusedStore) {
359
+ return;
360
+ }
361
+ this.focusedStore.entity.setEdit(val);
362
+ }
363
+ /**
364
+ * Select all cells across all stores
365
+ */
366
+ selectAll() {
367
+ for (let y in this.stores) {
368
+ for (let x in this.stores[y]) {
369
+ const store = this.stores[y][x];
370
+ if (!store) {
371
+ continue;
372
+ }
373
+ const lastCell = store.store.get('lastCell');
374
+ if (lastCell) {
375
+ store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
376
+ }
377
+ }
378
+ }
379
+ }
380
+ getXStores(y) {
381
+ return this.stores[y];
382
+ }
383
+ getYStores(x) {
384
+ const stores = {};
385
+ for (let i in this.stores) {
386
+ stores[i] = this.stores[i][x];
387
+ }
388
+ return stores;
389
+ }
390
+ }
391
+
392
+ function isHiddenStore(pos) {
393
+ return pos === EMPTY_INDEX;
394
+ }
395
+ function nextCell(cell, lastCell) {
396
+ const nextItem = {};
397
+ let types = ['x', 'y'];
398
+ // previous item check
399
+ for (let t of types) {
400
+ if (cell[t] < 0) {
401
+ nextItem[t] = cell[t];
402
+ return nextItem;
403
+ }
404
+ }
405
+ // next item check
406
+ for (let t of types) {
407
+ if (cell[t] >= lastCell[t]) {
408
+ nextItem[t] = cell[t] - lastCell[t];
409
+ return nextItem;
410
+ }
411
+ }
412
+ return null;
413
+ }
414
+ function cropCellToMax(cell, lastCell) {
415
+ const croppedCell = Object.assign({}, cell);
416
+ const cellCoordinates = ['x', 'y'];
417
+ for (const coordinate of cellCoordinates) {
418
+ if (cell[coordinate] < 0) {
419
+ croppedCell[coordinate] = 0;
420
+ }
421
+ else if (cell[coordinate] >= lastCell[coordinate]) {
422
+ croppedCell[coordinate] = lastCell[coordinate] - 1;
423
+ }
424
+ }
425
+ return croppedCell;
426
+ }
427
+ function getRange(start, end) {
428
+ return start && end
429
+ ? {
430
+ x: Math.min(start.x, end.x),
431
+ y: Math.min(start.y, end.y),
432
+ x1: Math.max(start.x, end.x),
433
+ y1: Math.max(start.y, end.y),
434
+ }
435
+ : null;
436
+ }
437
+ function isRangeSingleCell(a) {
438
+ return a.x === a.x1 && a.y === a.y1;
439
+ }
10
440
 
11
441
  const GROUP_DEPTH = `${index.GRID_INTERNALS}-depth`;
12
442
  const PSEUDO_GROUP_ITEM = `${index.GRID_INTERNALS}-name`;
@@ -140,52 +570,6 @@ function isSameGroup(currentGroup, currentModel, nextModel) {
140
570
  return currentModel[GROUP_DEPTH] < depth;
141
571
  }
142
572
 
143
- /**
144
- * Collects data for pinned columns in the required @ViewportProps format.
145
- */
146
- /**
147
- * Represents the slot names for the viewport slots.
148
- */
149
- const HEADER_SLOT = 'header'; // Slot name for the header slot
150
- const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
151
- const CONTENT_SLOT = 'content'; // Slot name for the content slot
152
- const DATA_SLOT = 'data'; // Slot name for the data slot
153
- /**
154
- * Returns the last visible cell in the viewport for a given row type.
155
- * Coordinates are not zero-based and are relative to the viewport.
156
- * If needed to be zero-based they can be adjusted by subtracting 1.
157
- */
158
- function getLastCell(data, rowType) {
159
- // Get the last visible column count from the viewport column data.
160
- const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
161
- // Get the last visible row count for the given row type from the viewport column data.
162
- const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
163
- // Return the last visible cell with the last visible column count and row count.
164
- return {
165
- x: lastVisibleColumnCount,
166
- y: lastVisibleRowCount,
167
- };
168
- }
169
- function viewportDataPartition(data, type, slot, fixed) {
170
- return {
171
- colData: data.colStore,
172
- viewportCol: data.viewports[data.colType].store,
173
- viewportRow: data.viewports[type].store,
174
- // lastCell is the last real coordinate + 1
175
- lastCell: getLastCell(data, type),
176
- slot,
177
- type,
178
- canDrag: !fixed,
179
- position: data.position,
180
- dataStore: data.rowStores[type].store,
181
- dimensionCol: data.dimensions[data.colType].store,
182
- dimensionRow: data.dimensions[type].store,
183
- style: fixed
184
- ? { height: `${data.dimensions[type].store.get('realSize')}px` }
185
- : undefined,
186
- };
187
- }
188
-
189
573
  /**
190
574
  * The base implementation of `_.slice` without an iteratee call guard.
191
575
  *
@@ -437,7 +821,7 @@ class ColumnService {
437
821
  }
438
822
  maxCol = Math.max(maxCol, colIndex - 1);
439
823
  }
440
- const range = selection_helpers.getRange(start, {
824
+ const range = getRange(start, {
441
825
  y: rowIndex - 1,
442
826
  x: maxCol,
443
827
  });
@@ -557,29 +941,32 @@ function doPropMerge(existing, extra) {
557
941
  return props;
558
942
  }
559
943
 
560
- exports.CONTENT_SLOT = CONTENT_SLOT;
561
944
  exports.ColumnService = ColumnService;
562
- exports.DATA_SLOT = DATA_SLOT;
563
- exports.FOOTER_SLOT = FOOTER_SLOT;
945
+ exports.EMPTY_INDEX = EMPTY_INDEX;
564
946
  exports.GROUPING_ROW_TYPE = GROUPING_ROW_TYPE;
565
947
  exports.GROUP_DEPTH = GROUP_DEPTH;
566
948
  exports.GROUP_EXPANDED = GROUP_EXPANDED;
567
949
  exports.GROUP_EXPAND_BTN = GROUP_EXPAND_BTN;
568
950
  exports.GROUP_EXPAND_EVENT = GROUP_EXPAND_EVENT;
569
- exports.HEADER_SLOT = HEADER_SLOT;
570
951
  exports.PSEUDO_GROUP_COLUMN = PSEUDO_GROUP_COLUMN;
571
952
  exports.PSEUDO_GROUP_ITEM = PSEUDO_GROUP_ITEM;
572
953
  exports.PSEUDO_GROUP_ITEM_ID = PSEUDO_GROUP_ITEM_ID;
573
954
  exports.PSEUDO_GROUP_ITEM_VALUE = PSEUDO_GROUP_ITEM_VALUE;
955
+ exports.SelectionStore = SelectionStore;
956
+ exports.SelectionStoreConnector = SelectionStoreConnector;
957
+ exports.cropCellToMax = cropCellToMax;
574
958
  exports.doPropMerge = doPropMerge;
575
959
  exports.gatherGrouping = gatherGrouping;
576
960
  exports.getCellData = getCellData;
577
961
  exports.getGroupingName = getGroupingName;
578
962
  exports.getParsedGroup = getParsedGroup;
963
+ exports.getRange = getRange;
579
964
  exports.isGrouping = isGrouping;
580
965
  exports.isGroupingColumn = isGroupingColumn;
966
+ exports.isHiddenStore = isHiddenStore;
967
+ exports.isRangeSingleCell = isRangeSingleCell;
581
968
  exports.isRowDragService = isRowDragService;
582
969
  exports.isSameGroup = isSameGroup;
583
- exports.viewportDataPartition = viewportDataPartition;
970
+ exports.nextCell = nextCell;
584
971
 
585
- //# sourceMappingURL=column.service-bfaba0e0.js.map
972
+ //# sourceMappingURL=column.service-15c8352d.js.map