@ngx-mce/file-input 22.2.8 → 22.2.9
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/ngx-mce-file-input.mjs +449 -334
- package/fesm2022/ngx-mce-file-input.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-mce-file-input.d.ts +143 -104
|
@@ -1,342 +1,457 @@
|
|
|
1
|
-
import { coerceBooleanProperty } from
|
|
2
|
-
import { Platform } from
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import { NgControl, NgForm
|
|
6
|
-
import * as i2 from
|
|
7
|
-
import { MatButtonModule } from
|
|
8
|
-
import { ErrorStateMatcher } from
|
|
9
|
-
import { MatFormFieldControl } from
|
|
10
|
-
import * as i1 from
|
|
11
|
-
import { MatIconModule } from
|
|
12
|
-
import { Subject } from
|
|
13
|
-
|
|
1
|
+
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
2
|
+
import { Platform } from "@angular/cdk/platform";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, Input, ViewEncapsulation, forwardRef, inject, input, viewChild } from "@angular/core";
|
|
5
|
+
import { FormGroupDirective, NgControl, NgForm } from "@angular/forms";
|
|
6
|
+
import * as i2 from "@angular/material/button";
|
|
7
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
8
|
+
import { ErrorStateMatcher } from "@angular/material/core";
|
|
9
|
+
import { MatFormFieldControl } from "@angular/material/form-field";
|
|
10
|
+
import * as i1 from "@angular/material/icon";
|
|
11
|
+
import { MatIconModule } from "@angular/material/icon";
|
|
12
|
+
import { Subject } from "rxjs";
|
|
14
13
|
let nextUniqueId = 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
class NgxMatFileInputIcon {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
14
|
+
var NgxMatInputMixinBase = class {
|
|
15
|
+
stateChanges = new Subject();
|
|
16
|
+
ngControl = null;
|
|
17
|
+
_parentForm = null;
|
|
18
|
+
_parentFormGroup = null;
|
|
19
|
+
_defaultErrorStateMatcher = null;
|
|
20
|
+
};
|
|
21
|
+
var NgxMatFileInputIcon = class NgxMatFileInputIcon {
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
23
|
+
minVersion: "12.0.0",
|
|
24
|
+
version: "22.2.0",
|
|
25
|
+
ngImport: i0,
|
|
26
|
+
type: NgxMatFileInputIcon,
|
|
27
|
+
deps: [],
|
|
28
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
29
|
+
});
|
|
30
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
31
|
+
minVersion: "14.0.0",
|
|
32
|
+
version: "22.2.0",
|
|
33
|
+
type: NgxMatFileInputIcon,
|
|
34
|
+
isStandalone: true,
|
|
35
|
+
selector: "[ngxMatFileInputIcon]",
|
|
36
|
+
ngImport: i0
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
40
|
+
minVersion: "12.0.0",
|
|
41
|
+
version: "22.2.0",
|
|
42
|
+
ngImport: i0,
|
|
43
|
+
type: NgxMatFileInputIcon,
|
|
44
|
+
decorators: [{
|
|
45
|
+
type: Directive,
|
|
46
|
+
args: [{ selector: "[ngxMatFileInputIcon]" }]
|
|
47
|
+
}]
|
|
48
|
+
});
|
|
49
|
+
var NgxMatFileInputComponent = class NgxMatFileInputComponent extends NgxMatInputMixinBase {
|
|
50
|
+
_inputFileRef = viewChild("inputFile", ...ngDevMode ? [{ debugName: "_inputFileRef" }] : /* istanbul ignore next */ []);
|
|
51
|
+
_inputValueRef = viewChild("inputValue", ...ngDevMode ? [{ debugName: "_inputValueRef" }] : /* istanbul ignore next */ []);
|
|
52
|
+
color = input("primary", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
53
|
+
fileNames = "";
|
|
54
|
+
_uid = `ngx-mat-fileinput-${nextUniqueId++}`;
|
|
55
|
+
_ariaDescribedby = "";
|
|
56
|
+
stateChanges = new Subject();
|
|
57
|
+
focused = false;
|
|
58
|
+
errorState = false;
|
|
59
|
+
controlType = "ngx-mat-file-input";
|
|
60
|
+
autofilled = false;
|
|
61
|
+
_onTouched = () => {};
|
|
62
|
+
_onChange = () => {};
|
|
63
|
+
get disabled() {
|
|
64
|
+
if (this.ngControl && this.ngControl.disabled !== null) return this.ngControl.disabled;
|
|
65
|
+
return this._disabled;
|
|
66
|
+
}
|
|
67
|
+
set disabled(value) {
|
|
68
|
+
this._disabled = coerceBooleanProperty(value);
|
|
69
|
+
if (this.focused) {
|
|
70
|
+
this.focused = false;
|
|
71
|
+
this.stateChanges.next();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
_disabled = false;
|
|
75
|
+
get id() {
|
|
76
|
+
return this._id;
|
|
77
|
+
}
|
|
78
|
+
set id(value) {
|
|
79
|
+
this._id = value || this._uid;
|
|
80
|
+
}
|
|
81
|
+
_id = "";
|
|
82
|
+
get multiple() {
|
|
83
|
+
return this._multiple;
|
|
84
|
+
}
|
|
85
|
+
set multiple(value) {
|
|
86
|
+
this._multiple = coerceBooleanProperty(value);
|
|
87
|
+
}
|
|
88
|
+
_multiple = false;
|
|
89
|
+
placeholder = "Choose a file";
|
|
90
|
+
separator = input(",", ...ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []);
|
|
91
|
+
get required() {
|
|
92
|
+
return this._required;
|
|
93
|
+
}
|
|
94
|
+
set required(value) {
|
|
95
|
+
this._required = coerceBooleanProperty(value);
|
|
96
|
+
}
|
|
97
|
+
_required = false;
|
|
98
|
+
errorStateMatcher = null;
|
|
99
|
+
get value() {
|
|
100
|
+
return this._value;
|
|
101
|
+
}
|
|
102
|
+
set value(value) {
|
|
103
|
+
this._value = value;
|
|
104
|
+
}
|
|
105
|
+
_value = null;
|
|
106
|
+
get readonly() {
|
|
107
|
+
return this._readonly;
|
|
108
|
+
}
|
|
109
|
+
set readonly(value) {
|
|
110
|
+
this._readonly = coerceBooleanProperty(value);
|
|
111
|
+
}
|
|
112
|
+
_readonly = true;
|
|
113
|
+
get accept() {
|
|
114
|
+
return this._accept;
|
|
115
|
+
}
|
|
116
|
+
set accept(value) {
|
|
117
|
+
this._accept = value;
|
|
118
|
+
}
|
|
119
|
+
_accept = "";
|
|
120
|
+
_elementRef = inject(ElementRef);
|
|
121
|
+
_platform = inject(Platform);
|
|
122
|
+
_cd = inject(ChangeDetectorRef);
|
|
123
|
+
ngControl = inject(NgControl, {
|
|
124
|
+
optional: true,
|
|
125
|
+
self: true
|
|
126
|
+
});
|
|
127
|
+
_parentForm = inject(NgForm, { optional: true });
|
|
128
|
+
_parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
129
|
+
_defaultErrorStateMatcher = inject(ErrorStateMatcher);
|
|
130
|
+
constructor() {
|
|
131
|
+
super();
|
|
132
|
+
if (this.ngControl) this.ngControl.valueAccessor = this;
|
|
133
|
+
}
|
|
134
|
+
ngOnChanges() {
|
|
135
|
+
this.stateChanges.next();
|
|
136
|
+
}
|
|
137
|
+
ngOnDestroy() {
|
|
138
|
+
this.stateChanges.complete();
|
|
139
|
+
}
|
|
140
|
+
ngDoCheck() {
|
|
141
|
+
if (this.ngControl) this.updateErrorState();
|
|
142
|
+
}
|
|
143
|
+
updateErrorState() {
|
|
144
|
+
const control = this.ngControl ? this.ngControl.control : null;
|
|
145
|
+
this.errorState = (this.errorStateMatcher ?? this._defaultErrorStateMatcher).isErrorState(control, this._parentForm);
|
|
146
|
+
}
|
|
147
|
+
writeValue(value) {
|
|
148
|
+
this._updateInputValue(value);
|
|
149
|
+
}
|
|
150
|
+
registerOnChange(fn) {
|
|
151
|
+
this._onChange = fn;
|
|
152
|
+
}
|
|
153
|
+
registerOnTouched(fn) {
|
|
154
|
+
this._onTouched = fn;
|
|
155
|
+
}
|
|
156
|
+
setDisabledState(isDisabled) {
|
|
157
|
+
this.disabled = isDisabled;
|
|
158
|
+
this.stateChanges.next();
|
|
159
|
+
}
|
|
160
|
+
focus(options) {
|
|
161
|
+
this._inputValueRef()?.nativeElement.focus(options);
|
|
162
|
+
}
|
|
163
|
+
_focusChanged(isFocused) {
|
|
164
|
+
if (isFocused !== this.focused && (!this.readonly || !isFocused)) {
|
|
165
|
+
this.focused = isFocused;
|
|
166
|
+
this.stateChanges.next();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
_markAsTouched() {
|
|
170
|
+
this._onTouched();
|
|
171
|
+
this._cd.markForCheck();
|
|
172
|
+
this.stateChanges.next();
|
|
173
|
+
}
|
|
174
|
+
_isBadInput() {
|
|
175
|
+
const validity = (this._inputValueRef()?.nativeElement).validity;
|
|
176
|
+
return validity && validity.badInput;
|
|
177
|
+
}
|
|
178
|
+
get empty() {
|
|
179
|
+
return !this._inputValueRef()?.nativeElement.value && !this._isBadInput() && !this.autofilled;
|
|
180
|
+
}
|
|
181
|
+
get shouldLabelFloat() {
|
|
182
|
+
return this.focused || !this.empty;
|
|
183
|
+
}
|
|
184
|
+
setDescribedByIds(ids) {
|
|
185
|
+
this._ariaDescribedby = ids.join(" ");
|
|
186
|
+
}
|
|
187
|
+
openFilePicker(event) {
|
|
188
|
+
this._inputFileRef()?.nativeElement.click();
|
|
189
|
+
if (event) {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
event.stopPropagation();
|
|
192
|
+
}
|
|
193
|
+
this._markAsTouched();
|
|
194
|
+
}
|
|
195
|
+
handleFiles(filelist) {
|
|
196
|
+
if (filelist.length > 0) {
|
|
197
|
+
const files = [];
|
|
198
|
+
for (let i = 0; i < filelist.length; i++) {
|
|
199
|
+
const f = filelist.item(i);
|
|
200
|
+
if (f) files.push(f);
|
|
201
|
+
}
|
|
202
|
+
this._updateInputValue(files);
|
|
203
|
+
this._resetInputFile();
|
|
204
|
+
this._onChange(this.multiple ? files : files[0]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
onContainerClick(_) {}
|
|
208
|
+
_resetInputFile() {
|
|
209
|
+
this._inputFileRef().nativeElement.value = "";
|
|
210
|
+
}
|
|
211
|
+
_updateInputValue(files) {
|
|
212
|
+
let text = null;
|
|
213
|
+
if (files) {
|
|
214
|
+
if (Array.isArray(files)) text = this._multiple ? files.map((x) => x.name).join(this.separator()) : files[0].name;
|
|
215
|
+
else text = files.name != null ? files.name : null;
|
|
216
|
+
}
|
|
217
|
+
this._inputValueRef().nativeElement.value = text;
|
|
218
|
+
}
|
|
219
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
220
|
+
minVersion: "12.0.0",
|
|
221
|
+
version: "22.2.0",
|
|
222
|
+
ngImport: i0,
|
|
223
|
+
type: NgxMatFileInputComponent,
|
|
224
|
+
deps: [],
|
|
225
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
226
|
+
});
|
|
227
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
228
|
+
minVersion: "17.2.0",
|
|
229
|
+
version: "22.2.0",
|
|
230
|
+
type: NgxMatFileInputComponent,
|
|
231
|
+
isStandalone: true,
|
|
232
|
+
selector: "ngx-mat-file-input",
|
|
233
|
+
inputs: {
|
|
234
|
+
color: {
|
|
235
|
+
classPropertyName: "color",
|
|
236
|
+
publicName: "color",
|
|
237
|
+
isSignal: true,
|
|
238
|
+
isRequired: false,
|
|
239
|
+
transformFunction: null
|
|
240
|
+
},
|
|
241
|
+
disabled: {
|
|
242
|
+
classPropertyName: "disabled",
|
|
243
|
+
publicName: "disabled",
|
|
244
|
+
isSignal: false,
|
|
245
|
+
isRequired: false,
|
|
246
|
+
transformFunction: null
|
|
247
|
+
},
|
|
248
|
+
id: {
|
|
249
|
+
classPropertyName: "id",
|
|
250
|
+
publicName: "id",
|
|
251
|
+
isSignal: false,
|
|
252
|
+
isRequired: false,
|
|
253
|
+
transformFunction: null
|
|
254
|
+
},
|
|
255
|
+
multiple: {
|
|
256
|
+
classPropertyName: "multiple",
|
|
257
|
+
publicName: "multiple",
|
|
258
|
+
isSignal: false,
|
|
259
|
+
isRequired: false,
|
|
260
|
+
transformFunction: null
|
|
261
|
+
},
|
|
262
|
+
placeholder: {
|
|
263
|
+
classPropertyName: "placeholder",
|
|
264
|
+
publicName: "placeholder",
|
|
265
|
+
isSignal: false,
|
|
266
|
+
isRequired: false,
|
|
267
|
+
transformFunction: null
|
|
268
|
+
},
|
|
269
|
+
separator: {
|
|
270
|
+
classPropertyName: "separator",
|
|
271
|
+
publicName: "separator",
|
|
272
|
+
isSignal: true,
|
|
273
|
+
isRequired: false,
|
|
274
|
+
transformFunction: null
|
|
275
|
+
},
|
|
276
|
+
required: {
|
|
277
|
+
classPropertyName: "required",
|
|
278
|
+
publicName: "required",
|
|
279
|
+
isSignal: false,
|
|
280
|
+
isRequired: false,
|
|
281
|
+
transformFunction: null
|
|
282
|
+
},
|
|
283
|
+
errorStateMatcher: {
|
|
284
|
+
classPropertyName: "errorStateMatcher",
|
|
285
|
+
publicName: "errorStateMatcher",
|
|
286
|
+
isSignal: false,
|
|
287
|
+
isRequired: false,
|
|
288
|
+
transformFunction: null
|
|
289
|
+
},
|
|
290
|
+
value: {
|
|
291
|
+
classPropertyName: "value",
|
|
292
|
+
publicName: "value",
|
|
293
|
+
isSignal: false,
|
|
294
|
+
isRequired: false,
|
|
295
|
+
transformFunction: null
|
|
296
|
+
},
|
|
297
|
+
readonly: {
|
|
298
|
+
classPropertyName: "readonly",
|
|
299
|
+
publicName: "readonly",
|
|
300
|
+
isSignal: false,
|
|
301
|
+
isRequired: false,
|
|
302
|
+
transformFunction: null
|
|
303
|
+
},
|
|
304
|
+
accept: {
|
|
305
|
+
classPropertyName: "accept",
|
|
306
|
+
publicName: "accept",
|
|
307
|
+
isSignal: false,
|
|
308
|
+
isRequired: false,
|
|
309
|
+
transformFunction: null
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
host: { classAttribute: "ngx-mat-file-input" },
|
|
313
|
+
providers: [{
|
|
314
|
+
provide: MatFormFieldControl,
|
|
315
|
+
useExisting: forwardRef(() => NgxMatFileInputComponent)
|
|
316
|
+
}],
|
|
317
|
+
viewQueries: [{
|
|
318
|
+
propertyName: "_inputFileRef",
|
|
319
|
+
first: true,
|
|
320
|
+
predicate: ["inputFile"],
|
|
321
|
+
descendants: true,
|
|
322
|
+
isSignal: true
|
|
323
|
+
}, {
|
|
324
|
+
propertyName: "_inputValueRef",
|
|
325
|
+
first: true,
|
|
326
|
+
predicate: ["inputValue"],
|
|
327
|
+
descendants: true,
|
|
328
|
+
isSignal: true
|
|
329
|
+
}],
|
|
330
|
+
exportAs: ["ngx-mat-file-input"],
|
|
331
|
+
usesInheritance: true,
|
|
332
|
+
usesOnChanges: true,
|
|
333
|
+
ngImport: i0,
|
|
334
|
+
template: "<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n",
|
|
335
|
+
styles: [".mat-mdc-form-field-appearance-outline .mat-form-field-prefix .ngx-mat-file-input--default-icon,.mat-mdc-form-field-appearance-outline .mat-form-field-suffix .ngx-mat-file-input--default-icon{width:1em}.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-prefix .ngx-mat-file-input--default-icon,.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-suffix .ngx-mat-file-input--default-icon{display:block;width:1.5em;height:1.5em}.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-prefix .mat-icon-button .ngx-mat-file-input--default-icon,.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-suffix .mat-icon-button .ngx-mat-file-input--default-icon{margin:auto}.ngx-mat-file-input{display:flex;line-height:18px;align-items:center}.ngx-mat-file-input .input-file{display:block;visibility:hidden;width:0;height:0}\n"],
|
|
336
|
+
dependencies: [
|
|
337
|
+
{
|
|
338
|
+
kind: "ngmodule",
|
|
339
|
+
type: MatIconModule
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
kind: "component",
|
|
343
|
+
type: i1.MatIcon,
|
|
344
|
+
selector: "mat-icon",
|
|
345
|
+
inputs: [
|
|
346
|
+
"color",
|
|
347
|
+
"inline",
|
|
348
|
+
"svgIcon",
|
|
349
|
+
"fontSet",
|
|
350
|
+
"fontIcon"
|
|
351
|
+
],
|
|
352
|
+
exportAs: ["matIcon"]
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
kind: "ngmodule",
|
|
356
|
+
type: MatButtonModule
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
kind: "component",
|
|
360
|
+
type: i2.MatIconButton,
|
|
361
|
+
selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
|
|
362
|
+
exportAs: ["matButton", "matAnchor"]
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager,
|
|
366
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
370
|
+
minVersion: "12.0.0",
|
|
371
|
+
version: "22.2.0",
|
|
372
|
+
ngImport: i0,
|
|
373
|
+
type: NgxMatFileInputComponent,
|
|
374
|
+
decorators: [{
|
|
375
|
+
type: Component,
|
|
376
|
+
args: [{
|
|
377
|
+
selector: "ngx-mat-file-input",
|
|
378
|
+
encapsulation: ViewEncapsulation.None,
|
|
379
|
+
host: { class: "ngx-mat-file-input" },
|
|
380
|
+
providers: [{
|
|
381
|
+
provide: MatFormFieldControl,
|
|
382
|
+
useExisting: forwardRef(() => NgxMatFileInputComponent)
|
|
383
|
+
}],
|
|
384
|
+
exportAs: "ngx-mat-file-input",
|
|
385
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
386
|
+
imports: [MatIconModule, MatButtonModule],
|
|
387
|
+
template: "<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n",
|
|
388
|
+
styles: [".mat-mdc-form-field-appearance-outline .mat-form-field-prefix .ngx-mat-file-input--default-icon,.mat-mdc-form-field-appearance-outline .mat-form-field-suffix .ngx-mat-file-input--default-icon{width:1em}.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-prefix .ngx-mat-file-input--default-icon,.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-suffix .ngx-mat-file-input--default-icon{display:block;width:1.5em;height:1.5em}.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-prefix .mat-icon-button .ngx-mat-file-input--default-icon,.mat-mdc-form-field:not(.mat-form-field-appearance-outline) .mat-form-field-suffix .mat-icon-button .ngx-mat-file-input--default-icon{margin:auto}.ngx-mat-file-input{display:flex;line-height:18px;align-items:center}.ngx-mat-file-input .input-file{display:block;visibility:hidden;width:0;height:0}\n"]
|
|
389
|
+
}]
|
|
390
|
+
}],
|
|
391
|
+
ctorParameters: () => [],
|
|
392
|
+
propDecorators: {
|
|
393
|
+
_inputFileRef: [{
|
|
394
|
+
type: i0.ViewChild,
|
|
395
|
+
args: ["inputFile", { isSignal: true }]
|
|
396
|
+
}],
|
|
397
|
+
_inputValueRef: [{
|
|
398
|
+
type: i0.ViewChild,
|
|
399
|
+
args: ["inputValue", { isSignal: true }]
|
|
400
|
+
}],
|
|
401
|
+
color: [{
|
|
402
|
+
type: i0.Input,
|
|
403
|
+
args: [{
|
|
404
|
+
isSignal: true,
|
|
405
|
+
alias: "color",
|
|
406
|
+
required: false
|
|
407
|
+
}]
|
|
408
|
+
}],
|
|
409
|
+
disabled: [{ type: Input }],
|
|
410
|
+
id: [{ type: Input }],
|
|
411
|
+
multiple: [{ type: Input }],
|
|
412
|
+
placeholder: [{ type: Input }],
|
|
413
|
+
separator: [{
|
|
414
|
+
type: i0.Input,
|
|
415
|
+
args: [{
|
|
416
|
+
isSignal: true,
|
|
417
|
+
alias: "separator",
|
|
418
|
+
required: false
|
|
419
|
+
}]
|
|
420
|
+
}],
|
|
421
|
+
required: [{ type: Input }],
|
|
422
|
+
errorStateMatcher: [{ type: Input }],
|
|
423
|
+
value: [{ type: Input }],
|
|
424
|
+
readonly: [{ type: Input }],
|
|
425
|
+
accept: [{ type: Input }]
|
|
426
|
+
}
|
|
427
|
+
});
|
|
271
428
|
function calculFileSize(number) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
return (number / 1024).toFixed(1) + 'KB';
|
|
277
|
-
}
|
|
278
|
-
else if (number >= 1048576) {
|
|
279
|
-
return (number / 1048576).toFixed(1) + 'MB';
|
|
280
|
-
}
|
|
281
|
-
return `${number}`;
|
|
429
|
+
if (number < 1024) return number + "bytes";
|
|
430
|
+
else if (number >= 1024 && number < 1048576) return (number / 1024).toFixed(1) + "KB";
|
|
431
|
+
else if (number >= 1048576) return (number / 1048576).toFixed(1) + "MB";
|
|
432
|
+
return `${number}`;
|
|
282
433
|
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Validator for size of file
|
|
286
|
-
* @param max Max of size of file (in bytes)
|
|
287
|
-
*/
|
|
288
434
|
function MaxSizeValidator(max) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (!files.length)
|
|
301
|
-
return null;
|
|
302
|
-
const add = (a, b) => a + b;
|
|
303
|
-
const sumSize = files.map((x) => x.size).reduce(add);
|
|
304
|
-
if (sumSize > max) {
|
|
305
|
-
return {
|
|
306
|
-
maxSize: true,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
return null;
|
|
310
|
-
};
|
|
435
|
+
return (ctrl) => {
|
|
436
|
+
max = Number(max);
|
|
437
|
+
if (isNaN(max)) throw "MaxSizeValidator: max of size of file is invalid";
|
|
438
|
+
if (!ctrl.value) return null;
|
|
439
|
+
let files = ctrl.value;
|
|
440
|
+
if (!Array.isArray(ctrl.value)) files = [ctrl.value];
|
|
441
|
+
if (!files.length) return null;
|
|
442
|
+
const add = (a, b) => a + b;
|
|
443
|
+
if (files.map((x) => x.size).reduce(add) > max) return { maxSize: true };
|
|
444
|
+
return null;
|
|
445
|
+
};
|
|
311
446
|
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Validator for input file accept
|
|
315
|
-
* @param accept Allowable type of file
|
|
316
|
-
*/
|
|
317
447
|
function AcceptValidator(accept) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (!accept.includes(ctrl.value.type)) {
|
|
325
|
-
return {
|
|
326
|
-
accept: true,
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
return null;
|
|
330
|
-
};
|
|
448
|
+
return (ctrl) => {
|
|
449
|
+
if (!accept) throw "AcceptValidator: allowable type of file can not be empty";
|
|
450
|
+
if (ctrl.value == null) return null;
|
|
451
|
+
if (!accept.includes(ctrl.value.type)) return { accept: true };
|
|
452
|
+
return null;
|
|
453
|
+
};
|
|
331
454
|
}
|
|
332
|
-
|
|
333
|
-
/*
|
|
334
|
-
* Public API Surface of file-input
|
|
335
|
-
*/
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Generated bundle index. Do not edit.
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
455
|
export { AcceptValidator, MaxSizeValidator, NgxMatFileInputComponent, NgxMatFileInputIcon, calculFileSize };
|
|
342
|
-
|
|
456
|
+
|
|
457
|
+
//# sourceMappingURL=ngx-mce-file-input.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-mce-file-input.mjs","sources":["../../../projects/file-input/src/lib/file-input.component.ts","../../../projects/file-input/src/lib/file-input.component.html","../../../projects/file-input/src/lib/file-input-helper.ts","../../../projects/file-input/src/lib/validators/max-size.validator.ts","../../../projects/file-input/src/lib/validators/accept.validator.ts","../../../projects/file-input/src/public-api.ts","../../../projects/file-input/src/ngx-mce-file-input.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Platform } from '@angular/cdk/platform';\n\nimport {\n ChangeDetectorRef,\n Component,\n Directive,\n DoCheck,\n ElementRef,\n forwardRef,\n inject,\n Input,\n input,\n OnChanges,\n OnDestroy,\n viewChild,\n ViewEncapsulation,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ErrorStateMatcher, ThemePalette } from '@angular/material/core';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subject } from 'rxjs';\nimport { FileOrArrayFile } from './file-input-type';\n\nlet nextUniqueId = 0;\n\nclass NgxMatInputMixinBase {\n\n readonly stateChanges = new Subject<void>();\n\n protected ngControl: NgControl | null = null;\n protected _parentForm: NgForm | null = null;\n protected _parentFormGroup: FormGroupDirective | null = null;\n protected _defaultErrorStateMatcher: ErrorStateMatcher | null = null;\n\n}\n\n@Directive({\n selector: '[ngxMatFileInputIcon]',\n})\nexport class NgxMatFileInputIcon {}\n\n@Component({\n selector: 'ngx-mat-file-input',\n templateUrl: 'file-input.component.html',\n styleUrls: ['file-input.component.scss'],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ngx-mat-file-input',\n },\n providers: [\n {\n provide: MatFormFieldControl,\n useExisting: forwardRef(() => NgxMatFileInputComponent),\n },\n ],\n exportAs: 'ngx-mat-file-input',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [MatIconModule, MatButtonModule],\n})\nexport class NgxMatFileInputComponent\n extends NgxMatInputMixinBase\n implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor\n{\n private _inputFileRef = viewChild<ElementRef>('inputFile');\n private _inputValueRef = viewChild<ElementRef>('inputValue');\n\n readonly color = input<ThemePalette>('primary');\n\n public fileNames = \"\";\n\n protected _uid = `ngx-mat-fileinput-${nextUniqueId++}`;\n _ariaDescribedby = \"\";\n\n override stateChanges: Subject<void> = new Subject<void>();\n focused = false;\n errorState = false;\n controlType = 'ngx-mat-file-input';\n autofilled = false;\n\n /** Function when touched */\n _onTouched = () => {\n // Intentionally empty.\n };\n\n /** Function when changed */\n _onChange: (value: FileOrArrayFile) => void = () => {\n // Intentionally empty.\n };\n\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n protected _disabled = false;\n\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n }\n protected _id = \"\";\n\n @Input()\n get multiple(): boolean {\n return this._multiple;\n }\n set multiple(value: boolean) {\n this._multiple = coerceBooleanProperty(value);\n }\n protected _multiple = false;\n\n @Input()\n placeholder = 'Choose a file';\n separator = input<string>(',');\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n protected _required = false;\n\n @Input() errorStateMatcher: ErrorStateMatcher | null = null;\n\n @Input()\n get value(): FileOrArrayFile | null {\n return this._value;\n }\n set value(value: FileOrArrayFile) {\n this._value = value;\n }\n protected _value: FileOrArrayFile | null = null;\n\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = true;\n\n /**\n * Limiting accepted file types\n * Example: accept=\"image/png, image/jpeg\" or accept=\".png, .jpg, .jpeg\" — Accept PNG or JPEG files.\n */\n @Input()\n get accept(): string {\n return this._accept;\n }\n set accept(value: string) {\n this._accept = value;\n }\n private _accept = \"\";\n\n protected _elementRef = inject(ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>);\n protected _platform = inject(Platform);\n private _cd = inject(ChangeDetectorRef);\n\n override ngControl = inject(NgControl, { optional: true, self: true });\n protected override _parentForm = inject(NgForm, { optional: true });\n protected override _parentFormGroup = inject(FormGroupDirective, { optional: true });\n protected override _defaultErrorStateMatcher = inject(ErrorStateMatcher);\n\n constructor() {\n super();\n\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n updateErrorState() {\n const control = this.ngControl ? this.ngControl.control : null;\n\n this.errorState = (this.errorStateMatcher ?? this._defaultErrorStateMatcher).isErrorState(\n control,\n this._parentForm,\n );\n }\n\n // Implemented as part of ControlValueAccessor.\n writeValue(value: FileOrArrayFile): void {\n this._updateInputValue(value);\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnChange(fn: (value: FileOrArrayFile) => void): void {\n this._onChange = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.stateChanges.next();\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this._inputValueRef()?.nativeElement.focus(options);\n }\n\n _focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused && (!this.readonly || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /** Mark the field as touched */\n _markAsTouched() {\n this._onTouched();\n this._cd.markForCheck();\n this.stateChanges.next();\n }\n\n protected _isBadInput() {\n const validity = (this._inputValueRef()?.nativeElement as HTMLInputElement).validity;\n return validity && validity.badInput;\n }\n\n get empty(): boolean {\n return !this._inputValueRef()?.nativeElement.value && !this._isBadInput() && !this.autofilled;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n openFilePicker(event?: MouseEvent) {\n this._inputFileRef()?.nativeElement.click();\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n this._markAsTouched();\n }\n\n handleFiles(filelist: FileList) {\n if (filelist.length > 0) {\n const files: File[] = [];\n for (let i = 0; i < filelist.length; i++) {\n const f = filelist.item(i);\n if (f)\n files.push(f);\n }\n this._updateInputValue(files);\n this._resetInputFile();\n this._onChange(this.multiple ? files : files[0]);\n }\n }\n\n /** Handles a click on the control's container. */\n onContainerClick(_: MouseEvent) {\n // Intentionally empty.\n }\n\n private _resetInputFile() {\n this._inputFileRef()!.nativeElement.value = '';\n }\n\n private _updateInputValue(files: FileOrArrayFile) {\n let text = null;\n if (files) {\n if (Array.isArray(files)) {\n text = this._multiple ? files.map((x) => x.name).join(this.separator()) : files[0].name;\n } else {\n text = files.name != null ? files.name : null;\n }\n }\n\n this._inputValueRef()!.nativeElement.value = text;\n }\n}\n","<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n","export function calculFileSize(number: number): string {\n if (number < 1024) {\n return number + 'bytes';\n } else if (number >= 1024 && number < 1048576) {\n return (number / 1024).toFixed(1) + 'KB';\n } else if (number >= 1048576) {\n return (number / 1048576).toFixed(1) + 'MB';\n }\n return `${number}`;\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for size of file\n * @param max Max of size of file (in bytes)\n */\nexport function MaxSizeValidator(max: number): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n max = Number(max);\n if (isNaN(max)) {\n throw 'MaxSizeValidator: max of size of file is invalid';\n }\n if (!ctrl.value) return null;\n let files: File[] = ctrl.value;\n if (!Array.isArray(ctrl.value)) {\n files = [ctrl.value];\n }\n if (!files.length) return null;\n const add = (a: number, b: number): number => a + b;\n const sumSize = files.map((x) => x.size).reduce(add);\n if (sumSize > max) {\n return {\n maxSize: true,\n };\n }\n return null;\n };\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for input file accept\n * @param accept Allowable type of file\n */\nexport function AcceptValidator(accept: string): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n if (!accept) {\n throw 'AcceptValidator: allowable type of file can not be empty';\n }\n\n if (ctrl.value == null) return null;\n\n if (!accept.includes(ctrl.value.type)) {\n return {\n accept: true,\n };\n }\n\n return null;\n };\n}\n","/*\n * Public API Surface of file-input\n */\n\nexport * from './lib/file-input.component';\n\nexport * from './lib/file-input-type';\nexport * from './lib/file-input-helper';\nexport * from './lib/validators';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AA2BA,IAAI,YAAY,GAAG,CAAC;AAEpB,MAAM,oBAAoB,CAAA;AAEf,IAAA,YAAY,GAAG,IAAI,OAAO,EAAQ;IAEjC,SAAS,GAAqB,IAAI;IAClC,WAAW,GAAkB,IAAI;IACjC,gBAAgB,GAA8B,IAAI;IAClD,yBAAyB,GAA6B,IAAI;AAErE;MAKY,mBAAmB,CAAA;uGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,uBAAuB;AAClC,iBAAA;;AAqBK,MAAO,wBACX,SAAQ,oBAAoB,CAAA;IAGpB,aAAa,GAAG,SAAS,CAAa,WAAW;sFAAC;IAClD,cAAc,GAAG,SAAS,CAAa,YAAY;uFAAC;IAEnD,KAAK,GAAG,KAAK,CAAe,SAAS;8EAAC;IAExC,SAAS,GAAG,EAAE;AAEX,IAAA,IAAI,GAAG,CAAA,kBAAA,EAAqB,YAAY,EAAE,EAAE;IACtD,gBAAgB,GAAG,EAAE;AAEZ,IAAA,YAAY,GAAkB,IAAI,OAAO,EAAQ;IAC1D,OAAO,GAAG,KAAK;IACf,UAAU,GAAG,KAAK;IAClB,WAAW,GAAG,oBAAoB;IAClC,UAAU,GAA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MAAM;AAAE,YAAA,OAAO,IAAI;AAC9B,QAAA,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,KAAa,CAAC,GAAG,CAAC;QACnD,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;AACpD,QAAA,IAAI,OAAO,GAAG,GAAG,EAAE;YACjB,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;aACd;QACH;AACA,QAAA,OAAO,IAAI;AACb,IAAA,CAAC;AACH;;ACzBA;;;AAGG;AACG,SAAU,eAAe,CAAC,MAAc,EAAA;IAC5C,OAAO,CAAC,IAAqB,KAA6B;QACxD,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,MAAM,0DAA0D;QAClE;AAEA,QAAA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI;AAAE,YAAA,OAAO,IAAI;AAEnC,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACrC,OAAO;AACL,gBAAA,MAAM,EAAE,IAAI;aACb;QACH;AAEA,QAAA,OAAO,IAAI;AACb,IAAA,CAAC;AACH;;ACtBA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-mce-file-input.mjs","names":[],"sources":["../../../projects/file-input/src/lib/file-input.component.ts","../../../projects/file-input/src/lib/file-input.component.html","../../../projects/file-input/src/lib/file-input-helper.ts","../../../projects/file-input/src/lib/validators/max-size.validator.ts","../../../projects/file-input/src/lib/validators/accept.validator.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Platform } from '@angular/cdk/platform';\n\nimport {\n ChangeDetectorRef,\n Component,\n Directive,\n DoCheck,\n ElementRef,\n forwardRef,\n inject,\n Input,\n input,\n OnChanges,\n OnDestroy,\n viewChild,\n ViewEncapsulation,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ErrorStateMatcher, ThemePalette } from '@angular/material/core';\nimport { MatFormFieldControl } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subject } from 'rxjs';\nimport { FileOrArrayFile } from './file-input-type';\n\nlet nextUniqueId = 0;\n\nclass NgxMatInputMixinBase {\n\n readonly stateChanges = new Subject<void>();\n\n protected ngControl: NgControl | null = null;\n protected _parentForm: NgForm | null = null;\n protected _parentFormGroup: FormGroupDirective | null = null;\n protected _defaultErrorStateMatcher: ErrorStateMatcher | null = null;\n\n}\n\n@Directive({\n selector: '[ngxMatFileInputIcon]',\n})\nexport class NgxMatFileInputIcon {}\n\n@Component({\n selector: 'ngx-mat-file-input',\n templateUrl: 'file-input.component.html',\n styleUrls: ['file-input.component.scss'],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ngx-mat-file-input',\n },\n providers: [\n {\n provide: MatFormFieldControl,\n useExisting: forwardRef(() => NgxMatFileInputComponent),\n },\n ],\n exportAs: 'ngx-mat-file-input',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [MatIconModule, MatButtonModule],\n})\nexport class NgxMatFileInputComponent\n extends NgxMatInputMixinBase\n implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor\n{\n private _inputFileRef = viewChild<ElementRef>('inputFile');\n private _inputValueRef = viewChild<ElementRef>('inputValue');\n\n readonly color = input<ThemePalette>('primary');\n\n public fileNames = \"\";\n\n protected _uid = `ngx-mat-fileinput-${nextUniqueId++}`;\n _ariaDescribedby = \"\";\n\n override stateChanges: Subject<void> = new Subject<void>();\n focused = false;\n errorState = false;\n controlType = 'ngx-mat-file-input';\n autofilled = false;\n\n /** Function when touched */\n _onTouched = () => {\n // Intentionally empty.\n };\n\n /** Function when changed */\n _onChange: (value: FileOrArrayFile) => void = () => {\n // Intentionally empty.\n };\n\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n return this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n protected _disabled = false;\n\n @Input()\n get id(): string {\n return this._id;\n }\n set id(value: string) {\n this._id = value || this._uid;\n }\n protected _id = \"\";\n\n @Input()\n get multiple(): boolean {\n return this._multiple;\n }\n set multiple(value: boolean) {\n this._multiple = coerceBooleanProperty(value);\n }\n protected _multiple = false;\n\n @Input()\n placeholder = 'Choose a file';\n separator = input<string>(',');\n\n @Input()\n get required(): boolean {\n return this._required;\n }\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n protected _required = false;\n\n @Input() errorStateMatcher: ErrorStateMatcher | null = null;\n\n @Input()\n get value(): FileOrArrayFile | null {\n return this._value;\n }\n set value(value: FileOrArrayFile) {\n this._value = value;\n }\n protected _value: FileOrArrayFile | null = null;\n\n @Input()\n get readonly(): boolean {\n return this._readonly;\n }\n set readonly(value: boolean) {\n this._readonly = coerceBooleanProperty(value);\n }\n private _readonly = true;\n\n /**\n * Limiting accepted file types\n * Example: accept=\"image/png, image/jpeg\" or accept=\".png, .jpg, .jpeg\" — Accept PNG or JPEG files.\n */\n @Input()\n get accept(): string {\n return this._accept;\n }\n set accept(value: string) {\n this._accept = value;\n }\n private _accept = \"\";\n\n protected _elementRef = inject(ElementRef<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>);\n protected _platform = inject(Platform);\n private _cd = inject(ChangeDetectorRef);\n\n override ngControl = inject(NgControl, { optional: true, self: true });\n protected override _parentForm = inject(NgForm, { optional: true });\n protected override _parentFormGroup = inject(FormGroupDirective, { optional: true });\n protected override _defaultErrorStateMatcher = inject(ErrorStateMatcher);\n\n constructor() {\n super();\n\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n this.updateErrorState();\n }\n }\n\n updateErrorState() {\n const control = this.ngControl ? this.ngControl.control : null;\n\n this.errorState = (this.errorStateMatcher ?? this._defaultErrorStateMatcher).isErrorState(\n control,\n this._parentForm,\n );\n }\n\n // Implemented as part of ControlValueAccessor.\n writeValue(value: FileOrArrayFile): void {\n this._updateInputValue(value);\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnChange(fn: (value: FileOrArrayFile) => void): void {\n this._onChange = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.stateChanges.next();\n }\n\n /** Focuses the input. */\n focus(options?: FocusOptions): void {\n this._inputValueRef()?.nativeElement.focus(options);\n }\n\n _focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused && (!this.readonly || !isFocused)) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /** Mark the field as touched */\n _markAsTouched() {\n this._onTouched();\n this._cd.markForCheck();\n this.stateChanges.next();\n }\n\n protected _isBadInput() {\n const validity = (this._inputValueRef()?.nativeElement as HTMLInputElement).validity;\n return validity && validity.badInput;\n }\n\n get empty(): boolean {\n return !this._inputValueRef()?.nativeElement.value && !this._isBadInput() && !this.autofilled;\n }\n\n get shouldLabelFloat(): boolean {\n return this.focused || !this.empty;\n }\n\n setDescribedByIds(ids: string[]) {\n this._ariaDescribedby = ids.join(' ');\n }\n\n openFilePicker(event?: MouseEvent) {\n this._inputFileRef()?.nativeElement.click();\n if (event) {\n event.preventDefault();\n event.stopPropagation();\n }\n this._markAsTouched();\n }\n\n handleFiles(filelist: FileList) {\n if (filelist.length > 0) {\n const files: File[] = [];\n for (let i = 0; i < filelist.length; i++) {\n const f = filelist.item(i);\n if (f)\n files.push(f);\n }\n this._updateInputValue(files);\n this._resetInputFile();\n this._onChange(this.multiple ? files : files[0]);\n }\n }\n\n /** Handles a click on the control's container. */\n onContainerClick(_: MouseEvent) {\n // Intentionally empty.\n }\n\n private _resetInputFile() {\n this._inputFileRef()!.nativeElement.value = '';\n }\n\n private _updateInputValue(files: FileOrArrayFile) {\n let text = null;\n if (files) {\n if (Array.isArray(files)) {\n text = this._multiple ? files.map((x) => x.name).join(this.separator()) : files[0].name;\n } else {\n text = files.name != null ? files.name : null;\n }\n }\n\n this._inputValueRef()!.nativeElement.value = text;\n }\n}\n","<input\n #inputValue\n autocomplete=\"off\"\n class=\"mat-mdc-input-element mat-mdc-form-field-input-control mdc-text-field__input\"\n [attr.id]=\"id\"\n [attr.placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.readonly]=\"readonly || null\"\n [attr.aria-describedby]=\"_ariaDescribedby || null\"\n [attr.aria-invalid]=\"errorState\"\n [attr.aria-required]=\"required.toString()\"\n/>\n<div class=\"mat-mdc-form-field-suffix\">\n <button\n matSuffix\n mat-icon-button\n [color]=\"color()\"\n class=\"button-browse\"\n (click)=\"openFilePicker($event)\"\n type=\"button\"\n [disabled]=\"disabled\"\n >\n <ng-content select=\"[ngxMatFileInputIcon]\">\n <mat-icon class=\"ngx-mat-file-input--default-icon\">attach_file</mat-icon>\n </ng-content>\n </button>\n</div>\n<input\n type=\"file\"\n #inputFile\n (change)=\"handleFiles($event.target.files!)\"\n class=\"input-file\"\n [multiple]=\"multiple\"\n [accept]=\"accept\"\n/>\n","export function calculFileSize(number: number): string {\n if (number < 1024) {\n return number + 'bytes';\n } else if (number >= 1024 && number < 1048576) {\n return (number / 1024).toFixed(1) + 'KB';\n } else if (number >= 1048576) {\n return (number / 1048576).toFixed(1) + 'MB';\n }\n return `${number}`;\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for size of file\n * @param max Max of size of file (in bytes)\n */\nexport function MaxSizeValidator(max: number): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n max = Number(max);\n if (isNaN(max)) {\n throw 'MaxSizeValidator: max of size of file is invalid';\n }\n if (!ctrl.value) return null;\n let files: File[] = ctrl.value;\n if (!Array.isArray(ctrl.value)) {\n files = [ctrl.value];\n }\n if (!files.length) return null;\n const add = (a: number, b: number): number => a + b;\n const sumSize = files.map((x) => x.size).reduce(add);\n if (sumSize > max) {\n return {\n maxSize: true,\n };\n }\n return null;\n };\n}\n","import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';\n\n/**\n * Validator for input file accept\n * @param accept Allowable type of file\n */\nexport function AcceptValidator(accept: string): ValidatorFn {\n return (ctrl: AbstractControl): ValidationErrors | null => {\n if (!accept) {\n throw 'AcceptValidator: allowable type of file can not be empty';\n }\n\n if (ctrl.value == null) return null;\n\n if (!accept.includes(ctrl.value.type)) {\n return {\n accept: true,\n };\n }\n\n return null;\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,IAAI,eAAe;AAEnB,IAAM,uBAAN,MAA0B;CAEf,eAAe,IAAI,QAAO;CAEzB,YAA8B;CAC9B,cAA6B;CAC7B,mBAA8C;CAC9C,4BAAsD;AAEjE;AAKD,IAAa,sBAAb,MAAa,oBAAmB;CAAnB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAmB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAnB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAmB,cAAA;EAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAAnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAH/B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,wBACX,CAAA;;;AAqBD,IAAa,2BAAb,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AE,IAAI,CAAC,CAAC,OAAO,GAC5C,IAAU,KACZ,OAAO,EACL,SAAS,KACV;EAEH,OAAO;CACT;AACF;ACrBA,SAAgB,gBAAgB,QAAc;CAC5C,QAAQ,SAAkD;EACxD,IAAI,CAAC,QACH,MAAM;EAGR,IAAI,KAAK,SAAS,MAAM,OAAO;EAE/B,IAAI,CAAC,OAAO,SAAS,KAAK,MAAM,IAAI,GAClC,OAAO,EACL,QAAQ,KACT;EAGH,OAAO;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,116 +1,155 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ErrorStateMatcher, ThemePalette } from
|
|
6
|
-
import { MatFormFieldControl } from
|
|
7
|
-
import { Subject } from
|
|
8
|
-
|
|
9
|
-
type FileOrArrayFile = File | File[];
|
|
10
|
-
|
|
1
|
+
import { Platform } from "@angular/cdk/platform";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { DoCheck, ElementRef, OnChanges, OnDestroy } from "@angular/core";
|
|
4
|
+
import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm, ValidatorFn } from "@angular/forms";
|
|
5
|
+
import { ErrorStateMatcher, ThemePalette } from "@angular/material/core";
|
|
6
|
+
import { MatFormFieldControl } from "@angular/material/form-field";
|
|
7
|
+
import { Subject } from "rxjs";
|
|
8
|
+
export type FileOrArrayFile = File | File[];
|
|
11
9
|
declare class NgxMatInputMixinBase {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
readonly stateChanges: Subject<void>;
|
|
11
|
+
protected ngControl: NgControl | null;
|
|
12
|
+
protected _parentForm: NgForm | null;
|
|
13
|
+
protected _parentFormGroup: FormGroupDirective | null;
|
|
14
|
+
protected _defaultErrorStateMatcher: ErrorStateMatcher | null;
|
|
17
15
|
}
|
|
18
|
-
declare class NgxMatFileInputIcon {
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
export declare class NgxMatFileInputIcon {
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatFileInputIcon, never>;
|
|
18
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxMatFileInputIcon, "[ngxMatFileInputIcon]", never, {}, {}, never, never, true, never>;
|
|
21
19
|
}
|
|
22
|
-
declare class NgxMatFileInputComponent extends NgxMatInputMixinBase implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
20
|
+
export declare class NgxMatFileInputComponent extends NgxMatInputMixinBase implements MatFormFieldControl<FileOrArrayFile>, OnChanges, OnDestroy, DoCheck, ControlValueAccessor {
|
|
21
|
+
private _inputFileRef;
|
|
22
|
+
private _inputValueRef;
|
|
23
|
+
readonly color: import("@angular/core").InputSignal<ThemePalette>;
|
|
24
|
+
fileNames: string;
|
|
25
|
+
protected _uid: string;
|
|
26
|
+
_ariaDescribedby: string;
|
|
27
|
+
stateChanges: Subject<void>;
|
|
28
|
+
focused: boolean;
|
|
29
|
+
errorState: boolean;
|
|
30
|
+
controlType: string;
|
|
31
|
+
autofilled: boolean;
|
|
32
|
+
/** Function when touched */
|
|
33
|
+
_onTouched: () => void;
|
|
34
|
+
/** Function when changed */
|
|
35
|
+
_onChange: (value: FileOrArrayFile) => void;
|
|
36
|
+
get disabled(): boolean;
|
|
37
|
+
set disabled(value: boolean);
|
|
38
|
+
protected _disabled: boolean;
|
|
39
|
+
get id(): string;
|
|
40
|
+
set id(value: string);
|
|
41
|
+
protected _id: string;
|
|
42
|
+
get multiple(): boolean;
|
|
43
|
+
set multiple(value: boolean);
|
|
44
|
+
protected _multiple: boolean;
|
|
45
|
+
placeholder: string;
|
|
46
|
+
separator: import("@angular/core").InputSignal<string>;
|
|
47
|
+
get required(): boolean;
|
|
48
|
+
set required(value: boolean);
|
|
49
|
+
protected _required: boolean;
|
|
50
|
+
errorStateMatcher: ErrorStateMatcher | null;
|
|
51
|
+
get value(): FileOrArrayFile | null;
|
|
52
|
+
set value(value: FileOrArrayFile);
|
|
53
|
+
protected _value: FileOrArrayFile | null;
|
|
54
|
+
get readonly(): boolean;
|
|
55
|
+
set readonly(value: boolean);
|
|
56
|
+
private _readonly;
|
|
57
|
+
/**
|
|
58
|
+
* Limiting accepted file types
|
|
59
|
+
* Example: accept="image/png, image/jpeg" or accept=".png, .jpg, .jpeg" — Accept PNG or JPEG files.
|
|
60
|
+
*/
|
|
61
|
+
get accept(): string;
|
|
62
|
+
set accept(value: string);
|
|
63
|
+
private _accept;
|
|
64
|
+
protected _elementRef: ElementRef<any>;
|
|
65
|
+
protected _platform: Platform;
|
|
66
|
+
private _cd;
|
|
67
|
+
ngControl: NgControl | null;
|
|
68
|
+
protected _parentForm: NgForm | null;
|
|
69
|
+
protected _parentFormGroup: FormGroupDirective | null;
|
|
70
|
+
protected _defaultErrorStateMatcher: ErrorStateMatcher;
|
|
71
|
+
constructor();
|
|
72
|
+
ngOnChanges(): void;
|
|
73
|
+
ngOnDestroy(): void;
|
|
74
|
+
ngDoCheck(): void;
|
|
75
|
+
updateErrorState(): void;
|
|
76
|
+
writeValue(value: FileOrArrayFile): void;
|
|
77
|
+
registerOnChange(fn: (value: FileOrArrayFile) => void): void;
|
|
78
|
+
registerOnTouched(fn: () => void): void;
|
|
79
|
+
setDisabledState(isDisabled: boolean): void;
|
|
80
|
+
/** Focuses the input. */
|
|
81
|
+
focus(options?: FocusOptions): void;
|
|
82
|
+
_focusChanged(isFocused: boolean): void;
|
|
83
|
+
/** Mark the field as touched */
|
|
84
|
+
_markAsTouched(): void;
|
|
85
|
+
protected _isBadInput(): boolean;
|
|
86
|
+
get empty(): boolean;
|
|
87
|
+
get shouldLabelFloat(): boolean;
|
|
88
|
+
setDescribedByIds(ids: string[]): void;
|
|
89
|
+
openFilePicker(event?: MouseEvent): void;
|
|
90
|
+
handleFiles(filelist: FileList): void;
|
|
91
|
+
/** Handles a click on the control's container. */
|
|
92
|
+
onContainerClick(_: MouseEvent): void;
|
|
93
|
+
private _resetInputFile;
|
|
94
|
+
private _updateInputValue;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatFileInputComponent, never>;
|
|
96
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatFileInputComponent, "ngx-mat-file-input", ["ngx-mat-file-input"], {
|
|
97
|
+
"color": {
|
|
98
|
+
"alias": "color";
|
|
99
|
+
"required": false;
|
|
100
|
+
"isSignal": true;
|
|
101
|
+
};
|
|
102
|
+
"disabled": {
|
|
103
|
+
"alias": "disabled";
|
|
104
|
+
"required": false;
|
|
105
|
+
};
|
|
106
|
+
"id": {
|
|
107
|
+
"alias": "id";
|
|
108
|
+
"required": false;
|
|
109
|
+
};
|
|
110
|
+
"multiple": {
|
|
111
|
+
"alias": "multiple";
|
|
112
|
+
"required": false;
|
|
113
|
+
};
|
|
114
|
+
"placeholder": {
|
|
115
|
+
"alias": "placeholder";
|
|
116
|
+
"required": false;
|
|
117
|
+
};
|
|
118
|
+
"separator": {
|
|
119
|
+
"alias": "separator";
|
|
120
|
+
"required": false;
|
|
121
|
+
"isSignal": true;
|
|
122
|
+
};
|
|
123
|
+
"required": {
|
|
124
|
+
"alias": "required";
|
|
125
|
+
"required": false;
|
|
126
|
+
};
|
|
127
|
+
"errorStateMatcher": {
|
|
128
|
+
"alias": "errorStateMatcher";
|
|
129
|
+
"required": false;
|
|
130
|
+
};
|
|
131
|
+
"value": {
|
|
132
|
+
"alias": "value";
|
|
133
|
+
"required": false;
|
|
134
|
+
};
|
|
135
|
+
"readonly": {
|
|
136
|
+
"alias": "readonly";
|
|
137
|
+
"required": false;
|
|
138
|
+
};
|
|
139
|
+
"accept": {
|
|
140
|
+
"alias": "accept";
|
|
141
|
+
"required": false;
|
|
142
|
+
};
|
|
143
|
+
}, {}, never, ["[ngxMatFileInputIcon]"], true, never>;
|
|
99
144
|
}
|
|
100
|
-
|
|
101
|
-
declare function calculFileSize(number: number): string;
|
|
102
|
-
|
|
145
|
+
export declare function calculFileSize(number: number): string;
|
|
103
146
|
/**
|
|
104
147
|
* Validator for size of file
|
|
105
148
|
* @param max Max of size of file (in bytes)
|
|
106
149
|
*/
|
|
107
|
-
declare function MaxSizeValidator(max: number): ValidatorFn;
|
|
108
|
-
|
|
150
|
+
export declare function MaxSizeValidator(max: number): ValidatorFn;
|
|
109
151
|
/**
|
|
110
152
|
* Validator for input file accept
|
|
111
153
|
* @param accept Allowable type of file
|
|
112
154
|
*/
|
|
113
|
-
declare function AcceptValidator(accept: string): ValidatorFn;
|
|
114
|
-
|
|
115
|
-
export { AcceptValidator, MaxSizeValidator, NgxMatFileInputComponent, NgxMatFileInputIcon, calculFileSize };
|
|
116
|
-
export type { FileOrArrayFile };
|
|
155
|
+
export declare function AcceptValidator(accept: string): ValidatorFn;
|