mat-table-ext 0.0.0 → 0.0.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.
Files changed (88) hide show
  1. package/README.md +48 -27
  2. package/{projects/mat-table-ext/assets → assets}/pinIcon.svg +0 -0
  3. package/{projects/mat-table-ext/assets → assets}/pinLeft.svg +0 -0
  4. package/{projects/mat-table-ext/assets → assets}/pinNone.svg +0 -0
  5. package/{projects/mat-table-ext/assets → assets}/pinRight.svg +0 -0
  6. package/{projects/mat-table-ext/assets → assets}/pinned.svg +0 -0
  7. package/esm2020/lib/components/column-pinning/column-pinning.component.mjs +58 -0
  8. package/esm2020/lib/components/editing/editing.component.mjs +122 -0
  9. package/esm2020/lib/components/filter-columns-component/filter-columns-component.component.mjs +68 -0
  10. package/esm2020/lib/directives/resize-column.directive.mjs +99 -0
  11. package/esm2020/lib/mat-table-ext.component.mjs +1021 -0
  12. package/esm2020/lib/mat-table-ext.module.mjs +237 -0
  13. package/esm2020/lib/mat-table-ext.service.mjs +20 -0
  14. package/esm2020/lib/models/tableExtModels.mjs +2 -0
  15. package/esm2020/mat-table-ext.mjs +5 -0
  16. package/esm2020/public-api.mjs +11 -0
  17. package/fesm2015/mat-table-ext.mjs +1585 -0
  18. package/fesm2015/mat-table-ext.mjs.map +1 -0
  19. package/fesm2020/mat-table-ext.mjs +1582 -0
  20. package/fesm2020/mat-table-ext.mjs.map +1 -0
  21. package/index.d.ts +5 -0
  22. package/lib/components/column-pinning/column-pinning.component.d.ts +27 -0
  23. package/lib/components/editing/editing.component.d.ts +42 -0
  24. package/lib/components/filter-columns-component/filter-columns-component.component.d.ts +26 -0
  25. package/lib/directives/resize-column.directive.d.ts +27 -0
  26. package/lib/mat-table-ext.component.d.ts +348 -0
  27. package/lib/mat-table-ext.module.d.ts +58 -0
  28. package/lib/mat-table-ext.service.d.ts +11 -0
  29. package/lib/models/tableExtModels.d.ts +76 -0
  30. package/package.json +54 -45
  31. package/{projects/mat-table-ext/src/public-api.ts → public-api.d.ts} +1 -5
  32. package/.editorconfig +0 -16
  33. package/.vscode/extensions.json +0 -4
  34. package/.vscode/launch.json +0 -20
  35. package/.vscode/tasks.json +0 -42
  36. package/angular.json +0 -150
  37. package/projects/mat-table-ext/.browserslistrc +0 -16
  38. package/projects/mat-table-ext/README.md +0 -24
  39. package/projects/mat-table-ext/karma.conf.js +0 -44
  40. package/projects/mat-table-ext/ng-package.json +0 -9
  41. package/projects/mat-table-ext/package.json +0 -34
  42. package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.html +0 -7
  43. package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.scss +0 -9
  44. package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.spec.ts +0 -23
  45. package/projects/mat-table-ext/src/lib/components/column-pinning/column-pinning.component.ts +0 -48
  46. package/projects/mat-table-ext/src/lib/components/editing/editing.component.html +0 -55
  47. package/projects/mat-table-ext/src/lib/components/editing/editing.component.scss +0 -19
  48. package/projects/mat-table-ext/src/lib/components/editing/editing.component.spec.ts +0 -23
  49. package/projects/mat-table-ext/src/lib/components/editing/editing.component.ts +0 -110
  50. package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.html +0 -26
  51. package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.scss +0 -0
  52. package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.spec.ts +0 -23
  53. package/projects/mat-table-ext/src/lib/components/filter-columns-component/filter-columns-component.component.ts +0 -54
  54. package/projects/mat-table-ext/src/lib/directives/resize-column.directive.ts +0 -103
  55. package/projects/mat-table-ext/src/lib/mat-table-ext.component.html +0 -285
  56. package/projects/mat-table-ext/src/lib/mat-table-ext.component.spec.ts +0 -25
  57. package/projects/mat-table-ext/src/lib/mat-table-ext.component.ts +0 -985
  58. package/projects/mat-table-ext/src/lib/mat-table-ext.module.ts +0 -127
  59. package/projects/mat-table-ext/src/lib/mat-table-ext.scss +0 -189
  60. package/projects/mat-table-ext/src/lib/mat-table-ext.service.spec.ts +0 -16
  61. package/projects/mat-table-ext/src/lib/mat-table-ext.service.ts +0 -12
  62. package/projects/mat-table-ext/src/lib/models/tableExtModels.ts +0 -85
  63. package/projects/mat-table-ext/src/test.ts +0 -27
  64. package/projects/mat-table-ext/tsconfig.lib.json +0 -15
  65. package/projects/mat-table-ext/tsconfig.lib.prod.json +0 -10
  66. package/projects/mat-table-ext/tsconfig.spec.json +0 -17
  67. package/projects/mat-table-ext-example/.browserslistrc +0 -16
  68. package/projects/mat-table-ext-example/karma.conf.js +0 -44
  69. package/projects/mat-table-ext-example/src/app/app.component.html +0 -577
  70. package/projects/mat-table-ext-example/src/app/app.component.scss +0 -0
  71. package/projects/mat-table-ext-example/src/app/app.component.spec.ts +0 -31
  72. package/projects/mat-table-ext-example/src/app/app.component.ts +0 -173
  73. package/projects/mat-table-ext-example/src/app/app.module.ts +0 -40
  74. package/projects/mat-table-ext-example/src/app/service/custom-table.service.spec.ts +0 -16
  75. package/projects/mat-table-ext-example/src/app/service/custom-table.service.ts +0 -18
  76. package/projects/mat-table-ext-example/src/assets/.gitkeep +0 -0
  77. package/projects/mat-table-ext-example/src/assets/data.json +0 -100003
  78. package/projects/mat-table-ext-example/src/environments/environment.prod.ts +0 -3
  79. package/projects/mat-table-ext-example/src/environments/environment.ts +0 -16
  80. package/projects/mat-table-ext-example/src/favicon.ico +0 -0
  81. package/projects/mat-table-ext-example/src/index.html +0 -14
  82. package/projects/mat-table-ext-example/src/main.ts +0 -12
  83. package/projects/mat-table-ext-example/src/polyfills.ts +0 -53
  84. package/projects/mat-table-ext-example/src/styles.scss +0 -1
  85. package/projects/mat-table-ext-example/src/test.ts +0 -26
  86. package/projects/mat-table-ext-example/tsconfig.app.json +0 -15
  87. package/projects/mat-table-ext-example/tsconfig.spec.json +0 -18
  88. package/tsconfig.json +0 -38
