@revolist/revogrid 4.21.5 → 4.21.6

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 (51) hide show
  1. package/dist/cjs/{cell-renderer-BLcxDHzP.js → cell-renderer-DW8i7ULg.js} +2 -2
  2. package/dist/cjs/{column.drag.plugin-BunAX4dQ.js → column.drag.plugin-BWX5_5iT.js} +96 -26
  3. package/dist/cjs/{column.service-BmT2HOnj.js → column.service-DvQDqxxx.js} +1 -1
  4. package/dist/cjs/{dimension.helpers-BOxHtX5T.js → dimension.helpers-CaIsYC99.js} +1 -1
  5. package/dist/cjs/{edit.utils-DnvQVP4H.js → edit.utils-CwMzSIVF.js} +1 -1
  6. package/dist/cjs/{header-cell-renderer-7DgGThjq.js → header-cell-renderer-B1dJwgTO.js} +1 -1
  7. package/dist/cjs/index.cjs.js +8 -8
  8. package/dist/cjs/revo-grid.cjs.entry.js +5 -5
  9. package/dist/cjs/revogr-attribution_7.cjs.entry.js +5 -5
  10. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +3 -3
  11. package/dist/cjs/revogr-data_4.cjs.entry.js +5 -5
  12. package/dist/cjs/{text-editor-B9ibcdrl.js → text-editor-BTnGaIl3.js} +2 -2
  13. package/dist/cjs/{throttle-DkuCcmB0.js → throttle-CI4MsAqs.js} +1 -1
  14. package/dist/cjs/{viewport.store-DG-4bWqg.js → viewport.store-Dcjud-a-.js} +1 -1
  15. package/dist/collection/plugins/filter/filter.plugin.js +2 -1
  16. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +21 -11
  17. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +81 -12
  18. package/dist/{revo-grid/cell-renderer-BNeaYjy6.js → esm/cell-renderer-CqVunVBY.js} +2 -2
  19. package/dist/esm/{column.drag.plugin-991PW1Yy.js → column.drag.plugin-6YvuxWof.js} +96 -26
  20. package/dist/esm/{column.service-8pPNyrKn.js → column.service-Cdz3dYqZ.js} +1 -1
  21. package/dist/{revo-grid/dimension.helpers-B-5OBYes.js → esm/dimension.helpers-DzxqJQqN.js} +1 -1
  22. package/dist/esm/{edit.utils-CQjRmx5n.js → edit.utils-CzfeG98N.js} +1 -1
  23. package/dist/{revo-grid/header-cell-renderer-WkTbrmr7.js → esm/header-cell-renderer-DXhxZMly.js} +1 -1
  24. package/dist/esm/index.js +9 -9
  25. package/dist/esm/revo-grid.entry.js +5 -5
  26. package/dist/esm/revogr-attribution_7.entry.js +5 -5
  27. package/dist/esm/revogr-clipboard_3.entry.js +3 -3
  28. package/dist/esm/revogr-data_4.entry.js +5 -5
  29. package/dist/{revo-grid/text-editor-DZSx2pWr.js → esm/text-editor-C1ks5eQ4.js} +2 -2
  30. package/dist/esm/{throttle-CYM0qC3v.js → throttle-BEjFQa2l.js} +1 -1
  31. package/dist/{revo-grid/viewport.store-BGWR3XfI.js → esm/viewport.store-saAZJHRo.js} +1 -1
  32. package/dist/{esm/cell-renderer-BNeaYjy6.js → revo-grid/cell-renderer-CqVunVBY.js} +2 -2
  33. package/dist/revo-grid/{column.drag.plugin-991PW1Yy.js → column.drag.plugin-6YvuxWof.js} +96 -26
  34. package/dist/revo-grid/{column.service-8pPNyrKn.js → column.service-Cdz3dYqZ.js} +1 -1
  35. package/dist/{esm/dimension.helpers-B-5OBYes.js → revo-grid/dimension.helpers-DzxqJQqN.js} +1 -1
  36. package/dist/revo-grid/{edit.utils-CQjRmx5n.js → edit.utils-CzfeG98N.js} +1 -1
  37. package/dist/{esm/header-cell-renderer-WkTbrmr7.js → revo-grid/header-cell-renderer-DXhxZMly.js} +1 -1
  38. package/dist/revo-grid/index.esm.js +9 -9
  39. package/dist/revo-grid/revo-grid.entry.js +5 -5
  40. package/dist/revo-grid/revogr-attribution_7.entry.js +5 -5
  41. package/dist/revo-grid/revogr-clipboard_3.entry.js +3 -3
  42. package/dist/revo-grid/revogr-data_4.entry.js +5 -5
  43. package/dist/{esm/text-editor-DZSx2pWr.js → revo-grid/text-editor-C1ks5eQ4.js} +2 -2
  44. package/dist/revo-grid/{throttle-CYM0qC3v.js → throttle-BEjFQa2l.js} +1 -1
  45. package/dist/{esm/viewport.store-BGWR3XfI.js → revo-grid/viewport.store-saAZJHRo.js} +1 -1
  46. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +1 -0
  47. package/dist/types/plugins/groupingRow/grouping.trimmed.service.d.ts +18 -0
  48. package/hydrate/index.js +93 -23
  49. package/hydrate/index.mjs +93 -23
  50. package/package.json +4 -3
  51. package/standalone/revo-grid.js +1 -1
