@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
@@ -6,17 +6,15 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index$1 = require('./index-10d10c55.js');
9
- const index = require('./index-464d1aaf.js');
10
- const column_utils = require('./column.utils-4a450d27.js');
11
- const toNumber = require('./toNumber-838e6ff5.js');
12
- const selection_helpers = require('./selection.helpers-2c90d546.js');
13
- const debounce = require('./debounce-e2b7c6fb.js');
14
- const rowHeaderUtils = require('./row-header-utils-e71dc7bf.js');
15
- const filter_button = require('./filter.button-afb16244.js');
16
- const column_service = require('./column.service-bfaba0e0.js');
17
- const dispatcher = require('./dispatcher-998aa470.js');
18
- const headerCellRenderer = require('./header-cell-renderer-53e4fd75.js');
9
+ const index = require('./index-28b6fdfb.js');
10
+ const column_drag_plugin = require('./column.drag.plugin-e636b5af.js');
11
+ const debounce = require('./debounce-cb5f4e35.js');
12
+ const column_service = require('./column.service-15c8352d.js');
13
+ const rowHeaderUtils = require('./row-header-utils-22ffee54.js');
14
+ const viewport_helpers = require('./viewport.helpers-e59a544e.js');
19
15
  const events = require('./events-af8f6914.js');
16
+ require('./filter.button-afb16244.js');
17
+ require('./header-cell-renderer-375a879f.js');
20
18
 
