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.
- package/LICENSE +21 -0
- package/README.md +361 -63
- package/fesm2022/easy-mat-ui.mjs +2874 -0
- package/fesm2022/easy-mat-ui.mjs.map +1 -0
- package/index.d.ts +1136 -0
- package/package.json +68 -22
- package/page-generator/blocks.js +155 -0
- package/page-generator/catalog.js +132 -0
- package/page-generator/cli/main.js +314 -0
- package/page-generator/cli/project.js +252 -0
- package/page-generator/context.js +108 -0
- package/page-generator/generate.js +182 -0
- package/page-generator/index.js +33 -0
- package/page-generator/naming.js +53 -0
- package/page-generator/table.js +310 -0
- package/page-generator/types.js +6 -0
- package/styles/styles/_backgrounds.scss +39 -0
- package/{src/lib → styles}/styles/_buttons.scss +90 -90
- package/styles/styles/_colors.scss +197 -0
- package/{src/lib → styles}/styles/_effects.scss +44 -44
- package/{src/lib → styles}/styles/_material-overrides.scss +106 -87
- package/{src/lib → styles}/styles/_spacing.scss +68 -68
- package/styles/styles/_tables.scss +569 -0
- package/{src/lib → styles}/styles/_typography.scss +100 -105
- package/{src/lib → styles}/styles.scss +29 -30
- package/ng-package.json +0 -19
- package/src/lib/easy-mat-ui.component.spec.ts +0 -23
- package/src/lib/easy-mat-ui.component.ts +0 -16
- package/src/lib/easy-mat-ui.service.spec.ts +0 -16
- package/src/lib/easy-mat-ui.service.ts +0 -9
- package/src/lib/easy-multi-select/easy-multi-select.css +0 -102
- package/src/lib/easy-multi-select/easy-multi-select.html +0 -51
- package/src/lib/easy-multi-select/easy-multi-select.spec.ts +0 -23
- package/src/lib/easy-multi-select/easy-multi-select.ts +0 -181
- package/src/lib/easy-table/easy-table.component.css +0 -117
- package/src/lib/easy-table/easy-table.component.html +0 -221
- package/src/lib/easy-table/easy-table.component.spec.ts +0 -23
- package/src/lib/easy-table/easy-table.component.ts +0 -568
- package/src/lib/model/dictionary.model.ts +0 -4
- package/src/lib/model/mat-column-typed.model.ts +0 -41
- package/src/lib/model/mat-column.model.ts +0 -35
- package/src/lib/model/tuple.model.ts +0 -8
- package/src/lib/shared/table-toolbar/table-toolbar.css +0 -26
- package/src/lib/shared/table-toolbar/table-toolbar.html +0 -80
- package/src/lib/shared/table-toolbar/table-toolbar.ts +0 -130
- package/src/lib/styles/_backgrounds.scss +0 -39
- package/src/lib/styles/_colors.scss +0 -67
- package/src/lib/styles/_tables.scss +0 -71
- package/src/lib/utils/enums.ts +0 -49
- package/src/lib/utils/matTabCommon.ts +0 -59
- package/src/lib/utils/utils.ts +0 -68
- package/src/public-api.ts +0 -8
- package/tsconfig.lib.json +0 -18
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
ChangeDetectorRef,
|
|
5
|
-
Component,
|
|
6
|
-
EventEmitter,
|
|
7
|
-
Input,
|
|
8
|
-
OnInit,
|
|
9
|
-
Output
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import {FormControl, ReactiveFormsModule} from '@angular/forms';
|
|
12
|
-
import {MatSelect, MatSelectModule} from '@angular/material/select';
|
|
13
|
-
import {CommonModule} from '@angular/common';
|
|
14
|
-
import {MatFormFieldAppearance, MatFormFieldModule} from '@angular/material/form-field';
|
|
15
|
-
import {MatCheckboxModule} from '@angular/material/checkbox';
|
|
16
|
-
import {MatIconModule} from '@angular/material/icon';
|
|
17
|
-
import {MatDividerModule} from '@angular/material/divider';
|
|
18
|
-
import {MatTooltipModule} from '@angular/material/tooltip';
|
|
19
|
-
import {TranslateModule} from '@ngx-translate/core';
|
|
20
|
-
import {MatInput, MatInputModule} from "@angular/material/input";
|
|
21
|
-
import {MatButtonModule, MatIconButton} from '@angular/material/button';
|
|
22
|
-
import {Dictionary} from '../model/dictionary.model';
|
|
23
|
-
import {map, Observable, startWith} from 'rxjs';
|
|
24
|
-
import {MatOption, MatOptionSelectionChange} from '@angular/material/core';
|
|
25
|
-
import {Utils} from '../utils/utils';
|
|
26
|
-
|
|
27
|
-
@Component({
|
|
28
|
-
selector: 'lib-easy-multi-select',
|
|
29
|
-
host: { '[attr.data-component-id]': "'easy-multi-select-' + componentId" },
|
|
30
|
-
standalone: true,
|
|
31
|
-
imports: [
|
|
32
|
-
CommonModule,
|
|
33
|
-
ReactiveFormsModule,
|
|
34
|
-
MatFormFieldModule,
|
|
35
|
-
MatSelectModule,
|
|
36
|
-
MatCheckboxModule,
|
|
37
|
-
MatIconModule,
|
|
38
|
-
MatDividerModule,
|
|
39
|
-
MatTooltipModule,
|
|
40
|
-
TranslateModule,
|
|
41
|
-
MatInputModule,
|
|
42
|
-
MatButtonModule
|
|
43
|
-
],
|
|
44
|
-
templateUrl: './easy-multi-select.html',
|
|
45
|
-
styleUrls: ['./easy-multi-select.css', '../styles.scss'],
|
|
46
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
47
|
-
})
|
|
48
|
-
export class EasyMultiSelect implements OnInit, AfterViewInit {
|
|
49
|
-
componentId = Math.random().toString(36).substring(2);
|
|
50
|
-
@Input() data: Dictionary[] = [];
|
|
51
|
-
@Input() title = 'multi select';
|
|
52
|
-
@Input() valueField!: keyof Dictionary;
|
|
53
|
-
@Input() displayField!: keyof Dictionary;
|
|
54
|
-
@Input() selectedData: Dictionary[] = [];
|
|
55
|
-
@Input() readOnly = false;
|
|
56
|
-
@Input() noPlaceholderNoHint = false;
|
|
57
|
-
@Input() padding = 'pd-0';
|
|
58
|
-
@Input() appearance: MatFormFieldAppearance = 'fill';
|
|
59
|
-
|
|
60
|
-
@Output() change = new EventEmitter<string[]>();
|
|
61
|
-
multiSelectControl = new FormControl<string[]>([]);
|
|
62
|
-
searchCtrl = new FormControl<string>('');
|
|
63
|
-
filteredMultiSelect: Observable<Dictionary[]> = new Observable<Dictionary[]>();
|
|
64
|
-
|
|
65
|
-
@Input() idPrefix = 'multi-select';
|
|
66
|
-
uniqueId = `${this.idPrefix}-${Math.random().toString(36).substring(2, 9)}`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
constructor(private cdref: ChangeDetectorRef) {
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
ngOnInit(): void {
|
|
73
|
-
this.data = (Utils.getUnique(this.data, this.valueField as string) as Dictionary[]).sort((a, b) =>
|
|
74
|
-
Utils.safeCompare(a[this.displayField], b[this.displayField])
|
|
75
|
-
);
|
|
76
|
-
this.initFilterGroup();
|
|
77
|
-
|
|
78
|
-
if (this.selectedData.length > 0) {
|
|
79
|
-
const selectedValues = this.selectedData.map((x) => x[this.valueField] as string);
|
|
80
|
-
this.setMultiSelectControl(selectedValues);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (this.readOnly) {
|
|
84
|
-
this.multiSelectControl.disable();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
initFilterGroup(): void {
|
|
89
|
-
this.filteredMultiSelect = this.searchCtrl.valueChanges.pipe(
|
|
90
|
-
startWith(''),
|
|
91
|
-
map((value) => this._filter(value ?? '', this.data.slice()))
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setMultiSelectControl(values: string[] | null): void {
|
|
96
|
-
this.multiSelectControl.setValue(values);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private _filter(value: string, options: Dictionary[]): Dictionary[] {
|
|
100
|
-
const filterValue = value.toLowerCase();
|
|
101
|
-
return options.filter((option) => {
|
|
102
|
-
const fieldValue = option[this.displayField];
|
|
103
|
-
const fieldStr = (fieldValue !== null && fieldValue !== undefined) ? String(fieldValue).toLowerCase() : '';
|
|
104
|
-
return fieldStr.includes(filterValue);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
selected(select: MatSelect): 'some' | 'all' | undefined {
|
|
110
|
-
const options = select?.options;
|
|
111
|
-
if (!options) return undefined;
|
|
112
|
-
|
|
113
|
-
const total = options.length;
|
|
114
|
-
const selectedCount = options.filter(opt => opt.selected).length;
|
|
115
|
-
|
|
116
|
-
if (selectedCount === total) return 'all';
|
|
117
|
-
if (selectedCount > 0) return 'some';
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
toggleSelection(select: MatSelect): void {
|
|
122
|
-
let values = this.multiSelectControl.value ?? [];
|
|
123
|
-
const selection = this.selected(select);
|
|
124
|
-
|
|
125
|
-
select.options.forEach((item: MatOption) => {
|
|
126
|
-
if (selection !== 'all' && !values.includes(item.value)) {
|
|
127
|
-
values.push(item.value);
|
|
128
|
-
} else if (selection === 'all' && values.includes(item.value)) {
|
|
129
|
-
values = values.filter((value) => value !== item.value);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
this.setMultiSelectControl(values);
|
|
134
|
-
this.change.emit(values);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
onSelectionChange(event: MatOptionSelectionChange): void {
|
|
138
|
-
let values = this.multiSelectControl.value ?? [];
|
|
139
|
-
if (event.isUserInput) {
|
|
140
|
-
if (event.source.selected && !values.includes(event.source.value)) {
|
|
141
|
-
values.push(event.source.value);
|
|
142
|
-
} else if (!event.source.selected && values.includes(event.source.value)) {
|
|
143
|
-
values = values.filter((value) => value !== event.source.value);
|
|
144
|
-
}
|
|
145
|
-
this.setMultiSelectControl(values);
|
|
146
|
-
this.change.emit(values);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
getTooltips(select: MatSelect): string {
|
|
151
|
-
return this.selected(select) === 'all' ? 'UNSELECT_ALL' : 'SELECT_ALL';
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
resetSelection(): void {
|
|
155
|
-
console.log(' *** resetSelection* ***');
|
|
156
|
-
this.multiSelectControl.setValue([]);
|
|
157
|
-
this.searchCtrl.setValue('');
|
|
158
|
-
this.change.emit([]);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
ngAfterViewInit(): void {
|
|
162
|
-
this.cdref.detectChanges();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
onKeydown(e: KeyboardEvent, i: HTMLInputElement): void {
|
|
166
|
-
i.onkeydown?.(e);
|
|
167
|
-
e.stopPropagation();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
clear(): void {
|
|
171
|
-
console.log('************** clear -----------------')
|
|
172
|
-
this.searchCtrl.patchValue('');
|
|
173
|
-
this.setMultiSelectControl(null);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
get hidePlaceholder(): boolean {
|
|
177
|
-
const value = this.multiSelectControl.value;
|
|
178
|
-
return Array.isArray(value) && value.length > 0;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
.custom-th-cell {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
justify-content: space-between;
|
|
6
|
-
height: 100%;
|
|
7
|
-
padding: 4px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.header-label {
|
|
11
|
-
font-weight: 500;
|
|
12
|
-
text-align: left;
|
|
13
|
-
width: 100%;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.header-filter {
|
|
17
|
-
margin-top: 4px;
|
|
18
|
-
width: 100%;
|
|
19
|
-
}
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
.visibility-hidden {
|
|
23
|
-
visibility: hidden !important;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.password-cell {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: space-between;
|
|
30
|
-
min-width: 100px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.masked-text {
|
|
34
|
-
font-family: sans-serif;
|
|
35
|
-
letter-spacing: 2px;
|
|
36
|
-
user-select: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.toggle-btn {
|
|
40
|
-
background: none;
|
|
41
|
-
border: none;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
padding: 0;
|
|
44
|
-
margin-left: 8px;
|
|
45
|
-
color: #666;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.toggle-btn:hover {
|
|
49
|
-
color: #000;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.active-item {
|
|
54
|
-
background-color: #4caf50 !important;
|
|
55
|
-
color: white;
|
|
56
|
-
margin: 4px;
|
|
57
|
-
border-radius: 4px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.inactive-item {
|
|
61
|
-
background: transparent;
|
|
62
|
-
color: #5a0023;
|
|
63
|
-
margin: 4px;
|
|
64
|
-
border-radius: 4px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.group1 {
|
|
68
|
-
background-color: white !important;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.group1 {
|
|
72
|
-
background-color: #e5f1ee !important;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.group2 {
|
|
76
|
-
background-color: #d1e0e0 !important;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.group3 {
|
|
80
|
-
background-color: #c9d3ed !important;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.group4 {
|
|
84
|
-
background-color: #c9d0db !important;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.group5 {
|
|
88
|
-
background-color: #fdf3e9 !important;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.group6 {
|
|
92
|
-
background-color: #ddb5b5 !important;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.group-header-row {
|
|
97
|
-
background: #f6f6f6;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.collapse-controls {
|
|
101
|
-
text-align: center !important;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.group-header-cell {
|
|
105
|
-
font-weight: bold;
|
|
106
|
-
text-align: left;
|
|
107
|
-
padding: 8px;
|
|
108
|
-
|
|
109
|
-
button {
|
|
110
|
-
all: unset;
|
|
111
|
-
cursor: pointer;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
gap: 8px;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
@if (withToolbar) {
|
|
2
|
-
<lib-table-toolbar
|
|
3
|
-
[withTitle]="withTitle"
|
|
4
|
-
[icon]="icon"
|
|
5
|
-
[iconClass]="iconClass"
|
|
6
|
-
[source]="source"
|
|
7
|
-
[withGlobalFilter]="withGlobalFilter"
|
|
8
|
-
[isPreview]="isPreview"
|
|
9
|
-
[searchTableField]="searchTableField"
|
|
10
|
-
[readonly]="readonly"
|
|
11
|
-
[canCreate]="canCreate"
|
|
12
|
-
[canExport]="canExport"
|
|
13
|
-
[customActionEnable]="customActionEnable"
|
|
14
|
-
[customActionTitle]="customActionTitle"
|
|
15
|
-
[customActionIcon]="customActionIcon"
|
|
16
|
-
[customRowActionClass]="customRowActionClass"
|
|
17
|
-
[logout]="logout"
|
|
18
|
-
[isAndFilterOperator]="isAndFilterOperator"
|
|
19
|
-
[btnSize]="btnSize"
|
|
20
|
-
[customColumnFilter]="customColumnFilter"
|
|
21
|
-
(searchTableFieldChange)="searchTableField = $event; applyFilterFromToolbar()"
|
|
22
|
-
(applyFilterEvent)="applyFilter($event)"
|
|
23
|
-
(filterTypeEvent)="filterType()"
|
|
24
|
-
(clearTableFilterEvent)="clearTableFilter()"
|
|
25
|
-
(addItemEvent)="addItem()"
|
|
26
|
-
(exportToCsvEvent)="exportToCsv()"
|
|
27
|
-
(customActionEvent)="onClickCustomAction()"
|
|
28
|
-
(closeEvent)="close()"
|
|
29
|
-
(toggleChangedEvent)="OnToggleChanged($event)">
|
|
30
|
-
</lib-table-toolbar>
|
|
31
|
-
<br>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div class="row p-0">
|
|
36
|
-
<div class="col-md-12 p-0" [ngClass]="fontSize">
|
|
37
|
-
<div class="table-responsive">
|
|
38
|
-
@if (expandableGroups) {
|
|
39
|
-
<div class="collapse-controls">
|
|
40
|
-
@for (group of availableGroups; track group) {
|
|
41
|
-
@if (group !== '_ungrouped') {
|
|
42
|
-
<button mat-button (click)="toggleGroup(group)"
|
|
43
|
-
[ngClass]="expandedGroups[group] ? 'active-item' : 'inactive-item'">
|
|
44
|
-
{{ group }} {{ expandedGroups[group] ? '▲' : '▼' }}
|
|
45
|
-
</button>
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
</div>
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
<table mat-table [dataSource]="dataSource" matSort [class.mat-elevation-z2]="isPreview"
|
|
52
|
-
[class.mat-elevation-z8]="!isPreview" class="mat-mdc-table w-100">
|
|
53
|
-
|
|
54
|
-
@for (grouped of groupedColumns; track grouped[0]) {
|
|
55
|
-
@if (grouped[0] !== '_ungrouped') {
|
|
56
|
-
<tr class="group-header-row">
|
|
57
|
-
<th [attr.colspan]="grouped[1].length" class="group-header-cell">
|
|
58
|
-
<button type="button" (click)="toggleGroup(grouped[0])">
|
|
59
|
-
<mat-icon>{{ expandedGroups[grouped[0]] ? 'expand_less' : 'expand_more' }}</mat-icon>
|
|
60
|
-
{{ grouped[0] }}
|
|
61
|
-
</button>
|
|
62
|
-
</th>
|
|
63
|
-
</tr>
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@for (col of grouped[1]; track col.name) {
|
|
67
|
-
@if (grouped[0] === '_ungrouped' || expandedGroups[grouped[0]]) {
|
|
68
|
-
|
|
69
|
-
<ng-container [matColumnDef]="col.name">
|
|
70
|
-
<th mat-header-cell *matHeaderCellDef
|
|
71
|
-
[class.mat-sort-header]="!withFilterInHeader"
|
|
72
|
-
[ngClass]="[col.size, col.stickyClass, col.groupClass || ('group' + getGroupIndex(grouped[0]))]"
|
|
73
|
-
class="custom-th-cell">
|
|
74
|
-
<div class="header-label">{{ col.name | translate }}</div>
|
|
75
|
-
|
|
76
|
-
@if (withFilterInHeader) {
|
|
77
|
-
<div class="header-filter">
|
|
78
|
-
<lib-easy-multi-select #multiSelectDropdown
|
|
79
|
-
[class.visibility-hidden]="!col.enableFilter"
|
|
80
|
-
[data]="col.filterList"
|
|
81
|
-
[valueField]="'value'"
|
|
82
|
-
[displayField]="'value'"
|
|
83
|
-
(change)="onChangeMultiSelect($event, col)"
|
|
84
|
-
[title]="col.name"
|
|
85
|
-
[selectedData]="getSelectedList(col)"
|
|
86
|
-
[noPlaceholderNoHint]="true"
|
|
87
|
-
[padding]="'pd-t-l-5 h-50'">
|
|
88
|
-
</lib-easy-multi-select>
|
|
89
|
-
</div>
|
|
90
|
-
}
|
|
91
|
-
</th>
|
|
92
|
-
|
|
93
|
-
@if (col.name === '#') {
|
|
94
|
-
<td mat-cell *matCellDef="let element; let i = index"
|
|
95
|
-
[ngClass]="[col.stickyClass]"
|
|
96
|
-
title="ID = {{element[col.id]}}">
|
|
97
|
-
{{ i + 1 }}
|
|
98
|
-
</td>
|
|
99
|
-
} @else if (col.name === 'actions') {
|
|
100
|
-
<td mat-cell *matCellDef="let element" class="text-center action-link"
|
|
101
|
-
[ngClass]="[col.stickyClass]">
|
|
102
|
-
<div class="d-inline-flex gap-1 align-items-center">
|
|
103
|
-
@if (!readonly && canAuditTrail) {
|
|
104
|
-
<button mat-icon-button class="icon-only primary audit"
|
|
105
|
-
title="{{'AUDIT_TRAIL' | translate}}" (click)="auditTrailItem(element)">
|
|
106
|
-
<mat-icon>history</mat-icon>
|
|
107
|
-
</button>
|
|
108
|
-
}
|
|
109
|
-
<button mat-icon-button class="icon-only taupe" title="{{'link' | translate}}"
|
|
110
|
-
(click)="viewItem(element)">
|
|
111
|
-
<mat-icon>visibility</mat-icon>
|
|
112
|
-
</button>
|
|
113
|
-
@if (!readonly && canUpdate) {
|
|
114
|
-
<button mat-icon-button class="icon-only success {{element.statusName}}"
|
|
115
|
-
title="{{'edit' | translate}}" (click)="editItem(element)">
|
|
116
|
-
<mat-icon>edit</mat-icon>
|
|
117
|
-
</button>
|
|
118
|
-
}
|
|
119
|
-
@if (!readonly && canDelete) {
|
|
120
|
-
<button mat-icon-button class="icon-only danger"
|
|
121
|
-
title="{{'delete' | translate}}" (click)="deleteItem(element)">
|
|
122
|
-
<mat-icon>delete_forever</mat-icon>
|
|
123
|
-
</button>
|
|
124
|
-
}
|
|
125
|
-
</div>
|
|
126
|
-
</td>
|
|
127
|
-
} @else {
|
|
128
|
-
@if (col.isOverwriting) {
|
|
129
|
-
<td mat-cell *matCellDef="let element" [ngClass]="col.stickyClass">
|
|
130
|
-
@if (col.type === ColumnType.DROPDOWNLIST) {
|
|
131
|
-
<lib-easy-multi-select [data]="col.filterList" [valueField]="'value'"
|
|
132
|
-
[displayField]="'value'"
|
|
133
|
-
(change)="onChangeMultiSelect($event, col, false)"
|
|
134
|
-
[title]="col.name"
|
|
135
|
-
[selectedData]="getSelectedData(element, col)"
|
|
136
|
-
[noPlaceholderNoHint]="true"
|
|
137
|
-
[padding]="'pd-t-l-5 h-50'">
|
|
138
|
-
</lib-easy-multi-select>
|
|
139
|
-
} @else {
|
|
140
|
-
<input class="form-control form-control-sm cell-input hover h-40"
|
|
141
|
-
[ngClass]="col.type === ColumnType.NUMBER ? 'input-overwrite overwrite' : 'bg-white'"
|
|
142
|
-
[value]="element[col.name] ?? null"
|
|
143
|
-
(change)="onChangeOverwrite(element, col, $event)"/>
|
|
144
|
-
}
|
|
145
|
-
</td>
|
|
146
|
-
} @else {
|
|
147
|
-
@switch (col.type) {
|
|
148
|
-
@case (ColumnType.ICON) {
|
|
149
|
-
<td mat-cell *matCellDef="let element" class="text-center hover action-link"
|
|
150
|
-
[title]="getIconTitle(col, element[col.name])"
|
|
151
|
-
[ngClass]="[col.stickyClass]">
|
|
152
|
-
<mat-icon [class]="MatTabCommon.getCssClasses(col, element)">
|
|
153
|
-
{{ getIconColumn(col, element) }}
|
|
154
|
-
</mat-icon>
|
|
155
|
-
</td>
|
|
156
|
-
}
|
|
157
|
-
@case (ColumnType.ICON_AND_TEXT) {
|
|
158
|
-
<td mat-cell *matCellDef="let element"
|
|
159
|
-
class="action-link d-flex align-items-center gap-1"
|
|
160
|
-
[ngClass]="[col.stickyClass]">
|
|
161
|
-
<button mat-mini-fab class="btn btn-link p-0"
|
|
162
|
-
[class]="MatTabCommon.getCssClasses(col, element)"
|
|
163
|
-
[title]="getIconTitle(col, element[col.name])">
|
|
164
|
-
<mat-icon>{{ getIconColumn(col, element) }}</mat-icon>
|
|
165
|
-
</button>
|
|
166
|
-
<strong>{{ element[col.name] | translate }}</strong>
|
|
167
|
-
</td>
|
|
168
|
-
}
|
|
169
|
-
@case (ColumnType.PASSWORD) {
|
|
170
|
-
<td mat-cell *matCellDef="let element">
|
|
171
|
-
<div class="password-cell" [ngClass]="[col.cssClass, col.stickyClass]">
|
|
172
|
-
<span class="masked-text">
|
|
173
|
-
{{ isPasswordVisible[element[col.name]] ? element[col.name] : getMaskedValue(element[col.name]) }}
|
|
174
|
-
</span>
|
|
175
|
-
<button type="button" class="toggle-btn"
|
|
176
|
-
(click)="togglePassword(element[col.name])"
|
|
177
|
-
tabindex="-1" aria-label="Toggle password visibility">
|
|
178
|
-
<mat-icon>
|
|
179
|
-
{{ isPasswordVisible[element[col.name]] ? 'visibility_off' : 'visibility' }}
|
|
180
|
-
</mat-icon>
|
|
181
|
-
</button>
|
|
182
|
-
</div>
|
|
183
|
-
</td>
|
|
184
|
-
}
|
|
185
|
-
@case (ColumnType.BUTTON) {
|
|
186
|
-
<td mat-cell *matCellDef="let element"
|
|
187
|
-
[title]="getTitleColumn(col, element)"
|
|
188
|
-
[ngClass]="[col.stickyClass]">
|
|
189
|
-
<button class="p-0 w-100 no-border"
|
|
190
|
-
[class]="MatTabCommon.getCssClasses(col, element)">
|
|
191
|
-
{{ element[col.displayColumn ?? col.name] | translate }}
|
|
192
|
-
</button>
|
|
193
|
-
</td>
|
|
194
|
-
}
|
|
195
|
-
@default {
|
|
196
|
-
<td mat-cell *matCellDef="let element"
|
|
197
|
-
[ngClass]="[col.stickyClass]"
|
|
198
|
-
class="hover"
|
|
199
|
-
[class]="MatTabCommon.getCssClasses(col, element)"
|
|
200
|
-
[title]="getTitleColumn(col, element)">
|
|
201
|
-
{{ MatTabCommon.displayFormatTyped(col, element[col.name], sliceSize) }}
|
|
202
|
-
</td>
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
</ng-container>
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
<tr mat-header-row *matHeaderRowDef="getDisplayedColumnNames()"></tr>
|
|
213
|
-
<tr mat-row *matRowDef="let row; columns: getDisplayedColumnNames()"></tr>
|
|
214
|
-
</table>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
<mat-paginator [pageSizeOptions]="[10, 25, 50]"
|
|
218
|
-
showFirstLastButtons
|
|
219
|
-
[class.opacity-0]="isPreview"></mat-paginator>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { EasyTableComponent } from './easy-table.component';
|
|
4
|
-
|
|
5
|
-
describe('EasyTableComponent', () => {
|
|
6
|
-
let component: EasyTableComponent;
|
|
7
|
-
let fixture: ComponentFixture<EasyTableComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [EasyTableComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(EasyTableComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|