@revolist/revogrid 4.14.0 → 4.14.2

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 (67) hide show
  1. package/dist/cjs/{column.drag.plugin-c61efe93.js → column.drag.plugin-911acec7.js} +52 -28
  2. package/dist/cjs/column.drag.plugin-911acec7.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +3 -2
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/revo-grid.cjs.entry.js +20 -50
  6. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  7. package/dist/cjs/revogr-attribution_7.cjs.entry.js +20 -11
  8. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  9. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +1 -1
  10. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  11. package/dist/collection/components/editors/revogr-edit.js +2 -2
  12. package/dist/collection/components/editors/revogr-edit.js.map +1 -1
  13. package/dist/collection/components/overlay/revogr-overlay-selection.js +40 -11
  14. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  15. package/dist/collection/components/revoGrid/revo-grid.js +42 -42
  16. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  17. package/dist/collection/plugins/sorting/sorting.plugin.js +52 -27
  18. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  19. package/dist/collection/plugins/sorting/sorting.types.js.map +1 -1
  20. package/dist/collection/serve/controller.js +12 -0
  21. package/dist/collection/services/column.data.provider.js +0 -38
  22. package/dist/collection/services/column.data.provider.js.map +1 -1
  23. package/dist/collection/types/events.js +2 -1
  24. package/dist/collection/types/events.js.map +1 -1
  25. package/dist/esm/{column.drag.plugin-eb8f7e38.js → column.drag.plugin-a111b876.js} +53 -28
  26. package/dist/esm/column.drag.plugin-a111b876.js.map +1 -0
  27. package/dist/esm/index.js +4 -3
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/revo-grid.entry.js +20 -50
  30. package/dist/esm/revo-grid.entry.js.map +1 -1
  31. package/dist/esm/revogr-attribution_7.entry.js +20 -11
  32. package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
  33. package/dist/esm/revogr-clipboard_3.entry.js +1 -1
  34. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  35. package/dist/revo-grid/{column.drag.plugin-eb8f7e38.js → column.drag.plugin-a111b876.js} +53 -28
  36. package/dist/revo-grid/column.drag.plugin-a111b876.js.map +1 -0
  37. package/dist/revo-grid/index.esm.js +4 -3
  38. package/dist/revo-grid/index.esm.js.map +1 -1
  39. package/dist/revo-grid/revo-grid.entry.js +20 -50
  40. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  41. package/dist/revo-grid/revogr-attribution_7.entry.js +20 -11
  42. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  43. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  44. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  45. package/dist/types/components/editors/revogr-edit.d.ts +1 -1
  46. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +5 -0
  47. package/dist/types/components/revoGrid/revo-grid.d.ts +10 -7
  48. package/dist/types/components.d.ts +19 -15
  49. package/dist/types/plugins/sorting/sorting.plugin.d.ts +12 -4
  50. package/dist/types/plugins/sorting/sorting.types.d.ts +1 -0
  51. package/dist/types/services/column.data.provider.d.ts +0 -7
  52. package/dist/types/types/events.d.ts +1 -1
  53. package/hydrate/index.js +158 -154
  54. package/hydrate/index.mjs +158 -154
  55. package/package.json +1 -1
  56. package/readme.md +6 -0
  57. package/standalone/index.js +2 -1
  58. package/standalone/index.js.map +1 -1
  59. package/standalone/revo-grid.js +70 -75
  60. package/standalone/revo-grid.js.map +1 -1
  61. package/standalone/revogr-edit2.js +1 -1
  62. package/standalone/revogr-edit2.js.map +1 -1
  63. package/standalone/revogr-overlay-selection2.js +20 -11
  64. package/standalone/revogr-overlay-selection2.js.map +1 -1
  65. package/dist/cjs/column.drag.plugin-c61efe93.js.map +0 -1
  66. package/dist/esm/column.drag.plugin-eb8f7e38.js.map +0 -1
  67. package/dist/revo-grid/column.drag.plugin-eb8f7e38.js.map +0 -1
