@revolist/revogrid 4.22.0 → 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-uZmDBXz7.js → cell-renderer-DWJ9Px9f.js} +9 -3
- package/dist/cjs/{column.drag.plugin-CM_5mKV3.js → column.drag.plugin-CaEBDG-Q.js} +409 -267
- package/dist/cjs/{column.service-DvQDqxxx.js → column.service-f612L4ql.js} +1 -1
- package/dist/cjs/{dimension.helpers-CaIsYC99.js → dimension.helpers-B9HgANnM.js} +14 -146
- package/dist/cjs/{edit.utils-CwMzSIVF.js → edit.utils-pKeiYFLJ.js} +22 -1
- package/dist/cjs/{header-cell-renderer-B1dJwgTO.js → header-cell-renderer-4yq9_WbM.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +45 -31
- package/dist/cjs/revo-grid.cjs.entry.js +35 -15
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +44 -26
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -9
- package/dist/cjs/revogr-data_4.cjs.entry.js +132 -178
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-BTnGaIl3.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CI4MsAqs.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-Dcjud-a-.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/clipboard/revogr-clipboard.js +1 -1
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +2 -1
- package/dist/collection/components/header/header-renderer.js +6 -5
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +105 -42
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +25 -3
- 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 +18 -15
- 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/types/events.js +4 -0
- package/dist/collection/utils/key.utils.js +20 -0
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-K_BKH7Kx.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/esm/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
- package/dist/esm/{column.service-Cdz3dYqZ.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-DzxqJQqN.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
- package/dist/{revo-grid/header-cell-renderer-DXhxZMly.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +15 -10
- package/dist/esm/revo-grid.entry.js +34 -14
- package/dist/esm/revogr-attribution_7.entry.js +43 -25
- package/dist/esm/revogr-clipboard_3.entry.js +12 -10
- package/dist/esm/revogr-data_4.entry.js +133 -179
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-saAZJHRo.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-K_BKH7Kx.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
- package/dist/revo-grid/{column.service-Cdz3dYqZ.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-DzxqJQqN.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
- package/dist/{esm/header-cell-renderer-DXhxZMly.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 +15 -10
- package/dist/revo-grid/revo-grid.entry.js +34 -14
- package/dist/revo-grid/revogr-attribution_7.entry.js +43 -25
- package/dist/revo-grid/revogr-clipboard_3.entry.js +12 -10
- package/dist/revo-grid/revogr-data_4.entry.js +133 -179
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-saAZJHRo.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/header/revogr-header.d.ts +6 -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/moveColumn/column.drag.plugin.d.ts +29 -3
- 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/events.d.ts +1 -1
- package/dist/types/types/interfaces.d.ts +11 -0
- package/dist/types/utils/key.utils.d.ts +8 -0
- package/hydrate/index.js +791 -539
- package/hydrate/index.mjs +791 -539
- 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-clipboard2.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-edit.js +1 -1
- package/standalone/revogr-edit2.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.js
CHANGED
|
@@ -6800,8 +6800,8 @@ class Clipboard {
|
|
|
6800
6800
|
return;
|
|
6801
6801
|
}
|
|
6802
6802
|
const data = this.getData(beforeCopy.detail.event);
|
|
6803
|
-
this.copyRegion.emit(data || undefined);
|
|
6804
6803
|
e.preventDefault();
|
|
6804
|
+
this.copyRegion.emit(data || undefined);
|
|
6805
6805
|
}
|
|
6806
6806
|
/**
|
|
6807
6807
|
* Listen to copy event and emit copy region event
|
|
@@ -7646,7 +7646,8 @@ class FilterPanel {
|
|
|
7646
7646
|
const options = [];
|
|
7647
7647
|
const prop = this.changes.prop;
|
|
7648
7648
|
const hidden = new Set();
|
|
7649
|
-
Object.
|
|
7649
|
+
Object.keys(this.filterItems).forEach((prop) => {
|
|
7650
|
+
const values = this.filterItems[prop];
|
|
7650
7651
|
values.forEach((filter) => {
|
|
7651
7652
|
if (filter.hidden) {
|
|
7652
7653
|
hidden.add(filter.type);
|
|
@@ -8729,11 +8730,11 @@ var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
|
8729
8730
|
var boolTag$1 = '[object Boolean]',
|
|
8730
8731
|
dateTag$1 = '[object Date]',
|
|
8731
8732
|
errorTag$1 = '[object Error]',
|
|
8732
|
-
mapTag$
|
|
8733
|
+
mapTag$2 = '[object Map]',
|
|
8733
8734
|
numberTag$1 = '[object Number]',
|
|
8734
8735
|
regexpTag$1 = '[object RegExp]',
|
|
8735
|
-
setTag$
|
|
8736
|
-
stringTag$
|
|
8736
|
+
setTag$2 = '[object Set]',
|
|
8737
|
+
stringTag$1 = '[object String]',
|
|
8737
8738
|
symbolTag = '[object Symbol]';
|
|
8738
8739
|
|
|
8739
8740
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
@@ -8788,16 +8789,16 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
8788
8789
|
return object.name == other.name && object.message == other.message;
|
|
8789
8790
|
|
|
8790
8791
|
case regexpTag$1:
|
|
8791
|
-
case stringTag$
|
|
8792
|
+
case stringTag$1:
|
|
8792
8793
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
8793
8794
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
8794
8795
|
// for more details.
|
|
8795
8796
|
return object == (other + '');
|
|
8796
8797
|
|
|
8797
|
-
case mapTag$
|
|
8798
|
+
case mapTag$2:
|
|
8798
8799
|
var convert = mapToArray;
|
|
8799
8800
|
|
|
8800
|
-
case setTag$
|
|
8801
|
+
case setTag$2:
|
|
8801
8802
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
8802
8803
|
convert || (convert = setToArray);
|
|
8803
8804
|
|
|
@@ -9138,12 +9139,12 @@ var argsTag$1 = '[object Arguments]',
|
|
|
9138
9139
|
dateTag = '[object Date]',
|
|
9139
9140
|
errorTag = '[object Error]',
|
|
9140
9141
|
funcTag = '[object Function]',
|
|
9141
|
-
mapTag$
|
|
9142
|
+
mapTag$1 = '[object Map]',
|
|
9142
9143
|
numberTag = '[object Number]',
|
|
9143
9144
|
objectTag$2 = '[object Object]',
|
|
9144
9145
|
regexpTag = '[object RegExp]',
|
|
9145
|
-
setTag$
|
|
9146
|
-
stringTag
|
|
9146
|
+
setTag$1 = '[object Set]',
|
|
9147
|
+
stringTag = '[object String]',
|
|
9147
9148
|
weakMapTag$1 = '[object WeakMap]';
|
|
9148
9149
|
|
|
9149
9150
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
@@ -9169,9 +9170,9 @@ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
|
9169
9170
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
9170
9171
|
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
|
|
9171
9172
|
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
9172
|
-
typedArrayTags[mapTag$
|
|
9173
|
+
typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
|
|
9173
9174
|
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
|
|
9174
|
-
typedArrayTags[setTag$
|
|
9175
|
+
typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
|
|
9175
9176
|
typedArrayTags[weakMapTag$1] = false;
|
|
9176
9177
|
|
|
9177
9178
|
/**
|
|
@@ -9521,10 +9522,10 @@ var Set$1 = getNative(root, 'Set');
|
|
|
9521
9522
|
var WeakMap$1 = getNative(root, 'WeakMap');
|
|
9522
9523
|
|
|
9523
9524
|
/** `Object#toString` result references. */
|
|
9524
|
-
var mapTag
|
|
9525
|
+
var mapTag = '[object Map]',
|
|
9525
9526
|
objectTag$1 = '[object Object]',
|
|
9526
9527
|
promiseTag = '[object Promise]',
|
|
9527
|
-
setTag
|
|
9528
|
+
setTag = '[object Set]',
|
|
9528
9529
|
weakMapTag = '[object WeakMap]';
|
|
9529
9530
|
|
|
9530
9531
|
var dataViewTag = '[object DataView]';
|
|
@@ -9547,9 +9548,9 @@ var getTag = baseGetTag;
|
|
|
9547
9548
|
|
|
9548
9549
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
9549
9550
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
9550
|
-
(Map$1 && getTag(new Map$1) != mapTag
|
|
9551
|
+
(Map$1 && getTag(new Map$1) != mapTag) ||
|
|
9551
9552
|
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
9552
|
-
(Set$1 && getTag(new Set$1) != setTag
|
|
9553
|
+
(Set$1 && getTag(new Set$1) != setTag) ||
|
|
9553
9554
|
(WeakMap$1 && getTag(new WeakMap$1) != weakMapTag)) {
|
|
9554
9555
|
getTag = function(value) {
|
|
9555
9556
|
var result = baseGetTag(value),
|
|
@@ -9559,9 +9560,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
9559
9560
|
if (ctorString) {
|
|
9560
9561
|
switch (ctorString) {
|
|
9561
9562
|
case dataViewCtorString: return dataViewTag;
|
|
9562
|
-
case mapCtorString: return mapTag
|
|
9563
|
+
case mapCtorString: return mapTag;
|
|
9563
9564
|
case promiseCtorString: return promiseTag;
|
|
9564
|
-
case setCtorString: return setTag
|
|
9565
|
+
case setCtorString: return setTag;
|
|
9565
9566
|
case weakMapCtorString: return weakMapTag;
|
|
9566
9567
|
}
|
|
9567
9568
|
}
|
|
@@ -10825,9 +10826,9 @@ function gatherTrimmedItems(trimmedItems) {
|
|
|
10825
10826
|
* @param data - The data to set on the store.
|
|
10826
10827
|
*/
|
|
10827
10828
|
function setStore(store, data) {
|
|
10828
|
-
Object.
|
|
10829
|
-
store.set(key,
|
|
10830
|
-
}
|
|
10829
|
+
for (const key of Object.keys(data)) {
|
|
10830
|
+
store.set(key, data[key]);
|
|
10831
|
+
}
|
|
10831
10832
|
}
|
|
10832
10833
|
|
|
10833
10834
|
/**
|
|
@@ -11289,6 +11290,26 @@ function isAll(event) {
|
|
|
11289
11290
|
return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
|
|
11290
11291
|
(event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
|
|
11291
11292
|
}
|
|
11293
|
+
/**
|
|
11294
|
+
* Returns true when a keyboard event represents a shortcut modifier that
|
|
11295
|
+
* should not start cell editing from printable `event.key` input.
|
|
11296
|
+
*
|
|
11297
|
+
* AltGr is intentionally excluded because many Windows/Linux layouts expose
|
|
11298
|
+
* printable AltGr characters as Ctrl+Alt key events.
|
|
11299
|
+
*/
|
|
11300
|
+
function isShortcutModifier(event) {
|
|
11301
|
+
var _a;
|
|
11302
|
+
if ((_a = event.getModifierState) === null || _a === void 0 ? void 0 : _a.call(event, 'AltGraph')) {
|
|
11303
|
+
return false;
|
|
11304
|
+
}
|
|
11305
|
+
if (event.ctrlKey &&
|
|
11306
|
+
event.altKey &&
|
|
11307
|
+
!event.metaKey &&
|
|
11308
|
+
event.key.length === 1) {
|
|
11309
|
+
return false;
|
|
11310
|
+
}
|
|
11311
|
+
return event.ctrlKey || event.metaKey;
|
|
11312
|
+
}
|
|
11292
11313
|
|
|
11293
11314
|
const LETTER_BLOCK_SIZE$1 = 10;
|
|
11294
11315
|
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
@@ -11318,21 +11339,6 @@ function getScrollbarSize(document) {
|
|
|
11318
11339
|
// Return the calculated width of the scrollbar
|
|
11319
11340
|
return scrollbarWidth;
|
|
11320
11341
|
}
|
|
11321
|
-
/* Scale a value between 2 ranges
|
|
11322
|
-
*
|
|
11323
|
-
* Sample:
|
|
11324
|
-
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
11325
|
-
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
11326
|
-
*
|
|
11327
|
-
* Ranges of two values
|
|
11328
|
-
* @from
|
|
11329
|
-
* @to
|
|
11330
|
-
*
|
|
11331
|
-
* ~~ return value does the equivalent of Math.floor but faster.
|
|
11332
|
-
*/
|
|
11333
|
-
function scaleValue(value, from, to) {
|
|
11334
|
-
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
11335
|
-
}
|
|
11336
11342
|
/**
|
|
11337
11343
|
* Async timeout
|
|
11338
11344
|
*/
|
|
@@ -11706,6 +11712,21 @@ function getItemByIndex(dimension, index) {
|
|
|
11706
11712
|
return item;
|
|
11707
11713
|
}
|
|
11708
11714
|
|
|
11715
|
+
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
11716
|
+
const safeCount = Math.max(0, count);
|
|
11717
|
+
let realSize = safeCount * originItemSize;
|
|
11718
|
+
for (let index in sizes) {
|
|
11719
|
+
const itemIndex = Number(index);
|
|
11720
|
+
if (!Number.isInteger(itemIndex) ||
|
|
11721
|
+
itemIndex < 0 ||
|
|
11722
|
+
itemIndex >= safeCount ||
|
|
11723
|
+
String(itemIndex) !== index) {
|
|
11724
|
+
continue;
|
|
11725
|
+
}
|
|
11726
|
+
realSize += sizes[index] - originItemSize;
|
|
11727
|
+
}
|
|
11728
|
+
return realSize;
|
|
11729
|
+
}
|
|
11709
11730
|
/**
|
|
11710
11731
|
* Plugin which recalculates realSize on changes of sizes, originItemSize and count
|
|
11711
11732
|
*/
|
|
@@ -11718,20 +11739,18 @@ const recalculateRealSizePlugin = (storeService) => {
|
|
|
11718
11739
|
* Reacts on changes of count, sizes and originItemSize
|
|
11719
11740
|
*/
|
|
11720
11741
|
set(k) {
|
|
11721
|
-
var _a;
|
|
11722
11742
|
switch (k) {
|
|
11723
11743
|
case 'count':
|
|
11724
11744
|
case 'sizes':
|
|
11725
11745
|
case 'originItemSize': {
|
|
11726
11746
|
// recalculate realSize
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
}
|
|
11734
|
-
storeService.setStore({ realSize });
|
|
11747
|
+
storeService.setStore({
|
|
11748
|
+
realSize: calculateRealSize({
|
|
11749
|
+
count: storeService.store.get('count'),
|
|
11750
|
+
sizes: storeService.store.get('sizes'),
|
|
11751
|
+
originItemSize: storeService.store.get('originItemSize'),
|
|
11752
|
+
}),
|
|
11753
|
+
});
|
|
11735
11754
|
break;
|
|
11736
11755
|
}
|
|
11737
11756
|
}
|
|
@@ -11821,7 +11840,9 @@ function initialState$1() {
|
|
|
11821
11840
|
// size which all items can take
|
|
11822
11841
|
realSize: 0,
|
|
11823
11842
|
// initial item size if it wasn't changed
|
|
11824
|
-
originItemSize: 0
|
|
11843
|
+
originItemSize: 0,
|
|
11844
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
11845
|
+
renderOffset: 0
|
|
11825
11846
|
});
|
|
11826
11847
|
}
|
|
11827
11848
|
class DimensionStore {
|
|
@@ -11853,7 +11874,7 @@ class DimensionStore {
|
|
|
11853
11874
|
setStore(this.store, data);
|
|
11854
11875
|
}
|
|
11855
11876
|
drop() {
|
|
11856
|
-
setStore(this.store, initialBase());
|
|
11877
|
+
setStore(this.store, Object.assign(Object.assign({}, initialBase()), { renderOffset: 0 }));
|
|
11857
11878
|
}
|
|
11858
11879
|
/**
|
|
11859
11880
|
* Set custom dimension sizes and overwrite old
|
|
@@ -12024,6 +12045,15 @@ function isRangeSingleCell(a) {
|
|
|
12024
12045
|
return a.x === a.x1 && a.y === a.y1;
|
|
12025
12046
|
}
|
|
12026
12047
|
|
|
12048
|
+
function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
12049
|
+
if (!viewportSize || dimension.realSize <= viewportSize) {
|
|
12050
|
+
return 0;
|
|
12051
|
+
}
|
|
12052
|
+
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
12053
|
+
}
|
|
12054
|
+
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
12055
|
+
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
12056
|
+
}
|
|
12027
12057
|
/**
|
|
12028
12058
|
* Update items based on new scroll position
|
|
12029
12059
|
* If viewport wasn't changed fully simple recombination of positions
|
|
@@ -12289,6 +12319,8 @@ function initialState() {
|
|
|
12289
12319
|
realCount: 0,
|
|
12290
12320
|
// size of viewport in px
|
|
12291
12321
|
clientSize: 0,
|
|
12322
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
12323
|
+
renderOffset: 0,
|
|
12292
12324
|
};
|
|
12293
12325
|
}
|
|
12294
12326
|
/**
|
|
@@ -12324,21 +12356,8 @@ class ViewportStore {
|
|
|
12324
12356
|
const outsize = singleOffsetInPx * 2;
|
|
12325
12357
|
// math virtual size is based on visible area + 2 items outside of visible area
|
|
12326
12358
|
const virtualSize = viewportSize + outsize;
|
|
12327
|
-
|
|
12328
|
-
let
|
|
12329
|
-
// if there is nodes outside of viewport, max coordinate has to be adjusted
|
|
12330
|
-
if (dimension.realSize > viewportSize) {
|
|
12331
|
-
// max coordinate is real size minus virtual/rendered space
|
|
12332
|
-
maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
|
|
12333
|
-
}
|
|
12334
|
-
let pos = position;
|
|
12335
|
-
// limit position to max and min coordinates
|
|
12336
|
-
if (pos < 0) {
|
|
12337
|
-
pos = 0;
|
|
12338
|
-
}
|
|
12339
|
-
else if (pos > maxCoordinate) {
|
|
12340
|
-
pos = maxCoordinate;
|
|
12341
|
-
}
|
|
12359
|
+
const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
|
|
12360
|
+
let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
|
|
12342
12361
|
// store last coordinate for further restore on redraw
|
|
12343
12362
|
this.lastCoordinate = pos;
|
|
12344
12363
|
// actual position is less than first item start based on offset
|
|
@@ -12475,11 +12494,12 @@ class RowOrderService {
|
|
|
12475
12494
|
getRow(y, { el, rows }) {
|
|
12476
12495
|
const { top } = el.getBoundingClientRect();
|
|
12477
12496
|
const topRelative = y - top;
|
|
12478
|
-
const
|
|
12497
|
+
const rowOffset = rows.renderOffset || 0;
|
|
12498
|
+
const rgRow = getItemByPosition(rows, topRelative + rowOffset);
|
|
12479
12499
|
const absolutePosition = {
|
|
12480
12500
|
itemIndex: rgRow.itemIndex,
|
|
12481
|
-
start: rgRow.start + top,
|
|
12482
|
-
end: rgRow.end + top,
|
|
12501
|
+
start: rgRow.start - rowOffset + top,
|
|
12502
|
+
end: rgRow.end - rowOffset + top,
|
|
12483
12503
|
};
|
|
12484
12504
|
return absolutePosition;
|
|
12485
12505
|
}
|
|
@@ -12488,8 +12508,8 @@ class RowOrderService {
|
|
|
12488
12508
|
const { top, left } = el.getBoundingClientRect();
|
|
12489
12509
|
const topRelative = y - top;
|
|
12490
12510
|
const leftRelative = x - left;
|
|
12491
|
-
const rgRow = getItemByPosition(rows, topRelative);
|
|
12492
|
-
const rgCol = getItemByPosition(cols, leftRelative);
|
|
12511
|
+
const rgRow = getItemByPosition(rows, topRelative + (rows.renderOffset || 0));
|
|
12512
|
+
const rgCol = getItemByPosition(cols, leftRelative + (cols.renderOffset || 0));
|
|
12493
12513
|
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
12494
12514
|
}
|
|
12495
12515
|
}
|
|
@@ -13225,8 +13245,8 @@ function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
|
13225
13245
|
cellX = width - 1;
|
|
13226
13246
|
}
|
|
13227
13247
|
// Get the row and column items based on the cell position
|
|
13228
|
-
const rgRow = getItemByPosition(rows, cellY);
|
|
13229
|
-
const rgCol = getItemByPosition(cols, cellX);
|
|
13248
|
+
const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
|
|
13249
|
+
const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
|
|
13230
13250
|
// Set the row and column index to 0 if they are before the first item
|
|
13231
13251
|
if (rgCol.itemIndex < 0) {
|
|
13232
13252
|
rgCol.itemIndex = 0;
|
|
@@ -13296,10 +13316,12 @@ function styleByCellProps(styles) {
|
|
|
13296
13316
|
};
|
|
13297
13317
|
}
|
|
13298
13318
|
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
13299
|
-
const
|
|
13300
|
-
const
|
|
13301
|
-
const
|
|
13302
|
-
const
|
|
13319
|
+
const rowOffset = dimensionRow.renderOffset || 0;
|
|
13320
|
+
const colOffset = dimensionCol.renderOffset || 0;
|
|
13321
|
+
const top = getItemByIndex(dimensionRow, y).start - rowOffset;
|
|
13322
|
+
const left = getItemByIndex(dimensionCol, x).start - colOffset;
|
|
13323
|
+
const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
|
|
13324
|
+
const right = getItemByIndex(dimensionCol, x1).end - colOffset;
|
|
13303
13325
|
return {
|
|
13304
13326
|
left,
|
|
13305
13327
|
right,
|
|
@@ -13330,9 +13352,29 @@ class KeyboardService {
|
|
|
13330
13352
|
constructor(sv) {
|
|
13331
13353
|
this.sv = sv;
|
|
13332
13354
|
}
|
|
13355
|
+
/**
|
|
13356
|
+
* Appends printable key input that arrives after edit mode was requested
|
|
13357
|
+
* but before the editor input has mounted or received focus.
|
|
13358
|
+
*/
|
|
13359
|
+
appendPendingEditValue(e) {
|
|
13360
|
+
if (isShortcutModifier(e) ||
|
|
13361
|
+
e.key.length !== 1 ||
|
|
13362
|
+
(e.target instanceof HTMLElement && isEditInput(e.target))) {
|
|
13363
|
+
return false;
|
|
13364
|
+
}
|
|
13365
|
+
const editCell = this.sv.selectionStore.get('edit');
|
|
13366
|
+
if (typeof (editCell === null || editCell === void 0 ? void 0 : editCell.val) !== 'string') {
|
|
13367
|
+
return false;
|
|
13368
|
+
}
|
|
13369
|
+
this.sv.selectionStore.set('edit', Object.assign(Object.assign({}, editCell), { val: `${editCell.val}${e.key}` }));
|
|
13370
|
+
return true;
|
|
13371
|
+
}
|
|
13333
13372
|
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
13334
13373
|
// IF EDIT MODE
|
|
13335
13374
|
if (isEditMode) {
|
|
13375
|
+
if (this.appendPendingEditValue(e)) {
|
|
13376
|
+
return;
|
|
13377
|
+
}
|
|
13336
13378
|
switch (e.code) {
|
|
13337
13379
|
case codesLetter.ESCAPE:
|
|
13338
13380
|
this.sv.cancel();
|
|
@@ -13384,7 +13426,7 @@ class KeyboardService {
|
|
|
13384
13426
|
return;
|
|
13385
13427
|
}
|
|
13386
13428
|
// pressed letter key
|
|
13387
|
-
if (e.key.length === 1) {
|
|
13429
|
+
if (!isShortcutModifier(e) && e.key.length === 1) {
|
|
13388
13430
|
this.sv.change(e.key);
|
|
13389
13431
|
return;
|
|
13390
13432
|
}
|
|
@@ -13426,7 +13468,8 @@ class KeyboardService {
|
|
|
13426
13468
|
}
|
|
13427
13469
|
const eData = this.sv.getData();
|
|
13428
13470
|
if (isMulti) {
|
|
13429
|
-
|
|
13471
|
+
const isOutOfBounds = [data.start, data.end].some(cell => isAfterLast(cell, eData.lastCell) || isBeforeFirst(cell));
|
|
13472
|
+
if (isOutOfBounds) {
|
|
13430
13473
|
return false;
|
|
13431
13474
|
}
|
|
13432
13475
|
const range = getRange(data.start, data.end);
|
|
@@ -14668,6 +14711,87 @@ class DataProvider {
|
|
|
14668
14711
|
}
|
|
14669
14712
|
}
|
|
14670
14713
|
|
|
14714
|
+
const FALLBACK_MAX_SCROLL_SIZE = 16000000;
|
|
14715
|
+
const SCROLL_SIZE_GUARD = 1000000;
|
|
14716
|
+
let detectedMaxScrollSize;
|
|
14717
|
+
function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
|
|
14718
|
+
if (typeof detectedMaxScrollSize === 'number') {
|
|
14719
|
+
return detectedMaxScrollSize;
|
|
14720
|
+
}
|
|
14721
|
+
const body = doc === null || doc === void 0 ? void 0 : doc.body;
|
|
14722
|
+
if (body) {
|
|
14723
|
+
const ownerDocument = body.ownerDocument;
|
|
14724
|
+
const element = ownerDocument.createElement('div');
|
|
14725
|
+
element.style.cssText = [
|
|
14726
|
+
'height:1px',
|
|
14727
|
+
'left:-10000px',
|
|
14728
|
+
'overflow:scroll',
|
|
14729
|
+
'position:absolute',
|
|
14730
|
+
'top:-10000px',
|
|
14731
|
+
'visibility:hidden',
|
|
14732
|
+
'width:1px',
|
|
14733
|
+
].join(';');
|
|
14734
|
+
const content = ownerDocument.createElement('div');
|
|
14735
|
+
content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
|
|
14736
|
+
element.appendChild(content);
|
|
14737
|
+
body.appendChild(element);
|
|
14738
|
+
detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
|
|
14739
|
+
element.remove();
|
|
14740
|
+
if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
|
|
14741
|
+
return detectedMaxScrollSize;
|
|
14742
|
+
}
|
|
14743
|
+
detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
|
|
14744
|
+
return detectedMaxScrollSize;
|
|
14745
|
+
}
|
|
14746
|
+
return FALLBACK_MAX_SCROLL_SIZE;
|
|
14747
|
+
}
|
|
14748
|
+
function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
|
|
14749
|
+
const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
|
|
14750
|
+
const size = Math.max(0, contentSize);
|
|
14751
|
+
const client = Math.max(0, clientSize);
|
|
14752
|
+
const viewport = Math.max(0, virtualSize || client);
|
|
14753
|
+
const logicalScrollSize = Math.max(0, size - viewport);
|
|
14754
|
+
const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
|
|
14755
|
+
const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
|
|
14756
|
+
const physicalContentSize = client + physicalScrollSize;
|
|
14757
|
+
const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
|
|
14758
|
+
const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
|
|
14759
|
+
const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
|
|
14760
|
+
const toLogicalCoordinate = (coordinate) => {
|
|
14761
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
14762
|
+
return 0;
|
|
14763
|
+
}
|
|
14764
|
+
if (!isCompressed) {
|
|
14765
|
+
return clampLogical(coordinate);
|
|
14766
|
+
}
|
|
14767
|
+
return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
|
|
14768
|
+
};
|
|
14769
|
+
const toPhysicalCoordinate = (coordinate) => {
|
|
14770
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
14771
|
+
return 0;
|
|
14772
|
+
}
|
|
14773
|
+
if (!isCompressed) {
|
|
14774
|
+
return clampPhysical(coordinate);
|
|
14775
|
+
}
|
|
14776
|
+
return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
|
|
14777
|
+
};
|
|
14778
|
+
return {
|
|
14779
|
+
contentSize: size,
|
|
14780
|
+
clientSize: client,
|
|
14781
|
+
viewportSize: viewport,
|
|
14782
|
+
physicalContentSize,
|
|
14783
|
+
logicalScrollSize,
|
|
14784
|
+
physicalScrollSize,
|
|
14785
|
+
isCompressed,
|
|
14786
|
+
toLogicalCoordinate,
|
|
14787
|
+
toPhysicalCoordinate,
|
|
14788
|
+
getRenderOffset(coordinate) {
|
|
14789
|
+
const logical = clampLogical(coordinate);
|
|
14790
|
+
return logical - toPhysicalCoordinate(logical);
|
|
14791
|
+
},
|
|
14792
|
+
};
|
|
14793
|
+
}
|
|
14794
|
+
|
|
14671
14795
|
/**
|
|
14672
14796
|
* Dimension provider
|
|
14673
14797
|
* Stores dimension information and custom sizes
|
|
@@ -14805,6 +14929,20 @@ class DimensionProvider {
|
|
|
14805
14929
|
}
|
|
14806
14930
|
setViewPortCoordinate({ type, coordinate = this.viewports.stores[type].lastCoordinate, force = false, }) {
|
|
14807
14931
|
const dimension = this.stores[type].getCurrentState();
|
|
14932
|
+
const viewport = this.viewports.stores[type].store;
|
|
14933
|
+
const clientSize = viewport.get('clientSize');
|
|
14934
|
+
const viewportSize = viewport.get('virtualSize');
|
|
14935
|
+
const scrollDimension = getScrollDimension({
|
|
14936
|
+
contentSize: dimension.realSize,
|
|
14937
|
+
clientSize,
|
|
14938
|
+
virtualSize: viewportSize,
|
|
14939
|
+
});
|
|
14940
|
+
const renderCoordinate = clampViewportCoordinate(coordinate, dimension, viewportSize);
|
|
14941
|
+
const renderOffset = clientSize && viewportSize
|
|
14942
|
+
? scrollDimension.getRenderOffset(renderCoordinate)
|
|
14943
|
+
: 0;
|
|
14944
|
+
this.stores[type].setStore({ renderOffset });
|
|
14945
|
+
this.viewports.stores[type].setViewport({ renderOffset });
|
|
14808
14946
|
this.viewports.stores[type].setViewPortCoordinate(coordinate, dimension, force);
|
|
14809
14947
|
}
|
|
14810
14948
|
getViewPortPos(e) {
|
|
@@ -15501,17 +15639,24 @@ class FilterPlugin extends BasePlugin {
|
|
|
15501
15639
|
}
|
|
15502
15640
|
}
|
|
15503
15641
|
if (config.collection) {
|
|
15504
|
-
const
|
|
15505
|
-
|
|
15642
|
+
const filterCollection = {};
|
|
15643
|
+
for (const prop of Object.keys(config.collection)) {
|
|
15644
|
+
const item = config.collection[prop];
|
|
15645
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
15646
|
+
filterCollection[prop] = item;
|
|
15647
|
+
}
|
|
15648
|
+
}
|
|
15649
|
+
this.filterCollection = filterCollection;
|
|
15506
15650
|
}
|
|
15507
15651
|
else {
|
|
15508
15652
|
this.filterCollection = {};
|
|
15509
15653
|
}
|
|
15510
15654
|
if (config.localization) {
|
|
15511
15655
|
if (config.localization.filterNames) {
|
|
15512
|
-
|
|
15656
|
+
const filterNames = config.localization.filterNames;
|
|
15657
|
+
Object.keys(filterNames).forEach((k) => {
|
|
15513
15658
|
if (this.filterNameIndexByType[k] != void 0) {
|
|
15514
|
-
this.filterNameIndexByType[k] =
|
|
15659
|
+
this.filterNameIndexByType[k] = filterNames[k];
|
|
15515
15660
|
}
|
|
15516
15661
|
});
|
|
15517
15662
|
}
|
|
@@ -15741,165 +15886,174 @@ function allAndConditionsSatisfied(pendingResults) {
|
|
|
15741
15886
|
return !pendingResults.includes(true);
|
|
15742
15887
|
}
|
|
15743
15888
|
|
|
15744
|
-
/** `Object#toString` result references. */
|
|
15745
|
-
var stringTag = '[object String]';
|
|
15746
|
-
|
|
15747
15889
|
/**
|
|
15748
|
-
* Checks
|
|
15890
|
+
* Checks whether a sorting map contains at least one active order.
|
|
15749
15891
|
*
|
|
15750
|
-
*
|
|
15751
|
-
* @since 0.1.0
|
|
15752
|
-
* @memberOf _
|
|
15753
|
-
* @category Lang
|
|
15754
|
-
* @param {*} value The value to check.
|
|
15755
|
-
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
|
15756
|
-
* @example
|
|
15757
|
-
*
|
|
15758
|
-
* _.isString('abc');
|
|
15759
|
-
* // => true
|
|
15760
|
-
*
|
|
15761
|
-
* _.isString(1);
|
|
15762
|
-
* // => false
|
|
15892
|
+
* Empty maps and properties with `undefined` order are treated as inactive.
|
|
15763
15893
|
*/
|
|
15764
|
-
function
|
|
15765
|
-
|
|
15766
|
-
|
|
15894
|
+
function hasActiveSorting(sorting) {
|
|
15895
|
+
for (const prop of Object.keys(sorting || {})) {
|
|
15896
|
+
if (sorting === null || sorting === void 0 ? void 0 : sorting[prop]) {
|
|
15897
|
+
return true;
|
|
15898
|
+
}
|
|
15899
|
+
}
|
|
15900
|
+
return false;
|
|
15767
15901
|
}
|
|
15768
|
-
|
|
15769
15902
|
/**
|
|
15770
|
-
*
|
|
15771
|
-
*
|
|
15772
|
-
* @private
|
|
15773
|
-
* @param {string} string The string inspect.
|
|
15774
|
-
* @returns {number} Returns the string size.
|
|
15903
|
+
* Compares column properties after object-key coercion.
|
|
15775
15904
|
*/
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
var rsAstralRange$1 = '\\ud800-\\udfff',
|
|
15780
|
-
rsComboMarksRange$1 = '\\u0300-\\u036f',
|
|
15781
|
-
reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f',
|
|
15782
|
-
rsComboSymbolsRange$1 = '\\u20d0-\\u20ff',
|
|
15783
|
-
rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1,
|
|
15784
|
-
rsVarRange$1 = '\\ufe0e\\ufe0f';
|
|
15785
|
-
|
|
15786
|
-
/** Used to compose unicode capture groups. */
|
|
15787
|
-
var rsZWJ$1 = '\\u200d';
|
|
15788
|
-
|
|
15789
|
-
/** 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/). */
|
|
15790
|
-
var reHasUnicode = RegExp('[' + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + ']');
|
|
15791
|
-
|
|
15905
|
+
function isSameColumnProp(a, b) {
|
|
15906
|
+
return String(a) === String(b);
|
|
15907
|
+
}
|
|
15792
15908
|
/**
|
|
15793
|
-
*
|
|
15794
|
-
*
|
|
15795
|
-
* @private
|
|
15796
|
-
* @param {string} string The string to inspect.
|
|
15797
|
-
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
|
15909
|
+
* Returns active sorting properties in explicit priority order.
|
|
15798
15910
|
*/
|
|
15799
|
-
function
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
/** Used to compose unicode capture groups. */
|
|
15812
|
-
var rsAstral = '[' + rsAstralRange + ']',
|
|
15813
|
-
rsCombo = '[' + rsComboRange + ']',
|
|
15814
|
-
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
15815
|
-
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
15816
|
-
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
15817
|
-
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
15818
|
-
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
15819
|
-
rsZWJ = '\\u200d';
|
|
15820
|
-
|
|
15821
|
-
/** Used to compose unicode regexes. */
|
|
15822
|
-
var reOptMod = rsModifier + '?',
|
|
15823
|
-
rsOptVar = '[' + rsVarRange + ']?',
|
|
15824
|
-
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
15825
|
-
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
15826
|
-
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
15827
|
-
|
|
15828
|
-
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
15829
|
-
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
15830
|
-
|
|
15911
|
+
function getActiveSortingProps(sorting, sortingOrder) {
|
|
15912
|
+
const activeProps = [];
|
|
15913
|
+
const add = (prop) => {
|
|
15914
|
+
if ((sorting === null || sorting === void 0 ? void 0 : sorting[prop]) && !activeProps.some(active => isSameColumnProp(active, prop))) {
|
|
15915
|
+
activeProps.push(prop);
|
|
15916
|
+
}
|
|
15917
|
+
};
|
|
15918
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
15919
|
+
Object.keys(sorting || {}).forEach(add);
|
|
15920
|
+
return activeProps;
|
|
15921
|
+
}
|
|
15831
15922
|
/**
|
|
15832
|
-
*
|
|
15923
|
+
* Returns one-based additive sorting rank for a column.
|
|
15833
15924
|
*
|
|
15834
|
-
*
|
|
15835
|
-
* @param {string} string The string inspect.
|
|
15836
|
-
* @returns {number} Returns the string size.
|
|
15925
|
+
* A single active sort does not need a visible rank, so it returns undefined.
|
|
15837
15926
|
*/
|
|
15838
|
-
function
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15927
|
+
function getSortingIndex(sorting, prop, sortingOrder) {
|
|
15928
|
+
const activeProps = getActiveSortingProps(sorting, sortingOrder);
|
|
15929
|
+
if (activeProps.length <= 1) {
|
|
15930
|
+
return undefined;
|
|
15931
|
+
}
|
|
15932
|
+
const index = activeProps.findIndex(active => isSameColumnProp(active, prop));
|
|
15933
|
+
return index >= 0 ? index + 1 : undefined;
|
|
15844
15934
|
}
|
|
15845
|
-
|
|
15846
15935
|
/**
|
|
15847
|
-
*
|
|
15936
|
+
* Collects only active comparator functions from a sorting function map.
|
|
15848
15937
|
*
|
|
15849
|
-
*
|
|
15850
|
-
* @param {string} string The string to inspect.
|
|
15851
|
-
* @returns {number} Returns the string size.
|
|
15938
|
+
* This keeps undefined comparator entries from triggering sorting work.
|
|
15852
15939
|
*/
|
|
15853
|
-
function
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15940
|
+
function activeSortingEntries(sortingFunc = {}, sortingOrder) {
|
|
15941
|
+
const entries = [];
|
|
15942
|
+
const add = (prop) => {
|
|
15943
|
+
const cmp = sortingFunc[prop];
|
|
15944
|
+
if (typeof cmp === 'function' && !entries.some(([active]) => isSameColumnProp(active, prop))) {
|
|
15945
|
+
entries.push([prop, cmp]);
|
|
15946
|
+
}
|
|
15947
|
+
};
|
|
15948
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
15949
|
+
Object.keys(sortingFunc).forEach(add);
|
|
15950
|
+
return entries;
|
|
15857
15951
|
}
|
|
15858
|
-
|
|
15859
|
-
/** `Object#toString` result references. */
|
|
15860
|
-
var mapTag = '[object Map]',
|
|
15861
|
-
setTag = '[object Set]';
|
|
15862
|
-
|
|
15863
15952
|
/**
|
|
15864
|
-
*
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
*
|
|
15875
|
-
|
|
15876
|
-
|
|
15953
|
+
* Reads and normalizes a value for the built-in default comparer.
|
|
15954
|
+
*/
|
|
15955
|
+
function getDefaultCompareValue(item, prop, column) {
|
|
15956
|
+
const aRaw = column ? getCellRaw(item, column) : item === null || item === void 0 ? void 0 : item[prop];
|
|
15957
|
+
return typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
15958
|
+
}
|
|
15959
|
+
function isEmptyCompareValue(value) {
|
|
15960
|
+
return value === '' || value === null || value === undefined;
|
|
15961
|
+
}
|
|
15962
|
+
/**
|
|
15963
|
+
* Compares two already-normalized default comparer values.
|
|
15964
|
+
*/
|
|
15965
|
+
function compareValues(av, bv) {
|
|
15966
|
+
if (av === bv) {
|
|
15967
|
+
return 0;
|
|
15968
|
+
}
|
|
15969
|
+
const aEmpty = isEmptyCompareValue(av);
|
|
15970
|
+
const bEmpty = isEmptyCompareValue(bv);
|
|
15971
|
+
if (aEmpty || bEmpty) {
|
|
15972
|
+
if (aEmpty && bEmpty) {
|
|
15973
|
+
return 0;
|
|
15974
|
+
}
|
|
15975
|
+
return aEmpty ? -1 : 1;
|
|
15976
|
+
}
|
|
15977
|
+
if (av > bv) {
|
|
15978
|
+
return 1;
|
|
15979
|
+
}
|
|
15980
|
+
return -1;
|
|
15981
|
+
}
|
|
15982
|
+
/**
|
|
15983
|
+
* Sorts indexes by precomputed values for default column comparers.
|
|
15877
15984
|
*
|
|
15878
|
-
*
|
|
15879
|
-
*
|
|
15985
|
+
* This avoids repeatedly parsing the same cell value during large default
|
|
15986
|
+
* sorts while preserving normal multi-column ordering.
|
|
15987
|
+
*/
|
|
15988
|
+
function sortIndexByDefaultComparers(indexes, source, entries, sorting, sortingColumns) {
|
|
15989
|
+
const prepared = entries.map(([prop]) => {
|
|
15990
|
+
const values = [];
|
|
15991
|
+
const column = sortingColumns[prop];
|
|
15992
|
+
for (const index of indexes) {
|
|
15993
|
+
values[index] = getDefaultCompareValue(source[index], prop, column);
|
|
15994
|
+
}
|
|
15995
|
+
return {
|
|
15996
|
+
order: sorting[prop],
|
|
15997
|
+
values,
|
|
15998
|
+
};
|
|
15999
|
+
});
|
|
16000
|
+
return indexes.sort((a, b) => {
|
|
16001
|
+
for (const { order, values } of prepared) {
|
|
16002
|
+
const sorted = compareValues(values[a], values[b]);
|
|
16003
|
+
if (sorted) {
|
|
16004
|
+
return order === 'desc' ? -sorted : sorted;
|
|
16005
|
+
}
|
|
16006
|
+
}
|
|
16007
|
+
return 0;
|
|
16008
|
+
});
|
|
16009
|
+
}
|
|
16010
|
+
/**
|
|
16011
|
+
* Detects whether the optimized default-comparer path can be used.
|
|
15880
16012
|
*
|
|
15881
|
-
*
|
|
15882
|
-
*
|
|
16013
|
+
* Grouped rows and custom `cellCompare` functions stay on the legacy
|
|
16014
|
+
* comparator path to preserve their exact behavior.
|
|
15883
16015
|
*/
|
|
15884
|
-
function
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
}
|
|
15891
|
-
var tag = getTag(collection);
|
|
15892
|
-
if (tag == mapTag || tag == setTag) {
|
|
15893
|
-
return collection.size;
|
|
15894
|
-
}
|
|
15895
|
-
return baseKeys(collection).length;
|
|
16016
|
+
function canUseDefaultCompareFastPath(entries, indexes, source, sorting, sortingColumns) {
|
|
16017
|
+
return !indexes.some(index => isGrouping(source[index])) && !!sorting && !!sortingColumns && entries.every(([prop]) => {
|
|
16018
|
+
const order = sorting[prop];
|
|
16019
|
+
const column = sortingColumns[prop];
|
|
16020
|
+
return !!order && !(column === null || column === void 0 ? void 0 : column.cellCompare);
|
|
16021
|
+
});
|
|
15896
16022
|
}
|
|
15897
|
-
|
|
15898
|
-
|
|
16023
|
+
/**
|
|
16024
|
+
* Group placeholder rows are generated for their grouping column. If sorting is
|
|
16025
|
+
* requested for another column, the grouped source must be unwrapped first.
|
|
16026
|
+
*/
|
|
16027
|
+
function hasGroupingRowsForOtherSorting(entries, indexes, source) {
|
|
16028
|
+
return indexes.some(index => {
|
|
16029
|
+
const item = source[index];
|
|
16030
|
+
return isGrouping(item) && !entries.some(([prop]) => isSameColumnProp(item[GROUP_COLUMN_PROP], prop));
|
|
16031
|
+
});
|
|
16032
|
+
}
|
|
16033
|
+
/**
|
|
16034
|
+
* Sorts row indexes against a source collection.
|
|
16035
|
+
*
|
|
16036
|
+
* @param indexes - Current proxy row indexes to sort.
|
|
16037
|
+
* @param source - Full source collection addressed by the indexes.
|
|
16038
|
+
* @param sortingFunc - Comparator functions by column property.
|
|
16039
|
+
* @param sorting - Active sorting order by column property.
|
|
16040
|
+
* @param sortingColumns - Column metadata by property for default-comparer optimization.
|
|
16041
|
+
* @param sortingOrder - Active sorting priority in click/config insertion order.
|
|
16042
|
+
* @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
|
|
16043
|
+
*/
|
|
16044
|
+
function sortIndexByItems(indexes, source, sortingFunc = {}, sorting, sortingColumns, sortingOrder) {
|
|
16045
|
+
const hasSortingKeys = Object.keys(sortingFunc).length > 0;
|
|
16046
|
+
const sortingEntries = activeSortingEntries(sortingFunc, sortingOrder);
|
|
15899
16047
|
// if no sorting - return unsorted indexes
|
|
15900
|
-
if (
|
|
16048
|
+
if (sortingEntries.length === 0) {
|
|
15901
16049
|
// Unsorted indexes
|
|
15902
|
-
return [...Array(indexes.length).keys()];
|
|
16050
|
+
return hasSortingKeys ? indexes : [...new Array(indexes.length).keys()];
|
|
16051
|
+
}
|
|
16052
|
+
if (hasGroupingRowsForOtherSorting(sortingEntries, indexes, source)) {
|
|
16053
|
+
return indexes;
|
|
16054
|
+
}
|
|
16055
|
+
if (canUseDefaultCompareFastPath(sortingEntries, indexes, source, sorting, sortingColumns)) {
|
|
16056
|
+
return sortIndexByDefaultComparers(indexes, source, sortingEntries, sorting, sortingColumns);
|
|
15903
16057
|
}
|
|
15904
16058
|
//
|
|
15905
16059
|
/**
|
|
@@ -15909,15 +16063,15 @@ function sortIndexByItems(indexes, source, sortingFunc = {}) {
|
|
|
15909
16063
|
return indexes.sort((a, b) => {
|
|
15910
16064
|
const itemA = source[a];
|
|
15911
16065
|
const itemB = source[b];
|
|
15912
|
-
for (const [prop, cmp] of
|
|
16066
|
+
for (const [prop, cmp] of sortingEntries) {
|
|
15913
16067
|
if (isGrouping(itemA)) {
|
|
15914
|
-
if (itemA[
|
|
15915
|
-
return
|
|
16068
|
+
if (!isSameColumnProp(itemA[GROUP_COLUMN_PROP], prop)) {
|
|
16069
|
+
return a - b;
|
|
15916
16070
|
}
|
|
15917
16071
|
}
|
|
15918
16072
|
if (isGrouping(itemB)) {
|
|
15919
|
-
if (itemB[
|
|
15920
|
-
return
|
|
16073
|
+
if (!isSameColumnProp(itemB[GROUP_COLUMN_PROP], prop)) {
|
|
16074
|
+
return a - b;
|
|
15921
16075
|
}
|
|
15922
16076
|
}
|
|
15923
16077
|
/**
|
|
@@ -15937,13 +16091,7 @@ function defaultCellCompare(prop, a, b) {
|
|
|
15937
16091
|
const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
|
|
15938
16092
|
const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
15939
16093
|
const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
|
|
15940
|
-
|
|
15941
|
-
return 0;
|
|
15942
|
-
}
|
|
15943
|
-
if (av > bv) {
|
|
15944
|
-
return 1;
|
|
15945
|
-
}
|
|
15946
|
-
return -1;
|
|
16094
|
+
return compareValues(av, bv);
|
|
15947
16095
|
}
|
|
15948
16096
|
function descCellCompare(cmp) {
|
|
15949
16097
|
return (prop, a, b) => {
|
|
@@ -15972,11 +16120,32 @@ function getComparer(column, order) {
|
|
|
15972
16120
|
return undefined;
|
|
15973
16121
|
}
|
|
15974
16122
|
|
|
16123
|
+
/**
|
|
16124
|
+
* Renders sorting direction and optional additive sorting rank.
|
|
16125
|
+
*/
|
|
15975
16126
|
const SortingSign = ({ column }) => {
|
|
15976
16127
|
var _a;
|
|
15977
|
-
|
|
16128
|
+
const indicatorAttrs = { class: 'sort-indicator' };
|
|
16129
|
+
const iconAttrs = { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' };
|
|
16130
|
+
const orderIndexAttrs = { class: 'sort-order-index' };
|
|
16131
|
+
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));
|
|
15978
16132
|
};
|
|
15979
16133
|
|
|
16134
|
+
function getSortableRowIndexes(indexes, source) {
|
|
16135
|
+
return indexes.filter(index => !isGrouping(source[index]));
|
|
16136
|
+
}
|
|
16137
|
+
function mergeSortedRowsWithGroups(indexes, source, sortedRows) {
|
|
16138
|
+
if (sortedRows.length === indexes.length) {
|
|
16139
|
+
return sortedRows;
|
|
16140
|
+
}
|
|
16141
|
+
let rowIndex = 0;
|
|
16142
|
+
return indexes.map(index => {
|
|
16143
|
+
if (isGrouping(source[index])) {
|
|
16144
|
+
return index;
|
|
16145
|
+
}
|
|
16146
|
+
return sortedRows[rowIndex++];
|
|
16147
|
+
});
|
|
16148
|
+
}
|
|
15980
16149
|
/**
|
|
15981
16150
|
* Lifecycle
|
|
15982
16151
|
* 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.
|
|
@@ -15991,54 +16160,37 @@ class SortingPlugin extends BasePlugin {
|
|
|
15991
16160
|
super(revogrid, providers);
|
|
15992
16161
|
this.revogrid = revogrid;
|
|
15993
16162
|
/**
|
|
15994
|
-
* Delayed sorting promise
|
|
16163
|
+
* Delayed sorting promise registered in the grid render job queue.
|
|
15995
16164
|
*/
|
|
15996
16165
|
this.sortingPromise = null;
|
|
15997
16166
|
/**
|
|
15998
|
-
*
|
|
16167
|
+
* Debounced sorting entry point.
|
|
16168
|
+
*
|
|
16169
|
+
* Sorting can be requested by column changes, source changes, and header
|
|
16170
|
+
* clicks in quick succession, so the actual sort is delayed and coalesced.
|
|
15999
16171
|
*/
|
|
16000
|
-
this.postponeSort = debounce$1((order, comparison, ignoreViewportUpdate) => this.runSorting(order, comparison, ignoreViewportUpdate), 50);
|
|
16001
|
-
|
|
16002
|
-
var _a;
|
|
16003
|
-
if (cfg) {
|
|
16004
|
-
const sortingFunc = {};
|
|
16005
|
-
const order = {};
|
|
16006
|
-
(_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
16007
|
-
sortingFunc[col.prop] = getComparer(col, col.order);
|
|
16008
|
-
order[col.prop] = col.order;
|
|
16009
|
-
});
|
|
16010
|
-
if (cfg.additive) {
|
|
16011
|
-
this.sorting = Object.assign(Object.assign({}, this.sorting), order);
|
|
16012
|
-
this.sortingFunc = Object.assign(Object.assign({}, this.sortingFunc), sortingFunc);
|
|
16013
|
-
}
|
|
16014
|
-
else {
|
|
16015
|
-
// // set sorting
|
|
16016
|
-
this.sorting = order;
|
|
16017
|
-
this.sortingFunc = sortingFunc;
|
|
16018
|
-
}
|
|
16019
|
-
}
|
|
16020
|
-
};
|
|
16021
|
-
setConfig(config);
|
|
16172
|
+
this.postponeSort = debounce$1((order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) => this.runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate), 50);
|
|
16173
|
+
this.applySortingConfig(config);
|
|
16022
16174
|
this.addEventListener('sortingconfigchanged', ({ detail }) => {
|
|
16023
16175
|
config = detail;
|
|
16024
|
-
|
|
16025
|
-
this.startSorting(this.sorting, this.sortingFunc);
|
|
16176
|
+
this.applySortingConfig(detail);
|
|
16177
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16026
16178
|
});
|
|
16027
16179
|
this.addEventListener('beforeheaderrender', ({ detail, }) => {
|
|
16028
16180
|
var _a;
|
|
16029
16181
|
const { data: column } = detail;
|
|
16030
16182
|
if (column.sortable) {
|
|
16031
|
-
detail.data = Object.assign(Object.assign({}, column), { order: (_a = this.sorting) === null || _a === void 0 ? void 0 : _a[column.prop] });
|
|
16183
|
+
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) });
|
|
16032
16184
|
}
|
|
16033
16185
|
});
|
|
16034
16186
|
this.addEventListener('beforeanysource', ({ detail: { type }, }) => {
|
|
16035
16187
|
// if sorting was provided - sort data
|
|
16036
|
-
if (
|
|
16188
|
+
if (hasActiveSorting(this.sorting) && this.sortingFunc) {
|
|
16037
16189
|
const event = this.emit('beforesourcesortingapply', { type, sorting: this.sorting });
|
|
16038
16190
|
if (event.defaultPrevented) {
|
|
16039
16191
|
return;
|
|
16040
16192
|
}
|
|
16041
|
-
this.startSorting(this.sorting, this.sortingFunc);
|
|
16193
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16042
16194
|
}
|
|
16043
16195
|
});
|
|
16044
16196
|
this.addEventListener('aftercolumnsset', ({ detail: { order }, }) => {
|
|
@@ -16048,13 +16200,24 @@ class SortingPlugin extends BasePlugin {
|
|
|
16048
16200
|
}
|
|
16049
16201
|
const columns = this.providers.column.getColumns();
|
|
16050
16202
|
const sortingFunc = {};
|
|
16203
|
+
const sortingColumns = {};
|
|
16204
|
+
const sortingOrder = [];
|
|
16205
|
+
const sorting = {};
|
|
16051
16206
|
for (let prop in order) {
|
|
16052
|
-
|
|
16053
|
-
|
|
16207
|
+
if (order[prop]) {
|
|
16208
|
+
const column = getColumnByProp(columns, prop);
|
|
16209
|
+
const cmp = getComparer(column, order[prop]);
|
|
16210
|
+
sorting[prop] = order[prop];
|
|
16211
|
+
sortingFunc[prop] = cmp;
|
|
16212
|
+
sortingColumns[prop] = column;
|
|
16213
|
+
sortingOrder.push(prop);
|
|
16214
|
+
}
|
|
16054
16215
|
}
|
|
16055
16216
|
// set sorting
|
|
16056
|
-
this.sorting =
|
|
16057
|
-
this.sortingFunc =
|
|
16217
|
+
this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
|
|
16218
|
+
this.sortingFunc = this.sorting ? sortingFunc : undefined;
|
|
16219
|
+
this.sortingColumns = this.sorting ? sortingColumns : undefined;
|
|
16220
|
+
this.sortingOrder = this.sorting ? sortingOrder : undefined;
|
|
16058
16221
|
});
|
|
16059
16222
|
this.addEventListener('beforeheaderclick', (e) => {
|
|
16060
16223
|
var _a, _b, _c, _d;
|
|
@@ -16068,23 +16231,89 @@ class SortingPlugin extends BasePlugin {
|
|
|
16068
16231
|
});
|
|
16069
16232
|
}
|
|
16070
16233
|
/**
|
|
16071
|
-
*
|
|
16234
|
+
* Creates mutable sorting maps from current state when additive sorting is requested.
|
|
16235
|
+
*/
|
|
16236
|
+
createSortingState(additive) {
|
|
16237
|
+
var _a;
|
|
16238
|
+
return {
|
|
16239
|
+
sorting: additive ? Object.assign({}, this.sorting) : {},
|
|
16240
|
+
sortingFunc: additive ? Object.assign({}, this.sortingFunc) : {},
|
|
16241
|
+
sortingColumns: additive ? Object.assign({}, this.sortingColumns) : {},
|
|
16242
|
+
sortingOrder: additive ? [...((_a = this.sortingOrder) !== null && _a !== void 0 ? _a : [])] : [],
|
|
16243
|
+
};
|
|
16244
|
+
}
|
|
16245
|
+
/**
|
|
16246
|
+
* Stores normalized sorting state, clearing inactive empty maps.
|
|
16247
|
+
*/
|
|
16248
|
+
setSortingState({ sorting, sortingFunc, sortingColumns, sortingOrder, }) {
|
|
16249
|
+
this.sorting = hasActiveSorting(sorting) ? sorting : undefined;
|
|
16250
|
+
this.sortingFunc = this.sorting ? sortingFunc : undefined;
|
|
16251
|
+
this.sortingColumns = this.sorting ? sortingColumns : undefined;
|
|
16252
|
+
this.sortingOrder = this.sorting ? sortingOrder : undefined;
|
|
16253
|
+
}
|
|
16254
|
+
/**
|
|
16255
|
+
* Adds or replaces a column in a sorting state.
|
|
16256
|
+
*/
|
|
16257
|
+
setColumnSorting(state, prop, order, cmp, column) {
|
|
16258
|
+
state.sorting[prop] = order;
|
|
16259
|
+
state.sortingFunc[prop] = cmp;
|
|
16260
|
+
state.sortingColumns[prop] = column;
|
|
16261
|
+
if (!state.sortingOrder.some(sortingProp => String(sortingProp) === String(prop))) {
|
|
16262
|
+
state.sortingOrder.push(prop);
|
|
16263
|
+
}
|
|
16264
|
+
}
|
|
16265
|
+
/**
|
|
16266
|
+
* Removes a column from a sorting state.
|
|
16267
|
+
*/
|
|
16268
|
+
clearColumnSorting(state, prop) {
|
|
16269
|
+
delete state.sorting[prop];
|
|
16270
|
+
delete state.sortingFunc[prop];
|
|
16271
|
+
delete state.sortingColumns[prop];
|
|
16272
|
+
const index = state.sortingOrder.findIndex(sortingProp => String(sortingProp) === String(prop));
|
|
16273
|
+
if (index >= 0) {
|
|
16274
|
+
state.sortingOrder.splice(index, 1);
|
|
16275
|
+
}
|
|
16276
|
+
}
|
|
16277
|
+
/**
|
|
16278
|
+
* Normalizes external sorting configuration into internal order,
|
|
16279
|
+
* comparator, and column metadata maps.
|
|
16072
16280
|
*/
|
|
16073
|
-
|
|
16281
|
+
applySortingConfig(cfg) {
|
|
16282
|
+
var _a;
|
|
16283
|
+
if (!cfg) {
|
|
16284
|
+
return;
|
|
16285
|
+
}
|
|
16286
|
+
const state = this.createSortingState(cfg.additive);
|
|
16287
|
+
(_a = cfg.columns) === null || _a === void 0 ? void 0 : _a.forEach(col => {
|
|
16288
|
+
if (col.order) {
|
|
16289
|
+
this.setColumnSorting(state, col.prop, col.order, getComparer(col, col.order), col);
|
|
16290
|
+
return;
|
|
16291
|
+
}
|
|
16292
|
+
this.clearColumnSorting(state, col.prop);
|
|
16293
|
+
});
|
|
16294
|
+
this.setSortingState(state);
|
|
16295
|
+
}
|
|
16296
|
+
startSorting(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate) {
|
|
16074
16297
|
if (!this.sortingPromise) {
|
|
16075
16298
|
// add job before render
|
|
16076
16299
|
this.revogrid.jobsBeforeRender.push(new Promise(resolve => {
|
|
16077
16300
|
this.sortingPromise = resolve;
|
|
16078
16301
|
}));
|
|
16079
16302
|
}
|
|
16080
|
-
|
|
16303
|
+
if (typeof sortingColumns === 'boolean') {
|
|
16304
|
+
this.postponeSort(order, sortingFunc, undefined, undefined, sortingColumns);
|
|
16305
|
+
return;
|
|
16306
|
+
}
|
|
16307
|
+
this.postponeSort(order, sortingFunc, sortingColumns, sortingOrder, ignoreViewportUpdate);
|
|
16081
16308
|
}
|
|
16082
16309
|
/**
|
|
16083
|
-
*
|
|
16084
|
-
*
|
|
16310
|
+
* Applies sorting requested by a sortable header click.
|
|
16311
|
+
*
|
|
16312
|
+
* @param column - Column that initiated sorting.
|
|
16313
|
+
* @param additive - If true, add/remove this column from the current multi-sort state.
|
|
16085
16314
|
*/
|
|
16086
16315
|
headerclick(column, additive) {
|
|
16087
|
-
var _a
|
|
16316
|
+
var _a;
|
|
16088
16317
|
const columnProp = column.prop;
|
|
16089
16318
|
let order = getNextOrder((_a = this.sorting) === null || _a === void 0 ? void 0 : _a[columnProp]);
|
|
16090
16319
|
const beforeEvent = this.emit('beforesorting', { column, order, additive });
|
|
@@ -16102,52 +16331,59 @@ class SortingPlugin extends BasePlugin {
|
|
|
16102
16331
|
return;
|
|
16103
16332
|
}
|
|
16104
16333
|
const cmp = getComparer(beforeApplyEvent.detail.column, beforeApplyEvent.detail.order);
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16334
|
+
this.applyHeaderSorting(beforeApplyEvent.detail.column, beforeApplyEvent.detail.additive, order, cmp);
|
|
16335
|
+
this.startSorting(this.sorting, this.sortingFunc, this.sortingColumns, this.sortingOrder);
|
|
16336
|
+
}
|
|
16337
|
+
/**
|
|
16338
|
+
* Applies sorting state produced by a header click.
|
|
16339
|
+
*/
|
|
16340
|
+
applyHeaderSorting(column, additive, order, cmp) {
|
|
16341
|
+
if (!additive) {
|
|
16342
|
+
this.setSortingState(order ? {
|
|
16343
|
+
sorting: { [column.prop]: order },
|
|
16344
|
+
sortingFunc: { [column.prop]: cmp },
|
|
16345
|
+
sortingColumns: { [column.prop]: column },
|
|
16346
|
+
sortingOrder: [column.prop],
|
|
16347
|
+
} : this.createSortingState());
|
|
16348
|
+
return;
|
|
16349
|
+
}
|
|
16350
|
+
const state = this.createSortingState(true);
|
|
16351
|
+
if (order) {
|
|
16352
|
+
this.setColumnSorting(state, column.prop, order, cmp, column);
|
|
16119
16353
|
}
|
|
16120
16354
|
else {
|
|
16121
|
-
|
|
16122
|
-
// reset sorting
|
|
16123
|
-
this.sorting = { [columnProp]: order };
|
|
16124
|
-
this.sortingFunc = { [columnProp]: cmp };
|
|
16125
|
-
}
|
|
16126
|
-
else {
|
|
16127
|
-
(_b = this.sorting) === null || _b === void 0 ? true : delete _b[columnProp];
|
|
16128
|
-
(_c = this.sortingFunc) === null || _c === void 0 ? true : delete _c[columnProp];
|
|
16129
|
-
}
|
|
16355
|
+
this.clearColumnSorting(state, column.prop);
|
|
16130
16356
|
}
|
|
16131
|
-
this.
|
|
16357
|
+
this.setSortingState(state);
|
|
16132
16358
|
}
|
|
16133
|
-
runSorting(order, comparison, ignoreViewportUpdate) {
|
|
16134
|
-
var _a;
|
|
16135
|
-
|
|
16136
|
-
|
|
16359
|
+
runSorting(order, comparison, sortingColumns, sortingOrder, ignoreViewportUpdate) {
|
|
16360
|
+
var _a, _b;
|
|
16361
|
+
if (typeof sortingColumns === 'boolean') {
|
|
16362
|
+
this.sort(order, comparison, undefined, undefined, undefined, sortingColumns);
|
|
16363
|
+
(_a = this.sortingPromise) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
16364
|
+
this.sortingPromise = null;
|
|
16365
|
+
return;
|
|
16366
|
+
}
|
|
16367
|
+
this.sort(order, comparison, sortingColumns, sortingOrder, undefined, ignoreViewportUpdate);
|
|
16368
|
+
(_b = this.sortingPromise) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
16137
16369
|
this.sortingPromise = null;
|
|
16138
16370
|
}
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16371
|
+
sort(sorting, sortingFunc, sortingColumns, sortingOrder, types = rowTypes, ignoreViewportUpdate = false) {
|
|
16372
|
+
let activeSortingColumns;
|
|
16373
|
+
let activeSortingOrder;
|
|
16374
|
+
let activeTypes = types;
|
|
16375
|
+
let activeIgnoreViewportUpdate = ignoreViewportUpdate;
|
|
16376
|
+
if (Array.isArray(sortingColumns)) {
|
|
16377
|
+
activeTypes = sortingColumns;
|
|
16378
|
+
activeIgnoreViewportUpdate = typeof sortingOrder === 'boolean' ? sortingOrder : false;
|
|
16379
|
+
}
|
|
16380
|
+
else {
|
|
16381
|
+
activeSortingColumns = sortingColumns;
|
|
16382
|
+
activeSortingOrder = Array.isArray(sortingOrder) ? sortingOrder : undefined;
|
|
16383
|
+
}
|
|
16148
16384
|
// if no sorting - reset
|
|
16149
16385
|
if (!Object.keys(sorting || {}).length) {
|
|
16150
|
-
for (let type of
|
|
16386
|
+
for (let type of activeTypes) {
|
|
16151
16387
|
const storeService = this.providers.data.stores[type];
|
|
16152
16388
|
// row data
|
|
16153
16389
|
const source = storeService.store.get('source');
|
|
@@ -16156,26 +16392,27 @@ class SortingPlugin extends BasePlugin {
|
|
|
16156
16392
|
// row indexes
|
|
16157
16393
|
const newItemsOrder = Array.from({ length: source.length }, (_, i) => i); // recover indexes range(0, source.length)
|
|
16158
16394
|
this.providers.dimension.updateSizesPositionByNewDataIndexes(type, newItemsOrder, proxyItems);
|
|
16159
|
-
storeService.setData({ proxyItems: newItemsOrder
|
|
16395
|
+
storeService.setData({ proxyItems: newItemsOrder });
|
|
16160
16396
|
}
|
|
16161
16397
|
}
|
|
16162
16398
|
else {
|
|
16163
|
-
for (let type of
|
|
16399
|
+
for (let type of activeTypes) {
|
|
16164
16400
|
const storeService = this.providers.data.stores[type];
|
|
16165
16401
|
// row data
|
|
16166
16402
|
const source = storeService.store.get('source');
|
|
16167
16403
|
// row indexes
|
|
16168
16404
|
const proxyItems = storeService.store.get('proxyItems');
|
|
16169
|
-
const
|
|
16405
|
+
const sortItems = getSortableRowIndexes(proxyItems, source);
|
|
16406
|
+
const sortedItems = sortIndexByItems([...sortItems], source, sortingFunc, sorting, activeSortingColumns, activeSortingOrder);
|
|
16407
|
+
const newItemsOrder = mergeSortedRowsWithGroups(proxyItems, source, sortedItems);
|
|
16170
16408
|
// take row indexes before trim applied and proxy items
|
|
16171
16409
|
const prevItems = storeService.store.get('items');
|
|
16172
16410
|
storeService.setData({
|
|
16173
16411
|
proxyItems: newItemsOrder,
|
|
16174
|
-
source: [...source],
|
|
16175
16412
|
});
|
|
16176
16413
|
// take currently visible row indexes
|
|
16177
16414
|
const newItems = storeService.store.get('items');
|
|
16178
|
-
if (!
|
|
16415
|
+
if (!activeIgnoreViewportUpdate) {
|
|
16179
16416
|
this.providers.dimension
|
|
16180
16417
|
.updateSizesPositionByNewDataIndexes(type, newItems, prevItems);
|
|
16181
16418
|
}
|
|
@@ -16745,6 +16982,18 @@ const expandSvgIconVNode = (expanded = false) => {
|
|
|
16745
16982
|
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" })));
|
|
16746
16983
|
};
|
|
16747
16984
|
|
|
16985
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
16986
|
+
var t = {};
|
|
16987
|
+
for (var p in s)
|
|
16988
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16989
|
+
t[p] = s[p];
|
|
16990
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16991
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16992
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
16993
|
+
t[p[i]] = s[p[i]];
|
|
16994
|
+
}
|
|
16995
|
+
return t;
|
|
16996
|
+
};
|
|
16748
16997
|
class GroupingRowPlugin extends BasePlugin {
|
|
16749
16998
|
getStore(type = GROUPING_ROW_TYPE) {
|
|
16750
16999
|
return this.providers.data.stores[type].store;
|
|
@@ -16828,6 +17077,18 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
16828
17077
|
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
16829
17078
|
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
16830
17079
|
}
|
|
17080
|
+
/**
|
|
17081
|
+
* Returns grouping options for regrouping that must preserve current UI state.
|
|
17082
|
+
*
|
|
17083
|
+
* `expandedAll` and config `prevExpanded` are initial/config instructions.
|
|
17084
|
+
* Reusing them after sorting would reopen groups the user collapsed before
|
|
17085
|
+
* sorting instead of using the current grouped source state.
|
|
17086
|
+
*/
|
|
17087
|
+
getCurrentExpandedOptions() {
|
|
17088
|
+
var _a;
|
|
17089
|
+
const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, options = __rest(_b, ["expandedAll", "prevExpanded"]);
|
|
17090
|
+
return options;
|
|
17091
|
+
}
|
|
16831
17092
|
/**
|
|
16832
17093
|
* Starts global source update with group clearing and applying new one
|
|
16833
17094
|
* Initiated when need to reapply grouping
|
|
@@ -16930,7 +17191,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
16930
17191
|
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
16931
17192
|
return;
|
|
16932
17193
|
}
|
|
16933
|
-
this.doSourceUpdate(
|
|
17194
|
+
this.doSourceUpdate(this.getCurrentExpandedOptions());
|
|
16934
17195
|
});
|
|
16935
17196
|
/**
|
|
16936
17197
|
* Apply logic for focus inside of grouping
|
|
@@ -17137,7 +17398,8 @@ class ViewportService {
|
|
|
17137
17398
|
(_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
|
|
17138
17399
|
// set resize event
|
|
17139
17400
|
const changedItems = {};
|
|
17140
|
-
for (const
|
|
17401
|
+
for (const i of Object.keys(detail || {})) {
|
|
17402
|
+
const size = detail[i];
|
|
17141
17403
|
const virtualIndex = parseInt(i, 10);
|
|
17142
17404
|
const item = getSourceItem(store, virtualIndex);
|
|
17143
17405
|
if (item) {
|
|
@@ -17540,7 +17802,10 @@ class SelectionStoreConnector {
|
|
|
17540
17802
|
const nextItem = nextCell(focus, lastCell);
|
|
17541
17803
|
let nextStore;
|
|
17542
17804
|
if (nextItem) {
|
|
17543
|
-
Object.
|
|
17805
|
+
Object.keys(nextItem).forEach((t) => {
|
|
17806
|
+
var _a;
|
|
17807
|
+
const type = t;
|
|
17808
|
+
const nextItemCoord = (_a = nextItem[type]) !== null && _a !== void 0 ? _a : 0;
|
|
17544
17809
|
let stores;
|
|
17545
17810
|
switch (type) {
|
|
17546
17811
|
case 'x':
|
|
@@ -18160,11 +18425,11 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
|
|
|
18160
18425
|
* Plugin for column manual move
|
|
18161
18426
|
*/
|
|
18162
18427
|
const COLUMN_CLICK = ON_COLUMN_CLICK;
|
|
18163
|
-
const
|
|
18164
|
-
const
|
|
18165
|
-
const
|
|
18428
|
+
const COLUMN_DRAG_MOVE_EVENT = 'columndragmousemove';
|
|
18429
|
+
const COLUMN_DRAG_END_EVENT = 'columndragend';
|
|
18430
|
+
const BEFORE_COLUMN_DRAG_END_EVENT = 'beforecolumndragend';
|
|
18166
18431
|
// use this event subscription to drop D&D for particular columns
|
|
18167
|
-
const
|
|
18432
|
+
const COLUMN_DRAG_START_EVENT = 'columndragstart';
|
|
18168
18433
|
class ColumnMovePlugin extends BasePlugin {
|
|
18169
18434
|
constructor(revogrid, providers) {
|
|
18170
18435
|
super(revogrid, providers);
|
|
@@ -18194,7 +18459,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18194
18459
|
if (event.defaultPrevented) {
|
|
18195
18460
|
return;
|
|
18196
18461
|
}
|
|
18197
|
-
const { defaultPrevented } = dispatch(this.revogrid,
|
|
18462
|
+
const { defaultPrevented } = dispatch(this.revogrid, COLUMN_DRAG_START_EVENT, data);
|
|
18198
18463
|
// check if allowed to drag particulat column
|
|
18199
18464
|
if (defaultPrevented) {
|
|
18200
18465
|
return;
|
|
@@ -18215,7 +18480,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18215
18480
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
18216
18481
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
18217
18482
|
const elRect = dataEl.getBoundingClientRect();
|
|
18218
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
|
|
18483
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
|
|
18219
18484
|
this.staticDragData = {
|
|
18220
18485
|
startPos: event.x,
|
|
18221
18486
|
startItem,
|
|
@@ -18225,7 +18490,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18225
18490
|
gridEl: this.revogrid,
|
|
18226
18491
|
cols,
|
|
18227
18492
|
};
|
|
18228
|
-
this.dragData = this.getData(this.staticDragData);
|
|
18493
|
+
this.dragData = this.getData(this.staticDragData, []);
|
|
18229
18494
|
mousemove.target.addEventListener('mousemove', mousemove.callback);
|
|
18230
18495
|
this.orderUi.start(event, Object.assign(Object.assign({}, this.dragData), this.staticDragData));
|
|
18231
18496
|
}
|
|
@@ -18233,24 +18498,24 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18233
18498
|
if (!this.staticDragData) {
|
|
18234
18499
|
return;
|
|
18235
18500
|
}
|
|
18236
|
-
const dragData = (this.dragData = this.getData(this.staticDragData));
|
|
18501
|
+
const dragData = (this.dragData = this.getData(this.staticDragData, []));
|
|
18237
18502
|
if (!dragData) {
|
|
18238
18503
|
return;
|
|
18239
18504
|
}
|
|
18240
18505
|
const start = this.staticDragData.startPos;
|
|
18241
18506
|
if (Math.abs(start - e.x) > 10) {
|
|
18242
18507
|
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
18243
|
-
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
18508
|
+
const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
|
|
18244
18509
|
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
18245
18510
|
// prevent position change if out of bounds
|
|
18246
18511
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
18247
18512
|
return;
|
|
18248
18513
|
}
|
|
18249
|
-
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
18514
|
+
this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
|
|
18250
18515
|
}
|
|
18251
18516
|
}
|
|
18252
18517
|
move(e) {
|
|
18253
|
-
dispatch(this.revogrid,
|
|
18518
|
+
dispatch(this.revogrid, COLUMN_DRAG_MOVE_EVENT, e);
|
|
18254
18519
|
// then do move
|
|
18255
18520
|
this.moveFunc(e);
|
|
18256
18521
|
}
|
|
@@ -18264,11 +18529,12 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18264
18529
|
if (relativePos < 0) {
|
|
18265
18530
|
relativePos = 0;
|
|
18266
18531
|
}
|
|
18267
|
-
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
18532
|
+
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
|
|
18268
18533
|
const store = this.providers.column.stores[this.dragData.type].store;
|
|
18534
|
+
const source = store.get('source');
|
|
18269
18535
|
const newItems = [...store.get('items')];
|
|
18270
18536
|
// prevent position change if needed
|
|
18271
|
-
const { defaultPrevented: stopDrag } = dispatch(this.revogrid,
|
|
18537
|
+
const { defaultPrevented: stopDrag } = dispatch(this.revogrid, BEFORE_COLUMN_DRAG_END_EVENT, Object.assign(Object.assign({}, this.staticDragData), { startPosition: this.staticDragData.startItem, newPosition, newItem: source[newItems[this.staticDragData.startItem.itemIndex]] }));
|
|
18272
18538
|
if (!stopDrag) {
|
|
18273
18539
|
const prevItems = [...newItems];
|
|
18274
18540
|
// todo: if move item out of group remove item from group
|
|
@@ -18277,7 +18543,7 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18277
18543
|
store.set('items', newItems);
|
|
18278
18544
|
this.providers.dimension.updateSizesPositionByNewDataIndexes(this.dragData.type, newItems, prevItems);
|
|
18279
18545
|
}
|
|
18280
|
-
dispatch(this.revogrid,
|
|
18546
|
+
dispatch(this.revogrid, COLUMN_DRAG_END_EVENT, this.getData(this.staticDragData, newItems, source));
|
|
18281
18547
|
}
|
|
18282
18548
|
this.clearOrder();
|
|
18283
18549
|
}
|
|
@@ -18297,13 +18563,15 @@ class ColumnMovePlugin extends BasePlugin {
|
|
|
18297
18563
|
super.clearSubscriptions();
|
|
18298
18564
|
this.clearLocalSubscriptions();
|
|
18299
18565
|
}
|
|
18300
|
-
getData({ gridEl, dataEl, pin,
|
|
18566
|
+
getData({ gridEl, dataEl, pin }, order, source = []) {
|
|
18301
18567
|
const gridRect = gridEl.getBoundingClientRect();
|
|
18302
18568
|
const elRect = dataEl.getBoundingClientRect();
|
|
18303
18569
|
const scrollOffset = elRect.left - gridRect.left;
|
|
18304
18570
|
return {
|
|
18571
|
+
columns: order.map(index => source[index]).filter(Boolean),
|
|
18305
18572
|
elRect,
|
|
18306
18573
|
gridRect,
|
|
18574
|
+
order,
|
|
18307
18575
|
type: pin || 'rgCol',
|
|
18308
18576
|
scrollOffset,
|
|
18309
18577
|
};
|
|
@@ -19226,12 +19494,13 @@ class RevoGridComponent {
|
|
|
19226
19494
|
return;
|
|
19227
19495
|
}
|
|
19228
19496
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
19497
|
+
const order = {};
|
|
19498
|
+
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
19499
|
+
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
19500
|
+
}
|
|
19229
19501
|
this.aftercolumnsset.emit({
|
|
19230
19502
|
columns,
|
|
19231
|
-
order
|
|
19232
|
-
acc[prop] = column.order;
|
|
19233
|
-
return acc;
|
|
19234
|
-
}, {}),
|
|
19503
|
+
order,
|
|
19235
19504
|
});
|
|
19236
19505
|
}
|
|
19237
19506
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
@@ -19520,7 +19789,7 @@ class RevoGridComponent {
|
|
|
19520
19789
|
if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
19521
19790
|
this.trimmedRowsChanged(this.trimmedRows);
|
|
19522
19791
|
}
|
|
19523
|
-
this.rowDefChanged(this.rowDefinitions);
|
|
19792
|
+
this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
|
|
19524
19793
|
// init grouping
|
|
19525
19794
|
if (this.grouping && Object.keys(this.grouping).length > 0) {
|
|
19526
19795
|
this.groupingChanged(this.grouping);
|
|
@@ -20037,11 +20306,13 @@ class RevogrData {
|
|
|
20037
20306
|
const depth = this.dataStore.get('groupingDepth');
|
|
20038
20307
|
const groupingCustomRenderer = this.dataStore.get('groupingCustomRenderer');
|
|
20039
20308
|
const groupDepth = this.columnService.hasGrouping ? depth : 0;
|
|
20309
|
+
const rowRenderOffset = this.viewportRow.get('renderOffset') || 0;
|
|
20310
|
+
const colRenderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
20040
20311
|
for (let rgRow of rows) {
|
|
20041
20312
|
const dataItem = getSourceItem(this.dataStore, rgRow.itemIndex);
|
|
20042
20313
|
// #region Grouping
|
|
20043
20314
|
if (isGrouping(dataItem)) {
|
|
20044
|
-
const gmodel = Object.assign(Object.assign({}, rgRow), { index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
20315
|
+
const gmodel = Object.assign(Object.assign({}, rgRow), { start: rgRow.start - rowRenderOffset, index: rgRow.itemIndex, model: dataItem, groupingCustomRenderer,
|
|
20045
20316
|
// Only show expand button if grouping is enabled and not in row headers
|
|
20046
20317
|
hasExpand: this.columnService.hasGrouping && this.colType !== 'rowHeaders', columnItems: cols, providers: this.providers });
|
|
20047
20318
|
rowsEls.push(hAsync(GroupingRowRenderer, Object.assign({}, gmodel)));
|
|
@@ -20064,7 +20335,7 @@ class RevogrData {
|
|
|
20064
20335
|
[DATA_ROW]: rowProps.itemIndex,
|
|
20065
20336
|
style: {
|
|
20066
20337
|
width: `${columnProps.size}px`,
|
|
20067
|
-
transform: `translateX(${columnProps.start}px)`,
|
|
20338
|
+
transform: `translateX(${columnProps.start - colRenderOffset}px)`,
|
|
20068
20339
|
height: rowProps.size ? `${rowProps.size}px` : undefined,
|
|
20069
20340
|
},
|
|
20070
20341
|
};
|
|
@@ -20092,7 +20363,7 @@ class RevogrData {
|
|
|
20092
20363
|
if (this.rowHighlightPlugin.isRowFocused(rgRow.itemIndex)) {
|
|
20093
20364
|
rowClass += ` ${ROW_FOCUSED_CLASS}`;
|
|
20094
20365
|
}
|
|
20095
|
-
const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start, groupingLevel: groupDepth || undefined }, cells));
|
|
20366
|
+
const row = (hAsync(RowRenderer, { index: rgRow.itemIndex, rowClass: rowClass, size: rgRow.size, start: rgRow.start - rowRenderOffset, groupingLevel: groupDepth || undefined }, cells));
|
|
20096
20367
|
this.beforerowrender.emit({
|
|
20097
20368
|
node: row,
|
|
20098
20369
|
item: rgRow,
|
|
@@ -20392,126 +20663,8 @@ class RevogrFocus {
|
|
|
20392
20663
|
}; }
|
|
20393
20664
|
}
|
|
20394
20665
|
|
|
20395
|
-
var defineProperty = (function() {
|
|
20396
|
-
try {
|
|
20397
|
-
var func = getNative(Object, 'defineProperty');
|
|
20398
|
-
func({}, '', {});
|
|
20399
|
-
return func;
|
|
20400
|
-
} catch (e) {}
|
|
20401
|
-
}());
|
|
20402
|
-
|
|
20403
|
-
/**
|
|
20404
|
-
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
20405
|
-
* value checks.
|
|
20406
|
-
*
|
|
20407
|
-
* @private
|
|
20408
|
-
* @param {Object} object The object to modify.
|
|
20409
|
-
* @param {string} key The key of the property to assign.
|
|
20410
|
-
* @param {*} value The value to assign.
|
|
20411
|
-
*/
|
|
20412
|
-
function baseAssignValue(object, key, value) {
|
|
20413
|
-
if (key == '__proto__' && defineProperty) {
|
|
20414
|
-
defineProperty(object, key, {
|
|
20415
|
-
'configurable': true,
|
|
20416
|
-
'enumerable': true,
|
|
20417
|
-
'value': value,
|
|
20418
|
-
'writable': true
|
|
20419
|
-
});
|
|
20420
|
-
} else {
|
|
20421
|
-
object[key] = value;
|
|
20422
|
-
}
|
|
20423
|
-
}
|
|
20424
|
-
|
|
20425
|
-
/**
|
|
20426
|
-
* A specialized version of `baseAggregator` for arrays.
|
|
20427
|
-
*
|
|
20428
|
-
* @private
|
|
20429
|
-
* @param {Array} [array] The array to iterate over.
|
|
20430
|
-
* @param {Function} setter The function to set `accumulator` values.
|
|
20431
|
-
* @param {Function} iteratee The iteratee to transform keys.
|
|
20432
|
-
* @param {Object} accumulator The initial aggregated object.
|
|
20433
|
-
* @returns {Function} Returns `accumulator`.
|
|
20434
|
-
*/
|
|
20435
|
-
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
20436
|
-
var index = -1,
|
|
20437
|
-
length = array == null ? 0 : array.length;
|
|
20438
|
-
|
|
20439
|
-
while (++index < length) {
|
|
20440
|
-
var value = array[index];
|
|
20441
|
-
setter(accumulator, value, iteratee(value), array);
|
|
20442
|
-
}
|
|
20443
|
-
return accumulator;
|
|
20444
|
-
}
|
|
20445
|
-
|
|
20446
|
-
/**
|
|
20447
|
-
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
|
20448
|
-
* by `iteratee` and values set by `setter`.
|
|
20449
|
-
*
|
|
20450
|
-
* @private
|
|
20451
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
20452
|
-
* @param {Function} setter The function to set `accumulator` values.
|
|
20453
|
-
* @param {Function} iteratee The iteratee to transform keys.
|
|
20454
|
-
* @param {Object} accumulator The initial aggregated object.
|
|
20455
|
-
* @returns {Function} Returns `accumulator`.
|
|
20456
|
-
*/
|
|
20457
|
-
function baseAggregator(collection, setter, iteratee, accumulator) {
|
|
20458
|
-
baseEach(collection, function(value, key, collection) {
|
|
20459
|
-
setter(accumulator, value, iteratee(value), collection);
|
|
20460
|
-
});
|
|
20461
|
-
return accumulator;
|
|
20462
|
-
}
|
|
20463
|
-
|
|
20464
|
-
/**
|
|
20465
|
-
* Creates a function like `_.groupBy`.
|
|
20466
|
-
*
|
|
20467
|
-
* @private
|
|
20468
|
-
* @param {Function} setter The function to set accumulator values.
|
|
20469
|
-
* @param {Function} [initializer] The accumulator object initializer.
|
|
20470
|
-
* @returns {Function} Returns the new aggregator function.
|
|
20471
|
-
*/
|
|
20472
|
-
function createAggregator(setter, initializer) {
|
|
20473
|
-
return function(collection, iteratee) {
|
|
20474
|
-
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
|
20475
|
-
accumulator = {};
|
|
20476
|
-
|
|
20477
|
-
return func(collection, setter, baseIteratee(iteratee), accumulator);
|
|
20478
|
-
};
|
|
20479
|
-
}
|
|
20480
|
-
|
|
20481
|
-
/**
|
|
20482
|
-
* Creates an object composed of keys generated from the results of running
|
|
20483
|
-
* each element of `collection` thru `iteratee`. The corresponding value of
|
|
20484
|
-
* each key is the last element responsible for generating the key. The
|
|
20485
|
-
* iteratee is invoked with one argument: (value).
|
|
20486
|
-
*
|
|
20487
|
-
* @static
|
|
20488
|
-
* @memberOf _
|
|
20489
|
-
* @since 4.0.0
|
|
20490
|
-
* @category Collection
|
|
20491
|
-
* @param {Array|Object} collection The collection to iterate over.
|
|
20492
|
-
* @param {Function} [iteratee=_.identity] The iteratee to transform keys.
|
|
20493
|
-
* @returns {Object} Returns the composed aggregate object.
|
|
20494
|
-
* @example
|
|
20495
|
-
*
|
|
20496
|
-
* var array = [
|
|
20497
|
-
* { 'dir': 'left', 'code': 97 },
|
|
20498
|
-
* { 'dir': 'right', 'code': 100 }
|
|
20499
|
-
* ];
|
|
20500
|
-
*
|
|
20501
|
-
* _.keyBy(array, function(o) {
|
|
20502
|
-
* return String.fromCharCode(o.code);
|
|
20503
|
-
* });
|
|
20504
|
-
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
|
|
20505
|
-
*
|
|
20506
|
-
* _.keyBy(array, 'dir');
|
|
20507
|
-
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
|
20508
|
-
*/
|
|
20509
|
-
var keyBy = createAggregator(function(result, value, key) {
|
|
20510
|
-
baseAssignValue(result, key, value);
|
|
20511
|
-
});
|
|
20512
|
-
|
|
20513
20666
|
const HeaderRenderer = (p) => {
|
|
20514
|
-
var _a, _b, _c, _d, _e;
|
|
20667
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
20515
20668
|
const cellClass = {
|
|
20516
20669
|
[HEADER_CLASS]: true,
|
|
20517
20670
|
[HEADER_SORTABLE_CLASS]: !!((_a = p.data) === null || _a === void 0 ? void 0 : _a.sortable),
|
|
@@ -20520,15 +20673,16 @@ const HeaderRenderer = (p) => {
|
|
|
20520
20673
|
cellClass[p.data.order] = true;
|
|
20521
20674
|
}
|
|
20522
20675
|
const dataProps = {
|
|
20676
|
+
key: String((_d = (_c = p.data) === null || _c === void 0 ? void 0 : _c.prop) !== null && _d !== void 0 ? _d : p.column.itemIndex),
|
|
20523
20677
|
[DATA_COL]: p.column.itemIndex,
|
|
20524
20678
|
canResize: p.canResize,
|
|
20525
|
-
minWidth: ((
|
|
20526
|
-
maxWidth: (
|
|
20679
|
+
minWidth: ((_e = p.data) === null || _e === void 0 ? void 0 : _e.minSize) || MIN_COL_SIZE,
|
|
20680
|
+
maxWidth: (_f = p.data) === null || _f === void 0 ? void 0 : _f.maxSize,
|
|
20527
20681
|
active: p.active || ['r'],
|
|
20528
20682
|
class: cellClass,
|
|
20529
20683
|
style: {
|
|
20530
20684
|
width: `${p.column.size}px`,
|
|
20531
|
-
transform: `translateX(${p.column.start}px)`,
|
|
20685
|
+
transform: `translateX(${p.column.start - (p.renderOffset || 0)}px)`,
|
|
20532
20686
|
},
|
|
20533
20687
|
onResize: p.onResize,
|
|
20534
20688
|
onDblClick(originalEvent) {
|
|
@@ -20559,11 +20713,12 @@ const HeaderRenderer = (p) => {
|
|
|
20559
20713
|
}
|
|
20560
20714
|
}
|
|
20561
20715
|
}
|
|
20562
|
-
return (hAsync(HeaderCellRenderer, { data: p.data, props: dataProps, additionalData: p.additionalData }, hAsync(SortingSign, { column: p.data }), p.canFilter && ((
|
|
20716
|
+
return (hAsync(HeaderCellRenderer, { data: p.data, props: dataProps, additionalData: p.additionalData }, hAsync(SortingSign, { column: p.data }), p.canFilter && ((_g = p.data) === null || _g === void 0 ? void 0 : _g.filter) !== false ? (hAsync(FilterButton, { column: p.data })) : ('')));
|
|
20563
20717
|
};
|
|
20564
20718
|
|
|
20565
20719
|
const HeaderGroupRenderer = (p) => {
|
|
20566
20720
|
const groupProps = {
|
|
20721
|
+
key: `${p.group.name}-${p.group.indexes.join('-')}`,
|
|
20567
20722
|
canResize: p.canResize,
|
|
20568
20723
|
minWidth: p.group.indexes.length * MIN_COL_SIZE,
|
|
20569
20724
|
maxWidth: 0,
|
|
@@ -20572,7 +20727,7 @@ const HeaderGroupRenderer = (p) => {
|
|
|
20572
20727
|
[HEADER_CLASS]: true,
|
|
20573
20728
|
},
|
|
20574
20729
|
style: {
|
|
20575
|
-
transform: `translateX(${p.start}px)`,
|
|
20730
|
+
transform: `translateX(${p.start - (p.renderOffset || 0)}px)`,
|
|
20576
20731
|
width: `${p.end - p.start}px`,
|
|
20577
20732
|
},
|
|
20578
20733
|
onResize: p.onResize,
|
|
@@ -20580,7 +20735,7 @@ const HeaderGroupRenderer = (p) => {
|
|
|
20580
20735
|
return (hAsync(HeaderCellRenderer, { data: Object.assign(Object.assign({}, p.group), { prop: '', providers: p.providers, index: p.start }), props: groupProps, additionalData: p.additionalData }));
|
|
20581
20736
|
};
|
|
20582
20737
|
|
|
20583
|
-
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}`;
|
|
20738
|
+
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}`;
|
|
20584
20739
|
|
|
20585
20740
|
class RevogrHeaderComponent {
|
|
20586
20741
|
constructor(hostRef) {
|
|
@@ -20613,13 +20768,10 @@ class RevogrHeaderComponent {
|
|
|
20613
20768
|
}
|
|
20614
20769
|
onResizeGroup(changedX, startIndex, endIndex) {
|
|
20615
20770
|
const sizes = {};
|
|
20616
|
-
const cols = keyBy(this.viewportCol.get('items'), 'itemIndex');
|
|
20617
20771
|
const change = changedX / (endIndex - startIndex + 1);
|
|
20618
20772
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
20619
|
-
const item =
|
|
20620
|
-
|
|
20621
|
-
sizes[i] = item.size + change;
|
|
20622
|
-
}
|
|
20773
|
+
const item = getItemByIndex(this.dimensionCol.state, i);
|
|
20774
|
+
sizes[i] = item.end - item.start + change;
|
|
20623
20775
|
}
|
|
20624
20776
|
this.headerresize.emit(sizes);
|
|
20625
20777
|
}
|
|
@@ -20633,12 +20785,13 @@ class RevogrHeaderComponent {
|
|
|
20633
20785
|
const { cells } = this.renderHeaderColumns(cols, range);
|
|
20634
20786
|
const groupRow = this.renderGroupingColumns();
|
|
20635
20787
|
return [
|
|
20636
|
-
hAsync("div", { key: '
|
|
20637
|
-
hAsync("div", { key: '
|
|
20788
|
+
hAsync("div", { key: '3cc466db6bc4df0cd61c47a22c3a0473318e5dd8', class: "group-rgRow" }, groupRow),
|
|
20789
|
+
hAsync("div", { key: '9742a3fa4d4b75073aef5544806f42386ebffdea', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
|
|
20638
20790
|
];
|
|
20639
20791
|
}
|
|
20640
20792
|
renderHeaderColumns(cols, range) {
|
|
20641
|
-
const
|
|
20793
|
+
const columnsToRender = [];
|
|
20794
|
+
const renderOffset = this.viewportCol.get('renderOffset') || 0;
|
|
20642
20795
|
for (let rgCol of cols) {
|
|
20643
20796
|
const colData = this.colData[rgCol.itemIndex];
|
|
20644
20797
|
const props = {
|
|
@@ -20647,6 +20800,7 @@ class RevogrHeaderComponent {
|
|
|
20647
20800
|
data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }),
|
|
20648
20801
|
canFilter: !!this.columnFilter,
|
|
20649
20802
|
canResize: this.canResize,
|
|
20803
|
+
renderOffset,
|
|
20650
20804
|
active: this.resizeHandler,
|
|
20651
20805
|
additionalData: this.additionalData,
|
|
20652
20806
|
onResize: e => this.onResize(e, rgCol.itemIndex),
|
|
@@ -20655,45 +20809,106 @@ class RevogrHeaderComponent {
|
|
|
20655
20809
|
};
|
|
20656
20810
|
const event = this.beforeHeaderRender.emit(props);
|
|
20657
20811
|
if (!event.defaultPrevented) {
|
|
20658
|
-
|
|
20812
|
+
columnsToRender.push(event.detail);
|
|
20659
20813
|
}
|
|
20660
20814
|
}
|
|
20815
|
+
const duplicateProps = this.getDuplicateHeaderProps(columnsToRender);
|
|
20816
|
+
const cells = columnsToRender.map(detail => hAsync(HeaderRenderer, Object.assign({ key: this.getHeaderCellKey(detail.data, this.type, duplicateProps) }, detail)));
|
|
20661
20817
|
return { cells };
|
|
20662
20818
|
}
|
|
20663
20819
|
renderGroupingColumns() {
|
|
20820
|
+
const visibleGroupRange = this.getVisibleGroupRange();
|
|
20821
|
+
return Array.from({ length: this.groupingDepth }, (_, level) => this.renderGroupRow(level, visibleGroupRange)).flat();
|
|
20822
|
+
}
|
|
20823
|
+
renderGroupRow(level, visibleGroupRange) {
|
|
20824
|
+
const groupCells = (this.groups[level] || [])
|
|
20825
|
+
.map(group => this.renderGroupColumn(group, level, visibleGroupRange))
|
|
20826
|
+
.filter((cell) => !!cell);
|
|
20827
|
+
return [
|
|
20828
|
+
...groupCells,
|
|
20829
|
+
hAsync('div', {
|
|
20830
|
+
key: `group-row-${level}`,
|
|
20831
|
+
class: {
|
|
20832
|
+
[HEADER_ROW_CLASS]: true,
|
|
20833
|
+
group: true,
|
|
20834
|
+
},
|
|
20835
|
+
}),
|
|
20836
|
+
];
|
|
20837
|
+
}
|
|
20838
|
+
renderGroupColumn(group, level, visibleGroupRange) {
|
|
20664
20839
|
var _a;
|
|
20665
|
-
const
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
|
|
20686
|
-
|
|
20687
|
-
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
20840
|
+
const groupStartIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
|
|
20841
|
+
if (groupStartIndex < 0) {
|
|
20842
|
+
return;
|
|
20843
|
+
}
|
|
20844
|
+
const groupEndIndex = groupStartIndex + group.indexes.length - 1;
|
|
20845
|
+
if (!visibleGroupRange ||
|
|
20846
|
+
!isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
|
|
20847
|
+
return;
|
|
20848
|
+
}
|
|
20849
|
+
const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
|
|
20850
|
+
const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
|
|
20851
|
+
const props = {
|
|
20852
|
+
providers: this.providers,
|
|
20853
|
+
start: groupStart,
|
|
20854
|
+
end: groupEnd,
|
|
20855
|
+
group,
|
|
20856
|
+
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
20857
|
+
active: this.resizeHandler,
|
|
20858
|
+
canResize: this.canResize,
|
|
20859
|
+
additionalData: this.additionalData,
|
|
20860
|
+
onResize: e => {
|
|
20861
|
+
var _a;
|
|
20862
|
+
return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupStartIndex, groupEndIndex);
|
|
20863
|
+
},
|
|
20864
|
+
};
|
|
20865
|
+
const event = this.beforeGroupHeaderRender.emit(props);
|
|
20866
|
+
if (event.defaultPrevented) {
|
|
20867
|
+
return;
|
|
20868
|
+
}
|
|
20869
|
+
return hAsync(HeaderGroupRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
|
|
20870
|
+
}
|
|
20871
|
+
getVisibleGroupRange() {
|
|
20872
|
+
const visibleColumns = this.viewportCol.get('items');
|
|
20873
|
+
if (!visibleColumns.length) {
|
|
20874
|
+
return;
|
|
20875
|
+
}
|
|
20876
|
+
return visibleColumns.reduce((range, column) => ({
|
|
20877
|
+
start: Math.min(range.start, column.itemIndex),
|
|
20878
|
+
end: Math.max(range.end, column.itemIndex),
|
|
20879
|
+
}), {
|
|
20880
|
+
start: visibleColumns[0].itemIndex,
|
|
20881
|
+
end: visibleColumns[0].itemIndex,
|
|
20882
|
+
});
|
|
20883
|
+
}
|
|
20884
|
+
getHeaderCellKey(column, type, duplicateProps) {
|
|
20885
|
+
if ((column === null || column === void 0 ? void 0 : column.prop) === undefined) {
|
|
20886
|
+
return `${type}-${String(column === null || column === void 0 ? void 0 : column.index)}`;
|
|
20887
|
+
}
|
|
20888
|
+
const propKey = String(column.prop);
|
|
20889
|
+
if (duplicateProps.has(propKey)) {
|
|
20890
|
+
return `${type}-${propKey}-${String(column.index)}`;
|
|
20891
|
+
}
|
|
20892
|
+
return `${type}-${propKey}`;
|
|
20893
|
+
}
|
|
20894
|
+
getDuplicateHeaderProps(columns) {
|
|
20895
|
+
const seenProps = new Set();
|
|
20896
|
+
const duplicateProps = new Set();
|
|
20897
|
+
columns.forEach(({ data }) => {
|
|
20898
|
+
if ((data === null || data === void 0 ? void 0 : data.prop) !== undefined) {
|
|
20899
|
+
const propKey = String(data.prop);
|
|
20900
|
+
if (seenProps.has(propKey)) {
|
|
20901
|
+
duplicateProps.add(propKey);
|
|
20902
|
+
}
|
|
20903
|
+
else {
|
|
20904
|
+
seenProps.add(propKey);
|
|
20692
20905
|
}
|
|
20693
20906
|
}
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20907
|
+
});
|
|
20908
|
+
return duplicateProps;
|
|
20909
|
+
}
|
|
20910
|
+
getGroupHeaderCellKey(group, level) {
|
|
20911
|
+
return `group-${level}-${group.name}-${group.indexes.join('-')}`;
|
|
20697
20912
|
}
|
|
20698
20913
|
get providers() {
|
|
20699
20914
|
return {
|
|
@@ -20729,6 +20944,10 @@ class RevogrHeaderComponent {
|
|
|
20729
20944
|
"$attrsToReflect$": []
|
|
20730
20945
|
}; }
|
|
20731
20946
|
}
|
|
20947
|
+
function isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleRange) {
|
|
20948
|
+
return (groupStartIndex <= visibleRange.end &&
|
|
20949
|
+
groupEndIndex >= visibleRange.start);
|
|
20950
|
+
}
|
|
20732
20951
|
|
|
20733
20952
|
const RowHeaderRender = s => (__, { rowIndex: i }) => s + i;
|
|
20734
20953
|
|
|
@@ -20825,10 +21044,11 @@ const NO_COORDINATE = -1;
|
|
|
20825
21044
|
* return full size
|
|
20826
21045
|
*/
|
|
20827
21046
|
function getContentSize(contentSize, clientSize, virtualSize = 0) {
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
21047
|
+
return getScrollDimension({
|
|
21048
|
+
contentSize,
|
|
21049
|
+
clientSize,
|
|
21050
|
+
virtualSize,
|
|
21051
|
+
}).physicalContentSize;
|
|
20832
21052
|
}
|
|
20833
21053
|
class LocalScrollService {
|
|
20834
21054
|
constructor(cfg) {
|
|
@@ -20842,14 +21062,20 @@ class LocalScrollService {
|
|
|
20842
21062
|
rgRow: NO_COORDINATE,
|
|
20843
21063
|
rgCol: NO_COORDINATE,
|
|
20844
21064
|
};
|
|
21065
|
+
this.previousLogicalScroll = {
|
|
21066
|
+
rgRow: 0,
|
|
21067
|
+
rgCol: 0,
|
|
21068
|
+
};
|
|
20845
21069
|
this.params = {
|
|
20846
21070
|
rgRow: Object.assign({}, initialParams),
|
|
20847
21071
|
rgCol: Object.assign({}, initialParams),
|
|
20848
21072
|
};
|
|
20849
21073
|
}
|
|
20850
21074
|
setParams(params, dimension) {
|
|
20851
|
-
const
|
|
20852
|
-
|
|
21075
|
+
const scrollDimension = getScrollDimension(params);
|
|
21076
|
+
const virtualContentSize = scrollDimension.physicalContentSize;
|
|
21077
|
+
this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize,
|
|
21078
|
+
scrollDimension });
|
|
20853
21079
|
}
|
|
20854
21080
|
// apply scroll values after scroll done
|
|
20855
21081
|
async setScroll(e) {
|
|
@@ -20869,16 +21095,27 @@ class LocalScrollService {
|
|
|
20869
21095
|
await frameAnimation;
|
|
20870
21096
|
const params = this.getParams(e.dimension);
|
|
20871
21097
|
e.coordinate = Math.ceil(e.coordinate);
|
|
20872
|
-
this.
|
|
21098
|
+
this.previousLogicalScroll[e.dimension] = this.wrapLogicalCoordinate(e.coordinate, params);
|
|
21099
|
+
const physicalCoordinate = this.toPhysicalCoordinate(e.coordinate, params);
|
|
21100
|
+
this.previousScroll[e.dimension] = this.wrapPhysicalCoordinate(physicalCoordinate, params);
|
|
20873
21101
|
this.preventArtificialScroll[e.dimension] = null;
|
|
20874
|
-
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate:
|
|
20875
|
-
? this.convert(e.coordinate, params, false)
|
|
20876
|
-
: e.coordinate }));
|
|
21102
|
+
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: physicalCoordinate }));
|
|
20877
21103
|
}
|
|
20878
21104
|
catch (id) {
|
|
20879
21105
|
window.cancelAnimationFrame(id);
|
|
20880
21106
|
}
|
|
20881
21107
|
}
|
|
21108
|
+
async setScrollByDelta(e, currentPhysicalCoordinate) {
|
|
21109
|
+
var _a;
|
|
21110
|
+
const params = this.getParams(e.dimension);
|
|
21111
|
+
const baseCoordinate = this.previousScroll[e.dimension] === NO_COORDINATE
|
|
21112
|
+
? this.toLogicalCoordinate(currentPhysicalCoordinate, params)
|
|
21113
|
+
: this.previousLogicalScroll[e.dimension];
|
|
21114
|
+
const coordinate = this.wrapLogicalCoordinate(baseCoordinate + ((_a = e.delta) !== null && _a !== void 0 ? _a : 0), params);
|
|
21115
|
+
const nextEvent = Object.assign(Object.assign({}, e), { coordinate });
|
|
21116
|
+
await this.setScroll(nextEvent);
|
|
21117
|
+
return nextEvent;
|
|
21118
|
+
}
|
|
20882
21119
|
/**
|
|
20883
21120
|
* On scroll event started
|
|
20884
21121
|
*/
|
|
@@ -20891,21 +21128,21 @@ class LocalScrollService {
|
|
|
20891
21128
|
return;
|
|
20892
21129
|
}
|
|
20893
21130
|
const param = this.getParams(dimension);
|
|
21131
|
+
const logicalCoordinate = this.toLogicalScrollCoordinate(coordinate, dimension, param, delta);
|
|
20894
21132
|
// let component know about scroll event started
|
|
20895
21133
|
this.cfg.runScroll({
|
|
20896
21134
|
dimension: dimension,
|
|
20897
|
-
coordinate:
|
|
20898
|
-
? this.convert(coordinate, param)
|
|
20899
|
-
: coordinate,
|
|
21135
|
+
coordinate: logicalCoordinate,
|
|
20900
21136
|
delta,
|
|
20901
21137
|
outside,
|
|
20902
21138
|
});
|
|
21139
|
+
this.previousLogicalScroll[dimension] = logicalCoordinate;
|
|
20903
21140
|
}
|
|
20904
21141
|
getParams(dimension) {
|
|
20905
21142
|
return this.params[dimension];
|
|
20906
21143
|
}
|
|
20907
21144
|
// check if scroll outside of region to avoid looping
|
|
20908
|
-
|
|
21145
|
+
wrapPhysicalCoordinate(c, param) {
|
|
20909
21146
|
if (c < 0) {
|
|
20910
21147
|
return NO_COORDINATE;
|
|
20911
21148
|
}
|
|
@@ -20914,22 +21151,39 @@ class LocalScrollService {
|
|
|
20914
21151
|
}
|
|
20915
21152
|
return c;
|
|
20916
21153
|
}
|
|
21154
|
+
wrapLogicalCoordinate(c, param) {
|
|
21155
|
+
var _a, _b;
|
|
21156
|
+
if (c < 0) {
|
|
21157
|
+
return 0;
|
|
21158
|
+
}
|
|
21159
|
+
return Math.min(c, (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.logicalScrollSize) !== null && _b !== void 0 ? _b : c);
|
|
21160
|
+
}
|
|
20917
21161
|
// prevent already started scroll, performance optimization
|
|
20918
21162
|
cancelScroll(dimension) {
|
|
20919
21163
|
var _a, _b;
|
|
20920
21164
|
(_b = (_a = this.preventArtificialScroll)[dimension]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
20921
21165
|
this.preventArtificialScroll[dimension] = null;
|
|
20922
21166
|
}
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
const from = [0, ((_a = param.virtualContentSize) !== null && _a !== void 0 ? _a : minRange) - minRange];
|
|
20928
|
-
const to = [0, param.contentSize - param.virtualSize];
|
|
20929
|
-
if (toReal) {
|
|
20930
|
-
return scaleValue(pos, from, to);
|
|
21167
|
+
toLogicalScrollCoordinate(coordinate, dimension, param, delta) {
|
|
21168
|
+
const scrollDimension = param.scrollDimension;
|
|
21169
|
+
if (!scrollDimension) {
|
|
21170
|
+
return coordinate;
|
|
20931
21171
|
}
|
|
20932
|
-
|
|
21172
|
+
if (typeof delta === 'number' && scrollDimension.isCompressed) {
|
|
21173
|
+
const base = this.previousScroll[dimension] === NO_COORDINATE
|
|
21174
|
+
? scrollDimension.toLogicalCoordinate(coordinate - delta)
|
|
21175
|
+
: this.previousLogicalScroll[dimension];
|
|
21176
|
+
return scrollDimension.toLogicalCoordinate(scrollDimension.toPhysicalCoordinate(base + delta));
|
|
21177
|
+
}
|
|
21178
|
+
return scrollDimension.toLogicalCoordinate(coordinate);
|
|
21179
|
+
}
|
|
21180
|
+
toPhysicalCoordinate(coordinate, param) {
|
|
21181
|
+
var _a, _b;
|
|
21182
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toPhysicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
21183
|
+
}
|
|
21184
|
+
toLogicalCoordinate(coordinate, param) {
|
|
21185
|
+
var _a, _b;
|
|
21186
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toLogicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
20933
21187
|
}
|
|
20934
21188
|
}
|
|
20935
21189
|
|
|
@@ -21087,15 +21341,9 @@ class RevogrScrollVirtual {
|
|
|
21087
21341
|
*/
|
|
21088
21342
|
async changeScroll(e) {
|
|
21089
21343
|
if (e.delta) {
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
break;
|
|
21094
|
-
case 'rgRow':
|
|
21095
|
-
e.coordinate = this.element.scrollTop + e.delta;
|
|
21096
|
-
break;
|
|
21097
|
-
}
|
|
21098
|
-
this.setScroll(e);
|
|
21344
|
+
const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
21345
|
+
const currentPhysicalCoordinate = this.element[scrollProperty];
|
|
21346
|
+
return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
|
|
21099
21347
|
}
|
|
21100
21348
|
return e;
|
|
21101
21349
|
}
|
|
@@ -21158,7 +21406,7 @@ class RevogrScrollVirtual {
|
|
|
21158
21406
|
}
|
|
21159
21407
|
render() {
|
|
21160
21408
|
const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
|
|
21161
|
-
return (hAsync(Host, { key: '
|
|
21409
|
+
return (hAsync(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
|
|
21162
21410
|
[this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
|
|
21163
21411
|
} })));
|
|
21164
21412
|
}
|
|
@@ -21267,7 +21515,7 @@ class RevogrViewportScroll {
|
|
|
21267
21515
|
* @param e
|
|
21268
21516
|
*/
|
|
21269
21517
|
async changeScroll(e, silent = false) {
|
|
21270
|
-
var _a, _b;
|
|
21518
|
+
var _a, _b, _c, _d;
|
|
21271
21519
|
if (silent) {
|
|
21272
21520
|
if (e.coordinate && this.verticalScroll) {
|
|
21273
21521
|
switch (e.dimension) {
|
|
@@ -21280,15 +21528,16 @@ class RevogrViewportScroll {
|
|
|
21280
21528
|
return;
|
|
21281
21529
|
}
|
|
21282
21530
|
if (e.delta) {
|
|
21531
|
+
let currentPhysicalCoordinate = 0;
|
|
21283
21532
|
switch (e.dimension) {
|
|
21284
21533
|
case 'rgCol':
|
|
21285
|
-
|
|
21534
|
+
currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
|
|
21286
21535
|
break;
|
|
21287
21536
|
case 'rgRow':
|
|
21288
|
-
|
|
21537
|
+
currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
|
|
21289
21538
|
break;
|
|
21290
21539
|
}
|
|
21291
|
-
this.
|
|
21540
|
+
return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
|
|
21292
21541
|
}
|
|
21293
21542
|
return e;
|
|
21294
21543
|
}
|
|
@@ -21440,7 +21689,10 @@ class RevogrViewportScroll {
|
|
|
21440
21689
|
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21441
21690
|
}
|
|
21442
21691
|
render() {
|
|
21443
|
-
|
|
21692
|
+
var _a, _b, _c, _d;
|
|
21693
|
+
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
21694
|
+
const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
21695
|
+
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 })))));
|
|
21444
21696
|
}
|
|
21445
21697
|
/**
|
|
21446
21698
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|