@mosa-ng/material 17.0.0 → 19.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.
Files changed (68) hide show
  1. package/fesm2022/mosa-ng-material.mjs +40 -0
  2. package/fesm2022/mosa-ng-material.mjs.map +1 -0
  3. package/index.d.ts +5 -0
  4. package/lib/mosa-material.module.d.ts +11 -0
  5. package/package.json +21 -10
  6. package/public-api.d.ts +1 -0
  7. package/.eslintrc.json +0 -31
  8. package/ng-package.json +0 -10
  9. package/src/lib/components/alert-widget/alert-widget.module.ts +0 -17
  10. package/src/lib/components/alert-widget/alert.widget.html +0 -7
  11. package/src/lib/components/alert-widget/alert.widget.scss +0 -50
  12. package/src/lib/components/alert-widget/alert.widget.ts +0 -61
  13. package/src/lib/components/base/base.module.ts +0 -14
  14. package/src/lib/components/base/cell-editor.base.component.ts +0 -79
  15. package/src/lib/components/cell-editor/cell-editor.component.html +0 -6
  16. package/src/lib/components/cell-editor/cell-editor.component.scss +0 -53
  17. package/src/lib/components/cell-editor/cell-editor.component.ts +0 -115
  18. package/src/lib/components/cell-editor/cell-editor.module.ts +0 -15
  19. package/src/lib/components/confirm-dialog/confirm-dialog.module.ts +0 -19
  20. package/src/lib/components/confirm-dialog/confirm.dialog.html +0 -15
  21. package/src/lib/components/confirm-dialog/confirm.dialog.scss +0 -3
  22. package/src/lib/components/confirm-dialog/confirm.dialog.ts +0 -60
  23. package/src/lib/components/loading-button/loading-button.component.html +0 -42
  24. package/src/lib/components/loading-button/loading-button.component.scss +0 -40
  25. package/src/lib/components/loading-button/loading-button.component.ts +0 -42
  26. package/src/lib/components/loading-button/loading-button.module.ts +0 -21
  27. package/src/lib/components/logger/README.md +0 -83
  28. package/src/lib/components/logger/logger.component.html +0 -32
  29. package/src/lib/components/logger/logger.component.scss +0 -120
  30. package/src/lib/components/logger/logger.component.ts +0 -116
  31. package/src/lib/components/logger/logger.module.ts +0 -23
  32. package/src/lib/components/skeleton-loader/base.skeleton-loader.ts +0 -14
  33. package/src/lib/components/skeleton-loader/list-skeleton-loader/list-skeleton-loader.module.ts +0 -17
  34. package/src/lib/components/skeleton-loader/list-skeleton-loader/list.skeleton-loader.html +0 -5
  35. package/src/lib/components/skeleton-loader/list-skeleton-loader/list.skeleton-loader.scss +0 -0
  36. package/src/lib/components/skeleton-loader/list-skeleton-loader/list.skeleton-loader.ts +0 -26
  37. package/src/lib/components/skeleton-loader/skeleton/skeleton.component.html +0 -0
  38. package/src/lib/components/skeleton-loader/skeleton/skeleton.component.scss +0 -15
  39. package/src/lib/components/skeleton-loader/skeleton/skeleton.component.ts +0 -64
  40. package/src/lib/components/skeleton-loader/skeleton-loader.module.ts +0 -17
  41. package/src/lib/components/skeleton-loader/table-skeleton-loader/table-skeleton-loader.module.ts +0 -19
  42. package/src/lib/components/skeleton-loader/table-skeleton-loader/table.skeleton-loader.html +0 -12
  43. package/src/lib/components/skeleton-loader/table-skeleton-loader/table.skeleton-loader.scss +0 -3
  44. package/src/lib/components/skeleton-loader/table-skeleton-loader/table.skeleton-loader.ts +0 -44
  45. package/src/lib/components/update-dialog/mat-update-dialog/mat-update.dialog.html +0 -17
  46. package/src/lib/components/update-dialog/mat-update-dialog/mat-update.dialog.scss +0 -3
  47. package/src/lib/components/update-dialog/mat-update-dialog/mat-update.dialog.ts +0 -28
  48. package/src/lib/components/update-dialog/update-dialog.module.ts +0 -22
  49. package/src/lib/components/update-dialog/update.dialog.ts +0 -124
  50. package/src/lib/directives/cell-editor/cell-editor.directive.module.ts +0 -15
  51. package/src/lib/directives/cell-editor/cell-editor.directive.ts +0 -163
  52. package/src/lib/directives/click-outside/click-outside.directive.module.ts +0 -15
  53. package/src/lib/directives/click-outside/click-outside.directive.ts +0 -48
  54. package/src/lib/models/confirm-dialog.model.ts +0 -33
  55. package/src/lib/models/skeleton.model.ts +0 -19
  56. package/src/lib/models/states/cell-editor-base-state.model.ts +0 -3
  57. package/src/lib/models/states/logger-state.model.ts +0 -5
  58. package/src/lib/models/table-item.model.ts +0 -6
  59. package/src/lib/models/update-config.model.ts +0 -20
  60. package/src/lib/mosa-material.module.ts +0 -26
  61. package/src/lib/services/cell-editor.service.ts +0 -46
  62. package/src/lib/services/facades/logger.facade.ts +0 -37
  63. package/src/lib/services/logger.service.ts +0 -49
  64. package/src/lib/styles/_vars.scss +0 -71
  65. package/src/public-api.ts +0 -1
  66. package/tsconfig.lib.json +0 -14
  67. package/tsconfig.lib.prod.json +0 -10
  68. package/tsconfig.spec.json +0 -14
