@revolist/revogrid 4.7.0-next.0 → 4.7.0-next.1

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 (43) hide show
  1. package/custom-element/revo-grid.js +44 -45
  2. package/custom-element/revo-grid.js.map +1 -1
  3. package/dist/cjs/revo-grid.cjs.entry.js +44 -45
  4. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  5. package/dist/collection/components/revoGrid/revo-grid.js +13 -17
  6. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  7. package/dist/collection/index.d.ts +2 -2
  8. package/dist/collection/index.js +2 -2
  9. package/dist/collection/index.js.map +1 -1
  10. package/dist/collection/plugins/base.plugin.d.ts +3 -1
  11. package/dist/collection/plugins/base.plugin.js +2 -1
  12. package/dist/collection/plugins/base.plugin.js.map +1 -1
  13. package/dist/collection/plugins/column.auto-size.plugin.d.ts +3 -10
  14. package/dist/collection/plugins/column.auto-size.plugin.js +6 -6
  15. package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -1
  16. package/dist/collection/plugins/column.stretch.plugin.d.ts +4 -16
  17. package/dist/collection/plugins/column.stretch.plugin.js +9 -7
  18. package/dist/collection/plugins/column.stretch.plugin.js.map +1 -1
  19. package/dist/collection/plugins/filter/filter.plugin.d.ts +2 -1
  20. package/dist/collection/plugins/filter/filter.plugin.js +2 -2
  21. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
  22. package/dist/collection/plugins/groupingRow/grouping.row.plugin.d.ts +3 -10
  23. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +9 -9
  24. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
  25. package/dist/collection/plugins/moveColumn/column.drag.plugin.d.ts +3 -2
  26. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +1 -1
  27. package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
  28. package/dist/collection/plugins/sorting/sorting.plugin.d.ts +2 -1
  29. package/dist/collection/plugins/sorting/sorting.plugin.js +2 -2
  30. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  31. package/dist/esm/revo-grid.entry.js +44 -45
  32. package/dist/esm/revo-grid.entry.js.map +1 -1
  33. package/dist/revo-grid/revo-grid.entry.js +1 -1
  34. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  35. package/dist/types/index.d.ts +2 -2
  36. package/dist/types/plugins/base.plugin.d.ts +3 -1
  37. package/dist/types/plugins/column.auto-size.plugin.d.ts +3 -10
  38. package/dist/types/plugins/column.stretch.plugin.d.ts +4 -16
  39. package/dist/types/plugins/filter/filter.plugin.d.ts +2 -1
  40. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +3 -10
  41. package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +3 -2
  42. package/dist/types/plugins/sorting/sorting.plugin.d.ts +2 -1
  43. package/package.json +1 -1
@@ -232,8 +232,9 @@ var map_1 = map;
232
232
  * Extend this class to create plugin
233
233
  */