@@ -4,8 +4,8 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
8
- var column_service = require('./column.service-BmT2HOnj.js');
7
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
8
+ var column_service = require('./column.service-DvQDqxxx.js');
9
9
 
10
10
  const SortingSign = ({ column }) => {
11
11
  var _a;
@@ -3,13 +3,13 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var column_service = require('./column.service-BmT2HOnj.js');
7
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
8
- var viewport_store = require('./viewport.store-DG-4bWqg.js');
6
+ var column_service = require('./column.service-DvQDqxxx.js');
7
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
8
+ var viewport_store = require('./viewport.store-Dcjud-a-.js');
9
9
  var index = require('./index-Dq8Xzj5l.js');
10
10
  var filter_button = require('./filter.button-w6LWnyhi.js');
11
11
  var debounce = require('./debounce-CcpHiH2p.js');
12
- var headerCellRenderer = require('./header-cell-renderer-7DgGThjq.js');
12
+ var headerCellRenderer = require('./header-cell-renderer-B1dJwgTO.js');
13
13
 
14
14
  /**
15
15
  * Plugin which recalculates realSize on changes of sizes, originItemSize and count
@@ -1288,6 +1288,7 @@ class FilterPlugin extends BasePlugin {
1288
1288
  if (Object.keys(this.multiFilterItems).length === 0) {
1289
1289
  return;
1290
1290
  }
1291
+ await dimension_helpers.timeout();
1291
1292
  await this.runFiltering(this.multiFilterItems);
1292
1293
  };
1293
1294
  this.addEventListener('headerclick', e => this.headerclick(e));
@@ -2112,6 +2113,23 @@ function doExpand(vIndex, source, rowItemsIndexes) {
2112
2113
  }
2113
2114
 
2114
2115
  const TRIMMED_GROUPING = 'grouping';
2116
+ /**
2117
+ * Converts a trim row index through the index maps produced while regrouping.
2118
+ *
2119
+ * Group rows are synthetic, so they may not exist in the first map. When a
2120
+ * second map is available, fall back to the original index so trims created
2121
+ * against the grouped physical source can still be remapped. If neither path
2122
+ * resolves to a number, the caller drops the stale trim entry.
2123
+ */
2124
+ function convertTrimmedIndex(initialIndex, firstLevelMap, secondLevelMap) {
2125
+ const sourceIndex = Number.parseInt(initialIndex, 10);
2126
+ const firstConversionIndex = firstLevelMap[sourceIndex];
2127
+ if (!secondLevelMap) {
2128
+ return firstConversionIndex;
2129
+ }
2130
+ const secondConversionKey = typeof firstConversionIndex === 'number' ? firstConversionIndex : sourceIndex;
2131
+ return secondLevelMap[secondConversionKey];
2132
+ }
2115
2133
  /**
2116
2134
  * Prepare trimming updated indexes for grouping
2117
2135
  * @param initiallyTrimed
@@ -2130,31 +2148,73 @@ function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, secondLe
2130
2148
  const items = initiallyTrimed[type];
2131
2149
  const newItems = {};
2132
2150
  for (let initialIndex in items) {
2151
+ if (!items[initialIndex]) {
2152
+ continue;
2153
+ }
2133
2154
  /**
2134
2155
  * if item exists we find it in collection
2135
2156
  * we support 2 level of conversions
2136
2157
  */
2137
- let newConversionIndex = firstLevelMap[initialIndex];
2138
- if (secondLevelMap) {
2139
- newConversionIndex = secondLevelMap[newConversionIndex];
2158
+ const newConversionIndex = convertTrimmedIndex(initialIndex, firstLevelMap, secondLevelMap);
2159
+ // Group rows do not exist in the ungrouped index map and must not leak into new trims.
2160
+ if (typeof newConversionIndex !== 'number') {
2161
+ continue;
2140
2162
  }
2141
2163
  /**
2142
2164
  * if item was trimmed previously
2143
2165
  * trimming makes sense to apply
2144
2166
  */
2145
- if (items[initialIndex]) {
2146
- newItems[newConversionIndex] = true;
2147
- /**
2148
- * If changes present apply changes to new source
2149
- */
2150
- if (newConversionIndex !== parseInt(initialIndex, 10)) {
2151
- trimemedOptionsToUpgrade[type] = newItems;
2152
- }
2153
- }
2167
+ newItems[newConversionIndex] = true;
2154
2168
  }
2169
+ trimemedOptionsToUpgrade[type] = newItems;
2155
2170
  }