@@ -1,42 +0,0 @@
1
- {
2
- // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3
- "version": "2.0.0",
4
- "tasks": [
5
- {
6
- "type": "npm",
7
- "script": "start",
8
- "isBackground": true,
9
- "problemMatcher": {
10
- "owner": "typescript",
11
- "pattern": "$tsc",
12
- "background": {
13
- "activeOnStart": true,
14
- "beginsPattern": {
15
- "regexp": "(.*?)"
16
- },
17
- "endsPattern": {
18
- "regexp": "bundle generation complete"
19
- }
20
- }
21
- }
22
- },
23
- {
24
- "type": "npm",
25
- "script": "test",
26
- "isBackground": true,
27
- "problemMatcher": {
28
- "owner": "typescript",
29
- "pattern": "$tsc",
30
- "background": {
31
- "activeOnStart": true,
32
- "beginsPattern": {
33
- "regexp": "(.*?)"
34
- },
35
- "endsPattern": {
36
- "regexp": "bundle generation complete"
37
- }
38
- }
39
- }
40
- }
41
- ]
42
- }
package/angular.json DELETED
@@ -1,150 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
- "version": 1,
4
- "newProjectRoot": "projects",
5
- "projects": {
6
- "mat-table-ext": {
7
- "projectType": "library",
8
- "root": "projects/mat-table-ext",
9
- "sourceRoot": "projects/mat-table-ext/src",
10
- "prefix": "lib",
11
- "architect": {
12
- "build": {
13
- "builder": "@angular-devkit/build-angular:ng-packagr",
14
- "options": {
15
- "project": "projects/mat-table-ext/ng-package.json"
16
- },
17
- "configurations": {
18
- "production": {
19
- "tsConfig": "projects/mat-table-ext/tsconfig.lib.prod.json"
20
- },
21
- "development": {
22
- "tsConfig": "projects/mat-table-ext/tsconfig.lib.json"
23
- }
24
- },
25
- "defaultConfiguration": "production"
26
- },
27
- "test": {
28
- "builder": "@angular-devkit/build-angular:karma",
29
- "options": {
30
- "main": "projects/mat-table-ext/src/test.ts",
31
- "tsConfig": "projects/mat-table-ext/tsconfig.spec.json",
32
- "karmaConfig": "projects/mat-table-ext/karma.conf.js"
33
- }
34
- }
35
- }
36
- },
37
- "mat-table-ext-example": {
38
- "projectType": "application",
39
- "schematics": {
40
- "@schematics/angular:component": {
41
- "style": "scss"
42
- },
43
- "@schematics/angular:application": {
44
- "strict": true
45
- }
46
- },
47
- "root": "projects/mat-table-ext-example",
48
- "sourceRoot": "projects/mat-table-ext-example/src",
49
- "prefix": "app",
50
- "architect": {
51
- "build": {
52
- "builder": "@angular-devkit/build-angular:browser",
53
- "options": {
54
- "outputPath": "dist/mat-table-ext-example",
55
- "index": "projects/mat-table-ext-example/src/index.html",
56
- "main": "projects/mat-table-ext-example/src/main.ts",
57
- "polyfills": "projects/mat-table-ext-example/src/polyfills.ts",
58
- "tsConfig": "projects/mat-table-ext-example/tsconfig.app.json",
59
- "inlineStyleLanguage": "scss",
60
- "assets": [
61
- "projects/mat-table-ext-example/src/favicon.ico",
62
- "projects/mat-table-ext-example/src/assets",
63
- {
64
- "glob": "**/*",
65
- "input": "projects/mat-table-ext/assets",
66
- "output": "/assets/"
67
- }
68
- ],
69
- "styles": [
70
- "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
71
- "projects/mat-table-ext-example/src/styles.scss"
72
- ],
73
- "scripts": []
74
- },
75
- "configurations": {
76
- "production": {
77
- "budgets": [
78
- {
79
- "type": "initial",
80
- "maximumWarning": "500kb",
81
- "maximumError": "1mb"
82
- },
83
- {
84
- "type": "anyComponentStyle",
85
- "maximumWarning": "2kb",
86
- "maximumError": "4kb"
87
- }
88
- ],
89
- "fileReplacements": [
90
- {
91
- "replace": "projects/mat-table-ext-example/src/environments/environment.ts",
92
- "with": "projects/mat-table-ext-example/src/environments/environment.prod.ts"
93
- }
94
- ],
95
- "outputHashing": "all"
96
- },
97
- "development": {
98
- "buildOptimizer": false,
99
- "optimization": false,
100
- "vendorChunk": true,
101
- "extractLicenses": false,
102
- "sourceMap": true,
103
- "namedChunks": true
104
- }
105
- },
106
- "defaultConfiguration": "production"
107
- },
108
- "serve": {
109
- "builder": "@angular-devkit/build-angular:dev-server",
110
- "configurations": {
111
- "production": {
112
- "browserTarget": "mat-table-ext-example:build:production"
113
- },
114
- "development": {
115
- "browserTarget": "mat-table-ext-example:build:development"
116
- }
117
- },
118
- "defaultConfiguration": "development"
119
- },
120
- "extract-i18n": {
121
- "builder": "@angular-devkit/build-angular:extract-i18n",
122
- "options": {
123
- "browserTarget": "mat-table-ext-example:build"
124
- }
125
- },
126
- "test": {
127
- "builder": "@angular-devkit/build-angular:karma",
128
- "options": {
129
- "main": "projects/mat-table-ext-example/src/test.ts",
130
- "polyfills": "projects/mat-table-ext-example/src/polyfills.ts",
131
- "tsConfig": "projects/mat-table-ext-example/tsconfig.spec.json",
132
- "karmaConfig": "projects/mat-table-ext-example/karma.conf.js",
133
- "inlineStyleLanguage": "scss",
134
- "assets": [
135
- "projects/mat-table-ext-example/src/favicon.ico",
136
- "projects/mat-table-ext-example/src/assets"
137
- ],
138
- "styles": [
139
- "projects/mat-table-ext-example/src/styles.scss"
140
- ],
141
- "scripts": []
142
- }
143
- }
144
- }
145
- }
146
- },
147
- "cli": {
148
- "analytics": false
149
- }
150
- }
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
@@ -1,24 +0,0 @@
1
- # MatTableExt
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.10.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project mat-table-ext` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project mat-table-ext`.
8
- > Note: Don't forget to add `--project mat-table-ext` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build mat-table-ext` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build mat-table-ext`, go to the dist folder `cd dist/mat-table-ext` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test mat-table-ext` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/mat-table-ext'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
@@ -1,9 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/mat-table-ext",
4
- "assets": ["assets"],
5
- "lib": {
6
- "entryFile": "src/public-api.ts",
7
- "cssUrl": "inline"
8
- }
9
- }
@@ -1,34 +0,0 @@
1
- {
2
- "name": "mat-table-sample",
3
- "version": "0.0.63",
4
- "description": "this is a sample table of material.",
5
- "keywords": [
6
- "Hamza"
7
- ],
8
- "author": {
9
- "name": "Samples Contribute",
10
- "email": "abc@gmail.com",
11
- "url": "http://blog.sample.me/"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/sample/tableSample"
16
- },
17
- "peerDependencies": {
18
- "@angular/animations": "^14.2.0",
19
- "@angular/cdk": "^14.2.4",
20
- "@angular/common": "^14.2.0",
21
- "@angular/compiler": "^14.2.0",
22
- "@angular/core": "^14.2.0",
23
- "@angular/forms": "^14.2.0",
24
- "@angular/material": "^14.2.4",
25
- "@angular/platform-browser": "^14.2.0",
26
- "@angular/platform-browser-dynamic": "^14.2.0",
27
- "@angular/router": "^14.2.0",
28
- "@ngx-translate/core": "^14.0.0",
29
- "xlsx": "^0.18.5"
30
- },
31
- "dependencies": {
32
- "tslib": "^2.3.0"
33
- }
34
- }
@@ -1,7 +0,0 @@
1
- <div class="pinning-list-item" *ngFor="let column of columns" style="display: flex; ">
2
- <button mat-icon-button >
3
- <mat-icon (click)="changeValue(column)" matTooltip="{{column['pinned'] ? (column['pinned'] | titlecase):'None'}}"
4
- svgIcon="{{column['pinned'] =='left'|| column['pinned'] =='right' ? icons[column['pinned']]:'pinNone'}}" class="pinning-icon"></mat-icon>
5
- </button>
6
- <span class="column-headers">{{column.header}}</span>
7
- </div>
@@ -1,9 +0,0 @@
1
- .pinning-list-item {
2
- display: flex;
3
- justify-content: flex-start;
4
- align-items: baseline;
5
- height: 3em;
6
- }
7
- .column-headers {
8
- font-family: Roboto, "Helvetica Neue", sans-serif;
9
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ColumnPinningComponent } from './column-pinning.component';
4
-
5
- describe('ColumnPinningComponent', () => {
6
- let component: ColumnPinningComponent;
7
- let fixture: ComponentFixture<ColumnPinningComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ColumnPinningComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ColumnPinningComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,48 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { MTExColumn } from '../../models/tableExtModels';
3
-
4
- @Component({
5
- selector: 'app-column-pinning',
6
- templateUrl: './column-pinning.component.html',
7
- styleUrls: ['./column-pinning.component.scss'],
8
- })
9
- export class ColumnPinningComponent implements OnInit {
10
- @Input() columns!: MTExColumn[];
11
- @Output() columnsChanged: EventEmitter<MTExColumn[]> = new EventEmitter();
12
- public icons = {
13
- left: 'pinLeft',
14
- right: 'pinRight',
15
- none: 'pinNone',
16
- };
17
-
18
- constructor() {}
19
- ngOnInit(): void {}
20
- /**
21
- * @description This method is called when pin value changes for a column.
22
- * @param column column of which to set the pin value
23
- */
24
- changeValue(column: MTExColumn) {
25
- if (column.pinned) {
26
- if (column.pinned == 'left') {
27
- this.setColumnPinValue(column, 'right');
28
- } else if (column.pinned == 'right') {
29
- this.setColumnPinValue(column, undefined);
30
- }
31
- } else {
32
- this.setColumnPinValue(column, 'left');
33
- }
34
- this.columnsChanged.emit(this.columns);
35
- }
36
- /**
37
- * @description This method is used to set the column pin value.
38
- * @param column column of which to set the pin value
39
- * @param value pin value to set
40
- */
41
- setColumnPinValue(column: MTExColumn, value: 'left' | 'right' | undefined) {
42
- this.columns.forEach((col) => {
43
- if (column?.header == col.header) {
44
- col.pinned = value;
45
- }
46
- });
47
- }
48
- }
@@ -1,55 +0,0 @@
1
- <div *ngIf="!templateRef" style="height: 100%;" class="main-dialog-container">
2
- <div mat-dialog-title class="dialog-title-container">
3
- <h2 style="margin: 0;">Edit Row</h2>
4
- <span class="example-spacer"></span>
5
- <button mat-icon-button aria-label="Example icon button with a vertical three dot icon">
6
- <mat-icon mat-dialog-close style="cursor: pointer;" fxFlex="5">close</mat-icon>
7
- </button>
8
- </div>
9
- <mat-dialog-content style="margin-right: 20px;">
10
- <div style="display: flex; flex-direction: column;">
11
- <ng-container *ngFor="let key of keys">
12
- <!-- Number Type -->
13
- <mat-form-field *ngIf="types[key] == 'number'" appearance="outline" class="inline-editing-field">
14
- <mat-label>{{key | titlecase}}</mat-label>
15
- <input matInput type="number" [(ngModel)]="dialogData['row'][key]" [ngModelOptions]="{standalone: true}">
16
- </mat-form-field>
17
-
18
- <!-- String Type -->
19
-
20
- <mat-form-field *ngIf="types[key] == 'string'" appearance="outline" class="inline-editing-field">
21
- <mat-label>{{key | titlecase}}</mat-label>
22
- <input matInput type="text" [(ngModel)]="dialogData['row'][key]" [ngModelOptions]="{standalone: true}">
23
- </mat-form-field>
24
- <mat-form-field *ngIf="types[key] == 'date'" appearance="outline" class="inline-editing-field">
25
- <mat-label>{{key | titlecase}}</mat-label>
26
- <input matInput type="text" [(ngModel)]="dialogData['row'][key]" [ngModelOptions]="{standalone: true}">
27
- </mat-form-field>
28
- <!-- Selection Type -->
29
-
30
- <mat-form-field *ngIf="types[key] == 'selection'" appearance="outline" class="inline-editing-field">
31
- <mat-label>{{key | titlecase}}</mat-label>
32
- <mat-select [value]="dialogData['row'][key].value" [(ngModel)]="dialogData['row'][key].value">
33
- <mat-option *ngFor="let option of dialogData['row'][key].options" [value]="option">
34
- {{option}}
35
- </mat-option>
36
- </mat-select>
37
- </mat-form-field>
38
- <!-- Boolean Type -->
39
- <p>
40
- <mat-checkbox *ngIf="types[key] == 'boolean'" color="primary" [(ngModel)]="dialogData['row'][key]">
41
- <mat-label>{{key | titlecase}}</mat-label>
42
- </mat-checkbox>
43
- </p>
44
- </ng-container>
45
- </div>
46
- </mat-dialog-content>
47
- <div class="spacer"></div>
48
- <mat-dialog-actions style="margin-top: 20px;" align="end">
49
- <button mat-raised-button color="warn" mat-dialog-close>
50
- Cancel
51
- </button>
52
- <button mat-raised-button color="primary" (click)="closeDialog()">Save</button>
53
- </mat-dialog-actions>
54
- </div>
55
- <ng-container *ngIf="templateRef" [ngTemplateOutlet]="templateRef" [ngTemplateOutletContext]="{data:{row:templateRow,columns:columns,columnKeys:templateKeys,columnTypes:templateTypes,closeDialog:closeTemplateDialog}}"></ng-container>
@@ -1,19 +0,0 @@
1
- .main-dialog-container {
2
- display: flex;
3
- flex-direction: column;
4
- }
5
-
6
- .main-dialog-container mat-dialog-content {
7
- overflow-y: auto;
8
- margin: 0px;
9
- padding: 0 0 0 20px;
10
- }
11
-
12
- .dialog-title-container {
13
- display: flex;
14
- align-items: center;
15
- }
16
-
17
- .spacer {
18
- flex-grow: 1;
19
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PopupModalComponent } from './editing.component';
4
-
5
- describe('PopupModalComponent', () => {
6
- let component: PopupModalComponent;
7
- let fixture: ComponentFixture<PopupModalComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ PopupModalComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(PopupModalComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,110 +0,0 @@
1
- import { Component, Inject, OnInit, TemplateRef } from '@angular/core';
2
- import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
3
- import { MTExColumn } from '../../models/tableExtModels';
4
- import { MatTableExtService } from '../../mat-table-ext.service';
5
-
6
- @Component({
7
- selector: 'app-editing',
8
- templateUrl: './editing.component.html',
9
- styleUrls: ['./editing.component.scss'],
10
- })
11
- export class EditingComponent implements OnInit {
12
- public templateRef!: TemplateRef<any>;
13
- public keys: string[] = [];
14
- public templateKeys: string[] = [];
15
- public types: any = {};
16
- public templateTypes: any = {};
17
- public columns: MTExColumn[] = [];
18
- public templateRow: any = {};
19
-
20
- constructor(
21
- public dialogRef: MatDialogRef<EditingComponent>,
22
- @Inject(MAT_DIALOG_DATA) public dialogData: any,
23
- public service: MatTableExtService
24
- ) { }
25
-
26
- ngOnInit(): void {
27
- this.setData(this.dialogData);
28
- }
29
- /**
30
- * @description This method is used to set data for editing.
31
- * @param value dialog Data
32
- */
33
- setData(value: any) {
34
- let row = value.row;
35
- let types: any = {};
36
- this.keys = [];
37
- this.columns = value.columns;
38
- this.columns.forEach((column) => {
39
- this.keys.push(column.field);
40
- if (column.type == 'selection') {
41
- types[column.field] = column.type;
42
- let temp = row[column.field];
43
- row[column.field] = {
44
- value: temp,
45
- options: column.options,
46
- };
47
- } else {
48
- types[column.field] = column.type;
49
- }
50
- });
51
- this.types = types;
52
- this.setTemplateRef(value);
53
- }
54
- /**
55
- * @description This method is used to set the data when data comes in from cus template.
56
- * @param value template value
57
- */
58
- setTemplateRef(value: any) {
59
- if (value.templateRef !== undefined) {
60
- this.templateRow = { ...value.row };
61
- let types: any = {};
62
- this.templateKeys = [];
63
- this.columns.forEach((column) => {
64
- this.templateKeys.push(column.field);
65
- if (column.type == 'selection') {
66
- types[column.field] = column.type;
67
- let temp = this.templateRow[column.field];
68
- this.templateRow[column.field] = {
69
- value: temp,
70
- options: column.options,
71
- };
72
- } else {
73
- types[column.field] = column.type;
74
- }
75
- });
76
- this.templateTypes = types;
77
- this.templateRef = value.templateRef;
78
- }
79
- }
80
- /**
81
- * @description This method is triggered when dialog is closed and also emits the dialog closed event data.
82
- */
83
- closeDialog() {
84
- let rowData = { ...this.dialogData.row };
85
- this.keys.forEach((key: any) => {
86
- if (this.types[key] === 'selection') {
87
- let temp = rowData[key].value;
88
- rowData[key] = temp;
89
- }
90
- });
91
- this.dialogRef.close(rowData);
92
- }
93
-
94
- /**
95
- * @description This method is called when the dialog is closed custom template action.
96
- * @param row row to be edited.
97
- * @param keys keys of columns
98
- * @param types column types
99
- */
100
- closeTemplateDialog(row: any, keys: string[], types: string[]) {
101
- let rowData = { ...row };
102
- keys.forEach((key: any) => {
103
- if (types[key] === 'selection') {
104
- let temp = rowData[key].value;
105
- rowData[key] = temp;
106
- }
107
- });
108
- this.dialogRef.close(rowData);
109
- }
110
- }
@@ -1,26 +0,0 @@
1
-
2
- <ng-container *ngIf="obj">
3
- <!-- Number Type -->
4
- <mat-form-field *ngIf="obj.type == 'number'" appearance="outline" class="inline-editing-field" >
5
- <input matInput type="number" [formControl]="numberCtrl">
6
- </mat-form-field>
7
-
8
- <!-- String Type -->
9
- <mat-form-field *ngIf="obj.type == 'string'" appearance="outline" class="inline-editing-field">
10
- <input matInput type="text" [formControl]="stringCtrl">
11
- </mat-form-field>
12
- <mat-form-field *ngIf="obj.type == 'date'" appearance="outline" class="inline-editing-field">
13
- <input matInput type="date" [formControl]="dateCtrl">
14
- </mat-form-field>
15
- <!-- Selection Type -->
16
- <mat-form-field *ngIf="obj.type == 'selection'" appearance="outline" class="inline-editing-field">
17
- <mat-select [value]="" [formControl]="selectionCtrl">
18
- <mat-option *ngFor="let option of obj.options" [value]="option">
19
- {{option}}
20
- </mat-option>
21
- </mat-select>
22
- </mat-form-field>
23
- <!-- Boolean Type -->
24
- <mat-checkbox (click)="$event.stopPropagation()" *ngIf="obj.type == 'boolean'" color="primary" [formControl]="booleanCtrl"></mat-checkbox>
25
-
26
- </ng-container>