@revolist/revogrid 4.23.20 → 4.23.21

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.
@@ -1877,7 +1877,7 @@ function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
1877
1877
  * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
1878
1878
  * 2. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
1879
1879
  * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
1880
- * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1880
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. The event detail includes the final sorting state and sorting column metadata when available.
1881
1881
  *
1882
1882
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
1883
1883
  */
@@ -2019,6 +2019,38 @@ class SortingPlugin extends BasePlugin {
2019
2019
  });
2020
2020
  this.setSortingState(state);
2021
2021
  }
2022
+ resetSortingForStore(type) {
2023
+ const storeService = this.providers.data.stores[type];
2024
+ // row data
2025
+ const source = storeService.store.get('source');
2026
+ // row indexes
2027
+ const proxyItems = storeService.store.get('proxyItems');
2028
+ // row indexes
2029
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2030
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2031
+ storeService.setData({ proxyItems: newItemsOrder });
2032
+ }
2033
+ applySortingForStore(type, sorting, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2034
+ const storeService = this.providers.data.stores[type];
2035
+ // row data
2036
+ const source = storeService.store.get('source');
2037
+ // row indexes
2038
+ const proxyItems = storeService.store.get('proxyItems');
2039
+ const sortItems = getSortableRowIndexes(proxyItems, source);
2040
+ const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, sortingColumns, sortingOrder);
2041
+ const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2042
+ // take row indexes before trim applied and proxy items
2043
+ const prevItems = storeService.store.get('items');
2044
+ storeService.setData({
2045
+ proxyItems: newItemsOrder,
2046
+ });
2047
+ // take currently visible row indexes
2048
+ const newItems = storeService.store.get('items');
2049
+ if (!ignoreViewportUpdate) {
2050
+ this.providers.dimension
2051
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2052
+ }
2053
+ }
2022
2054
  startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2023
2055
  if (!this.sortingPromise) {
2024
2056
  // add job before render
@@ -2110,45 +2142,25 @@ class SortingPlugin extends BasePlugin {
2110
2142
  // if no sorting - reset
2111
2143
  if (!Object.keys(sorting || {}).length) {
2112
2144
  for (let type of activeTypes) {
2113
- const storeService = this.providers.data.stores[type];
2114
- // row data
2115
- const source = storeService.store.get('source');
2116
- // row indexes
2117
- const proxyItems = storeService.store.get('proxyItems');
2118
- // row indexes
2119
- const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2120
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2121
- storeService.setData({ proxyItems: newItemsOrder });
2145
+ this.resetSortingForStore(type);
2122
2146
  }
2123
2147
  }
2124
2148
  else {
2125
2149
  for (let type of activeTypes) {
2126
- const storeService = this.providers.data.stores[type];
2127
- // row data
2128
- const source = storeService.store.get('source');
2129
- // row indexes
2130
- const proxyItems = storeService.store.get('proxyItems');
2131
- const sortItems = getSortableRowIndexes(proxyItems, source);
2132
- const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
2133
- const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2134
- // take row indexes before trim applied and proxy items
2135
- const prevItems = storeService.store.get('items');
2136
- storeService.setData({
2137
- proxyItems: newItemsOrder,
2138
- });
2139
- // take currently visible row indexes
2140
- const newItems = storeService.store.get('items');
2141
- if (!activeIgnoreViewportUpdate) {
2142
- this.providers.dimension
2143
- .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2144
- }
2150
+ this.applySortingForStore(type, sorting, sortingFunc, activeSortingColumns, activeSortingOrder, activeIgnoreViewportUpdate);
2145
2151
  }
2146
2152
  }
2147
2153
  // refresh columns to redraw column headers and show correct icon
2148
2154
  column_service.columnTypes.forEach((type) => {
2149
2155
  this.providers.column.dataSources[type].refresh();
2150
2156
  });
2151
- this.emit('aftersortingapply');
2157
+ const afterSortingDetail = {
2158
+ sorting: hasActiveSorting(sorting) ? sorting : undefined,
2159
+ sortingColumns: activeSortingColumns,
2160
+ sortingOrder: activeSortingOrder,
2161
+ types: activeTypes,
2162
+ };
2163
+ this.emit('aftersortingapply', afterSortingDetail);
2152
2164
  }
2153
2165
  }
