@revolist/revogrid 4.14.1 → 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 (37) 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 +1 -1
  4. package/dist/cjs/revo-grid.cjs.entry.js +20 -50
  5. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  6. package/dist/collection/components/revoGrid/revo-grid.js +42 -42
  7. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  8. package/dist/collection/plugins/sorting/sorting.plugin.js +52 -27
  9. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  10. package/dist/collection/plugins/sorting/sorting.types.js.map +1 -1
  11. package/dist/collection/serve/controller.js +12 -0
  12. package/dist/collection/services/column.data.provider.js +0 -38
  13. package/dist/collection/services/column.data.provider.js.map +1 -1
  14. package/dist/esm/{column.drag.plugin-eb8f7e38.js → column.drag.plugin-a111b876.js} +53 -28
  15. package/dist/esm/column.drag.plugin-a111b876.js.map +1 -0
  16. package/dist/esm/index.js +2 -2
  17. package/dist/esm/revo-grid.entry.js +20 -50
  18. package/dist/esm/revo-grid.entry.js.map +1 -1
  19. package/dist/revo-grid/{column.drag.plugin-eb8f7e38.js → column.drag.plugin-a111b876.js} +53 -28
  20. package/dist/revo-grid/column.drag.plugin-a111b876.js.map +1 -0
  21. package/dist/revo-grid/index.esm.js +2 -2
  22. package/dist/revo-grid/revo-grid.entry.js +20 -50
  23. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  24. package/dist/types/components/revoGrid/revo-grid.d.ts +10 -7
  25. package/dist/types/components.d.ts +11 -12
  26. package/dist/types/plugins/sorting/sorting.plugin.d.ts +12 -4
  27. package/dist/types/plugins/sorting/sorting.types.d.ts +1 -0
  28. package/dist/types/services/column.data.provider.d.ts +0 -7
  29. package/hydrate/index.js +137 -142
  30. package/hydrate/index.mjs +137 -142
  31. package/package.json +1 -1
  32. package/readme.md +6 -0
  33. package/standalone/revo-grid.js +70 -75
  34. package/standalone/revo-grid.js.map +1 -1
  35. package/dist/cjs/column.drag.plugin-c61efe93.js.map +0 -1
  36. package/dist/esm/column.drag.plugin-eb8f7e38.js.map +0 -1
  37. package/dist/revo-grid/column.drag.plugin-eb8f7e38.js.map +0 -1
package/hydrate/index.mjs CHANGED
@@ -10594,89 +10594,11 @@ class RevoEdit {
10594
10594
  }; }
10595
10595
  }
10596
10596
 
10597
- /**
10598
- * A specialized version of `_.forEach` for arrays without support for
10599
- * iteratee shorthands.
10600
- *
10601
- * @private
10602
- * @param {Array} [array] The array to iterate over.
10603
- * @param {Function} iteratee The function invoked per iteration.
10604
- * @returns {Array} Returns `array`.
10605
- */
10606
- function arrayEach(array, iteratee) {
10607
- var index = -1,
10608
- length = array == null ? 0 : array.length;
10609
-
10610
- while (++index < length) {
10611
- if (iteratee(array[index], index, array) === false) {
10612
- break;
10613
- }
10614
- }
10615
- return array;
10616
- }
10617
-
10618
- /**
10619
- * Casts `value` to `identity` if it's not a function.
10620
- *
10621
- * @private
10622
- * @param {*} value The value to inspect.
10623
- * @returns {Function} Returns cast function.
10624
- */
10625
- function castFunction(value) {
10626
- return typeof value == 'function' ? value : identity;
10627
- }
10628
-
10629
- /**
10630
- * Iterates over elements of `collection` and invokes `iteratee` for each element.
10631
- * The iteratee is invoked with three arguments: (value, index|key, collection).
10632
- * Iteratee functions may exit iteration early by explicitly returning `false`.
10633
- *
10634
- * **Note:** As with other "Collections" methods, objects with a "length"
10635
- * property are iterated like arrays. To avoid this behavior use `_.forIn`
10636
- * or `_.forOwn` for object iteration.
10637
- *
10638
- * @static
10639
- * @memberOf _
10640
- * @since 0.1.0
10641
- * @alias each
10642
- * @category Collection
10643
- * @param {Array|Object} collection The collection to iterate over.
10644
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
10645
- * @returns {Array|Object} Returns `collection`.
10646
- * @see _.forEachRight
10647
- * @example
10648
- *
10649
- * _.forEach([1, 2], function(value) {
10650
- * console.log(value);
10651
- * });
10652
- * // => Logs `1` then `2`.
10653
- *
10654
- * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
10655
- * console.log(key);
10656
- * });
10657
- * // => Logs 'a' then 'b' (iteration order is not guaranteed).
10658
- */
10659
- function forEach(collection, iteratee) {
10660
- var func = isArray$1(collection) ? arrayEach : baseEach$1;
10661
- return func(collection, castFunction(iteratee));
10662
- }
10663
-
10664
10597
  class ColumnDataProvider {
10665
- get order() {
10666
- const order = {};
10667
- const sorting = this.sorting;
10668
- if (sorting) {
10669
- Object.keys(sorting).forEach(prop => {
10670
- order[prop] = sorting[prop].order;
10671
- });
10672
- }
10673
- return order;
10674
- }
10675
10598
  get stores() {
10676
10599
  return this.dataSources;
10677
10600
  }
10678
10601
  constructor() {
10679
- this.sorting = null;
10680
10602
  this.collection = null;
10681
10603
  this.dataSources = columnTypes.reduce((sources, k) => {
10682
10604
  sources[k] = new DataStore(k);
@@ -10735,7 +10657,6 @@ class ColumnDataProvider {
10735
10657
  }, {}),
10736
10658
  });
10737
10659
  });