2156
2171
  return trimemedOptionsToUpgrade;
2157
2172
  }
2173
+ function hasVisibleGroupItems(source, trimmed, groupIndex) {
2174
+ var _a;
2175
+ const depth = (_a = source[groupIndex]) === null || _a === void 0 ? void 0 : _a[column_service.GROUP_DEPTH];
2176
+ if (depth == null) {
2177
+ return false;
2178
+ }
2179
+ // A group is visible when at least one descendant data row survives filtering.
2180
+ for (let i = groupIndex + 1; i < source.length; i++) {
2181
+ const model = source[i];
2182
+ if (column_service.isGrouping(model)) {
2183
+ if (model[column_service.GROUP_DEPTH] <= depth) {
2184
+ break;
2185
+ }
2186
+ continue;
2187
+ }
2188
+ if (!trimmed[i]) {
2189
+ return true;
2190
+ }
2191
+ }
2192
+ return false;
2193
+ }
2194
+ /**
2195
+ * Preserves data-row filter results and recalculates group-row visibility
2196
+ * from the filtered state of each group's descendant data rows.
2197
+ *
2198
+ * @param source - Grouped row source that contains group rows and data rows.
2199
+ * @param filterTrimmed - Current filter trim map keyed by physical row index.
2200
+ * @returns Filter trim map with empty group rows hidden and matching group rows visible.
2201
+ */
2202
+ function filterOutEmptyGroupRows(source, filterTrimmed) {
2203
+ const trimmed = Object.assign({}, filterTrimmed);
2204
+ // Recalculate only group rows; data-row filter results are preserved as-is.
2205
+ source.forEach((model, index) => {
2206
+ if (!column_service.isGrouping(model)) {
2207
+ return;
2208
+ }
2209
+ if (hasVisibleGroupItems(source, trimmed, index)) {
2210
+ delete trimmed[index];
2211
+ }
2212
+ else {
2213
+ trimmed[index] = true;
2214
+ }
2215
+ });
2216
+ return trimmed;
2217
+ }
2158
2218
 
