@nanahoshi/mona-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,773 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, computed, input, Directive, Component, signal, ElementRef, viewChild, output, effect, untracked, afterNextRender, ChangeDetectionStrategy, LOCALE_ID, model } from '@angular/core';
|
|
3
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
4
|
+
import { k as gridListTableCellThemeVariants, l as gridDetailContentCellThemeVariants, m as gridDetailIndentCellThemeVariants, n as gridDetailRowThemeVariants, c as GridService, o as gridListTableRowThemeVariants, p as gridCellEditorBaseThemeVariants, q as gridCellEditorInputThemeVariants, h as GridLockedCellDirective, f as GridLogicalCellDirective, r as gridCellBaseThemeVariants, s as gridCellContainerThemeVariants, t as gridCellDirtyIndicatorThemeVariants, u as gridCellTextThemeVariants } from './nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs';
|
|
5
|
+
import { ImmutableList } from '@mirei/ts-collections';
|
|
6
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
7
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
8
|
+
import { NgTemplateOutlet, formatDate } from '@angular/common';
|
|
9
|
+
import { LucideCheck, LucideOctagonAlert, LucideX, LucidePencil, LucideTrash2, LucideMinus, LucideChevronDown, LucidePlus, LucideChevronRight, LucideDynamicIcon } from '@lucide/angular';
|
|
10
|
+
import { take } from 'rxjs';
|
|
11
|
+
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
12
|
+
import { DialogService } from '@nanahoshi/mona-ui/dialog';
|
|
13
|
+
import { TooltipComponent } from '@nanahoshi/mona-ui/tooltip';
|
|
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
|
+
|
|
20
|
+
class GridCellDirective {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.#themeService = inject(ThemeService);
|
|
23
|
+
this.baseClass = computed(() => {
|
|
24
|
+
const theme = this.#themeService.theme();
|
|
25
|
+
const dataCell = this.dataCell();
|
|
26
|
+
const groupHeader = this.groupHeader();
|
|
27
|
+
const groupToggle = this.groupToggle();
|
|
28
|
+
const grouped = this.grouped();
|
|
29
|
+
const indentCell = this.indentCell();
|
|
30
|
+
const masterDetailContent = this.masterDetailContent();
|
|
31
|
+
const masterDetailToggle = this.masterDetailToggle();
|
|
32
|
+
const lastInRow = this.lastInRow() || groupHeader || masterDetailContent;
|
|
33
|
+
return gridListTableCellThemeVariants(theme)({
|
|
34
|
+
dataCell,
|
|
35
|
+
groupHeader,
|
|
36
|
+
groupToggle,
|
|
37
|
+
grouped,
|
|
38
|
+
indentCell,
|
|
39
|
+
lastInRow,
|
|
40
|
+
masterDetailContent,
|
|
41
|
+
masterDetailToggle
|
|
42
|
+
});
|
|
43
|
+
}, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
45
|
+
this.dataCell = input(false, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "dataCell" }] : /* istanbul ignore next */ []));
|
|
47
|
+
this.groupHeader = input(false, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "groupHeader" }] : /* istanbul ignore next */ []));
|
|
49
|
+
this.groupToggle = input(false, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "groupToggle" }] : /* istanbul ignore next */ []));
|
|
51
|
+
this.grouped = input(false, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "grouped" }] : /* istanbul ignore next */ []));
|
|
53
|
+
this.indentCell = input(false, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "indentCell" }] : /* istanbul ignore next */ []));
|
|
55
|
+
this.lastInRow = input(false, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "lastInRow" }] : /* istanbul ignore next */ []));
|
|
57
|
+
this.masterDetailContent = input(false, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "masterDetailContent" }] : /* istanbul ignore next */ []));
|
|
59
|
+
this.masterDetailToggle = input(false, /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "masterDetailToggle" }] : /* istanbul ignore next */ []));
|
|
61
|
+
this.nextRowType = input(null, /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
63
|
+
this.prevRowType = input(null, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "prevRowType" }] : /* istanbul ignore next */ []));
|
|
65
|
+
}
|
|
66
|
+
#themeService;
|
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
68
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridCellDirective, isStandalone: true, selector: "td[monaGridCell]", inputs: { dataCell: { classPropertyName: "dataCell", publicName: "dataCell", isSignal: true, isRequired: false, transformFunction: null }, groupHeader: { classPropertyName: "groupHeader", publicName: "groupHeader", isSignal: true, isRequired: false, transformFunction: null }, groupToggle: { classPropertyName: "groupToggle", publicName: "groupToggle", isSignal: true, isRequired: false, transformFunction: null }, grouped: { classPropertyName: "grouped", publicName: "grouped", isSignal: true, isRequired: false, transformFunction: null }, indentCell: { classPropertyName: "indentCell", publicName: "indentCell", isSignal: true, isRequired: false, transformFunction: null }, lastInRow: { classPropertyName: "lastInRow", publicName: "lastInRow", isSignal: true, isRequired: false, transformFunction: null }, masterDetailContent: { classPropertyName: "masterDetailContent", publicName: "masterDetailContent", isSignal: true, isRequired: false, transformFunction: null }, masterDetailToggle: { classPropertyName: "masterDetailToggle", publicName: "masterDetailToggle", isSignal: true, isRequired: false, transformFunction: null }, nextRowType: { classPropertyName: "nextRowType", publicName: "nextRowType", isSignal: true, isRequired: false, transformFunction: null }, prevRowType: { classPropertyName: "prevRowType", publicName: "prevRowType", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
69
|
+
}
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellDirective, decorators: [{
|
|
71
|
+
type: Directive,
|
|
72
|
+
args: [{
|
|
73
|
+
selector: "td[monaGridCell]",
|
|
74
|
+
host: {
|
|
75
|
+
"[class]": "baseClass()"
|
|
76
|
+
}
|
|
77
|
+
}]
|
|
78
|
+
}], propDecorators: { dataCell: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataCell", required: false }] }], groupHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupHeader", required: false }] }], groupToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupToggle", required: false }] }], grouped: [{ type: i0.Input, args: [{ isSignal: true, alias: "grouped", required: false }] }], indentCell: [{ type: i0.Input, args: [{ isSignal: true, alias: "indentCell", required: false }] }], lastInRow: [{ type: i0.Input, args: [{ isSignal: true, alias: "lastInRow", required: false }] }], masterDetailContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "masterDetailContent", required: false }] }], masterDetailToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "masterDetailToggle", required: false }] }], nextRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextRowType", required: false }] }], prevRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "prevRowType", required: false }] }] } });
|
|
79
|
+
|
|
80
|
+
class GridDetailContentCellDirective {
|
|
81
|
+
constructor() {
|
|
82
|
+
this.#themeService = inject(ThemeService);
|
|
83
|
+
this.baseClass = computed(() => {
|
|
84
|
+
const theme = this.#themeService.theme();
|
|
85
|
+
return gridDetailContentCellThemeVariants(theme)({
|
|
86
|
+
nextIsGroup: this.nextRowType() === "group"
|
|
87
|
+
});
|
|
88
|
+
}, /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
90
|
+
this.nextRowType = input(null, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
92
|
+
}
|
|
93
|
+
#themeService;
|
|
94
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailContentCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
95
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridDetailContentCellDirective, isStandalone: true, selector: "td[monaGridDetailContentCell]", inputs: { nextRowType: { classPropertyName: "nextRowType", publicName: "nextRowType", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
96
|
+
}
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailContentCellDirective, decorators: [{
|
|
98
|
+
type: Directive,
|
|
99
|
+
args: [{
|
|
100
|
+
selector: "td[monaGridDetailContentCell]",
|
|
101
|
+
host: {
|
|
102
|
+
"[class]": "baseClass()"
|
|
103
|
+
}
|
|
104
|
+
}]
|
|
105
|
+
}], propDecorators: { nextRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextRowType", required: false }] }] } });
|
|
106
|
+
|
|
107
|
+
class GridDetailIndentCellDirective {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.#themeService = inject(ThemeService);
|
|
110
|
+
this.baseClass = computed(() => {
|
|
111
|
+
const theme = this.#themeService.theme();
|
|
112
|
+
return gridDetailIndentCellThemeVariants(theme)({
|
|
113
|
+
nextIsGroup: this.nextRowType() === "group"
|
|
114
|
+
});
|
|
115
|
+
}, /* @ts-ignore */
|
|
116
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
117
|
+
this.nextRowType = input(null, /* @ts-ignore */
|
|
118
|
+
...(ngDevMode ? [{ debugName: "nextRowType" }] : /* istanbul ignore next */ []));
|
|
119
|
+
}
|
|
120
|
+
#themeService;
|
|
121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailIndentCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
122
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridDetailIndentCellDirective, isStandalone: true, selector: "td[monaGridDetailIndentCell]", inputs: { nextRowType: { classPropertyName: "nextRowType", publicName: "nextRowType", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
123
|
+
}
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailIndentCellDirective, decorators: [{
|
|
125
|
+
type: Directive,
|
|
126
|
+
args: [{
|
|
127
|
+
selector: "td[monaGridDetailIndentCell]",
|
|
128
|
+
host: {
|
|
129
|
+
"[class]": "baseClass()"
|
|
130
|
+
}
|
|
131
|
+
}]
|
|
132
|
+
}], propDecorators: { nextRowType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextRowType", required: false }] }] } });
|
|
133
|
+
|
|
134
|
+
class GridDetailRowDirective {
|
|
135
|
+
constructor() {
|
|
136
|
+
this.#themeService = inject(ThemeService);
|
|
137
|
+
this.baseClass = computed(() => {
|
|
138
|
+
const theme = this.#themeService.theme();
|
|
139
|
+
return gridDetailRowThemeVariants(theme)();
|
|
140
|
+
}, /* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
142
|
+
}
|
|
143
|
+
#themeService;
|
|
144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
145
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: GridDetailRowDirective, isStandalone: true, selector: "tr[monaGridDetailRow]", host: { properties: { "class": "baseClass()" } }, ngImport: i0 }); }
|
|
146
|
+
}
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridDetailRowDirective, decorators: [{
|
|
148
|
+
type: Directive,
|
|
149
|
+
args: [{
|
|
150
|
+
selector: "tr[monaGridDetailRow]",
|
|
151
|
+
host: {
|
|
152
|
+
"[class]": "baseClass()"
|
|
153
|
+
}
|
|
154
|
+
}]
|
|
155
|
+
}] });
|
|
156
|
+
|
|
157
|
+
class GridRowDirective {
|
|
158
|
+
constructor() {
|
|
159
|
+
this.#gridService = inject(GridService);
|
|
160
|
+
this.#themeService = inject(ThemeService);
|
|
161
|
+
this.ariaRowIndex = computed(() => this.index() + this.#gridService.paginationState().skip + 2, /* @ts-ignore */
|
|
162
|
+
...(ngDevMode ? [{ debugName: "ariaRowIndex" }] : /* istanbul ignore next */ []));
|
|
163
|
+
this.baseClass = computed(() => {
|
|
164
|
+
const theme = this.#themeService.theme();
|
|
165
|
+
const selected = this.selected();
|
|
166
|
+
return gridListTableRowThemeVariants(theme)({ selected });
|
|
167
|
+
}, /* @ts-ignore */
|
|
168
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
169
|
+
this.selectable = computed(() => this.#gridService.selectableOptions().enabled, /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
|
|
171
|
+
this.expanded = computed(() => this.#gridService.isRowExpanded(this.row()), /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
173
|
+
this.index = input.required(/* @ts-ignore */
|
|
174
|
+
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
175
|
+
this.row = input.required(/* @ts-ignore */
|
|
176
|
+
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
177
|
+
this.selected = computed(() => this.#gridService.isRowSelected(this.row()), /* @ts-ignore */
|
|
178
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
179
|
+
}
|
|
180
|
+
#gridService;
|
|
181
|
+
#themeService;
|
|
182
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
183
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: GridRowDirective, isStandalone: true, selector: "tr[monaGridRow]", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, row: { classPropertyName: "row", publicName: "row", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "row" }, properties: { "class": "baseClass()", "attr.data-ruid": "row().uid", "attr.data-row-view-index": "index()", "attr.aria-selected": "selectable() ? selected() : null", "attr.aria-rowindex": "ariaRowIndex()" } }, exportAs: ["monaGridRow"], ngImport: i0 }); }
|
|
184
|
+
}
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridRowDirective, decorators: [{
|
|
186
|
+
type: Directive,
|
|
187
|
+
args: [{
|
|
188
|
+
selector: "tr[monaGridRow]",
|
|
189
|
+
host: {
|
|
190
|
+
"[class]": "baseClass()",
|
|
191
|
+
"[attr.data-ruid]": "row().uid",
|
|
192
|
+
"[attr.data-row-view-index]": "index()",
|
|
193
|
+
role: "row",
|
|
194
|
+
"[attr.aria-selected]": "selectable() ? selected() : null",
|
|
195
|
+
"[attr.aria-rowindex]": "ariaRowIndex()"
|
|
196
|
+
},
|
|
197
|
+
exportAs: "monaGridRow"
|
|
198
|
+
}]
|
|
199
|
+
}], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
200
|
+
|
|
201
|
+
class GridCommandCellComponent {
|
|
202
|
+
constructor() {
|
|
203
|
+
this.#dialogService = inject(DialogService);
|
|
204
|
+
this.canEditRows = computed(() => {
|
|
205
|
+
const editableOptions = this.gridService.editableOptions();
|
|
206
|
+
return editableOptions.enabled === true && editableOptions.mode === "row";
|
|
207
|
+
}, /* @ts-ignore */
|
|
208
|
+
...(ngDevMode ? [{ debugName: "canEditRows" }] : /* istanbul ignore next */ []));
|
|
209
|
+
this.commandContext = computed(() => ({
|
|
210
|
+
$implicit: this.row()?.data ?? this.gridService.addRowData(),
|
|
211
|
+
cancel: (event) => this.cancel(event),
|
|
212
|
+
edit: (event) => this.edit(event),
|
|
213
|
+
isEditing: this.isEditing(),
|
|
214
|
+
isNew: this.newRow(),
|
|
215
|
+
remove: (event) => this.remove(event),
|
|
216
|
+
row: this.row(),
|
|
217
|
+
rowData: this.row()?.data ?? this.gridService.addRowData(),
|
|
218
|
+
save: (event) => this.save(event)
|
|
219
|
+
}), /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "commandContext" }] : /* istanbul ignore next */ []));
|
|
221
|
+
this.gridService = inject(GridService);
|
|
222
|
+
this.hasRowError = computed(() => this.rowErrorMessages().length > 0, /* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "hasRowError" }] : /* istanbul ignore next */ []));
|
|
224
|
+
this.isEditing = computed(() => {
|
|
225
|
+
const row = this.row();
|
|
226
|
+
const context = this.gridService.editContext();
|
|
227
|
+
return this.newRow() || (row != null && context?.mode === "row" && context.rowUid === row.uid);
|
|
228
|
+
}, /* @ts-ignore */
|
|
229
|
+
...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
|
|
230
|
+
this.rowErrorMessages = computed(() => {
|
|
231
|
+
if (!this.isEditing()) {
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
const session = this.gridService.editSession();
|
|
235
|
+
if (session == null) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
return session
|
|
239
|
+
.form()
|
|
240
|
+
.errorSummary()
|
|
241
|
+
.map(error => error.message)
|
|
242
|
+
.filter((message) => !!message);
|
|
243
|
+
}, /* @ts-ignore */
|
|
244
|
+
...(ngDevMode ? [{ debugName: "rowErrorMessages" }] : /* istanbul ignore next */ []));
|
|
245
|
+
this.rowErrorTooltip = computed(() => this.rowErrorMessages().join("\n") || "This row has validation errors.", /* @ts-ignore */
|
|
246
|
+
...(ngDevMode ? [{ debugName: "rowErrorTooltip" }] : /* istanbul ignore next */ []));
|
|
247
|
+
this.column = input.required(/* @ts-ignore */
|
|
248
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
249
|
+
this.newRow = input(false, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "newRow" }] : /* istanbul ignore next */ []));
|
|
251
|
+
this.row = input(null, /* @ts-ignore */
|
|
252
|
+
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
253
|
+
}
|
|
254
|
+
#dialogService;
|
|
255
|
+
cancel(event) {
|
|
256
|
+
event?.stopPropagation();
|
|
257
|
+
if (this.newRow()) {
|
|
258
|
+
this.gridService.cancelAddRow(event);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
this.gridService.cancelEdit(event);
|
|
262
|
+
}
|
|
263
|
+
edit(event) {
|
|
264
|
+
event?.stopPropagation();
|
|
265
|
+
if (!this.canEditRows()) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const row = this.row();
|
|
269
|
+
if (row != null) {
|
|
270
|
+
this.gridService.startRowEdit(row, event);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
remove(event) {
|
|
274
|
+
event?.stopPropagation();
|
|
275
|
+
const row = this.row();
|
|
276
|
+
if (row == null) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (!this.column().removeConfirmation) {
|
|
280
|
+
this.gridService.removeRow(row, event);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const dialogRef = this.#dialogService.show({
|
|
284
|
+
actions: [
|
|
285
|
+
{ look: "error", text: "Delete" },
|
|
286
|
+
{ look: "default", text: "Cancel" }
|
|
287
|
+
],
|
|
288
|
+
closeOnEscape: true,
|
|
289
|
+
text: "Are you sure you want to delete this item?",
|
|
290
|
+
title: "Delete row?",
|
|
291
|
+
type: "warning",
|
|
292
|
+
modal: true,
|
|
293
|
+
width: 360
|
|
294
|
+
});
|
|
295
|
+
dialogRef.result.pipe(take(1)).subscribe(result => {
|
|
296
|
+
if (!result.viaClose && result.action.text === "Delete") {
|
|
297
|
+
this.gridService.removeRow(row, event);
|
|
298
|
+
}
|
|
299
|
+
dialogRef.close();
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
save(event) {
|
|
303
|
+
event?.stopPropagation();
|
|
304
|
+
if (this.newRow()) {
|
|
305
|
+
this.gridService.saveAddRow(event);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this.gridService.commitRowEdit(event);
|
|
309
|
+
}
|
|
310
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
311
|
+
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: "w-full" }, ngImport: i0, template: "@if (column().commandTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().commandTemplate\"\r\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\r\n} @else {\r\n <div class=\"flex h-full items-center gap-1 px-1\">\r\n @if (isEditing()) {\r\n @if (hasRowError()) {\r\n <span class=\"shrink-0 px-1 text-error\" #rowErrorIcon>\r\n <svg lucideOctagonAlert [size]=\"14\"></svg>\r\n </span>\r\n <mona-tooltip [target]=\"rowErrorIcon\">\r\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\r\n </mona-tooltip>\r\n }\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Save row\"\r\n title=\"Save\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"save($event)\">\r\n <svg lucideCheck [size]=\"14\"></svg>\r\n </button>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Cancel row edit\"\r\n title=\"Cancel\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"cancel($event)\">\r\n <svg lucideX [size]=\"14\"></svg>\r\n </button>\r\n } @else {\r\n @if (canEditRows()) {\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Edit row\"\r\n title=\"Edit\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"edit($event)\">\r\n <svg lucidePencil [size]=\"14\"></svg>\r\n </button>\r\n }\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Remove row\"\r\n title=\"Remove\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"remove($event)\">\r\n <svg lucideTrash2 [size]=\"14\"></svg>\r\n </button>\r\n }\r\n </div>\r\n}\r\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "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"] }] }); }
|
|
312
|
+
}
|
|
313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCommandCellComponent, decorators: [{
|
|
314
|
+
type: Component,
|
|
315
|
+
args: [{ selector: "mona-grid-command-cell", imports: [
|
|
316
|
+
ButtonDirective,
|
|
317
|
+
NgTemplateOutlet,
|
|
318
|
+
LucideCheck,
|
|
319
|
+
LucideOctagonAlert,
|
|
320
|
+
LucideX,
|
|
321
|
+
LucidePencil,
|
|
322
|
+
LucideTrash2,
|
|
323
|
+
TooltipComponent
|
|
324
|
+
], host: {
|
|
325
|
+
class: "w-full"
|
|
326
|
+
}, template: "@if (column().commandTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().commandTemplate\"\r\n [ngTemplateOutletContext]=\"commandContext()\"></ng-container>\r\n} @else {\r\n <div class=\"flex h-full items-center gap-1 px-1\">\r\n @if (isEditing()) {\r\n @if (hasRowError()) {\r\n <span class=\"shrink-0 px-1 text-error\" #rowErrorIcon>\r\n <svg lucideOctagonAlert [size]=\"14\"></svg>\r\n </span>\r\n <mona-tooltip [target]=\"rowErrorIcon\">\r\n <span class=\"p-1 whitespace-pre-line\">{{ rowErrorTooltip() }}</span>\r\n </mona-tooltip>\r\n }\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Save row\"\r\n title=\"Save\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"save($event)\">\r\n <svg lucideCheck [size]=\"14\"></svg>\r\n </button>\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Cancel row edit\"\r\n title=\"Cancel\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"cancel($event)\">\r\n <svg lucideX [size]=\"14\"></svg>\r\n </button>\r\n } @else {\r\n @if (canEditRows()) {\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Edit row\"\r\n title=\"Edit\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"edit($event)\">\r\n <svg lucidePencil [size]=\"14\"></svg>\r\n </button>\r\n }\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Remove row\"\r\n title=\"Remove\"\r\n class=\"w-6 h-6\"\r\n [tabindex]=\"-1\"\r\n (click)=\"remove($event)\">\r\n <svg lucideTrash2 [size]=\"14\"></svg>\r\n </button>\r\n }\r\n </div>\r\n}\r\n" }]
|
|
327
|
+
}], 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 }] }] } });
|
|
328
|
+
|
|
329
|
+
class GridEditorComponent {
|
|
330
|
+
#datePopupOpen;
|
|
331
|
+
#elementRef;
|
|
332
|
+
#themeService;
|
|
333
|
+
#ignoreNextBooleanFocusOut;
|
|
334
|
+
constructor() {
|
|
335
|
+
this.#datePopupOpen = signal(false, /* @ts-ignore */
|
|
336
|
+
...(ngDevMode ? [{ debugName: "#datePopupOpen" }] : /* istanbul ignore next */ []));
|
|
337
|
+
this.#elementRef = inject((ElementRef));
|
|
338
|
+
this.#themeService = inject(ThemeService);
|
|
339
|
+
this.#ignoreNextBooleanFocusOut = false;
|
|
340
|
+
this.numericTextBoxRef = viewChild(NumericTextBoxComponent, /* @ts-ignore */
|
|
341
|
+
...(ngDevMode ? [{ debugName: "numericTextBoxRef" }] : /* istanbul ignore next */ []));
|
|
342
|
+
this.textBoxRef = viewChild(TextBoxComponent, /* @ts-ignore */
|
|
343
|
+
...(ngDevMode ? [{ debugName: "textBoxRef" }] : /* istanbul ignore next */ []));
|
|
344
|
+
this.baseClass = computed(() => {
|
|
345
|
+
const theme = this.#themeService.theme();
|
|
346
|
+
return gridCellEditorBaseThemeVariants(theme)();
|
|
347
|
+
}, /* @ts-ignore */
|
|
348
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
349
|
+
this.editTemplateContext = computed(() => ({
|
|
350
|
+
cancel: () => this.cancel.emit(),
|
|
351
|
+
column: this.column().field,
|
|
352
|
+
commit: () => this.commit.emit(),
|
|
353
|
+
dataField: this.column().field,
|
|
354
|
+
dataItem: this.session().model(),
|
|
355
|
+
errors: this.formField()().errors(),
|
|
356
|
+
field: this.formField(),
|
|
357
|
+
form: this.session().form,
|
|
358
|
+
invalid: this.formField()().invalid(),
|
|
359
|
+
isNew: this.isNew(),
|
|
360
|
+
session: this.session(),
|
|
361
|
+
setValue: (value) => this.#setFieldValue(value),
|
|
362
|
+
touched: this.formField()().touched(),
|
|
363
|
+
value: this.formField()().value()
|
|
364
|
+
}), /* @ts-ignore */
|
|
365
|
+
...(ngDevMode ? [{ debugName: "editTemplateContext" }] : /* istanbul ignore next */ []));
|
|
366
|
+
this.editorInputClass = computed(() => {
|
|
367
|
+
const theme = this.#themeService.theme();
|
|
368
|
+
return gridCellEditorInputThemeVariants(theme)();
|
|
369
|
+
}, /* @ts-ignore */
|
|
370
|
+
...(ngDevMode ? [{ debugName: "editorInputClass" }] : /* istanbul ignore next */ []));
|
|
371
|
+
this.fieldErrorMessage = computed(() => {
|
|
372
|
+
const [firstError] = this.formField()().errors();
|
|
373
|
+
return firstError?.message ?? "Invalid value.";
|
|
374
|
+
}, /* @ts-ignore */
|
|
375
|
+
...(ngDevMode ? [{ debugName: "fieldErrorMessage" }] : /* istanbul ignore next */ []));
|
|
376
|
+
this.formField = computed(() => {
|
|
377
|
+
const field = this.session().form[this.column().field];
|
|
378
|
+
if (field == null) {
|
|
379
|
+
throw new Error(`No signal form field was found for grid column '${this.column().field}'.`);
|
|
380
|
+
}
|
|
381
|
+
return field;
|
|
382
|
+
}, /* @ts-ignore */
|
|
383
|
+
...(ngDevMode ? [{ debugName: "formField" }] : /* istanbul ignore next */ []));
|
|
384
|
+
this.hasFieldError = computed(() => {
|
|
385
|
+
const field = this.formField()();
|
|
386
|
+
return field.invalid() && field.touched();
|
|
387
|
+
}, /* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [{ debugName: "hasFieldError" }] : /* istanbul ignore next */ []));
|
|
389
|
+
/**
|
|
390
|
+
* @description Controls whether the editor focuses its input after it renders.
|
|
391
|
+
*/
|
|
392
|
+
this.autoFocus = input(true, /* @ts-ignore */
|
|
393
|
+
...(ngDevMode ? [{ debugName: "autoFocus" }] : /* istanbul ignore next */ []));
|
|
394
|
+
this.cancel = output();
|
|
395
|
+
this.column = input.required(/* @ts-ignore */
|
|
396
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
397
|
+
this.commit = output();
|
|
398
|
+
this.isNew = input(false, /* @ts-ignore */
|
|
399
|
+
...(ngDevMode ? [{ debugName: "isNew" }] : /* istanbul ignore next */ []));
|
|
400
|
+
this.session = input.required(/* @ts-ignore */
|
|
401
|
+
...(ngDevMode ? [{ debugName: "session" }] : /* istanbul ignore next */ []));
|
|
402
|
+
effect(() => {
|
|
403
|
+
const column = this.column();
|
|
404
|
+
if (column.dataType !== "number") {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const field = this.formField();
|
|
408
|
+
const value = field().value();
|
|
409
|
+
const coercedValue = this.#coerceNumberValue(value);
|
|
410
|
+
if (Object.is(value, coercedValue)) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
untracked(() => field().value.set(coercedValue));
|
|
414
|
+
});
|
|
415
|
+
afterNextRender({
|
|
416
|
+
read: () => this.#focusEditor()
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
onBooleanEditorClick() {
|
|
420
|
+
this.#focusBooleanInput();
|
|
421
|
+
}
|
|
422
|
+
onBooleanEditorFocusOut(event) {
|
|
423
|
+
const relatedTarget = event.relatedTarget;
|
|
424
|
+
const editorHost = event.currentTarget;
|
|
425
|
+
if (relatedTarget && editorHost.contains(relatedTarget)) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (this.#ignoreNextBooleanFocusOut) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
this.commit.emit();
|
|
432
|
+
}
|
|
433
|
+
onBooleanEditorPointerDown() {
|
|
434
|
+
this.#ignoreNextBooleanFocusOut = true;
|
|
435
|
+
setTimeout(() => {
|
|
436
|
+
this.#ignoreNextBooleanFocusOut = false;
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
onDatePickerClose() {
|
|
440
|
+
this.#datePopupOpen.set(false);
|
|
441
|
+
}
|
|
442
|
+
onDatePickerEnter(event) {
|
|
443
|
+
if (this.#datePopupOpen()) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
event.target.blur();
|
|
447
|
+
}
|
|
448
|
+
onDatePickerFocusOut(event) {
|
|
449
|
+
const relatedTarget = event.relatedTarget;
|
|
450
|
+
if (relatedTarget?.closest(".cdk-overlay-container")) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const pickerHost = event.currentTarget;
|
|
454
|
+
if (pickerHost.contains(relatedTarget)) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
this.commit.emit();
|
|
458
|
+
}
|
|
459
|
+
onDatePickerOpen() {
|
|
460
|
+
this.#datePopupOpen.set(true);
|
|
461
|
+
}
|
|
462
|
+
onEditCancel() {
|
|
463
|
+
if (!this.#datePopupOpen()) {
|
|
464
|
+
this.cancel.emit();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
#coerceNumberValue(value) {
|
|
468
|
+
if (typeof value === "number") {
|
|
469
|
+
return Number.isFinite(value) ? value : null;
|
|
470
|
+
}
|
|
471
|
+
if (typeof value !== "string") {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const normalizedValue = value.trim().replace(/,/g, "");
|
|
475
|
+
if (normalizedValue === "") {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
const numberValue = Number(normalizedValue);
|
|
479
|
+
return Number.isFinite(numberValue) ? numberValue : null;
|
|
480
|
+
}
|
|
481
|
+
#focusBooleanInput() {
|
|
482
|
+
const checkbox = this.#elementRef.nativeElement.querySelector('input[type="checkbox"]');
|
|
483
|
+
checkbox?.focus();
|
|
484
|
+
}
|
|
485
|
+
#focusEditor() {
|
|
486
|
+
if (!this.autoFocus()) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
this.textBoxRef()?.focus();
|
|
490
|
+
this.numericTextBoxRef()?.focus();
|
|
491
|
+
const type = this.column().dataType;
|
|
492
|
+
if (type === "date") {
|
|
493
|
+
const inputElement = this.#elementRef.nativeElement.querySelector("input");
|
|
494
|
+
inputElement?.focus();
|
|
495
|
+
}
|
|
496
|
+
if (type === "boolean") {
|
|
497
|
+
this.#focusBooleanInput();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
#setFieldValue(value) {
|
|
501
|
+
this.formField()().value.set(value);
|
|
502
|
+
}
|
|
503
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
504
|
+
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 } }, outputs: { cancel: "cancel", commit: "commit" }, host: { 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) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().editTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\r\n} @else {\r\n <div class=\"relative flex items-center w-full h-full\">\r\n @switch (column().dataType) {\r\n @case (\"string\") {\r\n <mona-text-box\r\n [class]=\"editorInputClass()\"\r\n [inputAttributes]=\"{ autocomplete: 'off' }\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"commit.emit()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (inputBlur)=\"commit.emit()\"\r\n [size]=\"'small'\"></mona-text-box>\r\n }\r\n @case (\"number\") {\r\n <mona-numeric-text-box\r\n [class]=\"editorInputClass()\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"commit.emit()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (inputBlur)=\"commit.emit()\"\r\n [size]=\"'small'\"></mona-numeric-text-box>\r\n }\r\n @case (\"boolean\") {\r\n <mona-check-box\r\n class=\"{{ editorInputClass() }} ml-2\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (click)=\"onBooleanEditorClick()\"\r\n (focusout)=\"onBooleanEditorFocusOut($event)\"\r\n (pointerdown)=\"onBooleanEditorPointerDown()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (keydown.enter)=\"commit.emit()\"></mona-check-box>\r\n }\r\n @case (\"date\") {\r\n <mona-date-picker\r\n [class]=\"editorInputClass()\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"onDatePickerEnter($event)\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (focusout)=\"onDatePickerFocusOut($event)\"\r\n (opened)=\"onDatePickerOpen()\"\r\n (closed)=\"onDatePickerClose()\"\r\n size=\"small\"></mona-date-picker>\r\n }\r\n }\r\n @if (hasFieldError()) {\r\n <span class=\"shrink-0 px-1 text-error\" #fieldErrorIcon>\r\n <svg lucideOctagonAlert [size]=\"12\"></svg>\r\n </span>\r\n <mona-tooltip [target]=\"fieldErrorIcon\">\r\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\r\n </mona-tooltip>\r\n }\r\n </div>\r\n}\r\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: ["disabled", "disabledDates", "firstDay", "format", "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: ["aria-label", "decimals", "disabled", "formatter", "maxValue", "minValue", "nullable", "readonly", "required", "invalid", "rounded", "size", "spinners", "step", "tabindex", "touched", "class", "value"], outputs: ["inputBlur", "inputFocus", "inputFocusOut", "touch", "valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "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"] }] }); }
|
|
505
|
+
}
|
|
506
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridEditorComponent, decorators: [{
|
|
507
|
+
type: Component,
|
|
508
|
+
args: [{ selector: "mona-grid-editor", imports: [
|
|
509
|
+
CheckBoxComponent,
|
|
510
|
+
DatePickerComponent,
|
|
511
|
+
FormField,
|
|
512
|
+
LucideOctagonAlert,
|
|
513
|
+
NgTemplateOutlet,
|
|
514
|
+
NumericTextBoxComponent,
|
|
515
|
+
TextBoxComponent,
|
|
516
|
+
TooltipComponent
|
|
517
|
+
], host: {
|
|
518
|
+
"[class]": "baseClass()"
|
|
519
|
+
}, template: "@if (column().editTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().editTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: editTemplateContext() }\"></ng-container>\r\n} @else {\r\n <div class=\"relative flex items-center w-full h-full\">\r\n @switch (column().dataType) {\r\n @case (\"string\") {\r\n <mona-text-box\r\n [class]=\"editorInputClass()\"\r\n [inputAttributes]=\"{ autocomplete: 'off' }\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"commit.emit()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (inputBlur)=\"commit.emit()\"\r\n [size]=\"'small'\"></mona-text-box>\r\n }\r\n @case (\"number\") {\r\n <mona-numeric-text-box\r\n [class]=\"editorInputClass()\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"commit.emit()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (inputBlur)=\"commit.emit()\"\r\n [size]=\"'small'\"></mona-numeric-text-box>\r\n }\r\n @case (\"boolean\") {\r\n <mona-check-box\r\n class=\"{{ editorInputClass() }} ml-2\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (click)=\"onBooleanEditorClick()\"\r\n (focusout)=\"onBooleanEditorFocusOut($event)\"\r\n (pointerdown)=\"onBooleanEditorPointerDown()\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (keydown.enter)=\"commit.emit()\"></mona-check-box>\r\n }\r\n @case (\"date\") {\r\n <mona-date-picker\r\n [class]=\"editorInputClass()\"\r\n [rounded]=\"'none'\"\r\n [formField]=\"$any(formField())\"\r\n (keydown.enter)=\"onDatePickerEnter($event)\"\r\n (keydown.escape)=\"onEditCancel()\"\r\n (focusout)=\"onDatePickerFocusOut($event)\"\r\n (opened)=\"onDatePickerOpen()\"\r\n (closed)=\"onDatePickerClose()\"\r\n size=\"small\"></mona-date-picker>\r\n }\r\n }\r\n @if (hasFieldError()) {\r\n <span class=\"shrink-0 px-1 text-error\" #fieldErrorIcon>\r\n <svg lucideOctagonAlert [size]=\"12\"></svg>\r\n </span>\r\n <mona-tooltip [target]=\"fieldErrorIcon\">\r\n <span class=\"p-1\">{{ fieldErrorMessage() }}</span>\r\n </mona-tooltip>\r\n }\r\n </div>\r\n}\r\n" }]
|
|
520
|
+
}], 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 }] }], cancel: [{ type: i0.Output, args: ["cancel"] }], 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 }] }] } });
|
|
521
|
+
|
|
522
|
+
class GridAddRowComponent {
|
|
523
|
+
constructor() {
|
|
524
|
+
this.#themeService = inject(ThemeService);
|
|
525
|
+
this.baseClass = computed(() => {
|
|
526
|
+
const theme = this.#themeService.theme();
|
|
527
|
+
return gridListTableRowThemeVariants(theme)({ selected: false });
|
|
528
|
+
}, /* @ts-ignore */
|
|
529
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
530
|
+
this.gridService = inject(GridService);
|
|
531
|
+
this.columns = input(ImmutableList.create(), /* @ts-ignore */
|
|
532
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
533
|
+
}
|
|
534
|
+
#themeService;
|
|
535
|
+
onCancel() {
|
|
536
|
+
this.gridService.cancelAddRow();
|
|
537
|
+
}
|
|
538
|
+
onCommit() {
|
|
539
|
+
// Add rows are committed by the command column or toolbar save command.
|
|
540
|
+
}
|
|
541
|
+
isFirstEditableColumn(column) {
|
|
542
|
+
return this.columns().firstOrDefault(c => c.kind === "data" && c.editable) === column;
|
|
543
|
+
}
|
|
544
|
+
onValueChange(column, value) {
|
|
545
|
+
this.gridService.patchAddCell(column.field, value);
|
|
546
|
+
}
|
|
547
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
548
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: GridAddRowComponent, isStandalone: true, selector: "tr[monaGridAddRow]", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "row", "data-grid-add-row": "true" }, properties: { "class": "baseClass()" } }, ngImport: i0, template: "@if (gridService.addRowData(); as rowData) {\r\n @let session = gridService.editSession();\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"gridService.groupColumns().length * gridService.groupColumnWidth\"\r\n [masterDetailToggle]=\"true\"\r\n [rowIndex]=\"-1\"\r\n [colIndex]=\"0\"\r\n [cellKind]=\"'detail'\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [section]=\"'add'\"\r\n [style.width.px]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [dataCell]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [rowIndex]=\"-1\"\r\n [section]=\"'add'\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\">\r\n @if (column.kind === \"command\") {\r\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\r\n } @else if (column.editable && session) {\r\n <mona-grid-editor\r\n [column]=\"column\"\r\n [autoFocus]=\"isFirstEditableColumn(column)\"\r\n [isNew]=\"true\"\r\n [session]=\"session\"\r\n (commit)=\"onCommit()\"\r\n (cancel)=\"onCancel()\"></mona-grid-editor>\r\n } @else {\r\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\r\n }\r\n </td>\r\n }\r\n}\r\n", dependencies: [{ kind: "directive", type: GridCellDirective, selector: "td[monaGridCell]", inputs: ["dataCell", "groupHeader", "groupToggle", "grouped", "indentCell", "lastInRow", "masterDetailContent", "masterDetailToggle", "nextRowType", "prevRowType"] }, { 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"], outputs: ["cancel", "commit"] }, { kind: "directive", type: GridLockedCellDirective, selector: "td[monaGridLockedCell], th[monaGridLockedCell]", inputs: ["column", "lockedCellHeader", "lockedStructuralOffset"] }, { kind: "directive", type: GridLogicalCellDirective, selector: "td[monaGridLogicalCell], th[monaGridLogicalCell]", inputs: ["cellKind", "colIndex", "columnId", "firstInRow", "groupHeader", "groupKey", "lastInRow", "rowIndex", "rowUid", "section"], outputs: ["edit", "toggle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
549
|
+
}
|
|
550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridAddRowComponent, decorators: [{
|
|
551
|
+
type: Component,
|
|
552
|
+
args: [{ selector: "tr[monaGridAddRow]", changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
553
|
+
GridCellDirective,
|
|
554
|
+
GridCommandCellComponent,
|
|
555
|
+
GridEditorComponent,
|
|
556
|
+
GridLockedCellDirective,
|
|
557
|
+
GridLogicalCellDirective
|
|
558
|
+
], host: {
|
|
559
|
+
"[class]": "baseClass()",
|
|
560
|
+
role: "row",
|
|
561
|
+
"data-grid-add-row": "true"
|
|
562
|
+
}, template: "@if (gridService.addRowData(); as rowData) {\r\n @let session = gridService.editSession();\r\n @for (_ of gridService.groupColumns(); track $index) {\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [lockedCellHeader]=\"true\"\r\n [lockedStructuralOffset]=\"$index * gridService.groupColumnWidth\"\r\n [grouped]=\"true\"\r\n [indentCell]=\"true\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"gridService.groupColumnWidth\"></td>\r\n }\r\n @if (gridService.masterDetailTemplate()) {\r\n <td\r\n monaGridCell\r\n monaGridLogicalCell\r\n monaGridLockedCell\r\n [lockedStructuralOffset]=\"gridService.groupColumns().length * gridService.groupColumnWidth\"\r\n [masterDetailToggle]=\"true\"\r\n [rowIndex]=\"-1\"\r\n [colIndex]=\"0\"\r\n [cellKind]=\"'detail'\"\r\n [firstInRow]=\"true\"\r\n [lastInRow]=\"columns().length === 0\"\r\n [section]=\"'add'\"\r\n [style.width.px]=\"gridService.detailColumnWidth\"></td>\r\n }\r\n @for (column of columns(); track $index) {\r\n @let colIndex = gridService.masterDetailTemplate() ? $index + 1 : $index;\r\n <td\r\n monaGridCell\r\n monaGridLockedCell\r\n [column]=\"column\"\r\n [dataCell]=\"true\"\r\n monaGridLogicalCell\r\n [cellKind]=\"column.kind\"\r\n [colIndex]=\"colIndex\"\r\n [columnId]=\"column.id\"\r\n [rowIndex]=\"-1\"\r\n [section]=\"'add'\"\r\n [firstInRow]=\"colIndex === 0\"\r\n [lastInRow]=\"colIndex === columns().length - (gridService.masterDetailTemplate() ? 0 : 1)\"\r\n [attr.colspan]=\"1\"\r\n [style.width.px]=\"column.calculatedWidth\"\r\n [style.min-width.px]=\"column.minWidth\">\r\n @if (column.kind === \"command\") {\r\n <mona-grid-command-cell [column]=\"column\" [newRow]=\"true\"></mona-grid-command-cell>\r\n } @else if (column.editable && session) {\r\n <mona-grid-editor\r\n [column]=\"column\"\r\n [autoFocus]=\"isFirstEditableColumn(column)\"\r\n [isNew]=\"true\"\r\n [session]=\"session\"\r\n (commit)=\"onCommit()\"\r\n (cancel)=\"onCancel()\"></mona-grid-editor>\r\n } @else {\r\n <span class=\"block truncate px-2\">{{ rowData[column.field] }}</span>\r\n }\r\n </td>\r\n }\r\n}\r\n" }]
|
|
563
|
+
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }] } });
|
|
564
|
+
|
|
565
|
+
const FOCUSABLE_TARGET_SELECTOR = "button, input, select, textarea, a[href], [tabindex]";
|
|
566
|
+
class GridCellComponent {
|
|
567
|
+
constructor() {
|
|
568
|
+
this.#elementRef = inject((ElementRef));
|
|
569
|
+
this.#locale = inject(LOCALE_ID);
|
|
570
|
+
this.#themeService = inject(ThemeService);
|
|
571
|
+
this.baseClass = computed(() => {
|
|
572
|
+
const theme = this.#themeService.theme();
|
|
573
|
+
return gridCellBaseThemeVariants(theme)();
|
|
574
|
+
}, /* @ts-ignore */
|
|
575
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
576
|
+
this.cellContainerClass = computed(() => {
|
|
577
|
+
const theme = this.#themeService.theme();
|
|
578
|
+
const editing = this.isEditing();
|
|
579
|
+
return gridCellContainerThemeVariants(theme)({ editing });
|
|
580
|
+
}, /* @ts-ignore */
|
|
581
|
+
...(ngDevMode ? [{ debugName: "cellContainerClass" }] : /* istanbul ignore next */ []));
|
|
582
|
+
this.cellDirtyIndicatorClass = computed(() => {
|
|
583
|
+
const theme = this.#themeService.theme();
|
|
584
|
+
return gridCellDirtyIndicatorThemeVariants(theme)();
|
|
585
|
+
}, /* @ts-ignore */
|
|
586
|
+
...(ngDevMode ? [{ debugName: "cellDirtyIndicatorClass" }] : /* istanbul ignore next */ []));
|
|
587
|
+
this.cellTextClass = computed(() => {
|
|
588
|
+
const theme = this.#themeService.theme();
|
|
589
|
+
return gridCellTextThemeVariants(theme)();
|
|
590
|
+
}, /* @ts-ignore */
|
|
591
|
+
...(ngDevMode ? [{ debugName: "cellTextClass" }] : /* istanbul ignore next */ []));
|
|
592
|
+
this.cellUid = computed(() => `${this.row().uid}_${this.column().field}`, /* @ts-ignore */
|
|
593
|
+
...(ngDevMode ? [{ debugName: "cellUid" }] : /* istanbul ignore next */ []));
|
|
594
|
+
this.displayValue = computed(() => {
|
|
595
|
+
const editedRowData = this.gridService.editViewDict().get(this.row().uid);
|
|
596
|
+
const rowData = this.row().data;
|
|
597
|
+
const effectiveRowData = editedRowData ?? rowData;
|
|
598
|
+
return effectiveRowData[this.column().field];
|
|
599
|
+
}, /* @ts-ignore */
|
|
600
|
+
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
601
|
+
this.formattedDisplayValue = computed(() => {
|
|
602
|
+
const column = this.column();
|
|
603
|
+
const value = this.displayValue();
|
|
604
|
+
const format = column.format;
|
|
605
|
+
if (format == null) {
|
|
606
|
+
return value;
|
|
607
|
+
}
|
|
608
|
+
if (typeof format === "function") {
|
|
609
|
+
return format(column);
|
|
610
|
+
}
|
|
611
|
+
if (column.dataType === "date") {
|
|
612
|
+
return this.formatDateValue(value, format);
|
|
613
|
+
}
|
|
614
|
+
return value;
|
|
615
|
+
}, /* @ts-ignore */
|
|
616
|
+
...(ngDevMode ? [{ debugName: "formattedDisplayValue" }] : /* istanbul ignore next */ []));
|
|
617
|
+
this.gridService = inject(GridService);
|
|
618
|
+
this.isCellPristine = computed(() => {
|
|
619
|
+
const rowUid = this.row().uid;
|
|
620
|
+
const field = this.column().field;
|
|
621
|
+
const originalRowData = this.gridService.editBaseDict().get(rowUid);
|
|
622
|
+
const editedRowData = this.gridService.editViewDict().get(rowUid);
|
|
623
|
+
if (!originalRowData || !editedRowData) {
|
|
624
|
+
return true;
|
|
625
|
+
}
|
|
626
|
+
return originalRowData[field] === editedRowData[field];
|
|
627
|
+
}, /* @ts-ignore */
|
|
628
|
+
...(ngDevMode ? [{ debugName: "isCellPristine" }] : /* istanbul ignore next */ []));
|
|
629
|
+
this.isEditing = computed(() => {
|
|
630
|
+
const context = this.gridService.editContext();
|
|
631
|
+
if (context == null) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
if (context.mode === "cell") {
|
|
635
|
+
return context.cellUid === this.cellUid();
|
|
636
|
+
}
|
|
637
|
+
return context.rowUid === this.row().uid && this.column().editable;
|
|
638
|
+
}, /* @ts-ignore */
|
|
639
|
+
...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
|
|
640
|
+
this.shouldAutoFocusEditor = computed(() => {
|
|
641
|
+
const context = this.gridService.editContext();
|
|
642
|
+
if (context?.mode === "cell") {
|
|
643
|
+
return context.cellUid === this.cellUid();
|
|
644
|
+
}
|
|
645
|
+
if (context?.mode !== "row" || context.rowUid !== this.row().uid) {
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
return (this.gridService.visibleColumns().firstOrDefault(column => column.kind === "data" && column.editable) ===
|
|
649
|
+
this.column());
|
|
650
|
+
}, /* @ts-ignore */
|
|
651
|
+
...(ngDevMode ? [{ debugName: "shouldAutoFocusEditor" }] : /* istanbul ignore next */ []));
|
|
652
|
+
this.column = input.required(/* @ts-ignore */
|
|
653
|
+
...(ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []));
|
|
654
|
+
this.row = input.required(/* @ts-ignore */
|
|
655
|
+
...(ngDevMode ? [{ debugName: "row" }] : /* istanbul ignore next */ []));
|
|
656
|
+
}
|
|
657
|
+
#elementRef;
|
|
658
|
+
#locale;
|
|
659
|
+
#themeService;
|
|
660
|
+
handleLogicalCellEnter(originalEvent) {
|
|
661
|
+
if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const editableOptions = this.gridService.editableOptions();
|
|
665
|
+
if (editableOptions.mode === "cell") {
|
|
666
|
+
this.startEdit(originalEvent);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const context = this.gridService.editContext();
|
|
670
|
+
if (context?.mode === "row" && context.rowUid === this.row().uid) {
|
|
671
|
+
this.focusInnerEditor();
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
this.gridService.startRowEdit(this.row(), originalEvent);
|
|
675
|
+
}
|
|
676
|
+
onCellDoubleClick(event) {
|
|
677
|
+
if (this.gridService.editableOptions().mode === "cell") {
|
|
678
|
+
this.startEdit(event);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
onCellValueChange(value) {
|
|
682
|
+
this.gridService.patchCellEdit(this.row().uid, this.column().field, value);
|
|
683
|
+
}
|
|
684
|
+
onEditCancel() {
|
|
685
|
+
const context = this.gridService.editContext();
|
|
686
|
+
if (context?.mode === "cell") {
|
|
687
|
+
this.gridService.cancelEdit();
|
|
688
|
+
}
|
|
689
|
+
this.focusHostCell();
|
|
690
|
+
}
|
|
691
|
+
onEditCommit() {
|
|
692
|
+
const context = this.gridService.editContext();
|
|
693
|
+
if (context && context.mode === "cell") {
|
|
694
|
+
if (this.gridService.stopCellEdit()) {
|
|
695
|
+
this.focusHostCell();
|
|
696
|
+
}
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (this.#elementRef.nativeElement.contains(this.#elementRef.nativeElement.ownerDocument.activeElement)) {
|
|
700
|
+
this.focusHostCell();
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
focusHostCell() {
|
|
704
|
+
const cellElement = this.#elementRef.nativeElement.closest("td");
|
|
705
|
+
cellElement?.focus();
|
|
706
|
+
}
|
|
707
|
+
focusInnerEditor() {
|
|
708
|
+
const target = this.#elementRef.nativeElement.querySelector(FOCUSABLE_TARGET_SELECTOR);
|
|
709
|
+
target?.focus();
|
|
710
|
+
}
|
|
711
|
+
formatDateValue(value, format) {
|
|
712
|
+
if (value == null) {
|
|
713
|
+
return value;
|
|
714
|
+
}
|
|
715
|
+
if (value instanceof Date || typeof value === "number" || typeof value === "string") {
|
|
716
|
+
try {
|
|
717
|
+
return formatDate(value, format, this.#locale);
|
|
718
|
+
}
|
|
719
|
+
catch {
|
|
720
|
+
return value;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return value;
|
|
724
|
+
}
|
|
725
|
+
startEdit(originalEvent) {
|
|
726
|
+
if (!this.gridService.editableOptions().enabled || !this.column().editable || this.column().kind !== "data") {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
this.gridService.startCellEdit(this.cellUid(), this.row(), this.column(), originalEvent);
|
|
730
|
+
}
|
|
731
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
732
|
+
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;\r\n@let dataKey = column().field;\r\n\r\n@if (column().kind === \"command\") {\r\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\r\n} @else {\r\n <div\r\n role=\"gridcell\"\r\n [class]=\"cellContainerClass()\"\r\n cdkMonitorSubtreeFocus\r\n [attr.data-uid]=\"cellUid()\"\r\n [attr.data-ruid]=\"row().uid\"\r\n [attr.data-field]=\"dataKey\"\r\n [attr.data-col-index]=\"column().index\"\r\n [attr.aria-readonly]=\"!(gridService.editableOptions().enabled && column().editable)\"\r\n (dblclick)=\"onCellDoubleClick($event)\">\r\n @if (isEditing() && gridService.editSession(); as session) {\r\n <mona-grid-editor\r\n [column]=\"column()\"\r\n [autoFocus]=\"shouldAutoFocusEditor()\"\r\n [session]=\"session\"\r\n (commit)=\"onEditCommit()\"\r\n (cancel)=\"onEditCancel()\"></mona-grid-editor>\r\n } @else if (column().cellTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().cellTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\r\n } @else {\r\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\r\n }\r\n @if (!isCellPristine()) {\r\n <span aria-hidden=\"true\" [class]=\"cellDirtyIndicatorClass()\" title=\"Modified\"></span>\r\n }\r\n </div>\r\n}\r\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"], outputs: ["cancel", "commit"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
733
|
+
}
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridCellComponent, decorators: [{
|
|
735
|
+
type: Component,
|
|
736
|
+
args: [{ selector: "mona-grid-cell", imports: [A11yModule, GridCommandCellComponent, GridEditorComponent, NgTemplateOutlet], host: {
|
|
737
|
+
"[class]": "baseClass()"
|
|
738
|
+
}, template: "@let dataItem = row().data;\r\n@let dataKey = column().field;\r\n\r\n@if (column().kind === \"command\") {\r\n <mona-grid-command-cell [column]=\"column()\" [row]=\"row()\"></mona-grid-command-cell>\r\n} @else {\r\n <div\r\n role=\"gridcell\"\r\n [class]=\"cellContainerClass()\"\r\n cdkMonitorSubtreeFocus\r\n [attr.data-uid]=\"cellUid()\"\r\n [attr.data-ruid]=\"row().uid\"\r\n [attr.data-field]=\"dataKey\"\r\n [attr.data-col-index]=\"column().index\"\r\n [attr.aria-readonly]=\"!(gridService.editableOptions().enabled && column().editable)\"\r\n (dblclick)=\"onCellDoubleClick($event)\">\r\n @if (isEditing() && gridService.editSession(); as session) {\r\n <mona-grid-editor\r\n [column]=\"column()\"\r\n [autoFocus]=\"shouldAutoFocusEditor()\"\r\n [session]=\"session\"\r\n (commit)=\"onEditCommit()\"\r\n (cancel)=\"onEditCancel()\"></mona-grid-editor>\r\n } @else if (column().cellTemplate) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"column().cellTemplate\"\r\n [ngTemplateOutletContext]=\"{ $implicit: dataItem, column: column().field }\"></ng-container>\r\n } @else {\r\n <span [class]=\"cellTextClass()\">{{ formattedDisplayValue() }}</span>\r\n }\r\n @if (!isCellPristine()) {\r\n <span aria-hidden=\"true\" [class]=\"cellDirtyIndicatorClass()\" title=\"Modified\"></span>\r\n }\r\n </div>\r\n}\r\n" }]
|
|
739
|
+
}], propDecorators: { column: [{ type: i0.Input, args: [{ isSignal: true, alias: "column", required: true }] }], row: [{ type: i0.Input, args: [{ isSignal: true, alias: "row", required: true }] }] } });
|
|
740
|
+
|
|
741
|
+
class GridToggleComponent {
|
|
742
|
+
constructor() {
|
|
743
|
+
this.collapseIcon = computed(() => {
|
|
744
|
+
const type = this.type();
|
|
745
|
+
return type === "detail" ? LucideMinus : LucideChevronDown;
|
|
746
|
+
}, /* @ts-ignore */
|
|
747
|
+
...(ngDevMode ? [{ debugName: "collapseIcon" }] : /* istanbul ignore next */ []));
|
|
748
|
+
this.expandIcon = computed(() => {
|
|
749
|
+
const type = this.type();
|
|
750
|
+
return type === "detail" ? LucidePlus : LucideChevronRight;
|
|
751
|
+
}, /* @ts-ignore */
|
|
752
|
+
...(ngDevMode ? [{ debugName: "expandIcon" }] : /* istanbul ignore next */ []));
|
|
753
|
+
this.expanded = model.required(/* @ts-ignore */
|
|
754
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
755
|
+
this.type = input.required(/* @ts-ignore */
|
|
756
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
757
|
+
this.width = input.required(/* @ts-ignore */
|
|
758
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
759
|
+
}
|
|
760
|
+
onToggleDetailClick(event) {
|
|
761
|
+
event.stopPropagation();
|
|
762
|
+
this.expanded.update(v => !v);
|
|
763
|
+
}
|
|
764
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
765
|
+
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\r\n [style.width.px]=\"width()\"\r\n class=\"inline-flex items-center justify-center h-full aspect-square\"\r\n (click)=\"onToggleDetailClick($event)\">\r\n @if (expanded()) {\r\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\r\n } @else {\r\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\r\n }\r\n</span>\r\n", dependencies: [{ kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
766
|
+
}
|
|
767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: GridToggleComponent, decorators: [{
|
|
768
|
+
type: Component,
|
|
769
|
+
args: [{ selector: "mona-grid-toggle", imports: [LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\r\n [style.width.px]=\"width()\"\r\n class=\"inline-flex items-center justify-center h-full aspect-square\"\r\n (click)=\"onToggleDetailClick($event)\">\r\n @if (expanded()) {\r\n <svg [lucideIcon]=\"collapseIcon()\" [size]=\"16\"></svg>\r\n } @else {\r\n <svg [lucideIcon]=\"expandIcon()\" [size]=\"16\"></svg>\r\n }\r\n</span>\r\n" }]
|
|
770
|
+
}], 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 }] }] } });
|
|
771
|
+
|
|
772
|
+
export { GridAddRowComponent as G, GridCellComponent as a, GridRowDirective as b, GridCellDirective as c, GridDetailRowDirective as d, GridDetailIndentCellDirective as e, GridDetailContentCellDirective as f, GridToggleComponent as g };
|
|
773
|
+
//# sourceMappingURL=nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs.map
|