@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
@@ -4,8 +4,8 @@
4
4
  import { h, r as registerInstance, c as createEvent, H as Host, a as getElement } from './index-f6fae858.js';
5
5
  import { c as columnTypes, K as reduce, D as getColumnType, r as rowTypes, i as isRowType, E as getColumnSizes, N as EMPTY_INDEX, J as getColumnByProp, H as getColumns, O as SelectionStoreConnector } from './column.service-2f25c7d0.js';
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, u as timeout } from './dimension.helpers-87e12689.js';
7
- import { q as forEach, D as DimensionStore, B as BasePlugin, G as GroupingRowPlugin, S as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, d as FilterPlugin, E as ExportFilePlugin, l as SortingPlugin, C as ColumnMovePlugin } from './column.drag.plugin-eb8f7e38.js';
8
7
  import { d as debounce } from './debounce-b3166f78.js';
8
+ import { D as DimensionStore, B as BasePlugin, G as GroupingRowPlugin, S as StretchColumn, i as isStretchPlugin, A as AutoSizeColumnPlugin, d as FilterPlugin, E as ExportFilePlugin, l as SortingPlugin, C as ColumnMovePlugin } from './column.drag.plugin-a111b876.js';
9
9
  import { V as ViewportStore } from './viewport.store-84060ef5.js';
10
10
  import { v as viewportDataPartition, H as HEADER_SLOT, C as CONTENT_SLOT, F as FOOTER_SLOT, D as DATA_SLOT } from './viewport.helpers-7e7f9dad.js';
11
11
  import { g as getPropertyFromEvent } from './events-cf0893a3.js';
@@ -78,21 +78,10 @@ function getTheme(theme) {
78
78
  }
79
79
 
80
80
  class ColumnDataProvider {
81
- get order() {
82
- const order = {};
83
- const sorting = this.sorting;
84
- if (sorting) {
85
- Object.keys(sorting).forEach(prop => {
86
- order[prop] = sorting[prop].order;
87
- });
88
- }
89
- return order;
90
- }
91
81
  get stores() {
92
82
  return this.dataSources;
93
83
  }
94
84
  constructor() {
95
- this.sorting = null;
96
85
  this.collection = null;
97
86
  this.dataSources = columnTypes.reduce((sources, k) => {
98
87
  sources[k] = new DataStore(k);
@@ -151,7 +140,6 @@ class ColumnDataProvider {
151
140
  }, {}),
152
141
  });
153
142
  });
154
- this.sorting = data.sort;
155
143
  this.collection = data;
156
144
  return data;
157
145
  }
@@ -200,31 +188,6 @@ class ColumnDataProvider {
200
188
  const type = getColumnType(column);
201
189
  setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });
202
190
  }
203
- updateColumnSorting(column, index, sorting, additive) {
204
- if (!additive) {
205
- this.clearSorting();
206
- }
207
- column.order = sorting;
208
- if (!this.sorting) {
209
- this.sorting = {};
210
- }
211
- this.sorting[column.prop] = column;
212
- this.updateColumn(column, index);
213
- return column;
214
- }
215
- clearSorting() {
216
- const types = reduce(this.sorting, (r, c) => {
217
- const k = getColumnType(c);
218
- r[k] = true;
219
- return r;
220
- }, {});
221
- forEach(types, (_, type) => {
222
- const cols = this.dataSources[type].store.get('source');
223
- forEach(cols, (c) => (c.order = undefined));
224
- this.dataSources[type].setData({ source: [...cols] });
225
- });
226
- this.sorting = {};
227
- }
228
191
  }
229
192
 
230
193
  /**
@@ -1310,25 +1273,29 @@ const RevoGridComponent = class {
1310
1273
  }
1311
1274
  /**
1312
1275
  * Update column sorting
1313
- * @param column - full column details to update
1314
- * @param index - virtual column index
1276
+ * @param column - column prop and cellCompare
1315
1277
  * @param order - order to apply
1316
1278
  * @param additive - if false will replace current order
1279
+ *
1280
+ * later passed to SortingPlugin
1317
1281
  */
1318
- async updateColumnSorting(column, index, order, additive) {
1319
- if (!this.columnProvider) {
1320
- throw new Error('Not connected');
1321
- }
1322
- return this.columnProvider.updateColumnSorting(column, index, order, additive);
1282
+ async updateColumnSorting(column, order, additive) {
1283
+ this.sortingconfigchanged.emit({
1284
+ columns: [{
1285
+ prop: column.prop,
1286
+ order,
1287
+ cellCompare: column.cellCompare,
1288
+ }],
1289
+ additive,
1290
+ });
1323
1291
  }
1324
1292
  /**
1325
1293
  * Clears column sorting
1326
1294
  */
1327
1295
  async clearSorting() {
1328
- if (!this.columnProvider) {
1329
- throw new Error('Not connected');
1330
- }
1331
- this.columnProvider.clearSorting();
1296
+ this.sortingconfigchanged.emit({
1297
+ columns: [],
1298
+ });
1332
1299
  }
1333
1300
  /**
1334
1301
  * Receive all columns in data source
@@ -1536,7 +1503,10 @@ const RevoGridComponent = class {
1536
1503
  const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
1537
1504
  this.aftercolumnsset.emit({
1538
1505
  columns,
1539
- order: this.columnProvider.order,
1506
+ order: Object.entries(beforeApplyEvent.detail.sort).reduce((acc, [prop, column]) => {
1507
+ acc[prop] = column.order;
1508
+ return acc;
1509
+ }, {}),
1540
1510
  });
1541
1511
  }
1542
1512
  disableVirtualXChanged(newVal = false, prevVal = false) {