@revolist/revogrid 4.9.37 → 4.9.40

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 (158) hide show
  1. package/dist/cjs/{column.drag.plugin-ffe1918f.js → column.drag.plugin-fcd892ec.js} +18 -18
  2. package/dist/cjs/column.drag.plugin-fcd892ec.js.map +1 -0
  3. package/dist/cjs/{index-947f3534.js → column.service-26c61ed6.js} +1256 -469
  4. package/dist/cjs/column.service-26c61ed6.js.map +1 -0
  5. package/dist/cjs/{edit.utils-68a4f1c4.js → edit.utils-179c0800.js} +2 -2
  6. package/dist/cjs/{edit.utils-68a4f1c4.js.map → edit.utils-179c0800.js.map} +1 -1
  7. package/dist/cjs/{header-cell-renderer-57fb8f18.js → header-cell-renderer-d879d95e.js} +2 -2
  8. package/dist/cjs/{header-cell-renderer-57fb8f18.js.map → header-cell-renderer-d879d95e.js.map} +1 -1
  9. package/dist/cjs/index-3ab26ab9.js +513 -0
  10. package/dist/cjs/index-3ab26ab9.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +21 -20
  12. package/dist/cjs/index.cjs.js.map +1 -1
  13. package/dist/cjs/{key.utils-da2ead49.js → key.utils-f49d7bee.js} +2 -2
  14. package/dist/cjs/{key.utils-da2ead49.js.map → key.utils-f49d7bee.js.map} +1 -1
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/cjs/revo-grid.cjs.entry.js +87 -55
  17. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  18. package/dist/cjs/revo-grid.cjs.js +1 -1
  19. package/dist/cjs/revogr-attribution_7.cjs.entry.js +13 -13
  20. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  21. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +21 -18
  22. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  23. package/dist/cjs/revogr-data_4.cjs.entry.js +9 -9
  24. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  25. package/dist/cjs/{row-header-utils-fe2264e7.js → row-header-utils-c37f76e4.js} +6 -5
  26. package/dist/cjs/row-header-utils-c37f76e4.js.map +1 -0
  27. package/dist/cjs/{text-editor-55511a6a.js → text-editor-b756d6b3.js} +3 -3
  28. package/dist/cjs/{text-editor-55511a6a.js.map → text-editor-b756d6b3.js.map} +1 -1
  29. package/dist/cjs/{throttle-2ae258fb.js → throttle-a57f51f9.js} +2 -2
  30. package/dist/cjs/{throttle-2ae258fb.js.map → throttle-a57f51f9.js.map} +1 -1
  31. package/dist/collection/components/order/revogr-order-editor.js +99 -27
  32. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  33. package/dist/collection/components/overlay/revogr-overlay-selection.js +2 -2
  34. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  35. package/dist/collection/components/revoGrid/revo-grid.js +10 -0
  36. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  37. package/dist/collection/plugins/sorting/sorting.plugin.js +25 -27
  38. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
  39. package/dist/collection/services/data.provider.js +12 -5
  40. package/dist/collection/services/data.provider.js.map +1 -1
  41. package/dist/collection/services/dimension.provider.js +22 -0
  42. package/dist/collection/services/dimension.provider.js.map +1 -1
  43. package/dist/collection/store/dataSource/data.proxy.js +19 -6
  44. package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
  45. package/dist/collection/store/dataSource/data.store.js +3 -0
  46. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  47. package/dist/collection/types/events.js +1 -0
  48. package/dist/collection/types/events.js.map +1 -1
  49. package/dist/esm/{column.drag.plugin-bbd79520.js → column.drag.plugin-3cc77986.js} +6 -6
  50. package/dist/esm/{column.drag.plugin-bbd79520.js.map → column.drag.plugin-3cc77986.js.map} +1 -1
  51. package/dist/esm/{index-8eeaa30d.js → column.service-751345b2.js} +1216 -427
  52. package/dist/esm/column.service-751345b2.js.map +1 -0
  53. package/dist/esm/{debounce-7b511afc.js → debounce-72878ced.js} +2 -2
  54. package/dist/esm/{debounce-7b511afc.js.map → debounce-72878ced.js.map} +1 -1
  55. package/dist/esm/{edit.utils-aeb2dc7c.js → edit.utils-6fc686b9.js} +2 -2
  56. package/dist/esm/{edit.utils-aeb2dc7c.js.map → edit.utils-6fc686b9.js.map} +1 -1
  57. package/dist/esm/{header-cell-renderer-1aec2328.js → header-cell-renderer-32d2ed96.js} +2 -2
  58. package/dist/esm/{header-cell-renderer-1aec2328.js.map → header-cell-renderer-32d2ed96.js.map} +1 -1
  59. package/dist/esm/index-1dcad6ef.js +476 -0
  60. package/dist/esm/index-1dcad6ef.js.map +1 -0
  61. package/dist/esm/index.js +9 -8
  62. package/dist/esm/index.js.map +1 -1
  63. package/dist/esm/{key.utils-9ee5fa40.js → key.utils-17273f42.js} +2 -2
  64. package/dist/esm/{key.utils-9ee5fa40.js.map → key.utils-17273f42.js.map} +1 -1
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/revo-grid.entry.js +67 -35
  67. package/dist/esm/revo-grid.entry.js.map +1 -1
  68. package/dist/esm/revo-grid.js +1 -1
  69. package/dist/esm/revogr-attribution_7.entry.js +9 -9
  70. package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
  71. package/dist/esm/revogr-clipboard_3.entry.js +22 -19
  72. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  73. package/dist/esm/revogr-data_4.entry.js +5 -5
  74. package/dist/esm/revogr-filter-panel.entry.js +1 -1
  75. package/dist/esm/{row-header-utils-3220f80d.js → row-header-utils-3dfbb81f.js} +3 -2
  76. package/dist/esm/row-header-utils-3dfbb81f.js.map +1 -0
  77. package/dist/esm/{text-editor-d9dcf56d.js → text-editor-901c3eb8.js} +3 -3
  78. package/dist/esm/{text-editor-d9dcf56d.js.map → text-editor-901c3eb8.js.map} +1 -1
  79. package/dist/esm/{throttle-ce8e57c9.js → throttle-138d69c3.js} +3 -3
  80. package/dist/esm/{throttle-ce8e57c9.js.map → throttle-138d69c3.js.map} +1 -1
  81. package/dist/revo-grid/column.drag.plugin-3cc77986.js +5 -0
  82. package/dist/revo-grid/{column.drag.plugin-bbd79520.js.map → column.drag.plugin-3cc77986.js.map} +1 -1
  83. package/dist/revo-grid/column.service-751345b2.js +5 -0
  84. package/dist/revo-grid/column.service-751345b2.js.map +1 -0
  85. package/dist/revo-grid/{debounce-7b511afc.js → debounce-72878ced.js} +2 -2
  86. package/dist/revo-grid/{edit.utils-aeb2dc7c.js → edit.utils-6fc686b9.js} +2 -2
  87. package/dist/revo-grid/{header-cell-renderer-1aec2328.js → header-cell-renderer-32d2ed96.js} +2 -2
  88. package/dist/revo-grid/index-1dcad6ef.js +5 -0
  89. package/dist/revo-grid/index-1dcad6ef.js.map +1 -0
  90. package/dist/revo-grid/index.esm.js +1 -1
  91. package/dist/revo-grid/index.esm.js.map +1 -1
  92. package/dist/revo-grid/key.utils-17273f42.js +5 -0
  93. package/dist/revo-grid/{key.utils-9ee5fa40.js.map → key.utils-17273f42.js.map} +1 -1
  94. package/dist/revo-grid/revo-grid.entry.js +1 -1
  95. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  96. package/dist/revo-grid/revo-grid.esm.js +1 -1
  97. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  98. package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
  99. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  100. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  101. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  102. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  103. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  104. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  105. package/dist/revo-grid/row-header-utils-3dfbb81f.js +5 -0
  106. package/dist/revo-grid/{row-header-utils-3220f80d.js.map → row-header-utils-3dfbb81f.js.map} +1 -1
  107. package/dist/revo-grid/text-editor-901c3eb8.js +5 -0
  108. package/dist/revo-grid/{throttle-ce8e57c9.js → throttle-138d69c3.js} +2 -2
  109. package/dist/types/components/order/revogr-order-editor.d.ts +18 -4
  110. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +2 -4
  111. package/dist/types/components/revoGrid/revo-grid.d.ts +1 -0
  112. package/dist/types/components.d.ts +25 -6
  113. package/dist/types/plugins/sorting/sorting.plugin.d.ts +4 -4
  114. package/dist/types/services/data.provider.d.ts +5 -0
  115. package/dist/types/services/dimension.provider.d.ts +1 -0
  116. package/dist/types/store/dataSource/data.proxy.d.ts +9 -3
  117. package/dist/types/store/dataSource/data.store.d.ts +1 -0
  118. package/dist/types/types/events.d.ts +1 -1
  119. package/hydrate/index.js +127 -75
  120. package/hydrate/index.mjs +127 -75
  121. package/package.json +1 -1
  122. package/standalone/column.service.js +1 -1
  123. package/standalone/data.store.js +28 -31
  124. package/standalone/data.store.js.map +1 -1
  125. package/standalone/dimension.helpers.js +1 -1
  126. package/standalone/identity.js +26 -0
  127. package/standalone/identity.js.map +1 -0
  128. package/standalone/index.js +2 -1
  129. package/standalone/index.js.map +1 -1
  130. package/standalone/revo-grid.js +64 -31
  131. package/standalone/revo-grid.js.map +1 -1
  132. package/standalone/revogr-header2.js +1 -1
  133. package/standalone/revogr-order-editor2.js +18 -15
  134. package/standalone/revogr-order-editor2.js.map +1 -1
  135. package/standalone/revogr-overlay-selection2.js +2 -2
  136. package/standalone/revogr-overlay-selection2.js.map +1 -1
  137. package/dist/cjs/column.drag.plugin-ffe1918f.js.map +0 -1
  138. package/dist/cjs/column.service-e9ab1aa3.js +0 -1286
  139. package/dist/cjs/column.service-e9ab1aa3.js.map +0 -1
  140. package/dist/cjs/index-947f3534.js.map +0 -1
  141. package/dist/cjs/row-header-utils-fe2264e7.js.map +0 -1
  142. package/dist/esm/column.service-397b7249.js +0 -1249
  143. package/dist/esm/column.service-397b7249.js.map +0 -1
  144. package/dist/esm/index-8eeaa30d.js.map +0 -1
  145. package/dist/esm/row-header-utils-3220f80d.js.map +0 -1
  146. package/dist/revo-grid/column.drag.plugin-bbd79520.js +0 -5
  147. package/dist/revo-grid/column.service-397b7249.js +0 -5
  148. package/dist/revo-grid/column.service-397b7249.js.map +0 -1
  149. package/dist/revo-grid/index-8eeaa30d.js +0 -5
  150. package/dist/revo-grid/index-8eeaa30d.js.map +0 -1
  151. package/dist/revo-grid/key.utils-9ee5fa40.js +0 -5
  152. package/dist/revo-grid/row-header-utils-3220f80d.js +0 -5
  153. package/dist/revo-grid/text-editor-d9dcf56d.js +0 -5
  154. /package/dist/revo-grid/{debounce-7b511afc.js.map → debounce-72878ced.js.map} +0 -0
  155. /package/dist/revo-grid/{edit.utils-aeb2dc7c.js.map → edit.utils-6fc686b9.js.map} +0 -0
  156. /package/dist/revo-grid/{header-cell-renderer-1aec2328.js.map → header-cell-renderer-32d2ed96.js.map} +0 -0
  157. /package/dist/revo-grid/{text-editor-d9dcf56d.js.map → text-editor-901c3eb8.js.map} +0 -0
  158. /package/dist/revo-grid/{throttle-ce8e57c9.js.map → throttle-138d69c3.js.map} +0 -0
