angular-matecu 4.1.0 → 4.2.0
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/fesm2022/angular-matecu.mjs +1740 -0
- package/fesm2022/angular-matecu.mjs.map +1 -0
- package/package.json +16 -3
- package/types/angular-matecu.d.ts +490 -0
- package/ng-package.json +0 -7
- package/src/css/main.css +0 -1
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.html +0 -11
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.scss +0 -39
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-box/matecu-alert-box.component.ts +0 -60
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.html +0 -24
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.scss +0 -5
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-dialog/matecu-alert-dialog.component.ts +0 -53
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.html +0 -10
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.scss +0 -34
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.spec.ts +0 -25
- package/src/lib/components/matecu-alert-snack-bar/matecu-alert-snack-bar.component.ts +0 -45
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.html +0 -36
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.scss +0 -56
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.spec.ts +0 -23
- package/src/lib/components/matecu-autocomplete/matecu-autocomplete.ts +0 -336
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.html +0 -64
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.scss +0 -23
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.spec.ts +0 -23
- package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.ts +0 -314
- package/src/lib/components/matecu-file-input/matecu-file-input-customization.md +0 -284
- package/src/lib/components/matecu-file-input/matecu-file-input.example.md +0 -228
- package/src/lib/components/matecu-file-input/matecu-file-input.html +0 -128
- package/src/lib/components/matecu-file-input/matecu-file-input.scss +0 -461
- package/src/lib/components/matecu-file-input/matecu-file-input.spec.ts +0 -340
- package/src/lib/components/matecu-file-input/matecu-file-input.ts +0 -438
- package/src/lib/components/matecu-spinner/matecu-spinner.component.css +0 -15
- package/src/lib/components/matecu-spinner/matecu-spinner.component.html +0 -44
- package/src/lib/components/matecu-spinner/matecu-spinner.component.spec.ts +0 -25
- package/src/lib/components/matecu-spinner/matecu-spinner.component.ts +0 -54
- package/src/lib/components/matecu-spinner/spinner-loader.component.scss +0 -13
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.html +0 -1
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.scss +0 -19
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-action/matecu-topbar-action.component.ts +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.html +0 -1
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.scss +0 -14
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-body/matecu-topbar-body.component.ts +0 -11
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.html +0 -3
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.scss +0 -19
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-fab/matecu-topbar-fab.component.ts +0 -31
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.html +0 -1
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.scss +0 -8
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-column/matecu-topbar-header-column.component.ts +0 -11
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.html +0 -9
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.scss +0 -34
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.spec.ts +0 -23
- package/src/lib/components/matecu-topbar-header-row/matecu-topbar-header-row.component.ts +0 -18
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.html +0 -7
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.scss +0 -49
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-layout/matecu-topbar-layout.component.ts +0 -112
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.html +0 -20
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.scss +0 -90
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-search/matecu-topbar-search.component.ts +0 -92
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.html +0 -1
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.scss +0 -91
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.spec.ts +0 -25
- package/src/lib/components/matecu-topbar-title/matecu-topbar-title.component.ts +0 -14
- package/src/lib/modules/matecu-alert-box/matecu-alert-box.module.ts +0 -16
- package/src/lib/modules/matecu-spinner/matecu-spinner.module.ts +0 -14
- package/src/lib/modules/matecu-topbar-layout/matecu-topbar-layout.module.ts +0 -45
- package/src/lib/services/matecu-snack-bar.service.spec.ts +0 -16
- package/src/lib/services/matecu-snack-bar.service.ts +0 -66
- package/src/lib/services/matecu-spinner.service.spec.ts +0 -16
- package/src/lib/services/matecu-spinner.service.ts +0 -39
- package/src/lib/types/matecu-alert-dialog.ts +0 -10
- package/src/lib/types/matecu-alert-snackbar.ts +0 -8
- package/src/lib/types/matecu-altert-box-type.ts +0 -6
- package/src/lib/types/matecu-autocomplete.ts +0 -5
- package/src/public-api.ts +0 -42
- package/src/scss/main.scss +0 -2
- package/src/scss/matecu-spinner-module/_matecu-spinner-component.scss +0 -8
- package/src/scss/matecu-topbar-layout/_variables.scss +0 -2
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
@if (loading) {
|
|
2
|
-
|
|
3
|
-
<mat-progress-spinner matSuffix diameter="20" mode="indeterminate">
|
|
4
|
-
</mat-progress-spinner>
|
|
5
|
-
}
|
|
6
|
-
<mat-chip-grid #chipGrid class="chip-list">
|
|
7
|
-
|
|
8
|
-
@for (item of selectedItems(); track item.value) {
|
|
9
|
-
|
|
10
|
-
<mat-chip-row [removable]="!disabled && !readonly" (removed)="remove(item.value)"
|
|
11
|
-
[matTooltip]="showTooltip ? item.label : ''" matTooltipPosition="above">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{{ item.label }}
|
|
16
|
-
@if (!disabled && !readonly) {
|
|
17
|
-
|
|
18
|
-
<button matChipRemove aria-label="Remove {{item.label}}">
|
|
19
|
-
<mat-icon>cancel</mat-icon>
|
|
20
|
-
</button>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
</mat-chip-row>
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
<input type="text" matInput [formControl]="searchControl" [matAutocomplete]="auto" (keydown)="onKeyDown($event)"
|
|
27
|
-
[placeholder]="placeholder" />
|
|
28
|
-
|
|
29
|
-
</mat-chip-grid>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selectOption($event.option.value)"
|
|
33
|
-
class="autocomplete-large-panel" [displayWith]="displayLabel">
|
|
34
|
-
|
|
35
|
-
@if (!readonly && !disabled && (enableSelectAll || control.value.length > 0)) {
|
|
36
|
-
<mat-option>
|
|
37
|
-
<div style="display: flex; gap: 10px; align-items: center; justify-content: center; ">
|
|
38
|
-
|
|
39
|
-
@if (enableSelectAll) {
|
|
40
|
-
<div>
|
|
41
|
-
<button mat-icon-button (click)="selectAll()" [matTooltip]="selectAllLabel">
|
|
42
|
-
<mat-icon>select_all</mat-icon>
|
|
43
|
-
</button>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
@if (control.value.length > 0) {
|
|
48
|
-
<div>
|
|
49
|
-
|
|
50
|
-
<button mat-icon-button (click)="clearAll()" [matTooltip]="clearAllLabel">
|
|
51
|
-
<mat-icon>clear_all</mat-icon>
|
|
52
|
-
</button>
|
|
53
|
-
</div>
|
|
54
|
-
}
|
|
55
|
-
</div>
|
|
56
|
-
</mat-option>
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@for (option of filteredOptions(); track $index) {
|
|
60
|
-
<mat-option [value]="option">
|
|
61
|
-
{{ option[1] }}
|
|
62
|
-
</mat-option>
|
|
63
|
-
}
|
|
64
|
-
</mat-autocomplete>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
position: relative;
|
|
4
|
-
width: 100%;
|
|
5
|
-
|
|
6
|
-
input {
|
|
7
|
-
outline: none;
|
|
8
|
-
border: none;
|
|
9
|
-
background-color: transparent;
|
|
10
|
-
width: 100%;
|
|
11
|
-
}
|
|
12
|
-
.clear-all-box {
|
|
13
|
-
width: 100%;
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: flex-end;
|
|
16
|
-
align-items: center;
|
|
17
|
-
}
|
|
18
|
-
mat-option {
|
|
19
|
-
span {
|
|
20
|
-
display: block;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
package/src/lib/components/matecu-autocomplete-multiple/matecu-autocomplete-multiple.spec.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { MatecuAutocompleteMultiple } from './matecu-autocomplete-multiple';
|
|
4
|
-
|
|
5
|
-
describe('MatecuAutocompleteMultiple', () => {
|
|
6
|
-
let component: MatecuAutocompleteMultiple;
|
|
7
|
-
let fixture: ComponentFixture<MatecuAutocompleteMultiple>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [MatecuAutocompleteMultiple]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(MatecuAutocompleteMultiple);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
await fixture.whenStable();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
Input,
|
|
4
|
-
Output,
|
|
5
|
-
EventEmitter,
|
|
6
|
-
forwardRef,
|
|
7
|
-
OnDestroy,
|
|
8
|
-
signal,
|
|
9
|
-
computed,
|
|
10
|
-
effect,
|
|
11
|
-
inject,
|
|
12
|
-
OnInit,
|
|
13
|
-
Injector,
|
|
14
|
-
} from '@angular/core';
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
ControlValueAccessor,
|
|
18
|
-
NG_VALUE_ACCESSOR,
|
|
19
|
-
FormControl,
|
|
20
|
-
ReactiveFormsModule,
|
|
21
|
-
} from '@angular/forms';
|
|
22
|
-
|
|
23
|
-
import { MatFormFieldControl } from '@angular/material/form-field';
|
|
24
|
-
import { NgControl } from '@angular/forms';
|
|
25
|
-
import { Subject } from 'rxjs';
|
|
26
|
-
import { CdkDragDrop, DragDropModule, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
27
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
28
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
29
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
30
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
31
|
-
import { CdkFixedSizeVirtualScroll, ScrollingModule } from '@angular/cdk/scrolling';
|
|
32
|
-
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
33
|
-
|
|
34
|
-
import { ViewChild } from '@angular/core';
|
|
35
|
-
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
36
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
37
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
38
|
-
import {
|
|
39
|
-
MatecuAutocompleteFilterFn,
|
|
40
|
-
MatecuAutocompleteOption,
|
|
41
|
-
} from '../../types/matecu-autocomplete';
|
|
42
|
-
|
|
43
|
-
@Component({
|
|
44
|
-
selector: 'matecu-autocomplete-multiple',
|
|
45
|
-
standalone: true,
|
|
46
|
-
imports: [
|
|
47
|
-
ReactiveFormsModule,
|
|
48
|
-
MatChipsModule,
|
|
49
|
-
DragDropModule,
|
|
50
|
-
MatIconModule,
|
|
51
|
-
MatProgressSpinnerModule,
|
|
52
|
-
MatAutocompleteModule,
|
|
53
|
-
ScrollingModule,
|
|
54
|
-
MatButtonModule,
|
|
55
|
-
MatTooltipModule,
|
|
56
|
-
],
|
|
57
|
-
templateUrl: './matecu-autocomplete-multiple.html',
|
|
58
|
-
styleUrls: ['./matecu-autocomplete-multiple.scss'],
|
|
59
|
-
providers: [
|
|
60
|
-
{
|
|
61
|
-
provide: NG_VALUE_ACCESSOR,
|
|
62
|
-
useExisting: forwardRef(() => MatecuAutocompleteMultiple),
|
|
63
|
-
multi: true,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
provide: MatFormFieldControl,
|
|
67
|
-
useExisting: MatecuAutocompleteMultiple,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
})
|
|
71
|
-
export class MatecuAutocompleteMultiple
|
|
72
|
-
implements ControlValueAccessor, MatFormFieldControl<string[]>, OnDestroy, OnInit
|
|
73
|
-
{
|
|
74
|
-
static nextId = 0;
|
|
75
|
-
|
|
76
|
-
// ================= INPUTS =================
|
|
77
|
-
|
|
78
|
-
@Input() placeholder = '';
|
|
79
|
-
@Input() loading = false;
|
|
80
|
-
@Input() searchChangeDebounceTime = 300;
|
|
81
|
-
@Input() enableSelectAll = true;
|
|
82
|
-
@Input() readonly = false;
|
|
83
|
-
@Input() selectAllLabel = 'Select All';
|
|
84
|
-
@Input() clearAllLabel = 'Clear All';
|
|
85
|
-
@Input() showTooltip = true;
|
|
86
|
-
@Input() filterFn: MatecuAutocompleteFilterFn = this.createFilterFn();
|
|
87
|
-
private _options = signal<MatecuAutocompleteOption[]>([]);
|
|
88
|
-
|
|
89
|
-
@Input({ required: true })
|
|
90
|
-
set options(value: MatecuAutocompleteOption[]) {
|
|
91
|
-
this._options.set(value ?? []);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get options() {
|
|
95
|
-
return this._options();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// ================= OUTPUT =================
|
|
99
|
-
|
|
100
|
-
@Output() searchChange = new EventEmitter<string>();
|
|
101
|
-
|
|
102
|
-
// ================= INTERNAL CONTROL =================
|
|
103
|
-
|
|
104
|
-
control = new FormControl<string[]>([], { nonNullable: true });
|
|
105
|
-
controlValue$ = toSignal(this.control.valueChanges);
|
|
106
|
-
searchControl = new FormControl<string>('', { nonNullable: true });
|
|
107
|
-
@ViewChild(MatAutocompleteTrigger)
|
|
108
|
-
autocompleteTrigger!: MatAutocompleteTrigger;
|
|
109
|
-
|
|
110
|
-
// ================= SIGNALS =================
|
|
111
|
-
|
|
112
|
-
readonly searchText = signal<string>(''); // 🔥 AHORA SÍ existe correctamente
|
|
113
|
-
|
|
114
|
-
readonly filteredOptions = computed(() => {
|
|
115
|
-
const filter = this.searchText();
|
|
116
|
-
|
|
117
|
-
return this._options().filter(
|
|
118
|
-
(o) => this.filterFn(o[1], filter) && !this.control.value.includes(o[0]),
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
readonly selectedItems = computed(() => {
|
|
123
|
-
const values = this.controlValue$() ?? [];
|
|
124
|
-
return values.map((v) => {
|
|
125
|
-
const found = this._options().find((o) => o[0] === v);
|
|
126
|
-
return {
|
|
127
|
-
value: v,
|
|
128
|
-
label: found ? found[1] : v,
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// ================= FORM FIELD CONTROL =================
|
|
134
|
-
|
|
135
|
-
stateChanges = new Subject<void>();
|
|
136
|
-
focused = false;
|
|
137
|
-
controlType = 'autocomplete-multiple';
|
|
138
|
-
id = `autocomplete-multiple-${MatecuAutocompleteMultiple.nextId++}`;
|
|
139
|
-
describedBy = '';
|
|
140
|
-
disabled = false;
|
|
141
|
-
required = false;
|
|
142
|
-
errorState = false;
|
|
143
|
-
private injector: Injector;
|
|
144
|
-
ngControl: NgControl | null = null;
|
|
145
|
-
|
|
146
|
-
get empty() {
|
|
147
|
-
return this.control.value.length === 0;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
get shouldLabelFloat() {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// ================= CONSTRUCTOR =================
|
|
155
|
-
|
|
156
|
-
constructor(injector: Injector) {
|
|
157
|
-
this.injector = injector;
|
|
158
|
-
// Debounce search
|
|
159
|
-
let timeout: any;
|
|
160
|
-
|
|
161
|
-
this.searchControl.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
|
|
162
|
-
this.searchText.set(value ?? '');
|
|
163
|
-
});
|
|
164
|
-
this.control.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
|
|
165
|
-
this.onChange(value);
|
|
166
|
-
this.stateChanges.next();
|
|
167
|
-
});
|
|
168
|
-
effect(() => {
|
|
169
|
-
const value = this.searchText();
|
|
170
|
-
|
|
171
|
-
clearTimeout(timeout);
|
|
172
|
-
|
|
173
|
-
timeout = setTimeout(() => {
|
|
174
|
-
this.searchChange.emit(value);
|
|
175
|
-
}, this.searchChangeDebounceTime);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
value: string[] | null = null;
|
|
179
|
-
autofilled?: boolean | undefined;
|
|
180
|
-
userAriaDescribedBy?: string | undefined;
|
|
181
|
-
disableAutomaticLabeling?: boolean | undefined;
|
|
182
|
-
describedByIds?: string[] | undefined;
|
|
183
|
-
|
|
184
|
-
ngOnInit(): void {
|
|
185
|
-
try {
|
|
186
|
-
this.ngControl = this.injector.get(NgControl, null);
|
|
187
|
-
} catch (error) {
|
|
188
|
-
// Ignorar si no se puede obtener NgControl
|
|
189
|
-
this.ngControl = null;
|
|
190
|
-
}
|
|
191
|
-
// Propagar cambios del FormControl interno
|
|
192
|
-
}
|
|
193
|
-
// ================= AUTOCOMPLETE =================
|
|
194
|
-
|
|
195
|
-
selectOption(option: [string, string]) {
|
|
196
|
-
if (this.readonly || this.disabled) return;
|
|
197
|
-
if (!Array.isArray(option)) return;
|
|
198
|
-
if (!this.control.value.includes(option[0])) {
|
|
199
|
-
this.control.setValue([...this.control.value, option[0]]);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// limpiar input correctamente
|
|
203
|
-
this.searchControl.setValue('');
|
|
204
|
-
this.searchText.set('');
|
|
205
|
-
|
|
206
|
-
// cerrar panel
|
|
207
|
-
this.autocompleteTrigger.closePanel();
|
|
208
|
-
}
|
|
209
|
-
displayLabel(option: [string, string]): string {
|
|
210
|
-
return Array.isArray(option) ? option[1] : '';
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// ================= CHIP ACTIONS =================
|
|
214
|
-
|
|
215
|
-
remove(value: string) {
|
|
216
|
-
if (this.readonly || this.disabled) return;
|
|
217
|
-
|
|
218
|
-
this.control.setValue(this.control.value.filter((v) => v !== value));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
selectAll() {
|
|
222
|
-
if (this.readonly || this.disabled) return;
|
|
223
|
-
|
|
224
|
-
const allValues = this._options().map((o) => o[0]);
|
|
225
|
-
|
|
226
|
-
this.control.setValue([...new Set([...this.control.value, ...allValues])]);
|
|
227
|
-
|
|
228
|
-
this.searchControl.setValue('');
|
|
229
|
-
this.searchText.set('');
|
|
230
|
-
|
|
231
|
-
this.autocompleteTrigger.closePanel();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
clearAll(): void {
|
|
235
|
-
if (this.disabled || this.readonly) return;
|
|
236
|
-
|
|
237
|
-
if (this.control.value.length === 0) return;
|
|
238
|
-
|
|
239
|
-
this.control.setValue([]);
|
|
240
|
-
this.searchControl.setValue('');
|
|
241
|
-
this.searchText.set('');
|
|
242
|
-
|
|
243
|
-
this.autocompleteTrigger?.closePanel();
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// ================= DRAG & DROP =================
|
|
247
|
-
|
|
248
|
-
drop(event: CdkDragDrop<any>) {
|
|
249
|
-
if (this.disabled || this.readonly) return;
|
|
250
|
-
|
|
251
|
-
const current = [...this.control.value];
|
|
252
|
-
moveItemInArray(current, event.previousIndex, event.currentIndex);
|
|
253
|
-
this.control.setValue(current);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ================= KEYBOARD =================
|
|
257
|
-
|
|
258
|
-
onKeyDown(event: KeyboardEvent) {
|
|
259
|
-
if (this.readonly || this.disabled) return;
|
|
260
|
-
|
|
261
|
-
if (event.key === 'Backspace' && !this.searchText() && this.control.value.length > 0) {
|
|
262
|
-
const updated = [...this.control.value];
|
|
263
|
-
updated.pop();
|
|
264
|
-
this.control.setValue(updated);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// ================= CVA =================
|
|
269
|
-
|
|
270
|
-
onChange: (value: string[]) => void = () => {};
|
|
271
|
-
onTouched: () => void = () => {};
|
|
272
|
-
|
|
273
|
-
writeValue(value: string[] | null): void {
|
|
274
|
-
this.control.setValue(value ?? [], { emitEvent: false });
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
registerOnChange(fn: any): void {
|
|
278
|
-
this.onChange = fn;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
registerOnTouched(fn: any): void {
|
|
282
|
-
this.onTouched = fn;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
setDisabledState(isDisabled: boolean): void {
|
|
286
|
-
this.disabled = isDisabled;
|
|
287
|
-
|
|
288
|
-
isDisabled
|
|
289
|
-
? this.control.disable({ emitEvent: false })
|
|
290
|
-
: this.control.enable({ emitEvent: false });
|
|
291
|
-
|
|
292
|
-
this.stateChanges.next();
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
setDescribedByIds(ids: string[]): void {
|
|
296
|
-
this.describedBy = ids.join(' ');
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
onContainerClick() {}
|
|
300
|
-
|
|
301
|
-
ngOnDestroy() {
|
|
302
|
-
this.stateChanges.complete();
|
|
303
|
-
}
|
|
304
|
-
trackByValue = (_: number, item: [string, string]) => item[0];
|
|
305
|
-
openPanel() {
|
|
306
|
-
this.autocompleteTrigger.openPanel();
|
|
307
|
-
setTimeout(() => this.autocompleteTrigger.updatePosition());
|
|
308
|
-
}
|
|
309
|
-
private createFilterFn(): (v1: string, v2: string) => boolean {
|
|
310
|
-
return (v1: string, v2: string): boolean => {
|
|
311
|
-
return v1.toLowerCase().includes(v2.toLowerCase());
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
}
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
# Matecu File Input - CSS Customization Guide
|
|
2
|
-
|
|
3
|
-
## 🎨 Overview
|
|
4
|
-
|
|
5
|
-
The Matecu File Input component uses CSS custom properties (variables) to make theming and customization easy. All variables use the `--matecu-file-input-*` namespace to prevent conflicts with other components.
|
|
6
|
-
|
|
7
|
-
## 🔧 Available CSS Variables
|
|
8
|
-
|
|
9
|
-
### Color Palette
|
|
10
|
-
|
|
11
|
-
```css
|
|
12
|
-
:root {
|
|
13
|
-
/* Base Colors */
|
|
14
|
-
--matecu-file-input-color-primary: #4f46e5;
|
|
15
|
-
--matecu-file-input-color-primary-hover: #4338ca;
|
|
16
|
-
--matecu-file-input-color-success: #10b981;
|
|
17
|
-
--matecu-file-input-color-error: #ef4444;
|
|
18
|
-
--matecu-file-input-color-error-hover: #dc2626;
|
|
19
|
-
--matecu-file-input-color-loading: #8b5cf6;
|
|
20
|
-
--matecu-file-input-color-disabled: #9ca3af;
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Border Colors
|
|
25
|
-
|
|
26
|
-
```css
|
|
27
|
-
:root {
|
|
28
|
-
--matecu-file-input-border-default: #e1e5e9;
|
|
29
|
-
--matecu-file-input-border-hover: var(--matecu-file-input-color-primary);
|
|
30
|
-
--matecu-file-input-border-success: var(--matecu-file-input-color-success);
|
|
31
|
-
--matecu-file-input-border-error: var(--matecu-file-input-color-error);
|
|
32
|
-
--matecu-file-input-border-loading: var(--matecu-file-input-color-loading);
|
|
33
|
-
--matecu-file-input-border-separator: #e5e7eb;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Background Colors
|
|
38
|
-
|
|
39
|
-
```css
|
|
40
|
-
:root {
|
|
41
|
-
--matecu-file-input-bg-default: #fafbfc;
|
|
42
|
-
--matecu-file-input-bg-hover: #f8faff;
|
|
43
|
-
--matecu-file-input-bg-drag-over: #eef2ff;
|
|
44
|
-
--matecu-file-input-bg-disabled: #f5f5f5;
|
|
45
|
-
--matecu-file-input-bg-success: #f0fdf4;
|
|
46
|
-
--matecu-file-input-bg-error: #fef2f2;
|
|
47
|
-
--matecu-file-input-bg-loading: #faf5ff;
|
|
48
|
-
--matecu-file-input-bg-surface: #ffffff;
|
|
49
|
-
--matecu-file-input-bg-surface-alt: #f3f4f6;
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Text Colors
|
|
54
|
-
|
|
55
|
-
```css
|
|
56
|
-
:root {
|
|
57
|
-
--matecu-file-input-text-primary: #111827;
|
|
58
|
-
--matecu-file-input-text-secondary: #374151;
|
|
59
|
-
--matecu-file-input-text-muted: #6b7280;
|
|
60
|
-
--matecu-file-input-text-disabled: #9ca3af;
|
|
61
|
-
--matecu-file-input-text-on-primary: #ffffff;
|
|
62
|
-
--matecu-file-input-text-error: #dc2626;
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Button Colors
|
|
67
|
-
|
|
68
|
-
```css
|
|
69
|
-
:root {
|
|
70
|
-
--matecu-file-input-button-primary-bg: var(--matecu-file-input-color-primary);
|
|
71
|
-
--matecu-file-input-button-primary-bg-hover: var(--matecu-file-input-color-primary-hover);
|
|
72
|
-
--matecu-file-input-button-primary-text: var(--matecu-file-input-text-on-primary);
|
|
73
|
-
--matecu-file-input-button-danger-bg: var(--matecu-file-input-color-error);
|
|
74
|
-
--matecu-file-input-button-danger-bg-hover: var(--matecu-file-input-color-error-hover);
|
|
75
|
-
--matecu-file-input-button-danger-text: var(--matecu-file-input-text-on-primary);
|
|
76
|
-
--matecu-file-input-button-disabled-bg: var(--matecu-file-input-color-disabled);
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Design System
|
|
81
|
-
|
|
82
|
-
```css
|
|
83
|
-
:root {
|
|
84
|
-
/* Shadows */
|
|
85
|
-
--matecu-file-input-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
86
|
-
--matecu-file-input-shadow-md: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
87
|
-
|
|
88
|
-
/* Border Radius */
|
|
89
|
-
--matecu-file-input-border-radius-sm: 4px;
|
|
90
|
-
--matecu-file-input-border-radius-md: 6px;
|
|
91
|
-
--matecu-file-input-border-radius-lg: 8px;
|
|
92
|
-
--matecu-file-input-border-radius-xl: 12px;
|
|
93
|
-
|
|
94
|
-
/* Border Width */
|
|
95
|
-
--matecu-file-input-border-width: 2px;
|
|
96
|
-
|
|
97
|
-
/* Spinner */
|
|
98
|
-
--matecu-file-input-spinner-track: #e5e7eb;
|
|
99
|
-
--matecu-file-input-spinner-fill: var(--matecu-file-input-color-loading);
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## 🎯 Customization Examples
|
|
104
|
-
|
|
105
|
-
### Dark Theme
|
|
106
|
-
|
|
107
|
-
```css
|
|
108
|
-
.dark-theme {
|
|
109
|
-
--matecu-file-input-color-primary: #818cf8;
|
|
110
|
-
--matecu-file-input-color-primary-hover: #6366f1;
|
|
111
|
-
|
|
112
|
-
--matecu-file-input-bg-default: #1f2937;
|
|
113
|
-
--matecu-file-input-bg-hover: #374151;
|
|
114
|
-
--matecu-file-input-bg-surface: #111827;
|
|
115
|
-
--matecu-file-input-bg-surface-alt: #1f2937;
|
|
116
|
-
|
|
117
|
-
--matecu-file-input-text-primary: #f9fafb;
|
|
118
|
-
--matecu-file-input-text-secondary: #e5e7eb;
|
|
119
|
-
--matecu-file-input-text-muted: #9ca3af;
|
|
120
|
-
|
|
121
|
-
--matecu-file-input-border-default: #374151;
|
|
122
|
-
--matecu-file-input-border-separator: #374151;
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Brand Colors (Blue Theme)
|
|
127
|
-
|
|
128
|
-
```css
|
|
129
|
-
.blue-theme {
|
|
130
|
-
--matecu-file-input-color-primary: #3b82f6;
|
|
131
|
-
--matecu-file-input-color-primary-hover: #2563eb;
|
|
132
|
-
--matecu-file-input-color-success: #059669;
|
|
133
|
-
--matecu-file-input-color-error: #dc2626;
|
|
134
|
-
|
|
135
|
-
--matecu-file-input-bg-hover: #dbeafe;
|
|
136
|
-
--matecu-file-input-bg-drag-over: #bfdbfe;
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Green Theme
|
|
141
|
-
|
|
142
|
-
```css
|
|
143
|
-
.green-theme {
|
|
144
|
-
--matecu-file-input-color-primary: #059669;
|
|
145
|
-
--matecu-file-input-color-primary-hover: #047857;
|
|
146
|
-
|
|
147
|
-
--matecu-file-input-bg-hover: #d1fae5;
|
|
148
|
-
--matecu-file-input-bg-drag-over: #a7f3d0;
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Minimal Theme
|
|
153
|
-
|
|
154
|
-
```css
|
|
155
|
-
.minimal-theme {
|
|
156
|
-
--matecu-file-input-border-radius-sm: 2px;
|
|
157
|
-
--matecu-file-input-border-radius-md: 4px;
|
|
158
|
-
--matecu-file-input-border-radius-lg: 6px;
|
|
159
|
-
--matecu-file-input-border-width: 1px;
|
|
160
|
-
|
|
161
|
-
--matecu-file-input-shadow-sm: none;
|
|
162
|
-
--matecu-file-input-shadow-md: none;
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### High Contrast Theme
|
|
167
|
-
|
|
168
|
-
```css
|
|
169
|
-
.high-contrast-theme {
|
|
170
|
-
--matecu-file-input-color-primary: #0066cc;
|
|
171
|
-
--matecu-file-input-color-error: #d93025;
|
|
172
|
-
--matecu-file-input-color-success: #137333;
|
|
173
|
-
|
|
174
|
-
--matecu-file-input-border-width: 3px;
|
|
175
|
-
--matecu-file-input-text-primary: #000000;
|
|
176
|
-
--matecu-file-input-bg-surface: #ffffff;
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## 📱 Implementation
|
|
181
|
-
|
|
182
|
-
### Global Customization
|
|
183
|
-
|
|
184
|
-
```css
|
|
185
|
-
/* In your global styles.css */
|
|
186
|
-
:root {
|
|
187
|
-
--matecu-file-input-color-primary: #your-brand-color;
|
|
188
|
-
--matecu-file-input-border-radius-md: 12px;
|
|
189
|
-
/* ... other customizations */
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Component-Specific Customization
|
|
194
|
-
|
|
195
|
-
```css
|
|
196
|
-
/* Target specific component instance */
|
|
197
|
-
.my-custom-file-input {
|
|
198
|
-
--matecu-file-input-color-primary: #ff6b35;
|
|
199
|
-
--matecu-file-input-bg-hover: #ffebe6;
|
|
200
|
-
}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
```html
|
|
204
|
-
<!-- HTML -->
|
|
205
|
-
<matecu-file-input class="my-custom-file-input"> </matecu-file-input>
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Angular Component Customization
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
// In your component
|
|
212
|
-
@Component({
|
|
213
|
-
selector: 'app-upload',
|
|
214
|
-
template: ` <matecu-file-input class="branded-upload" [multiple]="true"> </matecu-file-input> `,
|
|
215
|
-
styles: [
|
|
216
|
-
`
|
|
217
|
-
.branded-upload {
|
|
218
|
-
--matecu-file-input-color-primary: #your-primary-color;
|
|
219
|
-
--matecu-file-input-color-success: #your-success-color;
|
|
220
|
-
--matecu-file-input-border-radius-lg: 16px;
|
|
221
|
-
}
|
|
222
|
-
`,
|
|
223
|
-
],
|
|
224
|
-
})
|
|
225
|
-
export class UploadComponent {}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### SCSS/Sass Variables
|
|
229
|
-
|
|
230
|
-
```scss
|
|
231
|
-
// Define your theme variables
|
|
232
|
-
$primary-color: #6366f1;
|
|
233
|
-
$success-color: #10b981;
|
|
234
|
-
$border-radius: 8px;
|
|
235
|
-
|
|
236
|
-
// Apply to the component
|
|
237
|
-
.my-file-input {
|
|
238
|
-
--matecu-file-input-color-primary: #{$primary-color};
|
|
239
|
-
--matecu-file-input-color-success: #{$success-color};
|
|
240
|
-
--matecu-file-input-border-radius-lg: #{$border-radius};
|
|
241
|
-
}
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
## 🔍 Best Practices
|
|
245
|
-
|
|
246
|
-
1. **Always use the full variable name** to avoid conflicts
|
|
247
|
-
2. **Test in different states** (hover, error, success, loading)
|
|
248
|
-
3. **Ensure sufficient contrast** for accessibility
|
|
249
|
-
4. **Consider responsive behavior** when customizing sizes
|
|
250
|
-
5. **Use semantic color names** in your design system
|
|
251
|
-
6. **Document your customizations** for team consistency
|
|
252
|
-
|
|
253
|
-
## 🎨 Design System Integration
|
|
254
|
-
|
|
255
|
-
The component variables are designed to integrate seamlessly with popular design systems:
|
|
256
|
-
|
|
257
|
-
- **Tailwind CSS**: Map to your Tailwind config colors
|
|
258
|
-
- **Material Design**: Use Material color palette
|
|
259
|
-
- **Bootstrap**: Integrate with Bootstrap theme colors
|
|
260
|
-
- **Custom Design System**: Map to your brand colors and spacing
|
|
261
|
-
|
|
262
|
-
## 🚀 Advanced Customization
|
|
263
|
-
|
|
264
|
-
For more complex customizations, you can also override specific component styles while respecting the CSS variable system:
|
|
265
|
-
|
|
266
|
-
```css
|
|
267
|
-
.advanced-file-input {
|
|
268
|
-
/* Use variables for consistency */
|
|
269
|
-
--matecu-file-input-color-primary: #your-color;
|
|
270
|
-
|
|
271
|
-
/* Additional custom styles */
|
|
272
|
-
.file-input-container {
|
|
273
|
-
backdrop-filter: blur(10px);
|
|
274
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.select-button {
|
|
278
|
-
font-size: 18px;
|
|
279
|
-
padding: 16px 32px;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
This approach ensures your customizations work with future component updates while maintaining design consistency.
|