@stramien/core 0.14.0 → 0.15.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/index.d.ts +36 -5
- package/dist/index.js +70 -5
- package/dist/index.js.map +1 -1
- package/dist/reset-guard.css +37 -0
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -730,6 +730,16 @@ interface PaginationChangedEvent<TData = Record<string, unknown>> {
|
|
|
730
730
|
totalRows: number;
|
|
731
731
|
totalPages: number;
|
|
732
732
|
}
|
|
733
|
+
interface RowsNearEndEvent<TData = Record<string, unknown>> {
|
|
734
|
+
api: GridApi<TData>;
|
|
735
|
+
/**
|
|
736
|
+
* Index of the last row the user can see, among the displayed (filtered, sorted) rows;
|
|
737
|
+
* `-1` when there are no rows.
|
|
738
|
+
*/
|
|
739
|
+
lastVisibleRowIndex: number;
|
|
740
|
+
/** Number of displayed rows. */
|
|
741
|
+
rowCount: number;
|
|
742
|
+
}
|
|
733
743
|
interface GridEventMap<TData = Record<string, unknown>> {
|
|
734
744
|
gridReady: GridReadyEvent<TData>;
|
|
735
745
|
rowClicked: RowClickedEvent<TData>;
|
|
@@ -748,6 +758,7 @@ interface GridEventMap<TData = Record<string, unknown>> {
|
|
|
748
758
|
treeNodeToggled: TreeNodeToggledEvent<TData>;
|
|
749
759
|
cellSelectionChanged: CellSelectionChangedEvent<TData>;
|
|
750
760
|
treeExpansionChanged: TreeExpansionChangedEvent<TData>;
|
|
761
|
+
rowsNearEnd: RowsNearEndEvent<TData>;
|
|
751
762
|
}
|
|
752
763
|
/** Top-level configuration options for `createGrid()`, `<stramien-grid>`, and `<StramienGrid>`. */
|
|
753
764
|
interface GridOptions<TData = Record<string, unknown>> {
|
|
@@ -933,6 +944,17 @@ interface GridOptions<TData = Record<string, unknown>> {
|
|
|
933
944
|
onTreeNodeToggled?: (event: TreeNodeToggledEvent<TData>) => void;
|
|
934
945
|
onTreeExpansionChanged?: (event: TreeExpansionChangedEvent<TData>) => void;
|
|
935
946
|
onCellSelectionChanged?: (event: CellSelectionChangedEvent<TData>) => void;
|
|
947
|
+
/**
|
|
948
|
+
* Called when the user scrolls to within `rowsNearEndThreshold` rows of the last row, so the
|
|
949
|
+
* app can load the next batch (infinite scroll with client-side row data). It fires once per
|
|
950
|
+
* row count, not on every scroll: again after rows were added or the row data was replaced,
|
|
951
|
+
* or after the user scrolled away from the end and back (to retry a failed load).
|
|
952
|
+
* It also fires when the rows don't fill the grid, including when there are none. Not
|
|
953
|
+
* called while `loading` is set, with pagination or with the server-side row model.
|
|
954
|
+
*/
|
|
955
|
+
onRowsNearEnd?: (event: RowsNearEndEvent<TData>) => void;
|
|
956
|
+
/** How many rows before the end `onRowsNearEnd` fires (default `10`). */
|
|
957
|
+
rowsNearEndThreshold?: number;
|
|
936
958
|
}
|
|
937
959
|
interface PaginationState {
|
|
938
960
|
enabled: boolean;
|
|
@@ -1303,16 +1325,21 @@ interface BadgeStyleConfig {
|
|
|
1303
1325
|
bg?: string;
|
|
1304
1326
|
color?: string;
|
|
1305
1327
|
}
|
|
1306
|
-
interface BadgeColumnOptions {
|
|
1307
|
-
/**
|
|
1308
|
-
|
|
1328
|
+
interface BadgeColumnOptions<TData = Record<string, unknown>> {
|
|
1329
|
+
/**
|
|
1330
|
+
* Maps raw cell values to a semantic tone or custom label/color config. Either an object
|
|
1331
|
+
* keyed by value, or a function `(value, data) => tone | config` for open-ended values (for
|
|
1332
|
+
* example `(v) => (v.startsWith('delete') ? 'danger' : undefined)`). Values the map doesn't
|
|
1333
|
+
* cover, and a function returning `undefined`, use `defaultTone`.
|
|
1334
|
+
*/
|
|
1335
|
+
map?: Record<string, BadgeTone | BadgeStyleConfig> | ((value: string, data: TData) => BadgeTone | BadgeStyleConfig | null | undefined);
|
|
1309
1336
|
/** Fallback tone when a value is not present in `map` (default `'neutral'`). */
|
|
1310
1337
|
defaultTone?: BadgeTone;
|
|
1311
1338
|
/** Render a subtle status indicator dot before the label (default `false`). */
|
|
1312
1339
|
dot?: boolean;
|
|
1313
1340
|
}
|
|
1314
1341
|
/** Built-in theme-aware pill / status badge column preset. */
|
|
1315
|
-
declare function badgeColumn<TData = Record<string, unknown>>(options?: BadgeColumnOptions): Partial<ColDef<TData, string>>;
|
|
1342
|
+
declare function badgeColumn<TData = Record<string, unknown>>(options?: BadgeColumnOptions<TData>): Partial<ColDef<TData, string>>;
|
|
1316
1343
|
interface BooleanColumnOptions {
|
|
1317
1344
|
/** Visual presentation: `'icon'` (default), `'pill'`, or `'text'`. */
|
|
1318
1345
|
style?: 'icon' | 'pill' | 'text';
|
|
@@ -1483,6 +1510,8 @@ declare class StramienGridCore<TData = Record<string, unknown>> {
|
|
|
1483
1510
|
/** `applyTransactionAsync` queue, and the timer that applies it. */
|
|
1484
1511
|
private asyncQueue;
|
|
1485
1512
|
private asyncTimer;
|
|
1513
|
+
/** Row count `onRowsNearEnd` last fired for (-1: not fired since the data was set). */
|
|
1514
|
+
private rowsNearEndFiredCount;
|
|
1486
1515
|
private readonly onAsyncVisibilityChange;
|
|
1487
1516
|
private readonly onVisibilityChange;
|
|
1488
1517
|
readonly api: GridApi<TData>;
|
|
@@ -1608,6 +1637,7 @@ declare class StramienGridCore<TData = Record<string, unknown>> {
|
|
|
1608
1637
|
*/
|
|
1609
1638
|
private mergeTransactions;
|
|
1610
1639
|
private scheduleAsyncFlush;
|
|
1640
|
+
private handleVisibleRowsEnd;
|
|
1611
1641
|
private clearAsyncQueue;
|
|
1612
1642
|
private flushAsyncTransactions;
|
|
1613
1643
|
private handleToggleRowSelection;
|
|
@@ -1783,7 +1813,8 @@ declare class EventBus<TEventMap extends {
|
|
|
1783
1813
|
on<K extends keyof TEventMap>(event: K, listener: EventListener<TEventMap[K]>): () => void;
|
|
1784
1814
|
off<K extends keyof TEventMap>(event: K, listener: EventListener<TEventMap[K]>): void;
|
|
1785
1815
|
emit<K extends keyof TEventMap>(event: K, payload: TEventMap[K]): void;
|
|
1816
|
+
hasListeners<K extends keyof TEventMap>(event: K): boolean;
|
|
1786
1817
|
clear(): void;
|
|
1787
1818
|
}
|
|
1788
1819
|
|
|
1789
|
-
export { type ActionButtonDef, type ActionButtonParams, type ActionButtonTone, type ActionButtonVariant, type ActionsColumnOptions, type AggFunc, type AggFuncParams, type BadgeColumnOptions, type BadgeStyleConfig, type BadgeTone, type BarColumnOptions, type BarColumnThresholds, type BooleanColumnOptions, type BuiltInActionIcon, type BuiltInAggFunc, type CellClassParams, type CellClickedEvent, type CellEditorComponentParams, type CellEditorOption, type CellEditorParams, type CellEditorSelectorParams, type CellEditorSpec, type CellEditorType, type CellRange, type CellRangeParams, type CellRenderer, type CellRendererParams, type CellSelectionChangedEvent, type CellSelectionConfig, type CellValidatorParams, type CellValueChangedEvent, type ColDef, type ColGroupDef, ColumnController, type ColumnDefItem, type ColumnFilterModel, type ColumnMovedEvent, type ColumnPinnedEvent, type ColumnResizedEvent, type ColumnStateItem, type ColumnTypeDef, type ColumnVisibilityChangedEvent, type ComponentMountAdapter, type CsvExportParams, type CurrencyColumnOptions, type CustomFilterDef, DETAIL_COL_ID, type DateFilterModel, type DateFilterOperator, type DetailCellRenderer, type DetailCellRendererParams, type EditableParams, EventBus, type FilterChangedEvent, type FilterModel, type FilterType, type GlobalSearchConfig, type GridApi, type GridDensity, type GridEventMap, type GridOptions, type GridReadyEvent, type GridState, type GridThemeMode, type HeaderGroupMeta, LocaleText, type MountedComponentHandle, type NumberFilterModel, type NumberFilterOperator, type PaginationChangedEvent, type PaginationState, type PercentColumnOptions, type PinnedDirection, type PinnedSummaryConfig, type QuickFilterTextParams, type RefreshCellsParams, type RelativeTimeColumnOptions, type ResolvedColDef, type ResponsivePinningConfig, type RowClickedEvent, type RowDataTransaction, type RowDataTransactionResult, type RowDetailToggledEvent, type RowHeightParams, type RowHrefParams, RowModel, type RowModelType, type RowNode, type RowSelectionConfig, SELECTION_COL_ID, type ScrollAlign, type SelectionChangedEvent, SelectionController, type ServerSideDatasource, type ServerSideGetRowsRequest, type ServerSideGetRowsResult, type SetFilterModel, type SortChangedEvent, type SortDirection, type SortModelItem, type SparklineColumnOptions, type StateChangedEvent, StramienGridCore, type TextFilterModel, type TextFilterOperator, type TreeExpandAllControl, type TreeExpansionChangeSource, type TreeExpansionChangedEvent, type TreeNodeToggledEvent, type TreeToggleLabelParams, UndoRedoStack, VANILLA_RENDERER_SYMBOL, type ValueFormatterParams, type ValueGetterParams, type ValueParserParams, type ValueSetterParams, type VanillaCellEditorFn, type VanillaCellEditorInstance, type VanillaCellRendererFn, type VanillaDetailCellRendererFn, type VirtualizationConfig, actionsColumn, badgeColumn, barColumn, booleanColumn, buildCsvString, buildQuickFilterHaystack, buildTsvString, createBuiltInColumnTypes, createGrid, currencyColumn, downloadCsvFile, filterRowNodes, getFormattedCellValue, getRawCellValue, isColGroupDef, markVanillaRenderer, matchesColumnFilter, normalizeSelectionConfig, parseQuickFilterTokens, percentColumn, relativeTimeColumn, resolveColumnFilterType, sortRowNodes, sparklineColumn };
|
|
1820
|
+
export { type ActionButtonDef, type ActionButtonParams, type ActionButtonTone, type ActionButtonVariant, type ActionsColumnOptions, type AggFunc, type AggFuncParams, type BadgeColumnOptions, type BadgeStyleConfig, type BadgeTone, type BarColumnOptions, type BarColumnThresholds, type BooleanColumnOptions, type BuiltInActionIcon, type BuiltInAggFunc, type CellClassParams, type CellClickedEvent, type CellEditorComponentParams, type CellEditorOption, type CellEditorParams, type CellEditorSelectorParams, type CellEditorSpec, type CellEditorType, type CellRange, type CellRangeParams, type CellRenderer, type CellRendererParams, type CellSelectionChangedEvent, type CellSelectionConfig, type CellValidatorParams, type CellValueChangedEvent, type ColDef, type ColGroupDef, ColumnController, type ColumnDefItem, type ColumnFilterModel, type ColumnMovedEvent, type ColumnPinnedEvent, type ColumnResizedEvent, type ColumnStateItem, type ColumnTypeDef, type ColumnVisibilityChangedEvent, type ComponentMountAdapter, type CsvExportParams, type CurrencyColumnOptions, type CustomFilterDef, DETAIL_COL_ID, type DateFilterModel, type DateFilterOperator, type DetailCellRenderer, type DetailCellRendererParams, type EditableParams, EventBus, type FilterChangedEvent, type FilterModel, type FilterType, type GlobalSearchConfig, type GridApi, type GridDensity, type GridEventMap, type GridOptions, type GridReadyEvent, type GridState, type GridThemeMode, type HeaderGroupMeta, LocaleText, type MountedComponentHandle, type NumberFilterModel, type NumberFilterOperator, type PaginationChangedEvent, type PaginationState, type PercentColumnOptions, type PinnedDirection, type PinnedSummaryConfig, type QuickFilterTextParams, type RefreshCellsParams, type RelativeTimeColumnOptions, type ResolvedColDef, type ResponsivePinningConfig, type RowClickedEvent, type RowDataTransaction, type RowDataTransactionResult, type RowDetailToggledEvent, type RowHeightParams, type RowHrefParams, RowModel, type RowModelType, type RowNode, type RowSelectionConfig, type RowsNearEndEvent, SELECTION_COL_ID, type ScrollAlign, type SelectionChangedEvent, SelectionController, type ServerSideDatasource, type ServerSideGetRowsRequest, type ServerSideGetRowsResult, type SetFilterModel, type SortChangedEvent, type SortDirection, type SortModelItem, type SparklineColumnOptions, type StateChangedEvent, StramienGridCore, type TextFilterModel, type TextFilterOperator, type TreeExpandAllControl, type TreeExpansionChangeSource, type TreeExpansionChangedEvent, type TreeNodeToggledEvent, type TreeToggleLabelParams, UndoRedoStack, VANILLA_RENDERER_SYMBOL, type ValueFormatterParams, type ValueGetterParams, type ValueParserParams, type ValueSetterParams, type VanillaCellEditorFn, type VanillaCellEditorInstance, type VanillaCellRendererFn, type VanillaDetailCellRendererFn, type VirtualizationConfig, actionsColumn, badgeColumn, barColumn, booleanColumn, buildCsvString, buildQuickFilterHaystack, buildTsvString, createBuiltInColumnTypes, createGrid, currencyColumn, downloadCsvFile, filterRowNodes, getFormattedCellValue, getRawCellValue, isColGroupDef, markVanillaRenderer, matchesColumnFilter, normalizeSelectionConfig, parseQuickFilterTokens, percentColumn, relativeTimeColumn, resolveColumnFilterType, sortRowNodes, sparklineColumn };
|
package/dist/index.js
CHANGED
|
@@ -821,10 +821,10 @@ function barColumn(options = {}) {
|
|
|
821
821
|
function badgeColumn(options = {}) {
|
|
822
822
|
const { map = {}, defaultTone = "neutral", dot = false } = options;
|
|
823
823
|
const renderer = markVanillaRenderer(
|
|
824
|
-
({ value, formattedValue }) => {
|
|
824
|
+
({ value, formattedValue, data }) => {
|
|
825
825
|
if (value === null || value === void 0 || value === "") return "";
|
|
826
826
|
const key = String(value);
|
|
827
|
-
const entry = map[key];
|
|
827
|
+
const entry = typeof map === "function" ? map(key, data) : Object.hasOwn(map, key) ? map[key] : void 0;
|
|
828
828
|
const cfg = typeof entry === "string" ? { tone: entry } : entry ?? {};
|
|
829
829
|
const tone = cfg.tone ?? defaultTone;
|
|
830
830
|
const text = cfg.label ?? (formattedValue || key);
|
|
@@ -2970,6 +2970,7 @@ var DomRenderer = class {
|
|
|
2970
2970
|
/** Content height without `maxHeight`: the page (or a scrolling ancestor) scrolls the rows. */
|
|
2971
2971
|
pageScroll = false;
|
|
2972
2972
|
pageScrollHandler = null;
|
|
2973
|
+
nearEndRafId = null;
|
|
2973
2974
|
pageResizeHandler = null;
|
|
2974
2975
|
headerStackEl;
|
|
2975
2976
|
rowHeightProbeEl = null;
|
|
@@ -3262,7 +3263,10 @@ var DomRenderer = class {
|
|
|
3262
3263
|
if (pageScroll === this.pageScroll) return;
|
|
3263
3264
|
this.pageScroll = pageScroll;
|
|
3264
3265
|
if (pageScroll) {
|
|
3265
|
-
this.pageScrollHandler = () =>
|
|
3266
|
+
this.pageScrollHandler = () => {
|
|
3267
|
+
this.rewindowIfNeeded();
|
|
3268
|
+
this.scheduleVisibleEndCheck();
|
|
3269
|
+
};
|
|
3266
3270
|
this.pageResizeHandler = () => {
|
|
3267
3271
|
this.syncStickyInset();
|
|
3268
3272
|
this.rewindowIfNeeded();
|
|
@@ -3772,6 +3776,29 @@ var DomRenderer = class {
|
|
|
3772
3776
|
}
|
|
3773
3777
|
handleVerticalScroll() {
|
|
3774
3778
|
this.rewindowIfNeeded();
|
|
3779
|
+
this.scheduleVisibleEndCheck();
|
|
3780
|
+
}
|
|
3781
|
+
/** Reports the last visible row once per frame (see `onVisibleRowsEnd`). */
|
|
3782
|
+
scheduleVisibleEndCheck() {
|
|
3783
|
+
if (this.nearEndRafId !== null || !this.callbacks.wantsVisibleRowsEnd()) return;
|
|
3784
|
+
this.nearEndRafId = requestAnimationFrame(() => {
|
|
3785
|
+
this.nearEndRafId = null;
|
|
3786
|
+
this.reportVisibleRowsEnd();
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
reportVisibleRowsEnd() {
|
|
3790
|
+
if (this.destroyed || this.callbacks.getLoading()) return;
|
|
3791
|
+
const rowCount = this.callbacks.getDisplayedRows().length;
|
|
3792
|
+
if (rowCount === 0) {
|
|
3793
|
+
this.callbacks.onVisibleRowsEnd(-1, 0);
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (this.heightIndex.getCount() !== rowCount) return;
|
|
3797
|
+
const top = this.pageScroll ? this.getPageScrollPastBody() : this.getBodyScrollTop();
|
|
3798
|
+
const bottom = top + this.getBodyViewportHeight();
|
|
3799
|
+
if (bottom <= 0) return;
|
|
3800
|
+
const last = this.heightIndex.findRowAtOffset(Math.max(0, bottom - 1));
|
|
3801
|
+
this.callbacks.onVisibleRowsEnd(last, rowCount);
|
|
3775
3802
|
}
|
|
3776
3803
|
/** Re-renders the body when the visible row range changed (scroll or viewport resize). */
|
|
3777
3804
|
rewindowIfNeeded() {
|
|
@@ -4724,6 +4751,7 @@ var DomRenderer = class {
|
|
|
4724
4751
|
}
|
|
4725
4752
|
if (rows.length === 0) {
|
|
4726
4753
|
const suspended2 = clearToOverlay();
|
|
4754
|
+
this.scheduleVisibleEndCheck();
|
|
4727
4755
|
this.overlayEl.hidden = false;
|
|
4728
4756
|
this.overlayEl.innerHTML = "";
|
|
4729
4757
|
const msg = document.createElement("span");
|
|
@@ -4796,6 +4824,7 @@ var DomRenderer = class {
|
|
|
4796
4824
|
};
|
|
4797
4825
|
this.renderedRowIds = visibleRows.map((r) => r.id);
|
|
4798
4826
|
this.renderedZoneColSig = nextColSig;
|
|
4827
|
+
this.scheduleVisibleEndCheck();
|
|
4799
4828
|
const leftOffset = 0;
|
|
4800
4829
|
const centerOffset = zones.left.length;
|
|
4801
4830
|
const rightOffset = zones.left.length + zones.center.length;
|
|
@@ -7199,6 +7228,7 @@ var DomRenderer = class {
|
|
|
7199
7228
|
this.destroyed = true;
|
|
7200
7229
|
this.editingCell?.suspend();
|
|
7201
7230
|
if (this.scrollRafId !== null) cancelAnimationFrame(this.scrollRafId);
|
|
7231
|
+
if (this.nearEndRafId !== null) cancelAnimationFrame(this.nearEndRafId);
|
|
7202
7232
|
if (this.hScrollLeaderTimer !== null) clearTimeout(this.hScrollLeaderTimer);
|
|
7203
7233
|
if (this.searchDebounceTimer) clearTimeout(this.searchDebounceTimer);
|
|
7204
7234
|
for (const timer of this.floatingDebounceTimers.values()) clearTimeout(timer);
|
|
@@ -7438,6 +7468,9 @@ var EventBus = class {
|
|
|
7438
7468
|
listener(payload);
|
|
7439
7469
|
}
|
|
7440
7470
|
}
|
|
7471
|
+
hasListeners(event) {
|
|
7472
|
+
return (this.listeners.get(event)?.size ?? 0) > 0;
|
|
7473
|
+
}
|
|
7441
7474
|
clear() {
|
|
7442
7475
|
this.listeners.clear();
|
|
7443
7476
|
}
|
|
@@ -7572,6 +7605,8 @@ var StramienGridCore = class {
|
|
|
7572
7605
|
/** `applyTransactionAsync` queue, and the timer that applies it. */
|
|
7573
7606
|
asyncQueue = [];
|
|
7574
7607
|
asyncTimer = null;
|
|
7608
|
+
/** Row count `onRowsNearEnd` last fired for (-1: not fired since the data was set). */
|
|
7609
|
+
rowsNearEndFiredCount = -1;
|
|
7575
7610
|
onAsyncVisibilityChange = () => {
|
|
7576
7611
|
if (document.visibilityState === "visible") this.flushAsyncTransactions();
|
|
7577
7612
|
};
|
|
@@ -7760,6 +7795,8 @@ var StramienGridCore = class {
|
|
|
7760
7795
|
onSizeColumnsToFit: () => this.api.sizeColumnsToFit(),
|
|
7761
7796
|
onGoToPage: (page) => this.api.goToPage(page),
|
|
7762
7797
|
onSetPageSize: (size) => this.api.setPageSize(size),
|
|
7798
|
+
onVisibleRowsEnd: (lastVisibleRowIndex, rowCount) => this.handleVisibleRowsEnd(lastVisibleRowIndex, rowCount),
|
|
7799
|
+
wantsVisibleRowsEnd: () => !this.destroyed && !this.options.pagination && this.rowModel.getMode() === "clientSide" && (Boolean(this.options.onRowsNearEnd) || this.eventBus.hasListeners("rowsNearEnd")),
|
|
7763
7800
|
onViewportResize: () => {
|
|
7764
7801
|
const width = this.renderer.getColumnFitWidth();
|
|
7765
7802
|
const { widthsChanged, zonesChanged } = this.columnController.setViewportWidth(width);
|
|
@@ -8692,6 +8729,21 @@ var StramienGridCore = class {
|
|
|
8692
8729
|
this.flushAsyncTransactions();
|
|
8693
8730
|
}, wait);
|
|
8694
8731
|
}
|
|
8732
|
+
handleVisibleRowsEnd(lastVisibleRowIndex, rowCount) {
|
|
8733
|
+
if (this.destroyed || this.options.pagination || this.rowModel.getMode() !== "clientSide") {
|
|
8734
|
+
return;
|
|
8735
|
+
}
|
|
8736
|
+
const threshold = Math.max(0, Math.floor(this.options.rowsNearEndThreshold ?? 10));
|
|
8737
|
+
if (lastVisibleRowIndex < rowCount - 1 - threshold) {
|
|
8738
|
+
this.rowsNearEndFiredCount = -1;
|
|
8739
|
+
return;
|
|
8740
|
+
}
|
|
8741
|
+
if (rowCount === this.rowsNearEndFiredCount) return;
|
|
8742
|
+
this.rowsNearEndFiredCount = rowCount;
|
|
8743
|
+
const payload = { api: this.api, lastVisibleRowIndex, rowCount };
|
|
8744
|
+
this.options.onRowsNearEnd?.(payload);
|
|
8745
|
+
this.eventBus.emit("rowsNearEnd", payload);
|
|
8746
|
+
}
|
|
8695
8747
|
clearAsyncQueue() {
|
|
8696
8748
|
if (this.asyncTimer !== null) clearTimeout(this.asyncTimer);
|
|
8697
8749
|
this.asyncTimer = null;
|
|
@@ -8769,6 +8821,8 @@ var StramienGridCore = class {
|
|
|
8769
8821
|
return {
|
|
8770
8822
|
setRowData: (rowData) => {
|
|
8771
8823
|
this.clearAsyncQueue();
|
|
8824
|
+
this.rowsNearEndFiredCount = -1;
|
|
8825
|
+
this.renderer.scheduleVisibleEndCheck();
|
|
8772
8826
|
const prevSnapshot = this.snapshotCellValues();
|
|
8773
8827
|
this.options.rowData = rowData;
|
|
8774
8828
|
this.rowModel.setRowData(
|
|
@@ -8896,6 +8950,9 @@ var StramienGridCore = class {
|
|
|
8896
8950
|
];
|
|
8897
8951
|
const prevSnapshot = this.rowModel.getMode() === "clientSide" && partial.rowData !== void 0 && partial.rowData !== prevRowData ? this.snapshotCellValues() : null;
|
|
8898
8952
|
this.options = { ...this.options, ...partial };
|
|
8953
|
+
if ("onRowsNearEnd" in partial || "rowsNearEndThreshold" in partial || "pagination" in partial) {
|
|
8954
|
+
this.renderer.scheduleVisibleEndCheck();
|
|
8955
|
+
}
|
|
8899
8956
|
let structuralChange = false;
|
|
8900
8957
|
let needsServerFetch = false;
|
|
8901
8958
|
let pinnedChanged = false;
|
|
@@ -8996,7 +9053,11 @@ var StramienGridCore = class {
|
|
|
8996
9053
|
const getRowIdChanged = "getRowId" in partial && partial.getRowId !== prevGetRowId;
|
|
8997
9054
|
const rowDataChanged = this.rowModel.getMode() === "clientSide" && (partial.rowData !== void 0 && (partial.rowData !== prevRowData || prevRowModelType !== "clientSide") || getRowIdChanged);
|
|
8998
9055
|
if (rowDataChanged) {
|
|
8999
|
-
if (partial.rowData !== void 0)
|
|
9056
|
+
if (partial.rowData !== void 0) {
|
|
9057
|
+
this.clearAsyncQueue();
|
|
9058
|
+
this.rowsNearEndFiredCount = -1;
|
|
9059
|
+
this.renderer.scheduleVisibleEndCheck();
|
|
9060
|
+
}
|
|
9000
9061
|
this.rowModel.setRowData(
|
|
9001
9062
|
this.options.rowData ?? [],
|
|
9002
9063
|
this.options.getRowId,
|
|
@@ -9605,7 +9666,11 @@ var StramienGridCore = class {
|
|
|
9605
9666
|
params?.columns ? new Set(params.columns) : void 0
|
|
9606
9667
|
);
|
|
9607
9668
|
},
|
|
9608
|
-
on: (event, listener) =>
|
|
9669
|
+
on: (event, listener) => {
|
|
9670
|
+
const off = this.eventBus.on(event, listener);
|
|
9671
|
+
if (event === "rowsNearEnd") this.renderer.scheduleVisibleEndCheck();
|
|
9672
|
+
return off;
|
|
9673
|
+
},
|
|
9609
9674
|
destroy: () => {
|
|
9610
9675
|
if (this.destroyed) return;
|
|
9611
9676
|
this.destroyed = true;
|