@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
|
@@ -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, 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-
|
|
5
|
-
import {
|
|
6
|
-
import { j as calculateRowHeaderSize } from './viewport.store-
|
|
7
|
-
import { g as getScrollbarSize, t as timeout } from './index-
|
|
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, 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-CM-wgGs8.js';
|
|
5
|
+
import { L as createStore, m as setStore, j as calculateDimensionData, N as identity, O as isArray, b as getSourceItem, g as getPhysical, e as setItems, k as getItemByPosition, l as getItemByIndex } from './dimension.helpers-Cln9sALu.js';
|
|
6
|
+
import { j as calculateRowHeaderSize } from './viewport.store-DWMKRDSH.js';
|
|
7
|
+
import { g as getScrollbarSize, t as timeout } from './index-BvMNbQyq.js';
|
|
8
8
|
import { h } from './index-CtimkLsB.js';
|
|
9
9
|
import { b as FILTER_PROP, i as isFilterBtn } from './filter.button-DMhpuAiw.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-Bqh1PrgH.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Public theme tokens and their CSS custom-property counterparts.
|
|
@@ -151,9 +151,7 @@ const trimmedPlugin = (storeService) => {
|
|
|
151
151
|
}
|
|
152
152
|
case 'trimmed': {
|
|
153
153
|
const trim = val;
|
|
154
|
-
|
|
155
|
-
trimmedPreviousSizes = storeService.store.get('sizes');
|
|
156
|
-
}
|
|
154
|
+
trimmedPreviousSizes !== null && trimmedPreviousSizes !== void 0 ? trimmedPreviousSizes : (trimmedPreviousSizes = storeService.store.get('sizes'));
|
|
157
155
|
trimmingObject = removeMultipleAndShift(trimmedPreviousSizes, trim || {});
|
|
158
156
|
// save a reference to the trimmed object to prevent changes after trimming
|
|
159
157
|
storeService.setSizes(trimmingObject);
|
|
@@ -1380,6 +1378,13 @@ const filterNames = {
|
|
|
1380
1378
|
lte: '<=',
|
|
1381
1379
|
};
|
|
1382
1380
|
|
|
1381
|
+
/** Fewer rows keep the existing synchronous filtering behavior. */
|
|
1382
|
+
const ASYNC_FILTER_ROW_THRESHOLD = 15000;
|
|
1383
|
+
/** Maximum rows evaluated in one filtering chunk. */
|
|
1384
|
+
const FILTER_CHUNK_SIZE = 1000;
|
|
1385
|
+
/** Yield after approximately this much accumulated filtering work. */
|
|
1386
|
+
const FILTER_TIME_BUDGET_MS = 5;
|
|
1387
|
+
|
|
1383
1388
|
// filter.plugin.tsx
|
|
1384
1389
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
1385
1390
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
@@ -1424,6 +1429,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1424
1429
|
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
1425
1430
|
this.filterProp = FILTER_PROP;
|
|
1426
1431
|
this.allowDuplicateOperators = true;
|
|
1432
|
+
this.filteringRunId = 0;
|
|
1427
1433
|
if (config) {
|
|
1428
1434
|
this.initConfig(config);
|
|
1429
1435
|
}
|
|
@@ -1432,7 +1438,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1432
1438
|
...existingNodes,
|
|
1433
1439
|
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()),
|
|
1434
1440
|
];
|
|
1435
|
-
const aftersourceset =
|
|
1441
|
+
const aftersourceset = () => {
|
|
1436
1442
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
1437
1443
|
if (filterCollectionProps.length > 0) {
|
|
1438
1444
|
// handle old way of filtering by reworking FilterCollection to new MultiFilterItem
|
|
@@ -1449,12 +1455,26 @@ class FilterPlugin extends BasePlugin {
|
|
|
1449
1455
|
}
|
|
1450
1456
|
});
|
|
1451
1457
|
}
|
|
1452
|
-
if (
|
|
1458
|
+
if (!this.hasActiveFilters()) {
|
|
1459
|
+
this.cancelFiltering();
|
|
1453
1460
|
return;
|
|
1454
1461
|
}
|
|
1455
|
-
|
|
1456
|
-
await this.runFiltering(this.multiFilterItems);
|
|
1462
|
+
void this.runFiltering(this.multiFilterItems);
|
|
1457
1463
|
};
|
|
1464
|
+
/**
|
|
1465
|
+
* This executes before the data store replaces its source.
|
|
1466
|
+
* For a large source with active filters:
|
|
1467
|
+
* 1. Existing filtering runs are invalidated.
|
|
1468
|
+
* 2. Pending state starts.
|
|
1469
|
+
* 3. Visible rows become empty.
|
|
1470
|
+
* 4. The source is replaced while the DataStore guard prevents it from exposing unfiltered rows.
|
|
1471
|
+
*/
|
|
1472
|
+
this.addEventListener('beforesourceset', ({ detail }) => {
|
|
1473
|
+
if (detail.source.length >= ASYNC_FILTER_ROW_THRESHOLD &&
|
|
1474
|
+
this.hasActiveFilters()) {
|
|
1475
|
+
this.deferFiltering();
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1458
1478
|
this.addEventListener('headerclick', e => this.headerclick(e));
|
|
1459
1479
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
1460
1480
|
if (!detail) {
|
|
@@ -1615,7 +1635,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
1615
1635
|
// store the filter items
|
|
1616
1636
|
this.multiFilterItems = filterItems;
|
|
1617
1637
|
// run the filtering when the items change
|
|
1618
|
-
this.runFiltering(this.multiFilterItems);
|
|
1638
|
+
await this.runFiltering(this.multiFilterItems);
|
|
1619
1639
|
}
|
|
1620
1640
|
onFilterReset(prop) {
|
|
1621
1641
|
delete this.multiFilterItems[prop !== null && prop !== void 0 ? prop : ''];
|
|
@@ -1625,6 +1645,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
1625
1645
|
* Triggers grid filtering
|
|
1626
1646
|
*/
|
|
1627
1647
|
async doFiltering(collection, source, columns, filterItems) {
|
|
1648
|
+
// creates the execution token - owns the actual calculation
|
|
1649
|
+
const runId = this.beginFiltering();
|
|
1628
1650
|
const columnsToUpdate = [];
|
|
1629
1651
|
/**
|
|
1630
1652
|
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
@@ -1649,7 +1671,25 @@ class FilterPlugin extends BasePlugin {
|
|
|
1649
1671
|
column[this.filterProp] = true;
|
|
1650
1672
|
}
|
|
1651
1673
|
});
|
|
1652
|
-
|
|
1674
|
+
let itemsToTrim;
|
|
1675
|
+
const hasFilters = Object.keys(filterItems).length > 0 || this.hasActiveFilters();
|
|
1676
|
+
const isLargeSource = hasFilters && source.length >= ASYNC_FILTER_ROW_THRESHOLD;
|
|
1677
|
+
if (isLargeSource) {
|
|
1678
|
+
this.providers.data.setItemsPending(true);
|
|
1679
|
+
await timeout();
|
|
1680
|
+
}
|
|
1681
|
+
if (!hasFilters) {
|
|
1682
|
+
itemsToTrim = {};
|
|
1683
|
+
}
|
|
1684
|
+
else if (isLargeSource && this.supportsChunkedFiltering()) {
|
|
1685
|
+
itemsToTrim = await this.getRowFilterInChunks(source, filterItems, columnByProp, runId);
|
|
1686
|
+
}
|
|
1687
|
+
else {
|
|
1688
|
+
itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
1689
|
+
}
|
|
1690
|
+
if (!itemsToTrim || runId !== this.filteringRunId) {
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1653
1693
|
// check is filter event prevented
|
|
1654
1694
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
1655
1695
|
collection,
|
|
@@ -1657,10 +1697,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
1657
1697
|
source,
|
|
1658
1698
|
filterItems,
|
|
1659
1699
|
});
|
|
1660
|
-
if (defaultPrevented) {
|
|
1700
|
+
if (defaultPrevented || runId !== this.filteringRunId) {
|
|
1701
|
+
this.releaseFiltering(runId);
|
|
1661
1702
|
return;
|
|
1662
1703
|
}
|
|
1663
1704
|
this.providers.data.setTrimmed({ [FILTER_TRIMMED_TYPE]: detail.itemsToFilter });
|
|
1705
|
+
this.releaseFiltering(runId);
|
|
1664
1706
|
// applies the hasFilter to the columns to show filter icon
|
|
1665
1707
|
this.providers.column.updateColumns(columnsToUpdate);
|
|
1666
1708
|
this.emit('afterfilterapply', {
|
|
@@ -1674,6 +1716,10 @@ class FilterPlugin extends BasePlugin {
|
|
|
1674
1716
|
await this.runFiltering(this.multiFilterItems);
|
|
1675
1717
|
}
|
|
1676
1718
|
async runFiltering(multiFilterItems) {
|
|
1719
|
+
// runFiltering: First token: "Is this request still valid after event handlers run?"
|
|
1720
|
+
// doFiltering: Second token: "Is this calculation still the newest one?"
|
|
1721
|
+
// creates a preflight token and sets the grid to a pending state
|
|
1722
|
+
const runId = this.beginFiltering();
|
|
1677
1723
|
const collection = {};
|
|
1678
1724
|
// handle old filterCollection to return the first filter only (if any) from multiFilterItems
|
|
1679
1725
|
const filterProps = Object.keys(multiFilterItems);
|
|
@@ -1697,10 +1743,67 @@ class FilterPlugin extends BasePlugin {
|
|
|
1697
1743
|
columns,
|
|
1698
1744
|
filterItems: this.multiFilterItems,
|
|
1699
1745
|
});
|
|
1700
|
-
if (defaultPrevented) {
|
|
1746
|
+
if (defaultPrevented || runId !== this.filteringRunId) {
|
|
1747
|
+
this.releaseFiltering(runId);
|
|
1701
1748
|
return;
|
|
1702
1749
|
}
|
|
1703
|
-
this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
|
|
1750
|
+
await this.doFiltering(detail.collection, detail.source, detail.columns, detail.filterItems);
|
|
1751
|
+
}
|
|
1752
|
+
/** Whether this plugin currently owns filter state that must follow a new source. */
|
|
1753
|
+
hasActiveFilters() {
|
|
1754
|
+
return (Object.keys(this.multiFilterItems).length > 0 ||
|
|
1755
|
+
Object.keys(this.filterCollection).length > 0);
|
|
1756
|
+
}
|
|
1757
|
+
/** Preserve whole-source semantics for plugins that override getRowFilter. */
|
|
1758
|
+
supportsChunkedFiltering() {
|
|
1759
|
+
return this.getRowFilter === FilterPlugin.prototype.getRowFilter;
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Hide visible rows and invalidate current filtering until a deferred filter
|
|
1763
|
+
* run is ready. Used by filter extensions with their own debounced state.
|
|
1764
|
+
*/
|
|
1765
|
+
deferFiltering() {
|
|
1766
|
+
this.beginFiltering(true);
|
|
1767
|
+
}
|
|
1768
|
+
beginFiltering(pending = false) {
|
|
1769
|
+
const runId = ++this.filteringRunId;
|
|
1770
|
+
if (pending) {
|
|
1771
|
+
this.providers.data.setItemsPending(true);
|
|
1772
|
+
}
|
|
1773
|
+
return runId;
|
|
1774
|
+
}
|
|
1775
|
+
releaseFiltering(runId) {
|
|
1776
|
+
if (runId === this.filteringRunId) {
|
|
1777
|
+
this.providers.data.setItemsPending(false);
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
cancelFiltering() {
|
|
1781
|
+
this.releaseFiltering(this.beginFiltering());
|
|
1782
|
+
}
|
|
1783
|
+
async getRowFilterInChunks(rows, filterItems, columnByProp, runId) {
|
|
1784
|
+
const trimmed = {};
|
|
1785
|
+
let sliceStarted = performance.now();
|
|
1786
|
+
for (let offset = 0; offset < rows.length; offset += FILTER_CHUNK_SIZE) {
|
|
1787
|
+
if (runId !== this.filteringRunId) {
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
const end = Math.min(offset + FILTER_CHUNK_SIZE, rows.length);
|
|
1791
|
+
const chunkTrimmed = this.getRowFilter(rows.slice(offset, end), filterItems, columnByProp);
|
|
1792
|
+
// filter that chunk
|
|
1793
|
+
for (const chunkIndex in chunkTrimmed) {
|
|
1794
|
+
trimmed[offset + Number(chunkIndex)] = true;
|
|
1795
|
+
}
|
|
1796
|
+
if (end < rows.length &&
|
|
1797
|
+
performance.now() - sliceStarted >= FILTER_TIME_BUDGET_MS) {
|
|
1798
|
+
await timeout();
|
|
1799
|
+
sliceStarted = performance.now();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
return runId === this.filteringRunId ? trimmed : undefined;
|
|
1803
|
+
}
|
|
1804
|
+
destroy() {
|
|
1805
|
+
this.cancelFiltering();
|
|
1806
|
+
super.destroy();
|
|
1704
1807
|
}
|
|
1705
1808
|
/**
|
|
1706
1809
|
* Get trimmed rows based on filter
|
|
@@ -2675,7 +2778,7 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2675
2778
|
customRenderer: options.groupLabelTemplate,
|
|
2676
2779
|
cellRenderer: options.groupCellTemplate,
|
|
2677
2780
|
});
|
|
2678
|
-
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups);
|
|
2781
|
+
this.updateTrimmed(trimmed, oldNewIndexMap, undefined, sourceWithGroups, { filterTrimmedMode: 'recompute-after-source-set' });
|
|
2679
2782
|
}
|
|
2680
2783
|
/**
|
|
2681
2784
|
* External call to apply grouping. Called by revogrid when prop changed.
|
|
@@ -2775,10 +2878,17 @@ class GroupingRowPlugin extends BasePlugin {
|
|
|
2775
2878
|
this.providers.data.setData(source, GROUPING_ROW_TYPE, this.revogrid.disableVirtualY, undefined, true);
|
|
2776
2879
|
this.updateTrimmed(undefined, undefined, oldNewIndexes, source);
|
|
2777
2880
|
}
|
|
2778
|
-
updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source')) {
|
|
2881
|
+
updateTrimmed(trimmedGroup = {}, firstLevelMap = {}, secondLevelMap, source = this.getStore().get('source'), { filterTrimmedMode = 'remap', } = {}) {
|
|
2779
2882
|
// map previously trimmed data
|
|
2780
2883
|
const trimemedOptionsToUpgrade = processDoubleConversionTrimmed(this.getStore().get('trimmed'), firstLevelMap, secondLevelMap);
|
|
2781
2884
|
for (let type in trimemedOptionsToUpgrade) {
|
|
2885
|
+
if (filterTrimmedMode === 'recompute-after-source-set' &&
|
|
2886
|
+
type === FILTER_TRIMMED_TYPE) {
|
|
2887
|
+
// The filter plugin recalculates this trim against the installed source
|
|
2888
|
+
// during aftersourceset. Reapplying remapped old indexes afterwards
|
|
2889
|
+
// would overwrite that fresh result.
|
|
2890
|
+
continue;
|
|
2891
|
+
}
|
|
2782
2892
|
if (type === FILTER_TRIMMED_TYPE) {
|
|
2783
2893
|
/** Regrouping changes physical indexes, so filter trim needs fresh group-header state. */
|
|
2784
2894
|
trimemedOptionsToUpgrade[type] = filterOutEmptyGroupRows(source, trimemedOptionsToUpgrade[type]);
|
|
@@ -3048,4 +3158,436 @@ function getColumnDragPosition(targetItem, startItem, renderOffset, scrollOffset
|
|
|
3048
3158
|
return insertionEdge - renderOffset + scrollOffset;
|
|
3049
3159
|
}
|
|
3050
3160
|
|
|
3051
|
-
|
|
3161
|
+
const DEFAULT_MIN_ROW_HEIGHT = 20;
|
|
3162
|
+
const finiteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
3163
|
+
function resolveRowResizeConfig(config = {}) {
|
|
3164
|
+
const minHeight = finiteNumber(config.minHeight)
|
|
3165
|
+
? Math.max(1, Math.round(config.minHeight))
|
|
3166
|
+
: DEFAULT_MIN_ROW_HEIGHT;
|
|
3167
|
+
const maxHeight = finiteNumber(config.maxHeight)
|
|
3168
|
+
? Math.max(minHeight, Math.round(config.maxHeight))
|
|
3169
|
+
: undefined;
|
|
3170
|
+
return { minHeight, maxHeight, fullRow: config.fullRow === true };
|
|
3171
|
+
}
|
|
3172
|
+
function clampRowResizeHeight(height, config) {
|
|
3173
|
+
var _a;
|
|
3174
|
+
const rounded = Number.isFinite(height)
|
|
3175
|
+
? Math.round(height)
|
|
3176
|
+
: config.minHeight;
|
|
3177
|
+
return Math.min(Math.max(rounded, config.minHeight), (_a = config.maxHeight) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY);
|
|
3178
|
+
}
|
|
3179
|
+
function getRowResizeIndexes({ rowType, rowIndex, rowCount, selectedRange, selectedRowType, }) {
|
|
3180
|
+
if (!selectedRange ||
|
|
3181
|
+
selectedRowType !== rowType ||
|
|
3182
|
+
rowIndex < Math.min(selectedRange.y, selectedRange.y1) ||
|
|
3183
|
+
rowIndex > Math.max(selectedRange.y, selectedRange.y1)) {
|
|
3184
|
+
return rowIndex >= 0 && rowIndex < rowCount ? [rowIndex] : [];
|
|
3185
|
+
}
|
|
3186
|
+
const start = Math.max(0, Math.min(selectedRange.y, selectedRange.y1));
|
|
3187
|
+
const end = Math.min(rowCount - 1, Math.max(selectedRange.y, selectedRange.y1));
|
|
3188
|
+
return Array.from({ length: Math.max(0, end - start + 1) }, (_, i) => start + i);
|
|
3189
|
+
}
|
|
3190
|
+
function createRowResizePatch(indexes, size) {
|
|
3191
|
+
return indexes.reduce((patch, index) => {
|
|
3192
|
+
patch[index] = size;
|
|
3193
|
+
return patch;
|
|
3194
|
+
}, {});
|
|
3195
|
+
}
|
|
3196
|
+
function mergeRowResizeDefinitions(definitions, rowType, physicalIndexes, size) {
|
|
3197
|
+
const targetIndexes = new Set(physicalIndexes);
|
|
3198
|
+
const existingIndexes = new Set();
|
|
3199
|
+
const merged = definitions.map(definition => {
|
|
3200
|
+
if (definition.type !== rowType || !targetIndexes.has(definition.index)) {
|
|
3201
|
+
return definition;
|
|
3202
|
+
}
|
|
3203
|
+
existingIndexes.add(definition.index);
|
|
3204
|
+
return Object.assign(Object.assign({}, definition), { size });
|
|
3205
|
+
});
|
|
3206
|
+
for (const index of targetIndexes) {
|
|
3207
|
+
if (!existingIndexes.has(index)) {
|
|
3208
|
+
merged.push({ type: rowType, index, size });
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
return merged;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
const ROW_RESIZE_HANDLE_CLASS = 'row-resize-handle';
|
|
3215
|
+
const BEFORE_ROW_RESIZE_EVENT = 'beforerowresize';
|
|
3216
|
+
const ROW_RESIZE_EVENT = 'rowresize';
|
|
3217
|
+
const AFTER_ROW_RESIZE_EVENT = 'afterrowresize';
|
|
3218
|
+
const ROW_RESIZE_CANCEL_EVENT = 'rowresizecancel';
|
|
3219
|
+
class RowResizePlugin extends BasePlugin {
|
|
3220
|
+
static fromGridProperty(revogrid, providers) {
|
|
3221
|
+
const plugin = new RowResizePlugin(revogrid, providers);
|
|
3222
|
+
plugin.controlFromGridProperty();
|
|
3223
|
+
return plugin;
|
|
3224
|
+
}
|
|
3225
|
+
constructor(revogrid, providers, config = {}) {
|
|
3226
|
+
super(revogrid, providers);
|
|
3227
|
+
this.enabled = false;
|
|
3228
|
+
this.gridResizeRow = false;
|
|
3229
|
+
this.gridPlugins = [];
|
|
3230
|
+
this.committedSizes = new Map();
|
|
3231
|
+
this.appliedIndexes = new Map();
|
|
3232
|
+
this.previousBodyCursor = '';
|
|
3233
|
+
this.decorateRow = ({ detail, }) => {
|
|
3234
|
+
if (!this.enabled ||
|
|
3235
|
+
(detail.colType !== 'rowHeaders' && !this.config.fullRow)) {
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
const handle = this.h('div', {
|
|
3239
|
+
'key': `row-resize-${detail.rowType}-${detail.item.itemIndex}`,
|
|
3240
|
+
'class': { [ROW_RESIZE_HANDLE_CLASS]: true },
|
|
3241
|
+
'data-row-resize-index': detail.item.itemIndex,
|
|
3242
|
+
'aria-hidden': 'true',
|
|
3243
|
+
'onPointerDown': (event) => this.startResize(event, detail.rowType, detail.item.itemIndex),
|
|
3244
|
+
});
|
|
3245
|
+
detail.node.$children$ = [...(detail.node.$children$ || []), handle];
|
|
3246
|
+
};
|
|
3247
|
+
this.cancelForDataChange = () => this.cancel('data-change');
|
|
3248
|
+
this.onPointerMove = (event) => {
|
|
3249
|
+
const active = this.active;
|
|
3250
|
+
if ((active === null || active === void 0 ? void 0 : active.pointerId) !== event.pointerId) {
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
event.preventDefault();
|
|
3254
|
+
active.lastEvent = event;
|
|
3255
|
+
this.pendingHeight = clampRowResizeHeight(active.startHeight + event.clientY - active.startY, this.config);
|
|
3256
|
+
if (this.animationFrame === undefined) {
|
|
3257
|
+
const view = this.revogrid.ownerDocument.defaultView;
|
|
3258
|
+
this.animationFrame = view === null || view === void 0 ? void 0 : view.requestAnimationFrame(() => {
|
|
3259
|
+
this.animationFrame = undefined;
|
|
3260
|
+
this.flushPendingResize();
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
};
|
|
3264
|
+
this.onPointerUp = (event) => {
|
|
3265
|
+
const active = this.active;
|
|
3266
|
+
if ((active === null || active === void 0 ? void 0 : active.pointerId) !== event.pointerId) {
|
|
3267
|
+
return;
|
|
3268
|
+
}
|
|
3269
|
+
event.preventDefault();
|
|
3270
|
+
active.lastEvent = event;
|
|
3271
|
+
this.pendingHeight = clampRowResizeHeight(active.startHeight + event.clientY - active.startY, this.config);
|
|
3272
|
+
this.flushPendingResize();
|
|
3273
|
+
if (this.active !== active) {
|
|
3274
|
+
return;
|
|
3275
|
+
}
|
|
3276
|
+
const detail = this.eventDetail(active, event, active.currentHeight);
|
|
3277
|
+
this.finishGesture();
|
|
3278
|
+
this.commitResize(active);
|
|
3279
|
+
this.emit(AFTER_ROW_RESIZE_EVENT, detail);
|
|
3280
|
+
};
|
|
3281
|
+
this.onPointerCancel = (event) => {
|
|
3282
|
+
var _a;
|
|
3283
|
+
if (((_a = this.active) === null || _a === void 0 ? void 0 : _a.pointerId) === event.pointerId) {
|
|
3284
|
+
this.active.lastEvent = event;
|
|
3285
|
+
this.cancel('pointercancel');
|
|
3286
|
+
}
|
|
3287
|
+
};
|
|
3288
|
+
this.onKeyDown = (event) => {
|
|
3289
|
+
if (event.key === 'Escape' && this.active) {
|
|
3290
|
+
event.preventDefault();
|
|
3291
|
+
this.cancel('escape');
|
|
3292
|
+
}
|
|
3293
|
+
};
|
|
3294
|
+
this.onWindowBlur = () => this.cancel('blur');
|
|
3295
|
+
this.reapplyCommittedSizes = () => this.applyCommittedSizes(false);
|
|
3296
|
+
this.rebuildCommittedSizes = () => this.applyCommittedSizes(true);
|
|
3297
|
+
this.syncAppliedIndexes = () => {
|
|
3298
|
+
for (const [rowType, committed] of this.committedSizes) {
|
|
3299
|
+
const items = this.providers.data.stores[rowType].store.get('items');
|
|
3300
|
+
const indexes = new Set();
|
|
3301
|
+
items.forEach((physicalIndex, virtualIndex) => {
|
|
3302
|
+
if (committed.has(physicalIndex)) {
|
|
3303
|
+
indexes.add(virtualIndex);
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
this.appliedIndexes.set(rowType, indexes);
|
|
3307
|
+
}
|
|
3308
|
+
};
|
|
3309
|
+
this.config = resolveRowResizeConfig(config);
|
|
3310
|
+
this.rowDefinitionsRef = revogrid.rowDefinitions;
|
|
3311
|
+
if (new.target !== RowResizePlugin) {
|
|
3312
|
+
this.enabled = true;
|
|
3313
|
+
this.registerEventListeners();
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
registerEventListeners() {
|
|
3317
|
+
this.addEventListener('beforerowrender', this.decorateRow);
|
|
3318
|
+
this.addEventListener('beforeanysource', ({ detail }) => {
|
|
3319
|
+
this.cancel('data-change');
|
|
3320
|
+
const committed = this.committedSizes.get(detail.type);
|
|
3321
|
+
if (!committed) {
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
const removedIndexes = new Set();
|
|
3325
|
+
for (const index of committed.keys()) {
|
|
3326
|
+
if (index >= detail.source.length) {
|
|
3327
|
+
committed.delete(index);
|
|
3328
|
+
removedIndexes.add(index);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
if (removedIndexes.size) {
|
|
3332
|
+
const rowDefinitions = this.revogrid.rowDefinitions.filter(definition => definition.type !== detail.type ||
|
|
3333
|
+
!removedIndexes.has(definition.index));
|
|
3334
|
+
this.rowDefinitionsRef = rowDefinitions;
|
|
3335
|
+
this.revogrid.rowDefinitions = rowDefinitions;
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
this.addEventListener('afteranysource', this.rebuildCommittedSizes);
|
|
3339
|
+
this.addEventListener('beforesourcesortingapply', this.cancelForDataChange);
|
|
3340
|
+
this.addEventListener('aftersortingapply', this.reapplyCommittedSizes);
|
|
3341
|
+
this.addEventListener('beforefilterapply', this.cancelForDataChange);
|
|
3342
|
+
this.addEventListener('beforerowdefinition', ({ detail }) => {
|
|
3343
|
+
this.cancel('data-change');
|
|
3344
|
+
if (detail.vals !== this.rowDefinitionsRef) {
|
|
3345
|
+
this.committedSizes.clear();
|
|
3346
|
+
this.appliedIndexes.clear();
|
|
3347
|
+
this.rowDefinitionsRef = detail.vals;
|
|
3348
|
+
}
|
|
3349
|
+
});
|
|
3350
|
+
this.addEventListener('afterthemechanged', this.reapplyCommittedSizes);
|
|
3351
|
+
this.addEventListener('aftertrimmed', this.syncAppliedIndexes);
|
|
3352
|
+
this.addEventListener('roworderchange', () => {
|
|
3353
|
+
queueMicrotask(this.reapplyCommittedSizes);
|
|
3354
|
+
});
|
|
3355
|
+
this.addEventListener(GROUP_EXPAND_EVENT, () => {
|
|
3356
|
+
queueMicrotask(this.reapplyCommittedSizes);
|
|
3357
|
+
});
|
|
3358
|
+
this.addEventListener('rowheaderschanged', ({ detail }) => {
|
|
3359
|
+
if (!detail && !this.config.fullRow) {
|
|
3360
|
+
this.cancel('row-headers-hidden');
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
}
|
|
3364
|
+
controlFromGridProperty() {
|
|
3365
|
+
this.gridResizeRow = this.revogrid.resizeRow;
|
|
3366
|
+
this.gridPlugins = this.revogrid.plugins;
|
|
3367
|
+
this.syncGridProperty(false);
|
|
3368
|
+
this.watch('resizeRow', value => {
|
|
3369
|
+
this.gridResizeRow = value;
|
|
3370
|
+
this.syncGridProperty();
|
|
3371
|
+
});
|
|
3372
|
+
this.watch('plugins', value => {
|
|
3373
|
+
this.gridPlugins = value || [];
|
|
3374
|
+
this.syncGridProperty();
|
|
3375
|
+
});
|
|
3376
|
+
}
|
|
3377
|
+
syncGridProperty(refresh = true) {
|
|
3378
|
+
const hasConfiguredPlugin = this.gridPlugins.some(plugin => plugin !== RowResizePlugin &&
|
|
3379
|
+
plugin.prototype instanceof RowResizePlugin);
|
|
3380
|
+
const explicitlyEnabled = this.gridPlugins.includes(RowResizePlugin);
|
|
3381
|
+
const enabled = hasConfiguredPlugin
|
|
3382
|
+
? false
|
|
3383
|
+
: explicitlyEnabled || !!this.gridResizeRow;
|
|
3384
|
+
const config = resolveRowResizeConfig(!hasConfiguredPlugin &&
|
|
3385
|
+
!explicitlyEnabled &&
|
|
3386
|
+
typeof this.gridResizeRow === 'object'
|
|
3387
|
+
? this.gridResizeRow
|
|
3388
|
+
: undefined);
|
|
3389
|
+
const configChanged = config.minHeight !== this.config.minHeight ||
|
|
3390
|
+
config.maxHeight !== this.config.maxHeight ||
|
|
3391
|
+
config.fullRow !== this.config.fullRow;
|
|
3392
|
+
if (enabled === this.enabled && !configChanged) {
|
|
3393
|
+
return;
|
|
3394
|
+
}
|
|
3395
|
+
this.cancel('config-change');
|
|
3396
|
+
this.config = config;
|
|
3397
|
+
if (enabled !== this.enabled) {
|
|
3398
|
+
this.enabled = enabled;
|
|
3399
|
+
if (enabled) {
|
|
3400
|
+
this.rowDefinitionsRef = this.revogrid.rowDefinitions;
|
|
3401
|
+
this.registerEventListeners();
|
|
3402
|
+
}
|
|
3403
|
+
else {
|
|
3404
|
+
this.clearSubscriptions();
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
if (refresh) {
|
|
3408
|
+
queueMicrotask(() => void this.revogrid.refresh());
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
startResize(event, rowType, index) {
|
|
3412
|
+
var _a, _b;
|
|
3413
|
+
if (!this.enabled ||
|
|
3414
|
+
this.active ||
|
|
3415
|
+
event.defaultPrevented ||
|
|
3416
|
+
!event.isPrimary ||
|
|
3417
|
+
(event.pointerType !== 'touch' && event.button !== 0)) {
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
const dimension = this.providers.dimension.stores[rowType];
|
|
3421
|
+
const dimensionState = dimension.getCurrentState();
|
|
3422
|
+
const item = getItemByIndex(dimensionState, index);
|
|
3423
|
+
const focusedStore = this.providers.selection.focusedStore;
|
|
3424
|
+
const selectedRowType = focusedStore
|
|
3425
|
+
? this.providers.selection.storesYToType[focusedStore.position.y]
|
|
3426
|
+
: undefined;
|
|
3427
|
+
const indexes = getRowResizeIndexes({
|
|
3428
|
+
rowType,
|
|
3429
|
+
rowIndex: index,
|
|
3430
|
+
rowCount: dimensionState.count,
|
|
3431
|
+
selectedRange: this.providers.selection.selectedRange,
|
|
3432
|
+
selectedRowType,
|
|
3433
|
+
});
|
|
3434
|
+
if (!indexes.length) {
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
const previousSizes = indexes.reduce((sizes, rowIndex) => {
|
|
3438
|
+
const row = getItemByIndex(dimensionState, rowIndex);
|
|
3439
|
+
sizes[rowIndex] = row.end - row.start;
|
|
3440
|
+
return sizes;
|
|
3441
|
+
}, {});
|
|
3442
|
+
const startHeight = item.end - item.start;
|
|
3443
|
+
const active = {
|
|
3444
|
+
pointerId: event.pointerId,
|
|
3445
|
+
rowType,
|
|
3446
|
+
index,
|
|
3447
|
+
indexes,
|
|
3448
|
+
startY: event.clientY,
|
|
3449
|
+
startHeight,
|
|
3450
|
+
currentHeight: startHeight,
|
|
3451
|
+
previousSizes,
|
|
3452
|
+
originalCustomSizes: Object.assign({}, dimensionState.sizes),
|
|
3453
|
+
startEvent: event,
|
|
3454
|
+
lastEvent: event,
|
|
3455
|
+
};
|
|
3456
|
+
const beforeEvent = this.emit(BEFORE_ROW_RESIZE_EVENT, this.eventDetail(active, event, startHeight));
|
|
3457
|
+
if (beforeEvent.defaultPrevented) {
|
|
3458
|
+
return;
|
|
3459
|
+
}
|
|
3460
|
+
event.preventDefault();
|
|
3461
|
+
event.stopPropagation();
|
|
3462
|
+
this.active = active;
|
|
3463
|
+
const doc = this.revogrid.ownerDocument;
|
|
3464
|
+
this.previousBodyCursor = ((_a = doc.body) === null || _a === void 0 ? void 0 : _a.style.cursor) || '';
|
|
3465
|
+
if (doc.body) {
|
|
3466
|
+
doc.body.style.cursor = 'row-resize';
|
|
3467
|
+
}
|
|
3468
|
+
doc.addEventListener('pointermove', this.onPointerMove, true);
|
|
3469
|
+
doc.addEventListener('pointerup', this.onPointerUp, true);
|
|
3470
|
+
doc.addEventListener('pointercancel', this.onPointerCancel, true);
|
|
3471
|
+
doc.addEventListener('keydown', this.onKeyDown, true);
|
|
3472
|
+
(_b = doc.defaultView) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.onWindowBlur);
|
|
3473
|
+
}
|
|
3474
|
+
flushPendingResize() {
|
|
3475
|
+
const active = this.active;
|
|
3476
|
+
if (!active || this.pendingHeight === undefined) {
|
|
3477
|
+
return;
|
|
3478
|
+
}
|
|
3479
|
+
const size = this.pendingHeight;
|
|
3480
|
+
this.pendingHeight = undefined;
|
|
3481
|
+
if (size === active.currentHeight) {
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3484
|
+
this.providers.dimension.setCustomSizes(active.rowType, createRowResizePatch(active.indexes, size), true);
|
|
3485
|
+
active.currentHeight = size;
|
|
3486
|
+
this.emit(ROW_RESIZE_EVENT, this.eventDetail(active, active.lastEvent, size));
|
|
3487
|
+
}
|
|
3488
|
+
cancel(reason) {
|
|
3489
|
+
const active = this.active;
|
|
3490
|
+
if (!active) {
|
|
3491
|
+
return;
|
|
3492
|
+
}
|
|
3493
|
+
const currentSizes = Object.assign({}, this.providers.dimension.stores[active.rowType].store.get('sizes'));
|
|
3494
|
+
for (const index of active.indexes) {
|
|
3495
|
+
if (Object.hasOwn(active.originalCustomSizes, index)) {
|
|
3496
|
+
currentSizes[index] = active.originalCustomSizes[index];
|
|
3497
|
+
}
|
|
3498
|
+
else {
|
|
3499
|
+
delete currentSizes[index];
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
this.providers.dimension.setCustomSizes(active.rowType, currentSizes);
|
|
3503
|
+
const detail = Object.assign(Object.assign({}, this.eventDetail(active, active.lastEvent || active.startEvent, active.startHeight)), { reason });
|
|
3504
|
+
this.finishGesture();
|
|
3505
|
+
this.emit(ROW_RESIZE_CANCEL_EVENT, detail);
|
|
3506
|
+
}
|
|
3507
|
+
eventDetail(active, originalEvent, size) {
|
|
3508
|
+
return {
|
|
3509
|
+
rowType: active.rowType,
|
|
3510
|
+
index: active.index,
|
|
3511
|
+
indexes: [...active.indexes],
|
|
3512
|
+
size,
|
|
3513
|
+
previousSizes: Object.assign({}, active.previousSizes),
|
|
3514
|
+
originalEvent,
|
|
3515
|
+
};
|
|
3516
|
+
}
|
|
3517
|
+
commitResize(active) {
|
|
3518
|
+
if (active.currentHeight === active.startHeight) {
|
|
3519
|
+
return;
|
|
3520
|
+
}
|
|
3521
|
+
const items = this.providers.data.stores[active.rowType].store.get('items');
|
|
3522
|
+
let committed = this.committedSizes.get(active.rowType);
|
|
3523
|
+
if (!committed) {
|
|
3524
|
+
committed = new Map();
|
|
3525
|
+
this.committedSizes.set(active.rowType, committed);
|
|
3526
|
+
}
|
|
3527
|
+
let applied = this.appliedIndexes.get(active.rowType);
|
|
3528
|
+
if (!applied) {
|
|
3529
|
+
applied = new Set();
|
|
3530
|
+
this.appliedIndexes.set(active.rowType, applied);
|
|
3531
|
+
}
|
|
3532
|
+
const physicalIndexes = active.indexes.reduce((result, index) => {
|
|
3533
|
+
const physicalIndex = items[index];
|
|
3534
|
+
if (physicalIndex !== undefined) {
|
|
3535
|
+
committed.set(physicalIndex, active.currentHeight);
|
|
3536
|
+
applied.add(index);
|
|
3537
|
+
result.push(physicalIndex);
|
|
3538
|
+
}
|
|
3539
|
+
return result;
|
|
3540
|
+
}, []);
|
|
3541
|
+
if (physicalIndexes.length) {
|
|
3542
|
+
const rowDefinitions = mergeRowResizeDefinitions(this.revogrid.rowDefinitions, active.rowType, physicalIndexes, active.currentHeight);
|
|
3543
|
+
this.rowDefinitionsRef = rowDefinitions;
|
|
3544
|
+
this.revogrid.rowDefinitions = rowDefinitions;
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
applyCommittedSizes(clearAppliedIndexes) {
|
|
3548
|
+
for (const [rowType, committed] of this.committedSizes) {
|
|
3549
|
+
const dimension = this.providers.dimension.stores[rowType];
|
|
3550
|
+
const sizes = Object.assign({}, dimension.store.get('sizes'));
|
|
3551
|
+
if (clearAppliedIndexes) {
|
|
3552
|
+
for (const index of this.appliedIndexes.get(rowType) || []) {
|
|
3553
|
+
delete sizes[index];
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
const items = this.providers.data.stores[rowType].store.get('items');
|
|
3557
|
+
const indexes = new Set();
|
|
3558
|
+
items.forEach((physicalIndex, virtualIndex) => {
|
|
3559
|
+
const size = committed.get(physicalIndex);
|
|
3560
|
+
if (size !== undefined) {
|
|
3561
|
+
sizes[virtualIndex] = size;
|
|
3562
|
+
indexes.add(virtualIndex);
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
this.appliedIndexes.set(rowType, indexes);
|
|
3566
|
+
this.providers.dimension.setCustomSizes(rowType, sizes);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
finishGesture() {
|
|
3570
|
+
const doc = this.revogrid.ownerDocument;
|
|
3571
|
+
const view = doc.defaultView;
|
|
3572
|
+
if (this.animationFrame !== undefined) {
|
|
3573
|
+
view === null || view === void 0 ? void 0 : view.cancelAnimationFrame(this.animationFrame);
|
|
3574
|
+
}
|
|
3575
|
+
doc.removeEventListener('pointermove', this.onPointerMove, true);
|
|
3576
|
+
doc.removeEventListener('pointerup', this.onPointerUp, true);
|
|
3577
|
+
doc.removeEventListener('pointercancel', this.onPointerCancel, true);
|
|
3578
|
+
doc.removeEventListener('keydown', this.onKeyDown, true);
|
|
3579
|
+
view === null || view === void 0 ? void 0 : view.removeEventListener('blur', this.onWindowBlur);
|
|
3580
|
+
if (doc.body) {
|
|
3581
|
+
doc.body.style.cursor = this.previousBodyCursor;
|
|
3582
|
+
}
|
|
3583
|
+
this.animationFrame = undefined;
|
|
3584
|
+
this.pendingHeight = undefined;
|
|
3585
|
+
this.active = undefined;
|
|
3586
|
+
}
|
|
3587
|
+
destroy() {
|
|
3588
|
+
this.cancel('destroy');
|
|
3589
|
+
super.destroy();
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
export { AutoSizeColumnPlugin as A, BasePlugin as B, ColumnAutoSizeMode as C, DimensionStore as D, ExportFilePlugin as E, FILTER_TRIMMED_TYPE as F, GroupingRowPlugin as G, ROW_RESIZE_CANCEL_EVENT as H, RowResizePlugin as I, DEFAULT_MIN_ROW_HEIGHT as J, resolveRowResizeConfig as K, clampRowResizeHeight as L, getRowResizeIndexes as M, createRowResizePatch as N, mergeRowResizeDefinitions as O, SortingPlugin as P, hasActiveSorting as Q, ROW_RESIZE_HANDLE_CLASS as R, SelectionStore as S, getSortingIndex as T, sortIndexByItems as U, defaultCellCompare as V, descCellCompare as W, getNextOrder as X, getComparer as Y, StretchColumn as a, ExportCsv as b, FILTER_CONFIG_CHANGED_EVENT as c, defineTheme as d, FILTE_PANEL as e, FilterPlugin as f, filterCoreFunctionsIndexedByType as g, filterTypes as h, isStretchPlugin as i, filterNames as j, DEFAULT_BLANK_SEMANTICS as k, isBlankValue as l, doCollapse as m, doExpand as n, COLUMN_DRAG_MOVE_EVENT as o, COLUMN_DRAG_END_EVENT as p, BEFORE_COLUMN_DRAG_END_EVENT as q, resolveBlankSemantics as r, COLUMN_DRAG_START_EVENT as s, themeTokenCssVariables as t, ColumnMovePlugin as u, getLeftRelative as v, getColumnDragPosition as w, BEFORE_ROW_RESIZE_EVENT as x, ROW_RESIZE_EVENT as y, AFTER_ROW_RESIZE_EVENT as z };
|