@nanahoshi/mona-ui 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component--nF_Q7Bd.mjs +169 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-S2qxwP2M.mjs +176 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-DZDeYdqc.mjs → nanahoshi-mona-ui-grid-grid-row.component-Dwy8hCm7.mjs} +201 -192
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DArxdAah.mjs +173 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C_mj53LF.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-bduDEm-x.mjs} +553 -666
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-grid.d.ts +126 -26
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-blRlw0Ie.mjs +0 -108
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-Cviex3cR.mjs +0 -44
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-H38ZTj-_.mjs +0 -164
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-b1W7r45p.mjs +0 -239
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, input, Directive, Component, signal, ElementRef, viewChild, output, effect, untracked, afterNextRender, ChangeDetectionStrategy, Injector, LOCALE_ID
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { inject, computed, input, Directive, Component, signal, ElementRef, viewChild, output, effect, untracked, afterNextRender, ChangeDetectionStrategy, model, Injector, LOCALE_ID } from '@angular/core';
|
|
3
|
+
import { a as GridService, i as gridListTableCellThemeVariants, j as gridCellEditorBaseThemeVariants, k as gridCellEditorInputThemeVariants, l as gridListTableRowThemeVariants, m as GridLockedCellDirective, n as GridLogicalCellDirective, o as gridGroupRowThemeVariants, G as GridNavigationService, p as gridCellBaseThemeVariants, q as gridCellContainerThemeVariants, r as gridCellDirtyIndicatorThemeVariants, s as gridCellTextThemeVariants, t as gridRowReorderHandleThemeVariants, u as gridSelectionCellThemeVariants } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-bduDEm-x.mjs';
|
|
4
|
+
import { NgTemplateOutlet, formatDate } from '@angular/common';
|
|
5
|
+
import { ContextMenuComponent } from '@nanahoshi/mona-ui/contextmenu';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
7
|
import * as i1 from '@angular/cdk/a11y';
|
|
6
8
|
import { A11yModule, LiveAnnouncer } from '@angular/cdk/a11y';
|
|
7
|
-
import {
|
|
8
|
-
import { LucideCheck, LucideOctagonAlert, LucideX, LucidePencil, LucideTrash2, LucideGripVertical, LucideMinus, LucideChevronDown, LucidePlus, LucideChevronRight, LucideDynamicIcon } from '@lucide/angular';
|
|
9
|
+
import { LucideCheck, LucideOctagonAlert, LucideX, LucidePencil, LucideTrash2, LucideMinus, LucideChevronDown, LucidePlus, LucideChevronRight, LucideDynamicIcon, LucideGripVertical } from '@lucide/angular';
|
|
9
10
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
10
11
|
import { DialogService } from '@nanahoshi/mona-ui/dialog';
|
|
11
12
|
import { TooltipComponent } from '@nanahoshi/mona-ui/tooltip';
|
|
@@ -20,52 +21,24 @@ import { CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
|
20
21
|
class GridCellDirective {
|
|
21
22
|
constructor() {
|
|
22
23
|
this.#gridService = inject(GridService, { optional: true });
|
|
23
|
-
this.baseClass = computed(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const indentCell = this.indentCell();
|
|
29
|
-
const masterDetailContent = this.masterDetailContent();
|
|
30
|
-
const masterDetailToggle = this.masterDetailToggle();
|
|
31
|
-
const lastInRow = this.lastInRow() || groupHeader || masterDetailContent;
|
|
32
|
-
return gridListTableCellThemeVariants({
|
|
33
|
-
virtual: this.#gridService?.virtualScrollOptions().enabled ?? false,
|
|
34
|
-
dataCell,
|
|
35
|
-
groupHeader,
|
|
36
|
-
groupToggle,
|
|
37
|
-
grouped,
|
|
38
|
-
indentCell,
|
|
39
|
-
lastInRow,
|
|
40
|
-
masterDetailContent,
|
|
41
|
-
masterDetailToggle
|
|
42
|
-
});
|
|
43
|
-
}, /* @ts-ignore */
|
|
24
|
+
this.baseClass = computed(() => gridListTableCellThemeVariants({
|
|
25
|
+
virtual: this.#gridService?.virtualScrollOptions().enabled ?? false,
|
|
26
|
+
groupIndent: this.groupIndent(),
|
|
27
|
+
lastInRow: this.lastInRow() || this.groupHeader()
|
|
28
|
+
}), /* @ts-ignore */
|
|
44
29
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
45
|
-
|
|
46
|
-
...(ngDevMode ? [{ debugName: "dataCell" }] : /* istanbul ignore next */ []));
|
|
30
|
+
/** Marks a group header title cell. It spans to the end of the row, so it draws no end border. */
|
|
47
31
|
this.groupHeader = input(false, /* @ts-ignore */
|
|
48
32
|
...(ngDevMode ? [{ debugName: "groupHeader" }] : /* istanbul ignore next */ []));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
...(ngDevMode ? [{ debugName: "grouped" }] : /* istanbul ignore next */ []));
|
|
53
|
-
this.indentCell = input(false, /* @ts-ignore */
|
|
54
|
-
...(ngDevMode ? [{ debugName: "indentCell" }] : /* istanbul ignore next */ []));
|
|
33
|
+
/** Marks an indent cell under a group, which uses the muted group background. */
|
|
34
|
+
this.groupIndent = input(false, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "groupIndent" }] : /* istanbul ignore next */ []));
|
|
55
36
|
this.lastInRow = input(false, /* @ts-ignore */
|
|
56
37
|
...(ngDevMode ? [{ debugName: "lastInRow" }] : /* istanbul ignore next */ []));
|
|
57
|
-
this.masterDetailContent = input(false, /* @ts-ignore */
|
|
58
|
-
...(ngDevMode ? [{ debugName: "masterDetailContent" }] : /* istanbul ignore next */ []));
|
|
59
|
-
this.masterDetailToggle = input(false, /* @ts-ignore */
|
|
60
|
-
...(ngDevMode ? [{ debugName: "masterDetailToggle" }] : /* istanbul ignore next */ []));
|
|
61
|
-
this.nextRowType = input(null, /* @ts-ignore */
|
|
62
|
-
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
63
|
-
this.prevRowType = input(null, /* @ts-ignore */
|
|
64
|
-
...(ngDevMode ? [{ debugName: "prevRowType" }] : /* istanbul ignore next */ []));
|
|
65
38
|
}
|
|
66
39
|
#gridService;
|
|
67
40
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
68
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridCellDirective, isStandalone: true, selector: "td[monaGridCell]", inputs: {
|
|
41
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridCellDirective, isStandalone: true, selector: "td[monaGridCell]", inputs: { groupHeader: { classPropertyName: "groupHeader", publicName: "groupHeader", isSignal: true, isRequired: false, transformFunction: null }, groupIndent: { classPropertyName: "groupIndent", publicName: "groupIndent", isSignal: true, isRequired: false, transformFunction: null }, lastInRow: { classPropertyName: "lastInRow", publicName: "lastInRow", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
69
42
|
}
|
|
70
43
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, decorators: [{
|
|
71
44
|
type: Directive,
|
|
@@ -76,119 +49,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
76
49
|
role: "gridcell"
|
|
77
50
|
}
|
|
78
51
|
}]
|
|
79
|
-
}], propDecorators: {
|
|
80
|
-
|
|
81
|
-
class GridDetailContentCellDirective {
|
|
82
|
-
constructor() {
|
|
83
|
-
this.baseClass = computed(() => {
|
|
84
|
-
return gridDetailContentCellThemeVariants({
|
|
85
|
-
nextIsGroup: this.nextRowType() === "group"
|
|
86
|
-
});
|
|
87
|
-
}, /* @ts-ignore */
|
|
88
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
89
|
-
this.nextRowType = input(null, /* @ts-ignore */
|
|
90
|
-
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
91
|
-
}
|
|
92
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailContentCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
93
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridDetailContentCellDirective, isStandalone: true, selector: "td[monaGridDetailContentCell]", inputs: { nextRowType: { classPropertyName: "nextRowType", publicName: "nextRowType", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
94
|
-
}
|
|
95
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailContentCellDirective, decorators: [{
|
|
96
|
-
type: Directive,
|
|
97
|
-
args: [{
|
|
98
|
-
selector: "td[monaGridDetailContentCell]",
|
|
99
|
-
host: {
|
|
100
|
-
"[class]": "baseClass()",
|
|
101
|
-
role: "gridcell"
|
|
102
|
-
}
|
|
103
|
-
}]
|
|
104
|
-
}], propDecorators: { nextRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextRowType", required: false }] }] } });
|
|
105
|
-
|
|
106
|
-
class GridDetailIndentCellDirective {
|
|
107
|
-
constructor() {
|
|
108
|
-
this.baseClass = computed(() => {
|
|
109
|
-
return gridDetailIndentCellThemeVariants({
|
|
110
|
-
nextIsGroup: this.nextRowType() === "group"
|
|
111
|
-
});
|
|
112
|
-
}, /* @ts-ignore */
|
|
113
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
114
|
-
this.nextRowType = input(null, /* @ts-ignore */
|
|
115
|
-
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
116
|
-
}
|
|
117
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailIndentCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
118
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridDetailIndentCellDirective, isStandalone: true, selector: "td[monaGridDetailIndentCell]", inputs: { nextRowType: { classPropertyName: "nextRowType", publicName: "nextRowType", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
119
|
-
}
|
|
120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailIndentCellDirective, decorators: [{
|
|
121
|
-
type: Directive,
|
|
122
|
-
args: [{
|
|
123
|
-
selector: "td[monaGridDetailIndentCell]",
|
|
124
|
-
host: {
|
|
125
|
-
"[class]": "baseClass()",
|
|
126
|
-
role: "gridcell"
|
|
127
|
-
}
|
|
128
|
-
}]
|
|
129
|
-
}], propDecorators: { nextRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextRowType", required: false }] }] } });
|
|
130
|
-
|
|
131
|
-
class GridDetailRowDirective {
|
|
132
|
-
constructor() {
|
|
133
|
-
this.baseClass = computed(() => {
|
|
134
|
-
return gridDetailRowThemeVariants();
|
|
135
|
-
}, /* @ts-ignore */
|
|
136
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
137
|
-
}
|
|
138
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
139
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: GridDetailRowDirective, isStandalone: true, selector: "tr[monaGridDetailRow]", host: { attributes: { "role": "row" }, properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
140
|
-
}
|
|
141
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowDirective, decorators: [{
|
|
142
|
-
type: Directive,
|
|
143
|
-
args: [{
|
|
144
|
-
selector: "tr[monaGridDetailRow]",
|
|
145
|
-
host: {
|
|
146
|
-
"[class]": "baseClass()",
|
|
147
|
-
role: "row"
|
|
148
|
-
}
|
|
149
|
-
}]
|
|
150
|
-
}] });
|
|
151
|
-
|
|
152
|
-
class GridRowDirective {
|
|
153
|
-
constructor() {
|
|
154
|
-
this.#gridService = inject(GridService);
|
|
155
|
-
this.ariaRowIndex = computed(() => this.index() + this.#gridService.paginationState().skip + 2, /* @ts-ignore */
|
|
156
|
-
...(ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []));
|
|
157
|
-
this.baseClass = computed(() => {
|
|
158
|
-
const selected = this.selected();
|
|
159
|
-
return gridListTableRowThemeVariants({ selected, virtual: this.#gridService.virtualScrollOptions().enabled });
|
|
160
|
-
}, /* @ts-ignore */
|
|
161
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
162
|
-
this.selectable = computed(() => this.#gridService.selectableOptions().enabled, /* @ts-ignore */
|
|
163
|
-
...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
|
|
164
|
-
this.expanded = computed(() => this.#gridService.isRowExpanded(this.row()), /* @ts-ignore */
|
|
165
|
-
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
166
|
-
this.index = input.required(/* @ts-ignore */
|
|
167
|
-
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
168
|
-
this.row = input.required(/* @ts-ignore */
|
|
169
|
-
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
170
|
-
this.selected = computed(() => this.#gridService.isRowSelected(this.row()), /* @ts-ignore */
|
|
171
|
-
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
172
|
-
}
|
|
173
|
-
#gridService;
|
|
174
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
175
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridRowDirective, isStandalone: true, selector: "tr[monaGridRow]", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, properties: { "class": "baseClass()", "attr.data-ruid": "row().uid", "attr.data-row-view-index": "index()", "attr.aria-selected": "selectable() ? selected() : null", "attr.aria-rowindex": "ariaRowIndex()" } }, exportAs: ["monaGridRow"], ngImport: i0 }); }
|
|
176
|
-
}
|
|
177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDirective, decorators: [{
|
|
178
|
-
type: Directive,
|
|
179
|
-
args: [{
|
|
180
|
-
selector: "tr[monaGridRow]",
|
|
181
|
-
host: {
|
|
182
|
-
"[class]": "baseClass()",
|
|
183
|
-
"[attr.data-ruid]": "row().uid",
|
|
184
|
-
"[attr.data-row-view-index]": "index()",
|
|
185
|
-
role: "row",
|
|
186
|
-
"[attr.aria-selected]": "selectable() ? selected() : null",
|
|
187
|
-
"[attr.aria-rowindex]": "ariaRowIndex()"
|
|
188
|
-
},
|
|
189
|
-
exportAs: "monaGridRow"
|
|
190
|
-
}]
|
|
191
|
-
}], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
52
|
+
}], propDecorators: { groupHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupHeader", required: false }] }], groupIndent: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupIndent", required: false }] }], lastInRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "lastInRow", required: false }] }] } });
|
|
192
53
|
|
|
193
54
|
class GridCommandCellComponent {
|
|
194
55
|
constructor() {
|
|
@@ -544,9 +405,14 @@ class GridAddRowComponent {
|
|
|
544
405
|
return gridListTableRowThemeVariants({ selected: false });
|
|
545
406
|
}, /* @ts-ignore */
|
|
546
407
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
408
|
+
this.firstEditableColumn = computed(() => this.gridService.visibleColumns().firstOrDefault(column => column.kind === "data" && column.editable), /* @ts-ignore */
|
|
409
|
+
...(ngDevMode ? [{ debugName: "firstEditableColumn" }] : /* istanbul ignore next */ []));
|
|
547
410
|
this.gridService = inject(GridService);
|
|
548
|
-
this.
|
|
549
|
-
|
|
411
|
+
this.structuralColumnIds = {
|
|
412
|
+
detail: undefined,
|
|
413
|
+
reorder: "$rowReorder",
|
|
414
|
+
selection: "$selection"
|
|
415
|
+
};
|
|
550
416
|
}
|
|
551
417
|
onCancel() {
|
|
552
418
|
this.gridService.cancelAddRow();
|
|
@@ -554,14 +420,11 @@ class GridAddRowComponent {
|
|
|
554
420
|
onCommit() {
|
|
555
421
|
// Add rows are committed by the command column or toolbar save command.
|
|
556
422
|
}
|
|
557
|
-
isFirstEditableColumn(column) {
|
|
558
|
-
return this.columns().firstOrDefault(c => c.kind === "data" && c.editable) === column;
|
|
559
|
-
}
|
|
560
423
|
onValueChange(column, value) {
|
|
561
424
|
this.gridService.patchAddCell(column.field, value);
|
|
562
425
|
}
|
|
563
426
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
564
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridAddRowComponent, isStandalone: true, selector: "tr[monaGridAddRow]",
|
|
427
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridAddRowComponent, isStandalone: true, selector: "tr[monaGridAddRow]", host: { attributes: { "role": "row", "data-grid-add-row": "true" }, properties: { "class": "baseClass()" } }, ngImport: i0, template: "@if (gridService.addRowData(); as rowData) {\n @let session = gridService.editSession();\n @for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n @let column = layoutColumn.column;\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"column.id\"\n [rowIndex]=\"-1\"\n [section]=\"'add'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n @if (column.kind === \"command\") {\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\n } @else if (column.editable && session) {\n <mona-grid-editor\n [column]=\"column\"\n [autoFocus]=\"column === firstEditableColumn()\"\n [isNew]=\"true\"\n [session]=\"session\"\n (commit)=\"onCommit()\"\n (cancelEdit)=\"onCancel()\"></mona-grid-editor>\n } @else {\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\n }\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n } @else {\n <td\n monaGridCell\n monaGridLogicalCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [rowIndex]=\"-1\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [cellKind]=\"layoutColumn.kind === 'detail' ? 'detail' : 'command'\"\n [columnId]=\"structuralColumnIds[layoutColumn.kind]\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [section]=\"'add'\"></td>\n }\n }\n}\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "component", type: GridCommandCellComponent, selector: "mona-grid-command-cell", inputs: ["column", "newRow", "row"] }, { kind: "component", type: GridEditorComponent, selector: "mona-grid-editor", inputs: ["autoFocus", "column", "isNew", "session", "tabNavigationEnabled"], outputs: ["cancelEdit", "commit", "tabNavigate"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["cellKind", "colIndex", "columnId", "editable", "firstInRow", "groupHeader", "groupKey", "lastInRow", "rowIndex", "rowUid", "section"], outputs: ["edit", "toggleExpand"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
565
428
|
}
|
|
566
429
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, decorators: [{
|
|
567
430
|
type: Component,
|
|
@@ -575,8 +438,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
575
438
|
"[class]": "baseClass()",
|
|
576
439
|
role: "row",
|
|
577
440
|
"data-grid-add-row": "true"
|
|
578
|
-
}, template: "@if (gridService.addRowData(); as rowData) {\n @let session = gridService.editSession();\n @for (
|
|
579
|
-
}]
|
|
441
|
+
}, template: "@if (gridService.addRowData(); as rowData) {\n @let session = gridService.editSession();\n @for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n @let column = layoutColumn.column;\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"column.id\"\n [rowIndex]=\"-1\"\n [section]=\"'add'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n @if (column.kind === \"command\") {\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\n } @else if (column.editable && session) {\n <mona-grid-editor\n [column]=\"column\"\n [autoFocus]=\"column === firstEditableColumn()\"\n [isNew]=\"true\"\n [session]=\"session\"\n (commit)=\"onCommit()\"\n (cancelEdit)=\"onCancel()\"></mona-grid-editor>\n } @else {\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\n }\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n } @else {\n <td\n monaGridCell\n monaGridLogicalCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n [rowIndex]=\"-1\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [cellKind]=\"layoutColumn.kind === 'detail' ? 'detail' : 'command'\"\n [columnId]=\"structuralColumnIds[layoutColumn.kind]\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n [section]=\"'add'\"></td>\n }\n }\n}\n" }]
|
|
442
|
+
}] });
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* The expanded master-detail row below a data row. Leading layout columns get empty indent cells,
|
|
446
|
+
* and the detail template spans the user columns.
|
|
447
|
+
*/
|
|
448
|
+
class GridDetailRowComponent {
|
|
449
|
+
constructor() {
|
|
450
|
+
this.contentColspan = computed(() => Math.max(this.gridService.visibleColumns().length, 1), /* @ts-ignore */
|
|
451
|
+
...(ngDevMode ? [{ debugName: "contentColspan" }] : /* istanbul ignore next */ []));
|
|
452
|
+
this.gridService = inject(GridService);
|
|
453
|
+
this.grouped = computed(() => this.gridService.groupColumns().length !== 0, /* @ts-ignore */
|
|
454
|
+
...(ngDevMode ? [{ debugName: "grouped" }] : /* istanbul ignore next */ []));
|
|
455
|
+
this.row = input.required(/* @ts-ignore */
|
|
456
|
+
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
457
|
+
}
|
|
458
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
459
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridDetailRowComponent, isStandalone: true, selector: "tr[monaGridDetailRow]", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, properties: { "style.width.px": "gridService.masterDetailRowWidth()" } }, ngImport: i0, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [groupIndent]=\"grouped()\"></td>\n } @else if (layoutColumn.kind !== \"column\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\"></td>\n }\n}\n<td monaGridCell [lastInRow]=\"true\" [attr.colspan]=\"contentColspan()\">\n <ng-container\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: row().data }\" />\n</td>\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
460
|
+
}
|
|
461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowComponent, decorators: [{
|
|
462
|
+
type: Component,
|
|
463
|
+
args: [{ selector: "tr[monaGridDetailRow]", changeDetection: ChangeDetectionStrategy.OnPush, imports: [GridCellDirective, GridLockedCellDirective, NgTemplateOutlet], host: {
|
|
464
|
+
role: "row",
|
|
465
|
+
"[style.width.px]": "gridService.masterDetailRowWidth()"
|
|
466
|
+
}, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [groupIndent]=\"grouped()\"></td>\n } @else if (layoutColumn.kind !== \"column\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\"></td>\n }\n}\n<td monaGridCell [lastInRow]=\"true\" [attr.colspan]=\"contentColspan()\">\n <ng-container\n [ngTemplateOutlet]=\"gridService.masterDetailTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: row().data }\" />\n</td>\n" }]
|
|
467
|
+
}], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
468
|
+
|
|
469
|
+
class GridToggleComponent {
|
|
470
|
+
constructor() {
|
|
471
|
+
this.collapseIcon = computed(() => {
|
|
472
|
+
const type = this.type();
|
|
473
|
+
return type === "detail" ? LucideMinus : LucideChevronDown;
|
|
474
|
+
}, /* @ts-ignore */
|
|
475
|
+
...(ngDevMode ? [{ debugName: "collapseIcon" }] : /* istanbul ignore next */ []));
|
|
476
|
+
this.expandIcon = computed(() => {
|
|
477
|
+
const type = this.type();
|
|
478
|
+
return type === "detail" ? LucidePlus : LucideChevronRight;
|
|
479
|
+
}, /* @ts-ignore */
|
|
480
|
+
...(ngDevMode ? [{ debugName: "expandIcon" }] : /* istanbul ignore next */ []));
|
|
481
|
+
this.expanded = model.required(/* @ts-ignore */
|
|
482
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
483
|
+
this.type = input.required(/* @ts-ignore */
|
|
484
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
485
|
+
this.width = input.required(/* @ts-ignore */
|
|
486
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
487
|
+
}
|
|
488
|
+
onToggleDetailClick(event) {
|
|
489
|
+
event.stopPropagation();
|
|
490
|
+
this.expanded.update(v => !v);
|
|
491
|
+
}
|
|
492
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
493
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridToggleComponent, isStandalone: true, selector: "mona-grid-toggle", inputs: { expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { expanded: "expandedChange" }, ngImport: i0, template: "<span\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\n }\n</span>\n", dependencies: [{ kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
494
|
+
}
|
|
495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, decorators: [{
|
|
496
|
+
type: Component,
|
|
497
|
+
args: [{ selector: "mona-grid-toggle", imports: [LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n [style.width.px]=\"width()\"\n class=\"inline-flex items-center justify-center min-h-9 aspect-square\"\n (click)=\"onToggleDetailClick($event)\">\n @if (expanded()) {\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\n } @else {\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\n }\n</span>\n" }]
|
|
498
|
+
}], propDecorators: { expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: true }] }, { type: i0.Output, args: ["expandedChange"] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: true }] }] } });
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* A group header row. It indents by the group depth, and its title cell spans the remaining columns.
|
|
502
|
+
*/
|
|
503
|
+
class GridGroupRowComponent {
|
|
504
|
+
constructor() {
|
|
505
|
+
this.collapsed = computed(() => this.gridService.isGroupCollapsed(this.group().groupKey), /* @ts-ignore */
|
|
506
|
+
...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
|
|
507
|
+
this.gridService = inject(GridService);
|
|
508
|
+
this.indentColumns = computed(() => this.gridService.layout().filter(column => column.kind === "group" && column.depth < this.group().depth), /* @ts-ignore */
|
|
509
|
+
...(ngDevMode ? [{ debugName: "indentColumns" }] : /* istanbul ignore next */ []));
|
|
510
|
+
this.rowClass = computed(() => gridGroupRowThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled }), /* @ts-ignore */
|
|
511
|
+
...(ngDevMode ? [{ debugName: "rowClass" }] : /* istanbul ignore next */ []));
|
|
512
|
+
this.titleClass = computed(() => this.gridService.virtualScrollOptions().enabled
|
|
513
|
+
? "absolute inset-0 flex items-center text-sm whitespace-nowrap overflow-hidden"
|
|
514
|
+
: "flex min-h-9 items-center text-sm whitespace-nowrap", /* @ts-ignore */
|
|
515
|
+
...(ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []));
|
|
516
|
+
// Everything after the indents and the reorder placeholder.
|
|
517
|
+
this.titleColspan = computed(() => this.gridService.layout().length - this.group().depth - (this.gridService.rowReorderColumnVisible() ? 1 : 0), /* @ts-ignore */
|
|
518
|
+
...(ngDevMode ? [{ debugName: "titleColspan" }] : /* istanbul ignore next */ []));
|
|
519
|
+
this.group = input.required(/* @ts-ignore */
|
|
520
|
+
...(ngDevMode ? [{ debugName: "group" }] : /* istanbul ignore next */ []));
|
|
521
|
+
/** The index of this row among the rendered body rows. */
|
|
522
|
+
this.rowIndex = input.required(/* @ts-ignore */
|
|
523
|
+
...(ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []));
|
|
524
|
+
}
|
|
525
|
+
toggle() {
|
|
526
|
+
this.gridService.toggleGroupCollapse(this.group().groupKey);
|
|
527
|
+
}
|
|
528
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridGroupRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
529
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridGroupRowComponent, isStandalone: true, selector: "tr[monaGridGroupRow]", inputs: { group: { classPropertyName: "group", publicName: "group", isSignal: true, isRequired: true, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, properties: { "class": "rowClass()", "attr.aria-level": "group().depth + 1", "attr.aria-expanded": "!collapsed()" } }, ngImport: i0, template: "@for (layoutColumn of indentColumns(); track layoutColumn.key) {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n}\n@if (gridService.rowReorderColumnVisible()) {\n <!-- Sits right after the indents, so it pins like the group column at this depth. -->\n <td\n monaGridCell\n [monaGridLockedCell]=\"'group:' + group().depth\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n}\n<td\n monaGridCell\n monaGridLogicalCell\n [cellKind]=\"'group'\"\n [rowIndex]=\"rowIndex()\"\n [colIndex]=\"0\"\n [section]=\"'body'\"\n [groupHeader]=\"true\"\n [firstInRow]=\"true\"\n [lastInRow]=\"gridService.visibleColumns().length === 0\"\n [groupKey]=\"group().groupKey\"\n [attr.colspan]=\"titleColspan()\"\n (toggleExpand)=\"toggle()\">\n <p [class]=\"titleClass()\">\n <mona-grid-toggle\n [expanded]=\"!collapsed()\"\n [width]=\"gridService.groupColumnWidth\"\n [type]=\"'group'\"\n (expandedChange)=\"toggle()\" />\n <span class=\"font-bold\">{{ group().title }}: {{ group().groupValue }}</span>\n </p>\n</td>\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["cellKind", "colIndex", "columnId", "editable", "firstInRow", "groupHeader", "groupKey", "lastInRow", "rowIndex", "rowUid", "section"], outputs: ["edit", "toggleExpand"] }, { kind: "component", type: GridToggleComponent, selector: "mona-grid-toggle", inputs: ["expanded", "type", "width"], outputs: ["expandedChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
530
|
+
}
|
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridGroupRowComponent, decorators: [{
|
|
532
|
+
type: Component,
|
|
533
|
+
args: [{ selector: "tr[monaGridGroupRow]", changeDetection: ChangeDetectionStrategy.OnPush, imports: [GridCellDirective, GridLockedCellDirective, GridLogicalCellDirective, GridToggleComponent], host: {
|
|
534
|
+
"[class]": "rowClass()",
|
|
535
|
+
role: "row",
|
|
536
|
+
"[attr.aria-level]": "group().depth + 1",
|
|
537
|
+
"[attr.aria-expanded]": "!collapsed()"
|
|
538
|
+
}, template: "@for (layoutColumn of indentColumns(); track layoutColumn.key) {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n}\n@if (gridService.rowReorderColumnVisible()) {\n <!-- Sits right after the indents, so it pins like the group column at this depth. -->\n <td\n monaGridCell\n [monaGridLockedCell]=\"'group:' + group().depth\"\n [lockedCellHeader]=\"true\"\n [groupIndent]=\"true\"></td>\n}\n<td\n monaGridCell\n monaGridLogicalCell\n [cellKind]=\"'group'\"\n [rowIndex]=\"rowIndex()\"\n [colIndex]=\"0\"\n [section]=\"'body'\"\n [groupHeader]=\"true\"\n [firstInRow]=\"true\"\n [lastInRow]=\"gridService.visibleColumns().length === 0\"\n [groupKey]=\"group().groupKey\"\n [attr.colspan]=\"titleColspan()\"\n (toggleExpand)=\"toggle()\">\n <p [class]=\"titleClass()\">\n <mona-grid-toggle\n [expanded]=\"!collapsed()\"\n [width]=\"gridService.groupColumnWidth\"\n [type]=\"'group'\"\n (expandedChange)=\"toggle()\" />\n <span class=\"font-bold\">{{ group().title }}: {{ group().groupValue }}</span>\n </p>\n</td>\n" }]
|
|
539
|
+
}], propDecorators: { group: [{ type: i0.Input, args: [{ isSignal: true, alias: "group", required: true }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowIndex", required: true }] }] } });
|
|
580
540
|
|
|
581
541
|
const FOCUSABLE_TARGET_SELECTOR = "button, input, select, textarea, a[href], [tabindex]";
|
|
582
542
|
class GridCellComponent {
|
|
@@ -779,6 +739,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
779
739
|
class GridRowReorderHandleComponent {
|
|
780
740
|
constructor() {
|
|
781
741
|
this.#gridService = inject(GridService);
|
|
742
|
+
this.#hostElement = inject(ElementRef).nativeElement;
|
|
743
|
+
this.#injector = inject(Injector);
|
|
782
744
|
this.#liveAnnouncer = inject(LiveAnnouncer);
|
|
783
745
|
this.ariaLabel = computed(() => {
|
|
784
746
|
const absoluteIndex = this.pageIndex() + this.#gridService.paginationState().skip;
|
|
@@ -815,8 +777,7 @@ class GridRowReorderHandleComponent {
|
|
|
815
777
|
}
|
|
816
778
|
}, /* @ts-ignore */
|
|
817
779
|
...(ngDevMode ? [{ debugName: "disabledReasonText" }] : /* istanbul ignore next */ []));
|
|
818
|
-
this.handleClass =
|
|
819
|
-
...(ngDevMode ? [{ debugName: "handleClass" }] : /* istanbul ignore next */ []));
|
|
780
|
+
this.handleClass = gridRowReorderHandleThemeVariants();
|
|
820
781
|
/**
|
|
821
782
|
* @description The row's position within the current page, used to move the row and derive its accessible label.
|
|
822
783
|
*/
|
|
@@ -829,6 +790,8 @@ class GridRowReorderHandleComponent {
|
|
|
829
790
|
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
830
791
|
}
|
|
831
792
|
#gridService;
|
|
793
|
+
#hostElement;
|
|
794
|
+
#injector;
|
|
832
795
|
#liveAnnouncer;
|
|
833
796
|
onKeydown(event) {
|
|
834
797
|
if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || !event.altKey) {
|
|
@@ -843,6 +806,15 @@ class GridRowReorderHandleComponent {
|
|
|
843
806
|
}
|
|
844
807
|
const moved = this.#gridService.requestRowReorder(this.row(), this.pageIndex(), targetIndex);
|
|
845
808
|
if (moved) {
|
|
809
|
+
// Re-rendering the new order moves this row in the DOM, which drops focus. Keep it so the row can move again.
|
|
810
|
+
afterNextRender({
|
|
811
|
+
write: () => {
|
|
812
|
+
const button = this.#hostElement.querySelector("button");
|
|
813
|
+
if (button != null && this.#hostElement.ownerDocument.activeElement !== button) {
|
|
814
|
+
button.focus();
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}, { injector: this.#injector });
|
|
846
818
|
const skip = this.#gridService.paginationState().skip;
|
|
847
819
|
const fromRowNumber = skip + this.pageIndex() + 1;
|
|
848
820
|
const toPosition = skip + targetIndex + 1;
|
|
@@ -850,7 +822,7 @@ class GridRowReorderHandleComponent {
|
|
|
850
822
|
}
|
|
851
823
|
}
|
|
852
824
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
853
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: GridRowReorderHandleComponent, isStandalone: true, selector: "mona-grid-row-reorder-handle", inputs: { pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()", "contextmenu": "$event.stopPropagation()", "dblclick": "$event.stopPropagation()" } }, ngImport: i0, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass
|
|
825
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: GridRowReorderHandleComponent, isStandalone: true, selector: "mona-grid-row-reorder-handle", inputs: { pageIndex: { classPropertyName: "pageIndex", publicName: "pageIndex", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()", "contextmenu": "$event.stopPropagation()", "dblclick": "$event.stopPropagation()" } }, ngImport: i0, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass\"\n [disabled]=\"disabled()\"\n [attr.title]=\"disabledReasonText()\"\n [attr.aria-label]=\"ariaLabel()\"\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n (keydown)=\"onKeydown($event)\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n", dependencies: [{ kind: "component", type: LucideGripVertical, selector: "svg[lucideGripVertical]" }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }] }); }
|
|
854
826
|
}
|
|
855
827
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, decorators: [{
|
|
856
828
|
type: Component,
|
|
@@ -858,7 +830,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
858
830
|
"(click)": "$event.stopPropagation()",
|
|
859
831
|
"(contextmenu)": "$event.stopPropagation()",
|
|
860
832
|
"(dblclick)": "$event.stopPropagation()"
|
|
861
|
-
}, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass
|
|
833
|
+
}, template: "<button\n type=\"button\"\n cdkDragHandle\n [class]=\"handleClass\"\n [disabled]=\"disabled()\"\n [attr.title]=\"disabledReasonText()\"\n [attr.aria-label]=\"ariaLabel()\"\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n (keydown)=\"onKeydown($event)\">\n <svg lucideGripVertical [size]=\"16\" aria-hidden=\"true\"></svg>\n</button>\n" }]
|
|
862
834
|
}], propDecorators: { pageIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageIndex", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
863
835
|
|
|
864
836
|
class GridSelectionCheckboxComponent {
|
|
@@ -902,36 +874,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
902
874
|
}, template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n" }]
|
|
903
875
|
}], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowIndex", required: true }] }] } });
|
|
904
876
|
|
|
905
|
-
|
|
877
|
+
/** A data row of the grid body, with one cell per layout column. */
|
|
878
|
+
class GridRowComponent {
|
|
906
879
|
constructor() {
|
|
907
|
-
this.
|
|
908
|
-
|
|
909
|
-
|
|
880
|
+
this.ariaRowIndex = computed(() => this.index() + this.gridService.paginationState().skip + 2, /* @ts-ignore */
|
|
881
|
+
...(ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []));
|
|
882
|
+
this.baseClass = computed(() => {
|
|
883
|
+
const variantClass = gridListTableRowThemeVariants({
|
|
884
|
+
selected: this.selected(),
|
|
885
|
+
virtual: this.gridService.virtualScrollOptions().enabled
|
|
886
|
+
});
|
|
887
|
+
const userClass = this.gridService.rowClass()?.(this.row().data);
|
|
888
|
+
return twMerge(variantClass, typeof userClass === "string" ? userClass : userClass?.join(" "));
|
|
910
889
|
}, /* @ts-ignore */
|
|
911
|
-
...(ngDevMode ? [{ debugName: "
|
|
912
|
-
this.
|
|
913
|
-
const
|
|
914
|
-
return
|
|
890
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
891
|
+
this.cellEditMode = computed(() => {
|
|
892
|
+
const options = this.gridService.editableOptions();
|
|
893
|
+
return options.enabled === true && options.mode === "cell";
|
|
915
894
|
}, /* @ts-ignore */
|
|
916
|
-
...(ngDevMode ? [{ debugName: "
|
|
917
|
-
this.
|
|
895
|
+
...(ngDevMode ? [{ debugName: "cellEditMode" }] : /* istanbul ignore next */ []));
|
|
896
|
+
this.detailToggleClass = computed(() => this.gridService.virtualScrollOptions().enabled
|
|
897
|
+
? "flex h-full w-full items-stretch justify-center"
|
|
898
|
+
: "flex min-h-9 w-full items-center justify-center", /* @ts-ignore */
|
|
899
|
+
...(ngDevMode ? [{ debugName: "detailToggleClass" }] : /* istanbul ignore next */ []));
|
|
900
|
+
this.gridService = inject(GridService);
|
|
901
|
+
this.hostElement = inject(ElementRef).nativeElement;
|
|
902
|
+
this.selectable = computed(() => this.gridService.selectableOptions().enabled, /* @ts-ignore */
|
|
903
|
+
...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
|
|
904
|
+
this.expanded = computed(() => this.gridService.isRowExpanded(this.row()), /* @ts-ignore */
|
|
918
905
|
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
919
|
-
this
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
906
|
+
/** The index of this row among the rendered body rows. */
|
|
907
|
+
this.index = input.required(/* @ts-ignore */
|
|
908
|
+
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
909
|
+
this.row = input.required(/* @ts-ignore */
|
|
910
|
+
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
911
|
+
this.selected = computed(() => this.gridService.isRowSelected(this.row()), /* @ts-ignore */
|
|
912
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
923
913
|
}
|
|
924
|
-
|
|
925
|
-
event.
|
|
926
|
-
this.expanded.update(v => !v);
|
|
914
|
+
onClick(event) {
|
|
915
|
+
this.gridService.handleRowClick(event, this.row());
|
|
927
916
|
}
|
|
928
|
-
|
|
929
|
-
|
|
917
|
+
toggleDetail() {
|
|
918
|
+
this.gridService.setRowExpanded(this.row(), !this.expanded());
|
|
919
|
+
}
|
|
920
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
921
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridRowComponent, isStandalone: true, selector: "tr[monaGridRow]", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, listeners: { "click": "onClick($event)" }, properties: { "class": "baseClass()", "attr.data-ruid": "row().uid", "attr.data-row-view-index": "index()", "attr.aria-selected": "selectable() ? selected() : null", "attr.aria-rowindex": "ariaRowIndex()" } }, exportAs: ["monaGridRow"], ngImport: i0, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (edit)=\"gridCell.handleLogicalCellEnter()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"hostElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n", dependencies: [{ kind: "component", type: ContextMenuComponent, selector: "mona-contextmenu", inputs: ["ariaLabel", "items", "minWidth", "rounded", "size", "target", "width"], outputs: ["menuClick"] }, { kind: "component", type: GridCellComponent, selector: "mona-grid-cell", inputs: ["column", "row"] }, { kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["groupHeader", "groupIndent", "lastInRow"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["monaGridLockedCell", "lockedCellHeader"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["cellKind", "colIndex", "columnId", "editable", "firstInRow", "groupHeader", "groupKey", "lastInRow", "rowIndex", "rowUid", "section"], outputs: ["edit", "toggleExpand"] }, { kind: "component", type: GridRowReorderHandleComponent, selector: "mona-grid-row-reorder-handle", inputs: ["pageIndex", "row"] }, { kind: "component", type: GridSelectionCheckboxComponent, selector: "mona-grid-selection-checkbox", inputs: ["row", "rowIndex"] }, { kind: "component", type: GridToggleComponent, selector: "mona-grid-toggle", inputs: ["expanded", "type", "width"], outputs: ["expandedChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
930
922
|
}
|
|
931
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type:
|
|
923
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowComponent, decorators: [{
|
|
932
924
|
type: Component,
|
|
933
|
-
args: [{ selector: "
|
|
934
|
-
|
|
925
|
+
args: [{ selector: "tr[monaGridRow]", exportAs: "monaGridRow", changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
926
|
+
ContextMenuComponent,
|
|
927
|
+
GridCellComponent,
|
|
928
|
+
GridCellDirective,
|
|
929
|
+
GridLockedCellDirective,
|
|
930
|
+
GridLogicalCellDirective,
|
|
931
|
+
GridRowReorderHandleComponent,
|
|
932
|
+
GridSelectionCheckboxComponent,
|
|
933
|
+
GridToggleComponent
|
|
934
|
+
], host: {
|
|
935
|
+
"[class]": "baseClass()",
|
|
936
|
+
"[attr.data-ruid]": "row().uid",
|
|
937
|
+
"[attr.data-row-view-index]": "index()",
|
|
938
|
+
role: "row",
|
|
939
|
+
"[attr.aria-selected]": "selectable() ? selected() : null",
|
|
940
|
+
"[attr.aria-rowindex]": "ariaRowIndex()",
|
|
941
|
+
"(click)": "onClick($event)"
|
|
942
|
+
}, template: "@for (layoutColumn of gridService.layout(); track layoutColumn.key) {\n @if (layoutColumn.kind === \"column\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"layoutColumn.column.kind\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [columnId]=\"layoutColumn.column.id\"\n [editable]=\"cellEditMode() && layoutColumn.column.kind === 'data' && layoutColumn.column.editable === true\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (edit)=\"gridCell.handleLogicalCellEnter()\">\n <mona-grid-cell #gridCell [column]=\"layoutColumn.column\" [row]=\"row()\" />\n </td>\n } @else if (layoutColumn.kind === \"group\") {\n <td monaGridCell [monaGridLockedCell]=\"layoutColumn.key\" [lockedCellHeader]=\"true\" [groupIndent]=\"true\"></td>\n } @else if (layoutColumn.kind === \"reorder\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$rowReorder'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-row-reorder-handle [row]=\"row()\" [pageIndex]=\"index()\" />\n </td>\n } @else if (layoutColumn.kind === \"detail\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'detail'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\"\n (toggleExpand)=\"toggleDetail()\">\n <span [class]=\"detailToggleClass()\">\n <mona-grid-toggle\n [expanded]=\"expanded()\"\n [type]=\"'detail'\"\n [width]=\"gridService.detailColumnWidth\"\n (expandedChange)=\"toggleDetail()\" />\n </span>\n </td>\n } @else if (layoutColumn.kind === \"selection\") {\n <td\n monaGridCell\n [monaGridLockedCell]=\"layoutColumn.key\"\n monaGridLogicalCell\n [cellKind]=\"'command'\"\n [columnId]=\"'$selection'\"\n [colIndex]=\"layoutColumn.logicalIndex\"\n [rowIndex]=\"index()\"\n [rowUid]=\"row().uid\"\n [section]=\"'body'\"\n [firstInRow]=\"layoutColumn.firstInRow\"\n [lastInRow]=\"layoutColumn.lastInRow\">\n <mona-grid-selection-checkbox [row]=\"row()\" [rowIndex]=\"index()\" />\n </td>\n }\n}\n@if (gridService.contextMenuItems().length !== 0) {\n <mona-contextmenu [target]=\"hostElement\" [items]=\"gridService.contextMenuItems()\" />\n}\n" }]
|
|
943
|
+
}], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
935
944
|
|
|
936
|
-
export { GridAddRowComponent as G,
|
|
937
|
-
//# sourceMappingURL=nanahoshi-mona-ui-grid-grid-
|
|
945
|
+
export { GridAddRowComponent as G, GridDetailRowComponent as a, GridGroupRowComponent as b, GridRowComponent as c };
|
|
946
|
+
//# sourceMappingURL=nanahoshi-mona-ui-grid-grid-row.component-Dwy8hCm7.mjs.map
|