@revolist/revogrid 4.22.1 → 4.23.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 (125) hide show
  1. package/dist/cjs/{cell-renderer-BQdEGQXP.js → cell-renderer-Dcz022q7.js} +9 -3
  2. package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-DJueWxN_.js} +391 -256
  3. package/dist/cjs/{column.service-DXYMehqK.js → column.service-C1Qvcf5l.js} +10 -1
  4. package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
  5. package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
  6. package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-QrcXXSkF.js} +1 -1
  7. package/dist/cjs/index-DxaSE5uZ.js +136 -0
  8. package/dist/cjs/index.cjs.js +37 -32
  9. package/dist/cjs/revo-grid.cjs.entry.js +124 -18
  10. package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
  11. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
  12. package/dist/cjs/revogr-data_4.cjs.entry.js +74 -32
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
  14. package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
  15. package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
  16. package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
  17. package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
  18. package/dist/collection/components/data/revogr-data.js +5 -3
  19. package/dist/collection/components/header/header-group-renderer.js +1 -1
  20. package/dist/collection/components/header/header-renderer.js +1 -1
  21. package/dist/collection/components/header/revogr-header-style.css +13 -3
  22. package/dist/collection/components/header/revogr-header.js +53 -17
  23. package/dist/collection/components/order/order-row.service.js +6 -5
  24. package/dist/collection/components/overlay/keyboard.service.js +23 -1
  25. package/dist/collection/components/overlay/selection.utils.js +8 -6
  26. package/dist/collection/components/revoGrid/revo-grid.js +69 -5
  27. package/dist/collection/components/revoGrid/viewport.service.js +2 -1
  28. package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
  29. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
  30. package/dist/collection/plugins/filter/filter.panel.js +2 -1
  31. package/dist/collection/plugins/filter/filter.plugin.js +11 -4
  32. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
  33. package/dist/collection/plugins/groupingRow/grouping.service.js +9 -0
  34. package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
  35. package/dist/collection/plugins/sorting/sorting.func.js +173 -15
  36. package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
  37. package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
  38. package/dist/collection/serve/controller.js +98 -37
  39. package/dist/collection/serve/data.js +273 -144
  40. package/dist/collection/services/dimension.provider.js +16 -1
  41. package/dist/collection/services/local.scroll.service.js +59 -24
  42. package/dist/collection/services/scroll.dimension.helpers.js +83 -0
  43. package/dist/collection/services/selection.store.connector.js +30 -4
  44. package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
  45. package/dist/collection/store/dimension/dimension.store.js +4 -2
  46. package/dist/collection/store/vp/viewport.helpers.js +9 -0
  47. package/dist/collection/store/vp/viewport.store.js +5 -16
  48. package/dist/collection/utils/store.utils.js +3 -3
  49. package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-BtN-NGCk.js} +9 -3
  50. package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
  51. package/dist/esm/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
  52. package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
  53. package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
  54. package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  55. package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-BsvUQ8GS.js} +1 -1
  56. package/dist/esm/index-Db3qZoW5.js +127 -0
  57. package/dist/esm/index.js +11 -10
  58. package/dist/esm/revo-grid.entry.js +123 -17
  59. package/dist/esm/revogr-attribution_7.entry.js +42 -24
  60. package/dist/esm/revogr-clipboard_3.entry.js +11 -9
  61. package/dist/esm/revogr-data_4.entry.js +75 -33
  62. package/dist/esm/revogr-filter-panel.entry.js +3 -2
  63. package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  64. package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  65. package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
  66. package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
  67. package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-BtN-NGCk.js} +9 -3
  68. package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
  69. package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
  70. package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
  71. package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
  72. package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
  73. package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-BsvUQ8GS.js} +1 -1
  74. package/dist/revo-grid/index-Db3qZoW5.js +127 -0
  75. package/dist/revo-grid/index.esm.js +11 -10
  76. package/dist/revo-grid/revo-grid.entry.js +123 -17
  77. package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
  78. package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
  79. package/dist/revo-grid/revogr-data_4.entry.js +75 -33
  80. package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
  81. package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
  82. package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
  83. package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
  84. package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
  85. package/dist/types/components/header/header-group-renderer.d.ts +2 -0
  86. package/dist/types/components/header/header-renderer.d.ts +1 -0
  87. package/dist/types/components/header/revogr-header.d.ts +2 -0
  88. package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
  89. package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
  90. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
  91. package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
  92. package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
  93. package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
  94. package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
  95. package/dist/types/services/local.scroll.service.d.ts +10 -2
  96. package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
  97. package/dist/types/services/selection.store.connector.d.ts +6 -0
  98. package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
  99. package/dist/types/types/interfaces.d.ts +11 -0
  100. package/dist/types/types/selection.d.ts +13 -0
  101. package/hydrate/index.js +795 -383
  102. package/hydrate/index.mjs +795 -383
  103. package/package.json +1 -1
  104. package/standalone/column.service.js +1 -1
  105. package/standalone/data.store.js +1 -1
  106. package/standalone/debounce.js +1 -1
  107. package/standalone/dimension.helpers.js +1 -1
  108. package/standalone/index.js +1 -1
  109. package/standalone/local.scroll.timer.js +1 -1
  110. package/standalone/revo-grid.js +1 -1
  111. package/standalone/revogr-data2.js +1 -1
  112. package/standalone/revogr-filter-panel.js +1 -1
  113. package/standalone/revogr-header2.js +1 -1
  114. package/standalone/revogr-order-editor2.js +1 -1
  115. package/standalone/revogr-overlay-selection2.js +1 -1
  116. package/standalone/revogr-row-headers.js +1 -1
  117. package/standalone/revogr-row-headers2.js +1 -1
  118. package/standalone/revogr-scroll-virtual2.js +1 -1
  119. package/standalone/revogr-viewport-scroll2.js +1 -1
  120. package/standalone/selection.utils.js +1 -1
  121. package/standalone/throttle.js +1 -1
  122. package/standalone/toNumber.js +1 -1
  123. package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
  124. package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
  125. package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
