easy-mat-ui 0.0.6 → 1.0.1

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +361 -63
  3. package/fesm2022/easy-mat-ui.mjs +2874 -0
  4. package/fesm2022/easy-mat-ui.mjs.map +1 -0
  5. package/index.d.ts +1136 -0
  6. package/package.json +68 -22
  7. package/page-generator/blocks.js +155 -0
  8. package/page-generator/catalog.js +132 -0
  9. package/page-generator/cli/main.js +314 -0
  10. package/page-generator/cli/project.js +252 -0
  11. package/page-generator/context.js +108 -0
  12. package/page-generator/generate.js +182 -0
  13. package/page-generator/index.js +33 -0
  14. package/page-generator/naming.js +53 -0
  15. package/page-generator/table.js +310 -0
  16. package/page-generator/types.js +6 -0
  17. package/styles/styles/_backgrounds.scss +39 -0
  18. package/{src/lib → styles}/styles/_buttons.scss +90 -90
  19. package/styles/styles/_colors.scss +197 -0
  20. package/{src/lib → styles}/styles/_effects.scss +44 -44
  21. package/{src/lib → styles}/styles/_material-overrides.scss +106 -87
  22. package/{src/lib → styles}/styles/_spacing.scss +68 -68
  23. package/styles/styles/_tables.scss +569 -0
  24. package/{src/lib → styles}/styles/_typography.scss +100 -105
  25. package/{src/lib → styles}/styles.scss +29 -30
  26. package/ng-package.json +0 -19
  27. package/src/lib/easy-mat-ui.component.spec.ts +0 -23
  28. package/src/lib/easy-mat-ui.component.ts +0 -16
  29. package/src/lib/easy-mat-ui.service.spec.ts +0 -16
  30. package/src/lib/easy-mat-ui.service.ts +0 -9
  31. package/src/lib/easy-multi-select/easy-multi-select.css +0 -102
  32. package/src/lib/easy-multi-select/easy-multi-select.html +0 -51
  33. package/src/lib/easy-multi-select/easy-multi-select.spec.ts +0 -23
  34. package/src/lib/easy-multi-select/easy-multi-select.ts +0 -181
  35. package/src/lib/easy-table/easy-table.component.css +0 -117
  36. package/src/lib/easy-table/easy-table.component.html +0 -221
  37. package/src/lib/easy-table/easy-table.component.spec.ts +0 -23
  38. package/src/lib/easy-table/easy-table.component.ts +0 -568
  39. package/src/lib/model/dictionary.model.ts +0 -4
  40. package/src/lib/model/mat-column-typed.model.ts +0 -41
  41. package/src/lib/model/mat-column.model.ts +0 -35
  42. package/src/lib/model/tuple.model.ts +0 -8
  43. package/src/lib/shared/table-toolbar/table-toolbar.css +0 -26
  44. package/src/lib/shared/table-toolbar/table-toolbar.html +0 -80
  45. package/src/lib/shared/table-toolbar/table-toolbar.ts +0 -130
  46. package/src/lib/styles/_backgrounds.scss +0 -39
  47. package/src/lib/styles/_colors.scss +0 -67
  48. package/src/lib/styles/_tables.scss +0 -71
  49. package/src/lib/utils/enums.ts +0 -49
  50. package/src/lib/utils/matTabCommon.ts +0 -59
  51. package/src/lib/utils/utils.ts +0 -68
  52. package/src/public-api.ts +0 -8
  53. package/tsconfig.lib.json +0 -18
  54. package/tsconfig.lib.prod.json +0 -11
  55. package/tsconfig.spec.json +0 -15