21
19
  class ThemeCompact {
22
20
  constructor() {
@@ -83,1087 +81,377 @@ class ThemeService {
83
81
  }
84
82
  }
85
83
 
86
- var baseIteratee = index._baseIteratee,
87
- isArrayLike$1 = index.isArrayLike_1,
88
- keys = index.keys_1;
89
-
90
- /**
91
- * Creates a `_.find` or `_.findLast` function.
92
- *
93
- * @private
94
- * @param {Function} findIndexFunc The function to find the collection index.
95
- * @returns {Function} Returns the new find function.
96
- */
97
- function createFind$1(findIndexFunc) {
98
- return function(collection, predicate, fromIndex) {
99
- var iterable = Object(collection);
100
- if (!isArrayLike$1(collection)) {
101
- var iteratee = baseIteratee(predicate);
102
- collection = keys(collection);
103
- predicate = function(key) { return iteratee(iterable[key], key, iterable); };
104
- }
105
- var index = findIndexFunc(collection, predicate, fromIndex);
106
- return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
107
- };
108
- }
109
-
110
- var _createFind = createFind$1;
111
-
112
- var createFind = _createFind,
113
- findIndex = index.findIndex_1;
114
-
115
- /**
116
- * Iterates over elements of `collection`, returning the first element
117
- * `predicate` returns truthy for. The predicate is invoked with three
118
- * arguments: (value, index|key, collection).
119
- *
120
- * @static
121
- * @memberOf _
122
- * @since 0.1.0
123
- * @category Collection
124
- * @param {Array|Object} collection The collection to inspect.
125
- * @param {Function} [predicate=_.identity] The function invoked per iteration.
126
- * @param {number} [fromIndex=0] The index to search from.
127
- * @returns {*} Returns the matched element, else `undefined`.
128
- * @example
129
- *
130
- * var users = [
131
- * { 'user': 'barney', 'age': 36, 'active': true },
132
- * { 'user': 'fred', 'age': 40, 'active': false },
133
- * { 'user': 'pebbles', 'age': 1, 'active': true }
134
- * ];
135
- *
136
- * _.find(users, function(o) { return o.age < 40; });
137
- * // => object for 'barney'
138
- *
139
- * // The `_.matches` iteratee shorthand.
140
- * _.find(users, { 'age': 1, 'active': true });
141
- * // => object for 'pebbles'
142
- *
143
- * // The `_.matchesProperty` iteratee shorthand.
144
- * _.find(users, ['active', false]);
145
- * // => object for 'fred'
146
- *
147
- * // The `_.property` iteratee shorthand.
148
- * _.find(users, 'active');
149
- * // => object for 'barney'
150
- */
151
- var find = createFind(findIndex);
152
-
153
- var find_1 = find;
154
-
155
- class ColumnDataProvider {
156
- get order() {
157
- const order = {};
158
- const sorting = this.sorting;
159
- if (sorting) {
160
- Object.keys(sorting).forEach((prop) => {
161
- order[prop] = sorting[prop].order;
162
- });
163
- }
164
- return order;
165
- }
166
- get stores() {
167
- return this.dataSources;
168
- }
169
- constructor() {
170
- this.sorting = null;
171
- this.dataSources = column_utils.columnTypes.reduce((sources, k) => {
172
- sources[k] = new index.DataStore(k);
173
- return sources;
174
- }, {});
175
- }
176
- column(c, pin) {
177
- return this.getColumn(c, pin || 'rgCol');
178
- }
179
- getColumn(virtualIndex, type) {
180
- return index.getSourceItem(this.dataSources[type].store, virtualIndex);
181
- }
182
- getRawColumns() {
183
- return index.reduce_1(this.dataSources, (result, item, type) => {
184
- result[type] = item.store.get('source');
185
- return result;
186
- }, {
187
- rgCol: [],
188
- colPinStart: [],
189
- colPinEnd: [],
190
- });
191
- }
192
- getColumns(type = 'all') {
193
- if (type !== 'all') {
194
- return this.dataSources[type].store.get('source');
195
- }
196
- return column_utils.columnTypes.reduce((r, t) => {
197
- r.push(...this.dataSources[t].store.get('source'));
198
- return r;
199
- }, []);
200
- }
201
- getColumnIndexByProp(prop, type) {
202
- return index.getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);
203
- }
204
- getColumnByProp(prop, type) {
205
- const items = this.dataSources[type].store.get('source');
206
- return find_1(items, { prop });
207
- }
208
- refreshByType(type) {
209
- this.dataSources[type].refresh();
210
- }
211
- setColumns(data) {
212
- column_utils.columnTypes.forEach(k => {
213
- // set columns data
214
- this.dataSources[k].updateData(data.columns[k], {
215
- // max depth level
216
- depth: data.maxLevel,
217
- // groups
218
- groups: data.columnGrouping[k].reduce((res, g) => {
219
- if (!res[g.level]) {
220
- res[g.level] = [];
221
- }
222
- res[g.level].push(g);
223
- return res;
224
- }, {}),
225
- });
226
- });
227
- this.sorting = data.sort;
228
- return data;
229
- }
230
- updateColumns(cols) {
231
- // collect column by type and propert
232
- const columnByKey = cols.reduce((res, c) => {
233
- const type = column_utils.getColumnType(c);
234
- if (!res[type]) {
235
- res[type] = {};
236
- }
237
- res[type][c.prop] = c;
238
- return res;
239
- }, {});
240
- // find indexes in source
241
- const colByIndex = {};
242
- for (const t in columnByKey) {
243
- if (!columnByKey.hasOwnProperty(t)) {
244
- continue;
245
- }
246
- const type = t;
247
- const colsToUpdate = columnByKey[type];
248
- const items = this.dataSources[type].store.get('source');
249
- colByIndex[type] = {};
250
- for (let i = 0; i < items.length; i++) {
251
- const rgCol = items[i];
252
- const colToUpdateIfExists = colsToUpdate === null || colsToUpdate === void 0 ? void 0 : colsToUpdate[rgCol.prop];
253
- if (colToUpdateIfExists) {
254
- colByIndex[type][i] = colToUpdateIfExists;
255
- }
256
- }
257
- }
258
- for (const t in colByIndex) {
259
- if (!colByIndex.hasOwnProperty(t)) {
260
- continue;
261
- }
262
- const type = t;
263
- index.setSourceByVirtualIndex(this.dataSources[type].store, colByIndex[type] || {});
264
- }
265
- }
266
- updateColumn(column, index$1) {
267
- const type = column_utils.getColumnType(column);
268
- index.setSourceByVirtualIndex(this.dataSources[type].store, { [index$1]: column });
269
- }
270
- updateColumnSorting(column, index, sorting, additive) {
271
- if (!additive) {
272
- this.clearSorting();
273
- }
274
- column.order = sorting;
275
- if (!this.sorting) {
276
- this.sorting = {};
277
- }
278
- this.sorting[column.prop] = column;
279
- this.updateColumn(column, index);
280
- return column;
281
- }
282
- clearSorting() {
283
- const types = index.reduce_1(this.sorting, (r, c) => {
284
- const k = column_utils.getColumnType(c);
285
- r[k] = true;
286
- return r;
287
- }, {});
288
- index.each(types, (_, type) => {
289
- const cols = this.dataSources[type].store.get('source');
290
- index.each(cols, (c) => (c.order = undefined));
291
- this.dataSources[type].setData({ source: [...cols] });
292
- });
293
- this.sorting = {};
294
- }
295
- }
296
-
297
- /**
298
- * Data source provider
299
- */
300
- class DataProvider {
301
- constructor(dimensionProvider) {
302
- this.dimensionProvider = dimensionProvider;
303
- this.stores = index.reduce_1(column_utils.rowTypes, (sources, k) => {
304
- sources[k] = new index.DataStore(k);
305
- return sources;
306
- }, {});
307
- }
308
- setData(data, type = 'rgRow', disableVirtualRows = false, grouping, silent = false) {
309
- // set rgRow data
310
- this.stores[type].updateData([...data], grouping, silent);
311
- // for pinned row no need virtual data
312
- const noVirtual = type !== 'rgRow' || disableVirtualRows;
313
- this.dimensionProvider.setData(data.length, type, noVirtual);
314
- return data;
315
- }
316
- getModel(virtualIndex, type = 'rgRow') {
317
- const store = this.stores[type].store;
318
- return index.getSourceItem(store, virtualIndex);
319
- }
320
- setCellData({ type, rowIndex, prop, val }, mutate = true) {
321
- const model = this.getModel(rowIndex, type);
322
- model[prop] = val;
323
- // apply data to source
324
- index.setSourceByVirtualIndex(this.stores[type].store, { [rowIndex]: model }, mutate);
325
- }
326
- setRangeData(data, type) {
327
- const items = {};
328
- for (let rowIndex in data) {
329
- const oldModel = (items[rowIndex] = index.getSourceItem(this.stores[type].store, parseInt(rowIndex, 10)));
330
- if (!oldModel) {
331
- continue;
332
- }
333
- for (let prop in data[rowIndex]) {
334
- oldModel[prop] = data[rowIndex][prop];
335
- }
336
- }
337
- // apply data to source
338
- index.setSourceByVirtualIndex(this.stores[type].store, items);
339
- }
340
- refresh(type = 'all') {
341
- if (column_utils.isRowType(type)) {
342
- this.refreshItems(type);
343
- }
344
- column_utils.rowTypes.forEach((t) => this.refreshItems(t));
345
- }
346
- refreshItems(type = 'rgRow') {
347
- const items = this.stores[type].store.get('items');
348
- this.stores[type].setData({ items: [...items] });
349
- }
350
- setGrouping({ depth }, type = 'rgRow') {
351
- this.stores[type].setData({ groupingDepth: depth });
352
- }
353
- setTrimmed(trimmed, type = 'rgRow') {
354
- const store = this.stores[type];
355
- store.addTrimmed(trimmed);
356
- this.dimensionProvider.setTrimmed(trimmed, type);
357
- if (type === 'rgRow') {
358
- this.dimensionProvider.setData(index.getVisibleSourceItem(store.store).length, type);
359
- }
360
- }
361
- }
362
-
363
- /**
364
- * Dimension provider
365
- * Stores dimension information and custom sizes
366
- */
367
- class DimensionProvider {
368
- constructor(viewports, config) {
369
- this.viewports = viewports;
370
- const sizeChanged = debounce.debounce_1((k) => config.realSizeChanged(k), index.RESIZE_INTERVAL);
371
- this.stores = index.reduce_1([...column_utils.rowTypes, ...column_utils.columnTypes], (sources, k) => {
372
- sources[k] = new column_utils.DimensionStore();
373
- sources[k].store.onChange('realSize', () => sizeChanged(k));
374
- return sources;
375
- }, {});
376
- }
377
- /**
378
- * Clear old sizes from dimension and viewports
379
- * @param type - dimension type
380
- * @param count - count of items
381
- */
382
- clearSize(t, count) {
383
- this.stores[t].drop();
384
- // after we done with drop trigger viewport recalculaction
385
- this.viewports.stores[t].setOriginalSizes(this.stores[t].store.get('originItemSize'));
386
- this.setItemCount(count, t);
387
- }
388
- /**
389
- * Apply new custom sizes to dimension and view port
390
- * @param type - dimension type
391
- * @param sizes - new custom sizes
392
- * @param keepOld - keep old sizes merge new with old
393
- */
394
- setCustomSizes(type, sizes, keepOld = false) {
395
- let newSizes = sizes;
396
- if (keepOld) {
397
- const oldSizes = this.stores[type].store.get('sizes');
398
- newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
399
- }
400
- this.stores[type].setDimensionSize(newSizes);
401
- this.updateViewport(type, true);
402
- }
403
- setItemCount(realCount, type) {
404
- this.viewports.stores[type].setViewport({ realCount });
405
- this.stores[type].setStore({ count: realCount });
406
- }
407
- /**
408
- * Apply trimmed items
409
- * @param trimmed - trimmed items
410
- * @param type
411
- */
412
- setTrimmed(trimmed, type) {
413
- const allTrimmed = index.gatherTrimmedItems(trimmed);
414
- const dimStoreType = this.stores[type];
415
- dimStoreType.setStore({ trimmed: allTrimmed });
416
- this.updateViewport(type, true);
417
- }
418
- /**
419
- * Sets dimension data and view port coordinate
420
- * @param itemCount
421
- * @param type - dimension type
422
- * @param noVirtual - disable virtual data
423
- */
424
- setData(itemCount, type, noVirtual = false) {
425
- this.setItemCount(itemCount, type);
426
- // Virtualization will get disabled
427
- if (noVirtual) {
428
- const dimension = this.stores[type].getCurrentState();
429
- this.viewports.stores[type].setViewport({
430
- virtualSize: dimension.realSize,
431
- });
432
- }
433
- this.updateViewport(type);
434
- }
435
- applyNewColumns(columns, disableVirtualX) {
436
- for (let type of column_utils.columnTypes) {
437
- // clear existing data
438
- this.stores[type].drop();
439
- const items = columns[type];
440
- // for pinned col no need virtual data
441
- const noVirtual = type !== 'rgCol' || disableVirtualX;
442
- // setItemCount
443
- this.stores[type].setStore({ count: items.length });
444
- // setCustomSizes
445
- const newSizes = column_utils.getColumnSizes(items);
446
- this.stores[type].setDimensionSize(newSizes);
447
- const vpUpdate = {
448
- // this triggers drop on realCount change
449
- realCount: items.length,
450
- };
451
- // Virtualization will get disabled
452
- if (noVirtual) {
453
- vpUpdate.virtualSize = this.stores[type].getCurrentState().realSize;
454
- }
455
- this.viewports.stores[type].setViewport(vpUpdate);
456
- this.setViewPortCoordinate({
457
- coordinate: this.viewports.stores[type].lastCoordinate,
458
- type,
459
- });
460
- }
461
- }
462
- getFullSize() {
463
- var _a, _b;
464
- let x = 0;
465
- let y = 0;
466
- for (let type of column_utils.columnTypes) {
467
- x += ((_a = this.stores[type]) === null || _a === void 0 ? void 0 : _a.store.get('realSize')) || 0;
468
- }
469
- for (let type of column_utils.rowTypes) {
470
- y += ((_b = this.stores[type]) === null || _b === void 0 ? void 0 : _b.store.get('realSize')) || 0;
471
- }
472
- return { y, x };
473
- }
474
- updateViewport(type, force = false) {
475
- this.setViewPortCoordinate({
476
- coordinate: this.viewports.stores[type].lastCoordinate,
477
- type,
478
- force,
479
- });
480
- }
481
- setViewPortCoordinate({ coordinate, type, force = false, }) {
482
- const dimension = this.stores[type].getCurrentState();
483
- this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
484
- }
485
- getViewPortPos(e) {
486
- const dimension = this.stores[e.dimension].getCurrentState();
487
- const item = index.getItemByIndex(dimension, e.coordinate);
488
- return item.start;
489
- }
490
- setSettings(data, dimensionType) {
491
- let stores = [];
492
- switch (dimensionType) {
493
- case 'rgCol':
494
- stores = column_utils.columnTypes;
495
- break;
496
- case 'rgRow':
497
- stores = column_utils.rowTypes;
84
+ // provide collapse data
85
+ function doCollapse(pIndex, source) {
86
+ const model = source[pIndex];
87
+ const collapseValue = model[column_service.PSEUDO_GROUP_ITEM_VALUE];
88
+ const trimmed = {};
89
+ let i = pIndex + 1;
90
+ const total = source.length;
91
+ while (i < total) {
92
+ const currentModel = source[i];
93
+ if (column_service.isGrouping(currentModel)) {
94
+ const currentValue = currentModel[column_service.PSEUDO_GROUP_ITEM_VALUE];
95
+ if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
498
96
  break;
97
+ }
98
+ currentModel[column_service.GROUP_EXPANDED] = false;
499
99
  }
500
- for (let s of stores) {
501
- this.stores[s].setStore(data);
502
- }
503
- }
504
- }
505
-
506
- class ViewportProvider {
507
- constructor() {
508
- this.stores = index.reduce_1([...column_utils.rowTypes, ...column_utils.columnTypes], (sources, k) => {
509
- sources[k] = new rowHeaderUtils.ViewportStore(k);
510
- return sources;
511
- }, {});
512
- }
513
- setViewport(type, data) {
514
- this.stores[type].setViewport(data);
100
+ trimmed[i++] = true;
515
101
  }
102
+ model[column_service.GROUP_EXPANDED] = false;
103
+ return { trimmed };
516
104
  }
517
-
518
105
  /**
519
- * Plugin module for revo-grid grid system
520
- * Add support for automatic column resize
106
+ *
107
+ * @param pIndex - physical index
108
+ * @param vIndex - virtual index, need to update item collection
109
+ * @param source - data source
110
+ * @param rowItemsIndexes - rgRow indexes
521
111
  */
522
- const LETTER_BLOCK_SIZE = 7;
523
- var ColumnAutoSizeMode;
524
- (function (ColumnAutoSizeMode) {
525
- // increases column width on header click according the largest text value
526
- ColumnAutoSizeMode["headerClickAutosize"] = "headerClickAutoSize";
527
- // increases column width on data set and text edit, decreases performance
528
- ColumnAutoSizeMode["autoSizeOnTextOverlap"] = "autoSizeOnTextOverlap";
529
- // increases and decreases column width based on all items sizes, worst for performance
530
- ColumnAutoSizeMode["autoSizeAll"] = "autoSizeAll";
531
- })(ColumnAutoSizeMode || (ColumnAutoSizeMode = {}));
532
- class AutoSizeColumnPlugin extends column_utils.BasePlugin {
533
- constructor(revogrid, providers, config) {
534
- super(revogrid, providers);
535
- this.providers = providers;
536
- this.config = config;
537
- this.autoSizeColumns = null;
538
- /** for edge case when no columns defined before data */
539
- this.dataResolve = null;
540
- this.dataReject = null;
541
- this.letterBlockSize = (config === null || config === void 0 ? void 0 : config.letterBlockSize) || LETTER_BLOCK_SIZE;
542
- // create test container to check text width
543
- if (config === null || config === void 0 ? void 0 : config.preciseSize) {
544
- this.precsizeCalculationArea = this.initiatePresizeElement();
545
- revogrid.appendChild(this.precsizeCalculationArea);
546
- }
547
- const aftersourceset = ({ detail: { source }, }) => {
548
- this.setSource(source);
549
- };
550
- const afteredit = ({ detail }) => {
551
- this.afteredit(detail);
552
- };
553
- const afterEditAll = ({ detail }) => {
554
- this.afterEditAll(detail);
555
- };
556
- const beforecolumnsset = ({ detail: { columns }, }) => {
557
- this.columnSet(columns);
558
- };
559
- const headerDblClick = ({ detail }) => {
560
- const type = column_utils.getColumnType(detail.column);
561
- const size = this.getColumnSize(detail.index, type);
562
- if (size) {
563
- this.providers.dimension.setCustomSizes(type, {
564
- [detail.index]: size,
565
- }, true);
566
- }
567
- };
568
- this.addEventListener('beforecolumnsset', beforecolumnsset);
569
- switch (config === null || config === void 0 ? void 0 : config.mode) {
570
- case ColumnAutoSizeMode.autoSizeOnTextOverlap:
571
- this.addEventListener('aftersourceset', aftersourceset);
572
- this.addEventListener('afteredit', afteredit);
573
- break;
574
- case ColumnAutoSizeMode.autoSizeAll:
575
- this.addEventListener('aftersourceset', aftersourceset);
576
- this.addEventListener('afteredit', afterEditAll);
577
- break;
578
- default:
579
- this.addEventListener('headerdblclick', headerDblClick);
580
- break;
581
- }
112
+ function doExpand(vIndex, source, rowItemsIndexes) {
113
+ const physicalIndex = rowItemsIndexes[vIndex];
114
+ const model = source[physicalIndex];
115
+ const currentGroup = column_service.getParsedGroup(model[column_service.PSEUDO_GROUP_ITEM_ID]);
116
+ const trimmed = {};
117
+ // no group found
118
+ if (!currentGroup) {
119
+ return { trimmed };
582
120
  }
583
- async setSource(source) {
584
- let autoSize = this.autoSizeColumns;
585
- if (this.dataReject) {
586
- this.dataReject();
587
- this.clearPromise();
588
- }
589
- /** If data set first and no column provided await until get one */
590
- if (!autoSize) {
591
- const request = new Promise((resolve, reject) => {
592
- this.dataResolve = resolve;
593
- this.dataReject = reject;
594
- });
595
- try {
596
- autoSize = await request;
597
- }
598
- catch (e) {
599
- return;
121
+ const groupItems = [];
122
+ model[column_service.GROUP_EXPANDED] = true;
123
+ let i = physicalIndex + 1;
124
+ const total = source.length;
125
+ let groupLevelOnly = 0;
126
+ // go through all rows
127
+ while (i < total) {
128
+ const currentModel = source[i];
129
+ const isGroup = column_service.isGrouping(currentModel);
130
+ // group found
131
+ if (isGroup) {
132
+ if (!column_service.isSameGroup(currentGroup, model, currentModel)) {
133
+ break;
600
134
  }
601
- }
602
- // calculate sizes
603
- index.each(autoSize, (_v, type) => {
604
- const sizes = {};
605
- index.each(autoSize[type], rgCol => {
606
- // calculate size
607
- rgCol.size = sizes[rgCol.index] = source.reduce((prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])), this.getLength(rgCol.name || ''));
608
- });
609
- this.providers.dimension.setCustomSizes(type, sizes, true);
610
- });
611
- }
612
- getLength(len) {
613
- var _a;
614
- const padding = 15;
615
- if (!len) {
616
- return 0;
617
- }
618
- try {
619
- const str = len.toString();
620
- /**if exact calculation required proxy with html element, slow operation */
621
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.preciseSize) {
622
- this.precsizeCalculationArea.innerText = str;
623
- return this.precsizeCalculationArea.scrollWidth + padding * 2;
135
+ else if (!groupLevelOnly) {
136
+ // if get group first it's group only level
137
+ groupLevelOnly = currentModel[column_service.GROUP_DEPTH];
624
138
  }
625
- return str.length * this.letterBlockSize + padding * 2;
626
139
  }
627
- catch (e) {
628
- return 0;
629
- }
630
- }
631
- afteredit(e) {
632
- let data;
633
- if (this.isRangeEdit(e)) {
634
- data = e.data;
635
- }
636
- else {
637
- data = { 0: { [e.prop]: e.val } };
140
+ // level 0 or same depth
141
+ if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[column_service.GROUP_DEPTH])) {
142
+ trimmed[i] = false;
143
+ groupItems.push(i);
638
144
  }
639
- index.each(this.autoSizeColumns, (columns, type) => {
640
- const sizes = {};
641
- index.each(columns, rgCol => {
642
- var _a;
643
- // calculate size
644
- const size = index.reduce_1(data, (prev, rgRow) => {
645
- if (typeof rgRow[rgCol.prop] === 'undefined') {
646
- return prev;
647
- }
648
- return Math.max(prev || 0, this.getLength(rgRow[rgCol.prop]));
649
- }, undefined);
650
- if (size && ((_a = rgCol.size) !== null && _a !== void 0 ? _a : 0) < size) {
651
- rgCol.size = sizes[rgCol.index] = size;
652
- }
653
- });
654
- this.providers.dimension.setCustomSizes(type, sizes, true);
655
- });
145
+ i++;
656
146
  }
657
- afterEditAll(e) {
658
- const props = {};
659
- if (this.isRangeEdit(e)) {
660
- index.each(e.data, r => index.each(r, (_v, p) => (props[p] = true)));
661
- }
662
- else {
663
- props[e.prop] = true;
664
- }
665
- index.each(this.autoSizeColumns, (columns, type) => {
666
- const sizes = {};
667
- index.each(columns, rgCol => {
668
- if (props[rgCol.prop]) {
669
- const size = this.getColumnSize(rgCol.index, type);
670
- if (size) {
671
- sizes[rgCol.index] = size;
672
- }
673
- }
674
- });
675
- this.providers.dimension.setCustomSizes(type, sizes, true);
676
- });
147
+ const result = {
148
+ trimmed,
149
+ };
150
+ if (groupItems.length) {
151
+ const items = [...rowItemsIndexes];
152
+ items.splice(vIndex + 1, 0, ...groupItems);
153
+ result.items = items;
677
154
  }
678
- getColumnSize(index$1, type) {
679
- var _a, _b;
680
- const rgCol = (_b = (_a = this.autoSizeColumns) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b[index$1];
681
- if (!rgCol) {
682
- return 0;
155
+ return result;
156
+ }
157
+
158
+ const TRIMMED_GROUPING = 'grouping';
159
+ /**
160
+ * Prepare trimming updated indexes for grouping
161
+ * @param initiallyTrimed
162
+ * @param firstLevelMap
163
+ * @param secondLevelMap
164
+ */
165
+ function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
166
+ const trimemedOptionsToUpgrade = {};
167
+ /**
168
+ * go through all groups except grouping
169
+ */
170
+ for (let type in initiallyTrimed) {
171
+ if (type === TRIMMED_GROUPING) {
172
+ continue;
683
173
  }
684
- return index.reduce_1(this.providers.data.stores, (r, s) => {
685
- const perStore = index.reduce_1(s.store.get('items'), (prev, _row, i) => {
686
- const item = index.getSourceItem(s.store, i);
687
- return Math.max(prev || 0, this.getLength(item === null || item === void 0 ? void 0 : item[rgCol.prop]));
688
- }, 0);
689
- return Math.max(r, perStore);
690
- }, rgCol.size || 0);
691
- }
692
- columnSet(columns) {
693
- var _a;
694
- for (let t of column_utils.columnTypes) {
695
- const type = t;
696
- const cols = columns[type];
697
- for (let i in cols) {
698
- if (cols[i].autoSize || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.allColumns)) {
699
- if (!this.autoSizeColumns) {
700
- this.autoSizeColumns = {};
701
- }
702
- if (!this.autoSizeColumns[type]) {
703
- this.autoSizeColumns[type] = {};
704
- }
705
- this.autoSizeColumns[type][i] = Object.assign(Object.assign({}, cols[i]), { index: parseInt(i, 10) });
174
+ const items = initiallyTrimed[type];
175
+ const newItems = {};
176
+ for (let initialIndex in items) {
177
+ /**
178
+ * if item exists we find it in collection
179
+ * we support 2 level of conversions
180
+ */
181
+ let newConversionIndex = firstLevelMap[initialIndex];
182
+ if (secondLevelMap) {
183
+ newConversionIndex = secondLevelMap[newConversionIndex];
184
+ }
185
+ /**
186
+ * if item was trimmed previously
187
+ * trimming makes sense to apply
188
+ */
189
+ if (items[initialIndex]) {
190
+ newItems[newConversionIndex] = true;
191
+ /**
192
+ * If changes present apply changes to new source
193
+ */
194
+ if (newConversionIndex !== parseInt(initialIndex, 10)) {
195
+ trimemedOptionsToUpgrade[type] = newItems;
706
196
  }
707
197
  }
708
198
  }
709
- if (this.dataResolve) {
710
- this.dataResolve(this.autoSizeColumns || {});
711
- this.clearPromise();
712
- }
713
- }
714
- clearPromise() {
715
- this.dataResolve = null;
716
- this.dataReject = null;
717
- }
718
- isRangeEdit(e) {
719
- return !!e.data;
720
- }
721
- initiatePresizeElement() {
722
- var _a;
723
- const styleForFontTest = {
724
- position: 'absolute',
725
- fontSize: '14px',
726
- height: '0',
727
- width: '0',
728
- whiteSpace: 'nowrap',
729
- top: '0',
730
- overflowX: 'scroll',
731
- };
732
- const el = document.createElement('div');
733
- for (let s in styleForFontTest) {
734
- el.style[s] = (_a = styleForFontTest[s]) !== null && _a !== void 0 ? _a : '';
735
- }
736
- el.classList.add('revo-test-container');
737
- return el;
738
- }
739
- destroy() {
740
- var _a;
741
- super.destroy();
742
- (_a = this.precsizeCalculationArea) === null || _a === void 0 ? void 0 : _a.remove();
743
199
  }
200
+ return trimemedOptionsToUpgrade;
744
201
  }
745
202
 
746
- const eq = (value, extra) => {
747
- if (typeof value === 'undefined' || (value === null && !extra)) {
748
- return true;
749
- }
750
- if (typeof value !== 'string') {
751
- value = JSON.stringify(value);
752
- }
753
- const filterVal = extra === null || extra === void 0 ? void 0 : extra.toString().toLocaleLowerCase();
754
- if ((filterVal === null || filterVal === void 0 ? void 0 : filterVal.length) === 0) {
755
- return true;
756
- }
757
- return value.toLocaleLowerCase() === filterVal;
758
- };
759
- const notEq = (value, extra) => !eq(value, extra);
760
- notEq.extra = 'input';
761
- eq.extra = 'input';
762
-
763
- const gtThan = function (value, extra) {
764
- let conditionValue;
765
- if (typeof value === 'number' && typeof extra !== 'undefined' && extra !== null) {
766
- conditionValue = parseFloat(extra === null || extra === void 0 ? void 0 : extra.toString());
767
- return value > conditionValue;
203
+ class GroupingRowPlugin extends column_drag_plugin.BasePlugin {
204
+ get hasProps() {
205
+ var _a, _b, _c;
206
+ return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) && ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.length);
768
207
  }
769
- return false;
770
- };
771
- gtThan.extra = 'input';
772
-
773
- const gtThanEq = function (value, extra) {
774
- return eq(value, extra) || gtThan(value, extra);
775
- };
776
- gtThanEq.extra = 'input';
777
-
778
- const lt = function (value, extra) {
779
- let conditionValue;
780
- if (typeof value === 'number' && typeof extra !== 'undefined' && extra !== null) {
781
- conditionValue = parseFloat(extra.toString());
782
- return value < conditionValue;
208
+ get store() {
209
+ return this.providers.data.stores[column_service.GROUPING_ROW_TYPE].store;
783
210
  }
784
- else {
785
- return false;
211
+ // proxy for items get
212
+ get rowItems() {
213
+ return this.store.get('items');
786
214
  }
787
- };
788
- lt.extra = 'input';
789
-
790
- const lsEq = function (value, extra) {
791
- return eq(value, extra) || lt(value, extra);
792
- };
793
- lsEq.extra = 'input';
794
-
795
- const set = (value) => !(value === '' || value === null || value === void 0);
796
- const notSet = (value) => !set(value);
797
-
798
- const beginsWith = (value, extra) => {
799
- if (!value) {
800
- return false;
215
+ get trimmed() {
216
+ return this.store.get('trimmed');
801
217
  }
802
- if (!extra) {
803
- return true;
218
+ constructor(revogrid, providers) {
219
+ super(revogrid, providers);
220
+ this.revogrid = revogrid;
221
+ this.providers = providers;
804
222
  }
805
- if (typeof value !== 'string') {
806
- value = JSON.stringify(value);
223
+ // befoce cell focus
224
+ onFocus(e) {
225
+ if (column_service.isGrouping(e.detail.model)) {
226
+ e.preventDefault();
227
+ }
807
228
  }
808
- if (typeof extra !== 'string') {
809
- extra = JSON.stringify(extra);
229
+ // expand event triggered
230
+ onExpand({ virtualIndex }) {
231
+ const { source } = this.getSource();
232
+ let newTrimmed = this.trimmed[TRIMMED_GROUPING];
233
+ let i = index.getPhysical(this.store, virtualIndex);
234
+ const model = source[i];
235
+ const prevExpanded = model[column_service.GROUP_EXPANDED];
236
+ if (!prevExpanded) {
237
+ const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);
238
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
239
+ if (items) {
240
+ index.setItems(this.store, items);
241
+ }
242
+ }
243
+ else {
244
+ const { trimmed } = doCollapse(i, source);
245
+ newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
246
+ this.revogrid.clearFocus();
247
+ }
248
+ this.store.set('source', source);
249
+ this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
810
250
  }
811
- return value.toLocaleLowerCase().indexOf(extra.toLocaleLowerCase()) === 0;
812
- };
813
- beginsWith.extra = 'input';
814
-
815
- const contains = (value, extra) => {
816
- if (!extra) {
817
- return true;
251
+ // get source based on proxy item collection to preserve rgRow order
252
+ getSource(withoutGrouping = false) {
253
+ const source = this.store.get('source');
254
+ const items = this.store.get('proxyItems');
255
+ let index = 0;
256
+ // order important here, expected parent is first, then others
257
+ return items.reduce((result, i) => {
258
+ const model = source[i];
259
+ if (!withoutGrouping) {
260
+ result.source.push(model);
261
+ return result;
262
+ }
263
+ // grouping filter
264
+ if (column_service.isGrouping(model)) {
265
+ if (model[column_service.GROUP_EXPANDED]) {
266
+ result.prevExpanded[model[column_service.PSEUDO_GROUP_ITEM_VALUE]] = true;
267
+ }
268
+ }
269
+ else {
270
+ result.source.push(model);
271
+ result.oldNewIndexes[i] = index;
272
+ index++;
273
+ }
274
+ return result;
275
+ }, {
276
+ source: [],
277
+ prevExpanded: {},
278
+ oldNewIndexes: {},
279
+ });
818
280
  }
819
- if (!value) {
281
+ setColumnGrouping(cols) {
282
+ // if 0 column as holder
283
+ if (cols === null || cols === void 0 ? void 0 : cols.length) {
284
+ cols[0][column_service.PSEUDO_GROUP_COLUMN] = true;
285
+ return true;
286
+ }
820
287
  return false;
821
288
  }
822
- if (extra) {
823
- if (typeof value !== 'string') {
824
- value = JSON.stringify(value);
289
+ setColumns({ columns }) {
290
+ for (let type of column_drag_plugin.columnTypes) {
291
+ if (this.setColumnGrouping(columns[type])) {
292
+ break;
293
+ }
825
294
  }
826
- return value.toLocaleLowerCase().indexOf(extra.toString().toLowerCase()) > -1;
827
295
  }
828
- return true;
829
- };
830
- const notContains = (value, extra) => {
831
- return !contains(value, extra);
832
- };
833
- notContains.extra = 'input';
834
- contains.extra = 'input';
835
-
836
- const filterNames = {
837
- none: 'None',
838
- empty: 'Not set',
839
- notEmpty: 'Set',
840
- eq: 'Equal',
841
- notEq: 'Not equal',
842
- begins: 'Begins with',
843
- contains: 'Contains',
844
- notContains: 'Does not contain',
845
- eqN: '=',
846
- neqN: '!=',
847
- gt: '>',
848
- gte: '>=',
849
- lt: '<',
850
- lte: '<=',
851
- };
852
- const filterEntities = {
853
- none: () => true,
854
- empty: notSet,
855
- notEmpty: set,
856
- eq: eq,
857
- notEq: notEq,
858
- begins: beginsWith,
859
- contains: contains,
860
- notContains: notContains,
861
- eqN: eq,
862
- neqN: notEq,
863
- gt: gtThan,
864
- gte: gtThanEq,
865
- lt: lt,
866
- lte: lsEq,
867
- };
868
- const filterTypes = {
869
- string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
870
- number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
871
- };
872
-
873
- const FILTER_TRIMMED_TYPE = 'filter';
874
- const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
875
- class FilterPlugin extends column_utils.BasePlugin {
876
- constructor(revogrid, providers, config) {
877
- var _a;
878
- super(revogrid, providers);
879
- this.revogrid = revogrid;
880
- this.filterCollection = {};
881
- this.multiFilterItems = {};
882
- this.possibleFilters = Object.assign({}, filterTypes);
883
- this.possibleFilterNames = Object.assign({}, filterNames);
884
- this.possibleFilterEntities = Object.assign({}, filterEntities);
885
- this.filterProp = filter_button.FILTER_PROP;
886
- if (config) {
887
- this.initConfig(config);
888
- }
889
- const headerclick = (e) => this.headerclick(e);
890
- const aftersourceset = async () => {
891
- const filterCollectionProps = Object.keys(this.filterCollection);
892
- if (filterCollectionProps.length > 0) {
893
- // handle old way of filtering by reworking FilterCollection to new MultiFilterItem
894
- filterCollectionProps.forEach((prop, index) => {
895
- if (!this.multiFilterItems[prop]) {
896
- this.multiFilterItems[prop] = [
897
- {
898
- id: index,
899
- type: this.filterCollection[prop].type,
900
- value: this.filterCollection[prop].value,
901
- relation: 'and',
902
- },
903
- ];
904
- }
905
- });
906
- }
907
- await this.runFiltering();
908
- };
909
- this.addEventListener('headerclick', headerclick);
910
- this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
911
- if (!detail) {
912
- this.clearFiltering();
296
+ // evaluate drag between groups
297
+ onDrag(e) {
298
+ const { from, to } = e.detail;
299
+ const isDown = to - from >= 0;
300
+ const { source } = this.getSource();
301
+ const items = this.rowItems;
302
+ let i = isDown ? from : to;
303
+ const end = isDown ? to : from;
304
+ for (; i < end; i++) {
305
+ const model = source[items[i]];
306
+ const isGroup = column_service.isGrouping(model);
307
+ if (isGroup) {
308
+ e.preventDefault();
913
309
  return;
914
310
  }
915
- if (typeof detail === 'object') {
916
- this.initConfig(detail);
917
- }
918
- aftersourceset();
919
- });
920
- this.addEventListener('aftersourceset', aftersourceset);
921
- this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
922
- const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');
923
- this.revogrid.registerVNode = [
924
- ...existingNodes,
925
- index$1.h("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.possibleFilterNames, filterEntities: this.possibleFilterEntities, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) }),
926
- ];
927
- }
928
- initConfig(config) {
929
- if (config.multiFilterItems) {
930
- this.multiFilterItems = Object.assign({}, config.multiFilterItems);
931
- }
932
- if (config.customFilters) {
933
- for (let cType in config.customFilters) {
934
- const cFilter = config.customFilters[cType];
935
- if (!this.possibleFilters[cFilter.columnFilterType]) {
936
- this.possibleFilters[cFilter.columnFilterType] = [];
311
+ }
312
+ }
313
+ beforeTrimmedApply(trimmed, type) {
314
+ /** Before filter apply remove grouping filtering */
315
+ if (type === column_drag_plugin.FILTER_TRIMMED_TYPE) {
316
+ const source = this.store.get('source');
317
+ for (let index in trimmed) {
318
+ if (trimmed[index] && column_service.isGrouping(source[index])) {
319
+ trimmed[index] = false;
937
320
  }
938
- this.possibleFilters[cFilter.columnFilterType].push(cType);
939
- this.possibleFilterEntities[cType] = cFilter.func;
940
- this.possibleFilterNames[cType] = cFilter.name;
941
321
  }
942
322
  }
943
- if (config.filterProp) {
944
- this.filterProp = config.filterProp;
945
- }
323
+ }
324
+ // subscribe to grid events to process them accordingly
325
+ subscribe() {
326
+ /** if grouping present and new data source arrived */
327
+ this.addEventListener('beforesourceset', ({ detail }) => this.onDataSet(detail));
328
+ this.addEventListener('beforecolumnsset', ({ detail }) => this.setColumns(detail));
946
329
  /**
947
- * which filters has to be included/excluded
948
- * convinient way to exclude system filters
330
+ * filter applied need to clear grouping and apply again
331
+ * based on new results can be new grouping
949
332
  */
950
- const cfgInlcude = config.include;
951
- if (cfgInlcude) {
952
- const filters = {};
953
- for (let t in this.possibleFilters) {
954
- // validate filters, if appropriate function present
955
- const newTypes = this.possibleFilters[t].filter(f => cfgInlcude.indexOf(f) > -1);
956
- if (newTypes.length) {
957
- filters[t] = newTypes;
958
- }
959
- }
960
- // if any valid filters provided show them
961
- if (Object.keys(filters).length > 0) {
962
- this.possibleFilters = filters;
963
- }
964
- }
965
- if (config.collection) {
966
- this.filterCollection = index.reduce_1(config.collection, (result, item, prop) => {
967
- if (this.possibleFilterEntities[item.type]) {
968
- result[prop] = item;
969
- }
970
- else {
971
- console.warn(`${item.type} type is not found.`);
972
- }
973
- return result;
974
- }, {});
975
- }
976
- if (config.localization) {
977
- if (config.localization.filterNames) {
978
- Object.entries(config.localization.filterNames).forEach(([k, v]) => {
979
- if (this.possibleFilterNames[k] != void 0) {
980
- this.possibleFilterNames[k] = v;
981
- }
982
- });
983
- }
984
- }
333
+ this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
334
+ /**
335
+ * sorting applied need to clear grouping and apply again
336
+ * based on new results whole grouping order will changed
337
+ */
338
+ this.addEventListener('aftersortingapply', () => this.doSourceUpdate(Object.assign({}, this.options)));
339
+ /**
340
+ * Apply logic for focus inside of grouping
341
+ * We can't focus on grouping rows, navigation only inside of groups for now
342
+ */
343
+ this.addEventListener('beforecellfocus', e => this.onFocus(e));
344
+ /**
345
+ * Prevent rgRow drag outside the group
346
+ */
347
+ this.addEventListener('roworderchanged', e => this.onDrag(e));
348
+ /**
349
+ * When grouping expand icon was clicked
350
+ */
351
+ this.addEventListener(column_service.GROUP_EXPAND_EVENT, ({ detail }) => this.onExpand(detail));
985
352
  }
986
- async headerclick(e) {
987
- var _a, _b, _c;
988
- const el = (_a = e.detail.originalEvent) === null || _a === void 0 ? void 0 : _a.target;
989
- if (!filter_button.isFilterBtn(el)) {
990
- return;
991
- }
992
- e.preventDefault();
993
- // close if same
994
- const changes = await ((_b = this.pop) === null || _b === void 0 ? void 0 : _b.getChanges());
995
- if (changes && (changes === null || changes === void 0 ? void 0 : changes.prop) === e.detail.prop) {
996
- (_c = this.pop) === null || _c === void 0 ? void 0 : _c.show();
997
- return;
998
- }
999
- if (!this.pop) {
353
+ /**
354
+ * Starts global source update with group clearing and applying new one
355
+ * Initiated when need to reapply grouping
356
+ */
357
+ doSourceUpdate(options) {
358
+ var _a;
359
+ if (!this.hasProps) {
1000
360
  return;
1001
361
  }
1002
- // filter button clicked, open filter dialog
1003
- const gridPos = this.revogrid.getBoundingClientRect();
1004
- const buttonPos = el.getBoundingClientRect();
1005
- const prop = e.detail.prop;
1006
- this.pop.filterTypes = this.getColumnFilter(e.detail.filter);
1007
- this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop }));
1008
- }
1009
- getColumnFilter(type) {
1010
- let filterType = 'string';
1011
- if (!type) {
1012
- return { [filterType]: this.possibleFilters[filterType] };
1013
- }
1014
- // if custom column filter
1015
- if (this.isValidType(type)) {
1016
- filterType = type;
1017
- // if multiple filters applied
1018
- }
1019
- else if (typeof type === 'object' && type.length) {
1020
- return type.reduce((r, multiType) => {
1021
- if (this.isValidType(multiType)) {
1022
- r[multiType] = this.possibleFilters[multiType];
1023
- }
1024
- return r;
1025
- }, {});
1026
- }
1027
- return { [filterType]: this.possibleFilters[filterType] };
1028
- }
1029
- isValidType(type) {
1030
- return !!(typeof type === 'string' && this.possibleFilters[type]);
1031
- }
1032
- // called on internal component change
1033
- async onFilterChange(filterItems) {
1034
- this.multiFilterItems = filterItems;
1035
- this.runFiltering();
362
+ /**
363
+ * Get source without grouping
364
+ * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
365
+ */
366
+ const { source, prevExpanded, oldNewIndexes } = this.getSource(true);
367
+ /**
368
+ * Group again
369
+ * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
370
+ */
371
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
372
+ // setup source
373
+ this.providers.data.setData(sourceWithGroups, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
374
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
1036
375
  }
1037
376
  /**
1038
- * Triggers grid filtering
377
+ * Apply grouping on data set
378
+ * Clear grouping from source
379
+ * If source came from other plugin
1039
380
  */
1040
- async doFiltering(collection, items, columns, filterItems) {
1041
- const columnsToUpdate = [];
1042
- columns.forEach(rgCol => {
1043
- const column = Object.assign({}, rgCol);
1044
- const hasFilter = filterItems[column.prop];
1045
- if (column[this.filterProp] && !hasFilter) {
1046
- delete column[this.filterProp];
1047
- columnsToUpdate.push(column);
1048
- }
1049
- if (!column[this.filterProp] && hasFilter) {
1050
- columnsToUpdate.push(column);
1051
- column[this.filterProp] = true;
1052
- }
1053
- });
1054
- const itemsToFilter = this.getRowFilter(items, filterItems);
1055
- // check is filter event prevented
1056
- const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
1057
- collection,
1058
- itemsToFilter,
1059
- source: items,
1060
- filterItems,
1061
- });
1062
- if (defaultPrevented) {
381
+ onDataSet(data) {
382
+ var _a;
383
+ if (!this.hasProps || !(data === null || data === void 0 ? void 0 : data.source) || !data.source.length) {
1063
384
  return;
1064
385
  }
1065
- // check is trimmed event prevented
1066
- const isAddedEvent = await this.revogrid.addTrimmed(detail.itemsToFilter, FILTER_TRIMMED_TYPE);
1067
- if (isAddedEvent.defaultPrevented) {
386
+ const source = data.source.filter(s => !column_service.isGrouping(s));
387
+ const expanded = this.revogrid.grouping || {};
388
+ const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
389
+ data.source = sourceWithGroups;
390
+ this.providers.data.setGrouping({ depth });
391
+ this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
392
+ }
393
+ // apply grouping
394
+ setGrouping(options) {
395
+ // unsubscribe from all events when group applied
396
+ this.clearSubscriptions();
397
+ this.options = options;
398
+ // clear props, no grouping exists
399
+ if (!options.props || !Object.keys(options.props).length) {
400
+ this.clearGrouping();
1068
401
  return;
1069
402
  }
1070
- // applies the hasFilter to the columns to show filter icon
1071
- await this.revogrid.updateColumns(columnsToUpdate);
1072
- this.emit('afterfilterapply');
1073
- }
1074
- async clearFiltering() {
1075
- this.multiFilterItems = {};
1076
- await this.runFiltering();
1077
- }
1078
- async runFiltering() {
1079
- const collection = {};
1080
- // handle old filterCollection to return the first filter only (if any) from multiFilterItems
1081
- const filterProps = Object.keys(this.multiFilterItems);
1082
- for (const prop of filterProps) {
1083
- // check if we have any filter for a column
1084
- if (this.multiFilterItems[prop].length > 0) {
1085
- const firstFilterItem = this.multiFilterItems[prop][0];
1086
- collection[prop] = {
1087
- filter: filterEntities[firstFilterItem.type],
1088
- type: firstFilterItem.type,
1089
- value: firstFilterItem.value,
1090
- };
1091
- }
403
+ // props exist and source inited
404
+ const { source } = this.getSource();
405
+ if (source.length) {
406
+ this.doSourceUpdate(Object.assign({}, options));
1092
407
  }
1093
- this.filterCollection = collection;
1094
- const { source, columns } = await this.getData();
1095
- const { defaultPrevented, detail } = this.emit('beforefilterapply', {
1096
- collection: this.filterCollection,
1097
- source,
1098
- columns,
1099
- filterItems: this.multiFilterItems,
1100
- });
1101
- if (defaultPrevented) {
1102
- return;
408
+ // props exist and columns inited
409
+ for (let t of column_drag_plugin.columnTypes) {
410
+ if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
411
+ this.providers.column.refreshByType(t);
412
+ break;
413
+ }
1103
414
  }
1104
- this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
1105
- }
1106
- async getData() {
1107
- return {
1108
- source: await this.revogrid.getSource(),
1109
- columns: await this.revogrid.getColumns(),
1110
- };
415
+ // if has any grouping subscribe to events again
416
+ this.subscribe();
1111
417
  }
1112
- getRowFilter(rows, filterItems) {
1113
- const propKeys = Object.keys(filterItems);
1114
- const trimmed = {};
1115
- let propFilterSatisfiedCount = 0;
1116
- let lastFilterResults = [];
1117
- // each rows
1118
- rows.forEach((model, rowIndex) => {
1119
- // working on all props
1120
- for (const prop of propKeys) {
1121
- const propFilters = filterItems[prop];
1122
- propFilterSatisfiedCount = 0;
1123
- lastFilterResults = [];
1124
- // testing each filter for a prop
1125
- for (const [filterIndex, filterData] of propFilters.entries()) {
1126
- // the filter LogicFunction based on the type
1127
- const filter = this.possibleFilterEntities[filterData.type];
1128
- // THE MAGIC OF FILTERING IS HERE
1129
- if (filterData.relation === 'or') {
1130
- lastFilterResults = [];
1131
- if (filter(model[prop], filterData.value)) {
1132
- continue;
1133
- }
1134
- propFilterSatisfiedCount++;
1135
- }
1136
- else {
1137
- // 'and' relation will need to know the next filter
1138
- // so we save this current filter to include it in the next filter
1139
- lastFilterResults.push(!filter(model[prop], filterData.value));
1140
- // check first if we have a filter on the next index to pair it with this current filter
1141
- const nextFilterData = propFilters[filterIndex + 1];
1142
- // stop the sequence if there is no next filter or if the next filter is not an 'and' relation
1143
- if (!nextFilterData || nextFilterData.relation !== 'and') {
1144
- // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
1145
- if (lastFilterResults.indexOf(true) === -1) {
1146
- lastFilterResults = [];
1147
- continue;
1148
- }
1149
- // we need to add all of the lastFilterResults since we need to satisfy all
1150
- propFilterSatisfiedCount += lastFilterResults.length;
1151
- lastFilterResults = [];
1152
- }
1153
- }
1154
- } // end of propFilters forEach
1155
- // add to the list of removed/trimmed rows of filter condition is satisfied
1156
- if (propFilterSatisfiedCount === propFilters.length)
1157
- trimmed[rowIndex] = true;
1158
- } // end of for-of propKeys
418
+ // clear grouping
419
+ clearGrouping() {
420
+ // clear columns
421
+ column_drag_plugin.columnTypes.forEach(t => {
422
+ const cols = this.providers.column.getColumns(t);
423
+ let deleted = false;
424
+ cols.forEach(c => {
425
+ if (column_service.isGroupingColumn(c)) {
426
+ delete c[column_service.PSEUDO_GROUP_COLUMN];
427
+ deleted = true;
428
+ }
429
+ });
430
+ // if column store had grouping clear and refresh
431
+ if (deleted) {
432
+ this.providers.column.refreshByType(t);
433
+ }
1159
434
  });
1160
- return trimmed;
435
+ // clear rows
436
+ const { source, oldNewIndexes } = this.getSource(true);
437
+ this.providers.data.setData(source, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
438
+ this.updateTrimmed(undefined, undefined, oldNewIndexes);
439
+ }
440
+ updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
441
+ // map previously trimmed data
442
+ const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.trimmed, firstLevelMap, secondLevelMap);
443
+ for (let type in trimemedOptionsToUpgrade) {
444
+ this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
445
+ }
446
+ // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
447
+ // setup trimmed data for grouping
448
+ this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
1161
449
  }
1162
450
  }
1163
451
 
1164
- var baseGetTag = toNumber._baseGetTag,
452
+ var baseGetTag = debounce._baseGetTag,
1165
453
  isArray = index.isArray_1,
1166
- isObjectLike = toNumber.isObjectLike_1;
454
+ isObjectLike = debounce.isObjectLike_1;
1167
455
 
1168
456
  /** `Object#toString` result references. */
1169
457
  var stringTag = '[object String]';
@@ -1300,7 +588,7 @@ var _stringSize = stringSize$1;
1300
588
 
1301
589
  var baseKeys = index._baseKeys,
1302
590
  getTag = index._getTag,
1303
- isArrayLike = index.isArrayLike_1,
591
+ isArrayLike$1 = index.isArrayLike_1,
1304
592
  isString = isString_1,
1305
593
  stringSize = _stringSize;
1306
594
 
@@ -1333,7 +621,7 @@ function size(collection) {
1333
621
  if (collection == null) {
1334
622
  return 0;
1335
623
  }
1336
- if (isArrayLike(collection)) {
624
+ if (isArrayLike$1(collection)) {
1337
625
  return isString(collection) ? stringSize(collection) : collection.length;
1338
626
  }
1339
627
  var tag = getTag(collection);
@@ -1354,7 +642,7 @@ var size_1 = size;
1354
642
  *
1355
643
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
1356
644
  */
1357
- class SortingPlugin extends column_utils.BasePlugin {
645
+ class SortingPlugin extends column_drag_plugin.BasePlugin {
1358
646
  async runSorting(order, comparison) {
1359
647
  var _a;
1360
648
  await this.sort(order, comparison);
@@ -1380,7 +668,7 @@ class SortingPlugin extends column_utils.BasePlugin {
1380
668
  const columns = (await this.revogrid.getColumns());
1381
669
  const sortingFunc = {};
1382
670
  for (let prop in order) {
1383
- const cmp = this.getComparer(column_utils.getColumnByProp(columns, prop), order[prop]);
671
+ const cmp = this.getComparer(column_drag_plugin.getColumnByProp(columns, prop), order[prop]);
1384
672
  sortingFunc[prop] = cmp;
1385
673
  }
1386
674
  this.runSorting(order, sortingFunc);
@@ -1566,742 +854,435 @@ class SortingPlugin extends column_utils.BasePlugin {
1566
854
  }
1567
855
  }
1568
856
 
1569
- /**
1570
- * The base implementation of `_.clamp` which doesn't coerce arguments.
1571
- *
1572
- * @private
1573
- * @param {number} number The number to clamp.
1574
- * @param {number} [lower] The lower bound.
1575
- * @param {number} upper The upper bound.
1576
- * @returns {number} Returns the clamped number.
1577
- */
1578
-
1579
- function baseClamp$1(number, lower, upper) {
1580
- if (number === number) {
1581
- if (upper !== undefined) {
1582
- number = number <= upper ? number : upper;
1583
- }
1584
- if (lower !== undefined) {
1585
- number = number >= lower ? number : lower;
1586
- }
1587
- }
1588
- return number;
1589
- }
1590
-
1591
- var _baseClamp = baseClamp$1;
1592
-
1593
- var baseClamp = _baseClamp,
1594
- toInteger$1 = index.toInteger_1;
1595
-
1596
- /** Used as references for the maximum length and index of an array. */
1597
- var MAX_ARRAY_LENGTH = 4294967295;
1598
-
1599
- /**
1600
- * Converts `value` to an integer suitable for use as the length of an
1601
- * array-like object.
1602
- *
1603
- * **Note:** This method is based on
1604
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1605
- *
1606
- * @static
1607
- * @memberOf _
1608
- * @since 4.0.0
1609
- * @category Lang
1610
- * @param {*} value The value to convert.
1611
- * @returns {number} Returns the converted integer.
1612
- * @example
1613
- *
1614
- * _.toLength(3.2);
1615
- * // => 3
1616
- *
1617
- * _.toLength(Number.MIN_VALUE);
1618
- * // => 0
1619
- *
1620
- * _.toLength(Infinity);
1621
- * // => 4294967295
1622
- *
1623
- * _.toLength('3.2');
1624
- * // => 3
1625
- */
1626
- function toLength$1(value) {
1627
- return value ? baseClamp(toInteger$1(value), 0, MAX_ARRAY_LENGTH) : 0;
1628
- }
1629
-
1630
- var toLength_1 = toLength$1;
1631
-
1632
- var toInteger = index.toInteger_1,
1633
- toLength = toLength_1;
857
+ var baseIteratee = index._baseIteratee,
858
+ isArrayLike = index.isArrayLike_1,
859
+ keys = index.keys_1;
1634
860
 
1635
861
  /**
1636
- * The base implementation of `_.fill` without an iteratee call guard.
862
+ * Creates a `_.find` or `_.findLast` function.
1637
863
  *
1638
864
  * @private
1639
- * @param {Array} array The array to fill.
1640
- * @param {*} value The value to fill `array` with.
1641
- * @param {number} [start=0] The start position.
1642
- * @param {number} [end=array.length] The end position.
1643
- * @returns {Array} Returns `array`.
865
+ * @param {Function} findIndexFunc The function to find the collection index.
866
+ * @returns {Function} Returns the new find function.
1644
867
  */
1645
- function baseFill$1(array, value, start, end) {
1646
- var length = array.length;
1647
-
1648
- start = toInteger(start);
1649
- if (start < 0) {
1650
- start = -start > length ? 0 : (length + start);
1651
- }
1652
- end = (end === undefined || end > length) ? length : toInteger(end);
1653
- if (end < 0) {
1654
- end += length;
1655
- }
1656
- end = start > end ? 0 : toLength(end);
1657
- while (start < end) {
1658
- array[start++] = value;
1659
- }
1660
- return array;
868
+ function createFind$1(findIndexFunc) {
869
+ return function(collection, predicate, fromIndex) {
870
+ var iterable = Object(collection);
871
+ if (!isArrayLike(collection)) {
872
+ var iteratee = baseIteratee(predicate);
873
+ collection = keys(collection);
874
+ predicate = function(key) { return iteratee(iterable[key], key, iterable); };
875
+ }
876
+ var index = findIndexFunc(collection, predicate, fromIndex);
877
+ return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
878
+ };
1661
879
  }
1662
880
 
1663
- var _baseFill = baseFill$1;
881
+ var _createFind = createFind$1;
1664
882
 
1665
- var baseFill = _baseFill,
1666
- isIterateeCall = index._isIterateeCall;
883
+ var createFind = _createFind,
884
+ findIndex = index.findIndex_1;
1667
885
 
1668
886
  /**
1669
- * Fills elements of `array` with `value` from `start` up to, but not
1670
- * including, `end`.
1671
- *
1672
- * **Note:** This method mutates `array`.
887
+ * Iterates over elements of `collection`, returning the first element
888
+ * `predicate` returns truthy for. The predicate is invoked with three
889
+ * arguments: (value, index|key, collection).
1673
890
  *
1674
891
  * @static
1675
892
  * @memberOf _
1676
- * @since 3.2.0
1677
- * @category Array
1678
- * @param {Array} array The array to fill.
1679
- * @param {*} value The value to fill `array` with.
1680
- * @param {number} [start=0] The start position.
1681
- * @param {number} [end=array.length] The end position.
1682
- * @returns {Array} Returns `array`.
893
+ * @since 0.1.0
894
+ * @category Collection
895
+ * @param {Array|Object} collection The collection to inspect.
896
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
897
+ * @param {number} [fromIndex=0] The index to search from.
898
+ * @returns {*} Returns the matched element, else `undefined`.
1683
899
  * @example
1684
900
  *
1685
- * var array = [1, 2, 3];
901
+ * var users = [
902
+ * { 'user': 'barney', 'age': 36, 'active': true },
903
+ * { 'user': 'fred', 'age': 40, 'active': false },
904
+ * { 'user': 'pebbles', 'age': 1, 'active': true }
905
+ * ];
906
+ *
907
+ * _.find(users, function(o) { return o.age < 40; });
908
+ * // => object for 'barney'
1686
909
  *
1687
- * _.fill(array, 'a');
1688
- * console.log(array);
1689
- * // => ['a', 'a', 'a']
910
+ * // The `_.matches` iteratee shorthand.
911
+ * _.find(users, { 'age': 1, 'active': true });
912
+ * // => object for 'pebbles'
1690
913
  *
1691
- * _.fill(Array(3), 2);
1692
- * // => [2, 2, 2]
914
+ * // The `_.matchesProperty` iteratee shorthand.
915
+ * _.find(users, ['active', false]);
916
+ * // => object for 'fred'
1693
917
  *
1694
- * _.fill([4, 6, 8, 10], '*', 1, 3);
1695
- * // => [4, '*', '*', 10]
918
+ * // The `_.property` iteratee shorthand.
919
+ * _.find(users, 'active');
920
+ * // => object for 'barney'
1696
921
  */
1697
- function fill(array, value, start, end) {
1698
- var length = array == null ? 0 : array.length;
1699
- if (!length) {
1700
- return [];
1701
- }
1702
- if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
1703
- start = 0;
1704
- end = length;
1705
- }
1706
- return baseFill(array, value, start, end);
1707
- }
922
+ var find = createFind(findIndex);
1708
923
 
1709
- var fill_1 = fill;
924
+ var find_1 = find;
1710
925
 
1711
- const INITIAL = {
1712
- mime: 'text/csv',
1713
- fileKind: 'csv',
1714
- // BOM signature
1715
- bom: true,
1716
- columnDelimiter: ',',
1717
- rowDelimiter: '\r\n',
1718
- encoding: '',
1719
- };
1720
- // The ASCII character code 13 is called a Carriage Return or CR.
1721
- const CARRIAGE_RETURN = String.fromCharCode(13);
1722
- // Chr(13) followed by a Chr(10) that compose a proper CRLF.
1723
- const LINE_FEED = String.fromCharCode(10);
1724
- const DOUBLE_QT = String.fromCharCode(34);
1725
- const NO_BREAK_SPACE = String.fromCharCode(0xfeff);
1726
- const escapeRegex = new RegExp('"', 'g');
1727
- class ExportCsv {
1728
- constructor(options = {}) {
1729
- this.options = Object.assign(Object.assign({}, INITIAL), options);
1730
- }
1731
- doExport({ data, headers, props }) {
1732
- let result = this.options.bom ? NO_BREAK_SPACE : '';
1733
- // any header
1734
- if ((headers === null || headers === void 0 ? void 0 : headers.length) > 0) {
1735
- headers.forEach(header => {
1736
- // ignore empty
1737
- if (!header.length) {
1738
- return;
1739
- }
1740
- result += this.prepareHeader(header, this.options.columnDelimiter);
1741
- result += this.options.rowDelimiter;
926
+ class ColumnDataProvider {
927
+ get order() {
928
+ const order = {};
929
+ const sorting = this.sorting;
930
+ if (sorting) {
931
+ Object.keys(sorting).forEach((prop) => {
932
+ order[prop] = sorting[prop].order;
1742
933
  });
1743
934
  }
1744
- data.forEach((rgRow, index) => {
1745
- if (index > 0) {
1746
- result += this.options.rowDelimiter;
1747
- }
1748
- // support grouping
1749
- if (column_service.isGrouping(rgRow)) {
1750
- result += this.parseCell(column_service.getGroupingName(rgRow), this.options.columnDelimiter);
1751
- return;
1752
- }
1753
- result += props.map(p => this.parseCell(rgRow[p], this.options.columnDelimiter)).join(this.options.columnDelimiter);
1754
- });
1755
- return result;
935
+ return order;
1756
936
  }
1757
- prepareHeader(columnHeaders, columnDelimiter) {
1758
- let result = '';
1759
- const newColumnHeaders = columnHeaders.map(v => this.parseCell(v, columnDelimiter, true));
1760
- result += newColumnHeaders.join(columnDelimiter);
1761
- return result;
937
+ get stores() {
938
+ return this.dataSources;
1762
939
  }
1763
- parseCell(value, columnDelimiter, force = false) {
1764
- let escape = value;
1765
- if (typeof value !== 'string') {
1766
- escape = JSON.stringify(value);
1767
- }
1768
- const toEscape = [CARRIAGE_RETURN, DOUBLE_QT, LINE_FEED, columnDelimiter];
1769
- if (typeof escape === 'undefined') {
1770
- return '';
1771
- }
1772
- if (escape !== '' && (force || toEscape.some(i => escape.indexOf(i) >= 0))) {
1773
- return `"${escape.replace(escapeRegex, '""')}"`;
1774
- }
1775
- return escape;
940
+ constructor() {
941
+ this.sorting = null;
942
+ this.dataSources = column_drag_plugin.columnTypes.reduce((sources, k) => {
943
+ sources[k] = new index.DataStore(k);
944
+ return sources;
945
+ }, {});
1776
946
  }
1777
- }
1778
-
1779
- var ExportTypes;
1780
- (function (ExportTypes) {
1781
- ExportTypes["csv"] = "csv";
1782
- })(ExportTypes || (ExportTypes = {}));
1783
- class ExportFilePlugin extends column_utils.BasePlugin {
1784
- /** Exports string */
1785
- async exportString(options = {}, t = ExportTypes.csv) {
1786
- const data = await this.beforeexport();
1787
- if (!data) {
1788
- return null;
1789
- }
1790
- return this.formatter(t, options).doExport(data);
1791
- }
1792
- /** Exports Blob */
1793
- async exportBlob(options = {}, t = ExportTypes.csv) {
1794
- return await this.getBlob(this.formatter(t, options));
1795
- }
1796
- /** Export file */
1797
- async exportFile(options = {}, t = ExportTypes.csv) {
1798
- const formatter = this.formatter(t, options);
1799
- // url
1800
- const URL = window.URL || window.webkitURL;
1801
- const a = document.createElement('a');
1802
- const { filename, fileKind } = formatter.options;
1803
- const name = `${filename}.${fileKind}`;
1804
- const blob = await this.getBlob(formatter);
1805
- const url = blob ? URL.createObjectURL(blob) : '';
1806
- a.style.display = 'none';
1807
- a.setAttribute('href', url);
1808
- a.setAttribute('download', name);
1809
- this.revogrid.appendChild(a);
1810
- a.dispatchEvent(new MouseEvent('click'));
1811
- this.revogrid.removeChild(a);
1812
- // delay for revoke, correct for some browsers
1813
- await index.timeout(120);
1814
- URL.revokeObjectURL(url);
1815
- }
1816
- /** Blob object */
1817
- async getBlob(formatter) {
1818
- const type = `${formatter.options.mime};charset=${formatter.options.encoding}`;
1819
- if (typeof Blob !== 'undefined') {
1820
- const data = await this.beforeexport();
1821
- if (!data) {
1822
- return null;
1823
- }
1824
- return new Blob([formatter.doExport(data)], { type });
1825
- }
1826
- return null;
947
+ column(c, pin) {
948
+ return this.getColumn(c, pin || 'rgCol');
1827
949
  }
1828
- // before event
1829
- async beforeexport() {
1830
- let data = await this.getData();
1831
- const event = this.emit('beforeexport', { data });
1832
- if (event.defaultPrevented) {
1833
- return null;
1834
- }
1835
- return event.detail.data;
950
+ getColumn(virtualIndex, type) {
951
+ return index.getSourceItem(this.dataSources[type].store, virtualIndex);
1836
952
  }
1837
- async getData() {
1838
- const data = await this.getSource();
1839
- const colSource = [];
1840
- const colPromises = [];
1841
- column_utils.columnTypes.forEach((t, i) => {
1842
- colPromises.push(this.getColPerSource(t).then(s => (colSource[i] = s)));
953
+ getRawColumns() {
954
+ return index.reduce_1(this.dataSources, (result, item, type) => {
955
+ result[type] = item.store.get('source');
956
+ return result;
957
+ }, {
958
+ rgCol: [],
959
+ colPinStart: [],
960
+ colPinEnd: [],
1843
961
  });
1844
- await Promise.all(colPromises);
1845
- const columns = {
1846
- headers: [],
1847
- props: [],
1848
- };
1849
- for (let source of colSource) {
1850
- source.headers.forEach((h, i) => {
1851
- if (!columns.headers[i]) {
1852
- columns.headers[i] = [];
1853
- }
1854
- columns.headers[i].push(...h);
1855
- });
1856
- columns.props.push(...source.props);
1857
- }
1858
- return Object.assign({ data }, columns);
1859
- }
1860
- async getColPerSource(t) {
1861
- const store = await this.revogrid.getColumnStore(t);
1862
- const source = store.get('source');
1863
- const virtualIndexes = store.get('items');
1864
- const depth = store.get('groupingDepth');
1865
- const groups = store.get('groups');
1866
- const colNames = [];
1867
- const colProps = [];
1868
- const visibleItems = virtualIndexes.reduce((r, v, virtualIndex) => {
1869
- const prop = source[v].prop;
1870
- colNames.push(source[v].name || '');
1871
- colProps.push(prop);
1872
- r[prop] = virtualIndex;
1873
- return r;
1874
- }, {});
1875
- const rows = this.getGroupHeaders(depth, groups, virtualIndexes, visibleItems);
1876
- rows.push(colNames);
1877
- return {
1878
- headers: rows,
1879
- props: colProps,
1880
- };
1881
962
  }
1882
- getGroupHeaders(depth, groups, items, visibleItems) {
1883
- const rows = [];
1884
- const template = fill_1(new Array(items.length), '');
1885
- for (let d = 0; d < depth; d++) {
1886
- const rgRow = [...template];
1887
- rows.push(rgRow);
1888
- if (!groups[d]) {
1889
- continue;
1890
- }
1891
- const levelGroups = groups[d];
1892
- // add names of groups
1893
- levelGroups.forEach((group) => {
1894
- const minIndex = this.findGroupStartIndex(group.ids, visibleItems);
1895
- if (typeof minIndex === 'number') {
1896
- rgRow[minIndex] = group.name;
1897
- }
1898
- });
963
+ getColumns(type = 'all') {
964
+ if (type !== 'all') {
965
+ return this.dataSources[type].store.get('source');
1899
966
  }
1900
- return rows;
1901
- }
1902
- findGroupStartIndex(ids, visibleItems) {
1903
- let min;
1904
- ids.forEach(id => {
1905
- const current = visibleItems[id];
1906
- if (typeof current === 'number') {
1907
- if (typeof min !== 'number' || min > current) {
1908
- min = current;
1909
- }
1910
- }
1911
- });
1912
- return min;
1913
- }
1914
- async getSource() {
1915
- const data = [];
1916
- const promisesData = [];
1917
- column_utils.rowTypes.forEach(t => {
1918
- const dataPart = [];
1919
- data.push(dataPart);
1920
- const promise = this.revogrid.getVisibleSource(t).then((d) => dataPart.push(...d));
1921
- promisesData.push(promise);
1922
- });
1923
- await Promise.all(promisesData);
1924
- return data.reduce((r, v) => {
1925
- r.push(...v);
967
+ return column_drag_plugin.columnTypes.reduce((r, t) => {
968
+ r.push(...this.dataSources[t].store.get('source'));
1926
969
  return r;
1927
970
  }, []);
1928
971
  }
1929
- // get correct class for future multiple types support
1930
- formatter(type, options = {}) {
1931
- switch (type) {
1932
- case ExportTypes.csv:
1933
- return new ExportCsv(options);
1934
- default:
1935
- throw new Error('Unknown format');
1936
- }
972
+ getColumnIndexByProp(prop, type) {
973
+ return index.getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);
1937
974
  }
1938
- }
1939
-
1940
- // provide collapse data
1941
- function doCollapse(pIndex, source) {
1942
- const model = source[pIndex];
1943
- const collapseValue = model[column_service.PSEUDO_GROUP_ITEM_VALUE];
1944
- const trimmed = {};
1945
- let i = pIndex + 1;
1946
- const total = source.length;
1947
- while (i < total) {
1948
- const currentModel = source[i];
1949
- if (column_service.isGrouping(currentModel)) {
1950
- const currentValue = currentModel[column_service.PSEUDO_GROUP_ITEM_VALUE];
1951
- if (!currentValue.length || !currentValue.startsWith(collapseValue + ',')) {
1952
- break;
1953
- }
1954
- currentModel[column_service.GROUP_EXPANDED] = false;
1955
- }
1956
- trimmed[i++] = true;
975
+ getColumnByProp(prop, type) {
976
+ const items = this.dataSources[type].store.get('source');
977
+ return find_1(items, { prop });
1957
978
  }
1958
- model[column_service.GROUP_EXPANDED] = false;
1959
- return { trimmed };
1960
- }
1961
- /**
1962
- *
1963
- * @param pIndex - physical index
1964
- * @param vIndex - virtual index, need to update item collection
1965
- * @param source - data source
1966
- * @param rowItemsIndexes - rgRow indexes
1967
- */
1968
- function doExpand(vIndex, source, rowItemsIndexes) {
1969
- const physicalIndex = rowItemsIndexes[vIndex];
1970
- const model = source[physicalIndex];
1971
- const currentGroup = column_service.getParsedGroup(model[column_service.PSEUDO_GROUP_ITEM_ID]);
1972
- const trimmed = {};
1973
- // no group found
1974
- if (!currentGroup) {
1975
- return { trimmed };
979
+ refreshByType(type) {
980
+ this.dataSources[type].refresh();
1976
981
  }
1977
- const groupItems = [];
1978
- model[column_service.GROUP_EXPANDED] = true;
1979
- let i = physicalIndex + 1;
1980
- const total = source.length;
1981
- let groupLevelOnly = 0;
1982
- // go through all rows
1983
- while (i < total) {
1984
- const currentModel = source[i];
1985
- const isGroup = column_service.isGrouping(currentModel);
1986
- // group found
1987
- if (isGroup) {
1988
- if (!column_service.isSameGroup(currentGroup, model, currentModel)) {
1989
- break;
982
+ setColumns(data) {
983
+ column_drag_plugin.columnTypes.forEach(k => {
984
+ // set columns data
985
+ this.dataSources[k].updateData(data.columns[k], {
986
+ // max depth level
987
+ depth: data.maxLevel,
988
+ // groups
989
+ groups: data.columnGrouping[k].reduce((res, g) => {
990
+ if (!res[g.level]) {
991
+ res[g.level] = [];
992
+ }
993
+ res[g.level].push(g);
994
+ return res;
995
+ }, {}),
996
+ });
997
+ });
998
+ this.sorting = data.sort;
999
+ return data;
1000
+ }
1001
+ updateColumns(cols) {
1002
+ // collect column by type and propert
1003
+ const columnByKey = cols.reduce((res, c) => {
1004
+ const type = column_drag_plugin.getColumnType(c);
1005
+ if (!res[type]) {
1006
+ res[type] = {};
1990
1007
  }
1991
- else if (!groupLevelOnly) {
1992
- // if get group first it's group only level
1993
- groupLevelOnly = currentModel[column_service.GROUP_DEPTH];
1008
+ res[type][c.prop] = c;
1009
+ return res;
1010
+ }, {});
1011
+ // find indexes in source
1012
+ const colByIndex = {};
1013
+ for (const t in columnByKey) {
1014
+ if (!columnByKey.hasOwnProperty(t)) {
1015
+ continue;
1016
+ }
1017
+ const type = t;
1018
+ const colsToUpdate = columnByKey[type];
1019
+ const items = this.dataSources[type].store.get('source');
1020
+ colByIndex[type] = {};
1021
+ for (let i = 0; i < items.length; i++) {
1022
+ const rgCol = items[i];
1023
+ const colToUpdateIfExists = colsToUpdate === null || colsToUpdate === void 0 ? void 0 : colsToUpdate[rgCol.prop];
1024
+ if (colToUpdateIfExists) {
1025
+ colByIndex[type][i] = colToUpdateIfExists;
1026
+ }
1994
1027
  }
1995
1028
  }
1996
- // level 0 or same depth
1997
- if (!groupLevelOnly || (isGroup && groupLevelOnly === currentModel[column_service.GROUP_DEPTH])) {
1998
- trimmed[i] = false;
1999
- groupItems.push(i);
1029
+ for (const t in colByIndex) {
1030
+ if (!colByIndex.hasOwnProperty(t)) {
1031
+ continue;
1032
+ }
1033
+ const type = t;
1034
+ index.setSourceByVirtualIndex(this.dataSources[type].store, colByIndex[type] || {});
2000
1035
  }
2001
- i++;
2002
- }
2003
- const result = {
2004
- trimmed,
2005
- };
2006
- if (groupItems.length) {
2007
- const items = [...rowItemsIndexes];
2008
- items.splice(vIndex + 1, 0, ...groupItems);
2009
- result.items = items;
2010
1036
  }
2011
- return result;
2012
- }
2013
-
2014
- const TRIMMED_GROUPING = 'grouping';
2015
- /**
2016
- * Prepare trimming updated indexes for grouping
2017
- * @param initiallyTrimed
2018
- * @param firstLevelMap
2019
- * @param secondLevelMap
2020
- */
2021
- function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLevelMap) {
2022
- const trimemedOptionsToUpgrade = {};
2023
- /**
2024
- * go through all groups except grouping
2025
- */
2026
- for (let type in initiallyTrimed) {
2027
- if (type === TRIMMED_GROUPING) {
2028
- continue;
2029
- }
2030
- const items = initiallyTrimed[type];
2031
- const newItems = {};
2032
- for (let initialIndex in items) {
2033
- /**
2034
- * if item exists we find it in collection
2035
- * we support 2 level of conversions
2036
- */
2037
- let newConversionIndex = firstLevelMap[initialIndex];
2038
- if (secondLevelMap) {
2039
- newConversionIndex = secondLevelMap[newConversionIndex];
2040
- }
2041
- /**
2042
- * if item was trimmed previously
2043
- * trimming makes sense to apply
2044
- */
2045
- if (items[initialIndex]) {
2046
- newItems[newConversionIndex] = true;
2047
- /**
2048
- * If changes present apply changes to new source
2049
- */
2050
- if (newConversionIndex !== parseInt(initialIndex, 10)) {
2051
- trimemedOptionsToUpgrade[type] = newItems;
2052
- }
2053
- }
1037
+ updateColumn(column, index$1) {
1038
+ const type = column_drag_plugin.getColumnType(column);
1039
+ index.setSourceByVirtualIndex(this.dataSources[type].store, { [index$1]: column });
1040
+ }
1041
+ updateColumnSorting(column, index, sorting, additive) {
1042
+ if (!additive) {
1043
+ this.clearSorting();
1044
+ }
1045
+ column.order = sorting;
1046
+ if (!this.sorting) {
1047
+ this.sorting = {};
2054
1048
  }
1049
+ this.sorting[column.prop] = column;
1050
+ this.updateColumn(column, index);
1051
+ return column;
1052
+ }
1053
+ clearSorting() {
1054
+ const types = index.reduce_1(this.sorting, (r, c) => {
1055
+ const k = column_drag_plugin.getColumnType(c);
1056
+ r[k] = true;
1057
+ return r;
1058
+ }, {});
1059
+ index.each(types, (_, type) => {
1060
+ const cols = this.dataSources[type].store.get('source');
1061
+ index.each(cols, (c) => (c.order = undefined));
1062
+ this.dataSources[type].setData({ source: [...cols] });
1063
+ });
1064
+ this.sorting = {};
2055
1065
  }
2056
- return trimemedOptionsToUpgrade;
2057
1066
  }
2058
1067
 
2059
- class GroupingRowPlugin extends column_utils.BasePlugin {
2060
- get hasProps() {
2061
- var _a, _b, _c;
2062
- return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) && ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.length);
2063
- }
2064
- get store() {
2065
- return this.providers.data.stores[column_service.GROUPING_ROW_TYPE].store;
2066
- }
2067
- // proxy for items get
2068
- get rowItems() {
2069
- return this.store.get('items');
1068
+ /**
1069
+ * Data source provider
1070
+ */
1071
+ class DataProvider {
1072
+ constructor(dimensionProvider) {
1073
+ this.dimensionProvider = dimensionProvider;
1074
+ this.stores = index.reduce_1(column_drag_plugin.rowTypes, (sources, k) => {
1075
+ sources[k] = new index.DataStore(k);
1076
+ return sources;
1077
+ }, {});
2070
1078
  }
2071
- get trimmed() {
2072
- return this.store.get('trimmed');
1079
+ setData(data, type = 'rgRow', disableVirtualRows = false, grouping, silent = false) {
1080
+ // set rgRow data
1081
+ this.stores[type].updateData([...data], grouping, silent);
1082
+ // for pinned row no need virtual data
1083
+ const noVirtual = type !== 'rgRow' || disableVirtualRows;
1084
+ this.dimensionProvider.setData(data.length, type, noVirtual);
1085
+ return data;
2073
1086
  }
2074
- constructor(revogrid, providers) {
2075
- super(revogrid, providers);
2076
- this.revogrid = revogrid;
2077
- this.providers = providers;
1087
+ getModel(virtualIndex, type = 'rgRow') {
1088
+ const store = this.stores[type].store;
1089
+ return index.getSourceItem(store, virtualIndex);
2078
1090
  }
2079
- // befoce cell focus
2080
- onFocus(e) {
2081
- if (column_service.isGrouping(e.detail.model)) {
2082
- e.preventDefault();
2083
- }
1091
+ setCellData({ type, rowIndex, prop, val }, mutate = true) {
1092
+ const model = this.getModel(rowIndex, type);
1093
+ model[prop] = val;
1094
+ // apply data to source
1095
+ index.setSourceByVirtualIndex(this.stores[type].store, { [rowIndex]: model }, mutate);
2084
1096
  }
2085
- // expand event triggered
2086
- onExpand({ virtualIndex }) {
2087
- const { source } = this.getSource();
2088
- let newTrimmed = this.trimmed[TRIMMED_GROUPING];
2089
- let i = index.getPhysical(this.store, virtualIndex);
2090
- const model = source[i];
2091
- const prevExpanded = model[column_service.GROUP_EXPANDED];
2092
- if (!prevExpanded) {
2093
- const { trimmed, items } = doExpand(virtualIndex, source, this.rowItems);
2094
- newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2095
- if (items) {
2096
- index.setItems(this.store, items);
1097
+ setRangeData(data, type) {
1098
+ const items = {};
1099
+ for (let rowIndex in data) {
1100
+ const oldModel = (items[rowIndex] = index.getSourceItem(this.stores[type].store, parseInt(rowIndex, 10)));
1101
+ if (!oldModel) {
1102
+ continue;
1103
+ }
1104
+ for (let prop in data[rowIndex]) {
1105
+ oldModel[prop] = data[rowIndex][prop];
2097
1106
  }
2098
1107
  }
2099
- else {
2100
- const { trimmed } = doCollapse(i, source);
2101
- newTrimmed = Object.assign(Object.assign({}, newTrimmed), trimmed);
2102
- this.revogrid.clearFocus();
1108
+ // apply data to source
1109
+ index.setSourceByVirtualIndex(this.stores[type].store, items);
1110
+ }
1111
+ refresh(type = 'all') {
1112
+ if (column_drag_plugin.isRowType(type)) {
1113
+ this.refreshItems(type);
2103
1114
  }
2104
- this.store.set('source', source);
2105
- this.revogrid.addTrimmed(newTrimmed, TRIMMED_GROUPING);
1115
+ column_drag_plugin.rowTypes.forEach((t) => this.refreshItems(t));
2106
1116
  }
2107
- // get source based on proxy item collection to preserve rgRow order
2108
- getSource(withoutGrouping = false) {
2109
- const source = this.store.get('source');
2110
- const items = this.store.get('proxyItems');
2111
- let index = 0;
2112
- // order important here, expected parent is first, then others
2113
- return items.reduce((result, i) => {
2114
- const model = source[i];
2115
- if (!withoutGrouping) {
2116
- result.source.push(model);
2117
- return result;
2118
- }
2119
- // grouping filter
2120
- if (column_service.isGrouping(model)) {
2121
- if (model[column_service.GROUP_EXPANDED]) {
2122
- result.prevExpanded[model[column_service.PSEUDO_GROUP_ITEM_VALUE]] = true;
2123
- }
2124
- }
2125
- else {
2126
- result.source.push(model);
2127
- result.oldNewIndexes[i] = index;
2128
- index++;
2129
- }
2130
- return result;
2131
- }, {
2132
- source: [],
2133
- prevExpanded: {},
2134
- oldNewIndexes: {},
2135
- });
1117
+ refreshItems(type = 'rgRow') {
1118
+ const items = this.stores[type].store.get('items');
1119
+ this.stores[type].setData({ items: [...items] });
2136
1120
  }
2137
- setColumnGrouping(cols) {
2138
- // if 0 column as holder
2139
- if (cols === null || cols === void 0 ? void 0 : cols.length) {
2140
- cols[0][column_service.PSEUDO_GROUP_COLUMN] = true;
2141
- return true;
2142
- }
2143
- return false;
1121
+ setGrouping({ depth }, type = 'rgRow') {
1122
+ this.stores[type].setData({ groupingDepth: depth });
2144
1123
  }
2145
- setColumns({ columns }) {
2146
- for (let type of column_utils.columnTypes) {
2147
- if (this.setColumnGrouping(columns[type])) {
2148
- break;
2149
- }
1124
+ setTrimmed(trimmed, type = 'rgRow') {
1125
+ const store = this.stores[type];
1126
+ store.addTrimmed(trimmed);
1127
+ this.dimensionProvider.setTrimmed(trimmed, type);
1128
+ if (type === 'rgRow') {
1129
+ this.dimensionProvider.setData(index.getVisibleSourceItem(store.store).length, type);
2150
1130
  }
2151
1131
  }
2152
- // evaluate drag between groups
2153
- onDrag(e) {
2154
- const { from, to } = e.detail;
2155
- const isDown = to - from >= 0;
2156
- const { source } = this.getSource();
2157
- const items = this.rowItems;
2158
- let i = isDown ? from : to;
2159
- const end = isDown ? to : from;
2160
- for (; i < end; i++) {
2161
- const model = source[items[i]];
2162
- const isGroup = column_service.isGrouping(model);
2163
- if (isGroup) {
2164
- e.preventDefault();
2165
- return;
2166
- }
2167
- }
1132
+ }
1133
+
1134
+ /**
1135
+ * Dimension provider
1136
+ * Stores dimension information and custom sizes
1137
+ */
1138
+ class DimensionProvider {
1139
+ constructor(viewports, config) {
1140
+ this.viewports = viewports;
1141
+ const sizeChanged = debounce.debounce_1((k) => config.realSizeChanged(k), index.RESIZE_INTERVAL);
1142
+ this.stores = index.reduce_1([...column_drag_plugin.rowTypes, ...column_drag_plugin.columnTypes], (sources, k) => {
1143
+ sources[k] = new column_drag_plugin.DimensionStore();
1144
+ sources[k].store.onChange('realSize', () => sizeChanged(k));
1145
+ return sources;
1146
+ }, {});
2168
1147
  }
2169
- beforeTrimmedApply(trimmed, type) {
2170
- /** Before filter apply remove grouping filtering */
2171
- if (type === FILTER_TRIMMED_TYPE) {
2172
- const source = this.store.get('source');
2173
- for (let index in trimmed) {
2174
- if (trimmed[index] && column_service.isGrouping(source[index])) {
2175
- trimmed[index] = false;
2176
- }
2177
- }
1148
+ /**
1149
+ * Clear old sizes from dimension and viewports
1150
+ * @param type - dimension type
1151
+ * @param count - count of items
1152
+ */
1153
+ clearSize(t, count) {
1154
+ this.stores[t].drop();
1155
+ // after we done with drop trigger viewport recalculaction
1156
+ this.viewports.stores[t].setOriginalSizes(this.stores[t].store.get('originItemSize'));
1157
+ this.setItemCount(count, t);
1158
+ }
1159
+ /**
1160
+ * Apply new custom sizes to dimension and view port
1161
+ * @param type - dimension type
1162
+ * @param sizes - new custom sizes
1163
+ * @param keepOld - keep old sizes merge new with old
1164
+ */
1165
+ setCustomSizes(type, sizes, keepOld = false) {
1166
+ let newSizes = sizes;
1167
+ if (keepOld) {
1168
+ const oldSizes = this.stores[type].store.get('sizes');
1169
+ newSizes = Object.assign(Object.assign({}, oldSizes), sizes);
2178
1170
  }
1171
+ this.stores[type].setDimensionSize(newSizes);
1172
+ this.updateViewport(type, true);
2179
1173
  }
2180
- // subscribe to grid events to process them accordingly
2181
- subscribe() {
2182
- /** if grouping present and new data source arrived */
2183
- this.addEventListener('beforesourceset', ({ detail }) => this.onDataSet(detail));
2184
- this.addEventListener('beforecolumnsset', ({ detail }) => this.setColumns(detail));
2185
- /**
2186
- * filter applied need to clear grouping and apply again
2187
- * based on new results can be new grouping
2188
- */
2189
- this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
2190
- /**
2191
- * sorting applied need to clear grouping and apply again
2192
- * based on new results whole grouping order will changed
2193
- */
2194
- this.addEventListener('aftersortingapply', () => this.doSourceUpdate(Object.assign({}, this.options)));
2195
- /**
2196
- * Apply logic for focus inside of grouping
2197
- * We can't focus on grouping rows, navigation only inside of groups for now
2198
- */
2199
- this.addEventListener('beforecellfocus', e => this.onFocus(e));
2200
- /**
2201
- * Prevent rgRow drag outside the group
2202
- */
2203
- this.addEventListener('roworderchanged', e => this.onDrag(e));
2204
- /**
2205
- * When grouping expand icon was clicked
2206
- */
2207
- this.addEventListener(column_service.GROUP_EXPAND_EVENT, ({ detail }) => this.onExpand(detail));
1174
+ setItemCount(realCount, type) {
1175
+ this.viewports.stores[type].setViewport({ realCount });
1176
+ this.stores[type].setStore({ count: realCount });
1177
+ }
1178
+ /**
1179
+ * Apply trimmed items
1180
+ * @param trimmed - trimmed items
1181
+ * @param type
1182
+ */
1183
+ setTrimmed(trimmed, type) {
1184
+ const allTrimmed = index.gatherTrimmedItems(trimmed);
1185
+ const dimStoreType = this.stores[type];
1186
+ dimStoreType.setStore({ trimmed: allTrimmed });
1187
+ this.updateViewport(type, true);
2208
1188
  }
2209
1189
  /**
2210
- * Starts global source update with group clearing and applying new one
2211
- * Initiated when need to reapply grouping
1190
+ * Sets dimension data and view port coordinate
1191
+ * @param itemCount
1192
+ * @param type - dimension type
1193
+ * @param noVirtual - disable virtual data
2212
1194
  */
2213
- doSourceUpdate(options) {
2214
- var _a;
2215
- if (!this.hasProps) {
2216
- return;
1195
+ setData(itemCount, type, noVirtual = false) {
1196
+ this.setItemCount(itemCount, type);
1197
+ // Virtualization will get disabled
1198
+ if (noVirtual) {
1199
+ const dimension = this.stores[type].getCurrentState();
1200
+ this.viewports.stores[type].setViewport({
1201
+ virtualSize: dimension.realSize,
1202
+ });
2217
1203
  }
2218
- /**
2219
- * Get source without grouping
2220
- * @param newOldIndexMap - provides us mapping with new indexes vs old indexes, we would use it for trimmed mapping
2221
- */
2222
- const { source, prevExpanded, oldNewIndexes } = this.getSource(true);
2223
- /**
2224
- * Group again
2225
- * @param oldNewIndexMap - provides us mapping with new indexes vs old indexes
2226
- */
2227
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
2228
- // setup source
2229
- this.providers.data.setData(sourceWithGroups, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
2230
- this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
1204
+ this.updateViewport(type);
2231
1205
  }
2232
- /**
2233
- * Apply grouping on data set
2234
- * Clear grouping from source
2235
- * If source came from other plugin
2236
- */
2237
- onDataSet(data) {
2238
- var _a;
2239
- if (!this.hasProps || !(data === null || data === void 0 ? void 0 : data.source) || !data.source.length) {
2240
- return;
1206
+ applyNewColumns(columns, disableVirtualX) {
1207
+ for (let type of column_drag_plugin.columnTypes) {
1208
+ // clear existing data
1209
+ this.stores[type].drop();
1210
+ const items = columns[type];
1211
+ // for pinned col no need virtual data
1212
+ const noVirtual = type !== 'rgCol' || disableVirtualX;
1213
+ // setItemCount
1214
+ this.stores[type].setStore({ count: items.length });
1215
+ // setCustomSizes
1216
+ const newSizes = column_drag_plugin.getColumnSizes(items);
1217
+ this.stores[type].setDimensionSize(newSizes);
1218
+ const vpUpdate = {
1219
+ // this triggers drop on realCount change
1220
+ realCount: items.length,
1221
+ };
1222
+ // Virtualization will get disabled
1223
+ if (noVirtual) {
1224
+ vpUpdate.virtualSize = this.stores[type].getCurrentState().realSize;
1225
+ }
1226
+ this.viewports.stores[type].setViewport(vpUpdate);
1227
+ this.setViewPortCoordinate({
1228
+ coordinate: this.viewports.stores[type].lastCoordinate,
1229
+ type,
1230
+ });
2241
1231
  }
2242
- const source = data.source.filter(s => !column_service.isGrouping(s));
2243
- const expanded = this.revogrid.grouping || {};
2244
- const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = column_service.gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
2245
- data.source = sourceWithGroups;
2246
- this.providers.data.setGrouping({ depth });
2247
- this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
2248
1232
  }
2249
- // apply grouping
2250
- setGrouping(options) {
2251
- // unsubscribe from all events when group applied
2252
- this.clearSubscriptions();
2253
- this.options = options;
2254
- // clear props, no grouping exists
2255
- if (!options.props || !Object.keys(options.props).length) {
2256
- this.clearGrouping();
2257
- return;
2258
- }
2259
- // props exist and source inited
2260
- const { source } = this.getSource();
2261
- if (source.length) {
2262
- this.doSourceUpdate(Object.assign({}, options));
1233
+ getFullSize() {
1234
+ var _a, _b;
1235
+ let x = 0;
1236
+ let y = 0;
1237
+ for (let type of column_drag_plugin.columnTypes) {
1238
+ x += ((_a = this.stores[type]) === null || _a === void 0 ? void 0 : _a.store.get('realSize')) || 0;
2263
1239
  }
2264
- // props exist and columns inited
2265
- for (let t of column_utils.columnTypes) {
2266
- if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
2267
- this.providers.column.refreshByType(t);
2268
- break;
2269
- }
1240
+ for (let type of column_drag_plugin.rowTypes) {
1241
+ y += ((_b = this.stores[type]) === null || _b === void 0 ? void 0 : _b.store.get('realSize')) || 0;
2270
1242
  }
2271
- // if has any grouping subscribe to events again
2272
- this.subscribe();
1243
+ return { y, x };
2273
1244
  }
2274
- // clear grouping
2275
- clearGrouping() {
2276
- // clear columns
2277
- column_utils.columnTypes.forEach(t => {
2278
- const cols = this.providers.column.getColumns(t);
2279
- let deleted = false;
2280
- cols.forEach(c => {
2281
- if (column_service.isGroupingColumn(c)) {
2282
- delete c[column_service.PSEUDO_GROUP_COLUMN];
2283
- deleted = true;
2284
- }
2285
- });
2286
- // if column store had grouping clear and refresh
2287
- if (deleted) {
2288
- this.providers.column.refreshByType(t);
2289
- }
1245
+ updateViewport(type, force = false) {
1246
+ this.setViewPortCoordinate({
1247
+ coordinate: this.viewports.stores[type].lastCoordinate,
1248
+ type,
1249
+ force,
2290
1250
  });
2291
- // clear rows
2292
- const { source, oldNewIndexes } = this.getSource(true);
2293
- this.providers.data.setData(source, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2294
- this.updateTrimmed(undefined, undefined, oldNewIndexes);
2295
1251
  }
2296
- updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap = {}, secondLevelMap) {
2297
- // map previously trimmed data
2298
- const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.trimmed, firstLevelMap, secondLevelMap);
2299
- for (let type in trimemedOptionsToUpgrade) {
2300
- this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
1252
+ setViewPortCoordinate({ coordinate, type, force = false, }) {
1253
+ const dimension = this.stores[type].getCurrentState();
1254
+ this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
1255
+ }
1256
+ getViewPortPos(e) {
1257
+ const dimension = this.stores[e.dimension].getCurrentState();
1258
+ const item = index.getItemByIndex(dimension, e.coordinate);
1259
+ return item.start;
1260
+ }
1261
+ setSettings(data, dimensionType) {
1262
+ let stores = [];
1263
+ switch (dimensionType) {
1264
+ case 'rgCol':
1265
+ stores = column_drag_plugin.columnTypes;
1266
+ break;
1267
+ case 'rgRow':
1268
+ stores = column_drag_plugin.rowTypes;
1269
+ break;
2301
1270
  }
2302
- // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
2303
- // setup trimmed data for grouping
2304
- this.revogrid.addTrimmed(Object.assign({}, trimmedGroup), TRIMMED_GROUPING);
1271
+ for (let s of stores) {
1272
+ this.stores[s].setStore(data);
1273
+ }
1274
+ }
1275
+ }
1276
+
1277
+ class ViewportProvider {
1278
+ constructor() {
1279
+ this.stores = index.reduce_1([...column_drag_plugin.rowTypes, ...column_drag_plugin.columnTypes], (sources, k) => {
1280
+ sources[k] = new rowHeaderUtils.ViewportStore(k);
1281
+ return sources;
1282
+ }, {});
1283
+ }
1284
+ setViewport(type, data) {
1285
+ this.stores[type].setViewport(data);
2305
1286
  }
2306
1287
  }
2307
1288
 
@@ -2345,7 +1326,7 @@ class ViewportService {
2345
1326
  // Transform data from stores and apply it to different components
2346
1327
  const columns = [];
2347
1328
  let x = 0; // we increase x only if column present
2348
- column_utils.columnTypes.forEach(val => {
1329
+ column_drag_plugin.columnTypes.forEach(val => {
2349
1330
  const colStore = config.columnProvider.stores[val].store;
2350
1331
  // only columns that have data show
2351
1332
  if (!colStore.get('items').length) {
@@ -2432,17 +1413,17 @@ class ViewportService {
2432
1413
  /** Collect Row data */
2433
1414
  dataViewPort(data) {
2434
1415
  const slots = {
2435
- rowPinStart: column_service.HEADER_SLOT,
2436
- rgRow: column_service.CONTENT_SLOT,
2437
- rowPinEnd: column_service.FOOTER_SLOT,
1416
+ rowPinStart: viewport_helpers.HEADER_SLOT,
1417
+ rgRow: viewport_helpers.CONTENT_SLOT,
1418
+ rowPinEnd: viewport_helpers.FOOTER_SLOT,
2438
1419
  };
2439
1420
  // y position for selection
2440
1421
  let y = 0;
2441
- return column_utils.rowTypes.reduce((result, type) => {
1422
+ return column_drag_plugin.rowTypes.reduce((result, type) => {
2442
1423
  // filter out empty sources, we still need to return source to keep slot working
2443
1424
  const isPresent = data.viewports[type].store.get('realCount') || type === 'rgRow';
2444
- const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y: isPresent ? y : selection_helpers.EMPTY_INDEX }) });
2445
- const partition = column_service.viewportDataPartition(rgCol, type, slots[type], type !== 'rgRow');
1425
+ const rgCol = Object.assign(Object.assign({}, data), { position: Object.assign(Object.assign({}, data.position), { y: isPresent ? y : column_service.EMPTY_INDEX }) });
1426
+ const partition = viewport_helpers.viewportDataPartition(rgCol, type, slots[type], type !== 'rgRow');
2446
1427
  result.push(partition);
2447
1428
  if (isPresent) {
2448
1429
  y++;
@@ -2568,9 +1549,9 @@ class GridScrollingService {
2568
1549
  if (elKey === key) {
2569
1550
  continue;
2570
1551
  }
2571
- if (column_utils.columnTypes.includes(key) &&
1552
+ if (column_drag_plugin.columnTypes.includes(key) &&
2572
1553
  (elKey === 'headerRow' ||
2573
- column_utils.columnTypes.includes(elKey))) {
1554
+ column_drag_plugin.columnTypes.includes(elKey))) {
2574
1555
  for (let el of this.elements[elKey]) {
2575
1556
  await ((_a = el.changeScroll) === null || _a === void 0 ? void 0 : _a.call(el, e, true));
2576
1557
  }
@@ -2656,95 +1637,6 @@ const OrderRenderer = ({ ref }) => {
2656
1637
  index$1.h("div", { class: "drag-position", ref: e => (service.rgRow = e) })));
2657
1638
  };
2658
1639
 
2659
- class StretchColumn extends column_utils.BasePlugin {
2660
- constructor(revogrid, providers) {
2661
- super(revogrid, providers);
2662
- this.providers = providers;
2663
- this.stretchedColumn = null;
2664
- // calculate scroll bar size for current user session
2665
- this.scrollSize = index.getScrollbarSize(document);
2666
- // subscribe to column changes
2667
- const beforecolumnapplied = ({ detail: { columns }, }) => this.applyStretch(columns);
2668
- this.addEventListener('beforecolumnapplied', beforecolumnapplied);
2669
- }
2670
- setScroll({ type, hasScroll }) {
2671
- var _a;
2672
- if (type === 'rgRow' &&
2673
- this.stretchedColumn &&
2674
- ((_a = this.stretchedColumn) === null || _a === void 0 ? void 0 : _a.initialSize) === this.stretchedColumn.size) {
2675
- if (hasScroll) {
2676
- this.stretchedColumn.size -= this.scrollSize;
2677
- this.apply();
2678
- this.dropChanges();
2679
- }
2680
- }
2681
- }
2682
- activateChanges() {
2683
- const setScroll = ({ detail }) => this.setScroll(detail);
2684
- this.addEventListener('scrollchange', setScroll);
2685
- }
2686
- dropChanges() {
2687
- this.stretchedColumn = null;
2688
- this.removeEventListener('scrollchange');
2689
- }
2690
- apply() {
2691
- if (!this.stretchedColumn) {
2692
- return;
2693
- }
2694
- const type = 'rgCol';
2695
- const sizes = this.providers.dimension.stores[type].store.get('sizes');
2696
- this.providers.dimension.setCustomSizes(type, Object.assign(Object.assign({}, sizes), { [this.stretchedColumn.index]: this.stretchedColumn.size }), true);
2697
- }
2698
- /**
2699
- * Apply stretch changes
2700
- */
2701
- applyStretch(columns) {
2702
- // unsubscribe from all events
2703
- this.dropChanges();
2704
- // calculate grid size
2705
- let sizeDifference = this.revogrid.clientWidth - 1;
2706
- index.each(columns, (_, type) => {
2707
- const realSize = this.providers.dimension.stores[type].store.get('realSize');
2708
- sizeDifference -= realSize;
2709
- });
2710
- if (this.revogrid.rowHeaders) {
2711
- const itemsLength = this.providers.data.stores.rgRow.store.get('source').length;
2712
- const header = this.revogrid.rowHeaders;
2713
- const rowHeaderSize = rowHeaderUtils.calculateRowHeaderSize(itemsLength, typeof header === 'object' ? header : undefined);
2714
- if (rowHeaderSize) {
2715
- sizeDifference -= rowHeaderSize;
2716
- }
2717
- }
2718
- if (sizeDifference > 0) {
2719
- // currently plugin accepts last column only
2720
- const index = columns.rgCol.length - 1;
2721
- const last = columns.rgCol[index];
2722
- /**
2723
- * has column
2724
- * no auto size applied
2725
- * size for column shouldn't be defined
2726
- */
2727
- const colSize = (last === null || last === void 0 ? void 0 : last.size) || this.revogrid.colSize || 0;
2728
- const size = sizeDifference + colSize - 1;
2729
- if (last && !last.autoSize && colSize < size) {
2730
- this.stretchedColumn = {
2731
- initialSize: size,
2732
- index,
2733
- size,
2734
- };
2735
- this.apply();
2736
- this.activateChanges();
2737
- }
2738
- }
2739
- }
2740
- }
2741
- /**
2742
- * Check plugin type is Stretch
2743
- */
2744
- function isStretchPlugin(plugin) {
2745
- return !!plugin.applyStretch;
2746
- }
2747
-
2748
1640
  const rowDefinitionByType = (newVal = []) => {
2749
1641
  const result = {};
2750
1642
  for (const v of newVal) {
@@ -2775,228 +1667,6 @@ const rowDefinitionRemoveByType = (oldVal = []) => {
2775
1667
  return result;
2776
1668
  };
2777
1669
 
2778
- const COLUMN_DRAG_CLASS = 'column-drag-start';
2779
- class ColumnOrderHandler {
2780
- constructor() {
2781
- this.offset = 0;
2782
- }
2783
- renderAutoscroll(_, parent) {
2784
- if (!parent) {
2785
- return;
2786
- }
2787
- this.autoscrollEl = document.createElement('div');
2788
- this.autoscrollEl.classList.add('drag-auto-scroll-y');
2789
- parent.appendChild(this.autoscrollEl);
2790
- }
2791
- autoscroll(pos, dataContainerSize, direction = 'translateX') {
2792
- if (!this.autoscrollEl) {
2793
- return;
2794
- }
2795
- const helperOffset = 10;
2796
- // calculate current y position inside of the grid active holder
2797
- // 3 - size of element + border
2798
- const maxScroll = Math.min(pos + helperOffset, dataContainerSize - 3);
2799
- this.autoscrollEl.style.transform = `${direction}(${maxScroll}px)`;
2800
- this.autoscrollEl.scrollIntoView({
2801
- block: 'nearest',
2802
- inline: 'nearest',
2803
- });
2804
- }
2805
- start(e, { dataEl, gridRect, scrollEl, gridEl }, dir = 'left') {
2806
- gridEl.classList.add(COLUMN_DRAG_CLASS);
2807
- const scrollContainerRect = scrollEl.getBoundingClientRect();
2808
- if (scrollContainerRect) {
2809
- this.offset = scrollContainerRect[dir] - gridRect[dir];
2810
- }
2811
- this.renderAutoscroll(e, dataEl);
2812
- }
2813
- stop(gridEl) {
2814
- var _a;
2815
- gridEl.classList.remove(COLUMN_DRAG_CLASS);
2816
- if (this.element) {
2817
- this.element.hidden = true;
2818
- }
2819
- this.offset = 0;
2820
- (_a = this.autoscrollEl) === null || _a === void 0 ? void 0 : _a.remove();
2821
- this.autoscrollEl = undefined;
2822
- }
2823
- showHandler(pos, size, direction = 'translateX') {
2824
- if (!this.element) {
2825
- return;
2826
- }
2827
- // do not allow overcross top of the scrollable area, header excluded
2828
- if (this.offset) {
2829
- pos = Math.max(pos, this.offset);
2830
- }
2831
- // can not be bigger then grid end
2832
- pos = Math.min(pos, size);
2833
- this.element.style.transform = `${direction}(${pos}px)`;
2834
- this.element.hidden = false;
2835
- }
2836
- render() {
2837
- const el = this.element = document.createElement('div');
2838
- el.classList.add('drag-position-y');
2839
- el.hidden = true;
2840
- return el;
2841
- }
2842
- }
2843
-
2844
- /**
2845
- * Plugin for column manual move
2846
- */
2847
- const COLUMN_CLICK = headerCellRenderer.ON_COLUMN_CLICK;
2848
- const MOVE = 'columndragmousemove';
2849
- const DRAG_END = 'columndragend';
2850
- const BEFORE_DRAG_END = 'beforecolumndragend';
2851
- // use this event subscription to drop D&D for particular columns
2852
- const DRAG_START = 'columndragstart';
2853
- class ColumnPlugin extends column_utils.BasePlugin {
2854
- constructor(revogrid, providers) {
2855
- super(revogrid, providers);
2856
- this.revogrid = revogrid;
2857
- this.providers = providers;
2858
- this.moveFunc = debounce.debounce_1((e) => this.doMove(e), 5);
2859
- this.staticDragData = null;
2860
- this.dragData = null;
2861
- this.localSubscriptions = {};
2862
- this.orderUi = new ColumnOrderHandler();
2863
- revogrid.appendChild(this.orderUi.render());
2864
- revogrid.classList.add('column-draggable');
2865
- // Register events
2866
- this.localSubscriptions['mouseleave'] = {
2867
- target: document,
2868
- callback: (e) => this.onMouseOut(e),
2869
- };
2870
- this.localSubscriptions['mouseup'] = {
2871
- target: document,
2872
- callback: (e) => this.onMouseUp(e),
2873
- };
2874
- this.localSubscriptions['mousemove'] = {
2875
- target: document,
2876
- callback: (e) => this.move(e),
2877
- };
2878
- this.addEventListener(COLUMN_CLICK, ({ detail }) => this.dragStart(detail));
2879
- }
2880
- dragStart({ event, data }) {
2881
- if (event.defaultPrevented) {
2882
- return;
2883
- }
2884
- const { defaultPrevented } = dispatcher.dispatch(this.revogrid, DRAG_START, data);
2885
- // check if allowed to drag particulat column
2886
- if (defaultPrevented) {
2887
- return;
2888
- }
2889
- this.clearOrder();
2890
- const { mouseleave, mouseup, mousemove } = this.localSubscriptions;
2891
- mouseleave.target.addEventListener('mouseleave', mouseleave.callback);
2892
- mouseup.target.addEventListener('mouseup', mouseup.callback);
2893
- const dataEl = event.target.closest('revogr-header');
2894
- const scrollEl = event.target.closest('revogr-viewport-scroll');
2895
- if (!dataEl || !scrollEl) {
2896
- return;
2897
- }
2898
- // no grouping drag and no row header column drag
2899
- if (column_utils.isColGrouping(data) || data.providers.type === 'rowHeaders') {
2900
- return;
2901
- }
2902
- const cols = this.getDimension(data.pin || 'rgCol');
2903
- const gridRect = this.revogrid.getBoundingClientRect();
2904
- const elRect = dataEl.getBoundingClientRect();
2905
- const startItem = index.getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
2906
- this.staticDragData = {
2907
- startPos: event.x,
2908
- startItem,
2909
- data,
2910
- dataEl,
2911
- scrollEl,
2912
- gridEl: this.revogrid,
2913
- cols,
2914
- };
2915
- this.dragData = this.getData(this.staticDragData);
2916
- mousemove.target.addEventListener('mousemove', mousemove.callback);
2917
- this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
2918
- }
2919
- doMove(e) {
2920
- if (!this.staticDragData) {
2921
- return;
2922
- }
2923
- const dragData = (this.dragData = this.getData(this.staticDragData));
2924
- if (!dragData) {
2925
- return;
2926
- }
2927
- const start = this.staticDragData.startPos;
2928
- if (Math.abs(start - e.x) > 10) {
2929
- const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2930
- const rgCol = index.getItemByPosition(this.staticDragData.cols, x);
2931
- this.orderUi.autoscroll(x, dragData.elRect.width);
2932
- this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
2933
- }
2934
- }
2935
- move(e) {
2936
- dispatcher.dispatch(this.revogrid, MOVE, e);
2937
- // then do move
2938
- this.moveFunc(e);
2939
- }
2940
- onMouseOut(_) {
2941
- this.clearOrder();
2942
- }
2943
- onMouseUp(e) {
2944
- // apply new positions
2945
- if (this.dragData && this.staticDragData) {
2946
- let relativePos = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
2947
- if (relativePos < 0) {
2948
- relativePos = 0;
2949
- }
2950
- const newPosition = index.getItemByPosition(this.staticDragData.cols, relativePos);
2951
- const store = this.providers.column.stores[this.dragData.type].store;
2952
- const items = [...store.get('items')];
2953
- // prevent position change if needed
2954
- const { defaultPrevented: stopDrag } = dispatcher.dispatch(this.revogrid, BEFORE_DRAG_END, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: store.get('source')[items[this.staticDragData.startItem.itemIndex]] }));
2955
- if (!stopDrag) {
2956
- // todo: if move item out of group remove item from group
2957
- const toMove = items.splice(this.staticDragData.startItem.itemIndex, 1);
2958
- items.splice(newPosition.itemIndex, 0, ...toMove);
2959
- store.set('items', items);
2960
- }
2961
- dispatcher.dispatch(this.revogrid, DRAG_END, this.dragData);
2962
- }
2963
- this.clearOrder();
2964
- }
2965
- clearLocalSubscriptions() {
2966
- index.each(this.localSubscriptions, ({ target, callback }, key) => target.removeEventListener(key, callback));
2967
- }
2968
- clearOrder() {
2969
- this.staticDragData = null;
2970
- this.dragData = null;
2971
- this.clearLocalSubscriptions();
2972
- this.orderUi.stop(this.revogrid);
2973
- }
2974
- /**
2975
- * Clearing subscription
2976
- */
2977
- clearSubscriptions() {
2978
- super.clearSubscriptions();
2979
- this.clearLocalSubscriptions();
2980
- }
2981
- getData({ gridEl, dataEl, data, }) {
2982
- const gridRect = gridEl.getBoundingClientRect();
2983
- const elRect = dataEl.getBoundingClientRect();
2984
- const scrollOffset = elRect.left - gridRect.left;
2985
- return {
2986
- elRect,
2987
- gridRect,
2988
- type: data.pin || 'rgCol',
2989
- scrollOffset,
2990
- };
2991
- }
2992
- getDimension(type) {
2993
- return this.providers.dimension.stores[type].getCurrentState();
2994
- }
2995
- }
2996
- function getLeftRelative(absoluteX, gridPos, offset) {
2997
- return absoluteX - gridPos - offset;
2998
- }
2999
-
3000
1670
  function isMobileDevice() {
3001
1671
  return /Mobi/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent) || navigator.maxTouchPoints > 0;
3002
1672
  }
@@ -3022,7 +1692,7 @@ function isMobileDevice() {
3022
1692
  * Note: The WCAG Plugin should be added as the last plugin in the list of plugins, as it modifies the grid's
3023
1693
  * default behavior and may conflict with other plugins if added earlier.
3024
1694
  */
3025
- class WCAGPlugin extends column_utils.BasePlugin {
1695
+ class WCAGPlugin extends column_drag_plugin.BasePlugin {
3026
1696
  constructor(revogrid, providers) {
3027
1697
  super(revogrid, providers);
3028
1698
  revogrid.setAttribute('dir', 'ltr');
@@ -3076,7 +1746,7 @@ class WCAGPlugin extends column_utils.BasePlugin {
3076
1746
  }
3077
1747
  }
3078
1748
 
3079
- const revoGridStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revo-grid[theme=default],revo-grid:not([theme]){border:1px solid #cecece;font-size:12px}revo-grid[theme=default] revogr-header,revo-grid:not([theme]) revogr-header{text-align:center;line-height:30px;background-color:#f8f9fa}revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{box-shadow:none}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{text-transform:uppercase;font-size:12px;color:#000}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow{height:30px;box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell,revo-grid:not([theme]) revogr-header .rgHeaderCell{box-shadow:-1px 0 0 0 #cecece inset, 0 -1px 0 0 #cecece, 0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell.focused-cell,revo-grid:not([theme]) revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] .rowHeaders,revo-grid:not([theme]) .rowHeaders{background-color:#f8f9fa}revo-grid[theme=default] .rowHeaders revogr-data .rgCell,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell{color:#000}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:first-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:first-child{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:not(:first-child),revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:not(:first-child){box-shadow:0 -1px 0 0 #cecece inset, 1px 0 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:last-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:last-child{border-right:1px solid #cecece}revo-grid[theme=default] .rowHeaders revogr-data revogr-header,revo-grid:not([theme]) .rowHeaders revogr-data revogr-header{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #cecece inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinEnd,revo-grid[theme=default] revogr-viewport-scroll.colPinEnd revogr-header,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd revogr-header{box-shadow:1px 0 0 #cecece inset}revo-grid[theme=default] .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset, 0 -1px 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data,revo-grid:not([theme]) revogr-data{text-align:center}revo-grid[theme=default] revogr-data .revo-draggable,revo-grid:not([theme]) revogr-data .revo-draggable{float:left}revo-grid[theme=default] revogr-data .rgRow,revo-grid:not([theme]) revogr-data .rgRow{line-height:27px}revo-grid[theme=default] revogr-data .rgRow.focused-rgRow,revo-grid:not([theme]) revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] revogr-data .rgCell,revo-grid:not([theme]) revogr-data .rgCell{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data .rgCell.disabled,revo-grid:not([theme]) revogr-data .rgCell.disabled{background-color:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=material]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=material] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=material] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=material] revogr-header .header-rgRow{height:50px}revo-grid[theme=material] revogr-data{text-align:left}revo-grid[theme=material] revogr-data .rgRow{line-height:42px}revo-grid[theme=material] revogr-data .rgCell{padding:0 15px}revo-grid[theme=material] .rowHeaders{background-color:#f7faff}revo-grid[theme=material] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=material] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=material] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=material] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=material] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=material] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=darkMaterial]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkMaterial] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkMaterial] revogr-header .header-rgRow{height:50px}revo-grid[theme=darkMaterial] revogr-data{text-align:left}revo-grid[theme=darkMaterial] revogr-data .rgRow{line-height:42px}revo-grid[theme=darkMaterial] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkMaterial] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkMaterial] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkMaterial] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkMaterial] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkMaterial] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=darkCompact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkCompact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkCompact] revogr-header .header-rgRow{height:45px}revo-grid[theme=darkCompact] revogr-data{text-align:left}revo-grid[theme=darkCompact] revogr-data .rgRow{line-height:32px}revo-grid[theme=darkCompact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkCompact] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkCompact] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkCompact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkCompact] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkCompact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=compact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=compact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=compact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=compact] revogr-header .header-rgRow{height:45px}revo-grid[theme=compact] revogr-data{text-align:left}revo-grid[theme=compact] revogr-data .rgRow{line-height:32px}revo-grid[theme=compact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=compact] .rowHeaders{background-color:#f7faff}revo-grid[theme=compact] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=compact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=compact] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=compact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=compact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=compact] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=compact] revo-dropdown .rv-dr-root{padding:0px 9px}revo-grid{display:block;height:100%;min-height:300px;font-family:Helvetica, Arial, Sans-Serif, serif;font-size:14px;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column;width:100%;height:100%}revo-grid .attribution{position:absolute;top:0;left:0;right:0;z-index:100;width:0;height:0;border-left:4px solid rgba(38, 106, 232, 0.6);border-top:4px solid rgba(38, 106, 232, 0.6);border-bottom:4px solid transparent;border-right:4px solid transparent;cursor:pointer}revo-grid .attribution .value{position:absolute;top:0;left:0;background-color:rgba(255, 255, 255, 0.9);padding:4px;border-radius:4px;box-shadow:0 1px 10px rgba(0, 0, 0, 0.2);white-space:nowrap;text-decoration:none;color:black;letter-spacing:0.3px;font-size:11px;opacity:0;width:4px;overflow:hidden;transition:opacity 0.5s ease-in-out, width 0.3s ease-in-out}revo-grid .attribution:hover .value{width:63px;opacity:1}revo-grid.column-draggable.column-drag-start:hover,revo-grid.column-draggable.column-drag-start *:hover{cursor:grabbing}revo-grid .footer-wrapper,revo-grid .header-wrapper{width:100%}revo-grid .footer-wrapper revogr-data,revo-grid .header-wrapper revogr-data{z-index:3}revo-grid revo-dropdown{width:100%}revo-grid revo-dropdown .rv-dr-root{max-height:100%}revo-grid revo-dropdown.shrink label{opacity:0}revo-grid .viewports{max-width:100%;display:flex;flex-direction:row;align-items:flex-start;flex-grow:1}revo-grid .main-viewport{flex-grow:1;height:0;display:flex;justify-content:space-between;flex-direction:row}revo-grid .draggable{position:fixed;height:30px;line-height:30px;background:#fff;border-radius:3px;display:block;z-index:100;margin-top:5px;margin-right:-20px;box-shadow:0 4px 20px 0 rgba(0, 0, 0, 0.15);padding-left:20px;padding-right:5px}revo-grid .draggable.hidden{display:none}revo-grid .draggable .revo-alt-icon{background-color:black;position:absolute;left:5px;top:10px}revo-grid .draggable-wrapper.hidden{display:none}revo-grid .drag-position{position:absolute;left:0;right:0;height:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-position-y{position:absolute;top:0;left:0;bottom:0;width:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-auto-scroll-y{pointer-events:none;position:absolute;left:0;top:0;height:50px;width:1px}revo-grid .clipboard{position:absolute;left:0;top:0}revo-grid revogr-scroll-virtual{position:relative}revo-grid revogr-scroll-virtual.vertical,revo-grid revogr-scroll-virtual.horizontal{z-index:3}";
1749
+ const revoGridStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revo-grid[theme=default],revo-grid:not([theme]){border:1px solid #cecece;font-size:12px}revo-grid[theme=default] revogr-header,revo-grid:not([theme]) revogr-header{text-align:center;line-height:30px;background-color:#f8f9fa}revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{box-shadow:none}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid[theme=default] revogr-header .group-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .group-rgRow{text-transform:uppercase;font-size:12px;color:#000}revo-grid[theme=default] revogr-header .header-rgRow,revo-grid:not([theme]) revogr-header .header-rgRow{height:30px;box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell,revo-grid:not([theme]) revogr-header .rgHeaderCell{box-shadow:-1px 0 0 0 #cecece inset, 0 -1px 0 0 #cecece, 0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-header .rgHeaderCell.focused-cell,revo-grid:not([theme]) revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] .rowHeaders,revo-grid:not([theme]) .rowHeaders{background-color:#f8f9fa}revo-grid[theme=default] .rowHeaders revogr-data .rgCell,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell{color:#000}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:first-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:first-child{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:not(:first-child),revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:not(:first-child){box-shadow:0 -1px 0 0 #cecece inset, 1px 0 0 0 #cecece inset}revo-grid[theme=default] .rowHeaders revogr-data .rgCell:last-child,revo-grid:not([theme]) .rowHeaders revogr-data .rgCell:last-child{border-right:1px solid #cecece}revo-grid[theme=default] .rowHeaders revogr-data revogr-header,revo-grid:not([theme]) .rowHeaders revogr-data revogr-header{box-shadow:0 -1px 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart revogr-data .rgRow .rgCell:last-child{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) revogr-viewport-scroll.colPinStart .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #cecece inset, -1px 0 0 0 #cecece inset}revo-grid[theme=default] revogr-viewport-scroll.colPinEnd,revo-grid[theme=default] revogr-viewport-scroll.colPinEnd revogr-header,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd,revo-grid:not([theme]) revogr-viewport-scroll.colPinEnd revogr-header{box-shadow:1px 0 0 #cecece inset}revo-grid[theme=default] .footer-wrapper revogr-data .rgRow:first-child .rgCell,revo-grid:not([theme]) .footer-wrapper revogr-data .rgRow:first-child .rgCell{box-shadow:0 1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset, 0 -1px 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data,revo-grid:not([theme]) revogr-data{text-align:center}revo-grid[theme=default] revogr-data .revo-draggable,revo-grid:not([theme]) revogr-data .revo-draggable{float:left}revo-grid[theme=default] revogr-data .rgRow,revo-grid:not([theme]) revogr-data .rgRow{line-height:27px}revo-grid[theme=default] revogr-data .rgRow.focused-rgRow,revo-grid:not([theme]) revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=default] revogr-data .rgCell,revo-grid:not([theme]) revogr-data .rgCell{box-shadow:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=default] revogr-data .rgCell.disabled,revo-grid:not([theme]) revogr-data .rgCell.disabled{background-color:0 -1px 0 0 #e2e3e3 inset, -1px 0 0 0 #e2e3e3 inset}revo-grid[theme=material]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=material] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=material] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=material] revogr-header .header-rgRow{height:50px}revo-grid[theme=material] revogr-data{text-align:left}revo-grid[theme=material] revogr-data .rgRow{line-height:42px}revo-grid[theme=material] revogr-data .rgCell{padding:0 15px}revo-grid[theme=material] .rowHeaders{background-color:#f7faff}revo-grid[theme=material] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=material] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=material] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=material] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=material] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=material] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=material] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=material] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=darkMaterial]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkMaterial] revogr-header{line-height:50px;font-weight:600;text-align:left}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkMaterial] revogr-header .header-rgRow{height:50px}revo-grid[theme=darkMaterial] revogr-data{text-align:left}revo-grid[theme=darkMaterial] revogr-data .rgRow{line-height:42px}revo-grid[theme=darkMaterial] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkMaterial] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkMaterial] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkMaterial] revogr-edit{background-color:#28272b}revo-grid[theme=darkMaterial] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkMaterial] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkMaterial] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkMaterial] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkMaterial] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=darkCompact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";color:#d8d8d8}revo-grid[theme=darkCompact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=darkCompact] revogr-header .header-rgRow{height:45px}revo-grid[theme=darkCompact] revogr-data{text-align:left}revo-grid[theme=darkCompact] revogr-data .rgRow{line-height:32px}revo-grid[theme=darkCompact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=darkCompact] .rowHeaders{background-color:rgba(40, 39, 43, 0.8)}revo-grid[theme=darkCompact] .rowHeaders revogr-data .rgCell{color:rgba(216, 216, 216, 0.8)}revo-grid[theme=darkCompact] revogr-edit{background-color:#28272b}revo-grid[theme=darkCompact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #404040, 0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.sortable:hover{background-color:rgba(64, 64, 64, 0.5)}revo-grid[theme=darkCompact] revogr-header .rgHeaderCell.focused-cell{background:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #404040}revo-grid[theme=darkCompact] revogr-data .rgCell{color:rgba(216, 216, 216, 0.9)}revo-grid[theme=darkCompact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-data .rgRow.focused-rgRow{background-color:rgba(115, 148, 160, 0.15)}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #404040 inset}revo-grid[theme=darkCompact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #404040}revo-grid[theme=compact]{font-family:Nunito, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}revo-grid[theme=compact] revogr-header{line-height:45px;font-weight:600;text-align:left}revo-grid[theme=compact] revogr-header .rgHeaderCell{padding:0 15px;text-overflow:ellipsis}revo-grid[theme=compact] revogr-header .header-rgRow{height:45px}revo-grid[theme=compact] revogr-data{text-align:left}revo-grid[theme=compact] revogr-data .rgRow{line-height:32px}revo-grid[theme=compact] revogr-data .rgCell{padding:0 15px}revo-grid[theme=compact] .rowHeaders{background-color:#f7faff}revo-grid[theme=compact] .rowHeaders revogr-data .rgCell{color:#757a82}revo-grid[theme=compact] revogr-header .header-rgRow.group{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .header-rgRow:not(.group){box-shadow:0 -1px 0 0 #f1f1f1, 0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-header .rgHeaderCell.sortable:hover{background-color:#f1f1f1}revo-grid[theme=compact] revogr-header .rgHeaderCell.focused-cell{background:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] .footer-wrapper revogr-data{box-shadow:0 -1px 0 #f1f1f1}revo-grid[theme=compact] revogr-viewport-scroll.colPinStart{box-shadow:-1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-viewport-scroll.colPinEnd{box-shadow:-1px 0 0 #f1f1f1}revo-grid[theme=compact] revogr-data .rgRow{box-shadow:0 -1px 0 0 #f1f1f1 inset}revo-grid[theme=compact] revogr-data .rgRow.focused-rgRow{background-color:rgba(233, 234, 237, 0.5)}revo-grid[theme=compact] revogr-data .rgCell{color:rgba(0, 0, 0, 0.87)}revo-grid[theme=compact] revogr-data .rgCell.disabled{background-color:#f7f7f7}revo-grid[theme=compact] revo-dropdown .rv-dr-root{padding:0px 9px}revo-grid{display:block;height:100%;min-height:300px;font-family:Helvetica, Arial, Sans-Serif, serif;font-size:14px;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column;width:100%;height:100%}revo-grid .attribution{position:absolute;top:0;left:0;right:0;z-index:100;width:0;height:0;border-left:4px solid rgba(38, 106, 232, 0.6);border-top:4px solid rgba(38, 106, 232, 0.6);border-bottom:4px solid transparent;border-right:4px solid transparent;cursor:pointer}revo-grid .attribution .value{position:absolute;top:0;left:0;background-color:rgba(255, 255, 255, 0.9);padding:4px;border-radius:4px;box-shadow:0 1px 10px rgba(0, 0, 0, 0.2);white-space:nowrap;text-decoration:none;color:black;letter-spacing:0.3px;font-size:11px;opacity:0;width:4px;overflow:hidden;transition:opacity 0.5s ease-in-out, width 0.3s ease-in-out}revo-grid .attribution:hover .value{width:63px;opacity:1}revo-grid.column-draggable.column-drag-start:hover,revo-grid.column-draggable.column-drag-start *:hover{cursor:grabbing}revo-grid .footer-wrapper,revo-grid .header-wrapper{width:100%}revo-grid .footer-wrapper revogr-data,revo-grid .header-wrapper revogr-data{z-index:3}revo-grid revo-dropdown{width:100%}revo-grid revo-dropdown .rv-dr-root{max-height:100%}revo-grid revo-dropdown.shrink label{opacity:0}revo-grid .viewports{max-width:100%;display:flex;flex-direction:row;align-items:flex-start;flex-grow:1}revo-grid .main-viewport{flex-grow:1;height:0;display:flex;justify-content:space-between;flex-direction:row}revo-grid .draggable{position:fixed;height:30px;line-height:30px;background:#fff;border-radius:3px;display:block;z-index:100;margin-top:5px;margin-right:-20px;box-shadow:0 4px 20px 0 rgba(0, 0, 0, 0.15);padding-left:20px;padding-right:5px}revo-grid .draggable.hidden{display:none}revo-grid .draggable .revo-alt-icon{background-color:black;position:absolute;left:5px;top:10px}revo-grid .draggable-wrapper.hidden{display:none}revo-grid .drag-position{position:absolute;left:0;right:0;height:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-position-y{position:absolute;top:0;left:0;bottom:0;width:1px;z-index:2;background:gray;pointer-events:none}revo-grid .drag-auto-scroll-y{pointer-events:none;position:absolute;left:0;top:0;height:50px;width:1px}revo-grid .clipboard{position:absolute;left:0;top:0}revo-grid revogr-scroll-virtual{position:relative}revo-grid revogr-scroll-virtual.vertical,revo-grid revogr-scroll-virtual.horizontal{z-index:3}";
3080
1750
  const RevoGridStyle0 = revoGridStyleCss;
3081
1751
 
3082
1752
  const RevoGridComponent = class {
@@ -3244,7 +1914,7 @@ const RevoGridComponent = class {
3244
1914
  /** Open editor for cell. */
3245
1915
  async setCellEdit(rgRow, prop, rowSource = 'rgRow') {
3246
1916
  var _a;
3247
- const rgCol = column_utils.getColumnByProp(this.columns, prop);
1917
+ const rgCol = column_drag_plugin.getColumnByProp(this.columns, prop);
3248
1918
  if (!rgCol) {
3249
1919
  return;
3250
1920
  }
@@ -3468,7 +2138,7 @@ const RevoGridComponent = class {
3468
2138
  this.columnChanged(this.columns);
3469
2139
  }
3470
2140
  columnChanged(newVal = []) {
3471
- const columnGather = column_utils.getColumns(newVal, 0, this.columnTypes);
2141
+ const columnGather = column_drag_plugin.getColumns(newVal, 0, this.columnTypes);
3472
2142
  this.beforecolumnsset.emit(columnGather);
3473
2143
  this.dimensionProvider.applyNewColumns(columnGather.columns, this.disableVirtualX);
3474
2144
  this.beforecolumnapplied.emit(columnGather);
@@ -3603,7 +2273,7 @@ const RevoGridComponent = class {
3603
2273
  if (isStretch === 'false') {
3604
2274
  isStretch = false;
3605
2275
  }
3606
- let stretch = this.internalPlugins.filter(p => isStretchPlugin(p))[0];
2276
+ let stretch = this.internalPlugins.filter(p => column_drag_plugin.isStretchPlugin(p))[0];
3607
2277
  if ((typeof isStretch === 'boolean' && isStretch) || isStretch === 'true') {
3608
2278
  if (!stretch) {
3609
2279
  const pluginData = {
@@ -3613,9 +2283,9 @@ const RevoGridComponent = class {
3613
2283
  viewport: this.viewportProvider,
3614
2284
  selection: this.selectionStoreConnector,
3615
2285
  };
3616
- this.internalPlugins.push(new StretchColumn(this.element, pluginData));
2286
+ this.internalPlugins.push(new column_drag_plugin.StretchColumn(this.element, pluginData));
3617
2287
  }
3618
- else if (isStretchPlugin(stretch)) {
2288
+ else if (column_drag_plugin.isStretchPlugin(stretch)) {
3619
2289
  stretch.applyStretch(this.columnProvider.getRawColumns());
3620
2290
  }
3621
2291
  }
@@ -3658,24 +2328,24 @@ const RevoGridComponent = class {
3658
2328
  }
3659
2329
  // register auto size plugin
3660
2330
  if (this.autoSizeColumn) {
3661
- this.internalPlugins.push(new AutoSizeColumnPlugin(this.element, pluginData, typeof this.autoSizeColumn === 'object'
2331
+ this.internalPlugins.push(new column_drag_plugin.AutoSizeColumnPlugin(this.element, pluginData, typeof this.autoSizeColumn === 'object'
3662
2332
  ? this.autoSizeColumn
3663
2333
  : undefined));
3664
2334
  }
3665
2335
  // register filter plugin
3666
2336
  if (this.filter) {
3667
- this.internalPlugins.push(new FilterPlugin(this.element, pluginData, typeof this.filter === 'object' ? this.filter : undefined));
2337
+ this.internalPlugins.push(new column_drag_plugin.FilterPlugin(this.element, pluginData, typeof this.filter === 'object' ? this.filter : undefined));
3668
2338
  }
3669
2339
  // register export plugin
3670
2340
  if (this.exporting) {
3671
- this.internalPlugins.push(new ExportFilePlugin(this.element, pluginData));
2341
+ this.internalPlugins.push(new column_drag_plugin.ExportFilePlugin(this.element, pluginData));
3672
2342
  }
3673
2343
  // register sorting plugin
3674
2344
  this.internalPlugins.push(new SortingPlugin(this.element, pluginData));
3675
2345
  // register grouping plugin
3676
2346
  this.internalPlugins.push(new GroupingRowPlugin(this.element, pluginData));
3677
2347
  if (this.canMoveColumns) {
3678
- this.internalPlugins.push(new ColumnPlugin(this.element, pluginData));
2348
+ this.internalPlugins.push(new column_drag_plugin.ColumnPlugin(this.element, pluginData));
3679
2349
  }
3680
2350
  // register user plugins
3681
2351
  (_a = this.plugins) === null || _a === void 0 ? void 0 : _a.forEach(p => this.internalPlugins.push(new p(this.element, pluginData)));
@@ -3708,7 +2378,7 @@ const RevoGridComponent = class {
3708
2378
  realSizeChanged: (k) => this.contentsizechanged.emit(k),
3709
2379
  });
3710
2380
  this.columnProvider = new ColumnDataProvider();
3711
- this.selectionStoreConnector = new selection_helpers.SelectionStoreConnector();
2381
+ this.selectionStoreConnector = new column_service.SelectionStoreConnector();
3712
2382
  this.dataProvider = new DataProvider(this.dimensionProvider);
3713
2383
  // #endregion
3714
2384
  this.registerOutsideVNodes(this.registerVNode);
@@ -3781,7 +2451,7 @@ const RevoGridComponent = class {
3781
2451
  const headerProperties = Object.assign(Object.assign({}, view.headerProp), { type: view.type, additionalData: this.additionalData, viewportCol: view.viewportCol, selectionStore: view.columnSelectionStore, canResize: this.resize, readonly: this.readonly, columnFilter: !!this.filter });
3782
2452
  // Column headers
3783
2453
  const dataViews = [
3784
- index$1.h("revogr-header", Object.assign({ key: '31f0cebc08d5e9222d058c138079ee1d6c228ed2' }, headerProperties, { slot: column_service.HEADER_SLOT })),
2454
+ index$1.h("revogr-header", Object.assign({ key: '31f0cebc08d5e9222d058c138079ee1d6c228ed2' }, headerProperties, { slot: viewport_helpers.HEADER_SLOT })),
3785
2455
  ];
3786
2456
  // Render viewport data (vertical sections)
3787
2457
  view.dataPorts.forEach(data => {
@@ -3791,7 +2461,7 @@ const RevoGridComponent = class {
3791
2461
  if (!event.defaultPrevented) {
3792
2462
  this.selectionStoreConnector.setEdit(detail.val);
3793
2463
  }
3794
- } }), index$1.h("revogr-data", Object.assign({}, data, { colType: view.type, key: key, readonly: this.readonly, range: this.range, rowClass: this.rowClass, rowSelectionStore: data.rowSelectionStore, additionalData: this.additionalData, jobsBeforeRender: this.jobsBeforeRender, slot: column_service.DATA_SLOT }), index$1.h("slot", { name: `data-${view.type}-${data.type}` })), index$1.h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }), index$1.h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, focusTemplate: this.focusTemplate, rowType: data.type, colType: view.type, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }, index$1.h("slot", { name: `focus-${view.type}-${data.type}` }))));
2464
+ } }), index$1.h("revogr-data", Object.assign({}, data, { colType: view.type, key: key, readonly: this.readonly, range: this.range, rowClass: this.rowClass, rowSelectionStore: data.rowSelectionStore, additionalData: this.additionalData, jobsBeforeRender: this.jobsBeforeRender, slot: viewport_helpers.DATA_SLOT }), index$1.h("slot", { name: `data-${view.type}-${data.type}` })), index$1.h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }), index$1.h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, focusTemplate: this.focusTemplate, rowType: data.type, colType: view.type, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }, index$1.h("slot", { name: `focus-${view.type}-${data.type}` }))));
3795
2465
  dataViews.push(dataView);
3796
2466
  });
3797
2467
  // Add viewport scroll in the end