2159
2219
  class GroupingRowPlugin extends BasePlugin {
2160
2220
  getStore(type = column_service.GROUPING_ROW_TYPE) {
@@ -2223,16 +2283,18 @@ class GroupingRowPlugin extends BasePlugin {
2223
2283
  }
2224
2284
  }
2225
2285
  beforeTrimmedApply(trimmed, type) {
2226
- /** Before filter apply remove grouping filtering */
2286
+ /** Filter trim must keep group headers in sync with their visible children. */
2227
2287
  if (type === FILTER_TRIMMED_TYPE) {
2228
2288
  const source = this.getStore().get('source');
2229
- for (let index in trimmed) {
2230
- if (trimmed[index] && column_service.isGrouping(source[index])) {
2231
- trimmed[index] = false;
2232
- }
2233
- }
2289
+ const updatedTrimmed = filterOutEmptyGroupRows(source, trimmed);
2290
+ Object.keys(trimmed).forEach(index => delete trimmed[Number.parseInt(index, 10)]);
2291
+ Object.assign(trimmed, updatedTrimmed);
2234
2292
  }
2235
2293
  }
2294
+ beforeFilterTrimmed(trimmed) {
2295
+ const source = this.getStore().get('source');
2296
+ return filterOutEmptyGroupRows(source, trimmed);
2297
+ }
2236
2298
  isSortingRunning() {
2237
2299
  const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
2238
2300
  return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
@@ -2258,7 +2320,7 @@ class GroupingRowPlugin extends BasePlugin {
2258
2320
  const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
2259
2321
  // setup source
2260
2322
  this.providers.data.setData(sourceWithGroups, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
2261
- this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
2323
+ this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap, sourceWithGroups);
2262
2324
  }
2263
2325
  /**
2264
2326
  * Apply grouping on data set
@@ -2277,7 +2339,7 @@ class GroupingRowPlugin extends BasePlugin {
2277
2339
  const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = column_service.gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
2278
2340
  data.source = sourceWithGroups;
2279
2341
  this.providers.data.setGrouping({ depth });
2280
- this.updateTrimmed(trimmed, oldNewIndexMap);
2342
+ this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
2281
2343
  }
2282
2344
  /**
2283
2345
  * External call to apply grouping. Called by revogrid when prop changed.
@@ -2326,6 +2388,10 @@ class GroupingRowPlugin extends BasePlugin {
2326
2388
  * based on new results can be new grouping
2327
2389
  */
2328
2390
  this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
2391
+ /** Filter plugin owns data-row matching; grouping decides which headers remain visible. */
2392
+ this.addEventListener('beforefiltertrimmed', ({ detail }) => {
2393
+ detail.itemsToFilter = this.beforeFilterTrimmed(detail.itemsToFilter);
2394
+ });
2329
2395
  /**
2330
2396
  * sorting applied need to clear grouping and apply again
2331
2397
  * based on new results whole grouping order will changed
@@ -2371,12 +2437,16 @@ class GroupingRowPlugin extends BasePlugin {
2371
2437
  // clear rows
2372
2438
  const { source, oldNewIndexes } = column_service.getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
2373
2439
  this.providers.data.setData(source, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2374
- this.updateTrimmed(undefined, undefined, oldNewIndexes);
2440
+ this.updateTrimmed(undefined, undefined, oldNewIndexes, source);
2375
2441
  }
2376
- updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap) {
2442
+ updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source')) {
2377
2443
  // map previously trimmed data
2378
2444
  const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
2379
2445
  for (let type in trimemedOptionsToUpgrade) {
2446
+ if (type === FILTER_TRIMMED_TYPE) {
2447
+ /** Regrouping changes physical indexes, so filter trim needs fresh group-header state. */
2448
+ trimemedOptionsToUpgrade[type] = filterOutEmptyGroupRows(source, trimemedOptionsToUpgrade[type]);
2449
+ }
2380
2450
  this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
2381
2451
  }
2382
2452
  // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
6
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
7
7
 
8
8
  /**
9
9
  * Converts `value` to an integer.
@@ -774,7 +774,7 @@ function setCacheAdd(value) {
774
774
  * @name has
775
775
  * @memberOf SetCache
776
776
  * @param {*} value The value to search for.
777
- * @returns {number} Returns `true` if `value` is found, else `false`.
777
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
778
778
  */