package/hydrate/index.js CHANGED
@@ -9850,6 +9850,7 @@ class OverlaySelection {
9850
9850
  this.beforeKeyDown = createEvent(this, "beforekeydown", 7);
9851
9851
  this.beforeKeyUp = createEvent(this, "beforekeyup", 7);
9852
9852
  this.beforeCellSave = createEvent(this, "beforecellsave", 7);
9853
+ this.cellEditDone = createEvent(this, "celledit", 7);
9853
9854
  this.keyboardService = null;
9854
9855
  this.autoFillService = null;
9855
9856
  this.unsubscribeSelectionStore = [];
@@ -10031,7 +10032,22 @@ class OverlaySelection {
10031
10032
  }
10032
10033
  const cell = getCell(renderEvent.detail.range, renderEvent.detail.rowDimension, renderEvent.detail.colDimension);
10033
10034
  const styles = styleByCellProps(cell);
10034
- return (hAsync("revogr-edit", { style: styles, ref: el => (this.revogrEdit = el), additionalData: this.additionalData, editCell: editable, saveOnClose: this.applyChangesOnClose, column: this.columnService.rowDataModel(editCell.y, editCell.x), editor: getCellEditor(this.columnService.columns[editCell.x], this.editors) }));
10035
+ return (hAsync("revogr-edit", { style: styles, ref: el => (this.revogrEdit = el), additionalData: this.additionalData, editCell: editable, saveOnClose: this.applyChangesOnClose, onCelleditinit: (e) => {
10036
+ this.cellEditDone.emit(e.detail);
10037
+ }, column: this.columnService.rowDataModel(editCell.y, editCell.x), editor: getCellEditor(this.columnService.columns[editCell.x], this.editors) }));
10038
+ }
10039
+ onEditCell(e) {
10040
+ if (e.defaultPrevented) {
10041
+ return;
10042
+ }
10043
+ const saveEv = this.beforeCellSave.emit(e.detail);
10044
+ if (!saveEv.defaultPrevented) {
10045
+ this.cellEdit(saveEv.detail);
10046
+ }
10047
+ // if not clear navigate to next cell after edit
10048
+ if (!saveEv.detail.preventFocus) {
10049
+ this.focusNext();
10050
+ }
10035
10051
  }
10036
10052
  render() {
10037
10053
  var _a;
@@ -10061,16 +10077,9 @@ class OverlaySelection {
10061
10077
  nodes.push(hAsync("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: e => this.rowDragStart(e) }));
10062
10078
  }
10063
10079
  }
10064
- return (hAsync(Host, { key: 'aaae2fb9cd6abd04c5b742277214579901062a54', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e), onCelledit: (e) => {
10065
- const saveEv = this.beforeCellSave.emit(e.detail);
10066
- if (!saveEv.defaultPrevented) {
10067
- this.cellEdit(saveEv.detail);
10068
- }
10069
- // if not clear navigate to next cell after edit
10070
- if (!saveEv.detail.preventFocus) {
10071
- this.focusNext();
10072
- }
10073
- } }, nodes, hAsync("slot", { key: '945243e45f2cfbb78d8727c10652d6d0d530d494', name: "data" })));
10080
+ return (hAsync(Host, { key: '262adae9c825a0feb678090b62bd3ab57f149ac7', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true), onCloseedit: (e) => this.closeEdit(e),
10081
+ // it's done to be able to throw events from different levels, not just from editor
10082
+ onCelledit: (e) => this.onEditCell(e) }, nodes, hAsync("slot", { key: '2196345c62e1edf7b00c854ba4f281ecb68ea5a7', name: "data" })));
10074
10083
  }
