@mosa-ng/material 20.1.1 → 21.0.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.
@@ -1,5 +1,1048 @@
1
- import { AssetsI18nLoaderService } from '@mosa-ng/core';
2
- import { makeEnvironmentProviders, provideAppInitializer, inject } from '@angular/core';
1
+ import { isZeroOrHigher, isNumber, isNullOrEmpty, MosaDurationPipe, ApiService, CoreLoggerService, AssetsI18nLoaderService } from '@mosa-ng/core';
2
+ import * as i0 from '@angular/core';
3
+ import { Input, ChangeDetectionStrategy, Component, Inject, Optional, EventEmitter, inject, ChangeDetectorRef, ElementRef, ContentChild, Output, Injectable, ViewChildren, HostListener, Directive, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';
4
+ import { MatIcon } from '@angular/material/icon';
5
+ import { MatTableDataSource, MatTable, MatColumnDef, MatHeaderCellDef, MatHeaderCell, MatCellDef, MatCell, MatHeaderRowDef, MatHeaderRow, MatRowDef, MatRow } from '@angular/material/table';
6
+ import * as i1 from '@angular/material/dialog';
7
+ import { MAT_DIALOG_DATA, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogRef, MatDialog } from '@angular/material/dialog';
8
+ import { MatButton, MatIconButton } from '@angular/material/button';
9
+ import { UpperCasePipe, NgTemplateOutlet, AsyncPipe } from '@angular/common';
10
+ import * as i2 from '@ngx-translate/core';
11
+ import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
12
+ import { firstValueFrom, BehaviorSubject, timer } from 'rxjs';
13
+ import { MatSelect } from '@angular/material/select';
14
+ import { MatProgressSpinner } from '@angular/material/progress-spinner';
15
+ import { MatProgressBar } from '@angular/material/progress-bar';
16
+ import { trigger, state, transition, style, animate } from '@angular/animations';
17
+ import { MatList, MatListItem } from '@angular/material/list';
18
+
19
+ class AlertWidget {
20
+ constructor() {
21
+ }
22
+ ngOnInit() {
23
+ this.updateData();
24
+ }
25
+ ngOnChanges(_changes) {
26
+ this.updateData();
27
+ }
28
+ updateData() {
29
+ if (!this.title || !this.icon) {
30
+ switch (this.type) {
31
+ case 'error':
32
+ this.icon ||= 'alert-circle-outline';
33
+ this.title ||= 'Error';
34
+ break;
35
+ case 'info':
36
+ this.icon ||= 'information-outline';
37
+ this.title ||= 'Information';
38
+ break;
39
+ case 'success':
40
+ this.icon ||= 'check';
41
+ this.title ||= 'Success';
42
+ break;
43
+ case 'warning':
44
+ this.icon ||= 'alert-outline';
45
+ this.title ||= 'Warning';
46
+ break;
47
+ default:
48
+ this.icon ||= 'information-outline';
49
+ this.title ||= 'Alert';
50
+ break;
51
+ }
52
+ }
53
+ }
54
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AlertWidget, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
55
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: AlertWidget, isStandalone: true, selector: "mosa-alert-widget", inputs: { icon: "icon", title: "title", message: "message", type: "type" }, usesOnChanges: true, ngImport: i0, template: "<div [class]=\"'alert-' + type\" class=\"alert\">\n <div class=\"icon\">\n <mat-icon>icon</mat-icon>\n {{ title }}\n </div>\n <div>{{ message }}</div>\n</div>\n", styles: [":host{display:block}.alert{position:relative;padding:15px;border-radius:4px;width:100%;display:table;color:#222;border:1px solid #222222;border-left-width:5px}.alert .icon{display:flex;align-items:center;margin-bottom:10px}.alert .icon mat-icon{margin-right:10px}.alert-danger{background:#f443361a;border-color:#f44336}.alert-warning{background:#ffaa001a;border-color:#fa0}.alert-info{background:#008eff1a;border-color:#008eff}.alert-primary{background:#66cc331a;border-color:#6c3}.alert-success{background:#3ad15d1a;border-color:#3ad15d}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
56
+ }
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AlertWidget, decorators: [{
58
+ type: Component,
59
+ args: [{ selector: 'mosa-alert-widget', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIcon], template: "<div [class]=\"'alert-' + type\" class=\"alert\">\n <div class=\"icon\">\n <mat-icon>icon</mat-icon>\n {{ title }}\n </div>\n <div>{{ message }}</div>\n</div>\n", styles: [":host{display:block}.alert{position:relative;padding:15px;border-radius:4px;width:100%;display:table;color:#222;border:1px solid #222222;border-left-width:5px}.alert .icon{display:flex;align-items:center;margin-bottom:10px}.alert .icon mat-icon{margin-right:10px}.alert-danger{background:#f443361a;border-color:#f44336}.alert-warning{background:#ffaa001a;border-color:#fa0}.alert-info{background:#008eff1a;border-color:#008eff}.alert-primary{background:#66cc331a;border-color:#6c3}.alert-success{background:#3ad15d1a;border-color:#3ad15d}\n"] }]
60
+ }], ctorParameters: () => [], propDecorators: { icon: [{
61
+ type: Input
62
+ }], title: [{
63
+ type: Input
64
+ }], message: [{
65
+ type: Input
66
+ }], type: [{
67
+ type: Input
68
+ }] } });
69
+
70
+ // eslint-disable-next-line max-classes-per-file
71
+ var ConfirmDialogResult;
72
+ (function (ConfirmDialogResult) {
73
+ ConfirmDialogResult[ConfirmDialogResult["confirmed"] = 0] = "confirmed";
74
+ ConfirmDialogResult[ConfirmDialogResult["denied"] = 1] = "denied";
75
+ ConfirmDialogResult[ConfirmDialogResult["cancelled"] = 2] = "cancelled";
76
+ })(ConfirmDialogResult || (ConfirmDialogResult = {}));
77
+ class ConfirmDialogAction {
78
+ constructor(label, visible) {
79
+ this.label = label;
80
+ this.visible = visible;
81
+ }
82
+ }
83
+ class ConfirmDialogData {
84
+ constructor(title, message, cancel, confirm, deny) {
85
+ this.title = title;
86
+ this.message = message;
87
+ this.cancel = cancel;
88
+ this.confirm = confirm;
89
+ this.deny = deny;
90
+ }
91
+ }
92
+
93
+ class ConfirmDialog {
94
+ constructor(myConfirmDialogData, myMatDialogRef) {
95
+ this.myConfirmDialogData = myConfirmDialogData;
96
+ this.myMatDialogRef = myMatDialogRef;
97
+ this.result = ConfirmDialogResult;
98
+ const cancel = new ConfirmDialogAction('mosa.commons.buttons.cancel', true);
99
+ const deny = new ConfirmDialogAction('mosa.commons.buttons.deny');
100
+ const confirm = new ConfirmDialogAction('mosa.commons.buttons.confirm', true);
101
+ const title = 'mosa.components.confirmDialog.title';
102
+ const message = 'mosa.components.confirmDialog.message';
103
+ this.dialogData = myConfirmDialogData || new ConfirmDialogData(title, message, cancel, confirm, deny);
104
+ if (!this.dialogData.title) {
105
+ this.dialogData.title = title;
106
+ }
107
+ if (!this.dialogData.message) {
108
+ this.dialogData.message = message;
109
+ }
110
+ if (!this.dialogData.cancel) {
111
+ this.dialogData.cancel = cancel;
112
+ }
113
+ if (!this.dialogData.confirm) {
114
+ this.dialogData.confirm = confirm;
115
+ }
116
+ if (!this.dialogData.deny) {
117
+ this.dialogData.deny = deny;
118
+ }
119
+ }
120
+ ngOnInit() {
121
+ //
122
+ }
123
+ confirm(result) {
124
+ this.myMatDialogRef.close(result);
125
+ }
126
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ConfirmDialog, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component }); }
127
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ConfirmDialog, isStandalone: true, selector: "mosa-confirm-dialog", ngImport: i0, template: "<h1 class=\"active\" mat-dialog-title>{{ dialogData.title | translate }}</h1>\n<div mat-dialog-content>\n {{ dialogData.message | translate }}\n</div>\n<div mat-dialog-actions>\n @if (dialogData.cancel) {\n <button (click)=\"confirm(result.cancelled)\" color=\"primary\" mat-stroked-button>\n {{ 'mosa.commons.buttons.cancel' | translate | uppercase }}\n </button>\n }\n @if (dialogData.deny?.visible) {\n <button (click)=\"confirm(result.denied)\" color=\"primary\" mat-stroked-button>\n {{ dialogData.deny?.label | translate | uppercase }}\n </button>\n }\n @if (dialogData.confirm?.visible) {\n <button (click)=\"confirm(result.confirmed)\" color=\"primary\" mat-flat-button>\n {{ dialogData.confirm?.label | translate | uppercase }}\n </button>\n }\n</div>\n", styles: [".mat-dialog-actions{margin-top:20px}\n"], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
128
+ }
129
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ConfirmDialog, decorators: [{
130
+ type: Component,
131
+ args: [{ selector: 'mosa-confirm-dialog', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
132
+ MatDialogTitle,
133
+ MatDialogContent,
134
+ MatDialogActions,
135
+ MatButton,
136
+ UpperCasePipe,
137
+ TranslateModule,
138
+ ], template: "<h1 class=\"active\" mat-dialog-title>{{ dialogData.title | translate }}</h1>\n<div mat-dialog-content>\n {{ dialogData.message | translate }}\n</div>\n<div mat-dialog-actions>\n @if (dialogData.cancel) {\n <button (click)=\"confirm(result.cancelled)\" color=\"primary\" mat-stroked-button>\n {{ 'mosa.commons.buttons.cancel' | translate | uppercase }}\n </button>\n }\n @if (dialogData.deny?.visible) {\n <button (click)=\"confirm(result.denied)\" color=\"primary\" mat-stroked-button>\n {{ dialogData.deny?.label | translate | uppercase }}\n </button>\n }\n @if (dialogData.confirm?.visible) {\n <button (click)=\"confirm(result.confirmed)\" color=\"primary\" mat-flat-button>\n {{ dialogData.confirm?.label | translate | uppercase }}\n </button>\n }\n</div>\n", styles: [".mat-dialog-actions{margin-top:20px}\n"] }]
139
+ }], ctorParameters: () => [{ type: ConfirmDialogData, decorators: [{
140
+ type: Inject,
141
+ args: [MAT_DIALOG_DATA]
142
+ }] }, { type: i1.MatDialogRef }] });
143
+
144
+ class CellEditorBaseComponent {
145
+ constructor(myMatDialog) {
146
+ this.myMatDialog = myMatDialog;
147
+ this.dataSource = new MatTableDataSource();
148
+ this.displayedColumns = [];
149
+ }
150
+ ngOnInit() {
151
+ //
152
+ }
153
+ get changedRows() {
154
+ return this.dataSource?.data?.filter((c) => !!c.changedRowKeys && c.changedRowKeys?.length > 0);
155
+ }
156
+ /**
157
+ * Remove table item data
158
+ * @param data
159
+ */
160
+ serializeData(data) {
161
+ return data.map((val) => {
162
+ delete val.changedRowKeys;
163
+ delete val.rowOriginalData;
164
+ return val;
165
+ });
166
+ }
167
+ toTableItems(data) {
168
+ return data.map((val) => ({
169
+ ...val,
170
+ rowOriginalData: val,
171
+ changedRowKeys: [],
172
+ }));
173
+ }
174
+ async canDeactivate(_component, _currentRoute, _currentState, _nextState) {
175
+ if (!this.changedRows.length) {
176
+ return true;
177
+ }
178
+ const result = await firstValueFrom(this.myMatDialog
179
+ .open(ConfirmDialog, {
180
+ width: '600px',
181
+ data: new ConfirmDialogData('mosa.components.cellEditorBase.discardChanges.label', 'mosa.components.cellEditorBase.discardChanges.message'),
182
+ })
183
+ .afterClosed());
184
+ return result === ConfirmDialogResult.confirmed;
185
+ }
186
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorBaseComponent, deps: [{ token: i1.MatDialog, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
187
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: CellEditorBaseComponent, isStandalone: true, selector: "mosa-cell-editor-base", ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
188
+ }
189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorBaseComponent, decorators: [{
190
+ type: Component,
191
+ args: [{
192
+ selector: 'mosa-cell-editor-base',
193
+ template: '',
194
+ changeDetection: ChangeDetectionStrategy.OnPush,
195
+ }]
196
+ }], ctorParameters: () => [{ type: i1.MatDialog, decorators: [{
197
+ type: Optional
198
+ }] }] });
199
+
200
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
+ class CellEditorComponent {
202
+ constructor() {
203
+ this.key = '';
204
+ this.valueChange = new EventEmitter();
205
+ this.cellClick = new EventEmitter();
206
+ this.cellChange = new EventEmitter();
207
+ this.cellCancel = new EventEmitter();
208
+ this.mode = 'output';
209
+ this.myChangeDetectorRef = inject(ChangeDetectorRef);
210
+ this.myElementRef = inject((ElementRef));
211
+ }
212
+ get element() {
213
+ return this.myElementRef.nativeElement;
214
+ }
215
+ ngOnInit() {
216
+ this.oldValue = this.value;
217
+ this.rowItem.rowOriginalData = this.rowItem;
218
+ }
219
+ toOutput(save) {
220
+ if (this.mode !== 'output') {
221
+ this.mode = 'output';
222
+ this.myChangeDetectorRef.markForCheck();
223
+ this.element.classList.remove('focused');
224
+ if (save) {
225
+ if (!this.rowItem.changedRowKeys) {
226
+ this.rowItem.changedRowKeys = [];
227
+ }
228
+ const index = this.rowItem.changedRowKeys.indexOf(this.key);
229
+ if (this.value !== this.oldValue) {
230
+ if (index === -1) {
231
+ this.rowItem.changedRowKeys.push(this.key);
232
+ this.element.classList.add('edited');
233
+ }
234
+ this.cellChange.emit();
235
+ }
236
+ else {
237
+ if (index !== -1) {
238
+ this.rowItem.changedRowKeys.splice(index, 1);
239
+ this.element.classList.remove('edited');
240
+ }
241
+ }
242
+ }
243
+ else {
244
+ this.value = this.oldValue;
245
+ this.cellCancel.emit();
246
+ }
247
+ this.valueChange.next(this.value);
248
+ }
249
+ }
250
+ toInput() {
251
+ this.mode = 'input';
252
+ this.myChangeDetectorRef.markForCheck();
253
+ this.element.classList.add('focused');
254
+ setTimeout(() => {
255
+ const comp = this.element.querySelector('.cell-input');
256
+ if (comp instanceof HTMLInputElement) {
257
+ comp.focus();
258
+ }
259
+ else if (this.select) {
260
+ this.select.open();
261
+ }
262
+ });
263
+ }
264
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
265
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CellEditorComponent, isStandalone: true, selector: "mosa-cell-editor", inputs: { key: "key", rowItem: "rowItem", value: "value" }, outputs: { valueChange: "valueChange", cellClick: "cellClick", cellChange: "cellChange", cellCancel: "cellCancel" }, queries: [{ propertyName: "select", first: true, predicate: MatSelect, descendants: true }], ngImport: i0, template: "@if (mode === 'input') {\n <div class=\"input-wrapper\">\n <ng-content select=\".cell-input\"></ng-content>\n </div>\n}\n@if (mode === 'output') {\n <div class=\"output-wrapper\">\n <ng-content select=\".cell-output\"></ng-content>\n </div>\n}\n", styles: [":host{display:flex;align-items:center;position:absolute;width:100%;height:100%;top:0;left:0;z-index:1}:host.focused .input-wrapper{height:calc(100% - 6px);width:100%;box-shadow:0 0 0 3px #1387dfcc;outline:0;display:flex;flex-direction:column}:host.edited{color:#1387df;font-weight:500}::ng-deep .editable-cell{position:relative}::ng-deep .editable-cell:first-child mosa-cell-editor:not(.focused){padding-left:24px}::ng-deep .cell-input{padding:10px}::ng-deep .cell-output{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}::ng-deep input.cell-input{font-size:14px;font-family:Roboto,sans-serif;background:none;flex-grow:1;outline:0;border:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
266
+ }
267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorComponent, decorators: [{
268
+ type: Component,
269
+ args: [{ selector: 'mosa-cell-editor', changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (mode === 'input') {\n <div class=\"input-wrapper\">\n <ng-content select=\".cell-input\"></ng-content>\n </div>\n}\n@if (mode === 'output') {\n <div class=\"output-wrapper\">\n <ng-content select=\".cell-output\"></ng-content>\n </div>\n}\n", styles: [":host{display:flex;align-items:center;position:absolute;width:100%;height:100%;top:0;left:0;z-index:1}:host.focused .input-wrapper{height:calc(100% - 6px);width:100%;box-shadow:0 0 0 3px #1387dfcc;outline:0;display:flex;flex-direction:column}:host.edited{color:#1387df;font-weight:500}::ng-deep .editable-cell{position:relative}::ng-deep .editable-cell:first-child mosa-cell-editor:not(.focused){padding-left:24px}::ng-deep .cell-input{padding:10px}::ng-deep .cell-output{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}::ng-deep input.cell-input{font-size:14px;font-family:Roboto,sans-serif;background:none;flex-grow:1;outline:0;border:none}\n"] }]
270
+ }], ctorParameters: () => [], propDecorators: { key: [{
271
+ type: Input
272
+ }], rowItem: [{
273
+ type: Input
274
+ }], value: [{
275
+ type: Input
276
+ }], valueChange: [{
277
+ type: Output
278
+ }], cellClick: [{
279
+ type: Output
280
+ }], cellChange: [{
281
+ type: Output
282
+ }], cellCancel: [{
283
+ type: Output
284
+ }], select: [{
285
+ type: ContentChild,
286
+ args: [MatSelect]
287
+ }] } });
288
+
289
+ class LoadingButtonComponent {
290
+ constructor() {
291
+ this.mode = 'spinner';
292
+ this.loading = false;
293
+ this.disabled = false;
294
+ this.color = 'primary';
295
+ this.buttonType = 'default';
296
+ this.click = new EventEmitter();
297
+ }
298
+ onClick(e) {
299
+ e.stopPropagation();
300
+ this.click.emit(e);
301
+ }
302
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
303
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: LoadingButtonComponent, isStandalone: true, selector: "mosa-loading-button", inputs: { mode: "mode", loading: "loading", disabled: "disabled", color: "color", buttonType: "buttonType", icon: "icon" }, outputs: { click: "click" }, ngImport: i0, template: "@switch (buttonType) {\n @default {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('raised') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-raised-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('stroked') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-stroked-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('flat') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-flat-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('icon') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-icon-button>\n @if (loading) {\n <mat-spinner class=\"icon-spinner\" [color]=\"color\" [diameter]=\"40\" [strokeWidth]=\"2\"></mat-spinner>\n } @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n <ng-content select=\".icon\"></ng-content>\n </button>\n }\n}\n\n<ng-template #buttonContent>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n } @switch (mode) {\n @case ('spinner') {\n <div class=\"spinner-inner\">\n @if (loading) {\n <mat-spinner [color]=\"color\" [diameter]=\"20\"></mat-spinner>\n }\n <span [class.loading]=\"loading\" class=\"label\">\n <ng-content select=\".spinner-label\"></ng-content>\n </span>\n </div>\n } @case ('progress-bar') {\n <ng-content select=\".progress-bar-label\"></ng-content>\n @if (loading) {\n <mat-progress-bar [color]=\"color\" mode=\"indeterminate\"></mat-progress-bar>\n }\n }\n}\n</ng-template>\n", styles: [":host{pointer-events:none}button:not(:disabled){pointer-events:all}.icon-spinner{position:absolute;top:0;left:0}.spinner .spinner-inner{display:flex;align-items:center}.spinner .spinner-inner mat-spinner{position:absolute}.spinner .spinner-inner .label.loading{margin-left:30px}.progress-bar{overflow:hidden;position:relative}.progress-bar mat-progress-bar{position:absolute;bottom:0;left:0;width:100%}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
304
+ }
305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingButtonComponent, decorators: [{
306
+ type: Component,
307
+ args: [{ selector: 'mosa-loading-button', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
308
+ MatButton,
309
+ NgTemplateOutlet,
310
+ MatIconButton,
311
+ MatProgressSpinner,
312
+ MatIcon,
313
+ MatProgressBar,
314
+ ], template: "@switch (buttonType) {\n @default {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('raised') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-raised-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('stroked') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-stroked-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('flat') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-flat-button>\n <ng-container [ngTemplateOutlet]=\"buttonContent\"></ng-container>\n </button>\n } @case ('icon') {\n <button (click)=\"onClick($event)\" [class]=\"mode\" [color]=\"color\"\n [disabled]=\"loading || disabled\" mat-icon-button>\n @if (loading) {\n <mat-spinner class=\"icon-spinner\" [color]=\"color\" [diameter]=\"40\" [strokeWidth]=\"2\"></mat-spinner>\n } @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n <ng-content select=\".icon\"></ng-content>\n </button>\n }\n}\n\n<ng-template #buttonContent>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n } @switch (mode) {\n @case ('spinner') {\n <div class=\"spinner-inner\">\n @if (loading) {\n <mat-spinner [color]=\"color\" [diameter]=\"20\"></mat-spinner>\n }\n <span [class.loading]=\"loading\" class=\"label\">\n <ng-content select=\".spinner-label\"></ng-content>\n </span>\n </div>\n } @case ('progress-bar') {\n <ng-content select=\".progress-bar-label\"></ng-content>\n @if (loading) {\n <mat-progress-bar [color]=\"color\" mode=\"indeterminate\"></mat-progress-bar>\n }\n }\n}\n</ng-template>\n", styles: [":host{pointer-events:none}button:not(:disabled){pointer-events:all}.icon-spinner{position:absolute;top:0;left:0}.spinner .spinner-inner{display:flex;align-items:center}.spinner .spinner-inner mat-spinner{position:absolute}.spinner .spinner-inner .label.loading{margin-left:30px}.progress-bar{overflow:hidden;position:relative}.progress-bar mat-progress-bar{position:absolute;bottom:0;left:0;width:100%}\n"] }]
315
+ }], ctorParameters: () => [], propDecorators: { mode: [{
316
+ type: Input
317
+ }], loading: [{
318
+ type: Input
319
+ }], disabled: [{
320
+ type: Input
321
+ }], color: [{
322
+ type: Input
323
+ }], buttonType: [{
324
+ type: Input
325
+ }], icon: [{
326
+ type: Input
327
+ }], click: [{
328
+ type: Output
329
+ }] } });
330
+
331
+ let _state = {
332
+ logs: [],
333
+ };
334
+ class LoggerFacade {
335
+ constructor() {
336
+ this.store$ = new BehaviorSubject(_state);
337
+ }
338
+ get snapshot() {
339
+ return this.store$.value;
340
+ }
341
+ subState() {
342
+ return this.store$.asObservable();
343
+ }
344
+ updateLogs(logs) {
345
+ this.updateState({ ..._state, logs });
346
+ }
347
+ updateState(state) {
348
+ this.store$.next(_state = state);
349
+ }
350
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
351
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerFacade, providedIn: 'root' }); }
352
+ }
353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerFacade, decorators: [{
354
+ type: Injectable,
355
+ args: [{
356
+ providedIn: 'root',
357
+ }]
358
+ }], ctorParameters: () => [] });
359
+
360
+ class LoggerComponent {
361
+ constructor() {
362
+ this.myLoggerFacade = inject(LoggerFacade);
363
+ }
364
+ ngOnInit() {
365
+ this.loggerState$ = this.myLoggerFacade.subState();
366
+ }
367
+ onClickLog(log) {
368
+ if (log.config.closeOnClick) {
369
+ this.slideOut(log.id);
370
+ }
371
+ }
372
+ /**
373
+ * Shows the snackbar
374
+ * @param title
375
+ * @param message
376
+ * @param type
377
+ * @param config
378
+ */
379
+ slideIn(title, message, type, config) {
380
+ const logs = [...this.myLoggerFacade.snapshot.logs];
381
+ const i = logs.length;
382
+ let icon;
383
+ switch (type) {
384
+ case 'error':
385
+ icon = 'error';
386
+ break;
387
+ case 'warning':
388
+ icon = 'warning';
389
+ break;
390
+ case 'info':
391
+ icon = 'info';
392
+ break;
393
+ case 'success':
394
+ icon = 'done';
395
+ break;
396
+ default:
397
+ icon = 'notifications';
398
+ break;
399
+ }
400
+ logs.push({ id: i, title, message, config, state: 'enter', icon });
401
+ this.myLoggerFacade.updateLogs(logs);
402
+ return i;
403
+ }
404
+ /**
405
+ * Hides the log
406
+ * @param id
407
+ */
408
+ slideOut(id) {
409
+ let logs = [...this.myLoggerFacade.snapshot.logs];
410
+ if (logs.length > 0) {
411
+ const item = logs.find((e) => e.id === id);
412
+ if (!item) {
413
+ return;
414
+ }
415
+ item.state = 'leave';
416
+ this.myLoggerFacade.updateLogs(logs);
417
+ setTimeout(() => {
418
+ logs = [...this.myLoggerFacade.snapshot.logs];
419
+ const index = logs.findIndex((log) => log.id === item.id);
420
+ logs.splice(index, 1);
421
+ this.myLoggerFacade.updateLogs(logs);
422
+ }, 200);
423
+ }
424
+ }
425
+ callAction(log) {
426
+ log.config.action?.callback?.call(this);
427
+ this.slideOut(log.id);
428
+ }
429
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
430
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: LoggerComponent, isStandalone: true, selector: "mosa-logger", viewQueries: [{ propertyName: "elements", predicate: ["loggerElement"], descendants: true }], ngImport: i0, template: "@if (loggerState$ | async; as state) {\n @for (log of state.logs; track log) {\n <div #loggerElement\n [@slide]=\"log.state\"\n [class.none]=\"!log.state\"\n [class]=\"log.config.className\"\n (click)=\"onClickLog(log)\"\n [class.touch]=\"log.config.closeOnClick\"\n class=\"logger-element\">\n <div class=\"content\">\n <mat-icon class=\"icon\">{{ log.icon }}</mat-icon>\n <div>\n @if (log.title) {\n <div class=\"title\">{{ log.title | translate }}</div>\n } @if (log.message) {\n <div [innerHTML]=\"log.message | translate\" class=\"message\"></div>\n }\n </div>\n </div>\n @if (log.config.action || log.config.showDismiss) {\n <div class=\"actions\">\n @if (log.config.showDismiss) {\n <button (click)=\"slideOut(log.id)\" class=\"dismiss\" mat-button>\n {{ 'mosa.commons.buttons.dismiss' | translate | uppercase }}\n </button>\n } @if (log.config.action && log.config.action.label && log.config.action.callback) {\n <button (click)=\"$event.stopPropagation(); callAction(log)\"\n class=\"action-btn\" mat-button>\n {{ log.config.action.label | translate | uppercase }}\n </button>\n }\n </div>\n }\n </div>\n }\n}\n\n", styles: [":host{width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;position:fixed;z-index:10000;align-items:flex-end;pointer-events:none}.logger-element{padding:10px 15px;margin:10px 10px 0;width:350px;background:#fff;border-radius:4px;box-shadow:3px 3px 10px #0000004d;border-left:5px solid;pointer-events:all;max-height:400px}.logger-element.touch{cursor:pointer}.logger-element .content{display:flex;width:100%}.logger-element .content .icon{flex-shrink:0;margin-right:10px}.logger-element .content .title{font-weight:500;color:#222}.logger-element .content .message{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;max-lines:3;text-overflow:ellipsis;flex:1 auto;font-size:15px;margin-top:3px;color:#222}.logger-element .actions{display:flex;justify-content:flex-end;margin-top:10px}.logger-element .dismiss{color:#222}.logger-element button:not(:first-child){margin-left:10px}.logger-element.snackbar-error{border-color:#f44336;color:#f44336}.logger-element.snackbar-error button.action-btn{background-color:#d2190b;color:#fff}.logger-element.snackbar-success{border-color:#3ad15d;color:#3ad15d}.logger-element.snackbar-success button.action-btn{background-color:#249a40;color:#fff}.logger-element.snackbar-warning{border-color:#fa0;color:#fa0}.logger-element.snackbar-warning button.action-btn{background-color:#c80;color:#fff}.logger-element.snackbar-info{border-color:#008eff;color:#008eff}.logger-element.snackbar-info button.action-btn{background-color:#0063b3;color:#fff}.logger-element.snackbar-default{border-color:#222;color:#222}.logger-element.snackbar-default button.action-btn{background-color:#222;color:#fff}@media screen and (max-width:480px){.logger-element{width:100%}}\n"], dependencies: [{ kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], animations: [
431
+ trigger('slide', [
432
+ state('enter', style({ transform: 'translateX(0)' })),
433
+ transition(':leave', [
434
+ animate(200, style({ transform: 'translateX(120%)' })),
435
+ ]),
436
+ transition(':enter', [
437
+ style({ transform: 'translateX(120%)' }),
438
+ animate(200, style({ transform: 'translateX(0)' })),
439
+ ]),
440
+ ]),
441
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
442
+ }
443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerComponent, decorators: [{
444
+ type: Component,
445
+ args: [{ selector: 'mosa-logger', animations: [
446
+ trigger('slide', [
447
+ state('enter', style({ transform: 'translateX(0)' })),
448
+ transition(':leave', [
449
+ animate(200, style({ transform: 'translateX(120%)' })),
450
+ ]),
451
+ transition(':enter', [
452
+ style({ transform: 'translateX(120%)' }),
453
+ animate(200, style({ transform: 'translateX(0)' })),
454
+ ]),
455
+ ]),
456
+ ], changeDetection: ChangeDetectionStrategy.OnPush, imports: [
457
+ MatIcon,
458
+ MatButton,
459
+ AsyncPipe,
460
+ UpperCasePipe,
461
+ TranslateModule,
462
+ ], template: "@if (loggerState$ | async; as state) {\n @for (log of state.logs; track log) {\n <div #loggerElement\n [@slide]=\"log.state\"\n [class.none]=\"!log.state\"\n [class]=\"log.config.className\"\n (click)=\"onClickLog(log)\"\n [class.touch]=\"log.config.closeOnClick\"\n class=\"logger-element\">\n <div class=\"content\">\n <mat-icon class=\"icon\">{{ log.icon }}</mat-icon>\n <div>\n @if (log.title) {\n <div class=\"title\">{{ log.title | translate }}</div>\n } @if (log.message) {\n <div [innerHTML]=\"log.message | translate\" class=\"message\"></div>\n }\n </div>\n </div>\n @if (log.config.action || log.config.showDismiss) {\n <div class=\"actions\">\n @if (log.config.showDismiss) {\n <button (click)=\"slideOut(log.id)\" class=\"dismiss\" mat-button>\n {{ 'mosa.commons.buttons.dismiss' | translate | uppercase }}\n </button>\n } @if (log.config.action && log.config.action.label && log.config.action.callback) {\n <button (click)=\"$event.stopPropagation(); callAction(log)\"\n class=\"action-btn\" mat-button>\n {{ log.config.action.label | translate | uppercase }}\n </button>\n }\n </div>\n }\n </div>\n }\n}\n\n", styles: [":host{width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;position:fixed;z-index:10000;align-items:flex-end;pointer-events:none}.logger-element{padding:10px 15px;margin:10px 10px 0;width:350px;background:#fff;border-radius:4px;box-shadow:3px 3px 10px #0000004d;border-left:5px solid;pointer-events:all;max-height:400px}.logger-element.touch{cursor:pointer}.logger-element .content{display:flex;width:100%}.logger-element .content .icon{flex-shrink:0;margin-right:10px}.logger-element .content .title{font-weight:500;color:#222}.logger-element .content .message{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;max-lines:3;text-overflow:ellipsis;flex:1 auto;font-size:15px;margin-top:3px;color:#222}.logger-element .actions{display:flex;justify-content:flex-end;margin-top:10px}.logger-element .dismiss{color:#222}.logger-element button:not(:first-child){margin-left:10px}.logger-element.snackbar-error{border-color:#f44336;color:#f44336}.logger-element.snackbar-error button.action-btn{background-color:#d2190b;color:#fff}.logger-element.snackbar-success{border-color:#3ad15d;color:#3ad15d}.logger-element.snackbar-success button.action-btn{background-color:#249a40;color:#fff}.logger-element.snackbar-warning{border-color:#fa0;color:#fa0}.logger-element.snackbar-warning button.action-btn{background-color:#c80;color:#fff}.logger-element.snackbar-info{border-color:#008eff;color:#008eff}.logger-element.snackbar-info button.action-btn{background-color:#0063b3;color:#fff}.logger-element.snackbar-default{border-color:#222;color:#222}.logger-element.snackbar-default button.action-btn{background-color:#222;color:#fff}@media screen and (max-width:480px){.logger-element{width:100%}}\n"] }]
463
+ }], ctorParameters: () => [], propDecorators: { elements: [{
464
+ type: ViewChildren,
465
+ args: ['loggerElement']
466
+ }] } });
467
+
468
+ class Skeleton {
469
+ constructor(skeleton) {
470
+ this.width = isZeroOrHigher(skeleton?.width) ? skeleton?.width : 100;
471
+ this.height = isZeroOrHigher(skeleton?.height) ? skeleton?.height : 15;
472
+ if ((isNumber(skeleton?.borderRadius) && isZeroOrHigher(skeleton?.borderRadius)) ||
473
+ (typeof skeleton?.borderRadius === 'string' && !isNullOrEmpty(skeleton?.borderRadius))) {
474
+ this.borderRadius = skeleton.borderRadius;
475
+ }
476
+ this.borderRadius = this.borderRadius || 4;
477
+ this.randomizeOffset = skeleton?.randomizeOffset || 0;
478
+ }
479
+ }
480
+
481
+ class SkeletonComponent {
482
+ constructor(myElementRef) {
483
+ this.myElementRef = myElementRef;
484
+ this.width = 0;
485
+ this.height = 0;
486
+ this.randomizeOffset = 0;
487
+ this.element = this.myElementRef.nativeElement;
488
+ }
489
+ ngOnInit() {
490
+ if (!this.skeleton) {
491
+ this.skeleton = new Skeleton({
492
+ width: this.width,
493
+ height: this.height,
494
+ borderRadius: this.borderRadius,
495
+ randomizeOffset: this.randomizeOffset,
496
+ });
497
+ }
498
+ this.element.style.width = this.actualWidth;
499
+ this.element.style.height = SkeletonComponent.value(this.skeleton.height);
500
+ this.element.style.borderRadius = SkeletonComponent.value(this.skeleton.borderRadius);
501
+ }
502
+ get actualWidth() {
503
+ if (this.skeleton.randomizeOffset && this.skeleton.randomizeOffset > 0 && typeof this.skeleton.width === 'number') {
504
+ return `${this.skeleton.width - Math.floor(Math.random() * this.skeleton.randomizeOffset)}px`;
505
+ }
506
+ return SkeletonComponent.value(this.skeleton.width);
507
+ }
508
+ static value(val) {
509
+ if (typeof val === 'number') {
510
+ return `${val}px`;
511
+ }
512
+ return val || '';
513
+ }
514
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
515
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: SkeletonComponent, isStandalone: true, selector: "mosa-skeleton", inputs: { skeleton: "skeleton", width: "width", height: "height", randomizeOffset: "randomizeOffset", borderRadius: "borderRadius" }, ngImport: i0, template: "", styles: [":host{display:flex;background:#d4d4d4;flex-shrink:0;animation:loading .25s infinite linear alternate-reverse}@keyframes loading{0%{opacity:1}to{opacity:.5}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
516
+ }
517
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: SkeletonComponent, decorators: [{
518
+ type: Component,
519
+ args: [{ selector: 'mosa-skeleton', changeDetection: ChangeDetectionStrategy.OnPush, template: "", styles: [":host{display:flex;background:#d4d4d4;flex-shrink:0;animation:loading .25s infinite linear alternate-reverse}@keyframes loading{0%{opacity:1}to{opacity:.5}}\n"] }]
520
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { skeleton: [{
521
+ type: Input
522
+ }], width: [{
523
+ type: Input
524
+ }], height: [{
525
+ type: Input
526
+ }], randomizeOffset: [{
527
+ type: Input
528
+ }], borderRadius: [{
529
+ type: Input
530
+ }] } });
531
+
532
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
533
+ class BaseSkeletonLoader {
534
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
535
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BaseSkeletonLoader, isStandalone: true, selector: "mosa-skeleton-loader", inputs: { itemCount: "itemCount" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
536
+ }
537
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseSkeletonLoader, decorators: [{
538
+ type: Component,
539
+ args: [{
540
+ selector: 'mosa-skeleton-loader',
541
+ template: '',
542
+ changeDetection: ChangeDetectionStrategy.OnPush,
543
+ }]
544
+ }], propDecorators: { itemCount: [{
545
+ type: Input
546
+ }] } });
547
+
548
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
549
+ class ListSkeletonLoader extends BaseSkeletonLoader {
550
+ constructor() {
551
+ super();
552
+ this.items = [];
553
+ }
554
+ ngOnInit() {
555
+ this.items = Array(this.itemCount).fill(this.itemCount).map((x, i) => i);
556
+ }
557
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ListSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
558
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ListSkeletonLoader, isStandalone: true, selector: "mosa-list-skeleton-loader", inputs: { content: "content" }, usesInheritance: true, ngImport: i0, template: "<mat-list>\n @for (item of items; track item) {\n <mat-list-item>\n <ng-container *ngTemplateOutlet=\"content, context: { $implicit: item }\"></ng-container>\n </mat-list-item>\n }\n</mat-list>\n", styles: [""], dependencies: [{ kind: "component", type: MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
559
+ }
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ListSkeletonLoader, decorators: [{
561
+ type: Component,
562
+ args: [{ selector: 'mosa-list-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
563
+ MatList,
564
+ MatListItem,
565
+ NgTemplateOutlet,
566
+ ], template: "<mat-list>\n @for (item of items; track item) {\n <mat-list-item>\n <ng-container *ngTemplateOutlet=\"content, context: { $implicit: item }\"></ng-container>\n </mat-list-item>\n }\n</mat-list>\n" }]
567
+ }], ctorParameters: () => [], propDecorators: { content: [{
568
+ type: Input
569
+ }] } });
570
+
571
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
572
+ class TableSkeletonLoader extends BaseSkeletonLoader {
573
+ constructor() {
574
+ super();
575
+ this.columns = [];
576
+ this.items = [];
577
+ this.displayedColumns = [];
578
+ }
579
+ ngOnInit() {
580
+ for (let i = 0; i < this.columns.length; i++) {
581
+ this.displayedColumns.push(`column-${i}`);
582
+ }
583
+ for (let i = 0; i < (this.itemCount || 0); i++) {
584
+ const skeletons = [];
585
+ for (let j = 0; j < this.displayedColumns.length; j++) {
586
+ const skeleton = this.columns[j][1];
587
+ skeletons.push(new Skeleton({
588
+ width: skeleton.width,
589
+ height: skeleton.height,
590
+ borderRadius: skeleton.borderRadius,
591
+ randomizeOffset: skeleton.randomizeOffset,
592
+ }));
593
+ }
594
+ this.items.push(skeletons);
595
+ }
596
+ }
597
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TableSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
598
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: TableSkeletonLoader, isStandalone: true, selector: "mosa-table-skeleton-loader", inputs: { columns: "columns" }, usesInheritance: true, ngImport: i0, template: "<table [dataSource]=\"items\" mat-table>\n @for (column of columns; track column; let i = $index) {\n <ng-container [matColumnDef]=\"'column-' + i\">\n <th *matHeaderCellDef mat-header-cell>\n <mosa-skeleton [skeleton]=\"column[0]\"></mosa-skeleton>\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mosa-skeleton [skeleton]=\"column[1]\"></mosa-skeleton>\n </td>\n </ng-container>\n }\n <tr *matHeaderRowDef=\"displayedColumns;sticky:true\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" class=\"row-hover\" mat-row></tr>\n</table>\n", styles: ["table{width:100%}\n"], dependencies: [{ kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "component", type: SkeletonComponent, selector: "mosa-skeleton", inputs: ["skeleton", "width", "height", "randomizeOffset", "borderRadius"] }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
599
+ }
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TableSkeletonLoader, decorators: [{
601
+ type: Component,
602
+ args: [{ selector: 'mosa-table-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
603
+ MatTable,
604
+ MatColumnDef,
605
+ MatHeaderCellDef,
606
+ MatHeaderCell,
607
+ SkeletonComponent,
608
+ MatCellDef,
609
+ MatCell,
610
+ MatHeaderRowDef,
611
+ MatHeaderRow,
612
+ MatRowDef,
613
+ MatRow,
614
+ ], template: "<table [dataSource]=\"items\" mat-table>\n @for (column of columns; track column; let i = $index) {\n <ng-container [matColumnDef]=\"'column-' + i\">\n <th *matHeaderCellDef mat-header-cell>\n <mosa-skeleton [skeleton]=\"column[0]\"></mosa-skeleton>\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mosa-skeleton [skeleton]=\"column[1]\"></mosa-skeleton>\n </td>\n </ng-container>\n }\n <tr *matHeaderRowDef=\"displayedColumns;sticky:true\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" class=\"row-hover\" mat-row></tr>\n</table>\n", styles: ["table{width:100%}\n"] }]
615
+ }], ctorParameters: () => [], propDecorators: { columns: [{
616
+ type: Input
617
+ }] } });
618
+
619
+ class MatUpdateDialog {
620
+ constructor(config) {
621
+ this.config = config;
622
+ this.myMatDialogRef = inject((MatDialogRef));
623
+ }
624
+ ngOnInit() {
625
+ //
626
+ }
627
+ close(result) {
628
+ this.myMatDialogRef.close(result);
629
+ }
630
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MatUpdateDialog, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
631
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: MatUpdateDialog, isStandalone: true, selector: "mosa-mat-update-dialog", ngImport: i0, template: "<h1 class=\"active\" mat-dialog-title>{{ config.title | translate }}</h1>\n<div mat-dialog-content>\n {{ config.message | translate }}\n</div>\n<div mat-dialog-actions>\n <button (click)=\"close(0)\" [class.cancel-btn]=\"config.showIgnore\" mat-stroked-button>\n {{ 'mosa.commons.buttons.cancel' | translate | uppercase }}\n </button>\n @if (config.showIgnore) {\n <button (click)=\"close(1)\" color=\"primary\" mat-stroked-button>\n {{\n 'mosa.commons.buttons.ignoreFor' | translate: {\n duration: config.ignoreTimeout | mosaDuration: 'auto' | async | uppercase\n } | uppercase\n }}\n </button>\n }\n <button mat-flat-button color=\"primary\" (click)=\"close(2)\">\n {{ 'mosa.commons.buttons.reloadNow' | translate | uppercase }}\n </button>\n</div>\n", styles: [".cancel-btn{margin-right:auto}\n"], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "pipe", type: MosaDurationPipe, name: "mosaDuration" }] }); }
632
+ }
633
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MatUpdateDialog, decorators: [{
634
+ type: Component,
635
+ args: [{ selector: 'mosa-mat-update-dialog', imports: [
636
+ MatDialogTitle,
637
+ MatDialogContent,
638
+ MatDialogActions,
639
+ MatButton,
640
+ AsyncPipe,
641
+ UpperCasePipe,
642
+ TranslatePipe,
643
+ MosaDurationPipe,
644
+ ], template: "<h1 class=\"active\" mat-dialog-title>{{ config.title | translate }}</h1>\n<div mat-dialog-content>\n {{ config.message | translate }}\n</div>\n<div mat-dialog-actions>\n <button (click)=\"close(0)\" [class.cancel-btn]=\"config.showIgnore\" mat-stroked-button>\n {{ 'mosa.commons.buttons.cancel' | translate | uppercase }}\n </button>\n @if (config.showIgnore) {\n <button (click)=\"close(1)\" color=\"primary\" mat-stroked-button>\n {{\n 'mosa.commons.buttons.ignoreFor' | translate: {\n duration: config.ignoreTimeout | mosaDuration: 'auto' | async | uppercase\n } | uppercase\n }}\n </button>\n }\n <button mat-flat-button color=\"primary\" (click)=\"close(2)\">\n {{ 'mosa.commons.buttons.reloadNow' | translate | uppercase }}\n </button>\n</div>\n", styles: [".cancel-btn{margin-right:auto}\n"] }]
645
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
646
+ type: Inject,
647
+ args: [MAT_DIALOG_DATA]
648
+ }] }] });
649
+
650
+ var UpdateDialogResult;
651
+ (function (UpdateDialogResult) {
652
+ UpdateDialogResult[UpdateDialogResult["cancel"] = 0] = "cancel";
653
+ UpdateDialogResult[UpdateDialogResult["ignore"] = 1] = "ignore";
654
+ UpdateDialogResult[UpdateDialogResult["reload"] = 2] = "reload";
655
+ })(UpdateDialogResult || (UpdateDialogResult = {}));
656
+
657
+ class UpdateDialog {
658
+ set updateConfig(config) {
659
+ if (config) {
660
+ if (!config.versionPath) {
661
+ console.warn('LoggerService: No version path was provided. This field is required!');
662
+ return;
663
+ }
664
+ if (!config.localStorageKey) {
665
+ config.localStorageKey = 'mosaApplicationVersion';
666
+ }
667
+ if (!config.ignoreTimeout) {
668
+ config.ignoreTimeout = 30000;
669
+ }
670
+ if (!config.refreshInterval) {
671
+ config.refreshInterval = 15000;
672
+ }
673
+ if (!config.title) {
674
+ config.title = 'mosa.components.updateDialog.title';
675
+ }
676
+ if (!config.message) {
677
+ config.message = 'mosa.components.updateDialog.message';
678
+ }
679
+ this.config = config;
680
+ this.end();
681
+ this.start();
682
+ }
683
+ else {
684
+ console.warn('LoggerService: Cannot check for version. No config was provided.');
685
+ }
686
+ }
687
+ constructor() {
688
+ this.firstLoad = true;
689
+ this.blocked = false;
690
+ this.myApiService = inject(ApiService);
691
+ this.myMatDialog = inject(MatDialog);
692
+ }
693
+ start() {
694
+ if (this.interval) {
695
+ this.end();
696
+ }
697
+ void this.checkForUpdate();
698
+ this.interval = setInterval(() => this.checkForUpdate(), this.config.refreshInterval);
699
+ }
700
+ openDialog(version) {
701
+ this.myMatDialog.open(MatUpdateDialog, {
702
+ width: '600px',
703
+ data: this.config,
704
+ })
705
+ .afterClosed()
706
+ .subscribe((result) => {
707
+ switch (result) {
708
+ case UpdateDialogResult.cancel:
709
+ this.end();
710
+ this.blocked = true;
711
+ break;
712
+ case UpdateDialogResult.ignore:
713
+ timer(this.config.ignoreTimeout).subscribe(() => this.openDialog(version));
714
+ break;
715
+ case UpdateDialogResult.reload:
716
+ window.location.reload();
717
+ window.localStorage.setItem(this.config.localStorageKey, JSON.stringify(version));
718
+ break;
719
+ }
720
+ });
721
+ }
722
+ async checkForUpdate() {
723
+ if (this.blocked) {
724
+ return;
725
+ }
726
+ const localStorageVersion = window.localStorage.getItem(this.config.localStorageKey);
727
+ let localVersion = { version: '0.0.0', timestamp: 0 };
728
+ if (!isNullOrEmpty(localStorageVersion)) {
729
+ localVersion = JSON.parse(localStorageVersion);
730
+ }
731
+ const data = await firstValueFrom(this.myApiService.get(this.config.versionPath));
732
+ if (this.firstLoad) {
733
+ window.localStorage.setItem(this.config.localStorageKey, JSON.stringify(data));
734
+ this.firstLoad = false;
735
+ return;
736
+ }
737
+ if (data.version !== localVersion.version) {
738
+ this.blocked = true;
739
+ this.end();
740
+ this.openDialog(data);
741
+ }
742
+ }
743
+ end() {
744
+ clearInterval(this.interval);
745
+ this.interval = undefined;
746
+ }
747
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UpdateDialog, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
748
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: UpdateDialog, isStandalone: true, selector: "mosa-update-dialog[config]", inputs: { updateConfig: ["config", "updateConfig"] }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
749
+ }
750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: UpdateDialog, decorators: [{
751
+ type: Component,
752
+ args: [{
753
+ selector: 'mosa-update-dialog[config]',
754
+ template: '',
755
+ changeDetection: ChangeDetectionStrategy.OnPush,
756
+ }]
757
+ }], ctorParameters: () => [], propDecorators: { updateConfig: [{
758
+ type: Input,
759
+ args: ['config']
760
+ }] } });
761
+
762
+ class CellEditorService {
763
+ constructor() {
764
+ }
765
+ updateEditingCell(cellEditor) {
766
+ if (cellEditor !== this.cellEditor) {
767
+ this.cellEditor?.toOutput(true);
768
+ }
769
+ this.cellEditor = cellEditor;
770
+ this.cellEditor.toInput();
771
+ this.bindDocumentEditListener();
772
+ }
773
+ bindDocumentEditListener() {
774
+ if (!this.documentEditListener) {
775
+ this.documentEditListener = (e) => {
776
+ e.preventDefault();
777
+ const target = e.target;
778
+ const mosaCellEditor = target.closest('mosa-cell-editor');
779
+ if (this.cellEditor && mosaCellEditor !== this.cellEditor.element && !target.classList.contains('cell-output')) {
780
+ document.removeEventListener('click', this.documentEditListener);
781
+ this.documentEditListener = undefined;
782
+ this.cellEditor.toOutput(true);
783
+ this.cellEditor = undefined;
784
+ }
785
+ };
786
+ document.addEventListener('click', this.documentEditListener);
787
+ }
788
+ }
789
+ isEditingCellValid() {
790
+ return this.cellEditor?.element != null && Array.from(this.cellEditor.element.querySelectorAll('.ng-invalid')).length === 0;
791
+ }
792
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
793
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorService, providedIn: 'root' }); }
794
+ }
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorService, decorators: [{
796
+ type: Injectable,
797
+ args: [{
798
+ providedIn: 'root',
799
+ }]
800
+ }], ctorParameters: () => [] });
801
+
802
+ class CellEditorDirective {
803
+ constructor() {
804
+ this.myElementRef = inject((ElementRef));
805
+ this.myCellEditorService = inject(CellEditorService);
806
+ }
807
+ onEscapeKeyDown(e) {
808
+ e.preventDefault();
809
+ this.cellEditor.toOutput();
810
+ }
811
+ onShiftKeyDown(e) {
812
+ e.preventDefault();
813
+ if (e.shiftKey) {
814
+ this.moveToCell(e, false);
815
+ }
816
+ else {
817
+ this.moveToCell(e, true);
818
+ }
819
+ }
820
+ onEnterKeyDown(e) {
821
+ e.preventDefault();
822
+ if (this.myCellEditorService.isEditingCellValid()) {
823
+ this.moveToNextRowCell(e);
824
+ }
825
+ }
826
+ onClick(e) {
827
+ e.preventDefault();
828
+ this.myCellEditorService.updateEditingCell(this.cellEditor);
829
+ this.cellEditor.cellClick.emit();
830
+ }
831
+ ngOnInit() {
832
+ this.myElementRef.nativeElement.classList.add('editable-cell');
833
+ }
834
+ moveToNextRowCell(e) {
835
+ const currentCell = this.cellEditor?.element?.parentElement;
836
+ if (!currentCell) {
837
+ return;
838
+ }
839
+ let columnDefClass = '';
840
+ currentCell.classList.forEach((className) => {
841
+ const found = className.includes('mat-column-');
842
+ if (found) {
843
+ columnDefClass = className;
844
+ }
845
+ });
846
+ const targetCell = this.findNextRowEditableColumn(currentCell, columnDefClass);
847
+ this.cellEditor.toOutput(true);
848
+ CellEditorDirective.executeMove(e, targetCell);
849
+ }
850
+ findNextRowEditableColumn(row, matColumnClassName) {
851
+ const nextRow = row.parentElement?.nextElementSibling;
852
+ if (!nextRow) {
853
+ return null;
854
+ }
855
+ const column = nextRow.getElementsByClassName(matColumnClassName)[0];
856
+ return column?.classList.contains('editable-cell') ?
857
+ column.firstChild :
858
+ this.findNextRowEditableColumn(nextRow, matColumnClassName);
859
+ }
860
+ findNextEditableColumn(cell) {
861
+ let nextCell = cell.parentElement?.nextElementSibling;
862
+ if (!nextCell) {
863
+ const nextRow = cell.parentElement?.parentElement?.nextElementSibling;
864
+ if (nextRow) {
865
+ nextCell = nextRow.firstElementChild;
866
+ }
867
+ }
868
+ if (nextCell) {
869
+ return nextCell.classList.contains('editable-cell')
870
+ ? nextCell.firstChild
871
+ : this.findNextEditableColumn(nextCell);
872
+ }
873
+ return null;
874
+ }
875
+ findPreviousEditableColumn(cell) {
876
+ let prevCell = cell.previousElementSibling;
877
+ if (!prevCell) {
878
+ const previousRow = cell.parentElement?.previousElementSibling;
879
+ if (previousRow) {
880
+ prevCell = previousRow.lastElementChild;
881
+ }
882
+ }
883
+ if (prevCell) {
884
+ return prevCell.classList.contains('editable-cell') ?
885
+ prevCell.firstChild :
886
+ this.findPreviousEditableColumn(prevCell);
887
+ }
888
+ else {
889
+ return null;
890
+ }
891
+ }
892
+ moveToCell(event, nextCell) {
893
+ const currentCell = this.cellEditor.element;
894
+ if (this.cellEditor.element != null) {
895
+ const targetCell = nextCell
896
+ ? this.findNextEditableColumn(currentCell)
897
+ : this.findPreviousEditableColumn(currentCell);
898
+ if (this.myCellEditorService.isEditingCellValid()) {
899
+ this.cellEditor.toOutput(true);
900
+ targetCell?.click();
901
+ }
902
+ CellEditorDirective.executeMove(event, targetCell);
903
+ }
904
+ }
905
+ static invokeElementMethod(element, methodName, args) {
906
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types,@typescript-eslint/no-unsafe-function-type,@typescript-eslint/no-explicit-any
907
+ element[methodName].apply(element, args);
908
+ }
909
+ static executeMove(e, targetCell) {
910
+ e.preventDefault();
911
+ // If datepicker is opened, remove cdk-overlay from dom
912
+ const element = e.composedPath()[0];
913
+ if (element.className.includes('td-input-date')) {
914
+ const cdkOverlayContainer = document.getElementsByClassName('cdk-overlay-container')[0];
915
+ const cdkBackdrop = cdkOverlayContainer.getElementsByClassName('cdk-overlay-backdrop')[0];
916
+ if (cdkBackdrop != null) {
917
+ CellEditorDirective.invokeElementMethod(cdkBackdrop, 'click');
918
+ }
919
+ cdkOverlayContainer.innerHTML = '';
920
+ }
921
+ CellEditorDirective.invokeElementMethod(e.target, 'blur');
922
+ if (targetCell != null) {
923
+ CellEditorDirective.invokeElementMethod(targetCell, 'click');
924
+ }
925
+ }
926
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
927
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: CellEditorDirective, isStandalone: true, selector: "td[mosaCellEditor]", host: { listeners: { "keydown.escape": "onEscapeKeyDown($event)", "keydown.tab": "onShiftKeyDown($event)", "keydown.shift.tab": "onShiftKeyDown($event)", "keydown.meta.tab": "onShiftKeyDown($event)", "keydown.enter": "onEnterKeyDown($event)", "click": "onClick($event)" } }, queries: [{ propertyName: "cellEditor", first: true, predicate: CellEditorComponent, descendants: true }], ngImport: i0 }); }
928
+ }
929
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CellEditorDirective, decorators: [{
930
+ type: Directive,
931
+ args: [{ selector: 'td[mosaCellEditor]' }]
932
+ }], ctorParameters: () => [], propDecorators: { cellEditor: [{
933
+ type: ContentChild,
934
+ args: [CellEditorComponent]
935
+ }], onEscapeKeyDown: [{
936
+ type: HostListener,
937
+ args: ['keydown.escape', ['$event']]
938
+ }], onShiftKeyDown: [{
939
+ type: HostListener,
940
+ args: ['keydown.tab', ['$event']]
941
+ }, {
942
+ type: HostListener,
943
+ args: ['keydown.shift.tab', ['$event']]
944
+ }, {
945
+ type: HostListener,
946
+ args: ['keydown.meta.tab', ['$event']]
947
+ }], onEnterKeyDown: [{
948
+ type: HostListener,
949
+ args: ['keydown.enter', ['$event']]
950
+ }], onClick: [{
951
+ type: HostListener,
952
+ args: ['click', ['$event']]
953
+ }] } });
954
+
955
+ class ClickOutsideDirective {
956
+ constructor(elementRef) {
957
+ this.elementRef = elementRef;
958
+ this.clickOutside = new EventEmitter();
959
+ this.enableWhiteListing = false;
960
+ }
961
+ onClick(targetElement) {
962
+ const clickedInside = this.elementRef.nativeElement.contains(targetElement);
963
+ const whiteListedClass = 'whitelisted';
964
+ if (clickedInside || !targetElement) {
965
+ return;
966
+ }
967
+ const htmlElement = targetElement;
968
+ if (this.enableWhiteListing) {
969
+ const isWhiteListed = htmlElement.classList.contains(whiteListedClass)
970
+ || ClickOutsideDirective.getClosest(htmlElement, whiteListedClass)
971
+ || ClickOutsideDirective.getClosest(htmlElement, 'cdk-overlay-container');
972
+ if (!isWhiteListed) {
973
+ this.clickOutside.emit([this.elementRef.nativeElement, htmlElement]);
974
+ }
975
+ }
976
+ else {
977
+ this.clickOutside.emit([this.elementRef.nativeElement, htmlElement]);
978
+ }
979
+ }
980
+ static getClosest(el, selector) {
981
+ while (el) {
982
+ if (el.classList.contains(selector)) {
983
+ return el;
984
+ }
985
+ el = el.parentElement;
986
+ }
987
+ return null;
988
+ }
989
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
990
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: ClickOutsideDirective, isStandalone: true, selector: "[clickOutside]", inputs: { enableWhiteListing: "enableWhiteListing" }, outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 }); }
991
+ }
992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ClickOutsideDirective, decorators: [{
993
+ type: Directive,
994
+ args: [{
995
+ // eslint-disable-next-line @angular-eslint/directive-selector
996
+ selector: '[clickOutside]',
997
+ }]
998
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { clickOutside: [{
999
+ type: Output
1000
+ }], enableWhiteListing: [{
1001
+ type: Input
1002
+ }], onClick: [{
1003
+ type: HostListener,
1004
+ args: ['document:click', ['$event.target']]
1005
+ }] } });
1006
+
1007
+ class LoggerService extends CoreLoggerService {
1008
+ /**
1009
+ * Default constructor
1010
+ */
1011
+ constructor() {
1012
+ super();
1013
+ }
1014
+ /**
1015
+ * Setter for logger
1016
+ * @param component
1017
+ * @param defaultConfig
1018
+ */
1019
+ logger(component, defaultConfig) {
1020
+ this.loggerComp = component;
1021
+ this.defaultConfig = defaultConfig;
1022
+ }
1023
+ /**
1024
+ * Shows the log
1025
+ * @param type
1026
+ * @param config
1027
+ */
1028
+ show(config, type) {
1029
+ super.show(config, type);
1030
+ if (this.loggerComp) {
1031
+ const i = this.loggerComp.slideIn(config.title, config.msg, type, config);
1032
+ if (config.duration !== -1) {
1033
+ setTimeout(() => this.loggerComp?.slideOut(i), (config.duration || 1) * 1000);
1034
+ }
1035
+ }
1036
+ }
1037
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1038
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
1039
+ }
1040
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoggerService, decorators: [{
1041
+ type: Injectable,
1042
+ args: [{
1043
+ providedIn: 'root',
1044
+ }]
1045
+ }], ctorParameters: () => [] });
3
1046
 
4
1047
  function initI18n(i18n) {
5
1048
  return i18n.init(undefined, 'mosa');
@@ -12,5 +1055,5 @@ const provideMosaMaterial = () => makeEnvironmentProviders([
12
1055
  * Generated bundle index. Do not edit.
13
1056
  */
14
1057
 
15
- export { provideMosaMaterial };
1058
+ export { AlertWidget, CellEditorBaseComponent, CellEditorComponent, CellEditorDirective, CellEditorService, ClickOutsideDirective, ConfirmDialog, ConfirmDialogAction, ConfirmDialogData, ConfirmDialogResult, ListSkeletonLoader, LoadingButtonComponent, LoggerComponent, LoggerFacade, LoggerService, MatUpdateDialog, Skeleton, SkeletonComponent, TableSkeletonLoader, UpdateDialog, UpdateDialogResult, provideMosaMaterial };
16
1059
  //# sourceMappingURL=mosa-ng-material.mjs.map