779
779
  function setCacheHas(value) {
780
780
  return this.__data__.has(value);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
6
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
7
7
 
8
8
  function isMetaKey(code) {
9
9
  const keys = [
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var column_service = require('./column.service-BmT2HOnj.js');
7
+ var column_service = require('./column.service-DvQDqxxx.js');
8
8
 
9
9
  /**
10
10
  * Dispatches a custom event to a specified target element.
@@ -3,15 +3,15 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var column_service = require('./column.service-BmT2HOnj.js');
7
- var column_drag_plugin = require('./column.drag.plugin-BunAX4dQ.js');
8
- var headerCellRenderer = require('./header-cell-renderer-7DgGThjq.js');
9
- var cellRenderer = require('./cell-renderer-BLcxDHzP.js');
10
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
11
- var textEditor = require('./text-editor-B9ibcdrl.js');
12
- var edit_utils = require('./edit.utils-DnvQVP4H.js');
6
+ var column_service = require('./column.service-DvQDqxxx.js');
7
+ var column_drag_plugin = require('./column.drag.plugin-BWX5_5iT.js');
8
+ var headerCellRenderer = require('./header-cell-renderer-B1dJwgTO.js');
9
+ var cellRenderer = require('./cell-renderer-DW8i7ULg.js');
10
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
11
+ var textEditor = require('./text-editor-BTnGaIl3.js');
12
+ var edit_utils = require('./edit.utils-CwMzSIVF.js');
13
13
  var index = require('./index-Dq8Xzj5l.js');
14
- var viewport_store = require('./viewport.store-DG-4bWqg.js');
14
+ var viewport_store = require('./viewport.store-Dcjud-a-.js');
15
15
  var filter_button = require('./filter.button-w6LWnyhi.js');
16
16
  require('./debounce-CcpHiH2p.js');
17
17
 
@@ -4,16 +4,16 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var column_service = require('./column.service-BmT2HOnj.js');
8
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
7
+ var column_service = require('./column.service-DvQDqxxx.js');
8
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
9
9
  var debounce = require('./debounce-CcpHiH2p.js');
10
- var column_drag_plugin = require('./column.drag.plugin-BunAX4dQ.js');
11
- var viewport_store = require('./viewport.store-DG-4bWqg.js');
10
+ var column_drag_plugin = require('./column.drag.plugin-BWX5_5iT.js');
11
+ var viewport_store = require('./viewport.store-Dcjud-a-.js');
12
12
  var theme_service = require('./theme.service-BgnxGIjK.js');
13
13
  var viewport_helpers = require('./viewport.helpers-BAovztDd.js');
14
14
  var events = require('./events-DeLDyZlb.js');
15
15
  require('./filter.button-w6LWnyhi.js');
16
- require('./header-cell-renderer-7DgGThjq.js');
16
+ require('./header-cell-renderer-B1dJwgTO.js');
17
17
 
18
18
  class ColumnDataProvider {
19
19
  get stores() {
@@ -4,14 +4,14 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
7
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
8
8
  var events = require('./events-DeLDyZlb.js');
9
- var column_service = require('./column.service-BmT2HOnj.js');
10
- var edit_utils = require('./edit.utils-DnvQVP4H.js');
9
+ var column_service = require('./column.service-DvQDqxxx.js');
10
+ var edit_utils = require('./edit.utils-CwMzSIVF.js');
11
11
  var debounce = require('./debounce-CcpHiH2p.js');
12
- var viewport_store = require('./viewport.store-DG-4bWqg.js');
12
+ var viewport_store = require('./viewport.store-Dcjud-a-.js');
13
13
  var viewport_helpers = require('./viewport.helpers-BAovztDd.js');
14
- var throttle = require('./throttle-DkuCcmB0.js');
14
+ var throttle = require('./throttle-CI4MsAqs.js');
15
15
 
16
16
  const Attribution = class {
17
17
  constructor(hostRef) {
@@ -4,9 +4,9 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
8
- var textEditor = require('./text-editor-B9ibcdrl.js');
9
- var edit_utils = require('./edit.utils-DnvQVP4H.js');
7
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
8
+ var textEditor = require('./text-editor-BTnGaIl3.js');
9
+ var edit_utils = require('./edit.utils-CwMzSIVF.js');
10
10
  var debounce = require('./debounce-CcpHiH2p.js');
11
11
 
12
12
  const Clipboard = class {
@@ -4,12 +4,12 @@
4
4
  'use strict';
5
5
 
6
6
  var index = require('./index-Dq8Xzj5l.js');
7
- var column_service = require('./column.service-BmT2HOnj.js');
8
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
9
- var cellRenderer = require('./cell-renderer-BLcxDHzP.js');
7
+ var column_service = require('./column.service-DvQDqxxx.js');
8
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
9
+ var cellRenderer = require('./cell-renderer-DW8i7ULg.js');
10
10
  var filter_button = require('./filter.button-w6LWnyhi.js');
11
- var headerCellRenderer = require('./header-cell-renderer-7DgGThjq.js');
12
- var throttle = require('./throttle-DkuCcmB0.js');
11
+ var headerCellRenderer = require('./header-cell-renderer-B1dJwgTO.js');
12
+ var throttle = require('./throttle-CI4MsAqs.js');
13
13
  var viewport_helpers = require('./viewport.helpers-BAovztDd.js');
14
14
  require('./debounce-CcpHiH2p.js');
15
15
 
@@ -3,8 +3,8 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var edit_utils = require('./edit.utils-DnvQVP4H.js');
7
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
6
+ var edit_utils = require('./edit.utils-CwMzSIVF.js');
7
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
8
8
 
9
9
  class TextEditor {
10
10
  constructor(data, saveCallback) {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
6
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
7
7
  var debounce = require('./debounce-CcpHiH2p.js');
8
8
 
9
9
  const initialParams = {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var dimension_helpers = require('./dimension.helpers-BOxHtX5T.js');
6
+ var dimension_helpers = require('./dimension.helpers-CaIsYC99.js');
7
7
 
8
8
  const LETTER_BLOCK_SIZE = 10;
9
9
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -6,7 +6,7 @@ import { h } from "@stencil/core";
6
6
  import { BasePlugin } from "../base.plugin";
7
7
  import { FILTER_PROP, isFilterBtn } from "./filter.button";
8
8
  import { filterCoreFunctionsIndexedByType, filterNames, filterTypes, } from "./filter.indexed";
9
- import { getCellDataParsed } from "../../utils";
9
+ import { getCellDataParsed, timeout } from "../../utils";
10
10
  export * from './filter.types';
11
11
  export * from './filter.indexed';
12
12
  export * from './filter.button';
@@ -80,6 +80,7 @@ export class FilterPlugin extends BasePlugin {
80
80
  if (Object.keys(this.multiFilterItems).length === 0) {
81
81
  return;
82
82
  }
83
+ await timeout();
83
84
  await this.runFiltering(this.multiFilterItems);
84
85
  };
85
86
  this.addEventListener('headerclick', e => this.headerclick(e));
@@ -8,7 +8,7 @@ import { SortingPlugin } from "../sorting/sorting.plugin";
8
8
  import { GROUP_EXPAND_EVENT, GROUPING_ROW_TYPE, PSEUDO_GROUP_COLUMN, } from "./grouping.const";
9
9
  import { doExpand, doCollapse } from "./grouping.row.expand.service";
10
10
  import { gatherGrouping, getExpanded, getSource, isGrouping, isGroupingColumn, } from "./grouping.service";
11
- import { processDoubleConversionTrimmed, TRIMMED_GROUPING, } from "./grouping.trimmed.service";
11
+ import { filterOutEmptyGroupRows, processDoubleConversionTrimmed, TRIMMED_GROUPING, } from "./grouping.trimmed.service";
12
12
  export * from './grouping.const';
13
13
  export * from './grouping.row.expand.service';
14
14
  export * from './grouping.row.types';
@@ -81,16 +81,18 @@ export class GroupingRowPlugin extends BasePlugin {
81
81
  }
82
82
  }
83
83
  beforeTrimmedApply(trimmed, type) {
84
- /** Before filter apply remove grouping filtering */
84
+ /** Filter trim must keep group headers in sync with their visible children. */
85
85
  if (type === FILTER_TRIMMED_TYPE) {
86
86
  const source = this.getStore().get('source');
87
- for (let index in trimmed) {
88
- if (trimmed[index] && isGrouping(source[index])) {
89
- trimmed[index] = false;
90
- }
91
- }
87
+ const updatedTrimmed = filterOutEmptyGroupRows(source, trimmed);
88
+ Object.keys(trimmed).forEach(index => delete trimmed[Number.parseInt(index, 10)]);
89
+ Object.assign(trimmed, updatedTrimmed);
92
90
  }
93
91
  }
92
+ beforeFilterTrimmed(trimmed) {
93
+ const source = this.getStore().get('source');
94
+ return filterOutEmptyGroupRows(source, trimmed);
95
+ }
94
96
  isSortingRunning() {
95
97
  const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
96
98
  return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
@@ -116,7 +118,7 @@ export class GroupingRowPlugin extends BasePlugin {
116
118
  const customRenderer = options === null || options === void 0 ? void 0 : options.groupLabelTemplate;
117
119
  // setup source
118
120
  this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer }, true);
119
- this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap);
121
+ this.updateTrimmed(trimmed, oldNewIndexes !== null && oldNewIndexes !== void 0 ? oldNewIndexes : {}, oldNewIndexMap, sourceWithGroups);
120
122
  }