10075
10084
  /**
10076
10085
  * Executes the focus operation on the specified range of cells.
@@ -10440,7 +10449,7 @@ var RevogrEditStyle0 = revogrEditStyleCss;
10440
10449
  class RevoEdit {
10441
10450
  constructor(hostRef) {
10442
10451
  registerInstance(this, hostRef);
10443
- this.cellEdit = createEvent(this, "celledit", 7);
10452
+ this.cellEdit = createEvent(this, "celleditinit", 7);
10444
10453
  this.closeEdit = createEvent(this, "closeedit", 7);
10445
10454
  this.currentEditor = null;
10446
10455
  this.preventSaveOnClose = false;
@@ -10589,89 +10598,11 @@ class RevoEdit {
10589
10598
  }; }
10590
10599
  }
10591
10600
 
10592
- /**
10593
- * A specialized version of `_.forEach` for arrays without support for
10594
- * iteratee shorthands.
10595
- *
10596
- * @private
10597
- * @param {Array} [array] The array to iterate over.
10598
- * @param {Function} iteratee The function invoked per iteration.
10599
- * @returns {Array} Returns `array`.
10600
- */
10601
- function arrayEach(array, iteratee) {
10602
- var index = -1,
10603
- length = array == null ? 0 : array.length;
10604
-
10605
- while (++index < length) {
10606
- if (iteratee(array[index], index, array) === false) {
10607
- break;
10608
- }
10609
- }
10610
- return array;
10611
- }
10612
-
10613
- /**
10614
- * Casts `value` to `identity` if it's not a function.
10615
- *
10616
- * @private
10617
- * @param {*} value The value to inspect.
10618
- * @returns {Function} Returns cast function.
10619
- */
10620
- function castFunction(value) {
10621
- return typeof value == 'function' ? value : identity;
10622
- }
10623
-
10624
- /**
10625
- * Iterates over elements of `collection` and invokes `iteratee` for each element.
10626
- * The iteratee is invoked with three arguments: (value, index|key, collection).
10627
- * Iteratee functions may exit iteration early by explicitly returning `false`.
10628
- *
10629
- * **Note:** As with other "Collections" methods, objects with a "length"
10630
- * property are iterated like arrays. To avoid this behavior use `_.forIn`
10631
- * or `_.forOwn` for object iteration.
10632
- *
10633
- * @static
10634
- * @memberOf _
10635
- * @since 0.1.0
10636
- * @alias each
10637
- * @category Collection
10638
- * @param {Array|Object} collection The collection to iterate over.
10639
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10640
- * @returns {Array|Object} Returns `collection`.
10641
- * @see _.forEachRight
10642
- * @example
10643
- *
10644
- * _.forEach([1, 2], function(value) {
10645
- * console.log(value);
10646
- * });
10647
- * // => Logs `1` then `2`.
10648
- *
10649
- * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
10650
- * console.log(key);
10651
- * });
10652
- * // => Logs 'a' then 'b' (iteration order is not guaranteed).
10653
- */
10654
- function forEach(collection, iteratee) {
10655
- var func = isArray$1(collection) ? arrayEach : baseEach$1;
10656
- return func(collection, castFunction(iteratee));
10657
- }
10658
-
10659
10601
  class ColumnDataProvider {
10660
- get order() {
10661
- const order = {};
10662
- const sorting = this.sorting;
10663
- if (sorting) {
10664
- Object.keys(sorting).forEach(prop => {
10665
- order[prop] = sorting[prop].order;
10666
- });
10667
- }
10668
- return order;
10669
- }
10670
10602
  get stores() {
10671
10603
  return this.dataSources;
10672
10604
  }
10673
10605
  constructor() {
10674
- this.sorting = null;
10675
10606
  this.collection = null;
10676
10607
  this.dataSources = columnTypes.reduce((sources, k) => {
10677
10608
  sources[k] = new DataStore(k);
@@ -10730,7 +10661,6 @@ class ColumnDataProvider {
10730
10661
  }, {}),
10731
10662
  });
10732
10663
  });
10733
- this.sorting = data.sort;
10734
10664
  this.collection = data;
10735
10665
  return data;
10736
10666
  }
@@ -10779,31 +10709,6 @@ class ColumnDataProvider {
10779
10709
  const type = getColumnType(column);
10780
10710
  setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });
10781
10711
  }
