@reforgium/data-grid 2.2.2 → 2.2.4

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.
@@ -1,4 +1,4 @@
1
- import { c as computeScrollbarState, a as clampThumbTop, m as mapThumbTopToScrollTop } from './reforgium-data-grid-reforgium-data-grid-uZ3onkWO.mjs';
1
+ import { c as computeScrollbarState, a as clampThumbTop, m as mapThumbTopToScrollTop } from './reforgium-data-grid-reforgium-data-grid-BvHXvsVe.mjs';
2
2
 
3
3
  function createGridOverlayScrollFeature(ctx) {
4
4
  const showScrollbar = () => {
@@ -76,4 +76,4 @@ function createGridOverlayScrollFeature(ctx) {
76
76
  }
77
77
 
78
78
  export { createGridOverlayScrollFeature };
79
- //# sourceMappingURL=reforgium-data-grid-grid-overlay-scroll.feature-B3hwiKYh.mjs.map
79
+ //# sourceMappingURL=reforgium-data-grid-grid-overlay-scroll.feature-BqjRyijB.mjs.map
@@ -1,3 +1,4 @@
1
+ // noinspection ES6PreferShortImport
1
2
  function createGridTooltipFeature(ctx) {
2
3
  const resolveCellValue = (row, col) => {
3
4
  return 'value' in col ? col.value(row) : row[col.key];
@@ -86,4 +87,4 @@ function createGridTooltipFeature(ctx) {
86
87
  }
87
88
 
88
89
  export { createGridTooltipFeature };
89
- //# sourceMappingURL=reforgium-data-grid-grid-tooltip.feature-CMo88m8o.mjs.map
90
+ //# sourceMappingURL=reforgium-data-grid-grid-tooltip.feature-i-k8F-1I.mjs.map
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, inject, TemplateRef, Directive, booleanAttribute, contentChild, Component, numberAttribute, InjectionToken, makeEnvironmentProviders, signal, computed, effect, Injectable, ChangeDetectionStrategy, output, untracked, DestroyRef, afterRenderEffect, viewChild, NgZone, contentChildren } from '@angular/core';
2
+ import { input, inject, TemplateRef, Directive, booleanAttribute, contentChild, Component, numberAttribute, InjectionToken, makeEnvironmentProviders, signal, computed, effect, Injectable, ChangeDetectionStrategy, output, untracked, DestroyRef, afterRenderEffect, viewChild, NgZone, contentChildren, afterNextRender } from '@angular/core';
3
3
  import { NgTemplateOutlet, DatePipe, DecimalPipe } from '@angular/common';
4
4
  import { Subject, debounceTime, fromEvent, Subscription } from 'rxjs';
5
5
 
@@ -912,6 +912,7 @@ function splitSticky(cols) {
912
912
  return { left, right, visible };
913
913
  }
914
914
 
915
+ // noinspection ES6PreferShortImport
915
916
  /**
916
917
  * View model for the data grid component.
917
918
  *
@@ -1305,19 +1306,19 @@ class DataGridCellComponent {
1305
1306
  [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index() }"
1306
1307
  />
1307
1308
  }
1308
- @case ('date') {
1309
- <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1310
- }
1311
- @case ('number') {
1312
- <span class="re-dg-cell-text">{{ val | number: col?.typeParams }}</span>
1313
- }
1314
- @case ('index') {
1315
- <span class="re-dg-cell-text">{{ index() + 1 }}</span>
1316
- }
1317
- @default {
1318
- <span class="re-dg-cell-text">{{ val }}</span>
1319
- }
1320
- }
1309
+ @case ('date') {
1310
+ <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1311
+ }
1312
+ @case ('number') {
1313
+ <span class="re-dg-cell-text">{{ val | number: col?.typeParams }}</span>
1314
+ }
1315
+ @case ('index') {
1316
+ <span class="re-dg-cell-text">{{ index() + 1 }}</span>
1317
+ }
1318
+ @default {
1319
+ <span class="re-dg-cell-text">{{ val }}</span>
1320
+ }
1321
+ }
1321
1322
  `, isInline: true, styles: [":host{display:block;width:100%;min-width:0;text-align:inherit}.re-dg-cell-text{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;line-height:var(--re-data-grid-cell-line-height, 1.2);-webkit-box-orient:vertical;-webkit-line-clamp:var(--re-data-grid-cell-max-lines, 2)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "pipe", type: DecimalPipe, name: "number" }] });
1322
1323
  }
1323
1324
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: DataGridCellComponent, decorators: [{
@@ -1352,19 +1353,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1352
1353
  [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index() }"
1353
1354
  />
1354
1355
  }
1355
- @case ('date') {
1356
- <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1357
- }
1358
- @case ('number') {
1359
- <span class="re-dg-cell-text">{{ val | number: col?.typeParams }}</span>
1360
- }
1361
- @case ('index') {
1362
- <span class="re-dg-cell-text">{{ index() + 1 }}</span>
1363
- }
1364
- @default {
1365
- <span class="re-dg-cell-text">{{ val }}</span>
1366
- }
1367
- }
1356
+ @case ('date') {
1357
+ <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1358
+ }
1359
+ @case ('number') {
1360
+ <span class="re-dg-cell-text">{{ val | number: col?.typeParams }}</span>
1361
+ }
1362
+ @case ('index') {
1363
+ <span class="re-dg-cell-text">{{ index() + 1 }}</span>
1364
+ }
1365
+ @default {
1366
+ <span class="re-dg-cell-text">{{ val }}</span>
1367
+ }
1368
+ }
1368
1369
  `, imports: [NgTemplateOutlet, DatePipe, DecimalPipe], styles: [":host{display:block;width:100%;min-width:0;text-align:inherit}.re-dg-cell-text{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;line-height:var(--re-data-grid-cell-line-height, 1.2);-webkit-box-orient:vertical;-webkit-line-clamp:var(--re-data-grid-cell-max-lines, 2)}\n"] }]
1369
1370
  }], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }] } });
1370
1371
 
@@ -1495,6 +1496,7 @@ function createGridHeaderMeasureFeature(ctx) {
1495
1496
  };
1496
1497
  }
1497
1498
 
1499
+ // noinspection ES6PreferShortImport
1498
1500
  function createGridInfinityPageRequestFeature(ctx) {
1499
1501
  const PREFETCH_FACTOR = 1.25;
1500
1502
  let lastRequestedPage = null;
@@ -1510,6 +1512,9 @@ function createGridInfinityPageRequestFeature(ctx) {
1510
1512
  if (state.initial || state.mode !== 'infinity') {
1511
1513
  return false;
1512
1514
  }
1515
+ if (state.total <= 0) {
1516
+ return false;
1517
+ }
1513
1518
  const threshold = Math.max(0, state.total - Math.max(1, Math.floor(state.visibleCount * PREFETCH_FACTOR)));
1514
1519
  const nearEnd = state.start + state.visibleCount >= threshold;
1515
1520
  if (!nearEnd || ctx.isLoading()) {
@@ -1937,6 +1942,7 @@ function createGridVirtualScrollFeature(ctx) {
1937
1942
  return { onVerticalScroll };
1938
1943
  }
1939
1944
 
1945
+ // noinspection ES6PreferShortImport
1940
1946
  const COLUMN_STATE_PRIORITY_KEYS = new Set(['disabled', 'visible', 'sticky']);
1941
1947
  function mergeDeclarativeColumns(declarative, columns) {
1942
1948
  if (!declarative.length) {
@@ -2745,8 +2751,14 @@ class DataGrid {
2745
2751
  return rows[index];
2746
2752
  }, ...(ngDevMode ? [{ debugName: "stickyRowData" }] : []));
2747
2753
  stickyIndexes = signal([], ...(ngDevMode ? [{ debugName: "stickyIndexes" }] : []));
2754
+ contentInitialized = signal(false, ...(ngDevMode ? [{ debugName: "contentInitialized" }] : []));
2748
2755
  expanderMap = signal(new Map(), ...(ngDevMode ? [{ debugName: "expanderMap" }] : []));
2749
- declarativeColumns = computed(() => normalizeDeclarativeColumns(this.declarativeColumnRefs().map((columnRef) => columnRef.toDeclarativeColumn()), this.rowKey()), ...(ngDevMode ? [{ debugName: "declarativeColumns" }] : []));
2756
+ declarativeColumns = computed(() => {
2757
+ if (!this.contentInitialized()) {
2758
+ return normalizeDeclarativeColumns([], this.rowKey());
2759
+ }
2760
+ return normalizeDeclarativeColumns(this.declarativeColumnRefs().map((columnRef) => columnRef.toDeclarativeColumn()), this.rowKey());
2761
+ }, ...(ngDevMode ? [{ debugName: "declarativeColumns" }] : []));
2750
2762
  sourceColumns = computed(() => mergeDeclarativeColumns(this.declarativeColumns().columns, this.columns()), ...(ngDevMode ? [{ debugName: "sourceColumns" }] : []));
2751
2763
  slotsFeature = createGridSlotsFeature({
2752
2764
  clearTypeTemplates: () => this.vm.globalTypeCellTpls.clear(),
@@ -2791,6 +2803,7 @@ class DataGrid {
2791
2803
  currentSortMap = new Map();
2792
2804
  subscription = new Subscription();
2793
2805
  constructor() {
2806
+ afterNextRender(() => this.contentInitialized.set(true));
2794
2807
  this.lifecycleInitFeature.init({
2795
2808
  afterRender: [
2796
2809
  () => {
@@ -2856,7 +2869,7 @@ class DataGrid {
2856
2869
  clearSelection() {
2857
2870
  this.gridApiFeature.clearSelection();
2858
2871
  }
2859
- /** Selects all currently loaded rows (multi mode only) and emits `selectChange`. */
2872
+ /** Selects all currently loaded rows (multimode only) and emits `selectChange`. */
2860
2873
  selectAllLoaded() {
2861
2874
  this.gridApiFeature.selectAllLoaded();
2862
2875
  }
@@ -3136,7 +3149,7 @@ class DataGrid {
3136
3149
  if (this.tooltipFeaturePromise) {
3137
3150
  return this.tooltipFeaturePromise;
3138
3151
  }
3139
- this.tooltipFeaturePromise = import('./reforgium-data-grid-grid-tooltip.feature-CMo88m8o.mjs').then(({ createGridTooltipFeature }) => {
3152
+ this.tooltipFeaturePromise = import('./reforgium-data-grid-grid-tooltip.feature-i-k8F-1I.mjs').then(({ createGridTooltipFeature }) => {
3140
3153
  const feature = createGridTooltipFeature({
3141
3154
  getTooltipState: () => this.tooltipState(),
3142
3155
  setTooltipState: (state) => this.tooltipState.set(state),
@@ -3155,7 +3168,7 @@ class DataGrid {
3155
3168
  if (this.overlayScrollFeaturePromise) {
3156
3169
  return this.overlayScrollFeaturePromise;
3157
3170
  }
3158
- this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-B3hwiKYh.mjs').then(({ createGridOverlayScrollFeature }) => {
3171
+ this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-BqjRyijB.mjs').then(({ createGridOverlayScrollFeature }) => {
3159
3172
  const feature = createGridOverlayScrollFeature({
3160
3173
  getScrollElement: () => this.scrollEl()?.nativeElement ?? null,
3161
3174
  getThumbTop: () => this.vm.thumbTopPx(),
@@ -3280,4 +3293,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
3280
3293
  */
3281
3294
 
3282
3295
  export { DataGridTypeCellTemplateDirective as D, clampThumbTop as a, DataGridCellTemplateDirective as b, computeScrollbarState as c, DataGridHeaderTemplateDirective as d, DataGridRowDirective as e, DataGridDeclarativeColumn as f, DataGridDeclarativeHeaderDirective as g, DataGridDeclarativeCellDirective as h, DataGridCellEmptyDirective as i, DataGridCellLoadingDirective as j, DataGridStickyRowDirective as k, DataGridSortIconDirective as l, mapThumbTopToScrollTop as m, DataGridExpanderIconDirective as n, DATA_GRID_CONFIG as o, DEFAULT_DATA_GRID_DEFAULTS as p, provideDataGridDefaults as q, DataGrid as r };
3283
- //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-uZ3onkWO.mjs.map
3296
+ //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-BvHXvsVe.mjs.map
@@ -1,2 +1,2 @@
1
- export { o as DATA_GRID_CONFIG, p as DEFAULT_DATA_GRID_DEFAULTS, r as DataGrid, i as DataGridCellEmptyDirective, j as DataGridCellLoadingDirective, b as DataGridCellTemplateDirective, h as DataGridDeclarativeCellDirective, f as DataGridDeclarativeColumn, g as DataGridDeclarativeHeaderDirective, n as DataGridExpanderIconDirective, d as DataGridHeaderTemplateDirective, e as DataGridRowDirective, l as DataGridSortIconDirective, k as DataGridStickyRowDirective, D as DataGridTypeCellTemplateDirective, q as provideDataGridDefaults } from './reforgium-data-grid-reforgium-data-grid-uZ3onkWO.mjs';
1
+ export { o as DATA_GRID_CONFIG, p as DEFAULT_DATA_GRID_DEFAULTS, r as DataGrid, i as DataGridCellEmptyDirective, j as DataGridCellLoadingDirective, b as DataGridCellTemplateDirective, h as DataGridDeclarativeCellDirective, f as DataGridDeclarativeColumn, g as DataGridDeclarativeHeaderDirective, n as DataGridExpanderIconDirective, d as DataGridHeaderTemplateDirective, e as DataGridRowDirective, l as DataGridSortIconDirective, k as DataGridStickyRowDirective, D as DataGridTypeCellTemplateDirective, q as provideDataGridDefaults } from './reforgium-data-grid-reforgium-data-grid-BvHXvsVe.mjs';
2
2
  //# sourceMappingURL=reforgium-data-grid.mjs.map
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.2.2",
2
+ "version": "2.2.4",
3
3
  "name": "@reforgium/data-grid",
4
4
  "description": "reforgium DataGrid component",
5
5
  "author": "rtommievich",
@@ -1420,6 +1420,7 @@ declare class DataGrid<Data extends AnyDict> {
1420
1420
  protected stickyRowTopPx: _angular_core.WritableSignal<number>;
1421
1421
  protected stickyRowData: _angular_core.Signal<Data | null>;
1422
1422
  private stickyIndexes;
1423
+ private contentInitialized;
1423
1424
  protected expanderMap: _angular_core.WritableSignal<Map<DataKey<Data>, boolean>>;
1424
1425
  protected declarativeColumns: _angular_core.Signal<DeclarativeColumnsResult<Data>>;
1425
1426
  protected sourceColumns: _angular_core.Signal<GridColumn<Data>[]>;
@@ -1440,7 +1441,7 @@ declare class DataGrid<Data extends AnyDict> {
1440
1441
  constructor();
1441
1442
  /** Clears current selection and emits `selectChange`. */
1442
1443
  clearSelection(): void;
1443
- /** Selects all currently loaded rows (multi mode only) and emits `selectChange`. */
1444
+ /** Selects all currently loaded rows (multimode only) and emits `selectChange`. */
1444
1445
  selectAllLoaded(): void;
1445
1446
  /** Resets sorting state and emits sort events. */
1446
1447
  resetSort(): void;