121
123
  /**
122
124
  * Apply grouping on data set
@@ -135,7 +137,7 @@ export class GroupingRowPlugin extends BasePlugin {
135
137
  const { sourceWithGroups, depth, trimmed, oldNewIndexMap, } = gatherGrouping(source, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.props) || [], options);
136
138
  data.source = sourceWithGroups;
137
139
  this.providers.data.setGrouping({ depth });
138
- this.updateTrimmed(trimmed, oldNewIndexMap);
140
+ this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
139
141
  }
140
142
  /**
141
143
  * External call to apply grouping. Called by revogrid when prop changed.
@@ -184,6 +186,10 @@ export class GroupingRowPlugin extends BasePlugin {
184
186
  * based on new results can be new grouping
185
187
  */
186
188
  this.addEventListener('beforetrimmed', ({ detail: { trimmed, trimmedType } }) => this.beforeTrimmedApply(trimmed, trimmedType));
189
+ /** Filter plugin owns data-row matching; grouping decides which headers remain visible. */
190
+ this.addEventListener('beforefiltertrimmed', ({ detail }) => {
191
+ detail.itemsToFilter = this.beforeFilterTrimmed(detail.itemsToFilter);
192
+ });
187
193
  /**
188
194
  * sorting applied need to clear grouping and apply again
189
195
  * based on new results whole grouping order will changed
@@ -229,12 +235,16 @@ export class GroupingRowPlugin extends BasePlugin {
229
235
  // clear rows
230
236
  const { source, oldNewIndexes } = getSource(this.getStore().get('source'), this.getStore().get('proxyItems'), true);
231
237
  this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
232
- this.updateTrimmed(undefined, undefined, oldNewIndexes);
238
+ this.updateTrimmed(undefined, undefined, oldNewIndexes, source);
233
239
  }
234
- updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap) {
240
+ updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source')) {
235
241
  // map previously trimmed data
236
242
  const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
237
243
  for (let type in trimemedOptionsToUpgrade) {
244
+ if (type === FILTER_TRIMMED_TYPE) {
245
+ /** Regrouping changes physical indexes, so filter trim needs fresh group-header state. */
246
+ trimemedOptionsToUpgrade[type] = filterOutEmptyGroupRows(source, trimemedOptionsToUpgrade[type]);
247
+ }
238
248
  this.revogrid.addTrimmed(trimemedOptionsToUpgrade[type], type);
