@nanahoshi/mona-ui 0.1.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/README.md +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, DestroyRef, ElementRef, Injector, viewChild, computed, input, effect, untracked, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
|
+
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { SlicePipe } from '@nanahoshi/mona-ui/common';
|
|
7
|
+
import { ContextMenuComponent } from '@nanahoshi/mona-ui/contextmenu';
|
|
8
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
9
|
+
import { rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
10
|
+
import { ImmutableList, ImmutableSet } from '@mirei/ts-collections';
|
|
11
|
+
import { fromEvent } from 'rxjs';
|
|
12
|
+
import { G as GridAddRowComponent, a as GridCellComponent, b as GridRowDirective, c as GridCellDirective, d as GridDetailRowDirective, e as GridDetailIndentCellDirective, f as GridDetailContentCellDirective, g as GridToggleComponent } from './nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs';
|
|
13
|
+
import { GridFooterTableCellDirective } from './nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs';
|
|
14
|
+
import { G as GridNavigationService, c as GridService, a as GridRowFlattenerService, g as gridListBaseThemeVariants, i as gridFooterThemeVariants, j as gridFooterTableThemeVariants, b as gridFooterTableRowThemeVariants, d as gridGroupRowThemeVariants, e as gridListTableThemeVariants, f as GridLogicalCellDirective, h as GridLockedCellDirective } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs';
|
|
15
|
+
import { GridFooterCellComponent } from './nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs';
|
|
16
|
+
|
|
17
|
+
class GridVirtualListComponent {
|
|
18
|
+
#destroyRef;
|
|
19
|
+
#gridNavigationService;
|
|
20
|
+
#groupColumns$;
|
|
21
|
+
#hostElementRef;
|
|
22
|
+
#injector;
|
|
23
|
+
#rowFlattener;
|
|
24
|
+
#themeService;
|
|
25
|
+
constructor() {
|
|
26
|
+
this.#destroyRef = inject(DestroyRef);
|
|
27
|
+
this.#gridNavigationService = inject(GridNavigationService);
|
|
28
|
+
this.#groupColumns$ = toObservable(inject(GridService).groupColumns);
|
|
29
|
+
this.#hostElementRef = inject((ElementRef));
|
|
30
|
+
this.#injector = inject(Injector);
|
|
31
|
+
this.#rowFlattener = inject(GridRowFlattenerService);
|
|
32
|
+
this.#themeService = inject(ThemeService);
|
|
33
|
+
this.addRowScrollElementRef = viewChild("addRowScrollElement", /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "addRowScrollElementRef" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.bodyTableElementRef = viewChild.required("bodyTable", /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "bodyTableElementRef" }] : /* istanbul ignore next */ []));
|
|
37
|
+
this.footerScrollElementRef = viewChild("footerScrollElement", /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "footerScrollElementRef" }] : /* istanbul ignore next */ []));
|
|
39
|
+
this.baseClass = computed(() => {
|
|
40
|
+
const theme = this.#themeService.theme();
|
|
41
|
+
return gridListBaseThemeVariants(theme)({ virtual: true });
|
|
42
|
+
}, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
44
|
+
this.flattenedGroupedRows = computed(() => {
|
|
45
|
+
const groupColumns = this.gridService.groupColumns();
|
|
46
|
+
if (groupColumns.length === 0) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
const collapsedKeys = new Set(this.gridService.collapsedGroupKeys());
|
|
50
|
+
const groupAggregateDict = this.gridService.groupAggregateMap().toDictionary(e => e.key, e => e.value);
|
|
51
|
+
const showFooter = this.gridService.groupableOptions().showFooter;
|
|
52
|
+
return this.#rowFlattener.flatten(this.data(), groupColumns, collapsedKeys, showFooter, groupAggregateDict);
|
|
53
|
+
}, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "flattenedGroupedRows" }] : /* istanbul ignore next */ []));
|
|
55
|
+
this.footerClass = computed(() => {
|
|
56
|
+
const theme = this.#themeService.theme();
|
|
57
|
+
return gridFooterThemeVariants(theme)();
|
|
58
|
+
}, /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
|
|
60
|
+
this.footerTableClass = computed(() => {
|
|
61
|
+
const theme = this.#themeService.theme();
|
|
62
|
+
return gridFooterTableThemeVariants(theme)();
|
|
63
|
+
}, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "footerTableClass" }] : /* istanbul ignore next */ []));
|
|
65
|
+
this.footerTableRowClass = computed(() => {
|
|
66
|
+
const theme = this.#themeService.theme();
|
|
67
|
+
return gridFooterTableRowThemeVariants(theme)();
|
|
68
|
+
}, /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "footerTableRowClass" }] : /* istanbul ignore next */ []));
|
|
70
|
+
this.gridService = inject(GridService);
|
|
71
|
+
this.groupRowClass = computed(() => {
|
|
72
|
+
const theme = this.#themeService.theme();
|
|
73
|
+
return gridGroupRowThemeVariants(theme)();
|
|
74
|
+
}, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "groupRowClass" }] : /* istanbul ignore next */ []));
|
|
76
|
+
this.tableClass = computed(() => {
|
|
77
|
+
const theme = this.#themeService.theme();
|
|
78
|
+
return gridListTableThemeVariants(theme)();
|
|
79
|
+
}, /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "tableClass" }] : /* istanbul ignore next */ []));
|
|
81
|
+
this.viewport = viewChild.required(CdkVirtualScrollViewport, /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
|
|
83
|
+
this.columns = input(ImmutableList.create(), /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
85
|
+
this.data = input(ImmutableSet.create(), /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
87
|
+
effect(() => {
|
|
88
|
+
const footerScrollElement = this.footerScrollElementRef()?.nativeElement ?? null;
|
|
89
|
+
untracked(() => this.gridService.footerScrollElement.set(footerScrollElement));
|
|
90
|
+
});
|
|
91
|
+
effect(() => {
|
|
92
|
+
const addRowScrollElement = this.addRowScrollElementRef()?.nativeElement ?? null;
|
|
93
|
+
const scrollLeft = this.gridService.horizontalScrollLeft();
|
|
94
|
+
untracked(() => this.setElementScrollLeft(addRowScrollElement, scrollLeft));
|
|
95
|
+
});
|
|
96
|
+
afterNextRender({
|
|
97
|
+
read: () => {
|
|
98
|
+
const bodyTableElement = this.bodyTableElementRef().nativeElement;
|
|
99
|
+
const bodyScrollElement = this.#hostElementRef.nativeElement.querySelector(".cdk-virtual-scroll-viewport");
|
|
100
|
+
this.gridService.bodyTableElement.set(bodyTableElement);
|
|
101
|
+
this.gridService.bodyScrollElement.set(bodyScrollElement);
|
|
102
|
+
this.setFocusSubscription();
|
|
103
|
+
this.setScrollEndSubscription();
|
|
104
|
+
this.#destroyRef.onDestroy(() => {
|
|
105
|
+
if (this.gridService.bodyTableElement() === bodyTableElement) {
|
|
106
|
+
this.gridService.bodyTableElement.set(null);
|
|
107
|
+
}
|
|
108
|
+
if (bodyScrollElement != null && this.gridService.bodyScrollElement() === bodyScrollElement) {
|
|
109
|
+
this.gridService.bodyScrollElement.set(null);
|
|
110
|
+
}
|
|
111
|
+
if (this.gridService.footerScrollElement() === this.footerScrollElementRef()?.nativeElement) {
|
|
112
|
+
this.gridService.footerScrollElement.set(null);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
this.setGroupSubscriptions();
|
|
118
|
+
this.setSelectedKeysLoadSubscription();
|
|
119
|
+
}
|
|
120
|
+
onGridRowClick(event, row) {
|
|
121
|
+
this.gridService.handleRowClick(event, row);
|
|
122
|
+
}
|
|
123
|
+
onGroupExpandChange(groupKey) {
|
|
124
|
+
this.gridService.toggleGroupCollapse(groupKey);
|
|
125
|
+
}
|
|
126
|
+
onToggleDetailClick(row) {
|
|
127
|
+
this.gridService.setRowExpanded(row, !this.gridService.isRowExpanded(row));
|
|
128
|
+
}
|
|
129
|
+
setElementScrollLeft(element, scrollLeft) {
|
|
130
|
+
if (element != null && element.scrollLeft !== scrollLeft) {
|
|
131
|
+
element.scrollLeft = scrollLeft;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
setFocusSubscription() {
|
|
135
|
+
fromEvent(this.#hostElementRef.nativeElement, "focus")
|
|
136
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
137
|
+
.subscribe(() => {
|
|
138
|
+
this.#gridNavigationService.focusActiveCellOrFirstHeader();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
setGroupSubscriptions() {
|
|
142
|
+
// Workaround for @angular/components issue #21793 — virtual scroll does not update
|
|
143
|
+
// the rendered range when data changes until the user scrolls.
|
|
144
|
+
this.#groupColumns$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
145
|
+
afterNextRender(() => {
|
|
146
|
+
const renderedRange = this.viewport().getRenderedRange();
|
|
147
|
+
this.viewport().setRenderedRange({
|
|
148
|
+
start: renderedRange.start,
|
|
149
|
+
end: renderedRange.end + 1
|
|
150
|
+
});
|
|
151
|
+
}, { injector: this.#injector });
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
setScrollEndSubscription() {
|
|
155
|
+
const viewport = this.viewport();
|
|
156
|
+
viewport.scrolledIndexChange.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
|
|
157
|
+
const bottomOffset = viewport.measureScrollOffset("bottom");
|
|
158
|
+
const itemHeight = this.gridService.virtualScrollOptions().height ?? 32;
|
|
159
|
+
const threshold = this.gridService.scrollEndThreshold();
|
|
160
|
+
if (bottomOffset <= threshold * itemHeight) {
|
|
161
|
+
this.gridService.scrollEnd$.next();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
setSelectedKeysLoadSubscription() {
|
|
166
|
+
this.gridService.selectedKeysLoad$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(selectedKeys => {
|
|
167
|
+
const firstKey = selectedKeys.firstOrDefault();
|
|
168
|
+
if (firstKey == null) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const selectBy = this.gridService.selectBy();
|
|
172
|
+
if (this.gridService.groupColumns().any()) {
|
|
173
|
+
const viewData = this.flattenedGroupedRows();
|
|
174
|
+
const selectedRow = viewData.find(r => {
|
|
175
|
+
if (r.type !== "data" || selectBy == null) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
if (typeof selectBy === "string") {
|
|
179
|
+
return r.row.data[selectBy] === firstKey;
|
|
180
|
+
}
|
|
181
|
+
return selectBy(r.row.data) === firstKey;
|
|
182
|
+
});
|
|
183
|
+
if (selectedRow != null) {
|
|
184
|
+
const index = viewData.indexOf(selectedRow);
|
|
185
|
+
rxTimeout(this.#destroyRef, () => {
|
|
186
|
+
this.viewport().scrollToIndex(index);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
const viewData = this.data().toImmutableList();
|
|
192
|
+
const selectedRow = viewData.firstOrDefault(r => {
|
|
193
|
+
if (selectBy == null) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
if (typeof selectBy === "string") {
|
|
197
|
+
return r.data[selectBy] === firstKey;
|
|
198
|
+
}
|
|
199
|
+
return selectBy(r.data) === firstKey;
|
|
200
|
+
});
|
|
201
|
+
if (selectedRow != null) {
|
|
202
|
+
const index = viewData.indexOf(selectedRow);
|
|
203
|
+
rxTimeout(this.#destroyRef, () => {
|
|
204
|
+
this.viewport().scrollToIndex(index);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
211
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridVirtualListComponent, isStandalone: true, selector: "mona-grid-virtual-list", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "addRowScrollElementRef", first: true, predicate: ["addRowScrollElement"], descendants: true, isSignal: true }, { propertyName: "bodyTableElementRef", first: true, predicate: ["bodyTable"], descendants: true, isSignal: true }, { propertyName: "footerScrollElementRef", first: true, predicate: ["footerScrollElement"], descendants: true, isSignal: true }, { propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], ngImport: i0, template: "@if (gridService.addRowVisible()) {\r\n <div\r\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\r\n [style.margin-right.px]=\"gridService.scrollbarGutterWidth()\"\r\n #addRowScrollElement>\r\n <table [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tbody role=\"rowgroup\">\r\n <tr monaGridAddRow [columns]=\"columns()\"></tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n}\r\n\r\n<cdk-virtual-scroll-viewport\r\n class=\"flex-1 min-h-0\"\r\n [itemSize]=\"gridService.virtualScrollOptions().height\"\r\n [minBufferPx]=\"gridService.virtualGridMinBuffer()\"\r\n [maxBufferPx]=\"gridService.virtualGridMaxBuffer()\">\r\n <table #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tbody role=\"rowgroup\">\r\n @if (gridService.groupColumns().length === 0) {\r\n <ng-container *cdkVirtualFor=\"let row of data(); let rowIndex = index\">\r\n <tr\r\n monaGridRow\r\n [index]=\"rowIndex\"\r\n [row]=\"row\"\r\n (click)=\"onGridRowClick($event, row)\"\r\n #gridRow=\"monaGridRow\"\r\n #rowElement>\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"0\"\r\n [masterDetailToggle]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"'detail'\"\r\n [colIndex]=\"0\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"row.uid\"\r\n [section]=\"'body'\"\r\n [style.width.px]=\"gridService.detailColumnWidth\"\r\n [attr.colspan]=\"1\">\r\n <span class=\"flex h-full w-full items-stretch justify-center\">\r\n <mona-grid-toggle\r\n [expanded]=\"gridRow.expanded()\"\r\n [type]=\"'detail'\"\r\n [width]=\"gridService.detailColumnWidth\"\r\n (expandedChange)=\"onToggleDetailClick(row)\"></mona-grid-toggle>\r\n </span>\r\n </td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [dataCell]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"row.uid\"\r\n [section]=\"'body'\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"\r\n colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\r\n \"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\"\r\n (edit)=\"gridCell.handleLogicalCellEnter()\">\r\n <mona-grid-cell #gridCell [column]=\"column\" [row]=\"row\"></mona-grid-cell>\r\n </td>\r\n }\r\n @if (gridService.contextMenuItems().length !== 0) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contextMenuTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row.data,\r\n element: rowElement,\r\n index: rowIndex\r\n }\">\r\n </ng-container>\r\n }\r\n </tr>\r\n @if (gridRow.expanded()) {\r\n <tr monaGridDetailRow [style.width.px]=\"gridService.masterDetailRowWidth()\">\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"0\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.masterDetailEmptyCellWidth()\"></td>\r\n <td monaGridCell [masterDetailContent]=\"true\" [attr.colspan]=\"columns().length\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row.data }\"></ng-container>\r\n </td>\r\n </tr>\r\n }\r\n </ng-container>\r\n } @else {\r\n <ng-container *cdkVirtualFor=\"let rowItem of flattenedGroupedRows(); let rowIndex = index\">\r\n @if (rowItem.type === \"group\") {\r\n @let prevRow = flattenedGroupedRows()[rowIndex - 1];\r\n @let isCollapsed = gridService.isGroupCollapsed(rowItem.groupKey);\r\n <tr\r\n [class]=\"groupRowClass()\"\r\n role=\"row\"\r\n [attr.aria-level]=\"rowItem.depth + 1\"\r\n [attr.aria-expanded]=\"!isCollapsed\">\r\n @for (_ of gridService.groupColumns() | monaSlice: 0 : rowItem.depth; track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n\r\n @let colspan =\r\n columns().length +\r\n gridService.groupColumns().length +\r\n (gridService.masterDetailTemplate() ? 1 : 0) -\r\n rowItem.depth +\r\n 1;\r\n\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n [cellKind]=\"'group'\"\r\n [rowIndex]=\"rowIndex\"\r\n [colIndex]=\"0\"\r\n [section]=\"'body'\"\r\n [grouped]=\"true\"\r\n [groupHeader]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [groupKey]=\"rowItem.groupKey\"\r\n [attr.colspan]=\"colspan\"\r\n (toggle)=\"onGroupExpandChange(rowItem.groupKey)\">\r\n <p class=\"flex h-8 items-center text-sm whitespace-nowrap\">\r\n <mona-grid-toggle\r\n [expanded]=\"!isCollapsed\"\r\n [width]=\"gridService.groupColumnWidth\"\r\n [type]=\"'group'\"\r\n (expandedChange)=\"onGroupExpandChange(rowItem.groupKey)\"></mona-grid-toggle>\r\n <span class=\"font-bold\">{{ rowItem.title }}: {{ rowItem.groupValue }}</span>\r\n </p>\r\n </td>\r\n </tr>\r\n } @else if (rowItem.type === \"groupFooter\") {\r\n <tr role=\"row\" [class]=\"footerTableRowClass()\">\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [footerCellWidth]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [footerCellWidth]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [lockedCellHeader]=\"true\"\r\n [footerColumn]=\"column\">\r\n <mona-grid-footer-cell\r\n [column]=\"column\"\r\n [columnIndex]=\"$index\"\r\n [groupKey]=\"rowItem.groupAggregate.groupKey\"></mona-grid-footer-cell>\r\n </td>\r\n }\r\n </tr>\r\n } @else if (rowItem.type === \"data\") {\r\n @let nextRow = flattenedGroupedRows()[rowIndex + 1];\r\n @let prevRow = flattenedGroupedRows()[rowIndex - 1];\r\n <tr\r\n (click)=\"onGridRowClick($event, rowItem.row)\"\r\n monaGridRow\r\n [index]=\"rowIndex\"\r\n [row]=\"rowItem.row\"\r\n #gridRow=\"monaGridRow\"\r\n #rowElement>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [grouped]=\"true\"\r\n [masterDetailToggle]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [nextRowType]=\"nextRow?.type\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"rowItem.row.uid\"\r\n [section]=\"'body'\"\r\n [cellKind]=\"'detail'\"\r\n [colIndex]=\"0\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [style.width.px]=\"gridService.detailColumnWidth\">\r\n <span class=\"flex h-full w-full items-stretch justify-center\">\r\n <mona-grid-toggle\r\n [expanded]=\"gridRow.expanded()\"\r\n [type]=\"'detail'\"\r\n [width]=\"gridService.detailColumnWidth\"\r\n (expandedChange)=\"onToggleDetailClick(rowItem.row)\"></mona-grid-toggle>\r\n </span>\r\n </td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [grouped]=\"true\"\r\n [dataCell]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [nextRowType]=\"nextRow?.type\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"\r\n colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\r\n \"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"rowItem.row.uid\"\r\n [section]=\"'body'\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\"\r\n (edit)=\"gridCell.handleLogicalCellEnter()\">\r\n <mona-grid-cell #gridCell [column]=\"column\" [row]=\"rowItem.row\"></mona-grid-cell>\r\n </td>\r\n }\r\n @if (gridService.contextMenuItems().length !== 0) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contextMenuTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: rowItem.row.data,\r\n element: rowElement,\r\n index: rowIndex\r\n }\">\r\n </ng-container>\r\n }\r\n </tr>\r\n @if (gridRow.expanded()) {\r\n <tr monaGridDetailRow [style.width.px]=\"gridService.masterDetailRowWidth()\">\r\n @for (\r\n _ of gridService.groupColumns() | monaSlice: 0 : rowItem.depth + 1;\r\n track $index\r\n ) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @let colspan = columns().length + gridService.groupColumns().length;\r\n <td\r\n monaGridDetailIndentCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"(rowItem.depth + 1) * gridService.groupColumnWidth\"\r\n [nextRowType]=\"nextRow?.type\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.masterDetailEmptyCellWidth()\"></td>\r\n <td monaGridDetailContentCell [nextRowType]=\"nextRow?.type\" [attr.colspan]=\"colspan\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowItem.row.data }\"></ng-container>\r\n </td>\r\n </tr>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n </tbody>\r\n </table>\r\n</cdk-virtual-scroll-viewport>\r\n\r\n@if (gridService.hasFooter()) {\r\n <div [class]=\"footerClass()\" [style.margin-right.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\r\n <div>\r\n <table [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tfoot role=\"rowgroup\">\r\n <tr [class]=\"footerTableRowClass()\">\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [footerCellWidth]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [footerCellWidth]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [lockedCellHeader]=\"true\"\r\n [footerColumn]=\"column\">\r\n <mona-grid-footer-cell [column]=\"column\" [columnIndex]=\"$index\"></mona-grid-footer-cell>\r\n </td>\r\n }\r\n </tr>\r\n </tfoot>\r\n </table>\r\n </div>\r\n </div>\r\n}\r\n\r\n<ng-template let-rowData let-element=\"element\" let-rowIndex=\"index\" #contextMenuTemplate>\r\n <mona-contextmenu [target]=\"element\" [items]=\"gridService.contextMenuItems()\"></mona-contextmenu>\r\n <!-- [context]=\"{rowData, element, rowIndex}\"-->\r\n</ng-template>\r\n", dependencies: [{ kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: GridAddRowComponent, selector: "tr[monaGridAddRow]", inputs: ["columns"] }, { kind: "component", type: GridCellComponent, selector: "mona-grid-cell", inputs: ["column", "row"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ContextMenuComponent, selector: "mona-contextmenu", inputs: ["ariaLabel", "items", "minWidth", "rounded", "size", "target", "width"], outputs: ["menuClick"] }, { kind: "directive", type: GridRowDirective, selector: "tr[monaGridRow]", inputs: ["index", "row"], exportAs: ["monaGridRow"] }, { kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["dataCell", "groupHeader", "groupToggle", "grouped", "indentCell", "lastInRow", "masterDetailContent", "masterDetailToggle", "nextRowType", "prevRowType"] }, { kind: "directive", type: GridDetailRowDirective, selector: "tr[monaGridDetailRow]" }, { kind: "directive", type: GridDetailIndentCellDirective, selector: "td[monaGridDetailIndentCell]", inputs: ["nextRowType"] }, { kind: "directive", type: GridDetailContentCellDirective, selector: "td[monaGridDetailContentCell]", inputs: ["nextRowType"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["cellKind", "colIndex", "columnId", "firstInRow", "groupHeader", "groupKey", "lastInRow", "rowIndex", "rowUid", "section"], outputs: ["edit", "toggle"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["column", "lockedCellHeader", "lockedStructuralOffset"] }, { kind: "directive", type: GridFooterTableCellDirective, selector: "td[monaGridFooterTableCell]", inputs: ["footerCellMinWidth", "footerCellWidth", "footerColumn"] }, { kind: "component", type: GridToggleComponent, selector: "mona-grid-toggle", inputs: ["expanded", "type", "width"], outputs: ["expandedChange"] }, { kind: "component", type: GridFooterCellComponent, selector: "mona-grid-footer-cell", inputs: ["column", "columnIndex", "groupKey"] }, { kind: "pipe", type: SlicePipe, name: "monaSlice" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
212
|
+
}
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridVirtualListComponent, decorators: [{
|
|
214
|
+
type: Component,
|
|
215
|
+
args: [{ selector: "mona-grid-virtual-list", imports: [
|
|
216
|
+
CdkVirtualScrollViewport,
|
|
217
|
+
CdkFixedSizeVirtualScroll,
|
|
218
|
+
CdkVirtualForOf,
|
|
219
|
+
GridAddRowComponent,
|
|
220
|
+
GridCellComponent,
|
|
221
|
+
SlicePipe,
|
|
222
|
+
NgTemplateOutlet,
|
|
223
|
+
ContextMenuComponent,
|
|
224
|
+
GridRowDirective,
|
|
225
|
+
GridCellDirective,
|
|
226
|
+
GridDetailRowDirective,
|
|
227
|
+
GridDetailIndentCellDirective,
|
|
228
|
+
GridDetailContentCellDirective,
|
|
229
|
+
GridLogicalCellDirective,
|
|
230
|
+
GridLockedCellDirective,
|
|
231
|
+
GridFooterTableCellDirective,
|
|
232
|
+
GridToggleComponent,
|
|
233
|
+
GridFooterCellComponent
|
|
234
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
235
|
+
"[class]": "baseClass()"
|
|
236
|
+
}, template: "@if (gridService.addRowVisible()) {\r\n <div\r\n class=\"shrink-0 overflow-hidden border-b border-b-border\"\r\n [style.margin-right.px]=\"gridService.scrollbarGutterWidth()\"\r\n #addRowScrollElement>\r\n <table [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tbody role=\"rowgroup\">\r\n <tr monaGridAddRow [columns]=\"columns()\"></tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n}\r\n\r\n<cdk-virtual-scroll-viewport\r\n class=\"flex-1 min-h-0\"\r\n [itemSize]=\"gridService.virtualScrollOptions().height\"\r\n [minBufferPx]=\"gridService.virtualGridMinBuffer()\"\r\n [maxBufferPx]=\"gridService.virtualGridMaxBuffer()\">\r\n <table #bodyTable [class]=\"tableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tbody role=\"rowgroup\">\r\n @if (gridService.groupColumns().length === 0) {\r\n <ng-container *cdkVirtualFor=\"let row of data(); let rowIndex = index\">\r\n <tr\r\n monaGridRow\r\n [index]=\"rowIndex\"\r\n [row]=\"row\"\r\n (click)=\"onGridRowClick($event, row)\"\r\n #gridRow=\"monaGridRow\"\r\n #rowElement>\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"0\"\r\n [masterDetailToggle]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"'detail'\"\r\n [colIndex]=\"0\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"row.uid\"\r\n [section]=\"'body'\"\r\n [style.width.px]=\"gridService.detailColumnWidth\"\r\n [attr.colspan]=\"1\">\r\n <span class=\"flex h-full w-full items-stretch justify-center\">\r\n <mona-grid-toggle\r\n [expanded]=\"gridRow.expanded()\"\r\n [type]=\"'detail'\"\r\n [width]=\"gridService.detailColumnWidth\"\r\n (expandedChange)=\"onToggleDetailClick(row)\"></mona-grid-toggle>\r\n </span>\r\n </td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [dataCell]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"row.uid\"\r\n [section]=\"'body'\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"\r\n colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\r\n \"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\"\r\n (edit)=\"gridCell.handleLogicalCellEnter()\">\r\n <mona-grid-cell #gridCell [column]=\"column\" [row]=\"row\"></mona-grid-cell>\r\n </td>\r\n }\r\n @if (gridService.contextMenuItems().length !== 0) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contextMenuTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: row.data,\r\n element: rowElement,\r\n index: rowIndex\r\n }\">\r\n </ng-container>\r\n }\r\n </tr>\r\n @if (gridRow.expanded()) {\r\n <tr monaGridDetailRow [style.width.px]=\"gridService.masterDetailRowWidth()\">\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"0\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.masterDetailEmptyCellWidth()\"></td>\r\n <td monaGridCell [masterDetailContent]=\"true\" [attr.colspan]=\"columns().length\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: row.data }\"></ng-container>\r\n </td>\r\n </tr>\r\n }\r\n </ng-container>\r\n } @else {\r\n <ng-container *cdkVirtualFor=\"let rowItem of flattenedGroupedRows(); let rowIndex = index\">\r\n @if (rowItem.type === \"group\") {\r\n @let prevRow = flattenedGroupedRows()[rowIndex - 1];\r\n @let isCollapsed = gridService.isGroupCollapsed(rowItem.groupKey);\r\n <tr\r\n [class]=\"groupRowClass()\"\r\n role=\"row\"\r\n [attr.aria-level]=\"rowItem.depth + 1\"\r\n [attr.aria-expanded]=\"!isCollapsed\">\r\n @for (_ of gridService.groupColumns() | monaSlice: 0 : rowItem.depth; track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n\r\n @let colspan =\r\n columns().length +\r\n gridService.groupColumns().length +\r\n (gridService.masterDetailTemplate() ? 1 : 0) -\r\n rowItem.depth +\r\n 1;\r\n\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n [cellKind]=\"'group'\"\r\n [rowIndex]=\"rowIndex\"\r\n [colIndex]=\"0\"\r\n [section]=\"'body'\"\r\n [grouped]=\"true\"\r\n [groupHeader]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [groupKey]=\"rowItem.groupKey\"\r\n [attr.colspan]=\"colspan\"\r\n (toggle)=\"onGroupExpandChange(rowItem.groupKey)\">\r\n <p class=\"flex h-8 items-center text-sm whitespace-nowrap\">\r\n <mona-grid-toggle\r\n [expanded]=\"!isCollapsed\"\r\n [width]=\"gridService.groupColumnWidth\"\r\n [type]=\"'group'\"\r\n (expandedChange)=\"onGroupExpandChange(rowItem.groupKey)\"></mona-grid-toggle>\r\n <span class=\"font-bold\">{{ rowItem.title }}: {{ rowItem.groupValue }}</span>\r\n </p>\r\n </td>\r\n </tr>\r\n } @else if (rowItem.type === \"groupFooter\") {\r\n <tr role=\"row\" [class]=\"footerTableRowClass()\">\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [footerCellWidth]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [footerCellWidth]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [lockedCellHeader]=\"true\"\r\n [footerColumn]=\"column\">\r\n <mona-grid-footer-cell\r\n [column]=\"column\"\r\n [columnIndex]=\"$index\"\r\n [groupKey]=\"rowItem.groupAggregate.groupKey\"></mona-grid-footer-cell>\r\n </td>\r\n }\r\n </tr>\r\n } @else if (rowItem.type === \"data\") {\r\n @let nextRow = flattenedGroupedRows()[rowIndex + 1];\r\n @let prevRow = flattenedGroupedRows()[rowIndex - 1];\r\n <tr\r\n (click)=\"onGridRowClick($event, rowItem.row)\"\r\n monaGridRow\r\n [index]=\"rowIndex\"\r\n [row]=\"rowItem.row\"\r\n #gridRow=\"monaGridRow\"\r\n #rowElement>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [grouped]=\"true\"\r\n [masterDetailToggle]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [nextRowType]=\"nextRow?.type\"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"rowItem.row.uid\"\r\n [section]=\"'body'\"\r\n [cellKind]=\"'detail'\"\r\n [colIndex]=\"0\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [style.width.px]=\"gridService.detailColumnWidth\">\r\n <span class=\"flex h-full w-full items-stretch justify-center\">\r\n <mona-grid-toggle\r\n [expanded]=\"gridRow.expanded()\"\r\n [type]=\"'detail'\"\r\n [width]=\"gridService.detailColumnWidth\"\r\n (expandedChange)=\"onToggleDetailClick(rowItem.row)\"></mona-grid-toggle>\r\n </span>\r\n </td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [grouped]=\"true\"\r\n [dataCell]=\"true\"\r\n [prevRowType]=\"prevRow?.type\"\r\n [nextRowType]=\"nextRow?.type\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"\r\n colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\r\n \"\r\n [rowIndex]=\"rowIndex\"\r\n [rowUid]=\"rowItem.row.uid\"\r\n [section]=\"'body'\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\"\r\n (edit)=\"gridCell.handleLogicalCellEnter()\">\r\n <mona-grid-cell #gridCell [column]=\"column\" [row]=\"rowItem.row\"></mona-grid-cell>\r\n </td>\r\n }\r\n @if (gridService.contextMenuItems().length !== 0) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"contextMenuTemplate\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: rowItem.row.data,\r\n element: rowElement,\r\n index: rowIndex\r\n }\">\r\n </ng-container>\r\n }\r\n </tr>\r\n @if (gridRow.expanded()) {\r\n <tr monaGridDetailRow [style.width.px]=\"gridService.masterDetailRowWidth()\">\r\n @for (\r\n _ of gridService.groupColumns() | monaSlice: 0 : rowItem.depth + 1;\r\n track $index\r\n ) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @let colspan = columns().length + gridService.groupColumns().length;\r\n <td\r\n monaGridDetailIndentCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"(rowItem.depth + 1) * gridService.groupColumnWidth\"\r\n [nextRowType]=\"nextRow?.type\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.masterDetailEmptyCellWidth()\"></td>\r\n <td monaGridDetailContentCell [nextRowType]=\"nextRow?.type\" [attr.colspan]=\"colspan\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: rowItem.row.data }\"></ng-container>\r\n </td>\r\n </tr>\r\n }\r\n }\r\n </ng-container>\r\n }\r\n </tbody>\r\n </table>\r\n</cdk-virtual-scroll-viewport>\r\n\r\n@if (gridService.hasFooter()) {\r\n <div [class]=\"footerClass()\" [style.margin-right.px]=\"gridService.scrollbarGutterWidth()\" #footerScrollElement>\r\n <div>\r\n <table [class]=\"footerTableClass()\" [style.width.px]=\"gridService.tableWidth()\">\r\n <colgroup>\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <col [style.width.px]=\"gridService.groupColumnWidth\" />\r\n }\r\n @for (col of columns(); track $index) {\r\n <col [style.width.px]=\"col.calculatedWidth\" />\r\n }\r\n </colgroup>\r\n <tfoot role=\"rowgroup\">\r\n <tr [class]=\"footerTableRowClass()\">\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [footerCellWidth]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"\r\n gridService.groupColumns().length * gridService.groupColumnWidth\r\n \"\r\n [footerCellWidth]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n <td\r\n monaGridFooterTableCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [lockedCellHeader]=\"true\"\r\n [footerColumn]=\"column\">\r\n <mona-grid-footer-cell [column]=\"column\" [columnIndex]=\"$index\"></mona-grid-footer-cell>\r\n </td>\r\n }\r\n </tr>\r\n </tfoot>\r\n </table>\r\n </div>\r\n </div>\r\n}\r\n\r\n<ng-template let-rowData let-element=\"element\" let-rowIndex=\"index\" #contextMenuTemplate>\r\n <mona-contextmenu [target]=\"element\" [items]=\"gridService.contextMenuItems()\"></mona-contextmenu>\r\n <!-- [context]=\"{rowData, element, rowIndex}\"-->\r\n</ng-template>\r\n" }]
|
|
237
|
+
}], ctorParameters: () => [], propDecorators: { addRowScrollElementRef: [{ type: i0.ViewChild, args: ["addRowScrollElement", { isSignal: true }] }], bodyTableElementRef: [{ type: i0.ViewChild, args: ["bodyTable", { isSignal: true }] }], footerScrollElementRef: [{ type: i0.ViewChild, args: ["footerScrollElement", { isSignal: true }] }], viewport: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
238
|
+
|
|
239
|
+
export { GridVirtualListComponent };
|
|
240
|
+
//# sourceMappingURL=nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs.map
|