@revolist/revogrid 4.22.1 → 4.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cell-renderer-BQdEGQXP.js → cell-renderer-Dcz022q7.js} +9 -3
- package/dist/cjs/{column.drag.plugin-RDjQhKCH.js → column.drag.plugin-DJueWxN_.js} +391 -256
- package/dist/cjs/{column.service-DXYMehqK.js → column.service-C1Qvcf5l.js} +10 -1
- package/dist/cjs/{dimension.helpers-CiiNnlLa.js → dimension.helpers-B9HgANnM.js} +14 -145
- package/dist/cjs/{edit.utils-CecCfA4E.js → edit.utils-pKeiYFLJ.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DGyBrK8I.js → header-cell-renderer-QrcXXSkF.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +37 -32
- package/dist/cjs/revo-grid.cjs.entry.js +124 -18
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +43 -25
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +10 -8
- package/dist/cjs/revogr-data_4.cjs.entry.js +74 -32
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-DnLZW1a-.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CfgQFkfR.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-q6YdR9mg.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +1 -1
- package/dist/collection/components/header/header-renderer.js +1 -1
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +53 -17
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +23 -1
- package/dist/collection/components/overlay/selection.utils.js +8 -6
- package/dist/collection/components/revoGrid/revo-grid.js +69 -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/groupingRow/grouping.service.js +9 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +4 -4
- package/dist/collection/plugins/sorting/sorting.func.js +173 -15
- package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
- package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
- package/dist/collection/serve/controller.js +98 -37
- package/dist/collection/serve/data.js +273 -144
- package/dist/collection/services/dimension.provider.js +16 -1
- package/dist/collection/services/local.scroll.service.js +59 -24
- package/dist/collection/services/scroll.dimension.helpers.js +83 -0
- package/dist/collection/services/selection.store.connector.js +30 -4
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
- package/dist/collection/store/dimension/dimension.store.js +4 -2
- package/dist/collection/store/vp/viewport.helpers.js +9 -0
- package/dist/collection/store/vp/viewport.store.js +5 -16
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-CALsEsnh.js → esm/cell-renderer-BtN-NGCk.js} +9 -3
- package/dist/esm/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
- package/dist/esm/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
- package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
- package/dist/{revo-grid/dimension.helpers-DmIvjIa7.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{revo-grid/header-cell-renderer-DU8wKAbg.js → esm/header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +11 -10
- package/dist/esm/revo-grid.entry.js +123 -17
- package/dist/esm/revogr-attribution_7.entry.js +42 -24
- package/dist/esm/revogr-clipboard_3.entry.js +11 -9
- package/dist/esm/revogr-data_4.entry.js +75 -33
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-CFjDW-3l.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-CALsEsnh.js → revo-grid/cell-renderer-BtN-NGCk.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-Dy5ztusn.js → column.drag.plugin-DCZW62Uc.js} +388 -255
- package/dist/revo-grid/{column.service-CCvAi5l4.js → column.service-CC_SD8W3.js} +10 -1
- package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
- package/dist/{esm/dimension.helpers-DmIvjIa7.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-DYN6XZh8.js → edit.utils-Dnnbd0xG.js} +1 -1
- package/dist/{esm/header-cell-renderer-DU8wKAbg.js → revo-grid/header-cell-renderer-BsvUQ8GS.js} +1 -1
- package/dist/revo-grid/index-Db3qZoW5.js +127 -0
- package/dist/revo-grid/index.esm.js +11 -10
- package/dist/revo-grid/revo-grid.entry.js +123 -17
- package/dist/revo-grid/revogr-attribution_7.entry.js +42 -24
- package/dist/revo-grid/revogr-clipboard_3.entry.js +11 -9
- package/dist/revo-grid/revogr-data_4.entry.js +75 -33
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-DpCnd6Fq.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-ERvyruXb.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-CFjDW-3l.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
- package/dist/types/components/header/header-group-renderer.d.ts +2 -0
- package/dist/types/components/header/header-renderer.d.ts +1 -0
- package/dist/types/components/header/revogr-header.d.ts +2 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +12 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
- package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
- package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
- package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
- package/dist/types/services/local.scroll.service.d.ts +10 -2
- package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
- package/dist/types/services/selection.store.connector.d.ts +6 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
- package/dist/types/types/interfaces.d.ts +11 -0
- package/dist/types/types/selection.d.ts +13 -0
- package/hydrate/index.js +795 -383
- package/hydrate/index.mjs +795 -383
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
- package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
|
@@ -49,8 +49,8 @@ export function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
|
49
49
|
cellX = width - 1;
|
|
50
50
|
}
|
|
51
51
|
// Get the row and column items based on the cell position
|
|
52
|
-
const rgRow = getItemByPosition(rows, cellY);
|
|
53
|
-
const rgCol = getItemByPosition(cols, cellX);
|
|
52
|
+
const rgRow = getItemByPosition(rows, cellY + (rows.renderOffset || 0));
|
|
53
|
+
const rgCol = getItemByPosition(cols, cellX + (cols.renderOffset || 0));
|
|
54
54
|
// Set the row and column index to 0 if they are before the first item
|
|
55
55
|
if (rgCol.itemIndex < 0) {
|
|
56
56
|
rgCol.itemIndex = 0;
|
|
@@ -120,10 +120,12 @@ export function styleByCellProps(styles) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
export function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
123
|
+
const rowOffset = dimensionRow.renderOffset || 0;
|
|
124
|
+
const colOffset = dimensionCol.renderOffset || 0;
|
|
125
|
+
const top = getItemByIndex(dimensionRow, y).start - rowOffset;
|
|
126
|
+
const left = getItemByIndex(dimensionCol, x).start - colOffset;
|
|
127
|
+
const bottom = getItemByIndex(dimensionRow, y1).end - rowOffset;
|
|
128
|
+
const right = getItemByIndex(dimensionCol, x1).end - colOffset;
|
|
127
129
|
return {
|
|
128
130
|
left,
|
|
129
131
|
right,
|
|
@@ -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,14 +627,76 @@ 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
|
+
}
|
|
633
|
+
const order = {};
|
|
634
|
+
for (const prop of Object.keys(beforeApplyEvent.detail.sort)) {
|
|
635
|
+
order[prop] = beforeApplyEvent.detail.sort[prop].order;
|
|
636
|
+
}
|
|
629
637
|
this.aftercolumnsset.emit({
|
|
630
638
|
columns,
|
|
631
|
-
order
|
|
632
|
-
acc[prop] = column.order;
|
|
633
|
-
return acc;
|
|
634
|
-
}, {}),
|
|
639
|
+
order,
|
|
635
640
|
});
|
|
636
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
|
+
}
|
|
637
700
|
disableVirtualXChanged(newVal = false, prevVal = false) {
|
|
638
701
|
if (newVal === prevVal) {
|
|
639
702
|
return;
|
|
@@ -920,7 +983,7 @@ export class RevoGridComponent {
|
|
|
920
983
|
if (Object.keys((_a = this.trimmedRows) !== null && _a !== void 0 ? _a : {}).length > 0) {
|
|
921
984
|
this.trimmedRowsChanged(this.trimmedRows);
|
|
922
985
|
}
|
|
923
|
-
this.rowDefChanged(this.rowDefinitions);
|
|
986
|
+
this.rowDefChanged(this.rowDefinitions, undefined, undefined, false);
|
|
924
987
|
// init grouping
|
|
925
988
|
if (this.grouping && Object.keys(this.grouping).length > 0) {
|
|
926
989
|
this.groupingChanged(this.grouping);
|
|
@@ -946,6 +1009,7 @@ export class RevoGridComponent {
|
|
|
946
1009
|
return Promise.all(this.jobsBeforeRender);
|
|
947
1010
|
}
|
|
948
1011
|
componentDidRender() {
|
|
1012
|
+
this.restoreColumnFocusAfterRender();
|
|
949
1013
|
this.aftergridrender.emit();
|
|
950
1014
|
}
|
|
951
1015
|
render() {
|
|
@@ -108,7 +108,8 @@ export default class ViewportService {
|
|
|
108
108
|
(_a = this.config.dimensionProvider) === null || _a === void 0 ? void 0 : _a.setCustomSizes(type, detail, true);
|
|
109
109
|
// set resize event
|
|
110
110
|
const changedItems = {};
|
|
111
|
-
for (const
|
|
111
|
+
for (const i of Object.keys(detail || {})) {
|
|
112
|
+
const size = detail[i];
|
|
112
113
|
const virtualIndex = parseInt(i, 10);
|
|
113
114
|
const item = getSourceItem(store, virtualIndex);
|
|
114
115
|
if (item) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, Host, } from "@stencil/core";
|
|
5
5
|
import GridResizeService from "../revoGrid/viewport.resize.service";
|
|
6
|
-
import LocalScrollService from "../../services/local.scroll.service";
|
|
6
|
+
import LocalScrollService, { getContentSize } from "../../services/local.scroll.service";
|
|
7
7
|
import { LocalScrollTimer } from "../../services/local.scroll.timer";
|
|
8
8
|
import { CONTENT_SLOT, FOOTER_SLOT, HEADER_SLOT, } from "../revoGrid/viewport.helpers";
|
|
9
9
|
/**
|
|
@@ -34,7 +34,7 @@ export class RevogrViewportScroll {
|
|
|
34
34
|
* @param e
|
|
35
35
|
*/
|
|
36
36
|
async changeScroll(e, silent = false) {
|
|
37
|
-
var _a, _b;
|
|
37
|
+
var _a, _b, _c, _d;
|
|
38
38
|
if (silent) {
|
|
39
39
|
if (e.coordinate && this.verticalScroll) {
|
|
40
40
|
switch (e.dimension) {
|
|
@@ -47,15 +47,16 @@ export class RevogrViewportScroll {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
if (e.delta) {
|
|
50
|
+
let currentPhysicalCoordinate = 0;
|
|
50
51
|
switch (e.dimension) {
|
|
51
52
|
case 'rgCol':
|
|
52
|
-
|
|
53
|
+
currentPhysicalCoordinate = this.horizontalScroll.scrollLeft;
|
|
53
54
|
break;
|
|
54
55
|
case 'rgRow':
|
|
55
|
-
|
|
56
|
+
currentPhysicalCoordinate = (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0;
|
|
56
57
|
break;
|
|
57
58
|
}
|
|
58
|
-
this.
|
|
59
|
+
return (_d = (_c = this.localScrollService) === null || _c === void 0 ? void 0 : _c.setScrollByDelta(e, currentPhysicalCoordinate)) !== null && _d !== void 0 ? _d : e;
|
|
59
60
|
}
|
|
60
61
|
return e;
|
|
61
62
|
}
|
|
@@ -207,7 +208,10 @@ export class RevogrViewportScroll {
|
|
|
207
208
|
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
208
209
|
}
|
|
209
210
|
render() {
|
|
210
|
-
|
|
211
|
+
var _a, _b, _c, _d;
|
|
212
|
+
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
213
|
+
const physicalContentWidth = getContentSize(this.contentWidth, (_d = (_c = this.horizontalScroll) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
214
|
+
return (h(Host, { key: 'a0c47dede9d131dea8c8ca449e8a323f24d9b113', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, h("div", { key: '6c960e753ffe522ba4afb1c379264873b6c617f3', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, h("div", { key: '1a6cbcbd3634e84756b54c8150aebd25c824e14a', class: "header-wrapper", ref: e => (this.header = e) }, h("slot", { key: 'e4202c687bc39b4f78f3ed9840e979b032f06af8', name: HEADER_SLOT })), h("div", { key: '651415b5b32e72735065b183317386a34042bb85', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, h("div", { key: 'e65623b78d80957d8676adb019618953ef267ec3', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, h("slot", { key: '5af47b12ef1226587cf774233447b5252d65e836', name: CONTENT_SLOT }))), h("div", { key: 'cbc0fd64fbfb53d3b18e547bbe34e32b7bb9c043', class: "footer-wrapper", ref: e => (this.footer = e) }, h("slot", { key: 'a8e4bfaef400973121090bac3069eb85469a95f3', name: FOOTER_SLOT })))));
|
|
211
215
|
}
|
|
212
216
|
/**
|
|
213
217
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
|
@@ -37,15 +37,9 @@ export class RevogrScrollVirtual {
|
|
|
37
37
|
*/
|
|
38
38
|
async changeScroll(e) {
|
|
39
39
|
if (e.delta) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
break;
|
|
44
|
-
case 'rgRow':
|
|
45
|
-
e.coordinate = this.element.scrollTop + e.delta;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
this.setScroll(e);
|
|
40
|
+
const scrollProperty = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
41
|
+
const currentPhysicalCoordinate = this.element[scrollProperty];
|
|
42
|
+
return this.localScrollService.setScrollByDelta(e, currentPhysicalCoordinate);
|
|
49
43
|
}
|
|
50
44
|
return e;
|
|
51
45
|
}
|
|
@@ -108,7 +102,7 @@ export class RevogrScrollVirtual {
|
|
|
108
102
|
}
|
|
109
103
|
render() {
|
|
110
104
|
const size = getContentSize(this.realSize, this.dimension === 'rgRow' ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
|
|
111
|
-
return (h(Host, { key: '
|
|
105
|
+
return (h(Host, { key: '7213817ef941eee4050b714266598ec0c2961ee9', onScroll: (e) => this.onScroll(e) }, h("div", { key: '501da49c63253ab943172494b9dbf5399be56cee', style: {
|
|
112
106
|
[this.dimension === 'rgRow' ? 'height' : 'width']: `${size}px`,
|
|
113
107
|
} })));
|
|
114
108
|
}
|
|
@@ -250,7 +250,8 @@ export class FilterPanel {
|
|
|
250
250
|
const options = [];
|
|
251
251
|
const prop = this.changes.prop;
|
|
252
252
|
const hidden = new Set();
|
|
253
|
-
Object.
|
|
253
|
+
Object.keys(this.filterItems).forEach((prop) => {
|
|
254
|
+
const values = this.filterItems[prop];
|
|
254
255
|
values.forEach((filter) => {
|
|
255
256
|
if (filter.hidden) {
|
|
256
257
|
hidden.add(filter.type);
|
|
@@ -152,17 +152,24 @@ export class FilterPlugin extends BasePlugin {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
if (config.collection) {
|
|
155
|
-
const
|
|
156
|
-
|
|
155
|
+
const filterCollection = {};
|
|
156
|
+
for (const prop of Object.keys(config.collection)) {
|
|
157
|
+
const item = config.collection[prop];
|
|
158
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
159
|
+
filterCollection[prop] = item;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.filterCollection = filterCollection;
|
|
157
163
|
}
|
|
158
164
|
else {
|
|
159
165
|
this.filterCollection = {};
|
|
160
166
|
}
|
|
161
167
|
if (config.localization) {
|
|
162
168
|
if (config.localization.filterNames) {
|
|
163
|
-
|
|
169
|
+
const filterNames = config.localization.filterNames;
|
|
170
|
+
Object.keys(filterNames).forEach((k) => {
|
|
164
171
|
if (this.filterNameIndexByType[k] != void 0) {
|
|
165
|
-
this.filterNameIndexByType[k] =
|
|
172
|
+
this.filterNameIndexByType[k] = filterNames[k];
|
|
166
173
|
}
|
|
167
174
|
});
|
|
168
175
|
}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
5
|
+
var t = {};
|
|
6
|
+
for (var p in s)
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
10
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
12
|
+
t[p[i]] = s[p[i]];
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
4
16
|
import { getPhysical, setItems, columnTypes, } from "../../store/index";
|
|
5
17
|
import { BasePlugin } from "../base.plugin";
|
|
6
18
|
import { FILTER_TRIMMED_TYPE } from "../filter/filter.plugin";
|
|
@@ -97,6 +109,18 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
97
109
|
const sortingPlugin = this.providers.plugins.getByClass(SortingPlugin);
|
|
98
110
|
return !!(sortingPlugin === null || sortingPlugin === void 0 ? void 0 : sortingPlugin.sortingPromise);
|
|
99
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns grouping options for regrouping that must preserve current UI state.
|
|
114
|
+
*
|
|
115
|
+
* `expandedAll` and config `prevExpanded` are initial/config instructions.
|
|
116
|
+
* Reusing them after sorting would reopen groups the user collapsed before
|
|
117
|
+
* sorting instead of using the current grouped source state.
|
|
118
|
+
*/
|
|
119
|
+
getCurrentExpandedOptions() {
|
|
120
|
+
var _a;
|
|
121
|
+
const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, { expandedAll: _expandedAll, prevExpanded: _prevExpanded } = _b, options = __rest(_b, ["expandedAll", "prevExpanded"]);
|
|
122
|
+
return options;
|
|
123
|
+
}
|
|
100
124
|
/**
|
|
101
125
|
* Starts global source update with group clearing and applying new one
|
|
102
126
|
* Initiated when need to reapply grouping
|
|
@@ -199,7 +223,7 @@ export class GroupingRowPlugin extends BasePlugin {
|
|
|
199
223
|
if (!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
200
224
|
return;
|
|
201
225
|
}
|
|
202
|
-
this.doSourceUpdate(
|
|
226
|
+
this.doSourceUpdate(this.getCurrentExpandedOptions());
|
|
203
227
|
});
|
|
204
228
|
/**
|
|
205
229
|
* Apply logic for focus inside of grouping
|
|
@@ -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;
|
|
@@ -68,7 +68,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
68
68
|
const cols = this.getDimension(data.pin || 'rgCol');
|
|
69
69
|
const gridRect = this.revogrid.getBoundingClientRect();
|
|
70
70
|
const elRect = dataEl.getBoundingClientRect();
|
|
71
|
-
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left));
|
|
71
|
+
const startItem = getItemByPosition(cols, getLeftRelative(event.x, gridRect.left, elRect.left - gridRect.left) + (cols.renderOffset || 0));
|
|
72
72
|
this.staticDragData = {
|
|
73
73
|
startPos: event.x,
|
|
74
74
|
startItem,
|
|
@@ -93,13 +93,13 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
93
93
|
const start = this.staticDragData.startPos;
|
|
94
94
|
if (Math.abs(start - e.x) > 10) {
|
|
95
95
|
const x = getLeftRelative(e.x, this.dragData.gridRect.left, this.dragData.scrollOffset);
|
|
96
|
-
const rgCol = getItemByPosition(this.staticDragData.cols, x);
|
|
96
|
+
const rgCol = getItemByPosition(this.staticDragData.cols, x + (this.staticDragData.cols.renderOffset || 0));
|
|
97
97
|
this.orderUi.autoscroll(x, dragData.elRect.width);
|
|
98
98
|
// prevent position change if out of bounds
|
|
99
99
|
if (rgCol.itemIndex >= this.staticDragData.cols.count) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
this.orderUi.showHandler(rgCol.end + dragData.scrollOffset, dragData.gridRect.width);
|
|
102
|
+
this.orderUi.showHandler(rgCol.end - (this.staticDragData.cols.renderOffset || 0) + dragData.scrollOffset, dragData.gridRect.width);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
move(e) {
|
|
@@ -117,7 +117,7 @@ export class ColumnMovePlugin extends BasePlugin {
|
|
|
117
117
|
if (relativePos < 0) {
|
|
118
118
|
relativePos = 0;
|
|
119
119
|
}
|
|
120
|
-
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos);
|
|
120
|
+
const newPosition = getItemByPosition(this.staticDragData.cols, relativePos + (this.staticDragData.cols.renderOffset || 0));
|
|
121
121
|
const store = this.providers.column.stores[this.dragData.type].store;
|
|
122
122
|
const source = store.get('source');
|
|
123
123
|
const newItems = [...store.get('items')];
|
|
@@ -1,13 +1,177 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
+
import { GROUP_COLUMN_PROP } from "../groupingRow/grouping.const";
|
|
4
5
|
import { isGrouping } from "../groupingRow/grouping.service";
|
|
5
6
|
import { getCellRaw } from "../../utils/column.utils";
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether a sorting map contains at least one active order.
|
|
9
|
+
*
|
|
10
|
+
* Empty maps and properties with `undefined` order are treated as inactive.
|
|
11
|
+
*/
|
|
12
|
+
export function hasActiveSorting(sorting) {
|
|
13
|
+
for (const prop of Object.keys(sorting || {})) {
|
|
14
|
+
if (sorting === null || sorting === void 0 ? void 0 : sorting[prop]) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compares column properties after object-key coercion.
|
|
22
|
+
*/
|
|
23
|
+
function isSameColumnProp(a, b) {
|
|
24
|
+
return String(a) === String(b);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns active sorting properties in explicit priority order.
|
|
28
|
+
*/
|
|
29
|
+
function getActiveSortingProps(sorting, sortingOrder) {
|
|
30
|
+
const activeProps = [];
|
|
31
|
+
const add = (prop) => {
|
|
32
|
+
if ((sorting === null || sorting === void 0 ? void 0 : sorting[prop]) && !activeProps.some(active => isSameColumnProp(active, prop))) {
|
|
33
|
+
activeProps.push(prop);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
37
|
+
Object.keys(sorting || {}).forEach(add);
|
|
38
|
+
return activeProps;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns one-based additive sorting rank for a column.
|
|
42
|
+
*
|
|
43
|
+
* A single active sort does not need a visible rank, so it returns undefined.
|
|
44
|
+
*/
|
|
45
|
+
export function getSortingIndex(sorting, prop, sortingOrder) {
|
|
46
|
+
const activeProps = getActiveSortingProps(sorting, sortingOrder);
|
|
47
|
+
if (activeProps.length <= 1) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const index = activeProps.findIndex(active => isSameColumnProp(active, prop));
|
|
51
|
+
return index >= 0 ? index + 1 : undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Collects only active comparator functions from a sorting function map.
|
|
55
|
+
*
|
|
56
|
+
* This keeps undefined comparator entries from triggering sorting work.
|
|
57
|
+
*/
|
|
58
|
+
function activeSortingEntries(sortingFunc = {}, sortingOrder) {
|
|
59
|
+
const entries = [];
|
|
60
|
+
const add = (prop) => {
|
|
61
|
+
const cmp = sortingFunc[prop];
|
|
62
|
+
if (typeof cmp === 'function' && !entries.some(([active]) => isSameColumnProp(active, prop))) {
|
|
63
|
+
entries.push([prop, cmp]);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
sortingOrder === null || sortingOrder === void 0 ? void 0 : sortingOrder.forEach(add);
|
|
67
|
+
Object.keys(sortingFunc).forEach(add);
|
|
68
|
+
return entries;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Reads and normalizes a value for the built-in default comparer.
|
|
72
|
+
*/
|
|
73
|
+
function getDefaultCompareValue(item, prop, column) {
|
|
74
|
+
const aRaw = column ? getCellRaw(item, column) : item === null || item === void 0 ? void 0 : item[prop];
|
|
75
|
+
return typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
function isEmptyCompareValue(value) {
|
|
78
|
+
return value === '' || value === null || value === undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Compares two already-normalized default comparer values.
|
|
82
|
+
*/
|
|
83
|
+
function compareValues(av, bv) {
|
|
84
|
+
if (av === bv) {
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
const aEmpty = isEmptyCompareValue(av);
|
|
88
|
+
const bEmpty = isEmptyCompareValue(bv);
|
|
89
|
+
if (aEmpty || bEmpty) {
|
|
90
|
+
if (aEmpty && bEmpty) {
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
return aEmpty ? -1 : 1;
|
|
94
|
+
}
|
|
95
|
+
if (av > bv) {
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
return -1;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sorts indexes by precomputed values for default column comparers.
|
|
102
|
+
*
|
|
103
|
+
* This avoids repeatedly parsing the same cell value during large default
|
|
104
|
+
* sorts while preserving normal multi-column ordering.
|
|
105
|
+
*/
|
|
106
|
+
function sortIndexByDefaultComparers(indexes, source, entries, sorting, sortingColumns) {
|
|
107
|
+
const prepared = entries.map(([prop]) => {
|
|
108
|
+
const values = [];
|
|
109
|
+
const column = sortingColumns[prop];
|
|
110
|
+
for (const index of indexes) {
|
|
111
|
+
values[index] = getDefaultCompareValue(source[index], prop, column);
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
order: sorting[prop],
|
|
115
|
+
values,
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
return indexes.sort((a, b) => {
|
|
119
|
+
for (const { order, values } of prepared) {
|
|
120
|
+
const sorted = compareValues(values[a], values[b]);
|
|
121
|
+
if (sorted) {
|
|
122
|
+
return order === 'desc' ? -sorted : sorted;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return 0;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Detects whether the optimized default-comparer path can be used.
|
|
130
|
+
*
|
|
131
|
+
* Grouped rows and custom `cellCompare` functions stay on the legacy
|
|
132
|
+
* comparator path to preserve their exact behavior.
|
|
133
|
+
*/
|
|
134
|
+
function canUseDefaultCompareFastPath(entries, indexes, source, sorting, sortingColumns) {
|
|
135
|
+
return !indexes.some(index => isGrouping(source[index])) && !!sorting && !!sortingColumns && entries.every(([prop]) => {
|
|
136
|
+
const order = sorting[prop];
|
|
137
|
+
const column = sortingColumns[prop];
|
|
138
|
+
return !!order && !(column === null || column === void 0 ? void 0 : column.cellCompare);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Group placeholder rows are generated for their grouping column. If sorting is
|
|
143
|
+
* requested for another column, the grouped source must be unwrapped first.
|
|
144
|
+
*/
|
|
145
|
+
function hasGroupingRowsForOtherSorting(entries, indexes, source) {
|
|
146
|
+
return indexes.some(index => {
|
|
147
|
+
const item = source[index];
|
|
148
|
+
return isGrouping(item) && !entries.some(([prop]) => isSameColumnProp(item[GROUP_COLUMN_PROP], prop));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Sorts row indexes against a source collection.
|
|
153
|
+
*
|
|
154
|
+
* @param indexes - Current proxy row indexes to sort.
|
|
155
|
+
* @param source - Full source collection addressed by the indexes.
|
|
156
|
+
* @param sortingFunc - Comparator functions by column property.
|
|
157
|
+
* @param sorting - Active sorting order by column property.
|
|
158
|
+
* @param sortingColumns - Column metadata by property for default-comparer optimization.
|
|
159
|
+
* @param sortingOrder - Active sorting priority in click/config insertion order.
|
|
160
|
+
* @returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
|
|
161
|
+
*/
|
|
162
|
+
export function sortIndexByItems(indexes, source, sortingFunc = {}, sorting, sortingColumns, sortingOrder) {
|
|
163
|
+
const hasSortingKeys = Object.keys(sortingFunc).length > 0;
|
|
164
|
+
const sortingEntries = activeSortingEntries(sortingFunc, sortingOrder);
|
|
7
165
|
// if no sorting - return unsorted indexes
|
|
8
|
-
if (
|
|
166
|
+
if (sortingEntries.length === 0) {
|
|
9
167
|
// Unsorted indexes
|
|
10
|
-
return [...Array(indexes.length).keys()];
|
|
168
|
+
return hasSortingKeys ? indexes : [...new Array(indexes.length).keys()];
|
|
169
|
+
}
|
|
170
|
+
if (hasGroupingRowsForOtherSorting(sortingEntries, indexes, source)) {
|
|
171
|
+
return indexes;
|
|
172
|
+
}
|
|
173
|
+
if (canUseDefaultCompareFastPath(sortingEntries, indexes, source, sorting, sortingColumns)) {
|
|
174
|
+
return sortIndexByDefaultComparers(indexes, source, sortingEntries, sorting, sortingColumns);
|
|
11
175
|
}
|
|
12
176
|
//
|
|
13
177
|
/**
|
|
@@ -17,15 +181,15 @@ export function sortIndexByItems(indexes, source, sortingFunc = {}) {
|
|
|
17
181
|
return indexes.sort((a, b) => {
|
|
18
182
|
const itemA = source[a];
|
|
19
183
|
const itemB = source[b];
|
|
20
|
-
for (const [prop, cmp] of
|
|
184
|
+
for (const [prop, cmp] of sortingEntries) {
|
|
21
185
|
if (isGrouping(itemA)) {
|
|
22
|
-
if (itemA[
|
|
23
|
-
return
|
|
186
|
+
if (!isSameColumnProp(itemA[GROUP_COLUMN_PROP], prop)) {
|
|
187
|
+
return a - b;
|
|
24
188
|
}
|
|
25
189
|
}
|
|
26
190
|
if (isGrouping(itemB)) {
|
|
27
|
-
if (itemB[
|
|
28
|
-
return
|
|
191
|
+
if (!isSameColumnProp(itemB[GROUP_COLUMN_PROP], prop)) {
|
|
192
|
+
return a - b;
|
|
29
193
|
}
|
|
30
194
|
}
|
|
31
195
|
/**
|
|
@@ -45,13 +209,7 @@ export function defaultCellCompare(prop, a, b) {
|
|
|
45
209
|
const bRaw = this.column ? getCellRaw(b, this.column) : b === null || b === void 0 ? void 0 : b[prop];
|
|
46
210
|
const av = typeof aRaw === 'number' ? aRaw : aRaw === null || aRaw === void 0 ? void 0 : aRaw.toString().toLowerCase();
|
|
47
211
|
const bv = typeof bRaw === 'number' ? bRaw : bRaw === null || bRaw === void 0 ? void 0 : bRaw.toString().toLowerCase();
|
|
48
|
-
|
|
49
|
-
return 0;
|
|
50
|
-
}
|
|
51
|
-
if (av > bv) {
|
|
52
|
-
return 1;
|
|
53
|
-
}
|
|
54
|
-
return -1;
|
|
212
|
+
return compareValues(av, bv);
|
|
55
213
|
}
|
|
56
214
|
export function descCellCompare(cmp) {
|
|
57
215
|
return (prop, a, b) => {
|