@lilydesignsystem/angular-data-grid 0.10.0 → 0.11.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.
@@ -954,6 +954,11 @@ var DataGrid = class DataGrid {
954
954
  isMovable(column) {
955
955
  return column.movable ?? this.movableColumns();
956
956
  }
957
+ footerAggregate(columnId, kind) {
958
+ const column = this.resolvedColumns().find((c) => c.id === columnId);
959
+ if (!column) return void 0;
960
+ return aggregateValues(kind, this.sortedEntries().map((e) => defaultAccessor(column, e.row)));
961
+ }
957
962
  constructor() {
958
963
  this.label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
959
964
  this.caption = input(void 0, ...ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []);
@@ -1155,7 +1160,9 @@ var DataGrid = class DataGrid {
1155
1160
  this.someSelected = computed(() => !this.allSelected() && this.sortedEntries().some((e) => this.selectedSet().has(e.id)), ...ngDevMode ? [{ debugName: "someSelected" }] : /* istanbul ignore next */ []);
1156
1161
  this.footerContext = computed(() => ({
1157
1162
  columns: this.visibleColumns(),
1158
- rows: this.pageEntries().map((e) => e.row)
1163
+ rows: this.pageEntries().map((e) => e.row),
1164
+ allRows: this.sortedEntries().map((e) => e.row),
1165
+ aggregate: (columnId, kind) => this.footerAggregate(columnId, kind)
1159
1166
  }), ...ngDevMode ? [{ debugName: "footerContext" }] : /* istanbul ignore next */ []);
1160
1167
  this.exportColumns = computed(() => this.visibleColumns().filter((c) => c.exportable !== false), ...ngDevMode ? [{ debugName: "exportColumns" }] : /* istanbul ignore next */ []);
1161
1168
  this.exportEntries = computed(() => this.exportScope() === "selected" ? this.sortedEntries().filter((e) => this.selectedSet().has(e.id)) : this.sortedEntries(), ...ngDevMode ? [{ debugName: "exportEntries" }] : /* istanbul ignore next */ []);
@@ -1231,7 +1238,8 @@ var DataGrid = class DataGrid {
1231
1238
  const snapshot = {
1232
1239
  columnWidths: this.columnWidths(),
1233
1240
  hiddenColumnIds: [...this.hiddenColumnIds()],
1234
- sort: this.sort()
1241
+ sort: this.sort(),
1242
+ columnOrder: this.columnOrder()
1235
1243
  };
1236
1244
  if (!key || typeof localStorage === "undefined") return;
1237
1245
  try {
@@ -1343,6 +1351,12 @@ var DataGrid = class DataGrid {
1343
1351
  const width = this.widthFor(column);
1344
1352
  if (width) parts.push(`width:${width}px`);
1345
1353
  if (column.align) parts.push(`text-align:${column.align}`);
1354
+ if (column.pinned) {
1355
+ const visible = this.visibleColumns();
1356
+ const i = visible.findIndex((c) => c.id === column.id);
1357
+ const widths = (column.pinned === "start" ? visible.slice(0, i) : visible.slice(i + 1)).filter((c) => c.pinned === column.pinned).map((c) => this.widthFor(c));
1358
+ if (widths.every((w) => w !== void 0)) parts.push(`--data-grid-pinned-offset:${widths.reduce((a, w) => a + (w ?? 0), 0)}px`);
1359
+ }
1346
1360
  return parts.length > 0 ? parts.join(";") : null;
1347
1361
  }
1348
1362
  setWidth(column, width) {
@@ -1886,6 +1900,7 @@ var DataGrid = class DataGrid {
1886
1900
  if (saved.columnWidths) this.columnWidths.set(saved.columnWidths);
1887
1901
  if (saved.hiddenColumnIds) this.hiddenColumnIds.set(new Set(saved.hiddenColumnIds));
1888
1902
  if (saved.sort) this.sort.set(saved.sort);
1903
+ if (Array.isArray(saved.columnOrder)) this.columnOrder.set(saved.columnOrder);
1889
1904
  }
1890
1905
  } catch {}
1891
1906
  }