angular-matecu 4.2.3 → 4.2.6
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 +330 -478
- package/fesm2022/angular-matecu.mjs.map +1 -1
- package/package.json +1 -1
- package/types/angular-matecu.d.ts +165 -170
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
2
|
+
import { Injectable, signal, input, effect, HostBinding, Component, NgModule, output, ViewChild, Inject, computed, Input, forwardRef, ChangeDetectionStrategy } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { BehaviorSubject, Subject, fromEvent, startWith,
|
|
5
|
+
import { BehaviorSubject, Subject, fromEvent, startWith, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, filter, tap as tap$1, takeUntil as takeUntil$1 } from 'rxjs';
|
|
6
6
|
import { tap, takeUntil, map, debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
7
7
|
import * as i2$1 from '@angular/material/button';
|
|
8
8
|
import { MatButtonModule } from '@angular/material/button';
|
|
@@ -23,7 +23,6 @@ import * as i5 from '@angular/material/progress-spinner';
|
|
|
23
23
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
24
24
|
import * as i1$4 from '@angular/material/form-field';
|
|
25
25
|
import { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';
|
|
26
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
27
26
|
import * as i1$3 from '@angular/cdk/a11y';
|
|
28
27
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
29
28
|
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
@@ -85,57 +84,51 @@ class MatecuSpinnerComponent {
|
|
|
85
84
|
cdr;
|
|
86
85
|
destroy$ = new Subject();
|
|
87
86
|
hiddenClass = 'matecu-spinner--hidden';
|
|
88
|
-
activeCache = false;
|
|
87
|
+
activeCache = signal(false, ...(ngDevMode ? [{ debugName: "activeCache" }] : []));
|
|
89
88
|
className = 'matecu-spinner';
|
|
90
|
-
color = '#2196F3';
|
|
91
|
-
global = false;
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
color = input('#2196F3', ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
90
|
+
global = input(false, ...(ngDevMode ? [{ debugName: "global" }] : []));
|
|
91
|
+
active = input(false, ...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
92
|
+
size = input('70px', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
93
|
+
get isActive() {
|
|
94
|
+
return this.activeCache();
|
|
94
95
|
}
|
|
95
|
-
set active(value) {
|
|
96
|
-
if (this.global) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
this.activeCache = value;
|
|
100
|
-
this.className = value
|
|
101
|
-
? this.className.replace(` ${this.hiddenClass}`, '')
|
|
102
|
-
: (this.className += ` ${this.hiddenClass}`);
|
|
103
|
-
}
|
|
104
|
-
size = '70px';
|
|
105
96
|
constructor(spinnerService, cdr) {
|
|
106
97
|
this.spinnerService = spinnerService;
|
|
107
98
|
this.cdr = cdr;
|
|
99
|
+
effect(() => {
|
|
100
|
+
if (this.global()) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const value = this.active();
|
|
104
|
+
this.activeCache.set(value);
|
|
105
|
+
this.className = value
|
|
106
|
+
? this.className.replace(` ${this.hiddenClass}`, '')
|
|
107
|
+
: (this.className += ` ${this.hiddenClass}`);
|
|
108
|
+
});
|
|
108
109
|
}
|
|
109
110
|
ngOnDestroy() {
|
|
110
111
|
this.destroy$.next();
|
|
111
112
|
this.destroy$.complete();
|
|
112
113
|
}
|
|
113
114
|
ngOnInit() {
|
|
114
|
-
if (this.global) {
|
|
115
|
+
if (this.global()) {
|
|
115
116
|
this.spinnerService
|
|
116
117
|
.watch()
|
|
117
|
-
.pipe(tap((value) =>
|
|
118
|
+
.pipe(tap((value) => this.activeCache.set(value)), tap(() => this.cdr.detectChanges()), takeUntil(this.destroy$))
|
|
118
119
|
.subscribe();
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuSpinnerComponent, deps: [{ token: MatecuSpinnerService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
122
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuSpinnerComponent, isStandalone: true, selector: "matecu-spinner", inputs: { color: "color", global: "global", active: "active", size: "size" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "@if(
|
|
123
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuSpinnerComponent, isStandalone: true, selector: "matecu-spinner", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, global: { classPropertyName: "global", publicName: "global", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "@if(isActive){\n\n<svg xmlns:svg=\"http://www.w3.org/2000/svg\" [attr.width]=\"size()\" [attr.height]=\"size()\"\n xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.0\" viewBox=\"0 0 128 128\"\n xml:space=\"preserve\">\n <rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"transparent\" />\n <g>\n <path class=\"matecu-spinner__100\" d=\"M122.5 69.25H96.47a33.1 33.1 0 0 0 0-10.5h26.05a5.25 5.25 0 0 1 0 10.5z\"\n [attr.fill]=\"color()\" fill-opacity=\"1\" />\n <path class=\"matecu-spinner__30\"\n d=\"M112.04 97.83L89.47 84.8a33.1 33.1 0 0 0 5.25-9.1l22.57 13.03a5.25 5.25 0 0 1-5.28 9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M88.68 117.35L75.65 94.78a33.1 33.1 0 0 0 9.1-5.25l13.02 22.57a5.25 5.25 0 1 1-9.1 5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\" d=\"M58.7 122.57V96.5a33.1 33.1 0 0 0 10.5 0v26.07a5.25 5.25 0 0 1-10.5 0z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M30.1 112.1l13.04-22.57a33.1 33.1 0 0 0 9.1 5.25L39.2 117.35a5.25 5.25 0 1 1-9.1-5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M10.6 88.74L33.16 75.7a33.1 33.1 0 0 0 5.25 9.1L15.88 97.83a5.25 5.25 0 1 1-5.25-9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__40\" d=\"M5.37 58.75h26.06a33.1 33.1 0 0 0 0 10.5H5.37a5.25 5.25 0 0 1 0-10.5z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.4\" />\n <path class=\"matecu-spinner__50\"\n d=\"M15.85 30.17L38.4 43.2a33.1 33.1 0 0 0-5.24 9.1L10.6 39.25a5.25 5.25 0 1 1 5.25-9.1z\" [attr.fill]=\"color()\"\n fill-opacity=\"0.5\" />\n <path class=\"matecu-spinner__60\"\n d=\"M39.2 10.65l13.03 22.57a33.1 33.1 0 0 0-9.1 5.25l-13-22.57a5.25 5.25 0 1 1 9.1-5.25z\" [attr.fill]=\"color()\"\n fill-opacity=\"0.6\" />\n <path class=\"matecu-spinner__70\" d=\"M69.2 5.43V31.5a33.1 33.1 0 0 0-10.5 0V5.42a5.25 5.25 0 1 1 10.5 0z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.7\" />\n <path class=\"matecu-spinner__80\"\n d=\"M97.77 15.9L84.75 38.47a33.1 33.1 0 0 0-9.1-5.25l13.03-22.57a5.25 5.25 0 1 1 9.1 5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.8\" />\n <path class=\"matecu-spinner__90\"\n d=\"M117.3 39.26L94.7 52.3a33.1 33.1 0 0 0-5.25-9.1l22.57-13.03a5.25 5.25 0 0 1 5.25 9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.9\" />\n <animateTransform attributeName=\"transform\" type=\"rotate\"\n values=\"0 64 64;30 64 64;60 64 64;90 64 64;120 64 64;150 64 64;180 64 64;210 64 64;240 64 64;270 64 64;300 64 64;330 64 64\"\n calcMode=\"discrete\" dur=\"600ms\" repeatCount=\"indefinite\"></animateTransform>\n </g>\n</svg>\n}", styles: [".matecu-spinner{display:flex;align-items:center;justify-content:center}.matecu-spinner>svg{width:80px;height:80px}.matecu-spinner__hidden{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
123
124
|
}
|
|
124
125
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuSpinnerComponent, decorators: [{
|
|
125
126
|
type: Component,
|
|
126
|
-
args: [{ selector: 'matecu-spinner', standalone: true, imports: [CommonModule], template: "@if(
|
|
127
|
+
args: [{ selector: 'matecu-spinner', standalone: true, imports: [CommonModule], template: "@if(isActive){\n\n<svg xmlns:svg=\"http://www.w3.org/2000/svg\" [attr.width]=\"size()\" [attr.height]=\"size()\"\n xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.0\" viewBox=\"0 0 128 128\"\n xml:space=\"preserve\">\n <rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"transparent\" />\n <g>\n <path class=\"matecu-spinner__100\" d=\"M122.5 69.25H96.47a33.1 33.1 0 0 0 0-10.5h26.05a5.25 5.25 0 0 1 0 10.5z\"\n [attr.fill]=\"color()\" fill-opacity=\"1\" />\n <path class=\"matecu-spinner__30\"\n d=\"M112.04 97.83L89.47 84.8a33.1 33.1 0 0 0 5.25-9.1l22.57 13.03a5.25 5.25 0 0 1-5.28 9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M88.68 117.35L75.65 94.78a33.1 33.1 0 0 0 9.1-5.25l13.02 22.57a5.25 5.25 0 1 1-9.1 5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\" d=\"M58.7 122.57V96.5a33.1 33.1 0 0 0 10.5 0v26.07a5.25 5.25 0 0 1-10.5 0z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M30.1 112.1l13.04-22.57a33.1 33.1 0 0 0 9.1 5.25L39.2 117.35a5.25 5.25 0 1 1-9.1-5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__30\"\n d=\"M10.6 88.74L33.16 75.7a33.1 33.1 0 0 0 5.25 9.1L15.88 97.83a5.25 5.25 0 1 1-5.25-9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.3\" />\n <path class=\"matecu-spinner__40\" d=\"M5.37 58.75h26.06a33.1 33.1 0 0 0 0 10.5H5.37a5.25 5.25 0 0 1 0-10.5z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.4\" />\n <path class=\"matecu-spinner__50\"\n d=\"M15.85 30.17L38.4 43.2a33.1 33.1 0 0 0-5.24 9.1L10.6 39.25a5.25 5.25 0 1 1 5.25-9.1z\" [attr.fill]=\"color()\"\n fill-opacity=\"0.5\" />\n <path class=\"matecu-spinner__60\"\n d=\"M39.2 10.65l13.03 22.57a33.1 33.1 0 0 0-9.1 5.25l-13-22.57a5.25 5.25 0 1 1 9.1-5.25z\" [attr.fill]=\"color()\"\n fill-opacity=\"0.6\" />\n <path class=\"matecu-spinner__70\" d=\"M69.2 5.43V31.5a33.1 33.1 0 0 0-10.5 0V5.42a5.25 5.25 0 1 1 10.5 0z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.7\" />\n <path class=\"matecu-spinner__80\"\n d=\"M97.77 15.9L84.75 38.47a33.1 33.1 0 0 0-9.1-5.25l13.03-22.57a5.25 5.25 0 1 1 9.1 5.25z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.8\" />\n <path class=\"matecu-spinner__90\"\n d=\"M117.3 39.26L94.7 52.3a33.1 33.1 0 0 0-5.25-9.1l22.57-13.03a5.25 5.25 0 0 1 5.25 9.1z\"\n [attr.fill]=\"color()\" fill-opacity=\"0.9\" />\n <animateTransform attributeName=\"transform\" type=\"rotate\"\n values=\"0 64 64;30 64 64;60 64 64;90 64 64;120 64 64;150 64 64;180 64 64;210 64 64;240 64 64;270 64 64;300 64 64;330 64 64\"\n calcMode=\"discrete\" dur=\"600ms\" repeatCount=\"indefinite\"></animateTransform>\n </g>\n</svg>\n}", styles: [".matecu-spinner{display:flex;align-items:center;justify-content:center}.matecu-spinner>svg{width:80px;height:80px}.matecu-spinner__hidden{display:none}\n"] }]
|
|
127
128
|
}], ctorParameters: () => [{ type: MatecuSpinnerService }, { type: i0.ChangeDetectorRef }], propDecorators: { className: [{
|
|
128
129
|
type: HostBinding,
|
|
129
130
|
args: ['class']
|
|
130
|
-
}], color: [{
|
|
131
|
-
type: Input
|
|
132
|
-
}], global: [{
|
|
133
|
-
type: Input
|
|
134
|
-
}], active: [{
|
|
135
|
-
type: Input
|
|
136
|
-
}], size: [{
|
|
137
|
-
type: Input
|
|
138
|
-
}] } });
|
|
131
|
+
}], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], global: [{ type: i0.Input, args: [{ isSignal: true, alias: "global", required: false }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
139
132
|
|
|
140
133
|
class MatecuSpinnerModule {
|
|
141
134
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -159,39 +152,36 @@ class MatecuTopbarLayoutComponent {
|
|
|
159
152
|
elementRef;
|
|
160
153
|
changeDetector;
|
|
161
154
|
zone;
|
|
162
|
-
_scrolled = false;
|
|
163
|
-
_prominent = false;
|
|
155
|
+
_scrolled = signal(false, ...(ngDevMode ? [{ debugName: "_scrolled" }] : []));
|
|
164
156
|
get scrolled() {
|
|
165
|
-
return this._scrolled;
|
|
157
|
+
return this._scrolled();
|
|
166
158
|
}
|
|
167
159
|
set scrolled(value) {
|
|
168
|
-
this._scrolled
|
|
160
|
+
this._scrolled.set(value);
|
|
169
161
|
this.className = this.className.replace(/scrolled/g, '').trim();
|
|
170
162
|
if (this.scrolled) {
|
|
171
163
|
this.className = `${this.className} scrolled`;
|
|
172
164
|
}
|
|
173
165
|
}
|
|
174
166
|
destroy$ = new Subject();
|
|
175
|
-
mobileStyle = false;
|
|
176
|
-
mobileStyleChange =
|
|
177
|
-
mobileWidth = 768;
|
|
178
|
-
whenResize =
|
|
179
|
-
|
|
180
|
-
return this._prominent;
|
|
181
|
-
}
|
|
182
|
-
set prominent(value) {
|
|
183
|
-
this._prominent = value;
|
|
184
|
-
this.className = this.className.replace(/prominent/g, '').trim();
|
|
185
|
-
if (this.prominent) {
|
|
186
|
-
this.className = `${this.className} prominent`;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
167
|
+
mobileStyle = input(false, ...(ngDevMode ? [{ debugName: "mobileStyle" }] : []));
|
|
168
|
+
mobileStyleChange = output();
|
|
169
|
+
mobileWidth = input(768, ...(ngDevMode ? [{ debugName: "mobileWidth" }] : []));
|
|
170
|
+
whenResize = output();
|
|
171
|
+
prominent = input(false, ...(ngDevMode ? [{ debugName: "prominent" }] : []));
|
|
189
172
|
className = 'matecu-topbar-layout';
|
|
190
173
|
bodyElement;
|
|
191
174
|
constructor(elementRef, changeDetector, zone) {
|
|
192
175
|
this.elementRef = elementRef;
|
|
193
176
|
this.changeDetector = changeDetector;
|
|
194
177
|
this.zone = zone;
|
|
178
|
+
effect(() => {
|
|
179
|
+
const prominentValue = this.prominent();
|
|
180
|
+
this.className = this.className.replace(/prominent/g, '').trim();
|
|
181
|
+
if (prominentValue) {
|
|
182
|
+
this.className = `${this.className} prominent`;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
195
185
|
}
|
|
196
186
|
ngOnDestroy() {
|
|
197
187
|
this.destroy$.next();
|
|
@@ -216,9 +206,9 @@ class MatecuTopbarLayoutComponent {
|
|
|
216
206
|
if (!width) {
|
|
217
207
|
return;
|
|
218
208
|
}
|
|
219
|
-
|
|
209
|
+
const isMobileStyle = width <= this.mobileWidth();
|
|
220
210
|
this.zone.run(() => {
|
|
221
|
-
this.mobileStyleChange.emit(
|
|
211
|
+
this.mobileStyleChange.emit(isMobileStyle);
|
|
222
212
|
this.whenResize.emit(width);
|
|
223
213
|
});
|
|
224
214
|
});
|
|
@@ -240,22 +230,12 @@ class MatecuTopbarLayoutComponent {
|
|
|
240
230
|
});
|
|
241
231
|
}
|
|
242
232
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarLayoutComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
243
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
233
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.3", type: MatecuTopbarLayoutComponent, isStandalone: true, selector: "matecu-topbar-layout", inputs: { mobileStyle: { classPropertyName: "mobileStyle", publicName: "mobileStyle", isSignal: true, isRequired: false, transformFunction: null }, mobileWidth: { classPropertyName: "mobileWidth", publicName: "mobileWidth", isSignal: true, isRequired: false, transformFunction: null }, prominent: { classPropertyName: "prominent", publicName: "prominent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { mobileStyleChange: "mobileStyleChange", whenResize: "whenResize" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "bodyElement", first: true, predicate: ["mtbBody"], descendants: true }], ngImport: i0, template: "<div class=\"matecu-topbar-layout__bar\">\n <ng-content select=\"matecu-topbar-header-row[first-row]\"></ng-content>\n <ng-content select=\"matecu-topbar-header-row[second-row]\"></ng-content>\n</div>\n<div class=\"matecu-topbar-layout__body\" #mtbBody>\n <ng-content select=\"matecu-topbar-body\"></ng-content>\n</div>\n", styles: [":host,.matecu-topbar-layout{position:relative;box-sizing:border-box}:host *,.matecu-topbar-layout *{box-sizing:border-box}:host,.matecu-topbar-layout{display:grid;grid-template-rows:auto 1fr;box-sizing:border-box;border:var(--mtb-border, none);margin:var(--mtb-margin, 0px);padding:0;width:var(--mtb-width, 100%);height:var(--mtb-height, 100vh);overflow:hidden}:host__bar,.matecu-topbar-layout__bar{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;background-color:var(--mtb-primary-color, #3f51b5);color:var(--mtb-bar-color, #fff);width:100%;padding:0;margin:0;min-height:var(--mtb-bar-height, 64px);transition:all .3s}:host__body,.matecu-topbar-layout__body{padding:0;margin:0;overflow-y:auto}:host.prominent .matecu-topbar-layout__bar,.matecu-topbar-layout.prominent .matecu-topbar-layout__bar{min-height:var(--mtb-bar-prominent-height, 128px)}:host.scrolled .matecu-topbar-layout__bar,.matecu-topbar-layout.scrolled .matecu-topbar-layout__bar{box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;min-height:var(--mtb-bar-height, 64px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatToolbarModule }] });
|
|
244
234
|
}
|
|
245
235
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarLayoutComponent, decorators: [{
|
|
246
236
|
type: Component,
|
|
247
237
|
args: [{ selector: 'matecu-topbar-layout', standalone: true, imports: [CommonModule, MatButtonModule, MatIconModule, MatToolbarModule], template: "<div class=\"matecu-topbar-layout__bar\">\n <ng-content select=\"matecu-topbar-header-row[first-row]\"></ng-content>\n <ng-content select=\"matecu-topbar-header-row[second-row]\"></ng-content>\n</div>\n<div class=\"matecu-topbar-layout__body\" #mtbBody>\n <ng-content select=\"matecu-topbar-body\"></ng-content>\n</div>\n", styles: [":host,.matecu-topbar-layout{position:relative;box-sizing:border-box}:host *,.matecu-topbar-layout *{box-sizing:border-box}:host,.matecu-topbar-layout{display:grid;grid-template-rows:auto 1fr;box-sizing:border-box;border:var(--mtb-border, none);margin:var(--mtb-margin, 0px);padding:0;width:var(--mtb-width, 100%);height:var(--mtb-height, 100vh);overflow:hidden}:host__bar,.matecu-topbar-layout__bar{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;background-color:var(--mtb-primary-color, #3f51b5);color:var(--mtb-bar-color, #fff);width:100%;padding:0;margin:0;min-height:var(--mtb-bar-height, 64px);transition:all .3s}:host__body,.matecu-topbar-layout__body{padding:0;margin:0;overflow-y:auto}:host.prominent .matecu-topbar-layout__bar,.matecu-topbar-layout.prominent .matecu-topbar-layout__bar{min-height:var(--mtb-bar-prominent-height, 128px)}:host.scrolled .matecu-topbar-layout__bar,.matecu-topbar-layout.scrolled .matecu-topbar-layout__bar{box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;min-height:var(--mtb-bar-height, 64px)}\n"] }]
|
|
248
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], propDecorators: { mobileStyle: [{
|
|
249
|
-
type: Input
|
|
250
|
-
}], mobileStyleChange: [{
|
|
251
|
-
type: Output
|
|
252
|
-
}], mobileWidth: [{
|
|
253
|
-
type: Input
|
|
254
|
-
}], whenResize: [{
|
|
255
|
-
type: Output
|
|
256
|
-
}], prominent: [{
|
|
257
|
-
type: Input
|
|
258
|
-
}], className: [{
|
|
238
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], propDecorators: { mobileStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileStyle", required: false }] }], mobileStyleChange: [{ type: i0.Output, args: ["mobileStyleChange"] }], mobileWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileWidth", required: false }] }], whenResize: [{ type: i0.Output, args: ["whenResize"] }], prominent: [{ type: i0.Input, args: [{ isSignal: true, alias: "prominent", required: false }] }], className: [{
|
|
259
239
|
type: HostBinding,
|
|
260
240
|
args: ['class']
|
|
261
241
|
}], bodyElement: [{
|
|
@@ -292,34 +272,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
292
272
|
}] } });
|
|
293
273
|
|
|
294
274
|
class MatecuTopbarFabComponent {
|
|
295
|
-
_mobileStyle = false;
|
|
296
275
|
mainClassName = 'matecu-topbar-fab';
|
|
297
|
-
display = true;
|
|
298
|
-
|
|
299
|
-
return this._mobileStyle;
|
|
300
|
-
}
|
|
301
|
-
set mobileStyle(value) {
|
|
302
|
-
this._mobileStyle = value;
|
|
303
|
-
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
304
|
-
if (this._mobileStyle) {
|
|
305
|
-
this.className = `${this.className} mobile-style`;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
276
|
+
display = input(true, ...(ngDevMode ? [{ debugName: "display" }] : []));
|
|
277
|
+
mobileStyle = input(false, ...(ngDevMode ? [{ debugName: "mobileStyle" }] : []));
|
|
308
278
|
className = this.mainClassName;
|
|
279
|
+
constructor() {
|
|
280
|
+
effect(() => {
|
|
281
|
+
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
282
|
+
if (this.mobileStyle()) {
|
|
283
|
+
this.className = `${this.className} mobile-style`;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
309
287
|
get color() {
|
|
310
|
-
return this.display ? 'flex' : 'none';
|
|
288
|
+
return this.display() ? 'flex' : 'none';
|
|
311
289
|
}
|
|
312
290
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarFabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
313
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarFabComponent, isStandalone: true, selector: "matecu-topbar-fab", inputs: { display: "display", mobileStyle: "mobileStyle" }, host: { properties: { "class": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display){\n<ng-content></ng-content>\n}", styles: [":host,:host *,.matecu-topbar-fab,.matecu-topbar-fab *{box-sizing:border-box;outline:none}:host,.matecu-topbar-fab{display:flex;align-self:flex-end;align-items:flex-start;transform:translateY(50%);transition:all .3s ease-in-out}:host.mobile-style,.matecu-topbar-fab.mobile-style{position:absolute;transform:translate(0);bottom:var(--mtb-fab-mobile-bottom-position, 20px);right:var(--mtb-fab-mobile-right-position, 20px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
291
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarFabComponent, isStandalone: true, selector: "matecu-topbar-fab", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, mobileStyle: { classPropertyName: "mobileStyle", publicName: "mobileStyle", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display()){\n<ng-content></ng-content>\n}", styles: [":host,:host *,.matecu-topbar-fab,.matecu-topbar-fab *{box-sizing:border-box;outline:none}:host,.matecu-topbar-fab{display:flex;align-self:flex-end;align-items:flex-start;transform:translateY(50%);transition:all .3s ease-in-out}:host.mobile-style,.matecu-topbar-fab.mobile-style{position:absolute;transform:translate(0);bottom:var(--mtb-fab-mobile-bottom-position, 20px);right:var(--mtb-fab-mobile-right-position, 20px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
314
292
|
}
|
|
315
293
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarFabComponent, decorators: [{
|
|
316
294
|
type: Component,
|
|
317
|
-
args: [{ selector: 'matecu-topbar-fab', standalone: true, imports: [CommonModule, MatButtonModule], template: "@if(display){\n<ng-content></ng-content>\n}", styles: [":host,:host *,.matecu-topbar-fab,.matecu-topbar-fab *{box-sizing:border-box;outline:none}:host,.matecu-topbar-fab{display:flex;align-self:flex-end;align-items:flex-start;transform:translateY(50%);transition:all .3s ease-in-out}:host.mobile-style,.matecu-topbar-fab.mobile-style{position:absolute;transform:translate(0);bottom:var(--mtb-fab-mobile-bottom-position, 20px);right:var(--mtb-fab-mobile-right-position, 20px)}\n"] }]
|
|
318
|
-
}], propDecorators: { display: [{
|
|
319
|
-
type: Input
|
|
320
|
-
}], mobileStyle: [{
|
|
321
|
-
type: Input
|
|
322
|
-
}], className: [{
|
|
295
|
+
args: [{ selector: 'matecu-topbar-fab', standalone: true, imports: [CommonModule, MatButtonModule], template: "@if(display()){\n<ng-content></ng-content>\n}", styles: [":host,:host *,.matecu-topbar-fab,.matecu-topbar-fab *{box-sizing:border-box;outline:none}:host,.matecu-topbar-fab{display:flex;align-self:flex-end;align-items:flex-start;transform:translateY(50%);transition:all .3s ease-in-out}:host.mobile-style,.matecu-topbar-fab.mobile-style{position:absolute;transform:translate(0);bottom:var(--mtb-fab-mobile-bottom-position, 20px);right:var(--mtb-fab-mobile-right-position, 20px)}\n"] }]
|
|
296
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], mobileStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileStyle", required: false }] }], className: [{
|
|
323
297
|
type: HostBinding,
|
|
324
298
|
args: ['class']
|
|
325
299
|
}], color: [{
|
|
@@ -331,37 +305,33 @@ class MatecuTopbarSearchComponent {
|
|
|
331
305
|
hasValue = false;
|
|
332
306
|
activeMobileSearch = false;
|
|
333
307
|
inputCtrl = new FormControl('');
|
|
334
|
-
_value = '';
|
|
335
|
-
_mobileStyle = false;
|
|
336
308
|
destroy$ = new Subject();
|
|
337
|
-
display = true;
|
|
338
|
-
placeholder = '';
|
|
339
|
-
delyValueChanges = 300; // valor en milisegundos
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
set value(v) {
|
|
344
|
-
this._value = v;
|
|
345
|
-
this.inputCtrl.setValue(v);
|
|
346
|
-
}
|
|
347
|
-
get mobileStyle() {
|
|
348
|
-
return this._mobileStyle;
|
|
349
|
-
}
|
|
350
|
-
set mobileStyle(value) {
|
|
351
|
-
this._mobileStyle = value;
|
|
352
|
-
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
353
|
-
if (this._mobileStyle) {
|
|
354
|
-
this.className = `${this.className} mobile-style`;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
valueChange = new EventEmitter();
|
|
309
|
+
display = input(true, ...(ngDevMode ? [{ debugName: "display" }] : []));
|
|
310
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
311
|
+
delyValueChanges = input(300, ...(ngDevMode ? [{ debugName: "delyValueChanges" }] : [])); // valor en milisegundos
|
|
312
|
+
value = input('', ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
313
|
+
mobileStyle = input(false, ...(ngDevMode ? [{ debugName: "mobileStyle" }] : []));
|
|
314
|
+
valueChange = output();
|
|
358
315
|
className = 'matecu-topbar-search';
|
|
316
|
+
constructor() {
|
|
317
|
+
effect(() => {
|
|
318
|
+
const valueInput = this.value();
|
|
319
|
+
this.inputCtrl.setValue(valueInput);
|
|
320
|
+
});
|
|
321
|
+
effect(() => {
|
|
322
|
+
const mobileStyleValue = this.mobileStyle();
|
|
323
|
+
this.className = this.className.replace(/mobile-style/g, '').trim();
|
|
324
|
+
if (mobileStyleValue) {
|
|
325
|
+
this.className = `${this.className} mobile-style`;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
359
329
|
get color() {
|
|
360
|
-
return this.display ? 'flex' : 'none';
|
|
330
|
+
return this.display() ? 'flex' : 'none';
|
|
361
331
|
}
|
|
362
332
|
ngOnInit() {
|
|
363
333
|
this.inputCtrl.valueChanges
|
|
364
|
-
.pipe(map((value) => value ?? ''), tap(this.updateHasValueFn()), debounceTime(this.delyValueChanges), distinctUntilChanged(), tap((value) => this.valueChange.emit(value)), takeUntil(this.destroy$))
|
|
334
|
+
.pipe(map((value) => value ?? ''), tap(this.updateHasValueFn()), debounceTime(this.delyValueChanges()), distinctUntilChanged(), tap((value) => this.valueChange.emit(value)), takeUntil(this.destroy$))
|
|
365
335
|
.subscribe();
|
|
366
336
|
}
|
|
367
337
|
toggleActiveMobildeSearch() {
|
|
@@ -377,30 +347,12 @@ class MatecuTopbarSearchComponent {
|
|
|
377
347
|
};
|
|
378
348
|
}
|
|
379
349
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
380
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarSearchComponent, isStandalone: true, selector: "matecu-topbar-search", inputs: { display: "display", placeholder: "placeholder", delyValueChanges: "delyValueChanges", value: "value", mobileStyle: "mobileStyle" }, outputs: { valueChange: "valueChange" }, host: { properties: { "className": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display){\n<button class=\"matecu-topbar-search-mobile-only\" [ngClass]=\"{ 'mobile-style': mobileStyle }\"\n (click)=\"toggleActiveMobildeSearch()\">\n <mat-icon>search</mat-icon>\n</button>\n<div class=\"matecu-topbar-search\" [ngClass]=\"{\n 'mobile-style': mobileStyle,\n 'active-mobile': activeMobileSearch\n }\">\n <span class=\"matecu-topbar-search__icon matecu-topbar-search__icon--search\">\n <mat-icon>search</mat-icon>\n </span>\n @if(hasValue || mobileStyle){\n <button class=\"matecu-topbar-search__icon matecu-topbar-search__icon--clear\" (click)=\"clearSearch()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <input type=\"text\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" />\n</div>\n}", styles: [".matecu-topbar-search-mobile-only{display:none;border:none;background:none;cursor:pointer;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));margin:var(--mtb-search-margin, 10px)}.matecu-topbar-search-mobile-only.mobile-style{display:block}.matecu-topbar-search,.matecu-topbar-search *{box-sizing:border-box;outline:none}.matecu-topbar-search{margin:var(--mtb-search-margin, 10px);position:relative;display:flex;align-items:center;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));max-height:var(--bar-height, 64px)}.matecu-topbar-search input{width:var(--mtb-search-width, 200px);min-width:var(--mtb-search-width, 200px);height:var(--mtb-search-height, 40px);padding:var(--mtb-search-pading, 3px 35px);border-radius:4px;border:1px solid;border:var(--mtb-search-border, none);background-color:var(--search-background-color, rgba(255, 255, 255, .3019607843));color:currentColor;transition:all .3s ease-in-out}.matecu-topbar-search input::placeholder{color:var(--mtb-search-color, var(--mtb-bar-color, #fff));opacity:1}.matecu-topbar-search input:focus{min-width:var(--mtb-search-width-large, 290px)}.matecu-topbar-search__icon{position:absolute;top:50%;transform:translateY(-50%);padding:0}.matecu-topbar-search__icon--search{left:6px}.matecu-topbar-search__icon--clear{border:0px;background:0px;cursor:pointer;color:currentColor;right:6px}.mobile-style.matecu-topbar-search{position:absolute;top:0;left:0;right:0;border-bottom:1px solid;border-bottom-color:var(--mtb-search-border-bottom-color, #ededed);z-index:3;padding:0;margin:0;height:64px;color:var(--mtb-search-mobile-color, #000);transform:translateY(-120%);transition:all .3s ease-in-out}.mobile-style.matecu-topbar-search.active-mobile{transform:translateY(0)}.mobile-style.matecu-topbar-search input{background-color:#fff;height:100%;width:100%;border-radius:0}.mobile-style.matecu-topbar-search input::placeholder{color:var(--mtb-search-mobile-color, #000)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
350
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarSearchComponent, isStandalone: true, selector: "matecu-topbar-search", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, delyValueChanges: { classPropertyName: "delyValueChanges", publicName: "delyValueChanges", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mobileStyle: { classPropertyName: "mobileStyle", publicName: "mobileStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { properties: { "className": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display()){\n<button class=\"matecu-topbar-search-mobile-only\" [ngClass]=\"{ 'mobile-style': mobileStyle() }\"\n (click)=\"toggleActiveMobildeSearch()\">\n <mat-icon>search</mat-icon>\n</button>\n<div class=\"matecu-topbar-search\" [ngClass]=\"{\n 'mobile-style': mobileStyle(),\n 'active-mobile': activeMobileSearch\n }\">\n <span class=\"matecu-topbar-search__icon matecu-topbar-search__icon--search\">\n <mat-icon>search</mat-icon>\n </span>\n @if(hasValue || mobileStyle()){\n <button class=\"matecu-topbar-search__icon matecu-topbar-search__icon--clear\" (click)=\"clearSearch()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <input type=\"text\" [placeholder]=\"placeholder()\" [formControl]=\"inputCtrl\" />\n</div>\n}", styles: [".matecu-topbar-search-mobile-only{display:none;border:none;background:none;cursor:pointer;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));margin:var(--mtb-search-margin, 10px)}.matecu-topbar-search-mobile-only.mobile-style{display:block}.matecu-topbar-search,.matecu-topbar-search *{box-sizing:border-box;outline:none}.matecu-topbar-search{margin:var(--mtb-search-margin, 10px);position:relative;display:flex;align-items:center;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));max-height:var(--bar-height, 64px)}.matecu-topbar-search input{width:var(--mtb-search-width, 200px);min-width:var(--mtb-search-width, 200px);height:var(--mtb-search-height, 40px);padding:var(--mtb-search-pading, 3px 35px);border-radius:4px;border:1px solid;border:var(--mtb-search-border, none);background-color:var(--search-background-color, rgba(255, 255, 255, .3019607843));color:currentColor;transition:all .3s ease-in-out}.matecu-topbar-search input::placeholder{color:var(--mtb-search-color, var(--mtb-bar-color, #fff));opacity:1}.matecu-topbar-search input:focus{min-width:var(--mtb-search-width-large, 290px)}.matecu-topbar-search__icon{position:absolute;top:50%;transform:translateY(-50%);padding:0}.matecu-topbar-search__icon--search{left:6px}.matecu-topbar-search__icon--clear{border:0px;background:0px;cursor:pointer;color:currentColor;right:6px}.mobile-style.matecu-topbar-search{position:absolute;top:0;left:0;right:0;border-bottom:1px solid;border-bottom-color:var(--mtb-search-border-bottom-color, #ededed);z-index:3;padding:0;margin:0;height:64px;color:var(--mtb-search-mobile-color, #000);transform:translateY(-120%);transition:all .3s ease-in-out}.mobile-style.matecu-topbar-search.active-mobile{transform:translateY(0)}.mobile-style.matecu-topbar-search input{background-color:#fff;height:100%;width:100%;border-radius:0}.mobile-style.matecu-topbar-search input::placeholder{color:var(--mtb-search-mobile-color, #000)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }] });
|
|
381
351
|
}
|
|
382
352
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarSearchComponent, decorators: [{
|
|
383
353
|
type: Component,
|
|
384
|
-
args: [{ selector: 'matecu-topbar-search', standalone: true, imports: [
|
|
385
|
-
|
|
386
|
-
FormsModule,
|
|
387
|
-
ReactiveFormsModule,
|
|
388
|
-
MatIconModule,
|
|
389
|
-
MatButtonModule,
|
|
390
|
-
], template: "@if(display){\n<button class=\"matecu-topbar-search-mobile-only\" [ngClass]=\"{ 'mobile-style': mobileStyle }\"\n (click)=\"toggleActiveMobildeSearch()\">\n <mat-icon>search</mat-icon>\n</button>\n<div class=\"matecu-topbar-search\" [ngClass]=\"{\n 'mobile-style': mobileStyle,\n 'active-mobile': activeMobileSearch\n }\">\n <span class=\"matecu-topbar-search__icon matecu-topbar-search__icon--search\">\n <mat-icon>search</mat-icon>\n </span>\n @if(hasValue || mobileStyle){\n <button class=\"matecu-topbar-search__icon matecu-topbar-search__icon--clear\" (click)=\"clearSearch()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <input type=\"text\" [placeholder]=\"placeholder\" [formControl]=\"inputCtrl\" />\n</div>\n}", styles: [".matecu-topbar-search-mobile-only{display:none;border:none;background:none;cursor:pointer;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));margin:var(--mtb-search-margin, 10px)}.matecu-topbar-search-mobile-only.mobile-style{display:block}.matecu-topbar-search,.matecu-topbar-search *{box-sizing:border-box;outline:none}.matecu-topbar-search{margin:var(--mtb-search-margin, 10px);position:relative;display:flex;align-items:center;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));max-height:var(--bar-height, 64px)}.matecu-topbar-search input{width:var(--mtb-search-width, 200px);min-width:var(--mtb-search-width, 200px);height:var(--mtb-search-height, 40px);padding:var(--mtb-search-pading, 3px 35px);border-radius:4px;border:1px solid;border:var(--mtb-search-border, none);background-color:var(--search-background-color, rgba(255, 255, 255, .3019607843));color:currentColor;transition:all .3s ease-in-out}.matecu-topbar-search input::placeholder{color:var(--mtb-search-color, var(--mtb-bar-color, #fff));opacity:1}.matecu-topbar-search input:focus{min-width:var(--mtb-search-width-large, 290px)}.matecu-topbar-search__icon{position:absolute;top:50%;transform:translateY(-50%);padding:0}.matecu-topbar-search__icon--search{left:6px}.matecu-topbar-search__icon--clear{border:0px;background:0px;cursor:pointer;color:currentColor;right:6px}.mobile-style.matecu-topbar-search{position:absolute;top:0;left:0;right:0;border-bottom:1px solid;border-bottom-color:var(--mtb-search-border-bottom-color, #ededed);z-index:3;padding:0;margin:0;height:64px;color:var(--mtb-search-mobile-color, #000);transform:translateY(-120%);transition:all .3s ease-in-out}.mobile-style.matecu-topbar-search.active-mobile{transform:translateY(0)}.mobile-style.matecu-topbar-search input{background-color:#fff;height:100%;width:100%;border-radius:0}.mobile-style.matecu-topbar-search input::placeholder{color:var(--mtb-search-mobile-color, #000)}\n"] }]
|
|
391
|
-
}], propDecorators: { display: [{
|
|
392
|
-
type: Input
|
|
393
|
-
}], placeholder: [{
|
|
394
|
-
type: Input
|
|
395
|
-
}], delyValueChanges: [{
|
|
396
|
-
type: Input
|
|
397
|
-
}], value: [{
|
|
398
|
-
type: Input
|
|
399
|
-
}], mobileStyle: [{
|
|
400
|
-
type: Input
|
|
401
|
-
}], valueChange: [{
|
|
402
|
-
type: Output
|
|
403
|
-
}], className: [{
|
|
354
|
+
args: [{ selector: 'matecu-topbar-search', standalone: true, imports: [CommonModule, FormsModule, ReactiveFormsModule, MatIconModule, MatButtonModule], template: "@if(display()){\n<button class=\"matecu-topbar-search-mobile-only\" [ngClass]=\"{ 'mobile-style': mobileStyle() }\"\n (click)=\"toggleActiveMobildeSearch()\">\n <mat-icon>search</mat-icon>\n</button>\n<div class=\"matecu-topbar-search\" [ngClass]=\"{\n 'mobile-style': mobileStyle(),\n 'active-mobile': activeMobileSearch\n }\">\n <span class=\"matecu-topbar-search__icon matecu-topbar-search__icon--search\">\n <mat-icon>search</mat-icon>\n </span>\n @if(hasValue || mobileStyle()){\n <button class=\"matecu-topbar-search__icon matecu-topbar-search__icon--clear\" (click)=\"clearSearch()\">\n <mat-icon>close</mat-icon>\n </button>\n }\n <input type=\"text\" [placeholder]=\"placeholder()\" [formControl]=\"inputCtrl\" />\n</div>\n}", styles: [".matecu-topbar-search-mobile-only{display:none;border:none;background:none;cursor:pointer;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));margin:var(--mtb-search-margin, 10px)}.matecu-topbar-search-mobile-only.mobile-style{display:block}.matecu-topbar-search,.matecu-topbar-search *{box-sizing:border-box;outline:none}.matecu-topbar-search{margin:var(--mtb-search-margin, 10px);position:relative;display:flex;align-items:center;color:var(--mtb-search-color, var(--mtb-bar-color, #fff));max-height:var(--bar-height, 64px)}.matecu-topbar-search input{width:var(--mtb-search-width, 200px);min-width:var(--mtb-search-width, 200px);height:var(--mtb-search-height, 40px);padding:var(--mtb-search-pading, 3px 35px);border-radius:4px;border:1px solid;border:var(--mtb-search-border, none);background-color:var(--search-background-color, rgba(255, 255, 255, .3019607843));color:currentColor;transition:all .3s ease-in-out}.matecu-topbar-search input::placeholder{color:var(--mtb-search-color, var(--mtb-bar-color, #fff));opacity:1}.matecu-topbar-search input:focus{min-width:var(--mtb-search-width-large, 290px)}.matecu-topbar-search__icon{position:absolute;top:50%;transform:translateY(-50%);padding:0}.matecu-topbar-search__icon--search{left:6px}.matecu-topbar-search__icon--clear{border:0px;background:0px;cursor:pointer;color:currentColor;right:6px}.mobile-style.matecu-topbar-search{position:absolute;top:0;left:0;right:0;border-bottom:1px solid;border-bottom-color:var(--mtb-search-border-bottom-color, #ededed);z-index:3;padding:0;margin:0;height:64px;color:var(--mtb-search-mobile-color, #000);transform:translateY(-120%);transition:all .3s ease-in-out}.mobile-style.matecu-topbar-search.active-mobile{transform:translateY(0)}.mobile-style.matecu-topbar-search input{background-color:#fff;height:100%;width:100%;border-radius:0}.mobile-style.matecu-topbar-search input::placeholder{color:var(--mtb-search-mobile-color, #000)}\n"] }]
|
|
355
|
+
}], ctorParameters: () => [], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], delyValueChanges: [{ type: i0.Input, args: [{ isSignal: true, alias: "delyValueChanges", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], mobileStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileStyle", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], className: [{
|
|
404
356
|
type: HostBinding
|
|
405
357
|
}], color: [{
|
|
406
358
|
type: HostBinding,
|
|
@@ -423,20 +375,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
423
375
|
}] } });
|
|
424
376
|
|
|
425
377
|
class MatecuTopbarHeaderRowComponent {
|
|
426
|
-
display = true;
|
|
378
|
+
display = input(true, ...(ngDevMode ? [{ debugName: "display" }] : []));
|
|
427
379
|
className = 'matecu-topbar-header-row';
|
|
428
380
|
get color() {
|
|
429
|
-
return this.display ? 'flex' : 'none';
|
|
381
|
+
return this.display() ? 'flex' : 'none';
|
|
430
382
|
}
|
|
431
383
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarHeaderRowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
432
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarHeaderRowComponent, isStandalone: true, selector: "matecu-topbar-header-row", inputs: { display: "display" }, host: { properties: { "class": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display){\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--left\">\n <ng-content select=\"matecu-topbar-header-column[left-column]\"></ng-content>\n</div>\n\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--right\">\n <ng-content select=\"matecu-topbar-header-column[right-column]\"></ng-content>\n</div>\n}", styles: [":host{--mtb-row-padding: 0px;--mtb-row-margin: 0;--mtb-row-max-width: 100%;--mtb-row-min-width: 320px}:host,:host *,.matecu-topbar-header-row,.matecu-topbar-header-row *{box-sizing:border-box;outline:none}:host,.matecu-topbar-header-row{padding:var(--mtb-row-padding);margin:var(--mtb-row-margin);display:flex;align-items:flex-start;justify-content:flex-start;box-sizing:border-box;width:100%;height:100%;max-width:var(--mtb-row-max-width);min-width:var(--mtb-row-min-width)}:host__column,.matecu-topbar-header-row__column{display:flex;height:100%;min-height:var(--mtb-bar-height, 64px);align-items:flex-start}:host__column--right,.matecu-topbar-header-row__column--right{margin-left:auto;justify-content:flex-end}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatToolbarModule }] });
|
|
384
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuTopbarHeaderRowComponent, isStandalone: true, selector: "matecu-topbar-header-row", inputs: { display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className", "style.display": "this.color" } }, ngImport: i0, template: "@if(display()){\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--left\">\n <ng-content select=\"matecu-topbar-header-column[left-column]\"></ng-content>\n</div>\n\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--right\">\n <ng-content select=\"matecu-topbar-header-column[right-column]\"></ng-content>\n</div>\n}", styles: [":host{--mtb-row-padding: 0px;--mtb-row-margin: 0;--mtb-row-max-width: 100%;--mtb-row-min-width: 320px}:host,:host *,.matecu-topbar-header-row,.matecu-topbar-header-row *{box-sizing:border-box;outline:none}:host,.matecu-topbar-header-row{padding:var(--mtb-row-padding);margin:var(--mtb-row-margin);display:flex;align-items:flex-start;justify-content:flex-start;box-sizing:border-box;width:100%;height:100%;max-width:var(--mtb-row-max-width);min-width:var(--mtb-row-min-width)}:host__column,.matecu-topbar-header-row__column{display:flex;height:100%;min-height:var(--mtb-bar-height, 64px);align-items:flex-start}:host__column--right,.matecu-topbar-header-row__column--right{margin-left:auto;justify-content:flex-end}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatToolbarModule }] });
|
|
433
385
|
}
|
|
434
386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuTopbarHeaderRowComponent, decorators: [{
|
|
435
387
|
type: Component,
|
|
436
|
-
args: [{ selector: 'matecu-topbar-header-row', standalone: true, imports: [CommonModule, MatToolbarModule], template: "@if(display){\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--left\">\n <ng-content select=\"matecu-topbar-header-column[left-column]\"></ng-content>\n</div>\n\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--right\">\n <ng-content select=\"matecu-topbar-header-column[right-column]\"></ng-content>\n</div>\n}", styles: [":host{--mtb-row-padding: 0px;--mtb-row-margin: 0;--mtb-row-max-width: 100%;--mtb-row-min-width: 320px}:host,:host *,.matecu-topbar-header-row,.matecu-topbar-header-row *{box-sizing:border-box;outline:none}:host,.matecu-topbar-header-row{padding:var(--mtb-row-padding);margin:var(--mtb-row-margin);display:flex;align-items:flex-start;justify-content:flex-start;box-sizing:border-box;width:100%;height:100%;max-width:var(--mtb-row-max-width);min-width:var(--mtb-row-min-width)}:host__column,.matecu-topbar-header-row__column{display:flex;height:100%;min-height:var(--mtb-bar-height, 64px);align-items:flex-start}:host__column--right,.matecu-topbar-header-row__column--right{margin-left:auto;justify-content:flex-end}\n"] }]
|
|
437
|
-
}], propDecorators: { display: [{
|
|
438
|
-
type: Input
|
|
439
|
-
}], className: [{
|
|
388
|
+
args: [{ selector: 'matecu-topbar-header-row', standalone: true, imports: [CommonModule, MatToolbarModule], template: "@if(display()){\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--left\">\n <ng-content select=\"matecu-topbar-header-column[left-column]\"></ng-content>\n</div>\n\n<div class=\"matecu-topbar-header-row__column matecu-topbar-header-row__column--right\">\n <ng-content select=\"matecu-topbar-header-column[right-column]\"></ng-content>\n</div>\n}", styles: [":host{--mtb-row-padding: 0px;--mtb-row-margin: 0;--mtb-row-max-width: 100%;--mtb-row-min-width: 320px}:host,:host *,.matecu-topbar-header-row,.matecu-topbar-header-row *{box-sizing:border-box;outline:none}:host,.matecu-topbar-header-row{padding:var(--mtb-row-padding);margin:var(--mtb-row-margin);display:flex;align-items:flex-start;justify-content:flex-start;box-sizing:border-box;width:100%;height:100%;max-width:var(--mtb-row-max-width);min-width:var(--mtb-row-min-width)}:host__column,.matecu-topbar-header-row__column{display:flex;height:100%;min-height:var(--mtb-bar-height, 64px);align-items:flex-start}:host__column--right,.matecu-topbar-header-row__column--right{margin-left:auto;justify-content:flex-end}\n"] }]
|
|
389
|
+
}], propDecorators: { display: [{ type: i0.Input, args: [{ isSignal: true, alias: "display", required: false }] }], className: [{
|
|
440
390
|
type: HostBinding,
|
|
441
391
|
args: ['class']
|
|
442
392
|
}], color: [{
|
|
@@ -531,33 +481,25 @@ var MatecuAlertBoxType;
|
|
|
531
481
|
|
|
532
482
|
class MatecuAlertBoxComponent {
|
|
533
483
|
classNameBase = 'matecu-alert-box';
|
|
534
|
-
alertColor;
|
|
535
484
|
iconValue;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return this.alertColor;
|
|
539
|
-
}
|
|
540
|
-
set color(value) {
|
|
541
|
-
this.alertColor = value;
|
|
542
|
-
if (!!value) {
|
|
543
|
-
this.className = `${this.classNameBase} ${this.classNameBase}--${value}`;
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
this.className = this.classNameBase;
|
|
547
|
-
}
|
|
548
|
-
this.updateIcon();
|
|
549
|
-
}
|
|
550
|
-
get icon() {
|
|
551
|
-
return this.alertIcon;
|
|
552
|
-
}
|
|
553
|
-
set icon(value) {
|
|
554
|
-
this.alertIcon = value;
|
|
555
|
-
}
|
|
485
|
+
color = input(undefined, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
486
|
+
icon = input(false, ...(ngDevMode ? [{ debugName: "icon" }] : []));
|
|
556
487
|
className = this.classNameBase;
|
|
557
|
-
constructor() {
|
|
488
|
+
constructor() {
|
|
489
|
+
effect(() => {
|
|
490
|
+
const colorValue = this.color();
|
|
491
|
+
if (!!colorValue) {
|
|
492
|
+
this.className = `${this.classNameBase} ${this.classNameBase}--${colorValue}`;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
this.className = this.classNameBase;
|
|
496
|
+
}
|
|
497
|
+
this.updateIcon(colorValue);
|
|
498
|
+
});
|
|
499
|
+
}
|
|
558
500
|
ngOnInit() { }
|
|
559
|
-
updateIcon() {
|
|
560
|
-
switch (
|
|
501
|
+
updateIcon(colorValue) {
|
|
502
|
+
switch (colorValue) {
|
|
561
503
|
case MatecuAlertBoxType.danger:
|
|
562
504
|
this.iconValue = 'dangerous';
|
|
563
505
|
break;
|
|
@@ -576,16 +518,12 @@ class MatecuAlertBoxComponent {
|
|
|
576
518
|
}
|
|
577
519
|
}
|
|
578
520
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAlertBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
579
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAlertBoxComponent, isStandalone: true, selector: "matecu-alert-box", inputs: { color: "color", icon: "icon" }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "@if (icon && iconValue) {\n<div class=\"matecu-alert-box__icon\">\n <mat-icon>{{iconValue}}</mat-icon>\n</div>\n}\n<div class=\"matecu-alert-box__content\">\n <ng-content>\n\n\n </ng-content>\n</div>", styles: [":host.matecu-alert-box{display:flex;padding:1rem;border-radius:.25rem;position:relative;border:1px solid rgb(224,224,224);box-sizing:border-box;margin:1rem 0}:host.matecu-alert-box--success{color:#0f5032;background-color:#d2e6dc;border-color:#badccd}:host.matecu-alert-box--danger{color:#821e28;background-color:#f8d7da;border-color:#f5c2c7}:host.matecu-alert-box--warning{color:#644d03;background-color:#fff3cd;border-color:#ffecb4}:host.matecu-alert-box--info{color:#055160;background-color:#cff4fc;border-color:#b6effb}:host.matecu-alert-box .matecu-alert-box__icon{display:flex;margin-right:1rem}:host.matecu-alert-box .matecu-alert-box__content{align-self:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
521
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAlertBoxComponent, isStandalone: true, selector: "matecu-alert-box", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.className" } }, ngImport: i0, template: "@if (icon() && iconValue) {\n<div class=\"matecu-alert-box__icon\">\n <mat-icon>{{iconValue}}</mat-icon>\n</div>\n}\n<div class=\"matecu-alert-box__content\">\n <ng-content>\n\n\n </ng-content>\n</div>", styles: [":host.matecu-alert-box{display:flex;padding:1rem;border-radius:.25rem;position:relative;border:1px solid rgb(224,224,224);box-sizing:border-box;margin:1rem 0}:host.matecu-alert-box--success{color:#0f5032;background-color:#d2e6dc;border-color:#badccd}:host.matecu-alert-box--danger{color:#821e28;background-color:#f8d7da;border-color:#f5c2c7}:host.matecu-alert-box--warning{color:#644d03;background-color:#fff3cd;border-color:#ffecb4}:host.matecu-alert-box--info{color:#055160;background-color:#cff4fc;border-color:#b6effb}:host.matecu-alert-box .matecu-alert-box__icon{display:flex;margin-right:1rem}:host.matecu-alert-box .matecu-alert-box__content{align-self:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
|
|
580
522
|
}
|
|
581
523
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAlertBoxComponent, decorators: [{
|
|
582
524
|
type: Component,
|
|
583
|
-
args: [{ selector: 'matecu-alert-box', standalone: true, imports: [CommonModule, MatIconModule], template: "@if (icon && iconValue) {\n<div class=\"matecu-alert-box__icon\">\n <mat-icon>{{iconValue}}</mat-icon>\n</div>\n}\n<div class=\"matecu-alert-box__content\">\n <ng-content>\n\n\n </ng-content>\n</div>", styles: [":host.matecu-alert-box{display:flex;padding:1rem;border-radius:.25rem;position:relative;border:1px solid rgb(224,224,224);box-sizing:border-box;margin:1rem 0}:host.matecu-alert-box--success{color:#0f5032;background-color:#d2e6dc;border-color:#badccd}:host.matecu-alert-box--danger{color:#821e28;background-color:#f8d7da;border-color:#f5c2c7}:host.matecu-alert-box--warning{color:#644d03;background-color:#fff3cd;border-color:#ffecb4}:host.matecu-alert-box--info{color:#055160;background-color:#cff4fc;border-color:#b6effb}:host.matecu-alert-box .matecu-alert-box__icon{display:flex;margin-right:1rem}:host.matecu-alert-box .matecu-alert-box__content{align-self:center}\n"] }]
|
|
584
|
-
}], ctorParameters: () => [], propDecorators: { color: [{
|
|
585
|
-
type: Input
|
|
586
|
-
}], icon: [{
|
|
587
|
-
type: Input
|
|
588
|
-
}], className: [{
|
|
525
|
+
args: [{ selector: 'matecu-alert-box', standalone: true, imports: [CommonModule, MatIconModule], template: "@if (icon() && iconValue) {\n<div class=\"matecu-alert-box__icon\">\n <mat-icon>{{iconValue}}</mat-icon>\n</div>\n}\n<div class=\"matecu-alert-box__content\">\n <ng-content>\n\n\n </ng-content>\n</div>", styles: [":host.matecu-alert-box{display:flex;padding:1rem;border-radius:.25rem;position:relative;border:1px solid rgb(224,224,224);box-sizing:border-box;margin:1rem 0}:host.matecu-alert-box--success{color:#0f5032;background-color:#d2e6dc;border-color:#badccd}:host.matecu-alert-box--danger{color:#821e28;background-color:#f8d7da;border-color:#f5c2c7}:host.matecu-alert-box--warning{color:#644d03;background-color:#fff3cd;border-color:#ffecb4}:host.matecu-alert-box--info{color:#055160;background-color:#cff4fc;border-color:#b6effb}:host.matecu-alert-box .matecu-alert-box__icon{display:flex;margin-right:1rem}:host.matecu-alert-box .matecu-alert-box__content{align-self:center}\n"] }]
|
|
526
|
+
}], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], className: [{
|
|
589
527
|
type: HostBinding,
|
|
590
528
|
args: ['class']
|
|
591
529
|
}] } });
|
|
@@ -754,38 +692,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
754
692
|
}], ctorParameters: () => [{ type: i1$2.MatSnackBar }] });
|
|
755
693
|
|
|
756
694
|
class MatecuAutocomplete {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
695
|
+
static nextId = 0;
|
|
696
|
+
creatingFlag = false;
|
|
697
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
698
|
+
allowCreate = input(false, ...(ngDevMode ? [{ debugName: "allowCreate" }] : []));
|
|
699
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
700
|
+
filterFn = input(this.createFilterFn(), ...(ngDevMode ? [{ debugName: "filterFn" }] : []));
|
|
701
|
+
searchChangeDebounceTime = input(300, ...(ngDevMode ? [{ debugName: "searchChangeDebounceTime" }] : []));
|
|
702
|
+
ngControl = null;
|
|
703
|
+
focused = false;
|
|
704
|
+
lastSearchText = null;
|
|
705
|
+
inputControl = new FormControl(null);
|
|
706
|
+
filteredOptions = computed(() => {
|
|
707
|
+
const fieldValue = this.inputValueSignal() ?? '';
|
|
708
|
+
const options = this.filter(fieldValue);
|
|
709
|
+
return options;
|
|
710
|
+
}, ...(ngDevMode ? [{ debugName: "filteredOptions" }] : []));
|
|
711
|
+
_disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
712
|
+
_required = signal(false, ...(ngDevMode ? [{ debugName: "_required" }] : []));
|
|
713
|
+
_readonly = signal(false, ...(ngDevMode ? [{ debugName: "_readonly" }] : []));
|
|
714
|
+
_placeholder = signal('', ...(ngDevMode ? [{ debugName: "_placeholder" }] : []));
|
|
715
|
+
stateChanges = new Subject();
|
|
716
|
+
id = `matecu-autocomplete-${MatecuAutocomplete.nextId++}`;
|
|
717
|
+
controlType = 'matecu-autocomplete';
|
|
718
|
+
autofilled = false;
|
|
719
|
+
destroy$ = new Subject();
|
|
720
|
+
internalValue = null;
|
|
721
|
+
internalValueSignal = signal(null, ...(ngDevMode ? [{ debugName: "internalValueSignal" }] : []));
|
|
722
|
+
inputValueSignal = signal(null, ...(ngDevMode ? [{ debugName: "inputValueSignal" }] : []));
|
|
723
|
+
focusMonitor;
|
|
724
|
+
elementRef;
|
|
725
|
+
injector;
|
|
726
|
+
optionMap = new Map();
|
|
727
|
+
onChange = () => { };
|
|
728
|
+
onTouched = () => { };
|
|
729
|
+
get required() {
|
|
730
|
+
return this._required();
|
|
766
731
|
}
|
|
767
|
-
set
|
|
768
|
-
this.
|
|
732
|
+
set required(value) {
|
|
733
|
+
this._required.set(value);
|
|
769
734
|
this.stateChanges.next();
|
|
770
735
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return this._required;
|
|
736
|
+
get readonly() {
|
|
737
|
+
return this._readonly();
|
|
774
738
|
}
|
|
775
|
-
set
|
|
776
|
-
this.
|
|
739
|
+
set readonly(value) {
|
|
740
|
+
this._readonly.set(value);
|
|
741
|
+
this.stateChanges.next();
|
|
742
|
+
}
|
|
743
|
+
get placeholder() {
|
|
744
|
+
return this._placeholder();
|
|
745
|
+
}
|
|
746
|
+
set placeholder(value) {
|
|
747
|
+
this._placeholder.set(value);
|
|
777
748
|
this.stateChanges.next();
|
|
778
749
|
}
|
|
779
|
-
_required = false;
|
|
780
750
|
get disabled() {
|
|
781
|
-
return this._disabled;
|
|
751
|
+
return this._disabled();
|
|
782
752
|
}
|
|
783
753
|
set disabled(value) {
|
|
784
|
-
this._disabled
|
|
785
|
-
this.setDisabledState(
|
|
754
|
+
this._disabled.set(value);
|
|
755
|
+
this.setDisabledState(value);
|
|
786
756
|
this.stateChanges.next();
|
|
787
757
|
}
|
|
788
|
-
_disabled = false;
|
|
789
758
|
get value() {
|
|
790
759
|
return this.internalValue;
|
|
791
760
|
}
|
|
@@ -793,27 +762,9 @@ class MatecuAutocomplete {
|
|
|
793
762
|
this.writeValue(value);
|
|
794
763
|
this.stateChanges.next();
|
|
795
764
|
}
|
|
796
|
-
searchChange =
|
|
797
|
-
create =
|
|
798
|
-
valueChange =
|
|
799
|
-
// MatFormFieldControl properties
|
|
800
|
-
static nextId = 0;
|
|
801
|
-
stateChanges = new Subject();
|
|
802
|
-
id = `matecu-autocomplete-${MatecuAutocomplete.nextId++}`;
|
|
803
|
-
ngControl = null;
|
|
804
|
-
focused = false;
|
|
805
|
-
lastSearchText = null;
|
|
806
|
-
controlType = 'matecu-autocomplete';
|
|
807
|
-
autofilled = false;
|
|
808
|
-
inputControl = new FormControl(null);
|
|
809
|
-
filteredOptions$;
|
|
810
|
-
internalValue = null;
|
|
811
|
-
focusMonitor;
|
|
812
|
-
elementRef;
|
|
813
|
-
injector;
|
|
814
|
-
optionMap = new Map();
|
|
815
|
-
onChange = () => { };
|
|
816
|
-
onTouched = () => { };
|
|
765
|
+
searchChange = output();
|
|
766
|
+
create = output();
|
|
767
|
+
valueChange = output();
|
|
817
768
|
get empty() {
|
|
818
769
|
const isEmpty = this.inputControl.value === '' || !this.inputControl.value;
|
|
819
770
|
return isEmpty;
|
|
@@ -825,17 +776,34 @@ class MatecuAutocomplete {
|
|
|
825
776
|
get errorState() {
|
|
826
777
|
return !!(this.ngControl && this.ngControl.invalid && this.ngControl.touched);
|
|
827
778
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
779
|
+
showCreateOption = computed(() => {
|
|
780
|
+
// se obtienen primero los valores de los signals porque al usarlos directamente en el return no se obtienen los valores actualizados,
|
|
781
|
+
// probablemente porque el effect que actualiza esos signals no se ha ejecutado aún, entonces al obtenerlos antes se asegura que se tienen los valores más recientes para la comparación
|
|
782
|
+
const options = this.options();
|
|
783
|
+
const allowCreate = this.allowCreate();
|
|
784
|
+
const internalValue = this.internalValueSignal();
|
|
785
|
+
const value = this.inputValueSignal() ?? '';
|
|
786
|
+
const valueTrimmed = value.trim();
|
|
787
|
+
const show = allowCreate &&
|
|
831
788
|
typeof value === 'string' &&
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
789
|
+
valueTrimmed !== '' &&
|
|
790
|
+
internalValue !== valueTrimmed &&
|
|
791
|
+
options.some((option) => option[1].trim().toLowerCase() === valueTrimmed.toLowerCase()) ===
|
|
792
|
+
false;
|
|
793
|
+
return show;
|
|
794
|
+
}, ...(ngDevMode ? [{ debugName: "showCreateOption" }] : []));
|
|
835
795
|
constructor(focusMonitor, elementRef, injector) {
|
|
836
796
|
this.focusMonitor = focusMonitor;
|
|
837
797
|
this.elementRef = elementRef;
|
|
838
798
|
this.injector = injector;
|
|
799
|
+
// Inicializar el signal con el valor inicial del inputControl
|
|
800
|
+
this.inputValueSignal.set(this.inputControl.value);
|
|
801
|
+
effect(() => {
|
|
802
|
+
this.options();
|
|
803
|
+
this.rebuildOptionMap();
|
|
804
|
+
this.updateInputLabelFromValue();
|
|
805
|
+
this.stateChanges.next();
|
|
806
|
+
});
|
|
839
807
|
}
|
|
840
808
|
ngOnInit() {
|
|
841
809
|
// Intentar obtener NgControl de forma segura
|
|
@@ -846,20 +814,15 @@ class MatecuAutocomplete {
|
|
|
846
814
|
// Ignorar si no se puede obtener NgControl
|
|
847
815
|
this.ngControl = null;
|
|
848
816
|
}
|
|
849
|
-
const value$ = this.inputControl.valueChanges.pipe(startWith(this.inputControl.value ?? ''));
|
|
850
|
-
this.filteredOptions$ = combineLatest([value$]).pipe(map$1(([value]) => this.filter(value ?? '')));
|
|
851
817
|
this.inputControl.valueChanges
|
|
852
|
-
.pipe(
|
|
853
|
-
//
|
|
854
|
-
tap$1((value) => (this.lastSearchText = value ?? this.lastSearchText)),
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
.
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
});
|
|
861
|
-
});
|
|
862
|
-
this.focusMonitor.monitor(this.elementRef, true).subscribe((focused) => {
|
|
818
|
+
.pipe(startWith(this.inputControl.value ?? ''), debounceTime$1(this.searchChangeDebounceTime()), distinctUntilChanged$1(),
|
|
819
|
+
// InternalValueSingal se actualiza solo al seleccionar una opción, no al escribir en el input, por lo que aquí se compara con el valor del input para evitar emitir searchChange cuando se selecciona una opción
|
|
820
|
+
filter((value) => this.internalValueSignal() !== value), tap$1((value) => (this.lastSearchText = value ?? this.lastSearchText)), tap$1((value) => this.inputValueSignal.set(value)), tap$1((value) => this.searchChange.emit(value ?? '')), tap$1(() => this.clearValue()), takeUntil$1(this.destroy$))
|
|
821
|
+
.subscribe();
|
|
822
|
+
this.focusMonitor
|
|
823
|
+
.monitor(this.elementRef, true)
|
|
824
|
+
.pipe(takeUntil$1(this.destroy$))
|
|
825
|
+
.subscribe((focused) => {
|
|
863
826
|
if (!!focused !== this.focused) {
|
|
864
827
|
this.focused = !!focused;
|
|
865
828
|
this.stateChanges.next();
|
|
@@ -868,6 +831,8 @@ class MatecuAutocomplete {
|
|
|
868
831
|
}
|
|
869
832
|
ngOnDestroy() {
|
|
870
833
|
this.stateChanges.complete();
|
|
834
|
+
this.destroy$.next();
|
|
835
|
+
this.destroy$.complete();
|
|
871
836
|
this.focusMonitor.stopMonitoring(this.elementRef);
|
|
872
837
|
}
|
|
873
838
|
ngDoCheck() {
|
|
@@ -879,17 +844,12 @@ class MatecuAutocomplete {
|
|
|
879
844
|
}
|
|
880
845
|
}
|
|
881
846
|
ngOnChanges(changes) {
|
|
882
|
-
if (changes['
|
|
883
|
-
this.rebuildOptionMap();
|
|
884
|
-
this.updateInputLabelFromValue();
|
|
885
|
-
this.stateChanges.next();
|
|
886
|
-
}
|
|
887
|
-
if (changes['placeholder'] || changes['required'] || changes['disabled']) {
|
|
847
|
+
if (changes['placeholder']) {
|
|
888
848
|
this.stateChanges.next();
|
|
889
849
|
}
|
|
890
850
|
}
|
|
891
851
|
filter(search) {
|
|
892
|
-
return this.options.filter((option) => this.filterFn(option[1], search));
|
|
852
|
+
return this.options().filter((option) => this.filterFn()(option[1], search));
|
|
893
853
|
}
|
|
894
854
|
createFilterFn() {
|
|
895
855
|
return (v1, v2) => {
|
|
@@ -899,16 +859,15 @@ class MatecuAutocomplete {
|
|
|
899
859
|
displayLabel = (value) => {
|
|
900
860
|
if (value === null || value === undefined)
|
|
901
861
|
return '';
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
}
|
|
905
|
-
return this.optionMap.get(value) ?? '';
|
|
862
|
+
const mapValue = this.optionMap.get(value) ?? (this.creatingFlag ? value : '');
|
|
863
|
+
return mapValue;
|
|
906
864
|
};
|
|
907
865
|
onOptionSelected(value) {
|
|
908
|
-
if (!value || this.readonly
|
|
866
|
+
if (!value || this.readonly) {
|
|
909
867
|
return;
|
|
910
868
|
}
|
|
911
869
|
this.internalValue = value;
|
|
870
|
+
this.internalValueSignal.set(value);
|
|
912
871
|
this.inputControl.setValue(value, { emitEvent: false });
|
|
913
872
|
this.onChange(value);
|
|
914
873
|
this.onTouched();
|
|
@@ -917,10 +876,12 @@ class MatecuAutocomplete {
|
|
|
917
876
|
onCreateClick() {
|
|
918
877
|
if (!this.lastSearchText ||
|
|
919
878
|
this.lastSearchText.trim() === '' ||
|
|
920
|
-
this.options.some((option) => option[1].toLowerCase() === this.lastSearchText.toLowerCase())
|
|
921
|
-
this.options.some((option) => option[1].toLowerCase() === this.lastSearchText.toLowerCase())) {
|
|
879
|
+
this.options().some((option) => option[1].toLowerCase() === this.lastSearchText.toLowerCase())) {
|
|
922
880
|
return;
|
|
923
881
|
}
|
|
882
|
+
this.inputValueSignal.set(this.lastSearchText);
|
|
883
|
+
this.internalValue = this.lastSearchText;
|
|
884
|
+
this.creatingFlag = true;
|
|
924
885
|
this.create.emit(this.lastSearchText);
|
|
925
886
|
}
|
|
926
887
|
updateInputLabelFromValue() {
|
|
@@ -932,6 +893,7 @@ class MatecuAutocomplete {
|
|
|
932
893
|
// ControlValueAccessor
|
|
933
894
|
writeValue(value) {
|
|
934
895
|
this.internalValue = value;
|
|
896
|
+
this.internalValueSignal.set(value);
|
|
935
897
|
this.updateInputLabelFromValue();
|
|
936
898
|
this.stateChanges.next();
|
|
937
899
|
}
|
|
@@ -942,8 +904,8 @@ class MatecuAutocomplete {
|
|
|
942
904
|
this.onTouched = fn;
|
|
943
905
|
}
|
|
944
906
|
setDisabledState(isDisabled) {
|
|
945
|
-
this._disabled = isDisabled;
|
|
946
907
|
isDisabled ? this.inputControl.disable() : this.inputControl.enable();
|
|
908
|
+
this._disabled.set(isDisabled);
|
|
947
909
|
this.stateChanges.next();
|
|
948
910
|
}
|
|
949
911
|
// MatFormFieldControl methods
|
|
@@ -961,18 +923,19 @@ class MatecuAutocomplete {
|
|
|
961
923
|
}
|
|
962
924
|
rebuildOptionMap() {
|
|
963
925
|
this.optionMap.clear();
|
|
964
|
-
for (const [value, label] of this.options ?? []) {
|
|
926
|
+
for (const [value, label] of this.options() ?? []) {
|
|
965
927
|
this.optionMap.set(value, label);
|
|
966
928
|
}
|
|
967
929
|
}
|
|
968
930
|
clearValue() {
|
|
969
931
|
this.internalValue = null;
|
|
932
|
+
this.internalValueSignal.set(null);
|
|
970
933
|
this.onChange(null);
|
|
971
934
|
this.onTouched();
|
|
972
935
|
this.valueChange.emit(null);
|
|
973
936
|
}
|
|
974
937
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAutocomplete, deps: [{ token: i1$3.FocusMonitor }, { token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
975
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAutocomplete, isStandalone: true, selector: "matecu-autocomplete", inputs: { options: "options", allowCreate: "allowCreate", loading: "loading",
|
|
938
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAutocomplete, isStandalone: true, selector: "matecu-autocomplete", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, allowCreate: { classPropertyName: "allowCreate", publicName: "allowCreate", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: true, isRequired: false, transformFunction: null }, searchChangeDebounceTime: { classPropertyName: "searchChangeDebounceTime", publicName: "searchChangeDebounceTime", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: false, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { searchChange: "searchChange", create: "create", valueChange: "valueChange" }, providers: [
|
|
976
939
|
{
|
|
977
940
|
provide: NG_VALUE_ACCESSOR,
|
|
978
941
|
useExisting: MatecuAutocomplete,
|
|
@@ -982,7 +945,7 @@ class MatecuAutocomplete {
|
|
|
982
945
|
provide: MatFormFieldControl,
|
|
983
946
|
useExisting: MatecuAutocomplete,
|
|
984
947
|
},
|
|
985
|
-
], usesOnChanges: true, ngImport: i0, template: "<input matInput type=\"text\" matInput [formControl]=\"inputControl\" [matAutocomplete]=\"auto\" [class.loading]=\"loading\"\n [readonly]=\"readonly\" />\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onOptionSelected($event.option.value)\"\n [displayWith]=\"displayLabel\">\n\n @for (option of filteredOptions
|
|
948
|
+
], usesOnChanges: true, ngImport: i0, template: "<input matInput type=\"text\" matInput [formControl]=\"inputControl\" [matAutocomplete]=\"auto\" [class.loading]=\"loading()\"\n [readonly]=\"readonly\" />\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onOptionSelected($event.option.value)\"\n [displayWith]=\"displayLabel\">\n\n @for (option of filteredOptions(); track $index) {\n\n <mat-option [value]=\"option[0]\">\n {{ option[1] }}\n </mat-option>\n\n }\n\n <!-- Crear nuevo -->\n @if(allowCreate()){\n\n <mat-divider></mat-divider>\n\n @if(showCreateOption() ){\n <mat-option (click)=\"onCreateClick()\" class=\"create-option\" [value]=\"inputControl.value\">\n <span>\u2795</span><span>\" {{ inputControl.value }}\"</span>\n\n </mat-option>\n }\n }\n\n</mat-autocomplete>\n\n<!-- Spinner -->\n@if(loading()){\n<mat-progress-spinner class=\"loading-spinner\" diameter=\"20\" mode=\"indeterminate\"\n style=\"position:absolute; right:10px; top:50%; transform:translateY(-50%);\">\n</mat-progress-spinner>\n}", styles: ["@charset \"UTF-8\";:host{display:block;position:relative;box-sizing:border-box;width:100%}:host input{border:none;background-color:transparent;outline:none}:host .create-option{display:flex;justify-content:space-between;align-items:center}:host .create-option:first-child{margin-right:auto;color:green}.loading-spinner{position:absolute;right:12px;top:50%;transform:translateY(-50%);pointer-events:none}input.loading{padding-right:40px}.create-option{font-style:italic;opacity:.85}::ng-deep .mat-mdc-option.create-option:hover{background:#0000000a}::ng-deep .mat-mdc-autocomplete-panel mat-divider{margin:4px 0}:host(.mat-mdc-input-disabled){opacity:.6;pointer-events:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i2$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i2$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i2$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i3$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i5.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
|
|
986
949
|
}
|
|
987
950
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAutocomplete, decorators: [{
|
|
988
951
|
type: Component,
|
|
@@ -1003,57 +966,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1003
966
|
provide: MatFormFieldControl,
|
|
1004
967
|
useExisting: MatecuAutocomplete,
|
|
1005
968
|
},
|
|
1006
|
-
], template: "<input matInput type=\"text\" matInput [formControl]=\"inputControl\" [matAutocomplete]=\"auto\" [class.loading]=\"loading\"\n [readonly]=\"readonly\" />\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onOptionSelected($event.option.value)\"\n [displayWith]=\"displayLabel\">\n\n @for (option of filteredOptions
|
|
1007
|
-
}], ctorParameters: () => [{ type: i1$3.FocusMonitor }, { type: i0.ElementRef }, { type: i0.Injector }], propDecorators: { options: [{
|
|
1008
|
-
type: Input
|
|
1009
|
-
}], allowCreate: [{
|
|
1010
|
-
type: Input
|
|
1011
|
-
}], loading: [{
|
|
969
|
+
], template: "<input matInput type=\"text\" matInput [formControl]=\"inputControl\" [matAutocomplete]=\"auto\" [class.loading]=\"loading()\"\n [readonly]=\"readonly\" />\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onOptionSelected($event.option.value)\"\n [displayWith]=\"displayLabel\">\n\n @for (option of filteredOptions(); track $index) {\n\n <mat-option [value]=\"option[0]\">\n {{ option[1] }}\n </mat-option>\n\n }\n\n <!-- Crear nuevo -->\n @if(allowCreate()){\n\n <mat-divider></mat-divider>\n\n @if(showCreateOption() ){\n <mat-option (click)=\"onCreateClick()\" class=\"create-option\" [value]=\"inputControl.value\">\n <span>\u2795</span><span>\" {{ inputControl.value }}\"</span>\n\n </mat-option>\n }\n }\n\n</mat-autocomplete>\n\n<!-- Spinner -->\n@if(loading()){\n<mat-progress-spinner class=\"loading-spinner\" diameter=\"20\" mode=\"indeterminate\"\n style=\"position:absolute; right:10px; top:50%; transform:translateY(-50%);\">\n</mat-progress-spinner>\n}", styles: ["@charset \"UTF-8\";:host{display:block;position:relative;box-sizing:border-box;width:100%}:host input{border:none;background-color:transparent;outline:none}:host .create-option{display:flex;justify-content:space-between;align-items:center}:host .create-option:first-child{margin-right:auto;color:green}.loading-spinner{position:absolute;right:12px;top:50%;transform:translateY(-50%);pointer-events:none}input.loading{padding-right:40px}.create-option{font-style:italic;opacity:.85}::ng-deep .mat-mdc-option.create-option:hover{background:#0000000a}::ng-deep .mat-mdc-autocomplete-panel mat-divider{margin:4px 0}:host(.mat-mdc-input-disabled){opacity:.6;pointer-events:none}\n"] }]
|
|
970
|
+
}], ctorParameters: () => [{ type: i1$3.FocusMonitor }, { type: i0.ElementRef }, { type: i0.Injector }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], allowCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCreate", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], searchChangeDebounceTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchChangeDebounceTime", required: false }] }], required: [{
|
|
1012
971
|
type: Input
|
|
1013
972
|
}], readonly: [{
|
|
1014
973
|
type: Input
|
|
1015
|
-
}], filterFn: [{
|
|
1016
|
-
type: Input
|
|
1017
|
-
}], searchChangeDebounceTime: [{
|
|
1018
|
-
type: Input
|
|
1019
974
|
}], placeholder: [{
|
|
1020
975
|
type: Input
|
|
1021
|
-
}], required: [{
|
|
1022
|
-
type: Input
|
|
1023
976
|
}], disabled: [{
|
|
1024
977
|
type: Input
|
|
1025
978
|
}], value: [{
|
|
1026
979
|
type: Input
|
|
1027
|
-
}], searchChange: [{
|
|
1028
|
-
type: Output
|
|
1029
|
-
}], create: [{
|
|
1030
|
-
type: Output
|
|
1031
|
-
}], valueChange: [{
|
|
1032
|
-
type: Output
|
|
1033
|
-
}] } });
|
|
980
|
+
}], searchChange: [{ type: i0.Output, args: ["searchChange"] }], create: [{ type: i0.Output, args: ["create"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
1034
981
|
|
|
1035
982
|
class MatecuAutocompleteMultiple {
|
|
1036
983
|
static nextId = 0;
|
|
1037
984
|
// ================= INPUTS =================
|
|
1038
|
-
|
|
1039
|
-
loading = false;
|
|
1040
|
-
searchChangeDebounceTime = 300;
|
|
1041
|
-
enableSelectAll = true;
|
|
1042
|
-
readonly = false;
|
|
1043
|
-
selectAllLabel = 'Select All';
|
|
1044
|
-
clearAllLabel = 'Clear All';
|
|
1045
|
-
showTooltip = true;
|
|
1046
|
-
filterFn = this.createFilterFn();
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
get options() {
|
|
1052
|
-
return this._options();
|
|
985
|
+
_placeholder = input('', ...(ngDevMode ? [{ debugName: "_placeholder" }] : []));
|
|
986
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
987
|
+
searchChangeDebounceTime = input(300, ...(ngDevMode ? [{ debugName: "searchChangeDebounceTime" }] : []));
|
|
988
|
+
enableSelectAll = input(true, ...(ngDevMode ? [{ debugName: "enableSelectAll" }] : []));
|
|
989
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
990
|
+
selectAllLabel = input('Select All', ...(ngDevMode ? [{ debugName: "selectAllLabel" }] : []));
|
|
991
|
+
clearAllLabel = input('Clear All', ...(ngDevMode ? [{ debugName: "clearAllLabel" }] : []));
|
|
992
|
+
showTooltip = input(true, ...(ngDevMode ? [{ debugName: "showTooltip" }] : []));
|
|
993
|
+
filterFn = input(this.createFilterFn(), ...(ngDevMode ? [{ debugName: "filterFn" }] : []));
|
|
994
|
+
options = input.required(...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
995
|
+
// MatFormFieldControl compatibility
|
|
996
|
+
get placeholder() {
|
|
997
|
+
return this._placeholder();
|
|
1053
998
|
}
|
|
1054
999
|
// ================= OUTPUT =================
|
|
1055
|
-
searchChange =
|
|
1056
|
-
valueChange =
|
|
1000
|
+
searchChange = output();
|
|
1001
|
+
valueChange = output();
|
|
1057
1002
|
// ================= INTERNAL CONTROL =================
|
|
1058
1003
|
control = new FormControl([], { nonNullable: true });
|
|
1059
1004
|
controlValue$ = toSignal(this.control.valueChanges);
|
|
@@ -1063,12 +1008,12 @@ class MatecuAutocompleteMultiple {
|
|
|
1063
1008
|
searchText = signal('', ...(ngDevMode ? [{ debugName: "searchText" }] : [])); // 🔥 AHORA SÍ existe correctamente
|
|
1064
1009
|
filteredOptions = computed(() => {
|
|
1065
1010
|
const filter = this.searchText();
|
|
1066
|
-
return this.
|
|
1011
|
+
return this.options().filter((o) => this.filterFn()(o[1], filter) && !this.control.value.includes(o[0]));
|
|
1067
1012
|
}, ...(ngDevMode ? [{ debugName: "filteredOptions" }] : []));
|
|
1068
1013
|
selectedItems = computed(() => {
|
|
1069
1014
|
const values = this.controlValue$() ?? [];
|
|
1070
1015
|
return values.map((v) => {
|
|
1071
|
-
const found = this.
|
|
1016
|
+
const found = this.options().find((o) => o[0] === v);
|
|
1072
1017
|
return {
|
|
1073
1018
|
value: v,
|
|
1074
1019
|
label: found ? found[1] : v,
|
|
@@ -1110,7 +1055,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1110
1055
|
clearTimeout(timeout);
|
|
1111
1056
|
timeout = setTimeout(() => {
|
|
1112
1057
|
this.searchChange.emit(value);
|
|
1113
|
-
}, this.searchChangeDebounceTime);
|
|
1058
|
+
}, this.searchChangeDebounceTime());
|
|
1114
1059
|
});
|
|
1115
1060
|
}
|
|
1116
1061
|
value = null;
|
|
@@ -1130,7 +1075,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1130
1075
|
}
|
|
1131
1076
|
// ================= AUTOCOMPLETE =================
|
|
1132
1077
|
selectOption(option) {
|
|
1133
|
-
if (this.readonly || this.disabled)
|
|
1078
|
+
if (this.readonly() || this.disabled)
|
|
1134
1079
|
return;
|
|
1135
1080
|
if (!Array.isArray(option))
|
|
1136
1081
|
return;
|
|
@@ -1148,21 +1093,21 @@ class MatecuAutocompleteMultiple {
|
|
|
1148
1093
|
}
|
|
1149
1094
|
// ================= CHIP ACTIONS =================
|
|
1150
1095
|
remove(value) {
|
|
1151
|
-
if (this.readonly || this.disabled)
|
|
1096
|
+
if (this.readonly() || this.disabled)
|
|
1152
1097
|
return;
|
|
1153
1098
|
this.control.setValue(this.control.value.filter((v) => v !== value));
|
|
1154
1099
|
}
|
|
1155
1100
|
selectAll() {
|
|
1156
|
-
if (this.readonly || this.disabled)
|
|
1101
|
+
if (this.readonly() || this.disabled)
|
|
1157
1102
|
return;
|
|
1158
|
-
const allValues = this.
|
|
1103
|
+
const allValues = this.options().map((o) => o[0]);
|
|
1159
1104
|
this.control.setValue([...new Set([...this.control.value, ...allValues])]);
|
|
1160
1105
|
this.searchControl.setValue('');
|
|
1161
1106
|
this.searchText.set('');
|
|
1162
1107
|
this.autocompleteTrigger.closePanel();
|
|
1163
1108
|
}
|
|
1164
1109
|
clearAll() {
|
|
1165
|
-
if (this.disabled || this.readonly)
|
|
1110
|
+
if (this.disabled || this.readonly())
|
|
1166
1111
|
return;
|
|
1167
1112
|
if (this.control.value.length === 0)
|
|
1168
1113
|
return;
|
|
@@ -1173,7 +1118,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1173
1118
|
}
|
|
1174
1119
|
// ================= DRAG & DROP =================
|
|
1175
1120
|
drop(event) {
|
|
1176
|
-
if (this.disabled || this.readonly)
|
|
1121
|
+
if (this.disabled || this.readonly())
|
|
1177
1122
|
return;
|
|
1178
1123
|
const current = [...this.control.value];
|
|
1179
1124
|
moveItemInArray(current, event.previousIndex, event.currentIndex);
|
|
@@ -1181,7 +1126,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1181
1126
|
}
|
|
1182
1127
|
// ================= KEYBOARD =================
|
|
1183
1128
|
onKeyDown(event) {
|
|
1184
|
-
if (this.readonly || this.disabled)
|
|
1129
|
+
if (this.readonly() || this.disabled)
|
|
1185
1130
|
return;
|
|
1186
1131
|
if (event.key === 'Backspace' && !this.searchText() && this.control.value.length > 0) {
|
|
1187
1132
|
const updated = [...this.control.value];
|
|
@@ -1226,7 +1171,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1226
1171
|
};
|
|
1227
1172
|
}
|
|
1228
1173
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAutocompleteMultiple, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
1229
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAutocompleteMultiple, isStandalone: true, selector: "matecu-autocomplete-multiple", inputs: {
|
|
1174
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuAutocompleteMultiple, isStandalone: true, selector: "matecu-autocomplete-multiple", inputs: { _placeholder: { classPropertyName: "_placeholder", publicName: "_placeholder", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, searchChangeDebounceTime: { classPropertyName: "searchChangeDebounceTime", publicName: "searchChangeDebounceTime", isSignal: true, isRequired: false, transformFunction: null }, enableSelectAll: { classPropertyName: "enableSelectAll", publicName: "enableSelectAll", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, selectAllLabel: { classPropertyName: "selectAllLabel", publicName: "selectAllLabel", isSignal: true, isRequired: false, transformFunction: null }, clearAllLabel: { classPropertyName: "clearAllLabel", publicName: "clearAllLabel", isSignal: true, isRequired: false, transformFunction: null }, showTooltip: { classPropertyName: "showTooltip", publicName: "showTooltip", isSignal: true, isRequired: false, transformFunction: null }, filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { searchChange: "searchChange", valueChange: "valueChange" }, providers: [
|
|
1230
1175
|
{
|
|
1231
1176
|
provide: NG_VALUE_ACCESSOR,
|
|
1232
1177
|
useExisting: forwardRef(() => MatecuAutocompleteMultiple),
|
|
@@ -1236,7 +1181,7 @@ class MatecuAutocompleteMultiple {
|
|
|
1236
1181
|
provide: MatFormFieldControl,
|
|
1237
1182
|
useExisting: MatecuAutocompleteMultiple,
|
|
1238
1183
|
},
|
|
1239
|
-
], viewQueries: [{ propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }], ngImport: i0, template: "@if (loading) {\n\n<mat-progress-spinner matSuffix diameter=\"20\" mode=\"indeterminate\">\n</mat-progress-spinner>\n}\n<mat-chip-grid #chipGrid class=\"chip-list\">\n\n @for (item of selectedItems(); track item.value) {\n\n <mat-chip-row [removable]=\"!disabled && !readonly\" (removed)=\"remove(item.value)\"\n [matTooltip]=\"showTooltip ? item.label : ''\" matTooltipPosition=\"above\">\n\n\n\n {{ item.label }}\n @if (!disabled && !readonly) {\n\n <button matChipRemove aria-label=\"Remove {{item.label}}\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n\n </mat-chip-row>\n }\n\n <input type=\"text\" matInput [formControl]=\"searchControl\" [matAutocomplete]=\"auto\" (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"
|
|
1184
|
+
], viewQueries: [{ propertyName: "autocompleteTrigger", first: true, predicate: MatAutocompleteTrigger, descendants: true }], ngImport: i0, template: "@if (loading()) {\n\n<mat-progress-spinner matSuffix diameter=\"20\" mode=\"indeterminate\">\n</mat-progress-spinner>\n}\n<mat-chip-grid #chipGrid class=\"chip-list\">\n\n @for (item of selectedItems(); track item.value) {\n\n <mat-chip-row [removable]=\"!disabled && !readonly()\" (removed)=\"remove(item.value)\"\n [matTooltip]=\"showTooltip() ? item.label : ''\" matTooltipPosition=\"above\">\n\n\n\n {{ item.label }}\n @if (!disabled && !readonly()) {\n\n <button matChipRemove aria-label=\"Remove {{item.label}}\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n\n </mat-chip-row>\n }\n\n <input type=\"text\" matInput [formControl]=\"searchControl\" [matAutocomplete]=\"auto\" (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"_placeholder()\" />\n\n</mat-chip-grid>\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selectOption($event.option.value)\"\n class=\"autocomplete-large-panel\" [displayWith]=\"displayLabel\">\n\n @if (!readonly() && !disabled && (enableSelectAll() || control.value.length > 0)) {\n <mat-option>\n <div style=\"display: flex; gap: 10px; align-items: center; justify-content: center; \">\n\n @if (enableSelectAll()) {\n <div>\n <button mat-icon-button (click)=\"selectAll()\" [matTooltip]=\"selectAllLabel()\">\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n\n }\n @if (control.value.length > 0) {\n <div>\n\n <button mat-icon-button (click)=\"clearAll()\" [matTooltip]=\"clearAllLabel()\">\n <mat-icon>clear_all</mat-icon>\n </button>\n </div>\n }\n </div>\n </mat-option>\n }\n\n @for (option of filteredOptions(); track $index) {\n <mat-option [value]=\"option\">\n {{ option[1] }}\n </mat-option>\n }\n</mat-autocomplete>", styles: [":host{display:inline-block;position:relative;width:100%}:host input{outline:none;border:none;background-color:transparent;width:100%}:host .clear-all-box{width:100%;display:flex;justify-content:flex-end;align-items:center}:host mat-option span{display:block}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i2$3.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i2$3.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i2$3.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i5.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i2$2.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i2$2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i2$2.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
1240
1185
|
}
|
|
1241
1186
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuAutocompleteMultiple, decorators: [{
|
|
1242
1187
|
type: Component,
|
|
@@ -1260,33 +1205,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1260
1205
|
provide: MatFormFieldControl,
|
|
1261
1206
|
useExisting: MatecuAutocompleteMultiple,
|
|
1262
1207
|
},
|
|
1263
|
-
], template: "@if (loading) {\n\n<mat-progress-spinner matSuffix diameter=\"20\" mode=\"indeterminate\">\n</mat-progress-spinner>\n}\n<mat-chip-grid #chipGrid class=\"chip-list\">\n\n @for (item of selectedItems(); track item.value) {\n\n <mat-chip-row [removable]=\"!disabled && !readonly\" (removed)=\"remove(item.value)\"\n [matTooltip]=\"showTooltip ? item.label : ''\" matTooltipPosition=\"above\">\n\n\n\n {{ item.label }}\n @if (!disabled && !readonly) {\n\n <button matChipRemove aria-label=\"Remove {{item.label}}\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n\n </mat-chip-row>\n }\n\n <input type=\"text\" matInput [formControl]=\"searchControl\" [matAutocomplete]=\"auto\" (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"
|
|
1264
|
-
}], ctorParameters: () => [{ type: i0.Injector }], propDecorators: {
|
|
1265
|
-
type: Input
|
|
1266
|
-
}], loading: [{
|
|
1267
|
-
type: Input
|
|
1268
|
-
}], searchChangeDebounceTime: [{
|
|
1269
|
-
type: Input
|
|
1270
|
-
}], enableSelectAll: [{
|
|
1271
|
-
type: Input
|
|
1272
|
-
}], readonly: [{
|
|
1273
|
-
type: Input
|
|
1274
|
-
}], selectAllLabel: [{
|
|
1275
|
-
type: Input
|
|
1276
|
-
}], clearAllLabel: [{
|
|
1277
|
-
type: Input
|
|
1278
|
-
}], showTooltip: [{
|
|
1279
|
-
type: Input
|
|
1280
|
-
}], filterFn: [{
|
|
1281
|
-
type: Input
|
|
1282
|
-
}], options: [{
|
|
1283
|
-
type: Input,
|
|
1284
|
-
args: [{ required: true }]
|
|
1285
|
-
}], searchChange: [{
|
|
1286
|
-
type: Output
|
|
1287
|
-
}], valueChange: [{
|
|
1288
|
-
type: Output
|
|
1289
|
-
}], autocompleteTrigger: [{
|
|
1208
|
+
], template: "@if (loading()) {\n\n<mat-progress-spinner matSuffix diameter=\"20\" mode=\"indeterminate\">\n</mat-progress-spinner>\n}\n<mat-chip-grid #chipGrid class=\"chip-list\">\n\n @for (item of selectedItems(); track item.value) {\n\n <mat-chip-row [removable]=\"!disabled && !readonly()\" (removed)=\"remove(item.value)\"\n [matTooltip]=\"showTooltip() ? item.label : ''\" matTooltipPosition=\"above\">\n\n\n\n {{ item.label }}\n @if (!disabled && !readonly()) {\n\n <button matChipRemove aria-label=\"Remove {{item.label}}\">\n <mat-icon>cancel</mat-icon>\n </button>\n }\n\n </mat-chip-row>\n }\n\n <input type=\"text\" matInput [formControl]=\"searchControl\" [matAutocomplete]=\"auto\" (keydown)=\"onKeyDown($event)\"\n [placeholder]=\"_placeholder()\" />\n\n</mat-chip-grid>\n\n\n<mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"selectOption($event.option.value)\"\n class=\"autocomplete-large-panel\" [displayWith]=\"displayLabel\">\n\n @if (!readonly() && !disabled && (enableSelectAll() || control.value.length > 0)) {\n <mat-option>\n <div style=\"display: flex; gap: 10px; align-items: center; justify-content: center; \">\n\n @if (enableSelectAll()) {\n <div>\n <button mat-icon-button (click)=\"selectAll()\" [matTooltip]=\"selectAllLabel()\">\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n\n }\n @if (control.value.length > 0) {\n <div>\n\n <button mat-icon-button (click)=\"clearAll()\" [matTooltip]=\"clearAllLabel()\">\n <mat-icon>clear_all</mat-icon>\n </button>\n </div>\n }\n </div>\n </mat-option>\n }\n\n @for (option of filteredOptions(); track $index) {\n <mat-option [value]=\"option\">\n {{ option[1] }}\n </mat-option>\n }\n</mat-autocomplete>", styles: [":host{display:inline-block;position:relative;width:100%}:host input{outline:none;border:none;background-color:transparent;width:100%}:host .clear-all-box{width:100%;display:flex;justify-content:flex-end;align-items:center}:host mat-option span{display:block}\n"] }]
|
|
1209
|
+
}], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { _placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "_placeholder", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], searchChangeDebounceTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchChangeDebounceTime", required: false }] }], enableSelectAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelectAll", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], selectAllLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectAllLabel", required: false }] }], clearAllLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearAllLabel", required: false }] }], showTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTooltip", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], autocompleteTrigger: [{
|
|
1290
1210
|
type: ViewChild,
|
|
1291
1211
|
args: [MatAutocompleteTrigger]
|
|
1292
1212
|
}] } });
|
|
@@ -1317,42 +1237,42 @@ class MatecuFileInput {
|
|
|
1317
1237
|
onChange;
|
|
1318
1238
|
onTouched;
|
|
1319
1239
|
// Inputs - Funcionalidad básica
|
|
1320
|
-
optimizeImage;
|
|
1321
|
-
optimizeImageToSize;
|
|
1322
|
-
maxFileSize; // tamaño máximo en bytes
|
|
1323
|
-
maxFiles = 1;
|
|
1324
|
-
multiple = false;
|
|
1325
|
-
showFileSize = false;
|
|
1326
|
-
fileSizeUnit = 'AUTO';
|
|
1327
|
-
displayName;
|
|
1328
|
-
placeholder = 'Select a file or drag here';
|
|
1329
|
-
buttonText = 'Select file';
|
|
1330
|
-
changeSelectedFileText = 'Change selected file(s)';
|
|
1331
|
-
loadingText = 'Processing...';
|
|
1332
|
-
ariaLabel;
|
|
1240
|
+
optimizeImage = input(undefined, ...(ngDevMode ? [{ debugName: "optimizeImage" }] : []));
|
|
1241
|
+
optimizeImageToSize = input(undefined, ...(ngDevMode ? [{ debugName: "optimizeImageToSize" }] : []));
|
|
1242
|
+
maxFileSize = input(undefined, ...(ngDevMode ? [{ debugName: "maxFileSize" }] : [])); // tamaño máximo en bytes
|
|
1243
|
+
maxFiles = input(1, ...(ngDevMode ? [{ debugName: "maxFiles" }] : []));
|
|
1244
|
+
multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
|
|
1245
|
+
showFileSize = input(false, ...(ngDevMode ? [{ debugName: "showFileSize" }] : []));
|
|
1246
|
+
fileSizeUnit = input('AUTO', ...(ngDevMode ? [{ debugName: "fileSizeUnit" }] : []));
|
|
1247
|
+
displayName = input(undefined, ...(ngDevMode ? [{ debugName: "displayName" }] : []));
|
|
1248
|
+
placeholder = input('Select a file or drag here', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
1249
|
+
buttonText = input('Select file', ...(ngDevMode ? [{ debugName: "buttonText" }] : []));
|
|
1250
|
+
changeSelectedFileText = input('Change selected file(s)', ...(ngDevMode ? [{ debugName: "changeSelectedFileText" }] : []));
|
|
1251
|
+
loadingText = input('Processing...', ...(ngDevMode ? [{ debugName: "loadingText" }] : []));
|
|
1252
|
+
ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
1333
1253
|
// Inputs - Validación
|
|
1334
|
-
acceptedMimeTypes = [];
|
|
1335
|
-
acceptedExtensions = [];
|
|
1336
|
-
errorMessages = {
|
|
1254
|
+
acceptedMimeTypes = input([], ...(ngDevMode ? [{ debugName: "acceptedMimeTypes" }] : []));
|
|
1255
|
+
acceptedExtensions = input([], ...(ngDevMode ? [{ debugName: "acceptedExtensions" }] : []));
|
|
1256
|
+
errorMessages = input({
|
|
1337
1257
|
invalidSize: 'File exceeds maximum allowed size',
|
|
1338
1258
|
invalidType: 'File type not allowed',
|
|
1339
1259
|
tooManyFiles: 'Maximum number of files exceeded',
|
|
1340
1260
|
uploadError: 'Error processing file',
|
|
1341
|
-
};
|
|
1261
|
+
}, ...(ngDevMode ? [{ debugName: "errorMessages" }] : []));
|
|
1342
1262
|
// Inputs - UI/UX
|
|
1343
|
-
enableDragDrop = true;
|
|
1344
|
-
showPreview = false;
|
|
1345
|
-
previewMaxWidth = 200;
|
|
1346
|
-
previewMaxHeight = 200;
|
|
1347
|
-
showProgress = false;
|
|
1263
|
+
enableDragDrop = input(true, ...(ngDevMode ? [{ debugName: "enableDragDrop" }] : []));
|
|
1264
|
+
showPreview = input(false, ...(ngDevMode ? [{ debugName: "showPreview" }] : []));
|
|
1265
|
+
previewMaxWidth = input(200, ...(ngDevMode ? [{ debugName: "previewMaxWidth" }] : []));
|
|
1266
|
+
previewMaxHeight = input(200, ...(ngDevMode ? [{ debugName: "previewMaxHeight" }] : []));
|
|
1267
|
+
showProgress = input(false, ...(ngDevMode ? [{ debugName: "showProgress" }] : []));
|
|
1348
1268
|
// Outputs
|
|
1349
|
-
fileSelected =
|
|
1350
|
-
filesSelected =
|
|
1351
|
-
fileRemoved =
|
|
1352
|
-
validationError =
|
|
1353
|
-
dragEnter =
|
|
1354
|
-
dragLeave =
|
|
1355
|
-
stateChange =
|
|
1269
|
+
fileSelected = output();
|
|
1270
|
+
filesSelected = output();
|
|
1271
|
+
fileRemoved = output();
|
|
1272
|
+
validationError = output();
|
|
1273
|
+
dragEnter = output();
|
|
1274
|
+
dragLeave = output();
|
|
1275
|
+
stateChange = output();
|
|
1356
1276
|
// ControlValueAccessor Methods
|
|
1357
1277
|
writeValue(value) {
|
|
1358
1278
|
if (value instanceof File) {
|
|
@@ -1427,7 +1347,7 @@ class MatecuFileInput {
|
|
|
1427
1347
|
URL.revokeObjectURL(previewUrl);
|
|
1428
1348
|
this.previewUrls.delete(fileKey);
|
|
1429
1349
|
}
|
|
1430
|
-
if (this.multiple) {
|
|
1350
|
+
if (this.multiple()) {
|
|
1431
1351
|
this.files = this.files.filter((file) => file !== fileToRemove);
|
|
1432
1352
|
this.notifyChange(this.files.length > 0 ? this.files : null);
|
|
1433
1353
|
this.filesSelected.emit([...this.files]);
|
|
@@ -1446,8 +1366,8 @@ class MatecuFileInput {
|
|
|
1446
1366
|
this.validationErrors = [];
|
|
1447
1367
|
try {
|
|
1448
1368
|
// Validar número máximo de archivos
|
|
1449
|
-
if (selectedFiles.length > this.maxFiles) {
|
|
1450
|
-
this.validationErrors.push(this.errorMessages.tooManyFiles);
|
|
1369
|
+
if (selectedFiles.length > this.maxFiles()) {
|
|
1370
|
+
this.validationErrors.push(this.errorMessages().tooManyFiles);
|
|
1451
1371
|
this.changeState(FileInputState.ERROR);
|
|
1452
1372
|
return;
|
|
1453
1373
|
}
|
|
@@ -1465,7 +1385,7 @@ class MatecuFileInput {
|
|
|
1465
1385
|
}
|
|
1466
1386
|
}
|
|
1467
1387
|
catch (error) {
|
|
1468
|
-
this.validationErrors.push(this.errorMessages.uploadError);
|
|
1388
|
+
this.validationErrors.push(this.errorMessages().uploadError);
|
|
1469
1389
|
}
|
|
1470
1390
|
}
|
|
1471
1391
|
if (this.validationErrors.length > 0) {
|
|
@@ -1474,7 +1394,7 @@ class MatecuFileInput {
|
|
|
1474
1394
|
return;
|
|
1475
1395
|
}
|
|
1476
1396
|
if (processedFiles.length > 0) {
|
|
1477
|
-
if (this.multiple) {
|
|
1397
|
+
if (this.multiple()) {
|
|
1478
1398
|
this.files = processedFiles;
|
|
1479
1399
|
this.filesSelected.emit([...this.files]);
|
|
1480
1400
|
this.notifyChange(this.files);
|
|
@@ -1489,14 +1409,14 @@ class MatecuFileInput {
|
|
|
1489
1409
|
}
|
|
1490
1410
|
}
|
|
1491
1411
|
catch (error) {
|
|
1492
|
-
this.validationErrors.push(this.errorMessages.uploadError);
|
|
1412
|
+
this.validationErrors.push(this.errorMessages().uploadError);
|
|
1493
1413
|
this.validationError.emit([...this.validationErrors]);
|
|
1494
1414
|
this.changeState(FileInputState.ERROR);
|
|
1495
1415
|
}
|
|
1496
1416
|
}
|
|
1497
1417
|
handleSingleFile(file) {
|
|
1498
1418
|
this.file = file;
|
|
1499
|
-
this.fileName = this.displayName || file.name;
|
|
1419
|
+
this.fileName = this.displayName() || file.name;
|
|
1500
1420
|
this.selectedFileSize = this.calculateFileSizeInMB(file);
|
|
1501
1421
|
this.generatePreview(file);
|
|
1502
1422
|
}
|
|
@@ -1506,9 +1426,10 @@ class MatecuFileInput {
|
|
|
1506
1426
|
this.fileName = files.length > 0 ? `${files.length} file(s) selected` : undefined;
|
|
1507
1427
|
}
|
|
1508
1428
|
async processFile(file) {
|
|
1509
|
-
|
|
1429
|
+
const optimizeImage = this.optimizeImage();
|
|
1430
|
+
if (optimizeImage && file.type.includes('image') && this.optimizeImageToSize()) {
|
|
1510
1431
|
try {
|
|
1511
|
-
return await
|
|
1432
|
+
return await optimizeImage(file);
|
|
1512
1433
|
}
|
|
1513
1434
|
catch (error) {
|
|
1514
1435
|
console.warn('Error optimizing image:', error);
|
|
@@ -1520,20 +1441,23 @@ class MatecuFileInput {
|
|
|
1520
1441
|
validateFile(file) {
|
|
1521
1442
|
const errors = [];
|
|
1522
1443
|
// Validar tamaño
|
|
1523
|
-
|
|
1524
|
-
|
|
1444
|
+
const maxFileSize = this.maxFileSize();
|
|
1445
|
+
if (maxFileSize && file.size > maxFileSize) {
|
|
1446
|
+
errors.push(this.errorMessages().invalidSize);
|
|
1525
1447
|
}
|
|
1526
1448
|
// Validar tipo MIME
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1449
|
+
const acceptedMimeTypes = this.acceptedMimeTypes();
|
|
1450
|
+
if (acceptedMimeTypes.length > 0) {
|
|
1451
|
+
if (!acceptedMimeTypes.some((type) => file.type.includes(type))) {
|
|
1452
|
+
errors.push(this.errorMessages().invalidType);
|
|
1530
1453
|
}
|
|
1531
1454
|
}
|
|
1532
1455
|
// Validar extensión
|
|
1533
|
-
|
|
1456
|
+
const acceptedExtensions = this.acceptedExtensions();
|
|
1457
|
+
if (acceptedExtensions.length > 0) {
|
|
1534
1458
|
const fileExtension = '.' + file.name.split('.').pop()?.toLowerCase();
|
|
1535
|
-
if (!
|
|
1536
|
-
errors.push(this.errorMessages.invalidType);
|
|
1459
|
+
if (!acceptedExtensions.some((ext) => ext.toLowerCase() === fileExtension)) {
|
|
1460
|
+
errors.push(this.errorMessages().invalidType);
|
|
1537
1461
|
}
|
|
1538
1462
|
}
|
|
1539
1463
|
return {
|
|
@@ -1543,7 +1467,7 @@ class MatecuFileInput {
|
|
|
1543
1467
|
}
|
|
1544
1468
|
generatePreview(file) {
|
|
1545
1469
|
this.cleanupPreview();
|
|
1546
|
-
if (this.showPreview && file.type.startsWith('image/')) {
|
|
1470
|
+
if (this.showPreview() && file.type.startsWith('image/')) {
|
|
1547
1471
|
const reader = new FileReader();
|
|
1548
1472
|
reader.onload = (e) => {
|
|
1549
1473
|
this.previewUrl = e.target?.result;
|
|
@@ -1601,8 +1525,9 @@ class MatecuFileInput {
|
|
|
1601
1525
|
const k = 1024;
|
|
1602
1526
|
const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB'];
|
|
1603
1527
|
// Si se especifica una unidad específica, usarla
|
|
1604
|
-
|
|
1605
|
-
|
|
1528
|
+
const fileSizeUnit = this.fileSizeUnit();
|
|
1529
|
+
if (fileSizeUnit !== 'AUTO') {
|
|
1530
|
+
const targetUnitIndex = sizes.indexOf(fileSizeUnit);
|
|
1606
1531
|
if (targetUnitIndex !== -1) {
|
|
1607
1532
|
const size = bytes / Math.pow(k, targetUnitIndex);
|
|
1608
1533
|
const formattedSize = targetUnitIndex === 0 ? size.toString() : size.toFixed(2);
|
|
@@ -1652,16 +1577,16 @@ class MatecuFileInput {
|
|
|
1652
1577
|
return this.currentState === FileInputState.LOADING;
|
|
1653
1578
|
}
|
|
1654
1579
|
get hasFiles() {
|
|
1655
|
-
return this.multiple ? this.files.length > 0 : !!this.file;
|
|
1580
|
+
return this.multiple() ? this.files.length > 0 : !!this.file;
|
|
1656
1581
|
}
|
|
1657
1582
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuFileInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1658
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuFileInput, isStandalone: true, selector: "matecu-file-input", inputs: { optimizeImage: "optimizeImage", optimizeImageToSize: "optimizeImageToSize", maxFileSize: "maxFileSize", maxFiles: "maxFiles", multiple: "multiple", showFileSize: "showFileSize", fileSizeUnit: "fileSizeUnit", displayName: "displayName", placeholder: "placeholder", buttonText: "buttonText", changeSelectedFileText: "changeSelectedFileText", loadingText: "loadingText", ariaLabel: "ariaLabel", acceptedMimeTypes: "acceptedMimeTypes", acceptedExtensions: "acceptedExtensions", errorMessages: "errorMessages", enableDragDrop: "enableDragDrop", showPreview: "showPreview", previewMaxWidth: "previewMaxWidth", previewMaxHeight: "previewMaxHeight", showProgress: "showProgress" }, outputs: { fileSelected: "fileSelected", filesSelected: "filesSelected", fileRemoved: "fileRemoved", validationError: "validationError", dragEnter: "dragEnter", dragLeave: "dragLeave", stateChange: "stateChange" }, providers: [
|
|
1583
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MatecuFileInput, isStandalone: true, selector: "matecu-file-input", inputs: { optimizeImage: { classPropertyName: "optimizeImage", publicName: "optimizeImage", isSignal: true, isRequired: false, transformFunction: null }, optimizeImageToSize: { classPropertyName: "optimizeImageToSize", publicName: "optimizeImageToSize", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null }, maxFiles: { classPropertyName: "maxFiles", publicName: "maxFiles", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showFileSize: { classPropertyName: "showFileSize", publicName: "showFileSize", isSignal: true, isRequired: false, transformFunction: null }, fileSizeUnit: { classPropertyName: "fileSizeUnit", publicName: "fileSizeUnit", isSignal: true, isRequired: false, transformFunction: null }, displayName: { classPropertyName: "displayName", publicName: "displayName", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, buttonText: { classPropertyName: "buttonText", publicName: "buttonText", isSignal: true, isRequired: false, transformFunction: null }, changeSelectedFileText: { classPropertyName: "changeSelectedFileText", publicName: "changeSelectedFileText", isSignal: true, isRequired: false, transformFunction: null }, loadingText: { classPropertyName: "loadingText", publicName: "loadingText", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, acceptedMimeTypes: { classPropertyName: "acceptedMimeTypes", publicName: "acceptedMimeTypes", isSignal: true, isRequired: false, transformFunction: null }, acceptedExtensions: { classPropertyName: "acceptedExtensions", publicName: "acceptedExtensions", isSignal: true, isRequired: false, transformFunction: null }, errorMessages: { classPropertyName: "errorMessages", publicName: "errorMessages", isSignal: true, isRequired: false, transformFunction: null }, enableDragDrop: { classPropertyName: "enableDragDrop", publicName: "enableDragDrop", isSignal: true, isRequired: false, transformFunction: null }, showPreview: { classPropertyName: "showPreview", publicName: "showPreview", isSignal: true, isRequired: false, transformFunction: null }, previewMaxWidth: { classPropertyName: "previewMaxWidth", publicName: "previewMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, previewMaxHeight: { classPropertyName: "previewMaxHeight", publicName: "previewMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, showProgress: { classPropertyName: "showProgress", publicName: "showProgress", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fileSelected: "fileSelected", filesSelected: "filesSelected", fileRemoved: "fileRemoved", validationError: "validationError", dragEnter: "dragEnter", dragLeave: "dragLeave", stateChange: "stateChange" }, providers: [
|
|
1659
1584
|
{
|
|
1660
1585
|
provide: NG_VALUE_ACCESSOR,
|
|
1661
1586
|
multi: true,
|
|
1662
1587
|
useExisting: MatecuFileInput,
|
|
1663
1588
|
},
|
|
1664
|
-
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<!-- Hidden file input -->\n<input type=\"file\" #fileInput (change)=\"onFileChange($event)\" [multiple]=\"multiple\" [disabled]=\"isDisabled\"\n [attr.aria-label]=\"ariaLabel || 'Select file'\" [attr.aria-describedby]=\"hasErrors ? 'file-input-errors' : null\"\n [accept]=\"acceptedMimeTypes.join(',')\" />\n\n<!-- Main drop zone and file display -->\n<div class=\"file-input-container\" [class.drag-over]=\"isDragOver\" [class.disabled]=\"isDisabled\"\n [class.has-files]=\"hasFiles\" [class.has-errors]=\"hasErrors\" [class.loading]=\"isLoading\"\n (dragover)=\"onDragOver($event)\" (dragleave)=\"onDragLeave($event)\" (drop)=\"onDrop($event)\"\n (click)=\"openFileDialog()\">\n <!-- Loading state -->\n @if (isLoading) {\n <div class=\"loading-container\">\n <div class=\"spinner\"></div>\n <span class=\"loading-text\">{{ loadingText }}</span>\n </div>\n }\n\n <!-- Empty state / Drop zone -->\n @if (!hasFiles && !isLoading) {\n <div class=\"drop-zone\">\n <div class=\"drop-zone-icon\">\n \uD83D\uDCC1\n </div>\n <div class=\"drop-zone-content\">\n <p class=\"drop-zone-title\">{{ placeholder }}</p>\n <button type=\"button\" class=\"select-button\" [disabled]=\"isDisabled\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ buttonText }}\n </button>\n @if (enableDragDrop && !isDisabled) {\n }\n </div>\n </div>\n }\n\n <!-- Single file display -->\n @if (!multiple && file && !isLoading) {\n <div class=\"single-file-display\">\n <div class=\"file-info\">\n <!-- File preview -->\n @if (showPreview && file.type.startsWith('image/')) {\n <div class=\"file-preview\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" [style.max-width.px]=\"previewMaxWidth\"\n [style.max-height.px]=\"previewMaxHeight\" />\n </div>\n } @else {\n <div class=\"file-icon\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-details\">\n <h3 class=\"file-name\">{{ displayName || file.name }}</h3>\n @if (showFileSize && selectedFileSize) {\n <p class=\"file-size\">\n {{ formatFileSize(file) }}\n </p>\n }\n <p class=\"file-type\">{{ file.type || 'Unknown type' }}</p>\n </div>\n </div>\n\n <button type=\"button\" class=\"remove-file-button\" (click)=\"removeFile(file); $event.stopPropagation()\"\n [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n\n <!-- Multiple files display -->\n @if (multiple && files.length > 0 && !isLoading) {\n <div class=\"multiple-files-display\">\n <div class=\"files-header\">\n @if (maxFiles > 1) {\n <span class=\"files-counter\">{{ files.length }} / {{ maxFiles }}</span>\n }\n </div>\n\n <div class=\"files-list\">\n @for (file of files; track file.name + file.size; let i = $index) {\n <div class=\"file-item\">\n <!-- File preview -->\n @if (showPreview && file.type.startsWith('image/')) {\n <div class=\"file-preview-small\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" />\n </div>\n } @else {\n <div class=\"file-icon-small\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-item-details\">\n <div class=\"file-item-name\">{{ file.name }}</div>\n @if (showFileSize) {\n <div class=\"file-item-size\">\n {{ formatFileSize(file) }}\n </div>\n }\n </div>\n\n <button type=\"button\" class=\"remove-file-button-small\"\n (click)=\"removeFile(file); $event.stopPropagation()\" [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n </div>\n\n <!-- Add more files button -->\n @if (files.length < maxFiles) { <button type=\"button\" class=\"add-more-button\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ changeSelectedFileText }}\n </button>\n }\n </div>\n }\n</div>\n\n<!-- Error messages -->\n@if (hasErrors) {\n<div id=\"file-input-errors\" class=\"error-messages\" role=\"alert\">\n @for (error of validationErrors; track error) {\n <div class=\"error-message\">{{ error }}</div>\n }\n</div>\n}", styles: [":host{display:block;width:100%}:host>*{box-sizing:border-box}:host{--matecu-file-input-color-primary: #4f46e5;--matecu-file-input-color-primary-hover: #4338ca;--matecu-file-input-color-success: #10b981;--matecu-file-input-color-error: #ef4444;--matecu-file-input-color-error-hover: #dc2626;--matecu-file-input-color-loading: #8b5cf6;--matecu-file-input-color-disabled: #9ca3af;--matecu-file-input-border-default: #e1e5e9;--matecu-file-input-border-hover: var(--matecu-file-input-color-primary);--matecu-file-input-border-success: var(--matecu-file-input-color-success);--matecu-file-input-border-error: var(--matecu-file-input-color-error);--matecu-file-input-border-loading: var(--matecu-file-input-color-loading);--matecu-file-input-border-separator: #e5e7eb;--matecu-file-input-bg-default: #fafbfc;--matecu-file-input-bg-hover: #f8faff;--matecu-file-input-bg-drag-over: #eef2ff;--matecu-file-input-bg-disabled: #f5f5f5;--matecu-file-input-bg-success: #f0fdf4;--matecu-file-input-bg-error: #fef2f2;--matecu-file-input-bg-loading: #faf5ff;--matecu-file-input-bg-surface: #ffffff;--matecu-file-input-bg-surface-alt: #f3f4f6;--matecu-file-input-text-primary: #111827;--matecu-file-input-text-secondary: #374151;--matecu-file-input-text-muted: #6b7280;--matecu-file-input-text-disabled: #9ca3af;--matecu-file-input-text-on-primary: #ffffff;--matecu-file-input-text-error: #dc2626;--matecu-file-input-button-primary-bg: var(--matecu-file-input-color-primary);--matecu-file-input-button-primary-bg-hover: var(--matecu-file-input-color-primary-hover);--matecu-file-input-button-primary-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-danger-bg: var(--matecu-file-input-color-error);--matecu-file-input-button-danger-bg-hover: var(--matecu-file-input-color-error-hover);--matecu-file-input-button-danger-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-disabled-bg: var(--matecu-file-input-color-disabled);--matecu-file-input-spinner-track: #e5e7eb;--matecu-file-input-spinner-fill: var(--matecu-file-input-color-loading);--matecu-file-input-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);--matecu-file-input-shadow-md: 0 1px 3px rgba(0, 0, 0, .1);--matecu-file-input-border-radius-sm: 4px;--matecu-file-input-border-radius-md: 6px;--matecu-file-input-border-radius-lg: 8px;--matecu-file-input-border-radius-xl: 12px;--matecu-file-input-border-width: 2px}:host input[type=file]{display:none}.file-input-container{position:relative;border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-default);border-radius:var(--matecu-file-input-border-radius-lg);padding:24px;transition:all .3s ease;background-color:var(--matecu-file-input-bg-default);cursor:pointer;min-height:120px;display:flex;align-items:center;justify-content:center}.file-input-container:hover:not(.disabled){border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-hover)}.file-input-container.drag-over{border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-drag-over);transform:scale(1.02)}.file-input-container.disabled{opacity:.6;cursor:not-allowed;background-color:var(--matecu-file-input-bg-disabled)}.file-input-container.has-files{border-style:solid;border-color:var(--matecu-file-input-border-success);background-color:var(--matecu-file-input-bg-success)}.file-input-container.has-errors{border-color:var(--matecu-file-input-border-error);background-color:var(--matecu-file-input-bg-error)}.file-input-container.loading{border-color:var(--matecu-file-input-border-loading);background-color:var(--matecu-file-input-bg-loading)}.loading-container{display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--matecu-file-input-text-muted)}.loading-container .spinner{width:32px;height:32px;border:3px solid var(--matecu-file-input-spinner-track);border-top:3px solid var(--matecu-file-input-spinner-fill);border-radius:50%;animation:spin 1s linear infinite}.loading-container .loading-text{font-size:14px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drop-zone{text-align:center;width:100%}.drop-zone .drop-zone-icon{font-size:48px;margin-bottom:16px}.drop-zone .drop-zone-content .drop-zone-title{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-secondary);margin-bottom:12px}.drop-zone .drop-zone-content .drop-zone-subtitle{font-size:14px;color:var(--matecu-file-input-text-muted);margin-top:8px}.drop-zone .select-button{background-color:var(--matecu-file-input-button-primary-bg);color:var(--matecu-file-input-button-primary-text);border:none;padding:12px 24px;border-radius:var(--matecu-file-input-border-radius-md);font-weight:500;cursor:pointer;transition:background-color .2s ease}.drop-zone .select-button:hover:not(:disabled){background-color:var(--matecu-file-input-button-primary-bg-hover)}.drop-zone .select-button:disabled{background-color:var(--matecu-file-input-button-disabled-bg);cursor:not-allowed}.single-file-display{box-sizing:border-box;display:grid;grid-template-columns:1fr 32px;align-items:center;justify-content:space-between;width:100%;padding:16px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-md)}.single-file-display .file-info{display:flex;align-items:center;gap:16px;overflow:hidden}.single-file-display .file-info .file-preview img{border-radius:var(--matecu-file-input-border-radius-sm);object-fit:cover}.single-file-display .file-info .file-icon{width:48px;height:48px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-md);display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--matecu-file-input-text-muted)}.single-file-display .file-info .file-details{max-width:calc(100% - 64px)}.single-file-display .file-info .file-details .file-name{max-width:100%;font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0 0 4px;display:inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.single-file-display .file-info .file-details .file-size{font-size:14px;color:var(--matecu-file-input-text-muted);margin:0 0 2px}.single-file-display .file-info .file-details .file-type{font-size:12px;color:var(--matecu-file-input-text-disabled);margin:0}.single-file-display .remove-file-button{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background-color .2s ease}.single-file-display .remove-file-button:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display{width:100%}.multiple-files-display .files-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .files-header h3{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0}.multiple-files-display .files-header .files-counter{font-size:14px;color:var(--matecu-file-input-text-muted);background-color:var(--matecu-file-input-bg-surface-alt);padding:4px 8px;border-radius:var(--matecu-file-input-border-radius-xl)}.multiple-files-display .files-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}.multiple-files-display .file-item{display:flex;align-items:center;gap:12px;padding:12px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-sm);border:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .file-item .file-preview-small,.multiple-files-display .file-item .file-icon-small{width:32px;height:32px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-sm);display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--matecu-file-input-text-muted);flex-shrink:0}.multiple-files-display .file-item .file-preview-small img,.multiple-files-display .file-item .file-icon-small img{width:100%;height:100%;object-fit:cover;border-radius:var(--matecu-file-input-border-radius-sm)}.multiple-files-display .file-item .file-item-details{flex:1;min-width:0}.multiple-files-display .file-item .file-item-details .file-item-name{font-size:14px;font-weight:500;color:var(--matecu-file-input-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.multiple-files-display .file-item .file-item-details .file-item-size{font-size:12px;color:var(--matecu-file-input-text-muted)}.multiple-files-display .file-item .remove-file-button-small{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:24px;height:24px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;flex-shrink:0;transition:background-color .2s ease}.multiple-files-display .file-item .remove-file-button-small:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display .add-more-button{width:100%;background-color:var(--matecu-file-input-bg-surface-alt);color:var(--matecu-file-input-text-muted);border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-separator);padding:12px;border-radius:var(--matecu-file-input-border-radius-md);cursor:pointer;font-weight:500;transition:all .2s ease}.multiple-files-display .add-more-button:hover{background-color:var(--matecu-file-input-bg-hover);border-color:var(--matecu-file-input-text-disabled)}.error-messages{margin-top:12px}.error-messages .error-message{background-color:var(--matecu-file-input-bg-error);color:var(--matecu-file-input-text-error);padding:8px 12px;border-radius:var(--matecu-file-input-border-radius-sm);border-left:4px solid var(--matecu-file-input-color-error);font-size:14px;margin-bottom:4px}.error-messages .error-message:last-child{margin-bottom:0}@media(max-width:640px){.file-input-container{padding:16px;min-height:100px}.single-file-display .file-info{gap:12px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info{flex-direction:column}}@media(max-width:640px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:40px;height:40px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:60px;height:60px}}@media(max-width:640px){.single-file-display .file-info .file-icon img,.single-file-display .file-info .file-preview img{width:100%;height:100%;object-fit:cover}.files-header{flex-direction:column;align-items:flex-start;gap:8px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1589
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<!-- Hidden file input -->\n<input type=\"file\" #fileInput (change)=\"onFileChange($event)\" [multiple]=\"multiple()\" [disabled]=\"isDisabled\"\n [attr.aria-label]=\"ariaLabel() || 'Select file'\" [attr.aria-describedby]=\"hasErrors ? 'file-input-errors' : null\"\n [accept]=\"acceptedMimeTypes().join(',')\" />\n\n<!-- Main drop zone and file display -->\n<div class=\"file-input-container\" [class.drag-over]=\"isDragOver\" [class.disabled]=\"isDisabled\"\n [class.has-files]=\"hasFiles\" [class.has-errors]=\"hasErrors\" [class.loading]=\"isLoading\"\n (dragover)=\"onDragOver($event)\" (dragleave)=\"onDragLeave($event)\" (drop)=\"onDrop($event)\"\n (click)=\"openFileDialog()\">\n <!-- Loading state -->\n @if (isLoading) {\n <div class=\"loading-container\">\n <div class=\"spinner\"></div>\n <span class=\"loading-text\">{{ loadingText() }}</span>\n </div>\n }\n\n <!-- Empty state / Drop zone -->\n @if (!hasFiles && !isLoading) {\n <div class=\"drop-zone\">\n <div class=\"drop-zone-icon\">\n \uD83D\uDCC1\n </div>\n <div class=\"drop-zone-content\">\n <p class=\"drop-zone-title\">{{ placeholder() }}</p>\n <button type=\"button\" class=\"select-button\" [disabled]=\"isDisabled\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ buttonText() }}\n </button>\n @if (enableDragDrop() && !isDisabled) {\n }\n </div>\n </div>\n }\n\n <!-- Single file display -->\n @if (!multiple() && file && !isLoading) {\n <div class=\"single-file-display\">\n <div class=\"file-info\">\n <!-- File preview -->\n @if (showPreview() && file.type.startsWith('image/')) {\n <div class=\"file-preview\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" [style.max-width.px]=\"previewMaxWidth()\"\n [style.max-height.px]=\"previewMaxHeight()\" />\n </div>\n } @else {\n <div class=\"file-icon\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-details\">\n <h3 class=\"file-name\">{{ displayName() || file.name }}</h3>\n @if (showFileSize() && selectedFileSize) {\n <p class=\"file-size\">\n {{ formatFileSize(file) }}\n </p>\n }\n <p class=\"file-type\">{{ file.type || 'Unknown type' }}</p>\n </div>\n </div>\n\n <button type=\"button\" class=\"remove-file-button\" (click)=\"removeFile(file); $event.stopPropagation()\"\n [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n\n <!-- Multiple files display -->\n @if (multiple() && files.length > 0 && !isLoading) {\n <div class=\"multiple-files-display\">\n <div class=\"files-header\">\n @if (maxFiles() > 1) {\n <span class=\"files-counter\">{{ files.length }} / {{ maxFiles() }}</span>\n }\n </div>\n\n <div class=\"files-list\">\n @for (file of files; track file.name + file.size; let i = $index) {\n <div class=\"file-item\">\n <!-- File preview -->\n @if (showPreview() && file.type.startsWith('image/')) {\n <div class=\"file-preview-small\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" />\n </div>\n } @else {\n <div class=\"file-icon-small\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-item-details\">\n <div class=\"file-item-name\">{{ file.name }}</div>\n @if (showFileSize()) {\n <div class=\"file-item-size\">\n {{ formatFileSize(file) }}\n </div>\n }\n </div>\n\n <button type=\"button\" class=\"remove-file-button-small\"\n (click)=\"removeFile(file); $event.stopPropagation()\" [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n </div>\n\n <!-- Add more files button -->\n @if (files.length < maxFiles()) { <button type=\"button\" class=\"add-more-button\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ changeSelectedFileText() }}\n </button>\n }\n </div>\n }\n</div>\n\n<!-- Error messages -->\n@if (hasErrors) {\n<div id=\"file-input-errors\" class=\"error-messages\" role=\"alert\">\n @for (error of validationErrors; track error) {\n <div class=\"error-message\">{{ error }}</div>\n }\n</div>\n}", styles: [":host{display:block;width:100%}:host>*{box-sizing:border-box}:host{--matecu-file-input-color-primary: #4f46e5;--matecu-file-input-color-primary-hover: #4338ca;--matecu-file-input-color-success: #10b981;--matecu-file-input-color-error: #ef4444;--matecu-file-input-color-error-hover: #dc2626;--matecu-file-input-color-loading: #8b5cf6;--matecu-file-input-color-disabled: #9ca3af;--matecu-file-input-border-default: #e1e5e9;--matecu-file-input-border-hover: var(--matecu-file-input-color-primary);--matecu-file-input-border-success: var(--matecu-file-input-color-success);--matecu-file-input-border-error: var(--matecu-file-input-color-error);--matecu-file-input-border-loading: var(--matecu-file-input-color-loading);--matecu-file-input-border-separator: #e5e7eb;--matecu-file-input-bg-default: #fafbfc;--matecu-file-input-bg-hover: #f8faff;--matecu-file-input-bg-drag-over: #eef2ff;--matecu-file-input-bg-disabled: #f5f5f5;--matecu-file-input-bg-success: #f0fdf4;--matecu-file-input-bg-error: #fef2f2;--matecu-file-input-bg-loading: #faf5ff;--matecu-file-input-bg-surface: #ffffff;--matecu-file-input-bg-surface-alt: #f3f4f6;--matecu-file-input-text-primary: #111827;--matecu-file-input-text-secondary: #374151;--matecu-file-input-text-muted: #6b7280;--matecu-file-input-text-disabled: #9ca3af;--matecu-file-input-text-on-primary: #ffffff;--matecu-file-input-text-error: #dc2626;--matecu-file-input-button-primary-bg: var(--matecu-file-input-color-primary);--matecu-file-input-button-primary-bg-hover: var(--matecu-file-input-color-primary-hover);--matecu-file-input-button-primary-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-danger-bg: var(--matecu-file-input-color-error);--matecu-file-input-button-danger-bg-hover: var(--matecu-file-input-color-error-hover);--matecu-file-input-button-danger-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-disabled-bg: var(--matecu-file-input-color-disabled);--matecu-file-input-spinner-track: #e5e7eb;--matecu-file-input-spinner-fill: var(--matecu-file-input-color-loading);--matecu-file-input-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);--matecu-file-input-shadow-md: 0 1px 3px rgba(0, 0, 0, .1);--matecu-file-input-border-radius-sm: 4px;--matecu-file-input-border-radius-md: 6px;--matecu-file-input-border-radius-lg: 8px;--matecu-file-input-border-radius-xl: 12px;--matecu-file-input-border-width: 2px}:host input[type=file]{display:none}.file-input-container{position:relative;border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-default);border-radius:var(--matecu-file-input-border-radius-lg);padding:24px;transition:all .3s ease;background-color:var(--matecu-file-input-bg-default);cursor:pointer;min-height:120px;display:flex;align-items:center;justify-content:center}.file-input-container:hover:not(.disabled){border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-hover)}.file-input-container.drag-over{border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-drag-over);transform:scale(1.02)}.file-input-container.disabled{opacity:.6;cursor:not-allowed;background-color:var(--matecu-file-input-bg-disabled)}.file-input-container.has-files{border-style:solid;border-color:var(--matecu-file-input-border-success);background-color:var(--matecu-file-input-bg-success)}.file-input-container.has-errors{border-color:var(--matecu-file-input-border-error);background-color:var(--matecu-file-input-bg-error)}.file-input-container.loading{border-color:var(--matecu-file-input-border-loading);background-color:var(--matecu-file-input-bg-loading)}.loading-container{display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--matecu-file-input-text-muted)}.loading-container .spinner{width:32px;height:32px;border:3px solid var(--matecu-file-input-spinner-track);border-top:3px solid var(--matecu-file-input-spinner-fill);border-radius:50%;animation:spin 1s linear infinite}.loading-container .loading-text{font-size:14px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drop-zone{text-align:center;width:100%}.drop-zone .drop-zone-icon{font-size:48px;margin-bottom:16px}.drop-zone .drop-zone-content .drop-zone-title{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-secondary);margin-bottom:12px}.drop-zone .drop-zone-content .drop-zone-subtitle{font-size:14px;color:var(--matecu-file-input-text-muted);margin-top:8px}.drop-zone .select-button{background-color:var(--matecu-file-input-button-primary-bg);color:var(--matecu-file-input-button-primary-text);border:none;padding:12px 24px;border-radius:var(--matecu-file-input-border-radius-md);font-weight:500;cursor:pointer;transition:background-color .2s ease}.drop-zone .select-button:hover:not(:disabled){background-color:var(--matecu-file-input-button-primary-bg-hover)}.drop-zone .select-button:disabled{background-color:var(--matecu-file-input-button-disabled-bg);cursor:not-allowed}.single-file-display{box-sizing:border-box;display:grid;grid-template-columns:1fr 32px;align-items:center;justify-content:space-between;width:100%;padding:16px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-md)}.single-file-display .file-info{display:flex;align-items:center;gap:16px;overflow:hidden}.single-file-display .file-info .file-preview img{border-radius:var(--matecu-file-input-border-radius-sm);object-fit:cover}.single-file-display .file-info .file-icon{width:48px;height:48px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-md);display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--matecu-file-input-text-muted)}.single-file-display .file-info .file-details{max-width:calc(100% - 64px)}.single-file-display .file-info .file-details .file-name{max-width:100%;font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0 0 4px;display:inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.single-file-display .file-info .file-details .file-size{font-size:14px;color:var(--matecu-file-input-text-muted);margin:0 0 2px}.single-file-display .file-info .file-details .file-type{font-size:12px;color:var(--matecu-file-input-text-disabled);margin:0}.single-file-display .remove-file-button{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background-color .2s ease}.single-file-display .remove-file-button:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display{width:100%}.multiple-files-display .files-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .files-header h3{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0}.multiple-files-display .files-header .files-counter{font-size:14px;color:var(--matecu-file-input-text-muted);background-color:var(--matecu-file-input-bg-surface-alt);padding:4px 8px;border-radius:var(--matecu-file-input-border-radius-xl)}.multiple-files-display .files-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}.multiple-files-display .file-item{display:flex;align-items:center;gap:12px;padding:12px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-sm);border:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .file-item .file-preview-small,.multiple-files-display .file-item .file-icon-small{width:32px;height:32px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-sm);display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--matecu-file-input-text-muted);flex-shrink:0}.multiple-files-display .file-item .file-preview-small img,.multiple-files-display .file-item .file-icon-small img{width:100%;height:100%;object-fit:cover;border-radius:var(--matecu-file-input-border-radius-sm)}.multiple-files-display .file-item .file-item-details{flex:1;min-width:0}.multiple-files-display .file-item .file-item-details .file-item-name{font-size:14px;font-weight:500;color:var(--matecu-file-input-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.multiple-files-display .file-item .file-item-details .file-item-size{font-size:12px;color:var(--matecu-file-input-text-muted)}.multiple-files-display .file-item .remove-file-button-small{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:24px;height:24px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;flex-shrink:0;transition:background-color .2s ease}.multiple-files-display .file-item .remove-file-button-small:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display .add-more-button{width:100%;background-color:var(--matecu-file-input-bg-surface-alt);color:var(--matecu-file-input-text-muted);border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-separator);padding:12px;border-radius:var(--matecu-file-input-border-radius-md);cursor:pointer;font-weight:500;transition:all .2s ease}.multiple-files-display .add-more-button:hover{background-color:var(--matecu-file-input-bg-hover);border-color:var(--matecu-file-input-text-disabled)}.error-messages{margin-top:12px}.error-messages .error-message{background-color:var(--matecu-file-input-bg-error);color:var(--matecu-file-input-text-error);padding:8px 12px;border-radius:var(--matecu-file-input-border-radius-sm);border-left:4px solid var(--matecu-file-input-color-error);font-size:14px;margin-bottom:4px}.error-messages .error-message:last-child{margin-bottom:0}@media(max-width:640px){.file-input-container{padding:16px;min-height:100px}.single-file-display .file-info{gap:12px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info{flex-direction:column}}@media(max-width:640px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:40px;height:40px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:60px;height:60px}}@media(max-width:640px){.single-file-display .file-info .file-icon img,.single-file-display .file-info .file-preview img{width:100%;height:100%;object-fit:cover}.files-header{flex-direction:column;align-items:flex-start;gap:8px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1665
1590
|
}
|
|
1666
1591
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuFileInput, decorators: [{
|
|
1667
1592
|
type: Component,
|
|
@@ -1671,82 +1596,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1671
1596
|
multi: true,
|
|
1672
1597
|
useExisting: MatecuFileInput,
|
|
1673
1598
|
},
|
|
1674
|
-
], template: "<!-- Hidden file input -->\n<input type=\"file\" #fileInput (change)=\"onFileChange($event)\" [multiple]=\"multiple\" [disabled]=\"isDisabled\"\n [attr.aria-label]=\"ariaLabel || 'Select file'\" [attr.aria-describedby]=\"hasErrors ? 'file-input-errors' : null\"\n [accept]=\"acceptedMimeTypes.join(',')\" />\n\n<!-- Main drop zone and file display -->\n<div class=\"file-input-container\" [class.drag-over]=\"isDragOver\" [class.disabled]=\"isDisabled\"\n [class.has-files]=\"hasFiles\" [class.has-errors]=\"hasErrors\" [class.loading]=\"isLoading\"\n (dragover)=\"onDragOver($event)\" (dragleave)=\"onDragLeave($event)\" (drop)=\"onDrop($event)\"\n (click)=\"openFileDialog()\">\n <!-- Loading state -->\n @if (isLoading) {\n <div class=\"loading-container\">\n <div class=\"spinner\"></div>\n <span class=\"loading-text\">{{ loadingText }}</span>\n </div>\n }\n\n <!-- Empty state / Drop zone -->\n @if (!hasFiles && !isLoading) {\n <div class=\"drop-zone\">\n <div class=\"drop-zone-icon\">\n \uD83D\uDCC1\n </div>\n <div class=\"drop-zone-content\">\n <p class=\"drop-zone-title\">{{ placeholder }}</p>\n <button type=\"button\" class=\"select-button\" [disabled]=\"isDisabled\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ buttonText }}\n </button>\n @if (enableDragDrop && !isDisabled) {\n }\n </div>\n </div>\n }\n\n <!-- Single file display -->\n @if (!multiple && file && !isLoading) {\n <div class=\"single-file-display\">\n <div class=\"file-info\">\n <!-- File preview -->\n @if (showPreview && file.type.startsWith('image/')) {\n <div class=\"file-preview\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" [style.max-width.px]=\"previewMaxWidth\"\n [style.max-height.px]=\"previewMaxHeight\" />\n </div>\n } @else {\n <div class=\"file-icon\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-details\">\n <h3 class=\"file-name\">{{ displayName || file.name }}</h3>\n @if (showFileSize && selectedFileSize) {\n <p class=\"file-size\">\n {{ formatFileSize(file) }}\n </p>\n }\n <p class=\"file-type\">{{ file.type || 'Unknown type' }}</p>\n </div>\n </div>\n\n <button type=\"button\" class=\"remove-file-button\" (click)=\"removeFile(file); $event.stopPropagation()\"\n [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n\n <!-- Multiple files display -->\n @if (multiple && files.length > 0 && !isLoading) {\n <div class=\"multiple-files-display\">\n <div class=\"files-header\">\n @if (maxFiles > 1) {\n <span class=\"files-counter\">{{ files.length }} / {{ maxFiles }}</span>\n }\n </div>\n\n <div class=\"files-list\">\n @for (file of files; track file.name + file.size; let i = $index) {\n <div class=\"file-item\">\n <!-- File preview -->\n @if (showPreview && file.type.startsWith('image/')) {\n <div class=\"file-preview-small\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" />\n </div>\n } @else {\n <div class=\"file-icon-small\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-item-details\">\n <div class=\"file-item-name\">{{ file.name }}</div>\n @if (showFileSize) {\n <div class=\"file-item-size\">\n {{ formatFileSize(file) }}\n </div>\n }\n </div>\n\n <button type=\"button\" class=\"remove-file-button-small\"\n (click)=\"removeFile(file); $event.stopPropagation()\" [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n </div>\n\n <!-- Add more files button -->\n @if (files.length < maxFiles) { <button type=\"button\" class=\"add-more-button\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ changeSelectedFileText }}\n </button>\n }\n </div>\n }\n</div>\n\n<!-- Error messages -->\n@if (hasErrors) {\n<div id=\"file-input-errors\" class=\"error-messages\" role=\"alert\">\n @for (error of validationErrors; track error) {\n <div class=\"error-message\">{{ error }}</div>\n }\n</div>\n}", styles: [":host{display:block;width:100%}:host>*{box-sizing:border-box}:host{--matecu-file-input-color-primary: #4f46e5;--matecu-file-input-color-primary-hover: #4338ca;--matecu-file-input-color-success: #10b981;--matecu-file-input-color-error: #ef4444;--matecu-file-input-color-error-hover: #dc2626;--matecu-file-input-color-loading: #8b5cf6;--matecu-file-input-color-disabled: #9ca3af;--matecu-file-input-border-default: #e1e5e9;--matecu-file-input-border-hover: var(--matecu-file-input-color-primary);--matecu-file-input-border-success: var(--matecu-file-input-color-success);--matecu-file-input-border-error: var(--matecu-file-input-color-error);--matecu-file-input-border-loading: var(--matecu-file-input-color-loading);--matecu-file-input-border-separator: #e5e7eb;--matecu-file-input-bg-default: #fafbfc;--matecu-file-input-bg-hover: #f8faff;--matecu-file-input-bg-drag-over: #eef2ff;--matecu-file-input-bg-disabled: #f5f5f5;--matecu-file-input-bg-success: #f0fdf4;--matecu-file-input-bg-error: #fef2f2;--matecu-file-input-bg-loading: #faf5ff;--matecu-file-input-bg-surface: #ffffff;--matecu-file-input-bg-surface-alt: #f3f4f6;--matecu-file-input-text-primary: #111827;--matecu-file-input-text-secondary: #374151;--matecu-file-input-text-muted: #6b7280;--matecu-file-input-text-disabled: #9ca3af;--matecu-file-input-text-on-primary: #ffffff;--matecu-file-input-text-error: #dc2626;--matecu-file-input-button-primary-bg: var(--matecu-file-input-color-primary);--matecu-file-input-button-primary-bg-hover: var(--matecu-file-input-color-primary-hover);--matecu-file-input-button-primary-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-danger-bg: var(--matecu-file-input-color-error);--matecu-file-input-button-danger-bg-hover: var(--matecu-file-input-color-error-hover);--matecu-file-input-button-danger-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-disabled-bg: var(--matecu-file-input-color-disabled);--matecu-file-input-spinner-track: #e5e7eb;--matecu-file-input-spinner-fill: var(--matecu-file-input-color-loading);--matecu-file-input-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);--matecu-file-input-shadow-md: 0 1px 3px rgba(0, 0, 0, .1);--matecu-file-input-border-radius-sm: 4px;--matecu-file-input-border-radius-md: 6px;--matecu-file-input-border-radius-lg: 8px;--matecu-file-input-border-radius-xl: 12px;--matecu-file-input-border-width: 2px}:host input[type=file]{display:none}.file-input-container{position:relative;border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-default);border-radius:var(--matecu-file-input-border-radius-lg);padding:24px;transition:all .3s ease;background-color:var(--matecu-file-input-bg-default);cursor:pointer;min-height:120px;display:flex;align-items:center;justify-content:center}.file-input-container:hover:not(.disabled){border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-hover)}.file-input-container.drag-over{border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-drag-over);transform:scale(1.02)}.file-input-container.disabled{opacity:.6;cursor:not-allowed;background-color:var(--matecu-file-input-bg-disabled)}.file-input-container.has-files{border-style:solid;border-color:var(--matecu-file-input-border-success);background-color:var(--matecu-file-input-bg-success)}.file-input-container.has-errors{border-color:var(--matecu-file-input-border-error);background-color:var(--matecu-file-input-bg-error)}.file-input-container.loading{border-color:var(--matecu-file-input-border-loading);background-color:var(--matecu-file-input-bg-loading)}.loading-container{display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--matecu-file-input-text-muted)}.loading-container .spinner{width:32px;height:32px;border:3px solid var(--matecu-file-input-spinner-track);border-top:3px solid var(--matecu-file-input-spinner-fill);border-radius:50%;animation:spin 1s linear infinite}.loading-container .loading-text{font-size:14px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drop-zone{text-align:center;width:100%}.drop-zone .drop-zone-icon{font-size:48px;margin-bottom:16px}.drop-zone .drop-zone-content .drop-zone-title{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-secondary);margin-bottom:12px}.drop-zone .drop-zone-content .drop-zone-subtitle{font-size:14px;color:var(--matecu-file-input-text-muted);margin-top:8px}.drop-zone .select-button{background-color:var(--matecu-file-input-button-primary-bg);color:var(--matecu-file-input-button-primary-text);border:none;padding:12px 24px;border-radius:var(--matecu-file-input-border-radius-md);font-weight:500;cursor:pointer;transition:background-color .2s ease}.drop-zone .select-button:hover:not(:disabled){background-color:var(--matecu-file-input-button-primary-bg-hover)}.drop-zone .select-button:disabled{background-color:var(--matecu-file-input-button-disabled-bg);cursor:not-allowed}.single-file-display{box-sizing:border-box;display:grid;grid-template-columns:1fr 32px;align-items:center;justify-content:space-between;width:100%;padding:16px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-md)}.single-file-display .file-info{display:flex;align-items:center;gap:16px;overflow:hidden}.single-file-display .file-info .file-preview img{border-radius:var(--matecu-file-input-border-radius-sm);object-fit:cover}.single-file-display .file-info .file-icon{width:48px;height:48px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-md);display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--matecu-file-input-text-muted)}.single-file-display .file-info .file-details{max-width:calc(100% - 64px)}.single-file-display .file-info .file-details .file-name{max-width:100%;font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0 0 4px;display:inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.single-file-display .file-info .file-details .file-size{font-size:14px;color:var(--matecu-file-input-text-muted);margin:0 0 2px}.single-file-display .file-info .file-details .file-type{font-size:12px;color:var(--matecu-file-input-text-disabled);margin:0}.single-file-display .remove-file-button{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background-color .2s ease}.single-file-display .remove-file-button:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display{width:100%}.multiple-files-display .files-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .files-header h3{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0}.multiple-files-display .files-header .files-counter{font-size:14px;color:var(--matecu-file-input-text-muted);background-color:var(--matecu-file-input-bg-surface-alt);padding:4px 8px;border-radius:var(--matecu-file-input-border-radius-xl)}.multiple-files-display .files-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}.multiple-files-display .file-item{display:flex;align-items:center;gap:12px;padding:12px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-sm);border:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .file-item .file-preview-small,.multiple-files-display .file-item .file-icon-small{width:32px;height:32px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-sm);display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--matecu-file-input-text-muted);flex-shrink:0}.multiple-files-display .file-item .file-preview-small img,.multiple-files-display .file-item .file-icon-small img{width:100%;height:100%;object-fit:cover;border-radius:var(--matecu-file-input-border-radius-sm)}.multiple-files-display .file-item .file-item-details{flex:1;min-width:0}.multiple-files-display .file-item .file-item-details .file-item-name{font-size:14px;font-weight:500;color:var(--matecu-file-input-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.multiple-files-display .file-item .file-item-details .file-item-size{font-size:12px;color:var(--matecu-file-input-text-muted)}.multiple-files-display .file-item .remove-file-button-small{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:24px;height:24px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;flex-shrink:0;transition:background-color .2s ease}.multiple-files-display .file-item .remove-file-button-small:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display .add-more-button{width:100%;background-color:var(--matecu-file-input-bg-surface-alt);color:var(--matecu-file-input-text-muted);border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-separator);padding:12px;border-radius:var(--matecu-file-input-border-radius-md);cursor:pointer;font-weight:500;transition:all .2s ease}.multiple-files-display .add-more-button:hover{background-color:var(--matecu-file-input-bg-hover);border-color:var(--matecu-file-input-text-disabled)}.error-messages{margin-top:12px}.error-messages .error-message{background-color:var(--matecu-file-input-bg-error);color:var(--matecu-file-input-text-error);padding:8px 12px;border-radius:var(--matecu-file-input-border-radius-sm);border-left:4px solid var(--matecu-file-input-color-error);font-size:14px;margin-bottom:4px}.error-messages .error-message:last-child{margin-bottom:0}@media(max-width:640px){.file-input-container{padding:16px;min-height:100px}.single-file-display .file-info{gap:12px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info{flex-direction:column}}@media(max-width:640px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:40px;height:40px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:60px;height:60px}}@media(max-width:640px){.single-file-display .file-info .file-icon img,.single-file-display .file-info .file-preview img{width:100%;height:100%;object-fit:cover}.files-header{flex-direction:column;align-items:flex-start;gap:8px}}\n"] }]
|
|
1599
|
+
], template: "<!-- Hidden file input -->\n<input type=\"file\" #fileInput (change)=\"onFileChange($event)\" [multiple]=\"multiple()\" [disabled]=\"isDisabled\"\n [attr.aria-label]=\"ariaLabel() || 'Select file'\" [attr.aria-describedby]=\"hasErrors ? 'file-input-errors' : null\"\n [accept]=\"acceptedMimeTypes().join(',')\" />\n\n<!-- Main drop zone and file display -->\n<div class=\"file-input-container\" [class.drag-over]=\"isDragOver\" [class.disabled]=\"isDisabled\"\n [class.has-files]=\"hasFiles\" [class.has-errors]=\"hasErrors\" [class.loading]=\"isLoading\"\n (dragover)=\"onDragOver($event)\" (dragleave)=\"onDragLeave($event)\" (drop)=\"onDrop($event)\"\n (click)=\"openFileDialog()\">\n <!-- Loading state -->\n @if (isLoading) {\n <div class=\"loading-container\">\n <div class=\"spinner\"></div>\n <span class=\"loading-text\">{{ loadingText() }}</span>\n </div>\n }\n\n <!-- Empty state / Drop zone -->\n @if (!hasFiles && !isLoading) {\n <div class=\"drop-zone\">\n <div class=\"drop-zone-icon\">\n \uD83D\uDCC1\n </div>\n <div class=\"drop-zone-content\">\n <p class=\"drop-zone-title\">{{ placeholder() }}</p>\n <button type=\"button\" class=\"select-button\" [disabled]=\"isDisabled\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ buttonText() }}\n </button>\n @if (enableDragDrop() && !isDisabled) {\n }\n </div>\n </div>\n }\n\n <!-- Single file display -->\n @if (!multiple() && file && !isLoading) {\n <div class=\"single-file-display\">\n <div class=\"file-info\">\n <!-- File preview -->\n @if (showPreview() && file.type.startsWith('image/')) {\n <div class=\"file-preview\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" [style.max-width.px]=\"previewMaxWidth()\"\n [style.max-height.px]=\"previewMaxHeight()\" />\n </div>\n } @else {\n <div class=\"file-icon\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-details\">\n <h3 class=\"file-name\">{{ displayName() || file.name }}</h3>\n @if (showFileSize() && selectedFileSize) {\n <p class=\"file-size\">\n {{ formatFileSize(file) }}\n </p>\n }\n <p class=\"file-type\">{{ file.type || 'Unknown type' }}</p>\n </div>\n </div>\n\n <button type=\"button\" class=\"remove-file-button\" (click)=\"removeFile(file); $event.stopPropagation()\"\n [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n\n <!-- Multiple files display -->\n @if (multiple() && files.length > 0 && !isLoading) {\n <div class=\"multiple-files-display\">\n <div class=\"files-header\">\n @if (maxFiles() > 1) {\n <span class=\"files-counter\">{{ files.length }} / {{ maxFiles() }}</span>\n }\n </div>\n\n <div class=\"files-list\">\n @for (file of files; track file.name + file.size; let i = $index) {\n <div class=\"file-item\">\n <!-- File preview -->\n @if (showPreview() && file.type.startsWith('image/')) {\n <div class=\"file-preview-small\">\n <img [src]=\"getPreviewUrl(file)\" [alt]=\"file.name\" />\n </div>\n } @else {\n <div class=\"file-icon-small\">\n {{ getFileIcon(file) }}\n </div>\n }\n\n <div class=\"file-item-details\">\n <div class=\"file-item-name\">{{ file.name }}</div>\n @if (showFileSize()) {\n <div class=\"file-item-size\">\n {{ formatFileSize(file) }}\n </div>\n }\n </div>\n\n <button type=\"button\" class=\"remove-file-button-small\"\n (click)=\"removeFile(file); $event.stopPropagation()\" [attr.aria-label]=\"'Remove ' + file.name\">\n \u2715\n </button>\n </div>\n }\n </div>\n\n <!-- Add more files button -->\n @if (files.length < maxFiles()) { <button type=\"button\" class=\"add-more-button\"\n (click)=\"openFileDialog(); $event.stopPropagation()\">\n {{ changeSelectedFileText() }}\n </button>\n }\n </div>\n }\n</div>\n\n<!-- Error messages -->\n@if (hasErrors) {\n<div id=\"file-input-errors\" class=\"error-messages\" role=\"alert\">\n @for (error of validationErrors; track error) {\n <div class=\"error-message\">{{ error }}</div>\n }\n</div>\n}", styles: [":host{display:block;width:100%}:host>*{box-sizing:border-box}:host{--matecu-file-input-color-primary: #4f46e5;--matecu-file-input-color-primary-hover: #4338ca;--matecu-file-input-color-success: #10b981;--matecu-file-input-color-error: #ef4444;--matecu-file-input-color-error-hover: #dc2626;--matecu-file-input-color-loading: #8b5cf6;--matecu-file-input-color-disabled: #9ca3af;--matecu-file-input-border-default: #e1e5e9;--matecu-file-input-border-hover: var(--matecu-file-input-color-primary);--matecu-file-input-border-success: var(--matecu-file-input-color-success);--matecu-file-input-border-error: var(--matecu-file-input-color-error);--matecu-file-input-border-loading: var(--matecu-file-input-color-loading);--matecu-file-input-border-separator: #e5e7eb;--matecu-file-input-bg-default: #fafbfc;--matecu-file-input-bg-hover: #f8faff;--matecu-file-input-bg-drag-over: #eef2ff;--matecu-file-input-bg-disabled: #f5f5f5;--matecu-file-input-bg-success: #f0fdf4;--matecu-file-input-bg-error: #fef2f2;--matecu-file-input-bg-loading: #faf5ff;--matecu-file-input-bg-surface: #ffffff;--matecu-file-input-bg-surface-alt: #f3f4f6;--matecu-file-input-text-primary: #111827;--matecu-file-input-text-secondary: #374151;--matecu-file-input-text-muted: #6b7280;--matecu-file-input-text-disabled: #9ca3af;--matecu-file-input-text-on-primary: #ffffff;--matecu-file-input-text-error: #dc2626;--matecu-file-input-button-primary-bg: var(--matecu-file-input-color-primary);--matecu-file-input-button-primary-bg-hover: var(--matecu-file-input-color-primary-hover);--matecu-file-input-button-primary-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-danger-bg: var(--matecu-file-input-color-error);--matecu-file-input-button-danger-bg-hover: var(--matecu-file-input-color-error-hover);--matecu-file-input-button-danger-text: var(--matecu-file-input-text-on-primary);--matecu-file-input-button-disabled-bg: var(--matecu-file-input-color-disabled);--matecu-file-input-spinner-track: #e5e7eb;--matecu-file-input-spinner-fill: var(--matecu-file-input-color-loading);--matecu-file-input-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);--matecu-file-input-shadow-md: 0 1px 3px rgba(0, 0, 0, .1);--matecu-file-input-border-radius-sm: 4px;--matecu-file-input-border-radius-md: 6px;--matecu-file-input-border-radius-lg: 8px;--matecu-file-input-border-radius-xl: 12px;--matecu-file-input-border-width: 2px}:host input[type=file]{display:none}.file-input-container{position:relative;border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-default);border-radius:var(--matecu-file-input-border-radius-lg);padding:24px;transition:all .3s ease;background-color:var(--matecu-file-input-bg-default);cursor:pointer;min-height:120px;display:flex;align-items:center;justify-content:center}.file-input-container:hover:not(.disabled){border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-hover)}.file-input-container.drag-over{border-color:var(--matecu-file-input-border-hover);background-color:var(--matecu-file-input-bg-drag-over);transform:scale(1.02)}.file-input-container.disabled{opacity:.6;cursor:not-allowed;background-color:var(--matecu-file-input-bg-disabled)}.file-input-container.has-files{border-style:solid;border-color:var(--matecu-file-input-border-success);background-color:var(--matecu-file-input-bg-success)}.file-input-container.has-errors{border-color:var(--matecu-file-input-border-error);background-color:var(--matecu-file-input-bg-error)}.file-input-container.loading{border-color:var(--matecu-file-input-border-loading);background-color:var(--matecu-file-input-bg-loading)}.loading-container{display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--matecu-file-input-text-muted)}.loading-container .spinner{width:32px;height:32px;border:3px solid var(--matecu-file-input-spinner-track);border-top:3px solid var(--matecu-file-input-spinner-fill);border-radius:50%;animation:spin 1s linear infinite}.loading-container .loading-text{font-size:14px;font-weight:500}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.drop-zone{text-align:center;width:100%}.drop-zone .drop-zone-icon{font-size:48px;margin-bottom:16px}.drop-zone .drop-zone-content .drop-zone-title{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-secondary);margin-bottom:12px}.drop-zone .drop-zone-content .drop-zone-subtitle{font-size:14px;color:var(--matecu-file-input-text-muted);margin-top:8px}.drop-zone .select-button{background-color:var(--matecu-file-input-button-primary-bg);color:var(--matecu-file-input-button-primary-text);border:none;padding:12px 24px;border-radius:var(--matecu-file-input-border-radius-md);font-weight:500;cursor:pointer;transition:background-color .2s ease}.drop-zone .select-button:hover:not(:disabled){background-color:var(--matecu-file-input-button-primary-bg-hover)}.drop-zone .select-button:disabled{background-color:var(--matecu-file-input-button-disabled-bg);cursor:not-allowed}.single-file-display{box-sizing:border-box;display:grid;grid-template-columns:1fr 32px;align-items:center;justify-content:space-between;width:100%;padding:16px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-md)}.single-file-display .file-info{display:flex;align-items:center;gap:16px;overflow:hidden}.single-file-display .file-info .file-preview img{border-radius:var(--matecu-file-input-border-radius-sm);object-fit:cover}.single-file-display .file-info .file-icon{width:48px;height:48px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-md);display:flex;align-items:center;justify-content:center;font-size:24px;color:var(--matecu-file-input-text-muted)}.single-file-display .file-info .file-details{max-width:calc(100% - 64px)}.single-file-display .file-info .file-details .file-name{max-width:100%;font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0 0 4px;display:inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.single-file-display .file-info .file-details .file-size{font-size:14px;color:var(--matecu-file-input-text-muted);margin:0 0 2px}.single-file-display .file-info .file-details .file-type{font-size:12px;color:var(--matecu-file-input-text-disabled);margin:0}.single-file-display .remove-file-button{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background-color .2s ease}.single-file-display .remove-file-button:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display{width:100%}.multiple-files-display .files-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;padding-bottom:8px;border-bottom:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .files-header h3{font-size:16px;font-weight:600;color:var(--matecu-file-input-text-primary);margin:0}.multiple-files-display .files-header .files-counter{font-size:14px;color:var(--matecu-file-input-text-muted);background-color:var(--matecu-file-input-bg-surface-alt);padding:4px 8px;border-radius:var(--matecu-file-input-border-radius-xl)}.multiple-files-display .files-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}.multiple-files-display .file-item{display:flex;align-items:center;gap:12px;padding:12px;background-color:var(--matecu-file-input-bg-surface);border-radius:var(--matecu-file-input-border-radius-md);box-shadow:var(--matecu-file-input-shadow-sm);border:1px solid var(--matecu-file-input-border-separator)}.multiple-files-display .file-item .file-preview-small,.multiple-files-display .file-item .file-icon-small{width:32px;height:32px;background-color:var(--matecu-file-input-bg-surface-alt);border-radius:var(--matecu-file-input-border-radius-sm);display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--matecu-file-input-text-muted);flex-shrink:0}.multiple-files-display .file-item .file-preview-small img,.multiple-files-display .file-item .file-icon-small img{width:100%;height:100%;object-fit:cover;border-radius:var(--matecu-file-input-border-radius-sm)}.multiple-files-display .file-item .file-item-details{flex:1;min-width:0}.multiple-files-display .file-item .file-item-details .file-item-name{font-size:14px;font-weight:500;color:var(--matecu-file-input-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.multiple-files-display .file-item .file-item-details .file-item-size{font-size:12px;color:var(--matecu-file-input-text-muted)}.multiple-files-display .file-item .remove-file-button-small{background-color:var(--matecu-file-input-button-danger-bg);color:var(--matecu-file-input-button-danger-text);border:none;width:24px;height:24px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;flex-shrink:0;transition:background-color .2s ease}.multiple-files-display .file-item .remove-file-button-small:hover{background-color:var(--matecu-file-input-button-danger-bg-hover)}.multiple-files-display .add-more-button{width:100%;background-color:var(--matecu-file-input-bg-surface-alt);color:var(--matecu-file-input-text-muted);border:var(--matecu-file-input-border-width) dashed var(--matecu-file-input-border-separator);padding:12px;border-radius:var(--matecu-file-input-border-radius-md);cursor:pointer;font-weight:500;transition:all .2s ease}.multiple-files-display .add-more-button:hover{background-color:var(--matecu-file-input-bg-hover);border-color:var(--matecu-file-input-text-disabled)}.error-messages{margin-top:12px}.error-messages .error-message{background-color:var(--matecu-file-input-bg-error);color:var(--matecu-file-input-text-error);padding:8px 12px;border-radius:var(--matecu-file-input-border-radius-sm);border-left:4px solid var(--matecu-file-input-color-error);font-size:14px;margin-bottom:4px}.error-messages .error-message:last-child{margin-bottom:0}@media(max-width:640px){.file-input-container{padding:16px;min-height:100px}.single-file-display .file-info{gap:12px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info{flex-direction:column}}@media(max-width:640px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:40px;height:40px}}@media screen and (max-width:640px)and (max-width:425px){.single-file-display .file-info .file-icon,.single-file-display .file-info .file-preview{width:60px;height:60px}}@media(max-width:640px){.single-file-display .file-info .file-icon img,.single-file-display .file-info .file-preview img{width:100%;height:100%;object-fit:cover}.files-header{flex-direction:column;align-items:flex-start;gap:8px}}\n"] }]
|
|
1675
1600
|
}], propDecorators: { fileInput: [{
|
|
1676
1601
|
type: ViewChild,
|
|
1677
1602
|
args: ['fileInput']
|
|
1678
|
-
}], optimizeImage: [{
|
|
1679
|
-
type: Input
|
|
1680
|
-
}], optimizeImageToSize: [{
|
|
1681
|
-
type: Input
|
|
1682
|
-
}], maxFileSize: [{
|
|
1683
|
-
type: Input
|
|
1684
|
-
}], maxFiles: [{
|
|
1685
|
-
type: Input
|
|
1686
|
-
}], multiple: [{
|
|
1687
|
-
type: Input
|
|
1688
|
-
}], showFileSize: [{
|
|
1689
|
-
type: Input
|
|
1690
|
-
}], fileSizeUnit: [{
|
|
1691
|
-
type: Input
|
|
1692
|
-
}], displayName: [{
|
|
1693
|
-
type: Input
|
|
1694
|
-
}], placeholder: [{
|
|
1695
|
-
type: Input
|
|
1696
|
-
}], buttonText: [{
|
|
1697
|
-
type: Input
|
|
1698
|
-
}], changeSelectedFileText: [{
|
|
1699
|
-
type: Input
|
|
1700
|
-
}], loadingText: [{
|
|
1701
|
-
type: Input
|
|
1702
|
-
}], ariaLabel: [{
|
|
1703
|
-
type: Input
|
|
1704
|
-
}], acceptedMimeTypes: [{
|
|
1705
|
-
type: Input
|
|
1706
|
-
}], acceptedExtensions: [{
|
|
1707
|
-
type: Input
|
|
1708
|
-
}], errorMessages: [{
|
|
1709
|
-
type: Input
|
|
1710
|
-
}], enableDragDrop: [{
|
|
1711
|
-
type: Input
|
|
1712
|
-
}], showPreview: [{
|
|
1713
|
-
type: Input
|
|
1714
|
-
}], previewMaxWidth: [{
|
|
1715
|
-
type: Input
|
|
1716
|
-
}], previewMaxHeight: [{
|
|
1717
|
-
type: Input
|
|
1718
|
-
}], showProgress: [{
|
|
1719
|
-
type: Input
|
|
1720
|
-
}], fileSelected: [{
|
|
1721
|
-
type: Output
|
|
1722
|
-
}], filesSelected: [{
|
|
1723
|
-
type: Output
|
|
1724
|
-
}], fileRemoved: [{
|
|
1725
|
-
type: Output
|
|
1726
|
-
}], validationError: [{
|
|
1727
|
-
type: Output
|
|
1728
|
-
}], dragEnter: [{
|
|
1729
|
-
type: Output
|
|
1730
|
-
}], dragLeave: [{
|
|
1731
|
-
type: Output
|
|
1732
|
-
}], stateChange: [{
|
|
1733
|
-
type: Output
|
|
1734
|
-
}] } });
|
|
1603
|
+
}], optimizeImage: [{ type: i0.Input, args: [{ isSignal: true, alias: "optimizeImage", required: false }] }], optimizeImageToSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "optimizeImageToSize", required: false }] }], maxFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFileSize", required: false }] }], maxFiles: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFiles", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showFileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFileSize", required: false }] }], fileSizeUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileSizeUnit", required: false }] }], displayName: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayName", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], buttonText: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonText", required: false }] }], changeSelectedFileText: [{ type: i0.Input, args: [{ isSignal: true, alias: "changeSelectedFileText", required: false }] }], loadingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingText", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], acceptedMimeTypes: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptedMimeTypes", required: false }] }], acceptedExtensions: [{ type: i0.Input, args: [{ isSignal: true, alias: "acceptedExtensions", required: false }] }], errorMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessages", required: false }] }], enableDragDrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableDragDrop", required: false }] }], showPreview: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPreview", required: false }] }], previewMaxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewMaxWidth", required: false }] }], previewMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewMaxHeight", required: false }] }], showProgress: [{ type: i0.Input, args: [{ isSignal: true, alias: "showProgress", required: false }] }], fileSelected: [{ type: i0.Output, args: ["fileSelected"] }], filesSelected: [{ type: i0.Output, args: ["filesSelected"] }], fileRemoved: [{ type: i0.Output, args: ["fileRemoved"] }], validationError: [{ type: i0.Output, args: ["validationError"] }], dragEnter: [{ type: i0.Output, args: ["dragEnter"] }], dragLeave: [{ type: i0.Output, args: ["dragLeave"] }], stateChange: [{ type: i0.Output, args: ["stateChange"] }] } });
|
|
1735
1604
|
|
|
1736
1605
|
class MatecuDatetimePicker {
|
|
1737
1606
|
value = null;
|
|
1738
1607
|
disabled = false;
|
|
1739
|
-
dateLabel = 'Select date';
|
|
1740
|
-
timeLabel = 'Select time';
|
|
1741
|
-
apparance = 'fill';
|
|
1742
|
-
matTimepickerMin = null;
|
|
1743
|
-
matTimepickerMax = null;
|
|
1744
|
-
minDate = null;
|
|
1745
|
-
maxDate = null;
|
|
1746
|
-
timeInterval = null;
|
|
1747
|
-
timeOptions = null;
|
|
1748
|
-
matDatepickerFilter = null;
|
|
1749
|
-
valueChange =
|
|
1608
|
+
dateLabel = input('Select date', ...(ngDevMode ? [{ debugName: "dateLabel" }] : []));
|
|
1609
|
+
timeLabel = input('Select time', ...(ngDevMode ? [{ debugName: "timeLabel" }] : []));
|
|
1610
|
+
apparance = input('fill', ...(ngDevMode ? [{ debugName: "apparance" }] : []));
|
|
1611
|
+
matTimepickerMin = input(null, ...(ngDevMode ? [{ debugName: "matTimepickerMin" }] : []));
|
|
1612
|
+
matTimepickerMax = input(null, ...(ngDevMode ? [{ debugName: "matTimepickerMax" }] : []));
|
|
1613
|
+
minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : []));
|
|
1614
|
+
maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
|
|
1615
|
+
timeInterval = input(null, ...(ngDevMode ? [{ debugName: "timeInterval" }] : []));
|
|
1616
|
+
timeOptions = input(null, ...(ngDevMode ? [{ debugName: "timeOptions" }] : []));
|
|
1617
|
+
matDatepickerFilter = input(null, ...(ngDevMode ? [{ debugName: "matDatepickerFilter" }] : []));
|
|
1618
|
+
valueChange = output();
|
|
1750
1619
|
onChange = () => { };
|
|
1751
1620
|
onTouched = () => { };
|
|
1752
1621
|
writeValue(value) {
|
|
@@ -1777,29 +1646,34 @@ class MatecuDatetimePicker {
|
|
|
1777
1646
|
return { invalidDate: true };
|
|
1778
1647
|
}
|
|
1779
1648
|
const dateValue = control.value;
|
|
1780
|
-
|
|
1781
|
-
|
|
1649
|
+
const minDate = this.minDate();
|
|
1650
|
+
if (minDate && dateValue < minDate) {
|
|
1651
|
+
return { minDate: { min: minDate, actual: dateValue } };
|
|
1782
1652
|
}
|
|
1783
|
-
|
|
1784
|
-
|
|
1653
|
+
const maxDate = this.maxDate();
|
|
1654
|
+
if (maxDate && dateValue > maxDate) {
|
|
1655
|
+
return { maxDate: { max: maxDate, actual: dateValue } };
|
|
1785
1656
|
}
|
|
1786
1657
|
// Validar tiempo mínimo
|
|
1787
|
-
|
|
1788
|
-
|
|
1658
|
+
const matTimepickerMin = this.matTimepickerMin();
|
|
1659
|
+
if (matTimepickerMin) {
|
|
1660
|
+
const minTimeError = this.validateMinTime(dateValue, matTimepickerMin);
|
|
1789
1661
|
if (minTimeError) {
|
|
1790
1662
|
return minTimeError;
|
|
1791
1663
|
}
|
|
1792
1664
|
}
|
|
1793
1665
|
// Validar tiempo máximo
|
|
1794
|
-
|
|
1795
|
-
|
|
1666
|
+
const matTimepickerMax = this.matTimepickerMax();
|
|
1667
|
+
if (matTimepickerMax) {
|
|
1668
|
+
const maxTimeError = this.validateMaxTime(dateValue, matTimepickerMax);
|
|
1796
1669
|
if (maxTimeError) {
|
|
1797
1670
|
return maxTimeError;
|
|
1798
1671
|
}
|
|
1799
1672
|
}
|
|
1800
1673
|
// Validar contra timeOptions si están disponibles
|
|
1801
|
-
|
|
1802
|
-
|
|
1674
|
+
const timeOptions = this.timeOptions();
|
|
1675
|
+
if (timeOptions && timeOptions.length > 0) {
|
|
1676
|
+
const timeOptionsError = this.validateTimeOptions(dateValue, timeOptions);
|
|
1803
1677
|
if (timeOptionsError) {
|
|
1804
1678
|
return timeOptionsError;
|
|
1805
1679
|
}
|
|
@@ -1872,7 +1746,7 @@ class MatecuDatetimePicker {
|
|
|
1872
1746
|
return date instanceof Date && !isNaN(date.getTime());
|
|
1873
1747
|
}
|
|
1874
1748
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuDatetimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1875
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1749
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.3", type: MatecuDatetimePicker, isStandalone: true, selector: "matecu-datetime-picker", inputs: { dateLabel: { classPropertyName: "dateLabel", publicName: "dateLabel", isSignal: true, isRequired: false, transformFunction: null }, timeLabel: { classPropertyName: "timeLabel", publicName: "timeLabel", isSignal: true, isRequired: false, transformFunction: null }, apparance: { classPropertyName: "apparance", publicName: "apparance", isSignal: true, isRequired: false, transformFunction: null }, matTimepickerMin: { classPropertyName: "matTimepickerMin", publicName: "matTimepickerMin", isSignal: true, isRequired: false, transformFunction: null }, matTimepickerMax: { classPropertyName: "matTimepickerMax", publicName: "matTimepickerMax", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, timeInterval: { classPropertyName: "timeInterval", publicName: "timeInterval", isSignal: true, isRequired: false, transformFunction: null }, timeOptions: { classPropertyName: "timeOptions", publicName: "timeOptions", isSignal: true, isRequired: false, transformFunction: null }, matDatepickerFilter: { classPropertyName: "matDatepickerFilter", publicName: "matDatepickerFilter", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
|
|
1876
1750
|
provideNativeDateAdapter(),
|
|
1877
1751
|
{
|
|
1878
1752
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -1884,7 +1758,7 @@ class MatecuDatetimePicker {
|
|
|
1884
1758
|
useExisting: MatecuDatetimePicker,
|
|
1885
1759
|
multi: true,
|
|
1886
1760
|
},
|
|
1887
|
-
], ngImport: i0, template: "<div class=\"matecu-datetime-picker-content\">\n <mat-form-field [appearance]=\"apparance\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input matInput [matDatepicker]=\"datepicker\" [ngModel]=\"value\" (ngModelChange)=\"onDateChange($event)\"\n [disabled]=\"disabled\" [min]=\"minDate\" [max]=\"maxDate\" [matDatepickerFilter]=\"matDatepickerFilter\"\n (blur)=\"onBlur()\" />\n <mat-datepicker #datepicker />\n <mat-datepicker-toggle [for]=\"datepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-date]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-date]\"></ng-content> </mat-error>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"apparance\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input matInput [matTimepicker]=\"timepicker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\"\n [ngModelOptions]=\"{ updateOn: 'blur' }\" [disabled]=\"disabled\" [matTimepickerMin]=\"matTimepickerMin\"\n [matTimepickerMax]=\"matTimepickerMax\" (blur)=\"onBlur()\" />\n <mat-timepicker #timepicker [options]=\"timeOptions\" [interval]=\"timeInterval\" />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-time]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-time]\"></ng-content> </mat-error>\n </mat-form-field>\n</div>", styles: [":host{display:block;container-type:inline-size;--matecu-datetime-picker-mobile-bg: #f1f5f9}:host .matecu-datetime-picker-content{display:flex;gap:8px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:140px}@container (width <= 400px){:host .matecu-datetime-picker-content{flex-direction:column;background-color:var(--matecu-datetime-picker-mobile-bg);gap:25px;padding:10px 10px 15px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:unset}}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1$4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTimepickerModule }, { kind: "component", type: i3$2.MatTimepicker, selector: "mat-timepicker", inputs: ["interval", "options", "disableRipple", "aria-label", "aria-labelledby", "panelClass"], outputs: ["selected", "opened", "closed"], exportAs: ["matTimepicker"] }, { kind: "directive", type: i3$2.MatTimepickerInput, selector: "input[matTimepicker]", inputs: ["value", "matTimepicker", "matTimepickerMin", "matTimepickerMax", "matTimepickerOpenOnClick", "disabled"], outputs: ["valueChange"], exportAs: ["matTimepickerInput"] }, { kind: "component", type: i3$2.MatTimepickerToggle, selector: "mat-timepicker-toggle", inputs: ["for", "aria-label", "aria-labelledby", "disabled", "tabIndex", "disableRipple"], exportAs: ["matTimepickerToggle"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1761
|
+
], ngImport: i0, template: "<div class=\"matecu-datetime-picker-content\">\n <mat-form-field [appearance]=\"apparance()\">\n <mat-label>{{ dateLabel() }}</mat-label>\n <input matInput [matDatepicker]=\"datepicker\" [ngModel]=\"value\" (ngModelChange)=\"onDateChange($event)\"\n [disabled]=\"disabled\" [min]=\"minDate()\" [max]=\"maxDate()\" [matDatepickerFilter]=\"matDatepickerFilter()\"\n (blur)=\"onBlur()\" />\n <mat-datepicker #datepicker />\n <mat-datepicker-toggle [for]=\"datepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-date]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-date]\"></ng-content> </mat-error>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"apparance()\">\n <mat-label>{{ timeLabel() }}</mat-label>\n <input matInput [matTimepicker]=\"timepicker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\"\n [ngModelOptions]=\"{ updateOn: 'blur' }\" [disabled]=\"disabled\" [matTimepickerMin]=\"matTimepickerMin()\"\n [matTimepickerMax]=\"matTimepickerMax()\" (blur)=\"onBlur()\" />\n <mat-timepicker #timepicker [options]=\"timeOptions()\" [interval]=\"timeInterval()\" />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-time]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-time]\"></ng-content> </mat-error>\n </mat-form-field>\n</div>", styles: [":host{display:block;container-type:inline-size;--matecu-datetime-picker-mobile-bg: #f1f5f9}:host .matecu-datetime-picker-content{display:flex;gap:8px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:140px}@container (width <= 400px){:host .matecu-datetime-picker-content{flex-direction:column;background-color:var(--matecu-datetime-picker-mobile-bg);gap:25px;padding:10px 10px 15px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:unset}}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1$4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1$4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1$4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1$4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1$4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTimepickerModule }, { kind: "component", type: i3$2.MatTimepicker, selector: "mat-timepicker", inputs: ["interval", "options", "disableRipple", "aria-label", "aria-labelledby", "panelClass"], outputs: ["selected", "opened", "closed"], exportAs: ["matTimepicker"] }, { kind: "directive", type: i3$2.MatTimepickerInput, selector: "input[matTimepicker]", inputs: ["value", "matTimepicker", "matTimepickerMin", "matTimepickerMax", "matTimepickerOpenOnClick", "disabled"], outputs: ["valueChange"], exportAs: ["matTimepickerInput"] }, { kind: "component", type: i3$2.MatTimepickerToggle, selector: "mat-timepicker-toggle", inputs: ["for", "aria-label", "aria-labelledby", "disabled", "tabIndex", "disableRipple"], exportAs: ["matTimepickerToggle"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1888
1762
|
}
|
|
1889
1763
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MatecuDatetimePicker, decorators: [{
|
|
1890
1764
|
type: Component,
|
|
@@ -1906,30 +1780,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
1906
1780
|
useExisting: MatecuDatetimePicker,
|
|
1907
1781
|
multi: true,
|
|
1908
1782
|
},
|
|
1909
|
-
], template: "<div class=\"matecu-datetime-picker-content\">\n <mat-form-field [appearance]=\"apparance\">\n <mat-label>{{ dateLabel }}</mat-label>\n <input matInput [matDatepicker]=\"datepicker\" [ngModel]=\"value\" (ngModelChange)=\"onDateChange($event)\"\n [disabled]=\"disabled\" [min]=\"minDate\" [max]=\"maxDate\" [matDatepickerFilter]=\"matDatepickerFilter\"\n (blur)=\"onBlur()\" />\n <mat-datepicker #datepicker />\n <mat-datepicker-toggle [for]=\"datepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-date]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-date]\"></ng-content> </mat-error>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"apparance\">\n <mat-label>{{ timeLabel }}</mat-label>\n <input matInput [matTimepicker]=\"timepicker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\"\n [ngModelOptions]=\"{ updateOn: 'blur' }\" [disabled]=\"disabled\" [matTimepickerMin]=\"matTimepickerMin\"\n [matTimepickerMax]=\"matTimepickerMax\" (blur)=\"onBlur()\" />\n <mat-timepicker #timepicker [options]=\"timeOptions\" [interval]=\"timeInterval\" />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-time]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-time]\"></ng-content> </mat-error>\n </mat-form-field>\n</div>", styles: [":host{display:block;container-type:inline-size;--matecu-datetime-picker-mobile-bg: #f1f5f9}:host .matecu-datetime-picker-content{display:flex;gap:8px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:140px}@container (width <= 400px){:host .matecu-datetime-picker-content{flex-direction:column;background-color:var(--matecu-datetime-picker-mobile-bg);gap:25px;padding:10px 10px 15px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:unset}}\n"] }]
|
|
1910
|
-
}], propDecorators: { dateLabel: [{
|
|
1911
|
-
type: Input
|
|
1912
|
-
}], timeLabel: [{
|
|
1913
|
-
type: Input
|
|
1914
|
-
}], apparance: [{
|
|
1915
|
-
type: Input
|
|
1916
|
-
}], matTimepickerMin: [{
|
|
1917
|
-
type: Input
|
|
1918
|
-
}], matTimepickerMax: [{
|
|
1919
|
-
type: Input
|
|
1920
|
-
}], minDate: [{
|
|
1921
|
-
type: Input
|
|
1922
|
-
}], maxDate: [{
|
|
1923
|
-
type: Input
|
|
1924
|
-
}], timeInterval: [{
|
|
1925
|
-
type: Input
|
|
1926
|
-
}], timeOptions: [{
|
|
1927
|
-
type: Input
|
|
1928
|
-
}], matDatepickerFilter: [{
|
|
1929
|
-
type: Input
|
|
1930
|
-
}], valueChange: [{
|
|
1931
|
-
type: Output
|
|
1932
|
-
}] } });
|
|
1783
|
+
], template: "<div class=\"matecu-datetime-picker-content\">\n <mat-form-field [appearance]=\"apparance()\">\n <mat-label>{{ dateLabel() }}</mat-label>\n <input matInput [matDatepicker]=\"datepicker\" [ngModel]=\"value\" (ngModelChange)=\"onDateChange($event)\"\n [disabled]=\"disabled\" [min]=\"minDate()\" [max]=\"maxDate()\" [matDatepickerFilter]=\"matDatepickerFilter()\"\n (blur)=\"onBlur()\" />\n <mat-datepicker #datepicker />\n <mat-datepicker-toggle [for]=\"datepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-date]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-date]\"></ng-content> </mat-error>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"apparance()\">\n <mat-label>{{ timeLabel() }}</mat-label>\n <input matInput [matTimepicker]=\"timepicker\" [ngModel]=\"value\" (ngModelChange)=\"onValueChange($event)\"\n [ngModelOptions]=\"{ updateOn: 'blur' }\" [disabled]=\"disabled\" [matTimepickerMin]=\"matTimepickerMin()\"\n [matTimepickerMax]=\"matTimepickerMax()\" (blur)=\"onBlur()\" />\n <mat-timepicker #timepicker [options]=\"timeOptions()\" [interval]=\"timeInterval()\" />\n <mat-timepicker-toggle [for]=\"timepicker\" matSuffix />\n\n <mat-hint> <ng-content select=\"[mat-hint-time]\"></ng-content> </mat-hint>\n <mat-error> <ng-content select=\"[mat-error-time]\"></ng-content> </mat-error>\n </mat-form-field>\n</div>", styles: [":host{display:block;container-type:inline-size;--matecu-datetime-picker-mobile-bg: #f1f5f9}:host .matecu-datetime-picker-content{display:flex;gap:8px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:140px}@container (width <= 400px){:host .matecu-datetime-picker-content{flex-direction:column;background-color:var(--matecu-datetime-picker-mobile-bg);gap:25px;padding:10px 10px 15px}:host .matecu-datetime-picker-content>mat-form-field:last-of-type{max-width:unset}}\n"] }]
|
|
1784
|
+
}], propDecorators: { dateLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateLabel", required: false }] }], timeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeLabel", required: false }] }], apparance: [{ type: i0.Input, args: [{ isSignal: true, alias: "apparance", required: false }] }], matTimepickerMin: [{ type: i0.Input, args: [{ isSignal: true, alias: "matTimepickerMin", required: false }] }], matTimepickerMax: [{ type: i0.Input, args: [{ isSignal: true, alias: "matTimepickerMax", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], timeInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeInterval", required: false }] }], timeOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "timeOptions", required: false }] }], matDatepickerFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "matDatepickerFilter", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
1933
1785
|
|
|
1934
1786
|
/*
|
|
1935
1787
|
* Public API Surface of angular-matecu
|