@mosa-ng/material 20.1.1 → 20.1.2

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,1047 @@
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: "20.3.11", ngImport: i0, type: AlertWidget, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
55
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", 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: "20.3.11", ngImport: i0, type: CellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
265
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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: "20.3.11", 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: "20.3.11", ngImport: i0, type: LoadingButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
303
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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: "20.3.11", 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: "20.3.11", ngImport: i0, type: LoggerFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
351
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerFacade, providedIn: 'root' }); }
352
+ }
353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerFacade, decorators: [{
354
+ type: Injectable,
355
+ args: [{
356
+ providedIn: 'root',
357
+ }]
358
+ }], ctorParameters: () => [] });
359
+
360
+ /* eslint-disable */
361
+ class LoggerComponent {
362
+ constructor() {
363
+ this.myLoggerFacade = inject(LoggerFacade);
364
+ }
365
+ ngOnInit() {
366
+ this.loggerState$ = this.myLoggerFacade.subState();
367
+ }
368
+ onClickLog(log) {
369
+ if (log.config.closeOnClick) {
370
+ this.slideOut(log.id);
371
+ }
372
+ }
373
+ /**
374
+ * Shows the snackbar
375
+ * @param title
376
+ * @param message
377
+ * @param type
378
+ * @param config
379
+ */
380
+ slideIn(title, message, type, config) {
381
+ const logs = [...this.myLoggerFacade.snapshot.logs];
382
+ const i = logs.length;
383
+ let icon;
384
+ switch (type) {
385
+ case 'error':
386
+ icon = 'error';
387
+ break;
388
+ case 'warning':
389
+ icon = 'warning';
390
+ break;
391
+ case 'info':
392
+ icon = 'info';
393
+ break;
394
+ case 'success':
395
+ icon = 'done';
396
+ break;
397
+ default:
398
+ icon = 'notifications';
399
+ break;
400
+ }
401
+ logs.push({ id: i, title, message, config, state: 'enter', icon });
402
+ this.myLoggerFacade.updateLogs(logs);
403
+ return i;
404
+ }
405
+ /**
406
+ * Hides the log
407
+ * @param id
408
+ */
409
+ slideOut(id) {
410
+ let logs = [...this.myLoggerFacade.snapshot.logs];
411
+ if (logs.length > 0) {
412
+ const item = logs.find((e) => e.id === id);
413
+ if (!item) {
414
+ return;
415
+ }
416
+ item.state = 'leave';
417
+ this.myLoggerFacade.updateLogs(logs);
418
+ setTimeout(() => {
419
+ logs = [...this.myLoggerFacade.snapshot.logs];
420
+ const index = logs.findIndex((log) => log.id === item.id);
421
+ logs.splice(index, 1);
422
+ this.myLoggerFacade.updateLogs(logs);
423
+ }, 200);
424
+ }
425
+ }
426
+ callAction(log) {
427
+ log.config.action?.callback?.call(this);
428
+ this.slideOut(log.id);
429
+ }
430
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
431
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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: [
432
+ trigger('slide', [
433
+ state('enter', style({ transform: 'translateX(0)' })),
434
+ transition(':leave', [
435
+ animate(200, style({ transform: 'translateX(120%)' })),
436
+ ]),
437
+ transition(':enter', [
438
+ style({ transform: 'translateX(120%)' }),
439
+ animate(200, style({ transform: 'translateX(0)' })),
440
+ ]),
441
+ ]),
442
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
443
+ }
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerComponent, decorators: [{
445
+ type: Component,
446
+ args: [{ selector: 'mosa-logger', animations: [
447
+ trigger('slide', [
448
+ state('enter', style({ transform: 'translateX(0)' })),
449
+ transition(':leave', [
450
+ animate(200, style({ transform: 'translateX(120%)' })),
451
+ ]),
452
+ transition(':enter', [
453
+ style({ transform: 'translateX(120%)' }),
454
+ animate(200, style({ transform: 'translateX(0)' })),
455
+ ]),
456
+ ]),
457
+ ], changeDetection: ChangeDetectionStrategy.OnPush, imports: [
458
+ MatIcon,
459
+ MatButton,
460
+ AsyncPipe,
461
+ UpperCasePipe,
462
+ TranslateModule,
463
+ ], 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"] }]
464
+ }], ctorParameters: () => [], propDecorators: { elements: [{
465
+ type: ViewChildren,
466
+ args: ['loggerElement']
467
+ }] } });
468
+
469
+ class Skeleton {
470
+ constructor(skeleton) {
471
+ this.width = isZeroOrHigher(skeleton?.width) ? skeleton?.width : 100;
472
+ this.height = isZeroOrHigher(skeleton?.height) ? skeleton?.height : 15;
473
+ if ((isNumber(skeleton?.borderRadius) && isZeroOrHigher(skeleton?.borderRadius)) ||
474
+ (typeof skeleton?.borderRadius === 'string' && !isNullOrEmpty(skeleton?.borderRadius))) {
475
+ this.borderRadius = skeleton.borderRadius;
476
+ }
477
+ this.borderRadius = this.borderRadius || 4;
478
+ this.randomizeOffset = skeleton?.randomizeOffset || 0;
479
+ }
480
+ }
481
+
482
+ class SkeletonComponent {
483
+ constructor(myElementRef) {
484
+ this.myElementRef = myElementRef;
485
+ this.width = 0;
486
+ this.height = 0;
487
+ this.randomizeOffset = 0;
488
+ this.element = this.myElementRef.nativeElement;
489
+ }
490
+ ngOnInit() {
491
+ if (!this.skeleton) {
492
+ this.skeleton = new Skeleton({
493
+ width: this.width,
494
+ height: this.height,
495
+ borderRadius: this.borderRadius,
496
+ randomizeOffset: this.randomizeOffset,
497
+ });
498
+ }
499
+ this.element.style.width = this.actualWidth;
500
+ this.element.style.height = SkeletonComponent.value(this.skeleton.height);
501
+ this.element.style.borderRadius = SkeletonComponent.value(this.skeleton.borderRadius);
502
+ }
503
+ get actualWidth() {
504
+ if (this.skeleton.randomizeOffset && this.skeleton.randomizeOffset > 0 && typeof this.skeleton.width === 'number') {
505
+ return `${this.skeleton.width - Math.floor(Math.random() * this.skeleton.randomizeOffset)}px`;
506
+ }
507
+ return SkeletonComponent.value(this.skeleton.width);
508
+ }
509
+ static value(val) {
510
+ if (typeof val === 'number') {
511
+ return `${val}px`;
512
+ }
513
+ return val || '';
514
+ }
515
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: SkeletonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
516
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.11", 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 }); }
517
+ }
518
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: SkeletonComponent, decorators: [{
519
+ type: Component,
520
+ 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"] }]
521
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { skeleton: [{
522
+ type: Input
523
+ }], width: [{
524
+ type: Input
525
+ }], height: [{
526
+ type: Input
527
+ }], randomizeOffset: [{
528
+ type: Input
529
+ }], borderRadius: [{
530
+ type: Input
531
+ }] } });
532
+
533
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
534
+ class BaseSkeletonLoader {
535
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: BaseSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
536
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.11", type: BaseSkeletonLoader, isStandalone: true, selector: "mosa-skeleton-loader", inputs: { itemCount: "itemCount" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
537
+ }
538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: BaseSkeletonLoader, decorators: [{
539
+ type: Component,
540
+ args: [{
541
+ selector: 'mosa-skeleton-loader',
542
+ template: '',
543
+ changeDetection: ChangeDetectionStrategy.OnPush,
544
+ }]
545
+ }], propDecorators: { itemCount: [{
546
+ type: Input
547
+ }] } });
548
+
549
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
550
+ class ListSkeletonLoader extends BaseSkeletonLoader {
551
+ constructor() {
552
+ super();
553
+ this.items = [];
554
+ }
555
+ ngOnInit() {
556
+ this.items = Array(this.itemCount).fill(this.itemCount).map((x, i) => i);
557
+ }
558
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
559
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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 }); }
560
+ }
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListSkeletonLoader, decorators: [{
562
+ type: Component,
563
+ args: [{ selector: 'mosa-list-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
564
+ MatList,
565
+ MatListItem,
566
+ NgTemplateOutlet,
567
+ ], 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" }]
568
+ }], ctorParameters: () => [], propDecorators: { content: [{
569
+ type: Input
570
+ }] } });
571
+
572
+ // eslint-disable-next-line @angular-eslint/component-class-suffix
573
+ class TableSkeletonLoader extends BaseSkeletonLoader {
574
+ constructor() {
575
+ super();
576
+ this.columns = [];
577
+ this.items = [];
578
+ this.displayedColumns = [];
579
+ }
580
+ ngOnInit() {
581
+ for (let i = 0; i < this.columns.length; i++) {
582
+ this.displayedColumns.push(`column-${i}`);
583
+ }
584
+ for (let i = 0; i < (this.itemCount || 0); i++) {
585
+ const skeletons = [];
586
+ for (let j = 0; j < this.displayedColumns.length; j++) {
587
+ const skeleton = this.columns[j][1];
588
+ skeletons.push(new Skeleton({
589
+ width: skeleton.width,
590
+ height: skeleton.height,
591
+ borderRadius: skeleton.borderRadius,
592
+ randomizeOffset: skeleton.randomizeOffset,
593
+ }));
594
+ }
595
+ this.items.push(skeletons);
596
+ }
597
+ }
598
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableSkeletonLoader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
599
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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 }); }
600
+ }
601
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: TableSkeletonLoader, decorators: [{
602
+ type: Component,
603
+ args: [{ selector: 'mosa-table-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
604
+ MatTable,
605
+ MatColumnDef,
606
+ MatHeaderCellDef,
607
+ MatHeaderCell,
608
+ SkeletonComponent,
609
+ MatCellDef,
610
+ MatCell,
611
+ MatHeaderRowDef,
612
+ MatHeaderRow,
613
+ MatRowDef,
614
+ MatRow,
615
+ ], 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"] }]
616
+ }], ctorParameters: () => [], propDecorators: { columns: [{
617
+ type: Input
618
+ }] } });
619
+
620
+ class MatUpdateDialog {
621
+ constructor(config) {
622
+ this.config = config;
623
+ this.myMatDialogRef = inject((MatDialogRef));
624
+ }
625
+ ngOnInit() {
626
+ //
627
+ }
628
+ close(result) {
629
+ this.myMatDialogRef.close(result);
630
+ }
631
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MatUpdateDialog, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
632
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", 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" }] }); }
633
+ }
634
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: MatUpdateDialog, decorators: [{
635
+ type: Component,
636
+ args: [{ selector: 'mosa-mat-update-dialog', imports: [
637
+ MatDialogTitle,
638
+ MatDialogContent,
639
+ MatDialogActions,
640
+ MatButton,
641
+ AsyncPipe,
642
+ UpperCasePipe,
643
+ TranslatePipe,
644
+ MosaDurationPipe,
645
+ ], 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"] }]
646
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
647
+ type: Inject,
648
+ args: [MAT_DIALOG_DATA]
649
+ }] }] });
650
+
651
+ var UpdateDialogResult;
652
+ (function (UpdateDialogResult) {
653
+ UpdateDialogResult[UpdateDialogResult["cancel"] = 0] = "cancel";
654
+ UpdateDialogResult[UpdateDialogResult["ignore"] = 1] = "ignore";
655
+ UpdateDialogResult[UpdateDialogResult["reload"] = 2] = "reload";
656
+ })(UpdateDialogResult || (UpdateDialogResult = {}));
657
+
658
+ class UpdateDialog {
659
+ set updateConfig(config) {
660
+ if (config) {
661
+ if (!config.versionPath) {
662
+ console.warn('LoggerService: No version path was provided. This field is required!');
663
+ return;
664
+ }
665
+ if (!config.localStorageKey) {
666
+ config.localStorageKey = 'mosaApplicationVersion';
667
+ }
668
+ if (!config.ignoreTimeout) {
669
+ config.ignoreTimeout = 30000;
670
+ }
671
+ if (!config.refreshInterval) {
672
+ config.refreshInterval = 15000;
673
+ }
674
+ if (!config.title) {
675
+ config.title = 'mosa.components.updateDialog.title';
676
+ }
677
+ if (!config.message) {
678
+ config.message = 'mosa.components.updateDialog.message';
679
+ }
680
+ this.config = config;
681
+ this.end();
682
+ this.start();
683
+ }
684
+ else {
685
+ console.warn('LoggerService: Cannot check for version. No config was provided.');
686
+ }
687
+ }
688
+ constructor() {
689
+ this.firstLoad = true;
690
+ this.blocked = false;
691
+ this.myApiService = inject(ApiService);
692
+ this.myMatDialog = inject(MatDialog);
693
+ }
694
+ start() {
695
+ if (this.interval) {
696
+ this.end();
697
+ }
698
+ void this.checkForUpdate();
699
+ this.interval = setInterval(() => this.checkForUpdate(), this.config.refreshInterval);
700
+ }
701
+ openDialog(version) {
702
+ this.myMatDialog.open(MatUpdateDialog, {
703
+ width: '600px',
704
+ data: this.config,
705
+ })
706
+ .afterClosed()
707
+ .subscribe((result) => {
708
+ switch (result) {
709
+ case UpdateDialogResult.cancel:
710
+ this.end();
711
+ this.blocked = true;
712
+ break;
713
+ case UpdateDialogResult.ignore:
714
+ timer(this.config.ignoreTimeout).subscribe(() => this.openDialog(version));
715
+ break;
716
+ case UpdateDialogResult.reload:
717
+ window.location.reload();
718
+ window.localStorage.setItem(this.config.localStorageKey, JSON.stringify(version));
719
+ break;
720
+ }
721
+ });
722
+ }
723
+ async checkForUpdate() {
724
+ if (this.blocked) {
725
+ return;
726
+ }
727
+ const localStorageVersion = window.localStorage.getItem(this.config.localStorageKey);
728
+ let localVersion = { version: '0.0.0', timestamp: 0 };
729
+ if (!isNullOrEmpty(localStorageVersion)) {
730
+ localVersion = JSON.parse(localStorageVersion);
731
+ }
732
+ const data = await firstValueFrom(this.myApiService.get(this.config.versionPath));
733
+ if (this.firstLoad) {
734
+ window.localStorage.setItem(this.config.localStorageKey, JSON.stringify(data));
735
+ this.firstLoad = false;
736
+ return;
737
+ }
738
+ if (data.version !== localVersion.version) {
739
+ this.blocked = true;
740
+ this.end();
741
+ this.openDialog(data);
742
+ }
743
+ }
744
+ end() {
745
+ clearInterval(this.interval);
746
+ this.interval = undefined;
747
+ }
748
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: UpdateDialog, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
749
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.11", type: UpdateDialog, isStandalone: true, selector: "mosa-update-dialog[config]", inputs: { updateConfig: ["config", "updateConfig"] }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
750
+ }
751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: UpdateDialog, decorators: [{
752
+ type: Component,
753
+ args: [{
754
+ selector: 'mosa-update-dialog[config]',
755
+ template: '',
756
+ changeDetection: ChangeDetectionStrategy.OnPush,
757
+ }]
758
+ }], ctorParameters: () => [], propDecorators: { updateConfig: [{
759
+ type: Input,
760
+ args: ['config']
761
+ }] } });
762
+
763
+ class CellEditorService {
764
+ constructor() {
765
+ }
766
+ updateEditingCell(cellEditor) {
767
+ if (cellEditor !== this.cellEditor) {
768
+ this.cellEditor?.toOutput(true);
769
+ }
770
+ this.cellEditor = cellEditor;
771
+ this.cellEditor.toInput();
772
+ this.bindDocumentEditListener();
773
+ }
774
+ bindDocumentEditListener() {
775
+ if (!this.documentEditListener) {
776
+ this.documentEditListener = (e) => {
777
+ e.preventDefault();
778
+ const target = e.target;
779
+ const mosaCellEditor = target.closest('mosa-cell-editor');
780
+ if (this.cellEditor && mosaCellEditor !== this.cellEditor.element && !target.classList.contains('cell-output')) {
781
+ document.removeEventListener('click', this.documentEditListener);
782
+ this.documentEditListener = undefined;
783
+ this.cellEditor.toOutput(true);
784
+ this.cellEditor = undefined;
785
+ }
786
+ };
787
+ document.addEventListener('click', this.documentEditListener);
788
+ }
789
+ }
790
+ isEditingCellValid() {
791
+ return this.cellEditor?.element != null && Array.from(this.cellEditor.element.querySelectorAll('.ng-invalid')).length === 0;
792
+ }
793
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CellEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
794
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CellEditorService, providedIn: 'root' }); }
795
+ }
796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CellEditorService, decorators: [{
797
+ type: Injectable,
798
+ args: [{
799
+ providedIn: 'root',
800
+ }]
801
+ }], ctorParameters: () => [] });
802
+
803
+ class CellEditorDirective {
804
+ constructor() {
805
+ this.myElementRef = inject((ElementRef));
806
+ this.myCellEditorService = inject(CellEditorService);
807
+ }
808
+ onEscapeKeyDown(e) {
809
+ e.preventDefault();
810
+ this.cellEditor.toOutput();
811
+ }
812
+ onShiftKeyDown(e) {
813
+ e.preventDefault();
814
+ if (e.shiftKey) {
815
+ this.moveToCell(e, false);
816
+ }
817
+ else {
818
+ this.moveToCell(e, true);
819
+ }
820
+ }
821
+ onEnterKeyDown(e) {
822
+ e.preventDefault();
823
+ if (this.myCellEditorService.isEditingCellValid()) {
824
+ this.moveToNextRowCell(e);
825
+ }
826
+ }
827
+ onClick(e) {
828
+ e.preventDefault();
829
+ this.myCellEditorService.updateEditingCell(this.cellEditor);
830
+ this.cellEditor.cellClick.emit();
831
+ }
832
+ ngOnInit() {
833
+ this.myElementRef.nativeElement.classList.add('editable-cell');
834
+ }
835
+ moveToNextRowCell(e) {
836
+ const currentCell = this.cellEditor?.element?.parentElement;
837
+ if (!currentCell) {
838
+ return;
839
+ }
840
+ let columnDefClass = '';
841
+ currentCell.classList.forEach((className) => {
842
+ const found = className.includes('mat-column-');
843
+ if (found) {
844
+ columnDefClass = className;
845
+ }
846
+ });
847
+ const targetCell = this.findNextRowEditableColumn(currentCell, columnDefClass);
848
+ this.cellEditor.toOutput(true);
849
+ CellEditorDirective.executeMove(e, targetCell);
850
+ }
851
+ findNextRowEditableColumn(row, matColumnClassName) {
852
+ const nextRow = row.parentElement?.nextElementSibling;
853
+ if (!nextRow) {
854
+ return null;
855
+ }
856
+ const column = nextRow.getElementsByClassName(matColumnClassName)[0];
857
+ return column?.classList.contains('editable-cell') ?
858
+ column.firstChild :
859
+ this.findNextRowEditableColumn(nextRow, matColumnClassName);
860
+ }
861
+ findNextEditableColumn(cell) {
862
+ let nextCell = cell.parentElement?.nextElementSibling;
863
+ if (!nextCell) {
864
+ const nextRow = cell.parentElement?.parentElement?.nextElementSibling;
865
+ if (nextRow) {
866
+ nextCell = nextRow.firstElementChild;
867
+ }
868
+ }
869
+ if (nextCell) {
870
+ return nextCell.classList.contains('editable-cell')
871
+ ? nextCell.firstChild
872
+ : this.findNextEditableColumn(nextCell);
873
+ }
874
+ return null;
875
+ }
876
+ findPreviousEditableColumn(cell) {
877
+ let prevCell = cell.previousElementSibling;
878
+ if (!prevCell) {
879
+ const previousRow = cell.parentElement?.previousElementSibling;
880
+ if (previousRow) {
881
+ prevCell = previousRow.lastElementChild;
882
+ }
883
+ }
884
+ if (prevCell) {
885
+ return prevCell.classList.contains('editable-cell') ?
886
+ prevCell.firstChild :
887
+ this.findPreviousEditableColumn(prevCell);
888
+ }
889
+ else {
890
+ return null;
891
+ }
892
+ }
893
+ moveToCell(event, nextCell) {
894
+ const currentCell = this.cellEditor.element;
895
+ if (this.cellEditor.element != null) {
896
+ const targetCell = nextCell
897
+ ? this.findNextEditableColumn(currentCell)
898
+ : this.findPreviousEditableColumn(currentCell);
899
+ if (this.myCellEditorService.isEditingCellValid()) {
900
+ this.cellEditor.toOutput(true);
901
+ targetCell?.click();
902
+ }
903
+ CellEditorDirective.executeMove(event, targetCell);
904
+ }
905
+ }
906
+ static invokeElementMethod(element, methodName, args) {
907
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types,@typescript-eslint/no-unsafe-function-type,@typescript-eslint/no-explicit-any
908
+ element[methodName].apply(element, args);
909
+ }
910
+ static executeMove(e, targetCell) {
911
+ e.preventDefault();
912
+ // If datepicker is opened, remove cdk-overlay from dom
913
+ const element = e.composedPath()[0];
914
+ if (element.className.includes('td-input-date')) {
915
+ const cdkOverlayContainer = document.getElementsByClassName('cdk-overlay-container')[0];
916
+ const cdkBackdrop = cdkOverlayContainer.getElementsByClassName('cdk-overlay-backdrop')[0];
917
+ if (cdkBackdrop != null) {
918
+ CellEditorDirective.invokeElementMethod(cdkBackdrop, 'click');
919
+ }
920
+ cdkOverlayContainer.innerHTML = '';
921
+ }
922
+ CellEditorDirective.invokeElementMethod(e.target, 'blur');
923
+ if (targetCell != null) {
924
+ CellEditorDirective.invokeElementMethod(targetCell, 'click');
925
+ }
926
+ }
927
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CellEditorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
928
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.11", 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 }); }
929
+ }
930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: CellEditorDirective, decorators: [{
931
+ type: Directive,
932
+ args: [{ selector: 'td[mosaCellEditor]' }]
933
+ }], ctorParameters: () => [], propDecorators: { cellEditor: [{
934
+ type: ContentChild,
935
+ args: [CellEditorComponent]
936
+ }], onEscapeKeyDown: [{
937
+ type: HostListener,
938
+ args: ['keydown.escape', ['$event']]
939
+ }], onShiftKeyDown: [{
940
+ type: HostListener,
941
+ args: ['keydown.tab', ['$event']]
942
+ }, {
943
+ type: HostListener,
944
+ args: ['keydown.shift.tab', ['$event']]
945
+ }, {
946
+ type: HostListener,
947
+ args: ['keydown.meta.tab', ['$event']]
948
+ }], onEnterKeyDown: [{
949
+ type: HostListener,
950
+ args: ['keydown.enter', ['$event']]
951
+ }], onClick: [{
952
+ type: HostListener,
953
+ args: ['click', ['$event']]
954
+ }] } });
955
+
956
+ class ClickOutsideDirective {
957
+ constructor(elementRef) {
958
+ this.elementRef = elementRef;
959
+ this.clickOutside = new EventEmitter();
960
+ this.enableWhiteListing = false;
961
+ }
962
+ onClick(targetElement) {
963
+ const clickedInside = this.elementRef.nativeElement.contains(targetElement);
964
+ const whiteListedClass = 'whitelisted';
965
+ if (!clickedInside) {
966
+ if (this.enableWhiteListing) {
967
+ const isWhiteListed = targetElement.classList.contains(whiteListedClass)
968
+ || ClickOutsideDirective.getClosest(targetElement, whiteListedClass)
969
+ || ClickOutsideDirective.getClosest(targetElement, 'cdk-overlay-container');
970
+ if (!isWhiteListed) {
971
+ this.clickOutside.emit([this.elementRef.nativeElement, targetElement]);
972
+ }
973
+ }
974
+ else {
975
+ this.clickOutside.emit([this.elementRef.nativeElement, targetElement]);
976
+ }
977
+ }
978
+ }
979
+ static getClosest(el, selector) {
980
+ while (el) {
981
+ if (el.classList.contains(selector)) {
982
+ return el;
983
+ }
984
+ el = el.parentElement;
985
+ }
986
+ return null;
987
+ }
988
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
989
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.11", type: ClickOutsideDirective, isStandalone: true, selector: "[clickOutside]", inputs: { enableWhiteListing: "enableWhiteListing" }, outputs: { clickOutside: "clickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 }); }
990
+ }
991
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ClickOutsideDirective, decorators: [{
992
+ type: Directive,
993
+ args: [{
994
+ // eslint-disable-next-line @angular-eslint/directive-selector
995
+ selector: '[clickOutside]',
996
+ }]
997
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { clickOutside: [{
998
+ type: Output
999
+ }], enableWhiteListing: [{
1000
+ type: Input
1001
+ }], onClick: [{
1002
+ type: HostListener,
1003
+ args: ['document:click', ['$event.target']]
1004
+ }] } });
1005
+
1006
+ class LoggerService extends CoreLoggerService {
1007
+ /**
1008
+ * Default constructor
1009
+ */
1010
+ constructor() {
1011
+ super();
1012
+ }
1013
+ /**
1014
+ * Setter for logger
1015
+ * @param component
1016
+ * @param defaultConfig
1017
+ */
1018
+ logger(component, defaultConfig) {
1019
+ this.loggerComp = component;
1020
+ this.defaultConfig = defaultConfig;
1021
+ }
1022
+ /**
1023
+ * Shows the log
1024
+ * @param type
1025
+ * @param config
1026
+ */
1027
+ show(config, type) {
1028
+ super.show(config, type);
1029
+ if (this.loggerComp) {
1030
+ const i = this.loggerComp.slideIn(config.title, config.msg, type, config);
1031
+ if (config.duration !== -1) {
1032
+ setTimeout(() => this.loggerComp?.slideOut(i), (config.duration || 1) * 1000);
1033
+ }
1034
+ }
1035
+ }
1036
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1037
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
1038
+ }
1039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: LoggerService, decorators: [{
1040
+ type: Injectable,
1041
+ args: [{
1042
+ providedIn: 'root',
1043
+ }]
1044
+ }], ctorParameters: () => [] });
3
1045
 
4
1046
  function initI18n(i18n) {
5
1047
  return i18n.init(undefined, 'mosa');
@@ -12,5 +1054,5 @@ const provideMosaMaterial = () => makeEnvironmentProviders([
12
1054
  * Generated bundle index. Do not edit.
13
1055
  */
14
1056
 
15
- export { provideMosaMaterial };
1057
+ export { AlertWidget, CellEditorBaseComponent, CellEditorComponent, CellEditorDirective, CellEditorService, ClickOutsideDirective, ConfirmDialog, ConfirmDialogAction, ConfirmDialogData, ConfirmDialogResult, ListSkeletonLoader, LoadingButtonComponent, LoggerComponent, LoggerFacade, LoggerService, MatUpdateDialog, Skeleton, SkeletonComponent, TableSkeletonLoader, UpdateDialog, UpdateDialogResult, provideMosaMaterial };
16
1058
  //# sourceMappingURL=mosa-ng-material.mjs.map