@revolist/revogrid 4.23.0 → 4.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cell-renderer-DWJ9Px9f.js → cell-renderer-Dcz022q7.js} +1 -1
- package/dist/cjs/{column.drag.plugin-CaEBDG-Q.js → column.drag.plugin-DJueWxN_.js} +2 -2
- package/dist/cjs/{column.service-f612L4ql.js → column.service-C1Qvcf5l.js} +9 -0
- package/dist/cjs/{header-cell-renderer-4yq9_WbM.js → header-cell-renderer-QrcXXSkF.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/revo-grid.cjs.entry.js +92 -6
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +51 -18
- package/dist/collection/components/header/revogr-header.js +49 -16
- package/dist/collection/components/revoGrid/revo-grid.js +63 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +9 -0
- package/dist/collection/services/selection.store.connector.js +26 -3
- package/dist/esm/{cell-renderer-8UiGd-s7.js → cell-renderer-BtN-NGCk.js} +1 -1
- package/dist/esm/{column.drag.plugin-BsfhsfmB.js → column.drag.plugin-DCZW62Uc.js} +2 -2
- package/dist/esm/{column.service-DbpulTog.js → column.service-CC_SD8W3.js} +9 -0
- package/dist/esm/{header-cell-renderer-DGI2FAD8.js → header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/revo-grid.entry.js +92 -6
- package/dist/esm/revogr-attribution_7.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +51 -18
- package/dist/revo-grid/{cell-renderer-8UiGd-s7.js → cell-renderer-BtN-NGCk.js} +1 -1
- package/dist/revo-grid/{column.drag.plugin-BsfhsfmB.js → column.drag.plugin-DCZW62Uc.js} +2 -2
- package/dist/revo-grid/{column.service-DbpulTog.js → column.service-CC_SD8W3.js} +9 -0
- package/dist/revo-grid/{header-cell-renderer-DGI2FAD8.js → header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/revo-grid/index.esm.js +5 -5
- package/dist/revo-grid/revo-grid.entry.js +92 -6
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +51 -18
- package/dist/types/components/header/header-group-renderer.d.ts +1 -0
- package/dist/types/components/header/revogr-header.d.ts +2 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
- package/dist/types/services/selection.store.connector.d.ts +6 -0
- package/dist/types/types/selection.d.ts +13 -0
- package/hydrate/index.js +146 -18
- package/hydrate/index.mjs +146 -18
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-header2.js +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
7
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
8
|
-
var column_service = require('./column.service-
|
|
8
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Renders sorting direction and optional additive sorting rank.
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var column_service = require('./column.service-
|
|
6
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
7
7
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
8
8
|
var viewport_store = require('./viewport.store-BlKQ4x9H.js');
|
|
9
9
|
var index$1 = require('./index-DxaSE5uZ.js');
|
|
10
10
|
var index = require('./index-Dq8Xzj5l.js');
|
|
11
11
|
var filter_button = require('./filter.button-w6LWnyhi.js');
|
|
12
12
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
13
|
-
var headerCellRenderer = require('./header-cell-renderer-
|
|
13
|
+
var headerCellRenderer = require('./header-cell-renderer-QrcXXSkF.js');
|
|
14
14
|
|
|
15
15
|
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
16
16
|
const safeCount = Math.max(0, count);
|
|
@@ -439,6 +439,9 @@ const GROUPING_ROW_TYPE = 'rgRow';
|
|
|
439
439
|
function getGroupValueDefault(item, prop) {
|
|
440
440
|
return item[prop] || null;
|
|
441
441
|
}
|
|
442
|
+
function isDataRow(item) {
|
|
443
|
+
return item != null;
|
|
444
|
+
}
|
|
442
445
|
// get source based on proxy item collection to preserve rgRow order
|
|
443
446
|
function getSource(source, items, withoutGrouping = false) {
|
|
444
447
|
let index = 0;
|
|
@@ -460,6 +463,9 @@ function getSource(source, items, withoutGrouping = false) {
|
|
|
460
463
|
result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
|
|
461
464
|
}
|
|
462
465
|
}
|
|
466
|
+
else if (!isDataRow(model)) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
463
469
|
else {
|
|
464
470
|
result.source.push(model);
|
|
465
471
|
result.oldNewIndexes[i] = index;
|
|
@@ -540,6 +546,9 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
|
|
|
540
546
|
function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
|
|
541
547
|
const groupedItems = new Map();
|
|
542
548
|
array.forEach((item, originalIndex) => {
|
|
549
|
+
if (!isDataRow(item)) {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
543
552
|
const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
|
|
544
553
|
const lastLevelValue = groupLevelValues.pop();
|
|
545
554
|
let currentGroupLevel = groupedItems;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var column_service = require('./column.service-
|
|
7
|
-
var column_drag_plugin = require('./column.drag.plugin-
|
|
8
|
-
var headerCellRenderer = require('./header-cell-renderer-
|
|
9
|
-
var cellRenderer = require('./cell-renderer-
|
|
6
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
7
|
+
var column_drag_plugin = require('./column.drag.plugin-DJueWxN_.js');
|
|
8
|
+
var headerCellRenderer = require('./header-cell-renderer-QrcXXSkF.js');
|
|
9
|
+
var cellRenderer = require('./cell-renderer-Dcz022q7.js');
|
|
10
10
|
var index$1 = require('./index-DxaSE5uZ.js');
|
|
11
11
|
var textEditor = require('./text-editor-B4W-m-r-.js');
|
|
12
12
|
var edit_utils = require('./edit.utils-pKeiYFLJ.js');
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
|
-
var column_service = require('./column.service-
|
|
7
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
8
8
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
9
9
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
10
10
|
var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
|
|
11
11
|
var viewport_store = require('./viewport.store-BlKQ4x9H.js');
|
|
12
|
-
var column_drag_plugin = require('./column.drag.plugin-
|
|
12
|
+
var column_drag_plugin = require('./column.drag.plugin-DJueWxN_.js');
|
|
13
13
|
var theme_service = require('./theme.service-BgnxGIjK.js');
|
|
14
14
|
var index$1 = require('./index-DxaSE5uZ.js');
|
|
15
15
|
var events = require('./events-DeLDyZlb.js');
|
|
16
16
|
require('./filter.button-w6LWnyhi.js');
|
|
17
|
-
require('./header-cell-renderer-
|
|
17
|
+
require('./header-cell-renderer-QrcXXSkF.js');
|
|
18
18
|
|
|
19
19
|
class ColumnDataProvider {
|
|
20
20
|
get stores() {
|
|
@@ -784,13 +784,11 @@ class SelectionStoreConnector {
|
|
|
784
784
|
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
785
785
|
}
|
|
786
786
|
registerColumn(x, type) {
|
|
787
|
+
this.updateColumnTypeMapping(x, type);
|
|
787
788
|
if (this.columnStores[x]) {
|
|
788
789
|
return this.columnStores[x];
|
|
789
790
|
}
|
|
790
791
|
this.columnStores[x] = new column_drag_plugin.SelectionStore();
|
|
791
|
-
// build cross-linking type to position
|
|
792
|
-
this.storesByType[type] = x;
|
|
793
|
-
this.storesXToType[x] = type;
|
|
794
792
|
return this.columnStores[x];
|
|
795
793
|
}
|
|
796
794
|
registerRow(y, type) {
|
|
@@ -1011,6 +1009,31 @@ class SelectionStoreConnector {
|
|
|
1011
1009
|
}
|
|
1012
1010
|
return stores;
|
|
1013
1011
|
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Keep column viewport positions and types in sync across pin/unpin rerenders.
|
|
1014
|
+
* Regression case: when a selected rgCol cell was pinned left, colPinStart
|
|
1015
|
+
* could take over x=0 and render the stale rgCol focus store in the pinned area.
|
|
1016
|
+
*/
|
|
1017
|
+
updateColumnTypeMapping(x, type) {
|
|
1018
|
+
const previousType = this.storesXToType[x];
|
|
1019
|
+
const previousX = this.storesByType[type];
|
|
1020
|
+
let shouldClearFocus = false;
|
|
1021
|
+
this.storesByType[type] = x;
|
|
1022
|
+
this.storesXToType[x] = type;
|
|
1023
|
+
if (previousType && previousType !== type) {
|
|
1024
|
+
shouldClearFocus = true;
|
|
1025
|
+
if (this.storesByType[previousType] === x) {
|
|
1026
|
+
delete this.storesByType[previousType];
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
if (typeof previousX === 'number' && previousX !== x && this.storesXToType[previousX] === type) {
|
|
1030
|
+
delete this.storesXToType[previousX];
|
|
1031
|
+
shouldClearFocus = true;
|
|
1032
|
+
}
|
|
1033
|
+
if (shouldClearFocus) {
|
|
1034
|
+
this.clearAll();
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1014
1037
|
}
|
|
1015
1038
|
|
|
1016
1039
|
/**
|
|
@@ -1960,6 +1983,7 @@ const RevoGridComponent = class {
|
|
|
1960
1983
|
if (!this.dimensionProvider || !this.columnProvider) {
|
|
1961
1984
|
return;
|
|
1962
1985
|
}
|
|
1986
|
+
const focusToRestore = init ? undefined : this.getColumnFocusRestore();
|
|
1963
1987
|
const beforeGatherEvent = this.beforecolumnsgather.emit({
|
|
1964
1988
|
columns: [...newVal],
|
|
1965
1989
|
});
|
|
@@ -1977,6 +2001,9 @@ const RevoGridComponent = class {
|
|
|
1977
2001
|
return;
|
|
1978
2002
|
}
|
|
1979
2003
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
2004
|
+
if (focusToRestore) {
|
|
2005
|
+
this.pendingColumnFocusRestore = focusToRestore;
|
|
2006
|
+
}
|
|
1980
2007
|
const order = {};
|
|
1981
2008
|
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
1982
2009
|
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
@@ -1986,6 +2013,64 @@ const RevoGridComponent = class {
|
|
|
1986
2013
|
order,
|
|
1987
2014
|
});
|
|
1988
2015
|
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Capture logical focus before columns are repartitioned by pin state.
|
|
2018
|
+
* Regression case: selecting a regular cell, then pinning that column left,
|
|
2019
|
+
* used to let the new pinned viewport reuse the old rgCol selection store.
|
|
2020
|
+
*/
|
|
2021
|
+
getColumnFocusRestore() {
|
|
2022
|
+
var _a, _b, _c, _d;
|
|
2023
|
+
const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
|
|
2024
|
+
const prevStoreX = (_c = (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.focusedStore) === null || _c === void 0 ? void 0 : _c.position.x;
|
|
2025
|
+
const prop = (_d = focused === null || focused === void 0 ? void 0 : focused.column) === null || _d === void 0 ? void 0 : _d.prop;
|
|
2026
|
+
if (!focused || prop === undefined || prevStoreX === undefined) {
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
return {
|
|
2030
|
+
prop,
|
|
2031
|
+
colType: focused.colType,
|
|
2032
|
+
colIndex: focused.cell.x,
|
|
2033
|
+
prevStoreX,
|
|
2034
|
+
rowType: focused.rowType,
|
|
2035
|
+
rowIndex: focused.cell.y,
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Reapply focus by column prop after render, once pinning has moved the
|
|
2040
|
+
* column to its new viewport and virtual index.
|
|
2041
|
+
*/
|
|
2042
|
+
restoreColumnFocusAfterRender() {
|
|
2043
|
+
var _a, _b, _c, _d;
|
|
2044
|
+
const pending = this.pendingColumnFocusRestore;
|
|
2045
|
+
if (!pending) {
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
this.pendingColumnFocusRestore = undefined;
|
|
2049
|
+
if (!this.viewport || !this.columnProvider) {
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
const column = (_b = (_a = this.columnProvider.getColumnByProp(pending.prop)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : column_service.getColumnByProp(this.columns, pending.prop);
|
|
2053
|
+
if (!column) {
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
const colType = column.pin || 'rgCol';
|
|
2057
|
+
const columnIndex = this.columnProvider.getColumnIndexByProp(pending.prop, colType);
|
|
2058
|
+
if (columnIndex < 0) {
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
// Header-only column refreshes should not collapse an existing range.
|
|
2062
|
+
// Replay focus only when pin/unpin or repartitioning moved the logical column.
|
|
2063
|
+
if (colType === pending.colType &&
|
|
2064
|
+
columnIndex === pending.colIndex &&
|
|
2065
|
+
pending.prevStoreX === ((_d = (_c = this.selectionStoreConnector) === null || _c === void 0 ? void 0 : _c.focusedStore) === null || _d === void 0 ? void 0 : _d.position.x)) {
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
const cell = {
|
|
2069
|
+
x: columnIndex,
|
|
2070
|
+
y: pending.rowIndex,
|
|
2071
|
+
};
|
|
2072
|
+
this.viewport.setFocus(colType, pending.rowType, cell, cell);
|
|
2073
|
+
}
|
|
1989
2074
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
1990
2075
|
if (newVal === prevVal) {
|
|
1991
2076
|
return;
|
|
@@ -2298,6 +2383,7 @@ const RevoGridComponent = class {
|
|
|
2298
2383
|
return Promise.all(this.jobsBeforeRender);
|
|
2299
2384
|
}
|
|
2300
2385
|
componentDidRender() {
|
|
2386
|
+
this.restoreColumnFocusAfterRender();
|
|
2301
2387
|
this.aftergridrender.emit();
|
|
2302
2388
|
}
|
|
2303
2389
|
render() {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
7
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
8
8
|
var events = require('./events-DeLDyZlb.js');
|
|
9
|
-
var column_service = require('./column.service-
|
|
9
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
10
10
|
var edit_utils = require('./edit.utils-pKeiYFLJ.js');
|
|
11
11
|
var index$1 = require('./index-DxaSE5uZ.js');
|
|
12
12
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
var index = require('./index-Dq8Xzj5l.js');
|
|
7
|
-
var column_service = require('./column.service-
|
|
7
|
+
var column_service = require('./column.service-C1Qvcf5l.js');
|
|
8
8
|
var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
|
|
9
|
-
var cellRenderer = require('./cell-renderer-
|
|
9
|
+
var cellRenderer = require('./cell-renderer-Dcz022q7.js');
|
|
10
10
|
var filter_button = require('./filter.button-w6LWnyhi.js');
|
|
11
|
-
var headerCellRenderer = require('./header-cell-renderer-
|
|
11
|
+
var headerCellRenderer = require('./header-cell-renderer-QrcXXSkF.js');
|
|
12
12
|
var throttle = require('./throttle-BCwEuJJq.js');
|
|
13
13
|
var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
|
|
14
14
|
require('./debounce-CcpHiH2p.js');
|
|
@@ -436,22 +436,13 @@ const RevogrHeaderComponent = class {
|
|
|
436
436
|
];
|
|
437
437
|
}
|
|
438
438
|
renderGroupColumn(group, level, visibleGroupRange) {
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
if (groupStartIndex < 0) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
const groupEndIndex = groupStartIndex + group.indexes.length - 1;
|
|
445
|
-
if (!visibleGroupRange ||
|
|
446
|
-
!isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
|
|
447
|
-
return;
|
|
448
|
-
}
|
|
449
|
-
const groupStart = dimension_helpers.getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
|
|
450
|
-
const groupEnd = dimension_helpers.getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
|
|
439
|
+
const groupRange = this.getGroupIndexRange(group);
|
|
440
|
+
const groupBounds = this.getGroupBounds(groupRange);
|
|
451
441
|
const props = {
|
|
442
|
+
level,
|
|
452
443
|
providers: this.providers,
|
|
453
|
-
start:
|
|
454
|
-
end:
|
|
444
|
+
start: groupBounds.start,
|
|
445
|
+
end: groupBounds.end,
|
|
455
446
|
group,
|
|
456
447
|
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
457
448
|
active: this.resizeHandler,
|
|
@@ -459,15 +450,57 @@ const RevogrHeaderComponent = class {
|
|
|
459
450
|
additionalData: this.additionalData,
|
|
460
451
|
onResize: e => {
|
|
461
452
|
var _a;
|
|
462
|
-
return
|
|
453
|
+
return groupRange
|
|
454
|
+
? this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupRange.startIndex, groupRange.endIndex)
|
|
455
|
+
: undefined;
|
|
463
456
|
},
|
|
464
457
|
};
|
|
465
458
|
const event = this.beforeGroupHeaderRender.emit(props);
|
|
466
459
|
if (event.defaultPrevented) {
|
|
467
460
|
return;
|
|
468
461
|
}
|
|
462
|
+
const renderRange = this.getGroupIndexRange(event.detail.group);
|
|
463
|
+
if (!renderRange ||
|
|
464
|
+
!visibleGroupRange ||
|
|
465
|
+
!isGroupInVisibleRange(renderRange.startIndex, renderRange.endIndex, visibleGroupRange)) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (event.detail.onResize === props.onResize) {
|
|
469
|
+
event.detail.onResize = e => {
|
|
470
|
+
var _a;
|
|
471
|
+
return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, renderRange.startIndex, renderRange.endIndex);
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
const renderBounds = this.getGroupBounds(renderRange);
|
|
475
|
+
if (event.detail.start === props.start) {
|
|
476
|
+
event.detail.start = renderBounds.start;
|
|
477
|
+
}
|
|
478
|
+
if (event.detail.end === props.end) {
|
|
479
|
+
event.detail.end = renderBounds.end;
|
|
480
|
+
}
|
|
469
481
|
return index.h(HeaderGroupRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
|
|
470
482
|
}
|
|
483
|
+
getGroupIndexRange(group) {
|
|
484
|
+
var _a;
|
|
485
|
+
const startIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
|
|
486
|
+
if (startIndex < 0) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const endIndex = group.indexes[group.indexes.length - 1];
|
|
490
|
+
return {
|
|
491
|
+
startIndex,
|
|
492
|
+
endIndex,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
getGroupBounds(range) {
|
|
496
|
+
if (!range) {
|
|
497
|
+
return { start: 0, end: 0 };
|
|
498
|
+
}
|
|
499
|
+
return {
|
|
500
|
+
start: dimension_helpers.getItemByIndex(this.dimensionCol.state, range.startIndex).start,
|
|
501
|
+
end: dimension_helpers.getItemByIndex(this.dimensionCol.state, range.endIndex).end,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
471
504
|
getVisibleGroupRange() {
|
|
472
505
|
const visibleColumns = this.viewportCol.get('items');
|
|
473
506
|
if (!visibleColumns.length) {
|
|
@@ -97,22 +97,13 @@ export class RevogrHeaderComponent {
|
|
|
97
97
|
];
|
|
98
98
|
}
|
|
99
99
|
renderGroupColumn(group, level, visibleGroupRange) {
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
if (groupStartIndex < 0) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const groupEndIndex = groupStartIndex + group.indexes.length - 1;
|
|
106
|
-
if (!visibleGroupRange ||
|
|
107
|
-
!isGroupInVisibleRange(groupStartIndex, groupEndIndex, visibleGroupRange)) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const groupStart = getItemByIndex(this.dimensionCol.state, groupStartIndex).start;
|
|
111
|
-
const groupEnd = getItemByIndex(this.dimensionCol.state, groupEndIndex).end;
|
|
100
|
+
const groupRange = this.getGroupIndexRange(group);
|
|
101
|
+
const groupBounds = this.getGroupBounds(groupRange);
|
|
112
102
|
const props = {
|
|
103
|
+
level,
|
|
113
104
|
providers: this.providers,
|
|
114
|
-
start:
|
|
115
|
-
end:
|
|
105
|
+
start: groupBounds.start,
|
|
106
|
+
end: groupBounds.end,
|
|
116
107
|
group,
|
|
117
108
|
renderOffset: this.viewportCol.get('renderOffset') || 0,
|
|
118
109
|
active: this.resizeHandler,
|
|
@@ -120,15 +111,57 @@ export class RevogrHeaderComponent {
|
|
|
120
111
|
additionalData: this.additionalData,
|
|
121
112
|
onResize: e => {
|
|
122
113
|
var _a;
|
|
123
|
-
return
|
|
114
|
+
return groupRange
|
|
115
|
+
? this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, groupRange.startIndex, groupRange.endIndex)
|
|
116
|
+
: undefined;
|
|
124
117
|
},
|
|
125
118
|
};
|
|
126
119
|
const event = this.beforeGroupHeaderRender.emit(props);
|
|
127
120
|
if (event.defaultPrevented) {
|
|
128
121
|
return;
|
|
129
122
|
}
|
|
123
|
+
const renderRange = this.getGroupIndexRange(event.detail.group);
|
|
124
|
+
if (!renderRange ||
|
|
125
|
+
!visibleGroupRange ||
|
|
126
|
+
!isGroupInVisibleRange(renderRange.startIndex, renderRange.endIndex, visibleGroupRange)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (event.detail.onResize === props.onResize) {
|
|
130
|
+
event.detail.onResize = e => {
|
|
131
|
+
var _a;
|
|
132
|
+
return this.onResizeGroup((_a = e.changedX) !== null && _a !== void 0 ? _a : 0, renderRange.startIndex, renderRange.endIndex);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const renderBounds = this.getGroupBounds(renderRange);
|
|
136
|
+
if (event.detail.start === props.start) {
|
|
137
|
+
event.detail.start = renderBounds.start;
|
|
138
|
+
}
|
|
139
|
+
if (event.detail.end === props.end) {
|
|
140
|
+
event.detail.end = renderBounds.end;
|
|
141
|
+
}
|
|
130
142
|
return h(GroupHeaderRenderer, Object.assign({ key: this.getGroupHeaderCellKey(event.detail.group, level) }, event.detail));
|
|
131
143
|
}
|
|
144
|
+
getGroupIndexRange(group) {
|
|
145
|
+
var _a;
|
|
146
|
+
const startIndex = (_a = group.indexes[0]) !== null && _a !== void 0 ? _a : -1;
|
|
147
|
+
if (startIndex < 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const endIndex = group.indexes[group.indexes.length - 1];
|
|
151
|
+
return {
|
|
152
|
+
startIndex,
|
|
153
|
+
endIndex,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
getGroupBounds(range) {
|
|
157
|
+
if (!range) {
|
|
158
|
+
return { start: 0, end: 0 };
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
start: getItemByIndex(this.dimensionCol.state, range.startIndex).start,
|
|
162
|
+
end: getItemByIndex(this.dimensionCol.state, range.endIndex).end,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
132
165
|
getVisibleGroupRange() {
|
|
133
166
|
const visibleColumns = this.viewportCol.get('items');
|
|
134
167
|
if (!visibleColumns.length) {
|
|
@@ -604,7 +637,7 @@ export class RevogrHeaderComponent {
|
|
|
604
637
|
},
|
|
605
638
|
"complexType": {
|
|
606
639
|
"original": "HeaderGroupRendererProps",
|
|
607
|
-
"resolved": "{ start: number; end: number; group: Group; providers: ProvidersColumns<DimensionCols | \"rowHeaders\">; additionalData: any; canResize?: boolean | undefined; renderOffset?: number | undefined; onResize?(e: ResizeEvent): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
640
|
+
"resolved": "{ level: number; start: number; end: number; group: Group; providers: ProvidersColumns<DimensionCols | \"rowHeaders\">; additionalData: any; canResize?: boolean | undefined; renderOffset?: number | undefined; onResize?(e: ResizeEvent): void; } & Partial<Pick<ResizeProps, \"active\">>",
|
|
608
641
|
"references": {
|
|
609
642
|
"HeaderGroupRendererProps": {
|
|
610
643
|
"location": "import",
|
|
@@ -609,6 +609,7 @@ export class RevoGridComponent {
|
|
|
609
609
|
if (!this.dimensionProvider || !this.columnProvider) {
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
|
+
const focusToRestore = init ? undefined : this.getColumnFocusRestore();
|
|
612
613
|
const beforeGatherEvent = this.beforecolumnsgather.emit({
|
|
613
614
|
columns: [...newVal],
|
|
614
615
|
});
|
|
@@ -626,6 +627,9 @@ export class RevoGridComponent {
|
|
|
626
627
|
return;
|
|
627
628
|
}
|
|
628
629
|
const columns = this.columnProvider.setColumns(beforeApplyEvent.detail);
|
|
630
|
+
if (focusToRestore) {
|
|
631
|
+
this.pendingColumnFocusRestore = focusToRestore;
|
|
632
|
+
}
|
|
629
633
|
const order = {};
|
|
630
634
|
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
631
635
|
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
@@ -635,6 +639,64 @@ export class RevoGridComponent {
|
|
|
635
639
|
order,
|
|
636
640
|
});
|
|
637
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* Capture logical focus before columns are repartitioned by pin state.
|
|
644
|
+
* Regression case: selecting a regular cell, then pinning that column left,
|
|
645
|
+
* used to let the new pinned viewport reuse the old rgCol selection store.
|
|
646
|
+
*/
|
|
647
|
+
getColumnFocusRestore() {
|
|
648
|
+
var _a, _b, _c, _d;
|
|
649
|
+
const focused = (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.getFocused();
|
|
650
|
+
const prevStoreX = (_c = (_b = this.selectionStoreConnector) === null || _b === void 0 ? void 0 : _b.focusedStore) === null || _c === void 0 ? void 0 : _c.position.x;
|
|
651
|
+
const prop = (_d = focused === null || focused === void 0 ? void 0 : focused.column) === null || _d === void 0 ? void 0 : _d.prop;
|
|
652
|
+
if (!focused || prop === undefined || prevStoreX === undefined) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
prop,
|
|
657
|
+
colType: focused.colType,
|
|
658
|
+
colIndex: focused.cell.x,
|
|
659
|
+
prevStoreX,
|
|
660
|
+
rowType: focused.rowType,
|
|
661
|
+
rowIndex: focused.cell.y,
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Reapply focus by column prop after render, once pinning has moved the
|
|
666
|
+
* column to its new viewport and virtual index.
|
|
667
|
+
*/
|
|
668
|
+
restoreColumnFocusAfterRender() {
|
|
669
|
+
var _a, _b, _c, _d;
|
|
670
|
+
const pending = this.pendingColumnFocusRestore;
|
|
671
|
+
if (!pending) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
this.pendingColumnFocusRestore = undefined;
|
|
675
|
+
if (!this.viewport || !this.columnProvider) {
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const column = (_b = (_a = this.columnProvider.getColumnByProp(pending.prop)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : getColumnByProp(this.columns, pending.prop);
|
|
679
|
+
if (!column) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
const colType = column.pin || 'rgCol';
|
|
683
|
+
const columnIndex = this.columnProvider.getColumnIndexByProp(pending.prop, colType);
|
|
684
|
+
if (columnIndex < 0) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
// Header-only column refreshes should not collapse an existing range.
|
|
688
|
+
// Replay focus only when pin/unpin or repartitioning moved the logical column.
|
|
689
|
+
if (colType === pending.colType &&
|
|
690
|
+
columnIndex === pending.colIndex &&
|
|
691
|
+
pending.prevStoreX === ((_d = (_c = this.selectionStoreConnector) === null || _c === void 0 ? void 0 : _c.focusedStore) === null || _d === void 0 ? void 0 : _d.position.x)) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const cell = {
|
|
695
|
+
x: columnIndex,
|
|
696
|
+
y: pending.rowIndex,
|
|
697
|
+
};
|
|
698
|
+
this.viewport.setFocus(colType, pending.rowType, cell, cell);
|
|
699
|
+
}
|
|
638
700
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
639
701
|
if (newVal === prevVal) {
|
|
640
702
|
return;
|
|
@@ -947,6 +1009,7 @@ export class RevoGridComponent {
|
|
|
947
1009
|
return Promise.all(this.jobsBeforeRender);
|
|
948
1010
|
}
|
|
949
1011
|
componentDidRender() {
|
|
1012
|
+
this.restoreColumnFocusAfterRender();
|
|
950
1013
|
this.aftergridrender.emit();
|
|
951
1014
|
}
|
|
952
1015
|
render() {
|
|
@@ -5,6 +5,9 @@ import { GROUP_DEPTH, GROUP_EXPANDED, PSEUDO_GROUP_COLUMN, PSEUDO_GROUP_ITEM, PS
|
|
|
5
5
|
function getGroupValueDefault(item, prop) {
|
|
6
6
|
return item[prop] || null;
|
|
7
7
|
}
|
|
8
|
+
function isDataRow(item) {
|
|
9
|
+
return item != null;
|
|
10
|
+
}
|
|
8
11
|
// get source based on proxy item collection to preserve rgRow order
|
|
9
12
|
export function getSource(source, items, withoutGrouping = false) {
|
|
10
13
|
let index = 0;
|
|
@@ -26,6 +29,9 @@ export function getSource(source, items, withoutGrouping = false) {
|
|
|
26
29
|
result.prevExpanded[model[PSEUDO_GROUP_ITEM_VALUE]] = true;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
else if (!isDataRow(model)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
else {
|
|
30
36
|
result.source.push(model);
|
|
31
37
|
result.oldNewIndexes[i] = index;
|
|
@@ -106,6 +112,9 @@ function flattenGroupMaps({ groupedValues, parentIds, isExpanded, itemIndex, exp
|
|
|
106
112
|
export function gatherGrouping(array, columnProps, { prevExpanded = {}, expandedAll = false, getGroupValue = getGroupValueDefault, }) {
|
|
107
113
|
const groupedItems = new Map();
|
|
108
114
|
array.forEach((item, originalIndex) => {
|
|
115
|
+
if (!isDataRow(item)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
109
118
|
const groupLevelValues = columnProps.map(groupId => getGroupValue(item, groupId));
|
|
110
119
|
const lastLevelValue = groupLevelValues.pop();
|
|
111
120
|
let currentGroupLevel = groupedItems;
|
|
@@ -46,13 +46,11 @@ export class SelectionStoreConnector {
|
|
|
46
46
|
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
47
47
|
}
|
|
48
48
|
registerColumn(x, type) {
|
|
49
|
+
this.updateColumnTypeMapping(x, type);
|
|
49
50
|
if (this.columnStores[x]) {
|
|
50
51
|
return this.columnStores[x];
|
|
51
52
|
}
|
|
52
53
|
this.columnStores[x] = new SelectionStore();
|
|
53
|
-
// build cross-linking type to position
|
|
54
|
-
this.storesByType[type] = x;
|
|
55
|
-
this.storesXToType[x] = type;
|
|
56
54
|
return this.columnStores[x];
|
|
57
55
|
}
|
|
58
56
|
registerRow(y, type) {
|
|
@@ -273,4 +271,29 @@ export class SelectionStoreConnector {
|
|
|
273
271
|
}
|
|
274
272
|
return stores;
|
|
275
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Keep column viewport positions and types in sync across pin/unpin rerenders.
|
|
276
|
+
* Regression case: when a selected rgCol cell was pinned left, colPinStart
|
|
277
|
+
* could take over x=0 and render the stale rgCol focus store in the pinned area.
|
|
278
|
+
*/
|
|
279
|
+
updateColumnTypeMapping(x, type) {
|
|
280
|
+
const previousType = this.storesXToType[x];
|
|
281
|
+
const previousX = this.storesByType[type];
|
|
282
|
+
let shouldClearFocus = false;
|
|
283
|
+
this.storesByType[type] = x;
|
|
284
|
+
this.storesXToType[x] = type;
|
|
285
|
+
if (previousType && previousType !== type) {
|
|
286
|
+
shouldClearFocus = true;
|
|
287
|
+
if (this.storesByType[previousType] === x) {
|
|
288
|
+
delete this.storesByType[previousType];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (typeof previousX === 'number' && previousX !== x && this.storesXToType[previousX] === type) {
|
|
292
|
+
delete this.storesXToType[previousX];
|
|
293
|
+
shouldClearFocus = true;
|
|
294
|
+
}
|
|
295
|
+
if (shouldClearFocus) {
|
|
296
|
+
this.clearAll();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
276
299
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, f as Build } from './index-Chp_81rd.js';
|
|
5
5
|
import { n as DATA_ROW, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-CGKwSvw6.js';
|
|
6
|
-
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-
|
|
6
|
+
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-CC_SD8W3.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Renders sorting direction and optional additive sorting rank.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-
|
|
4
|
+
import { J as reduce, g as getRange, K as baseEach, C as getColumnType, c as columnTypes, L as toInteger, u as isGrouping, t as getGroupingName, r as rowTypes, B as getCellDataParsed, A as getCellRaw, j as GROUP_COLUMN_PROP, I as getColumnByProp, h as GROUP_EXPANDED, x as getParsedGroup, y as isSameGroup, G as GROUP_DEPTH, e as PSEUDO_GROUP_ITEM_VALUE, d as PSEUDO_GROUP_ITEM_ID, o as GROUPING_ROW_TYPE, p as getSource, f as PSEUDO_GROUP_COLUMN, s as gatherGrouping, m as GROUP_EXPAND_EVENT, v as isGroupingColumn, q as getExpanded, E as isColGrouping } from './column.service-CC_SD8W3.js';
|
|
5
5
|
import { K as createStore, l as setStore, i as calculateDimensionData, L as identity, N as isArray, b as getSourceItem, g as getPhysical, e as setItems, j as getItemByPosition } from './dimension.helpers-CGKwSvw6.js';
|
|
6
6
|
import { j as calculateRowHeaderSize } from './viewport.store-COAfzAyu.js';
|
|
7
7
|
import { g as getScrollbarSize, t as timeout } from './index-Db3qZoW5.js';
|
|
8
8
|
import { h } from './index-Chp_81rd.js';
|
|
9
9
|
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-C8XTWPU2.js';
|
|
10
10
|
import { d as debounce } from './debounce-PCRWZliA.js';
|
|
11
|
-
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-
|
|
11
|
+
import { O as ON_COLUMN_CLICK, d as dispatch } from './header-cell-renderer-BsvUQ8GS.js';
|
|
12
12
|
|
|
13
13
|
function calculateRealSize({ count, originItemSize, sizes, }) {
|
|
14
14
|
const safeCount = Math.max(0, count);
|