2154
2166
 
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  var column_service = require('./column.service-BNWNiJW3.js');
7
- var column_drag_plugin = require('./column.drag.plugin-ByDJ7Rk3.js');
7
+ var column_drag_plugin = require('./column.drag.plugin-Bjnv6C0x.js');
8
8
  var headerCellRenderer = require('./header-cell-renderer-DyjOxArm.js');
9
9
  var cellRenderer = require('./cell-renderer-DfUCisis.js');
10
10
  var index$1 = require('./index-DxaSE5uZ.js');
@@ -28,6 +28,7 @@ const REVOGRID_EVENTS = new Map([
28
28
  ['beforesorting', 'beforesorting'],
29
29
  ['beforesourcesortingapply', 'beforesourcesortingapply'],
30
30
  ['beforesortingapply', 'beforesortingapply'],
31
+ ['aftersortingapply', 'aftersortingapply'],
31
32
  ['rowdragstart', 'rowdragstart'],
32
33
  ['headerclick', 'headerclick'],
33
34
  ['beforecellfocus', 'beforecellfocus'],
@@ -8,7 +8,7 @@ var column_service = require('./column.service-BNWNiJW3.js');
8
8
  var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
9
9
  var debounce = require('./debounce-CcpHiH2p.js');
10
10
  var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
11
- var column_drag_plugin = require('./column.drag.plugin-ByDJ7Rk3.js');
11
+ var column_drag_plugin = require('./column.drag.plugin-Bjnv6C0x.js');
12
12
  var viewport_store = require('./viewport.store-BscUCiUk.js');
13
13
  var theme_service = require('./theme.service-BgnxGIjK.js');
14
14
  var index$1 = require('./index-DxaSE5uZ.js');
@@ -1407,6 +1407,7 @@ const RevoGridComponent = class {
1407
1407
  this.beforesorting = index.createEvent(this, "beforesorting", 7);
1408
1408
  this.beforesourcesortingapply = index.createEvent(this, "beforesourcesortingapply", 7);
1409
1409
  this.beforesortingapply = index.createEvent(this, "beforesortingapply", 7);
1410
+ this.aftersortingapply = index.createEvent(this, "aftersortingapply", 7);
1410
1411
  this.rowdragstart = index.createEvent(this, "rowdragstart", 7);
1411
1412
  this.headerclick = index.createEvent(this, "headerclick", 7);
1412
1413
  this.beforecellfocus = index.createEvent(this, "beforecellfocus", 7);
@@ -149,7 +149,7 @@ const Clipboard = class {
149
149
  }
150
150
  };
151
151
 
152
- const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:#fff}revogr-edit input{height:100%;width:100%;box-sizing:border-box}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
152
+ const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:var(--revo-grid-background, #fff)}revogr-edit input{height:100%;width:100%;box-sizing:border-box;background-color:var(--revo-grid-background, transparent)}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
153
153
 
154
154
  const RevoEdit = class {
155
155
  constructor(hostRef) {
@@ -1,12 +1,13 @@
1
1
  revogr-edit {
2
2
  display: block;
3
3
  position: absolute;
4
- background-color: #fff;
4
+ background-color: var(--revo-grid-background, #fff);
5
5
  }
6
6
  revogr-edit input {
7
7
  height: 100%;
8
8
  width: 100%;
9
9
  box-sizing: border-box;
10
+ background-color: var(--revo-grid-background, transparent);
10
11
  }
11
12
  revogr-edit revo-dropdown {
12
13
  height: 100%;
@@ -2248,6 +2248,28 @@ export class RevoGridComponent {
2248
2248
  }
2249
2249
  }
2250
2250
  }
2251
+ }, {
2252
+ "method": "aftersortingapply",
2253
+ "name": "aftersortingapply",
2254
+ "bubbles": true,
2255
+ "cancelable": true,
2256
+ "composed": true,
2257
+ "docs": {
2258
+ "tags": [],
2259
+ "text": "By `SortingPlugin`\n<br>Triggered after sorting has been applied and completed.\n<br>Provides final sorting state and sorting column metadata when available."
2260
+ },
2261
+ "complexType": {
2262
+ "original": "AfterSortingApplyEvent",
2263
+ "resolved": "{ sorting?: SortingOrder | undefined; sortingColumns?: SortingColumnMap | undefined; sortingOrder?: SortingColumnOrder | undefined; types: DimensionRows[]; }",
2264
+ "references": {
2265
+ "AfterSortingApplyEvent": {
2266
+ "location": "import",
2267
+ "path": "../../plugins",
2268
+ "id": "src/plugins/index.ts::AfterSortingApplyEvent",
2269
+ "referenceLocation": "AfterSortingApplyEvent"
2270
+ }
2271
+ }
2272
+ }
2251
2273
  }, {
2252
2274
  "method": "rowdragstart",
2253
2275
  "name": "rowdragstart",
@@ -30,7 +30,7 @@ function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
30
30
  * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
31
31
  * 2. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
32
32
  * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
33
- * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
33
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. The event detail includes the final sorting state and sorting column metadata when available.
34
34
  *
35
35
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
36
36
  */
@@ -172,6 +172,38 @@ export class SortingPlugin extends BasePlugin {
172
172
  });
173
173
  this.setSortingState(state);
174
174
  }
175
+ resetSortingForStore(type) {
176
+ const storeService = this.providers.data.stores[type];
177
+ // row data
178
+ const source = storeService.store.get('source');
179
+ // row indexes
180
+ const proxyItems = storeService.store.get('proxyItems');
181
+ // row indexes
182
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
183
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
184
+ storeService.setData({ proxyItems: newItemsOrder });
185
+ }
186
+ applySortingForStore(type, sorting, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
187
+ const storeService = this.providers.data.stores[type];
188
+ // row data
189
+ const source = storeService.store.get('source');
190
+ // row indexes
191
+ const proxyItems = storeService.store.get('proxyItems');
192
+ const sortItems = getSortableRowIndexes(proxyItems, source);
193
+ const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, sortingColumns, sortingOrder);
194
+ const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
195
+ // take row indexes before trim applied and proxy items
196
+ const prevItems = storeService.store.get('items');
197
+ storeService.setData({
198
+ proxyItems: newItemsOrder,
199
+ });
200
+ // take currently visible row indexes
201
+ const newItems = storeService.store.get('items');
202
+ if (!ignoreViewportUpdate) {
203
+ this.providers.dimension
204
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
205
+ }
206
+ }
175
207
  startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
176
208
  if (!this.sortingPromise) {
177
209
  // add job before render
@@ -263,44 +295,24 @@ export class SortingPlugin extends BasePlugin {
263
295
  // if no sorting - reset
264
296
  if (!Object.keys(sorting || {}).length) {
265
297
  for (let type of activeTypes) {
266
- const storeService = this.providers.data.stores[type];
267
- // row data
268
- const source = storeService.store.get('source');
269
- // row indexes
270
- const proxyItems = storeService.store.get('proxyItems');
271
- // row indexes
272
- const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
273
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
274
- storeService.setData({ proxyItems: newItemsOrder });
298
+ this.resetSortingForStore(type);
275
299
  }
276
300
  }
277
301
  else {
278
302
  for (let type of activeTypes) {
279
- const storeService = this.providers.data.stores[type];
280
- // row data
281
- const source = storeService.store.get('source');
282
- // row indexes
283
- const proxyItems = storeService.store.get('proxyItems');
284
- const sortItems = getSortableRowIndexes(proxyItems, source);
285
- const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
286
- const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
287
- // take row indexes before trim applied and proxy items
288
- const prevItems = storeService.store.get('items');
289
- storeService.setData({
290
- proxyItems: newItemsOrder,
291
- });
292
- // take currently visible row indexes
293
- const newItems = storeService.store.get('items');
294
- if (!activeIgnoreViewportUpdate) {
295
- this.providers.dimension
296
- .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
297
- }
303
+ this.applySortingForStore(type, sorting, sortingFunc, activeSortingColumns, activeSortingOrder, activeIgnoreViewportUpdate);
298
304
  }
299
305
  }
300
306
  // refresh columns to redraw column headers and show correct icon
301
307
  columnTypes.forEach((type) => {
302
308
  this.providers.column.dataSources[type].refresh();
303
309
  });
304
- this.emit('aftersortingapply');
310
+ const afterSortingDetail = {
311
+ sorting: hasActiveSorting(sorting) ? sorting : undefined,
312
+ sortingColumns: activeSortingColumns,
313
+ sortingOrder: activeSortingOrder,
314
+ types: activeTypes,
315
+ };
316
+ this.emit('aftersortingapply', afterSortingDetail);
305
317
  }
306
318
  }
@@ -13,6 +13,7 @@ export const REVOGRID_EVENTS = new Map([
13
13
  ['beforesorting', 'beforesorting'],
14
14
  ['beforesourcesortingapply', 'beforesourcesortingapply'],
15
15
  ['beforesortingapply', 'beforesortingapply'],
16
+ ['aftersortingapply', 'aftersortingapply'],
16
17
  ['rowdragstart', 'rowdragstart'],
17
18
  ['headerclick', 'headerclick'],
18
19
  ['beforecellfocus', 'beforecellfocus'],
@@ -1875,7 +1875,7 @@ function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
1875
1875
  * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
1876
1876
  * 2. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
1877
1877
  * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
1878
- * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1878
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. The event detail includes the final sorting state and sorting column metadata when available.
1879
1879
  *
1880
1880
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
1881
1881
  */
@@ -2017,6 +2017,38 @@ class SortingPlugin extends BasePlugin {
2017
2017
  });
2018
2018
  this.setSortingState(state);
2019
2019
  }
2020
+ resetSortingForStore(type) {
2021
+ const storeService = this.providers.data.stores[type];
2022
+ // row data
2023
+ const source = storeService.store.get('source');
2024
+ // row indexes
2025
+ const proxyItems = storeService.store.get('proxyItems');
2026
+ // row indexes
2027
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2028
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2029
+ storeService.setData({ proxyItems: newItemsOrder });
2030
+ }
2031
+ applySortingForStore(type, sorting, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2032
+ const storeService = this.providers.data.stores[type];
2033
+ // row data
2034
+ const source = storeService.store.get('source');
2035
+ // row indexes
2036
+ const proxyItems = storeService.store.get('proxyItems');
2037
+ const sortItems = getSortableRowIndexes(proxyItems, source);
2038
+ const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, sortingColumns, sortingOrder);
2039
+ const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2040
+ // take row indexes before trim applied and proxy items
2041
+ const prevItems = storeService.store.get('items');
2042
+ storeService.setData({
2043
+ proxyItems: newItemsOrder,
2044
+ });
2045
+ // take currently visible row indexes
2046
+ const newItems = storeService.store.get('items');
2047
+ if (!ignoreViewportUpdate) {
2048
+ this.providers.dimension
2049
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2050
+ }
2051
+ }
2020
2052
  startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2021
2053
  if (!this.sortingPromise) {
2022
2054
  // add job before render
@@ -2108,45 +2140,25 @@ class SortingPlugin extends BasePlugin {
2108
2140
  // if no sorting - reset
2109
2141
  if (!Object.keys(sorting || {}).length) {
2110
2142
  for (let type of activeTypes) {
2111
- const storeService = this.providers.data.stores[type];
2112
- // row data
2113
- const source = storeService.store.get('source');
2114
- // row indexes
2115
- const proxyItems = storeService.store.get('proxyItems');
2116
- // row indexes
2117
- const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2118
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2119
- storeService.setData({ proxyItems: newItemsOrder });
2143
+ this.resetSortingForStore(type);
2120
2144
  }
2121
2145
  }
2122
2146
  else {
2123
2147
  for (let type of activeTypes) {
2124
- const storeService = this.providers.data.stores[type];
2125
- // row data
2126
- const source = storeService.store.get('source');
2127
- // row indexes
2128
- const proxyItems = storeService.store.get('proxyItems');
2129
- const sortItems = getSortableRowIndexes(proxyItems, source);
2130
- const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
2131
- const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2132
- // take row indexes before trim applied and proxy items
2133
- const prevItems = storeService.store.get('items');
2134
- storeService.setData({
2135
- proxyItems: newItemsOrder,
2136
- });
2137
- // take currently visible row indexes
2138
- const newItems = storeService.store.get('items');
2139
- if (!activeIgnoreViewportUpdate) {
2140
- this.providers.dimension
2141
- .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2142
- }
2148
+ this.applySortingForStore(type, sorting, sortingFunc, activeSortingColumns, activeSortingOrder, activeIgnoreViewportUpdate);
2143
2149
  }
2144
2150
  }
2145
2151
  // refresh columns to redraw column headers and show correct icon
2146
2152
  columnTypes.forEach((type) => {
2147
2153
  this.providers.column.dataSources[type].refresh();
2148
2154
  });
2149
- this.emit('aftersortingapply');
2155
+ const afterSortingDetail = {
2156
+ sorting: hasActiveSorting(sorting) ? sorting : undefined,
2157
+ sortingColumns: activeSortingColumns,
2158
+ sortingOrder: activeSortingOrder,
2159
+ types: activeTypes,
2160
+ };
2161
+ this.emit('aftersortingapply', afterSortingDetail);
2150
2162
  }
2151
2163
  }
2152
2164
 
package/dist/esm/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-C6hByxPy.js';
5
- import { B as BasePlugin } from './column.drag.plugin-BZacA8n_.js';
6
- export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, s as SortingPlugin, a as StretchColumn, w as defaultCellCompare, x as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, r as getColumnDragPosition, z as getComparer, q as getLeftRelative, y as getNextOrder, u as getSortingIndex, t as hasActiveSorting, i as isStretchPlugin, v as sortIndexByItems } from './column.drag.plugin-BZacA8n_.js';
5
+ import { B as BasePlugin } from './column.drag.plugin-Bzb8TAwZ.js';
6
+ export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, s as SortingPlugin, a as StretchColumn, w as defaultCellCompare, x as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, r as getColumnDragPosition, z as getComparer, q as getLeftRelative, y as getNextOrder, u as getSortingIndex, t as hasActiveSorting, i as isStretchPlugin, v as sortIndexByItems } from './column.drag.plugin-Bzb8TAwZ.js';
7
7
  export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-BMmXRsd_.js';
