@nanahoshi/mona-ui 0.22.1 → 0.23.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.
@@ -1,2 +1,2 @@
1
- export { C as CellEditEvent, B as GRID_DEFAULT_MESSAGES, D as GridAddCommandDirective, E as GridAddEvent, F as GridCancelCommandDirective, H as GridCancelEvent, I as GridCellTemplateDirective, J as GridColumnComponent, K as GridColumnTitleTemplateDirective, L as GridCommandColumnComponent, M as GridComponent, N as GridContextMenuDirective, O as GridDetailTemplateDirective, P as GridEditCommandDirective, Q as GridEditEvent, R as GridEditTemplateDirective, S as GridEditableDirective, T as GridExportDirective, U as GridFilterableDirective, V as GridFooterTemplateDirective, W as GridGroupFooterTemplateDirective, X as GridGroupableDirective, Y as GridHeaderTemplateDirective, Z as GridNoDataTemplateDirective, _ as GridRemoveCommandDirective, $ as GridRemoveEvent, a0 as GridReorderableDirective, a1 as GridResizableDirective, a2 as GridRowReorderableDirective, a3 as GridSaveCommandDirective, a4 as GridSaveEvent, a5 as GridSelectableDirective, a6 as GridServerBindingDirective, a7 as GridSortableDirective, a8 as GridStatePersistenceDirective, a9 as GridToolbarTemplateDirective, aa as GridVirtualScrollDirective, ab as RowEditEvent, ac as RowReorderEvent } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C_mj53LF.mjs';
1
+ export { C as CellEditEvent, x as GRID_DEFAULT_MESSAGES, y as GridAddCommandDirective, z as GridAddEvent, A as GridCancelCommandDirective, B as GridCancelEvent, D as GridCellTemplateDirective, E as GridColumnComponent, F as GridColumnTitleTemplateDirective, H as GridCommandColumnComponent, I as GridComponent, J as GridContextMenuDirective, K as GridDetailTemplateDirective, L as GridEditCommandDirective, M as GridEditEvent, N as GridEditTemplateDirective, O as GridEditableDirective, P as GridExportDirective, Q as GridFilterableDirective, R as GridFooterTemplateDirective, S as GridGroupFooterTemplateDirective, T as GridGroupableDirective, U as GridHeaderTemplateDirective, V as GridNoDataTemplateDirective, W as GridRemoveCommandDirective, X as GridRemoveEvent, Y as GridReorderableDirective, Z as GridResizableDirective, _ as GridRowReorderableDirective, $ as GridSaveCommandDirective, a0 as GridSaveEvent, a1 as GridSelectableDirective, a2 as GridServerBindingDirective, a3 as GridSortableDirective, a4 as GridStatePersistenceDirective, a5 as GridToolbarTemplateDirective, a6 as GridVirtualScrollDirective, a7 as RowEditEvent, a8 as RowReorderEvent } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-bduDEm-x.mjs';
2
2
  //# sourceMappingURL=nanahoshi-mona-ui-grid.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanahoshi/mona-ui",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "description": "A very light Angular UI framework",
5
5
  "author": "Nanahoshi",