10782
- updateColumnSorting(column, index, sorting, additive) {
10783
- if (!additive) {
10784
- this.clearSorting();
10785
- }
10786
- column.order = sorting;
10787
- if (!this.sorting) {
10788
- this.sorting = {};
10789
- }
10790
- this.sorting[column.prop] = column;
10791
- this.updateColumn(column, index);
10792
- return column;
10793
- }
10794
- clearSorting() {
10795
- const types = reduce(this.sorting, (r, c) => {
10796
- const k = getColumnType(c);
10797
- r[k] = true;
10798
- return r;
10799
- }, {});
10800
- forEach(types, (_, type) => {
10801
- const cols = this.dataSources[type].store.get('source');
10802
- forEach(cols, (c) => (c.order = undefined));
10803
- this.dataSources[type].setData({ source: [...cols] });
10804
- });
10805
- this.sorting = {};
10806
- }
10807
10712
  }
10808
10713
 
10809
10714
  /**
@@ -11070,6 +10975,73 @@ class ViewportProvider {
11070
10975
  }
11071
10976
  }
11072
10977
 
10978
+ /**
10979
+ * A specialized version of `_.forEach` for arrays without support for
10980
+ * iteratee shorthands.
10981
+ *
10982
+ * @private
10983
+ * @param {Array} [array] The array to iterate over.
10984
+ * @param {Function} iteratee The function invoked per iteration.
10985
+ * @returns {Array} Returns `array`.
10986
+ */
10987
+ function arrayEach(array, iteratee) {
10988
+ var index = -1,
10989
+ length = array == null ? 0 : array.length;
10990
+
10991
+ while (++index < length) {
10992
+ if (iteratee(array[index], index, array) === false) {
10993
+ break;
10994
+ }
10995
+ }
10996
+ return array;
10997
+ }
10998
+
10999
+ /**
11000
+ * Casts `value` to `identity` if it's not a function.
11001
+ *
11002
+ * @private
11003
+ * @param {*} value The value to inspect.
11004
+ * @returns {Function} Returns cast function.
11005
+ */
11006
+ function castFunction(value) {
11007
+ return typeof value == 'function' ? value : identity;
11008
+ }
11009
+
11010
+ /**
11011
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
11012
+ * The iteratee is invoked with three arguments: (value, index|key, collection).
11013
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
11014
+ *
11015
+ * **Note:** As with other "Collections" methods, objects with a "length"
11016
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
11017
+ * or `_.forOwn` for object iteration.
11018
+ *
11019
+ * @static
11020
+ * @memberOf _
11021
+ * @since 0.1.0
11022
+ * @alias each
11023
+ * @category Collection
11024
+ * @param {Array|Object} collection The collection to iterate over.
11025
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
11026
+ * @returns {Array|Object} Returns `collection`.
11027
+ * @see _.forEachRight
11028
+ * @example
11029
+ *
11030
+ * _.forEach([1, 2], function(value) {
11031
+ * console.log(value);
11032
+ * });
11033
+ * // => Logs `1` then `2`.
11034
+ *
11035
+ * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
11036
+ * console.log(key);
11037
+ * });
11038
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
11039
+ */
11040
+ function forEach(collection, iteratee) {
11041
+ var func = isArray$1(collection) ? arrayEach : baseEach$1;
11042
+ return func(collection, castFunction(iteratee));
11043
+ }
11044
+
11073
11045
  /**
11074
11046
  * Base layer for plugins
11075
11047
  * Provide minimal starting core for plugins to work
@@ -12121,24 +12093,23 @@ const SortingSign = ({ column }) => {
12121
12093
  /**
12122
12094
  * Lifecycle
12123
12095
  * 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.
12124
- * 1.1. @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.
12125
- * 2. Method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
12096
+ * 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.
12126
12097
  * 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.
12127
12098
  * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
12128
12099
  *
12129
12100
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
12130
12101
  */