package/hydrate/index.mjs CHANGED
@@ -3295,12 +3295,48 @@ class FilterPanel {
3295
3295
  }; }
3296
3296
  }
3297
3297
 
3298
+ const MIN_COL_SIZE = 30;
3299
+ const RESIZE_INTERVAL = 40;
3300
+ const DATA_COL = 'data-rgCol';
3301
+ const DATA_ROW = 'data-rgRow';
3302
+ const DISABLED_CLASS = 'disabled';
3303
+ const CELL_CLASS = 'rgCell';
3304
+ const ROW_HEADER_TYPE = 'rowHeaders';
3305
+ const HEADER_CLASS = 'rgHeaderCell';
3306
+ const HEADER_SORTABLE_CLASS = 'sortable';
3307
+ const HEADER_ROW_CLASS = 'header-rgRow';
3308
+ const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
3309
+ const DRAG_ICON_CLASS = 'revo-drag-icon';
3310
+ const DRAGGABLE_CLASS = 'revo-draggable';
3311
+ const FOCUS_CLASS = 'focused-cell';
3312
+ const SELECTION_BORDER_CLASS = 'selection-border-range';
3313
+ const MOBILE_CLASS = 'mobile-handler';
3314
+ const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
3315
+ const CELL_HANDLER_CLASS = 'autofill-handle';
3316
+ const EDIT_INPUT_WR = 'edit-input-wrapper';
3317
+ const DRAGG_TEXT = 'Draggable item';
3318
+ const GRID_INTERNALS = '__rvgr';
3319
+ const ROW_FOCUSED_CLASS = 'focused-rgRow';
3320
+
3298
3321
  /**
3299
- * All items
3300
- * Used as proxy for sorting
3301
- * Keep order but do not modify final source
3322
+ * Proxy plugin for data source.
3323
+ * This plugin is used to sort the data source.
3324
+ * It keeps the order of the items but does not modify the final source.
3325
+ * It is also used to filter the items in the data source.
3326
+ * The `set` method takes a key and a new value as arguments.
3327
+ * If the key is 'proxyItems' it will filter the items in the data source according to the new value.
3328
+ * The new value should be an array of numbers representing the indexes of the items that should be visible.
3329
+ * The method will return a new array of numbers with the indexes of the items that should be visible.
3330
+ * The method will also update the 'items' property of the store with the new array.
3302
3331
  */
