@dbg-riskit/angular-file 9999.9999.9999-rc.3117021 → 9999.9999.9999-rc.3295464

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.
@@ -1,10 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, LOCALE_ID, Pipe, ElementRef, Input, Directive, Renderer2, EventEmitter, ViewChild, Output, Injectable, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { BaseComponent, DialogService, DateFormatter } from '@dbg-riskit/angular-view';
2
+ import { inject, LOCALE_ID, Pipe, ElementRef, DestroyRef, Injector, input, afterNextRender, Directive, output, viewChild, signal, computed, linkedSignal, Injectable, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
+ import { RiskDialogService, RiskDateFormatter } from '@dbg-riskit/angular-view';
4
5
  import { Logger, isEventObject, ObservableEventType, ErrorType, toString, base64encode, CONTENT_TYPE } from '@dbg-riskit/common';
5
6
  import 'file-saver';
6
7
  import { Observable, of, Subject, EMPTY, forkJoin, throwError } from 'rxjs';
7
- import { takeUntil, take, map, tap, filter, catchError, finalize, first, switchMap } from 'rxjs/operators';
8
+ import { take, map, tap, filter, catchError, finalize, first, switchMap } from 'rxjs/operators';
8
9
  import { DecimalPipe } from '@angular/common';
9
10
  import { MatAnchor, MatButton } from '@angular/material/button';
10
11
  import { MatIcon } from '@angular/material/icon';
@@ -24,7 +25,7 @@ import { MatTooltip } from '@angular/material/tooltip';
24
25
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
26
  // See the License for the specific language governing permissions and
26
27
  // limitations under the License.
27
- class FileSizePipe {
28
+ class RiskFileSizePipe {
28
29
  constructor() {
29
30
  this.base = 1024;
30
31
  this.powerSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
@@ -47,36 +48,39 @@ class FileSizePipe {
47
48
  const suffix = this.powerSuffixes[power];
48
49
  return suffix ? `${formatted}${suffix}` : formatted;
49
50
  }
50
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FileSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
51
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: FileSizePipe, isStandalone: true, name: "riskFileSize" }); }
51
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskFileSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
52
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: RiskFileSizePipe, isStandalone: true, name: "riskFileSize" }); }
52
53
  }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FileSizePipe, decorators: [{
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskFileSizePipe, decorators: [{
54
55
  type: Pipe,
55
56
  args: [{
56
57
  name: 'riskFileSize'
57
58
  }]
58
59
  }] });
59
60
 