6
6
  "repository": {
@@ -274,6 +274,11 @@ interface FilterableOptions {
274
274
  type: "menu" | "row" | "menu, row";
275
275
  }
276
276
 
277
+ /** The classes a {@link GridRowClass} function adds to a data row. Nullish values add nothing. */
278
+ type GridRowClassValue = string | readonly string[] | null | undefined;
279
+ /** Returns the classes to add to the data row that shows the given item. */
280
+ type GridRowClass<TData> = (data: TData) => GridRowClassValue;
281
+
277
282
  interface SortableOptions {
278
283
  allowUnsort?: boolean;
279
284
  enabled?: boolean;
@@ -898,16 +903,59 @@ interface RowEditContext {
898
903
  }
899
904
  type GridEditContext = CellEditContext | RowEditContext;
900
905
 
901
- interface GridLockedColumnState {
902
- readonly edge: boolean;
903
- readonly offset: number;
904
- readonly side: GridColumnLockedPosition;
906
+ /** A single row of the grid body — either a group header, a group footer, or a data row. */
907
+ type GridViewRow = GridViewGroupRow | GridViewGroupFooterRow | GridViewDataRow;
908
+ /** A group header row in the flattened grid view. */
909
+ interface GridViewGroupRow {
910
+ /** The number of data rows (leaf rows) contained in this group. */
911
+ readonly count: number;
912
+ /** The nesting depth (0 = top-level group). */
913
+ readonly depth: number;
914
+ /** The field this group is grouped by. */
915
+ readonly field: string;
916
+ /** A unique identifier for this group (used for collapse tracking). */
917
+ readonly groupKey: string;
918
+ /** The display value for this group header. */
919
+ readonly groupValue: unknown;
920
+ /** A key that identifies this row among all body rows, for view tracking. */
921
+ readonly key: string;
922
+ /** The display title for this group header. */
923
+ readonly title: string;
924
+ readonly type: "group";
925
+ }
926
+ /** A footer row for a grouped section in the flattened grid view. */
927
+ interface GridViewGroupFooterRow {
928
+ /** The nesting depth (0 = top-level group). */
929
+ readonly depth: number;
930
+ /** The aggregate metadata for this grouped footer. */
931
+ readonly groupAggregate: GridGroupAggregate;
932
+ /** A key that identifies this row among all body rows, for view tracking. */
933
+ readonly key: string;
934
+ readonly type: "groupFooter";
935
+ }
936
+ /** A data row in the flattened grid view. */
937
+ interface GridViewDataRow {
938
+ /** The depth of the innermost group this row belongs to, or 0 when the grid is not grouped. */
939
+ readonly depth: number;
940
+ /** The groupKey of the innermost group this row belongs to, or null when the grid is not grouped. */
941
+ readonly groupKey: string | null;
942
+ /** A key that identifies this row among all body rows, for view tracking. */
943
+ readonly key: string;
944
+ /** The actual Row model. */
945
+ readonly row: Row;
946
+ readonly type: "data";
905
947
  }
906
948
 
907
- interface PaginationState {
908
- readonly page: number;
909
- readonly skip: number;
910
- readonly take: number;
949
+ /**
950
+ * How a layout column stays pinned while the grid scrolls horizontally.
951
+ * Sides are logical, so `start` is the left edge in LTR and the right edge in RTL.
952
+ */
953
+ interface GridStickyState {
954
+ /** Whether this is the innermost pinned column on its side, which draws the separator border. */
955
+ readonly edge: boolean;
956
+ /** The distance from the pinned side, in pixels. */
957
+ readonly offset: number;
958
+ readonly side: "end" | "start";
911
959
  }
912
960
 
913
961
  type StructuralColumnKind = "detail" | "reorder" | "selection";
@@ -917,6 +965,56 @@ interface StructuralColumnDescriptor {
917
965
  readonly width: number;
918
966
  }
919
967
 
968
+ /**
969
+ * A single physical column of the grid tables, in inline-start to inline-end order.
970
+ * Every table section (header, body, add row, footer) renders the same sequence of layout columns.
971
+ */
972
+ type GridLayoutColumn = GridLayoutDataColumn | GridLayoutGroupColumn | GridLayoutStructuralColumn;
973
+ /** A user-defined data or command column. */
974
+ interface GridLayoutDataColumn {
975
+ readonly column: Column;
976
+ /** The index among the visible user columns. */
977
+ readonly columnIndex: number;
978
+ /** Whether ArrowLeft (inline-start) stops at this cell. */
979
+ readonly firstInRow: boolean;
980
+ readonly key: string;
981
+ readonly kind: "column";
982
+ /** Whether ArrowRight (inline-end) stops at this cell. */
983
+ readonly lastInRow: boolean;
984
+ /** The keyboard-navigation column index. */
985
+ readonly logicalIndex: number;
986
+ readonly sticky: GridStickyState | null;
987
+ readonly width: number | null;
988
+ }
989
+ /** An indent column rendered for each active group level. It does not participate in keyboard navigation. */
990
+ interface GridLayoutGroupColumn {
991
+ readonly depth: number;
992
+ readonly key: string;
993
+ readonly kind: "group";
994
+ readonly logicalIndex: null;
995
+ readonly sticky: GridStickyState | null;
996
+ readonly width: number;
997
+ }
998
+ /** A built-in column such as the row reorder handle, the detail toggle or the selection checkbox. */
999
+ interface GridLayoutStructuralColumn {
1000
+ /** Whether ArrowLeft (inline-start) stops at this cell. */
1001
+ readonly firstInRow: boolean;
1002
+ readonly key: string;
1003
+ readonly kind: StructuralColumnKind;
1004
+ /** Whether ArrowRight (inline-end) stops at this cell. */
1005
+ readonly lastInRow: boolean;
1006
+ /** The keyboard-navigation column index. */
1007
+ readonly logicalIndex: number;
1008
+ readonly sticky: GridStickyState | null;
1009
+ readonly width: number;
1010
+ }
1011
+
1012
+ interface PaginationState {
1013
+ readonly page: number;
1014
+ readonly skip: number;
1015
+ readonly take: number;
1016
+ }
1017
+
920
1018
  interface RowEditDataItem extends Record<string, unknown> {
921
1019
  readonly $rowId: string;
922
1020
  }
@@ -945,9 +1043,7 @@ declare class GridService {
945
1043
  readonly columns: _angular_core.WritableSignal<ImmutableList<Column>>;
946
1044
  readonly contextMenuItems: _angular_core.WritableSignal<ImmutableSet<PopupMenuItem>>;
947
1045
  readonly dataStateChange$: Subject<GridDataState>;
948
- readonly detailColumnOffset: _angular_core.Signal<number>;
949
1046
  readonly detailColumnWidth = 36;
950
- readonly detailStructuralWidth: _angular_core.Signal<36 | 0>;
951
1047
  readonly draggingRowUid: _angular_core.WritableSignal<string | null>;
952
1048
  readonly edit$: Subject<GridEditEvent>;
953
1049
  readonly editBaseDict: _angular_core.Signal<ImmutableDictionary<string, RowEditDataItem>>;
@@ -972,13 +1068,9 @@ declare class GridService {
972
1068
  readonly headerTableElement: _angular_core.WritableSignal<HTMLTableElement | null>;
973
1069
  readonly horizontalScrollLeft: _angular_core.Signal<number>;
974
1070
  readonly isInEditMode: _angular_core.Signal<boolean>;
975
- readonly lastLeftStructuralOffset: _angular_core.Signal<number | null>;
976
- readonly leadingLogicalColumnCount: _angular_core.Signal<number>;
977
- readonly leadingStructuralColumnCount: _angular_core.Signal<number>;
1071
+ readonly layout: _angular_core.Signal<readonly GridLayoutColumn[]>;
1072
+ readonly layoutColumnByKey: _angular_core.Signal<ReadonlyMap<string, GridLayoutColumn>>;
978
1073
  readonly leadingStructuralWidth: _angular_core.Signal<number>;
979
- readonly leftLockedStructuralWidth: _angular_core.Signal<number>;
980
- readonly lockedColumnStates: _angular_core.Signal<ReadonlyMap<string, GridLockedColumnState>>;
981
- readonly masterDetailEmptyCellWidth: _angular_core.Signal<number>;
982
1074
  readonly masterDetailRowWidth: _angular_core.Signal<number>;
983
1075
  readonly masterDetailTemplate: _angular_core.WritableSignal<TemplateRef<unknown> | null>;
984
1076
  readonly messages: _angular_core.Signal<_nanahoshi_mona_ui_i18n.MonaGridMessages>;
@@ -988,16 +1080,15 @@ declare class GridService {
988
1080
  readonly remove$: Subject<GridRemoveEvent>;
989
1081
  readonly reorderableOptions: _angular_core.Signal<ReorderableOptions>;
990
1082
  readonly resizableOptions: _angular_core.Signal<ResizableOptions>;
1083
+ readonly rowClass: _angular_core.WritableSignal<GridRowClass<unknown> | null>;
991
1084
  readonly rowDragInProgress: _angular_core.Signal<boolean>;
992
1085
  readonly rowEdit$: Subject<RowEditEvent>;
993
1086
  readonly rowKey: _angular_core.WritableSignal<GridKeySelector<unknown>>;
994
1087
  readonly rowReorder$: Subject<RowReorderEvent<Record<PropertyKey, unknown>>>;
995
- readonly rowReorderColumnOffset: _angular_core.Signal<number>;
996
1088
  readonly rowReorderColumnVisible: _angular_core.Signal<boolean>;
997
1089
  readonly rowReorderColumnWidth = 36;
998
1090
  readonly rowReorderDisabledReason: _angular_core.Signal<RowReorderDisabledReason>;
999
1091
  readonly rowReorderInteractionEnabled: _angular_core.Signal<boolean>;
1000
- readonly rowReorderStructuralWidth: _angular_core.Signal<36 | 0>;
1001
1092
  readonly rowReorderableOptions: _angular_core.Signal<RowReorderableOptions>;
1002
1093
  readonly rows: _angular_core.WritableSignal<ImmutableList<Row>>;
1003
1094
  readonly save$: Subject<GridSaveEvent>;
@@ -1010,18 +1101,14 @@ declare class GridService {
1010
1101
  readonly selectedKeysChange$: rxjs.Observable<ImmutableSet<unknown>>;
1011
1102
  readonly selectedKeysLoad$: BehaviorSubject<ImmutableSet<unknown>>;
1012
1103
  readonly selectedRows: _angular_core.Signal<ImmutableSet<Row>>;
1013
- readonly selectionColumnOffset: _angular_core.Signal<number>;
1014
1104
  readonly selectionColumnVisible: _angular_core.Signal<boolean>;
1015
1105
  readonly selectionColumnWidth = 40;
1016
- readonly selectionStructuralWidth: _angular_core.Signal<0 | 40>;
1017
1106
  readonly serverBindingEnabled: _angular_core.Signal<boolean>;
1018
1107
  readonly serverLoading: _angular_core.Signal<boolean>;
1019
1108
  readonly serverTotal: _angular_core.Signal<number>;
1020
1109
  readonly someBulkSelectionRowsSelected: _angular_core.Signal<boolean>;
1021
1110
  readonly sortableOptions: _angular_core.WritableSignal<SortableOptions>;
1022
- readonly structuralColIndexMap: _angular_core.Signal<Map<StructuralColumnKind, number>>;
1023
1111
  readonly structuralColumns: _angular_core.Signal<readonly StructuralColumnDescriptor[]>;
1024
- readonly structuralLastKind: _angular_core.Signal<StructuralColumnKind | null>;
1025
1112
  readonly tableWidth: _angular_core.Signal<number | null>;
1026
1113
  readonly viewPageRows: _angular_core.Signal<ImmutableList<Row>>;
1027
1114
  readonly viewRowCount: _angular_core.Signal<number>;
@@ -1041,6 +1128,11 @@ declare class GridService {
1041
1128
  clearCollapsedGroups(predicate?: (key: string) => boolean): void;
1042
1129
  clearColumnGrouping(column: Column): void;
1043
1130
  commitRowEdit(originalEvent?: Event): boolean;
1131
+ /**
1132
+ * Builds the body rows for the given data rows: plain data rows when ungrouped, otherwise the flattened
1133
+ * group headers, data rows and group footers. Reads grouping state, so call it inside a computed.
1134
+ */
1135
+ createBodyRows(rows: Iterable<Row>): GridViewRow[];
1044
1136
  deselectAllRows(): void;
1045
1137
  deselectRow(row: Row): void;
1046
1138
  findTextWidthOfColumn(column: Column, element: HTMLTableCellElement): number;
@@ -1107,7 +1199,6 @@ declare class GridService {
1107
1199
  startCellEdit(uid: string, row: Row, column: Column, originalEvent?: Event): boolean;
1108
1200
  startRowEdit(row: Row, originalEvent?: Event): boolean;
1109
1201
  stopCellEdit(originalEvent?: Event): boolean;
1110
- structuralColumnOffset(kind: StructuralColumnKind, groupPrefixWidth: number): number;
1111
1202
  toggleGroupCollapse(groupKey: string): void;
1112
1203
  updateColumn(columnId: string, patch: Partial<Omit<Column, "id">>): void;
1113
1204
  private applyColumnIndexes;
@@ -1196,7 +1287,6 @@ declare class GridComponent<T> implements GridVariantInput {
1196
1287
  protected readonly filterRowEnabled: _angular_core.Signal<boolean>;
1197
1288
  protected readonly footerClass: _angular_core.Signal<string>;
1198
1289
  protected readonly footerTableClass: _angular_core.Signal<string>;
1199
- protected readonly footerTableRowClass: _angular_core.Signal<string>;
1200
1290
  protected readonly footerVisible: _angular_core.Signal<boolean>;
1201
1291
  protected readonly gridDetailTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
1202
1292
  protected readonly gridHeaderElement: _angular_core.Signal<ElementRef<HTMLDivElement>>;
@@ -1267,6 +1357,16 @@ declare class GridComponent<T> implements GridVariantInput {
1267
1357
  * @default "medium"
1268
1358
  */
1269
1359
  readonly rounded: _angular_core.InputSignal<"small" | "none" | "medium" | "large" | null | undefined>;
1360
+ /**
1361
+ * @description Returns extra CSS classes for the data row that shows an item, merged onto the row's own
1362
+ * classes via `tailwind-merge`. It runs again whenever the item's row is rebound.
1363
+ * Group, group footer and detail rows are not affected.
1364
+ *
1365
+ * To dim a row, prefer a text style such as `text-muted-foreground` over `opacity`: locked cells stay
1366
+ * opaque so scrolled cells pass beneath them, and opacity on the row or its cells would let those show through.
1367
+ * @default null
1368
+ */
1369
+ readonly rowClass: _angular_core.InputSignal<GridRowClass<T> | null>;
1270
1370
  /**
1271
1371
  * @description Field name or selector used to derive a stable identity for each row.
1272
1372
  * The resolved value must be unique within the grid data.
@@ -1315,7 +1415,7 @@ declare class GridComponent<T> implements GridVariantInput {
1315
1415
  private setResizeObserver;
1316
1416
  private syncToolbarFocusTargets;
1317
1417
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridComponent<any>, never>;
1318
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<GridComponent<any>, "mona-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizeValues": { "alias": "pageSizeValues"; "required": false; "isSignal": true; }; "resizeMethod": { "alias": "resizeMethod"; "required": false; "isSignal": true; }; "responsivePager": { "alias": "responsivePager"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "rowKey": { "alias": "rowKey"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, ["columnDefinitions", "gridDetailTemplate", "noDataTemplate", "toolbarTemplate"], never, true, never>;
1418
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<GridComponent<any>, "mona-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "pageSizeValues": { "alias": "pageSizeValues"; "required": false; "isSignal": true; }; "resizeMethod": { "alias": "resizeMethod"; "required": false; "isSignal": true; }; "responsivePager": { "alias": "responsivePager"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; "rowKey": { "alias": "rowKey"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, ["columnDefinitions", "gridDetailTemplate", "noDataTemplate", "toolbarTemplate"], never, true, never>;
1319
1419
  }
1320
1420
 
1321
1421
  declare const GRID_DEFAULT_MESSAGES: {
@@ -1363,4 +1463,4 @@ declare const GRID_DEFAULT_MESSAGES: {
1363
1463
  };
1364
1464
 
1365
1465
  export { CellEditEvent, ColumnReorderEvent, ColumnSortEvent, GRID_DEFAULT_MESSAGES, GridAddCommandDirective, GridAddEvent, GridCancelCommandDirective, GridCancelEvent, GridCellTemplateDirective, GridColumnComponent, GridColumnTitleTemplateDirective, GridCommandColumnComponent, GridComponent, GridContextMenuDirective, GridDetailTemplateDirective, GridEditCommandDirective, GridEditEvent, GridEditTemplateDirective, GridEditableDirective, GridExportDirective, GridFilterableDirective, GridFooterTemplateDirective, GridGroupFooterTemplateDirective, GridGroupableDirective, GridHeaderTemplateDirective, GridNoDataTemplateDirective, GridRemoveCommandDirective, GridRemoveEvent, GridReorderableDirective, GridResizableDirective, GridRowReorderableDirective, GridSaveCommandDirective, GridSaveEvent, GridSelectableDirective, GridServerBindingDirective, GridSortableDirective, GridStatePersistenceDirective, GridToolbarTemplateDirective, GridVirtualScrollDirective, RowEditEvent, RowReorderEvent };
1366
- export type { AggregateFunction, Column, ColumnConfig, ColumnFormat, ColumnKind, ColumnResizeEvent, EditableOptions, FilterableOptions, GridColumnLockedPosition, GridColumnState, GridDataState, GridEditFormContext, GridEditOperation, GridEditSchemaFactory, GridEditSession, GridEditTemplateContext, GridSaveOperation, GridState, GridStateCompositeFilterDescriptor, GridStateFilterDescriptor, GridStateFilterValue, GridStateLoadResult, GridStateLoadStatus, GridStatePersistenceOptions, GridStateSortDescriptor, GridStateVersion, GroupDescriptor, GroupableOptions, ReorderableOptions, ResizableOptions, ResizeMethod, RowReorderableOptions, SelectableOptions, SortableOptions };
1466
+ export type { AggregateFunction, Column, ColumnConfig, ColumnFormat, ColumnKind, ColumnResizeEvent, EditableOptions, FilterableOptions, GridColumnLockedPosition, GridColumnState, GridDataState, GridEditFormContext, GridEditOperation, GridEditSchemaFactory, GridEditSession, GridEditTemplateContext, GridRowClass, GridRowClassValue, GridSaveOperation, GridState, GridStateCompositeFilterDescriptor, GridStateFilterDescriptor, GridStateFilterValue, GridStateLoadResult, GridStateLoadStatus, GridStatePersistenceOptions, GridStateSortDescriptor, GridStateVersion, GroupDescriptor, GroupableOptions, ReorderableOptions, ResizableOptions, ResizeMethod, RowReorderableOptions, SelectableOptions, SortableOptions };
@@ -1,108 +0,0 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, computed, input, ChangeDetectionStrategy, Component } from '@angular/core';
4
- import { ImmutableDictionary } from '@mirei/ts-collections';
5
- import { c as GridService } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C_mj53LF.mjs';
6
-
7
- class GridFooterCellComponent {
8
- constructor() {
9
- this.#gridService = inject(GridService);
10
- this.aggregate = computed(() => {
11
- const field = this.column().field;
12
- const groupKey = this.groupKey();
13
- if (groupKey == null) {
14
- return this.aggregateMap().get(field) ?? null;
15
- }
16
- return this.#gridService.groupAggregateMap().get(groupKey)?.aggregates.get(field) ?? null;
17
- }, /* @ts-ignore */
18
- ...(ngDevMode ? [{ debugName: "aggregate" }] : /* istanbul ignore next */ []));
19
- this.aggregateMap = computed(() => {
20
- const groupKey = this.groupKey();
21
- if (groupKey == null) {
22
- return this.#gridService.aggregateMap();
23
- }
24
- return (this.#gridService.groupAggregateMap().get(groupKey)?.aggregates ??
25
- ImmutableDictionary.create());
26
- }, /* @ts-ignore */
27
- ...(ngDevMode ? [{ debugName: "aggregateMap" }] : /* istanbul ignore next */ []));
28
- this.displayValue = computed(() => {
29
- return this.#gridService.resolveAggregateValue(this.aggregate(), this.column().aggregate);
30
- }, /* @ts-ignore */
31
- ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
32
- this.templateContext = computed(() => {
33
- const column = this.column();
34
- const columnIndex = this.columnIndex();
35
- const aggregate = this.aggregate();
36
- const aggregates = this.aggregateMap().toObject(e => e.key, e => e.value);
37
- const value = this.displayValue();
38
- const groupKey = this.groupKey();
39
- if (groupKey == null) {
40
- return {
41
- $implicit: value,
42
- aggregate,
43
- aggregates,
44
- column,
45
- columnIndex,
46
- rows: this.#gridService.aggregateRows()
47
- };
48
- }
49
- const groupFooterAggregate = this.#gridService.groupAggregateMap().get(groupKey);
50
- return {
51
- $implicit: value,
52
- aggregate,
53
- aggregates,
54
- column,
55
- columnIndex,
56
- count: groupFooterAggregate?.count ?? 0,
57
- depth: groupFooterAggregate?.depth ?? 0,
58
- groupKey,
59
- groupValue: groupFooterAggregate?.groupValue,
60
- rows: groupFooterAggregate?.rows ?? []
61
- };
62
- }, /* @ts-ignore */
63
- ...(ngDevMode ? [{ debugName: "templateContext" }] : /* istanbul ignore next */ []));
64
- this.templateRef = computed(() => {
65
- if (this.groupKey() != null) {
66
- return this.column().groupFooterTemplate;
67
- }
68
- return this.column().footerTemplate;
69
- }, /* @ts-ignore */
70
- ...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
71
- this.column = input.required(/* @ts-ignore */
72
- ...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
73
- this.columnIndex = input.required(/* @ts-ignore */
74
- ...(ngDevMode ? [{ debugName: "columnIndex" }] : /* istanbul ignore next */ []));
75
- this.groupKey = input(null, /* @ts-ignore */
76
- ...(ngDevMode ? [{ debugName: "groupKey" }] : /* istanbul ignore next */ []));
77
- }
78
- #gridService;
79
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridFooterCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
80
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridFooterCellComponent, isStandalone: true, selector: "mona-grid-footer-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, columnIndex: { classPropertyName: "columnIndex", publicName: "columnIndex", isSignal: true, isRequired: true, transformFunction: null }, groupKey: { classPropertyName: "groupKey", publicName: "groupKey", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center h-full" }, ngImport: i0, template: `
81
- @if (templateRef(); as templateRef) {
82
- <ng-container [ngTemplateOutlet]="templateRef" [ngTemplateOutletContext]="templateContext()"></ng-container>
83
- } @else if (displayValue() != null) {
84
- <span class="block truncate font-medium">{{ displayValue() }}</span>
85
- }
86
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
87
- }
88
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridFooterCellComponent, decorators: [{
89
- type: Component,
90
- args: [{
91
- selector: "mona-grid-footer-cell",
92
- template: `
93
- @if (templateRef(); as templateRef) {
94
- <ng-container [ngTemplateOutlet]="templateRef" [ngTemplateOutletContext]="templateContext()"></ng-container>
95
- } @else if (displayValue() != null) {
96
- <span class="block truncate font-medium">{{ displayValue() }}</span>
97
- }
98
- `,
99
- changeDetection: ChangeDetectionStrategy.OnPush,
100
- imports: [NgTemplateOutlet],
101
- host: {
102
- class: "flex items-center h-full"
103
- }
104
- }]
105
- }], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], columnIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnIndex", required: true }] }], groupKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupKey", required: false }] }] } });
106
-
107
- export { GridFooterCellComponent };
108
- //# sourceMappingURL=nanahoshi-mona-ui-grid-grid-footer-cell.component-blRlw0Ie.mjs.map
@@ -1,44 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, computed, input, Directive } from '@angular/core';
3
- import { c as GridService, A as gridFooterTableCellThemeVariants } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C_mj53LF.mjs';
4
-
5
- class GridFooterTableCellDirective {
6
- constructor() {
7
- this.#gridService = inject(GridService, { optional: true });
8
- this.className = computed(() => {
9
- return (gridFooterTableCellThemeVariants() +
10
- (this.#gridService?.virtualScrollOptions().enabled
11
- ? " h-(--mona-grid-row-height) max-h-(--mona-grid-row-height) overflow-hidden py-0! align-middle"
12
- : ""));
13
- }, /* @ts-ignore */
14
- ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
15
- this.minWidth = computed(() => this.footerColumn()?.minWidth ?? this.footerCellMinWidth(), /* @ts-ignore */
16
- ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
17
- this.width = computed(() => this.footerColumn()?.calculatedWidth ?? this.footerCellWidth(), /* @ts-ignore */
18
- ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
19
- this.footerCellMinWidth = input(null, /* @ts-ignore */
20
- ...(ngDevMode ? [{ debugName: "footerCellMinWidth" }] : /* istanbul ignore next */ []));
21
- this.footerCellWidth = input(null, /* @ts-ignore */
22
- ...(ngDevMode ? [{ debugName: "footerCellWidth" }] : /* istanbul ignore next */ []));
23
- this.footerColumn = input(null, /* @ts-ignore */
24
- ...(ngDevMode ? [{ debugName: "footerColumn" }] : /* istanbul ignore next */ []));
25
- }
26
- #gridService;
27
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridFooterTableCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
28
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridFooterTableCellDirective, isStandalone: true, selector: "td[monaGridFooterTableCell]", inputs: { footerCellMinWidth: { classPropertyName: "footerCellMinWidth", publicName: "footerCellMinWidth", isSignal: true, isRequired: false, transformFunction: null }, footerCellWidth: { classPropertyName: "footerCellWidth", publicName: "footerCellWidth", isSignal: true, isRequired: false, transformFunction: null }, footerColumn: { classPropertyName: "footerColumn", publicName: "footerColumn", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "class": "className()", "style.width.px": "width()", "style.min-width.px": "minWidth()" } }, ngImport: i0 }); }
29
- }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridFooterTableCellDirective, decorators: [{
31
- type: Directive,
32
- args: [{
33
- selector: "td[monaGridFooterTableCell]",
34
- host: {
35
- "[class]": "className()",
36
- "[style.width.px]": "width()",
37
- "[style.min-width.px]": "minWidth()",
38
- role: "gridcell"
39
- }
40
- }]
41
- }], propDecorators: { footerCellMinWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "footerCellMinWidth", required: false }] }], footerCellWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "footerCellWidth", required: false }] }], footerColumn: [{ type: i0.Input, args: [{ isSignal: true, alias: "footerColumn", required: false }] }] } });
42
-
43
- export { GridFooterTableCellDirective };
44
- //# sourceMappingURL=nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-Cviex3cR.mjs.map