@@ -0,0 +1,40 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { provideAppInitializer, inject, NgModule } from '@angular/core';
4
+ import { AssetsI18nLoaderService } from '@mosa-ng/core';
5
+
6
+ function initI18n(i18n) {
7
+ return () => i18n.init(null, 'mosa');
8
+ }
9
+ class MosaMaterialModule {
10
+ static forRoot() {
11
+ return {
12
+ ngModule: MosaMaterialModule,
13
+ providers: [
14
+ provideAppInitializer(() => {
15
+ const initializerFn = (initI18n)(inject(AssetsI18nLoaderService));
16
+ return initializerFn();
17
+ }),
18
+ ],
19
+ };
20
+ }
21
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaMaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
22
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: MosaMaterialModule, imports: [CommonModule] }); }
23
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaMaterialModule, imports: [CommonModule] }); }
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: MosaMaterialModule, decorators: [{
26
+ type: NgModule,
27
+ args: [{
28
+ declarations: [],
29
+ imports: [
30
+ CommonModule,
31
+ ],
32
+ }]
33
+ }] });
34
+
35
+ /**
36
+ * Generated bundle index. Do not edit.
37
+ */
38
+
39
+ export { MosaMaterialModule, initI18n };
40
+ //# sourceMappingURL=mosa-ng-material.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mosa-ng-material.mjs","sources":["../../../../projects/material/src/lib/mosa-material.module.ts","../../../../projects/material/src/mosa-ng-material.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { inject, ModuleWithProviders, NgModule, provideAppInitializer } from '@angular/core';\nimport { AssetsI18nLoaderService } from '@mosa-ng/core';\n\nexport function initI18n(i18n: AssetsI18nLoaderService): () => Promise<void> {\n return () => i18n.init(null, 'mosa');\n}\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n ],\n})\nexport class MosaMaterialModule {\n\n public static forRoot(): ModuleWithProviders<MosaMaterialModule> {\n return {\n ngModule: MosaMaterialModule,\n providers: [\n provideAppInitializer(() => {\n const initializerFn = (initI18n)(inject(AssetsI18nLoaderService));\n return initializerFn();\n }),\n ],\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAIM,SAAU,QAAQ,CAAC,IAA6B,EAAA;IAClD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AACxC;MAQa,kBAAkB,CAAA;AAEpB,IAAA,OAAO,OAAO,GAAA;QACjB,OAAO;AACH,YAAA,QAAQ,EAAE,kBAAkB;AAC5B,YAAA,SAAS,EAAE;gBACP,qBAAqB,CAAC,MAAK;oBACnC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC;oBACjE,OAAO,aAAa,EAAE;AACxB,iBAAC,CAAC;AACK,aAAA;SACJ;;8GAXI,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHvB,YAAY,CAAA,EAAA,CAAA,CAAA;AAGP,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHvB,YAAY,CAAA,EAAA,CAAA,CAAA;;2FAGP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAN9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACL,YAAY;AACf,qBAAA;AACJ,iBAAA;;;ACbD;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@mosa-ng/material" />
5
+ export * from './public-api';
@@ -0,0 +1,11 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { AssetsI18nLoaderService } from '@mosa-ng/core';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/common";
5
+ export declare function initI18n(i18n: AssetsI18nLoaderService): () => Promise<void>;
6
+ export declare class MosaMaterialModule {
7
+ static forRoot(): ModuleWithProviders<MosaMaterialModule>;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<MosaMaterialModule, never>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MosaMaterialModule, never, [typeof i1.CommonModule], never>;
10
+ static ɵinj: i0.ɵɵInjectorDeclaration<MosaMaterialModule>;
11
+ }
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
1
  {
2
- "name": "@mosa-ng/material",
3
- "version": "17.0.0",
4
- "peerDependencies": {
5
- "@angular/common": ">=17.0.0 < 18.0.0",
6
- "@angular/core": ">=17.0.0 < 18.0.0"
2
+ "name": "@mosa-ng/material",
3
+ "version": "19.0.0",
4
+ "peerDependencies": {
5
+ "@angular/common": ">=18.0.0 < 19.0.0",
6
+ "@angular/core": ">=18.0.0 < 19.0.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2022/mosa-ng-material.mjs",
13
+ "typings": "index.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
7
17
  },
8
- "dependencies": {
9
- "tslib": "^2.3.0"
10
- },
11
- "sideEffects": false
12
- }
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "default": "./fesm2022/mosa-ng-material.mjs"
21
+ }
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export * from './lib/mosa-material.module';
package/.eslintrc.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "extends": "../../.eslintrc.json",
3
- "parserOptions": {
4
- "project": "**/tsconfig.json"
5
- },
6
- "overrides": [
7
- {
8
- "files": [
9
- "*.ts"
10
- ],
11
- "rules": {
12
- "@angular-eslint/component-selector": [
13
- "error",
14
- {
15
- "type": "element",
16
- "prefix": "mosa",
17
- "style": "kebab-case"
18
- }
19
- ],
20
- "@angular-eslint/directive-selector": [
21
- "error",
22
- {
23
- "type": "attribute",
24
- "prefix": "mosa",
25
- "style": "camelCase"
26
- }
27
- ]
28
- }
29
- }
30
- ]
31
- }
package/ng-package.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/@mosa-ng/material",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "assets": [
8
- "src/assets"
9
- ]
10
- }
@@ -1,17 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { MatIconModule } from '@angular/material/icon';
4
- import { AlertWidget } from './alert.widget';
5
-
6
- @NgModule({
7
- declarations: [ AlertWidget ],
8
- exports: [
9
- AlertWidget,
10
- ],
11
- imports: [
12
- CommonModule,
13
- MatIconModule,
14
- ],
15
- })
16
- export class AlertWidgetModule {
17
- }
@@ -1,7 +0,0 @@
1
- <div [class]="'alert-' + type" class="alert">
2
- <div class="icon">
3
- <mat-icon>icon</mat-icon>
4
- {{ title }}
5
- </div>
6
- <div>{{ message }}</div>
7
- </div>
@@ -1,50 +0,0 @@
1
- @import "../../styles/vars";
2
-
3
- :host {
4
- display: block;
5
- }
6
-
7
- .alert {
8
- position: relative;
9
- padding: 15px;
10
- border-radius: 4px;
11
- width: 100%;
12
- display: table;
13
- color: #222222;
14
- border: 1px solid #222222;
15
- border-left-width: 5px;
16
-
17
- .icon {
18
- @include flex(false, false, true);
19
- margin-bottom: 10px;
20
-
21
- mat-icon {
22
- margin-right: 10px;
23
- }
24
- }
25
-
26
- &-danger {
27
- background: rgba($danger, .1);
28
- border-color: $danger;
29
- }
30
-
31
- &-warning {
32
- background: rgba($warning, .1);
33
- border-color: $warning;
34
- }
35
-
36
- &-info {
37
- background: rgba($info, .1);
38
- border-color: $info;
39
- }
40
-
41
- &-primary {
42
- background: rgba($primary, .1);
43
- border-color: $primary;
44
- }
45
-
46
- &-success {
47
- background: rgba($success, .1);
48
- border-color: $success;
49
- }
50
- }
@@ -1,61 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'mosa-alert-widget',
5
- templateUrl: './alert.widget.html',
6
- styleUrls: [ './alert.widget.scss' ],
7
- changeDetection: ChangeDetectionStrategy.OnPush,
8
- })
9
- export class AlertWidget implements OnInit, OnChanges {
10
-
11
- @Input()
12
- public icon: string;
13
-
14
- @Input()
15
- public title: string;
16
-
17
- @Input()
18
- public message: string;
19
-
20
- @Input()
21
- public type: 'warning' | 'error' | 'info' | 'success';
22
-
23
- constructor() {
24
- }
25
-
26
- public ngOnInit(): void {
27
- this.updateData();
28
- }
29
-
30
- public ngOnChanges(_changes: SimpleChanges): void {
31
- this.updateData();
32
- }
33
-
34
- private updateData(): void {
35
- if (!this.title || !this.icon) {
36
- switch (this.type) {
37
- case 'error':
38
- this.icon ||= 'alert-circle-outline';
39
- this.title ||= 'Error';
40
- break;
41
- case 'info':
42
- this.icon ||= 'information-outline';
43
- this.title ||= 'Information';
44
- break;
45
- case 'success':
46
- this.icon ||= 'check';
47
- this.title ||= 'Success';
48
- break;
49
- case 'warning':
50
- this.icon ||= 'alert-outline';
51
- this.title ||= 'Warning';
52
- break;
53
- default:
54
- this.icon ||= 'information-outline';
55
- this.title ||= 'Alert';
56
- break;
57
- }
58
- }
59
- }
60
-
61
- }
@@ -1,14 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { CellEditorBaseComponent } from './cell-editor.base.component';
4
-
5
- @NgModule({
6
- declarations: [
7
- CellEditorBaseComponent,
8
- ],
9
- imports: [
10
- CommonModule,
11
- ],
12
- })
13
- export class BaseModule {
14
- }
@@ -1,79 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, OnInit, Optional } from '@angular/core';
2
- import { MatDialog } from '@angular/material/dialog';
3
- import { MatTableDataSource } from '@angular/material/table';
4
- import { ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot, UrlTree } from '@angular/router';
5
- import { PromiseReject, PromiseResolve } from '@mosa-ng/core';
6
- import { Observable } from 'rxjs';
7
- import { ConfirmDialogData, ConfirmDialogResult } from '../../models/confirm-dialog.model';
8
- import { TableItem } from '../../models/table-item.model';
9
- import { ConfirmDialog } from '../confirm-dialog/confirm.dialog';
10
-
11
- @Component({
12
- selector: 'mosa-cell-editor-base',
13
- template: '',
14
- changeDetection: ChangeDetectionStrategy.OnPush,
15
- })
16
- export class CellEditorBaseComponent<Model> implements OnInit, CanDeactivate<CellEditorBaseComponent<Model>> {
17
-
18
- public dataSource: MatTableDataSource<TableItem<Model>>;
19
- public displayedColumns: (keyof Model | string)[] = [];
20
-
21
- constructor(
22
- @Optional()
23
- protected readonly myMatDialog: MatDialog,
24
- ) {
25
- }
26
-
27
- public ngOnInit(): void {
28
- this.dataSource = new MatTableDataSource<TableItem<Model>>();
29
- }
30
-
31
- public get changedRows(): TableItem<Model>[] {
32
- return this.dataSource?.data?.filter((c: TableItem<Model>): boolean => c.changedRowKeys?.length > 0);
33
- }
34
-
35
- /**
36
- * Remove table item data
37
- * @param data
38
- */
39
- public serializeData(data: TableItem<Model>[]): Model[] {
40
- return data.map((val: TableItem<Model>): Model => {
41
- delete val.changedRowKeys;
42
- delete val.rowOriginalData;
43
- return val;
44
- });
45
- }
46
-
47
- public toTableItems(data: Model[]): TableItem<Model>[] {
48
- return data.map((val: Model): TableItem<Model> => ({
49
- ...val,
50
- rowOriginalData: val,
51
- changedRowKeys: [],
52
- }));
53
- }
54
-
55
- public canDeactivate(_component: CellEditorBaseComponent<Model>, _currentRoute: ActivatedRouteSnapshot, _currentState: RouterStateSnapshot,
56
- _nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
57
- if (!this.changedRows.length) {
58
- return true;
59
- }
60
-
61
- return new Promise((resolve: PromiseResolve<boolean>, _reject: PromiseReject): void => {
62
- this.myMatDialog
63
- .open(ConfirmDialog, {
64
- width: '600px',
65
- data: new ConfirmDialogData('mosa.components.cellEditorBase.discardChanges.label',
66
- 'mosa.components.cellEditorBase.discardChanges.message'),
67
- })
68
- .afterClosed()
69
- .subscribe((result: ConfirmDialogResult): void => {
70
- if (result === ConfirmDialogResult.confirmed) {
71
- resolve(true);
72
- } else {
73
- resolve(false);
74
- }
75
- });
76
- });
77
- }
78
-
79
- }
@@ -1,6 +0,0 @@
1
- <div *ngIf="mode === 'input'" class="input-wrapper">
2
- <ng-content select=".cell-input"></ng-content>
3
- </div>
4
- <div *ngIf="mode === 'output'" class="output-wrapper">
5
- <ng-content select=".cell-output"></ng-content>
6
- </div>
@@ -1,53 +0,0 @@
1
- @import "../../styles/vars";
2
-
3
- :host {
4
- display: flex;
5
- align-items: center;
6
- position: absolute;
7
- width: 100%;
8
- height: 100%;
9
- top: 0;
10
- left: 0;
11
- z-index: 1;
12
-
13
- &.focused .input-wrapper {
14
- height: calc(100% - 6px);
15
- width: 100%;
16
- box-shadow: 0 0 0 3px rgba(#1387DF, .8);
17
- outline: 0;
18
- display: flex;
19
- flex-direction: column;
20
- }
21
-
22
- &.edited {
23
- color: #1387DF;
24
- font-weight: 500;
25
- }
26
- }
27
-
28
- ::ng-deep .editable-cell {
29
- position: relative;
30
-
31
- &:first-child mosa-cell-editor:not(.focused) {
32
- padding-left: 24px;
33
- }
34
- }
35
-
36
- ::ng-deep .cell-input {
37
- padding: 10px;
38
- }
39
-
40
- ::ng-deep .cell-output {
41
- text-overflow: ellipsis;
42
- overflow: hidden;
43
- white-space: nowrap;
44
- }
45
-
46
- ::ng-deep input.cell-input {
47
- font-size: 14px;
48
- font-family: $fontRoboto;
49
- background: none;
50
- flex-grow: 1;
51
- outline: 0;
52
- border: none;
53
- }
@@ -1,115 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- ChangeDetectorRef,
4
- Component,
5
- ContentChild,
6
- ElementRef,
7
- EventEmitter,
8
- Input,
9
- OnInit,
10
- Output,
11
- } from '@angular/core';
12
- import { MatSelect } from '@angular/material/select';
13
- import { TableItem } from '../../models/table-item.model';
14
- import { BaseComponent } from '../base/base.component';
15
-
16
- @Component({
17
- selector: 'mosa-cell-editor',
18
- templateUrl: './cell-editor.component.html',
19
- styleUrls: [ './cell-editor.component.scss' ],
20
- changeDetection: ChangeDetectionStrategy.OnPush,
21
- })
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- export class CellEditorComponent<T = any> extends BaseComponent implements OnInit {
24
-
25
- @Input()
26
- public key: string;
27
-
28
- @Input()
29
- public rowItem: TableItem<T>;
30
-
31
- @Input()
32
- public value: T;
33
-
34
- @Output()
35
- public valueChange: EventEmitter<T> = new EventEmitter<T>();
36
-
37
- @Output()
38
- public cellClick: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();
39
-
40
- @Output()
41
- private readonly cellChange: EventEmitter<void> = new EventEmitter<void>();
42
-
43
- @Output()
44
- private readonly cellCancel: EventEmitter<void> = new EventEmitter<void>();
45
-
46
- @ContentChild(MatSelect)
47
- private readonly select: MatSelect;
48
-
49
- public mode: 'input' | 'output' = 'output';
50
-
51
- private oldValue: T;
52
-
53
- constructor(
54
- private readonly myChangeDetectorRef: ChangeDetectorRef,
55
- private readonly myElementRef: ElementRef<HTMLElement>,
56
- ) {
57
- super();
58
- }
59
-
60
- public get element(): HTMLElement {
61
- return this.myElementRef.nativeElement;
62
- }
63
-
64
- public override ngOnInit(): void {
65
- this.oldValue = this.value;
66
- this.rowItem.rowOriginalData = this.rowItem;
67
- }
68
-
69
- public toOutput(save?: boolean): void {
70
- if (this.mode !== 'output') {
71
- this.mode = 'output';
72
- this.myChangeDetectorRef.markForCheck();
73
- this.element.classList.remove('focused');
74
-
75
- if (save) {
76
- if (!this.rowItem.changedRowKeys) {
77
- this.rowItem.changedRowKeys = [];
78
- }
79
- const index: number = this.rowItem.changedRowKeys.indexOf(this.key);
80
- if (this.value !== this.oldValue) {
81
- if (index === -1) {
82
- this.rowItem.changedRowKeys.push(this.key);
83
- this.element.classList.add('edited');
84
- }
85
- this.cellChange.emit();
86
- } else {
87
- if (index !== -1) {
88
- this.rowItem.changedRowKeys.splice(index, 1);
89
- this.element.classList.remove('edited');
90
- }
91
- }
92
- } else {
93
- this.value = this.oldValue;
94
- this.cellCancel.emit();
95
- }
96
- this.valueChange.next(this.value);
97
- }
98
- }
99
-
100
- public toInput(): void {
101
- this.mode = 'input';
102
- this.myChangeDetectorRef.markForCheck();
103
- this.element.classList.add('focused');
104
- setTimeout((): void => {
105
- const comp: HTMLElement = this.element.querySelector('.cell-input');
106
-
107
- if (comp instanceof HTMLInputElement) {
108
- comp.focus();
109
- } else if (this.select) {
110
- this.select.open();
111
- }
112
- });
113
- }
114
-
115
- }
@@ -1,15 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { CellEditorComponent } from './cell-editor.component';
4
-
5
- @NgModule({
6
- declarations: [ CellEditorComponent ],
7
- imports: [
8
- CommonModule,
9
- ],
10
- exports: [
11
- CellEditorComponent,
12
- ],
13
- })
14
- export class CellEditorModule {
15
- }
@@ -1,19 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { NgModule } from '@angular/core';
3
- import { MatButtonModule } from '@angular/material/button';
4
- import { MatDialogModule } from '@angular/material/dialog';
5
- import { TranslateModule } from '@ngx-translate/core';
6
- import { ConfirmDialog } from './confirm.dialog';
7
-
8
- @NgModule({
9
- declarations: [ ConfirmDialog ],
10
- imports: [
11
- CommonModule,
12
- MatDialogModule,
13
- MatButtonModule,
14
- TranslateModule,
15
- ],
16
- exports: [ ConfirmDialog ],
17
- })
18
- export class ConfirmDialogModule {
19
- }
@@ -1,15 +0,0 @@
1
- <h1 class="active" mat-dialog-title>{{ dialogData.title | translate }}</h1>
2
- <div mat-dialog-content>
3
- {{ dialogData.message | translate }}
4
- </div>
5
- <div mat-dialog-actions>
6
- <button (click)="confirm(result.cancelled)" *ngIf="dialogData.cancel" color="primary" mat-stroked-button>
7
- {{ 'mosa.commons.buttons.cancel' | translate | uppercase }}
8
- </button>
9
- <button (click)="confirm(result.denied)" *ngIf="dialogData.deny.visible" color="primary" mat-stroked-button>
10
- {{ dialogData.deny.label | translate | uppercase }}
11
- </button>
12
- <button (click)="confirm(result.confirmed)" *ngIf="dialogData.confirm.visible" color="primary" mat-flat-button>
13
- {{ dialogData.confirm.label | translate | uppercase }}
14
- </button>
15
- </div>
@@ -1,3 +0,0 @@
1
- .mat-dialog-actions {
2
- margin-top: 20px;
3
- }
@@ -1,60 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core';
2
- import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
3
- import { ConfirmDialogAction, ConfirmDialogData, ConfirmDialogResult } from '../../models/confirm-dialog.model';
4
- import { BaseComponent } from '../base/base.component';
5
-
6
- @Component({
7
- selector: 'mosa-confirm-dialog',
8
- templateUrl: './confirm.dialog.html',
9
- styleUrls: [ './confirm.dialog.scss' ],
10
- changeDetection: ChangeDetectionStrategy.OnPush,
11
- })
12
- export class ConfirmDialog extends BaseComponent implements OnInit {
13
-
14
- public dialogData: ConfirmDialogData;
15
- public result: typeof ConfirmDialogResult = ConfirmDialogResult;
16
-
17
- constructor(
18
- @Inject(MAT_DIALOG_DATA)
19
- private readonly myConfirmDialogData: ConfirmDialogData,
20
- private readonly myMatDialogRef: MatDialogRef<ConfirmDialog>,
21
- ) {
22
- super();
23
- const cancel: ConfirmDialogAction = new ConfirmDialogAction('mosa.commons.buttons.cancel', true);
24
- const deny: ConfirmDialogAction = new ConfirmDialogAction('mosa.commons.buttons.deny');
25
- const confirm: ConfirmDialogAction = new ConfirmDialogAction('mosa.commons.buttons.confirm', true);
26
- const title: string = 'mosa.components.confirmDialog.title';
27
- const message: string = 'mosa.components.confirmDialog.message';
28
-
29
- this.dialogData = myConfirmDialogData || new ConfirmDialogData(title, message, cancel, confirm, deny);
30
-
31
- if (!this.dialogData.title) {
32
- this.dialogData.title = title;
33
- }
34
-
35
- if (!this.dialogData.message) {
36
- this.dialogData.message = message;
37
- }
38
-
39
- if (!this.dialogData.cancel) {
40
- this.dialogData.cancel = cancel;
41
- }
42
-
43
- if (!this.dialogData.confirm) {
44
- this.dialogData.confirm = confirm;
45
- }
46
-
47
- if (!this.dialogData.deny) {
48
- this.dialogData.deny = deny;
49
- }
50
- }
51
-
52
- public override ngOnInit(): void {
53
- super.ngOnInit();
54
- }
55
-
56
- public confirm(result: ConfirmDialogResult): void {
57
- this.myMatDialogRef.close(result);
58
- }
59
-
60
- }