12131
12102
  class SortingPlugin extends BasePlugin {
12132
- runSorting(order, comparison, ignoreViewportUpdate) {
12133
- var _a;
12134
- this.sort(order, comparison, undefined, ignoreViewportUpdate);
12135
- (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
12136
- this.sortingPromise = null;
12137
- }
12138
12103
  constructor(revogrid, providers, config) {
12139
12104
  super(revogrid, providers);
12140
12105
  this.revogrid = revogrid;
12106
+ /**
12107
+ * Delayed sorting promise
12108
+ */
12141
12109
  this.sortingPromise = null;
12110
+ /**
12111
+ * We need to sort only so often
12112
+ */
12142
12113
  this.postponeSort = debounce$1((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
12143
12114
  const setConfig = (cfg) => {
12144
12115
  var _a;
@@ -12149,9 +12120,15 @@ class SortingPlugin extends BasePlugin {
12149
12120
  sortingFunc[col.prop] = getComparer(col, col.order);
12150
12121
  order[col.prop] = col.order;
12151
12122
  });
12152
- // // set sorting
12153
- this.sorting = order;
12154
- this.sortingFunc = sortingFunc;
12123
+ if (cfg.additive) {
12124
+ this.sorting = Object.assign(Object.assign({}, this.sorting), order);
12125
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
12126
+ }
12127
+ else {
12128
+ // // set sorting
12129
+ this.sorting = order;
12130
+ this.sortingFunc = sortingFunc;
12131
+ }
12155
12132
  }
12156
12133
  };
12157
12134
  setConfig(config);
@@ -12160,6 +12137,13 @@ class SortingPlugin extends BasePlugin {
12160
12137
  setConfig(detail);
12161
12138
  this.startSorting(this.sorting, this.sortingFunc);
12162
12139
  });
12140
+ this.addEventListener('beforeheaderrender', ({ detail, }) => {
12141
+ var _a;
12142
+ const { data: column } = detail;
12143
+ if (column.sortable) {
12144
+ detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
12145
+ }
12146
+ });
12163
12147
  this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
12164
12148
  // if sorting was provided - sort data
12165
12149
  if (!!this.sorting && this.sortingFunc) {
@@ -12193,9 +12177,12 @@ class SortingPlugin extends BasePlugin {
12193
12177
  if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
12194
12178
  return;
12195
12179
  }
12196
- this.headerclick(e.detail.column, e.detail.index, (_d = (_c = e.detail) === null || _c === void 0 ? void 0 : _c.originalEvent) === null || _d === void 0 ? void 0 : _d.shiftKey);
12180
+ this.headerclick(e.detail.column, (_d = (_c = e.detail) === null || _c === void 0 ? void 0 : _c.originalEvent) === null || _d === void 0 ? void 0 : _d.shiftKey);
12197
12181
  });
12198
12182
  }