@@ -1,80 +0,0 @@
1
- <div class="row p-0">
2
- <div class="col-12 p-0 d-flex flex-wrap align-items-center gap-3">
3
-
4
- @if (withTitle) {
5
- <div class="d-flex align-items-center flex-grow-1 flex-shrink-0 min-width-250">
6
- <div class="card-pricing d-flex align-items-center p-2">
7
- <div class="card-icon icon-rose" >
8
- <i class="material-icons" [ngClass]="iconClass">{{ icon }}</i>
9
- </div>
10
- <h6 class="bold text-uppercase ms-2 mb-0">{{ source | translate }}</h6>
11
- </div>
12
- </div>
13
- }
14
-
15
- @if (withGlobalFilter) {
16
- <div class="flex-grow-1 flex-shrink-0 min-width-300" [ngClass]="isPreview ? 'opacity-0' : ''">
17
- <div class="d-flex flex-wrap align-items-center gap-2">
18
-
19
- <mat-form-field class="underline-style flex-grow-1 min-width-200">
20
- <mat-label>{{ 'SEARCH' | translate }}</mat-label>
21
- <input matInput [(ngModel)]="searchTableField" (keyup)="applyFilter($event)" autocomplete="off"/>
22
- <button mat-icon-button matSuffix (click)="filterType()" [title]="getTitleFilterOperator() | translate">
23
- <mat-icon [ngClass]="getIconFilterOperator()">{{ getIconFilterOperator() }}</mat-icon>
24
- </button>
25
- </mat-form-field>
26
-
27
- <div class="d-flex flex-wrap gap-1">
28
- <button class="btn-mini-fab bg-yellow" [ngClass]="[btnSize]" title="{{ 'CLEAR' | translate }}"
29
- (click)="clearTableFilter()">
30
- <mat-icon>cleaning_services</mat-icon>
31
- </button>
32
-
33
- @if (!readonly && canCreate) {
34
- <button class="btn-mini-fab bg-taupe" [ngClass]="[btnSize]" title="{{ 'ADD' | translate }}"
35
- (click)="addItem()">
36
- <mat-icon>add</mat-icon>
37
- </button>
38
- }
39
-
40
- @if (canExport) {
41
- <button class="btn-mini-fab bg-info" [ngClass]="[btnSize]" title="{{ 'DOWNLOAD' | translate }}"
42
- (click)="exportToCsv()">
43
- <mat-icon>file_download</mat-icon>
44
- </button>
45
- }
46
-
47
- @if (customActionEnable) {
48
- <button class="btn-mini-fab" [ngClass]="[btnSize, customRowActionClass]"
49
- title="{{ customActionTitle | translate }}" (click)="onClickCustomAction()">
50
- <mat-icon>{{ customActionIcon ?? 'rocket_launch' }}</mat-icon>
51
- </button>
52
- }
53
-
54
- @if (logout) {
55
- <button class="btn-mini-fab bg-red" [ngClass]="[btnSize]" title="{{ 'CLOSE' | translate }}"
56
- (click)="close()">
57
- <mat-icon>logout</mat-icon>
58
- </button>
59
- }
60
- </div>
61
-
62
- @if (customColumnFilter && customColumnFilter.length > 1) {
63
- <div class="w-100 text-end">
64
- <mat-button-toggle-group class="no-border" #group="matButtonToggleGroup" multiple
65
- (change)="onToggleChanged(group.value)">
66
- <mat-button-toggle *ngFor="let item of customColumnFilter"
67
- [value]="item"
68
- [ngClass]="getFilterColor(item)">
69
- <mat-icon class="xx-large">{{ getFilterIcon(item) }}</mat-icon>
70
- </mat-button-toggle>
71
- </mat-button-toggle-group>
72
- </div>
73
- }
74
-
75
- </div>
76
- </div>
77
- }
78
-
79
- </div>
80
- </div>
@@ -1,130 +0,0 @@
1
- import {Component, EventEmitter, Input, Output} from '@angular/core';
2
- import {Dictionary} from '../../model/dictionary.model';
3
- import {TranslatePipe} from '@ngx-translate/core';
4
- import {MatColumn} from '../../model/mat-column.model';
5
- import {MatFormField, MatInput} from '@angular/material/input';
6
- import {MatIconButton} from '@angular/material/button';
7
- import {MatButtonToggle, MatButtonToggleGroup} from '@angular/material/button-toggle';
8
- import {MatIcon} from '@angular/material/icon';
9
- import {CommonModule, NgClass} from '@angular/common';
10
- import {FormsModule} from '@angular/forms';
11
- import {MatFormFieldModule} from '@angular/material/form-field';
12
-
13
- @Component({
14
- selector: 'lib-table-toolbar',
15
- standalone: true,
16
- imports: [
17
- MatButtonToggle,
18
- TranslatePipe,
19
- MatInput,
20
- MatFormField,
21
- MatIconButton,
22
- MatIcon,
23
- MatButtonToggleGroup,
24
- MatButtonToggle,
25
- NgClass,
26
- FormsModule,
27
- CommonModule,
28
- MatFormFieldModule
29
- ],
30
- templateUrl: './table-toolbar.html',
31
- styleUrls: ['./table-toolbar.css', '../../styles.scss'],
32
- })
33
- export class TableToolbarComponent {
34
- @Input() withTitle = true;
35
- @Input() icon = '';
36
- @Input() source = '';
37
- @Input() withGlobalFilter = true;
38
- @Input() isPreview = false;
39
- @Input() searchTableField = '';
40
- @Input() readonly = false;
41
- @Input() canCreate = true;
42
- @Input() canExport = true;
43
- @Input() customActionEnable = false;
44
- @Input() customActionTitle = '';
45
- @Input() customActionIcon?: string;
46
- @Input() customRowActionClass = '';
47
- @Input() logout = false;
48
- @Input() isAndFilterOperator = true;
49
- @Input() btnSize = 'btn-small';
50
- @Input() iconClass = 'taupe';
51
- @Input() customColumnFilter: Dictionary[] = [];
52
-
53
- @Output() searchTableFieldChange = new EventEmitter<string>();
54
- @Output() applyFilterEvent = new EventEmitter<KeyboardEvent>();
55
- @Output() filterTypeEvent = new EventEmitter<void>();
56
- @Output() clearTableFilterEvent = new EventEmitter<void>();
57
- @Output() addItemEvent = new EventEmitter<void>();
58
- @Output() exportToCsvEvent = new EventEmitter<void>();
59
- @Output() customActionEvent = new EventEmitter<void>();
60
- @Output() closeEvent = new EventEmitter<void>();
61
- @Output() toggleChangedEvent = new EventEmitter<any>();
62
-
63
- filterColumn!: MatColumn;
64
-
65
- onSearchChange(value: string) {
66
- this.searchTableFieldChange.emit(value);
67
- }
68
-
69
- applyFilter(event: KeyboardEvent) {
70
- this.applyFilterEvent.emit(event);
71
- }
72
-
73
- filterType() {
74
- this.filterTypeEvent.emit();
75
- }
76
-
77
- clearTableFilter() {
78
- this.searchTableField = '';
79
- this.clearTableFilterEvent.emit();
80
- }
81
-
82
- addItem() {
83
- this.addItemEvent.emit();
84
- }
85
-
86
- exportToCsv() {
87
- this.exportToCsvEvent.emit();
88
- }
89
-
90
- onClickCustomAction() {
91
- this.customActionEvent.emit();
92
- }
93
-
94
- close() {
95
- this.closeEvent.emit();
96
- }
97
-
98
- onToggleChanged(value: any) {
99
- this.toggleChangedEvent.emit(value);
100
- }
101
-
102
- getTitleFilterOperator() {
103
- return this.isAndFilterOperator ? 'FILTER_BY_AND_OPERATOR' : 'FILTER_BY_OR_OPERATOR';
104
- }
105
-
106
- getIconFilterOperator() {
107
- return this.isAndFilterOperator ? 'zoom_out' : 'zoom_in';
108
- }
109
-
110
- getFilterColor(filter: Dictionary): string | undefined {
111
- const filterValue = String(filter.value).toLowerCase();
112
- const filterKey = String(filter.key).toLowerCase();
113
-
114
- switch (filterValue) {
115
- case 'true':
116
- return filterKey === 'true'
117
- ? this.filterColumn.enableColor
118
- : this.filterColumn.disableColor;
119
- case 'false':
120
- return 'grey';
121
- default:
122
- return 'black';
123
- }
124
- }
125
-
126
- getFilterIcon(filter: Dictionary) {
127
- return String(filter.key) === 'true' ? this.filterColumn.enableIcon : this.filterColumn.disableIcon;
128
- }
129
-
130
- }
@@ -1,39 +0,0 @@
1
- .bg-yellow {
2
- background-color: #ffb804 !important;
3
- }
4
-
5
- .bg-morning-blue {
6
- background-color: #82a7a6 !important;
7
- }
8
-
9
- .bg-blue {
10
- background-color: #6b95aa !important;
11
- }
12
-
13
- .bg-morning-clear-green {
14
- background-color: #d1e0e0 !important;
15
- }
16
-
17
- .bg-taupe {
18
- background-color: #785964 !important;
19
- }
20
-
21
- .bg-red {
22
- background-color: #f44438 !important;
23
- }
24
-
25
- .bg-orange {
26
- background-color: tomato !important;
27
- }
28
-
29
- .bg-green {
30
- background-color: #4caf50 !important;
31
- }
32
-
33
- .bg-info {
34
- background-color: #00bcd4 !important;
35
- }
36
-
37
- .bg-white{
38
- background-color: white;
39
- }
@@ -1,67 +0,0 @@
1
- .taupe{
2
- color: #550015 !important;
3
- }
4
-
5
- .taupe-light{
6
- color: #785964 !important;
7
- }
8
-
9
- .blue{
10
- color: #0275d8 !important;
11
- }
12
-
13
- .royal-blue{
14
- color: #6b95aa !important;
15
- }
16
-
17
- .green{
18
- color: #4CAF50 !important;
19
- }
20
-
21
- .red{
22
- color: #f44336 !important;
23
- }
24
-
25
- .light-blue {
26
- color: #b1cdee !important;
27
- }
28
-
29
- .yellow{
30
- color: #ffb804 !important;
31
- }
32
-
33
- .info{
34
- color: #00bcd4 !important;
35
- }
36
-
37
- .grey{
38
- color: #999999 !important;
39
- }
40
-
41
- .success {
42
- color: #198754 !important;
43
- }
44
-
45
- .primary {
46
- color: #0d6efd !important;
47
- }
48
-
49
- .danger {
50
- color: #dc3545 !important;
51
- }
52
-
53
- .error {
54
- color: #ff6347 !important;
55
- }
56
-
57
- .secondary {
58
- color: #6c757d !important;
59
- }
60
-
61
- .warning {
62
- color: #ffc107 !important;
63
- }
64
-
65
- .dark {
66
- color: #212529 !important;
67
- }
@@ -1,71 +0,0 @@
1
- .mat-mdc-table {
2
- width: 100% !important;
3
- table-layout: auto;
4
- }
5
-
6
- .table-responsive {
7
- overflow-x: auto;
8
- -webkit-overflow-scrolling: touch;
9
- }
10
-
11
- .mat-mdc-header-cell {
12
- font-size: 14px;
13
- font-weight: bold;
14
- color: black;
15
- }
16
-
17
- tr.mat-mdc-header-row {
18
- height: 56px;
19
- font-weight: bold;
20
- }
21
-
22
- tr.mat-mdc-row,
23
- tr.mat-mdc-footer-row {
24
- height: 48px;
25
- }
26
-
27
- th.mat-mdc-header-cell,
28
- td.mat-mdc-cell,
29
- td.mat-mdc-footer-cell {
30
- border-bottom: 1px solid rgba(0, 0, 0, 0.12);
31
- }
32
-
33
- tr.mat-mdc-row:nth-child(odd),
34
- .mat-row:nth-child(2n+1),
35
- .gray {
36
- background-color: #f5f5f5;
37
- }
38
-
39
- mat-paginator {
40
- color: #6b95aa;
41
- font-weight: bold;
42
- }
43
-
44
- .disable {
45
- background-color: lightgray;
46
- opacity: 0.5;
47
- color: #a09e9e;
48
- }
49
-
50
- .selected-row {
51
- background-color: #f1f6fb !important;
52
- box-shadow: 0px 5px 5px #555555 !important;
53
- font-weight: bold;
54
- text-shadow: 0 5px 5px #c2c0c0;
55
- }
56
-
57
- .mat-row:hover {
58
- background-color: #f1f6fb !important;
59
- }
60
-
61
- .sticky-left {
62
- position: sticky;
63
- left: 0;
64
- z-index: 10;
65
- }
66
-
67
- .sticky-right {
68
- position: sticky;
69
- right: 0;
70
- z-index: 10;
71
- }
@@ -1,49 +0,0 @@
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
- }
@@ -1,59 +0,0 @@
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
- }
@@ -1,68 +0,0 @@
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
- }
package/src/public-api.ts DELETED
@@ -1,8 +0,0 @@
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';
package/tsconfig.lib.json DELETED
@@ -1,18 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
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
- }