10738
- this.sorting = data.sort;
10739
10660
  this.collection = data;
10740
10661
  return data;
10741
10662
  }
@@ -10784,31 +10705,6 @@ class ColumnDataProvider {
10784
10705
  const type = getColumnType(column);
10785
10706
  setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });
10786
10707
  }
10787
- updateColumnSorting(column, index, sorting, additive) {
10788
- if (!additive) {
10789
- this.clearSorting();
10790
- }
10791
- column.order = sorting;
10792
- if (!this.sorting) {
10793
- this.sorting = {};
10794
- }
10795
- this.sorting[column.prop] = column;
10796
- this.updateColumn(column, index);
10797
- return column;
10798
- }
10799
- clearSorting() {
10800
- const types = reduce(this.sorting, (r, c) => {
10801
- const k = getColumnType(c);
10802
- r[k] = true;
10803
- return r;
10804
- }, {});
10805
- forEach(types, (_, type) => {
10806
- const cols = this.dataSources[type].store.get('source');
10807
- forEach(cols, (c) => (c.order = undefined));
10808
- this.dataSources[type].setData({ source: [...cols] });
10809
- });
10810
- this.sorting = {};
10811
- }
10812
10708
  }
10813
10709
 
10814
10710
  /**
@@ -11075,6 +10971,73 @@ class ViewportProvider {
11075
10971
  }
11076
10972
  }
11077
10973
 
10974
+ /**
10975
+ * A specialized version of `_.forEach` for arrays without support for
10976
+ * iteratee shorthands.
10977
+ *
10978
+ * @private
10979
+ * @param {Array} [array] The array to iterate over.
10980
+ * @param {Function} iteratee The function invoked per iteration.
10981
+ * @returns {Array} Returns `array`.
10982
+ */
10983
+ function arrayEach(array, iteratee) {
10984
+ var index = -1,
10985
+ length = array == null ? 0 : array.length;
10986
+
10987
+ while (++index < length) {
10988
+ if (iteratee(array[index], index, array) === false) {
10989
+ break;
10990
+ }
10991
+ }
10992
+ return array;
10993
+ }
10994
+
10995
+ /**
10996
+ * Casts `value` to `identity` if it's not a function.
10997
+ *
10998
+ * @private
10999
+ * @param {*} value The value to inspect.
11000
+ * @returns {Function} Returns cast function.
11001
+ */
11002
+ function castFunction(value) {
11003
+ return typeof value == 'function' ? value : identity;
11004
+ }
11005
+
11006
+ /**
11007
+ * Iterates over elements of `collection` and invokes `iteratee` for each element.
11008
+ * The iteratee is invoked with three arguments: (value, index|key, collection).
11009
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
11010
+ *
11011
+ * **Note:** As with other "Collections" methods, objects with a "length"
11012
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
11013
+ * or `_.forOwn` for object iteration.
11014
+ *
11015
+ * @static
11016
+ * @memberOf _
11017
+ * @since 0.1.0
11018
+ * @alias each
11019
+ * @category Collection
11020
+ * @param {Array|Object} collection The collection to iterate over.
11021
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
11022
+ * @returns {Array|Object} Returns `collection`.
11023
+ * @see _.forEachRight
11024
+ * @example
11025
+ *
11026
+ * _.forEach([1, 2], function(value) {
11027
+ * console.log(value);
11028
+ * });
11029
+ * // => Logs `1` then `2`.
11030
+ *
11031
+ * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
11032
+ * console.log(key);
11033
+ * });
11034
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
11035
+ */
11036
+ function forEach(collection, iteratee) {
11037
+ var func = isArray$1(collection) ? arrayEach : baseEach$1;
11038
+ return func(collection, castFunction(iteratee));
11039
+ }
11040
+
11078
11041
  /**
11079
11042
  * Base layer for plugins
11080
11043
  * Provide minimal starting core for plugins to work
@@ -12126,24 +12089,23 @@ const SortingSign = ({ column }) => {
12126
12089
  /**
12127
12090
  * Lifecycle
12128
12091
  * 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.
12129
- * 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.
12130
- * 2. Method `updateColumnSorting` - Updates the column sorting icon on the grid and the column itself, but the data remains untouched.
12092
+ * 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.
12131
12093
  * 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.
12132
12094
  * 4. @event `aftersortingapply` - Triggered after sorting has been applied and completed. This event occurs for both row and column sorting.
12133
12095
  *
12134
12096
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
12135
12097
  */
