@recursyve/ngx-material-components 19.0.0-beta.11 → 19.0.0-beta.13
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/chip-list/chip-list.d.ts +26 -0
- package/chip-list/icons/clear/chip-list-items-clear-icon.d.ts +5 -0
- package/chip-list/index.d.ts +2 -0
- package/chip-list/items/chip-list-items.d.ts +14 -0
- package/common/index.d.ts +4 -0
- package/common/provider.d.ts +3 -0
- package/common/translater/constant.d.ts +2 -0
- package/common/translater/options.d.ts +7 -0
- package/common/translater/translate-pipe.d.ts +8 -0
- package/common/translater/translater.d.ts +1 -0
- package/dropzone/config.d.ts +38 -0
- package/dropzone/constant.d.ts +2 -0
- package/dropzone/dropzone.d.ts +42 -0
- package/dropzone/dropzone.directive.d.ts +12 -0
- package/dropzone/icons/delete/delete-icon.component.d.ts +5 -0
- package/dropzone/icons/file/file-icon.component.d.ts +5 -0
- package/dropzone/icons/image/image-icon.component.d.ts +5 -0
- package/dropzone/index.d.ts +5 -0
- package/dropzone/models.d.ts +20 -0
- package/dropzone/options.d.ts +4 -0
- package/dropzone/pipes/file-size.pipe.d.ts +10 -0
- package/dropzone/preview/file-preview.d.ts +14 -0
- package/dropzone/provider.d.ts +3 -0
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs +156 -0
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-common.mjs +39 -0
- package/fesm2022/recursyve-ngx-material-components-common.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs +354 -0
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs.map +1 -0
- package/fesm2022/recursyve-ngx-material-components-form-field-error.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs +30 -20
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs.map +1 -1
- package/form-field-error/index.d.ts +0 -1
- package/form-field-error/options.d.ts +2 -2
- package/package.json +13 -1
- package/typeahead/async-typeahead.d.ts +1 -0
- package/typeahead/icons/search/typeahead-search-icon.d.ts +5 -0
- package/typeahead/typeahead-base.d.ts +2 -1
- package/form-field-error/error-translater.d.ts +0 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, output, HostListener, Output, HostBinding, Directive, InjectionToken, Component, inject, Pipe, input, computed, viewChild, ElementRef, signal, effect, forwardRef, ViewEncapsulation } from '@angular/core';
|
|
3
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { MatRippleLoader } from '@angular/material/core';
|
|
6
|
+
import { NICE_COMPONENTS_TRANSLATER, NiceTranslatePipe } from '@recursyve/ngx-material-components/common';
|
|
7
|
+
|
|
8
|
+
class NiceDropzoneDirective {
|
|
9
|
+
fileOver;
|
|
10
|
+
filesDropped = new EventEmitter();
|
|
11
|
+
files = output();
|
|
12
|
+
// Dragover listener
|
|
13
|
+
onDragOver(event) {
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
this.fileOver = true;
|
|
17
|
+
}
|
|
18
|
+
// Dragleave listener
|
|
19
|
+
onDragLeave(event) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
this.fileOver = false;
|
|
23
|
+
}
|
|
24
|
+
// Drop listener
|
|
25
|
+
ondrop(event) {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
this.fileOver = false;
|
|
29
|
+
if (!event.dataTransfer) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const files = event.dataTransfer.files;
|
|
33
|
+
if (files.length > 0) {
|
|
34
|
+
this.filesDropped.emit(files);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
38
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: NiceDropzoneDirective, isStandalone: true, selector: "[niceDropzone]", outputs: { filesDropped: "filesDropped", files: "files" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "ondrop($event)" }, properties: { "class.file-over": "this.fileOver" } }, ngImport: i0 });
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneDirective, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: "[niceDropzone]",
|
|
44
|
+
standalone: true
|
|
45
|
+
}]
|
|
46
|
+
}], propDecorators: { fileOver: [{
|
|
47
|
+
type: HostBinding,
|
|
48
|
+
args: ["class.file-over"]
|
|
49
|
+
}], filesDropped: [{
|
|
50
|
+
type: Output
|
|
51
|
+
}], onDragOver: [{
|
|
52
|
+
type: HostListener,
|
|
53
|
+
args: ["dragover", ["$event"]]
|
|
54
|
+
}], onDragLeave: [{
|
|
55
|
+
type: HostListener,
|
|
56
|
+
args: ["dragleave", ["$event"]]
|
|
57
|
+
}], ondrop: [{
|
|
58
|
+
type: HostListener,
|
|
59
|
+
args: ["drop", ["$event"]]
|
|
60
|
+
}] } });
|
|
61
|
+
|
|
62
|
+
const NICE_DROPZONE_TRANSLATION_KEYS = new InjectionToken("nice_dropzone_translation_keys");
|
|
63
|
+
|
|
64
|
+
class NiceDropzoneFileIcon {
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneFileIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
66
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: NiceDropzoneFileIcon, isStandalone: true, selector: "nice-dropzone-file-icon", ngImport: i0, template: "<svg fill=\"none\" viewBox=\"-1.25 -1.25 40 40\" height=\"40\" width=\"40\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.859375 36.328125h25.78125c1.294375 0 2.34375 -1.049375 2.34375 -2.34375V12.6890625c-0.00015625 -0.621171875 -0.246875 -1.2168750000000002 -0.6859375 -1.65625l-9.175 -9.175c-0.439375 -0.43909062499999996 -1.03515625 -0.6858046875 -1.65625 -0.6859375H5.859375c-1.2765624999999998 0 -2.34375 1.0671875000000002 -2.34375 2.34375v30.46875c0 1.2765624999999998 1.0671875000000002 2.34375 2.34375 2.34375Z\" stroke-width=\"2.5\"></path>\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M33.984375 12.890625h-9.375c-0.6215625 0 -1.2178125 -0.24693750000000003 -1.65734375 -0.68646875S22.265625 11.16846875 22.265625 10.546875v-9.375\" stroke-width=\"2.5\"></path>\n</svg>" });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneFileIcon, decorators: [{
|
|
69
|
+
type: Component,
|
|
70
|
+
args: [{ selector: "nice-dropzone-file-icon", template: "<svg fill=\"none\" viewBox=\"-1.25 -1.25 40 40\" height=\"40\" width=\"40\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.859375 36.328125h25.78125c1.294375 0 2.34375 -1.049375 2.34375 -2.34375V12.6890625c-0.00015625 -0.621171875 -0.246875 -1.2168750000000002 -0.6859375 -1.65625l-9.175 -9.175c-0.439375 -0.43909062499999996 -1.03515625 -0.6858046875 -1.65625 -0.6859375H5.859375c-1.2765624999999998 0 -2.34375 1.0671875000000002 -2.34375 2.34375v30.46875c0 1.2765624999999998 1.0671875000000002 2.34375 2.34375 2.34375Z\" stroke-width=\"2.5\"></path>\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M33.984375 12.890625h-9.375c-0.6215625 0 -1.2178125 -0.24693750000000003 -1.65734375 -0.68646875S22.265625 11.16846875 22.265625 10.546875v-9.375\" stroke-width=\"2.5\"></path>\n</svg>" }]
|
|
71
|
+
}] });
|
|
72
|
+
|
|
73
|
+
class NiceDropzoneImageIcon {
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneImageIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
75
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: NiceDropzoneImageIcon, isStandalone: true, selector: "nice-dropzone-image-icon", ngImport: i0, template: "<svg width=\"40\" height=\"43\" viewBox=\"0 0 40 43\" fill=\"none\">\n <path d=\"M29.333 1.5H2.66634C1.92996 1.5 1.33301 2.09695 1.33301 2.83333V33.0556C1.33301 33.7919 1.92996 34.3889 2.66634 34.3889H29.333C30.0694 34.3889 30.6663 33.7919 30.6663 33.0556V2.83333C30.6663 2.09695 30.0694 1.5 29.333 1.5Z\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M38.6667 11.2778V40.1667C38.6621 40.5189 38.5201 40.8554 38.2711 41.1044C38.022 41.3535 37.6855 41.4954 37.3333 41.5001H12\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M30.6663 27.2778H1.33301\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M7.55566 27.2778L16.8001 14.0689C17.0316 13.7366 17.3357 13.4614 17.6895 13.2642C18.0432 13.0669 18.4372 12.9528 18.8415 12.9306C19.2459 12.9083 19.6501 12.9784 20.0233 13.1356C20.3965 13.2928 20.7291 13.533 20.9957 13.8378L30.6668 25.0556\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M9.33268 6.8335C9.8601 6.8335 10.3757 6.98989 10.8142 7.28291C11.2527 7.57593 11.5945 7.9924 11.7964 8.47967C11.9982 8.96694 12.051 9.50312 11.9481 10.0204C11.8452 10.5377 11.5912 11.0128 11.2183 11.3858C10.8454 11.7587 10.3702 12.0127 9.85292 12.1156C9.33564 12.2185 8.79946 12.1657 8.31219 11.9638C7.82492 11.762 7.40845 11.4202 7.11543 10.9817C6.82241 10.5432 6.66602 10.0276 6.66602 9.50016C6.66602 8.79292 6.94697 8.11464 7.44706 7.61454C7.94716 7.11445 8.62544 6.8335 9.33268 6.8335\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n" });
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneImageIcon, decorators: [{
|
|
78
|
+
type: Component,
|
|
79
|
+
args: [{ selector: "nice-dropzone-image-icon", template: "<svg width=\"40\" height=\"43\" viewBox=\"0 0 40 43\" fill=\"none\">\n <path d=\"M29.333 1.5H2.66634C1.92996 1.5 1.33301 2.09695 1.33301 2.83333V33.0556C1.33301 33.7919 1.92996 34.3889 2.66634 34.3889H29.333C30.0694 34.3889 30.6663 33.7919 30.6663 33.0556V2.83333C30.6663 2.09695 30.0694 1.5 29.333 1.5Z\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M38.6667 11.2778V40.1667C38.6621 40.5189 38.5201 40.8554 38.2711 41.1044C38.022 41.3535 37.6855 41.4954 37.3333 41.5001H12\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M30.6663 27.2778H1.33301\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M7.55566 27.2778L16.8001 14.0689C17.0316 13.7366 17.3357 13.4614 17.6895 13.2642C18.0432 13.0669 18.4372 12.9528 18.8415 12.9306C19.2459 12.9083 19.6501 12.9784 20.0233 13.1356C20.3965 13.2928 20.7291 13.533 20.9957 13.8378L30.6668 25.0556\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M9.33268 6.8335C9.8601 6.8335 10.3757 6.98989 10.8142 7.28291C11.2527 7.57593 11.5945 7.9924 11.7964 8.47967C11.9982 8.96694 12.051 9.50312 11.9481 10.0204C11.8452 10.5377 11.5912 11.0128 11.2183 11.3858C10.8454 11.7587 10.3702 12.0127 9.85292 12.1156C9.33564 12.2185 8.79946 12.1657 8.31219 11.9638C7.82492 11.762 7.40845 11.4202 7.11543 10.9817C6.82241 10.5432 6.66602 10.0276 6.66602 9.50016C6.66602 8.79292 6.94697 8.11464 7.44706 7.61454C7.94716 7.11445 8.62544 6.8335 9.33268 6.8335\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n" }]
|
|
80
|
+
}] });
|
|
81
|
+
|
|
82
|
+
function isLocalFile(file) {
|
|
83
|
+
return "file" in file;
|
|
84
|
+
}
|
|
85
|
+
function isRemoteFile(file) {
|
|
86
|
+
return "id" in file;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
class FileSizePipe {
|
|
90
|
+
units = ["B", "KB", "MB", "GB"];
|
|
91
|
+
translater = inject(NICE_COMPONENTS_TRANSLATER);
|
|
92
|
+
translationKeys = inject(NICE_DROPZONE_TRANSLATION_KEYS);
|
|
93
|
+
transform(bytes, precision = 0) {
|
|
94
|
+
const defaultUnit = this.translater(this.translationKeys.size.units.B);
|
|
95
|
+
if (!bytes) {
|
|
96
|
+
return `0 ${defaultUnit}`;
|
|
97
|
+
}
|
|
98
|
+
const unitIndex = Math.floor(Math.log(bytes) / Math.log(1000));
|
|
99
|
+
const boundedUnitIndex = Math.min(unitIndex, this.units.length - 1);
|
|
100
|
+
const size = bytes / Math.pow(1000, boundedUnitIndex);
|
|
101
|
+
const unit = this.translater(this.translationKeys.size.units[this.units[boundedUnitIndex]]);
|
|
102
|
+
return `${size.toFixed(precision)} ${unit}`;
|
|
103
|
+
}
|
|
104
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: FileSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
105
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: FileSizePipe, isStandalone: true, name: "niceFileSize" });
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: FileSizePipe, decorators: [{
|
|
108
|
+
type: Pipe,
|
|
109
|
+
args: [{
|
|
110
|
+
name: "niceFileSize"
|
|
111
|
+
}]
|
|
112
|
+
}] });
|
|
113
|
+
|
|
114
|
+
class NiceDropzoneDeleteIcon {
|
|
115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneDeleteIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
116
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: NiceDropzoneDeleteIcon, isStandalone: true, selector: "nice-dropzone-delete-icon", ngImport: i0, template: "<svg viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>" });
|
|
117
|
+
}
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneDeleteIcon, decorators: [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{ selector: "nice-dropzone-delete-icon", template: "<svg viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>" }]
|
|
121
|
+
}] });
|
|
122
|
+
|
|
123
|
+
class NiceDropzoneFilePreview {
|
|
124
|
+
file = input.required();
|
|
125
|
+
mode = input.required();
|
|
126
|
+
clickDelete = output();
|
|
127
|
+
isImage = computed(() => this.mode() === "image");
|
|
128
|
+
imageDimensions = computed(() => {
|
|
129
|
+
const file = this.file();
|
|
130
|
+
if (isLocalFile(file)) {
|
|
131
|
+
return file.dimensions ?? null;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
});
|
|
135
|
+
imageUrl = computed(() => {
|
|
136
|
+
const file = this.file();
|
|
137
|
+
if (isLocalFile(file)) {
|
|
138
|
+
return URL.createObjectURL(file.file);
|
|
139
|
+
}
|
|
140
|
+
return file.url;
|
|
141
|
+
});
|
|
142
|
+
_translationKeys = inject(NICE_DROPZONE_TRANSLATION_KEYS);
|
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneFilePreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: NiceDropzoneFilePreview, isStandalone: true, selector: "nice-dropzone-file-preview", inputs: { file: { classPropertyName: "file", publicName: "file", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { clickDelete: "clickDelete" }, host: { styleAttribute: "flex: 1 1 auto;" }, ngImport: i0, template: "<div class=\"nice-dropzone-preview\">\n @if (isImage()) {\n <img class=\"nice-dropzone-preview-image\" alt=\"\" draggable=\"false\" [src]=\"imageUrl()\" />\n } @else {\n <div class=\"nice-dropzone-preview-file\">\n <nice-dropzone-file-icon />\n </div>\n }\n\n <div class=\"nice-dropzone-preview-file-info\">\n <span class=\"mat-body-medium\">{{ file().name }}</span>\n\n @if (imageDimensions(); as dimension) {\n <span class=\"mat-label-medium\">\n {{ `${dimension.width}x${dimension.height}` }} {{ _translationKeys.ratio.pixels | niceTranslate }}\n </span>\n }\n\n @if (file().size; as size) {\n <span class=\"mat-label-medium\">{{ size | niceFileSize }}</span>\n }\n </div>\n\n <div class=\"nice-dropzone-preview-actions\">\n <button class=\"nice-dropzone-preview-actions-delete\" (click)=\"$event.stopPropagation(); clickDelete.emit()\">\n <nice-dropzone-delete-icon />\n </button>\n </div>\n</div>\n", styles: [".nice-dropzone-preview{position:relative;display:flex;align-items:center;justify-content:center;flex:1 1 auto;gap:32px;height:100px;padding-top:12px;padding-bottom:12px;border-style:solid;border-radius:var(--nice-dropzone-shape, 8px);border-width:var(--nice-dropzone-border-width, 1px);border-color:var(--nice-dropzone-border-color, var(--mat-sys-primary))}.nice-dropzone-preview .nice-dropzone-preview-image{max-height:100%;max-width:min(200px,50%);-webkit-user-select:none;user-select:none}.nice-dropzone-preview .nice-dropzone-preview-file{color:var(--mat-sys-primary)}.nice-dropzone-preview .nice-dropzone-preview-file-info{display:flex;flex-direction:column;gap:4px;max-width:min(400px,40%);-webkit-user-select:none;user-select:none}.nice-dropzone-preview .nice-dropzone-preview-actions{position:absolute;width:24px;height:24px;background-color:var(--mat-sys-on-primary);border-radius:50%;top:-12px;right:-12px;opacity:0;transition:opacity .1s ease-in-out}.nice-dropzone-preview .nice-dropzone-preview-actions .nice-dropzone-preview-actions-delete{background-color:transparent;color:var(--mat-sys-primary);border:none;cursor:pointer;padding:0}.nice-dropzone-preview:hover .nice-dropzone-preview-actions,.nice-dropzone-preview:focus .nice-dropzone-preview-actions{opacity:1}\n"], dependencies: [{ kind: "component", type: NiceDropzoneDeleteIcon, selector: "nice-dropzone-delete-icon" }, { kind: "pipe", type: NiceTranslatePipe, name: "niceTranslate" }, { kind: "pipe", type: FileSizePipe, name: "niceFileSize" }, { kind: "component", type: NiceDropzoneFileIcon, selector: "nice-dropzone-file-icon" }] });
|
|
145
|
+
}
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzoneFilePreview, decorators: [{
|
|
147
|
+
type: Component,
|
|
148
|
+
args: [{ selector: "nice-dropzone-file-preview", imports: [NiceDropzoneDeleteIcon, NiceTranslatePipe, FileSizePipe, NiceDropzoneFileIcon], host: {
|
|
149
|
+
style: "flex: 1 1 auto;"
|
|
150
|
+
}, template: "<div class=\"nice-dropzone-preview\">\n @if (isImage()) {\n <img class=\"nice-dropzone-preview-image\" alt=\"\" draggable=\"false\" [src]=\"imageUrl()\" />\n } @else {\n <div class=\"nice-dropzone-preview-file\">\n <nice-dropzone-file-icon />\n </div>\n }\n\n <div class=\"nice-dropzone-preview-file-info\">\n <span class=\"mat-body-medium\">{{ file().name }}</span>\n\n @if (imageDimensions(); as dimension) {\n <span class=\"mat-label-medium\">\n {{ `${dimension.width}x${dimension.height}` }} {{ _translationKeys.ratio.pixels | niceTranslate }}\n </span>\n }\n\n @if (file().size; as size) {\n <span class=\"mat-label-medium\">{{ size | niceFileSize }}</span>\n }\n </div>\n\n <div class=\"nice-dropzone-preview-actions\">\n <button class=\"nice-dropzone-preview-actions-delete\" (click)=\"$event.stopPropagation(); clickDelete.emit()\">\n <nice-dropzone-delete-icon />\n </button>\n </div>\n</div>\n", styles: [".nice-dropzone-preview{position:relative;display:flex;align-items:center;justify-content:center;flex:1 1 auto;gap:32px;height:100px;padding-top:12px;padding-bottom:12px;border-style:solid;border-radius:var(--nice-dropzone-shape, 8px);border-width:var(--nice-dropzone-border-width, 1px);border-color:var(--nice-dropzone-border-color, var(--mat-sys-primary))}.nice-dropzone-preview .nice-dropzone-preview-image{max-height:100%;max-width:min(200px,50%);-webkit-user-select:none;user-select:none}.nice-dropzone-preview .nice-dropzone-preview-file{color:var(--mat-sys-primary)}.nice-dropzone-preview .nice-dropzone-preview-file-info{display:flex;flex-direction:column;gap:4px;max-width:min(400px,40%);-webkit-user-select:none;user-select:none}.nice-dropzone-preview .nice-dropzone-preview-actions{position:absolute;width:24px;height:24px;background-color:var(--mat-sys-on-primary);border-radius:50%;top:-12px;right:-12px;opacity:0;transition:opacity .1s ease-in-out}.nice-dropzone-preview .nice-dropzone-preview-actions .nice-dropzone-preview-actions-delete{background-color:transparent;color:var(--mat-sys-primary);border:none;cursor:pointer;padding:0}.nice-dropzone-preview:hover .nice-dropzone-preview-actions,.nice-dropzone-preview:focus .nice-dropzone-preview-actions{opacity:1}\n"] }]
|
|
151
|
+
}] });
|
|
152
|
+
|
|
153
|
+
const niceDropzoneModes = ["image", "file", "all"];
|
|
154
|
+
class NiceDropzone {
|
|
155
|
+
mode = input("all");
|
|
156
|
+
multiple = input(false, { transform: coerceBooleanProperty });
|
|
157
|
+
disabled = input(false, { transform: coerceBooleanProperty });
|
|
158
|
+
accept = input();
|
|
159
|
+
config = input();
|
|
160
|
+
maxFileSize = input();
|
|
161
|
+
_elementRef = viewChild("element", { read: ElementRef });
|
|
162
|
+
_inputRef = viewChild("fileInput");
|
|
163
|
+
/**
|
|
164
|
+
* Handles the lazy creation of the MatButton ripple.
|
|
165
|
+
* Used to improve the initial load time of large applications.
|
|
166
|
+
*/
|
|
167
|
+
_rippleLoader = inject(MatRippleLoader);
|
|
168
|
+
_translationKeys = inject(NICE_DROPZONE_TRANSLATION_KEYS);
|
|
169
|
+
files = signal([]);
|
|
170
|
+
_disabled = false;
|
|
171
|
+
_onChange;
|
|
172
|
+
_value = null;
|
|
173
|
+
constructor() {
|
|
174
|
+
effect(() => {
|
|
175
|
+
const elementRef = this._elementRef();
|
|
176
|
+
if (!elementRef) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this._rippleLoader.configureRipple(elementRef.nativeElement, { className: "nice-dropzone-ripple" });
|
|
180
|
+
});
|
|
181
|
+
effect(() => {
|
|
182
|
+
this._disabled = this.disabled();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
ngOnDestroy() {
|
|
186
|
+
this._rippleLoader.destroyRipple(this._elementRef()?.nativeElement);
|
|
187
|
+
}
|
|
188
|
+
writeValue(value) {
|
|
189
|
+
this._value = value;
|
|
190
|
+
if (value) {
|
|
191
|
+
this.files.set(Array.isArray(value) ? value : [value]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
registerOnChange(fn) {
|
|
195
|
+
this._onChange = fn;
|
|
196
|
+
}
|
|
197
|
+
registerOnTouched() {
|
|
198
|
+
// Do nothing
|
|
199
|
+
}
|
|
200
|
+
setDisabledState(disabled) {
|
|
201
|
+
this._disabled = disabled;
|
|
202
|
+
}
|
|
203
|
+
onFileChanged(event) {
|
|
204
|
+
const files = event.target.files;
|
|
205
|
+
if (!files) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.onFilesDropped(files);
|
|
209
|
+
}
|
|
210
|
+
async onFilesDropped(fileList) {
|
|
211
|
+
if (this.multiple() && !this._value) {
|
|
212
|
+
this._value = [];
|
|
213
|
+
}
|
|
214
|
+
const accept = this.accept();
|
|
215
|
+
for (const file of Array.from(fileList)) {
|
|
216
|
+
if (accept && !accept.includes(file.type)) {
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const isImage = file.type.startsWith("image/");
|
|
220
|
+
const value = {
|
|
221
|
+
file,
|
|
222
|
+
name: file.name,
|
|
223
|
+
size: file.size,
|
|
224
|
+
...(isImage && { dimensions: await this.getImageDimension(file) })
|
|
225
|
+
};
|
|
226
|
+
if (this.multiple()) {
|
|
227
|
+
this._value.push(value);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this._value = value;
|
|
231
|
+
this.propagateChanges(this._value);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (this._value) {
|
|
236
|
+
this.propagateChanges(this._value);
|
|
237
|
+
}
|
|
238
|
+
this.resetInput();
|
|
239
|
+
}
|
|
240
|
+
onFileDelete(index) {
|
|
241
|
+
if (this.multiple()) {
|
|
242
|
+
const files = [...this.files()];
|
|
243
|
+
files.splice(index, 1);
|
|
244
|
+
this.propagateChanges(files);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this.propagateChanges(null);
|
|
248
|
+
this.resetInput();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
propagateChanges(value) {
|
|
252
|
+
if (value) {
|
|
253
|
+
this.files.set(Array.isArray(value) ? value : [value]);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
this.files.set([]);
|
|
257
|
+
}
|
|
258
|
+
this._value = value;
|
|
259
|
+
this._onChange(value);
|
|
260
|
+
}
|
|
261
|
+
getImageDimension(file) {
|
|
262
|
+
return new Promise((resolve, reject) => {
|
|
263
|
+
const reader = new FileReader();
|
|
264
|
+
reader.onload = () => {
|
|
265
|
+
const image = new Image();
|
|
266
|
+
image.onload = () => {
|
|
267
|
+
resolve({
|
|
268
|
+
width: image.width,
|
|
269
|
+
height: image.height,
|
|
270
|
+
ratio: image.width / image.height
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
image.onerror = reject;
|
|
274
|
+
image.src = reader.result;
|
|
275
|
+
};
|
|
276
|
+
reader.readAsDataURL(file);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
resetInput() {
|
|
280
|
+
const input = this._inputRef();
|
|
281
|
+
if (!input) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
input.nativeElement.value = "";
|
|
285
|
+
}
|
|
286
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzone, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
287
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: NiceDropzone, isStandalone: true, selector: "nice-dropzone", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, maxFileSize: { classPropertyName: "maxFileSize", publicName: "maxFileSize", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
288
|
+
{
|
|
289
|
+
provide: NG_VALUE_ACCESSOR,
|
|
290
|
+
useExisting: forwardRef(() => NiceDropzone),
|
|
291
|
+
multi: true
|
|
292
|
+
}
|
|
293
|
+
], viewQueries: [{ propertyName: "_elementRef", first: true, predicate: ["element"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "_inputRef", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"nice-dropzone-container\"\n>\n <div\n #element\n role=\"none\"\n class=\"nice-dropzone\"\n [class.nice-dropzone-disabled]=\"_disabled\"\n [class.nice-dropzone-multiple]=\"multiple()\"\n [class.nice-dropzone-single]=\"!multiple()\"\n [class.nice-dropzone-image]=\"mode() === 'image'\"\n [class.nice-dropzone-file]=\"mode() === 'file'\"\n [class.nice-dropzone-all]=\"mode() === 'all'\"\n [class.nice-dropzone-selected]=\"files().length > 0\"\n\n niceDropzone\n (filesDropped)=\"onFilesDropped($event)\"\n (click)=\"fileInput.click()\"\n (keyup.enter)=\"fileInput.click()\"\n >\n <div class=\"nice-dropzone-ripple\"></div>\n\n @if (multiple() || (!multiple() && !files().length)) {\n <div class=\"nice-dropzone-placeholder\">\n <div class=\"nice-dropzone-icon\">\n @if (mode() === \"image\") {\n <nice-dropzone-image-icon />\n } @else {\n <nice-dropzone-file-icon />\n }\n </div>\n\n <div class=\"nice-dropzone-content\">\n <span class=\"nice-dropzone-content-title\">\n @if (mode() === \"image\") {\n @if (multiple()) {\n {{ _translationKeys.upload.images | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.image | niceTranslate }}\n }\n } @else {\n @if (multiple()) {\n {{ _translationKeys.upload.files | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.file | niceTranslate }}\n }\n }\n </span>\n\n <div class=\"nice-dropzone-content-description\">\n @if (accept()?.length) {\n <span>\n {{ _translationKeys.format.label | niceTranslate }}: \n\n <span>\n {{ accept()?.join(\", \") }}\n </span>\n </span>\n }\n\n @if (mode() === \"image\" && config()?.recommendedSize; as recommendedSize) {\n <span>\n {{ _translationKeys.ratio.label | niceTranslate }}: \n\n <span>{{ recommendedSize.width }}x{{ recommendedSize.height }} {{ _translationKeys.ratio.pixels | niceTranslate }}</span>\n </span>\n }\n\n @if (maxFileSize(); as maxFileSize) {\n <span>\n {{ _translationKeys.size.label | niceTranslate }}: \n\n <span>{{ maxFileSize.size }} {{ _translationKeys.size.units[maxFileSize.unit] | niceTranslate }}</span>\n </span>\n }\n </div>\n </div>\n </div>\n } @else {\n <nice-dropzone-file-preview [file]=\"files()[0]\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete(0)\" />\n }\n </div>\n\n @if (multiple()) {\n <div class=\"nice-dropzone-multiple-files-preview\">\n @for (file of files(); track file) {\n <nice-dropzone-file-preview [file]=\"file\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete($index)\" />\n }\n </div>\n }\n</div>\n\n<input #fileInput style=\"display: none;\" type=\"file\" [accept]=\"accept()\" [multiple]=\"multiple()\" (change)=\"onFileChanged($event)\" />\n", styles: [".nice-dropzone-container{--nice-dropzone-ripple-color: color-mix(in srgb, var(--mat-sys-primary) 10%, transparent);--mat-ripple-color: var(--nice-dropzone-ripple-color)}.nice-dropzone-container .nice-dropzone{position:relative;display:flex;justify-content:center;place-items:center;cursor:pointer;min-height:124px;border-radius:var(--nice-dropzone-shape, 8px)}.nice-dropzone-container .nice-dropzone.nice-dropzone-single:not(.nice-dropzone-selected),.nice-dropzone-container .nice-dropzone.nice-dropzone-multiple{border-style:dashed;border-width:var(--nice-dropzone-border-width, 1px);border-color:var(--nice-dropzone-border-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-placeholder{display:flex;justify-content:center;place-items:center;gap:32px}.nice-dropzone-container .nice-dropzone .nice-dropzone-icon{color:var(--nice-dropzone-icon-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-content{-webkit-user-select:none;user-select:none;color:var(--nice-dropzone-text-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-content .nice-dropzone-content-title{font-size:var(--nice-dropzone-content-title-font-size, 18px);font-weight:var(--nice-dropzone-content-title-font-weight, 600);line-height:var(--nice-dropzone-content-title-line-height, 22px)}.nice-dropzone-container .nice-dropzone .nice-dropzone-content .nice-dropzone-content-description{padding-top:4px;display:flex;flex-direction:column;gap:4px;font-size:var(--nice-dropzone-content-description-font-size, 14px);font-weight:var(--nice-dropzone-content-description-font-weight, 400);line-height:var(--nice-dropzone-content-description-line-height, 16px)}.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple,.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple:before{inset:0;position:absolute;pointer-events:none;border-radius:inherit}.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple{overflow:hidden}.nice-dropzone-container .nice-dropzone .mat-ripple-element{background-color:var(--nice-dropzone-ripple-color)}.nice-dropzone-container .nice-dropzone:hover{background-color:var(--nice-dropzone-hover-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.nice-dropzone-container .nice-dropzone.nice-dropzone-disabled{cursor:default;pointer-events:none;opacity:.5}.nice-dropzone-container .nice-dropzone-multiple-files-preview{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding-top:16px}\n"], dependencies: [{ kind: "directive", type: NiceDropzoneDirective, selector: "[niceDropzone]", outputs: ["filesDropped", "files"] }, { kind: "component", type: NiceDropzoneImageIcon, selector: "nice-dropzone-image-icon" }, { kind: "component", type: NiceDropzoneFileIcon, selector: "nice-dropzone-file-icon" }, { kind: "component", type: NiceDropzoneFilePreview, selector: "nice-dropzone-file-preview", inputs: ["file", "mode"], outputs: ["clickDelete"] }, { kind: "pipe", type: NiceTranslatePipe, name: "niceTranslate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
294
|
+
}
|
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: NiceDropzone, decorators: [{
|
|
296
|
+
type: Component,
|
|
297
|
+
args: [{ selector: "nice-dropzone", imports: [
|
|
298
|
+
NiceDropzoneDirective,
|
|
299
|
+
NiceDropzoneImageIcon,
|
|
300
|
+
NiceDropzoneFileIcon,
|
|
301
|
+
NiceDropzoneFilePreview,
|
|
302
|
+
NiceTranslatePipe
|
|
303
|
+
], encapsulation: ViewEncapsulation.None, providers: [
|
|
304
|
+
{
|
|
305
|
+
provide: NG_VALUE_ACCESSOR,
|
|
306
|
+
useExisting: forwardRef(() => NiceDropzone),
|
|
307
|
+
multi: true
|
|
308
|
+
}
|
|
309
|
+
], template: "<div\n class=\"nice-dropzone-container\"\n>\n <div\n #element\n role=\"none\"\n class=\"nice-dropzone\"\n [class.nice-dropzone-disabled]=\"_disabled\"\n [class.nice-dropzone-multiple]=\"multiple()\"\n [class.nice-dropzone-single]=\"!multiple()\"\n [class.nice-dropzone-image]=\"mode() === 'image'\"\n [class.nice-dropzone-file]=\"mode() === 'file'\"\n [class.nice-dropzone-all]=\"mode() === 'all'\"\n [class.nice-dropzone-selected]=\"files().length > 0\"\n\n niceDropzone\n (filesDropped)=\"onFilesDropped($event)\"\n (click)=\"fileInput.click()\"\n (keyup.enter)=\"fileInput.click()\"\n >\n <div class=\"nice-dropzone-ripple\"></div>\n\n @if (multiple() || (!multiple() && !files().length)) {\n <div class=\"nice-dropzone-placeholder\">\n <div class=\"nice-dropzone-icon\">\n @if (mode() === \"image\") {\n <nice-dropzone-image-icon />\n } @else {\n <nice-dropzone-file-icon />\n }\n </div>\n\n <div class=\"nice-dropzone-content\">\n <span class=\"nice-dropzone-content-title\">\n @if (mode() === \"image\") {\n @if (multiple()) {\n {{ _translationKeys.upload.images | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.image | niceTranslate }}\n }\n } @else {\n @if (multiple()) {\n {{ _translationKeys.upload.files | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.file | niceTranslate }}\n }\n }\n </span>\n\n <div class=\"nice-dropzone-content-description\">\n @if (accept()?.length) {\n <span>\n {{ _translationKeys.format.label | niceTranslate }}: \n\n <span>\n {{ accept()?.join(\", \") }}\n </span>\n </span>\n }\n\n @if (mode() === \"image\" && config()?.recommendedSize; as recommendedSize) {\n <span>\n {{ _translationKeys.ratio.label | niceTranslate }}: \n\n <span>{{ recommendedSize.width }}x{{ recommendedSize.height }} {{ _translationKeys.ratio.pixels | niceTranslate }}</span>\n </span>\n }\n\n @if (maxFileSize(); as maxFileSize) {\n <span>\n {{ _translationKeys.size.label | niceTranslate }}: \n\n <span>{{ maxFileSize.size }} {{ _translationKeys.size.units[maxFileSize.unit] | niceTranslate }}</span>\n </span>\n }\n </div>\n </div>\n </div>\n } @else {\n <nice-dropzone-file-preview [file]=\"files()[0]\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete(0)\" />\n }\n </div>\n\n @if (multiple()) {\n <div class=\"nice-dropzone-multiple-files-preview\">\n @for (file of files(); track file) {\n <nice-dropzone-file-preview [file]=\"file\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete($index)\" />\n }\n </div>\n }\n</div>\n\n<input #fileInput style=\"display: none;\" type=\"file\" [accept]=\"accept()\" [multiple]=\"multiple()\" (change)=\"onFileChanged($event)\" />\n", styles: [".nice-dropzone-container{--nice-dropzone-ripple-color: color-mix(in srgb, var(--mat-sys-primary) 10%, transparent);--mat-ripple-color: var(--nice-dropzone-ripple-color)}.nice-dropzone-container .nice-dropzone{position:relative;display:flex;justify-content:center;place-items:center;cursor:pointer;min-height:124px;border-radius:var(--nice-dropzone-shape, 8px)}.nice-dropzone-container .nice-dropzone.nice-dropzone-single:not(.nice-dropzone-selected),.nice-dropzone-container .nice-dropzone.nice-dropzone-multiple{border-style:dashed;border-width:var(--nice-dropzone-border-width, 1px);border-color:var(--nice-dropzone-border-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-placeholder{display:flex;justify-content:center;place-items:center;gap:32px}.nice-dropzone-container .nice-dropzone .nice-dropzone-icon{color:var(--nice-dropzone-icon-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-content{-webkit-user-select:none;user-select:none;color:var(--nice-dropzone-text-color, var(--mat-sys-primary))}.nice-dropzone-container .nice-dropzone .nice-dropzone-content .nice-dropzone-content-title{font-size:var(--nice-dropzone-content-title-font-size, 18px);font-weight:var(--nice-dropzone-content-title-font-weight, 600);line-height:var(--nice-dropzone-content-title-line-height, 22px)}.nice-dropzone-container .nice-dropzone .nice-dropzone-content .nice-dropzone-content-description{padding-top:4px;display:flex;flex-direction:column;gap:4px;font-size:var(--nice-dropzone-content-description-font-size, 14px);font-weight:var(--nice-dropzone-content-description-font-weight, 400);line-height:var(--nice-dropzone-content-description-line-height, 16px)}.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple,.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple:before{inset:0;position:absolute;pointer-events:none;border-radius:inherit}.nice-dropzone-container .nice-dropzone .nice-dropzone-ripple{overflow:hidden}.nice-dropzone-container .nice-dropzone .mat-ripple-element{background-color:var(--nice-dropzone-ripple-color)}.nice-dropzone-container .nice-dropzone:hover{background-color:var(--nice-dropzone-hover-color, color-mix(in srgb, var(--mat-sys-primary) 20%, transparent))}.nice-dropzone-container .nice-dropzone.nice-dropzone-disabled{cursor:default;pointer-events:none;opacity:.5}.nice-dropzone-container .nice-dropzone-multiple-files-preview{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;padding-top:16px}\n"] }]
|
|
310
|
+
}], ctorParameters: () => [] });
|
|
311
|
+
|
|
312
|
+
const defaultTranslationKeys = {
|
|
313
|
+
upload: {
|
|
314
|
+
file: "components.dropzone.upload.file",
|
|
315
|
+
files: "components.dropzone.upload.files",
|
|
316
|
+
image: "components.dropzone.upload.image",
|
|
317
|
+
images: "components.dropzone.upload.images"
|
|
318
|
+
},
|
|
319
|
+
format: {
|
|
320
|
+
label: "components.dropzone.format.label"
|
|
321
|
+
},
|
|
322
|
+
ratio: {
|
|
323
|
+
label: "components.dropzone.ratio.label",
|
|
324
|
+
pixels: "components.dropzone.ratio.pixels"
|
|
325
|
+
},
|
|
326
|
+
size: {
|
|
327
|
+
label: "components.dropzone.size.label",
|
|
328
|
+
units: {
|
|
329
|
+
B: "components.dropzone.size.units.B",
|
|
330
|
+
KB: "components.dropzone.size.units.KB",
|
|
331
|
+
MB: "components.dropzone.size.units.MB",
|
|
332
|
+
GB: "components.dropzone.size.units.GB"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
function provideDropzone(options) {
|
|
337
|
+
return [
|
|
338
|
+
{
|
|
339
|
+
provide: NICE_DROPZONE_TRANSLATION_KEYS,
|
|
340
|
+
useValue: options?.translationKeys ?? defaultTranslationKeys
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/*
|
|
346
|
+
* Public API Surface of dropzone
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Generated bundle index. Do not edit.
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
export { NiceDropzone, NiceDropzoneDirective, niceDropzoneModes, provideDropzone };
|
|
354
|
+
//# sourceMappingURL=recursyve-ngx-material-components-dropzone.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursyve-ngx-material-components-dropzone.mjs","sources":["../../../src/material-components/dropzone/dropzone.directive.ts","../../../src/material-components/dropzone/constant.ts","../../../src/material-components/dropzone/icons/file/file-icon.component.ts","../../../src/material-components/dropzone/icons/file/file-icon.template.svg","../../../src/material-components/dropzone/icons/image/image-icon.component.ts","../../../src/material-components/dropzone/icons/image/image-icon.template.svg","../../../src/material-components/dropzone/models.ts","../../../src/material-components/dropzone/pipes/file-size.pipe.ts","../../../src/material-components/dropzone/icons/delete/delete-icon.component.ts","../../../src/material-components/dropzone/icons/delete/delete-icon.template.svg","../../../src/material-components/dropzone/preview/file-preview.ts","../../../src/material-components/dropzone/preview/file-preview.html","../../../src/material-components/dropzone/dropzone.ts","../../../src/material-components/dropzone/dropzone.html","../../../src/material-components/dropzone/provider.ts","../../../src/material-components/dropzone/index.ts","../../../src/material-components/dropzone/recursyve-ngx-material-components-dropzone.ts"],"sourcesContent":["import { Directive, EventEmitter, HostBinding, HostListener, output, Output } from \"@angular/core\";\n\n@Directive({\n selector: \"[niceDropzone]\",\n standalone: true\n})\nexport class NiceDropzoneDirective {\n @HostBinding(\"class.file-over\")\n public fileOver!: boolean;\n\n @Output()\n public filesDropped = new EventEmitter<FileList>();\n\n public files = output()\n\n // Dragover listener\n @HostListener(\"dragover\", [\"$event\"])\n public onDragOver(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.fileOver = true;\n }\n\n // Dragleave listener\n @HostListener(\"dragleave\", [\"$event\"])\n public onDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.fileOver = false;\n }\n\n // Drop listener\n @HostListener(\"drop\", [\"$event\"])\n public ondrop(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.fileOver = false;\n\n if (!event.dataTransfer) {\n return;\n }\n\n const files = event.dataTransfer.files;\n if (files.length > 0) {\n this.filesDropped.emit(files);\n }\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport const NICE_DROPZONE_TRANSLATION_KEYS = new InjectionToken(\"nice_dropzone_translation_keys\");\n","import { Component } from \"@angular/core\";\n\n@Component({\n selector: \"nice-dropzone-file-icon\",\n templateUrl: \"./file-icon.template.svg\"\n})\nexport class NiceDropzoneFileIcon {}\n","<svg fill=\"none\" viewBox=\"-1.25 -1.25 40 40\" height=\"40\" width=\"40\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.859375 36.328125h25.78125c1.294375 0 2.34375 -1.049375 2.34375 -2.34375V12.6890625c-0.00015625 -0.621171875 -0.246875 -1.2168750000000002 -0.6859375 -1.65625l-9.175 -9.175c-0.439375 -0.43909062499999996 -1.03515625 -0.6858046875 -1.65625 -0.6859375H5.859375c-1.2765624999999998 0 -2.34375 1.0671875000000002 -2.34375 2.34375v30.46875c0 1.2765624999999998 1.0671875000000002 2.34375 2.34375 2.34375Z\" stroke-width=\"2.5\"></path>\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M33.984375 12.890625h-9.375c-0.6215625 0 -1.2178125 -0.24693750000000003 -1.65734375 -0.68646875S22.265625 11.16846875 22.265625 10.546875v-9.375\" stroke-width=\"2.5\"></path>\n</svg>","import { Component } from \"@angular/core\";\n\n@Component({\n selector: \"nice-dropzone-image-icon\",\n templateUrl: \"./image-icon.template.svg\"\n})\nexport class NiceDropzoneImageIcon {}\n","<svg width=\"40\" height=\"43\" viewBox=\"0 0 40 43\" fill=\"none\">\n <path d=\"M29.333 1.5H2.66634C1.92996 1.5 1.33301 2.09695 1.33301 2.83333V33.0556C1.33301 33.7919 1.92996 34.3889 2.66634 34.3889H29.333C30.0694 34.3889 30.6663 33.7919 30.6663 33.0556V2.83333C30.6663 2.09695 30.0694 1.5 29.333 1.5Z\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M38.6667 11.2778V40.1667C38.6621 40.5189 38.5201 40.8554 38.2711 41.1044C38.022 41.3535 37.6855 41.4954 37.3333 41.5001H12\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M30.6663 27.2778H1.33301\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M7.55566 27.2778L16.8001 14.0689C17.0316 13.7366 17.3357 13.4614 17.6895 13.2642C18.0432 13.0669 18.4372 12.9528 18.8415 12.9306C19.2459 12.9083 19.6501 12.9784 20.0233 13.1356C20.3965 13.2928 20.7291 13.533 20.9957 13.8378L30.6668 25.0556\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M9.33268 6.8335C9.8601 6.8335 10.3757 6.98989 10.8142 7.28291C11.2527 7.57593 11.5945 7.9924 11.7964 8.47967C11.9982 8.96694 12.051 9.50312 11.9481 10.0204C11.8452 10.5377 11.5912 11.0128 11.2183 11.3858C10.8454 11.7587 10.3702 12.0127 9.85292 12.1156C9.33564 12.2185 8.79946 12.1657 8.31219 11.9638C7.82492 11.762 7.40845 11.4202 7.11543 10.9817C6.82241 10.5432 6.66602 10.0276 6.66602 9.50016C6.66602 8.79292 6.94697 8.11464 7.44706 7.61454C7.94716 7.11445 8.62544 6.8335 9.33268 6.8335\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","export type NiceFileDimensions = {\n width: number;\n height: number;\n ratio: number;\n};\n\nexport type NiceLocalFile = {\n file: File;\n name: string;\n size?: number;\n dimensions?: NiceFileDimensions;\n};\n\nexport type NiceRemoteFile = {\n id: string | number;\n name: string;\n url: string;\n size?: number;\n};\n\nexport type NiceSelectedFiles = NiceLocalFile | NiceRemoteFile;\n\nexport function isLocalFile(file: NiceSelectedFiles): file is NiceLocalFile {\n return \"file\" in file;\n}\n\nexport function isRemoteFile(file: NiceSelectedFiles): file is NiceRemoteFile {\n return \"id\" in file;\n}\n","import { inject, Pipe, PipeTransform } from \"@angular/core\";\nimport { NiceTranslater, NICE_COMPONENTS_TRANSLATER } from \"@recursyve/ngx-material-components/common\";\n\nimport { NICE_DROPZONE_TRANSLATION_KEYS } from \"../constant\";\nimport { NiceDropzoneTranslationKeyConfig } from \"../config\";\n\n@Pipe({\n name: \"niceFileSize\"\n})\nexport class FileSizePipe implements PipeTransform {\n private readonly units = [\"B\", \"KB\", \"MB\", \"GB\"] as const;\n\n private readonly translater = inject<NiceTranslater>(NICE_COMPONENTS_TRANSLATER);\n private readonly translationKeys = inject<NiceDropzoneTranslationKeyConfig>(NICE_DROPZONE_TRANSLATION_KEYS);\n\n public transform(bytes: number | null | undefined, precision = 0): string {\n const defaultUnit = this.translater(this.translationKeys.size.units.B);\n\n if (!bytes) {\n return `0 ${defaultUnit}`;\n }\n\n const unitIndex = Math.floor(Math.log(bytes) / Math.log(1000));\n const boundedUnitIndex = Math.min(unitIndex, this.units.length - 1);\n\n const size = bytes / Math.pow(1000, boundedUnitIndex);\n\n const unit = this.translater(this.translationKeys.size.units[this.units[boundedUnitIndex]]);\n return `${size.toFixed(precision)} ${unit}`;\n }\n}\n","import { Component } from \"@angular/core\";\n\n@Component({\n selector: \"nice-dropzone-delete-icon\",\n templateUrl: \"./delete-icon.template.svg\"\n})\nexport class NiceDropzoneDeleteIcon {}\n","<svg viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M12 0a12 12 0 1 0 12 12A12 12 0 0 0 12 0Zm5.49 16.07a1 1 0 0 1 -1.41 1.42l-3.9 -3.9a0.25 0.25 0 0 0 -0.36 0l-3.9 3.9a1 1 0 1 1 -1.41 -1.42l3.9 -3.89a0.25 0.25 0 0 0 0 -0.36l-3.9 -3.9a1 1 0 0 1 1.41 -1.41l3.9 3.9a0.25 0.25 0 0 0 0.36 0l3.9 -3.9a1 1 0 0 1 1.41 1.41l-3.9 3.9a0.25 0.25 0 0 0 0 0.36Z\" fill=\"currentColor\" stroke-width=\"1\"></path>\n</svg>","import { Component, computed, inject, input, output } from \"@angular/core\";\nimport { NiceTranslatePipe } from \"@recursyve/ngx-material-components/common\";\n\nimport { NICE_DROPZONE_TRANSLATION_KEYS } from \"../constant\";\nimport { NiceDropzoneModes } from \"../dropzone\";\nimport { NiceDropzoneTranslationKeyConfig } from \"../config\";\nimport { isLocalFile, NiceFileDimensions, NiceSelectedFiles } from \"../models\";\nimport { FileSizePipe } from \"../pipes/file-size.pipe\";\nimport { NiceDropzoneDeleteIcon } from \"../icons/delete/delete-icon.component\";\nimport { NiceDropzoneFileIcon } from \"../icons/file/file-icon.component\";\n\n@Component({\n selector: \"nice-dropzone-file-preview\",\n templateUrl: \"./file-preview.html\",\n styleUrls: [\"./file-preview.scss\"],\n imports: [NiceDropzoneDeleteIcon, NiceTranslatePipe, FileSizePipe, NiceDropzoneFileIcon],\n host: {\n style: \"flex: 1 1 auto;\"\n }\n})\nexport class NiceDropzoneFilePreview {\n public readonly file = input.required<NiceSelectedFiles>();\n public readonly mode = input.required<NiceDropzoneModes>();\n\n protected readonly clickDelete = output<void>();\n\n protected readonly isImage = computed(() => this.mode() === \"image\");\n protected readonly imageDimensions = computed<NiceFileDimensions | null>(() => {\n const file = this.file();\n if (isLocalFile(file)) {\n return file.dimensions ?? null;\n }\n\n return null;\n });\n protected readonly imageUrl = computed<string>(() => {\n const file = this.file();\n if (isLocalFile(file)) {\n return URL.createObjectURL(file.file);\n }\n\n return file.url;\n });\n\n protected _translationKeys = inject<NiceDropzoneTranslationKeyConfig>(NICE_DROPZONE_TRANSLATION_KEYS);\n}\n","<div class=\"nice-dropzone-preview\">\n @if (isImage()) {\n <img class=\"nice-dropzone-preview-image\" alt=\"\" draggable=\"false\" [src]=\"imageUrl()\" />\n } @else {\n <div class=\"nice-dropzone-preview-file\">\n <nice-dropzone-file-icon />\n </div>\n }\n\n <div class=\"nice-dropzone-preview-file-info\">\n <span class=\"mat-body-medium\">{{ file().name }}</span>\n\n @if (imageDimensions(); as dimension) {\n <span class=\"mat-label-medium\">\n {{ `${dimension.width}x${dimension.height}` }} {{ _translationKeys.ratio.pixels | niceTranslate }}\n </span>\n }\n\n @if (file().size; as size) {\n <span class=\"mat-label-medium\">{{ size | niceFileSize }}</span>\n }\n </div>\n\n <div class=\"nice-dropzone-preview-actions\">\n <button class=\"nice-dropzone-preview-actions-delete\" (click)=\"$event.stopPropagation(); clickDelete.emit()\">\n <nice-dropzone-delete-icon />\n </button>\n </div>\n</div>\n","import { coerceBooleanProperty } from \"@angular/cdk/coercion\";\nimport {\n Component,\n effect,\n ElementRef,\n forwardRef,\n inject,\n input,\n OnDestroy,\n signal,\n viewChild,\n ViewEncapsulation\n} from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { MatRippleLoader } from \"@angular/material/core\";\nimport { NiceTranslatePipe } from \"@recursyve/ngx-material-components/common\";\n\nimport { NICE_DROPZONE_TRANSLATION_KEYS } from \"./constant\";\nimport {\n NiceDropzoneFileSizeConfig,\n NiceDropzoneImageConfig,\n NiceDropzoneTranslationKeyConfig\n} from \"./config\";\nimport { NiceDropzoneDirective } from \"./dropzone.directive\";\nimport { NiceDropzoneFileIcon } from \"./icons/file/file-icon.component\";\nimport { NiceDropzoneImageIcon } from \"./icons/image/image-icon.component\";\nimport { NiceFileDimensions, NiceSelectedFiles } from \"./models\";\nimport { NiceDropzoneFilePreview } from \"./preview/file-preview\";\n\nexport const niceDropzoneModes = [\"image\", \"file\", \"all\"] as const;\nexport type NiceDropzoneModes = (typeof niceDropzoneModes)[number];\n\n@Component({\n selector: \"nice-dropzone\",\n templateUrl: \"dropzone.html\",\n styleUrl: \"dropzone.scss\",\n imports: [\n NiceDropzoneDirective,\n NiceDropzoneImageIcon,\n NiceDropzoneFileIcon,\n NiceDropzoneFilePreview,\n NiceTranslatePipe\n ],\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NiceDropzone),\n multi: true\n }\n ]\n})\nexport class NiceDropzone implements OnDestroy, ControlValueAccessor {\n public readonly mode = input<NiceDropzoneModes>(\"all\");\n public readonly multiple = input(false, { transform: coerceBooleanProperty });\n public readonly disabled = input(false, { transform: coerceBooleanProperty });\n public readonly accept = input<string[]>();\n public readonly config = input<NiceDropzoneImageConfig>();\n public readonly maxFileSize = input<NiceDropzoneFileSizeConfig>();\n\n protected readonly _elementRef = viewChild(\"element\", { read: ElementRef });\n protected readonly _inputRef = viewChild<ElementRef<HTMLInputElement>>(\"fileInput\");\n\n /**\n * Handles the lazy creation of the MatButton ripple.\n * Used to improve the initial load time of large applications.\n */\n protected readonly _rippleLoader: MatRippleLoader = inject(MatRippleLoader);\n protected readonly _translationKeys = inject<NiceDropzoneTranslationKeyConfig>(NICE_DROPZONE_TRANSLATION_KEYS);\n\n protected readonly files = signal<NiceSelectedFiles[]>([]);\n\n protected _disabled = false;\n\n private _onChange!: (value: NiceSelectedFiles | NiceSelectedFiles[] | null) => void;\n private _value: NiceSelectedFiles | NiceSelectedFiles[] | null = null;\n\n constructor() {\n effect(() => {\n const elementRef = this._elementRef();\n if (!elementRef) {\n return;\n }\n\n this._rippleLoader.configureRipple(elementRef.nativeElement, { className: \"nice-dropzone-ripple\" });\n });\n\n effect(() => {\n this._disabled = this.disabled();\n });\n }\n\n public ngOnDestroy(): void {\n this._rippleLoader.destroyRipple(this._elementRef()?.nativeElement);\n }\n\n public writeValue(value: NiceSelectedFiles | NiceSelectedFiles[] | null): void {\n this._value = value;\n if (value) {\n this.files.set(Array.isArray(value) ? value : [value]);\n }\n }\n\n public registerOnChange(fn: (value: NiceSelectedFiles | NiceSelectedFiles[] | null) => void): void {\n this._onChange = fn;\n }\n\n public registerOnTouched(): void {\n // Do nothing\n }\n\n public setDisabledState(disabled: boolean): void {\n this._disabled = disabled;\n }\n\n public onFileChanged(event: Event): void {\n const files = (event.target as HTMLInputElement).files;\n if (!files) {\n return;\n }\n\n this.onFilesDropped(files);\n }\n\n public async onFilesDropped(fileList: FileList): Promise<void> {\n if (this.multiple() && !this._value) {\n this._value = [];\n }\n\n const accept = this.accept();\n for (const file of Array.from(fileList)) {\n if (accept && !accept.includes(file.type)) {\n continue;\n }\n\n const isImage = file.type.startsWith(\"image/\");\n const value = {\n file,\n name: file.name,\n size: file.size,\n ...(isImage && { dimensions: await this.getImageDimension(file) })\n } satisfies NiceSelectedFiles;\n if (this.multiple()) {\n (this._value as NiceSelectedFiles[]).push(value);\n } else {\n this._value = value;\n this.propagateChanges(this._value);\n return;\n }\n }\n\n if (this._value) {\n this.propagateChanges(this._value);\n }\n\n this.resetInput();\n }\n\n public onFileDelete(index: number): void {\n if (this.multiple()) {\n const files = [...this.files()];\n files.splice(index, 1);\n this.propagateChanges(files);\n } else {\n this.propagateChanges(null);\n this.resetInput();\n }\n }\n\n protected propagateChanges(value: NiceSelectedFiles | NiceSelectedFiles[] | null): void {\n if (value) {\n this.files.set(Array.isArray(value) ? value : [value]);\n } else {\n this.files.set([]);\n }\n\n this._value = value;\n this._onChange(value);\n }\n\n protected getImageDimension(file: File): Promise<NiceFileDimensions> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n\n reader.onload = () => {\n const image = new Image();\n image.onload = () => {\n resolve({\n width: image.width,\n height: image.height,\n ratio: image.width / image.height\n });\n };\n image.onerror = reject;\n image.src = reader.result as string;\n };\n\n reader.readAsDataURL(file);\n });\n }\n\n protected resetInput(): void {\n const input = this._inputRef();\n if (!input) {\n return;\n }\n\n input.nativeElement.value = \"\";\n }\n}\n","<div\n class=\"nice-dropzone-container\"\n>\n <div\n #element\n role=\"none\"\n class=\"nice-dropzone\"\n [class.nice-dropzone-disabled]=\"_disabled\"\n [class.nice-dropzone-multiple]=\"multiple()\"\n [class.nice-dropzone-single]=\"!multiple()\"\n [class.nice-dropzone-image]=\"mode() === 'image'\"\n [class.nice-dropzone-file]=\"mode() === 'file'\"\n [class.nice-dropzone-all]=\"mode() === 'all'\"\n [class.nice-dropzone-selected]=\"files().length > 0\"\n\n niceDropzone\n (filesDropped)=\"onFilesDropped($event)\"\n (click)=\"fileInput.click()\"\n (keyup.enter)=\"fileInput.click()\"\n >\n <div class=\"nice-dropzone-ripple\"></div>\n\n @if (multiple() || (!multiple() && !files().length)) {\n <div class=\"nice-dropzone-placeholder\">\n <div class=\"nice-dropzone-icon\">\n @if (mode() === \"image\") {\n <nice-dropzone-image-icon />\n } @else {\n <nice-dropzone-file-icon />\n }\n </div>\n\n <div class=\"nice-dropzone-content\">\n <span class=\"nice-dropzone-content-title\">\n @if (mode() === \"image\") {\n @if (multiple()) {\n {{ _translationKeys.upload.images | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.image | niceTranslate }}\n }\n } @else {\n @if (multiple()) {\n {{ _translationKeys.upload.files | niceTranslate }}\n } @else {\n {{ _translationKeys.upload.file | niceTranslate }}\n }\n }\n </span>\n\n <div class=\"nice-dropzone-content-description\">\n @if (accept()?.length) {\n <span>\n {{ _translationKeys.format.label | niceTranslate }}: \n\n <span>\n {{ accept()?.join(\", \") }}\n </span>\n </span>\n }\n\n @if (mode() === \"image\" && config()?.recommendedSize; as recommendedSize) {\n <span>\n {{ _translationKeys.ratio.label | niceTranslate }}: \n\n <span>{{ recommendedSize.width }}x{{ recommendedSize.height }} {{ _translationKeys.ratio.pixels | niceTranslate }}</span>\n </span>\n }\n\n @if (maxFileSize(); as maxFileSize) {\n <span>\n {{ _translationKeys.size.label | niceTranslate }}: \n\n <span>{{ maxFileSize.size }} {{ _translationKeys.size.units[maxFileSize.unit] | niceTranslate }}</span>\n </span>\n }\n </div>\n </div>\n </div>\n } @else {\n <nice-dropzone-file-preview [file]=\"files()[0]\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete(0)\" />\n }\n </div>\n\n @if (multiple()) {\n <div class=\"nice-dropzone-multiple-files-preview\">\n @for (file of files(); track file) {\n <nice-dropzone-file-preview [file]=\"file\" [mode]=\"mode()\" (clickDelete)=\"onFileDelete($index)\" />\n }\n </div>\n }\n</div>\n\n<input #fileInput style=\"display: none;\" type=\"file\" [accept]=\"accept()\" [multiple]=\"multiple()\" (change)=\"onFileChanged($event)\" />\n","import { Provider } from \"@angular/core\";\nimport { NICE_DROPZONE_TRANSLATION_KEYS } from \"./constant\";\nimport { NiceDropzoneTranslationKeyConfig } from \"./config\";\nimport { NiceDropzoneOptions } from \"./options\";\n\nconst defaultTranslationKeys: NiceDropzoneTranslationKeyConfig = {\n upload: {\n file: \"components.dropzone.upload.file\",\n files: \"components.dropzone.upload.files\",\n image: \"components.dropzone.upload.image\",\n images: \"components.dropzone.upload.images\"\n },\n format: {\n label: \"components.dropzone.format.label\"\n },\n ratio: {\n label: \"components.dropzone.ratio.label\",\n pixels: \"components.dropzone.ratio.pixels\"\n },\n size: {\n label: \"components.dropzone.size.label\",\n units: {\n B: \"components.dropzone.size.units.B\",\n KB: \"components.dropzone.size.units.KB\",\n MB: \"components.dropzone.size.units.MB\",\n GB: \"components.dropzone.size.units.GB\"\n }\n }\n};\n\nexport function provideDropzone(options?: NiceDropzoneOptions): Provider[] {\n return [\n {\n provide: NICE_DROPZONE_TRANSLATION_KEYS,\n useValue: options?.translationKeys ?? defaultTranslationKeys\n }\n ];\n}\n","/*\n * Public API Surface of dropzone\n */\n\nexport * from \"./dropzone.directive\";\nexport * from \"./dropzone\";\nexport * from \"./config\";\nexport * from \"./options\";\nexport * from \"./provider\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAMa,qBAAqB,CAAA;AAEvB,IAAA,QAAQ;AAGR,IAAA,YAAY,GAAG,IAAI,YAAY,EAAY;IAE3C,KAAK,GAAG,MAAM,EAAE;;AAIhB,IAAA,UAAU,CAAC,KAAgB,EAAA;QAC9B,KAAK,CAAC,cAAc,EAAE;QACtB,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;;;AAKjB,IAAA,WAAW,CAAC,KAAgB,EAAA;QAC/B,KAAK,CAAC,cAAc,EAAE;QACtB,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;;;AAKlB,IAAA,MAAM,CAAC,KAAgB,EAAA;QAC1B,KAAK,CAAC,cAAc,EAAE;QACtB,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;AAErB,QAAA,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;YACrB;;AAGJ,QAAA,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK;AACtC,QAAA,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AAClB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CA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EAAE;AACP;AACJ;CACJ;AAEK,SAAU,eAAe,CAAC,OAA6B,EAAA;IACzD,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,8BAA8B;AACvC,YAAA,QAAQ,EAAE,OAAO,EAAE,eAAe,IAAI;AACzC;KACJ;AACL;;ACrCA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recursyve-ngx-material-components-form-field-error.mjs","sources":["../../../src/material-components/form-field-error/error-transformer.ts","../../../src/material-components/form-field-error/form-field-error.ts","../../../src/material-components/form-field-error/constant.ts","../../../src/material-components/form-field-error/form-field-error.directive.ts","../../../src/material-components/form-field-error/provider.ts","../../../src/material-components/form-field-error/recursyve-ngx-material-components-form-field-error.ts"],"sourcesContent":["import { ValidationErrors } from \"@angular/forms\";\n\nexport type TransformedError = { key: string; params?: Record<string, string> };\nexport type ErrorTransformer = (error: string, details: ValidationErrors) => TransformedError;\nexport type ErrorTransformers = Record<string, ErrorTransformer>;\n\nexport const PatternErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n if (details[\"requiredPattern\"]) {\n return {\n key: details[\"requiredPattern\"]\n }\n }\n\n return { key: error };\n};\n\nexport const MaskErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n if (details[\"requiredMask\"]) {\n return {\n key: details[\"requiredMask\"]\n }\n }\n\n return { key: error };\n};\n\nexport const LengthErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n value: details[\"requiredLength\"]\n }\n };\n};\n\nexport const MinErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n min: details[\"min\"],\n actual: details[\"actual\"]\n }\n };\n};\n\nexport const MaxErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n max: details[\"max\"],\n actual: details[\"actual\"]\n }\n };\n};\n\nexport const DefaultErrorTransformers: ErrorTransformers = {\n pattern: PatternErrorTransformer,\n mask: MaskErrorTransformer,\n minlength: LengthErrorTransformer,\n maxlength: LengthErrorTransformer,\n min: MinErrorTransformer,\n max: MaxErrorTransformer\n};\n","import { animate, style, transition, trigger } from \"@angular/animations\";\nimport { Component, Input, ViewEncapsulation } from \"@angular/core\";\nimport { MatError } from \"@angular/material/form-field\";\n\n@Component({\n selector: \"nice-form-field-error\",\n template: `\n @if (message) {\n <div [@animation]=\"increment\">\n <mat-error>{{ message }}</mat-error>\n </div>\n }\n `,\n styleUrls: [\"./form-field-error.scss\"],\n animations: [\n trigger(\"animation\", [\n transition(\":increment\", [style({ opacity: 0 }), animate(\"200ms ease-in\", style({ opacity: 1 }))]),\n transition(\":enter\", [\n style({ opacity: 0, transform: \"translateY(-1rem)\" }),\n animate(\"200ms ease-in\", style({ opacity: 1, transform: \"translateY(0)\" }))\n ]),\n transition(\":leave\", [animate(\"200ms ease-out\", style({ opacity: 0, transform: \"translateY(-1rem)\" }))])\n ])\n ],\n encapsulation: ViewEncapsulation.None,\n imports: [\n MatError\n ]\n})\nexport class NiceFormErrorComponent {\n public message = \"\";\n public increment = 0;\n\n @Input()\n public set error(value: string) {\n if (value) {\n if (this.message !== value) {\n this.increment++;\n }\n }\n this.message = value;\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport const NICE_FORM_FIELD_ERROR_TRANSFORMERS = new InjectionToken(\"nice_form_field_error_transformers\");\nexport const NICE_FORM_FIELD_ERROR_TRANSLATER = new InjectionToken(\"nice_form_field_error_translater\");\n","import {\n AfterViewInit,\n ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n ViewContainerRef\n} from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { AbstractControlDirective, NgControl } from \"@angular/forms\";\nimport { MatFormField } from \"@angular/material/form-field\";\nimport { combineLatest, startWith } from \"rxjs\";\nimport { NiceFormErrorComponent } from \"./form-field-error\";\nimport { ErrorTransformers } from \"./error-transformer\";\nimport { ErrorTranslater } from \"./error-translater\";\nimport { NICE_FORM_FIELD_ERROR_TRANSFORMERS, NICE_FORM_FIELD_ERROR_TRANSLATER } from \"./constant\";\n\n@Directive({ selector: \"[niceFormFieldError]\", standalone: true })\nexport class NiceFormFieldErrorDirective implements AfterViewInit {\n private readonly destroyRef = inject(DestroyRef);\n private readonly elementRef = inject(ElementRef);\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly formField = inject(MatFormField);\n private readonly transformers = inject<ErrorTransformers>(NICE_FORM_FIELD_ERROR_TRANSFORMERS);\n private readonly translater = inject<ErrorTranslater>(NICE_FORM_FIELD_ERROR_TRANSLATER);\n\n private ref: ComponentRef<NiceFormErrorComponent> | null = null ;\n private control: NgControl | AbstractControlDirective | null = null;\n\n public onChange = () => {\n if (this.control === null || this.control.pending) {\n return;\n }\n\n if (this.control.valid || this.control.untouched) {\n this.setError(\"\", {});\n return;\n }\n\n for (const error in this.control.errors) {\n const details = this.control.errors[error];\n if (typeof details !== \"object\") {\n this.setError(`errors.${error}`, {});\n continue;\n }\n\n const transformer = this.transformers[error];\n if (!transformer) {\n this.setError(`errors.${error}`, {});\n continue;\n }\n\n const { key, params } = transformer(error, details);\n this.setError(`errors.${key}`, params ?? {});\n }\n }\n\n public ngAfterViewInit(): void {\n this.control = this.formField._control.ngControl;\n\n if (this.control !== null && this.control.statusChanges !== null) {\n combineLatest([\n this.formField._control.stateChanges,\n this.control.statusChanges.pipe(startWith(this.control.status))\n ])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.onChange());\n }\n }\n\n public setError(text: string, params: Record<string, string>): void {\n if (!this.ref) {\n this.ref = this.viewContainerRef.createComponent(NiceFormErrorComponent);\n if (this.elementRef.nativeElement.getElementsByClassName(\"mat-mdc-form-field-subscript-wrapper\").item(0)) {\n const hint = this.elementRef.nativeElement.getElementsByClassName(\"mat-mdc-form-field-hint\").item(0);\n (this.ref.location.nativeElement as HTMLDivElement).style.position = \"absolute\";\n (this.ref.location.nativeElement as HTMLDivElement).style.top = hint ? \"16px\" : \"0\";\n\n const wrapper = this.elementRef.nativeElement\n .getElementsByClassName(\"mat-mdc-form-field-subscript-wrapper\")\n .item(0);\n if (hint) {\n wrapper.classList.add(\"override-height\");\n }\n\n wrapper.prepend(this.ref.location.nativeElement);\n }\n }\n\n if (text) {\n this.elementRef.nativeElement.classList.add(\"form-error-show\");\n } else {\n this.elementRef.nativeElement.classList.remove(\"form-error-show\");\n }\n\n this.ref.instance.error = text.length > 0 ? this.translater(text, params) : text;\n }\n}\n","import { Provider } from \"@angular/core\";\nimport { NICE_FORM_FIELD_ERROR_TRANSFORMERS, NICE_FORM_FIELD_ERROR_TRANSLATER } from \"./constant\";\nimport { NiceFormFieldErrorsOptions } from \"./options\";\nimport { DefaultErrorTransformers } from \"./error-transformer\";\n\nexport function provideFormFieldError(options: NiceFormFieldErrorsOptions): Provider[] {\n return [\n {\n provide: NICE_FORM_FIELD_ERROR_TRANSFORMERS,\n useValue: {\n ...DefaultErrorTransformers,\n ...options.errorTransformers\n }\n },\n {\n provide: NICE_FORM_FIELD_ERROR_TRANSLATER,\n ...options.translater\n }\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAMa,uBAAuB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;AAClG,IAAA,IAAI,OAAO,CAAC,iBAAiB,CAAC,EAAE;QAC5B,OAAO;AACH,YAAA,GAAG,EAAE,OAAO,CAAC,iBAAiB;SACjC;;AAGL,IAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE;AACzB;MAEa,oBAAoB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;AAC/F,IAAA,IAAI,OAAO,CAAC,cAAc,CAAC,EAAE;QACzB,OAAO;AACH,YAAA,GAAG,EAAE,OAAO,CAAC,cAAc;SAC9B;;AAGL,IAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE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C;;gBAG5C,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC;;;QAIxD,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC;;aAC3D;YACH,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC;;QAGrE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI;;wGA7E3E,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,QAAQ,EAAE,sBAAsB,EAAE,UAAU,EAAE,IAAI,EAAE;;;ACb3D,SAAU,qBAAqB,CAAC,OAAmC,EAAA;IACrE,OAAO;AACH,QAAA;AACI,YAAA,OAAO,EAAE,kCAAkC;AAC3C,YAAA,QAAQ,EAAE;AACN,gBAAA,GAAG,wBAAwB;gBAC3B,GAAG,OAAO,CAAC;AACd;AACJ,SAAA;AACD,QAAA;AACI,YAAA,OAAO,EAAE,gCAAgC;YACzC,GAAG,OAAO,CAAC;AACd;KACJ;AACL;;ACnBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"recursyve-ngx-material-components-form-field-error.mjs","sources":["../../../src/material-components/form-field-error/error-transformer.ts","../../../src/material-components/form-field-error/form-field-error.ts","../../../src/material-components/form-field-error/constant.ts","../../../src/material-components/form-field-error/form-field-error.directive.ts","../../../src/material-components/form-field-error/provider.ts","../../../src/material-components/form-field-error/recursyve-ngx-material-components-form-field-error.ts"],"sourcesContent":["import { ValidationErrors } from \"@angular/forms\";\n\nexport type TransformedError = { key: string; params?: Record<string, string> };\nexport type ErrorTransformer = (error: string, details: ValidationErrors) => TransformedError;\nexport type ErrorTransformers = Record<string, ErrorTransformer>;\n\nexport const PatternErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n if (details[\"requiredPattern\"]) {\n return {\n key: details[\"requiredPattern\"]\n }\n }\n\n return { key: error };\n};\n\nexport const MaskErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n if (details[\"requiredMask\"]) {\n return {\n key: details[\"requiredMask\"]\n }\n }\n\n return { key: error };\n};\n\nexport const LengthErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n value: details[\"requiredLength\"]\n }\n };\n};\n\nexport const MinErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n min: details[\"min\"],\n actual: details[\"actual\"]\n }\n };\n};\n\nexport const MaxErrorTransformer: ErrorTransformer = (error: string, details: ValidationErrors) => {\n return {\n key: error,\n params: {\n max: details[\"max\"],\n actual: details[\"actual\"]\n }\n };\n};\n\nexport const DefaultErrorTransformers: ErrorTransformers = {\n pattern: PatternErrorTransformer,\n mask: MaskErrorTransformer,\n minlength: LengthErrorTransformer,\n maxlength: LengthErrorTransformer,\n min: MinErrorTransformer,\n max: MaxErrorTransformer\n};\n","import { animate, style, transition, trigger } from \"@angular/animations\";\nimport { Component, Input, ViewEncapsulation } from \"@angular/core\";\nimport { MatError } from \"@angular/material/form-field\";\n\n@Component({\n selector: \"nice-form-field-error\",\n template: `\n @if (message) {\n <div [@animation]=\"increment\">\n <mat-error>{{ message }}</mat-error>\n </div>\n }\n `,\n styleUrls: [\"./form-field-error.scss\"],\n animations: [\n trigger(\"animation\", [\n transition(\":increment\", [style({ opacity: 0 }), animate(\"200ms ease-in\", style({ opacity: 1 }))]),\n transition(\":enter\", [\n style({ opacity: 0, transform: \"translateY(-1rem)\" }),\n animate(\"200ms ease-in\", style({ opacity: 1, transform: \"translateY(0)\" }))\n ]),\n transition(\":leave\", [animate(\"200ms ease-out\", style({ opacity: 0, transform: \"translateY(-1rem)\" }))])\n ])\n ],\n encapsulation: ViewEncapsulation.None,\n imports: [\n MatError\n ]\n})\nexport class NiceFormErrorComponent {\n public message = \"\";\n public increment = 0;\n\n @Input()\n public set error(value: string) {\n if (value) {\n if (this.message !== value) {\n this.increment++;\n }\n }\n this.message = value;\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport const NICE_FORM_FIELD_ERROR_TRANSFORMERS = new InjectionToken(\"nice_form_field_error_transformers\");\nexport const NICE_FORM_FIELD_ERROR_TRANSLATER = new InjectionToken(\"nice_form_field_error_translater\");\n","import {\n AfterViewInit,\n ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n ViewContainerRef\n} from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { AbstractControlDirective, NgControl } from \"@angular/forms\";\nimport { MatFormField } from \"@angular/material/form-field\";\nimport { NiceTranslater } from \"@recursyve/ngx-material-components/common\";\nimport { combineLatest, startWith } from \"rxjs\";\n\nimport { NiceFormErrorComponent } from \"./form-field-error\";\nimport { ErrorTransformers } from \"./error-transformer\";\nimport { NICE_FORM_FIELD_ERROR_TRANSFORMERS, NICE_FORM_FIELD_ERROR_TRANSLATER } from \"./constant\";\n\n@Directive({ selector: \"[niceFormFieldError]\", standalone: true })\nexport class NiceFormFieldErrorDirective implements AfterViewInit {\n private readonly destroyRef = inject(DestroyRef);\n private readonly elementRef = inject(ElementRef);\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly formField = inject(MatFormField);\n private readonly transformers = inject<ErrorTransformers>(NICE_FORM_FIELD_ERROR_TRANSFORMERS);\n private readonly translater = inject<NiceTranslater>(NICE_FORM_FIELD_ERROR_TRANSLATER);\n\n private ref: ComponentRef<NiceFormErrorComponent> | null = null ;\n private control: NgControl | AbstractControlDirective | null = null;\n\n public onChange = () => {\n if (this.control === null || this.control.pending) {\n return;\n }\n\n if (this.control.valid || this.control.untouched) {\n this.setError(\"\", {});\n return;\n }\n\n for (const error in this.control.errors) {\n const details = this.control.errors[error];\n if (typeof details !== \"object\") {\n this.setError(`errors.${error}`, {});\n continue;\n }\n\n const transformer = this.transformers[error];\n if (!transformer) {\n this.setError(`errors.${error}`, {});\n continue;\n }\n\n const { key, params } = transformer(error, details);\n this.setError(`errors.${key}`, params ?? {});\n }\n }\n\n public ngAfterViewInit(): void {\n this.control = this.formField._control.ngControl;\n\n if (this.control !== null && this.control.statusChanges !== null) {\n combineLatest([\n this.formField._control.stateChanges,\n this.control.statusChanges.pipe(startWith(this.control.status))\n ])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.onChange());\n }\n }\n\n public setError(text: string, params: Record<string, string>): void {\n if (!this.ref) {\n this.ref = this.viewContainerRef.createComponent(NiceFormErrorComponent);\n if (this.elementRef.nativeElement.getElementsByClassName(\"mat-mdc-form-field-subscript-wrapper\").item(0)) {\n const hint = this.elementRef.nativeElement.getElementsByClassName(\"mat-mdc-form-field-hint\").item(0);\n (this.ref.location.nativeElement as HTMLDivElement).style.position = \"absolute\";\n (this.ref.location.nativeElement as HTMLDivElement).style.top = hint ? \"16px\" : \"0\";\n\n const wrapper = this.elementRef.nativeElement\n .getElementsByClassName(\"mat-mdc-form-field-subscript-wrapper\")\n .item(0);\n if (hint) {\n wrapper.classList.add(\"override-height\");\n }\n\n wrapper.prepend(this.ref.location.nativeElement);\n }\n }\n\n if (text) {\n this.elementRef.nativeElement.classList.add(\"form-error-show\");\n } else {\n this.elementRef.nativeElement.classList.remove(\"form-error-show\");\n }\n\n this.ref.instance.error = text.length > 0 ? this.translater(text, params) : text;\n }\n}\n","import { Provider } from \"@angular/core\";\nimport { NICE_FORM_FIELD_ERROR_TRANSFORMERS, NICE_FORM_FIELD_ERROR_TRANSLATER } from \"./constant\";\nimport { NiceFormFieldErrorsOptions } from \"./options\";\nimport { DefaultErrorTransformers } from \"./error-transformer\";\n\nexport function provideFormFieldError(options: NiceFormFieldErrorsOptions): Provider[] {\n return [\n {\n provide: NICE_FORM_FIELD_ERROR_TRANSFORMERS,\n useValue: {\n ...DefaultErrorTransformers,\n ...options.errorTransformers\n }\n },\n {\n provide: NICE_FORM_FIELD_ERROR_TRANSLATER,\n ...options.translater\n }\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAMa,uBAAuB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;AAClG,IAAA,IAAI,OAAO,CAAC,iBAAiB,CAAC,EAAE;QAC5B,OAAO;AACH,YAAA,GAAG,EAAE,OAAO,CAAC,iBAAiB;SACjC;;AAGL,IAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE;AACzB;MAEa,oBAAoB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;AAC/F,IAAA,IAAI,OAAO,CAAC,cAAc,CAAC,EAAE;QACzB,OAAO;AACH,YAAA,GAAG,EAAE,OAAO,CAAC,cAAc;SAC9B;;AAGL,IAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE;AACzB;MAEa,sBAAsB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;IACjG,OAAO;AACH,QAAA,GAAG,EAAE,KAAK;AACV,QAAA,MAAM,EAAE;AACJ,YAAA,KAAK,EAAE,OAAO,CAAC,gBAAgB;AAClC;KACJ;AACL;MAEa,mBAAmB,GAAqB,CAAC,KAAa,EAAE,OAAyB,KAAI;IAC9F,OAAO;AACH,QAAA,GAAG,EAAE,KAAK;AACV,QAAA,MAAM,EAAE;AACJ,YAAA,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC;AACnB,YAAA,MAAM,EAAE,OA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