60
- class AbstractFileDownloadDirective extends BaseComponent {
61
+ class AbstractRiskFileDownloadDirective {
61
62
  constructor() {
62
- super(...arguments);
63
63
  this.elementRef = inject(ElementRef);
64
- this.dialogService = inject(DialogService);
65
- this.fileSizePipe = inject(FileSizePipe);
64
+ this.dialogService = inject(RiskDialogService);
65
+ this.fileSizePipe = inject(RiskFileSizePipe);
66
66
  this.logger = inject(Logger);
67
+ this.destroyRef = inject(DestroyRef);
68
+ this.injector = inject(Injector);
69
+ this.disabled = input(...(ngDevMode ? [undefined, { debugName: "disabled" }] : []));
67
70
  }
68
71
  isDisabled() {
69
72
  if (this.elementRef.nativeElement.disabled === true) {
70
73
  return true;
71
74
  }
72
- if (this.disabled == null) {
75
+ const disabledValue = this.disabled();
76
+ if (disabledValue == null) {
73
77
  return false;
74
78
  }
75
- switch (typeof this.disabled) {
79
+ switch (typeof disabledValue) {
76
80
  case 'boolean':
77
- return this.disabled;
81
+ return disabledValue;
78
82
  case 'string':
79
- return this.disabled.toLowerCase() === 'disabled' || this.disabled.toLowerCase() === 'true';
83
+ return disabledValue.toLowerCase() === 'disabled' || disabledValue.toLowerCase() === 'true';
80
84
  }
81
85
  return false;
82
86
  }
@@ -88,12 +92,12 @@ class AbstractFileDownloadDirective extends BaseComponent {
88
92
  this.logger.error(new Error('No data provided for download!'));
89
93
  return;
90
94
  }
91
- this.getDataObservable(this.data).pipe(takeUntil(this.destroyed), take(1), map((data) => this.mapToFile(data))).subscribe((file) => this.store(file));
95
+ this.getDataObservable(this.data()).pipe(takeUntilDestroyed(this.destroyRef), take(1), map((data) => this.mapToFile(data))).subscribe((file) => this.store(file));
92
96
  }
93
97
  store(file) {
94
- setTimeout(() => {
98
+ afterNextRender(() => {
95
99
  window.saveAs(file.content, file.filename || 'data.txt');
96
- });
100
+ }, { injector: this.injector });
97
101
  }
98
102
  getDataObservable(data) {
99
103
  if (!(data instanceof Observable)) {
@@ -104,7 +108,7 @@ class AbstractFileDownloadDirective extends BaseComponent {
104
108
  downloadWithProgress(observableWithProgress) {
105
109
  const canceled = new Subject();
106
110
  let dialog;
107
- return observableWithProgress.pipe(takeUntil(canceled), takeUntil(this.destroyed), tap((event) => {
111
+ return observableWithProgress.pipe(takeUntilDestroyed(this.destroyRef), tap((event) => {
108
112
  dialog = this.updateProgress(event, dialog, canceled);
109
113
  }), filter((event) => !isEventObject(event)
110
114
  || event.type === ObservableEventType.Result), map((event) => {
@@ -132,8 +136,8 @@ class AbstractFileDownloadDirective extends BaseComponent {
132
136
  valueFormatter: this.fileSizePipe
133
137
  });
134
138
  }
135
- dialog.value = progressEvent.current;
136
- dialog.total = progressEvent.total;
139
+ dialog.setValue(progressEvent.current);
140
+ dialog.setTotal(progressEvent.total);
137
141
  }
138
142
  return dialog;
139
143
  }
@@ -177,45 +181,83 @@ class AbstractFileDownloadDirective extends BaseComponent {
177
181
  createBlob(data, contentType) {
178
182
  return new Blob(data, contentType);
179
183
  }
180
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AbstractFileDownloadDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
181
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: AbstractFileDownloadDirective, isStandalone: true, inputs: { disabled: "disabled" }, usesInheritance: true, ngImport: i0 }); }
184
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractRiskFileDownloadDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
185
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.15", type: AbstractRiskFileDownloadDirective, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
182
186
  }
183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AbstractFileDownloadDirective, decorators: [{
187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractRiskFileDownloadDirective, decorators: [{
184
188
  type: Directive
185
- }], propDecorators: { disabled: [{
186
- type: Input
187
- }] } });
189
+ }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
188
190
 
189
- class AbstractFileUploadComponent extends BaseComponent {
191
+ class AbstractRiskFileUploadComponent {
190
192
  constructor() {
191
- super(...arguments);
192
- this.renderer = inject(Renderer2);
193
- this.error = new EventEmitter(true);
194
- this.multiple = true;
195
- this.filesLoaded = new EventEmitter(true);
196
- this.offset = 0;
197
- this.fileInputHidden = false;
198
- this.raised = true;
199
- this.color = 'primary';
200
- this.disabled = false;
201
- }
202
- ngAfterViewInit() {
203
- this.offset = this.wrapper.nativeElement.getBoundingClientRect().left
204
- - this.anchor.nativeElement.getBoundingClientRect().left
205
- + (this.wrapper.nativeElement.getBoundingClientRect().width / 2);
193
+ this.injector = inject(Injector);
194
+ this.destroyRef = inject(DestroyRef);
195
+ this.label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
196
+ this.accept = input(...(ngDevMode ? [undefined, { debugName: "accept" }] : []));
197
+ this.multiple = input(true, ...(ngDevMode ? [{ debugName: "multiple" }] : []));
198
+ this.raised = input(true, ...(ngDevMode ? [{ debugName: "raised" }] : []));
199
+ this.color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : []));
200
+ this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
201
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
202
+ this.error = output();
203
+ this.filesLoaded = output();
204
+ this.anchor = viewChild(MatAnchor, ...(ngDevMode ? [{ debugName: "anchor", read: ElementRef }] : [{ read: ElementRef }]));
205
+ this.fileInput = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInput" }] : []));
206
+ this.wrapper = viewChild('wrapper', ...(ngDevMode ? [{ debugName: "wrapper" }] : []));
207
+ this.lastMouseMoveEvent = signal(null, ...(ngDevMode ? [{ debugName: "lastMouseMoveEvent" }] : []));
208
+ this.offset = computed(() => {
209
+ const wrapperEl = this.wrapper()?.nativeElement;
210
+ const anchorEl = this.anchor()?.nativeElement;
211
+ if (wrapperEl && anchorEl) {
212
+ return wrapperEl.getBoundingClientRect().left
213
+ - anchorEl.getBoundingClientRect().left
214
+ + (wrapperEl.getBoundingClientRect().width / 2);
215
+ }
216
+ return 0;
217
+ }, ...(ngDevMode ? [{ debugName: "offset" }] : []));
218
+ this.wrapperLeft = linkedSignal(...(ngDevMode ? [{ debugName: "wrapperLeft", source: computed(() => ({
219
+ event: this.lastMouseMoveEvent(),
220
+ fileInput: this.fileInput()?.nativeElement
221
+ })),
222
+ computation: ({ event, fileInput }, prev) => {
223
+ if (event == null) {
224
+ return 0;
225
+ }
226
+ if (fileInput && event.target !== fileInput) {
227
+ const diff = event.target?.getBoundingClientRect().left
228
+ - event.currentTarget?.getBoundingClientRect().left
229
+ - this.offset();
230
+ return event.offsetX + diff;
231
+ }
232
+ return prev?.value ?? 0;
233
+ } }] : [{
234
+ source: computed(() => ({
235
+ event: this.lastMouseMoveEvent(),
236
+ fileInput: this.fileInput()?.nativeElement
237
+ })),
238
+ computation: ({ event, fileInput }, prev) => {
239
+ if (event == null) {
240
+ return 0;
241
+ }
242
+ if (fileInput && event.target !== fileInput) {
243
+ const diff = event.target?.getBoundingClientRect().left
244
+ - event.currentTarget?.getBoundingClientRect().left
245
+ - this.offset();
246
+ return event.offsetX + diff;
247
+ }
248
+ return prev?.value ?? 0;
249
+ }
250
+ }]));
251
+ // Hide and show the input field to reset the selection
252
+ this.fileInputHidden = signal(false, ...(ngDevMode ? [{ debugName: "fileInputHidden" }] : []));
206
253
  }
207
254
  move(event) {
208
- if (this.fileInput && event.target !== this.fileInput.nativeElement && this.anchor) {
209
- const diff = event.target?.getBoundingClientRect().left
210
- - event.currentTarget?.getBoundingClientRect().left
211
- - this.offset;
212
- this.renderer.setStyle(this.wrapper.nativeElement, 'left', `${event.offsetX + diff}px`);
213
- }
255
+ this.lastMouseMoveEvent.set(event);
214
256
  }
215
257
  handleFiles(fileList) {
216
258
  // Check for the various File API support.
217
259
  if ('FileReader' in window) {
218
- this.readFiles(fileList).pipe(takeUntil(this.destroyed), first()).subscribe({
260
+ this.readFiles(fileList).pipe(takeUntilDestroyed(this.destroyRef), first()).subscribe({
219
261
  next: (files) => {
220
262
  this.filesLoaded.emit(files);
221
263
  this.resetInputField();
@@ -239,48 +281,20 @@ class AbstractFileUploadComponent extends BaseComponent {
239
281
  });
240
282
  }
241
283
  }
242
- // Hide and show the input field to reset the selection
243
284
  resetInputField() {
244
- this.fileInputHidden = true;
245
- setTimeout(() => {
246
- this.fileInputHidden = false;
247
- });
285
+ this.fileInputHidden.set(true);
286
+ afterNextRender(() => {
287
+ this.fileInputHidden.set(false);
288
+ }, { injector: this.injector });
248
289
  }
249
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AbstractFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
250
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: AbstractFileUploadComponent, isStandalone: true, inputs: { label: "label", accept: "accept", multiple: "multiple", raised: "raised", color: "color", icon: "icon", disabled: "disabled" }, outputs: { error: "error", filesLoaded: "filesLoaded" }, viewQueries: [{ propertyName: "anchor", first: true, predicate: MatAnchor, descendants: true, read: ElementRef }, { propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }, { propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true }], usesInheritance: true, ngImport: i0 }); }
290
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractRiskFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
291
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.3.15", type: AbstractRiskFileUploadComponent, isStandalone: true, inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, raised: { classPropertyName: "raised", publicName: "raised", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { error: "error", filesLoaded: "filesLoaded" }, viewQueries: [{ propertyName: "anchor", first: true, predicate: MatAnchor, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }, { propertyName: "wrapper", first: true, predicate: ["wrapper"], descendants: true, isSignal: true }], ngImport: i0 }); }
251
292
  }
252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AbstractFileUploadComponent, decorators: [{
293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AbstractRiskFileUploadComponent, decorators: [{
253
294
  type: Directive
254
- }], propDecorators: { error: [{
255
- type: Output
256
- }], label: [{
257
- type: Input
258
- }], accept: [{
259
- type: Input
260
- }], multiple: [{
261
- type: Input
262
- }], filesLoaded: [{
263
- type: Output
264
- }], anchor: [{
265
- type: ViewChild,
266
- args: [MatAnchor, { read: ElementRef }]
267
- }], fileInput: [{
268
- type: ViewChild,
269
- args: ['fileInput']
270
- }], wrapper: [{
271
- type: ViewChild,
272
- args: ['wrapper']
273
- }], raised: [{
274
- type: Input
275
- }], color: [{
276
- type: Input
277
- }], icon: [{
278
- type: Input
279
- }], disabled: [{
280
- type: Input
281
- }] } });
295
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], raised: [{ type: i0.Input, args: [{ isSignal: true, alias: "raised", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], error: [{ type: i0.Output, args: ["error"] }], filesLoaded: [{ type: i0.Output, args: ["filesLoaded"] }], anchor: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatAnchor), { ...{ read: ElementRef }, isSignal: true }] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], wrapper: [{ type: i0.ViewChild, args: ['wrapper', { isSignal: true }] }] } });
282
296
 
283
- class BinaryFileUploadService {
297
+ class RiskBinaryFileUploadService {
284
298
  readFiles(files) {
285
299
  const fileOservables = [];
286
300
  for (const file of Array.from(files)) {
@@ -310,54 +324,60 @@ class BinaryFileUploadService {
310
324
  }
311
325
  return forkJoin(fileOservables);
312
326
  }
313
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BinaryFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
314
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BinaryFileUploadService, providedIn: 'root' }); }
327
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskBinaryFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
328
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskBinaryFileUploadService, providedIn: 'root' }); }
315
329
  }