239
249
  }
240
250
  // const emptyGroups = this.filterOutEmptyGroups(trimemedOptionsToUpgrade, childrenByGroup);
@@ -2,7 +2,26 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { gatherTrimmedItems } from "../../store/index";
5
+ import { GROUP_DEPTH } from "./grouping.const";
6
+ import { isGrouping } from "./grouping.service";
5
7
  export const TRIMMED_GROUPING = 'grouping';
8
+ /**
9
+ * Converts a trim row index through the index maps produced while regrouping.
10
+ *
11
+ * Group rows are synthetic, so they may not exist in the first map. When a
12
+ * second map is available, fall back to the original index so trims created
13
+ * against the grouped physical source can still be remapped. If neither path
14
+ * resolves to a number, the caller drops the stale trim entry.
15
+ */
16
+ function convertTrimmedIndex(initialIndex, firstLevelMap, secondLevelMap) {
17
+ const sourceIndex = Number.parseInt(initialIndex, 10);
18
+ const firstConversionIndex = firstLevelMap[sourceIndex];
19
+ if (!secondLevelMap) {
20
+ return firstConversionIndex;
21
+ }
22
+ const secondConversionKey = typeof firstConversionIndex === 'number' ? firstConversionIndex : sourceIndex;
23
+ return secondLevelMap[secondConversionKey];
24
+ }
6
25
  /**
7
26
  * Prepare trimming updated indexes for grouping
8
27
  * @param initiallyTrimed
@@ -21,31 +40,81 @@ export function processDoubleConversionTrimmed(initiallyTrimed, firstLevelMap, s
21
40
  const items = initiallyTrimed[type];
22
41
  const newItems = {};
23
42
  for (let initialIndex in items) {
43
+ if (!items[initialIndex]) {
44
+ continue;
45
+ }
24
46
  /**
25
47
  * if item exists we find it in collection
26
48
  * we support 2 level of conversions
27
49
  */
