@reforgium/data-grid 2.5.1 → 2.5.3

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-D_DDE2E7.mjs';
1
+ import { c as computeScrollbarState, a as clampThumbTop, m as mapThumbTopToScrollTop } from './reforgium-data-grid-reforgium-data-grid-BOyAs6Bw.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-DlgNSvfN.mjs.map
79
+ //# sourceMappingURL=reforgium-data-grid-grid-overlay-scroll.feature-Dvwc2nsE.mjs.map
@@ -762,18 +762,16 @@ function computeHeaderGroups(headers = [], columns = []) {
762
762
  return normalized;
763
763
  }
764
764
  function normalizeRange(range, prefix, columns) {
765
+ const { align, title, titleTemplate } = range.header;
765
766
  const base = {
766
767
  key: range.header.key,
768
+ title,
769
+ titleTemplate,
770
+ align,
767
771
  widthPx: sumByRange(prefix, range.start, range.end),
768
772
  startKey: columns[range.start]?.key,
769
773
  endKey: columns[range.end]?.key,
770
774
  };
771
- if ('titleTemplate' in range.header) {
772
- base.titleTemplate = range.header.titleTemplate;
773
- return base;
774
- }
775
- base.title = range.header.title;
776
- base.align = range.header.align;
777
775
  return base;
778
776
  }
779
777
  function resolveColumnWidth(column) {
@@ -1360,6 +1358,7 @@ class DataGridCellComponent {
1360
1358
  }
1361
1359
  return displayValue;
1362
1360
  }, ...(ngDevMode ? [{ debugName: "value" }] : []));
1361
+ resolvedAlign = computed(() => this.column().align ?? 'left', ...(ngDevMode ? [{ debugName: "resolvedAlign" }] : []));
1363
1362
  resolveTypeTemplate(type) {
1364
1363
  if (!type) {
1365
1364
  return undefined;
@@ -1374,31 +1373,39 @@ class DataGridCellComponent {
1374
1373
  @let val = $any(value());
1375
1374
  @let pinned = isPinned();
1376
1375
 
1377
- @switch (type()) {
1378
- @case ('tpl') {
1379
- <ng-container
1380
- [ngTemplateOutlet]="col.renderTemplate"
1381
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1382
- />
1383
- }
1384
- @case ('globalTypeTpl') {
1385
- <ng-container
1386
- [ngTemplateOutlet]="resolveTypeTemplate(col.type)"
1387
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1388
- />
1389
- }
1390
- @case ('globalDataTpl') {
1391
- <ng-container
1392
- [ngTemplateOutlet]="vm.globalDataCellTpls.get(col.key)"
1393
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1394
- />
1395
- }
1396
- @case ('globalRowTpl') {
1397
- <ng-container
1398
- [ngTemplateOutlet]="vm.globalRowCellTpls.get(col.key)"
1399
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1400
- />
1401
- }
1376
+ @switch (type()) {
1377
+ @case ('tpl') {
1378
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1379
+ <ng-container
1380
+ [ngTemplateOutlet]="col.renderTemplate"
1381
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1382
+ />
1383
+ </div>
1384
+ }
1385
+ @case ('globalTypeTpl') {
1386
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1387
+ <ng-container
1388
+ [ngTemplateOutlet]="resolveTypeTemplate(col.type)"
1389
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1390
+ />
1391
+ </div>
1392
+ }
1393
+ @case ('globalDataTpl') {
1394
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1395
+ <ng-container
1396
+ [ngTemplateOutlet]="vm.globalDataCellTpls.get(col.key)"
1397
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1398
+ />
1399
+ </div>
1400
+ }
1401
+ @case ('globalRowTpl') {
1402
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1403
+ <ng-container
1404
+ [ngTemplateOutlet]="vm.globalRowCellTpls.get(col.key)"
1405
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1406
+ />
1407
+ </div>
1408
+ }
1402
1409
  @case ('date') {
1403
1410
  <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1404
1411
  }
@@ -1412,7 +1419,7 @@ class DataGridCellComponent {
1412
1419
  <span class="re-dg-cell-text">{{ val }}</span>
1413
1420
  }
1414
1421
  }
1415
- `, 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" }] });
1422
+ `, 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)}.re-dg-cell-template{display:flex;width:100%;min-width:0}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "pipe", type: DecimalPipe, name: "number" }] });
1416
1423
  }
