easy-mat-ui 0.0.3 → 0.0.4

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 (43) hide show
  1. package/ng-package.json +19 -0
  2. package/package.json +16 -18
  3. package/src/lib/easy-mat-ui.component.spec.ts +23 -0
  4. package/src/lib/easy-mat-ui.component.ts +16 -0
  5. package/src/lib/easy-mat-ui.service.spec.ts +16 -0
  6. package/src/lib/easy-mat-ui.service.ts +9 -0
  7. package/src/lib/easy-multi-select/easy-multi-select.css +102 -0
  8. package/src/lib/easy-multi-select/easy-multi-select.html +51 -0
  9. package/src/lib/easy-multi-select/easy-multi-select.spec.ts +23 -0
  10. package/src/lib/easy-multi-select/easy-multi-select.ts +181 -0
  11. package/src/lib/easy-table/easy-table.component.css +117 -0
  12. package/src/lib/easy-table/easy-table.component.html +221 -0
  13. package/src/lib/easy-table/easy-table.component.spec.ts +23 -0
  14. package/src/lib/easy-table/easy-table.component.ts +568 -0
  15. package/src/lib/model/dictionary.model.ts +4 -0
  16. package/src/lib/model/mat-column-typed.model.ts +41 -0
  17. package/src/lib/model/mat-column.model.ts +35 -0
  18. package/src/lib/model/tuple.model.ts +8 -0
  19. package/src/lib/shared/table-toolbar/table-toolbar.css +26 -0
  20. package/src/lib/shared/table-toolbar/table-toolbar.html +80 -0
  21. package/src/lib/shared/table-toolbar/table-toolbar.ts +130 -0
  22. package/src/lib/styles/_backgrounds.scss +39 -0
  23. package/src/lib/styles/_buttons.scss +90 -0
  24. package/src/lib/styles/_colors.scss +67 -0
  25. package/src/lib/styles/_effects.scss +44 -0
  26. package/src/lib/styles/_material-overrides.scss +87 -0
  27. package/src/lib/styles/_spacing.scss +68 -0
  28. package/src/lib/styles/_tables.scss +71 -0
  29. package/src/lib/styles/_typography.scss +105 -0
  30. package/src/lib/styles.scss +30 -0
  31. package/src/lib/utils/enums.ts +49 -0
  32. package/src/lib/utils/matTabCommon.ts +59 -0
  33. package/src/lib/utils/utils.ts +68 -0
  34. package/{public-api.d.ts → src/public-api.ts} +8 -3
  35. package/tsconfig.lib.json +18 -0
  36. package/tsconfig.lib.prod.json +11 -0
  37. package/tsconfig.spec.json +15 -0
  38. package/fesm2022/easy-mat-ui.mjs +0 -110
  39. package/fesm2022/easy-mat-ui.mjs.map +0 -1
  40. package/index.d.ts +0 -5
  41. package/lib/easy-mat-ui.component.d.ts +0 -5
  42. package/lib/easy-mat-ui.service.d.ts +0 -6
  43. package/lib/easy-table/easy-table.component.d.ts +0 -15
