@ptsecurity/mosaic 17.3.0 → 17.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/autocomplete-trigger.directive.d.ts +1 -0
- package/button/button.scss +14 -4
- package/checkbox/checkbox.d.ts +6 -6
- package/core/animation/animation.d.ts +2 -1
- package/core/common-behaviors/checkbox.d.ts +1 -0
- package/core/common-behaviors/index.d.ts +1 -0
- package/core/forms/index.d.ts +1 -0
- package/core/forms/validators.d.ts +22 -0
- package/core/locales/en-US.d.ts +17 -0
- package/core/locales/es-LA.d.ts +17 -0
- package/core/locales/fa-IR.d.ts +17 -0
- package/core/locales/index.d.ts +7 -0
- package/core/locales/locale-service.d.ts +175 -0
- package/core/locales/pt-BR.d.ts +17 -0
- package/core/locales/ru-RU.d.ts +17 -0
- package/core/locales/tk-TM.d.ts +64 -0
- package/core/locales/zh-CN.d.ts +17 -0
- package/core/pop-up/constants.d.ts +9 -0
- package/core/pop-up/pop-up-trigger.d.ts +25 -9
- package/core/pop-up/pop-up.d.ts +3 -3
- package/core/styles/theming/_theming.scss +1 -0
- package/datepicker/calendar-header.component.d.ts +11 -5
- package/datepicker/datepicker-input.directive.d.ts +10 -0
- package/dropdown/dropdown-trigger.directive.d.ts +1 -1
- package/ellipsis-center/ellipsis-center.directive.d.ts +3 -7
- package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +13 -5
- package/esm2022/button/button.component.mjs +2 -2
- package/esm2022/checkbox/checkbox.mjs +5 -5
- package/esm2022/code-block/actionbar.component.mjs +1 -1
- package/esm2022/core/animation/animation.mjs +2 -1
- package/esm2022/core/common-behaviors/checkbox.mjs +2 -0
- package/esm2022/core/common-behaviors/index.mjs +2 -1
- package/esm2022/core/forms/index.mjs +2 -1
- package/esm2022/core/forms/validators.mjs +33 -0
- package/esm2022/core/locales/en-US.mjs +19 -2
- package/esm2022/core/locales/es-LA.mjs +19 -2
- package/esm2022/core/locales/fa-IR.mjs +19 -2
- package/esm2022/core/locales/index.mjs +8 -1
- package/esm2022/core/locales/locale-service.mjs +39 -3
- package/esm2022/core/locales/pt-BR.mjs +19 -2
- package/esm2022/core/locales/ru-RU.mjs +19 -2
- package/esm2022/core/locales/tk-TM.mjs +63 -0
- package/esm2022/core/locales/zh-CN.mjs +19 -2
- package/esm2022/core/pop-up/constants.mjs +6 -1
- package/esm2022/core/pop-up/pop-up-trigger.mjs +68 -21
- package/esm2022/core/pop-up/pop-up.mjs +7 -6
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/datepicker/calendar-header.component.mjs +40 -10
- package/esm2022/datepicker/datepicker-input.directive.mjs +103 -23
- package/esm2022/dropdown/dropdown-trigger.directive.mjs +2 -2
- package/esm2022/ellipsis-center/ellipsis-center.directive.mjs +12 -23
- package/esm2022/file-upload/file-upload.mjs +39 -2
- package/esm2022/file-upload/file-upload.module.mjs +8 -1
- package/esm2022/file-upload/multiple-file-upload.component.mjs +157 -42
- package/esm2022/file-upload/single-file-upload.component.mjs +140 -38
- package/esm2022/form-field/form-field.mjs +6 -6
- package/esm2022/form-field/validate.directive.mjs +5 -2
- package/esm2022/input/input-number.mjs +31 -59
- package/esm2022/input/input-password.mjs +15 -26
- package/esm2022/input/input.mjs +3 -3
- package/esm2022/loader-overlay/loader-overlay.component.mjs +10 -8
- package/esm2022/modal/modal.component.mjs +3 -3
- package/esm2022/modal/modal.directive.mjs +38 -7
- package/esm2022/navbar/navbar-item.component.mjs +16 -30
- package/esm2022/popover/popover-confirm.component.mjs +11 -20
- package/esm2022/popover/popover.component.mjs +27 -29
- package/esm2022/progress-spinner/progress-spinner.component.mjs +2 -2
- package/esm2022/select/select-option.directive.mjs +7 -18
- package/esm2022/select/select.component.mjs +9 -6
- package/esm2022/sidebar/sidebar.component.mjs +10 -6
- package/esm2022/tabs/tab-group.component.mjs +1 -1
- package/esm2022/tabs/tab-header.component.mjs +2 -2
- package/esm2022/timezone/timezone-option.directive.mjs +7 -18
- package/esm2022/title/title.directive.mjs +7 -18
- package/esm2022/toggle/toggle.component.mjs +103 -18
- package/esm2022/tooltip/tooltip.component.mjs +72 -45
- package/esm2022/tree-select/tree-select.component.mjs +8 -6
- package/fesm2022/ptsecurity-mosaic-autocomplete.mjs +12 -4
- package/fesm2022/ptsecurity-mosaic-autocomplete.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-button.mjs +2 -2
- package/fesm2022/ptsecurity-mosaic-button.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-checkbox.mjs +4 -4
- package/fesm2022/ptsecurity-mosaic-checkbox.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-code-block.mjs +1 -1
- package/fesm2022/ptsecurity-mosaic-code-block.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-core.mjs +322 -36
- package/fesm2022/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-datepicker.mjs +141 -31
- package/fesm2022/ptsecurity-mosaic-datepicker.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-dropdown.mjs +1 -1
- package/fesm2022/ptsecurity-mosaic-dropdown.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-ellipsis-center.mjs +11 -19
- package/fesm2022/ptsecurity-mosaic-ellipsis-center.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-file-upload.mjs +327 -73
- package/fesm2022/ptsecurity-mosaic-file-upload.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-form-field.mjs +9 -6
- package/fesm2022/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-input.mjs +39 -75
- package/fesm2022/ptsecurity-mosaic-input.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-loader-overlay.mjs +10 -8
- package/fesm2022/ptsecurity-mosaic-loader-overlay.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-modal.mjs +32 -7
- package/fesm2022/ptsecurity-mosaic-modal.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-navbar.mjs +14 -26
- package/fesm2022/ptsecurity-mosaic-navbar.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-popover.mjs +33 -39
- package/fesm2022/ptsecurity-mosaic-popover.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-progress-spinner.mjs +2 -2
- package/fesm2022/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-select.mjs +25 -28
- package/fesm2022/ptsecurity-mosaic-select.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-sidebar.mjs +8 -4
- package/fesm2022/ptsecurity-mosaic-sidebar.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-tabs.mjs +3 -3
- package/fesm2022/ptsecurity-mosaic-tabs.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-timezone.mjs +10 -17
- package/fesm2022/ptsecurity-mosaic-timezone.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-title.mjs +6 -14
- package/fesm2022/ptsecurity-mosaic-title.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-toggle.mjs +102 -17
- package/fesm2022/ptsecurity-mosaic-toggle.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-tooltip.mjs +71 -42
- package/fesm2022/ptsecurity-mosaic-tooltip.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-tree-select.mjs +7 -5
- package/fesm2022/ptsecurity-mosaic-tree-select.mjs.map +1 -1
- package/file-upload/_file-upload-theme.scss +23 -13
- package/file-upload/file-upload.d.ts +31 -3
- package/file-upload/file-upload.module.d.ts +11 -10
- package/file-upload/file-upload.scss +8 -1
- package/file-upload/multiple-file-upload.component.d.ts +62 -10
- package/file-upload/multiple-file-upload.component.scss +0 -8
- package/file-upload/single-file-upload.component.d.ts +55 -11
- package/file-upload/single-file-upload.component.scss +0 -8
- package/form-field/form-field.d.ts +1 -1
- package/form-field/validate.directive.d.ts +5 -2
- package/input/input-number.d.ts +10 -11
- package/input/input-password.d.ts +3 -6
- package/input/input.d.ts +1 -1
- package/loader-overlay/loader-overlay.component.d.ts +4 -3
- package/modal/modal.directive.d.ts +4 -1
- package/navbar/navbar-item.component.d.ts +5 -7
- package/package.json +8 -8
- package/popover/popover-confirm.component.d.ts +3 -6
- package/popover/popover.component.d.ts +9 -6
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/progress-spinner/progress-spinner.scss +1 -0
- package/select/select-option.directive.d.ts +3 -6
- package/sidebar/sidebar.component.d.ts +3 -2
- package/tabs/tab-header.scss +2 -2
- package/timezone/timezone-option.directive.d.ts +3 -6
- package/title/title.directive.d.ts +3 -6
- package/toggle/_toggle-theme.scss +7 -1
- package/toggle/toggle.component.d.ts +23 -6
- package/toggle/toggle.scss +23 -0
- package/tooltip/tooltip.component.d.ts +25 -13
@@ -1,28 +1,64 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, EventEmitter, Directive, Output, TemplateRef, Component, ChangeDetectionStrategy, Optional, Inject, Input, ContentChild, ViewChild, NgModule } from '@angular/core';
|
2
|
+
import { InjectionToken, inject, Renderer2, ChangeDetectorRef, DestroyRef, ElementRef, EventEmitter, Directive, Output, TemplateRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Optional, Inject, Input, ContentChild, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
3
|
+
import { NgControl, NgForm, FormGroupDirective, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
4
|
+
import * as i8 from '@ptsecurity/mosaic/core';
|
5
|
+
import { MC_LOCALE_SERVICE, ErrorStateMatcher, ruRULocaleData, McDataSizeModule } from '@ptsecurity/mosaic/core';
|
6
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
3
7
|
import * as i1 from '@angular/common';
|
4
8
|
import { CommonModule } from '@angular/common';
|
5
9
|
import * as i4$1 from '@ptsecurity/mosaic/button';
|
6
10
|
import { McButtonModule } from '@ptsecurity/mosaic/button';
|
7
|
-
import * as
|
8
|
-
import { McDataSizeModule } from '@ptsecurity/mosaic/core';
|
9
|
-
import * as i6 from '@ptsecurity/mosaic/ellipsis-center';
|
11
|
+
import * as i5 from '@ptsecurity/mosaic/ellipsis-center';
|
10
12
|
import { McEllipsisCenterModule } from '@ptsecurity/mosaic/ellipsis-center';
|
11
|
-
import
|
12
|
-
import { McFormFieldModule } from '@ptsecurity/mosaic/form-field';
|
13
|
+
import { McHint, McFormFieldModule } from '@ptsecurity/mosaic/form-field';
|
13
14
|
import * as i3 from '@ptsecurity/mosaic/icon';
|
14
15
|
import { McIconModule } from '@ptsecurity/mosaic/icon';
|
15
|
-
import * as
|
16
|
+
import * as i6 from '@ptsecurity/mosaic/link';
|
16
17
|
import { McLinkModule } from '@ptsecurity/mosaic/link';
|
17
18
|
import * as i4 from '@ptsecurity/mosaic/list';
|
18
19
|
import { McListModule } from '@ptsecurity/mosaic/list';
|
19
20
|
import * as i2 from '@ptsecurity/mosaic/progress-spinner';
|
20
21
|
import { McProgressSpinnerModule } from '@ptsecurity/mosaic/progress-spinner';
|
21
22
|
import { McToolTipModule } from '@ptsecurity/mosaic/tooltip';
|
22
|
-
import {
|
23
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
24
|
+
import { distinctUntilChanged } from 'rxjs/operators';
|
23
25
|
|
24
26
|
/* Object for labels customization inside file upload component */
|
25
27
|
const MC_FILE_UPLOAD_CONFIGURATION = new InjectionToken('McFileUploadConfiguration');
|
28
|
+
/** @docs-private */
|
29
|
+
class McFileUploadBase {
|
30
|
+
constructor() {
|
31
|
+
/** Whether the component is in an error state. */
|
32
|
+
this.errorState = false;
|
33
|
+
/**
|
34
|
+
* Emits whenever the component state changes and should cause the parent
|
35
|
+
* form-field to update. Implemented as part of `McFormFieldControl`.
|
36
|
+
* @docs-private
|
37
|
+
*/
|
38
|
+
this.stateChanges = new Subject();
|
39
|
+
this.renderer = inject(Renderer2);
|
40
|
+
this.cdr = inject(ChangeDetectorRef);
|
41
|
+
this.localeService = inject(MC_LOCALE_SERVICE, { optional: true });
|
42
|
+
this.destroyRef = inject(DestroyRef);
|
43
|
+
this.ngControl = inject(NgControl, { optional: true, self: true });
|
44
|
+
this.parentForm = inject(NgForm, { optional: true });
|
45
|
+
this.parentFormGroup = inject(FormGroupDirective, { optional: true });
|
46
|
+
this.defaultErrorStateMatcher = inject(ErrorStateMatcher);
|
47
|
+
this.elementRef = inject(ElementRef);
|
48
|
+
}
|
49
|
+
/** implemented as part of base class. Decided not use mixinErrorState, not to over */
|
50
|
+
updateErrorState() {
|
51
|
+
const oldState = this.errorState;
|
52
|
+
const parent = this.parentFormGroup || this.parentForm;
|
53
|
+
const matcher = this.errorStateMatcher || this.defaultErrorStateMatcher;
|
54
|
+
const control = this.ngControl ? this.ngControl.control : null;
|
55
|
+
const newState = matcher.isErrorState(control, parent);
|
56
|
+
if (newState !== oldState) {
|
57
|
+
this.errorState = newState;
|
58
|
+
this.stateChanges.next();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
26
62
|
|
27
63
|
const isFolderCanBeDragged = () => 'webkitGetAsEntry' in DataTransferItem.prototype;
|
28
64
|
const entryIsDirectory = (entry) => !!entry && entry.isDirectory;
|
@@ -103,67 +139,157 @@ const unwrapDirectory = async (item) => {
|
|
103
139
|
};
|
104
140
|
|
105
141
|
let nextMultipleFileUploadUniqueId = 0;
|
106
|
-
const MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION =
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
142
|
+
const MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION = ruRULocaleData['ru-RU'].fileUpload.multiple;
|
143
|
+
class McMultipleFileUploadComponent extends McFileUploadBase {
|
144
|
+
get files() {
|
145
|
+
return this._files;
|
146
|
+
}
|
147
|
+
set files(currentFileList) {
|
148
|
+
this._files = currentFileList;
|
149
|
+
this.cvaOnChange(this._files);
|
150
|
+
this.fileQueueChanged.emit(this._files);
|
151
|
+
this.cdr.markForCheck();
|
115
152
|
}
|
116
|
-
};
|
117
|
-
class McMultipleFileUploadComponent {
|
118
153
|
get acceptedFiles() {
|
119
154
|
return this.accept && this.accept.length > 0 ? this.accept.map((ext) => `.${ext}`).join(',') : '*/*';
|
120
155
|
}
|
156
|
+
/**
|
157
|
+
* @deprecated use `FormControl.errors`
|
158
|
+
*/
|
121
159
|
get hasErrors() {
|
122
160
|
return this.errors && !!this.errors.length;
|
123
161
|
}
|
124
|
-
|
125
|
-
this.
|
126
|
-
|
162
|
+
get hasHint() {
|
163
|
+
return this.hint.length > 0;
|
164
|
+
}
|
165
|
+
/**
|
166
|
+
* Indicates an invalid state based on file errors or `errorState`,
|
167
|
+
* applying a CSS class in HTML for visual feedback.
|
168
|
+
*/
|
169
|
+
get invalid() {
|
170
|
+
return this.errorState;
|
171
|
+
}
|
172
|
+
constructor(configuration) {
|
173
|
+
super();
|
174
|
+
this.configuration = configuration;
|
127
175
|
this.errors = [];
|
128
|
-
this.files = [];
|
129
176
|
this.size = 'default';
|
177
|
+
/**
|
178
|
+
* custom ID for the file input element.
|
179
|
+
*/
|
130
180
|
this.inputId = `mc-multiple-file-upload-${nextMultipleFileUploadUniqueId++}`;
|
181
|
+
this._files = [];
|
131
182
|
this.fileQueueChanged = new EventEmitter();
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
183
|
+
/**
|
184
|
+
* Emits an event containing a chunk of files added to the file list.
|
185
|
+
*/
|
186
|
+
this.filesAdded = new EventEmitter();
|
187
|
+
/**
|
188
|
+
* Emits an event containing a file and file's index when removed from the file list.
|
189
|
+
*/
|
190
|
+
this.fileRemoved = new EventEmitter();
|
191
|
+
/** cvaOnChange function registered via registerOnChange (ControlValueAccessor). @docs-private */
|
192
|
+
// tslint:disable-next-line:no-empty
|
193
|
+
this.cvaOnChange = (_) => { };
|
194
|
+
/** onTouch function registered via registerOnTouch (ControlValueAccessor). @docs-private */
|
195
|
+
// tslint:disable-next-line:no-empty
|
196
|
+
this.onTouched = () => { };
|
197
|
+
this.updateLocaleParams = () => {
|
198
|
+
this.config = this.configuration || this.localeService?.getParams('fileUpload').multiple;
|
199
|
+
this.columnDefs = [
|
200
|
+
{ header: this.config.gridHeaders.file, cssClass: 'file' },
|
201
|
+
{ header: this.config.gridHeaders.size, cssClass: 'size' },
|
202
|
+
{ header: '', cssClass: 'action' }
|
203
|
+
];
|
204
|
+
this.makeCaptionText();
|
205
|
+
this.cdr.markForCheck();
|
206
|
+
};
|
207
|
+
this.localeService?.changes.pipe(takeUntilDestroyed()).subscribe(this.updateLocaleParams);
|
208
|
+
if (!this.localeService) {
|
209
|
+
this.initDefaultParams();
|
210
|
+
}
|
211
|
+
if (this.ngControl) {
|
212
|
+
// Note: we provide the value accessor through here, instead of
|
213
|
+
// the `providers` to avoid running into a circular import.
|
214
|
+
this.ngControl.valueAccessor = this;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
ngAfterViewInit() {
|
218
|
+
// FormControl specific errors update
|
219
|
+
this.ngControl?.statusChanges
|
220
|
+
?.pipe(takeUntilDestroyed(this.destroyRef))
|
221
|
+
.subscribe(() => {
|
222
|
+
this.errors = Object.values(this.ngControl?.errors || {});
|
223
|
+
this.cdr.markForCheck();
|
224
|
+
});
|
225
|
+
this.stateChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.cdr.markForCheck());
|
226
|
+
}
|
227
|
+
ngDoCheck() {
|
228
|
+
if (this.ngControl) {
|
229
|
+
// We need to re-evaluate this on every change detection cycle, because there are some
|
230
|
+
// error triggers that we can't subscribe to (e.g. parent form submissions). This means
|
231
|
+
// that whatever logic is in here has to be super lean or we risk destroying the performance.
|
232
|
+
this.updateErrorState();
|
233
|
+
}
|
234
|
+
}
|
235
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
236
|
+
writeValue(files) {
|
237
|
+
if (files instanceof FileList || !files) {
|
238
|
+
this.files = this.mapToFileItem(files);
|
239
|
+
}
|
240
|
+
else {
|
241
|
+
this.files = files;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
245
|
+
registerOnChange(fn) { this.cvaOnChange = fn; }
|
246
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
247
|
+
registerOnTouched(fn) { this.onTouched = fn; }
|
248
|
+
/**
|
249
|
+
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
|
250
|
+
* @param isDisabled Whether the control should be disabled.
|
251
|
+
* @docs-private
|
252
|
+
*/
|
253
|
+
setDisabledState(isDisabled) {
|
254
|
+
this.disabled = isDisabled;
|
255
|
+
this.cdr.markForCheck();
|
138
256
|
}
|
139
257
|
onFileSelectedViaClick({ target }) {
|
140
258
|
if (this.disabled) {
|
141
259
|
return;
|
142
260
|
}
|
261
|
+
const filesToAdd = this.mapToFileItem(target.files);
|
143
262
|
this.files = [
|
144
263
|
...this.files,
|
145
|
-
...
|
264
|
+
...filesToAdd
|
146
265
|
];
|
266
|
+
this.filesAdded.emit(filesToAdd);
|
267
|
+
this.onTouched();
|
147
268
|
/* even if the user selects the same file,
|
148
269
|
the onchange event will be triggered every time user clicks on the control.*/
|
149
270
|
this.renderer.setProperty(this.input.nativeElement, 'value', null);
|
150
|
-
this.onFileListChange();
|
151
271
|
}
|
152
272
|
onFileDropped(files) {
|
153
273
|
if (this.disabled) {
|
154
274
|
return;
|
155
275
|
}
|
156
|
-
|
157
|
-
this.
|
276
|
+
const filesToAdd = this.mapToFileItem(files);
|
277
|
+
this.files = [
|
278
|
+
...this.files,
|
279
|
+
...filesToAdd
|
280
|
+
];
|
281
|
+
this.filesAdded.emit(filesToAdd);
|
282
|
+
this.onTouched();
|
158
283
|
}
|
159
284
|
deleteFile(index, event) {
|
160
285
|
if (this.disabled) {
|
161
286
|
return;
|
162
287
|
}
|
163
288
|
event?.stopPropagation();
|
289
|
+
this.fileRemoved.emit([this.files[index], index]);
|
164
290
|
this.files.splice(index, 1);
|
165
291
|
this.files = [...this.files];
|
166
|
-
this.
|
292
|
+
this.onTouched();
|
167
293
|
}
|
168
294
|
onFileListChange() {
|
169
295
|
this.fileQueueChanged.emit(this.files);
|
@@ -198,15 +324,29 @@ class McMultipleFileUploadComponent {
|
|
198
324
|
const fileExt = file.name.split('.').pop() || '';
|
199
325
|
return this.acceptedFiles !== '*/*' && this.acceptedFiles.length > 0 ? this.acceptedFiles.includes(fileExt) : true;
|
200
326
|
}
|
201
|
-
|
202
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: McMultipleFileUploadComponent, selector: "mc-multiple-file-upload", inputs: { accept: "accept", disabled: "disabled", errors: "errors", files: "files", size: "size", inputId: "inputId", customValidation: "customValidation" }, outputs: { fileQueueChanged: "fileQueueChanged" }, host: { classAttribute: "mc-multiple-file-upload" }, queries: [{ propertyName: "customFileIcon", first: true, predicate: ["mcFileIcon"], descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.selected]=\"files && files.length\"\n [ngClass]=\"size\"\n (filesDropped)=\"onFileDropped($event)\"\n>\n <ng-container *ngIf=\"!files.length; else fileOutput\">\n <div class=\"dropzone\">\n <ng-container *ngIf=\"size === 'default' else compactCaption\">\n <i mc-icon=\"mc-upload-to-cloud_64\"></i>\n <div class=\"dropzone__text\">\n <span class=\"multiple__header\">{{ config.title }}</span>\n <div>\n <span class=\"multiple__caption\">\n {{ config.captionText }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n\n<div class=\"mc-file-upload__info-section\">\n <mc-hint class=\"mc-file-upload__hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </mc-hint>\n\n <ng-container *ngIf=\"hasErrors\">\n <mc-hint class=\"mc-file-upload__hint mc-error\"\n *ngFor=\"let error of errors\">\n {{ error }}\n </mc-hint>\n </ng-container>\n</div>\n\n<ng-template #fileOutput>\n <div class=\"file-upload__dropzone\">\n <div class=\"mc-file-upload__grid\">\n <div class=\"mc-file-multiple-uploaded__header\">\n <div class=\"mc-file-multiple-uploaded__header-inner\">\n <div [class]=\"'mc-file-upload__' + column.cssClass\" *ngFor=\"let column of columnDefs\">\n {{ column.header }}\n </div>\n </div>\n </div>\n\n <mc-list-selection [autoSelect]=\"false\" [disabled]=\"disabled\">\n <mc-list-option\n class=\"multiple__uploaded-item\"\n [value]=\"file.file.name\"\n (keydown.delete)=\"deleteFile(index)\"\n (keydown.backspace)=\"deleteFile(index)\"\n *ngFor=\"let file of files; let index = index;\">\n <div class=\"mc-file-upload__row\" [class.error]=\"file.hasError\">\n <div class=\"mc-file-upload__file\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async } as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\"\n [ngTemplateOutlet]=\"$any(customFileIcon)\"\n [ngTemplateOutletContext]=\"{ $implicit: file }\"\n >\n </ng-container>\n\n <mc-progress-spinner\n class=\"pt-nat-file-upload-name-cell__icon\"\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <span class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></span>\n </div>\n <div class=\"mc-file-upload__size\">\n {{ file.file.size | mcDataSize }}\n </div>\n <div class=\"mc-file-upload__action\">\n <i mc-icon=\"mc-close-circle_16\" (click)=\"deleteFile(index, $event)\"></i>\n </div>\n </div>\n </mc-list-option>\n </mc-list-selection>\n </div>\n\n <div class=\"btn-upload\">\n <div class=\"dropzone\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ config.captionTextWhenSelected }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #compactCaption>\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ config.captionText }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n</ng-template>\n\n<ng-template #inputTemplate>\n <input #input\n type=\"file\"\n class=\"cdk-visually-hidden\"\n multiple\n [id]=\"inputId\"\n [accept]=\"acceptedFiles\"\n [disabled]=\"disabled\"\n (change)=\"onFileSelectedViaClick($event)\">\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{border-radius:var(--mc-file-upload-size-multiple-border-radius, 4px);border-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-style:var(--mc-file-upload-size-multiple-border-style, dashed)}.mc-file-upload .mc-list-option{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);height:36px}.mc-file-upload .mc-list-option .mc-icon{margin-right:0}.mc-file-upload .mc-file-upload__grid{min-height:142px}.mc-file-upload .mc-file-multiple-uploaded__header-inner,.mc-file-upload .mc-file-upload__row{display:flex;align-items:center}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{width:65%;max-width:65%}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__size{width:var(--mc-size-7xl, 64px);min-width:var(--mc-size-7xl, 64px);text-align:left;flex-grow:1}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__action{padding-left:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px);padding-right:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px)}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{display:flex;align-items:center}.mc-file-upload .mc-file-upload__row .mc-file-upload__file .file-item__text{margin-left:0;width:90%}.mc-file-upload .mc-file-multiple-uploaded__header{border-bottom-width:1px;border-bottom-style:solid}.mc-file-upload .mc-file-multiple-uploaded__header-inner{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);border:2px solid transparent;border-bottom:unset;box-sizing:border-box;height:var(--mc-size-3xl, 32px)}.mc-file-upload .btn-upload .dropzone{margin:0;border-top-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-top-style:var(--mc-file-upload-size-multiple-border-style, dashed);padding:3px var(--mc-size-m, 12px) var(--mc-size-xxs, 4px) var(--mc-size-m, 12px)}.mc-file-upload.compact:not(.selected){height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px)}.mc-file-upload.compact .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload.default{min-height:176px;justify-content:center}.mc-file-upload.default .dropzone .dropzone__text{margin-left:var(--mc-size-l, 16px)}.mc-file-upload.default .btn-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-upload__dropzone{width:100%;height:100%}.mc-hint{display:block}.mc-file-upload__hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.McProgressSpinner, selector: "mc-progress-spinner", inputs: ["color", "id", "value", "mode", "size"] }, { kind: "component", type: i3.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i3.McIconCSSStyler, selector: "[mc-icon]" }, { kind: "component", type: i4.McListSelection, selector: "mc-list-selection", inputs: ["disabled", "autoSelect", "noUnselectLast", "horizontal", "tabIndex", "compareWith"], outputs: ["onSelectAll", "onCopy", "selectionChange"], exportAs: ["mcListSelection"] }, { kind: "component", type: i4.McListOption, selector: "mc-list-option", inputs: ["checkboxPosition", "value", "disabled", "showCheckbox", "selected"], exportAs: ["mcListOption"] }, { kind: "directive", type: i5.McHint, selector: "mc-hint", inputs: ["color", "id"] }, { kind: "directive", type: i6.McEllipsisCenterDirective, selector: "[mcEllipsisCenter]", inputs: ["mcEllipsisCenter", "minVisibleLength"] }, { kind: "directive", type: i7.McLink, selector: "[mc-link]", inputs: ["tabIndex", "disabled", "pseudo", "noUnderline", "caption", "useVisited", "print"], exportAs: ["mcLink"] }, { kind: "directive", type: McFileDropDirective, selector: "[mcFileDrop]", outputs: ["filesDropped"], exportAs: ["mcFileDrop"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i9.McDataSizePipe, name: "mcDataSize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
327
|
+
initDefaultParams() {
|
328
|
+
this.config = MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION;
|
329
|
+
this.columnDefs = [
|
330
|
+
{ header: this.config.gridHeaders.file, cssClass: 'file' },
|
331
|
+
{ header: this.config.gridHeaders.size, cssClass: 'size' },
|
332
|
+
{ header: '', cssClass: 'action' }
|
333
|
+
];
|
334
|
+
this.makeCaptionText();
|
335
|
+
}
|
336
|
+
makeCaptionText() {
|
337
|
+
this.separatedCaptionText = this.config.captionText.split('{{ browseLink }}');
|
338
|
+
this.separatedCaptionTextWhenSelected = this.config.captionTextWhenSelected.split('{{ browseLink }}');
|
339
|
+
this.separatedCaptionTextForCompactSize = this.config.captionTextForCompactSize.split('{{ browseLink }}');
|
340
|
+
}
|
341
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: McMultipleFileUploadComponent, deps: [{ token: MC_FILE_UPLOAD_CONFIGURATION, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
342
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: McMultipleFileUploadComponent, selector: "mc-multiple-file-upload", inputs: { accept: "accept", disabled: "disabled", errors: "errors", size: "size", inputId: "inputId", customValidation: "customValidation", errorStateMatcher: "errorStateMatcher", files: "files" }, outputs: { fileQueueChanged: "fileQueueChanged", filesAdded: "filesAdded", fileRemoved: "fileRemoved" }, host: { classAttribute: "mc-multiple-file-upload" }, queries: [{ propertyName: "customFileIcon", first: true, predicate: ["mcFileIcon"], descendants: true, read: TemplateRef }, { propertyName: "hint", predicate: McHint }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.mc-error]=\"errorState\"\n [class.selected]=\"files && files.length\"\n [ngClass]=\"size\"\n (filesDropped)=\"onFileDropped($event)\"\n>\n <ng-container *ngIf=\"!files.length; else fileOutput\">\n <div class=\"dropzone\">\n <ng-container *ngIf=\"size === 'default' else compactCaption\">\n <i mc-icon=\"mc-upload-to-cloud_64\"></i>\n <div class=\"dropzone__text\">\n <span class=\"multiple__header\">{{ config.title }}</span>\n <div>\n <span class=\"multiple__caption\">\n {{ separatedCaptionText[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionText[1] }}\n </span>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-container *ngIf=\"hasHint\">\n <div class=\"mc-file-upload__hint\">\n <ng-content select=\"mc-hint,[hint]\" />\n </div>\n</ng-container>\n\n<ng-template #fileOutput>\n <div class=\"file-upload__dropzone\">\n <div class=\"mc-file-upload__grid\">\n <div class=\"mc-file-multiple-uploaded__header\">\n <div class=\"mc-file-multiple-uploaded__header-inner\">\n <div [class]=\"'mc-file-upload__' + column.cssClass\" *ngFor=\"let column of columnDefs\">\n {{ column.header }}\n </div>\n </div>\n </div>\n\n <mc-list-selection [autoSelect]=\"false\" [disabled]=\"disabled\">\n <mc-list-option\n class=\"multiple__uploaded-item\"\n [value]=\"file.file.name\"\n (keydown.delete)=\"deleteFile(index)\"\n (keydown.backspace)=\"deleteFile(index)\"\n *ngFor=\"let file of files; let index = index;\">\n <div class=\"mc-file-upload__row\" [class.error]=\"file.hasError\">\n <div class=\"mc-file-upload__file\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async } as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\"\n [ngTemplateOutlet]=\"$any(customFileIcon)\"\n [ngTemplateOutletContext]=\"{ $implicit: file }\"\n >\n </ng-container>\n\n <mc-progress-spinner\n class=\"pt-nat-file-upload-name-cell__icon\"\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <span class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></span>\n </div>\n <div class=\"mc-file-upload__size\">\n {{ file.file.size | mcDataSize }}\n </div>\n <div class=\"mc-file-upload__action\">\n <i mc-icon=\"mc-close-circle_16\" (click)=\"deleteFile(index, $event)\"></i>\n </div>\n </div>\n </mc-list-option>\n </mc-list-selection>\n </div>\n\n <div class=\"btn-upload\">\n <div class=\"dropzone\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ separatedCaptionTextWhenSelected[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionTextWhenSelected[1] }}\n </span>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #compactCaption>\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ separatedCaptionTextForCompactSize[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionTextForCompactSize[1] }}\n </span>\n</ng-template>\n\n<ng-template #inputTemplate>\n <input #input\n type=\"file\"\n class=\"cdk-visually-hidden\"\n multiple\n [id]=\"inputId\"\n [accept]=\"acceptedFiles\"\n [disabled]=\"disabled\"\n (change)=\"onFileSelectedViaClick($event)\">\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}.mc-file-upload__hint>.mc-hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{border-radius:var(--mc-file-upload-size-multiple-border-radius, 4px);border-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-style:var(--mc-file-upload-size-multiple-border-style, dashed)}.mc-file-upload .mc-list-option{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);height:36px}.mc-file-upload .mc-list-option .mc-icon{margin-right:0}.mc-file-upload .mc-file-upload__grid{min-height:142px}.mc-file-upload .mc-file-multiple-uploaded__header-inner,.mc-file-upload .mc-file-upload__row{display:flex;align-items:center}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{width:65%;max-width:65%}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__size{width:var(--mc-size-7xl, 64px);min-width:var(--mc-size-7xl, 64px);text-align:left;flex-grow:1}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__action{padding-left:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px);padding-right:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px)}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{display:flex;align-items:center}.mc-file-upload .mc-file-upload__row .mc-file-upload__file .file-item__text{margin-left:0;width:90%}.mc-file-upload .mc-file-multiple-uploaded__header{border-bottom-width:1px;border-bottom-style:solid}.mc-file-upload .mc-file-multiple-uploaded__header-inner{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);border:2px solid transparent;border-bottom:unset;box-sizing:border-box;height:var(--mc-size-3xl, 32px)}.mc-file-upload .btn-upload .dropzone{margin:0;border-top-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-top-style:var(--mc-file-upload-size-multiple-border-style, dashed);padding:3px var(--mc-size-m, 12px) var(--mc-size-xxs, 4px) var(--mc-size-m, 12px)}.mc-file-upload.compact:not(.selected){height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px)}.mc-file-upload.compact .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload.default{min-height:176px;justify-content:center}.mc-file-upload.default .dropzone .dropzone__text{margin-left:var(--mc-size-l, 16px)}.mc-file-upload.default .btn-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-upload__dropzone{width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.McProgressSpinner, selector: "mc-progress-spinner", inputs: ["color", "id", "value", "mode", "size"] }, { kind: "component", type: i3.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i3.McIconCSSStyler, selector: "[mc-icon]" }, { kind: "component", type: i4.McListSelection, selector: "mc-list-selection", inputs: ["disabled", "autoSelect", "noUnselectLast", "horizontal", "tabIndex", "compareWith"], outputs: ["onSelectAll", "onCopy", "selectionChange"], exportAs: ["mcListSelection"] }, { kind: "component", type: i4.McListOption, selector: "mc-list-option", inputs: ["checkboxPosition", "value", "disabled", "showCheckbox", "selected"], exportAs: ["mcListOption"] }, { kind: "directive", type: i5.McEllipsisCenterDirective, selector: "[mcEllipsisCenter]", inputs: ["mcEllipsisCenter", "minVisibleLength"] }, { kind: "directive", type: i6.McLink, selector: "[mc-link]", inputs: ["tabIndex", "disabled", "pseudo", "noUnderline", "caption", "useVisited", "print"], exportAs: ["mcLink"] }, { kind: "directive", type: McFileDropDirective, selector: "[mcFileDrop]", outputs: ["filesDropped"], exportAs: ["mcFileDrop"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i8.McDataSizePipe, name: "mcDataSize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
203
343
|
}
|
204
344
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: McMultipleFileUploadComponent, decorators: [{
|
205
345
|
type: Component,
|
206
|
-
args: [{ selector: 'mc-multiple-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
346
|
+
args: [{ selector: 'mc-multiple-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
207
347
|
class: 'mc-multiple-file-upload'
|
208
|
-
}, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.selected]=\"files && files.length\"\n [ngClass]=\"size\"\n (filesDropped)=\"onFileDropped($event)\"\n>\n <ng-container *ngIf=\"!files.length; else fileOutput\">\n <div class=\"dropzone\">\n <ng-container *ngIf=\"size === 'default' else compactCaption\">\n <i mc-icon=\"mc-upload-to-cloud_64\"></i>\n <div class=\"dropzone__text\">\n <span class=\"multiple__header\">{{ config.title }}</span>\n <div>\n <span class=\"multiple__caption\">\n {{ config.captionText }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n\n<div class=\"mc-file-upload__info-section\">\n <mc-hint class=\"mc-file-upload__hint\">\n <ng-content select=\"[hint]\"></ng-content>\n </mc-hint>\n\n <ng-container *ngIf=\"hasErrors\">\n <mc-hint class=\"mc-file-upload__hint mc-error\"\n *ngFor=\"let error of errors\">\n {{ error }}\n </mc-hint>\n </ng-container>\n</div>\n\n<ng-template #fileOutput>\n <div class=\"file-upload__dropzone\">\n <div class=\"mc-file-upload__grid\">\n <div class=\"mc-file-multiple-uploaded__header\">\n <div class=\"mc-file-multiple-uploaded__header-inner\">\n <div [class]=\"'mc-file-upload__' + column.cssClass\" *ngFor=\"let column of columnDefs\">\n {{ column.header }}\n </div>\n </div>\n </div>\n\n <mc-list-selection [autoSelect]=\"false\" [disabled]=\"disabled\">\n <mc-list-option\n class=\"multiple__uploaded-item\"\n [value]=\"file.file.name\"\n (keydown.delete)=\"deleteFile(index)\"\n (keydown.backspace)=\"deleteFile(index)\"\n *ngFor=\"let file of files; let index = index;\">\n <div class=\"mc-file-upload__row\" [class.error]=\"file.hasError\">\n <div class=\"mc-file-upload__file\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async } as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\"\n [ngTemplateOutlet]=\"$any(customFileIcon)\"\n [ngTemplateOutletContext]=\"{ $implicit: file }\"\n >\n </ng-container>\n\n <mc-progress-spinner\n class=\"pt-nat-file-upload-name-cell__icon\"\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <span class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></span>\n </div>\n <div class=\"mc-file-upload__size\">\n {{ file.file.size | mcDataSize }}\n </div>\n <div class=\"mc-file-upload__action\">\n <i mc-icon=\"mc-close-circle_16\" (click)=\"deleteFile(index, $event)\"></i>\n </div>\n </div>\n </mc-list-option>\n </mc-list-selection>\n </div>\n\n <div class=\"btn-upload\">\n <div class=\"dropzone\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ config.captionTextWhenSelected }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #compactCaption>\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ config.captionText }}\n <label mc-link pseudo [tabIndex]=\"-1\" [for]=\"inputId\" [disabled]=\"disabled\">\n {{ config.browseLink }}\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </label>\n </span>\n</ng-template>\n\n<ng-template #inputTemplate>\n <input #input\n type=\"file\"\n class=\"cdk-visually-hidden\"\n multiple\n [id]=\"inputId\"\n [accept]=\"acceptedFiles\"\n [disabled]=\"disabled\"\n (change)=\"onFileSelectedViaClick($event)\">\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{border-radius:var(--mc-file-upload-size-multiple-border-radius, 4px);border-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-style:var(--mc-file-upload-size-multiple-border-style, dashed)}.mc-file-upload .mc-list-option{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);height:36px}.mc-file-upload .mc-list-option .mc-icon{margin-right:0}.mc-file-upload .mc-file-upload__grid{min-height:142px}.mc-file-upload .mc-file-multiple-uploaded__header-inner,.mc-file-upload .mc-file-upload__row{display:flex;align-items:center}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{width:65%;max-width:65%}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__size{width:var(--mc-size-7xl, 64px);min-width:var(--mc-size-7xl, 64px);text-align:left;flex-grow:1}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__action{padding-left:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px);padding-right:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px)}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{display:flex;align-items:center}.mc-file-upload .mc-file-upload__row .mc-file-upload__file .file-item__text{margin-left:0;width:90%}.mc-file-upload .mc-file-multiple-uploaded__header{border-bottom-width:1px;border-bottom-style:solid}.mc-file-upload .mc-file-multiple-uploaded__header-inner{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);border:2px solid transparent;border-bottom:unset;box-sizing:border-box;height:var(--mc-size-3xl, 32px)}.mc-file-upload .btn-upload .dropzone{margin:0;border-top-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-top-style:var(--mc-file-upload-size-multiple-border-style, dashed);padding:3px var(--mc-size-m, 12px) var(--mc-size-xxs, 4px) var(--mc-size-m, 12px)}.mc-file-upload.compact:not(.selected){height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px)}.mc-file-upload.compact .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload.default{min-height:176px;justify-content:center}.mc-file-upload.default .dropzone .dropzone__text{margin-left:var(--mc-size-l, 16px)}.mc-file-upload.default .btn-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-upload__dropzone{width:100%;height:100%}.mc-hint{display:block}.mc-file-upload__hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n"] }]
|
209
|
-
}], ctorParameters: () => [{ type:
|
348
|
+
}, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.mc-error]=\"errorState\"\n [class.selected]=\"files && files.length\"\n [ngClass]=\"size\"\n (filesDropped)=\"onFileDropped($event)\"\n>\n <ng-container *ngIf=\"!files.length; else fileOutput\">\n <div class=\"dropzone\">\n <ng-container *ngIf=\"size === 'default' else compactCaption\">\n <i mc-icon=\"mc-upload-to-cloud_64\"></i>\n <div class=\"dropzone__text\">\n <span class=\"multiple__header\">{{ config.title }}</span>\n <div>\n <span class=\"multiple__caption\">\n {{ separatedCaptionText[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionText[1] }}\n </span>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-container *ngIf=\"hasHint\">\n <div class=\"mc-file-upload__hint\">\n <ng-content select=\"mc-hint,[hint]\" />\n </div>\n</ng-container>\n\n<ng-template #fileOutput>\n <div class=\"file-upload__dropzone\">\n <div class=\"mc-file-upload__grid\">\n <div class=\"mc-file-multiple-uploaded__header\">\n <div class=\"mc-file-multiple-uploaded__header-inner\">\n <div [class]=\"'mc-file-upload__' + column.cssClass\" *ngFor=\"let column of columnDefs\">\n {{ column.header }}\n </div>\n </div>\n </div>\n\n <mc-list-selection [autoSelect]=\"false\" [disabled]=\"disabled\">\n <mc-list-option\n class=\"multiple__uploaded-item\"\n [value]=\"file.file.name\"\n (keydown.delete)=\"deleteFile(index)\"\n (keydown.backspace)=\"deleteFile(index)\"\n *ngFor=\"let file of files; let index = index;\">\n <div class=\"mc-file-upload__row\" [class.error]=\"file.hasError\">\n <div class=\"mc-file-upload__file\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async } as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\"\n [ngTemplateOutlet]=\"$any(customFileIcon)\"\n [ngTemplateOutletContext]=\"{ $implicit: file }\"\n >\n </ng-container>\n\n <mc-progress-spinner\n class=\"pt-nat-file-upload-name-cell__icon\"\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <span class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></span>\n </div>\n <div class=\"mc-file-upload__size\">\n {{ file.file.size | mcDataSize }}\n </div>\n <div class=\"mc-file-upload__action\">\n <i mc-icon=\"mc-close-circle_16\" (click)=\"deleteFile(index, $event)\"></i>\n </div>\n </div>\n </mc-list-option>\n </mc-list-selection>\n </div>\n\n <div class=\"btn-upload\">\n <div class=\"dropzone\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ separatedCaptionTextWhenSelected[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionTextWhenSelected[1] }}\n </span>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #compactCaption>\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text multiple__caption\">\n {{ separatedCaptionTextForCompactSize[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container></label>{{ separatedCaptionTextForCompactSize[1] }}\n </span>\n</ng-template>\n\n<ng-template #inputTemplate>\n <input #input\n type=\"file\"\n class=\"cdk-visually-hidden\"\n multiple\n [id]=\"inputId\"\n [accept]=\"acceptedFiles\"\n [disabled]=\"disabled\"\n (change)=\"onFileSelectedViaClick($event)\">\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}.mc-file-upload__hint>.mc-hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{border-radius:var(--mc-file-upload-size-multiple-border-radius, 4px);border-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-style:var(--mc-file-upload-size-multiple-border-style, dashed)}.mc-file-upload .mc-list-option{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);height:36px}.mc-file-upload .mc-list-option .mc-icon{margin-right:0}.mc-file-upload .mc-file-upload__grid{min-height:142px}.mc-file-upload .mc-file-multiple-uploaded__header-inner,.mc-file-upload .mc-file-upload__row{display:flex;align-items:center}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{width:65%;max-width:65%}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__size{width:var(--mc-size-7xl, 64px);min-width:var(--mc-size-7xl, 64px);text-align:left;flex-grow:1}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__file,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__size,.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file,.mc-file-upload .mc-file-upload__row .mc-file-upload__size,.mc-file-upload .mc-file-upload__row .mc-file-upload__action{padding-left:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px);padding-right:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px)}.mc-file-upload .mc-file-multiple-uploaded__header-inner .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__action,.mc-file-upload .mc-file-upload__row .mc-file-upload__file{display:flex;align-items:center}.mc-file-upload .mc-file-upload__row .mc-file-upload__file .file-item__text{margin-left:0;width:90%}.mc-file-upload .mc-file-multiple-uploaded__header{border-bottom-width:1px;border-bottom-style:solid}.mc-file-upload .mc-file-multiple-uploaded__header-inner{padding:var(--mc-file-upload-size-multiple-uploaded-item-horizontal-padding, 8px) var(--mc-file-upload-size-multiple-uploaded-item-vertical-padding, 8px);border:2px solid transparent;border-bottom:unset;box-sizing:border-box;height:var(--mc-size-3xl, 32px)}.mc-file-upload .btn-upload .dropzone{margin:0;border-top-width:var(--mc-file-upload-size-multiple-border-width, 1px);border-top-style:var(--mc-file-upload-size-multiple-border-style, dashed);padding:3px var(--mc-size-m, 12px) var(--mc-size-xxs, 4px) var(--mc-size-m, 12px)}.mc-file-upload.compact:not(.selected){height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px)}.mc-file-upload.compact .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload.default{min-height:176px;justify-content:center}.mc-file-upload.default .dropzone .dropzone__text{margin-left:var(--mc-size-l, 16px)}.mc-file-upload.default .btn-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-upload__dropzone{width:100%;height:100%}\n"] }]
|
349
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
210
350
|
type: Optional
|
211
351
|
}, {
|
212
352
|
type: Inject,
|
@@ -217,42 +357,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
217
357
|
type: Input
|
218
358
|
}], errors: [{
|
219
359
|
type: Input
|
220
|
-
}], files: [{
|
221
|
-
type: Input
|
222
360
|
}], size: [{
|
223
361
|
type: Input
|
224
362
|
}], inputId: [{
|
225
363
|
type: Input
|
226
364
|
}], customValidation: [{
|
227
365
|
type: Input
|
366
|
+
}], errorStateMatcher: [{
|
367
|
+
type: Input
|
368
|
+
}], files: [{
|
369
|
+
type: Input
|
228
370
|
}], fileQueueChanged: [{
|
229
371
|
type: Output
|
372
|
+
}], filesAdded: [{
|
373
|
+
type: Output
|
374
|
+
}], fileRemoved: [{
|
375
|
+
type: Output
|
230
376
|
}], customFileIcon: [{
|
231
377
|
type: ContentChild,
|
232
378
|
args: ['mcFileIcon', { static: false, read: TemplateRef }]
|
233
379
|
}], input: [{
|
234
380
|
type: ViewChild,
|
235
381
|
args: ['input']
|
382
|
+
}], hint: [{
|
383
|
+
type: ContentChildren,
|
384
|
+
args: [McHint]
|
236
385
|
}] } });
|
237
386
|
|
238
387
|
let nextSingleFileUploadUniqueId = 0;
|
239
|
-
const MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION =
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
388
|
+
const MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION = ruRULocaleData['ru-RU'].fileUpload.single;
|
389
|
+
class McSingleFileUploadComponent extends McFileUploadBase {
|
390
|
+
get file() {
|
391
|
+
return this._file;
|
392
|
+
}
|
393
|
+
set file(currentFile) {
|
394
|
+
this._file = currentFile;
|
395
|
+
this.cvaOnChange(this._file);
|
396
|
+
this.fileQueueChanged.emit(this._file);
|
397
|
+
this.cdr.markForCheck();
|
398
|
+
}
|
244
399
|
get acceptedFiles() {
|
245
400
|
return this.accept && this.accept.length > 0 ? this.accept.map((ext) => `.${ext}`).join(',') : '*/*';
|
246
401
|
}
|
247
|
-
|
248
|
-
this.
|
249
|
-
|
402
|
+
get hasHint() {
|
403
|
+
return this.hint.length > 0;
|
404
|
+
}
|
405
|
+
/**
|
406
|
+
* Indicates an invalid state based on `errorState`,
|
407
|
+
* applying a CSS class in HTML for visual feedback.
|
408
|
+
*/
|
409
|
+
get invalid() {
|
410
|
+
return !!this.file?.hasError || this.errorState;
|
411
|
+
}
|
412
|
+
constructor(configuration) {
|
413
|
+
super();
|
414
|
+
this.configuration = configuration;
|
415
|
+
this._file = null;
|
250
416
|
this.disabled = false;
|
417
|
+
/**
|
418
|
+
* @deprecated use `FormControl.errors`
|
419
|
+
*/
|
251
420
|
this.errors = [];
|
252
|
-
this.files = [];
|
253
421
|
this.inputId = `mc-single-file-upload-${nextSingleFileUploadUniqueId++}`;
|
254
422
|
this.fileQueueChanged = new EventEmitter();
|
255
|
-
|
423
|
+
/** cvaOnChange function registered via registerOnChange (ControlValueAccessor).
|
424
|
+
* @docs-private
|
425
|
+
*/
|
426
|
+
// tslint:disable-next-line:no-empty
|
427
|
+
this.cvaOnChange = (_) => { };
|
428
|
+
/** onTouch function registered via registerOnTouch (ControlValueAccessor).
|
429
|
+
* @docs-private
|
430
|
+
*/
|
431
|
+
// tslint:disable-next-line:no-empty
|
432
|
+
this.onTouched = () => { };
|
433
|
+
this.updateLocaleParams = () => {
|
434
|
+
this.config = this.configuration || this.localeService?.getParams('fileUpload').multiple;
|
435
|
+
this.makeCaptionText();
|
436
|
+
this.cdr.markForCheck();
|
437
|
+
};
|
438
|
+
this.localeService?.changes.pipe(takeUntilDestroyed())
|
439
|
+
.subscribe(this.updateLocaleParams);
|
440
|
+
if (!this.localeService) {
|
441
|
+
this.initDefaultParams();
|
442
|
+
}
|
443
|
+
if (this.ngControl) {
|
444
|
+
// Note: we provide the value accessor through here, instead of
|
445
|
+
// the `providers` to avoid running into a circular import.
|
446
|
+
this.ngControl.valueAccessor = this;
|
447
|
+
}
|
448
|
+
}
|
449
|
+
ngAfterViewInit() {
|
450
|
+
// FormControl specific errors update
|
451
|
+
this.ngControl?.statusChanges?.pipe(distinctUntilChanged(), takeUntilDestroyed(this.destroyRef))
|
452
|
+
.subscribe((status) => {
|
453
|
+
if (this._file) {
|
454
|
+
this._file.hasError = status === 'INVALID';
|
455
|
+
}
|
456
|
+
this.errors = Object.values(this.ngControl?.errors || {});
|
457
|
+
this.cdr.markForCheck();
|
458
|
+
});
|
459
|
+
this.stateChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.cdr.markForCheck());
|
460
|
+
}
|
461
|
+
ngDoCheck() {
|
462
|
+
if (this.ngControl) {
|
463
|
+
// We need to re-evaluate this on every change detection cycle, because there are some
|
464
|
+
// error triggers that we can't subscribe to (e.g. parent form submissions). This means
|
465
|
+
// that whatever logic is in here has to be super lean or we risk destroying the performance.
|
466
|
+
this.updateErrorState();
|
467
|
+
}
|
468
|
+
}
|
469
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
470
|
+
writeValue(file) {
|
471
|
+
if (file instanceof File) {
|
472
|
+
this.file = this.mapToFileItem(file);
|
473
|
+
}
|
474
|
+
else {
|
475
|
+
this.file = file;
|
476
|
+
}
|
477
|
+
}
|
478
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
479
|
+
registerOnChange(fn) { this.cvaOnChange = fn; }
|
480
|
+
/** Implemented as part of ControlValueAccessor. @docs-private */
|
481
|
+
registerOnTouched(fn) { this.onTouched = fn; }
|
482
|
+
/**
|
483
|
+
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
|
484
|
+
* @param isDisabled Whether the control should be disabled.
|
485
|
+
* @docs-private
|
486
|
+
*/
|
487
|
+
setDisabledState(isDisabled) {
|
488
|
+
this.disabled = isDisabled;
|
489
|
+
this.cdr.markForCheck();
|
256
490
|
}
|
257
491
|
onFileSelectedViaClick({ target }) {
|
258
492
|
if (this.disabled) {
|
@@ -260,9 +494,9 @@ class McSingleFileUploadComponent {
|
|
260
494
|
}
|
261
495
|
const files = target.files;
|
262
496
|
if (files?.length) {
|
263
|
-
this.
|
264
|
-
this.fileQueueChanged.emit(this.files[0]);
|
497
|
+
this.file = this.mapToFileItem(files[0]);
|
265
498
|
}
|
499
|
+
this.onTouched();
|
266
500
|
/* even if the user selects the same file,
|
267
501
|
the onchange event will be triggered every time user clicks on the control.*/
|
268
502
|
this.renderer.setProperty(this.input.nativeElement, 'value', null);
|
@@ -272,19 +506,20 @@ class McSingleFileUploadComponent {
|
|
272
506
|
return;
|
273
507
|
}
|
274
508
|
event?.stopPropagation();
|
275
|
-
this.
|
509
|
+
this.file = null;
|
276
510
|
this.errors = [];
|
277
|
-
|
511
|
+
// mark as touched after file drop even if file wasn't correct
|
512
|
+
this.onTouched();
|
278
513
|
}
|
279
514
|
onFileDropped(files) {
|
280
515
|
if (this.disabled) {
|
281
516
|
return;
|
282
517
|
}
|
283
|
-
if (this.isCorrectExtension(files[0])) {
|
284
|
-
this.
|
285
|
-
.map((file) => this.mapToFileItem(file));
|
286
|
-
this.fileQueueChanged.emit(this.files[0]);
|
518
|
+
if (files?.length && this.isCorrectExtension(files[0])) {
|
519
|
+
this.file = this.mapToFileItem(files[0]);
|
287
520
|
}
|
521
|
+
// mark as touched after file drop even if file wasn't correct
|
522
|
+
this.onTouched();
|
288
523
|
}
|
289
524
|
mapToFileItem(file) {
|
290
525
|
this.validateFile(file);
|
@@ -295,47 +530,60 @@ class McSingleFileUploadComponent {
|
|
295
530
|
};
|
296
531
|
}
|
297
532
|
validateFile(file) {
|
298
|
-
if (this.customValidation
|
299
|
-
|
300
|
-
errors.push(validatorFn(file));
|
301
|
-
return errors;
|
302
|
-
}, []).filter(Boolean);
|
533
|
+
if (!this.customValidation?.length) {
|
534
|
+
return;
|
303
535
|
}
|
536
|
+
this.errors = this.customValidation.reduce((errors, validatorFn) => {
|
537
|
+
errors.push(validatorFn(file));
|
538
|
+
return errors;
|
539
|
+
}, []).filter(Boolean);
|
304
540
|
}
|
305
541
|
isCorrectExtension(file) {
|
306
542
|
const fileExt = file.name.split('.').pop() || '';
|
307
543
|
return this.acceptedFiles !== '*/*' && this.acceptedFiles.length > 0 ? this.acceptedFiles.includes(fileExt) : true;
|
308
544
|
}
|
309
|
-
|
310
|
-
|
545
|
+
initDefaultParams() {
|
546
|
+
this.config = MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION;
|
547
|
+
this.makeCaptionText();
|
548
|
+
}
|
549
|
+
makeCaptionText() {
|
550
|
+
this.separatedCaptionText = this.config.captionText.split('{{ browseLink }}');
|
551
|
+
}
|
552
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: McSingleFileUploadComponent, deps: [{ token: MC_FILE_UPLOAD_CONFIGURATION, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
553
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.0", type: McSingleFileUploadComponent, selector: "mc-single-file-upload", inputs: { file: "file", accept: "accept", disabled: "disabled", errors: "errors", inputId: "inputId", customValidation: "customValidation", errorStateMatcher: "errorStateMatcher" }, outputs: { fileQueueChanged: "fileQueueChanged" }, host: { classAttribute: "mc-single-file-upload" }, queries: [{ propertyName: "hint", predicate: McHint }], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.mc-error]=\"invalid\"\n (filesDropped)=\"onFileDropped($event)\">\n <div class=\"dropzone\" *ngIf=\"!file; else fileOutput\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text\">\n {{ separatedCaptionText[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<input #input type=\"file\" class=\"cdk-visually-hidden\" [id]=\"inputId\" [accept]=\"acceptedFiles\" [disabled]=\"disabled\" (change)=\"onFileSelectedViaClick($event)\"></label>{{ separatedCaptionText[1] }}\n </span>\n </div>\n</div>\n\n<ng-container *ngIf=\"hasHint\">\n <div class=\"mc-file-upload__hint\">\n <ng-content select=\"mc-hint,[hint]\" />\n </div>\n</ng-container>\n\n<ng-template #fileOutput>\n <div class=\"file-item\" *ngIf=\"file\">\n <div class=\"file-item__text-wrapper\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async} as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\">\n <ng-content select=\"[mc-icon]\"></ng-content>\n </ng-container>\n\n <mc-progress-spinner\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <div class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></div>\n </div>\n <button mc-button\n class=\"mc-button_transparent\"\n [disabled]=\"disabled\"\n (keydown.delete)=\"deleteItem()\"\n (keydown.backspace)=\"deleteItem()\"\n (click)=\"deleteItem($event)\">\n <i mc-icon=\"mc-close-circle_16\"></i>\n </button>\n </div>\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}.mc-file-upload__hint>.mc-hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px);border-radius:var(--mc-file-upload-size-single-border-radius, 4px);border-width:var(--mc-file-upload-size-single-border-width, 1px);border-style:var(--mc-file-upload-size-single-border-style, dashed)}.mc-file-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-item{width:100%}.mc-file-upload .file-item .file-item__text-wrapper{display:flex;align-items:center;width:100%}.mc-file-upload .file-item .file-item__text-wrapper .file-item__text{margin-left:var(--mc-size-s, 8px);width:120px;flex-grow:1}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.McProgressSpinner, selector: "mc-progress-spinner", inputs: ["color", "id", "value", "mode", "size"] }, { kind: "component", type: i3.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i3.McIconCSSStyler, selector: "[mc-icon]" }, { kind: "component", type: i4$1.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i4$1.McButtonCssStyler, selector: "[mc-button]" }, { kind: "directive", type: i5.McEllipsisCenterDirective, selector: "[mcEllipsisCenter]", inputs: ["mcEllipsisCenter", "minVisibleLength"] }, { kind: "directive", type: i6.McLink, selector: "[mc-link]", inputs: ["tabIndex", "disabled", "pseudo", "noUnderline", "caption", "useVisited", "print"], exportAs: ["mcLink"] }, { kind: "directive", type: McFileDropDirective, selector: "[mcFileDrop]", outputs: ["filesDropped"], exportAs: ["mcFileDrop"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
311
554
|
}
|
312
555
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: McSingleFileUploadComponent, decorators: [{
|
313
556
|
type: Component,
|
314
|
-
args: [{ selector: 'mc-single-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
557
|
+
args: [{ selector: 'mc-single-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
315
558
|
class: 'mc-single-file-upload'
|
316
|
-
}, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.mc-error]=\"
|
317
|
-
}], ctorParameters: () => [{ type:
|
559
|
+
}, template: "<div class=\"mc-file-upload\"\n mcFileDrop\n [class.disabled]=\"disabled\"\n [class.mc-error]=\"invalid\"\n (filesDropped)=\"onFileDropped($event)\">\n <div class=\"dropzone\" *ngIf=\"!file; else fileOutput\">\n <i mc-icon=\"mc-upload-to-cloud_24\"></i>\n <span class=\"dropzone__text\">\n {{ separatedCaptionText[0] }}<label mc-link pseudo [disabled]=\"disabled\" [tabIndex]=\"-1\" [for]=\"inputId\">{{ config.browseLink }}<input #input type=\"file\" class=\"cdk-visually-hidden\" [id]=\"inputId\" [accept]=\"acceptedFiles\" [disabled]=\"disabled\" (change)=\"onFileSelectedViaClick($event)\"></label>{{ separatedCaptionText[1] }}\n </span>\n </div>\n</div>\n\n<ng-container *ngIf=\"hasHint\">\n <div class=\"mc-file-upload__hint\">\n <ng-content select=\"mc-hint,[hint]\" />\n </div>\n</ng-container>\n\n<ng-template #fileOutput>\n <div class=\"file-item\" *ngIf=\"file\">\n <div class=\"file-item__text-wrapper\">\n <ng-container *ngIf=\"{ loading: file.loading | async, progress: file.progress | async} as asyncData\">\n <ng-container *ngIf=\"!asyncData.loading\">\n <ng-content select=\"[mc-icon]\"></ng-content>\n </ng-container>\n\n <mc-progress-spinner\n [value]=\"asyncData.progress || 0\"\n *ngIf=\"asyncData.loading\"\n ></mc-progress-spinner>\n </ng-container>\n\n <div class=\"file-item__text\" [mcEllipsisCenter]=\"file.file.name\" [minVisibleLength]=\"10\"></div>\n </div>\n <button mc-button\n class=\"mc-button_transparent\"\n [disabled]=\"disabled\"\n (keydown.delete)=\"deleteItem()\"\n (keydown.backspace)=\"deleteItem()\"\n (click)=\"deleteItem($event)\">\n <i mc-icon=\"mc-close-circle_16\"></i>\n </button>\n </div>\n</ng-template>\n", styles: [".mc-file-upload{box-sizing:border-box;display:flex;align-items:center;position:relative}.mc-file-upload .dropzone,.mc-file-upload .file-item{display:flex;align-items:center}.mc-file-upload .mc-ellipsis-center{position:relative;display:flex}.mc-file-upload .mc-ellipsis-center .data-text-start{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:pre}.mc-file-upload .mc-ellipsis-center .data-text-end{flex:1 0 auto;overflow:hidden;white-space:pre}.mc-file-upload__hint>.mc-hint{margin-top:var(--mc-form-field-hint-size-margin-top, 4px)}\n", "@keyframes mc-progress{0%{background-position:0 0}to{background-position:29px 0}}.mc-progress{position:relative}.mc-progress:after{content:\"\";position:absolute;border-radius:inherit;inset:0;background:linear-gradient(135deg,rgba(0,0,0,.05) 10px,transparent 10px,transparent 20px,rgba(0,0,0,.05) 20px,rgba(0,0,0,.05) 30px,transparent 30px) repeat;background-size:29px 29px;animation:mc-progress 1s linear infinite}.mc-group{display:flex;flex-direction:row}.mc-group .mc-group_justified>.mc-group-item{width:100%}.mc-group .mc-group-item+.mc-group-item{margin-left:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-top-right-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-bottom-left-radius:0;border-top-left-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group{display:flex;flex-direction:column}.mc-vertical-group>.mc-group-item:first-child:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-right-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:first-child:not(:last-child)>.mc-form-field__container{border-bottom-right-radius:0;border-bottom-left-radius:0}.mc-vertical-group>.mc-group-item:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-left-radius:var(--mc-button-size-border-radius, 4px)}.mc-vertical-group>.mc-group-item:last-child:not(:first-child)>.mc-form-field__container{border-top-right-radius:0;border-top-left-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child){border-radius:0}.mc-vertical-group>.mc-group-item:not(:first-child):not(:last-child)>.mc-form-field__container{border-radius:0}.mc-vertical-group .mc-group-item+.mc-group-item{margin-top:calc(-1 * var(--mc-button-size-border-width, 1px))}.mc-no-select{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mc-file-upload{height:var(--mc-file-upload-size-single-height, 48px);padding-top:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-bottom:var(--mc-file-upload-size-single-vertical-padding, 12px);padding-left:var(--mc-size-m, 12px);border-radius:var(--mc-file-upload-size-single-border-radius, 4px);border-width:var(--mc-file-upload-size-single-border-width, 1px);border-style:var(--mc-file-upload-size-single-border-style, dashed)}.mc-file-upload .dropzone .dropzone__text{margin-left:var(--mc-size-xs, 6px)}.mc-file-upload .file-item{width:100%}.mc-file-upload .file-item .file-item__text-wrapper{display:flex;align-items:center;width:100%}.mc-file-upload .file-item .file-item__text-wrapper .file-item__text{margin-left:var(--mc-size-s, 8px);width:120px;flex-grow:1}\n"] }]
|
560
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
318
561
|
type: Optional
|
319
562
|
}, {
|
320
563
|
type: Inject,
|
321
564
|
args: [MC_FILE_UPLOAD_CONFIGURATION]
|
322
|
-
}] }], propDecorators: {
|
565
|
+
}] }], propDecorators: { file: [{
|
566
|
+
type: Input
|
567
|
+
}], accept: [{
|
323
568
|
type: Input
|
324
569
|
}], disabled: [{
|
325
570
|
type: Input
|
326
571
|
}], errors: [{
|
327
572
|
type: Input
|
328
|
-
}], files: [{
|
329
|
-
type: Input
|
330
573
|
}], inputId: [{
|
331
574
|
type: Input
|
332
575
|
}], customValidation: [{
|
333
576
|
type: Input
|
577
|
+
}], errorStateMatcher: [{
|
578
|
+
type: Input
|
334
579
|
}], fileQueueChanged: [{
|
335
580
|
type: Output
|
336
581
|
}], input: [{
|
337
582
|
type: ViewChild,
|
338
583
|
args: ['input']
|
584
|
+
}], hint: [{
|
585
|
+
type: ContentChildren,
|
586
|
+
args: [McHint]
|
339
587
|
}] } });
|
340
588
|
|
341
589
|
class McFileUploadModule {
|
@@ -343,6 +591,8 @@ class McFileUploadModule {
|
|
343
591
|
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.0", ngImport: i0, type: McFileUploadModule, declarations: [McFileDropDirective,
|
344
592
|
McSingleFileUploadComponent,
|
345
593
|
McMultipleFileUploadComponent], imports: [CommonModule,
|
594
|
+
FormsModule,
|
595
|
+
ReactiveFormsModule,
|
346
596
|
McToolTipModule,
|
347
597
|
McProgressSpinnerModule,
|
348
598
|
McIconModule,
|
@@ -355,6 +605,8 @@ class McFileUploadModule {
|
|
355
605
|
McMultipleFileUploadComponent,
|
356
606
|
McFileDropDirective] }); }
|
357
607
|
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.0", ngImport: i0, type: McFileUploadModule, imports: [CommonModule,
|
608
|
+
FormsModule,
|
609
|
+
ReactiveFormsModule,
|
358
610
|
McToolTipModule,
|
359
611
|
McProgressSpinnerModule,
|
360
612
|
McIconModule,
|
@@ -370,6 +622,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
370
622
|
args: [{
|
371
623
|
imports: [
|
372
624
|
CommonModule,
|
625
|
+
FormsModule,
|
626
|
+
ReactiveFormsModule,
|
373
627
|
McToolTipModule,
|
374
628
|
McProgressSpinnerModule,
|
375
629
|
McIconModule,
|
@@ -397,5 +651,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.0", ngImpor
|
|
397
651
|
* Generated bundle index. Do not edit.
|
398
652
|
*/
|
399
653
|
|
400
|
-
export { MC_FILE_UPLOAD_CONFIGURATION, MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION, MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION, McFileDropDirective, McFileUploadModule, McMultipleFileUploadComponent, McSingleFileUploadComponent };
|
654
|
+
export { MC_FILE_UPLOAD_CONFIGURATION, MC_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION, MC_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION, McFileDropDirective, McFileUploadBase, McFileUploadModule, McMultipleFileUploadComponent, McSingleFileUploadComponent };
|
401
655
|
//# sourceMappingURL=ptsecurity-mosaic-file-upload.mjs.map
|