234
234
  class BasePlugin {
235
- constructor(revogrid) {
235
+ constructor(revogrid, providers) {
236
236
  this.revogrid = revogrid;
237
+ this.providers = providers;
237
238
  this.subscriptions = {};
238
239
  }
239
240
  /**
@@ -861,7 +862,7 @@ var ColumnAutoSizeMode;
861
862
  })(ColumnAutoSizeMode || (ColumnAutoSizeMode = {}));
862
863
  class AutoSizeColumnPlugin extends BasePlugin {
863
864
  constructor(revogrid, providers, config) {
864
- super(revogrid);
865
+ super(revogrid, providers);
865
866
  this.providers = providers;
866
867
  this.config = config;
867
868
  this.autoSizeColumns = null;
@@ -890,7 +891,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
890
891
  const type = ColumnDataProvider.getColumnType(detail.column);
891
892
  const size = this.getColumnSize(detail.index, type);
892
893
  if (size) {
893
- this.providers.dimensionProvider.setCustomSizes(type, {
894
+ this.providers.dimension.setCustomSizes(type, {
894
895
  [detail.index]: size,
895
896
  }, true);
896
897
  }
@@ -936,7 +937,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
936
937
  // calculate size
937
938
  rgCol.size = sizes[rgCol.index] = source.reduce((prev, rgRow) => Math.max(prev, this.getLength(rgRow[rgCol.prop])), this.getLength(rgCol.name || ''));
938
939
  });
939
- this.providers.dimensionProvider.setCustomSizes(type, sizes, true);
940
+ this.providers.dimension.setCustomSizes(type, sizes, true);
940
941
  });
941
942
  }
942
943
  getLength(len) {
@@ -980,7 +981,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
980
981
  rgCol.size = sizes[rgCol.index] = size;
981
982
  }
982
983
  });
983
- this.providers.dimensionProvider.setCustomSizes(type, sizes, true);
984
+ this.providers.dimension.setCustomSizes(type, sizes, true);
984
985
  });
985
986
  }
986
987
  afterEditAll(e) {
@@ -1001,7 +1002,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
1001
1002
  }
1002
1003
  }
1003
1004
  });
1004
- this.providers.dimensionProvider.setCustomSizes(type, sizes, true);
1005
+ this.providers.dimension.setCustomSizes(type, sizes, true);
1005
1006
  });
1006
1007
  }
1007
1008
  getColumnSize(index, type) {
@@ -1009,7 +1010,7 @@ class AutoSizeColumnPlugin extends BasePlugin {
1009
1010
  if (!rgCol) {
1010
1011
  return 0;
1011
1012
  }
1012
- return reduce_1(this.providers.dataProvider.stores, (r, s) => {
1013
+ return reduce_1(this.providers.data.stores, (r, s) => {
1013
1014
  const perStore = reduce_1(s.store.get('items'), (prev, _row, i) => {
1014
1015
  const item = getSourceItem(s.store, i);
1015
1016
  return Math.max(prev || 0, this.getLength(item[rgCol.prop]));
@@ -1200,9 +1201,9 @@ const filterTypes = {
1200
1201
  const FILTER_TRIMMED_TYPE = 'filter';
1201
1202
  const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
1202
1203
  class FilterPlugin extends BasePlugin {
1203
- constructor(revogrid, uiid, config) {
1204
+ constructor(revogrid, providers, uiid, config) {
1204
1205
  var _a;
1205
- super(revogrid);
1206
+ super(revogrid, providers);
1206
1207
  this.revogrid = revogrid;
1207
1208
  this.filterCollection = {};
1208
1209
  this.multiFilterItems = {};
@@ -1648,8 +1649,8 @@ var size_1 = size;
1648
1649
  * If you prevent event it'll not reach farther steps
1649
1650
  */
1650
1651
  class SortingPlugin extends BasePlugin {
1651
- constructor(revogrid) {
1652
- super(revogrid);
1652
+ constructor(revogrid, providers) {
1653
+ super(revogrid, providers);
1653
1654
  this.revogrid = revogrid;
1654
1655
  // sorting order per column
1655
1656
  this.sorting = null;
@@ -2310,7 +2311,7 @@ class GroupingRowPlugin extends BasePlugin {
2310
2311
  return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) && ((_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.length);
2311
2312
  }
2312
2313
  get store() {
2313
- return this.providers.dataProvider.stores[GROUPING_ROW_TYPE].store;
2314
+ return this.providers.data.stores[GROUPING_ROW_TYPE].store;
2314
2315
  }
2315
2316
  // proxy for items get
2316
2317
  get rowItems() {
@@ -2320,7 +2321,7 @@ class GroupingRowPlugin extends BasePlugin {
2320
2321
  return this.store.get('trimmed');
2321
2322
  }
2322
2323
  constructor(revogrid, providers) {
2323
- super(revogrid);
2324
+ super(revogrid, providers);
2324
2325
  this.revogrid = revogrid;
2325
2326
  this.providers = providers;
2326
2327
  }
@@ -2474,7 +2475,7 @@ class GroupingRowPlugin extends BasePlugin {
2474
2475
  */
2475
2476
  const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({ prevExpanded }, options));
2476
2477
  // setup source
2477
- this.providers.dataProvider.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
2478
+ this.providers.data.setData(sourceWithGroups, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, { depth, customRenderer: options === null || options === void 0 ? void 0 : options.groupLabelTemplate }, true);
2478
2479
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexes, oldNewIndexMap);
2479
2480
  }
2480
2481
  /**
@@ -2491,7 +2492,7 @@ class GroupingRowPlugin extends BasePlugin {
2491
2492
  const expanded = this.revogrid.grouping || {};
2492
2493
  const { sourceWithGroups, depth, trimmed, oldNewIndexMap, childrenByGroup, } = gatherGrouping(source, ((_a = this.options) === null || _a === void 0 ? void 0 : _a.props) || [], Object.assign({}, (expanded || {})));
2493
2494
  data.source = sourceWithGroups;
2494
- this.providers.dataProvider.setGrouping({ depth });
2495
+ this.providers.data.setGrouping({ depth });
2495
2496
  this.updateTrimmed(trimmed, childrenByGroup, oldNewIndexMap);
2496
2497
  }
2497
2498
  // apply grouping
@@ -2511,8 +2512,8 @@ class GroupingRowPlugin extends BasePlugin {
2511
2512
  }
2512
2513
  // props exist and columns inited
2513
2514
  for (let t of columnTypes) {
2514
- if (this.setColumnGrouping(this.providers.columnProvider.getColumns(t))) {
2515
- this.providers.columnProvider.refreshByType(t);
2515
+ if (this.setColumnGrouping(this.providers.column.getColumns(t))) {
2516
+ this.providers.column.refreshByType(t);
2516
2517
  break;
2517
2518
  }
2518
2519
  }
@@ -2523,7 +2524,7 @@ class GroupingRowPlugin extends BasePlugin {
2523
2524
  clearGrouping() {
2524
2525
  // clear columns
2525
2526
  columnTypes.forEach(t => {
2526
- const cols = this.providers.columnProvider.getColumns(t);
2527
+ const cols = this.providers.column.getColumns(t);
2527
2528
  let deleted = false;
2528
2529
  cols.forEach(c => {
2529
2530
  if (isGroupingColumn(c)) {
@@ -2533,12 +2534,12 @@ class GroupingRowPlugin extends BasePlugin {
2533
2534
  });
2534
2535
  // if column store had grouping clear and refresh
2535
2536
  if (deleted) {
2536
- this.providers.columnProvider.refreshByType(t);
2537
+ this.providers.column.refreshByType(t);
2537
2538
  }
2538
2539
  });
2539
2540
  // clear rows
2540
2541
  const { source, oldNewIndexes } = this.getSource(true);
2541
- this.providers.dataProvider.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2542
+ this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
2542
2543
  this.updateTrimmed(undefined, undefined, oldNewIndexes);
2543
2544
  }
2544
2545
  updateTrimmed(trimmedGroup = {}, _childrenByGroup = {}, firstLevelMap, secondLevelMap) {
@@ -2972,18 +2973,20 @@ class GridScrollingService {
2972
2973
 
2973
2974
  class StretchColumn extends BasePlugin {
2974
2975
  constructor(revogrid, providers) {
2975
- super(revogrid);
2976
+ super(revogrid, providers);
2976
2977
  this.providers = providers;
2977
2978
  this.stretchedColumn = null;
2978
2979
  // calculate scroll bar size for current user session
2979
2980
  this.scrollSize = getScrollbarWidth(document);
2980
2981
  // subscribe to column changes
2981
- const beforecolumnapplied = ({ detail: { columns } }) => this.applyStretch(columns);
2982
+ const beforecolumnapplied = ({ detail: { columns }, }) => this.applyStretch(columns);
2982
2983
  this.addEventListener('beforecolumnapplied', beforecolumnapplied);
2983
2984
  }
2984
2985
  setScroll({ type, hasScroll }) {
2985
2986
  var _a;
2986
- if (type === 'rgRow' && this.stretchedColumn && ((_a = this.stretchedColumn) === null || _a === void 0 ? void 0 : _a.initialSize) === this.stretchedColumn.size) {
2987
+ if (type === 'rgRow' &&
2988
+ this.stretchedColumn &&
2989
+ ((_a = this.stretchedColumn) === null || _a === void 0 ? void 0 : _a.initialSize) === this.stretchedColumn.size) {
2987
2990
  if (hasScroll) {
2988
2991
  this.stretchedColumn.size -= this.scrollSize;
2989
2992
  this.apply();
@@ -3004,8 +3007,8 @@ class StretchColumn extends BasePlugin {
3004
3007
  return;
3005
3008
  }
3006
3009
  const type = 'rgCol';
3007
- const sizes = this.providers.dimensionProvider.stores[type].store.get('sizes');
3008
- this.providers.dimensionProvider.setCustomSizes(type, Object.assign(Object.assign({}, sizes), { [this.stretchedColumn.index]: this.stretchedColumn.size }), true);
3010
+ const sizes = this.providers.dimension.stores[type].store.get('sizes');
3011
+ this.providers.dimension.setCustomSizes(type, Object.assign(Object.assign({}, sizes), { [this.stretchedColumn.index]: this.stretchedColumn.size }), true);
3009
3012
  }
3010
3013
  /**
3011
3014
  * Apply stretch changes
@@ -3016,11 +3019,11 @@ class StretchColumn extends BasePlugin {
3016
3019
  // calculate grid size
3017
3020
  let sizeDifference = this.revogrid.clientWidth - 1;
3018
3021
  each(columns, (_, type) => {
3019
- const realSize = this.providers.dimensionProvider.stores[type].store.get('realSize');
3022
+ const realSize = this.providers.dimension.stores[type].store.get('realSize');
3020
3023
  sizeDifference -= realSize;
3021
3024
  });
3022
3025
  if (this.revogrid.rowHeaders) {
3023
- const itemsLength = this.providers.dataProvider.stores.rgRow.store.get('source').length;
3026
+ const itemsLength = this.providers.data.stores.rgRow.store.get('source').length;
3024
3027
  const header = this.revogrid.rowHeaders;
3025
3028
  const rowHeaderSize = calculateRowHeaderSize(itemsLength, typeof header === 'object' ? header : undefined);
3026
3029
  if (rowHeaderSize) {
@@ -3157,7 +3160,7 @@ const BEFORE_DRAG_END = 'before-column-drag-end';
3157
3160
  const DRAG_START = 'column-drag-start';
3158
3161
  class ColumnPlugin extends BasePlugin {
3159
3162
  constructor(revogrid, providers) {
3160
- super(revogrid);
3163
+ super(revogrid, providers);
3161
3164
  this.revogrid = revogrid;
3162
3165
  this.providers = providers;
3163
3166
  this.moveFunc = debounce_1((e) => this.doMove(e), 5);
@@ -3810,11 +3813,14 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3810
3813
  let stretch = this.internalPlugins.filter(p => isStretchPlugin(p))[0];
3811
3814
  if ((typeof isStretch === 'boolean' && isStretch) || isStretch === 'true') {
3812
3815
  if (!stretch) {
3813
- this.internalPlugins.push(new StretchColumn(this.element, {
3814
- dataProvider: this.dataProvider,
3815
- columnProvider: this.columnProvider,
3816
- dimensionProvider: this.dimensionProvider,
3817
- }));
3816
+ const pluginData = {
3817
+ data: this.dataProvider,
3818
+ column: this.columnProvider,
3819
+ dimension: this.dimensionProvider,
3820
+ viewport: this.viewportProvider,
3821
+ selection: this.selectionStoreConnector,
3822
+ };
3823
+ this.internalPlugins.push(new StretchColumn(this.element, pluginData));
3818
3824
  }
3819
3825
  else if (isStretchPlugin(stretch)) {
3820
3826
  stretch.applyStretch(this.columnProvider.getRawColumns());
@@ -3855,25 +3861,18 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class RevoGridCompone
3855
3861
  selection: this.selectionStoreConnector,
3856
3862
  };
3857
3863
  if (this.autoSizeColumn) {
3858
- this.internalPlugins.push(new AutoSizeColumnPlugin(this.element, {
3859
- dataProvider: this.dataProvider,
3860
- columnProvider: this.columnProvider,
3861
- dimensionProvider: this.dimensionProvider,
3862
- }, typeof this.autoSizeColumn === 'object'
3864
+ this.internalPlugins.push(new AutoSizeColumnPlugin(this.element, pluginData, typeof this.autoSizeColumn === 'object'
3863
3865
  ? this.autoSizeColumn
3864
3866
  : undefined));
3865
3867
  }
3866
3868
  if (this.filter) {
3867
- this.internalPlugins.push(new FilterPlugin(this.element, this.uuid, typeof this.filter === 'object' ? this.filter : undefined));
3869
+ this.internalPlugins.push(new FilterPlugin(this.element, pluginData, this.uuid, typeof this.filter === 'object' ? this.filter : undefined));
3868
3870
  }
3869
3871
  if (this.exporting) {
3870
- this.internalPlugins.push(new ExportFilePlugin(this.element));
3872
+ this.internalPlugins.push(new ExportFilePlugin(this.element, pluginData));
3871
3873
  }
3872
- this.internalPlugins.push(new SortingPlugin(this.element));
3873
- this.internalPlugins.push(new GroupingRowPlugin(this.element, {
3874
- dataProvider: this.dataProvider,
3875
- columnProvider: this.columnProvider,
3876
- }));
3874
+ this.internalPlugins.push(new SortingPlugin(this.element, pluginData));
3875
+ this.internalPlugins.push(new GroupingRowPlugin(this.element, pluginData));
3877
3876
  if (this.canMoveColumns) {
3878
3877
  this.internalPlugins.push(new ColumnPlugin(this.element, pluginData));
3879
3878
  }