easy-mat-ui 0.0.6 → 0.0.7

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 (40) hide show
  1. package/fesm2022/easy-mat-ui.mjs +1119 -0
  2. package/fesm2022/easy-mat-ui.mjs.map +1 -0
  3. package/index.d.ts +279 -0
  4. package/package.json +15 -6
  5. package/ng-package.json +0 -19
  6. package/src/lib/easy-mat-ui.component.spec.ts +0 -23
  7. package/src/lib/easy-mat-ui.component.ts +0 -16
  8. package/src/lib/easy-mat-ui.service.spec.ts +0 -16
  9. package/src/lib/easy-mat-ui.service.ts +0 -9
  10. package/src/lib/easy-multi-select/easy-multi-select.css +0 -102
  11. package/src/lib/easy-multi-select/easy-multi-select.html +0 -51
  12. package/src/lib/easy-multi-select/easy-multi-select.spec.ts +0 -23
  13. package/src/lib/easy-multi-select/easy-multi-select.ts +0 -181
  14. package/src/lib/easy-table/easy-table.component.css +0 -117
  15. package/src/lib/easy-table/easy-table.component.html +0 -221
  16. package/src/lib/easy-table/easy-table.component.spec.ts +0 -23
  17. package/src/lib/easy-table/easy-table.component.ts +0 -568
  18. package/src/lib/model/dictionary.model.ts +0 -4
  19. package/src/lib/model/mat-column-typed.model.ts +0 -41
  20. package/src/lib/model/mat-column.model.ts +0 -35
  21. package/src/lib/model/tuple.model.ts +0 -8
  22. package/src/lib/shared/table-toolbar/table-toolbar.css +0 -26
  23. package/src/lib/shared/table-toolbar/table-toolbar.html +0 -80
  24. package/src/lib/shared/table-toolbar/table-toolbar.ts +0 -130
  25. package/src/lib/styles/_backgrounds.scss +0 -39
  26. package/src/lib/styles/_buttons.scss +0 -90
  27. package/src/lib/styles/_colors.scss +0 -67
  28. package/src/lib/styles/_effects.scss +0 -44
  29. package/src/lib/styles/_material-overrides.scss +0 -87
  30. package/src/lib/styles/_spacing.scss +0 -68
  31. package/src/lib/styles/_tables.scss +0 -71
  32. package/src/lib/styles/_typography.scss +0 -105
  33. package/src/lib/styles.scss +0 -30
  34. package/src/lib/utils/enums.ts +0 -49
  35. package/src/lib/utils/matTabCommon.ts +0 -59
  36. package/src/lib/utils/utils.ts +0 -68
  37. package/src/public-api.ts +0 -8
  38. package/tsconfig.lib.json +0 -18
  39. package/tsconfig.lib.prod.json +0 -11
  40. package/tsconfig.spec.json +0 -15
