@nanahoshi/mona-ui 0.24.6 → 0.24.8
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-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +14 -4
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +233 -231
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs} +24 -12
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs +208 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs +1100 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs} +34 -21
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs} +2565 -928
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +79 -11
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +28 -2
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -74
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +69 -11
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +62 -11
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +78 -11
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +58 -11
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +367 -463
- package/fesm2022/nanahoshi-mona-ui-query.mjs +317 -122
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
- package/i18n/catalogs/en-US.messages.json +64 -17
- package/locales/ar-sa/ar-sa.messages.json +58 -11
- package/locales/de-de/de-de.messages.json +58 -11
- package/locales/es-es/es-es.messages.json +58 -11
- package/locales/fr-fr/fr-fr.messages.json +58 -11
- package/locales/id-id/id-id.messages.json +58 -11
- package/locales/it-it/it-it.messages.json +58 -11
- package/locales/ja-jp/ja-jp.messages.json +58 -11
- package/locales/ko-kr/ko-kr.messages.json +58 -11
- package/locales/pt-br/pt-br.messages.json +58 -11
- package/locales/ru-ru/ru-ru.messages.json +58 -11
- package/locales/tr-tr/tr-tr.messages.json +58 -11
- package/locales/zh-cn/zh-cn.messages.json +58 -11
- package/locales/zh-tw/zh-tw.messages.json +58 -11
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-check-box.d.ts +11 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +54 -32
- package/types/nanahoshi-mona-ui-grid.d.ts +359 -110
- package/types/nanahoshi-mona-ui-i18n.d.ts +97 -6
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
- package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
- package/types/nanahoshi-mona-ui-internal.d.ts +10 -2
- package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
- package/types/nanahoshi-mona-ui-list-view.d.ts +111 -21
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +53 -6
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +53 -6
- package/types/nanahoshi-mona-ui-pager.d.ts +159 -76
- package/types/nanahoshi-mona-ui-query.d.ts +45 -14
- package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs +0 -176
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs +0 -946
|
@@ -1,946 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
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-BvUM9nPt.mjs';
|
|
4
|
-
import { NgTemplateOutlet, formatDate } from '@angular/common';
|
|
5
|
-
import { ContextMenuComponent } from '@nanahoshi/mona-ui/contextmenu';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as i1 from '@angular/cdk/a11y';
|
|
8
|
-
import { A11yModule, LiveAnnouncer } from '@angular/cdk/a11y';
|
|
9
|
-
import { LucideCheck, LucideOctagonAlert, LucideX, LucidePencil, LucideTrash2, LucideMinus, LucideChevronDown, LucidePlus, LucideChevronRight, LucideDynamicIcon, LucideGripVertical } from '@lucide/angular';
|
|
10
|
-
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
11
|
-
import { DialogService } from '@nanahoshi/mona-ui/dialog';
|
|
12
|
-
import { TooltipComponent } from '@nanahoshi/mona-ui/tooltip';
|
|
13
|
-
import { take } from 'rxjs';
|
|
14
|
-
import { FormField } from '@angular/forms/signals';
|
|
15
|
-
import { CheckBoxComponent } from '@nanahoshi/mona-ui/check-box';
|
|
16
|
-
import { DatePickerComponent } from '@nanahoshi/mona-ui/date-picker';
|
|
17
|
-
import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
|
|
18
|
-
import { TextBoxComponent } from '@nanahoshi/mona-ui/text-box';
|
|
19
|
-
import { CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
20
|
-
|
|
21
|
-
class GridCellDirective {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.#gridService = inject(GridService, { optional: true });
|
|
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 */
|
|
29
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
30
|
-
/** Marks a group header title cell. It spans to the end of the row, so it draws no end border. */
|
|
31
|
-
this.groupHeader = input(false, /* @ts-ignore */
|
|
32
|
-
...(ngDevMode ? [{ debugName: "groupHeader" }] : /* 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 */ []));
|
|
36
|
-
this.lastInRow = input(false, /* @ts-ignore */
|
|
37
|
-
...(ngDevMode ? [{ debugName: "lastInRow" }] : /* istanbul ignore next */ []));
|
|
38
|
-
}
|
|
39
|
-
#gridService;
|
|
40
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
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 }); }
|
|
42
|
-
}
|
|
43
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, decorators: [{
|
|
44
|
-
type: Directive,
|
|
45
|
-
args: [{
|
|
46
|
-
selector: "td[monaGridCell]",
|
|
47
|
-
host: {
|
|
48
|
-
"[class]": "baseClass()",
|
|
49
|
-
role: "gridcell"
|
|
50
|
-
}
|
|
51
|
-
}]
|
|
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 }] }] } });
|
|
53
|
-
|
|
54
|
-
class GridCommandCellComponent {
|
|
55
|
-
constructor() {
|
|
56
|
-
this.#dialogService = inject(DialogService);
|
|
57
|
-
this.canEditRows = computed(() => {
|
|
58
|
-
const editableOptions = this.gridService.editableOptions();
|
|
59
|
-
return editableOptions.enabled === true && editableOptions.mode === "row";
|
|
60
|
-
}, /* @ts-ignore */
|
|
61
|
-
...(ngDevMode ? [{ debugName: "canEditRows" }] : /* istanbul ignore next */ []));
|
|
62
|
-
this.commandContext = computed(() => ({
|
|
63
|
-
$implicit: this.row()?.data ?? this.gridService.addRowData(),
|
|
64
|
-
cancel: (event) => this.cancel(event),
|
|
65
|
-
edit: (event) => this.edit(event),
|
|
66
|
-
isEditing: this.isEditing(),
|
|
67
|
-
isNew: this.newRow(),
|
|
68
|
-
remove: (event) => this.remove(event),
|
|
69
|
-
row: this.row(),
|
|
70
|
-
rowData: this.row()?.data ?? this.gridService.addRowData(),
|
|
71
|
-
save: (event) => this.save(event)
|
|
72
|
-
}), /* @ts-ignore */
|
|
73
|
-
...(ngDevMode ? [{ debugName: "commandContext" }] : /* istanbul ignore next */ []));
|
|
74
|
-
this.gridService = inject(GridService);
|
|
75
|
-
this.hasRowError = computed(() => this.rowErrorMessages().length > 0, /* @ts-ignore */
|
|
76
|
-
...(ngDevMode ? [{ debugName: "hasRowError" }] : /* istanbul ignore next */ []));
|
|
77
|
-
this.isEditing = computed(() => {
|
|
78
|
-
const row = this.row();
|
|
79
|
-
const context = this.gridService.editContext();
|
|
80
|
-
return this.newRow() || (row != null && context?.mode === "row" && context.rowUid === row.uid);
|
|
81
|
-
}, /* @ts-ignore */
|
|
82
|
-
...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
|
|
83
|
-
this.messages = computed(() => this.gridService.messages(), /* @ts-ignore */
|
|
84
|
-
...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
|
|
85
|
-
this.rowErrorMessages = computed(() => {
|
|
86
|
-
if (!this.isEditing()) {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
const session = this.gridService.editSession();
|
|
90
|
-
if (session == null) {
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
return session
|
|
94
|
-
.form()
|
|
95
|
-
.errorSummary()
|
|
96
|
-
.map(error => error.message)
|
|
97
|
-
.filter((message) => !!message);
|
|
98
|
-
}, /* @ts-ignore */
|
|
99
|
-
...(ngDevMode ? [{ debugName: "rowErrorMessages" }] : /* istanbul ignore next */ []));
|
|
100
|
-
this.rowErrorTooltip = computed(() => this.rowErrorMessages().join("\n") || this.messages().rowValidationError, /* @ts-ignore */
|
|
101
|
-
...(ngDevMode ? [{ debugName: "rowErrorTooltip" }] : /* istanbul ignore next */ []));
|
|
102
|
-
this.column = input.required(/* @ts-ignore */
|
|
103
|
-
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
104
|
-
this.newRow = input(false, /* @ts-ignore */
|
|
105
|
-
...(ngDevMode ? [{ debugName: "newRow" }] : /* istanbul ignore next */ []));
|
|
106
|
-
this.row = input(null, /* @ts-ignore */
|
|
107
|
-
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
108
|
-
}
|
|
109
|
-
#dialogService;
|
|
110
|
-
cancel(event) {
|
|
111
|
-
event?.stopPropagation();
|
|
112
|
-
if (this.newRow()) {
|
|
113
|
-
this.gridService.cancelAddRow(event);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
this.gridService.cancelEdit(event);
|
|
117
|
-
}
|
|
118
|
-
edit(event) {
|
|
119
|
-
event?.stopPropagation();
|
|
120
|
-
if (!this.canEditRows()) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const row = this.row();
|
|
124
|
-
if (row != null) {
|
|
125
|
-
this.gridService.startRowEdit(row, event);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
remove(event) {
|
|
129
|
-
event?.stopPropagation();
|
|
130
|
-
const row = this.row();
|
|
131
|
-
if (row == null) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (!this.column().removeConfirmation) {
|
|
135
|
-
this.gridService.removeRow(row, event);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const dialogRef = this.#dialogService.show({
|
|
139
|
-
actions: [
|
|
140
|
-
{ look: "error", text: this.messages().delete },
|
|
141
|
-
{ look: "default", text: this.messages().cancel }
|
|
142
|
-
],
|
|
143
|
-
closeOnEscape: true,
|
|
144
|
-
text: this.messages().deleteRowConfirmation,
|
|
145
|
-
title: this.messages().deleteRowTitle,
|
|
146
|
-
type: "warning",
|
|
147
|
-
modal: true,
|
|
148
|
-
width: 360
|
|
149
|
-
});
|
|
150
|
-
dialogRef.result.pipe(take(1)).subscribe(result => {
|
|
151
|
-
if (!result.viaClose && result.action.text === this.messages().delete) {
|
|
152
|
-
this.gridService.removeRow(row, event);
|
|
153
|
-
}
|
|
154
|
-
dialogRef.close();
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
save(event) {
|
|
158
|
-
event?.stopPropagation();
|
|
159
|
-
if (this.newRow()) {
|
|
160
|
-
this.gridService.saveAddRow(event);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
this.gridService.commitRowEdit(event);
|
|
164
|
-
}
|
|
165
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
166
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridCommandCellComponent, isStandalone: true, selector: "mona-grid-command-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, newRow: { classPropertyName: "newRow", publicName: "newRow", isSignal: true, isRequired: false, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center w-full min-h-9" }, ngImport: i0, template: "@if (column().commandTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().commandTemplate\"\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\n} @else {\n <div class=\"flex min-h-9 items-center gap-1 px-1\">\n @if (isEditing()) {\n @if (hasRowError()) {\n <span class=\"shrink-0 px-1 text-error\" #rowErrorIcon>\n <svg lucideOctagonAlert [size]=\"14\"></svg>\n </span>\n <mona-tooltip [target]=\"rowErrorIcon\">\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\n </mona-tooltip>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().saveRow\"\n [attr.title]=\"messages().save\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"save($event)\">\n <svg lucideCheck [size]=\"14\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().cancelRowEdit\"\n [attr.title]=\"messages().cancel\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"cancel($event)\">\n <svg lucideX [size]=\"14\"></svg>\n </button>\n } @else {\n @if (canEditRows()) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().editRow\"\n [attr.title]=\"messages().edit\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"edit($event)\">\n <svg lucidePencil [size]=\"14\"></svg>\n </button>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().removeRow\"\n [attr.title]=\"messages().remove\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"remove($event)\">\n <svg lucideTrash2 [size]=\"14\"></svg>\n </button>\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCheck, selector: "svg[lucideCheck]" }, { kind: "component", type: LucideOctagonAlert, selector: "svg[lucideOctagonAlert], svg[lucideAlertOctagon]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucidePencil, selector: "svg[lucidePencil]" }, { kind: "component", type: LucideTrash2, selector: "svg[lucideTrash2]" }, { kind: "component", type: TooltipComponent, selector: "mona-tooltip", inputs: ["disabled", "hideDelay", "position", "rounded", "showDelay", "target"], outputs: ["hidden", "shown"] }] }); }
|
|
167
|
-
}
|
|
168
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, decorators: [{
|
|
169
|
-
type: Component,
|
|
170
|
-
args: [{ selector: "mona-grid-command-cell", imports: [
|
|
171
|
-
ButtonDirective,
|
|
172
|
-
NgTemplateOutlet,
|
|
173
|
-
LucideCheck,
|
|
174
|
-
LucideOctagonAlert,
|
|
175
|
-
LucideX,
|
|
176
|
-
LucidePencil,
|
|
177
|
-
LucideTrash2,
|
|
178
|
-
TooltipComponent
|
|
179
|
-
], host: {
|
|
180
|
-
class: "flex items-center w-full min-h-9"
|
|
181
|
-
}, template: "@if (column().commandTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().commandTemplate\"\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\n} @else {\n <div class=\"flex min-h-9 items-center gap-1 px-1\">\n @if (isEditing()) {\n @if (hasRowError()) {\n <span class=\"shrink-0 px-1 text-error\" #rowErrorIcon>\n <svg lucideOctagonAlert [size]=\"14\"></svg>\n </span>\n <mona-tooltip [target]=\"rowErrorIcon\">\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\n </mona-tooltip>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().saveRow\"\n [attr.title]=\"messages().save\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"save($event)\">\n <svg lucideCheck [size]=\"14\"></svg>\n </button>\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().cancelRowEdit\"\n [attr.title]=\"messages().cancel\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"cancel($event)\">\n <svg lucideX [size]=\"14\"></svg>\n </button>\n } @else {\n @if (canEditRows()) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().editRow\"\n [attr.title]=\"messages().edit\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"edit($event)\">\n <svg lucidePencil [size]=\"14\"></svg>\n </button>\n }\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().removeRow\"\n [attr.title]=\"messages().remove\"\n class=\"w-6 h-6\"\n [tabindex]=\"-1\"\n (click)=\"remove($event)\">\n <svg lucideTrash2 [size]=\"14\"></svg>\n </button>\n }\n </div>\n}\n" }]
|
|
182
|
-
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], newRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "newRow", required: false }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: false }] }] } });
|
|
183
|
-
|
|
184
|
-
const FOCUSABLE_TARGET_SELECTOR$1 = "button, input, select, textarea, a[href], [tabindex]";
|
|
185
|
-
class GridEditorComponent {
|
|
186
|
-
#datePopupOpen;
|
|
187
|
-
#elementRef;
|
|
188
|
-
#gridService;
|
|
189
|
-
#ignoreNextBooleanFocusOut;
|
|
190
|
-
constructor() {
|
|
191
|
-
this.#datePopupOpen = signal(false, /* @ts-ignore */
|
|
192
|
-
...(ngDevMode ? [{ debugName: "#datePopupOpen" }] : /* istanbul ignore next */ []));
|
|
193
|
-
this.#elementRef = inject((ElementRef));
|
|
194
|
-
this.#gridService = inject(GridService, { optional: true });
|
|
195
|
-
this.#ignoreNextBooleanFocusOut = false;
|
|
196
|
-
this.numericTextBoxRef = viewChild(NumericTextBoxComponent, /* @ts-ignore */
|
|
197
|
-
...(ngDevMode ? [{ debugName: "numericTextBoxRef" }] : /* istanbul ignore next */ []));
|
|
198
|
-
this.textBoxRef = viewChild(TextBoxComponent, /* @ts-ignore */
|
|
199
|
-
...(ngDevMode ? [{ debugName: "textBoxRef" }] : /* istanbul ignore next */ []));
|
|
200
|
-
this.baseClass = computed(() => {
|
|
201
|
-
return gridCellEditorBaseThemeVariants({ virtual: this.#gridService?.virtualScrollOptions().enabled ?? false });
|
|
202
|
-
}, /* @ts-ignore */
|
|
203
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
204
|
-
this.editTemplateContext = computed(() => ({
|
|
205
|
-
cancel: () => this.cancelEdit.emit(),
|
|
206
|
-
column: this.column().field,
|
|
207
|
-
commit: () => this.commit.emit(),
|
|
208
|
-
dataField: this.column().field,
|
|
209
|
-
dataItem: this.session().model(),
|
|
210
|
-
errors: this.formField()().errors(),
|
|
211
|
-
field: this.formField(),
|
|
212
|
-
form: this.session().form,
|
|
213
|
-
invalid: this.formField()().invalid(),
|
|
214
|
-
isNew: this.isNew(),
|
|
215
|
-
session: this.session(),
|
|
216
|
-
setValue: (value) => this.#setFieldValue(value),
|
|
217
|
-
touched: this.formField()().touched(),
|
|
218
|
-
value: this.formField()().value()
|
|
219
|
-
}), /* @ts-ignore */
|
|
220
|
-
...(ngDevMode ? [{ debugName: "editTemplateContext" }] : /* istanbul ignore next */ []));
|
|
221
|
-
this.editorInputClass = computed(() => {
|
|
222
|
-
return gridCellEditorInputThemeVariants({
|
|
223
|
-
virtual: this.#gridService?.virtualScrollOptions().enabled ?? false
|
|
224
|
-
});
|
|
225
|
-
}, /* @ts-ignore */
|
|
226
|
-
...(ngDevMode ? [{ debugName: "editorInputClass" }] : /* istanbul ignore next */ []));
|
|
227
|
-
this.fieldErrorMessage = computed(() => {
|
|
228
|
-
const [firstError] = this.formField()().errors();
|
|
229
|
-
return firstError?.message ?? this.#gridService?.messages().fieldValidationError ?? "";
|
|
230
|
-
}, /* @ts-ignore */
|
|
231
|
-
...(ngDevMode ? [{ debugName: "fieldErrorMessage" }] : /* istanbul ignore next */ []));
|
|
232
|
-
this.formField = computed(() => {
|
|
233
|
-
const field = this.session().form[this.column().field];
|
|
234
|
-
if (field == null) {
|
|
235
|
-
throw new Error(`No signal form field was found for grid column '${this.column().field}'.`);
|
|
236
|
-
}
|
|
237
|
-
return field;
|
|
238
|
-
}, /* @ts-ignore */
|
|
239
|
-
...(ngDevMode ? [{ debugName: "formField" }] : /* istanbul ignore next */ []));
|
|
240
|
-
this.hasFieldError = computed(() => {
|
|
241
|
-
const field = this.formField()();
|
|
242
|
-
return field.invalid() && field.touched();
|
|
243
|
-
}, /* @ts-ignore */
|
|
244
|
-
...(ngDevMode ? [{ debugName: "hasFieldError" }] : /* istanbul ignore next */ []));
|
|
245
|
-
/**
|
|
246
|
-
* @description Controls whether the editor focuses its input after it renders.
|
|
247
|
-
*/
|
|
248
|
-
this.autoFocus = input(true, /* @ts-ignore */
|
|
249
|
-
...(ngDevMode ? [{ debugName: "autoFocus" }] : /* istanbul ignore next */ []));
|
|
250
|
-
this.cancelEdit = output();
|
|
251
|
-
this.column = input.required(/* @ts-ignore */
|
|
252
|
-
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
253
|
-
this.commit = output();
|
|
254
|
-
this.isNew = input(false, /* @ts-ignore */
|
|
255
|
-
...(ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []));
|
|
256
|
-
this.session = input.required(/* @ts-ignore */
|
|
257
|
-
...(ngDevMode ? [{ debugName: "session" }] : /* istanbul ignore next */ []));
|
|
258
|
-
this.tabNavigate = output();
|
|
259
|
-
/**
|
|
260
|
-
* @description Enables Tab and Shift+Tab traversal between editable cells while cell editing.
|
|
261
|
-
*/
|
|
262
|
-
this.tabNavigationEnabled = input(false, /* @ts-ignore */
|
|
263
|
-
...(ngDevMode ? [{ debugName: "tabNavigationEnabled" }] : /* istanbul ignore next */ []));
|
|
264
|
-
effect(() => {
|
|
265
|
-
const column = this.column();
|
|
266
|
-
if (column.dataType !== "number") {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
const field = this.formField();
|
|
270
|
-
const value = field().value();
|
|
271
|
-
const coercedValue = this.#coerceNumberValue(value);
|
|
272
|
-
if (Object.is(value, coercedValue)) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
untracked(() => field().value.set(coercedValue));
|
|
276
|
-
});
|
|
277
|
-
afterNextRender({
|
|
278
|
-
read: () => this.#focusEditor()
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
onBooleanEditorClick() {
|
|
282
|
-
this.#focusBooleanInput();
|
|
283
|
-
}
|
|
284
|
-
onBooleanEditorFocusOut(event) {
|
|
285
|
-
const relatedTarget = event.relatedTarget;
|
|
286
|
-
const editorHost = event.currentTarget;
|
|
287
|
-
if (relatedTarget && editorHost.contains(relatedTarget)) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
if (this.#ignoreNextBooleanFocusOut) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
this.commit.emit();
|
|
294
|
-
}
|
|
295
|
-
onBooleanEditorPointerDown() {
|
|
296
|
-
this.#ignoreNextBooleanFocusOut = true;
|
|
297
|
-
setTimeout(() => {
|
|
298
|
-
this.#ignoreNextBooleanFocusOut = false;
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
onDatePickerClose() {
|
|
302
|
-
this.#datePopupOpen.set(false);
|
|
303
|
-
}
|
|
304
|
-
onDatePickerEnter(event) {
|
|
305
|
-
if (this.#datePopupOpen()) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
event.target.blur();
|
|
309
|
-
}
|
|
310
|
-
onDatePickerFocusOut(event) {
|
|
311
|
-
const relatedTarget = event.relatedTarget;
|
|
312
|
-
if (relatedTarget?.closest(".cdk-overlay-container")) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
const pickerHost = event.currentTarget;
|
|
316
|
-
if (pickerHost.contains(relatedTarget)) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
this.commit.emit();
|
|
320
|
-
}
|
|
321
|
-
onDatePickerOpen() {
|
|
322
|
-
this.#datePopupOpen.set(true);
|
|
323
|
-
}
|
|
324
|
-
onEditCancel() {
|
|
325
|
-
if (!this.#datePopupOpen()) {
|
|
326
|
-
this.cancelEdit.emit();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
onHostKeydown(event) {
|
|
330
|
-
if (event.key !== "Tab" || !this.tabNavigationEnabled() || event.defaultPrevented) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
event.preventDefault();
|
|
334
|
-
event.stopPropagation();
|
|
335
|
-
this.tabNavigate.emit(event.shiftKey ? "previous" : "next");
|
|
336
|
-
}
|
|
337
|
-
#coerceNumberValue(value) {
|
|
338
|
-
if (typeof value === "number") {
|
|
339
|
-
return Number.isFinite(value) ? value : null;
|
|
340
|
-
}
|
|
341
|
-
if (typeof value !== "string") {
|
|
342
|
-
return null;
|
|
343
|
-
}
|
|
344
|
-
const normalizedValue = value.trim().replace(/,/g, "");
|
|
345
|
-
if (normalizedValue === "") {
|
|
346
|
-
return null;
|
|
347
|
-
}
|
|
348
|
-
const numberValue = Number(normalizedValue);
|
|
349
|
-
return Number.isFinite(numberValue) ? numberValue : null;
|
|
350
|
-
}
|
|
351
|
-
#focusBooleanInput() {
|
|
352
|
-
const checkbox = this.#elementRef.nativeElement.querySelector('input[type="checkbox"]');
|
|
353
|
-
checkbox?.focus();
|
|
354
|
-
}
|
|
355
|
-
#focusEditor() {
|
|
356
|
-
if (!this.autoFocus()) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
if (this.column().editTemplate) {
|
|
360
|
-
this.#focusTemplateTarget();
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
this.textBoxRef()?.focus();
|
|
364
|
-
this.numericTextBoxRef()?.focus();
|
|
365
|
-
const type = this.column().dataType;
|
|
366
|
-
if (type === "date") {
|
|
367
|
-
const inputElement = this.#elementRef.nativeElement.querySelector("input");
|
|
368
|
-
inputElement?.focus();
|
|
369
|
-
}
|
|
370
|
-
if (type === "boolean") {
|
|
371
|
-
this.#focusBooleanInput();
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
#focusTemplateTarget() {
|
|
375
|
-
const targets = Array.from(this.#elementRef.nativeElement.querySelectorAll(FOCUSABLE_TARGET_SELECTOR$1));
|
|
376
|
-
const target = targets.find(candidate => !candidate.hasAttribute("disabled") && candidate.getAttribute("aria-hidden") !== "true");
|
|
377
|
-
target?.focus();
|
|
378
|
-
}
|
|
379
|
-
#setFieldValue(value) {
|
|
380
|
-
this.formField()().value.set(value);
|
|
381
|
-
}
|
|
382
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
383
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridEditorComponent, isStandalone: true, selector: "mona-grid-editor", inputs: { autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, isNew: { classPropertyName: "isNew", publicName: "isNew", isSignal: true, isRequired: false, transformFunction: null }, session: { classPropertyName: "session", publicName: "session", isSignal: true, isRequired: true, transformFunction: null }, tabNavigationEnabled: { classPropertyName: "tabNavigationEnabled", publicName: "tabNavigationEnabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { cancelEdit: "cancelEdit", commit: "commit", tabNavigate: "tabNavigate" }, host: { listeners: { "keydown": "onHostKeydown($event)" }, properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "numericTextBoxRef", first: true, predicate: NumericTextBoxComponent, descendants: true, isSignal: true }, { propertyName: "textBoxRef", first: true, predicate: TextBoxComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@if (column().editTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().editTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\n} @else {\n <div class=\"relative flex items-center w-full min-h-8\">\n @switch (column().dataType) {\n @case (\"string\") {\n <mona-text-box\n [class]=\"editorInputClass()\"\n [inputAttributes]=\"{ autocomplete: 'off' }\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"commit.emit()\"\n (keydown.escape)=\"onEditCancel()\"\n (inputBlur)=\"commit.emit()\"\n [size]=\"'small'\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"commit.emit()\"\n (keydown.escape)=\"onEditCancel()\"\n (inputBlur)=\"commit.emit()\"\n [size]=\"'small'\"></mona-numeric-text-box>\n }\n @case (\"boolean\") {\n <mona-check-box\n class=\"{{ editorInputClass() }} ms-2\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (click)=\"onBooleanEditorClick()\"\n (focusout)=\"onBooleanEditorFocusOut($event)\"\n (pointerdown)=\"onBooleanEditorPointerDown()\"\n (keydown.escape)=\"onEditCancel()\"\n (keydown.enter)=\"commit.emit()\"></mona-check-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"onDatePickerEnter($event)\"\n (keydown.escape)=\"onEditCancel()\"\n (focusout)=\"onDatePickerFocusOut($event)\"\n (opened)=\"onDatePickerOpen()\"\n (closed)=\"onDatePickerClose()\"\n size=\"small\"></mona-date-picker>\n }\n }\n @if (hasFieldError()) {\n <span class=\"shrink-0 px-1 text-error\" #fieldErrorIcon>\n <svg lucideOctagonAlert [size]=\"12\"></svg>\n </span>\n <mona-tooltip [target]=\"fieldErrorIcon\">\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\n </mona-tooltip>\n }\n </div>\n}\n", dependencies: [{ kind: "component", type: CheckBoxComponent, selector: "mona-check-box", inputs: ["checked", "disabled", "indeterminate", "invalid", "label", "labelPosition", "labelSize", "required", "rounded", "tabIndex", "touched", "class"], outputs: ["checkedChange", "inputBlur", "inputChange", "inputFocus", "touch"] }, { kind: "component", type: DatePickerComponent, selector: "mona-date-picker", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "disabled", "disabledDates", "firstDay", "format", "inputId", "invalid", "max", "min", "placeholder", "popupClass", "popupHeight", "popupWidth", "readonly", "readonlyInput", "required", "rounded", "showClearButton", "size", "touched", "class", "value", "weekNumber"], outputs: ["close", "closed", "open", "opened", "touch", "valueChange"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "component", type: LucideOctagonAlert, selector: "svg[lucideOctagonAlert], svg[lucideAlertOctagon]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "component", type: TooltipComponent, selector: "mona-tooltip", inputs: ["disabled", "hideDelay", "position", "rounded", "showDelay", "target"], outputs: ["hidden", "shown"] }] }); }
|
|
384
|
-
}
|
|
385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, decorators: [{
|
|
386
|
-
type: Component,
|
|
387
|
-
args: [{ selector: "mona-grid-editor", imports: [
|
|
388
|
-
CheckBoxComponent,
|
|
389
|
-
DatePickerComponent,
|
|
390
|
-
FormField,
|
|
391
|
-
LucideOctagonAlert,
|
|
392
|
-
NgTemplateOutlet,
|
|
393
|
-
NumericTextBoxComponent,
|
|
394
|
-
TextBoxComponent,
|
|
395
|
-
TooltipComponent
|
|
396
|
-
], host: {
|
|
397
|
-
"[class]": "baseClass()",
|
|
398
|
-
"(keydown)": "onHostKeydown($event)"
|
|
399
|
-
}, template: "@if (column().editTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().editTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\n} @else {\n <div class=\"relative flex items-center w-full min-h-8\">\n @switch (column().dataType) {\n @case (\"string\") {\n <mona-text-box\n [class]=\"editorInputClass()\"\n [inputAttributes]=\"{ autocomplete: 'off' }\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"commit.emit()\"\n (keydown.escape)=\"onEditCancel()\"\n (inputBlur)=\"commit.emit()\"\n [size]=\"'small'\"></mona-text-box>\n }\n @case (\"number\") {\n <mona-numeric-text-box\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"commit.emit()\"\n (keydown.escape)=\"onEditCancel()\"\n (inputBlur)=\"commit.emit()\"\n [size]=\"'small'\"></mona-numeric-text-box>\n }\n @case (\"boolean\") {\n <mona-check-box\n class=\"{{ editorInputClass() }} ms-2\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (click)=\"onBooleanEditorClick()\"\n (focusout)=\"onBooleanEditorFocusOut($event)\"\n (pointerdown)=\"onBooleanEditorPointerDown()\"\n (keydown.escape)=\"onEditCancel()\"\n (keydown.enter)=\"commit.emit()\"></mona-check-box>\n }\n @case (\"date\") {\n <mona-date-picker\n [class]=\"editorInputClass()\"\n [rounded]=\"'none'\"\n [formField]=\"$any(formField())\"\n (keydown.enter)=\"onDatePickerEnter($event)\"\n (keydown.escape)=\"onEditCancel()\"\n (focusout)=\"onDatePickerFocusOut($event)\"\n (opened)=\"onDatePickerOpen()\"\n (closed)=\"onDatePickerClose()\"\n size=\"small\"></mona-date-picker>\n }\n }\n @if (hasFieldError()) {\n <span class=\"shrink-0 px-1 text-error\" #fieldErrorIcon>\n <svg lucideOctagonAlert [size]=\"12\"></svg>\n </span>\n <mona-tooltip [target]=\"fieldErrorIcon\">\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\n </mona-tooltip>\n }\n </div>\n}\n" }]
|
|
400
|
-
}], ctorParameters: () => [], propDecorators: { numericTextBoxRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NumericTextBoxComponent), { isSignal: true }] }], textBoxRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TextBoxComponent), { isSignal: true }] }], autoFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoFocus", required: false }] }], cancelEdit: [{ type: i0.Output, args: ["cancelEdit"] }], column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], commit: [{ type: i0.Output, args: ["commit"] }], isNew: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNew", required: false }] }], session: [{ type: i0.Input, args: [{ isSignal: true, alias: "session", required: true }] }], tabNavigate: [{ type: i0.Output, args: ["tabNavigate"] }], tabNavigationEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabNavigationEnabled", required: false }] }] } });
|
|
401
|
-
|
|
402
|
-
class GridAddRowComponent {
|
|
403
|
-
constructor() {
|
|
404
|
-
this.baseClass = computed(() => {
|
|
405
|
-
return gridListTableRowThemeVariants({ selected: false });
|
|
406
|
-
}, /* @ts-ignore */
|
|
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 */ []));
|
|
410
|
-
this.gridService = inject(GridService);
|
|
411
|
-
this.structuralColumnIds = {
|
|
412
|
-
detail: undefined,
|
|
413
|
-
reorder: "$rowReorder",
|
|
414
|
-
selection: "$selection"
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
onCancel() {
|
|
418
|
-
this.gridService.cancelAddRow();
|
|
419
|
-
}
|
|
420
|
-
onCommit() {
|
|
421
|
-
// Add rows are committed by the command column or toolbar save command.
|
|
422
|
-
}
|
|
423
|
-
onValueChange(column, value) {
|
|
424
|
-
this.gridService.patchAddCell(column.field, value);
|
|
425
|
-
}
|
|
426
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
428
|
-
}
|
|
429
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, decorators: [{
|
|
430
|
-
type: Component,
|
|
431
|
-
args: [{ selector: "tr[monaGridAddRow]", changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
432
|
-
GridCellDirective,
|
|
433
|
-
GridCommandCellComponent,
|
|
434
|
-
GridEditorComponent,
|
|
435
|
-
GridLockedCellDirective,
|
|
436
|
-
GridLogicalCellDirective
|
|
437
|
-
], host: {
|
|
438
|
-
"[class]": "baseClass()",
|
|
439
|
-
role: "row",
|
|
440
|
-
"data-grid-add-row": "true"
|
|
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 }] }] } });
|
|
540
|
-
|
|
541
|
-
const FOCUSABLE_TARGET_SELECTOR = "button, input, select, textarea, a[href], [tabindex]";
|
|
542
|
-
class GridCellComponent {
|
|
543
|
-
constructor() {
|
|
544
|
-
this.#elementRef = inject((ElementRef));
|
|
545
|
-
this.#gridNavigationService = inject(GridNavigationService);
|
|
546
|
-
this.#injector = inject(Injector);
|
|
547
|
-
this.#locale = inject(LOCALE_ID);
|
|
548
|
-
this.#logicalCell = inject(GridLogicalCellDirective, { optional: true });
|
|
549
|
-
this.baseClass = computed(() => {
|
|
550
|
-
return gridCellBaseThemeVariants({ virtual: this.gridService.virtualScrollOptions().enabled });
|
|
551
|
-
}, /* @ts-ignore */
|
|
552
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
553
|
-
this.cellContainerClass = computed(() => {
|
|
554
|
-
const editing = this.isEditing();
|
|
555
|
-
return gridCellContainerThemeVariants({ editing, virtual: this.gridService.virtualScrollOptions().enabled });
|
|
556
|
-
}, /* @ts-ignore */
|
|
557
|
-
...(ngDevMode ? [{ debugName: "cellContainerClass" }] : /* istanbul ignore next */ []));
|
|
558
|
-
this.cellDirtyIndicatorClass = computed(() => {
|
|
559
|
-
return gridCellDirtyIndicatorThemeVariants();
|
|
560
|
-
}, /* @ts-ignore */
|
|
561
|
-
...(ngDevMode ? [{ debugName: "cellDirtyIndicatorClass" }] : /* istanbul ignore next */ []));
|
|
562
|
-
this.cellTextClass = computed(() => {
|
|
563
|
-
return gridCellTextThemeVariants();
|
|
564
|
-
}, /* @ts-ignore */
|
|
565
|
-
...(ngDevMode ? [{ debugName: "cellTextClass" }] : /* istanbul ignore next */ []));
|
|
566
|
-
this.cellUid = computed(() => `${this.row().uid}_${this.column().field}`, /* @ts-ignore */
|
|
567
|
-
...(ngDevMode ? [{ debugName: "cellUid" }] : /* istanbul ignore next */ []));
|
|
568
|
-
this.displayValue = computed(() => {
|
|
569
|
-
const editedRowData = this.gridService.editViewDict().get(this.row().uid);
|
|
570
|
-
const rowData = this.row().data;
|
|
571
|
-
const effectiveRowData = editedRowData ?? rowData;
|
|
572
|
-
return effectiveRowData[this.column().field];
|
|
573
|
-
}, /* @ts-ignore */
|
|
574
|
-
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
575
|
-
this.editContextIsCellMode = computed(() => this.gridService.editContext()?.mode === "cell", /* @ts-ignore */
|
|
576
|
-
...(ngDevMode ? [{ debugName: "editContextIsCellMode" }] : /* istanbul ignore next */ []));
|
|
577
|
-
this.formattedDisplayValue = computed(() => {
|
|
578
|
-
const column = this.column();
|
|
579
|
-
const value = this.displayValue();
|
|
580
|
-
const format = column.format;
|
|
581
|
-
if (format == null) {
|
|
582
|
-
return value;
|
|
583
|
-
}
|
|
584
|
-
if (typeof format === "function") {
|
|
585
|
-
return format(column);
|
|
586
|
-
}
|
|
587
|
-
if (column.dataType === "date") {
|
|
588
|
-
return this.formatDateValue(value, format);
|
|
589
|
-
}
|
|
590
|
-
return value;
|
|
591
|
-
}, /* @ts-ignore */
|
|
592
|
-
...(ngDevMode ? [{ debugName: "formattedDisplayValue" }] : /* istanbul ignore next */ []));
|
|
593
|
-
this.gridService = inject(GridService);
|
|
594
|
-
this.isCellPristine = computed(() => {
|
|
595
|
-
const rowUid = this.row().uid;
|
|
596
|
-
const field = this.column().field;
|
|
597
|
-
const originalRowData = this.gridService.editBaseDict().get(rowUid);
|
|
598
|
-
const editedRowData = this.gridService.editViewDict().get(rowUid);
|
|
599
|
-
if (!originalRowData || !editedRowData) {
|
|
600
|
-
return true;
|
|
601
|
-
}
|
|
602
|
-
return originalRowData[field] === editedRowData[field];
|
|
603
|
-
}, /* @ts-ignore */
|
|
604
|
-
...(ngDevMode ? [{ debugName: "isCellPristine" }] : /* istanbul ignore next */ []));
|
|
605
|
-
this.isEditing = computed(() => {
|
|
606
|
-
const context = this.gridService.editContext();
|
|
607
|
-
if (context == null) {
|
|
608
|
-
return false;
|
|
609
|
-
}
|
|
610
|
-
if (context.mode === "cell") {
|
|
611
|
-
return context.cellUid === this.cellUid();
|
|
612
|
-
}
|
|
613
|
-
return context.rowUid === this.row().uid && this.column().editable;
|
|
614
|
-
}, /* @ts-ignore */
|
|
615
|
-
...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
|
|
616
|
-
this.shouldAutoFocusEditor = computed(() => {
|
|
617
|
-
const context = this.gridService.editContext();
|
|
618
|
-
if (context?.mode === "cell") {
|
|
619
|
-
return context.cellUid === this.cellUid();
|
|
620
|
-
}
|
|
621
|
-
if (context?.mode !== "row" || context.rowUid !== this.row().uid) {
|
|
622
|
-
return false;
|
|
623
|
-
}
|
|
624
|
-
return (this.gridService.visibleColumns().firstOrDefault(column => column.kind === "data" && column.editable) ===
|
|
625
|
-
this.column());
|
|
626
|
-
}, /* @ts-ignore */
|
|
627
|
-
...(ngDevMode ? [{ debugName: "shouldAutoFocusEditor" }] : /* istanbul ignore next */ []));
|
|
628
|
-
this.column = input.required(/* @ts-ignore */
|
|
629
|
-
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
630
|
-
this.row = input.required(/* @ts-ignore */
|
|
631
|
-
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
632
|
-
}
|
|
633
|
-
#elementRef;
|
|
634
|
-
#gridNavigationService;
|
|
635
|
-
#injector;
|
|
636
|
-
#locale;
|
|
637
|
-
#logicalCell;
|
|
638
|
-
handleLogicalCellEnter(originalEvent) {
|
|
639
|
-
if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
const editableOptions = this.gridService.editableOptions();
|
|
643
|
-
if (editableOptions.mode === "cell") {
|
|
644
|
-
this.startEdit(originalEvent);
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
const context = this.gridService.editContext();
|
|
648
|
-
if (context?.mode === "row" && context.rowUid === this.row().uid) {
|
|
649
|
-
this.focusInnerEditor();
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
this.gridService.startRowEdit(this.row(), originalEvent);
|
|
653
|
-
}
|
|
654
|
-
onCellDoubleClick(event) {
|
|
655
|
-
if (this.gridService.editableOptions().mode === "cell") {
|
|
656
|
-
this.startEdit(event);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
onCellValueChange(value) {
|
|
660
|
-
this.gridService.patchCellEdit(this.row().uid, this.column().field, value);
|
|
661
|
-
}
|
|
662
|
-
onEditCancel() {
|
|
663
|
-
const context = this.gridService.editContext();
|
|
664
|
-
if (context?.mode === "cell") {
|
|
665
|
-
this.gridService.cancelEdit();
|
|
666
|
-
}
|
|
667
|
-
this.focusHostCell();
|
|
668
|
-
}
|
|
669
|
-
onEditCommit() {
|
|
670
|
-
const context = this.gridService.editContext();
|
|
671
|
-
if (context && context.mode === "cell") {
|
|
672
|
-
if (this.gridService.stopCellEdit()) {
|
|
673
|
-
this.focusHostCell();
|
|
674
|
-
}
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if (this.#elementRef.nativeElement.contains(this.#elementRef.nativeElement.ownerDocument.activeElement)) {
|
|
678
|
-
this.focusHostCell();
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
onEditTabNavigate(direction) {
|
|
682
|
-
const context = this.gridService.editContext();
|
|
683
|
-
if (context?.mode !== "cell") {
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
const rowUid = this.row().uid;
|
|
687
|
-
const columnId = this.column().id;
|
|
688
|
-
if (!this.gridService.stopCellEdit()) {
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
// The commit may replace the row data, so wait for the grid to re-render before starting the next edit.
|
|
692
|
-
afterNextRender({
|
|
693
|
-
read: () => {
|
|
694
|
-
if (this.#gridNavigationService.focusAdjacentEditableCell(rowUid, columnId, direction)) {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
this.#logicalCell?.focusNextPageTabTarget(direction === "previous");
|
|
698
|
-
}
|
|
699
|
-
}, { injector: this.#injector });
|
|
700
|
-
}
|
|
701
|
-
focusHostCell() {
|
|
702
|
-
const cellElement = this.#elementRef.nativeElement.closest("td");
|
|
703
|
-
cellElement?.focus();
|
|
704
|
-
}
|
|
705
|
-
focusInnerEditor() {
|
|
706
|
-
const target = this.#elementRef.nativeElement.querySelector(FOCUSABLE_TARGET_SELECTOR);
|
|
707
|
-
target?.focus();
|
|
708
|
-
}
|
|
709
|
-
formatDateValue(value, format) {
|
|
710
|
-
if (value == null) {
|
|
711
|
-
return value;
|
|
712
|
-
}
|
|
713
|
-
if (value instanceof Date || typeof value === "number" || typeof value === "string") {
|
|
714
|
-
try {
|
|
715
|
-
return formatDate(value, format, this.#locale);
|
|
716
|
-
}
|
|
717
|
-
catch {
|
|
718
|
-
return value;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
return value;
|
|
722
|
-
}
|
|
723
|
-
startEdit(originalEvent) {
|
|
724
|
-
if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") {
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
this.gridService.startCellEdit(this.cellUid(), this.row(), this.column(), originalEvent);
|
|
728
|
-
}
|
|
729
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
730
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridCellComponent, isStandalone: true, selector: "mona-grid-cell", inputs: { column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0, template: "@let dataItem = row().data;\n@let dataKey = column().field;\n\n@if (column().kind === \"command\") {\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\n} @else {\n <div\n [class]=\"cellContainerClass()\"\n cdkMonitorSubtreeFocus\n [attr.data-uid]=\"cellUid()\"\n [attr.data-ruid]=\"row().uid\"\n [attr.data-field]=\"dataKey\"\n [attr.data-col-index]=\"column().index\"\n (dblclick)=\"onCellDoubleClick($event)\">\n @if (isEditing() && gridService.editSession(); as session) {\n <mona-grid-editor\n [column]=\"column()\"\n [autoFocus]=\"shouldAutoFocusEditor()\"\n [session]=\"session\"\n [tabNavigationEnabled]=\"editContextIsCellMode()\"\n (commit)=\"onEditCommit()\"\n (cancelEdit)=\"onEditCancel()\"\n (tabNavigate)=\"onEditTabNavigate($event)\"></mona-grid-editor>\n } @else if (column().cellTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().cellTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\n } @else {\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\n }\n @if (!isCellPristine()) {\n <span aria-hidden=\"true\" [class]=\"cellDirtyIndicatorClass()\" [title]=\"gridService.messages().modified\"></span>\n }\n </div>\n}\n", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { 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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
731
|
-
}
|
|
732
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, decorators: [{
|
|
733
|
-
type: Component,
|
|
734
|
-
args: [{ selector: "mona-grid-cell", imports: [A11yModule, GridCommandCellComponent, GridEditorComponent, NgTemplateOutlet], host: {
|
|
735
|
-
"[class]": "baseClass()"
|
|
736
|
-
}, template: "@let dataItem = row().data;\n@let dataKey = column().field;\n\n@if (column().kind === \"command\") {\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\n} @else {\n <div\n [class]=\"cellContainerClass()\"\n cdkMonitorSubtreeFocus\n [attr.data-uid]=\"cellUid()\"\n [attr.data-ruid]=\"row().uid\"\n [attr.data-field]=\"dataKey\"\n [attr.data-col-index]=\"column().index\"\n (dblclick)=\"onCellDoubleClick($event)\">\n @if (isEditing() && gridService.editSession(); as session) {\n <mona-grid-editor\n [column]=\"column()\"\n [autoFocus]=\"shouldAutoFocusEditor()\"\n [session]=\"session\"\n [tabNavigationEnabled]=\"editContextIsCellMode()\"\n (commit)=\"onEditCommit()\"\n (cancelEdit)=\"onEditCancel()\"\n (tabNavigate)=\"onEditTabNavigate($event)\"></mona-grid-editor>\n } @else if (column().cellTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"column().cellTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\n } @else {\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\n }\n @if (!isCellPristine()) {\n <span aria-hidden=\"true\" [class]=\"cellDirtyIndicatorClass()\" [title]=\"gridService.messages().modified\"></span>\n }\n </div>\n}\n" }]
|
|
737
|
-
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
738
|
-
|
|
739
|
-
class GridRowReorderHandleComponent {
|
|
740
|
-
constructor() {
|
|
741
|
-
this.#gridService = inject(GridService);
|
|
742
|
-
this.#hostElement = inject(ElementRef).nativeElement;
|
|
743
|
-
this.#injector = inject(Injector);
|
|
744
|
-
this.#liveAnnouncer = inject(LiveAnnouncer);
|
|
745
|
-
this.ariaLabel = computed(() => {
|
|
746
|
-
const absoluteIndex = this.pageIndex() + this.#gridService.paginationState().skip;
|
|
747
|
-
const label = this.#gridService.getRowReorderAriaLabel(this.row(), absoluteIndex);
|
|
748
|
-
const reasonText = this.disabledReasonText();
|
|
749
|
-
const messages = this.#gridService.messages();
|
|
750
|
-
return messages.rowReorderHandleAriaLabel(label, messages.rowReorderKeyboardHint, reasonText ?? undefined);
|
|
751
|
-
}, /* @ts-ignore */
|
|
752
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
753
|
-
this.disabled = computed(() => !this.#gridService.canReorderRow(this.row()), /* @ts-ignore */
|
|
754
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
755
|
-
this.disabledReasonText = computed(() => {
|
|
756
|
-
const reason = this.#gridService.rowReorderDisabledReason();
|
|
757
|
-
const messages = this.#gridService.messages();
|
|
758
|
-
switch (reason) {
|
|
759
|
-
case null:
|
|
760
|
-
return null;
|
|
761
|
-
case "disabled":
|
|
762
|
-
return messages.rowReorderDisabled;
|
|
763
|
-
case "editing":
|
|
764
|
-
return messages.rowReorderDisabledEditing;
|
|
765
|
-
case "filtered":
|
|
766
|
-
return messages.rowReorderDisabledFiltered;
|
|
767
|
-
case "grouped":
|
|
768
|
-
return messages.rowReorderDisabledGrouped;
|
|
769
|
-
case "single-row":
|
|
770
|
-
return messages.rowReorderDisabledSingleRow;
|
|
771
|
-
case "server-binding":
|
|
772
|
-
return messages.rowReorderDisabledServerBinding;
|
|
773
|
-
case "sorted":
|
|
774
|
-
return messages.rowReorderDisabledSorted;
|
|
775
|
-
case "virtual-scroll":
|
|
776
|
-
return messages.rowReorderDisabledVirtualScroll;
|
|
777
|
-
}
|
|
778
|
-
}, /* @ts-ignore */
|
|
779
|
-
...(ngDevMode ? [{ debugName: "disabledReasonText" }] : /* istanbul ignore next */ []));
|
|
780
|
-
this.handleClass = gridRowReorderHandleThemeVariants();
|
|
781
|
-
/**
|
|
782
|
-
* @description The row's position within the current page, used to move the row and derive its accessible label.
|
|
783
|
-
*/
|
|
784
|
-
this.pageIndex = input.required(/* @ts-ignore */
|
|
785
|
-
...(ngDevMode ? [{ debugName: "pageIndex" }] : /* istanbul ignore next */ []));
|
|
786
|
-
/**
|
|
787
|
-
* @description The grid row whose reorder handle this button controls.
|
|
788
|
-
*/
|
|
789
|
-
this.row = input.required(/* @ts-ignore */
|
|
790
|
-
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
791
|
-
}
|
|
792
|
-
#gridService;
|
|
793
|
-
#hostElement;
|
|
794
|
-
#injector;
|
|
795
|
-
#liveAnnouncer;
|
|
796
|
-
onKeydown(event) {
|
|
797
|
-
if ((event.key !== "ArrowUp" && event.key !== "ArrowDown") || !event.altKey) {
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
event.preventDefault();
|
|
801
|
-
event.stopPropagation();
|
|
802
|
-
const direction = event.key === "ArrowUp" ? -1 : 1;
|
|
803
|
-
const targetIndex = this.pageIndex() + direction;
|
|
804
|
-
if (targetIndex < 0 || targetIndex >= this.#gridService.viewPageRows().length) {
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
const moved = this.#gridService.requestRowReorder(this.row(), this.pageIndex(), targetIndex);
|
|
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 });
|
|
818
|
-
const skip = this.#gridService.paginationState().skip;
|
|
819
|
-
const fromRowNumber = skip + this.pageIndex() + 1;
|
|
820
|
-
const toPosition = skip + targetIndex + 1;
|
|
821
|
-
this.#liveAnnouncer.announce(this.#gridService.messages().rowReorderMoved(fromRowNumber, toPosition));
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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"] }] }); }
|
|
826
|
-
}
|
|
827
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowReorderHandleComponent, decorators: [{
|
|
828
|
-
type: Component,
|
|
829
|
-
args: [{ selector: "mona-grid-row-reorder-handle", imports: [LucideGripVertical, CdkDragHandle], host: {
|
|
830
|
-
"(click)": "$event.stopPropagation()",
|
|
831
|
-
"(contextmenu)": "$event.stopPropagation()",
|
|
832
|
-
"(dblclick)": "$event.stopPropagation()"
|
|
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" }]
|
|
834
|
-
}], propDecorators: { pageIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageIndex", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
835
|
-
|
|
836
|
-
class GridSelectionCheckboxComponent {
|
|
837
|
-
constructor() {
|
|
838
|
-
this.#gridService = inject(GridService);
|
|
839
|
-
this.ariaLabel = computed(() => {
|
|
840
|
-
const labelFn = this.#gridService.selectableOptions().rowAriaLabel;
|
|
841
|
-
if (labelFn) {
|
|
842
|
-
return labelFn(this.row().data);
|
|
843
|
-
}
|
|
844
|
-
return this.#gridService.messages().selectRow(this.rowIndex() + 1);
|
|
845
|
-
}, /* @ts-ignore */
|
|
846
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
847
|
-
this.checked = computed(() => this.#gridService.isRowSelected(this.row()), /* @ts-ignore */
|
|
848
|
-
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
849
|
-
this.hostClass = computed(() => gridSelectionCellThemeVariants({ virtual: this.#gridService.virtualScrollOptions().enabled }), /* @ts-ignore */
|
|
850
|
-
...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
|
|
851
|
-
/**
|
|
852
|
-
* @description The grid row whose selected state this checkbox controls.
|
|
853
|
-
*/
|
|
854
|
-
this.row = input.required(/* @ts-ignore */
|
|
855
|
-
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
856
|
-
/**
|
|
857
|
-
* @description The row's position within its rendered list, used to derive a default accessible label.
|
|
858
|
-
*/
|
|
859
|
-
this.rowIndex = input.required(/* @ts-ignore */
|
|
860
|
-
...(ngDevMode ? [{ debugName: "rowIndex" }] : /* istanbul ignore next */ []));
|
|
861
|
-
}
|
|
862
|
-
#gridService;
|
|
863
|
-
onCheckedChange(checked) {
|
|
864
|
-
this.#gridService.setRowSelected(this.row(), checked);
|
|
865
|
-
}
|
|
866
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
867
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: GridSelectionCheckboxComponent, isStandalone: true, selector: "mona-grid-selection-checkbox", inputs: { row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "$event.stopPropagation()" }, properties: { "class": "hostClass()" } }, ngImport: i0, template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n", dependencies: [{ kind: "component", type: CheckBoxComponent, selector: "mona-check-box", inputs: ["checked", "disabled", "indeterminate", "invalid", "label", "labelPosition", "labelSize", "required", "rounded", "tabIndex", "touched", "class"], outputs: ["checkedChange", "inputBlur", "inputChange", "inputFocus", "touch"] }] }); }
|
|
868
|
-
}
|
|
869
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridSelectionCheckboxComponent, decorators: [{
|
|
870
|
-
type: Component,
|
|
871
|
-
args: [{ selector: "mona-grid-selection-checkbox", imports: [CheckBoxComponent], host: {
|
|
872
|
-
"[class]": "hostClass()",
|
|
873
|
-
"(click)": "$event.stopPropagation()"
|
|
874
|
-
}, template: "<mona-check-box\n [checked]=\"checked()\"\n (checkedChange)=\"onCheckedChange($event)\">\n <span class=\"sr-only\">{{ ariaLabel() }}</span>\n</mona-check-box>\n" }]
|
|
875
|
-
}], propDecorators: { row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowIndex", required: true }] }] } });
|
|
876
|
-
|
|
877
|
-
/** A data row of the grid body, with one cell per layout column. */
|
|
878
|
-
class GridRowComponent {
|
|
879
|
-
constructor() {
|
|
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(" "));
|
|
889
|
-
}, /* @ts-ignore */
|
|
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";
|
|
894
|
-
}, /* @ts-ignore */
|
|
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 */
|
|
905
|
-
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
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 */ []));
|
|
913
|
-
}
|
|
914
|
-
onClick(event) {
|
|
915
|
-
this.gridService.handleRowClick(event, this.row());
|
|
916
|
-
}
|
|
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 }); }
|
|
922
|
-
}
|
|
923
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowComponent, decorators: [{
|
|
924
|
-
type: Component,
|
|
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 }] }] } });
|
|
944
|
-
|
|
945
|
-
export { GridAddRowComponent as G, GridDetailRowComponent as a, GridGroupRowComponent as b, GridRowComponent as c };
|
|
946
|
-
//# sourceMappingURL=nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs.map
|