3303
3332
  const proxyPlugin = (store) => ({
3333
+ /**
3334
+ * Set the value of a property in the store.
3335
+ * If the key is 'proxyItems' it will filter the items in the data source according to the new value.
3336
+ * The new value should be an array of numbers representing the indexes of the items that should be visible.
3337
+ * The method will return a new array of numbers with the indexes of the items that should be visible.
3338
+ * The method will also update the 'items' property of the store with the new array.
3339
+ */
3304
3340
  set(k, newVal) {
3305
3341
  if (!isProxy(k)) {
3306
3342
  return;
@@ -3310,15 +3346,15 @@ const proxyPlugin = (store) => ({
3310
3346
  * Mark indexes as visible
3311
3347
  */
3312
3348
  const oldItems = store.get('items').reduce((r, v) => {
3313
- r[v] = true;
3349
+ r.add(v);
3314
3350
  return r;
3315
- }, {});
3351
+ }, new Set());
3316
3352
  /**
3317
3353
  * Check if new values where present in items
3318
3354
  * Filter item collection according presense
3319
3355
  */
3320
3356
  const newItems = newVal.reduce((r, i) => {
3321
- if (oldItems[i]) {
3357
+ if (oldItems.has(i)) {
3322
3358
  r.push(i);
3323
3359
  }
3324
3360
  return r;
@@ -6359,6 +6395,9 @@ class DataStore {
6359
6395
  trimmed = Object.assign(Object.assign({}, trimmed), some);
6360
6396
  setStore(this.store, { trimmed });
6361
6397
  }
6398
+ setSourceData(items, mutate = true) {
6399
+ setSourceByVirtualIndex(this.store, items, mutate);
6400
+ }
6362
6401
  // local data update
6363
6402
  setData(input) {
6364
6403
  const data = Object.assign({}, input);
@@ -7800,29 +7839,6 @@ function isRowType(type) {
7800
7839
  return rowTypes.indexOf(type) > -1;
7801
7840
  }
7802
7841
 
7803
- const MIN_COL_SIZE = 30;
7804
- const RESIZE_INTERVAL = 40;
7805
- const DATA_COL = 'data-rgCol';
7806
- const DATA_ROW = 'data-rgRow';
7807
- const DISABLED_CLASS = 'disabled';
7808
- const CELL_CLASS = 'rgCell';
7809
- const ROW_HEADER_TYPE = 'rowHeaders';
7810
- const HEADER_CLASS = 'rgHeaderCell';
7811
- const HEADER_SORTABLE_CLASS = 'sortable';
7812
- const HEADER_ROW_CLASS = 'header-rgRow';
7813
- const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
7814
- const DRAG_ICON_CLASS = 'revo-drag-icon';
7815
- const DRAGGABLE_CLASS = 'revo-draggable';
7816
- const FOCUS_CLASS = 'focused-cell';
7817
- const SELECTION_BORDER_CLASS = 'selection-border-range';
7818
- const MOBILE_CLASS = 'mobile-handler';
7819
- const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
7820
- const CELL_HANDLER_CLASS = 'autofill-handle';
7821
- const EDIT_INPUT_WR = 'edit-input-wrapper';
7822
- const DRAGG_TEXT = 'Draggable item';
7823
- const GRID_INTERNALS = '__rvgr';
7824
- const ROW_FOCUSED_CLASS = 'focused-rgRow';
7825
-
7826
7842
  class RowOrderService {
7827
7843
  constructor(config) {
7828
7844
  this.config = config;
@@ -7902,17 +7918,19 @@ class OrderEditor {
7902
7918
  this.rowDrag = createEvent(this, "rowdragmoveinit", 7);
7903
7919
  this.rowMouseMove = createEvent(this, "rowdragmousemove", 7);
7904
7920
  this.rowDropped = createEvent(this, "rowdropinit", 7);
7921
+ this.rowOrderChange = createEvent(this, "roworderchange", 7);
7905
7922
  this.events = [];
7906
7923
  this.rowMoveFunc = debounce$1((y) => {
7907
7924
  const rgRow = this.rowOrderService.move(y, this.getData());
7908
7925
  if (rgRow !== null) {
7909
- this.rowDrag.emit(rgRow);
7926
+ this.rowDrag.emit(Object.assign(Object.assign({}, rgRow), { rowType: this.rowType }));
7910
7927
  }
7911
7928
  }, 5);
7912
7929
  this.parent = undefined;
7913
7930
  this.dimensionRow = undefined;
7914
7931
  this.dimensionCol = undefined;
7915
7932
  this.dataStore = undefined;
7933
+ this.rowType = undefined;
7916
7934
  }
7917
7935
  // #endregion
7918
7936
  // #region Methods
@@ -7930,6 +7948,7 @@ class OrderEditor {
7930
7948
  text: DRAGG_TEXT,
7931
7949
  pos,
7932
7950
  event: e.originalEvent,
7951
+ rowType: this.rowType,
7933
7952
  });
7934
7953
  if (dragStartEvent.defaultPrevented) {
7935
7954
  return;
@@ -7960,28 +7979,28 @@ class OrderEditor {
7960
7979
  this.rowOrderService.clear();
7961
7980
  this.events.forEach(v => document.removeEventListener(v.name, v.listener));
7962
7981
  this.events.length = 0;
7963
- this.rowDragEnd.emit();
7982
+ this.rowDragEnd.emit({ rowType: this.rowType });
7964
7983
  }
7965
7984
  // #endregion
7966
7985
  move({ x, y }) {
7967
- this.rowMouseMove.emit({ x, y });
7986
+ this.rowMouseMove.emit({ x, y, rowType: this.rowType });
7968
7987
  this.rowMoveFunc(y);
7969
7988
  }
7970
7989
  connectedCallback() {
7971
7990
  this.rowOrderService = new RowOrderService({
7972
- positionChanged: (f, t) => this.onPositionChanged(f, t),
7991
+ positionChanged: (from, to) => {
7992
+ const dropEvent = this.rowDropped.emit({
7993
+ from,
7994
+ to,
7995
+ rowType: this.rowType,
7996
+ });
7997
+ if (dropEvent.defaultPrevented) {
7998
+ return;
7999
+ }
8000
+ this.rowOrderChange.emit(dropEvent.detail);
8001
+ },
7973
8002
  });
7974
8003
  }
7975
- onPositionChanged(from, to) {
7976
- const dropEvent = this.rowDropped.emit({ from, to });
7977
- if (dropEvent.defaultPrevented) {
7978
- return;
7979
- }
7980
- const items = [...this.dataStore.get('items')];
7981
- const toMove = items.splice(from, 1);
7982
- items.splice(to, 0, ...toMove);
7983
- setItems(this.dataStore, items);
7984
- }
7985
8004
  getData() {
7986
8005
  return {
7987
8006
  el: this.parent,
@@ -7997,6 +8016,7 @@ class OrderEditor {
7997
8016
  "dimensionRow": [16],
7998
8017
  "dimensionCol": [16],
7999
8018
  "dataStore": [16],
8019
+ "rowType": [1, "row-type"],
8000
8020
  "dragStart": [64],
8001
8021
  "endOrder": [64],
8002
8022
  "clearOrder": [64]
@@ -9573,10 +9593,10 @@ class OverlaySelection {
9573
9593
  }
9574
9594
  // Order
9575
9595
  if (this.canDrag) {
9576
- nodes.push(hAsync("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onRowdragstartinit: e => this.rowDragStart(e) }));
9596
+ 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) }));
9577
9597
  }
9578
9598
  }
9579
- return (hAsync(Host, { key: 'e48d9f7349a97c719120610b3839f5aff213547c', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, hAsync("slot", { key: 'c0a25578618d0025f784f188eb8db28159e92955', name: "data" })));
9599
+ return (hAsync(Host, { key: '53847b6211a31f69b2f2df1b191544a3b6dfefd8', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, hAsync("slot", { key: '012c496c34954b7074a53a4d9e949ac9e3d072af', name: "data" })));
9580
9600
  }
9581
9601
  /**
9582
9602
  * Executes the focus operation on the specified range of cells.
@@ -10325,11 +10345,19 @@ class DataProvider {
10325
10345
  const store = this.stores[type].store;
10326
10346
  return getSourceItem(store, virtualIndex);
10327
10347
  }
10348
+ changeOrder({ rowType = 'rgRow', from, to }) {
10349
+ const service = this.stores[rowType];
10350
+ const items = [...service.store.get('items')];
10351
+ const prevItems = [...items];
10352
+ const toMove = items.splice(from, 1);
10353
+ items.splice(to, 0, ...toMove);
10354
+ this.dimensionProvider.updateSizesPositionByNewDataIndexes(rowType, items, prevItems);
10355
+ service.setData({ items });
10356
+ }
10328
10357
  setCellData({ type, rowIndex, prop, val }, mutate = true) {
10329
10358
  const model = this.getModel(rowIndex, type);
10330
10359
  model[prop] = val;
10331
- // apply data to source
10332
- setSourceByVirtualIndex(this.stores[type].store, { [rowIndex]: model }, mutate);
10360
+ this.stores[type].setSourceData({ [rowIndex]: model }, mutate);
10333
10361
  }
10334
10362
  setRangeData(data, type) {
10335
10363
  const items = {};
@@ -10342,8 +10370,7 @@ class DataProvider {
10342
10370
  oldModel[prop] = data[rowIndex][prop];
10343
10371
  }
10344
10372
  }
10345
- // apply data to source
10346
- setSourceByVirtualIndex(this.stores[type].store, items);
10373
+ this.stores[type].setSourceData(items);
10347
10374
  }
10348
10375
  refresh(type = 'all') {
10349
10376
  if (isRowType(type)) {
@@ -10518,6 +10545,28 @@ class DimensionProvider {
10518
10545
  this.stores[s].setStore(data);
10519
10546
  }
10520
10547
  }
10548
+ updateSizesPositionByNewDataIndexes(type, newItemsOrder, prevItemsOrder = []) {
10549
+ // Move custom sizes to new order
10550
+ const dimService = this.stores[type];
10551
+ const customSizes = Object.assign({}, dimService.store.get('sizes'));
10552
+ if (Object.keys(customSizes).length) {
10553
+ const originalIndices = new Map();
10554
+ prevItemsOrder.forEach((value, index) => {
10555
+ originalIndices.set(value, index);
10556
+ });
10557
+ const newSizes = {};
10558
+ newItemsOrder.forEach((value, newIndex) => {
10559
+ const originalIndex = originalIndices.get(value);
10560
+ if (originalIndex !== newIndex && customSizes[originalIndex]) {
10561
+ newSizes[newIndex] = customSizes[originalIndex];
10562
+ delete customSizes[originalIndex];
10563
+ }
10564
+ });
10565
+ if (Object.keys(newSizes).length) {
10566
+ this.setCustomSizes(type, Object.assign(Object.assign({}, customSizes), newSizes));
10567
+ }
10568
+ }
10569
+ }
10521
10570
  }
10522
10571
 
10523
10572
  class ViewportProvider {
@@ -11546,9 +11595,9 @@ function size$1(collection) {
11546
11595
  * Note: If you prevent an event, it will not proceed to the subsequent steps.
11547
11596
  */
11548
11597
  class SortingPlugin extends BasePlugin {
11549
- async runSorting(order, comparison) {
11598
+ runSorting(order, comparison) {
11550
11599
  var _a;
11551
- await this.sort(order, comparison);
11600
+ this.sort(order, comparison);
11552
11601
  (_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
11553
11602
  this.sortingPromise = null;
11554
11603
  }
@@ -11556,8 +11605,8 @@ class SortingPlugin extends BasePlugin {
11556
11605
  super(revogrid, providers);
11557
11606
  this.revogrid = revogrid;
11558
11607
  this.sortingPromise = null;
11559
- this.postponeSort = debounce$1(async (order, comparison) => this.runSorting(order, comparison), 50);
11560
- const beforeanysource = async ({ detail: { type }, }) => {
11608
+ this.postponeSort = debounce$1((order, comparison) => this.runSorting(order, comparison), 50);
11609
+ const beforeanysource = ({ detail: { type }, }) => {
11561
11610
  // if sorting was provided - sort data
11562
11611
  if (!!this.sorting && this.sortingFunc) {
11563
11612
  const beforeEvent = this.emit('beforesorting', { type });
@@ -11567,8 +11616,8 @@ class SortingPlugin extends BasePlugin {
11567
11616
  this.startSorting(this.sorting, this.sortingFunc);
11568
11617
  }
11569
11618
  };
11570
- const aftercolumnsset = async ({ detail: { order }, }) => {
11571
- const columns = (await this.revogrid.getColumns());
11619
+ const aftercolumnsset = ({ detail: { order }, }) => {
11620
+ const columns = this.providers.column.getColumns();
11572
11621
  const sortingFunc = {};
11573
11622
  for (let prop in order) {
11574
11623
  const cmp = this.getComparer(getColumnByProp(columns, prop), order[prop]);
@@ -11576,7 +11625,7 @@ class SortingPlugin extends BasePlugin {
11576
11625
  }
11577
11626
  this.runSorting(order, sortingFunc);
11578
11627
  };
11579
- const headerclick = async (e) => {
11628
+ const headerclick = (e) => {
11580
11629
  var _a, _b;
11581
11630
  if (e.defaultPrevented) {
11582
11631
  return;
@@ -11613,7 +11662,7 @@ class SortingPlugin extends BasePlugin {
11613
11662
  * Apply sorting to data on header click
11614
11663
  * If additive - add to existing sorting, multiple columns can be sorted
11615
11664
  */
11616
- async headerclick(column, index, additive) {
11665
+ headerclick(column, index, additive) {
11617
11666
  var _a, _b;
11618
11667
  let order = this.getNextOrder(column.order);
11619
11668
  const beforeEvent = this.emit('beforesorting', { column, order, additive });
@@ -11621,7 +11670,7 @@ class SortingPlugin extends BasePlugin {
11621
11670
  return;
11622
11671
  }
11623
11672
  order = beforeEvent.detail.order;
11624
- const newCol = await this.revogrid.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
11673
+ const newCol = this.providers.column.updateColumnSorting(beforeEvent.detail.column, index, order, additive);
11625
11674
  // apply sort data
11626
11675
  const beforeApplyEvent = this.emit('beforesortingapply', {
11627
11676
  column: newCol,
@@ -11669,38 +11718,37 @@ class SortingPlugin extends BasePlugin {
11669
11718
  * @param sorting - per column sorting
11670
11719
  * @param data - this.stores['rgRow'].store.get('source')
11671
11720
  */
11672
- async sort(sorting, sortingFunc, types = ['rgRow', 'rowPinStart', 'rowPinEnd']) {
11721
+ sort(sorting, sortingFunc, types = rowTypes) {
11673
11722
  // if no sorting - reset
11674
11723
  if (!size$1(sorting)) {
11675
11724
  this.sorting = undefined;
11676
11725
  this.sortingFunc = undefined;
11677
11726
  for (let type of types) {
11678
- const store = await this.revogrid.getSourceStore(type);
11727
+ const storeService = this.providers.data.stores[type];
11679
11728
  // row data
11680
- const source = store.get('source');
11729
+ const source = storeService.store.get('source');
11681
11730
  // row indexes
11682
- const proxyItems = range$1(0, source.length);
11683
- setStore(store, {
11684
- proxyItems,
11685
- source: [...source],
11686
- });
11731
+ const proxyItems = storeService.store.get('proxyItems');
11732
+ // row indexes
11733
+ const newItemsOrder = storeService.store.get('items'); // recover indexes range(0, source.length)
11734
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
11735
+ storeService.setData({ proxyItems: newItemsOrder, source: [...source] });
11687
11736
  }
11688
11737
  }
11689
11738
  else {
11690
11739
  // set sorting
11691
11740
  this.sorting = sorting;
11692
11741
  this.sortingFunc = sortingFunc;
11693
- // by default it'll sort by rgRow store
11694
- // todo: support multiple stores
11695
11742
  for (let type of types) {
11696
- const store = await this.revogrid.getSourceStore(type);
11743
+ const storeService = this.providers.data.stores[type];
11697
11744
  // row data
11698
- const source = store.get('source');
11745
+ const source = storeService.store.get('source');
11699
11746
  // row indexes
11700
- const proxyItems = store.get('proxyItems');
11701
- const data = this.sortIndexByItems([...proxyItems], source, sortingFunc);
11702
- setStore(store, {
11703
- proxyItems: data,
11747
+ const proxyItems = storeService.store.get('proxyItems');
11748
+ const newItemsOrder = this.sortIndexByItems([...proxyItems], source, sortingFunc);
11749
+ this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
11750
+ storeService.setData({
11751
+ proxyItems: newItemsOrder,
11704
11752
  source: [...source],
11705
11753
  });
11706
11754
  }
@@ -13999,6 +14047,10 @@ class RevoGridComponent {
13999
14047
  var _a;
14000
14048
  (_a = this.orderService) === null || _a === void 0 ? void 0 : _a.end();
14001
14049
  }
14050
+ onRowOrderChange(e) {
14051
+ var _a;
14052
+ (_a = this.dataProvider) === null || _a === void 0 ? void 0 : _a.changeOrder(e.detail);
14053
+ }
14002
14054
  onRowDrag({ detail }) {
14003
14055
  var _a;
14004
14056
  (_a = this.orderService) === null || _a === void 0 ? void 0 : _a.move(detail);
@@ -14558,7 +14610,7 @@ class RevoGridComponent {
14558
14610
  "getContentSize": [64],
14559
14611
  "getSelectedRange": [64]
14560
14612
  },
14561
- "$listeners$": [[5, "touchstart", "mousedownHandle"], [5, "mousedown", "mousedownHandle"], [5, "touchend", "mouseupHandle"], [5, "mouseup", "mouseupHandle"], [0, "rowdragstartinit", "onRowDragStarted"], [0, "rowdragendinit", "onRowDragEnd"], [0, "rowdragmoveinit", "onRowDrag"], [0, "rowdragmousemove", "onRowMouseMove"], [0, "celleditapply", "onCellEdit"], [0, "rangeeditapply", "onRangeEdit"], [0, "selectionchangeinit", "onRangeChanged"], [0, "rowdropinit", "onRowDropped"], [0, "beforeheaderclick", "onHeaderClick"], [0, "beforecellfocusinit", "onCellFocus"]],
14613
+ "$listeners$": [[5, "touchstart", "mousedownHandle"], [5, "mousedown", "mousedownHandle"], [5, "touchend", "mouseupHandle"], [5, "mouseup", "mouseupHandle"], [0, "rowdragstartinit", "onRowDragStarted"], [0, "rowdragendinit", "onRowDragEnd"], [0, "roworderchange", "onRowOrderChange"], [0, "rowdragmoveinit", "onRowDrag"], [0, "rowdragmousemove", "onRowMouseMove"], [0, "celleditapply", "onCellEdit"], [0, "rangeeditapply", "onRangeEdit"], [0, "selectionchangeinit", "onRangeChanged"], [0, "rowdropinit", "onRowDropped"], [0, "beforeheaderclick", "onHeaderClick"], [0, "beforecellfocusinit", "onCellFocus"]],
14562
14614
  "$lazyBundleId$": "-",
14563
14615
  "$attrsToReflect$": [["theme", "theme"], ["rowClass", "row-class"]]
14564
14616
  }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolist/revogrid",
3
- "version": "4.9.37",
3
+ "version": "4.9.40",
4
4
  "type": "module",
5
5
  "description": "Virtual reactive data grid spreadsheet component - RevoGrid.",
6
6
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { z as keys, q as isArrayLike, y as baseIteratee, l as isArray, j as createStore, i as setStore, n as isIterateeCall, m as toInteger, a as getVisibleSourceItem, b as getSourceItem } from './data.store.js';
4
+ import { x as keys, o as isArrayLike, w as baseIteratee, k as isArray, j as createStore, i as setStore, m as isIterateeCall, l as toInteger, a as getVisibleSourceItem, b as getSourceItem } from './data.store.js';
5
5
  import '@stencil/core/internal/client';
6
6
  import { G as GRID_INTERNALS, C as CELL_CLASS, b as DISABLED_CLASS } from './consts.js';
7
7
  import './platform.js';
@@ -2,14 +2,28 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { a as isObject, b as baseGetTag, r as root, S as Symbol, i as isObjectLike, f as freeGlobal, c as isSymbol, t as toNumber } from './toNumber.js';
5
+ import { i as identity } from './identity.js';
5
6
  import { getRenderingRef, forceUpdate } from '@stencil/core/internal/client';
6
7
 
7
8
  /**
8
- * All items
9
- * Used as proxy for sorting
10
- * Keep order but do not modify final source
9
+ * Proxy plugin for data source.
10
+ * This plugin is used to sort the data source.
11
+ * It keeps the order of the items but does not modify the final source.
12
+ * It is also used to filter the items in the data source.
13
+ * The `set` method takes a key and a new value as arguments.
14
+ * If the key is 'proxyItems' it will filter the items in the data source according to the new value.
15
+ * The new value should be an array of numbers representing the indexes of the items that should be visible.
16
+ * The method will return a new array of numbers with the indexes of the items that should be visible.
17
+ * The method will also update the 'items' property of the store with the new array.
11
18
  */
12
19
  const proxyPlugin = (store) => ({
20
+ /**
21
+ * Set the value of a property in the store.
22
+ * If the key is 'proxyItems' it will filter the items in the data source according to the new value.
23
+ * The new value should be an array of numbers representing the indexes of the items that should be visible.
24
+ * The method will return a new array of numbers with the indexes of the items that should be visible.
25
+ * The method will also update the 'items' property of the store with the new array.
26
+ */
13
27
  set(k, newVal) {
14
28
  if (!isProxy(k)) {
15
29
  return;
@@ -19,15 +33,15 @@ const proxyPlugin = (store) => ({
19
33
  * Mark indexes as visible
20
34
  */
21
35
  const oldItems = store.get('items').reduce((r, v) => {
22
- r[v] = true;
36
+ r.add(v);
23
37
  return r;
24
- }, {});
38
+ }, new Set());
25
39
  /**
26
40
  * Check if new values where present in items
27
41
  * Filter item collection according presense
28
42
  */
29
43
  const newItems = newVal.reduce((r, i) => {
30
- if (oldItems[i]) {
44
+ if (oldItems.has(i)) {
31
45
  r.push(i);
32
46
  }
33
47
  return r;
@@ -1763,9 +1777,9 @@ var Promise$1 = getNative(root, 'Promise');
1763
1777
  const Promise$2 = Promise$1;
1764
1778
 
1765
1779
  /* Built-in method references that are verified to be native. */
1766
- var Set = getNative(root, 'Set');
1780
+ var Set$1 = getNative(root, 'Set');
1767
1781
 
1768
- const Set$1 = Set;
1782
+ const Set$2 = Set$1;
1769
1783
 
1770
1784
  /* Built-in method references that are verified to be native. */
1771
1785
  var WeakMap = getNative(root, 'WeakMap');
@@ -1785,7 +1799,7 @@ var dataViewTag = '[object DataView]';
1785
1799
  var dataViewCtorString = toSource(DataView$1),
1786
1800
  mapCtorString = toSource(Map$2),
1787
1801
  promiseCtorString = toSource(Promise$2),
1788
- setCtorString = toSource(Set$1),
1802
+ setCtorString = toSource(Set$2),
1789
1803
  weakMapCtorString = toSource(WeakMap$1);
1790
1804
 
1791
1805
  /**
@@ -1801,7 +1815,7 @@ var getTag = baseGetTag;
1801
1815
  if ((DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag) ||
1802
1816
  (Map$2 && getTag(new Map$2) != mapTag) ||
1803
1817
  (Promise$2 && getTag(Promise$2.resolve()) != promiseTag) ||
1804
- (Set$1 && getTag(new Set$1) != setTag) ||
1818
+ (Set$2 && getTag(new Set$2) != setTag) ||
1805
1819
  (WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
1806
1820
  getTag = function(value) {
1807
1821
  var result = baseGetTag(value),
@@ -2446,26 +2460,6 @@ function baseMatchesProperty(path, srcValue) {
2446
2460
  };
2447
2461
  }
2448
2462
 
2449
- /**
2450
- * This method returns the first argument it receives.
2451
- *
2452
- * @static
2453
- * @since 0.1.0
2454
- * @memberOf _
2455
- * @category Util
2456
- * @param {*} value Any value.
2457
- * @returns {*} Returns `value`.
2458
- * @example
2459
- *
2460
- * var object = { 'a': 1 };
2461
- *
2462
- * console.log(_.identity(object) === object);
2463
- * // => true
2464
- */
2465
- function identity(value) {
2466
- return value;
2467
- }
2468
-
2469
2463
  /**
2470
2464
  * The base implementation of `_.property` without support for deep paths.
2471
2465
  *
@@ -3068,6 +3062,9 @@ class DataStore {
3068
3062
  trimmed = Object.assign(Object.assign({}, trimmed), some);
3069
3063
  setStore(this.store, { trimmed });
3070
3064
  }
3065
+ setSourceData(items, mutate = true) {
3066
+ setSourceByVirtualIndex(this.store, items, mutate);
3067
+ }
3071
3068
  // local data update
3072
3069
  setData(input) {
3073
3070
  const data = Object.assign({}, input);
@@ -3153,6 +3150,6 @@ function getSourceItemVirtualIndexByProp(store, prop) {
3153
3150
  return items.indexOf(physicalIndex);
3154
3151
  }
3155
3152
 
3156
- export { DataStore as D, getVisibleSourceItem as a, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, setStore as i, createStore as j, identity as k, isArray$1 as l, toInteger as m, isIterateeCall as n, baseProperty as o, proxyPlugin as p, isArrayLike as q, getTag$1 as r, setSourceByVirtualIndex as s, trimmedPlugin as t, baseKeys as u, range$1 as v, findIndex as w, getNative as x, baseIteratee as y, keys as z };
3153
+ export { DataStore as D, getVisibleSourceItem as a, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, setStore as i, createStore as j, isArray$1 as k, toInteger as l, isIterateeCall as m, baseProperty as n, isArrayLike as o, proxyPlugin as p, getTag$1 as q, baseKeys as r, setSourceByVirtualIndex as s, trimmedPlugin as t, findIndex as u, getNative as v, baseIteratee as w, keys as x };
3157
3154
 
3158
3155
  //# sourceMappingURL=data.store.js.map