@@ -0,0 +1,133 @@
1
+ /*!
2
+ * Built by Revolist OU ❤️
3
+ */
4
+ const FALLBACK_MAX_SCROLL_SIZE = 16000000;
5
+ const SCROLL_SIZE_GUARD = 1000000;
6
+ let detectedMaxScrollSize;
7
+ function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
8
+ if (typeof detectedMaxScrollSize === 'number') {
9
+ return detectedMaxScrollSize;
10
+ }
11
+ const body = doc === null || doc === void 0 ? void 0 : doc.body;
12
+ if (body) {
13
+ const ownerDocument = body.ownerDocument;
14
+ const element = ownerDocument.createElement('div');
15
+ element.style.cssText = [
16
+ 'height:1px',
17
+ 'left:-10000px',
18
+ 'overflow:scroll',
19
+ 'position:absolute',
20
+ 'top:-10000px',
21
+ 'visibility:hidden',
22
+ 'width:1px',
23
+ ].join(';');
24
+ const content = ownerDocument.createElement('div');
25
+ content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
26
+ element.appendChild(content);
27
+ body.appendChild(element);
28
+ detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
29
+ element.remove();
30
+ if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
31
+ return detectedMaxScrollSize;
32
+ }
33
+ detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
34
+ return detectedMaxScrollSize;
35
+ }
36
+ return FALLBACK_MAX_SCROLL_SIZE;
37
+ }
38
+ function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
39
+ const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
40
+ const size = Math.max(0, contentSize);
41
+ const client = Math.max(0, clientSize);
42
+ const viewport = Math.max(0, virtualSize || client);
43
+ const logicalScrollSize = Math.max(0, size - viewport);
44
+ const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
45
+ const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
46
+ const physicalContentSize = client + physicalScrollSize;
47
+ const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
48
+ const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
49
+ const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
50
+ const toLogicalCoordinate = (coordinate) => {
51
+ if (!logicalScrollSize || !physicalScrollSize) {
52
+ return 0;
53
+ }
54
+ if (!isCompressed) {
55
+ return clampLogical(coordinate);
56
+ }
57
+ return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
58
+ };
59
+ const toPhysicalCoordinate = (coordinate) => {
60
+ if (!logicalScrollSize || !physicalScrollSize) {
61
+ return 0;
62
+ }
63
+ if (!isCompressed) {
64
+ return clampPhysical(coordinate);
65
+ }
66
+ return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
67
+ };
68
+ return {
69
+ contentSize: size,
70
+ clientSize: client,
71
+ viewportSize: viewport,
72
+ physicalContentSize,
73
+ logicalScrollSize,
74
+ physicalScrollSize,
75
+ isCompressed,
76
+ toLogicalCoordinate,
77
+ toPhysicalCoordinate,
78
+ getRenderOffset(coordinate) {
79
+ const logical = clampLogical(coordinate);
80
+ return logical - toPhysicalCoordinate(logical);
81
+ },
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Collects data for pinned columns in the required @ViewportProps format.
87
+ */
88
+ /**
89
+ * Represents the slot names for the viewport slots.
90
+ */
91
+ const HEADER_SLOT = 'header'; // Slot name for the header slot
92
+ const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
93
+ const CONTENT_SLOT = 'content'; // Slot name for the content slot
94
+ const DATA_SLOT = 'data'; // Slot name for the data slot
95
+ /**
96
+ * Returns the last visible cell in the viewport for a given row type.
97
+ * Coordinates are not zero-based and are relative to the viewport.
98
+ * If needed to be zero-based they can be adjusted by subtracting 1.
99
+ */
100
+ function getLastCell(data, rowType) {
101
+ // Get the last visible column count from the viewport column data.
102
+ const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
103
+ // Get the last visible row count for the given row type from the viewport column data.
104
+ const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
105
+ // Return the last visible cell with the last visible column count and row count.
106
+ return {
107
+ x: lastVisibleColumnCount,
108
+ y: lastVisibleRowCount,
109
+ };
110
+ }
111
+ function viewportDataPartition(data, type, slot, fixed) {
112
+ return {
113
+ colData: data.colStore,
114
+ viewportCol: data.viewports[data.colType].store,
115
+ viewportRow: data.viewports[type].store,
116
+ /**
117
+ * lastCell is the last real coordinate + 1, saved to selection store
118
+ */
119
+ lastCell: getLastCell(data, type),
120
+ slot,
121
+ type,
122
+ canDrag: !fixed,
123
+ position: data.position,
124
+ dataStore: data.rowStores[type].store,
125
+ dimensionCol: data.dimensions[data.colType].store,
126
+ dimensionRow: data.dimensions[type].store,
127
+ style: fixed
128
+ ? { height: `${data.dimensions[type].store.get('realSize')}px` }
129
+ : undefined,
130
+ };
131
+ }
132
+
133
+ export { CONTENT_SLOT as C, DATA_SLOT as D, FOOTER_SLOT as F, HEADER_SLOT as H, getScrollDimension as g, viewportDataPartition as v };
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- import { j as getItemByPosition, W as createStore, w as setStore } from './dimension.helpers-DmIvjIa7.js';
4
+ import { j as getItemByPosition, K as createStore, l as setStore } from './dimension.helpers-CGKwSvw6.js';
5
5
 
6
6
  const LETTER_BLOCK_SIZE = 10;
7
7
  const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
@@ -9,6 +9,15 @@ const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) =>
9
9
  Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth));