@@ -1,9 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
-
3
- @Injectable({
4
- providedIn: 'root'
5
- })
6
- export class EasyMatUiService {
7
-
8
- constructor() { }
9
- }
@@ -1,102 +0,0 @@
1
- .full-width {
2
- width: 100%;
3
- }
4
-
5
- .select-header {
6
- display: flex;
7
- align-items: center;
8
- padding: 10px;
9
- gap: 8px;
10
- flex-wrap: nowrap;
11
- overflow: hidden;
12
- }
13
-
14
- .search-field {
15
- flex: 1;
16
- min-width: 0;
17
- }
18
-
19
- mat-form-field.search-field {
20
- margin: 0;
21
- }
22
-
23
- .options {
24
- max-height: 200px;
25
- overflow-y: auto;
26
- overflow-x: hidden;
27
- }
28
-
29
- .no-data {
30
- padding: 12px;
31
- color: gray;
32
- font-style: italic;
33
- }
34
-
35
- .select-color {
36
- white-space: nowrap;
37
- }
38
-
39
- ::ng-deep .checkbox-container{
40
- display: flex !important;
41
- align-items: center !important;
42
- }
43
-
44
- ::ng-deep div.mat-mdc-select-panel{
45
- max-height: unset !important;
46
- }
47
-
48
-
49
-
50
-
51
-
52
-
53
- .pd-l-10 {
54
- padding-left: 10px;
55
- }
56
-
57
- .pd-r-10 {
58
- padding-right: 10px;
59
- }
60
-
61
- .pd-t-10 {
62
- padding-top: 10px;
63
- }
64
-
65
- .select-color {
66
- color: #5a0023 !important;
67
- font-weight: 500;
68
- }
69
-
70
- .d-contents {
71
- display: contents;
72
- }
73
-
74
- .no-data {
75
- color: red;
76
- font-weight: bold;
77
- text-align: center;
78
- }
79
-
80
- ::ng-deep .mat-checkbox-layout {
81
- margin-top: 15px;
82
- }
83
-
84
- ::ng-deep .mat-select-panel {
85
- min-width: 100% !important;
86
- }
87
-
88
- ::ng-deep .cdk-overlay-pane {
89
- transform: none !important;
90
- }
91
-
92
- .mat-icon {
93
- color: red !important;
94
- }
95
-
96
- .hover {
97
- cursor: pointer;
98
- }
99
-
100
- ::ng-deep .mat-mdc-form-field-subscript-wrapper.mat-mdc-form-field-bottom-align {
101
- display: none !important;
102
- }
@@ -1,51 +0,0 @@
1
- <mat-form-field class="w-100 underline-style flex-grow-1" [ngClass]="padding" floatLabel="always">
2
- @if (!noPlaceholderNoHint && !hidePlaceholder) {
3
- <mat-label>
4
- {{ title | translate }}
5
- </mat-label>
6
- }
7
- <mat-select [formControl]="multiSelectControl" multiple #opts [panelClass]="uniqueId"
8
- (openedChange)="searchCtrl.setValue('')">
9
- <div class="checkbox-container container-fluid pd-l-10 pd-t-10 w-100 flex-grow-1">
10
- <mat-checkbox
11
- color="primary"
12
- [checked]="selected(opts) === 'all'"
13
- [indeterminate]="selected(opts) === 'some'"
14
- (change)="toggleSelection(opts)"
15
- matTooltip="{{getTooltips(opts) | translate }}"
16
- matTooltipPosition="above">
17
- </mat-checkbox>
18
- <mat-form-field class="w-100 flex-grow-1">
19
- <input matInput #input placeholder="Search" class="w-100 flex-grow-1"
20
- [formControl]="searchCtrl"
21
- (keydown)="onKeydown($event, input)"/>
22
- <mat-icon class="hover" matSuffix (click)="clear()" title="{{'CLEAR' | translate}}">cleaning_services</mat-icon>
23
- </mat-form-field>
24
-
25
- <mat-icon class="hover" matSuffix (click)="opts.close()"
26
- title="{{ 'CLOSE' | translate }}">close
27
- </mat-icon>
28
- </div>
29
- <mat-divider></mat-divider>
30
- <div class="options">
31
- @if (searchCtrl.value && !opts.options?.length) {
32
- <div class="no-data">
33
- {{ 'NO_RESULTS_FOUND' | translate }} "{{ searchCtrl.value }}"
34
- </div>
35
- }
36
- <mat-option class="select-color"
37
- *ngFor="let item of filteredMultiSelect | async "
38
- [value]="item[valueField]"
39
- (onSelectionChange)="onSelectionChange($event)"
40
- >{{ item[displayField] }}
41
- </mat-option
42
- >
43
- </div>
44
- </mat-select>
45
- </mat-form-field>
46
- @if (!noPlaceholderNoHint && data.length === 0) {
47
- <div>
48
- {{ 'NO_OPTIONS' | translate }}
49
- </div>
50
- }
51
-
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { EasyMultiSelect } from './easy-multi-select';
4
-
5
- describe('EasyMultiSelect', () => {
6
- let component: EasyMultiSelect;
7
- let fixture: ComponentFixture<EasyMultiSelect>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [EasyMultiSelect]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(EasyMultiSelect);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -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
-