@revolist/revogrid 4.26.2 → 4.27.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-Cf2Pu4S0.js → cell-renderer-C7rdgaov.js} +3 -3
- package/dist/cjs/{column.service-C7p5eC5V.js → column.service-Bbml5C2j.js} +3 -3
- package/dist/cjs/{dimension.helpers-CgHhnN1d.js → dimension.helpers-CptesQOZ.js} +52 -8
- package/dist/cjs/{edit.utils-rAcGublN.js → edit.utils-CBAbQhGP.js} +1 -1
- package/dist/cjs/{header-cell-renderer-DHClfIto.js → header-cell-renderer-BljFI6wj.js} +1 -1
- package/dist/cjs/{index--FdNLz1Z.js → index-BVESmpqW.js} +1 -1
- package/dist/cjs/index.cjs.js +71 -55
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +74 -49
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +51 -19
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
- package/dist/cjs/revogr-data_4.cjs.entry.js +21 -15
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +9 -9
- package/dist/cjs/{column.drag.plugin-CK5HADlW.js → row-resize.plugin-BRQy_qNn.js} +573 -19
- package/dist/cjs/{text-editor-F04kTx53.js → text-editor-CJyQaYei.js} +2 -2
- package/dist/cjs/{throttle-fV6BUmM7.js → throttle-BsaP4fgu.js} +3 -3
- package/dist/cjs/{viewport.store-B4Clk4m9.js → viewport.store-mhsdi61t.js} +1 -1
- package/dist/collection/components/data/revogr-data-style.css +11 -0
- package/dist/collection/components/data/revogr-data.js +14 -8
- package/dist/collection/components/header/revogr-header-style.css +1 -0
- package/dist/collection/components/overlay/keyboard.service.js +33 -3
- package/dist/collection/components/overlay/revogr-overlay-selection.js +12 -10
- package/dist/collection/components/revoGrid/plugin.service.js +2 -2
- package/dist/collection/components/revoGrid/revo-grid.js +44 -10
- package/dist/collection/components/revoGrid/viewport.scrolling.service.js +24 -13
- package/dist/collection/components/revoGrid/viewport.service.js +1 -1
- package/dist/collection/plugins/filter/filter.constants.js +9 -0
- package/dist/collection/plugins/filter/filter.panel.js +8 -8
- package/dist/collection/plugins/filter/filter.plugin.js +109 -10
- package/dist/collection/plugins/filter/filter.style.css +2 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +9 -2
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +1 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +1 -1
- package/dist/collection/plugins/index.js +1 -0
- package/dist/collection/plugins/row-resize/index.js +6 -0
- package/dist/collection/plugins/row-resize/row-resize.plugin.js +385 -0
- package/dist/collection/plugins/row-resize/row-resize.types.js +1 -0
- package/dist/collection/plugins/row-resize/row-resize.utils.js +55 -0
- package/dist/collection/serve/controller.js +1 -1
- package/dist/collection/services/data.provider.js +8 -2
- package/dist/collection/services/local.scroll.timer.js +3 -3
- package/dist/collection/services/selection.store.connector.js +4 -2
- package/dist/collection/store/dataSource/data.pending.plugin.js +21 -0
- package/dist/collection/store/dataSource/data.store.js +25 -3
- package/dist/collection/store/dataSource/trimmed.plugin.js +9 -6
- package/dist/collection/store/dimension/dimension.trim.plugin.js +1 -3
- package/dist/collection/types/events.js +4 -1
- package/dist/collection/utils/column.utils.js +1 -1
- package/dist/esm/{cell-renderer-11cf-lu3.js → cell-renderer-BFpmdV8H.js} +3 -3
- package/dist/esm/{column.service-Cfw3L0PN.js → column.service-CM-wgGs8.js} +3 -3
- package/dist/{revo-grid/dimension.helpers-fl4HSSK9.js → esm/dimension.helpers-Cln9sALu.js} +52 -9
- package/dist/{revo-grid/edit.utils-4e9fsqOR.js → esm/edit.utils-3ZbhQCv_.js} +1 -1
- package/dist/esm/{header-cell-renderer-Cqtg1ETB.js → header-cell-renderer-Bqh1PrgH.js} +1 -1
- package/dist/esm/{index-D24ku9ej.js → index-BvMNbQyq.js} +1 -1
- package/dist/esm/index.js +14 -11
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +56 -31
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_7.entry.js +51 -19
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +21 -15
- package/dist/esm/revogr-filter-panel.entry.js +9 -9
- package/dist/esm/{column.drag.plugin-DDBKeTGI.js → row-resize.plugin-BRiaHlHA.js} +562 -20
- package/dist/{revo-grid/text-editor-DlMnLkRK.js → esm/text-editor-eHtrwvxH.js} +2 -2
- package/dist/{revo-grid/throttle-Cpk1LoGk.js → esm/throttle-3rhqdcLy.js} +3 -3
- package/dist/{revo-grid/viewport.store-BSXmsiZc.js → esm/viewport.store-DWMKRDSH.js} +1 -1
- package/dist/revo-grid/{cell-renderer-11cf-lu3.js → cell-renderer-BFpmdV8H.js} +3 -3
- package/dist/revo-grid/{column.service-Cfw3L0PN.js → column.service-CM-wgGs8.js} +3 -3
- package/dist/{esm/dimension.helpers-fl4HSSK9.js → revo-grid/dimension.helpers-Cln9sALu.js} +52 -9
- package/dist/{esm/edit.utils-4e9fsqOR.js → revo-grid/edit.utils-3ZbhQCv_.js} +1 -1
- package/dist/revo-grid/{header-cell-renderer-Cqtg1ETB.js → header-cell-renderer-Bqh1PrgH.js} +1 -1
- package/dist/revo-grid/{index-D24ku9ej.js → index-BvMNbQyq.js} +1 -1
- package/dist/revo-grid/index.esm.js +14 -11
- package/dist/revo-grid/revo-grid.entry.js +56 -31
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revogr-attribution_7.entry.js +51 -19
- package/dist/revo-grid/revogr-clipboard_3.entry.js +4 -4
- package/dist/revo-grid/revogr-data_4.entry.js +21 -15
- package/dist/revo-grid/revogr-filter-panel.entry.js +9 -9
- package/dist/revo-grid/{column.drag.plugin-DDBKeTGI.js → row-resize.plugin-BRiaHlHA.js} +562 -20
- package/dist/{esm/text-editor-DlMnLkRK.js → revo-grid/text-editor-eHtrwvxH.js} +2 -2
- package/dist/{esm/throttle-Cpk1LoGk.js → revo-grid/throttle-3rhqdcLy.js} +3 -3
- package/dist/{esm/viewport.store-BSXmsiZc.js → revo-grid/viewport.store-DWMKRDSH.js} +1 -1
- package/dist/types/components/data/revogr-data.d.ts +1 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +6 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +3 -1
- package/dist/types/components/revoGrid/revo-grid.d.ts +7 -1
- package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +3 -1
- package/dist/types/components.d.ts +23 -10
- package/dist/types/plugins/filter/filter.constants.d.ts +6 -0
- package/dist/types/plugins/filter/filter.plugin.d.ts +15 -0
- package/dist/types/plugins/index.d.ts +1 -0
- package/dist/types/plugins/row-resize/index.d.ts +3 -0
- package/dist/types/plugins/row-resize/row-resize.plugin.d.ts +44 -0
- package/dist/types/plugins/row-resize/row-resize.types.d.ts +40 -0
- package/dist/types/plugins/row-resize/row-resize.utils.d.ts +14 -0
- package/dist/types/services/data.provider.d.ts +2 -0
- package/dist/types/store/dataSource/data.pending.plugin.d.ts +9 -0
- package/dist/types/store/dataSource/data.store.d.ts +10 -0
- package/dist/types/store/dataSource/trimmed.plugin.d.ts +5 -0
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/interfaces.d.ts +3 -1
- package/hydrate/index.js +734 -85
- package/hydrate/index.mjs +734 -85
- package/package.json +1 -1
- package/readme.md +4 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.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-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
-
var column_service = require('./column.service-
|
|
7
|
-
var dimension_helpers = require('./dimension.helpers-
|
|
8
|
-
var viewport_store = require('./viewport.store-
|
|
9
|
-
var index$1 = require('./index
|
|
6
|
+
var column_service = require('./column.service-Bbml5C2j.js');
|
|
7
|
+
var dimension_helpers = require('./dimension.helpers-CptesQOZ.js');
|
|
8
|
+
var viewport_store = require('./viewport.store-mhsdi61t.js');
|
|
9
|
+
var index$1 = require('./index-BVESmpqW.js');
|
|
10
10
|
var index = require('./index-DRvxCueo.js');
|
|
11
11
|
var filter_button = require('./filter.button-F2Bw3UAd.js');
|
|
12
12
|
var debounce = require('./debounce-CcpHiH2p.js');
|
|
13
|
-
var headerCellRenderer = require('./header-cell-renderer-
|
|
13
|
+
var headerCellRenderer = require('./header-cell-renderer-BljFI6wj.js');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Public theme tokens and their CSS custom-property counterparts.
|
|
@@ -153,9 +153,7 @@ const trimmedPlugin = (storeService) => {
|
|
|
153
153
|
}
|
|
154
154
|
case 'trimmed': {
|
|
155
155
|
const trim = val;
|
|
156
|
-
|
|
157
|
-
trimmedPreviousSizes = storeService.store.get('sizes');
|
|
158
|
-
}
|
|
156
|
+
trimmedPreviousSizes !== null && trimmedPreviousSizes !== void 0 ? trimmedPreviousSizes : (trimmedPreviousSizes = storeService.store.get('sizes'));
|
|
159
157
|
trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
|
|
160
158
|
// save a reference to the trimmed object to prevent changes after trimming
|
|
161
159
|
storeService.setSizes(trimmingObject);
|
|
@@ -1382,6 +1380,13 @@ const filterNames = {
|
|
|
1382
1380
|
lte: '<=',
|
|
1383
1381
|
};
|
|
1384
1382
|
|
|
1383
|
+
/** Fewer rows keep the existing synchronous filtering behavior. */
|
|
1384
|
+
const ASYNC_FILTER_ROW_THRESHOLD = 15000;
|
|
1385
|
+
/** Maximum rows evaluated in one filtering chunk. */
|
|
1386
|
+
const FILTER_CHUNK_SIZE = 1000;
|
|
1387
|
+
/** Yield after approximately this much accumulated filtering work. */
|
|
1388
|
+
const FILTER_TIME_BUDGET_MS = 5;
|
|
1389
|
+
|
|
1385
1390
|
// filter.plugin.tsx
|
|
1386
1391
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
1387
1392
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
@@ -1426,6 +1431,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1426
1431
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1427
1432
|
this.filterProp = filter_button.FILTER_PROP;
|
|
1428
1433
|
this.allowDuplicateOperators = true;
|
|
1434
|
+
this.filteringRunId = 0;
|
|
1429
1435
|
if (config) {
|
|
1430
1436
|
this.initConfig(config);
|
|
1431
1437
|
}
|
|
@@ -1434,7 +1440,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1434
1440
|
...existingNodes,
|
|
1435
1441
|
index.h("revogr-filter-panel", { filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), onResetChange: e => this.onFilterReset(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, closeOnOutsideClick: config === null || config === void 0 ? void 0 : config.closeFilterPanelOnOutsideClick, allowDuplicateOperators: this.allowDuplicateOperators, ref: e => (this.pop = e) }, ' ', this.extraContent()),
|
|
1436
1442
|
];
|
|
1437
|
-
const aftersourceset =
|
|
1443
|
+
const aftersourceset = () => {
|
|
1438
1444
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
1439
1445
|
if (filterCollectionProps.length > 0) {
|
|
1440
1446
|
// handle old way of filtering by reworking FilterCollection to new MultiFilterItem
|
|
@@ -1451,12 +1457,26 @@ class FilterPlugin extends BasePlugin {
|
|
|
1451
1457
|
}
|
|
1452
1458
|
});
|
|
1453
1459
|
}
|
|
1454
|
-
if (
|
|
1460
|
+
if (!this.hasActiveFilters()) {
|
|
1461
|
+
this.cancelFiltering();
|
|
1455
1462
|
return;
|
|
1456
1463
|
}
|
|
1457
|
-
|
|
1458
|
-
await this.runFiltering(this.multiFilterItems);
|
|
1464
|
+
void this.runFiltering(this.multiFilterItems);
|
|
1459
1465
|
};
|
|
1466
|
+
/**
|
|
1467
|
+
* This executes before the data store replaces its source.
|
|
1468
|
+
* For a large source with active filters:
|
|
1469
|
+
* 1. Existing filtering runs are invalidated.
|
|
1470
|
+
* 2. Pending state starts.
|
|
1471
|
+
* 3. Visible rows become empty.
|
|
1472
|
+
* 4. The source is replaced while the DataStore guard prevents it from exposing unfiltered rows.
|
|
1473
|
+
*/
|
|
1474
|
+
this.addEventListener('beforesourceset', ({ detail }) => {
|
|
1475
|
+
if (detail.source.length >= ASYNC_FILTER_ROW_THRESHOLD &&
|
|
1476
|
+
this.hasActiveFilters()) {
|
|
1477
|
+
this.deferFiltering();
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1460
1480
|
this.addEventListener('headerclick', e => this.headerclick(e));
|
|
1461
1481
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1462
1482
|
if (!detail) {
|
|
@@ -1617,7 +1637,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1617
1637
|
// store the filter items
|
|
1618
1638
|
this.multiFilterItems = filterItems;
|
|
1619
1639
|
// run the filtering when the items change
|
|
1620
|
-
this.runFiltering(this.multiFilterItems);
|
|
1640
|
+
await this.runFiltering(this.multiFilterItems);
|
|
1621
1641
|
}
|
|
1622
1642
|
onFilterReset(prop) {
|
|
1623
1643
|
delete this.multiFilterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
@@ -1627,6 +1647,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
1627
1647
|
* Triggers grid filtering
|
|
1628
1648
|
*/
|
|
1629
1649
|
async doFiltering(collection, source, columns, filterItems) {
|
|
1650
|
+
// creates the execution token - owns the actual calculation
|
|
1651
|
+
const runId = this.beginFiltering();
|
|
1630
1652
|
const columnsToUpdate = [];
|
|
1631
1653
|
/**
|
|
1632
1654
|
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
@@ -1651,7 +1673,25 @@ class FilterPlugin extends BasePlugin {
|
|
|
1651
1673
|
column[this.filterProp] = true;
|
|
1652
1674
|
}
|
|
1653
1675
|
});
|
|
1654
|
-
|
|
1676
|
+
let itemsToTrim;
|
|
1677
|
+
const hasFilters = Object.keys(filterItems).length > 0 || this.hasActiveFilters();
|
|
1678
|
+
const isLargeSource = hasFilters && source.length >= ASYNC_FILTER_ROW_THRESHOLD;
|
|
1679
|
+
if (isLargeSource) {
|
|
1680
|
+
this.providers.data.setItemsPending(true);
|
|
1681
|
+
await index$1.timeout();
|
|
1682
|
+
}
|
|
1683
|
+
if (!hasFilters) {
|
|
1684
|
+
itemsToTrim = {};
|
|
1685
|
+
}
|
|
1686
|
+
else if (isLargeSource && this.supportsChunkedFiltering()) {
|
|
1687
|
+
itemsToTrim = await this.getRowFilterInChunks(source, filterItems, columnByProp, runId);
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
1691
|
+
}
|
|
1692
|
+
if (!itemsToTrim || runId !== this.filteringRunId) {
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1655
1695
|
// check is filter event prevented
|
|
1656
1696
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
1657
1697
|
collection,
|
|
@@ -1659,10 +1699,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1659
1699
|
source,
|
|
1660
1700
|
filterItems,
|
|
1661
1701
|
});
|
|
1662
|
-
if (defaultPrevented) {
|
|
1702
|
+
if (defaultPrevented || runId !== this.filteringRunId) {
|
|
1703
|
+
this.releaseFiltering(runId);
|
|
1663
1704
|
return;
|
|
1664
1705
|
}
|
|
1665
1706
|
this.providers.data.setTrimmed({ [FILTER_TRIMMED_TYPE]: detail.itemsToFilter });
|
|
1707
|
+
this.releaseFiltering(runId);
|
|
1666
1708
|
// applies the hasFilter to the columns to show filter icon
|
|
1667
1709
|
this.providers.column.updateColumns(columnsToUpdate);
|
|
1668
1710
|
this.emit('afterfilterapply', {
|
|
@@ -1676,6 +1718,10 @@ class FilterPlugin extends BasePlugin {
|
|
|
1676
1718
|
await this.runFiltering(this.multiFilterItems);
|
|
1677
1719
|
}
|
|
1678
1720
|
async runFiltering(multiFilterItems) {
|
|
1721
|
+
// runFiltering: First token: "Is this request still valid after event handlers run?"
|
|
1722
|
+
// doFiltering: Second token: "Is this calculation still the newest one?"
|
|
1723
|
+
// creates a preflight token and sets the grid to a pending state
|
|
1724
|
+
const runId = this.beginFiltering();
|
|
1679
1725
|
const collection = {};
|
|
1680
1726
|
// handle old filterCollection to return the first filter only (if any) from multiFilterItems
|
|
1681
1727
|
const filterProps = Object.keys(multiFilterItems);
|
|
@@ -1699,10 +1745,67 @@ class FilterPlugin extends BasePlugin {
|
|
|
1699
1745
|
columns,
|
|
1700
1746
|
filterItems: this.multiFilterItems,
|
|
1701
1747
|
});
|
|
1702
|
-
if (defaultPrevented) {
|
|
1748
|
+
if (defaultPrevented || runId !== this.filteringRunId) {
|
|
1749
|
+
this.releaseFiltering(runId);
|
|
1703
1750
|
return;
|
|
1704
1751
|
}
|
|
1705
|
-
this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
|
|
1752
|
+
await this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
|
|
1753
|
+
}
|
|
1754
|
+
/** Whether this plugin currently owns filter state that must follow a new source. */
|
|
1755
|
+
hasActiveFilters() {
|
|
1756
|
+
return (Object.keys(this.multiFilterItems).length > 0 ||
|
|
1757
|
+
Object.keys(this.filterCollection).length > 0);
|
|
1758
|
+
}
|
|
1759
|
+
/** Preserve whole-source semantics for plugins that override getRowFilter. */
|
|
1760
|
+
supportsChunkedFiltering() {
|
|
1761
|
+
return this.getRowFilter === FilterPlugin.prototype.getRowFilter;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Hide visible rows and invalidate current filtering until a deferred filter
|
|
1765
|
+
* run is ready. Used by filter extensions with their own debounced state.
|
|
1766
|
+
*/
|
|
1767
|
+
deferFiltering() {
|
|
1768
|
+
this.beginFiltering(true);
|
|
1769
|
+
}
|
|
1770
|
+
beginFiltering(pending = false) {
|
|
1771
|
+
const runId = ++this.filteringRunId;
|
|
1772
|
+
if (pending) {
|
|
1773
|
+
this.providers.data.setItemsPending(true);
|
|
1774
|
+
}
|
|
1775
|
+
return runId;
|
|
1776
|
+
}
|
|
1777
|
+
releaseFiltering(runId) {
|
|
1778
|
+
if (runId === this.filteringRunId) {
|
|
1779
|
+
this.providers.data.setItemsPending(false);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
cancelFiltering() {
|
|
1783
|
+
this.releaseFiltering(this.beginFiltering());
|
|
1784
|
+
}
|
|
1785
|
+
async getRowFilterInChunks(rows, filterItems, columnByProp, runId) {
|
|
1786
|
+
const trimmed = {};
|
|
1787
|
+
let sliceStarted = performance.now();
|
|
1788
|
+
for (let offset = 0; offset < rows.length; offset += FILTER_CHUNK_SIZE) {
|
|
1789
|
+
if (runId !== this.filteringRunId) {
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
const end = Math.min(offset + FILTER_CHUNK_SIZE, rows.length);
|
|
1793
|
+
const chunkTrimmed = this.getRowFilter(rows.slice(offset, end), filterItems, columnByProp);
|
|
1794
|
+
// filter that chunk
|
|
1795
|
+
for (const chunkIndex in chunkTrimmed) {
|
|
1796
|
+
trimmed[offset + Number(chunkIndex)] = true;
|
|
1797
|
+
}
|
|
1798
|
+
if (end < rows.length &&
|
|
1799
|
+
performance.now() - sliceStarted >= FILTER_TIME_BUDGET_MS) {
|
|
1800
|
+
await index$1.timeout();
|
|
1801
|
+
sliceStarted = performance.now();
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
return runId === this.filteringRunId ? trimmed : undefined;
|
|
1805
|
+
}
|
|
1806
|
+
destroy() {
|
|
1807
|
+
this.cancelFiltering();
|
|
1808
|
+
super.destroy();
|
|
1706
1809
|
}
|
|
1707
1810
|
/**
|
|
1708
1811
|
* Get trimmed rows based on filter
|
|
@@ -2677,7 +2780,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2677
2780
|
customRenderer: options.groupLabelTemplate,
|
|
2678
2781
|
cellRenderer: options.groupCellTemplate,
|
|
2679
2782
|
});
|
|
2680
|
-
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
|
|
2783
|
+
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups, { filterTrimmedMode: 'recompute-after-source-set' });
|
|
2681
2784
|
}
|
|
2682
2785
|
/**
|
|
2683
2786
|
* External call to apply grouping. Called by revogrid when prop changed.
|
|
@@ -2777,10 +2880,17 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2777
2880
|
this.providers.data.setData(source, column_service.GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
|
|
2778
2881
|
this.updateTrimmed(undefined, undefined, oldNewIndexes, source);
|
|
2779
2882
|
}
|
|
2780
|
-
updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source')) {
|
|
2883
|
+
updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source'), { filterTrimmedMode = 'remap', } = {}) {
|
|
2781
2884
|
// map previously trimmed data
|
|
2782
2885
|
const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
|
|
2783
2886
|
for (let type in trimemedOptionsToUpgrade) {
|
|
2887
|
+
if (filterTrimmedMode === 'recompute-after-source-set' &&
|
|
2888
|
+
type === FILTER_TRIMMED_TYPE) {
|
|
2889
|
+
// The filter plugin recalculates this trim against the installed source
|
|
2890
|
+
// during aftersourceset. Reapplying remapped old indexes afterwards
|
|
2891
|
+
// would overwrite that fresh result.
|
|
2892
|
+
continue;
|
|
2893
|
+
}
|
|
2784
2894
|
if (type === FILTER_TRIMMED_TYPE) {
|
|
2785
2895
|
/** Regrouping changes physical indexes, so filter trim needs fresh group-header state. */
|
|
2786
2896
|
trimemedOptionsToUpgrade[type] = filterOutEmptyGroupRows(source, trimemedOptionsToUpgrade[type]);
|
|
@@ -3050,14 +3160,449 @@ function getColumnDragPosition(targetItem, startItem, renderOffset, scrollOffset
|
|
|
3050
3160
|
return insertionEdge - renderOffset + scrollOffset;
|
|
3051
3161
|
}
|
|
3052
3162
|
|
|
3163
|
+
const DEFAULT_MIN_ROW_HEIGHT = 20;
|
|
3164
|
+
const finiteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
3165
|
+
function resolveRowResizeConfig(config = {}) {
|
|
3166
|
+
const minHeight = finiteNumber(config.minHeight)
|
|
3167
|
+
? Math.max(1, Math.round(config.minHeight))
|
|
3168
|
+
: DEFAULT_MIN_ROW_HEIGHT;
|
|
3169
|
+
const maxHeight = finiteNumber(config.maxHeight)
|
|
3170
|
+
? Math.max(minHeight, Math.round(config.maxHeight))
|
|
3171
|
+
: undefined;
|
|
3172
|
+
return { minHeight, maxHeight, fullRow: config.fullRow === true };
|
|
3173
|
+
}
|
|
3174
|
+
function clampRowResizeHeight(height, config) {
|
|
3175
|
+
var _a;
|
|
3176
|
+
const rounded = Number.isFinite(height)
|
|
3177
|
+
? Math.round(height)
|
|
3178
|
+
: config.minHeight;
|
|
3179
|
+
return Math.min(Math.max(rounded, config.minHeight), (_a = config.maxHeight) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY);
|
|
3180
|
+
}
|
|
3181
|
+
function getRowResizeIndexes({ rowType, rowIndex, rowCount, selectedRange, selectedRowType, }) {
|
|
3182
|
+
if (!selectedRange ||
|
|
3183
|
+
selectedRowType !== rowType ||
|
|
3184
|
+
rowIndex < Math.min(selectedRange.y, selectedRange.y1) ||
|
|
3185
|
+
rowIndex > Math.max(selectedRange.y, selectedRange.y1)) {
|
|
3186
|
+
return rowIndex >= 0 && rowIndex < rowCount ? [rowIndex] : [];
|
|
3187
|
+
}
|
|
3188
|
+
const start = Math.max(0, Math.min(selectedRange.y, selectedRange.y1));
|
|
3189
|
+
const end = Math.min(rowCount - 1, Math.max(selectedRange.y, selectedRange.y1));
|
|
3190
|
+
return Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => start + i);
|
|
3191
|
+
}
|
|
3192
|
+
function createRowResizePatch(indexes, size) {
|
|
3193
|
+
return indexes.reduce((patch, index) => {
|
|
3194
|
+
patch[index] = size;
|
|
3195
|
+
return patch;
|
|
3196
|
+
}, {});
|
|
3197
|
+
}
|
|
3198
|
+
function mergeRowResizeDefinitions(definitions, rowType, physicalIndexes, size) {
|
|
3199
|
+
const targetIndexes = new Set(physicalIndexes);
|
|
3200
|
+
const existingIndexes = new Set();
|
|
3201
|
+
const merged = definitions.map(definition => {
|
|
3202
|
+
if (definition.type !== rowType || !targetIndexes.has(definition.index)) {
|
|
3203
|
+
return definition;
|
|
3204
|
+
}
|
|
3205
|
+
existingIndexes.add(definition.index);
|
|
3206
|
+
return Object.assign(Object.assign({}, definition), { size });
|
|
3207
|
+
});
|
|
3208
|
+
for (const index of targetIndexes) {
|
|
3209
|
+
if (!existingIndexes.has(index)) {
|
|
3210
|
+
merged.push({ type: rowType, index, size });
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
return merged;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
const ROW_RESIZE_HANDLE_CLASS = 'row-resize-handle';
|
|
3217
|
+
const BEFORE_ROW_RESIZE_EVENT = 'beforerowresize';
|
|
3218
|
+
const ROW_RESIZE_EVENT = 'rowresize';
|
|
3219
|
+
const AFTER_ROW_RESIZE_EVENT = 'afterrowresize';
|
|
3220
|
+
const ROW_RESIZE_CANCEL_EVENT = 'rowresizecancel';
|
|
3221
|
+
class RowResizePlugin extends BasePlugin {
|
|
3222
|
+
static fromGridProperty(revogrid, providers) {
|
|
3223
|
+
const plugin = new RowResizePlugin(revogrid, providers);
|
|
3224
|
+
plugin.controlFromGridProperty();
|
|
3225
|
+
return plugin;
|
|
3226
|
+
}
|
|
3227
|
+
constructor(revogrid, providers, config = {}) {
|
|
3228
|
+
super(revogrid, providers);
|
|
3229
|
+
this.enabled = false;
|
|
3230
|
+
this.gridResizeRow = false;
|
|
3231
|
+
this.gridPlugins = [];
|
|
3232
|
+
this.committedSizes = new Map();
|
|
3233
|
+
this.appliedIndexes = new Map();
|
|
3234
|
+
this.previousBodyCursor = '';
|
|
3235
|
+
this.decorateRow = ({ detail, }) => {
|
|
3236
|
+
if (!this.enabled ||
|
|
3237
|
+
(detail.colType !== 'rowHeaders' && !this.config.fullRow)) {
|
|
3238
|
+
return;
|
|
3239
|
+
}
|
|
3240
|
+
const handle = this.h('div', {
|
|
3241
|
+
'key': `row-resize-${detail.rowType}-${detail.item.itemIndex}`,
|
|
3242
|
+
'class': { [ROW_RESIZE_HANDLE_CLASS]: true },
|
|
3243
|
+
'data-row-resize-index': detail.item.itemIndex,
|
|
3244
|
+
'aria-hidden': 'true',
|
|
3245
|
+
'onPointerDown': (event) => this.startResize(event, detail.rowType, detail.item.itemIndex),
|
|
3246
|
+
});
|
|
3247
|
+
detail.node.$children$ = [...(detail.node.$children$ || []), handle];
|
|
3248
|
+
};
|
|
3249
|
+
this.cancelForDataChange = () => this.cancel('data-change');
|
|
3250
|
+
this.onPointerMove = (event) => {
|
|
3251
|
+
const active = this.active;
|
|
3252
|
+
if ((active === null || active === void 0 ? void 0 : active.pointerId) !== event.pointerId) {
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3255
|
+
event.preventDefault();
|
|
3256
|
+
active.lastEvent = event;
|
|
3257
|
+
this.pendingHeight = clampRowResizeHeight(active.startHeight + event.clientY - active.startY, this.config);
|
|
3258
|
+
if (this.animationFrame === undefined) {
|
|
3259
|
+
const view = this.revogrid.ownerDocument.defaultView;
|
|
3260
|
+
this.animationFrame = view === null || view === void 0 ? void 0 : view.requestAnimationFrame(() => {
|
|
3261
|
+
this.animationFrame = undefined;
|
|
3262
|
+
this.flushPendingResize();
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
};
|
|
3266
|
+
this.onPointerUp = (event) => {
|
|
3267
|
+
const active = this.active;
|
|
3268
|
+
if ((active === null || active === void 0 ? void 0 : active.pointerId) !== event.pointerId) {
|
|
3269
|
+
return;
|
|
3270
|
+
}
|
|
3271
|
+
event.preventDefault();
|
|
3272
|
+
active.lastEvent = event;
|
|
3273
|
+
this.pendingHeight = clampRowResizeHeight(active.startHeight + event.clientY - active.startY, this.config);
|
|
3274
|
+
this.flushPendingResize();
|
|
3275
|
+
if (this.active !== active) {
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
const detail = this.eventDetail(active, event, active.currentHeight);
|
|
3279
|
+
this.finishGesture();
|
|
3280
|
+
this.commitResize(active);
|
|
3281
|
+
this.emit(AFTER_ROW_RESIZE_EVENT, detail);
|
|
3282
|
+
};
|
|
3283
|
+
this.onPointerCancel = (event) => {
|
|
3284
|
+
var _a;
|
|
3285
|
+
if (((_a = this.active) === null || _a === void 0 ? void 0 : _a.pointerId) === event.pointerId) {
|
|
3286
|
+
this.active.lastEvent = event;
|
|
3287
|
+
this.cancel('pointercancel');
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
3290
|
+
this.onKeyDown = (event) => {
|
|
3291
|
+
if (event.key === 'Escape' && this.active) {
|
|
3292
|
+
event.preventDefault();
|
|
3293
|
+
this.cancel('escape');
|
|
3294
|
+
}
|
|
3295
|
+
};
|
|
3296
|
+
this.onWindowBlur = () => this.cancel('blur');
|
|
3297
|
+
this.reapplyCommittedSizes = () => this.applyCommittedSizes(false);
|
|
3298
|
+
this.rebuildCommittedSizes = () => this.applyCommittedSizes(true);
|
|
3299
|
+
this.syncAppliedIndexes = () => {
|
|
3300
|
+
for (const [rowType, committed] of this.committedSizes) {
|
|
3301
|
+
const items = this.providers.data.stores[rowType].store.get('items');
|
|
3302
|
+
const indexes = new Set();
|
|
3303
|
+
items.forEach((physicalIndex, virtualIndex) => {
|
|
3304
|
+
if (committed.has(physicalIndex)) {
|
|
3305
|
+
indexes.add(virtualIndex);
|
|
3306
|
+
}
|
|
3307
|
+
});
|
|
3308
|
+
this.appliedIndexes.set(rowType, indexes);
|
|
3309
|
+
}
|
|
3310
|
+
};
|
|
3311
|
+
this.config = resolveRowResizeConfig(config);
|
|
3312
|
+
this.rowDefinitionsRef = revogrid.rowDefinitions;
|
|
3313
|
+
if (new.target !== RowResizePlugin) {
|
|
3314
|
+
this.enabled = true;
|
|
3315
|
+
this.registerEventListeners();
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
registerEventListeners() {
|
|
3319
|
+
this.addEventListener('beforerowrender', this.decorateRow);
|
|
3320
|
+
this.addEventListener('beforeanysource', ({ detail }) => {
|
|
3321
|
+
this.cancel('data-change');
|
|
3322
|
+
const committed = this.committedSizes.get(detail.type);
|
|
3323
|
+
if (!committed) {
|
|
3324
|
+
return;
|
|
3325
|
+
}
|
|
3326
|
+
const removedIndexes = new Set();
|
|
3327
|
+
for (const index of committed.keys()) {
|
|
3328
|
+
if (index >= detail.source.length) {
|
|
3329
|
+
committed.delete(index);
|
|
3330
|
+
removedIndexes.add(index);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
if (removedIndexes.size) {
|
|
3334
|
+
const rowDefinitions = this.revogrid.rowDefinitions.filter(definition => definition.type !== detail.type ||
|
|
3335
|
+
!removedIndexes.has(definition.index));
|
|
3336
|
+
this.rowDefinitionsRef = rowDefinitions;
|
|
3337
|
+
this.revogrid.rowDefinitions = rowDefinitions;
|
|
3338
|
+
}
|
|
3339
|
+
});
|
|
3340
|
+
this.addEventListener('afteranysource', this.rebuildCommittedSizes);
|
|
3341
|
+
this.addEventListener('beforesourcesortingapply', this.cancelForDataChange);
|
|
3342
|
+
this.addEventListener('aftersortingapply', this.reapplyCommittedSizes);
|
|
3343
|
+
this.addEventListener('beforefilterapply', this.cancelForDataChange);
|
|
3344
|
+
this.addEventListener('beforerowdefinition', ({ detail }) => {
|
|
3345
|
+
this.cancel('data-change');
|
|
3346
|
+
if (detail.vals !== this.rowDefinitionsRef) {
|
|
3347
|
+
this.committedSizes.clear();
|
|
3348
|
+
this.appliedIndexes.clear();
|
|
3349
|
+
this.rowDefinitionsRef = detail.vals;
|
|
3350
|
+
}
|
|
3351
|
+
});
|
|
3352
|
+
this.addEventListener('afterthemechanged', this.reapplyCommittedSizes);
|
|
3353
|
+
this.addEventListener('aftertrimmed', this.syncAppliedIndexes);
|
|
3354
|
+
this.addEventListener('roworderchange', () => {
|
|
3355
|
+
queueMicrotask(this.reapplyCommittedSizes);
|
|
3356
|
+
});
|
|
3357
|
+
this.addEventListener(column_service.GROUP_EXPAND_EVENT, () => {
|
|
3358
|
+
queueMicrotask(this.reapplyCommittedSizes);
|
|
3359
|
+
});
|
|
3360
|
+
this.addEventListener('rowheaderschanged', ({ detail }) => {
|
|
3361
|
+
if (!detail && !this.config.fullRow) {
|
|
3362
|
+
this.cancel('row-headers-hidden');
|
|
3363
|
+
}
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
controlFromGridProperty() {
|
|
3367
|
+
this.gridResizeRow = this.revogrid.resizeRow;
|
|
3368
|
+
this.gridPlugins = this.revogrid.plugins;
|
|
3369
|
+
this.syncGridProperty(false);
|
|
3370
|
+
this.watch('resizeRow', value => {
|
|
3371
|
+
this.gridResizeRow = value;
|
|
3372
|
+
this.syncGridProperty();
|
|
3373
|
+
});
|
|
3374
|
+
this.watch('plugins', value => {
|
|
3375
|
+
this.gridPlugins = value || [];
|
|
3376
|
+
this.syncGridProperty();
|
|
3377
|
+
});
|
|
3378
|
+
}
|
|
3379
|
+
syncGridProperty(refresh = true) {
|
|
3380
|
+
const hasConfiguredPlugin = this.gridPlugins.some(plugin => plugin !== RowResizePlugin &&
|
|
3381
|
+
plugin.prototype instanceof RowResizePlugin);
|
|
3382
|
+
const explicitlyEnabled = this.gridPlugins.includes(RowResizePlugin);
|
|
3383
|
+
const enabled = hasConfiguredPlugin
|
|
3384
|
+
? false
|
|
3385
|
+
: explicitlyEnabled || !!this.gridResizeRow;
|
|
3386
|
+
const config = resolveRowResizeConfig(!hasConfiguredPlugin &&
|
|
3387
|
+
!explicitlyEnabled &&
|
|
3388
|
+
typeof this.gridResizeRow === 'object'
|
|
3389
|
+
? this.gridResizeRow
|
|
3390
|
+
: undefined);
|
|
3391
|
+
const configChanged = config.minHeight !== this.config.minHeight ||
|
|
3392
|
+
config.maxHeight !== this.config.maxHeight ||
|
|
3393
|
+
config.fullRow !== this.config.fullRow;
|
|
3394
|
+
if (enabled === this.enabled && !configChanged) {
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
this.cancel('config-change');
|
|
3398
|
+
this.config = config;
|
|
3399
|
+
if (enabled !== this.enabled) {
|
|
3400
|
+
this.enabled = enabled;
|
|
3401
|
+
if (enabled) {
|
|
3402
|
+
this.rowDefinitionsRef = this.revogrid.rowDefinitions;
|
|
3403
|
+
this.registerEventListeners();
|
|
3404
|
+
}
|
|
3405
|
+
else {
|
|
3406
|
+
this.clearSubscriptions();
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
if (refresh) {
|
|
3410
|
+
queueMicrotask(() => void this.revogrid.refresh());
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
startResize(event, rowType, index) {
|
|
3414
|
+
var _a, _b;
|
|
3415
|
+
if (!this.enabled ||
|
|
3416
|
+
this.active ||
|
|
3417
|
+
event.defaultPrevented ||
|
|
3418
|
+
!event.isPrimary ||
|
|
3419
|
+
(event.pointerType !== 'touch' && event.button !== 0)) {
|
|
3420
|
+
return;
|
|
3421
|
+
}
|
|
3422
|
+
const dimension = this.providers.dimension.stores[rowType];
|
|
3423
|
+
const dimensionState = dimension.getCurrentState();
|
|
3424
|
+
const item = dimension_helpers.getItemByIndex(dimensionState, index);
|
|
3425
|
+
const focusedStore = this.providers.selection.focusedStore;
|
|
3426
|
+
const selectedRowType = focusedStore
|
|
3427
|
+
? this.providers.selection.storesYToType[focusedStore.position.y]
|
|
3428
|
+
: undefined;
|
|
3429
|
+
const indexes = getRowResizeIndexes({
|
|
3430
|
+
rowType,
|
|
3431
|
+
rowIndex: index,
|
|
3432
|
+
rowCount: dimensionState.count,
|
|
3433
|
+
selectedRange: this.providers.selection.selectedRange,
|
|
3434
|
+
selectedRowType,
|
|
3435
|
+
});
|
|
3436
|
+
if (!indexes.length) {
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
const previousSizes = indexes.reduce((sizes, rowIndex) => {
|
|
3440
|
+
const row = dimension_helpers.getItemByIndex(dimensionState, rowIndex);
|
|
3441
|
+
sizes[rowIndex] = row.end - row.start;
|
|
3442
|
+
return sizes;
|
|
3443
|
+
}, {});
|
|
3444
|
+
const startHeight = item.end - item.start;
|
|
3445
|
+
const active = {
|
|
3446
|
+
pointerId: event.pointerId,
|
|
3447
|
+
rowType,
|
|
3448
|
+
index,
|
|
3449
|
+
indexes,
|
|
3450
|
+
startY: event.clientY,
|
|
3451
|
+
startHeight,
|
|
3452
|
+
currentHeight: startHeight,
|
|
3453
|
+
previousSizes,
|
|
3454
|
+
originalCustomSizes: Object.assign({}, dimensionState.sizes),
|
|
3455
|
+
startEvent: event,
|
|
3456
|
+
lastEvent: event,
|
|
3457
|
+
};
|
|
3458
|
+
const beforeEvent = this.emit(BEFORE_ROW_RESIZE_EVENT, this.eventDetail(active, event, startHeight));
|
|
3459
|
+
if (beforeEvent.defaultPrevented) {
|
|
3460
|
+
return;
|
|
3461
|
+
}
|
|
3462
|
+
event.preventDefault();
|
|
3463
|
+
event.stopPropagation();
|
|
3464
|
+
this.active = active;
|
|
3465
|
+
const doc = this.revogrid.ownerDocument;
|
|
3466
|
+
this.previousBodyCursor = ((_a = doc.body) === null || _a === void 0 ? void 0 : _a.style.cursor) || '';
|
|
3467
|
+
if (doc.body) {
|
|
3468
|
+
doc.body.style.cursor = 'row-resize';
|
|
3469
|
+
}
|
|
3470
|
+
doc.addEventListener('pointermove', this.onPointerMove, true);
|
|
3471
|
+
doc.addEventListener('pointerup', this.onPointerUp, true);
|
|
3472
|
+
doc.addEventListener('pointercancel', this.onPointerCancel, true);
|
|
3473
|
+
doc.addEventListener('keydown', this.onKeyDown, true);
|
|
3474
|
+
(_b = doc.defaultView) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.onWindowBlur);
|
|
3475
|
+
}
|
|
3476
|
+
flushPendingResize() {
|
|
3477
|
+
const active = this.active;
|
|
3478
|
+
if (!active || this.pendingHeight === undefined) {
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
const size = this.pendingHeight;
|
|
3482
|
+
this.pendingHeight = undefined;
|
|
3483
|
+
if (size === active.currentHeight) {
|
|
3484
|
+
return;
|
|
3485
|
+
}
|
|
3486
|
+
this.providers.dimension.setCustomSizes(active.rowType, createRowResizePatch(active.indexes, size), true);
|
|
3487
|
+
active.currentHeight = size;
|
|
3488
|
+
this.emit(ROW_RESIZE_EVENT, this.eventDetail(active, active.lastEvent, size));
|
|
3489
|
+
}
|
|
3490
|
+
cancel(reason) {
|
|
3491
|
+
const active = this.active;
|
|
3492
|
+
if (!active) {
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
const currentSizes = Object.assign({}, this.providers.dimension.stores[active.rowType].store.get('sizes'));
|
|
3496
|
+
for (const index of active.indexes) {
|
|
3497
|
+
if (Object.hasOwn(active.originalCustomSizes, index)) {
|
|
3498
|
+
currentSizes[index] = active.originalCustomSizes[index];
|
|
3499
|
+
}
|
|
3500
|
+
else {
|
|
3501
|
+
delete currentSizes[index];
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
this.providers.dimension.setCustomSizes(active.rowType, currentSizes);
|
|
3505
|
+
const detail = Object.assign(Object.assign({}, this.eventDetail(active, active.lastEvent || active.startEvent, active.startHeight)), { reason });
|
|
3506
|
+
this.finishGesture();
|
|
3507
|
+
this.emit(ROW_RESIZE_CANCEL_EVENT, detail);
|
|
3508
|
+
}
|
|
3509
|
+
eventDetail(active, originalEvent, size) {
|
|
3510
|
+
return {
|
|
3511
|
+
rowType: active.rowType,
|
|
3512
|
+
index: active.index,
|
|
3513
|
+
indexes: [...active.indexes],
|
|
3514
|
+
size,
|
|
3515
|
+
previousSizes: Object.assign({}, active.previousSizes),
|
|
3516
|
+
originalEvent,
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
commitResize(active) {
|
|
3520
|
+
if (active.currentHeight === active.startHeight) {
|
|
3521
|
+
return;
|
|
3522
|
+
}
|
|
3523
|
+
const items = this.providers.data.stores[active.rowType].store.get('items');
|
|
3524
|
+
let committed = this.committedSizes.get(active.rowType);
|
|
3525
|
+
if (!committed) {
|
|
3526
|
+
committed = new Map();
|
|
3527
|
+
this.committedSizes.set(active.rowType, committed);
|
|
3528
|
+
}
|
|
3529
|
+
let applied = this.appliedIndexes.get(active.rowType);
|
|
3530
|
+
if (!applied) {
|
|
3531
|
+
applied = new Set();
|
|
3532
|
+
this.appliedIndexes.set(active.rowType, applied);
|
|
3533
|
+
}
|
|
3534
|
+
const physicalIndexes = active.indexes.reduce((result, index) => {
|
|
3535
|
+
const physicalIndex = items[index];
|
|
3536
|
+
if (physicalIndex !== undefined) {
|
|
3537
|
+
committed.set(physicalIndex, active.currentHeight);
|
|
3538
|
+
applied.add(index);
|
|
3539
|
+
result.push(physicalIndex);
|
|
3540
|
+
}
|
|
3541
|
+
return result;
|
|
3542
|
+
}, []);
|
|
3543
|
+
if (physicalIndexes.length) {
|
|
3544
|
+
const rowDefinitions = mergeRowResizeDefinitions(this.revogrid.rowDefinitions, active.rowType, physicalIndexes, active.currentHeight);
|
|
3545
|
+
this.rowDefinitionsRef = rowDefinitions;
|
|
3546
|
+
this.revogrid.rowDefinitions = rowDefinitions;
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
applyCommittedSizes(clearAppliedIndexes) {
|
|
3550
|
+
for (const [rowType, committed] of this.committedSizes) {
|
|
3551
|
+
const dimension = this.providers.dimension.stores[rowType];
|
|
3552
|
+
const sizes = Object.assign({}, dimension.store.get('sizes'));
|
|
3553
|
+
if (clearAppliedIndexes) {
|
|
3554
|
+
for (const index of this.appliedIndexes.get(rowType) || []) {
|
|
3555
|
+
delete sizes[index];
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
const items = this.providers.data.stores[rowType].store.get('items');
|
|
3559
|
+
const indexes = new Set();
|
|
3560
|
+
items.forEach((physicalIndex, virtualIndex) => {
|
|
3561
|
+
const size = committed.get(physicalIndex);
|
|
3562
|
+
if (size !== undefined) {
|
|
3563
|
+
sizes[virtualIndex] = size;
|
|
3564
|
+
indexes.add(virtualIndex);
|
|
3565
|
+
}
|
|
3566
|
+
});
|
|
3567
|
+
this.appliedIndexes.set(rowType, indexes);
|
|
3568
|
+
this.providers.dimension.setCustomSizes(rowType, sizes);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
finishGesture() {
|
|
3572
|
+
const doc = this.revogrid.ownerDocument;
|
|
3573
|
+
const view = doc.defaultView;
|
|
3574
|
+
if (this.animationFrame !== undefined) {
|
|
3575
|
+
view === null || view === void 0 ? void 0 : view.cancelAnimationFrame(this.animationFrame);
|
|
3576
|
+
}
|
|
3577
|
+
doc.removeEventListener('pointermove', this.onPointerMove, true);
|
|
3578
|
+
doc.removeEventListener('pointerup', this.onPointerUp, true);
|
|
3579
|
+
doc.removeEventListener('pointercancel', this.onPointerCancel, true);
|
|
3580
|
+
doc.removeEventListener('keydown', this.onKeyDown, true);
|
|
3581
|
+
view === null || view === void 0 ? void 0 : view.removeEventListener('blur', this.onWindowBlur);
|
|
3582
|
+
if (doc.body) {
|
|
3583
|
+
doc.body.style.cursor = this.previousBodyCursor;
|
|
3584
|
+
}
|
|
3585
|
+
this.animationFrame = undefined;
|
|
3586
|
+
this.pendingHeight = undefined;
|
|
3587
|
+
this.active = undefined;
|
|
3588
|
+
}
|
|
3589
|
+
destroy() {
|
|
3590
|
+
this.cancel('destroy');
|
|
3591
|
+
super.destroy();
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
exports.AFTER_ROW_RESIZE_EVENT = AFTER_ROW_RESIZE_EVENT;
|
|
3053
3596
|
exports.AutoSizeColumnPlugin = AutoSizeColumnPlugin;
|
|
3054
3597
|
exports.BEFORE_COLUMN_DRAG_END_EVENT = BEFORE_COLUMN_DRAG_END_EVENT;
|
|
3598
|
+
exports.BEFORE_ROW_RESIZE_EVENT = BEFORE_ROW_RESIZE_EVENT;
|
|
3055
3599
|
exports.BasePlugin = BasePlugin;
|
|
3056
3600
|
exports.COLUMN_DRAG_END_EVENT = COLUMN_DRAG_END_EVENT;
|
|
3057
3601
|
exports.COLUMN_DRAG_MOVE_EVENT = COLUMN_DRAG_MOVE_EVENT;
|
|
3058
3602
|
exports.COLUMN_DRAG_START_EVENT = COLUMN_DRAG_START_EVENT;
|
|
3059
3603
|
exports.ColumnMovePlugin = ColumnMovePlugin;
|
|
3060
3604
|
exports.DEFAULT_BLANK_SEMANTICS = DEFAULT_BLANK_SEMANTICS;
|
|
3605
|
+
exports.DEFAULT_MIN_ROW_HEIGHT = DEFAULT_MIN_ROW_HEIGHT;
|
|
3061
3606
|
exports.DimensionStore = DimensionStore;
|
|
3062
3607
|
exports.ExportCsv = ExportCsv;
|
|
3063
3608
|
exports.ExportFilePlugin = ExportFilePlugin;
|
|
@@ -3066,9 +3611,15 @@ exports.FILTER_TRIMMED_TYPE = FILTER_TRIMMED_TYPE;
|
|
|
3066
3611
|
exports.FILTE_PANEL = FILTE_PANEL;
|
|
3067
3612
|
exports.FilterPlugin = FilterPlugin;
|
|
3068
3613
|
exports.GroupingRowPlugin = GroupingRowPlugin;
|
|
3614
|
+
exports.ROW_RESIZE_CANCEL_EVENT = ROW_RESIZE_CANCEL_EVENT;
|
|
3615
|
+
exports.ROW_RESIZE_EVENT = ROW_RESIZE_EVENT;
|
|
3616
|
+
exports.ROW_RESIZE_HANDLE_CLASS = ROW_RESIZE_HANDLE_CLASS;
|
|
3617
|
+
exports.RowResizePlugin = RowResizePlugin;
|
|
3069
3618
|
exports.SelectionStore = SelectionStore;
|
|
3070
3619
|
exports.SortingPlugin = SortingPlugin;
|
|
3071
3620
|
exports.StretchColumn = StretchColumn;
|
|
3621
|
+
exports.clampRowResizeHeight = clampRowResizeHeight;
|
|
3622
|
+
exports.createRowResizePatch = createRowResizePatch;
|
|
3072
3623
|
exports.defaultCellCompare = defaultCellCompare;
|
|
3073
3624
|
exports.defineTheme = defineTheme;
|
|
3074
3625
|
exports.descCellCompare = descCellCompare;
|
|
@@ -3081,10 +3632,13 @@ exports.getColumnDragPosition = getColumnDragPosition;
|
|
|
3081
3632
|
exports.getComparer = getComparer;
|
|
3082
3633
|
exports.getLeftRelative = getLeftRelative;
|
|
3083
3634
|
exports.getNextOrder = getNextOrder;
|
|
3635
|
+
exports.getRowResizeIndexes = getRowResizeIndexes;
|
|
3084
3636
|
exports.getSortingIndex = getSortingIndex;
|
|
3085
3637
|
exports.hasActiveSorting = hasActiveSorting;
|
|
3086
3638
|
exports.isBlankValue = isBlankValue;
|
|
3087
3639
|
exports.isStretchPlugin = isStretchPlugin;
|
|
3640
|
+
exports.mergeRowResizeDefinitions = mergeRowResizeDefinitions;
|
|
3088
3641
|
exports.resolveBlankSemantics = resolveBlankSemantics;
|
|
3642
|
+
exports.resolveRowResizeConfig = resolveRowResizeConfig;
|
|
3089
3643
|
exports.sortIndexByItems = sortIndexByItems;
|
|
3090
3644
|
exports.themeTokenCssVariables = themeTokenCssVariables;
|