12136
12098
  class SortingPlugin extends BasePlugin {
12137
- runSorting(order, comparison, ignoreViewportUpdate) {
12138
- var _a;
12139
- this.sort(order, comparison, undefined, ignoreViewportUpdate);
12140
- (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
12141
- this.sortingPromise = null;
12142
- }
12143
12099
  constructor(revogrid, providers, config) {
12144
12100
  super(revogrid, providers);
12145
12101
  this.revogrid = revogrid;
12102
+ /**
12103
+ * Delayed sorting promise
12104
+ */
12146
12105
  this.sortingPromise = null;
12106
+ /**
12107
+ * We need to sort only so often
12108
+ */
12147
12109
  this.postponeSort = debounce$1((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
12148
12110
  const setConfig = (cfg) => {
12149
12111
  var _a;
@@ -12154,9 +12116,15 @@ class SortingPlugin extends BasePlugin {
12154
12116
  sortingFunc[col.prop] = getComparer(col, col.order);
12155
12117
  order[col.prop] = col.order;
12156
12118
  });
12157
- // // set sorting
12158
- this.sorting = order;
12159
- this.sortingFunc = sortingFunc;
12119
+ if (cfg.additive) {
12120
+ this.sorting = Object.assign(Object.assign({}, this.sorting), order);
12121
+ this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
12122
+ }
12123
+ else {
12124
+ // // set sorting
12125
+ this.sorting = order;
12126
+ this.sortingFunc = sortingFunc;
12127
+ }
12160
12128
  }
12161
12129
  };
12162
12130
  setConfig(config);
@@ -12165,6 +12133,13 @@ class SortingPlugin extends BasePlugin {
12165
12133
  setConfig(detail);
12166
12134
  this.startSorting(this.sorting, this.sortingFunc);
12167
12135
  });
12136
+ this.addEventListener('beforeheaderrender', ({ detail, }) => {
12137
+ var _a;
12138
+ const { data: column } = detail;
12139
+ if (column.sortable) {
12140
+ detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
12141
+ }
12142
+ });
12168
12143
  this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
12169
12144
  // if sorting was provided - sort data
12170
12145
  if (!!this.sorting && this.sortingFunc) {
@@ -12198,9 +12173,12 @@ class SortingPlugin extends BasePlugin {
12198
12173
  if (!((_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.sortable)) {
12199
12174
  return;
12200
12175
  }
12201
- 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);
12176
+ 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);
12202
12177
  });
12203
12178
  }