28
- let newConversionIndex = firstLevelMap[initialIndex];
29
- if (secondLevelMap) {
30
- newConversionIndex = secondLevelMap[newConversionIndex];
50
+ const newConversionIndex = convertTrimmedIndex(initialIndex, firstLevelMap, secondLevelMap);
51
+ // Group rows do not exist in the ungrouped index map and must not leak into new trims.
52
+ if (typeof newConversionIndex !== 'number') {
53
+ continue;
31
54
  }
32
55
  /**
33
56
  * if item was trimmed previously
34
57
  * trimming makes sense to apply
35
58
  */
36
- if (items[initialIndex]) {
37
- newItems[newConversionIndex] = true;
38
- /**
39
- * If changes present apply changes to new source
40
- */
41
- if (newConversionIndex !== parseInt(initialIndex, 10)) {
42
- trimemedOptionsToUpgrade[type] = newItems;
43
- }
44
- }
59
+ newItems[newConversionIndex] = true;
45
60
  }
61
+ trimemedOptionsToUpgrade[type] = newItems;
46
62
  }
47
63
  return trimemedOptionsToUpgrade;
48
64
  }
65
+ function hasVisibleGroupItems(source, trimmed, groupIndex) {
66
+ var _a;
67
+ const depth = (_a = source[groupIndex]) === null || _a === void 0 ? void 0 : _a[GROUP_DEPTH];
68
+ if (depth == null) {
69
+ return false;
70
+ }
71
+ // A group is visible when at least one descendant data row survives filtering.
72
+ for (let i = groupIndex + 1; i < source.length; i++) {
73
+ const model = source[i];
74
+ if (isGrouping(model)) {
75
+ if (model[GROUP_DEPTH] <= depth) {
76
+ break;
77
+ }
78
+ continue;
79
+ }
80
+ if (!trimmed[i]) {
81
+ return true;
82
+ }
83
+ }
84
+ return false;
85
+ }
86
+ /**
87
+ * Preserves data-row filter results and recalculates group-row visibility
88
+ * from the filtered state of each group's descendant data rows.
89
+ *
90
+ * @param source - Grouped row source that contains group rows and data rows.
91
+ * @param filterTrimmed - Current filter trim map keyed by physical row index.
92
+ * @returns Filter trim map with empty group rows hidden and matching group rows visible.
93
+ */
94
+ export function filterOutEmptyGroupRows(source, filterTrimmed) {
95
+ const trimmed = Object.assign({}, filterTrimmed);
96
+ // Recalculate only group rows; data-row filter results are preserved as-is.
97
+ source.forEach((model, index) => {
98
+ if (!isGrouping(model)) {
99
+ return;
100
+ }
101
+ if (hasVisibleGroupItems(source, trimmed, index)) {
102
+ delete trimmed[index];
103
+ }
104
+ else {
105
+ trimmed[index] = true;
106
+ }
107
+ });
108
+ return trimmed;
109
+ }
110
+ /**
111
+ * Builds grouping trims from an explicit group-to-children map by hiding
112
+ * groups whose children are all hidden by any active trim type.
113
+ *
114
+ * @param allTrimmedGroups - Active trim maps keyed by trim type.
115
+ * @param childrenByGroup - Child row indexes keyed by group row index.
116
+ * @returns Grouping trim map that hides groups without visible children.
117
+ */
49
118
  export function filterOutEmptyGroups(allTrimmedGroups, childrenByGroup = {}) {
50
119
  const trimmedGroup = {};
51
120
  const allTrimmed = gatherTrimmedItems(allTrimmedGroups);
@@ -2,8 +2,8 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { h, f as Build } from './index-Chp_81rd.js';
5
- import { y as DATA_ROW, G as DRAG_ICON_CLASS, I as DRAGGABLE_CLASS } from './dimension.helpers-B-5OBYes.js';
6
- import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-8pPNyrKn.js';
5
+ import { y as DATA_ROW, G as DRAG_ICON_CLASS, I as DRAGGABLE_CLASS } from './dimension.helpers-DzxqJQqN.js';
6
+ import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-Cdz3dYqZ.js';
7
7
 
8
8
  const SortingSign = ({ column }) => {
9
9
  var _a;