12183
+ /**
12184
+ * Entry point for sorting, waits for all delayes, registers jobs
12185
+ */
12199
12186
  startSorting(order, sortingFunc, ignoreViewportUpdate) {
12200
12187
  if (!this.sortingPromise) {
12201
12188
  // add job before render
@@ -12209,18 +12196,18 @@ class SortingPlugin extends BasePlugin {
12209
12196
  * Apply sorting to data on header click
12210
12197
  * If additive - add to existing sorting, multiple columns can be sorted
12211
12198
  */
12212
- headerclick(column, index, additive) {
12213
- var _a, _b;
12214
- let order = getNextOrder(column.order);
12199
+ headerclick(column, additive) {
12200
+ var _a, _b, _c;
12201
+ const columnProp = column.prop;
12202
+ let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
12215
12203
  const beforeEvent = this.emit('beforesorting', { column, order, additive });
12216
12204
  if (beforeEvent.defaultPrevented) {
12217
12205
  return;
12218
12206
  }
12219
12207
  order = beforeEvent.detail.order;
12220
- const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
12221
12208
  // apply sort data
12222
12209
  const beforeApplyEvent = this.emit('beforesortingapply', {
12223
- column: newCol,
12210
+ column: beforeEvent.detail.column,
12224
12211
  order,
12225
12212
  additive,
12226
12213
  });
@@ -12234,28 +12221,34 @@ class SortingPlugin extends BasePlugin {
12234
12221
  this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
12235
12222
  // extend sorting function with new sorting for multiple columns sorting
12236
12223
  this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
12237
- if (column.prop in sorting && size$1(sorting) > 1 && order === undefined) {
12238
- delete sorting[column.prop];
12239
- delete sortingFunc[column.prop];
12224
+ if (columnProp in sorting && size$1(sorting) > 1 && order === undefined) {
12225
+ delete sorting[columnProp];
12226
+ delete sortingFunc[columnProp];
12240
12227
  }
12241
12228
  else {
12242
- sorting[column.prop] = order;
12243
- sortingFunc[column.prop] = cmp;
12229
+ sorting[columnProp] = order;
12230
+ sortingFunc[columnProp] = cmp;
12244
12231
  }
12245
12232
  }
12246
12233
  else {
12247
12234
  if (order) {
12248
12235
  // reset sorting
12249
- this.sorting = { [column.prop]: order };
12250
- this.sortingFunc = { [column.prop]: cmp };
12236
+ this.sorting = { [columnProp]: order };
12237
+ this.sortingFunc = { [columnProp]: cmp };
12251
12238
  }
12252
12239
  else {
12253
- (_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
12254
- (_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
12240
+ (_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
12241
+ (_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
12255
12242
  }
12256
12243
  }
12257
12244
  this.startSorting(this.sorting, this.sortingFunc);
12258
12245
  }
12246
+ runSorting(order, comparison, ignoreViewportUpdate) {
12247
+ var _a;
12248
+ this.sort(order, comparison, undefined, ignoreViewportUpdate);
12249
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
12250
+ this.sortingPromise = null;
12251
+ }
12259
12252
  /**
12260
12253
  * Sort items by sorting function
12261
12254
  * @requires proxyItems applied to row store
@@ -12301,6 +12294,10 @@ class SortingPlugin extends BasePlugin {
12301
12294
  }
12302
12295
  }
12303
12296
  }
12297
+ // refresh columns to redraw column headers and show correct icon
12298
+ columnTypes.forEach((type) => {
12299
+ this.providers.column.dataSources[type].refresh();
12300
+ });
12304
12301
  this.emit('aftersortingapply');
12305
12302
  }
12306
12303
  }
@@ -14559,25 +14556,29 @@ class RevoGridComponent {
14559
14556
  }
14560
14557
  /**
14561
14558
  * Update column sorting
14562
- * @param column - full column details to update
14563
- * @param index - virtual column index
14559
+ * @param column - column prop and cellCompare
14564
14560
  * @param order - order to apply
14565
14561
  * @param additive - if false will replace current order
14562
+ *
14563
+ * later passed to SortingPlugin
14566
14564
  */
14567
- async updateColumnSorting(column, index, order, additive) {
14568
- if (!this.columnProvider) {
14569
- throw new Error('Not connected');
14570
- }
14571
- return this.columnProvider.updateColumnSorting(column, index, order, additive);
14565
+ async updateColumnSorting(column, order, additive) {
14566
+ this.sortingconfigchanged.emit({
14567
+ columns: [{
14568
+ prop: column.prop,
14569
+ order,
14570
+ cellCompare: column.cellCompare,
14571
+ }],
14572
+ additive,
14573
+ });
14572
14574
  }
14573
14575
  /**
14574
14576
  * Clears column sorting
14575
14577
  */
14576
14578
  async clearSorting() {
14577
- if (!this.columnProvider) {
14578
- throw new Error('Not connected');
14579
- }
14580
- this.columnProvider.clearSorting();
14579
+ this.sortingconfigchanged.emit({
14580
+ columns: [],
14581
+ });
14581
14582
  }
14582
14583
  /**
14583
14584
  * Receive all columns in data source
@@ -14785,7 +14786,10 @@ class RevoGridComponent {
14785
14786
  const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
14786
14787
  this.aftercolumnsset.emit({
14787
14788
  columns,
14788
- order: this.columnProvider.order,
14789
+ order: Object.entries(beforeApplyEvent.detail.sort).reduce((acc, [prop, column]) => {
14790
+ acc[prop] = column.order;
14791
+ return acc;
14792
+ }, {}),
14789
14793
  });
14790
14794
  }
14791
14795
  disableVirtualXChanged(newVal = false, prevVal = false) {