@revolist/revogrid 4.22.1 → 4.23.0
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.
- package/dist/cjs/{cell-renderer-BQdEGQXP.js → cell-renderer-DWJ9Px9f.js} +9 -3
- package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-CaEBDG-Q.js} +391 -256
- package/dist/cjs/{column.service-DXYMehqK.js → column.service-f612L4ql.js} +1 -1
- package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
- package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-4yq9_WbM.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +37 -32
- package/dist/cjs/revo-grid.cjs.entry.js +35 -15
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
- package/dist/cjs/revogr-data_4.cjs.entry.js +26 -17
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +1 -1
- package/dist/collection/components/header/header-renderer.js +1 -1
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +5 -2
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +23 -1
- package/dist/collection/components/overlay/selection.utils.js +8 -6
- package/dist/collection/components/revoGrid/revo-grid.js +6 -5
- package/dist/collection/components/revoGrid/viewport.service.js +2 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
- package/dist/collection/plugins/filter/filter.panel.js +2 -1
- package/dist/collection/plugins/filter/filter.plugin.js +11 -4
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
- package/dist/collection/plugins/sorting/sorting.func.js +173 -15
- package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
- package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
- package/dist/collection/serve/controller.js +98 -37
- package/dist/collection/serve/data.js +273 -144
- package/dist/collection/services/dimension.provider.js +16 -1
- package/dist/collection/services/local.scroll.service.js +59 -24
- package/dist/collection/services/scroll.dimension.helpers.js +83 -0
- package/dist/collection/services/selection.store.connector.js +4 -1
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
- package/dist/collection/store/dimension/dimension.store.js +4 -2
- package/dist/collection/store/vp/viewport.helpers.js +9 -0
- package/dist/collection/store/vp/viewport.store.js +5 -16
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
- package/dist/esm/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
- package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
- package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +11 -10
- package/dist/esm/revo-grid.entry.js +34 -14
- package/dist/esm/revogr-attribution_7.entry.js +42 -24
- package/dist/esm/revogr-clipboard_3.entry.js +11 -9
- package/dist/esm/revogr-data_4.entry.js +27 -18
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-BsfhsfmB.js} +388 -255
- package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-DbpulTog.js} +1 -1
- package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
- package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/revo-grid/index-Db3qZoW5.js +127 -0
- package/dist/revo-grid/index.esm.js +11 -10
- package/dist/revo-grid/revo-grid.entry.js +34 -14
- package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
- package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
- package/dist/revo-grid/revogr-data_4.entry.js +27 -18
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
- package/dist/types/components/header/header-group-renderer.d.ts +1 -0
- package/dist/types/components/header/header-renderer.d.ts +1 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
- package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
- package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
- package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
- package/dist/types/services/local.scroll.service.d.ts +10 -2
- package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
- package/dist/types/types/interfaces.d.ts +11 -0
- package/hydrate/index.js +649 -365
- package/hydrate/index.mjs +649 -365
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
- package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
package/hydrate/index.mjs
CHANGED
|
@@ -7644,7 +7644,8 @@ class FilterPanel {
|
|
|
7644
7644
|
const options = [];
|
|
7645
7645
|
const prop = this.changes.prop;
|
|
7646
7646
|
const hidden = new Set();
|
|
7647
|
-
Object.
|
|
7647
|
+
Object.keys(this.filterItems).forEach((prop) => {
|
|
7648
|
+
const values = this.filterItems[prop];
|
|
7648
7649
|
values.forEach((filter) => {
|
|
7649
7650
|
if (filter.hidden) {
|
|
7650
7651
|
hidden.add(filter.type);
|
|
@@ -8727,11 +8728,11 @@ var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
|
8727
8728
|
var boolTag$1 = '[object Boolean]',
|
|
8728
8729
|
dateTag$1 = '[object Date]',
|
|
8729
8730
|
errorTag$1 = '[object Error]',
|
|
8730
|
-
mapTag$
|
|
8731
|
+
mapTag$2 = '[object Map]',
|
|
8731
8732
|
numberTag$1 = '[object Number]',
|
|
8732
8733
|
regexpTag$1 = '[object RegExp]',
|
|
8733
|
-
setTag$
|
|
8734
|
-
stringTag$
|
|
8734
|
+
setTag$2 = '[object Set]',
|
|
8735
|
+
stringTag$1 = '[object String]',
|
|
8735
8736
|
symbolTag = '[object Symbol]';
|
|
8736
8737
|
|
|
8737
8738
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
@@ -8786,16 +8787,16 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
8786
8787
|
return object.name == other.name && object.message == other.message;
|
|
8787
8788
|
|
|
8788
8789
|
case regexpTag$1:
|
|
8789
|
-
case stringTag$
|
|
8790
|
+
case stringTag$1:
|
|
8790
8791
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
8791
8792
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
8792
8793
|
// for more details.
|
|
8793
8794
|
return object == (other + '');
|
|
8794
8795
|
|
|
8795
|
-
case mapTag$
|
|
8796
|
+
case mapTag$2:
|
|
8796
8797
|
var convert = mapToArray;
|
|
8797
8798
|
|
|
8798
|
-
case setTag$
|
|
8799
|
+
case setTag$2:
|
|
8799
8800
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
8800
8801
|
convert || (convert = setToArray);
|
|
8801
8802
|
|
|
@@ -9136,12 +9137,12 @@ var argsTag$1 = '[object Arguments]',
|
|
|
9136
9137
|
dateTag = '[object Date]',
|
|
9137
9138
|
errorTag = '[object Error]',
|
|
9138
9139
|
funcTag = '[object Function]',
|
|
9139
|
-
mapTag$
|
|
9140
|
+
mapTag$1 = '[object Map]',
|
|
9140
9141
|
numberTag = '[object Number]',
|
|
9141
9142
|
objectTag$2 = '[object Object]',
|
|
9142
9143
|
regexpTag = '[object RegExp]',
|
|
9143
|
-
setTag$
|
|
9144
|
-
stringTag
|
|
9144
|
+
setTag$1 = '[object Set]',
|
|
9145
|
+
stringTag = '[object String]',
|
|
9145
9146
|
weakMapTag$1 = '[object WeakMap]';
|
|
9146
9147
|
|
|
9147
9148
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
@@ -9167,9 +9168,9 @@ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
|
9167
9168
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
9168
9169
|
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
|
|
9169
9170
|
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
9170
|
-
typedArrayTags[mapTag$
|
|
9171
|
+
typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
|
|
9171
9172
|
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
|
|
9172
|
-
typedArrayTags[setTag$
|
|
9173
|
+
typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
|
|
9173
9174
|
typedArrayTags[weakMapTag$1] = false;
|
|
9174
9175
|
|
|
9175
9176
|
/**
|
|
@@ -9519,10 +9520,10 @@ var Set$1 = getNative(root, 'Set');
|
|
|
9519
9520
|
var WeakMap$1 = getNative(root, 'WeakMap');
|
|
9520
9521
|
|
|
9521
9522
|
/** `Object#toString` result references. */
|
|
9522
|
-
var mapTag
|
|
9523
|
+
var mapTag = '[object Map]',
|
|
9523
9524
|
objectTag$1 = '[object Object]',
|
|
9524
9525
|
promiseTag = '[object Promise]',
|
|
9525
|
-
setTag
|
|
9526
|
+
setTag = '[object Set]',
|
|
9526
9527
|
weakMapTag = '[object WeakMap]';
|
|
9527
9528
|
|
|
9528
9529
|
var dataViewTag = '[object DataView]';
|
|
@@ -9545,9 +9546,9 @@ var getTag = baseGetTag;
|
|
|
9545
9546
|
|
|
9546
9547
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
9547
9548
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
9548
|
-
(Map$1 && getTag(new Map$1) != mapTag
|
|
9549
|
+
(Map$1 && getTag(new Map$1) != mapTag) ||
|
|
9549
9550
|
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
9550
|
-
(Set$1 && getTag(new Set$1) != setTag
|
|
9551
|
+
(Set$1 && getTag(new Set$1) != setTag) ||
|
|
9551
9552
|
(WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
|
|
9552
9553
|
getTag = function(value) {
|
|
9553
9554
|
var result = baseGetTag(value),
|
|
@@ -9557,9 +9558,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
9557
9558
|
if (ctorString) {
|
|
9558
9559
|
switch (ctorString) {
|
|
9559
9560
|
case dataViewCtorString: return dataViewTag;
|
|
9560
|
-
case mapCtorString: return mapTag
|
|
9561
|
+
case mapCtorString: return mapTag;
|
|
9561
9562
|
case promiseCtorString: return promiseTag;
|
|
9562
|
-
case setCtorString: return setTag
|
|
9563
|
+
case setCtorString: return setTag;
|
|
9563
9564
|
case weakMapCtorString: return weakMapTag;
|
|
9564
9565
|
}
|
|
9565
9566
|
}
|
|
@@ -10823,9 +10824,9 @@ function gatherTrimmedItems(trimmedItems) {
|
|
|
10823
10824
|
* @param data - The data to set on the store.
|
|
10824
10825
|
*/
|
|
10825
10826
|
function setStore(store, data) {
|
|
10826
|
-
Object.
|
|
10827
|
-
store.set(key,
|
|
10828
|
-
}
|
|
10827
|
+
for (const key of Object.keys(data)) {
|
|
10828
|
+
store.set(key, data[key]);
|
|
10829
|
+
}
|
|
10829
10830
|
}
|
|
10830
10831
|
|
|
10831
10832
|
/**
|
|
@@ -11336,21 +11337,6 @@ function getScrollbarSize(document) {
|
|
|
11336
11337
|
// Return the calculated width of the scrollbar
|
|
11337
11338
|
return scrollbarWidth;
|
|
11338
11339
|
}
|
|
11339
|
-
/* Scale a value between 2 ranges
|
|
11340
|
-
*
|
|
11341
|
-
* Sample:
|
|
11342
|
-
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
11343
|
-
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
11344
|
-
*
|
|
11345
|
-
* Ranges of two values
|
|
11346
|
-
* @from
|
|
11347
|
-
* @to
|
|
11348
|
-
*
|
|
11349
|
-
* ~~ return value does the equivalent of Math.floor but faster.
|
|
11350
|
-
*/
|
|
11351
|
-
function scaleValue(value, from, to) {
|
|
11352
|
-
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
11353
|
-
}
|
|
11354
11340
|
/**
|
|
11355
11341
|
* Async timeout
|
|
11356
11342
|
*/
|
|
@@ -11724,6 +11710,21 @@ function getItemByIndex(dimension, index) {
|
|
|
11724
11710
|
return item;
|
|
11725
11711
|
}
|
|
11726
11712
|
|
|
11713
|
+
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
11714
|
+
const safeCount = Math.max(0, count);
|
|
11715
|
+
let realSize = safeCount * originItemSize;
|
|
11716
|
+
for (let index in sizes) {
|
|
11717
|
+
const itemIndex = Number(index);
|
|
11718
|
+
if (!Number.isInteger(itemIndex) ||
|
|
11719
|
+
itemIndex < 0 ||
|
|
11720
|
+
itemIndex >= safeCount ||
|
|
11721
|
+
String(itemIndex) !== index) {
|
|
11722
|
+
continue;
|
|
11723
|
+
}
|
|
11724
|
+
realSize += sizes[index] - originItemSize;
|
|
11725
|
+
}
|
|
11726
|
+
return realSize;
|
|
11727
|
+
}
|
|
11727
11728
|
/**
|
|
11728
11729
|
* Plugin which recalculates realSize on changes of sizes, originItemSize and count
|
|
11729
11730
|
*/
|
|
@@ -11736,20 +11737,18 @@ const recalculateRealSizePlugin = (storeService) => {
|
|
|
11736
11737
|
* Reacts on changes of count, sizes and originItemSize
|
|
11737
11738
|
*/
|
|
11738
11739
|
set(k) {
|
|
11739
|
-
var _a;
|
|
11740
11740
|
switch (k) {
|
|
11741
11741
|
case 'count':
|
|
11742
11742
|
case 'sizes':
|
|
11743
11743
|
case 'originItemSize': {
|
|
11744
11744
|
// recalculate realSize
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
}
|
|
11752
|
-
storeService.setStore({ realSize });
|
|
11745
|
+
storeService.setStore({
|
|
11746
|
+
realSize: calculateRealSize({
|
|
11747
|
+
count: storeService.store.get('count'),
|
|
11748
|
+
sizes: storeService.store.get('sizes'),
|
|
11749
|
+
originItemSize: storeService.store.get('originItemSize'),
|
|
11750
|
+
}),
|
|
11751
|
+
});
|
|
11753
11752
|
break;
|
|
11754
11753
|
}
|
|
11755
11754
|
}
|
|
@@ -11839,7 +11838,9 @@ function initialState$1() {
|
|
|
11839
11838
|
// size which all items can take
|
|
11840
11839
|
realSize: 0,
|
|
11841
11840
|
// initial item size if it wasn't changed
|
|
11842
|
-
originItemSize: 0
|
|
11841
|
+
originItemSize: 0,
|
|
11842
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
11843
|
+
renderOffset: 0
|
|
11843
11844
|
});
|
|
11844
11845
|
}
|
|
11845
11846
|
class DimensionStore {
|
|
@@ -11871,7 +11872,7 @@ class DimensionStore {
|
|
|
11871
11872
|
setStore(this.store, data);
|
|
11872
11873
|
}
|
|
11873
11874
|
drop() {
|
|
11874
|
-
setStore(this.store, initialBase());
|
|
11875
|
+
setStore(this.store, Object.assign(Object.assign({}, initialBase()), { renderOffset: 0 }));
|
|
11875
11876
|
}
|
|
11876
11877
|
/**
|
|
11877
11878
|
* Set custom dimension sizes and overwrite old
|
|
@@ -12042,6 +12043,15 @@ function isRangeSingleCell(a) {
|
|
|
12042
12043
|
return a.x === a.x1 && a.y === a.y1;
|
|
12043
12044
|
}
|
|
12044
12045
|
|
|
12046
|
+
function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
12047
|
+
if (!viewportSize || dimension.realSize <= viewportSize) {
|
|
12048
|
+
return 0;
|
|
12049
|
+
}
|
|
12050
|
+
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
12051
|
+
}
|
|
12052
|
+
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
12053
|
+
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
12054
|
+
}
|
|
12045
12055
|
/**
|
|
12046
12056
|
* Update items based on new scroll position
|
|
12047
12057
|
* If viewport wasn't changed fully simple recombination of positions
|
|
@@ -12307,6 +12317,8 @@ function initialState() {
|
|
|
12307
12317
|
realCount: 0,
|
|
12308
12318
|
// size of viewport in px
|
|
12309
12319
|
clientSize: 0,
|
|
12320
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
12321
|
+
renderOffset: 0,
|
|
12310
12322
|
};
|
|
12311
12323
|
}
|
|
12312
12324
|
/**
|
|
@@ -12342,21 +12354,8 @@ class ViewportStore {
|
|
|
12342
12354
|
const outsize = singleOffsetInPx * 2;
|
|
12343
12355
|
// math virtual size is based on visible area + 2 items outside of visible area
|
|
12344
12356
|
const virtualSize = viewportSize + outsize;
|
|
12345
|
-
|
|
12346
|
-
let
|
|
12347
|
-
// if there is nodes outside of viewport, max coordinate has to be adjusted
|
|
12348
|
-
if (dimension.realSize > viewportSize) {
|
|
12349
|
-
// max coordinate is real size minus virtual/rendered space
|
|
12350
|
-
maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
|
|
12351
|
-
}
|
|
12352
|
-
let pos = position;
|
|
12353
|
-
// limit position to max and min coordinates
|
|
12354
|
-
if (pos < 0) {
|
|
12355
|
-
pos = 0;
|
|
12356
|
-
}
|
|
12357
|
-
else if (pos > maxCoordinate) {
|
|
12358
|
-
pos = maxCoordinate;
|
|
12359
|
-
}
|
|
12357
|
+
const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
|
|
12358
|
+
let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
|
|
12360
12359
|
// store last coordinate for further restore on redraw
|
|
12361
12360
|
this.lastCoordinate = pos;
|
|
12362
12361
|
// actual position is less than first item start based on offset
|
|
@@ -12493,11 +12492,12 @@ class RowOrderService {
|
|
|
12493
12492
|
getRow(y, { el, rows }) {
|
|
12494
12493
|
const { top } = el.getBoundingClientRect();
|
|
12495
12494
|
const topRelative = y - top;
|
|
12496
|
-
const
|
|
12495
|
+
const rowOffset = rows.renderOffset || 0;
|
|
12496
|
+
const rgRow = getItemByPosition(rows, topRelative + rowOffset);
|
|
12497
12497
|
const absolutePosition = {
|
|
12498
12498
|
itemIndex: rgRow.itemIndex,
|
|
12499
|
-
start: rgRow.start + top,
|
|
12500
|
-
end: rgRow.end + top,
|
|
12499
|
+
start: rgRow.start - rowOffset + top,
|
|
12500
|
+
end: rgRow.end - rowOffset + top,
|
|
12501
12501
|
};
|
|
12502
12502
|
return absolutePosition;
|
|
12503
12503
|
}
|
|
@@ -12506,8 +12506,8 @@ class RowOrderService {
|
|
|
12506
12506
|
const { top, left } = el.getBoundingClientRect();
|
|
12507
12507
|
const topRelative = y - top;
|
|
12508
12508
|
const leftRelative = x - left;
|
|
12509
|
-
const rgRow = getItemByPosition(rows, topRelative);
|
|
12510
|
-
const rgCol = getItemByPosition(cols, leftRelative);
|
|
12509
|
+
const rgRow = getItemByPosition(rows, topRelative + (rows.renderOffset || 0));
|
|
12510
|
+
const rgCol = getItemByPosition(cols, leftRelative + (cols.renderOffset || 0));
|
|
12511
12511
|
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
12512
12512
|
}
|
|
12513
12513
|
}
|
|
@@ -13243,8 +13243,8 @@ function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
|
13243
13243
|
cellX = width - 1;
|
|
13244
13244
|
}
|
|
13245
13245
|
// Get the row and column items based on the cell position
|
|
13246
|
-
const rgRow = getItemByPosition(rows, cellY);
|
|
13247
|
-
const rgCol = getItemByPosition(cols, cellX);
|
|
13246
|
+
const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
|
|
13247
|
+
const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
|
|
13248
13248
|
// Set the row and column index to 0 if they are before the first item
|
|
13249
13249
|
if (rgCol.itemIndex < 0) {
|
|
13250
13250
|
rgCol.itemIndex = 0;
|
|
@@ -13314,10 +13314,12 @@ function styleByCellProps(styles) {
|
|
|
13314
13314
|
};
|
|
13315
13315
|
}
|
|
13316
13316
|
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
13317
|
-
const
|
|
13318
|
-
const
|
|
13319
|
-
const
|
|
13320
|
-
const
|
|
13317
|
+
const rowOffset = dimensionRow.renderOffset || 0;
|
|
13318
|
+
const colOffset = dimensionCol.renderOffset || 0;
|
|
13319
|
+
const top = getItemByIndex(dimensionRow, y).start - rowOffset;
|
|
13320
|
+
const left = getItemByIndex(dimensionCol, x).start - colOffset;
|
|
13321
|
+
const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
|
|
13322
|
+
const right = getItemByIndex(dimensionCol, x1).end - colOffset;
|
|
13321
13323
|
return {
|
|
13322
13324
|
left,
|
|
13323
13325
|
right,
|
|
@@ -13348,9 +13350,29 @@ class KeyboardService {
|
|
|
13348
13350
|
constructor(sv) {
|
|
13349
13351
|
this.sv = sv;
|
|
13350
13352
|
}
|
|
13353
|
+
/**
|
|
13354
|
+
* Appends printable key input that arrives after edit mode was requested
|
|
13355
|
+
* but before the editor input has mounted or received focus.
|
|
13356
|
+
*/
|
|
13357
|
+
appendPendingEditValue(e) {
|
|
13358
|
+
if (isShortcutModifier(e) ||
|
|
13359
|
+
e.key.length !== 1 ||
|
|
13360
|
+
(e.target instanceof HTMLElement && isEditInput(e.target))) {
|
|
13361
|
+
return false;
|
|
13362
|
+
}
|
|
13363
|
+
const editCell = this.sv.selectionStore.get('edit');
|
|
13364
|
+
if (typeof (editCell === null || editCell === void 0 ? void 0 : editCell.val) !== 'string') {
|
|
13365
|
+
return false;
|
|
13366
|
+
}
|
|
13367
|
+
this.sv.selectionStore.set('edit', Object.assign(Object.assign({}, editCell), { val: `${editCell.val}${e.key}` }));
|
|
13368
|
+
return true;
|
|
13369
|
+
}
|
|
13351
13370
|
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
13352
13371
|
// IF EDIT MODE
|
|
13353
13372
|
if (isEditMode) {
|
|
13373
|
+
if (this.appendPendingEditValue(e)) {
|
|
13374
|
+
return;
|
|
13375
|
+
}
|
|
13354
13376
|
switch (e.code) {
|
|
13355
13377
|
case codesLetter.ESCAPE:
|
|
13356
13378
|
this.sv.cancel();
|
|
@@ -13444,7 +13466,8 @@ class KeyboardService {
|
|
|
13444
13466
|
}
|
|
13445
13467
|
const eData = this.sv.getData();
|
|
13446
13468
|
if (isMulti) {
|
|
13447
|
-
|
|
13469
|
+
const isOutOfBounds = [data.start, data.end].some(cell => isAfterLast(cell, eData.lastCell) || isBeforeFirst(cell));
|
|
13470
|
+
if (isOutOfBounds) {
|
|
13448
13471
|
return false;
|
|
13449
13472
|
}
|
|
13450
13473
|
const range = getRange(data.start, data.end);
|
|
@@ -14686,6 +14709,87 @@ class DataProvider {
|
|
|
14686
14709
|
}
|
|
14687
14710
|
}
|
|
14688
14711
|
|
|
14712
|
+
const FALLBACK_MAX_SCROLL_SIZE = 16000000;
|
|
14713
|
+
const SCROLL_SIZE_GUARD = 1000000;
|
|
14714
|
+
let detectedMaxScrollSize;
|
|
14715
|
+
function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
|
|
14716
|
+
if (typeof detectedMaxScrollSize === 'number') {
|
|
14717
|
+
return detectedMaxScrollSize;
|
|
14718
|
+
}
|
|
14719
|
+
const body = doc === null || doc === void 0 ? void 0 : doc.body;
|
|
14720
|
+
if (body) {
|
|
14721
|
+
const ownerDocument = body.ownerDocument;
|
|
14722
|
+
const element = ownerDocument.createElement('div');
|
|
14723
|
+
element.style.cssText = [
|
|
14724
|
+
'height:1px',
|
|
14725
|
+
'left:-10000px',
|
|
14726
|
+
'overflow:scroll',
|
|
14727
|
+
'position:absolute',
|
|
14728
|
+
'top:-10000px',
|
|
14729
|
+
'visibility:hidden',
|
|
14730
|
+
'width:1px',
|
|
14731
|
+
].join(';');
|
|
14732
|
+
const content = ownerDocument.createElement('div');
|
|
14733
|
+
content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
|
|
14734
|
+
element.appendChild(content);
|
|
14735
|
+
body.appendChild(element);
|
|
14736
|
+
detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
|
|
14737
|
+
element.remove();
|
|
14738
|
+
if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
|
|
14739
|
+
return detectedMaxScrollSize;
|
|
14740
|
+
}
|
|
14741
|
+
detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
|
|
14742
|
+
return detectedMaxScrollSize;
|
|
14743
|
+
}
|
|
14744
|
+
return FALLBACK_MAX_SCROLL_SIZE;
|
|
14745
|
+
}
|
|
14746
|
+
function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
|
|
14747
|
+
const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
|
|
14748
|
+
const size = Math.max(0, contentSize);
|
|
14749
|
+
const client = Math.max(0, clientSize);
|
|
14750
|
+
const viewport = Math.max(0, virtualSize || client);
|
|
14751
|
+
const logicalScrollSize = Math.max(0, size - viewport);
|
|
14752
|
+
const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
|
|
14753
|
+
const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
|
|
14754
|
+
const physicalContentSize = client + physicalScrollSize;
|
|
14755
|
+
const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
|
|
14756
|
+
const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
|
|
14757
|
+
const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
|
|
14758
|
+
const toLogicalCoordinate = (coordinate) => {
|
|
14759
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
14760
|
+
return 0;
|
|
14761
|
+
}
|
|
14762
|
+
if (!isCompressed) {
|
|
14763
|
+
return clampLogical(coordinate);
|
|
14764
|
+
}
|
|
14765
|
+
return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
|
|
14766
|
+
};
|
|
14767
|
+
const toPhysicalCoordinate = (coordinate) => {
|
|
14768
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
14769
|
+
return 0;
|
|
14770
|
+
}
|
|
14771
|
+
if (!isCompressed) {
|
|
14772
|
+
return clampPhysical(coordinate);
|
|
14773
|
+
}
|
|
14774
|
+
return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
|
|
14775
|
+
};
|
|
14776
|
+
return {
|
|
14777
|
+
contentSize: size,
|
|
14778
|
+
clientSize: client,
|
|
14779
|
+
viewportSize: viewport,
|
|
14780
|
+
physicalContentSize,
|
|
14781
|
+
logicalScrollSize,
|
|
14782
|
+
physicalScrollSize,
|
|
14783
|
+
isCompressed,
|
|
14784
|
+
toLogicalCoordinate,
|
|
14785
|
+
toPhysicalCoordinate,
|
|
14786
|
+
getRenderOffset(coordinate) {
|
|
14787
|
+
const logical = clampLogical(coordinate);
|
|
14788
|
+
return logical - toPhysicalCoordinate(logical);
|
|
14789
|
+
},
|
|
14790
|
+
};
|
|
14791
|
+
}
|
|
14792
|
+
|
|
14689
14793
|
/**
|
|
14690
14794
|
* Dimension provider
|
|
14691
14795
|
* Stores dimension information and custom sizes
|
|
@@ -14823,6 +14927,20 @@ class DimensionProvider {
|
|
|
14823
14927
|
}
|
|
14824
14928
|
setViewPortCoordinate({ type, coordinate = this.viewports.stores[type].lastCoordinate, force = false, }) {
|
|
14825
14929
|
const dimension = this.stores[type].getCurrentState();
|
|
14930
|
+
const viewport = this.viewports.stores[type].store;
|
|
14931
|
+
const clientSize = viewport.get('clientSize');
|
|
14932
|
+
const viewportSize = viewport.get('virtualSize');
|
|
14933
|
+
const scrollDimension = getScrollDimension({
|
|
14934
|
+
contentSize: dimension.realSize,
|
|
14935
|
+
clientSize,
|
|
14936
|
+
virtualSize: viewportSize,
|
|
14937
|
+
});
|
|
14938
|
+
const renderCoordinate = clampViewportCoordinate(coordinate, dimension, viewportSize);
|
|
14939
|
+
const renderOffset = clientSize && viewportSize
|
|
14940
|
+
? scrollDimension.getRenderOffset(renderCoordinate)
|
|
14941
|
+
: 0;
|
|
14942
|
+
this.stores[type].setStore({ renderOffset });
|
|
14943
|
+
this.viewports.stores[type].setViewport({ renderOffset });
|
|
14826
14944
|
this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
|
|
14827
14945
|
}
|
|
14828
14946
|
getViewPortPos(e) {
|
|
@@ -15519,17 +15637,24 @@ class FilterPlugin extends BasePlugin {
|
|
|
15519
15637
|
}
|
|
15520
15638
|
}
|
|
15521
15639
|
if (config.collection) {
|
|
15522
|
-
const
|
|
15523
|
-
|
|
15640
|
+
const filterCollection = {};
|
|
15641
|
+
for (const prop of Object.keys(config.collection)) {
|
|
15642
|
+
const item = config.collection[prop];
|
|
15643
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
15644
|
+
filterCollection[prop] = item;
|
|
15645
|
+
}
|
|
15646
|
+
}
|
|
15647
|
+
this.filterCollection = filterCollection;
|
|
15524
15648
|
}
|
|
15525
15649
|
else {
|
|
15526
15650
|
this.filterCollection = {};
|
|
15527
15651
|
}
|
|
15528
15652
|
if (config.localization) {
|
|
15529
15653
|
if (config.localization.filterNames) {
|
|
15530
|
-
|
|
15654
|
+
const filterNames = config.localization.filterNames;
|
|
15655
|
+
Object.keys(filterNames).forEach((k) => {
|
|
15531
15656
|
if (this.filterNameIndexByType[k] != void 0) {
|
|
15532
|
-
this.filterNameIndexByType[k] =
|
|
15657
|
+
this.filterNameIndexByType[k] = filterNames[k];
|
|
15533
15658
|
}
|
|
15534
15659
|
});
|
|
15535
15660
|
}
|
|
@@ -15759,165 +15884,174 @@ function allAndConditionsSatisfied(pendingResults) {
|
|
|
15759
15884
|
return !pendingResults.includes(true);
|
|
15760
15885
|
}
|
|
15761
15886
|
|
|
15762
|
-
/** `Object#toString` result references. */
|
|
15763
|
-
var stringTag = '[object String]';
|
|
15764
|
-
|
|
15765
15887
|
/**
|
|
15766
|
-
* Checks
|
|
15888
|
+
* Checks whether a sorting map contains at least one active order.
|
|
15767
15889
|
*
|
|
15768
|
-
*
|
|
15769
|
-
* @since 0.1.0
|
|
15770
|
-
* @memberOf _
|
|
15771
|
-
* @category Lang
|
|
15772
|
-
* @param {*} value The value to check.
|
|
15773
|
-
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
15774
|
-
* @example
|
|
15775
|
-
*
|
|
15776
|
-
* _.isString('abc');
|
|
15777
|
-
* // => true
|
|
15778
|
-
*
|
|
15779
|
-
* _.isString(1);
|
|
15780
|
-
* // => false
|
|
15890
|
+
* Empty maps and properties with `undefined` order are treated as inactive.
|
|
15781
15891
|
*/
|
|
15782
|
-
function
|
|
15783
|
-
|
|
15784
|
-
|
|
15892
|
+
function hasActiveSorting(sorting) {
|
|
15893
|
+
for (const prop of Object.keys(sorting || {})) {
|
|
15894
|
+
if (sorting === null || sorting === void 0 ? void 0 : sorting[prop]) {
|
|
15895
|
+
return true;
|
|
15896
|
+
}
|
|
15897
|
+
}
|
|
15898
|
+
return false;
|
|
15785
15899
|
}
|
|
15786
|
-
|
|
15787
15900
|
/**
|
|
15788
|
-
*
|
|
15789
|
-
*
|
|
15790
|
-
* @private
|
|
15791
|
-
* @param {string} string The string inspect.
|
|
15792
|
-
* @returns {number} Returns the string size.
|
|
15901
|
+
* Compares column properties after object-key coercion.
|
|
15793
15902
|
*/
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
15798
|
-
rsComboMarksRange$1 = '\\u0300-\\u036f',
|
|
15799
|
-
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
|
|
15800
|
-
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
|
|
15801
|
-
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
|
|
15802
|
-
rsVarRange$1 = '\\ufe0e\\ufe0f';
|
|
15803
|
-
|
|
15804
|
-
/** Used to compose unicode capture groups. */
|
|
15805
|
-
var rsZWJ$1 = '\\u200d';
|
|
15806
|
-
|
|
15807
|
-
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
15808
|
-
var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
|
|
15809
|
-
|
|
15903
|
+
function isSameColumnProp(a, b) {
|
|
15904
|
+
return String(a) === String(b);
|
|
15905
|
+
}
|
|
15810
15906
|
/**
|
|
15811
|
-
*
|
|
15812
|
-
*
|
|
15813
|
-
* @private
|
|
15814
|
-
* @param {string} string The string to inspect.
|
|
15815
|
-
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
15907
|
+
* Returns active sorting properties in explicit priority order.
|
|
15816
15908
|
*/
|
|
15817
|
-
function
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
/** Used to compose unicode capture groups. */
|
|
15830
|
-
var rsAstral = '[' + rsAstralRange + ']',
|
|
15831
|
-
rsCombo = '[' + rsComboRange + ']',
|
|
15832
|
-
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
15833
|
-
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
15834
|
-
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
15835
|
-
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
15836
|
-
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
15837
|
-
rsZWJ = '\\u200d';
|
|
15838
|
-
|
|
15839
|
-
/** Used to compose unicode regexes. */
|
|
15840
|
-
var reOptMod = rsModifier + '?',
|
|
15841
|
-
rsOptVar = '[' + rsVarRange + ']?',
|
|
15842
|
-
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
15843
|
-
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
15844
|
-
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
15845
|
-
|
|
15846
|
-
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
15847
|
-
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
15848
|
-
|
|
15909
|
+
function getActiveSortingProps(sorting, sortingOrder) {
|
|
15910
|
+
const activeProps = [];
|
|
15911
|
+
const add = (prop) => {
|
|
15912
|
+
if ((sorting === null || sorting === void 0 ? void 0 : sorting[prop]) && !activeProps.some(active => isSameColumnProp(active, prop))) {
|
|
15913
|
+
activeProps.push(prop);
|
|
15914
|
+
}
|
|
15915
|
+
};
|
|
15916
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
15917
|
+
Object.keys(sorting || {}).forEach(add);
|
|
15918
|
+
return activeProps;
|
|
15919
|
+
}
|
|
15849
15920
|
/**
|
|
15850
|
-
*
|
|
15921
|
+
* Returns one-based additive sorting rank for a column.
|
|
15851
15922
|
*
|
|
15852
|
-
*
|
|
15853
|
-
* @param {string} string The string inspect.
|
|
15854
|
-
* @returns {number} Returns the string size.
|
|
15923
|
+
* A single active sort does not need a visible rank, so it returns undefined.
|
|
15855
15924
|
*/
|
|
15856
|
-
function
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15925
|
+
function getSortingIndex(sorting, prop, sortingOrder) {
|
|
15926
|
+
const activeProps = getActiveSortingProps(sorting, sortingOrder);
|
|
15927
|
+
if (activeProps.length <= 1) {
|
|
15928
|
+
return undefined;
|
|
15929
|
+
}
|
|
15930
|
+
const index = activeProps.findIndex(active => isSameColumnProp(active, prop));
|
|
15931
|
+
return index >= 0 ? index + 1 : undefined;
|
|
15862
15932
|
}
|
|
15863
|
-
|
|
15864
15933
|
/**
|
|
15865
|
-
*
|
|
15934
|
+
* Collects only active comparator functions from a sorting function map.
|
|
15866
15935
|
*
|
|
15867
|
-
*
|
|
15868
|
-
* @param {string} string The string to inspect.
|
|
15869
|
-
* @returns {number} Returns the string size.
|
|
15936
|
+
* This keeps undefined comparator entries from triggering sorting work.
|
|
15870
15937
|
*/
|
|
15871
|
-
function
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15938
|
+
function activeSortingEntries(sortingFunc = {}, sortingOrder) {
|
|
15939
|
+
const entries = [];
|
|
15940
|
+
const add = (prop) => {
|
|
15941
|
+
const cmp = sortingFunc[prop];
|
|
15942
|
+
if (typeof cmp === 'function' && !entries.some(([active]) => isSameColumnProp(active, prop))) {
|
|
15943
|
+
entries.push([prop, cmp]);
|
|
15944
|
+
}
|
|
15945
|
+
};
|
|
15946
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
15947
|
+
Object.keys(sortingFunc).forEach(add);
|
|
15948
|
+
return entries;
|
|
15875
15949
|
}
|
|
15876
|
-
|
|
15877
|
-
/** `Object#toString` result references. */
|
|
15878
|
-
var mapTag = '[object Map]',
|
|
15879
|
-
setTag = '[object Set]';
|
|
15880
|
-
|
|
15881
15950
|
/**
|
|
15882
|
-
*
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
*
|
|
15893
|
-
|
|
15894
|
-
|
|
15951
|
+
* Reads and normalizes a value for the built-in default comparer.
|
|
15952
|
+
*/
|
|
15953
|
+
function getDefaultCompareValue(item, prop, column) {
|
|
15954
|
+
const aRaw = column ? getCellRaw(item, column) : item === null || item === void 0 ? void 0 : item[prop];
|
|
15955
|
+
return typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
15956
|
+
}
|
|
15957
|
+
function isEmptyCompareValue(value) {
|
|
15958
|
+
return value === '' || value === null || value === undefined;
|
|
15959
|
+
}
|
|
15960
|
+
/**
|
|
15961
|
+
* Compares two already-normalized default comparer values.
|
|
15962
|
+
*/
|
|
15963
|
+
function compareValues(av, bv) {
|
|
15964
|
+
if (av === bv) {
|
|
15965
|
+
return 0;
|
|
15966
|
+
}
|
|
15967
|
+
const aEmpty = isEmptyCompareValue(av);
|
|
15968
|
+
const bEmpty = isEmptyCompareValue(bv);
|
|
15969
|
+
if (aEmpty || bEmpty) {
|
|
15970
|
+
if (aEmpty && bEmpty) {
|
|
15971
|
+
return 0;
|
|
15972
|
+
}
|
|
15973
|
+
return aEmpty ? -1 : 1;
|
|
15974
|
+
}
|
|
15975
|
+
if (av > bv) {
|
|
15976
|
+
return 1;
|
|
15977
|
+
}
|
|
15978
|
+
return -1;
|
|
15979
|
+
}
|
|
15980
|
+
/**
|
|
15981
|
+
* Sorts indexes by precomputed values for default column comparers.
|
|
15895
15982
|
*
|
|
15896
|
-
*
|
|
15897
|
-
*
|
|
15983
|
+
* This avoids repeatedly parsing the same cell value during large default
|
|
15984
|
+
* sorts while preserving normal multi-column ordering.
|
|
15985
|
+
*/
|
|
15986
|
+
function sortIndexByDefaultComparers(indexes, source, entries, sorting, sortingColumns) {
|
|
15987
|
+
const prepared = entries.map(([prop]) => {
|
|
15988
|
+
const values = [];
|
|
15989
|
+
const column = sortingColumns[prop];
|
|
15990
|
+
for (const index of indexes) {
|
|
15991
|
+
values[index] = getDefaultCompareValue(source[index], prop, column);
|
|
15992
|
+
}
|
|
15993
|
+
return {
|
|
15994
|
+
order: sorting[prop],
|
|
15995
|
+
values,
|
|
15996
|
+
};
|
|
15997
|
+
});
|
|
15998
|
+
return indexes.sort((a, b) => {
|
|
15999
|
+
for (const { order, values } of prepared) {
|
|
16000
|
+
const sorted = compareValues(values[a], values[b]);
|
|
16001
|
+
if (sorted) {
|
|
16002
|
+
return order === 'desc' ? -sorted : sorted;
|
|
16003
|
+
}
|
|
16004
|
+
}
|
|
16005
|
+
return 0;
|
|
16006
|
+
});
|
|
16007
|
+
}
|
|
16008
|
+
/**
|
|
16009
|
+
* Detects whether the optimized default-comparer path can be used.
|
|
15898
16010
|
*
|
|
15899
|
-
*
|
|
15900
|
-
*
|
|
16011
|
+
* Grouped rows and custom `cellCompare` functions stay on the legacy
|
|
16012
|
+
* comparator path to preserve their exact behavior.
|
|
15901
16013
|
*/
|
|
15902
|
-
function
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
}
|
|
15909
|
-
var tag = getTag(collection);
|
|
15910
|
-
if (tag == mapTag || tag == setTag) {
|
|
15911
|
-
return collection.size;
|
|
15912
|
-
}
|
|
15913
|
-
return baseKeys(collection).length;
|
|
16014
|
+
function canUseDefaultCompareFastPath(entries, indexes, source, sorting, sortingColumns) {
|
|
16015
|
+
return !indexes.some(index => isGrouping(source[index])) && !!sorting && !!sortingColumns && entries.every(([prop]) => {
|
|
16016
|
+
const order = sorting[prop];
|
|
16017
|
+
const column = sortingColumns[prop];
|
|
16018
|
+
return !!order && !(column === null || column === void 0 ? void 0 : column.cellCompare);
|
|
16019
|
+
});
|
|
15914
16020
|
}
|
|
15915
|
-
|
|
15916
|
-
|
|
16021
|
+
/**
|
|
16022
|
+
* Group placeholder rows are generated for their grouping column. If sorting is
|
|
16023
|
+
* requested for another column, the grouped source must be unwrapped first.
|
|
16024
|
+
*/
|
|
16025
|
+
function hasGroupingRowsForOtherSorting(entries, indexes, source) {
|
|
16026
|
+
return indexes.some(index => {
|
|
16027
|
+
const item = source[index];
|
|
16028
|
+
return isGrouping(item) && !entries.some(([prop]) => isSameColumnProp(item[GROUP_COLUMN_PROP], prop));
|
|
16029
|
+
});
|
|
16030
|
+
}
|
|
16031
|
+
/**
|
|
16032
|
+
* Sorts row indexes against a source collection.
|
|
16033
|
+
*
|
|
16034
|
+
* @param indexes - Current proxy row indexes to sort.
|
|
16035
|
+
* @param source - Full source collection addressed by the indexes.
|
|
16036
|
+
* @param sortingFunc - Comparator functions by column property.
|
|
16037
|
+
* @param sorting - Active sorting order by column property.
|
|
16038
|
+
* @param sortingColumns - Column metadata by property for default-comparer optimization.
|
|
16039
|
+
* @param sortingOrder - Active sorting priority in click/config insertion order.
|
|
16040
|
+
* @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
|
|
16041
|
+
*/
|
|
16042
|
+
function sortIndexByItems(indexes, source, sortingFunc = {}, sorting, sortingColumns, sortingOrder) {
|
|
16043
|
+
const hasSortingKeys = Object.keys(sortingFunc).length > 0;
|
|
16044
|
+
const sortingEntries = activeSortingEntries(sortingFunc, sortingOrder);
|
|
15917
16045
|
// if no sorting - return unsorted indexes
|
|
15918
|
-
if (
|
|
16046
|
+
if (sortingEntries.length === 0) {
|
|
15919
16047
|
// Unsorted indexes
|
|
15920
|
-
return [...Array(indexes.length).keys()];
|
|
16048
|
+
return hasSortingKeys ? indexes : [...new Array(indexes.length).keys()];
|
|
16049
|
+
}
|
|
16050
|
+
if (hasGroupingRowsForOtherSorting(sortingEntries, indexes, source)) {
|
|
16051
|
+
return indexes;
|
|
16052
|
+
}
|
|
16053
|
+
if (canUseDefaultCompareFastPath(sortingEntries, indexes, source, sorting, sortingColumns)) {
|
|
16054
|
+
return sortIndexByDefaultComparers(indexes, source, sortingEntries, sorting, sortingColumns);
|
|
15921
16055
|
}
|
|
15922
16056
|
//
|
|
15923
16057
|
/**
|
|
@@ -15927,15 +16061,15 @@ function sortIndexByItems(indexes, source, sortingFunc = {}) {
|
|
|
15927
16061
|
return indexes.sort((a, b) => {
|
|
15928
16062
|
const itemA = source[a];
|
|
15929
16063
|
const itemB = source[b];
|
|
15930
|
-
for (const [prop, cmp] of
|
|
16064
|
+
for (const [prop, cmp] of sortingEntries) {
|
|
15931
16065
|
if (isGrouping(itemA)) {
|
|
15932
|
-
if (itemA[
|
|
15933
|
-
return
|
|
16066
|
+
if (!isSameColumnProp(itemA[GROUP_COLUMN_PROP], prop)) {
|
|
16067
|
+
return a - b;
|
|
15934
16068
|
}
|
|
15935
16069
|
}
|
|
15936
16070
|
if (isGrouping(itemB)) {
|
|
15937
|
-
if (itemB[
|
|
15938
|
-
return
|
|
16071
|
+
if (!isSameColumnProp(itemB[GROUP_COLUMN_PROP], prop)) {
|
|
16072
|
+
return a - b;
|
|
15939
16073
|
}
|
|
15940
16074
|
}
|
|
15941
16075
|
/**
|
|
@@ -15955,13 +16089,7 @@ function defaultCellCompare(prop, a, b) {
|
|
|
15955
16089
|
const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
|
|
15956
16090
|
const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
15957
16091
|
const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
|
|
15958
|
-
|
|
15959
|
-
return 0;
|
|
15960
|
-
}
|
|
15961
|
-
if (av > bv) {
|
|
15962
|
-
return 1;
|
|
15963
|
-
}
|
|
15964
|
-
return -1;
|
|
16092
|
+
return compareValues(av, bv);
|
|
15965
16093
|
}
|
|
15966
16094
|
function descCellCompare(cmp) {
|
|
15967
16095
|
return (prop, a, b) => {
|
|
@@ -15990,11 +16118,32 @@ function getComparer(column, order) {
|
|
|
15990
16118
|
return undefined;
|
|
15991
16119
|
}
|
|
15992
16120
|
|
|
16121
|
+
/**
|
|
16122
|
+
* Renders sorting direction and optional additive sorting rank.
|
|
16123
|
+
*/
|
|
15993
16124
|
const SortingSign = ({ column }) => {
|
|
15994
16125
|
var _a;
|
|
15995
|
-
|
|
16126
|
+
const indicatorAttrs = { class: 'sort-indicator' };
|
|
16127
|
+
const iconAttrs = { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' };
|
|
16128
|
+
const orderIndexAttrs = { class: 'sort-order-index' };
|
|
16129
|
+
return (hAsync("span", Object.assign({}, indicatorAttrs), hAsync("i", Object.assign({}, iconAttrs)), (column === null || column === void 0 ? void 0 : column.sortIndex) ? (hAsync("sup", Object.assign({}, orderIndexAttrs), column.sortIndex)) : null));
|
|
15996
16130
|
};
|
|
15997
16131
|
|
|
16132
|
+
function getSortableRowIndexes(indexes, source) {
|
|
16133
|
+
return indexes.filter(index => !isGrouping(source[index]));
|
|
16134
|
+
}
|
|
16135
|
+
function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
|
|
16136
|
+
if (sortedRows.length === indexes.length) {
|
|
16137
|
+
return sortedRows;
|
|
16138
|
+
}
|
|
16139
|
+
let rowIndex = 0;
|
|
16140
|
+
return indexes.map(index => {
|
|
16141
|
+
if (isGrouping(source[index])) {
|
|
16142
|
+
return index;
|
|
16143
|
+
}
|
|
16144
|
+
return sortedRows[rowIndex++];
|
|
16145
|
+
});
|
|
16146
|
+
}
|
|
15998
16147
|
/**
|
|
15999
16148
|
* Lifecycle
|
|
16000
16149
|
* 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.
|
|
@@ -16009,54 +16158,37 @@ class SortingPlugin extends BasePlugin {
|
|
|
16009
16158
|
super(revogrid, providers);
|
|
16010
16159
|
this.revogrid = revogrid;
|
|
16011
16160
|
/**
|
|
16012
|
-
* Delayed sorting promise
|
|
16161
|
+
* Delayed sorting promise registered in the grid render job queue.
|
|
16013
16162
|
*/
|
|
16014
16163
|
this.sortingPromise = null;
|
|
16015
16164
|
/**
|
|
16016
|
-
*
|
|
16165
|
+
* Debounced sorting entry point.
|
|
16166
|
+
*
|
|
16167
|
+
* Sorting can be requested by column changes, source changes, and header
|
|
16168
|
+
* clicks in quick succession, so the actual sort is delayed and coalesced.
|
|
16017
16169
|
*/
|
|
16018
|
-
this.postponeSort = debounce$1((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
|
|
16019
|
-
|
|
16020
|
-
var _a;
|
|
16021
|
-
if (cfg) {
|
|
16022
|
-
const sortingFunc = {};
|
|
16023
|
-
const order = {};
|
|
16024
|
-
(_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
16025
|
-
sortingFunc[col.prop] = getComparer(col, col.order);
|
|
16026
|
-
order[col.prop] = col.order;
|
|
16027
|
-
});
|
|
16028
|
-
if (cfg.additive) {
|
|
16029
|
-
this.sorting = Object.assign(Object.assign({}, this.sorting), order);
|
|
16030
|
-
this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
|
|
16031
|
-
}
|
|
16032
|
-
else {
|
|
16033
|
-
// // set sorting
|
|
16034
|
-
this.sorting = order;
|
|
16035
|
-
this.sortingFunc = sortingFunc;
|
|
16036
|
-
}
|
|
16037
|
-
}
|
|
16038
|
-
};
|
|
16039
|
-
setConfig(config);
|
|
16170
|
+
this.postponeSort = debounce$1((order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) => this.runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate), 50);
|
|
16171
|
+
this.applySortingConfig(config);
|
|
16040
16172
|
this.addEventListener('sortingconfigchanged', ({ detail }) => {
|
|
16041
16173
|
config = detail;
|
|
16042
|
-
|
|
16043
|
-
this.startSorting(this.sorting, this.sortingFunc);
|
|
16174
|
+
this.applySortingConfig(detail);
|
|
16175
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16044
16176
|
});
|
|
16045
16177
|
this.addEventListener('beforeheaderrender', ({ detail, }) => {
|
|
16046
16178
|
var _a;
|
|
16047
16179
|
const { data: column } = detail;
|
|
16048
16180
|
if (column.sortable) {
|
|
16049
|
-
detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
|
|
16181
|
+
detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop], sortIndex: getSortingIndex(this.sorting, column.prop, this.sortingOrder) });
|
|
16050
16182
|
}
|
|
16051
16183
|
});
|
|
16052
16184
|
this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
|
|
16053
16185
|
// if sorting was provided - sort data
|
|
16054
|
-
if (
|
|
16186
|
+
if (hasActiveSorting(this.sorting) && this.sortingFunc) {
|
|
16055
16187
|
const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
|
|
16056
16188
|
if (event.defaultPrevented) {
|
|
16057
16189
|
return;
|
|
16058
16190
|
}
|
|
16059
|
-
this.startSorting(this.sorting, this.sortingFunc);
|
|
16191
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16060
16192
|
}
|
|
16061
16193
|
});
|
|
16062
16194
|
this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
|
|
@@ -16066,13 +16198,24 @@ class SortingPlugin extends BasePlugin {
|
|
|
16066
16198
|
}
|
|
16067
16199
|
const columns = this.providers.column.getColumns();
|
|
16068
16200
|
const sortingFunc = {};
|
|
16201
|
+
const sortingColumns = {};
|
|
16202
|
+
const sortingOrder = [];
|
|
16203
|
+
const sorting = {};
|
|
16069
16204
|
for (let prop in order) {
|
|
16070
|
-
|
|
16071
|
-
|
|
16205
|
+
if (order[prop]) {
|
|
16206
|
+
const column = getColumnByProp(columns, prop);
|
|
16207
|
+
const cmp = getComparer(column, order[prop]);
|
|
16208
|
+
sorting[prop] = order[prop];
|
|
16209
|
+
sortingFunc[prop] = cmp;
|
|
16210
|
+
sortingColumns[prop] = column;
|
|
16211
|
+
sortingOrder.push(prop);
|
|
16212
|
+
}
|
|
16072
16213
|
}
|
|
16073
16214
|
// set sorting
|
|
16074
|
-
this.sorting =
|
|
16075
|
-
this.sortingFunc =
|
|
16215
|
+
this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
|
|
16216
|
+
this.sortingFunc = this.sorting ? sortingFunc : undefined;
|
|
16217
|
+
this.sortingColumns = this.sorting ? sortingColumns : undefined;
|
|
16218
|
+
this.sortingOrder = this.sorting ? sortingOrder : undefined;
|
|
16076
16219
|
});
|
|
16077
16220
|
this.addEventListener('beforeheaderclick', (e) => {
|
|
16078
16221
|
var _a, _b, _c, _d;
|
|
@@ -16086,23 +16229,89 @@ class SortingPlugin extends BasePlugin {
|
|
|
16086
16229
|
});
|
|
16087
16230
|
}
|
|
16088
16231
|
/**
|
|
16089
|
-
*
|
|
16232
|
+
* Creates mutable sorting maps from current state when additive sorting is requested.
|
|
16233
|
+
*/
|
|
16234
|
+
createSortingState(additive) {
|
|
16235
|
+
var _a;
|
|
16236
|
+
return {
|
|
16237
|
+
sorting: additive ? Object.assign({}, this.sorting) : {},
|
|
16238
|
+
sortingFunc: additive ? Object.assign({}, this.sortingFunc) : {},
|
|
16239
|
+
sortingColumns: additive ? Object.assign({}, this.sortingColumns) : {},
|
|
16240
|
+
sortingOrder: additive ? [...((_a = this.sortingOrder) !== null && _a !== void 0 ? _a : [])] : [],
|
|
16241
|
+
};
|
|
16242
|
+
}
|
|
16243
|
+
/**
|
|
16244
|
+
* Stores normalized sorting state, clearing inactive empty maps.
|
|
16090
16245
|
*/
|
|
16091
|
-
|
|
16246
|
+
setSortingState({ sorting, sortingFunc, sortingColumns, sortingOrder, }) {
|
|
16247
|
+
this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
|
|
16248
|
+
this.sortingFunc = this.sorting ? sortingFunc : undefined;
|
|
16249
|
+
this.sortingColumns = this.sorting ? sortingColumns : undefined;
|
|
16250
|
+
this.sortingOrder = this.sorting ? sortingOrder : undefined;
|
|
16251
|
+
}
|
|
16252
|
+
/**
|
|
16253
|
+
* Adds or replaces a column in a sorting state.
|
|
16254
|
+
*/
|
|
16255
|
+
setColumnSorting(state, prop, order, cmp, column) {
|
|
16256
|
+
state.sorting[prop] = order;
|
|
16257
|
+
state.sortingFunc[prop] = cmp;
|
|
16258
|
+
state.sortingColumns[prop] = column;
|
|
16259
|
+
if (!state.sortingOrder.some(sortingProp => String(sortingProp) === String(prop))) {
|
|
16260
|
+
state.sortingOrder.push(prop);
|
|
16261
|
+
}
|
|
16262
|
+
}
|
|
16263
|
+
/**
|
|
16264
|
+
* Removes a column from a sorting state.
|
|
16265
|
+
*/
|
|
16266
|
+
clearColumnSorting(state, prop) {
|
|
16267
|
+
delete state.sorting[prop];
|
|
16268
|
+
delete state.sortingFunc[prop];
|
|
16269
|
+
delete state.sortingColumns[prop];
|
|
16270
|
+
const index = state.sortingOrder.findIndex(sortingProp => String(sortingProp) === String(prop));
|
|
16271
|
+
if (index >= 0) {
|
|
16272
|
+
state.sortingOrder.splice(index, 1);
|
|
16273
|
+
}
|
|
16274
|
+
}
|
|
16275
|
+
/**
|
|
16276
|
+
* Normalizes external sorting configuration into internal order,
|
|
16277
|
+
* comparator, and column metadata maps.
|
|
16278
|
+
*/
|
|
16279
|
+
applySortingConfig(cfg) {
|
|
16280
|
+
var _a;
|
|
16281
|
+
if (!cfg) {
|
|
16282
|
+
return;
|
|
16283
|
+
}
|
|
16284
|
+
const state = this.createSortingState(cfg.additive);
|
|
16285
|
+
(_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
16286
|
+
if (col.order) {
|
|
16287
|
+
this.setColumnSorting(state, col.prop, col.order, getComparer(col, col.order), col);
|
|
16288
|
+
return;
|
|
16289
|
+
}
|
|
16290
|
+
this.clearColumnSorting(state, col.prop);
|
|
16291
|
+
});
|
|
16292
|
+
this.setSortingState(state);
|
|
16293
|
+
}
|
|
16294
|
+
startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
|
|
16092
16295
|
if (!this.sortingPromise) {
|
|
16093
16296
|
// add job before render
|
|
16094
16297
|
this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
|
|
16095
16298
|
this.sortingPromise = resolve;
|
|
16096
16299
|
}));
|
|
16097
16300
|
}
|
|
16098
|
-
|
|
16301
|
+
if (typeof sortingColumns === 'boolean') {
|
|
16302
|
+
this.postponeSort(order, sortingFunc, undefined, undefined, sortingColumns);
|
|
16303
|
+
return;
|
|
16304
|
+
}
|
|
16305
|
+
this.postponeSort(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate);
|
|
16099
16306
|
}
|
|
16100
16307
|
/**
|
|
16101
|
-
*
|
|
16102
|
-
*
|
|
16308
|
+
* Applies sorting requested by a sortable header click.
|
|
16309
|
+
*
|
|
16310
|
+
* @param column - Column that initiated sorting.
|
|
16311
|
+
* @param additive - If true, add/remove this column from the current multi-sort state.
|
|
16103
16312
|
*/
|
|
16104
16313
|
headerclick(column, additive) {
|
|
16105
|
-
var _a
|
|
16314
|
+
var _a;
|
|
16106
16315
|
const columnProp = column.prop;
|
|
16107
16316
|
let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
|
|
16108
16317
|
const beforeEvent = this.emit('beforesorting', { column, order, additive });
|
|
@@ -16120,52 +16329,59 @@ class SortingPlugin extends BasePlugin {
|
|
|
16120
16329
|
return;
|
|
16121
16330
|
}
|
|
16122
16331
|
const cmp = getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16332
|
+
this.applyHeaderSorting(beforeApplyEvent.detail.column, beforeApplyEvent.detail.additive, order, cmp);
|
|
16333
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16334
|
+
}
|
|
16335
|
+
/**
|
|
16336
|
+
* Applies sorting state produced by a header click.
|
|
16337
|
+
*/
|
|
16338
|
+
applyHeaderSorting(column, additive, order, cmp) {
|
|
16339
|
+
if (!additive) {
|
|
16340
|
+
this.setSortingState(order ? {
|
|
16341
|
+
sorting: { [column.prop]: order },
|
|
16342
|
+
sortingFunc: { [column.prop]: cmp },
|
|
16343
|
+
sortingColumns: { [column.prop]: column },
|
|
16344
|
+
sortingOrder: [column.prop],
|
|
16345
|
+
} : this.createSortingState());
|
|
16346
|
+
return;
|
|
16347
|
+
}
|
|
16348
|
+
const state = this.createSortingState(true);
|
|
16349
|
+
if (order) {
|
|
16350
|
+
this.setColumnSorting(state, column.prop, order, cmp, column);
|
|
16137
16351
|
}
|
|
16138
16352
|
else {
|
|
16139
|
-
|
|
16140
|
-
// reset sorting
|
|
16141
|
-
this.sorting = { [columnProp]: order };
|
|
16142
|
-
this.sortingFunc = { [columnProp]: cmp };
|
|
16143
|
-
}
|
|
16144
|
-
else {
|
|
16145
|
-
(_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
|
|
16146
|
-
(_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
|
|
16147
|
-
}
|
|
16353
|
+
this.clearColumnSorting(state, column.prop);
|
|
16148
16354
|
}
|
|
16149
|
-
this.
|
|
16355
|
+
this.setSortingState(state);
|
|
16150
16356
|
}
|
|
16151
|
-
runSorting(order, comparison, ignoreViewportUpdate) {
|
|
16152
|
-
var _a;
|
|
16153
|
-
|
|
16154
|
-
|
|
16357
|
+
runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) {
|
|
16358
|
+
var _a, _b;
|
|
16359
|
+
if (typeof sortingColumns === 'boolean') {
|
|
16360
|
+
this.sort(order, comparison, undefined, undefined, undefined, sortingColumns);
|
|
16361
|
+
(_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
16362
|
+
this.sortingPromise = null;
|
|
16363
|
+
return;
|
|
16364
|
+
}
|
|
16365
|
+
this.sort(order, comparison, sortingColumns, sortingOrder, undefined, ignoreViewportUpdate);
|
|
16366
|
+
(_b = this.sortingPromise) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
16155
16367
|
this.sortingPromise = null;
|
|
16156
16368
|
}
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16369
|
+
sort(sorting, sortingFunc, sortingColumns, sortingOrder, types = rowTypes, ignoreViewportUpdate = false) {
|
|
16370
|
+
let activeSortingColumns;
|
|
16371
|
+
let activeSortingOrder;
|
|
16372
|
+
let activeTypes = types;
|
|
16373
|
+
let activeIgnoreViewportUpdate = ignoreViewportUpdate;
|
|
16374
|
+
if (Array.isArray(sortingColumns)) {
|
|
16375
|
+
activeTypes = sortingColumns;
|
|
16376
|
+
activeIgnoreViewportUpdate = typeof sortingOrder === 'boolean' ? sortingOrder : false;
|
|
16377
|
+
}
|
|
16378
|
+
else {
|
|
16379
|
+
activeSortingColumns = sortingColumns;
|
|
16380
|
+
activeSortingOrder = Array.isArray(sortingOrder) ? sortingOrder : undefined;
|
|
16381
|
+
}
|
|
16166
16382
|
// if no sorting - reset
|
|
16167
16383
|
if (!Object.keys(sorting || {}).length) {
|
|
16168
|
-
for (let type of
|
|
16384
|
+
for (let type of activeTypes) {
|
|
16169
16385
|
const storeService = this.providers.data.stores[type];
|
|
16170
16386
|
// row data
|
|
16171
16387
|
const source = storeService.store.get('source');
|
|
@@ -16174,26 +16390,27 @@ class SortingPlugin extends BasePlugin {
|
|
|
16174
16390
|
// row indexes
|
|
16175
16391
|
const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
|
|
16176
16392
|
this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
|
|
16177
|
-
storeService.setData({ proxyItems: newItemsOrder
|
|
16393
|
+
storeService.setData({ proxyItems: newItemsOrder });
|
|
16178
16394
|
}
|
|
16179
16395
|
}
|
|
16180
16396
|
else {
|
|
16181
|
-
for (let type of
|
|
16397
|
+
for (let type of activeTypes) {
|
|
16182
16398
|
const storeService = this.providers.data.stores[type];
|
|
16183
16399
|
// row data
|
|
16184
16400
|
const source = storeService.store.get('source');
|
|
16185
16401
|
// row indexes
|
|
16186
16402
|
const proxyItems = storeService.store.get('proxyItems');
|
|
16187
|
-
const
|
|
16403
|
+
const sortItems = getSortableRowIndexes(proxyItems, source);
|
|
16404
|
+
const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
|
|
16405
|
+
const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
|
|
16188
16406
|
// take row indexes before trim applied and proxy items
|
|
16189
16407
|
const prevItems = storeService.store.get('items');
|
|
16190
16408
|
storeService.setData({
|
|
16191
16409
|
proxyItems: newItemsOrder,
|
|
16192
|
-
source: [...source],
|
|
16193
16410
|
});
|
|
16194
16411
|
// take currently visible row indexes
|
|
16195
16412
|
const newItems = storeService.store.get('items');
|
|
16196
|
-
if (!
|
|
16413
|
+
if (!activeIgnoreViewportUpdate) {
|
|
16197
16414
|
this.providers.dimension
|
|
16198
16415
|
.updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
|
|
16199
16416
|
}
|
|
@@ -16763,6 +16980,18 @@ const expandSvgIconVNode = (expanded = false) => {
|
|
|
16763
16980
|
return (hAsync("svg", { "aria-hidden": "true", style: { transform: `rotate(${!expanded ? -90 : 0}deg)` }, focusable: "false", viewBox: "0 0 448 512" }, hAsync("path", { fill: "currentColor", d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" })));
|
|
16764
16981
|
};
|
|
16765
16982
|
|
|
16983
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
16984
|
+
var t = {};
|
|
16985
|
+
for (var p in s)
|
|
16986
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16987
|
+
t[p] = s[p];
|
|
16988
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16989
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16990
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
16991
|
+
t[p[i]] = s[p[i]];
|
|
16992
|
+
}
|
|
16993
|
+
return t;
|
|
16994
|
+
};
|
|
16766
16995
|
class GroupingRowPlugin extends BasePlugin {
|
|
16767
16996
|
getStore(type = GROUPING_ROW_TYPE) {
|
|
16768
16997
|
return this.providers.data.stores[type].store;
|
|
@@ -16846,6 +17075,18 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
16846
17075
|
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
16847
17076
|
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
16848
17077
|
}
|
|
17078
|
+
/**
|
|
17079
|
+
* Returns grouping options for regrouping that must preserve current UI state.
|
|
17080
|
+
*
|
|
17081
|
+
* `expandedAll` and config `prevExpanded` are initial/config instructions.
|
|
17082
|
+
* Reusing them after sorting would reopen groups the user collapsed before
|
|
17083
|
+
* sorting instead of using the current grouped source state.
|
|
17084
|
+
*/
|
|
17085
|
+
getCurrentExpandedOptions() {
|
|
17086
|
+
var _a;
|
|
17087
|
+
const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, options = __rest(_b, ["expandedAll", "prevExpanded"]);
|
|
17088
|
+
return options;
|
|
17089
|
+
}
|
|
16849
17090
|
/**
|
|
16850
17091
|
* Starts global source update with group clearing and applying new one
|
|
16851
17092
|
* Initiated when need to reapply grouping
|
|
@@ -16948,7 +17189,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
16948
17189
|
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
16949
17190
|
return;
|
|
16950
17191
|
}
|
|
16951
|
-
this.doSourceUpdate(
|
|
17192
|
+
this.doSourceUpdate(this.getCurrentExpandedOptions());
|
|
16952
17193
|
});
|
|
16953
17194
|
/**
|
|
16954
17195
|
* Apply logic for focus inside of grouping
|
|
@@ -17155,7 +17396,8 @@ class ViewportService {
|
|
|
17155
17396
|
(_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
|
|
17156
17397
|
// set resize event
|
|
17157
17398
|
const changedItems = {};
|
|
17158
|
-
for (const
|
|
17399
|
+
for (const i of Object.keys(detail || {})) {
|
|
17400
|
+
const size = detail[i];
|
|
17159
17401
|
const virtualIndex = parseInt(i, 10);
|
|
17160
17402
|
const item = getSourceItem(store, virtualIndex);
|
|
17161
17403
|
if (item) {
|
|
@@ -17558,7 +17800,10 @@ class SelectionStoreConnector {
|
|
|
17558
17800
|
const nextItem = nextCell(focus, lastCell);
|
|
17559
17801
|
let nextStore;
|
|
17560
17802
|
if (nextItem) {
|
|
17561
|
-
Object.
|
|
17803
|
+
Object.keys(nextItem).forEach((t) => {
|
|
17804
|
+
var _a;
|
|
17805
|
+
const type = t;
|
|
17806
|
+
const nextItemCoord = (_a = nextItem[type]) !== null && _a !== void 0 ? _a : 0;
|
|
17562
17807
|
let stores;
|
|
17563
17808
|
switch (type) {
|
|
17564
17809
|
case 'x':
|
|
@@ -18233,7 +18478,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18233
18478
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
18234
18479
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
18235
18480
|
const elRect = dataEl.getBoundingClientRect();
|
|
18236
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
|
|
18481
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
|
|
18237
18482
|
this.staticDragData = {
|
|
18238
18483
|
startPos: event.x,
|
|
18239
18484
|
startItem,
|
|
@@ -18258,13 +18503,13 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18258
18503
|
const start = this.staticDragData.startPos;
|
|
18259
18504
|
if (Math.abs(start - e.x) > 10) {
|
|
18260
18505
|
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
18261
|
-
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
18506
|
+
const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
|
|
18262
18507
|
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
18263
18508
|
// prevent position change if out of bounds
|
|
18264
18509
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
18265
18510
|
return;
|
|
18266
18511
|
}
|
|
18267
|
-
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
18512
|
+
this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
|
|
18268
18513
|
}
|
|
18269
18514
|
}
|
|
18270
18515
|
move(e) {
|
|
@@ -18282,7 +18527,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18282
18527
|
if (relativePos < 0) {
|
|
18283
18528
|
relativePos = 0;
|
|
18284
18529
|
}
|
|
18285
|
-
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
18530
|
+
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
|
|
18286
18531
|
const store = this.providers.column.stores[this.dragData.type].store;
|
|
18287
18532
|
const source = store.get('source');
|
|
18288
18533
|
const newItems = [...store.get('items')];
|
|
@@ -19247,12 +19492,13 @@ class RevoGridComponent {
|
|
|
19247
19492
|
return;
|
|
19248
19493
|
}
|
|
19249
19494
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
19495
|
+
const order = {};
|
|
19496
|
+
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
19497
|
+
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
19498
|
+
}
|
|
19250
19499
|
this.aftercolumnsset.emit({
|
|
19251
19500
|
columns,
|
|
19252
|
-
order
|
|
19253
|
-
acc[prop] = column.order;
|
|
19254
|
-
return acc;
|
|
19255
|
-
}, {}),
|
|
19501
|
+
order,
|
|
19256
19502
|
});
|
|
19257
19503
|
}
|
|
19258
19504
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
@@ -19541,7 +19787,7 @@ class RevoGridComponent {
|
|
|
19541
19787
|
if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
19542
19788
|
this.trimmedRowsChanged(this.trimmedRows);
|
|
19543
19789
|
}
|
|
19544
|
-
this.rowDefChanged(this.rowDefinitions);
|
|
19790
|
+
this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
|
|
19545
19791
|
// init grouping
|
|
19546
19792
|
if (this.grouping && Object.keys(this.grouping).length > 0) {
|
|
19547
19793
|
this.groupingChanged(this.grouping);
|
|
@@ -20058,11 +20304,13 @@ class RevogrData {
|
|
|
20058
20304
|
const depth = this.dataStore.get('groupingDepth');
|
|
20059
20305
|
const groupingCustomRenderer = this.dataStore.get('groupingCustomRenderer');
|
|
20060
20306
|
const groupDepth = this.columnService.hasGrouping ? depth : 0;
|
|
20307
|
+
const rowRenderOffset = this.viewportRow.get('renderOffset') || 0;
|
|
20308
|
+
const colRenderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
20061
20309
|
for (let rgRow of rows) {
|
|
20062
20310
|
const dataItem = getSourceItem(this.dataStore, rgRow.itemIndex);
|
|
20063
20311
|
// #region Grouping
|
|
20064
20312
|
if (isGrouping(dataItem)) {
|
|
20065
|
-
const gmodel = Object.assign(Object.assign({}, rgRow), { index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
20313
|
+
const gmodel = Object.assign(Object.assign({}, rgRow), { start: rgRow.start - rowRenderOffset, index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
20066
20314
|
// Only show expand button if grouping is enabled and not in row headers
|
|
20067
20315
|
hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
|
|
20068
20316
|
rowsEls.push(hAsync(GroupingRowRenderer, Object.assign({}, gmodel)));
|
|
@@ -20085,7 +20333,7 @@ class RevogrData {
|
|
|
20085
20333
|
[DATA_ROW]: rowProps.itemIndex,
|
|
20086
20334
|
style: {
|
|
20087
20335
|
width: `${columnProps.size}px`,
|
|
20088
|
-
transform: `translateX(${columnProps.start}px)`,
|
|
20336
|
+
transform: `translateX(${columnProps.start - colRenderOffset}px)`,
|
|
20089
20337
|
height: rowProps.size ? `${rowProps.size}px` : undefined,
|
|
20090
20338
|
},
|
|
20091
20339
|
};
|
|
@@ -20113,7 +20361,7 @@ class RevogrData {
|
|
|
20113
20361
|
if (this.rowHighlightPlugin.isRowFocused(rgRow.itemIndex)) {
|
|
20114
20362
|
rowClass += ` ${ROW_FOCUSED_CLASS}`;
|
|
20115
20363
|
}
|
|
20116
|
-
const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start, groupingLevel: groupDepth || undefined }, cells));
|
|
20364
|
+
const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start - rowRenderOffset, groupingLevel: groupDepth || undefined }, cells));
|
|
20117
20365
|
this.beforerowrender.emit({
|
|
20118
20366
|
node: row,
|
|
20119
20367
|
item: rgRow,
|
|
@@ -20432,7 +20680,7 @@ const HeaderRenderer = (p) => {
|
|
|
20432
20680
|
class: cellClass,
|
|
20433
20681
|
style: {
|
|
20434
20682
|
width: `${p.column.size}px`,
|
|
20435
|
-
transform: `translateX(${p.column.start}px)`,
|
|
20683
|
+
transform: `translateX(${p.column.start - (p.renderOffset || 0)}px)`,
|
|
20436
20684
|
},
|
|
20437
20685
|
onResize: p.onResize,
|
|
20438
20686
|
onDblClick(originalEvent) {
|
|
@@ -20477,7 +20725,7 @@ const HeaderGroupRenderer = (p) => {
|
|
|
20477
20725
|
[HEADER_CLASS]: true,
|
|
20478
20726
|
},
|
|
20479
20727
|
style: {
|
|
20480
|
-
transform: `translateX(${p.start}px)`,
|
|
20728
|
+
transform: `translateX(${p.start - (p.renderOffset || 0)}px)`,
|
|
20481
20729
|
width: `${p.end - p.start}px`,
|
|
20482
20730
|
},
|
|
20483
20731
|
onResize: p.onResize,
|
|
@@ -20485,7 +20733,7 @@ const HeaderGroupRenderer = (p) => {
|
|
|
20485
20733
|
return (hAsync(HeaderCellRenderer, { data: Object.assign(Object.assign({}, p.group), { prop: '', providers: p.providers, index: p.start }), props: groupProps, additionalData: p.additionalData }));
|
|
20486
20734
|
};
|
|
20487
20735
|
|
|
20488
|
-
const revogrHeaderStyleCss = () => `@charset "UTF-8";revogr-header{position:relative;z-index:5;display:block}revogr-header .header-rgRow{display:block;position:relative}revogr-header .header-rgRow.group{z-index:0}revogr-header .group-rgRow{position:relative;overflow:hidden}revogr-header .rgHeaderCell{position:absolute;box-sizing:border-box;height:100%;z-index:1;display:flex}revogr-header .rgHeaderCell.align-center{text-align:center}revogr-header .rgHeaderCell.align-left{text-align:left}revogr-header .rgHeaderCell.align-right{text-align:right}revogr-header .rgHeaderCell.sortable{cursor:pointer}revogr-header .rgHeaderCell i.asc:after,revogr-header .rgHeaderCell i.desc:after{font-size:13px}revogr-header .rgHeaderCell i.asc:after{content:"↑"}revogr-header .rgHeaderCell i.desc:after{content:"↓"}revogr-header .rgHeaderCell.active{z-index:10}revogr-header .rgHeaderCell.active .resizable{background-color:deepskyblue}revogr-header .rgHeaderCell .header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}revogr-header .rgHeaderCell .resizable{display:block;position:absolute;z-index:90;touch-action:none;user-select:none}revogr-header .rgHeaderCell .resizable:hover{background-color:deepskyblue}revogr-header .rgHeaderCell>.resizable-r{cursor:ew-resize;width:6px;right:0;top:0;height:100%}revogr-header .rgHeaderCell>.resizable-rb{cursor:se-resize;width:6px;height:6px;right:0;bottom:0}revogr-header .rgHeaderCell>.resizable-b{cursor:s-resize;height:6px;bottom:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-lb{cursor:sw-resize;width:6px;height:6px;left:0;bottom:0}revogr-header .rgHeaderCell>.resizable-l{cursor:w-resize;width:6px;left:0;height:100%;top:0}revogr-header .rgHeaderCell>.resizable-lt{cursor:nw-resize;width:6px;height:6px;left:0;top:0}revogr-header .rgHeaderCell>.resizable-t{cursor:n-resize;height:6px;top:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-rt{cursor:ne-resize;width:6px;height:6px;right:0;top:0}revogr-header .rv-filter{visibility:hidden}`;
|
|
20736
|
+
const revogrHeaderStyleCss = () => `@charset "UTF-8";revogr-header{position:relative;z-index:5;display:block}revogr-header .header-rgRow{display:block;position:relative}revogr-header .header-rgRow.group{z-index:0}revogr-header .group-rgRow{position:relative;overflow:hidden}revogr-header .rgHeaderCell{position:absolute;box-sizing:border-box;height:100%;z-index:1;display:flex}revogr-header .rgHeaderCell.align-center{text-align:center}revogr-header .rgHeaderCell.align-left{text-align:left}revogr-header .rgHeaderCell.align-right{text-align:right}revogr-header .rgHeaderCell.sortable{cursor:pointer}revogr-header .rgHeaderCell .sort-indicator{display:inline-flex;align-items:flex-start;gap:1px}revogr-header .rgHeaderCell .sort-indicator i.asc:after,revogr-header .rgHeaderCell .sort-indicator i.desc:after{font-size:13px}revogr-header .rgHeaderCell .sort-indicator i.asc:after{content:"↑"}revogr-header .rgHeaderCell .sort-indicator i.desc:after{content:"↓"}revogr-header .rgHeaderCell .sort-indicator .sort-order-index{font-size:10px;line-height:1;top:0}revogr-header .rgHeaderCell.active{z-index:10}revogr-header .rgHeaderCell.active .resizable{background-color:deepskyblue}revogr-header .rgHeaderCell .header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}revogr-header .rgHeaderCell .resizable{display:block;position:absolute;z-index:90;touch-action:none;user-select:none}revogr-header .rgHeaderCell .resizable:hover{background-color:deepskyblue}revogr-header .rgHeaderCell>.resizable-r{cursor:ew-resize;width:6px;right:0;top:0;height:100%}revogr-header .rgHeaderCell>.resizable-rb{cursor:se-resize;width:6px;height:6px;right:0;bottom:0}revogr-header .rgHeaderCell>.resizable-b{cursor:s-resize;height:6px;bottom:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-lb{cursor:sw-resize;width:6px;height:6px;left:0;bottom:0}revogr-header .rgHeaderCell>.resizable-l{cursor:w-resize;width:6px;left:0;height:100%;top:0}revogr-header .rgHeaderCell>.resizable-lt{cursor:nw-resize;width:6px;height:6px;left:0;top:0}revogr-header .rgHeaderCell>.resizable-t{cursor:n-resize;height:6px;top:0;width:100%;left:0}revogr-header .rgHeaderCell>.resizable-rt{cursor:ne-resize;width:6px;height:6px;right:0;top:0}revogr-header .rv-filter{visibility:hidden}`;
|
|
20489
20737
|
|
|
20490
20738
|
class RevogrHeaderComponent {
|
|
20491
20739
|
constructor(hostRef) {
|
|
@@ -20541,6 +20789,7 @@ class RevogrHeaderComponent {
|
|
|
20541
20789
|
}
|
|
20542
20790
|
renderHeaderColumns(cols, range) {
|
|
20543
20791
|
const columnsToRender = [];
|
|
20792
|
+
const renderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
20544
20793
|
for (let rgCol of cols) {
|
|
20545
20794
|
const colData = this.colData[rgCol.itemIndex];
|
|
20546
20795
|
const props = {
|
|
@@ -20549,6 +20798,7 @@ class RevogrHeaderComponent {
|
|
|
20549
20798
|
data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }),
|
|
20550
20799
|
canFilter: !!this.columnFilter,
|
|
20551
20800
|
canResize: this.canResize,
|
|
20801
|
+
renderOffset,
|
|
20552
20802
|
active: this.resizeHandler,
|
|
20553
20803
|
additionalData: this.additionalData,
|
|
20554
20804
|
onResize: e => this.onResize(e, rgCol.itemIndex),
|
|
@@ -20601,6 +20851,7 @@ class RevogrHeaderComponent {
|
|
|
20601
20851
|
start: groupStart,
|
|
20602
20852
|
end: groupEnd,
|
|
20603
20853
|
group,
|
|
20854
|
+
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
20604
20855
|
active: this.resizeHandler,
|
|
20605
20856
|
canResize: this.canResize,
|
|
20606
20857
|
additionalData: this.additionalData,
|
|
@@ -20791,10 +21042,11 @@ const NO_COORDINATE = -1;
|
|
|
20791
21042
|
* return full size
|
|
20792
21043
|
*/
|
|
20793
21044
|
function getContentSize(contentSize, clientSize, virtualSize = 0) {
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
21045
|
+
return getScrollDimension({
|
|
21046
|
+
contentSize,
|
|
21047
|
+
clientSize,
|
|
21048
|
+
virtualSize,
|
|
21049
|
+
}).physicalContentSize;
|
|
20798
21050
|
}
|
|
20799
21051
|
class LocalScrollService {
|
|
20800
21052
|
constructor(cfg) {
|
|
@@ -20808,14 +21060,20 @@ class LocalScrollService {
|
|
|
20808
21060
|
rgRow: NO_COORDINATE,
|
|
20809
21061
|
rgCol: NO_COORDINATE,
|
|
20810
21062
|
};
|
|
21063
|
+
this.previousLogicalScroll = {
|
|
21064
|
+
rgRow: 0,
|
|
21065
|
+
rgCol: 0,
|
|
21066
|
+
};
|
|
20811
21067
|
this.params = {
|
|
20812
21068
|
rgRow: Object.assign({}, initialParams),
|
|
20813
21069
|
rgCol: Object.assign({}, initialParams),
|
|
20814
21070
|
};
|
|
20815
21071
|
}
|
|
20816
21072
|
setParams(params, dimension) {
|
|
20817
|
-
const
|
|
20818
|
-
|
|
21073
|
+
const scrollDimension = getScrollDimension(params);
|
|
21074
|
+
const virtualContentSize = scrollDimension.physicalContentSize;
|
|
21075
|
+
this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize,
|
|
21076
|
+
scrollDimension });
|
|
20819
21077
|
}
|
|
20820
21078
|
// apply scroll values after scroll done
|
|
20821
21079
|
async setScroll(e) {
|
|
@@ -20835,16 +21093,27 @@ class LocalScrollService {
|
|
|
20835
21093
|
await frameAnimation;
|
|
20836
21094
|
const params = this.getParams(e.dimension);
|
|
20837
21095
|
e.coordinate = Math.ceil(e.coordinate);
|
|
20838
|
-
this.
|
|
21096
|
+
this.previousLogicalScroll[e.dimension] = this.wrapLogicalCoordinate(e.coordinate, params);
|
|
21097
|
+
const physicalCoordinate = this.toPhysicalCoordinate(e.coordinate, params);
|
|
21098
|
+
this.previousScroll[e.dimension] = this.wrapPhysicalCoordinate(physicalCoordinate, params);
|
|
20839
21099
|
this.preventArtificialScroll[e.dimension] = null;
|
|
20840
|
-
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate:
|
|
20841
|
-
? this.convert(e.coordinate, params, false)
|
|
20842
|
-
: e.coordinate }));
|
|
21100
|
+
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: physicalCoordinate }));
|
|
20843
21101
|
}
|
|
20844
21102
|
catch (id) {
|
|
20845
21103
|
window.cancelAnimationFrame(id);
|
|
20846
21104
|
}
|
|
20847
21105
|
}
|
|
21106
|
+
async setScrollByDelta(e, currentPhysicalCoordinate) {
|
|
21107
|
+
var _a;
|
|
21108
|
+
const params = this.getParams(e.dimension);
|
|
21109
|
+
const baseCoordinate = this.previousScroll[e.dimension] === NO_COORDINATE
|
|
21110
|
+
? this.toLogicalCoordinate(currentPhysicalCoordinate, params)
|
|
21111
|
+
: this.previousLogicalScroll[e.dimension];
|
|
21112
|
+
const coordinate = this.wrapLogicalCoordinate(baseCoordinate + ((_a = e.delta) !== null && _a !== void 0 ? _a : 0), params);
|
|
21113
|
+
const nextEvent = Object.assign(Object.assign({}, e), { coordinate });
|
|
21114
|
+
await this.setScroll(nextEvent);
|
|
21115
|
+
return nextEvent;
|
|
21116
|
+
}
|
|
20848
21117
|
/**
|
|
20849
21118
|
* On scroll event started
|
|
20850
21119
|
*/
|
|
@@ -20857,21 +21126,21 @@ class LocalScrollService {
|
|
|
20857
21126
|
return;
|
|
20858
21127
|
}
|
|
20859
21128
|
const param = this.getParams(dimension);
|
|
21129
|
+
const logicalCoordinate = this.toLogicalScrollCoordinate(coordinate, dimension, param, delta);
|
|
20860
21130
|
// let component know about scroll event started
|
|
20861
21131
|
this.cfg.runScroll({
|
|
20862
21132
|
dimension: dimension,
|
|
20863
|
-
coordinate:
|
|
20864
|
-
? this.convert(coordinate, param)
|
|
20865
|
-
: coordinate,
|
|
21133
|
+
coordinate: logicalCoordinate,
|
|
20866
21134
|
delta,
|
|
20867
21135
|
outside,
|
|
20868
21136
|
});
|
|
21137
|
+
this.previousLogicalScroll[dimension] = logicalCoordinate;
|
|
20869
21138
|
}
|
|
20870
21139
|
getParams(dimension) {
|
|
20871
21140
|
return this.params[dimension];
|
|
20872
21141
|
}
|
|
20873
21142
|
// check if scroll outside of region to avoid looping
|
|
20874
|
-
|
|
21143
|
+
wrapPhysicalCoordinate(c, param) {
|
|
20875
21144
|
if (c < 0) {
|
|
20876
21145
|
return NO_COORDINATE;
|
|
20877
21146
|
}
|
|
@@ -20880,22 +21149,39 @@ class LocalScrollService {
|
|
|
20880
21149
|
}
|
|
20881
21150
|
return c;
|
|
20882
21151
|
}
|
|
21152
|
+
wrapLogicalCoordinate(c, param) {
|
|
21153
|
+
var _a, _b;
|
|
21154
|
+
if (c < 0) {
|
|
21155
|
+
return 0;
|
|
21156
|
+
}
|
|
21157
|
+
return Math.min(c, (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.logicalScrollSize) !== null && _b !== void 0 ? _b : c);
|
|
21158
|
+
}
|
|
20883
21159
|
// prevent already started scroll, performance optimization
|
|
20884
21160
|
cancelScroll(dimension) {
|
|
20885
21161
|
var _a, _b;
|
|
20886
21162
|
(_b = (_a = this.preventArtificialScroll)[dimension]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
20887
21163
|
this.preventArtificialScroll[dimension] = null;
|
|
20888
21164
|
}
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
const from = [0, ((_a = param.virtualContentSize) !== null && _a !== void 0 ? _a : minRange) - minRange];
|
|
20894
|
-
const to = [0, param.contentSize - param.virtualSize];
|
|
20895
|
-
if (toReal) {
|
|
20896
|
-
return scaleValue(pos, from, to);
|
|
21165
|
+
toLogicalScrollCoordinate(coordinate, dimension, param, delta) {
|
|
21166
|
+
const scrollDimension = param.scrollDimension;
|
|
21167
|
+
if (!scrollDimension) {
|
|
21168
|
+
return coordinate;
|
|
20897
21169
|
}
|
|
20898
|
-
|
|
21170
|
+
if (typeof delta === 'number' && scrollDimension.isCompressed) {
|
|
21171
|
+
const base = this.previousScroll[dimension] === NO_COORDINATE
|
|
21172
|
+
? scrollDimension.toLogicalCoordinate(coordinate - delta)
|
|
21173
|
+
: this.previousLogicalScroll[dimension];
|
|
21174
|
+
return scrollDimension.toLogicalCoordinate(scrollDimension.toPhysicalCoordinate(base + delta));
|
|
21175
|
+
}
|
|
21176
|
+
return scrollDimension.toLogicalCoordinate(coordinate);
|
|
21177
|
+
}
|
|
21178
|
+
toPhysicalCoordinate(coordinate, param) {
|
|
21179
|
+
var _a, _b;
|
|
21180
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toPhysicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
21181
|
+
}
|
|
21182
|
+
toLogicalCoordinate(coordinate, param) {
|
|
21183
|
+
var _a, _b;
|
|
21184
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toLogicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
20899
21185
|
}
|
|
20900
21186
|
}
|
|
20901
21187
|
|
|
@@ -21053,15 +21339,9 @@ class RevogrScrollVirtual {
|
|
|
21053
21339
|
*/
|
|
21054
21340
|
async changeScroll(e) {
|
|
21055
21341
|
if (e.delta) {
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
break;
|
|
21060
|
-
case 'rgRow':
|
|
21061
|
-
e.coordinate = this.element.scrollTop + e.delta;
|
|
21062
|
-
break;
|
|
21063
|
-
}
|
|
21064
|
-
this.setScroll(e);
|
|
21342
|
+
const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
21343
|
+
const currentPhysicalCoordinate = this.element[scrollProperty];
|
|
21344
|
+
return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
|
|
21065
21345
|
}
|
|
21066
21346
|
return e;
|
|
21067
21347
|
}
|
|
@@ -21124,7 +21404,7 @@ class RevogrScrollVirtual {
|
|
|
21124
21404
|
}
|
|
21125
21405
|
render() {
|
|
21126
21406
|
const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
|
|
21127
|
-
return (hAsync(Host, { key: '
|
|
21407
|
+
return (hAsync(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
|
|
21128
21408
|
[this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
|
|
21129
21409
|
} })));
|
|
21130
21410
|
}
|
|
@@ -21233,7 +21513,7 @@ class RevogrViewportScroll {
|
|
|
21233
21513
|
* @param e
|
|
21234
21514
|
*/
|
|
21235
21515
|
async changeScroll(e, silent = false) {
|
|
21236
|
-
var _a, _b;
|
|
21516
|
+
var _a, _b, _c, _d;
|
|
21237
21517
|
if (silent) {
|
|
21238
21518
|
if (e.coordinate && this.verticalScroll) {
|
|
21239
21519
|
switch (e.dimension) {
|
|
@@ -21246,15 +21526,16 @@ class RevogrViewportScroll {
|
|
|
21246
21526
|
return;
|
|
21247
21527
|
}
|
|
21248
21528
|
if (e.delta) {
|
|
21529
|
+
let currentPhysicalCoordinate = 0;
|
|
21249
21530
|
switch (e.dimension) {
|
|
21250
21531
|
case 'rgCol':
|
|
21251
|
-
|
|
21532
|
+
currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
|
|
21252
21533
|
break;
|
|
21253
21534
|
case 'rgRow':
|
|
21254
|
-
|
|
21535
|
+
currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
|
|
21255
21536
|
break;
|
|
21256
21537
|
}
|
|
21257
|
-
this.
|
|
21538
|
+
return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
|
|
21258
21539
|
}
|
|
21259
21540
|
return e;
|
|
21260
21541
|
}
|
|
@@ -21406,7 +21687,10 @@ class RevogrViewportScroll {
|
|
|
21406
21687
|
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21407
21688
|
}
|
|
21408
21689
|
render() {
|
|
21409
|
-
|
|
21690
|
+
var _a, _b, _c, _d;
|
|
21691
|
+
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
21692
|
+
const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
21693
|
+
return (hAsync(Host, { key: 'a0c47dede9d131dea8c8ca449e8a323f24d9b113', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '6c960e753ffe522ba4afb1c379264873b6c617f3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, hAsync("div", { key: '1a6cbcbd3634e84756b54c8150aebd25c824e14a', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: 'e4202c687bc39b4f78f3ed9840e979b032f06af8', name: HEADER_SLOT })), hAsync("div", { key: '651415b5b32e72735065b183317386a34042bb85', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'e65623b78d80957d8676adb019618953ef267ec3', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, hAsync("slot", { key: '5af47b12ef1226587cf774233447b5252d65e836', name: CONTENT_SLOT }))), hAsync("div", { key: 'cbc0fd64fbfb53d3b18e547bbe34e32b7bb9c043', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'a8e4bfaef400973121090bac3069eb85469a95f3', name: FOOTER_SLOT })))));
|
|
21410
21694
|
}
|
|
21411
21695
|
/**
|
|
21412
21696
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|