1417
1424
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: DataGridCellComponent, decorators: [{
1418
1425
  type: Component,
@@ -1422,31 +1429,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1422
1429
  @let val = $any(value());
1423
1430
  @let pinned = isPinned();
1424
1431
 
1425
- @switch (type()) {
1426
- @case ('tpl') {
1427
- <ng-container
1428
- [ngTemplateOutlet]="col.renderTemplate"
1429
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1430
- />
1431
- }
1432
- @case ('globalTypeTpl') {
1433
- <ng-container
1434
- [ngTemplateOutlet]="resolveTypeTemplate(col.type)"
1435
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1436
- />
1437
- }
1438
- @case ('globalDataTpl') {
1439
- <ng-container
1440
- [ngTemplateOutlet]="vm.globalDataCellTpls.get(col.key)"
1441
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1442
- />
1443
- }
1444
- @case ('globalRowTpl') {
1445
- <ng-container
1446
- [ngTemplateOutlet]="vm.globalRowCellTpls.get(col.key)"
1447
- [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1448
- />
1449
- }
1432
+ @switch (type()) {
1433
+ @case ('tpl') {
1434
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1435
+ <ng-container
1436
+ [ngTemplateOutlet]="col.renderTemplate"
1437
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1438
+ />
1439
+ </div>
1440
+ }
1441
+ @case ('globalTypeTpl') {
1442
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1443
+ <ng-container
1444
+ [ngTemplateOutlet]="resolveTypeTemplate(col.type)"
1445
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1446
+ />
1447
+ </div>
1448
+ }
1449
+ @case ('globalDataTpl') {
1450
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1451
+ <ng-container
1452
+ [ngTemplateOutlet]="vm.globalDataCellTpls.get(col.key)"
1453
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1454
+ />
1455
+ </div>
1456
+ }
1457
+ @case ('globalRowTpl') {
1458
+ <div class="re-dg-cell-template" [style.justify-content]="resolvedAlign()" [style.text-align]="resolvedAlign()">
1459
+ <ng-container
1460
+ [ngTemplateOutlet]="vm.globalRowCellTpls.get(col.key)"
1461
+ [ngTemplateOutletContext]="{ $implicit: val, value: val, row, col, index: index(), isPinned: pinned }"
1462
+ />
1463
+ </div>
1464
+ }
1450
1465
  @case ('date') {
1451
1466
  <span class="re-dg-cell-text">{{ val | date: col?.typeParams }}</span>
1452
1467
  }
@@ -1460,7 +1475,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1460
1475
  <span class="re-dg-cell-text">{{ val }}</span>
1461
1476
  }
1462
1477
  }
1463
- `, 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"] }]
1478
+ `, 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)}.re-dg-cell-template{display:flex;width:100%;min-width:0}\n"] }]
1464
1479
  }], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], isPinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "isPinned", required: false }] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }] } });
1465
1480
 
1466
1481
  // noinspection ES6PreferShortImport
@@ -3377,7 +3392,7 @@ class DataGrid {
3377
3392
  if (this.overlayScrollFeaturePromise) {
3378
3393
  return this.overlayScrollFeaturePromise;
3379
3394
  }
3380
- this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-DlgNSvfN.mjs').then(({ createGridOverlayScrollFeature }) => {
3395
+ this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-Dvwc2nsE.mjs').then(({ createGridOverlayScrollFeature }) => {
3381
3396
  const feature = createGridOverlayScrollFeature({
3382
3397
  getScrollElement: () => this.scrollEl()?.nativeElement ?? null,
3383
3398
  getThumbTop: () => this.vm.thumbTopPx(),
@@ -3502,4 +3517,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
3502
3517
  */
3503
3518
 
3504
3519
  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, DATA_GRID_TYPE_RENDERERS as p, DATA_GRID_TYPE_TRANSFORMERS as q, DEFAULT_DATA_GRID_DEFAULTS as r, provideDataGridDefaults as s, provideDataGridTypeRenderers as t, provideDataGridTypeTransformers as u, DataGrid as v };
3505
- //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-D_DDE2E7.mjs.map
3520
+ //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-BOyAs6Bw.mjs.map
@@ -1,2 +1,2 @@
1
- export { o as DATA_GRID_CONFIG, p as DATA_GRID_TYPE_RENDERERS, q as DATA_GRID_TYPE_TRANSFORMERS, r as DEFAULT_DATA_GRID_DEFAULTS, v 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, s as provideDataGridDefaults, t as provideDataGridTypeRenderers, u as provideDataGridTypeTransformers } from './reforgium-data-grid-reforgium-data-grid-D_DDE2E7.mjs';
1
+ export { o as DATA_GRID_CONFIG, p as DATA_GRID_TYPE_RENDERERS, q as DATA_GRID_TYPE_TRANSFORMERS, r as DEFAULT_DATA_GRID_DEFAULTS, v 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, s as provideDataGridDefaults, t as provideDataGridTypeRenderers, u as provideDataGridTypeTransformers } from './reforgium-data-grid-reforgium-data-grid-BOyAs6Bw.mjs';
2
2
  //# sourceMappingURL=reforgium-data-grid.mjs.map
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.5.1",
2
+ "version": "2.5.3",
3
3
  "name": "@reforgium/data-grid",
4
4
  "description": "reforgium DataGrid component",
5
5
  "author": "rtommievich",
@@ -885,11 +885,14 @@ type GridCellDoubleClickEvent<Data extends AnyDict = AnyDict> = {
885
885
  event: MouseEvent;
886
886
  };
887
887
 
888
- type TemplatedHeader = {
888
+ type HeaderTitleContent = {
889
+ title: string;
890
+ titleTemplate?: TemplateRef<HeaderTemplateData>;
891
+ } | {
892
+ title?: string;
889
893
  titleTemplate: TemplateRef<HeaderTemplateData>;
890
894
  };
891
- type PlainHeader = {
892
- title: string;
895
+ type HeaderPresentation = {
893
896
  align?: GridCellAlign;
894
897
  };
895
898
  /**
@@ -910,7 +913,7 @@ type GridHeaderGroup<Data extends AnyDict = AnyDict> = {
910
913
  key: string;
911
914
  from: DataKey<Data>;
912
915
  to?: DataKey<Data>;
913
- } & (TemplatedHeader | PlainHeader);
916
+ } & HeaderTitleContent & HeaderPresentation;
914
917
  /**
915
918
  * Internal normalized representation of a header group after processing.
916
919
  * Used by the grid component to render header groups with calculated dimensions.