316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BinaryFileUploadService, decorators: [{
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskBinaryFileUploadService, decorators: [{
317
331
  type: Injectable,
318
332
  args: [{ providedIn: 'root' }]
319
333
  }] });
320
334
 
321
- class BinaryFileUploadComponent extends AbstractFileUploadComponent {
335
+ class RiskBinaryFileUploadComponent extends AbstractRiskFileUploadComponent {
322
336
  constructor() {
323
337
  super(...arguments);
324
- this.fileUploadService = inject(BinaryFileUploadService);
338
+ this.fileUploadService = inject(RiskBinaryFileUploadService);
325
339
  }
326
340
  readFiles(fileList) {
327
341
  return this.fileUploadService.readFiles(fileList);
328
342
  }
329
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BinaryFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
330
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: BinaryFileUploadComponent, isStandalone: true, selector: "risk-binary-file-upload", host: { properties: { "class.risk-binary-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
343
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskBinaryFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
344
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: RiskBinaryFileUploadComponent, isStandalone: true, selector: "risk-binary-file-upload", host: { properties: { "class.risk-binary-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
331
345
  }
332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: BinaryFileUploadComponent, decorators: [{
346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskBinaryFileUploadComponent, decorators: [{
333
347
  type: Component,
334
- args: [{ selector: 'risk-binary-file-upload', host: {
348
+ args: [{ selector: 'risk-binary-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, host: {
335
349
  '[class.risk-binary-file-upload]': 'true'
336
- }, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, imports: [MatButton, MatIcon], template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
350
+ }, imports: [
351
+ MatButton,
352
+ MatIcon
353
+ ], template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
337
354
  }] });
338
355
 
339
- class CSVFileDownloadDirective extends AbstractFileDownloadDirective {
356
+ class RiskCSVFileDownloadDirective extends AbstractRiskFileDownloadDirective {
340
357
  constructor() {
341
358
  super(...arguments);
342
- this.dateFormatter = inject(DateFormatter);
343
- this.filename = 'data.csv';
344
- this.crlfLineEnding = false;
359
+ this.dateFormatter = inject(RiskDateFormatter);
360
+ this.columns = input.required(...(ngDevMode ? [{ debugName: "columns", alias: 'risk-csv-download-columns' }] : [{ alias: 'risk-csv-download-columns' }]));
361
+ this.data = input.required(...(ngDevMode ? [{ debugName: "data", alias: 'risk-csv-download' }] : [{ alias: 'risk-csv-download' }]));
362
+ this.filename = input('data.csv', ...(ngDevMode ? [{ debugName: "filename", alias: 'risk-csv-download-filename' }] : [{ alias: 'risk-csv-download-filename' }]));
363
+ this.crlfLineEnding = input(false, ...(ngDevMode ? [{ debugName: "crlfLineEnding", alias: 'risk-csv-download-crlf' }] : [{ alias: 'risk-csv-download-crlf' }]));
345
364
  }
346
365
  mapToFile(data) {
347
366
  let csvFile = '';
348
- if (this.columns) {
349
- csvFile += this.createHeader();
367
+ const columns = this.columns();
368
+ if (columns) {
369
+ csvFile += this.createHeader(columns);
350
370
  for (const row of data) {
351
- csvFile += this.processRow(row);
371
+ csvFile += this.processRow(row, columns);
352
372
  }
353
373
  }
354
374
  return {
355
- filename: this.filename,
375
+ filename: this.filename(),
356
376
  content: this.createBlob([csvFile], { type: CONTENT_TYPE.TEXT_CSV })
357
377
  };
358
378
  }
359
- processRow(row) {
360
- return this.columns.map((column) => {
379
+ processRow(row, columns) {
380
+ return columns.map((column) => {
361
381
  const value = column.get(row);
362
382
  let innerValue = toString(value);
363
383
  if (value instanceof Date) {
@@ -370,8 +390,8 @@ class CSVFileDownloadDirective extends AbstractFileDownloadDirective {
370
390
  return result;
371
391
  }).join(',') + this.getLineEnding();
372
392
  }
373
- createHeader() {
374
- return this.columns.map((column) => {
393
+ createHeader(columns) {
394
+ return columns.map((column) => {
375
395
  const innerValue = toString(column.header);
376
396
  let result = innerValue.replace(/"/g, '""');
377
397
  if (result.search(/([",\n])/g) >= 0) {
@@ -381,17 +401,14 @@ class CSVFileDownloadDirective extends AbstractFileDownloadDirective {
381
401
  }).join(',') + this.getLineEnding();
382
402
  }
383
403
  getLineEnding() {
384
- if (this.crlfLineEnding) {
385
- return '\r\n';
386
- }
387
- return '\n';
404
+ return this.crlfLineEnding() ? '\r\n' : '\n';
388
405
  }
389
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileDownloadDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
390
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: CSVFileDownloadDirective, isStandalone: true, selector: "[risk-csv-download]", inputs: { columns: ["risk-csv-download-columns", "columns"], data: ["risk-csv-download", "data"], filename: ["risk-csv-download-filename", "filename"], crlfLineEnding: ["risk-csv-download-crlf", "crlfLineEnding"] }, host: { listeners: { "click": "download()" }, properties: { "class.risk-csv-download": "true" } }, providers: [
391
- FileSizePipe
406
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileDownloadDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
407
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.15", type: RiskCSVFileDownloadDirective, isStandalone: true, selector: "[risk-csv-download]", inputs: { columns: { classPropertyName: "columns", publicName: "risk-csv-download-columns", isSignal: true, isRequired: true, transformFunction: null }, data: { classPropertyName: "data", publicName: "risk-csv-download", isSignal: true, isRequired: true, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "risk-csv-download-filename", isSignal: true, isRequired: false, transformFunction: null }, crlfLineEnding: { classPropertyName: "crlfLineEnding", publicName: "risk-csv-download-crlf", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "download()" }, properties: { "class.risk-csv-download": "true" } }, providers: [
408
+ RiskFileSizePipe
392
409
  ], usesInheritance: true, ngImport: i0 }); }
393
410
  }
394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileDownloadDirective, decorators: [{
411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileDownloadDirective, decorators: [{
395
412
  type: Directive,
396
413
  args: [{
397
414
  selector: '[risk-csv-download]',
@@ -400,22 +417,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
400
417
  '(click)': 'download()'
401
418
  },
402
419
  providers: [
403
- FileSizePipe
420
+ RiskFileSizePipe
404
421
  ]
405
422
  }]
406
- }], propDecorators: { columns: [{
407
- type: Input,
408
- args: ['risk-csv-download-columns']
409
- }], data: [{
410
- type: Input,
411
- args: ['risk-csv-download']
412
- }], filename: [{
413
- type: Input,
414
- args: ['risk-csv-download-filename']
415
- }], crlfLineEnding: [{
416
- type: Input,
417
- args: ['risk-csv-download-crlf']
418
- }] } });
423
+ }], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-csv-download-columns", required: true }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-csv-download", required: true }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-csv-download-filename", required: false }] }], crlfLineEnding: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-csv-download-crlf", required: false }] }] } });
419
424
 
420
425
  // Create a regular expression to parse the CSV values.
421
426
  const CSV_FILE_PATTERN = new RegExp((
@@ -425,7 +430,7 @@ const CSV_FILE_PATTERN = new RegExp((
425
430
  '(?:"([^"]*(?:""[^"]*)*)"|' +
426
431
  // Standard fields.
427
432
  '([^",;\\r\\n]*))'), 'gi');
428
- class CSVFileUploadService {
433
+ class RiskCSVFileUploadService {
429
434
  readFiles(files, nameMapper = (name) => name) {
430
435
  const fileOservables = [];
431
436
  for (const file of Array.from(files)) {
@@ -435,7 +440,7 @@ class CSVFileUploadService {
435
440
  const reader = new FileReader();
436
441
  // Handle errors load
437
442
  reader.onload = (event) => {
438
- observer.next(CSVFileUploadService.getCSVFile(toString(event.target.result), file, nameMapper));
443
+ observer.next(RiskCSVFileUploadService.getCSVFile(toString(event.target.result), file, nameMapper));
439
444
  observer.complete();
440
445
  };
441
446
  reader.onerror = (event) => {
@@ -515,24 +520,27 @@ class CSVFileUploadService {
515
520
  }
516
521
  };
517
522
  }
518
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
519
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileUploadService, providedIn: 'root' }); }
523
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
524
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileUploadService, providedIn: 'root' }); }
520
525
  }
521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileUploadService, decorators: [{
526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileUploadService, decorators: [{
522
527
  type: Injectable,
523
528
  args: [{ providedIn: 'root' }]
524
529
  }] });
525
530
 
526
- class CSVFileUploadComponent extends AbstractFileUploadComponent {
531
+ class RiskCSVFileUploadComponent extends AbstractRiskFileUploadComponent {
527
532
  constructor() {
528
533
  super(...arguments);
529
- this.fileUploadService = inject(CSVFileUploadService);
534
+ this.fileUploadService = inject(RiskCSVFileUploadService);
535
+ this.validator = input(...(ngDevMode ? [undefined, { debugName: "validator" }] : []));
536
+ this.nameMapper = input(...(ngDevMode ? [undefined, { debugName: "nameMapper" }] : []));
530
537
  }
531
538
  readFiles(fileList) {
532
- return this.fileUploadService.readFiles(fileList, this.nameMapper).pipe(switchMap((files) => {
539
+ return this.fileUploadService.readFiles(fileList, this.nameMapper()).pipe(switchMap((files) => {
533
540
  const validationErrors = [];
534
- if (!this.validator || files.every((file) => {
535
- const result = this.validator(file);
541
+ const validatorFn = this.validator();
542
+ if (!validatorFn || files.every((file) => {
543
+ const result = validatorFn(file);
536
544
  if (!result.result && result.messages != null) {
537
545
  result.messages.forEach((message) => {
538
546
  validationErrors.push(message);
@@ -547,21 +555,20 @@ class CSVFileUploadComponent extends AbstractFileUploadComponent {
547
555
  }
548
556
  }));
549
557
  }
550
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
551
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: CSVFileUploadComponent, isStandalone: true, selector: "risk-csv-file-upload", inputs: { validator: "validator", nameMapper: "nameMapper" }, host: { properties: { "class.risk-csv-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
558
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
559
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: RiskCSVFileUploadComponent, isStandalone: true, selector: "risk-csv-file-upload", inputs: { validator: { classPropertyName: "validator", publicName: "validator", isSignal: true, isRequired: false, transformFunction: null }, nameMapper: { classPropertyName: "nameMapper", publicName: "nameMapper", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.risk-csv-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
552
560
  }
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVFileUploadComponent, decorators: [{
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVFileUploadComponent, decorators: [{
554
562
  type: Component,
555
- args: [{ selector: 'risk-csv-file-upload', host: {
563
+ args: [{ selector: 'risk-csv-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, host: {
556
564
  '[class.risk-csv-file-upload]': 'true'
557
- }, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, imports: [MatButton, MatIcon], template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
558
- }], propDecorators: { validator: [{
559
- type: Input
560
- }], nameMapper: [{
561
- type: Input
562
- }] } });
565
+ }, imports: [
566
+ MatButton,
567
+ MatIcon
568
+ ], template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
569
+ }], propDecorators: { validator: [{ type: i0.Input, args: [{ isSignal: true, alias: "validator", required: false }] }], nameMapper: [{ type: i0.Input, args: [{ isSignal: true, alias: "nameMapper", required: false }] }] } });
563
570
 
564
- class TextFileUploadService {
571
+ class RiskTextFileUploadService {
565
572
  readFiles(files) {
566
573
  const fileOservables = [];
567
574
  for (const file of Array.from(files)) {
@@ -591,95 +598,101 @@ class TextFileUploadService {
591
598
  }
592
599
  return forkJoin(fileOservables);
593
600
  }
594
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TextFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
595
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TextFileUploadService, providedIn: 'root' }); }
601
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskTextFileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
602
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskTextFileUploadService, providedIn: 'root' }); }
596
603
  }
597
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TextFileUploadService, decorators: [{
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskTextFileUploadService, decorators: [{
598
605
  type: Injectable,
599
606
  args: [{ providedIn: 'root' }]
600
607
  }] });
601
608
 
602
- class TextFileUploadComponent extends AbstractFileUploadComponent {
609
+ class RiskTextFileUploadComponent extends AbstractRiskFileUploadComponent {
603
610
  constructor() {
604
611
  super(...arguments);
605
- this.fileUploadService = inject(TextFileUploadService);
612
+ this.fileUploadService = inject(RiskTextFileUploadService);
606
613
  }
607
614
  readFiles(fileList) {
608
- return this.fileUploadService
609
- .readFiles(fileList);
615
+ return this.fileUploadService.readFiles(fileList);
610
616
  }
611
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TextFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
612
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.12", type: TextFileUploadComponent, isStandalone: true, selector: "risk-text-file-upload", host: { properties: { "class.risk-text-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
617
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskTextFileUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
618
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: RiskTextFileUploadComponent, isStandalone: true, selector: "risk-text-file-upload", host: { properties: { "class.risk-text-file-upload": "true" } }, usesInheritance: true, ngImport: i0, template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
613
619
  }
614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TextFileUploadComponent, decorators: [{
620
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskTextFileUploadComponent, decorators: [{
615
621
  type: Component,
616
- args: [{ selector: 'risk-text-file-upload', host: {
622
+ args: [{ selector: 'risk-text-file-upload', changeDetection: ChangeDetectionStrategy.OnPush, host: {
617
623
  '[class.risk-text-file-upload]': 'true'
618
- }, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, imports: [MatButton, MatIcon], template: "@if (raised) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-raised-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color\"\n [disabled]=\"disabled\"\n mat-button>\n @if (icon) {\n <mat-icon>{{ icon }}</mat-icon>\n }\n {{ label }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\">\n @if (!fileInputHidden) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
624
+ }, imports: [
625
+ MatButton,
626
+ MatIcon
627
+ ], template: "@if (raised()) {\n <a\n (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-raised-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n} @else {\n <a (mousemove)=\"move($event)\"\n [color]=\"color()\"\n [disabled]=\"disabled()\"\n mat-button>\n @if (icon()) {\n <mat-icon>{{ icon() }}</mat-icon>\n }\n {{ label() }}\n <div #wrapper\n class=\"risk-file-upload-input-wrapper\"\n [style.left.px]=\"wrapperLeft()\">\n @if (!fileInputHidden()) {\n <input #fileInput\n (change)=\"handleFiles($event.target.files)\"\n [accept]=\"accept()\"\n [disabled]=\"disabled()\"\n [multiple]=\"multiple()\"\n id=\"fileInput\"\n title=\"\"\n type=\"file\">\n }\n </div>\n </a>\n}\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}a{overflow:hidden}a .risk-file-upload-input-wrapper{width:30px;height:36px;margin-left:-15px;top:0;left:0;position:absolute;overflow:hidden;cursor:pointer;z-index:1}a .risk-file-upload-input-wrapper input{position:absolute;display:block;cursor:pointer;height:36px;font-size:36px;top:0;right:0;outline:0 none;opacity:0}\n"] }]
619
628
  }] });
620
629
 
621
- class CSVDownloadMenuComponent {
630
+ class RiskCSVDownloadMenuComponent {
622
631
  constructor() {
623
- this.menuLabel = 'Download';
624
- this.disabled = false;
625
- }
626
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVDownloadMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
627
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: CSVDownloadMenuComponent, isStandalone: true, selector: "risk-download-menu", inputs: { menuLabel: "menuLabel", menuTooltip: "menuTooltip", columns: "columns", data: "data", disabled: "disabled", filename: "filename" }, host: { properties: { "class.risk-download-menu": "true" } }, ngImport: i0, template: "<mat-menu #downloadMenu=\"matMenu\"\n [overlapTrigger]=\"false\">\n <a mat-menu-item\n [risk-csv-download]=\"data\"\n [risk-csv-download-columns]=\"columns\"\n [risk-csv-download-filename]=\"filename\"\n [risk-csv-download-crlf]=\"true\">\n As CSV file (Windows)\n </a>\n <a mat-menu-item\n [risk-csv-download]=\"data\"\n [risk-csv-download-columns]=\"columns\"\n [risk-csv-download-filename]=\"filename\">\n As CSV file (Unix)\n </a>\n</mat-menu>\n\n<button mat-button\n #menu=\"matMenuTrigger\"\n [disabled]=\"disabled\"\n [matMenuTriggerFor]=\"downloadMenu\"\n [class.risk-menu-open]=\"menu.menuOpen\"\n [matTooltip]=\"menuTooltip\">\n <mat-icon>file_download</mat-icon>\n {{ menuLabel }}\n</button>\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}\n"], dependencies: [{ kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: CSVFileDownloadDirective, selector: "[risk-csv-download]", inputs: ["risk-csv-download-columns", "risk-csv-download", "risk-csv-download-filename", "risk-csv-download-crlf"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
632
+ this.menuLabel = input('Download', ...(ngDevMode ? [{ debugName: "menuLabel" }] : []));
633
+ this.menuTooltip = input(...(ngDevMode ? [undefined, { debugName: "menuTooltip" }] : []));
634
+ this.columns = input(...(ngDevMode ? [undefined, { debugName: "columns" }] : []));
635
+ this.data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : []));
636
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
637
+ this.filename = input(...(ngDevMode ? [undefined, { debugName: "filename" }] : []));
638
+ }
639
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVDownloadMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
640
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.15", type: RiskCSVDownloadMenuComponent, isStandalone: true, selector: "risk-download-menu", inputs: { menuLabel: { classPropertyName: "menuLabel", publicName: "menuLabel", isSignal: true, isRequired: false, transformFunction: null }, menuTooltip: { classPropertyName: "menuTooltip", publicName: "menuTooltip", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "filename", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.risk-download-menu": "true" } }, ngImport: i0, template: "<mat-menu #downloadMenu=\"matMenu\"\n [overlapTrigger]=\"false\">\n <a mat-menu-item\n [risk-csv-download]=\"data()\"\n [risk-csv-download-columns]=\"columns()\"\n [risk-csv-download-filename]=\"filename()\"\n [risk-csv-download-crlf]=\"true\">\n As CSV file (Windows)\n </a>\n <a mat-menu-item\n [risk-csv-download]=\"data()\"\n [risk-csv-download-columns]=\"columns()\"\n [risk-csv-download-filename]=\"filename()\">\n As CSV file (Unix)\n </a>\n</mat-menu>\n\n<button mat-button\n #menu=\"matMenuTrigger\"\n [disabled]=\"disabled()\"\n [matMenuTriggerFor]=\"downloadMenu\"\n [class.risk-menu-open]=\"menu.menuOpen\"\n [matTooltip]=\"menuTooltip()\">\n <mat-icon>file_download</mat-icon>\n {{ menuLabel() }}\n</button>\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}\n"], dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: RiskCSVFileDownloadDirective, selector: "[risk-csv-download]", inputs: ["risk-csv-download-columns", "risk-csv-download", "risk-csv-download-filename", "risk-csv-download-crlf"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
628
641
  }
629
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: CSVDownloadMenuComponent, decorators: [{
642
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskCSVDownloadMenuComponent, decorators: [{
630
643
  type: Component,
631
- args: [{ selector: 'risk-download-menu', host: {
644
+ args: [{ selector: 'risk-download-menu', changeDetection: ChangeDetectionStrategy.OnPush, host: {
632
645
  '[class.risk-download-menu]': 'true'
633
- }, changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, imports: [
646
+ }, imports: [
647
+ MatButton,
648
+ MatIcon,
634
649
  MatMenu,
635
650
  MatMenuItem,
636
- CSVFileDownloadDirective,
637
- MatButton,
638
651
  MatMenuTrigger,
639
652
  MatTooltip,
640
- MatIcon
641
- ], template: "<mat-menu #downloadMenu=\"matMenu\"\n [overlapTrigger]=\"false\">\n <a mat-menu-item\n [risk-csv-download]=\"data\"\n [risk-csv-download-columns]=\"columns\"\n [risk-csv-download-filename]=\"filename\"\n [risk-csv-download-crlf]=\"true\">\n As CSV file (Windows)\n </a>\n <a mat-menu-item\n [risk-csv-download]=\"data\"\n [risk-csv-download-columns]=\"columns\"\n [risk-csv-download-filename]=\"filename\">\n As CSV file (Unix)\n </a>\n</mat-menu>\n\n<button mat-button\n #menu=\"matMenuTrigger\"\n [disabled]=\"disabled\"\n [matMenuTriggerFor]=\"downloadMenu\"\n [class.risk-menu-open]=\"menu.menuOpen\"\n [matTooltip]=\"menuTooltip\">\n <mat-icon>file_download</mat-icon>\n {{ menuLabel }}\n</button>\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}\n"] }]
642
- }], propDecorators: { menuLabel: [{
643
- type: Input
644
- }], menuTooltip: [{
645
- type: Input
646
- }], columns: [{
647
- type: Input
648
- }], data: [{
649
- type: Input
650
- }], disabled: [{
651
- type: Input
652
- }], filename: [{
653
- type: Input
654
- }] } });
653
+ RiskCSVFileDownloadDirective
654
+ ], template: "<mat-menu #downloadMenu=\"matMenu\"\n [overlapTrigger]=\"false\">\n <a mat-menu-item\n [risk-csv-download]=\"data()\"\n [risk-csv-download-columns]=\"columns()\"\n [risk-csv-download-filename]=\"filename()\"\n [risk-csv-download-crlf]=\"true\">\n As CSV file (Windows)\n </a>\n <a mat-menu-item\n [risk-csv-download]=\"data()\"\n [risk-csv-download-columns]=\"columns()\"\n [risk-csv-download-filename]=\"filename()\">\n As CSV file (Unix)\n </a>\n</mat-menu>\n\n<button mat-button\n #menu=\"matMenuTrigger\"\n [disabled]=\"disabled()\"\n [matMenuTriggerFor]=\"downloadMenu\"\n [class.risk-menu-open]=\"menu.menuOpen\"\n [matTooltip]=\"menuTooltip()\">\n <mat-icon>file_download</mat-icon>\n {{ menuLabel() }}\n</button>\n", styles: [":host{display:block;padding:0;margin:0}:host>*{vertical-align:bottom}\n", ":host{display:inline-block}\n"] }]
655
+ }], propDecorators: { menuLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuLabel", required: false }] }], menuTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuTooltip", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "filename", required: false }] }] } });
655
656
 
656
- class FileDownloadDirective extends AbstractFileDownloadDirective {
657
+ class RiskFileDownloadDirective extends AbstractRiskFileDownloadDirective {
658
+ constructor() {
659
+ super(...arguments);
660
+ this.data = input.required(...(ngDevMode ? [{ debugName: "data", alias: 'risk-download' }] : [{ alias: 'risk-download' }]));
661
+ this.contentType = input(CONTENT_TYPE.TEXT_PLAIN, ...(ngDevMode ? [{ debugName: "contentType", alias: 'risk-download-content-type' }] : [{ alias: 'risk-download-content-type' }]));
662
+ this.filename = input('data.txt', ...(ngDevMode ? [{ debugName: "filename", alias: 'risk-download-filename' }] : [{ alias: 'risk-download-filename' }]));
663
+ }
657
664
  mapToFile(data) {
658
- const filename = this.filename || 'data.txt';
665
+ const filename = this.filename();
659
666
  if (data instanceof Blob) {
660
667
  return {
661
668
  content: data,
662
669
  filename
663
670
  };
664
671
  }
665
- if (typeof data === 'object' && 'content' in data && data.content instanceof Blob) {
666
- return {
667
- content: data.content,
668
- filename: data.filename || filename
669
- };
672
+ if (typeof data === 'object' && data != null && !('content' in data)) {
673
+ // treat plain object (non FileWithContent) by JSON stringify later
674
+ }
675
+ if (typeof data === 'object' && data != null && 'content' in data) {
676
+ const fc = data;
677
+ if (fc.content instanceof Blob) {
678
+ return {
679
+ content: fc.content,
680
+ filename: fc.filename || filename
681
+ };
682
+ }
670
683
  }
671
684
  const stringData = typeof data === 'string' ? data : JSON.stringify(data);
672
685
  return {
673
- content: this.createBlob([stringData], { type: this.contentType }),
686
+ content: this.createBlob([stringData], { type: this.contentType() }),
674
687
  filename
675
688
  };
676
689
  }
677
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FileDownloadDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
678
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.12", type: FileDownloadDirective, isStandalone: true, selector: "[risk-download]", inputs: { data: ["risk-download", "data"], contentType: ["risk-download-content-type", "contentType"], filename: ["risk-download-filename", "filename"] }, host: { listeners: { "click": "download()" }, properties: { "class.risk-download": "true" } }, providers: [
679
- FileSizePipe
690
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskFileDownloadDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
691
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.15", type: RiskFileDownloadDirective, isStandalone: true, selector: "[risk-download]", inputs: { data: { classPropertyName: "data", publicName: "risk-download", isSignal: true, isRequired: true, transformFunction: null }, contentType: { classPropertyName: "contentType", publicName: "risk-download-content-type", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "risk-download-filename", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "download()" }, properties: { "class.risk-download": "true" } }, providers: [
692
+ RiskFileSizePipe
680
693
  ], usesInheritance: true, ngImport: i0 }); }
681
694
  }
682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: FileDownloadDirective, decorators: [{
695
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: RiskFileDownloadDirective, decorators: [{
683
696
  type: Directive,
684
697
  args: [{
685
698
  selector: '[risk-download]',
@@ -688,23 +701,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
688
701
  '(click)': 'download()'
689
702
  },
690
703
  providers: [
691
- FileSizePipe
704
+ RiskFileSizePipe
692
705
  ]
693
706
  }]
694
- }], propDecorators: { data: [{
695
- type: Input,
696
- args: ['risk-download']
697
- }], contentType: [{
698
- type: Input,
699
- args: ['risk-download-content-type']
700
- }], filename: [{
701
- type: Input,
702
- args: ['risk-download-filename']
703
- }] } });
707
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-download", required: true }] }], contentType: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-download-content-type", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "risk-download-filename", required: false }] }] } });
704
708
 
705
709
  /**
706
710
  * Generated bundle index. Do not edit.
707
711
  */
708
712
 
709
- export { AbstractFileDownloadDirective, AbstractFileUploadComponent, BinaryFileUploadComponent, BinaryFileUploadService, CSVDownloadMenuComponent, CSVFileDownloadDirective, CSVFileUploadComponent, CSVFileUploadService, FileDownloadDirective, FileSizePipe, TextFileUploadComponent, TextFileUploadService };
713
+ export { AbstractRiskFileDownloadDirective, AbstractRiskFileUploadComponent, RiskBinaryFileUploadComponent, RiskBinaryFileUploadService, RiskCSVDownloadMenuComponent, RiskCSVFileDownloadDirective, RiskCSVFileUploadComponent, RiskCSVFileUploadService, RiskFileDownloadDirective, RiskFileSizePipe, RiskTextFileUploadComponent, RiskTextFileUploadService };
710
714
  //# sourceMappingURL=dbg-riskit-angular-file.mjs.map