@nanahoshi/mona-ui 0.1.0 → 0.2.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/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +24 -58
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -48
- package/fesm2022/nanahoshi-mona-ui-button.mjs +130 -129
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +69 -165
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +81 -128
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +102 -112
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +11 -25
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +41 -92
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +27 -49
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +64 -65
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +39 -61
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +12 -15
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +44 -33
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +58 -60
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +52 -165
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +36 -59
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +56 -61
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +302 -81
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +33 -84
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +12 -45
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +18 -48
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +14 -14
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs +121 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +26 -55
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs +231 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +167 -451
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +57 -87
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -139
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +10 -32
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +8 -21
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +50 -156
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +40 -69
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +32 -116
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +81 -107
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +33 -85
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +12 -34
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +31 -52
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +38 -110
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +21 -62
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +66 -111
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +60 -151
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +117 -173
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +32 -45
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +29 -64
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +38 -101
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +58 -79
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +42 -118
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +29 -37
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -81
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +45 -39
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +45 -109
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +54 -82
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-window.mjs +35 -115
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +31 -5
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +6 -6
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +6 -9
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -8
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +7 -8
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-editor.d.ts +17 -17
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +3 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +16 -17
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +16 -16
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +7 -8
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +8 -11
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +13 -14
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +15 -17
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +4 -6
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +10 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +0 -130
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +0 -240
|
@@ -1,240 +0,0 @@
|
|
|
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
|