10
10
  };
11
11
 
12
+ function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
13
+ if (!viewportSize || dimension.realSize <= viewportSize) {
14
+ return 0;
15
+ }
16
+ return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
17
+ }
18
+ function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
19
+ return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
20
+ }
12
21
  /**
13
22
  * Update items based on new scroll position
14
23
  * If viewport wasn't changed fully simple recombination of positions
@@ -274,6 +283,8 @@ function initialState() {
274
283
  realCount: 0,
275
284
  // size of viewport in px
276
285
  clientSize: 0,
286
+ // logical-to-physical render offset used when scroll space is compressed
287
+ renderOffset: 0,
277
288
  };
278
289
  }
279
290
  /**
@@ -309,21 +320,8 @@ class ViewportStore {
309
320
  const outsize = singleOffsetInPx * 2;
310
321
  // math virtual size is based on visible area + 2 items outside of visible area
311
322
  const virtualSize = viewportSize + outsize;
312
- // expected no scroll if real size less than virtual size, position is 0
313
- let maxCoordinate = 0;
314
- // if there is nodes outside of viewport, max coordinate has to be adjusted
315
- if (dimension.realSize > viewportSize) {
316
- // max coordinate is real size minus virtual/rendered space
317
- maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
318
- }
319
- let pos = position;
320
- // limit position to max and min coordinates
321
- if (pos < 0) {
322
- pos = 0;
323
- }
324
- else if (pos > maxCoordinate) {
325
- pos = maxCoordinate;
326
- }
323
+ const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
324
+ let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
327
325
  // store last coordinate for further restore on redraw
328
326
  this.lastCoordinate = pos;
329
327
  // actual position is less than first item start based on offset
@@ -401,4 +399,4 @@ class ViewportStore {
401
399
  }
402
400
  }
403
401
 
404
- export { ViewportStore as V, addMissingItems as a, getItems as b, isActiveRangeOutsideLastItem as c, getFirstItem as d, getLastItem as e, calculateRowHeaderSize as f, getUpdatedItemsByPosition as g, isActiveRange as i, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
402
+ export { ViewportStore as V, getUpdatedItemsByPosition as a, addMissingItems as b, clampViewportCoordinate as c, getItems as d, isActiveRangeOutsideLastItem as e, getFirstItem as f, getViewportMaxCoordinate as g, getLastItem as h, isActiveRange as i, calculateRowHeaderSize as j, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
@@ -2,12 +2,18 @@
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
4
  import { h, f as Build } from './index-Chp_81rd.js';
5
- import { y as DATA_ROW, G as DRAG_ICON_CLASS, I as DRAGGABLE_CLASS } from './dimension.helpers-DmIvjIa7.js';
6
- import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-CCvAi5l4.js';
5
+ import { n as DATA_ROW, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-CGKwSvw6.js';
6
+ import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-CC_SD8W3.js';
7
7
 
8
+ /**
9
+ * Renders sorting direction and optional additive sorting rank.
10
+ */
8
11
  const SortingSign = ({ column }) => {
9
12
  var _a;
10
- return h("i", { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' });
13
+ const indicatorAttrs = { class: 'sort-indicator' };
14
+ const iconAttrs = { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' };
15
+ const orderIndexAttrs = { class: 'sort-order-index' };
16
+ return (h("span", Object.assign({}, indicatorAttrs), h("i", Object.assign({}, iconAttrs)), (column === null || column === void 0 ? void 0 : column.sortIndex) ? (h("sup", Object.assign({}, orderIndexAttrs), column.sortIndex)) : null));
11
17
  };
12
18
 
13
19
  const PADDING_DEPTH = 10;