12179
+ /**
12180
+ * Entry point for sorting, waits for all delayes, registers jobs
12181
+ */
12204
12182
  startSorting(order, sortingFunc, ignoreViewportUpdate) {
12205
12183
  if (!this.sortingPromise) {
12206
12184
  // add job before render
@@ -12214,18 +12192,18 @@ class SortingPlugin extends BasePlugin {
12214
12192
  * Apply sorting to data on header click
12215
12193
  * If additive - add to existing sorting, multiple columns can be sorted
12216
12194
  */
12217
- headerclick(column, index, additive) {
12218
- var _a, _b;
12219
- let order = getNextOrder(column.order);
12195
+ headerclick(column, additive) {
12196
+ var _a, _b, _c;
12197
+ const columnProp = column.prop;
12198
+ let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
12220
12199
  const beforeEvent = this.emit('beforesorting', { column, order, additive });
12221
12200
  if (beforeEvent.defaultPrevented) {
12222
12201
  return;
12223
12202
  }
12224
12203
  order = beforeEvent.detail.order;
12225
- const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
12226
12204
  // apply sort data
12227
12205
  const beforeApplyEvent = this.emit('beforesortingapply', {
12228
- column: newCol,
12206
+ column: beforeEvent.detail.column,
12229
12207
  order,
12230
12208
  additive,
12231
12209
  });
@@ -12239,28 +12217,34 @@ class SortingPlugin extends BasePlugin {
12239
12217
  this.sorting = Object.assign(Object.assign({}, this.sorting), sorting);
12240
12218
  // extend sorting function with new sorting for multiple columns sorting
12241
12219
  this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
12242
- if (column.prop in sorting && size$1(sorting) > 1 && order === undefined) {
12243
- delete sorting[column.prop];
12244
- delete sortingFunc[column.prop];
12220
+ if (columnProp in sorting && size$1(sorting) > 1 && order === undefined) {
12221
+ delete sorting[columnProp];
12222
+ delete sortingFunc[columnProp];
12245
12223
  }
12246
12224
  else {
12247
- sorting[column.prop] = order;
12248
- sortingFunc[column.prop] = cmp;
12225
+ sorting[columnProp] = order;
12226
+ sortingFunc[columnProp] = cmp;
12249
12227
  }
12250
12228
  }
12251
12229
  else {
12252
12230
  if (order) {
12253
12231
  // reset sorting
12254
- this.sorting = { [column.prop]: order };
12255
- this.sortingFunc = { [column.prop]: cmp };
12232
+ this.sorting = { [columnProp]: order };
12233
+ this.sortingFunc = { [columnProp]: cmp };
12256
12234
  }
12257
12235
  else {
12258
- (_a = this.sorting) === null || _a === void 0 ? true : delete _a[column.prop];
12259
- (_b = this.sortingFunc) === null || _b === void 0 ? true : delete _b[column.prop];
12236
+ (_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
12237
+ (_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
12260
12238
  }
12261
12239
  }
12262
12240
  this.startSorting(this.sorting, this.sortingFunc);
12263
12241
  }
12242
+ runSorting(order, comparison, ignoreViewportUpdate) {
12243
+ var _a;
12244
+ this.sort(order, comparison, undefined, ignoreViewportUpdate);
12245
+ (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
12246
+ this.sortingPromise = null;
12247
+ }
12264
12248
  /**
12265
12249
  * Sort items by sorting function
12266
12250
  * @requires proxyItems applied to row store
@@ -12306,6 +12290,10 @@ class SortingPlugin extends BasePlugin {
12306
12290
  }
12307
12291
  }
12308
12292
  }
12293
+ // refresh columns to redraw column headers and show correct icon
12294
+ columnTypes.forEach((type) => {
12295
+ this.providers.column.dataSources[type].refresh();
12296
+ });
12309
12297
  this.emit('aftersortingapply');
12310
12298
  }
12311
12299
  }
@@ -14564,25 +14552,29 @@ class RevoGridComponent {
14564
14552
  }
14565
14553
  /**
14566
14554
  * Update column sorting
14567
- * @param column - full column details to update
14568
- * @param index - virtual column index
14555
+ * @param column - column prop and cellCompare
14569
14556
  * @param order - order to apply
14570
14557
  * @param additive - if false will replace current order
14558
+ *
14559
+ * later passed to SortingPlugin
14571
14560
  */
14572
- async updateColumnSorting(column, index, order, additive) {
14573
- if (!this.columnProvider) {
14574
- throw new Error('Not connected');
14575
- }
14576
- return this.columnProvider.updateColumnSorting(column, index, order, additive);
14561
+ async updateColumnSorting(column, order, additive) {
14562
+ this.sortingconfigchanged.emit({
14563
+ columns: [{
14564
+ prop: column.prop,
14565
+ order,
14566
+ cellCompare: column.cellCompare,
14567
+ }],
14568
+ additive,
14569
+ });
14577
14570
  }
14578
14571
  /**
14579
14572
  * Clears column sorting
14580
14573
  */
14581
14574
  async clearSorting() {
14582
- if (!this.columnProvider) {
14583
- throw new Error('Not connected');
14584
- }
14585
- this.columnProvider.clearSorting();
14575
+ this.sortingconfigchanged.emit({
14576
+ columns: [],
14577
+ });
14586
14578
  }
14587
14579
  /**
14588
14580
  * Receive all columns in data source
@@ -14790,7 +14782,10 @@ class RevoGridComponent {
14790
14782
  const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
14791
14783
  this.aftercolumnsset.emit({
14792
14784
  columns,
14793
- order: this.columnProvider.order,
14785
+ order: Object.entries(beforeApplyEvent.detail.sort).reduce((acc, [prop, column]) => {
14786
+ acc[prop] = column.order;
14787
+ return acc;
14788
+ }, {}),
14794
14789
  });
14795
14790
  }
14796
14791
  disableVirtualXChanged(newVal = false, prevVal = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolist/revogrid",
3
- "version": "4.14.1",
3
+ "version": "4.14.2",
4
4
  "type": "module",
5
5
  "description": "Virtual reactive data grid spreadsheet component - RevoGrid.",
6
6
  "license": "MIT",
package/readme.md CHANGED
@@ -61,6 +61,7 @@ Support Millions of cells and thousands of columns easy and efficiently for fast
61
61
  - Preserve existing collections.
62
62
  - Selection.
63
63
  - Slider.
64
+ - Header filtering.
64
65
  - Custom filters to extend system filters with your own set.
65
66
 
66
67
  - **[Export](https://rv-grid.com/guide/export.plugin)**: Export data to file.
@@ -76,6 +77,7 @@ Support Millions of cells and thousands of columns easy and efficiently for fast
76
77
 
77
78
  - **Grouping**:
78
79
  - [Column grouping](https://rv-grid.com/guide/column/grouping) (nested headers).
80
+ - Column grouping Drill Down: Collapse grouping columns to streamline your grid view, trimming away unnecessary columns and enhancing data organization. Perfect for focusing on the information that matters most, while keeping your workspace clean and efficient.
79
81
  - [Row grouping](https://rv-grid.com/guide/row/grouping) (nested rows).
80
82
 
81
83
  - **Column Types**: [More details](https://rv-grid.com/guide/column/#Column-Formats)
@@ -104,11 +106,15 @@ Support Millions of cells and thousands of columns easy and efficiently for fast
104
106
 
105
107
  - **[Master Detail/Subtables/Forms](https://rv-grid.com/guide/row/master.pro)**: Expand rows to reveal child data.
106
108
  - **[Cell/Column/Row Span/Merge](https://rv-grid.com/guide/cell/merge)**: Merge cells to form groups.
109
+ - **Auto Merge**: Automatically merges cells with identical values in a column.
110
+ - **Form editig**: Edit forms directly within the grid, featuring all necessary fields, including custom options and markdown support for a fast and enhanced data entry experience.
107
111
 
108
112
  - **Customizations**:
109
113
  - [Column header template](https://rv-grid.com/guide/column/header.template).
110
114
  - [Row header template](https://rv-grid.com/guide/row/headers).
111
115
  - [Cell properties](https://rv-grid.com/guide/cell/) (define custom properties for rendered cells).
116
+ - Nested grids: Build a grid inside a grid, showcasing advanced editing options and user interactions for a more dynamic data presentation.
117
+ - Context Menu: Build context menus for any grid element - from cells to headers. Cut, copy, paste, add rows, modify columns, and more. Fully customizable with your own actions and behaviors.
112
118
 
113
119
  - [Cell template](https://rv-grid.com/guide/cell/renderer) (create your own cell views).
114
120
  - [Cell editor](https://rv-grid.com/guide/cell/editor) (use predefined or apply your own custom editors and cell types).