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