@@ -0,0 +1,105 @@
1
+ .hover {
2
+ cursor: pointer;
3
+ }
4
+
5
+ .no-border {
6
+ border: transparent;
7
+ }
8
+
9
+ .uppercase {
10
+ text-transform: uppercase;
11
+ }
12
+
13
+ .tab-space {
14
+ padding: 0 0 50px 0;
15
+ }
16
+
17
+ .xx-large,
18
+ .x-large {
19
+ font-size: xx-large !important;
20
+ }
21
+
22
+ .xx-small {
23
+ font-size: xx-small !important;
24
+ }
25
+
26
+ .x-small {
27
+ font-size: x-small !important;
28
+ }
29
+
30
+ .small {
31
+ font-size: small !important;
32
+ }
33
+
34
+ .required {
35
+ color: #f44336;
36
+ }
37
+
38
+ .zoom_in {
39
+ color: #00bcd4 !important;
40
+ }
41
+
42
+ .zoom_out {
43
+ color: #ffb804 !important;
44
+ }
45
+
46
+ .zoom_out, .zoom_in {
47
+ font-size: 1.6em !important;
48
+ cursor: pointer;
49
+ }
50
+
51
+ .isReadOnly {
52
+ color: #4e656f;
53
+ font-weight: 100 !important;
54
+ }
55
+
56
+ .shadow-5 {
57
+ text-shadow: 0 5px 5px #c2c0c0;
58
+ }
59
+
60
+ .shadow-title {
61
+ text-shadow: 0 10px 10px #c2c0c0;
62
+ color: #5a0023;
63
+ font-weight: 500;
64
+ }
65
+
66
+ .shadow-lg {
67
+ font-size: x-large !important;
68
+ text-shadow: 0 5px 5px #c2c0c0;
69
+ color: #5a0023 !important;
70
+ }
71
+
72
+ .card-pricing h6 {
73
+ color: #5a0023;
74
+ }
75
+
76
+
77
+ .x-small-column {
78
+ width: 2%;
79
+ min-width: 25px;
80
+ flex: 0 0 2%;
81
+ }
82
+
83
+ .small-column {
84
+ width: 5%;
85
+ min-width: 50px;
86
+ flex: 0 0 6%;
87
+ }
88
+
89
+ .medium-column {
90
+ width: 12%;
91
+ min-width: 100px;
92
+ flex: 0 0 12%;
93
+ }
94
+
95
+ .large-column {
96
+ width: 20%;
97
+ min-width: 150px;
98
+ flex: 0 0 20%;
99
+ }
100
+
101
+ .x-large-column {
102
+ width: 30%;
103
+ min-width: 200px;
104
+ flex: 0 0 30%;
105
+ }
@@ -0,0 +1,30 @@
1
+ @use "bootstrap/scss/bootstrap";
2
+
3
+ @use './styles/colors' as *;
4
+ @use './styles/backgrounds' as *;
5
+ @use './styles/buttons' as *;
6
+ @use './styles/tables' as *;
7
+ @use './styles/typography' as *;
8
+ @use './styles/spacing' as *;
9
+ @use './styles/effects' as *;
10
+ @use './styles/material-overrides' as *;
11
+
12
+
13
+ @media (max-width: 768px) {
14
+ .mat-header-cell, .mat-cell {
15
+ font-size: 12px;
16
+ padding: 0.25rem;
17
+ }
18
+
19
+ .action-link button {
20
+ padding: 0.25rem !important;
21
+ }
22
+
23
+ .btn-mini-fab mat-icon {
24
+ font-size: 18px;
25
+ }
26
+
27
+ mat-form-field {
28
+ width: 100% !important;
29
+ }
30
+ }
@@ -0,0 +1,49 @@
1
+ export enum CRUD {
2
+ CREATE = 'create',
3
+ READ = 'read',
4
+ UPDATE = 'update',
5
+ DELETE = 'delete',
6
+ LINK = 'link',
7
+ DUPLICATE = 'duplicate'
8
+ }
9
+
10
+ export enum ColumnType {
11
+ ICON = 'icon',
12
+ TEXT = 'text',
13
+ DATE = 'date',
14
+ DATE_TIME = 'date-time',
15
+ NUMBER = 'number',
16
+ Filter = 'filter',
17
+ ICON_AND_TEXT = 'icon-and-text',
18
+ PASSWORD = 'password',
19
+ BUTTON = 'button',
20
+ DROPDOWNLIST = 'dropdownlist'
21
+ }
22
+
23
+ export enum ColumnSize {
24
+ XSmall = 'x-small-column',
25
+ Small = 'small-column',
26
+ Medium = 'medium-column',
27
+ Large = 'large-column',
28
+ XLarge = 'x-large-column'
29
+ }
30
+
31
+
32
+ export enum InputType {
33
+ Dropdown = 'ddl',
34
+ Text = 'text',
35
+ Number = 'number',
36
+ Date = 'date',
37
+ TextArea = 'textarea',
38
+ Checkbox = 'checkbox'
39
+ }
40
+
41
+
42
+ export enum ScreenSize {
43
+ lg = 1281, // High Resolution desktops min-width:1281px
44
+ md = 1025, // Laptop and desktops min-width:1025px
45
+ sml = 801, // Landscape Tablet and iPads min-width:801px
46
+ sm = 600, // Portrait Tablet and iPads min-width:600px
47
+ xsl = 480, // Phone with Landscape mode min-width:480px
48
+ sx = 320, // Phone with portrait mode min-width:320px
49
+ }
@@ -0,0 +1,59 @@
1
+ import {formatDate} from '@angular/common';
2
+ import {Utils} from './utils';
3
+ import {ColumnType} from './enums';
4
+ import {MatColumnTyped} from '../model/mat-column-typed.model';
5
+
6
+ export class MatTabCommon {
7
+
8
+ static displayFormatTyped(column: MatColumnTyped, value: string | null | undefined, sliceSize: number): string | null {
9
+ let str: string | null = null;
10
+
11
+ switch (column.type) {
12
+ case ColumnType.DATE_TIME:
13
+ if (value) {
14
+ str = formatDate(value, 'yyyy-MM-dd HH-mm-ss', 'en_LU');
15
+ } else {
16
+ str = null;
17
+ }
18
+ break;
19
+ case ColumnType.DATE:
20
+ if (value) {
21
+ str = formatDate(value, 'yyyy-MM-dd', 'en_LU');
22
+ } else {
23
+ str = null;
24
+ }
25
+ break;
26
+
27
+ case ColumnType.NUMBER:
28
+ const num = parseFloat(value ?? '');
29
+ str = isNaN(num) ? '' : num.toFixed(2);
30
+ break;
31
+
32
+ default:
33
+ str = value ?? '';
34
+ }
35
+
36
+ const sliceBase = Utils.slice_size ?? 20;
37
+ const effectiveSlice = sliceSize == null || sliceSize === 0 ? 1 : sliceSize;
38
+ const length = sliceBase / effectiveSlice;
39
+
40
+ if (str == null) {
41
+ return null;
42
+ }
43
+
44
+ return str.length > length ? str.slice(0, length) + '...' : str;
45
+ }
46
+
47
+
48
+ static toFixed(value: string, digits: number): null | string | undefined {
49
+ return value == null ? null : parseFloat(value)?.toFixed(digits);
50
+ }
51
+
52
+ static getCssClasses(col: MatColumnTyped, item: any): string {
53
+ const staticClass = col.cssClass ?? '';
54
+ const dynamicClass = col.cssClassFn ? col.cssClassFn(item, col) : '';
55
+ return [staticClass, dynamicClass].filter(Boolean).join(' ');
56
+ }
57
+
58
+
59
+ }
@@ -0,0 +1,68 @@
1
+ import {formatDate} from '@angular/common';
2
+
3
+
4
+ export class Utils {
5
+ public static slice_size: number;
6
+ public static screen_size: number;
7
+
8
+
9
+ static isNullOrEmpty(value: string): boolean {
10
+ return !value || value?.toString()?.trim() == '';
11
+ }
12
+
13
+
14
+ public static areValuesEqual(val1: any, val2: any): boolean {
15
+ if (val1 === null || val1 === undefined || val1 === '') {
16
+ return val2 === null || val2 === undefined || val2 === '';
17
+ }
18
+ if (val2 === null || val2 === undefined || val2 === '') {
19
+ return val1 === null || val1 === undefined || val1 === '';
20
+ }
21
+
22
+ const num1 = Number(val1);
23
+ const num2 = Number(val2);
24
+
25
+ if (!isNaN(num1) && !isNaN(num2)) {
26
+ return num1 === num2;
27
+ }
28
+
29
+ return val1 === val2;
30
+ }
31
+
32
+ static identifyDuplicates(
33
+ data: Record<string, any>[],
34
+ key: string,
35
+ getUnique: boolean = true
36
+ ): Record<string, any>[] {
37
+ const uniqueMap = new Map<any, Record<string, any>>();
38
+ const duplicates: Record<string, any>[] = [];
39
+
40
+ data?.forEach(item => {
41
+ const keyValue = item[key];
42
+ if (uniqueMap.has(keyValue)) {
43
+ duplicates.push(item);
44
+ } else {
45
+ uniqueMap.set(keyValue, item);
46
+ }
47
+ });
48
+
49
+ return getUnique ? Array.from(uniqueMap.values()) : duplicates;
50
+ }
51
+
52
+
53
+ public static getUnique(data: Object[], key: string) {
54
+ return this.identifyDuplicates(data, key);
55
+ }
56
+
57
+ public static getDuplicate(data: Object[], key: string) {
58
+ return this.identifyDuplicates(data, key, false);
59
+ }
60
+
61
+
62
+ static safeCompare(a: any, b: any): number {
63
+ const aStr = a != null ? String(a) : '';
64
+ const bStr = b != null ? String(b) : '';
65
+ return aStr.localeCompare(bStr);
66
+ }
67
+
68
+ }
@@ -1,3 +1,8 @@
1
- export * from './lib/easy-mat-ui.service';
2
- export * from './lib/easy-mat-ui.component';
3
- export * from './lib/easy-table/easy-table.component';
1
+ /*
2
+ * Public API Surface of easy-mat-ui
3
+ */
4
+
5
+ export * from './lib/easy-mat-ui.service';
6
+ export * from './lib/easy-mat-ui.component';
7
+ export * from './lib/easy-table/easy-table.component';
8
+ export * from './lib/easy-multi-select/easy-multi-select';
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "declaration": true,
6
+ "declarationMap": true,
7
+ "inlineSources": true,
8
+ "types": [],
9
+ "target": "ES2022",
10
+ "useDefineForClassFields": false
11
+ },
12
+ "angularCompilerOptions": {
13
+ "strictTemplates": true
14
+ },
15
+ "exclude": [
16
+ "**/*.spec.ts"
17
+ ]
18
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "jasmine"
9
+ ]
10
+ },
11
+ "include": [
12
+ "**/*.spec.ts",
13
+ "**/*.d.ts"
14
+ ]
15
+ }
@@ -1,110 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Component, ViewChild, Input, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import { MatTable, MatColumnDef, MatCell, MatHeaderRow, MatHeaderCell, MatRow, MatRowDef, MatHeaderRowDef, MatHeaderCellDef, MatCellDef, MatTableModule } from '@angular/material/table';
6
- import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
7
- import { MatSort, MatSortModule } from '@angular/material/sort';
8
- import { MatInputModule } from '@angular/material/input';
9
- import { MatFormFieldModule } from '@angular/material/form-field';
10
- import { MatButtonModule } from '@angular/material/button';
11
- import { MatIconModule } from '@angular/material/icon';
12
- import { TranslatePipe, TranslateModule } from '@ngx-translate/core';
13
-
14
- class EasyMatUiService {
15
- constructor() { }
16
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyMatUiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyMatUiService, providedIn: 'root' });
18
- }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyMatUiService, decorators: [{
20
- type: Injectable,
21
- args: [{
22
- providedIn: 'root'
23
- }]
24
- }], ctorParameters: () => [] });
25
-
26
- class EasyMatUiComponent {
27
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyMatUiComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
28
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: EasyMatUiComponent, isStandalone: true, selector: "lib-easy-mat-ui", ngImport: i0, template: `
29
- <p>
30
- easy-mat-ui works!
31
- </p>
32
- `, isInline: true, styles: [""] });
33
- }
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyMatUiComponent, decorators: [{
35
- type: Component,
36
- args: [{ selector: 'lib-easy-mat-ui', imports: [], template: `
37
- <p>
38
- easy-mat-ui works!
39
- </p>
40
- `, standalone: true }]
41
- }] });
42
-
43
- class EasyTableComponent {
44
- dataSource;
45
- displayedColumns = [];
46
- paginator;
47
- sort;
48
- ngAfterViewInit() {
49
- if (this.dataSource && this.paginator && this.sort) {
50
- this.dataSource.paginator = this.paginator;
51
- this.dataSource.sort = this.sort;
52
- }
53
- }
54
- applyFilter(event) {
55
- this.dataSource.filter = event.target.value
56
- .trim()
57
- .toLowerCase();
58
- }
59
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
60
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: EasyTableComponent, isStandalone: true, selector: "lib-easy-table", inputs: { dataSource: "dataSource", displayedColumns: "displayedColumns" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0, template: "<div class=\"table-responsive p-3 border rounded shadow-sm bg-white\">\r\n <div class=\"d-flex justify-content-between align-items-center mb-3\">\r\n <input\r\n class=\"form-control w-25\"\r\n placeholder=\"Filter\"\r\n (input)=\"applyFilter($event)\"\r\n type=\"text\"\r\n />\r\n </div>\r\n\r\n <table mat-table [dataSource]=\"dataSource\" matSort class=\"table table-hover align-middle\">\r\n\r\n <ng-container *ngFor=\"let column of displayedColumns\" [matColumnDef]=\"column\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{ column | translate }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n {{ element[column] }}\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n\r\n <mat-paginator [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n", styles: [":host{display:block}.table th{white-space:nowrap}.table td{white-space:nowrap;max-width:200px;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: MatCellDef, selector: "[matCellDef]" }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatTableModule }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "ngmodule", type: MatSortModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: TranslateModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
61
- }
62
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EasyTableComponent, decorators: [{
63
- type: Component,
64
- args: [{ selector: 'lib-easy-table', standalone: true, imports: [
65
- CommonModule,
66
- MatTable,
67
- MatColumnDef,
68
- MatCell,
69
- MatHeaderRow,
70
- MatPaginator,
71
- MatHeaderCell,
72
- MatSort,
73
- MatRow,
74
- MatRowDef,
75
- MatHeaderRowDef,
76
- MatHeaderCellDef,
77
- MatCellDef,
78
- TranslatePipe,
79
- MatTableModule,
80
- MatPaginatorModule,
81
- MatSortModule,
82
- MatInputModule,
83
- MatFormFieldModule,
84
- MatButtonModule,
85
- MatIconModule,
86
- TranslateModule
87
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"table-responsive p-3 border rounded shadow-sm bg-white\">\r\n <div class=\"d-flex justify-content-between align-items-center mb-3\">\r\n <input\r\n class=\"form-control w-25\"\r\n placeholder=\"Filter\"\r\n (input)=\"applyFilter($event)\"\r\n type=\"text\"\r\n />\r\n </div>\r\n\r\n <table mat-table [dataSource]=\"dataSource\" matSort class=\"table table-hover align-middle\">\r\n\r\n <ng-container *ngFor=\"let column of displayedColumns\" [matColumnDef]=\"column\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{ column | translate }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n {{ element[column] }}\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n\r\n <mat-paginator [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n", styles: [":host{display:block}.table th{white-space:nowrap}.table td{white-space:nowrap;max-width:200px;overflow:hidden;text-overflow:ellipsis}\n"] }]
88
- }], propDecorators: { dataSource: [{
89
- type: Input,
90
- args: [{ required: true }]
91
- }], displayedColumns: [{
92
- type: Input
93
- }], paginator: [{
94
- type: ViewChild,
95
- args: [MatPaginator]
96
- }], sort: [{
97
- type: ViewChild,
98
- args: [MatSort]
99
- }] } });
100
-
101
- /*
102
- * Public API Surface of easy-mat-ui
103
- */
104
-
105
- /**
106
- * Generated bundle index. Do not edit.
107
- */
108
-
109
- export { EasyMatUiComponent, EasyMatUiService, EasyTableComponent };
110
- //# sourceMappingURL=easy-mat-ui.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"easy-mat-ui.mjs","sources":["../../../projects/easy-mat-ui/src/lib/easy-mat-ui.service.ts","../../../projects/easy-mat-ui/src/lib/easy-mat-ui.component.ts","../../../projects/easy-mat-ui/src/lib/easy-table/easy-table.component.ts","../../../projects/easy-mat-ui/src/lib/easy-table/easy-table.component.html","../../../projects/easy-mat-ui/src/public-api.ts","../../../projects/easy-mat-ui/src/easy-mat-ui.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class EasyMatUiService {\r\n\r\n constructor() { }\r\n}\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'lib-easy-mat-ui',\r\n imports: [],\r\n template: `\r\n <p>\r\n easy-mat-ui works!\r\n </p>\r\n `,\r\n standalone: true,\r\n styles: ``\r\n})\r\nexport class EasyMatUiComponent {\r\n\r\n}\r\n","import {AfterViewInit, ChangeDetectionStrategy, Component, Input, ViewChild} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {\r\n MatCell, MatCellDef,\r\n MatColumnDef,\r\n MatHeaderCell, MatHeaderCellDef,\r\n MatHeaderRow, MatHeaderRowDef,\r\n MatRow, MatRowDef,\r\n MatTable, MatTableDataSource,\r\n MatTableModule\r\n} from '@angular/material/table';\r\nimport {MatPaginator, MatPaginatorModule} from '@angular/material/paginator';\r\nimport {MatSort, MatSortModule} from '@angular/material/sort';\r\nimport {MatInputModule} from '@angular/material/input';\r\nimport {MatFormFieldModule} from '@angular/material/form-field';\r\nimport {MatButtonModule} from '@angular/material/button';\r\nimport {MatIconModule} from '@angular/material/icon';\r\nimport {TranslateModule, TranslatePipe} from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'lib-easy-table',\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n MatTable,\r\n MatColumnDef,\r\n MatCell,\r\n MatHeaderRow,\r\n MatPaginator,\r\n MatHeaderCell,\r\n MatSort,\r\n MatRow,\r\n MatRowDef,\r\n MatHeaderRowDef,\r\n MatHeaderCellDef,\r\n MatCellDef,\r\n TranslatePipe,\r\n MatTableModule,\r\n MatPaginatorModule,\r\n MatSortModule,\r\n MatInputModule,\r\n MatFormFieldModule,\r\n MatButtonModule,\r\n MatIconModule,\r\n TranslateModule\r\n ],\r\n templateUrl: './easy-table.component.html',\r\n styleUrl: './easy-table.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class EasyTableComponent<T extends Record<string, never>>\r\n implements AfterViewInit\r\n{\r\n @Input({ required: true }) dataSource!: MatTableDataSource<T>;\r\n @Input() displayedColumns: string[] = [];\r\n\r\n @ViewChild(MatPaginator) paginator!: MatPaginator;\r\n @ViewChild(MatSort) sort!: MatSort;\r\n\r\n ngAfterViewInit(): void {\r\n if (this.dataSource && this.paginator && this.sort) {\r\n this.dataSource.paginator = this.paginator;\r\n this.dataSource.sort = this.sort;\r\n }\r\n }\r\n\r\n applyFilter(event: Event): void {\r\n this.dataSource.filter = (event.target as HTMLInputElement).value\r\n .trim()\r\n .toLowerCase();\r\n }\r\n}\r\n","<div class=\"table-responsive p-3 border rounded shadow-sm bg-white\">\r\n <div class=\"d-flex justify-content-between align-items-center mb-3\">\r\n <input\r\n class=\"form-control w-25\"\r\n placeholder=\"Filter\"\r\n (input)=\"applyFilter($event)\"\r\n type=\"text\"\r\n />\r\n </div>\r\n\r\n <table mat-table [dataSource]=\"dataSource\" matSort class=\"table table-hover align-middle\">\r\n\r\n <ng-container *ngFor=\"let column of displayedColumns\" [matColumnDef]=\"column\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n {{ column | translate }}\r\n </th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n {{ element[column] }}\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n\r\n <mat-paginator [pageSize]=\"10\" [pageSizeOptions]=\"[5, 10, 25]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n","/*\r\n * Public API Surface of easy-mat-ui\r\n */\r\n\r\nexport * from './lib/easy-mat-ui.service';\r\nexport * from './lib/easy-mat-ui.component';\r\nexport * from './lib/easy-table/easy-table.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAKa,gBAAgB,CAAA;AAE3B,IAAA,WAAA,GAAA;wGAFW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;4FAEP,gB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kB,8BAClB,eAAe,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACf,aAAa,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACb,eAAe,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAMN,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBA/B9B,SAAS;+BACE,gBAAgB,EAAA,UAAA,EACd,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,QAAQ;wBACR,YAAY;wBACZ,OAAO;wBACP,YAAY;wBACZ,YAAY;wBACZ,aAAa;wBACb,OAAO;wBACP,MAAM;wBACN,SAAS;wBACT,eAAe;wBACf,gBAAgB;wBAChB,UAAU;wBACV,aAAa;wBACb,cAAc;wBACd,kBAAkB;wBAClB,aAAa;wBACb,cAAc;wBACd,kBAAkB;wBAClB,eAAe;wBACf,aAAa;wBACb;qBACD,EAGgB,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,ogCAAA,EAAA,MAAA,EAAA,CAAA,yIAAA,CAAA,EAAA;8BAKpB,UAAU,EAAA,CAAA;sBAApC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAChB,gBAAgB,EAAA,CAAA;sBAAxB;gBAEwB,SAAS,EAAA,CAAA;sBAAjC,SAAS;uBAAC,YAAY;gBACH,IAAI,EAAA,CAAA;sBAAvB,SAAS;uBAAC,OAAO;;;AEzDpB;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="easy-mat-ui" />
5
- export * from './public-api';
@@ -1,5 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class EasyMatUiComponent {
3
- static ɵfac: i0.ɵɵFactoryDeclaration<EasyMatUiComponent, never>;
4
- static ɵcmp: i0.ɵɵComponentDeclaration<EasyMatUiComponent, "lib-easy-mat-ui", never, {}, {}, never, never, true, never>;
5
- }
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class EasyMatUiService {
3
- constructor();
4
- static ɵfac: i0.ɵɵFactoryDeclaration<EasyMatUiService, never>;
5
- static ɵprov: i0.ɵɵInjectableDeclaration<EasyMatUiService>;
6
- }
@@ -1,15 +0,0 @@
1
- import { AfterViewInit } from '@angular/core';
2
- import { MatTableDataSource } from '@angular/material/table';
3
- import { MatPaginator } from '@angular/material/paginator';
4
- import { MatSort } from '@angular/material/sort';
5
- import * as i0 from "@angular/core";
6
- export declare class EasyTableComponent<T extends Record<string, never>> implements AfterViewInit {
7
- dataSource: MatTableDataSource<T>;
8
- displayedColumns: string[];
9
- paginator: MatPaginator;
10
- sort: MatSort;
11
- ngAfterViewInit(): void;
12
- applyFilter(event: Event): void;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<EasyTableComponent<any>, never>;
14
- static ɵcmp: i0.ɵɵComponentDeclaration<EasyTableComponent<any>, "lib-easy-table", never, { "dataSource": { "alias": "dataSource"; "required": true; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; }; }, {}, never, never, true, never>;
15
- }