8
8
  export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-CLTRlCa5.js';
9
9
  export { a as applyMixins, f as findPositionInArray, g as getScrollbarSize, m as mergeSortedArray, p as pushSorted, r as range, s as scaleValue, t as timeout } from './index-Db3qZoW5.js';
@@ -27,6 +27,7 @@ const REVOGRID_EVENTS = new Map([
27
27
  ['beforesorting', 'beforesorting'],
28
28
  ['beforesourcesortingapply', 'beforesourcesortingapply'],
29
29
  ['beforesortingapply', 'beforesortingapply'],
30
+ ['aftersortingapply', 'aftersortingapply'],
30
31
  ['rowdragstart', 'rowdragstart'],
31
32
  ['headerclick', 'headerclick'],
32
33
  ['beforecellfocus', 'beforecellfocus'],
@@ -6,7 +6,7 @@ import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as
6
6
  import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL } from './dimension.helpers-CGKwSvw6.js';
7
7
  import { d as debounce } from './debounce-PCRWZliA.js';
8
8
  import { g as getScrollDimension, v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-CoCAvmZs.js';
9
- import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, s as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-BZacA8n_.js';
9
+ import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, s as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-Bzb8TAwZ.js';
10
10
  import { V as ViewportStore } from './viewport.store-_c579YyM.js';
11
11
  import { T as ThemeService } from './theme.service-BmnDvr6P.js';
12
12
  import { t as timeout } from './index-Db3qZoW5.js';
@@ -1405,6 +1405,7 @@ const RevoGridComponent = class {
1405
1405
  this.beforesorting = createEvent(this, "beforesorting", 7);
1406
1406
  this.beforesourcesortingapply = createEvent(this, "beforesourcesortingapply", 7);
1407
1407
  this.beforesortingapply = createEvent(this, "beforesortingapply", 7);
1408
+ this.aftersortingapply = createEvent(this, "aftersortingapply", 7);
1408
1409
  this.rowdragstart = createEvent(this, "rowdragstart", 7);
1409
1410
  this.headerclick = createEvent(this, "headerclick", 7);
1410
1411
  this.beforecellfocus = createEvent(this, "beforecellfocus", 7);
@@ -147,7 +147,7 @@ const Clipboard = class {
147
147
  }
148
148
  };
149
149
 
150
- const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:#fff}revogr-edit input{height:100%;width:100%;box-sizing:border-box}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
150
+ const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:var(--revo-grid-background, #fff)}revogr-edit input{height:100%;width:100%;box-sizing:border-box;background-color:var(--revo-grid-background, transparent)}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
151
151
 
152
152
  const RevoEdit = class {
153
153
  constructor(hostRef) {
@@ -1875,7 +1875,7 @@ function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
1875
1875
  * 1. @event `beforesorting` - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
1876
1876
  * 2. @event `beforesourcesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
1877
1877
  * 3. @event `beforesortingapply` - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
1878
- * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
1878
+ * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. The event detail includes the final sorting state and sorting column metadata when available.
1879
1879
  *
1880
1880
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
1881
1881
  */
@@ -2017,6 +2017,38 @@ class SortingPlugin extends BasePlugin {
2017
2017
  });
2018
2018
  this.setSortingState(state);
2019
2019
  }
2020
+ resetSortingForStore(type) {
2021
+ const storeService = this.providers.data.stores[type];
2022
+ // row data
2023
+ const source = storeService.store.get('source');
2024
+ // row indexes
2025
+ const proxyItems = storeService.store.get('proxyItems');
2026
+ // row indexes
2027
+ const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2028
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2029
+ storeService.setData({ proxyItems: newItemsOrder });
2030
+ }
2031
+ applySortingForStore(type, sorting, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2032
+ const storeService = this.providers.data.stores[type];
2033
+ // row data
2034
+ const source = storeService.store.get('source');
2035
+ // row indexes
2036
+ const proxyItems = storeService.store.get('proxyItems');
2037
+ const sortItems = getSortableRowIndexes(proxyItems, source);
2038
+ const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, sortingColumns, sortingOrder);
2039
+ const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2040
+ // take row indexes before trim applied and proxy items
2041
+ const prevItems = storeService.store.get('items');
2042
+ storeService.setData({
2043
+ proxyItems: newItemsOrder,
2044
+ });
2045
+ // take currently visible row indexes
2046
+ const newItems = storeService.store.get('items');
2047
+ if (!ignoreViewportUpdate) {
2048
+ this.providers.dimension
2049
+ .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2050
+ }
2051
+ }
2020
2052
  startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
2021
2053
  if (!this.sortingPromise) {
2022
2054
  // add job before render
@@ -2108,45 +2140,25 @@ class SortingPlugin extends BasePlugin {
2108
2140
  // if no sorting - reset
2109
2141
  if (!Object.keys(sorting || {}).length) {
2110
2142
  for (let type of activeTypes) {
2111
- const storeService = this.providers.data.stores[type];
2112
- // row data
2113
- const source = storeService.store.get('source');
2114
- // row indexes
2115
- const proxyItems = storeService.store.get('proxyItems');
2116
- // row indexes
2117
- const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
2118
- this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
2119
- storeService.setData({ proxyItems: newItemsOrder });
2143
+ this.resetSortingForStore(type);
2120
2144
  }
2121
2145
  }
2122
2146
  else {
2123
2147
  for (let type of activeTypes) {
2124
- const storeService = this.providers.data.stores[type];
2125
- // row data
2126
- const source = storeService.store.get('source');
2127
- // row indexes
2128
- const proxyItems = storeService.store.get('proxyItems');
2129
- const sortItems = getSortableRowIndexes(proxyItems, source);
2130
- const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
2131
- const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
2132
- // take row indexes before trim applied and proxy items
2133
- const prevItems = storeService.store.get('items');
2134
- storeService.setData({
2135
- proxyItems: newItemsOrder,
2136
- });
2137
- // take currently visible row indexes
2138
- const newItems = storeService.store.get('items');
2139
- if (!activeIgnoreViewportUpdate) {
2140
- this.providers.dimension
2141
- .updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
2142
- }
2148
+ this.applySortingForStore(type, sorting, sortingFunc, activeSortingColumns, activeSortingOrder, activeIgnoreViewportUpdate);
2143
2149
  }
2144
2150
  }
2145
2151
  // refresh columns to redraw column headers and show correct icon
2146
2152
  columnTypes.forEach((type) => {
2147
2153
  this.providers.column.dataSources[type].refresh();
2148
2154
  });
2149
- this.emit('aftersortingapply');
2155
+ const afterSortingDetail = {
2156
+ sorting: hasActiveSorting(sorting) ? sorting : undefined,
2157
+ sortingColumns: activeSortingColumns,
2158
+ sortingOrder: activeSortingOrder,
2159
+ types: activeTypes,
2160
+ };
2161
+ this.emit('aftersortingapply', afterSortingDetail);
2150
2162
  }
2151
2163
  }
2152
2164
 
@@ -2,8 +2,8 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  export { o as GROUPING_ROW_TYPE, j as GROUP_COLUMN_PROP, G as GROUP_DEPTH, h as GROUP_EXPANDED, l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, k as GROUP_ORIGINAL_INDEX, f as PSEUDO_GROUP_COLUMN, P as PSEUDO_GROUP_ITEM, d as PSEUDO_GROUP_ITEM_ID, e as PSEUDO_GROUP_ITEM_VALUE, c as columnTypes, a as cropCellToMax, H as gatherGroup, s as gatherGrouping, z as getCellData, B as getCellDataParsed, A as getCellRaw, I as getColumnByProp, D as getColumnSizes, C as getColumnType, F as getColumns, q as getExpanded, t as getGroupingName, x as getParsedGroup, g as getRange, p as getSource, E as isColGrouping, u as isGrouping, v as isGroupingColumn, b as isRangeSingleCell, i as isRowType, y as isSameGroup, w as measureEqualDepth, n as nextCell, r as rowTypes } from './column.service-C6hByxPy.js';
5
- import { B as BasePlugin } from './column.drag.plugin-BZacA8n_.js';
6
- export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, s as SortingPlugin, a as StretchColumn, w as defaultCellCompare, x as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, r as getColumnDragPosition, z as getComparer, q as getLeftRelative, y as getNextOrder, u as getSortingIndex, t as hasActiveSorting, i as isStretchPlugin, v as sortIndexByItems } from './column.drag.plugin-BZacA8n_.js';
5
+ import { B as BasePlugin } from './column.drag.plugin-Bzb8TAwZ.js';
6
+ export { A as AutoSizeColumnPlugin, n as BEFORE_COLUMN_DRAG_END_EVENT, m as COLUMN_DRAG_END_EVENT, l as COLUMN_DRAG_MOVE_EVENT, o as COLUMN_DRAG_START_EVENT, C as ColumnAutoSizeMode, p as ColumnMovePlugin, D as DimensionStore, b as ExportCsv, E as ExportFilePlugin, c as FILTER_CONFIG_CHANGED_EVENT, F as FILTER_TRIMMED_TYPE, d as FILTE_PANEL, e as FilterPlugin, G as GroupingRowPlugin, S as SelectionStore, s as SortingPlugin, a as StretchColumn, w as defaultCellCompare, x as descCellCompare, j as doCollapse, k as doExpand, f as filterCoreFunctionsIndexedByType, h as filterNames, g as filterTypes, r as getColumnDragPosition, z as getComparer, q as getLeftRelative, y as getNextOrder, u as getSortingIndex, t as hasActiveSorting, i as isStretchPlugin, v as sortIndexByItems } from './column.drag.plugin-Bzb8TAwZ.js';
7
7
  export { d as dispatch, a as dispatchByEvent } from './header-cell-renderer-BMmXRsd_.js';
8
8
  export { C as CellRenderer, G as GroupingRowRenderer, S as SortingSign, e as expandEvent, a as expandSvgIconVNode } from './cell-renderer-CLTRlCa5.js';
9
9
  export { a as applyMixins, f as findPositionInArray, g as getScrollbarSize, m as mergeSortedArray, p as pushSorted, r as range, s as scaleValue, t as timeout } from './index-Db3qZoW5.js';
@@ -27,6 +27,7 @@ const REVOGRID_EVENTS = new Map([
27
27
  ['beforesorting', 'beforesorting'],
28
28
  ['beforesourcesortingapply', 'beforesourcesortingapply'],
29
29
  ['beforesortingapply', 'beforesortingapply'],
30
+ ['aftersortingapply', 'aftersortingapply'],
30
31
  ['rowdragstart', 'rowdragstart'],
31
32
  ['headerclick', 'headerclick'],
32
33
  ['beforecellfocus', 'beforecellfocus'],
@@ -6,7 +6,7 @@ import { c as columnTypes, J as reduce, C as getColumnType, r as rowTypes, i as
6
6
  import { D as DataStore, b as getSourceItem, f as getSourceItemVirtualIndexByProp, d as setSourceByPhysicalIndex, s as setSourceByVirtualIndex, a as getVisibleSourceItem, h as gatherTrimmedItems, k as getItemByIndex, R as RESIZE_INTERVAL } from './dimension.helpers-CGKwSvw6.js';
7
7
  import { d as debounce } from './debounce-PCRWZliA.js';
8
8
  import { g as getScrollDimension, v as viewportDataPartition, F as FOOTER_SLOT, C as CONTENT_SLOT, H as HEADER_SLOT, D as DATA_SLOT } from './viewport.helpers-CoCAvmZs.js';
9
- import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, s as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-BZacA8n_.js';
9
+ import { D as DimensionStore, S as SelectionStore, B as BasePlugin, G as GroupingRowPlugin, a as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, e as FilterPlugin, E as ExportFilePlugin, s as SortingPlugin, p as ColumnMovePlugin } from './column.drag.plugin-Bzb8TAwZ.js';
10
10
  import { V as ViewportStore } from './viewport.store-_c579YyM.js';
11
11
  import { T as ThemeService } from './theme.service-BmnDvr6P.js';
12
12
  import { t as timeout } from './index-Db3qZoW5.js';
@@ -1405,6 +1405,7 @@ const RevoGridComponent = class {
1405
1405
  this.beforesorting = createEvent(this, "beforesorting", 7);
1406
1406
  this.beforesourcesortingapply = createEvent(this, "beforesourcesortingapply", 7);
1407
1407
  this.beforesortingapply = createEvent(this, "beforesortingapply", 7);
1408
+ this.aftersortingapply = createEvent(this, "aftersortingapply", 7);
1408
1409
  this.rowdragstart = createEvent(this, "rowdragstart", 7);
1409
1410
  this.headerclick = createEvent(this, "headerclick", 7);
1410
1411
  this.beforecellfocus = createEvent(this, "beforecellfocus", 7);
@@ -147,7 +147,7 @@ const Clipboard = class {
147
147
  }
148
148
  };
149
149
 
150
- const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:#fff}revogr-edit input{height:100%;width:100%;box-sizing:border-box}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
150
+ const revogrEditStyleCss = () => `revogr-edit{display:block;position:absolute;background-color:var(--revo-grid-background, #fff)}revogr-edit input{height:100%;width:100%;box-sizing:border-box;background-color:var(--revo-grid-background, transparent)}revogr-edit revo-dropdown{height:100%}revogr-edit revo-dropdown.shrink fieldset legend>span{display:none}`;
151
151
 
152
152
  const RevoEdit = class {
153
153
  constructor(hostRef) {