@tectra-ng/ui 0.1.2 → 0.1.4
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/README.md +36 -19
- package/accordion/README.md +61 -0
- package/analog-clock/README.md +31 -0
- package/breadcrumb/README.md +57 -0
- package/countdown/README.md +45 -0
- package/datepicker/README.md +109 -0
- package/export/README.md +79 -0
- package/export-font/OFL.txt +93 -0
- package/export-font/README.md +7 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs +980 -0
- package/fesm2022/tectra-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs +386 -0
- package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-autocomplete.mjs +2 -2
- package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs +382 -0
- package/fesm2022/tectra-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-cascade-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-chips-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-color-picker.mjs +2 -2
- package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-countdown.mjs +513 -0
- package/fesm2022/tectra-ng-ui-countdown.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs +2640 -0
- package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs +7 -0
- package/fesm2022/tectra-ng-ui-export-font.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-export.mjs +2574 -0
- package/fesm2022/tectra-ng-ui-export.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-field.mjs +1 -1
- package/fesm2022/tectra-ng-ui-field.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-file-upload.mjs +1452 -0
- package/fesm2022/tectra-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-input-group.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input-group.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-input.mjs +2 -2
- package/fesm2022/tectra-ng-ui-input.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-label.mjs +4 -4
- package/fesm2022/tectra-ng-ui-label.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-listbox.mjs +2 -2
- package/fesm2022/tectra-ng-ui-listbox.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-menubar.mjs +742 -0
- package/fesm2022/tectra-ng-ui-menubar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs +601 -0
- package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-multiselect.mjs +2 -2
- package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-panel-menu.mjs +610 -0
- package/fesm2022/tectra-ng-ui-panel-menu.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs +319 -0
- package/fesm2022/tectra-ng-ui-scroll-panel.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-sparkline.mjs +240 -0
- package/fesm2022/tectra-ng-ui-sparkline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs +750 -0
- package/fesm2022/tectra-ng-ui-splitter.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs +661 -0
- package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs +1166 -0
- package/fesm2022/tectra-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-table.mjs +195 -71
- package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tabs.mjs +1218 -0
- package/fesm2022/tectra-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-textarea.mjs +4 -1
- package/fesm2022/tectra-ng-ui-textarea.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-timeline.mjs +407 -0
- package/fesm2022/tectra-ng-ui-timeline.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs +348 -0
- package/fesm2022/tectra-ng-ui-toolbar.mjs.map +1 -0
- package/fesm2022/tectra-ng-ui-tree-select.mjs +2 -2
- package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -1
- package/fesm2022/tectra-ng-ui-tree-table.mjs +80 -2
- package/fesm2022/tectra-ng-ui-tree-table.mjs.map +1 -1
- package/field/README.md +1 -1
- package/file-upload/README.md +85 -0
- package/menubar/README.md +51 -0
- package/month-calendar/README.md +46 -0
- package/package.json +80 -4
- package/panel-menu/README.md +45 -0
- package/scroll-panel/README.md +35 -0
- package/sparkline/README.md +27 -0
- package/splitter/README.md +62 -0
- package/stat-tiles/README.md +53 -0
- package/stepper/README.md +66 -0
- package/table/README.md +1 -1
- package/tabs/README.md +69 -0
- package/timeline/README.md +42 -0
- package/toolbar/README.md +35 -0
- package/types/tectra-ng-ui-accordion.d.ts +304 -0
- package/types/tectra-ng-ui-accordion.d.ts.map +1 -0
- package/types/tectra-ng-ui-analog-clock.d.ts +127 -0
- package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts +157 -0
- package/types/tectra-ng-ui-breadcrumb.d.ts.map +1 -0
- package/types/tectra-ng-ui-countdown.d.ts +150 -0
- package/types/tectra-ng-ui-countdown.d.ts.map +1 -0
- package/types/tectra-ng-ui-datepicker.d.ts +801 -0
- package/types/tectra-ng-ui-datepicker.d.ts.map +1 -0
- package/types/tectra-ng-ui-export-font.d.ts +5 -0
- package/types/tectra-ng-ui-export-font.d.ts.map +1 -0
- package/types/tectra-ng-ui-export.d.ts +427 -0
- package/types/tectra-ng-ui-export.d.ts.map +1 -0
- package/types/tectra-ng-ui-file-upload.d.ts +527 -0
- package/types/tectra-ng-ui-file-upload.d.ts.map +1 -0
- package/types/tectra-ng-ui-menubar.d.ts +201 -0
- package/types/tectra-ng-ui-menubar.d.ts.map +1 -0
- package/types/tectra-ng-ui-month-calendar.d.ts +287 -0
- package/types/tectra-ng-ui-month-calendar.d.ts.map +1 -0
- package/types/tectra-ng-ui-panel-menu.d.ts +244 -0
- package/types/tectra-ng-ui-panel-menu.d.ts.map +1 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts +94 -0
- package/types/tectra-ng-ui-scroll-panel.d.ts.map +1 -0
- package/types/tectra-ng-ui-sparkline.d.ts +80 -0
- package/types/tectra-ng-ui-sparkline.d.ts.map +1 -0
- package/types/tectra-ng-ui-splitter.d.ts +226 -0
- package/types/tectra-ng-ui-splitter.d.ts.map +1 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts +287 -0
- package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -0
- package/types/tectra-ng-ui-stepper.d.ts +446 -0
- package/types/tectra-ng-ui-stepper.d.ts.map +1 -0
- package/types/tectra-ng-ui-table.d.ts +2 -4
- package/types/tectra-ng-ui-table.d.ts.map +1 -1
- package/types/tectra-ng-ui-tabs.d.ts +420 -0
- package/types/tectra-ng-ui-tabs.d.ts.map +1 -0
- package/types/tectra-ng-ui-textarea.d.ts +1 -0
- package/types/tectra-ng-ui-textarea.d.ts.map +1 -1
- package/types/tectra-ng-ui-timeline.d.ts +129 -0
- package/types/tectra-ng-ui-timeline.d.ts.map +1 -0
- package/types/tectra-ng-ui-toolbar.d.ts +85 -0
- package/types/tectra-ng-ui-toolbar.d.ts.map +1 -0
- package/types/tectra-ng-ui-tree-table.d.ts.map +1 -1
|
@@ -0,0 +1,1452 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Directive, TemplateRef, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { HttpClient, HttpEventType, HttpHeaders } from "@angular/common/http";
|
|
5
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
6
|
+
import { TxAnnouncer, uniqueId } from "@tectra-ng/core/a11y";
|
|
7
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
8
|
+
import { TxFormControlBase, injectFieldInvalid } from "@tectra-ng/core/forms";
|
|
9
|
+
import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
|
|
10
|
+
import { optionalBoolean, optionalNumber } from "@tectra-ng/core/utils";
|
|
11
|
+
import { TxIcon } from "@tectra-ng/icons";
|
|
12
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
13
|
+
import { TxButton } from "@tectra-ng/ui/button";
|
|
14
|
+
import { TxField } from "@tectra-ng/ui/field";
|
|
15
|
+
var TxFileUploadFileTemplate = class TxFileUploadFileTemplate {
|
|
16
|
+
template = inject(TemplateRef);
|
|
17
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
18
|
+
return !!context;
|
|
19
|
+
}
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
21
|
+
minVersion: "12.0.0",
|
|
22
|
+
version: "22.2.3",
|
|
23
|
+
ngImport: i0,
|
|
24
|
+
type: TxFileUploadFileTemplate,
|
|
25
|
+
deps: [],
|
|
26
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
27
|
+
});
|
|
28
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
29
|
+
minVersion: "14.0.0",
|
|
30
|
+
version: "22.2.3",
|
|
31
|
+
type: TxFileUploadFileTemplate,
|
|
32
|
+
isStandalone: true,
|
|
33
|
+
selector: "ng-template[txFileUploadFile]",
|
|
34
|
+
ngImport: i0
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
38
|
+
minVersion: "12.0.0",
|
|
39
|
+
version: "22.2.3",
|
|
40
|
+
ngImport: i0,
|
|
41
|
+
type: TxFileUploadFileTemplate,
|
|
42
|
+
decorators: [{
|
|
43
|
+
type: Directive,
|
|
44
|
+
args: [{ selector: "ng-template[txFileUploadFile]" }]
|
|
45
|
+
}]
|
|
46
|
+
});
|
|
47
|
+
var TxFileUploadDropzoneTemplate = class TxFileUploadDropzoneTemplate {
|
|
48
|
+
template = inject(TemplateRef);
|
|
49
|
+
static ngTemplateContextGuard(_directive, context) {
|
|
50
|
+
return !!context;
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
53
|
+
minVersion: "12.0.0",
|
|
54
|
+
version: "22.2.3",
|
|
55
|
+
ngImport: i0,
|
|
56
|
+
type: TxFileUploadDropzoneTemplate,
|
|
57
|
+
deps: [],
|
|
58
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
59
|
+
});
|
|
60
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
61
|
+
minVersion: "14.0.0",
|
|
62
|
+
version: "22.2.3",
|
|
63
|
+
type: TxFileUploadDropzoneTemplate,
|
|
64
|
+
isStandalone: true,
|
|
65
|
+
selector: "ng-template[txFileUploadDropzone]",
|
|
66
|
+
ngImport: i0
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
70
|
+
minVersion: "12.0.0",
|
|
71
|
+
version: "22.2.3",
|
|
72
|
+
ngImport: i0,
|
|
73
|
+
type: TxFileUploadDropzoneTemplate,
|
|
74
|
+
decorators: [{
|
|
75
|
+
type: Directive,
|
|
76
|
+
args: [{ selector: "ng-template[txFileUploadDropzone]" }]
|
|
77
|
+
}]
|
|
78
|
+
});
|
|
79
|
+
var TxFileUploadActions = class TxFileUploadActions {
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
81
|
+
minVersion: "12.0.0",
|
|
82
|
+
version: "22.2.3",
|
|
83
|
+
ngImport: i0,
|
|
84
|
+
type: TxFileUploadActions,
|
|
85
|
+
deps: [],
|
|
86
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
87
|
+
});
|
|
88
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
89
|
+
minVersion: "14.0.0",
|
|
90
|
+
version: "22.2.3",
|
|
91
|
+
type: TxFileUploadActions,
|
|
92
|
+
isStandalone: true,
|
|
93
|
+
selector: "[txFileUploadActions]",
|
|
94
|
+
ngImport: i0
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "22.2.3",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: TxFileUploadActions,
|
|
102
|
+
decorators: [{
|
|
103
|
+
type: Directive,
|
|
104
|
+
args: [{ selector: "[txFileUploadActions]" }]
|
|
105
|
+
}]
|
|
106
|
+
});
|
|
107
|
+
const KINDS = {
|
|
108
|
+
pdf: ["pdf"],
|
|
109
|
+
sheet: [
|
|
110
|
+
"csv",
|
|
111
|
+
"tsv",
|
|
112
|
+
"xls",
|
|
113
|
+
"xlsx",
|
|
114
|
+
"ods",
|
|
115
|
+
"numbers"
|
|
116
|
+
],
|
|
117
|
+
document: [
|
|
118
|
+
"doc",
|
|
119
|
+
"docx",
|
|
120
|
+
"odt",
|
|
121
|
+
"rtf",
|
|
122
|
+
"txt",
|
|
123
|
+
"md",
|
|
124
|
+
"pages"
|
|
125
|
+
],
|
|
126
|
+
archive: [
|
|
127
|
+
"zip",
|
|
128
|
+
"rar",
|
|
129
|
+
"7z",
|
|
130
|
+
"tar",
|
|
131
|
+
"gz",
|
|
132
|
+
"tgz",
|
|
133
|
+
"bz2"
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
const TX_FILE_SIZE_UNITS = [
|
|
137
|
+
"byte",
|
|
138
|
+
"kilobyte",
|
|
139
|
+
"megabyte",
|
|
140
|
+
"gigabyte",
|
|
141
|
+
"terabyte"
|
|
142
|
+
];
|
|
143
|
+
function fileExtension(file) {
|
|
144
|
+
const dot = file.name.lastIndexOf(".");
|
|
145
|
+
return dot > 0 ? file.name.slice(dot + 1).toLowerCase() : "";
|
|
146
|
+
}
|
|
147
|
+
function fileKind(file) {
|
|
148
|
+
if (file.type.startsWith("image/")) return "image";
|
|
149
|
+
if (file.type.startsWith("video/") || file.type.startsWith("audio/")) return "media";
|
|
150
|
+
const extension = fileExtension(file);
|
|
151
|
+
return Object.keys(KINDS).find((kind) => KINDS[kind].includes(extension)) ?? (file.type === "application/pdf" ? "pdf" : "other");
|
|
152
|
+
}
|
|
153
|
+
function fileMatchesAccept(file, accept) {
|
|
154
|
+
const rules = (accept ?? "").split(",").map((rule) => rule.trim().toLowerCase()).filter(Boolean);
|
|
155
|
+
if (!rules.length) return true;
|
|
156
|
+
const type = file.type.toLowerCase();
|
|
157
|
+
const extension = `.${fileExtension(file)}`;
|
|
158
|
+
return rules.some((rule) => {
|
|
159
|
+
if (rule.startsWith(".")) return rule === extension;
|
|
160
|
+
if (rule.endsWith("/*")) return type.startsWith(rule.slice(0, -1));
|
|
161
|
+
return rule === type;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function fileSizeParts(bytes) {
|
|
165
|
+
let value = Math.max(0, bytes);
|
|
166
|
+
let index = 0;
|
|
167
|
+
while (value >= 1024 && index < TX_FILE_SIZE_UNITS.length - 1) {
|
|
168
|
+
value /= 1024;
|
|
169
|
+
index++;
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
value,
|
|
173
|
+
unit: TX_FILE_SIZE_UNITS[index]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function sameFile(a, b) {
|
|
177
|
+
return a.name === b.name && a.size === b.size && a.type === b.type && a.lastModified === b.lastModified;
|
|
178
|
+
}
|
|
179
|
+
function acceptLabel(accept) {
|
|
180
|
+
const labels = (accept ?? "").split(",").map((rule) => rule.trim()).filter(Boolean).map((rule) => {
|
|
181
|
+
if (rule.startsWith(".")) return rule.slice(1).toUpperCase();
|
|
182
|
+
const [type, subtype = ""] = rule.split("/");
|
|
183
|
+
return subtype === "*" ? `${type}/*` : subtype.replace(/^x-/, "").split(/[.+-]/).pop()?.toUpperCase() ?? rule;
|
|
184
|
+
});
|
|
185
|
+
return [...new Set(labels)].join(", ");
|
|
186
|
+
}
|
|
187
|
+
const KIND_ICONS = {
|
|
188
|
+
image: "image",
|
|
189
|
+
pdf: "file",
|
|
190
|
+
sheet: "file",
|
|
191
|
+
document: "file",
|
|
192
|
+
archive: "file",
|
|
193
|
+
media: "video",
|
|
194
|
+
other: "file"
|
|
195
|
+
};
|
|
196
|
+
var TxFileUpload = class TxFileUpload extends TxFormControlBase {
|
|
197
|
+
document = inject(DOCUMENT);
|
|
198
|
+
http = inject(HttpClient, { optional: true });
|
|
199
|
+
announcer = inject(TxAnnouncer);
|
|
200
|
+
localeService = inject(TxLocaleService);
|
|
201
|
+
field = inject(TxField, { optional: true });
|
|
202
|
+
mode = input("advanced", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
|
|
203
|
+
files = model([], ...ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []);
|
|
204
|
+
file = model(null, ...ngDevMode ? [{ debugName: "file" }] : /* istanbul ignore next */ []);
|
|
205
|
+
multiple = input(false, {
|
|
206
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
207
|
+
transform: booleanAttribute
|
|
208
|
+
});
|
|
209
|
+
accept = input(void 0, ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
|
|
210
|
+
maxFileSize = input(void 0, {
|
|
211
|
+
...ngDevMode ? { debugName: "maxFileSize" } : /* istanbul ignore next */ {},
|
|
212
|
+
transform: optionalNumber
|
|
213
|
+
});
|
|
214
|
+
fileLimit = input(void 0, {
|
|
215
|
+
...ngDevMode ? { debugName: "fileLimit" } : /* istanbul ignore next */ {},
|
|
216
|
+
transform: optionalNumber
|
|
217
|
+
});
|
|
218
|
+
disabledInput = input(false, {
|
|
219
|
+
...ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {},
|
|
220
|
+
alias: "disabled",
|
|
221
|
+
transform: booleanAttribute
|
|
222
|
+
});
|
|
223
|
+
invalid = input(void 0, {
|
|
224
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
225
|
+
transform: optionalBoolean
|
|
226
|
+
});
|
|
227
|
+
auto = input(false, {
|
|
228
|
+
...ngDevMode ? { debugName: "auto" } : /* istanbul ignore next */ {},
|
|
229
|
+
transform: booleanAttribute
|
|
230
|
+
});
|
|
231
|
+
url = input(void 0, ...ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []);
|
|
232
|
+
name = input("files", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
233
|
+
method = input("post", ...ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []);
|
|
234
|
+
headers = input(void 0, ...ngDevMode ? [{ debugName: "headers" }] : /* istanbul ignore next */ []);
|
|
235
|
+
withCredentials = input(false, {
|
|
236
|
+
...ngDevMode ? { debugName: "withCredentials" } : /* istanbul ignore next */ {},
|
|
237
|
+
transform: booleanAttribute
|
|
238
|
+
});
|
|
239
|
+
customUpload = input(false, {
|
|
240
|
+
...ngDevMode ? { debugName: "customUpload" } : /* istanbul ignore next */ {},
|
|
241
|
+
transform: booleanAttribute
|
|
242
|
+
});
|
|
243
|
+
description = input(void 0, ...ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []);
|
|
244
|
+
chooseLabel = input(void 0, ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
245
|
+
uploadLabel = input(void 0, ...ngDevMode ? [{ debugName: "uploadLabel" }] : /* istanbul ignore next */ []);
|
|
246
|
+
cancelLabel = input(void 0, ...ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []);
|
|
247
|
+
chooseIcon = input("plus", ...ngDevMode ? [{ debugName: "chooseIcon" }] : /* istanbul ignore next */ []);
|
|
248
|
+
uploadIcon = input("upload", ...ngDevMode ? [{ debugName: "uploadIcon" }] : /* istanbul ignore next */ []);
|
|
249
|
+
cancelIcon = input("times", ...ngDevMode ? [{ debugName: "cancelIcon" }] : /* istanbul ignore next */ []);
|
|
250
|
+
showUploadButton = input(true, {
|
|
251
|
+
...ngDevMode ? { debugName: "showUploadButton" } : /* istanbul ignore next */ {},
|
|
252
|
+
transform: booleanAttribute
|
|
253
|
+
});
|
|
254
|
+
showCancelButton = input(true, {
|
|
255
|
+
...ngDevMode ? { debugName: "showCancelButton" } : /* istanbul ignore next */ {},
|
|
256
|
+
transform: booleanAttribute
|
|
257
|
+
});
|
|
258
|
+
showMessages = input(true, {
|
|
259
|
+
...ngDevMode ? { debugName: "showMessages" } : /* istanbul ignore next */ {},
|
|
260
|
+
transform: booleanAttribute
|
|
261
|
+
});
|
|
262
|
+
invalidFileTypeMessage = input(void 0, ...ngDevMode ? [{ debugName: "invalidFileTypeMessage" }] : /* istanbul ignore next */ []);
|
|
263
|
+
invalidFileSizeMessage = input(void 0, ...ngDevMode ? [{ debugName: "invalidFileSizeMessage" }] : /* istanbul ignore next */ []);
|
|
264
|
+
invalidFileLimitMessage = input(void 0, ...ngDevMode ? [{ debugName: "invalidFileLimitMessage" }] : /* istanbul ignore next */ []);
|
|
265
|
+
ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
266
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
267
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
268
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
269
|
+
unstyled = input(void 0, {
|
|
270
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
271
|
+
transform: optionalBoolean
|
|
272
|
+
});
|
|
273
|
+
selected = output();
|
|
274
|
+
removed = output();
|
|
275
|
+
cleared = output();
|
|
276
|
+
rejected = output();
|
|
277
|
+
beforeUpload = output();
|
|
278
|
+
uploadProgress = output();
|
|
279
|
+
uploaded = output();
|
|
280
|
+
uploadFailed = output();
|
|
281
|
+
uploadHandler = output();
|
|
282
|
+
uploadedFileRemoved = output();
|
|
283
|
+
translations = injectTranslations();
|
|
284
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
285
|
+
isInvalid = injectFieldInvalid(this.invalid);
|
|
286
|
+
passThrough = injectPassThrough("fileUpload", this, this.pt, this.ptOptions);
|
|
287
|
+
fileTemplate = contentChild(TxFileUploadFileTemplate, ...ngDevMode ? [{ debugName: "fileTemplate" }] : /* istanbul ignore next */ []);
|
|
288
|
+
dropzoneTemplate = contentChild(TxFileUploadDropzoneTemplate, ...ngDevMode ? [{ debugName: "dropzoneTemplate" }] : /* istanbul ignore next */ []);
|
|
289
|
+
actions = contentChild(TxFileUploadActions, ...ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []);
|
|
290
|
+
inputElement = viewChild("input", ...ngDevMode ? [{ debugName: "inputElement" }] : /* istanbul ignore next */ []);
|
|
291
|
+
id = uniqueId("tx-file-upload");
|
|
292
|
+
entries = signal([], ...ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []);
|
|
293
|
+
uploadedEntries = signal([], ...ngDevMode ? [{ debugName: "uploadedEntries" }] : /* istanbul ignore next */ []);
|
|
294
|
+
messages = signal([], ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
|
|
295
|
+
dragging = signal(false, ...ngDevMode ? [{ debugName: "dragging" }] : /* istanbul ignore next */ []);
|
|
296
|
+
isDisabled = computed(() => this.disabled() || this.disabledInput(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
297
|
+
uploading = computed(() => this.entries().some((entry) => entry.status === "uploading"), ...ngDevMode ? [{ debugName: "uploading" }] : /* istanbul ignore next */ []);
|
|
298
|
+
rows = computed(() => [...this.entries(), ...this.uploadedEntries()].sort((a, b) => (this.order.get(a.id) ?? 0) - (this.order.get(b.id) ?? 0)), ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
|
|
299
|
+
current = computed(() => this.entries()[0] ?? this.uploadedEntries().at(-1) ?? null, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
300
|
+
hasTarget = computed(() => !!this.url() || this.customUpload(), ...ngDevMode ? [{ debugName: "hasTarget" }] : /* istanbul ignore next */ []);
|
|
301
|
+
waiting = computed(() => this.entries().filter((entry) => entry.status === "pending" || entry.status === "failed"), ...ngDevMode ? [{ debugName: "waiting" }] : /* istanbul ignore next */ []);
|
|
302
|
+
limitReached = computed(() => {
|
|
303
|
+
const limit = this.fileLimit();
|
|
304
|
+
return this.multiple() && limit !== void 0 && this.entries().length + this.uploadedEntries().length >= limit;
|
|
305
|
+
}, ...ngDevMode ? [{ debugName: "limitReached" }] : /* istanbul ignore next */ []);
|
|
306
|
+
showFooter = computed(() => this.mode() === "advanced" && (!!this.actions() || this.hasTarget() && !this.auto() && this.showUploadButton() && this.waiting().length > 0), ...ngDevMode ? [{ debugName: "showFooter" }] : /* istanbul ignore next */ []);
|
|
307
|
+
prompt = computed(() => {
|
|
308
|
+
const t = this.translations();
|
|
309
|
+
const [before, after = ""] = (this.multiple() ? t.fileUploadPrompt : t.fileUploadPromptSingle).split("{browse}");
|
|
310
|
+
return {
|
|
311
|
+
before,
|
|
312
|
+
link: this.chooseLabel() ?? t.fileUploadBrowse,
|
|
313
|
+
after
|
|
314
|
+
};
|
|
315
|
+
}, ...ngDevMode ? [{ debugName: "prompt" }] : /* istanbul ignore next */ []);
|
|
316
|
+
summary = computed(() => {
|
|
317
|
+
const waiting = this.waiting();
|
|
318
|
+
const size = this.formatSize(waiting.reduce((sum, entry) => sum + entry.file.size, 0));
|
|
319
|
+
return this.translations().filesSummary.replace("{count}", String(waiting.length)).replace("{size}", size);
|
|
320
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
321
|
+
basicLabel = computed(() => {
|
|
322
|
+
const entries = this.rows();
|
|
323
|
+
const t = this.translations();
|
|
324
|
+
if (!entries.length) return t.noFileChosen;
|
|
325
|
+
return entries.length === 1 ? entries[0].file.name : t.filesChosen.replace("{count}", String(entries.length));
|
|
326
|
+
}, ...ngDevMode ? [{ debugName: "basicLabel" }] : /* istanbul ignore next */ []);
|
|
327
|
+
zoneLabelledBy = computed(() => {
|
|
328
|
+
if (this.ariaLabel()) return null;
|
|
329
|
+
const own = !this.multiple() && this.current() ? `${this.id}-prompt` : `${this.id}-content`;
|
|
330
|
+
return [this.field?.label() ? this.field.labelId : null, own].filter(Boolean).join(" ");
|
|
331
|
+
}, ...ngDevMode ? [{ debugName: "zoneLabelledBy" }] : /* istanbul ignore next */ []);
|
|
332
|
+
chooseText = computed(() => this.chooseLabel() ?? (this.multiple() ? this.translations().chooseFiles : this.translations().chooseFile), ...ngDevMode ? [{ debugName: "chooseText" }] : /* istanbul ignore next */ []);
|
|
333
|
+
hostStyle = computed(() => ({
|
|
334
|
+
...toStyleObject(this.dt(), "--tx-file-upload"),
|
|
335
|
+
...this.passThrough().root?.style
|
|
336
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
337
|
+
chooseFiles = () => this.choose();
|
|
338
|
+
order = /* @__PURE__ */ new Map();
|
|
339
|
+
dragDepth = 0;
|
|
340
|
+
messageId = 0;
|
|
341
|
+
abort = null;
|
|
342
|
+
constructor() {
|
|
343
|
+
super();
|
|
344
|
+
effect(() => {
|
|
345
|
+
const files = this.files();
|
|
346
|
+
untracked(() => this.adopt(files));
|
|
347
|
+
});
|
|
348
|
+
effect(() => {
|
|
349
|
+
const file = this.file();
|
|
350
|
+
untracked(() => {
|
|
351
|
+
if (!this.multiple() && (this.files()[0] ?? null) !== file) this.files.set(file ? [file] : []);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
inject(DestroyRef).onDestroy(() => {
|
|
355
|
+
this.abort?.();
|
|
356
|
+
[...this.entries(), ...this.uploadedEntries()].forEach((entry) => this.revoke(entry));
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
writeValue(value) {
|
|
360
|
+
super.writeValue(value);
|
|
361
|
+
const files = value === null || value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
362
|
+
this.files.set(files);
|
|
363
|
+
this.file.set(this.multiple() ? null : files[0] ?? null);
|
|
364
|
+
}
|
|
365
|
+
choose() {
|
|
366
|
+
if (!this.isDisabled()) this.inputElement()?.nativeElement.click();
|
|
367
|
+
}
|
|
368
|
+
upload() {
|
|
369
|
+
const waiting = this.waiting();
|
|
370
|
+
if (!waiting.length || this.uploading()) return;
|
|
371
|
+
const ids = new Set(waiting.map((entry) => entry.id));
|
|
372
|
+
this.patch(ids, {
|
|
373
|
+
status: "uploading",
|
|
374
|
+
progress: 0,
|
|
375
|
+
error: null
|
|
376
|
+
});
|
|
377
|
+
const files = waiting.map((entry) => entry.file);
|
|
378
|
+
if (this.customUpload()) {
|
|
379
|
+
this.uploadHandler.emit({
|
|
380
|
+
files,
|
|
381
|
+
progress: (value, file) => this.patch(this.idsOf(ids, file), { progress: this.clampProgress(value) }),
|
|
382
|
+
complete: (file) => this.finish(this.idsOf(ids, file), null),
|
|
383
|
+
fail: (message, file) => this.fail(this.idsOf(ids, file), message ?? this.translations().fileFailed, null)
|
|
384
|
+
});
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const url = this.url();
|
|
388
|
+
if (url) this.send(url, ids, files);
|
|
389
|
+
}
|
|
390
|
+
clear() {
|
|
391
|
+
this.abort?.();
|
|
392
|
+
this.abort = null;
|
|
393
|
+
this.entries().forEach((entry) => this.revoke(entry));
|
|
394
|
+
this.entries.set([]);
|
|
395
|
+
this.messages.set([]);
|
|
396
|
+
this.commit();
|
|
397
|
+
this.cleared.emit();
|
|
398
|
+
}
|
|
399
|
+
onInputChange(event) {
|
|
400
|
+
const input = event.target;
|
|
401
|
+
this.add(Array.from(input.files ?? []), event);
|
|
402
|
+
input.value = "";
|
|
403
|
+
this.markTouched();
|
|
404
|
+
}
|
|
405
|
+
onZoneClick(event) {
|
|
406
|
+
if (!this.fromSelectedCard(event)) this.choose();
|
|
407
|
+
}
|
|
408
|
+
onZoneKeydown(event) {
|
|
409
|
+
if (event.target !== event.currentTarget || this.fromSelectedCard(event)) return;
|
|
410
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
411
|
+
event.preventDefault();
|
|
412
|
+
this.choose();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
onDragEnter(event) {
|
|
416
|
+
if (!this.acceptsDrag(event)) return;
|
|
417
|
+
event.preventDefault();
|
|
418
|
+
this.dragDepth++;
|
|
419
|
+
this.dragging.set(true);
|
|
420
|
+
}
|
|
421
|
+
onDragOver(event) {
|
|
422
|
+
if (!this.acceptsDrag(event)) return;
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
|
|
425
|
+
}
|
|
426
|
+
onDragLeave(event) {
|
|
427
|
+
if (!this.dragging()) return;
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
this.dragDepth = Math.max(0, this.dragDepth - 1);
|
|
430
|
+
if (this.dragDepth === 0) this.dragging.set(false);
|
|
431
|
+
}
|
|
432
|
+
onDrop(event) {
|
|
433
|
+
this.dragDepth = 0;
|
|
434
|
+
this.dragging.set(false);
|
|
435
|
+
if (this.isDisabled()) return;
|
|
436
|
+
event.preventDefault();
|
|
437
|
+
const files = Array.from(event.dataTransfer?.files ?? []);
|
|
438
|
+
if (files.length) {
|
|
439
|
+
this.add(files, event);
|
|
440
|
+
this.markTouched();
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
remove(event, entry) {
|
|
444
|
+
this.revoke(entry);
|
|
445
|
+
if (this.uploadedEntries().includes(entry)) {
|
|
446
|
+
this.uploadedEntries.update((entries) => entries.filter((item) => item !== entry));
|
|
447
|
+
this.uploadedFileRemoved.emit({
|
|
448
|
+
file: entry.file,
|
|
449
|
+
files: this.uploadedEntries().map((item) => item.file)
|
|
450
|
+
});
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
this.entries.update((entries) => entries.filter((item) => item !== entry));
|
|
454
|
+
this.messages.update((messages) => messages.filter((message) => !this.isLimitMessage(message)));
|
|
455
|
+
this.commit();
|
|
456
|
+
this.removed.emit({
|
|
457
|
+
originalEvent: event,
|
|
458
|
+
file: entry.file
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
retry(entry) {
|
|
462
|
+
this.patch(/* @__PURE__ */ new Set([entry.id]), {
|
|
463
|
+
status: "pending",
|
|
464
|
+
progress: 0,
|
|
465
|
+
error: null
|
|
466
|
+
});
|
|
467
|
+
this.upload();
|
|
468
|
+
}
|
|
469
|
+
dismiss(message) {
|
|
470
|
+
this.messages.update((messages) => messages.filter((item) => item !== message));
|
|
471
|
+
}
|
|
472
|
+
fileContext(entry, index) {
|
|
473
|
+
return {
|
|
474
|
+
$implicit: entry,
|
|
475
|
+
index,
|
|
476
|
+
remove: (event) => this.remove(event, entry)
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
kindIcon(kind) {
|
|
480
|
+
return KIND_ICONS[kind];
|
|
481
|
+
}
|
|
482
|
+
meta(entry) {
|
|
483
|
+
const t = this.translations();
|
|
484
|
+
const size = this.formatSize(entry.file.size);
|
|
485
|
+
switch (entry.status) {
|
|
486
|
+
case "uploading": return `${size} · ${t.fileUploading.replace("{progress}", String(Math.round(entry.progress)))}`;
|
|
487
|
+
case "uploaded": return `${size} · ${t.fileUploaded}`;
|
|
488
|
+
case "failed": return `${size} · ${entry.error ?? t.fileFailed}`;
|
|
489
|
+
default: return this.hasTarget() && !this.auto() ? `${size} · ${t.fileReady}` : size;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
removeLabel(entry) {
|
|
493
|
+
return this.translations().removeItem.replace("{item}", entry.file.name);
|
|
494
|
+
}
|
|
495
|
+
formatSize(bytes) {
|
|
496
|
+
const { value, unit } = fileSizeParts(bytes);
|
|
497
|
+
return this.localeService.formatNumber(value, {
|
|
498
|
+
style: "unit",
|
|
499
|
+
unit,
|
|
500
|
+
unitDisplay: "short",
|
|
501
|
+
maximumFractionDigits: unit === "byte" ? 0 : 1
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
add(files, event) {
|
|
505
|
+
if (this.isDisabled() || !files.length) return;
|
|
506
|
+
const multiple = this.multiple();
|
|
507
|
+
const candidates = multiple ? files : files.slice(0, 1);
|
|
508
|
+
const kept = multiple ? this.entries() : [];
|
|
509
|
+
const limit = this.fileLimit();
|
|
510
|
+
const room = multiple && limit !== void 0 ? Math.max(0, limit - kept.length - this.uploadedEntries().length) : Infinity;
|
|
511
|
+
const accepted = [];
|
|
512
|
+
const rejections = [];
|
|
513
|
+
for (const file of candidates) {
|
|
514
|
+
if ([...kept.map((entry) => entry.file), ...accepted].some((other) => sameFile(other, file))) continue;
|
|
515
|
+
const reason = this.validate(file);
|
|
516
|
+
if (reason) rejections.push({
|
|
517
|
+
file,
|
|
518
|
+
reason,
|
|
519
|
+
message: this.rejectionText(reason, file)
|
|
520
|
+
});
|
|
521
|
+
else if (accepted.length >= room) rejections.push({
|
|
522
|
+
file,
|
|
523
|
+
reason: "limit",
|
|
524
|
+
message: this.rejectionText("limit", file)
|
|
525
|
+
});
|
|
526
|
+
else accepted.push(file);
|
|
527
|
+
}
|
|
528
|
+
const limitMessages = rejections.filter((rejection) => rejection.reason === "limit").slice(0, 1);
|
|
529
|
+
const shown = [...rejections.filter((rejection) => rejection.reason !== "limit"), ...limitMessages];
|
|
530
|
+
this.messages.set(this.showMessages() ? shown.map((rejection) => ({
|
|
531
|
+
id: ++this.messageId,
|
|
532
|
+
text: rejection.message
|
|
533
|
+
})) : []);
|
|
534
|
+
if (rejections.length) {
|
|
535
|
+
this.rejected.emit(rejections);
|
|
536
|
+
this.announcer.announce(shown.map((rejection) => rejection.message).join(". "), "assertive");
|
|
537
|
+
}
|
|
538
|
+
if (!accepted.length) return;
|
|
539
|
+
if (!multiple) this.entries().forEach((entry) => this.revoke(entry));
|
|
540
|
+
this.entries.set([...kept, ...accepted.map((file) => this.toEntry(file))]);
|
|
541
|
+
this.commit();
|
|
542
|
+
this.selected.emit({
|
|
543
|
+
originalEvent: event,
|
|
544
|
+
files: accepted,
|
|
545
|
+
currentFiles: this.files()
|
|
546
|
+
});
|
|
547
|
+
this.announcer.announce(this.translations().filesAdded.replace("{names}", accepted.map((file) => file.name).join(", ")));
|
|
548
|
+
if (this.auto() && this.hasTarget()) this.upload();
|
|
549
|
+
}
|
|
550
|
+
validate(file) {
|
|
551
|
+
if (!fileMatchesAccept(file, this.accept())) return "type";
|
|
552
|
+
const max = this.maxFileSize();
|
|
553
|
+
return max !== void 0 && max > 0 && file.size > max ? "size" : null;
|
|
554
|
+
}
|
|
555
|
+
rejectionText(reason, file) {
|
|
556
|
+
const t = this.translations();
|
|
557
|
+
return {
|
|
558
|
+
type: this.invalidFileTypeMessage() ?? t.invalidFileType,
|
|
559
|
+
size: this.invalidFileSizeMessage() ?? t.invalidFileSize,
|
|
560
|
+
limit: this.invalidFileLimitMessage() ?? t.invalidFileLimit
|
|
561
|
+
}[reason].replace("{name}", file.name).replace("{types}", acceptLabel(this.accept())).replace("{size}", this.formatSize(this.maxFileSize() ?? 0)).replace("{limit}", String(this.fileLimit() ?? ""));
|
|
562
|
+
}
|
|
563
|
+
isLimitMessage(message) {
|
|
564
|
+
const limit = String(this.fileLimit() ?? "");
|
|
565
|
+
return message.text === (this.invalidFileLimitMessage() ?? this.translations().invalidFileLimit).replace("{limit}", limit);
|
|
566
|
+
}
|
|
567
|
+
adopt(files) {
|
|
568
|
+
const entries = this.entries();
|
|
569
|
+
if (files.length === entries.length && files.every((file, index) => file === entries[index].file)) return;
|
|
570
|
+
const next = files.map((file) => entries.find((entry) => entry.file === file) ?? this.toEntry(file));
|
|
571
|
+
entries.filter((entry) => !next.includes(entry)).forEach((entry) => this.revoke(entry));
|
|
572
|
+
this.entries.set(next);
|
|
573
|
+
}
|
|
574
|
+
commit() {
|
|
575
|
+
const files = this.entries().map((entry) => entry.file);
|
|
576
|
+
this.files.set(files);
|
|
577
|
+
const single = files[0] ?? null;
|
|
578
|
+
if (!this.multiple()) this.file.set(single);
|
|
579
|
+
this.updateValue(this.multiple() ? files : single);
|
|
580
|
+
}
|
|
581
|
+
toEntry(file) {
|
|
582
|
+
const kind = fileKind(file);
|
|
583
|
+
const view = this.document.defaultView;
|
|
584
|
+
const preview = kind === "image" && view?.URL?.createObjectURL ? view.URL.createObjectURL(file) : null;
|
|
585
|
+
const id = uniqueId("tx-file");
|
|
586
|
+
this.order.set(id, this.order.size);
|
|
587
|
+
return {
|
|
588
|
+
id,
|
|
589
|
+
file,
|
|
590
|
+
kind,
|
|
591
|
+
extension: fileExtension(file),
|
|
592
|
+
preview,
|
|
593
|
+
status: "pending",
|
|
594
|
+
progress: 0,
|
|
595
|
+
error: null
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
revoke(entry) {
|
|
599
|
+
this.order.delete(entry.id);
|
|
600
|
+
if (entry.preview) this.document.defaultView?.URL?.revokeObjectURL?.(entry.preview);
|
|
601
|
+
}
|
|
602
|
+
patch(ids, changes) {
|
|
603
|
+
this.entries.update((entries) => entries.map((entry) => ids.has(entry.id) ? {
|
|
604
|
+
...entry,
|
|
605
|
+
...changes
|
|
606
|
+
} : entry));
|
|
607
|
+
if (changes.progress !== void 0 && changes.status === void 0) this.uploadProgress.emit({ progress: changes.progress });
|
|
608
|
+
}
|
|
609
|
+
idsOf(ids, file) {
|
|
610
|
+
if (!file) return ids;
|
|
611
|
+
const entry = this.entries().find((item) => item.file === file && ids.has(item.id));
|
|
612
|
+
return new Set(entry ? [entry.id] : []);
|
|
613
|
+
}
|
|
614
|
+
finish(ids, originalEvent) {
|
|
615
|
+
const done = this.entries().filter((entry) => ids.has(entry.id) && entry.status === "uploading");
|
|
616
|
+
if (!done.length) return;
|
|
617
|
+
this.entries.update((entries) => entries.filter((entry) => !done.includes(entry)));
|
|
618
|
+
this.uploadedEntries.update((entries) => [...entries, ...done.map((entry) => ({
|
|
619
|
+
...entry,
|
|
620
|
+
status: "uploaded",
|
|
621
|
+
progress: 100
|
|
622
|
+
}))]);
|
|
623
|
+
this.commit();
|
|
624
|
+
const files = done.map((entry) => entry.file);
|
|
625
|
+
this.uploaded.emit({
|
|
626
|
+
originalEvent,
|
|
627
|
+
files
|
|
628
|
+
});
|
|
629
|
+
this.announcer.announce(this.translations().filesUploaded);
|
|
630
|
+
}
|
|
631
|
+
fail(ids, message, error) {
|
|
632
|
+
const failed = this.entries().filter((entry) => ids.has(entry.id) && entry.status === "uploading");
|
|
633
|
+
if (!failed.length) return;
|
|
634
|
+
this.patch(new Set(failed.map((entry) => entry.id)), {
|
|
635
|
+
status: "failed",
|
|
636
|
+
error: message
|
|
637
|
+
});
|
|
638
|
+
this.uploadFailed.emit({
|
|
639
|
+
files: failed.map((entry) => entry.file),
|
|
640
|
+
error
|
|
641
|
+
});
|
|
642
|
+
this.announcer.announce(message, "assertive");
|
|
643
|
+
}
|
|
644
|
+
send(url, ids, files) {
|
|
645
|
+
const formData = new FormData();
|
|
646
|
+
this.beforeUpload.emit({ formData });
|
|
647
|
+
files.forEach((file) => formData.append(this.name(), file, file.name));
|
|
648
|
+
const failText = this.translations().fileFailed;
|
|
649
|
+
if (this.http) {
|
|
650
|
+
const headers = this.headers();
|
|
651
|
+
const subscription = this.http.request(this.method().toUpperCase(), url, {
|
|
652
|
+
body: formData,
|
|
653
|
+
headers: headers instanceof HttpHeaders ? headers : new HttpHeaders(headers ?? {}),
|
|
654
|
+
reportProgress: true,
|
|
655
|
+
observe: "events",
|
|
656
|
+
withCredentials: this.withCredentials()
|
|
657
|
+
}).subscribe({
|
|
658
|
+
next: (event) => {
|
|
659
|
+
if (event.type === HttpEventType.UploadProgress && event.total) this.patch(ids, { progress: this.clampProgress(event.loaded * 100 / event.total) });
|
|
660
|
+
else if (event.type === HttpEventType.Response) {
|
|
661
|
+
this.abort = null;
|
|
662
|
+
if (event.ok) this.finish(ids, event);
|
|
663
|
+
else this.fail(ids, failText, event);
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
error: (error) => {
|
|
667
|
+
this.abort = null;
|
|
668
|
+
this.fail(ids, failText, error);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
this.abort = () => subscription.unsubscribe();
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
const request = new XMLHttpRequest();
|
|
675
|
+
request.open(this.method().toUpperCase(), url);
|
|
676
|
+
request.withCredentials = this.withCredentials();
|
|
677
|
+
const headers = this.headers();
|
|
678
|
+
if (headers instanceof HttpHeaders) headers.keys().forEach((key) => request.setRequestHeader(key, headers.get(key) ?? ""));
|
|
679
|
+
else Object.entries(headers ?? {}).forEach(([key, value]) => request.setRequestHeader(key, value));
|
|
680
|
+
request.upload.onprogress = (event) => {
|
|
681
|
+
if (event.lengthComputable) this.patch(ids, { progress: this.clampProgress(event.loaded * 100 / event.total) });
|
|
682
|
+
};
|
|
683
|
+
request.onload = () => {
|
|
684
|
+
this.abort = null;
|
|
685
|
+
if (request.status >= 200 && request.status < 300) this.finish(ids, request);
|
|
686
|
+
else this.fail(ids, failText, request);
|
|
687
|
+
};
|
|
688
|
+
request.onerror = () => {
|
|
689
|
+
this.abort = null;
|
|
690
|
+
this.fail(ids, failText, request);
|
|
691
|
+
};
|
|
692
|
+
request.send(formData);
|
|
693
|
+
this.abort = () => request.abort();
|
|
694
|
+
}
|
|
695
|
+
clampProgress(value) {
|
|
696
|
+
return Math.round(Math.min(100, Math.max(0, value)));
|
|
697
|
+
}
|
|
698
|
+
fromSelectedCard(event) {
|
|
699
|
+
const target = event.target;
|
|
700
|
+
return !this.multiple() && this.current() !== null || !!target?.closest?.(".tx-file-upload__selected");
|
|
701
|
+
}
|
|
702
|
+
acceptsDrag(event) {
|
|
703
|
+
return !this.isDisabled() && !!event.dataTransfer && Array.from(event.dataTransfer.types).includes("Files");
|
|
704
|
+
}
|
|
705
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
706
|
+
minVersion: "12.0.0",
|
|
707
|
+
version: "22.2.3",
|
|
708
|
+
ngImport: i0,
|
|
709
|
+
type: TxFileUpload,
|
|
710
|
+
deps: [],
|
|
711
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
712
|
+
});
|
|
713
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
714
|
+
minVersion: "17.0.0",
|
|
715
|
+
version: "22.2.3",
|
|
716
|
+
type: TxFileUpload,
|
|
717
|
+
isStandalone: true,
|
|
718
|
+
selector: "tx-file-upload",
|
|
719
|
+
inputs: {
|
|
720
|
+
mode: {
|
|
721
|
+
classPropertyName: "mode",
|
|
722
|
+
publicName: "mode",
|
|
723
|
+
isSignal: true,
|
|
724
|
+
isRequired: false,
|
|
725
|
+
transformFunction: null
|
|
726
|
+
},
|
|
727
|
+
files: {
|
|
728
|
+
classPropertyName: "files",
|
|
729
|
+
publicName: "files",
|
|
730
|
+
isSignal: true,
|
|
731
|
+
isRequired: false,
|
|
732
|
+
transformFunction: null
|
|
733
|
+
},
|
|
734
|
+
file: {
|
|
735
|
+
classPropertyName: "file",
|
|
736
|
+
publicName: "file",
|
|
737
|
+
isSignal: true,
|
|
738
|
+
isRequired: false,
|
|
739
|
+
transformFunction: null
|
|
740
|
+
},
|
|
741
|
+
multiple: {
|
|
742
|
+
classPropertyName: "multiple",
|
|
743
|
+
publicName: "multiple",
|
|
744
|
+
isSignal: true,
|
|
745
|
+
isRequired: false,
|
|
746
|
+
transformFunction: null
|
|
747
|
+
},
|
|
748
|
+
accept: {
|
|
749
|
+
classPropertyName: "accept",
|
|
750
|
+
publicName: "accept",
|
|
751
|
+
isSignal: true,
|
|
752
|
+
isRequired: false,
|
|
753
|
+
transformFunction: null
|
|
754
|
+
},
|
|
755
|
+
maxFileSize: {
|
|
756
|
+
classPropertyName: "maxFileSize",
|
|
757
|
+
publicName: "maxFileSize",
|
|
758
|
+
isSignal: true,
|
|
759
|
+
isRequired: false,
|
|
760
|
+
transformFunction: null
|
|
761
|
+
},
|
|
762
|
+
fileLimit: {
|
|
763
|
+
classPropertyName: "fileLimit",
|
|
764
|
+
publicName: "fileLimit",
|
|
765
|
+
isSignal: true,
|
|
766
|
+
isRequired: false,
|
|
767
|
+
transformFunction: null
|
|
768
|
+
},
|
|
769
|
+
disabledInput: {
|
|
770
|
+
classPropertyName: "disabledInput",
|
|
771
|
+
publicName: "disabled",
|
|
772
|
+
isSignal: true,
|
|
773
|
+
isRequired: false,
|
|
774
|
+
transformFunction: null
|
|
775
|
+
},
|
|
776
|
+
invalid: {
|
|
777
|
+
classPropertyName: "invalid",
|
|
778
|
+
publicName: "invalid",
|
|
779
|
+
isSignal: true,
|
|
780
|
+
isRequired: false,
|
|
781
|
+
transformFunction: null
|
|
782
|
+
},
|
|
783
|
+
auto: {
|
|
784
|
+
classPropertyName: "auto",
|
|
785
|
+
publicName: "auto",
|
|
786
|
+
isSignal: true,
|
|
787
|
+
isRequired: false,
|
|
788
|
+
transformFunction: null
|
|
789
|
+
},
|
|
790
|
+
url: {
|
|
791
|
+
classPropertyName: "url",
|
|
792
|
+
publicName: "url",
|
|
793
|
+
isSignal: true,
|
|
794
|
+
isRequired: false,
|
|
795
|
+
transformFunction: null
|
|
796
|
+
},
|
|
797
|
+
name: {
|
|
798
|
+
classPropertyName: "name",
|
|
799
|
+
publicName: "name",
|
|
800
|
+
isSignal: true,
|
|
801
|
+
isRequired: false,
|
|
802
|
+
transformFunction: null
|
|
803
|
+
},
|
|
804
|
+
method: {
|
|
805
|
+
classPropertyName: "method",
|
|
806
|
+
publicName: "method",
|
|
807
|
+
isSignal: true,
|
|
808
|
+
isRequired: false,
|
|
809
|
+
transformFunction: null
|
|
810
|
+
},
|
|
811
|
+
headers: {
|
|
812
|
+
classPropertyName: "headers",
|
|
813
|
+
publicName: "headers",
|
|
814
|
+
isSignal: true,
|
|
815
|
+
isRequired: false,
|
|
816
|
+
transformFunction: null
|
|
817
|
+
},
|
|
818
|
+
withCredentials: {
|
|
819
|
+
classPropertyName: "withCredentials",
|
|
820
|
+
publicName: "withCredentials",
|
|
821
|
+
isSignal: true,
|
|
822
|
+
isRequired: false,
|
|
823
|
+
transformFunction: null
|
|
824
|
+
},
|
|
825
|
+
customUpload: {
|
|
826
|
+
classPropertyName: "customUpload",
|
|
827
|
+
publicName: "customUpload",
|
|
828
|
+
isSignal: true,
|
|
829
|
+
isRequired: false,
|
|
830
|
+
transformFunction: null
|
|
831
|
+
},
|
|
832
|
+
description: {
|
|
833
|
+
classPropertyName: "description",
|
|
834
|
+
publicName: "description",
|
|
835
|
+
isSignal: true,
|
|
836
|
+
isRequired: false,
|
|
837
|
+
transformFunction: null
|
|
838
|
+
},
|
|
839
|
+
chooseLabel: {
|
|
840
|
+
classPropertyName: "chooseLabel",
|
|
841
|
+
publicName: "chooseLabel",
|
|
842
|
+
isSignal: true,
|
|
843
|
+
isRequired: false,
|
|
844
|
+
transformFunction: null
|
|
845
|
+
},
|
|
846
|
+
uploadLabel: {
|
|
847
|
+
classPropertyName: "uploadLabel",
|
|
848
|
+
publicName: "uploadLabel",
|
|
849
|
+
isSignal: true,
|
|
850
|
+
isRequired: false,
|
|
851
|
+
transformFunction: null
|
|
852
|
+
},
|
|
853
|
+
cancelLabel: {
|
|
854
|
+
classPropertyName: "cancelLabel",
|
|
855
|
+
publicName: "cancelLabel",
|
|
856
|
+
isSignal: true,
|
|
857
|
+
isRequired: false,
|
|
858
|
+
transformFunction: null
|
|
859
|
+
},
|
|
860
|
+
chooseIcon: {
|
|
861
|
+
classPropertyName: "chooseIcon",
|
|
862
|
+
publicName: "chooseIcon",
|
|
863
|
+
isSignal: true,
|
|
864
|
+
isRequired: false,
|
|
865
|
+
transformFunction: null
|
|
866
|
+
},
|
|
867
|
+
uploadIcon: {
|
|
868
|
+
classPropertyName: "uploadIcon",
|
|
869
|
+
publicName: "uploadIcon",
|
|
870
|
+
isSignal: true,
|
|
871
|
+
isRequired: false,
|
|
872
|
+
transformFunction: null
|
|
873
|
+
},
|
|
874
|
+
cancelIcon: {
|
|
875
|
+
classPropertyName: "cancelIcon",
|
|
876
|
+
publicName: "cancelIcon",
|
|
877
|
+
isSignal: true,
|
|
878
|
+
isRequired: false,
|
|
879
|
+
transformFunction: null
|
|
880
|
+
},
|
|
881
|
+
showUploadButton: {
|
|
882
|
+
classPropertyName: "showUploadButton",
|
|
883
|
+
publicName: "showUploadButton",
|
|
884
|
+
isSignal: true,
|
|
885
|
+
isRequired: false,
|
|
886
|
+
transformFunction: null
|
|
887
|
+
},
|
|
888
|
+
showCancelButton: {
|
|
889
|
+
classPropertyName: "showCancelButton",
|
|
890
|
+
publicName: "showCancelButton",
|
|
891
|
+
isSignal: true,
|
|
892
|
+
isRequired: false,
|
|
893
|
+
transformFunction: null
|
|
894
|
+
},
|
|
895
|
+
showMessages: {
|
|
896
|
+
classPropertyName: "showMessages",
|
|
897
|
+
publicName: "showMessages",
|
|
898
|
+
isSignal: true,
|
|
899
|
+
isRequired: false,
|
|
900
|
+
transformFunction: null
|
|
901
|
+
},
|
|
902
|
+
invalidFileTypeMessage: {
|
|
903
|
+
classPropertyName: "invalidFileTypeMessage",
|
|
904
|
+
publicName: "invalidFileTypeMessage",
|
|
905
|
+
isSignal: true,
|
|
906
|
+
isRequired: false,
|
|
907
|
+
transformFunction: null
|
|
908
|
+
},
|
|
909
|
+
invalidFileSizeMessage: {
|
|
910
|
+
classPropertyName: "invalidFileSizeMessage",
|
|
911
|
+
publicName: "invalidFileSizeMessage",
|
|
912
|
+
isSignal: true,
|
|
913
|
+
isRequired: false,
|
|
914
|
+
transformFunction: null
|
|
915
|
+
},
|
|
916
|
+
invalidFileLimitMessage: {
|
|
917
|
+
classPropertyName: "invalidFileLimitMessage",
|
|
918
|
+
publicName: "invalidFileLimitMessage",
|
|
919
|
+
isSignal: true,
|
|
920
|
+
isRequired: false,
|
|
921
|
+
transformFunction: null
|
|
922
|
+
},
|
|
923
|
+
ariaLabel: {
|
|
924
|
+
classPropertyName: "ariaLabel",
|
|
925
|
+
publicName: "ariaLabel",
|
|
926
|
+
isSignal: true,
|
|
927
|
+
isRequired: false,
|
|
928
|
+
transformFunction: null
|
|
929
|
+
},
|
|
930
|
+
dt: {
|
|
931
|
+
classPropertyName: "dt",
|
|
932
|
+
publicName: "dt",
|
|
933
|
+
isSignal: true,
|
|
934
|
+
isRequired: false,
|
|
935
|
+
transformFunction: null
|
|
936
|
+
},
|
|
937
|
+
pt: {
|
|
938
|
+
classPropertyName: "pt",
|
|
939
|
+
publicName: "pt",
|
|
940
|
+
isSignal: true,
|
|
941
|
+
isRequired: false,
|
|
942
|
+
transformFunction: null
|
|
943
|
+
},
|
|
944
|
+
ptOptions: {
|
|
945
|
+
classPropertyName: "ptOptions",
|
|
946
|
+
publicName: "ptOptions",
|
|
947
|
+
isSignal: true,
|
|
948
|
+
isRequired: false,
|
|
949
|
+
transformFunction: null
|
|
950
|
+
},
|
|
951
|
+
unstyled: {
|
|
952
|
+
classPropertyName: "unstyled",
|
|
953
|
+
publicName: "unstyled",
|
|
954
|
+
isSignal: true,
|
|
955
|
+
isRequired: false,
|
|
956
|
+
transformFunction: null
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
outputs: {
|
|
960
|
+
files: "filesChange",
|
|
961
|
+
file: "fileChange",
|
|
962
|
+
selected: "selected",
|
|
963
|
+
removed: "removed",
|
|
964
|
+
cleared: "cleared",
|
|
965
|
+
rejected: "rejected",
|
|
966
|
+
beforeUpload: "beforeUpload",
|
|
967
|
+
uploadProgress: "uploadProgress",
|
|
968
|
+
uploaded: "uploaded",
|
|
969
|
+
uploadFailed: "uploadFailed",
|
|
970
|
+
uploadHandler: "uploadHandler",
|
|
971
|
+
uploadedFileRemoved: "uploadedFileRemoved"
|
|
972
|
+
},
|
|
973
|
+
host: {
|
|
974
|
+
properties: {
|
|
975
|
+
"class": "passThrough().root?.class",
|
|
976
|
+
"style": "hostStyle()",
|
|
977
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
978
|
+
"attr.data-mode": "mode()",
|
|
979
|
+
"class.tx-file-upload--disabled": "isDisabled()",
|
|
980
|
+
"class.tx-file-upload--invalid": "isInvalid()",
|
|
981
|
+
"class.tx-file-upload--dragging": "dragging()",
|
|
982
|
+
"class.tx-file-upload--filled": "rows().length > 0"
|
|
983
|
+
},
|
|
984
|
+
classAttribute: "tx-file-upload"
|
|
985
|
+
},
|
|
986
|
+
providers: [{
|
|
987
|
+
provide: NG_VALUE_ACCESSOR,
|
|
988
|
+
useExisting: forwardRef(() => TxFileUpload),
|
|
989
|
+
multi: true
|
|
990
|
+
}],
|
|
991
|
+
queries: [
|
|
992
|
+
{
|
|
993
|
+
propertyName: "fileTemplate",
|
|
994
|
+
first: true,
|
|
995
|
+
predicate: TxFileUploadFileTemplate,
|
|
996
|
+
descendants: true,
|
|
997
|
+
isSignal: true
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
propertyName: "dropzoneTemplate",
|
|
1001
|
+
first: true,
|
|
1002
|
+
predicate: TxFileUploadDropzoneTemplate,
|
|
1003
|
+
descendants: true,
|
|
1004
|
+
isSignal: true
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
propertyName: "actions",
|
|
1008
|
+
first: true,
|
|
1009
|
+
predicate: TxFileUploadActions,
|
|
1010
|
+
descendants: true,
|
|
1011
|
+
isSignal: true
|
|
1012
|
+
}
|
|
1013
|
+
],
|
|
1014
|
+
viewQueries: [{
|
|
1015
|
+
propertyName: "inputElement",
|
|
1016
|
+
first: true,
|
|
1017
|
+
predicate: ["input"],
|
|
1018
|
+
descendants: true,
|
|
1019
|
+
isSignal: true
|
|
1020
|
+
}],
|
|
1021
|
+
usesInheritance: true,
|
|
1022
|
+
ngImport: i0,
|
|
1023
|
+
template: "<input\n #input\n type=\"file\"\n class=\"tx-file-upload__input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept() ?? ''\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n (change)=\"onInputChange($event)\"\n/>\n\n<ng-template #thumbnail let-entry let-large=\"large\">\n <span\n class=\"tx-file-upload__thumbnail\"\n aria-hidden=\"true\"\n [attr.data-kind]=\"entry.kind\"\n [attr.data-size]=\"large ? 'large' : null\"\n [class]=\"passThrough().thumbnail?.class\"\n [style]=\"passThrough().thumbnail?.style\"\n >\n @if (entry.preview) {\n <img class=\"tx-file-upload__preview\" alt=\"\" [src]=\"entry.preview\" />\n } @else {\n <tx-icon class=\"tx-file-upload__kind\" [name]=\"kindIcon(entry.kind)\" />\n @if (entry.extension) {\n <span class=\"tx-file-upload__extension\">{{ entry.extension }}</span>\n }\n }\n </span>\n</ng-template>\n\n<ng-template #progress let-entry>\n <span\n class=\"tx-file-upload__progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"entry.progress\"\n [attr.aria-label]=\"entry.file.name\"\n [class]=\"passThrough().progress?.class\"\n [style]=\"passThrough().progress?.style\"\n >\n <span class=\"tx-file-upload__progress-value\" [style.width.%]=\"entry.progress\"></span>\n </span>\n</ng-template>\n\n<ng-template #messageList>\n @if (messages().length) {\n <div class=\"tx-file-upload__messages\">\n @for (message of messages(); track message.id) {\n <div\n class=\"tx-file-upload__message\"\n animate.enter=\"tx-file-upload--enter\"\n animate.leave=\"tx-file-upload--leave\"\n [class]=\"passThrough().message?.class\"\n [style]=\"passThrough().message?.style\"\n >\n <tx-icon class=\"tx-file-upload__message-icon\" name=\"exclamation-circle\" />\n <span class=\"tx-file-upload__message-text\">{{ message.text }}</span>\n <button type=\"button\" class=\"tx-file-upload__dismiss\" [attr.aria-label]=\"translations().close\" (click)=\"dismiss(message)\">\n <tx-icon name=\"times\" />\n </button>\n </div>\n }\n </div>\n }\n</ng-template>\n\n@if (mode() === 'basic') {\n <div class=\"tx-file-upload__basic\" [class]=\"passThrough().basic?.class\" [style]=\"passThrough().basic?.style\">\n <button\n txButton\n type=\"button\"\n severity=\"secondary\"\n outlined\n [icon]=\"chooseIcon()\"\n [disabled]=\"isDisabled() || uploading()\"\n [attr.aria-describedby]=\"id + '-label'\"\n (click)=\"choose()\"\n >\n {{ chooseText() }}\n </button>\n @if (hasTarget() && !auto() && showUploadButton() && waiting().length) {\n <button txButton type=\"button\" [icon]=\"uploadIcon()\" [loading]=\"uploading()\" (click)=\"upload()\">\n {{ uploadLabel() ?? translations().upload }}\n </button>\n }\n <span class=\"tx-file-upload__basic-label\" [id]=\"id + '-label'\">\n {{ basicLabel() }}\n @if (rows().length === 1 && rows()[0].status !== 'pending') {\n · {{ meta(rows()[0]) }}\n }\n </span>\n </div>\n <ng-container [ngTemplateOutlet]=\"messageList\" />\n} @else {\n <div\n class=\"tx-file-upload__zone\"\n data-tx-field-control\n [attr.data-state]=\"!multiple() && current() ? 'selected' : 'empty'\"\n [attr.role]=\"!multiple() && current() ? 'group' : 'button'\"\n [attr.tabindex]=\"!multiple() && current() ? null : isDisabled() || limitReached() ? -1 : 0\"\n [attr.aria-disabled]=\"!multiple() && current() ? null : isDisabled() || limitReached() || null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"zoneLabelledBy()\"\n [attr.aria-describedby]=\"!multiple() && current() && description() ? id + '-hint' : null\"\n [attr.aria-invalid]=\"isInvalid() || null\"\n [class]=\"passThrough().dropzone?.class\"\n [style]=\"passThrough().dropzone?.style\"\n (click)=\"onZoneClick($event)\"\n (keydown)=\"onZoneKeydown($event)\"\n (blur)=\"markTouched()\"\n (dragenter)=\"onDragEnter($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n >\n <svg class=\"tx-file-upload__outline\" aria-hidden=\"true\" focusable=\"false\"><rect class=\"tx-file-upload__outline-rect\" /></svg>\n @if (!multiple() && current(); as entry) {\n <div class=\"tx-file-upload__selected\" animate.enter=\"tx-file-upload--enter\">\n @if (fileTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"fileContext(entry, 0)\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"thumbnail\" [ngTemplateOutletContext]=\"{ $implicit: entry, large: true }\" />\n <span class=\"tx-file-upload__selected-info\">\n <span\n class=\"tx-file-upload__name\"\n [id]=\"id + '-prompt'\"\n [title]=\"entry.file.name\"\n [class]=\"passThrough().fileName?.class\"\n [style]=\"passThrough().fileName?.style\"\n >{{ entry.file.name }}</span\n >\n <span\n class=\"tx-file-upload__meta\"\n [attr.data-status]=\"entry.status\"\n [class]=\"passThrough().fileMeta?.class\"\n [style]=\"passThrough().fileMeta?.style\"\n >\n @if (entry.status === 'uploaded') {\n <tx-icon class=\"tx-file-upload__status-icon\" name=\"check-circle\" />\n }\n {{ meta(entry) }}\n </span>\n </span>\n @if (entry.status === 'uploading') {\n <ng-container [ngTemplateOutlet]=\"progress\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n <span class=\"tx-file-upload__selected-actions\">\n @if (entry.status === 'failed') {\n <button txButton type=\"button\" size=\"small\" text severity=\"secondary\" icon=\"refresh\" (click)=\"retry(entry)\">{{ translations().retry }}</button>\n }\n @if (hasTarget() && !auto() && showUploadButton() && entry.status === 'pending') {\n <button txButton type=\"button\" size=\"small\" [icon]=\"uploadIcon()\" (click)=\"upload()\">{{ uploadLabel() ?? translations().upload }}</button>\n }\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n severity=\"secondary\"\n icon=\"sync\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"choose()\"\n >\n {{ translations().replace }}\n </button>\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n severity=\"danger\"\n icon=\"trash\"\n [attr.aria-label]=\"removeLabel(entry)\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"remove($event, entry)\"\n >\n {{ translations().remove }}\n </button>\n </span>\n }\n </div>\n } @else {\n <span class=\"tx-file-upload__content\" [id]=\"id + '-content'\">\n @if (dropzoneTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: dragging(), choose: chooseFiles }\" />\n } @else {\n <span class=\"tx-file-upload__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n <tx-icon class=\"tx-file-upload__glyph\" [name]=\"dragging() ? 'arrow-down' : 'cloud-upload'\" />\n </span>\n <span class=\"tx-file-upload__prompt\" [class]=\"passThrough().prompt?.class\" [style]=\"passThrough().prompt?.style\">\n @if (dragging()) {\n {{ translations().fileUploadRelease }}\n } @else {\n {{ prompt().before }}<span class=\"tx-file-upload__link\">{{ prompt().link }}</span>{{ prompt().after }}\n }\n </span>\n @if (description()) {\n <span class=\"tx-file-upload__hint\" [id]=\"id + '-hint'\" [class]=\"passThrough().hint?.class\" [style]=\"passThrough().hint?.style\">{{ description() }}</span>\n }\n }\n </span>\n }\n </div>\n\n @if (!multiple() && current() && description()) {\n <span class=\"tx-file-upload__hint tx-file-upload__hint--below\" [id]=\"id + '-hint'\">{{ description() }}</span>\n }\n\n <ng-container [ngTemplateOutlet]=\"messageList\" />\n\n @if (multiple() && rows().length) {\n <ul class=\"tx-file-upload__list\" [class]=\"passThrough().list?.class\" [style]=\"passThrough().list?.style\">\n @for (entry of rows(); track entry.id; let index = $index) {\n <li\n class=\"tx-file-upload__file\"\n animate.enter=\"tx-file-upload--enter\"\n animate.leave=\"tx-file-upload--leave\"\n [attr.data-status]=\"entry.status\"\n [class]=\"passThrough().file?.class\"\n [style]=\"passThrough().file?.style\"\n >\n @if (fileTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"fileContext(entry, index)\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"thumbnail\" [ngTemplateOutletContext]=\"{ $implicit: entry, large: false }\" />\n <span class=\"tx-file-upload__info\">\n <span class=\"tx-file-upload__name\" [title]=\"entry.file.name\" [class]=\"passThrough().fileName?.class\" [style]=\"passThrough().fileName?.style\">{{ entry.file.name }}</span>\n <span class=\"tx-file-upload__meta\" [attr.data-status]=\"entry.status\" [class]=\"passThrough().fileMeta?.class\" [style]=\"passThrough().fileMeta?.style\">\n @if (entry.status === 'uploaded') {\n <tx-icon class=\"tx-file-upload__status-icon\" name=\"check-circle\" />\n }\n {{ meta(entry) }}\n </span>\n @if (entry.status === 'uploading') {\n <ng-container [ngTemplateOutlet]=\"progress\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </span>\n @if (entry.status === 'failed') {\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n rounded\n severity=\"secondary\"\n icon=\"refresh\"\n iconOnly\n [attr.aria-label]=\"translations().retry + ' ' + entry.file.name\"\n (click)=\"retry(entry)\"\n ></button>\n }\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n rounded\n severity=\"secondary\"\n [icon]=\"cancelIcon()\"\n iconOnly\n class=\"tx-file-upload__remove\"\n [attr.aria-label]=\"removeLabel(entry)\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"remove($event, entry)\"\n ></button>\n }\n </li>\n }\n </ul>\n }\n\n @if (showFooter()) {\n <div class=\"tx-file-upload__footer\" [class]=\"passThrough().footer?.class\" [style]=\"passThrough().footer?.style\">\n <ng-content select=\"[txFileUploadActions]\" />\n @if (hasTarget() && !auto() && showUploadButton() && waiting().length) {\n <span class=\"tx-file-upload__summary\">{{ summary() }}</span>\n <span class=\"tx-file-upload__footer-buttons\">\n @if (showCancelButton()) {\n <button txButton type=\"button\" size=\"small\" text severity=\"secondary\" [icon]=\"cancelIcon()\" (click)=\"clear()\">\n {{ cancelLabel() ?? translations().clear }}\n </button>\n }\n <button txButton type=\"button\" size=\"small\" [icon]=\"uploadIcon()\" [loading]=\"uploading()\" (click)=\"upload()\">\n {{ uploadLabel() ?? translations().upload }}\n </button>\n </span>\n }\n </div>\n }\n}\n",
|
|
1024
|
+
styles: [":host{display:flex;flex-direction:column;min-width:0}.tx-file-upload__input{display:none}.tx-file-upload__zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;text-align:center;isolation:isolate}.tx-file-upload__outline{position:absolute;inset:0;z-index:-1;width:100%;height:100%;overflow:visible;pointer-events:none}.tx-file-upload__outline-rect{fill:none}.tx-file-upload__icon,.tx-file-upload__thumbnail{display:inline-flex;flex-shrink:0;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}.tx-file-upload__preview{width:100%;height:100%;object-fit:cover}.tx-file-upload__content{display:flex;flex-direction:column;align-items:center;min-width:0}.tx-file-upload__selected{display:flex;flex-direction:column;align-items:center;width:100%;min-width:0}.tx-file-upload__selected-info,.tx-file-upload__info{display:flex;flex-direction:column;min-width:0;max-width:100%}.tx-file-upload__info{flex:1 1 auto}.tx-file-upload__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tx-file-upload__meta{display:inline-flex;align-items:center}.tx-file-upload__selected-actions,.tx-file-upload__footer-buttons{display:flex;flex-wrap:wrap;align-items:center;justify-content:center}.tx-file-upload__list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.tx-file-upload__file{display:flex;align-items:center;min-width:0}.tx-file-upload__progress{display:block;overflow:hidden}.tx-file-upload__progress-value{display:block;height:100%}.tx-file-upload__messages{display:flex;flex-direction:column}.tx-file-upload__message{display:flex;align-items:flex-start}.tx-file-upload__message-text{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}.tx-file-upload__dismiss{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.tx-file-upload__footer,.tx-file-upload__basic{display:flex;flex-wrap:wrap;align-items:center;min-width:0}.tx-file-upload__footer-buttons{margin-inline-start:auto}.tx-file-upload__basic-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-styled]){--_duration: var(--tx-file-upload-transition-duration);--_easing: var(--tx-file-upload-easing);gap:var(--tx-file-upload-gap);color:var(--tx-file-upload-color);font-family:var(--tx-font-family);font-size:var(--tx-file-upload-font-size);line-height:1.45}:host([data-styled]) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-border-color);--_fill: var(--tx-file-upload-dropzone-background);--_border: var(--tx-file-upload-dropzone-border-width);--_radius: var(--tx-file-upload-dropzone-border-radius);gap:var(--tx-file-upload-dropzone-gap);min-height:var(--tx-file-upload-dropzone-min-height);padding:var(--tx-file-upload-dropzone-padding);border-radius:var(--_radius);outline:var(--tx-file-upload-focus-ring-width) solid transparent;outline-offset:var(--tx-file-upload-focus-ring-offset);background:var(--_fill);cursor:pointer;transition:background-color var(--_duration) var(--_easing),outline-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__outline-rect{x:calc(var(--_border) / 2);y:calc(var(--_border) / 2);width:calc(100% - var(--_border));height:calc(100% - var(--_border));rx:calc(var(--_radius) - var(--_border) / 2);stroke:var(--_stroke);stroke-width:var(--_border);stroke-dasharray:var(--tx-file-upload-dropzone-dash);transition:stroke var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__zone:focus-visible{outline-color:var(--tx-file-upload-focus-ring-color)}:host([data-styled]:not(.tx-file-upload--disabled)) .tx-file-upload__zone[data-state=empty]:not([aria-disabled]):hover{--_stroke: var(--tx-file-upload-dropzone-hover-border-color);--_fill: var(--tx-file-upload-dropzone-hover-background)}:host([data-styled].tx-file-upload--invalid) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-invalid-border-color)}:host([data-styled]) .tx-file-upload__zone[data-state=selected]{--_stroke: var(--tx-file-upload-selected-border-color);--_fill: var(--tx-file-upload-selected-background);cursor:default}:host([data-styled]) .tx-file-upload__zone[data-state=selected] .tx-file-upload__outline-rect{stroke-dasharray:none}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-active-border-color);--_fill: var(--tx-file-upload-dropzone-active-background)}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__outline-rect{stroke-dasharray:var(--tx-file-upload-dropzone-dash);animation:tx-file-upload-march calc(var(--_duration) * 3) linear infinite}:host([data-styled]) .tx-file-upload__zone[aria-disabled],:host([data-styled].tx-file-upload--disabled) .tx-file-upload__zone{cursor:not-allowed}:host([data-styled].tx-file-upload--disabled) .tx-file-upload__zone{opacity:var(--tx-file-upload-dropzone-disabled-opacity)}:host([data-styled]) .tx-file-upload__icon{width:var(--tx-file-upload-icon-size);height:var(--tx-file-upload-icon-size);border-radius:var(--tx-file-upload-icon-border-radius);background:var(--tx-file-upload-icon-background);color:var(--tx-file-upload-icon-color);font-size:var(--tx-file-upload-icon-glyph-size);transition:transform var(--_duration) var(--_easing),box-shadow var(--_duration) var(--_easing)}:host([data-styled]:not(.tx-file-upload--disabled)) .tx-file-upload__zone:not([aria-disabled]):hover .tx-file-upload__icon,:host([data-styled]) .tx-file-upload__zone:focus-visible .tx-file-upload__icon{box-shadow:var(--tx-file-upload-icon-hover-shadow);transform:translateY(var(--tx-file-upload-icon-lift))}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__icon{box-shadow:var(--tx-file-upload-icon-hover-shadow);transform:translateY(var(--tx-file-upload-icon-lift)) scale(1.06)}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__glyph{animation:tx-file-upload-drop calc(var(--_duration) * 5) var(--_easing) infinite}:host([data-styled]) .tx-file-upload__prompt{font-weight:var(--tx-file-upload-prompt-font-weight)}:host([data-styled]) .tx-file-upload__link{color:var(--tx-file-upload-prompt-link-color);font-weight:var(--tx-file-upload-prompt-link-font-weight);text-decoration:underline transparent;text-underline-offset:3px;transition:text-decoration-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__zone:hover .tx-file-upload__link{text-decoration-color:currentColor}:host([data-styled]) .tx-file-upload__hint{max-width:44ch;color:var(--tx-file-upload-hint-color);font-size:var(--tx-file-upload-hint-font-size)}:host([data-styled]) .tx-file-upload__zone .tx-file-upload__hint{margin-top:calc(var(--tx-file-upload-dropzone-gap) * -.5)}:host([data-styled]) .tx-file-upload__hint--below{max-width:none;margin-top:calc(var(--tx-file-upload-gap) * -.5)}:host([data-styled]) .tx-file-upload__content{gap:var(--tx-file-upload-dropzone-gap)}:host([data-styled]) .tx-file-upload__selected{gap:var(--tx-file-upload-selected-gap)}:host([data-styled]) .tx-file-upload__selected-info{align-items:center}:host([data-styled]) .tx-file-upload__selected .tx-file-upload__progress{width:min(var(--tx-file-upload-selected-progress-width),100%)}:host([data-styled]) .tx-file-upload__selected-actions,:host([data-styled]) .tx-file-upload__footer-buttons{gap:var(--tx-file-upload-selected-actions-gap)}:host([data-styled]) .tx-file-upload__list{gap:var(--tx-file-upload-list-gap)}:host([data-styled]) .tx-file-upload__file{gap:var(--tx-file-upload-file-gap);padding:var(--tx-file-upload-file-padding);border:1px solid var(--tx-file-upload-file-border-color);border-radius:var(--tx-file-upload-file-border-radius);background:var(--tx-file-upload-file-background)}:host([data-styled]) .tx-file-upload__name{font-weight:var(--tx-file-upload-file-name-font-weight)}:host([data-styled]) .tx-file-upload__meta{gap:var(--tx-file-upload-file-meta-gap);color:var(--tx-file-upload-file-meta-color);font-size:var(--tx-file-upload-file-meta-font-size)}:host([data-styled]) .tx-file-upload__meta[data-status=uploaded]{color:var(--tx-file-upload-file-success-color)}:host([data-styled]) .tx-file-upload__meta[data-status=failed]{color:var(--tx-file-upload-file-error-color)}:host([data-styled]) .tx-file-upload__thumbnail{--_tone: var(--tx-file-upload-thumbnail-color);gap:1px;width:var(--tx-file-upload-thumbnail-size);height:var(--tx-file-upload-thumbnail-size);border-radius:var(--tx-file-upload-thumbnail-border-radius);background:var(--tx-file-upload-thumbnail-background);color:var(--_tone);font-size:var(--tx-file-upload-thumbnail-glyph-size)}:host([data-styled]) .tx-file-upload__thumbnail:not([data-kind=other]){background:color-mix(in srgb,var(--_tone) var(--tx-file-upload-thumbnail-tint),var(--tx-file-upload-file-background))}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=image],:host([data-styled]) .tx-file-upload__thumbnail[data-kind=media]{--_tone: var(--tx-file-upload-thumbnail-image-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=document]{--_tone: var(--tx-file-upload-thumbnail-document-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=pdf]{--_tone: var(--tx-file-upload-thumbnail-pdf-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=sheet]{--_tone: var(--tx-file-upload-thumbnail-sheet-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=archive]{--_tone: var(--tx-file-upload-thumbnail-archive-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-size=large]{width:var(--tx-file-upload-thumbnail-large-size);height:var(--tx-file-upload-thumbnail-large-size);border-radius:var(--tx-file-upload-thumbnail-large-border-radius);font-size:var(--tx-file-upload-thumbnail-large-glyph-size)}:host([data-styled]) .tx-file-upload__extension{max-width:100%;overflow:hidden;font-size:var(--tx-file-upload-thumbnail-extension-font-size);font-weight:var(--tx-font-weight-semibold);letter-spacing:.04em;line-height:1;text-overflow:clip;text-transform:uppercase;white-space:nowrap}:host([data-styled]) .tx-file-upload__thumbnail[data-size=large] .tx-file-upload__extension{font-size:var(--tx-file-upload-thumbnail-large-extension-font-size)}:host([data-styled]) .tx-file-upload__progress{height:var(--tx-file-upload-progress-height);margin-top:var(--tx-file-upload-progress-margin-top);border-radius:var(--tx-radius-full);background:var(--tx-file-upload-progress-background)}:host([data-styled]) .tx-file-upload__progress-value{border-radius:inherit;background:var(--tx-file-upload-progress-color);transition:width var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__messages{gap:var(--tx-file-upload-list-gap)}:host([data-styled]) .tx-file-upload__message{gap:var(--tx-file-upload-message-gap);padding:var(--tx-file-upload-message-padding);border-radius:var(--tx-file-upload-message-border-radius);background:var(--tx-file-upload-message-background);color:var(--tx-file-upload-message-color);font-size:var(--tx-file-upload-message-font-size)}:host([data-styled]) .tx-file-upload__message-icon{flex-shrink:0;margin-top:.15em}:host([data-styled]) .tx-file-upload__dismiss{width:1.45em;height:1.45em;margin:-.1em -.25em -.1em 0;border-radius:var(--tx-radius-full);outline:var(--tx-file-upload-focus-ring-width) solid transparent;outline-offset:1px;opacity:.75;transition:opacity var(--_duration) var(--_easing),background-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__dismiss:hover{background:color-mix(in srgb,currentColor 12%,transparent);opacity:1}:host([data-styled]) .tx-file-upload__dismiss:focus-visible{outline-color:var(--tx-file-upload-focus-ring-color);opacity:1}:host([data-styled]) .tx-file-upload__footer{gap:var(--tx-file-upload-footer-gap)}:host([data-styled]) .tx-file-upload__summary{color:var(--tx-file-upload-footer-summary-color);font-size:var(--tx-file-upload-footer-summary-font-size)}:host([data-styled]) .tx-file-upload__basic{gap:var(--tx-file-upload-basic-gap)}:host([data-styled]) .tx-file-upload__basic-label{color:var(--tx-file-upload-basic-label-color);font-size:var(--tx-file-upload-basic-label-font-size)}:host([data-styled]) .tx-file-upload--enter{animation:tx-file-upload-in var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload--leave{animation:tx-file-upload-in calc(var(--_duration) * .8) ease-in reverse forwards}@keyframes tx-file-upload-in{0%{opacity:0;transform:translateY(4px) scale(.98)}}@keyframes tx-file-upload-march{to{stroke-dashoffset:calc(var(--tx-file-upload-dropzone-dash-period) * -1)}}@keyframes tx-file-upload-drop{0%,to{transform:translateY(-1px)}50%{transform:translateY(2px)}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-file-upload__zone,:host([data-styled]) .tx-file-upload__outline-rect,:host([data-styled]) .tx-file-upload__icon,:host([data-styled]) .tx-file-upload__link,:host([data-styled]) .tx-file-upload__progress-value,:host([data-styled]) .tx-file-upload__dismiss{transition:none}:host([data-styled]) .tx-file-upload--enter,:host([data-styled]) .tx-file-upload--leave,:host([data-styled].tx-file-upload--dragging) .tx-file-upload__outline-rect,:host([data-styled].tx-file-upload--dragging) .tx-file-upload__glyph{animation:none}:host([data-styled]) .tx-file-upload__icon{transform:none!important}}\n"],
|
|
1025
|
+
dependencies: [
|
|
1026
|
+
{
|
|
1027
|
+
kind: "directive",
|
|
1028
|
+
type: NgTemplateOutlet,
|
|
1029
|
+
selector: "[ngTemplateOutlet]",
|
|
1030
|
+
inputs: [
|
|
1031
|
+
"ngTemplateOutletContext",
|
|
1032
|
+
"ngTemplateOutlet",
|
|
1033
|
+
"ngTemplateOutletInjector"
|
|
1034
|
+
]
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
kind: "component",
|
|
1038
|
+
type: TxIcon,
|
|
1039
|
+
selector: "tx-icon",
|
|
1040
|
+
inputs: ["name"]
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
kind: "component",
|
|
1044
|
+
type: TxButton,
|
|
1045
|
+
selector: "button[txButton], a[txButton]",
|
|
1046
|
+
inputs: [
|
|
1047
|
+
"label",
|
|
1048
|
+
"severity",
|
|
1049
|
+
"size",
|
|
1050
|
+
"variant",
|
|
1051
|
+
"outlined",
|
|
1052
|
+
"text",
|
|
1053
|
+
"link",
|
|
1054
|
+
"rounded",
|
|
1055
|
+
"raised",
|
|
1056
|
+
"plain",
|
|
1057
|
+
"fluid",
|
|
1058
|
+
"disabled",
|
|
1059
|
+
"tabindex",
|
|
1060
|
+
"icon",
|
|
1061
|
+
"iconPos",
|
|
1062
|
+
"iconOnly",
|
|
1063
|
+
"loading",
|
|
1064
|
+
"loadingIcon",
|
|
1065
|
+
"badge",
|
|
1066
|
+
"badgeSeverity",
|
|
1067
|
+
"dt",
|
|
1068
|
+
"pt",
|
|
1069
|
+
"ptOptions",
|
|
1070
|
+
"unstyled"
|
|
1071
|
+
]
|
|
1072
|
+
}
|
|
1073
|
+
],
|
|
1074
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1075
|
+
});
|
|
1076
|
+
};
|
|
1077
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1078
|
+
minVersion: "12.0.0",
|
|
1079
|
+
version: "22.2.3",
|
|
1080
|
+
ngImport: i0,
|
|
1081
|
+
type: TxFileUpload,
|
|
1082
|
+
decorators: [{
|
|
1083
|
+
type: Component,
|
|
1084
|
+
args: [{
|
|
1085
|
+
selector: "tx-file-upload",
|
|
1086
|
+
imports: [
|
|
1087
|
+
NgTemplateOutlet,
|
|
1088
|
+
TxIcon,
|
|
1089
|
+
TxButton
|
|
1090
|
+
],
|
|
1091
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1092
|
+
providers: [{
|
|
1093
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1094
|
+
useExisting: forwardRef(() => TxFileUpload),
|
|
1095
|
+
multi: true
|
|
1096
|
+
}],
|
|
1097
|
+
host: {
|
|
1098
|
+
class: "tx-file-upload",
|
|
1099
|
+
"[class]": "passThrough().root?.class",
|
|
1100
|
+
"[style]": "hostStyle()",
|
|
1101
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
1102
|
+
"[attr.data-mode]": "mode()",
|
|
1103
|
+
"[class.tx-file-upload--disabled]": "isDisabled()",
|
|
1104
|
+
"[class.tx-file-upload--invalid]": "isInvalid()",
|
|
1105
|
+
"[class.tx-file-upload--dragging]": "dragging()",
|
|
1106
|
+
"[class.tx-file-upload--filled]": "rows().length > 0"
|
|
1107
|
+
},
|
|
1108
|
+
template: "<input\n #input\n type=\"file\"\n class=\"tx-file-upload__input\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept() ?? ''\"\n [multiple]=\"multiple()\"\n [disabled]=\"isDisabled()\"\n (change)=\"onInputChange($event)\"\n/>\n\n<ng-template #thumbnail let-entry let-large=\"large\">\n <span\n class=\"tx-file-upload__thumbnail\"\n aria-hidden=\"true\"\n [attr.data-kind]=\"entry.kind\"\n [attr.data-size]=\"large ? 'large' : null\"\n [class]=\"passThrough().thumbnail?.class\"\n [style]=\"passThrough().thumbnail?.style\"\n >\n @if (entry.preview) {\n <img class=\"tx-file-upload__preview\" alt=\"\" [src]=\"entry.preview\" />\n } @else {\n <tx-icon class=\"tx-file-upload__kind\" [name]=\"kindIcon(entry.kind)\" />\n @if (entry.extension) {\n <span class=\"tx-file-upload__extension\">{{ entry.extension }}</span>\n }\n }\n </span>\n</ng-template>\n\n<ng-template #progress let-entry>\n <span\n class=\"tx-file-upload__progress\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuenow]=\"entry.progress\"\n [attr.aria-label]=\"entry.file.name\"\n [class]=\"passThrough().progress?.class\"\n [style]=\"passThrough().progress?.style\"\n >\n <span class=\"tx-file-upload__progress-value\" [style.width.%]=\"entry.progress\"></span>\n </span>\n</ng-template>\n\n<ng-template #messageList>\n @if (messages().length) {\n <div class=\"tx-file-upload__messages\">\n @for (message of messages(); track message.id) {\n <div\n class=\"tx-file-upload__message\"\n animate.enter=\"tx-file-upload--enter\"\n animate.leave=\"tx-file-upload--leave\"\n [class]=\"passThrough().message?.class\"\n [style]=\"passThrough().message?.style\"\n >\n <tx-icon class=\"tx-file-upload__message-icon\" name=\"exclamation-circle\" />\n <span class=\"tx-file-upload__message-text\">{{ message.text }}</span>\n <button type=\"button\" class=\"tx-file-upload__dismiss\" [attr.aria-label]=\"translations().close\" (click)=\"dismiss(message)\">\n <tx-icon name=\"times\" />\n </button>\n </div>\n }\n </div>\n }\n</ng-template>\n\n@if (mode() === 'basic') {\n <div class=\"tx-file-upload__basic\" [class]=\"passThrough().basic?.class\" [style]=\"passThrough().basic?.style\">\n <button\n txButton\n type=\"button\"\n severity=\"secondary\"\n outlined\n [icon]=\"chooseIcon()\"\n [disabled]=\"isDisabled() || uploading()\"\n [attr.aria-describedby]=\"id + '-label'\"\n (click)=\"choose()\"\n >\n {{ chooseText() }}\n </button>\n @if (hasTarget() && !auto() && showUploadButton() && waiting().length) {\n <button txButton type=\"button\" [icon]=\"uploadIcon()\" [loading]=\"uploading()\" (click)=\"upload()\">\n {{ uploadLabel() ?? translations().upload }}\n </button>\n }\n <span class=\"tx-file-upload__basic-label\" [id]=\"id + '-label'\">\n {{ basicLabel() }}\n @if (rows().length === 1 && rows()[0].status !== 'pending') {\n · {{ meta(rows()[0]) }}\n }\n </span>\n </div>\n <ng-container [ngTemplateOutlet]=\"messageList\" />\n} @else {\n <div\n class=\"tx-file-upload__zone\"\n data-tx-field-control\n [attr.data-state]=\"!multiple() && current() ? 'selected' : 'empty'\"\n [attr.role]=\"!multiple() && current() ? 'group' : 'button'\"\n [attr.tabindex]=\"!multiple() && current() ? null : isDisabled() || limitReached() ? -1 : 0\"\n [attr.aria-disabled]=\"!multiple() && current() ? null : isDisabled() || limitReached() || null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"zoneLabelledBy()\"\n [attr.aria-describedby]=\"!multiple() && current() && description() ? id + '-hint' : null\"\n [attr.aria-invalid]=\"isInvalid() || null\"\n [class]=\"passThrough().dropzone?.class\"\n [style]=\"passThrough().dropzone?.style\"\n (click)=\"onZoneClick($event)\"\n (keydown)=\"onZoneKeydown($event)\"\n (blur)=\"markTouched()\"\n (dragenter)=\"onDragEnter($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\"\n >\n <svg class=\"tx-file-upload__outline\" aria-hidden=\"true\" focusable=\"false\"><rect class=\"tx-file-upload__outline-rect\" /></svg>\n @if (!multiple() && current(); as entry) {\n <div class=\"tx-file-upload__selected\" animate.enter=\"tx-file-upload--enter\">\n @if (fileTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"fileContext(entry, 0)\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"thumbnail\" [ngTemplateOutletContext]=\"{ $implicit: entry, large: true }\" />\n <span class=\"tx-file-upload__selected-info\">\n <span\n class=\"tx-file-upload__name\"\n [id]=\"id + '-prompt'\"\n [title]=\"entry.file.name\"\n [class]=\"passThrough().fileName?.class\"\n [style]=\"passThrough().fileName?.style\"\n >{{ entry.file.name }}</span\n >\n <span\n class=\"tx-file-upload__meta\"\n [attr.data-status]=\"entry.status\"\n [class]=\"passThrough().fileMeta?.class\"\n [style]=\"passThrough().fileMeta?.style\"\n >\n @if (entry.status === 'uploaded') {\n <tx-icon class=\"tx-file-upload__status-icon\" name=\"check-circle\" />\n }\n {{ meta(entry) }}\n </span>\n </span>\n @if (entry.status === 'uploading') {\n <ng-container [ngTemplateOutlet]=\"progress\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n <span class=\"tx-file-upload__selected-actions\">\n @if (entry.status === 'failed') {\n <button txButton type=\"button\" size=\"small\" text severity=\"secondary\" icon=\"refresh\" (click)=\"retry(entry)\">{{ translations().retry }}</button>\n }\n @if (hasTarget() && !auto() && showUploadButton() && entry.status === 'pending') {\n <button txButton type=\"button\" size=\"small\" [icon]=\"uploadIcon()\" (click)=\"upload()\">{{ uploadLabel() ?? translations().upload }}</button>\n }\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n severity=\"secondary\"\n icon=\"sync\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"choose()\"\n >\n {{ translations().replace }}\n </button>\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n severity=\"danger\"\n icon=\"trash\"\n [attr.aria-label]=\"removeLabel(entry)\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"remove($event, entry)\"\n >\n {{ translations().remove }}\n </button>\n </span>\n }\n </div>\n } @else {\n <span class=\"tx-file-upload__content\" [id]=\"id + '-content'\">\n @if (dropzoneTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"{ $implicit: dragging(), choose: chooseFiles }\" />\n } @else {\n <span class=\"tx-file-upload__icon\" aria-hidden=\"true\" [class]=\"passThrough().icon?.class\" [style]=\"passThrough().icon?.style\">\n <tx-icon class=\"tx-file-upload__glyph\" [name]=\"dragging() ? 'arrow-down' : 'cloud-upload'\" />\n </span>\n <span class=\"tx-file-upload__prompt\" [class]=\"passThrough().prompt?.class\" [style]=\"passThrough().prompt?.style\">\n @if (dragging()) {\n {{ translations().fileUploadRelease }}\n } @else {\n {{ prompt().before }}<span class=\"tx-file-upload__link\">{{ prompt().link }}</span>{{ prompt().after }}\n }\n </span>\n @if (description()) {\n <span class=\"tx-file-upload__hint\" [id]=\"id + '-hint'\" [class]=\"passThrough().hint?.class\" [style]=\"passThrough().hint?.style\">{{ description() }}</span>\n }\n }\n </span>\n }\n </div>\n\n @if (!multiple() && current() && description()) {\n <span class=\"tx-file-upload__hint tx-file-upload__hint--below\" [id]=\"id + '-hint'\">{{ description() }}</span>\n }\n\n <ng-container [ngTemplateOutlet]=\"messageList\" />\n\n @if (multiple() && rows().length) {\n <ul class=\"tx-file-upload__list\" [class]=\"passThrough().list?.class\" [style]=\"passThrough().list?.style\">\n @for (entry of rows(); track entry.id; let index = $index) {\n <li\n class=\"tx-file-upload__file\"\n animate.enter=\"tx-file-upload--enter\"\n animate.leave=\"tx-file-upload--leave\"\n [attr.data-status]=\"entry.status\"\n [class]=\"passThrough().file?.class\"\n [style]=\"passThrough().file?.style\"\n >\n @if (fileTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.template\" [ngTemplateOutletContext]=\"fileContext(entry, index)\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"thumbnail\" [ngTemplateOutletContext]=\"{ $implicit: entry, large: false }\" />\n <span class=\"tx-file-upload__info\">\n <span class=\"tx-file-upload__name\" [title]=\"entry.file.name\" [class]=\"passThrough().fileName?.class\" [style]=\"passThrough().fileName?.style\">{{ entry.file.name }}</span>\n <span class=\"tx-file-upload__meta\" [attr.data-status]=\"entry.status\" [class]=\"passThrough().fileMeta?.class\" [style]=\"passThrough().fileMeta?.style\">\n @if (entry.status === 'uploaded') {\n <tx-icon class=\"tx-file-upload__status-icon\" name=\"check-circle\" />\n }\n {{ meta(entry) }}\n </span>\n @if (entry.status === 'uploading') {\n <ng-container [ngTemplateOutlet]=\"progress\" [ngTemplateOutletContext]=\"{ $implicit: entry }\" />\n }\n </span>\n @if (entry.status === 'failed') {\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n rounded\n severity=\"secondary\"\n icon=\"refresh\"\n iconOnly\n [attr.aria-label]=\"translations().retry + ' ' + entry.file.name\"\n (click)=\"retry(entry)\"\n ></button>\n }\n <button\n txButton\n type=\"button\"\n size=\"small\"\n text\n rounded\n severity=\"secondary\"\n [icon]=\"cancelIcon()\"\n iconOnly\n class=\"tx-file-upload__remove\"\n [attr.aria-label]=\"removeLabel(entry)\"\n [disabled]=\"isDisabled() || entry.status === 'uploading'\"\n (click)=\"remove($event, entry)\"\n ></button>\n }\n </li>\n }\n </ul>\n }\n\n @if (showFooter()) {\n <div class=\"tx-file-upload__footer\" [class]=\"passThrough().footer?.class\" [style]=\"passThrough().footer?.style\">\n <ng-content select=\"[txFileUploadActions]\" />\n @if (hasTarget() && !auto() && showUploadButton() && waiting().length) {\n <span class=\"tx-file-upload__summary\">{{ summary() }}</span>\n <span class=\"tx-file-upload__footer-buttons\">\n @if (showCancelButton()) {\n <button txButton type=\"button\" size=\"small\" text severity=\"secondary\" [icon]=\"cancelIcon()\" (click)=\"clear()\">\n {{ cancelLabel() ?? translations().clear }}\n </button>\n }\n <button txButton type=\"button\" size=\"small\" [icon]=\"uploadIcon()\" [loading]=\"uploading()\" (click)=\"upload()\">\n {{ uploadLabel() ?? translations().upload }}\n </button>\n </span>\n }\n </div>\n }\n}\n",
|
|
1109
|
+
styles: [":host{display:flex;flex-direction:column;min-width:0}.tx-file-upload__input{display:none}.tx-file-upload__zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0;text-align:center;isolation:isolate}.tx-file-upload__outline{position:absolute;inset:0;z-index:-1;width:100%;height:100%;overflow:visible;pointer-events:none}.tx-file-upload__outline-rect{fill:none}.tx-file-upload__icon,.tx-file-upload__thumbnail{display:inline-flex;flex-shrink:0;flex-direction:column;align-items:center;justify-content:center;overflow:hidden}.tx-file-upload__preview{width:100%;height:100%;object-fit:cover}.tx-file-upload__content{display:flex;flex-direction:column;align-items:center;min-width:0}.tx-file-upload__selected{display:flex;flex-direction:column;align-items:center;width:100%;min-width:0}.tx-file-upload__selected-info,.tx-file-upload__info{display:flex;flex-direction:column;min-width:0;max-width:100%}.tx-file-upload__info{flex:1 1 auto}.tx-file-upload__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tx-file-upload__meta{display:inline-flex;align-items:center}.tx-file-upload__selected-actions,.tx-file-upload__footer-buttons{display:flex;flex-wrap:wrap;align-items:center;justify-content:center}.tx-file-upload__list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}.tx-file-upload__file{display:flex;align-items:center;min-width:0}.tx-file-upload__progress{display:block;overflow:hidden}.tx-file-upload__progress-value{display:block;height:100%}.tx-file-upload__messages{display:flex;flex-direction:column}.tx-file-upload__message{display:flex;align-items:flex-start}.tx-file-upload__message-text{flex:1 1 auto;min-width:0;overflow-wrap:anywhere}.tx-file-upload__dismiss{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}.tx-file-upload__footer,.tx-file-upload__basic{display:flex;flex-wrap:wrap;align-items:center;min-width:0}.tx-file-upload__footer-buttons{margin-inline-start:auto}.tx-file-upload__basic-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-styled]){--_duration: var(--tx-file-upload-transition-duration);--_easing: var(--tx-file-upload-easing);gap:var(--tx-file-upload-gap);color:var(--tx-file-upload-color);font-family:var(--tx-font-family);font-size:var(--tx-file-upload-font-size);line-height:1.45}:host([data-styled]) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-border-color);--_fill: var(--tx-file-upload-dropzone-background);--_border: var(--tx-file-upload-dropzone-border-width);--_radius: var(--tx-file-upload-dropzone-border-radius);gap:var(--tx-file-upload-dropzone-gap);min-height:var(--tx-file-upload-dropzone-min-height);padding:var(--tx-file-upload-dropzone-padding);border-radius:var(--_radius);outline:var(--tx-file-upload-focus-ring-width) solid transparent;outline-offset:var(--tx-file-upload-focus-ring-offset);background:var(--_fill);cursor:pointer;transition:background-color var(--_duration) var(--_easing),outline-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__outline-rect{x:calc(var(--_border) / 2);y:calc(var(--_border) / 2);width:calc(100% - var(--_border));height:calc(100% - var(--_border));rx:calc(var(--_radius) - var(--_border) / 2);stroke:var(--_stroke);stroke-width:var(--_border);stroke-dasharray:var(--tx-file-upload-dropzone-dash);transition:stroke var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__zone:focus-visible{outline-color:var(--tx-file-upload-focus-ring-color)}:host([data-styled]:not(.tx-file-upload--disabled)) .tx-file-upload__zone[data-state=empty]:not([aria-disabled]):hover{--_stroke: var(--tx-file-upload-dropzone-hover-border-color);--_fill: var(--tx-file-upload-dropzone-hover-background)}:host([data-styled].tx-file-upload--invalid) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-invalid-border-color)}:host([data-styled]) .tx-file-upload__zone[data-state=selected]{--_stroke: var(--tx-file-upload-selected-border-color);--_fill: var(--tx-file-upload-selected-background);cursor:default}:host([data-styled]) .tx-file-upload__zone[data-state=selected] .tx-file-upload__outline-rect{stroke-dasharray:none}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__zone{--_stroke: var(--tx-file-upload-dropzone-active-border-color);--_fill: var(--tx-file-upload-dropzone-active-background)}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__outline-rect{stroke-dasharray:var(--tx-file-upload-dropzone-dash);animation:tx-file-upload-march calc(var(--_duration) * 3) linear infinite}:host([data-styled]) .tx-file-upload__zone[aria-disabled],:host([data-styled].tx-file-upload--disabled) .tx-file-upload__zone{cursor:not-allowed}:host([data-styled].tx-file-upload--disabled) .tx-file-upload__zone{opacity:var(--tx-file-upload-dropzone-disabled-opacity)}:host([data-styled]) .tx-file-upload__icon{width:var(--tx-file-upload-icon-size);height:var(--tx-file-upload-icon-size);border-radius:var(--tx-file-upload-icon-border-radius);background:var(--tx-file-upload-icon-background);color:var(--tx-file-upload-icon-color);font-size:var(--tx-file-upload-icon-glyph-size);transition:transform var(--_duration) var(--_easing),box-shadow var(--_duration) var(--_easing)}:host([data-styled]:not(.tx-file-upload--disabled)) .tx-file-upload__zone:not([aria-disabled]):hover .tx-file-upload__icon,:host([data-styled]) .tx-file-upload__zone:focus-visible .tx-file-upload__icon{box-shadow:var(--tx-file-upload-icon-hover-shadow);transform:translateY(var(--tx-file-upload-icon-lift))}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__icon{box-shadow:var(--tx-file-upload-icon-hover-shadow);transform:translateY(var(--tx-file-upload-icon-lift)) scale(1.06)}:host([data-styled].tx-file-upload--dragging) .tx-file-upload__glyph{animation:tx-file-upload-drop calc(var(--_duration) * 5) var(--_easing) infinite}:host([data-styled]) .tx-file-upload__prompt{font-weight:var(--tx-file-upload-prompt-font-weight)}:host([data-styled]) .tx-file-upload__link{color:var(--tx-file-upload-prompt-link-color);font-weight:var(--tx-file-upload-prompt-link-font-weight);text-decoration:underline transparent;text-underline-offset:3px;transition:text-decoration-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__zone:hover .tx-file-upload__link{text-decoration-color:currentColor}:host([data-styled]) .tx-file-upload__hint{max-width:44ch;color:var(--tx-file-upload-hint-color);font-size:var(--tx-file-upload-hint-font-size)}:host([data-styled]) .tx-file-upload__zone .tx-file-upload__hint{margin-top:calc(var(--tx-file-upload-dropzone-gap) * -.5)}:host([data-styled]) .tx-file-upload__hint--below{max-width:none;margin-top:calc(var(--tx-file-upload-gap) * -.5)}:host([data-styled]) .tx-file-upload__content{gap:var(--tx-file-upload-dropzone-gap)}:host([data-styled]) .tx-file-upload__selected{gap:var(--tx-file-upload-selected-gap)}:host([data-styled]) .tx-file-upload__selected-info{align-items:center}:host([data-styled]) .tx-file-upload__selected .tx-file-upload__progress{width:min(var(--tx-file-upload-selected-progress-width),100%)}:host([data-styled]) .tx-file-upload__selected-actions,:host([data-styled]) .tx-file-upload__footer-buttons{gap:var(--tx-file-upload-selected-actions-gap)}:host([data-styled]) .tx-file-upload__list{gap:var(--tx-file-upload-list-gap)}:host([data-styled]) .tx-file-upload__file{gap:var(--tx-file-upload-file-gap);padding:var(--tx-file-upload-file-padding);border:1px solid var(--tx-file-upload-file-border-color);border-radius:var(--tx-file-upload-file-border-radius);background:var(--tx-file-upload-file-background)}:host([data-styled]) .tx-file-upload__name{font-weight:var(--tx-file-upload-file-name-font-weight)}:host([data-styled]) .tx-file-upload__meta{gap:var(--tx-file-upload-file-meta-gap);color:var(--tx-file-upload-file-meta-color);font-size:var(--tx-file-upload-file-meta-font-size)}:host([data-styled]) .tx-file-upload__meta[data-status=uploaded]{color:var(--tx-file-upload-file-success-color)}:host([data-styled]) .tx-file-upload__meta[data-status=failed]{color:var(--tx-file-upload-file-error-color)}:host([data-styled]) .tx-file-upload__thumbnail{--_tone: var(--tx-file-upload-thumbnail-color);gap:1px;width:var(--tx-file-upload-thumbnail-size);height:var(--tx-file-upload-thumbnail-size);border-radius:var(--tx-file-upload-thumbnail-border-radius);background:var(--tx-file-upload-thumbnail-background);color:var(--_tone);font-size:var(--tx-file-upload-thumbnail-glyph-size)}:host([data-styled]) .tx-file-upload__thumbnail:not([data-kind=other]){background:color-mix(in srgb,var(--_tone) var(--tx-file-upload-thumbnail-tint),var(--tx-file-upload-file-background))}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=image],:host([data-styled]) .tx-file-upload__thumbnail[data-kind=media]{--_tone: var(--tx-file-upload-thumbnail-image-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=document]{--_tone: var(--tx-file-upload-thumbnail-document-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=pdf]{--_tone: var(--tx-file-upload-thumbnail-pdf-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=sheet]{--_tone: var(--tx-file-upload-thumbnail-sheet-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-kind=archive]{--_tone: var(--tx-file-upload-thumbnail-archive-color)}:host([data-styled]) .tx-file-upload__thumbnail[data-size=large]{width:var(--tx-file-upload-thumbnail-large-size);height:var(--tx-file-upload-thumbnail-large-size);border-radius:var(--tx-file-upload-thumbnail-large-border-radius);font-size:var(--tx-file-upload-thumbnail-large-glyph-size)}:host([data-styled]) .tx-file-upload__extension{max-width:100%;overflow:hidden;font-size:var(--tx-file-upload-thumbnail-extension-font-size);font-weight:var(--tx-font-weight-semibold);letter-spacing:.04em;line-height:1;text-overflow:clip;text-transform:uppercase;white-space:nowrap}:host([data-styled]) .tx-file-upload__thumbnail[data-size=large] .tx-file-upload__extension{font-size:var(--tx-file-upload-thumbnail-large-extension-font-size)}:host([data-styled]) .tx-file-upload__progress{height:var(--tx-file-upload-progress-height);margin-top:var(--tx-file-upload-progress-margin-top);border-radius:var(--tx-radius-full);background:var(--tx-file-upload-progress-background)}:host([data-styled]) .tx-file-upload__progress-value{border-radius:inherit;background:var(--tx-file-upload-progress-color);transition:width var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__messages{gap:var(--tx-file-upload-list-gap)}:host([data-styled]) .tx-file-upload__message{gap:var(--tx-file-upload-message-gap);padding:var(--tx-file-upload-message-padding);border-radius:var(--tx-file-upload-message-border-radius);background:var(--tx-file-upload-message-background);color:var(--tx-file-upload-message-color);font-size:var(--tx-file-upload-message-font-size)}:host([data-styled]) .tx-file-upload__message-icon{flex-shrink:0;margin-top:.15em}:host([data-styled]) .tx-file-upload__dismiss{width:1.45em;height:1.45em;margin:-.1em -.25em -.1em 0;border-radius:var(--tx-radius-full);outline:var(--tx-file-upload-focus-ring-width) solid transparent;outline-offset:1px;opacity:.75;transition:opacity var(--_duration) var(--_easing),background-color var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload__dismiss:hover{background:color-mix(in srgb,currentColor 12%,transparent);opacity:1}:host([data-styled]) .tx-file-upload__dismiss:focus-visible{outline-color:var(--tx-file-upload-focus-ring-color);opacity:1}:host([data-styled]) .tx-file-upload__footer{gap:var(--tx-file-upload-footer-gap)}:host([data-styled]) .tx-file-upload__summary{color:var(--tx-file-upload-footer-summary-color);font-size:var(--tx-file-upload-footer-summary-font-size)}:host([data-styled]) .tx-file-upload__basic{gap:var(--tx-file-upload-basic-gap)}:host([data-styled]) .tx-file-upload__basic-label{color:var(--tx-file-upload-basic-label-color);font-size:var(--tx-file-upload-basic-label-font-size)}:host([data-styled]) .tx-file-upload--enter{animation:tx-file-upload-in var(--_duration) var(--_easing)}:host([data-styled]) .tx-file-upload--leave{animation:tx-file-upload-in calc(var(--_duration) * .8) ease-in reverse forwards}@keyframes tx-file-upload-in{0%{opacity:0;transform:translateY(4px) scale(.98)}}@keyframes tx-file-upload-march{to{stroke-dashoffset:calc(var(--tx-file-upload-dropzone-dash-period) * -1)}}@keyframes tx-file-upload-drop{0%,to{transform:translateY(-1px)}50%{transform:translateY(2px)}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-file-upload__zone,:host([data-styled]) .tx-file-upload__outline-rect,:host([data-styled]) .tx-file-upload__icon,:host([data-styled]) .tx-file-upload__link,:host([data-styled]) .tx-file-upload__progress-value,:host([data-styled]) .tx-file-upload__dismiss{transition:none}:host([data-styled]) .tx-file-upload--enter,:host([data-styled]) .tx-file-upload--leave,:host([data-styled].tx-file-upload--dragging) .tx-file-upload__outline-rect,:host([data-styled].tx-file-upload--dragging) .tx-file-upload__glyph{animation:none}:host([data-styled]) .tx-file-upload__icon{transform:none!important}}\n"]
|
|
1110
|
+
}]
|
|
1111
|
+
}],
|
|
1112
|
+
ctorParameters: () => [],
|
|
1113
|
+
propDecorators: {
|
|
1114
|
+
mode: [{
|
|
1115
|
+
type: i0.Input,
|
|
1116
|
+
args: [{
|
|
1117
|
+
isSignal: true,
|
|
1118
|
+
alias: "mode",
|
|
1119
|
+
required: false
|
|
1120
|
+
}]
|
|
1121
|
+
}],
|
|
1122
|
+
files: [{
|
|
1123
|
+
type: i0.Input,
|
|
1124
|
+
args: [{
|
|
1125
|
+
isSignal: true,
|
|
1126
|
+
alias: "files",
|
|
1127
|
+
required: false
|
|
1128
|
+
}]
|
|
1129
|
+
}, {
|
|
1130
|
+
type: i0.Output,
|
|
1131
|
+
args: ["filesChange"]
|
|
1132
|
+
}],
|
|
1133
|
+
file: [{
|
|
1134
|
+
type: i0.Input,
|
|
1135
|
+
args: [{
|
|
1136
|
+
isSignal: true,
|
|
1137
|
+
alias: "file",
|
|
1138
|
+
required: false
|
|
1139
|
+
}]
|
|
1140
|
+
}, {
|
|
1141
|
+
type: i0.Output,
|
|
1142
|
+
args: ["fileChange"]
|
|
1143
|
+
}],
|
|
1144
|
+
multiple: [{
|
|
1145
|
+
type: i0.Input,
|
|
1146
|
+
args: [{
|
|
1147
|
+
isSignal: true,
|
|
1148
|
+
alias: "multiple",
|
|
1149
|
+
required: false
|
|
1150
|
+
}]
|
|
1151
|
+
}],
|
|
1152
|
+
accept: [{
|
|
1153
|
+
type: i0.Input,
|
|
1154
|
+
args: [{
|
|
1155
|
+
isSignal: true,
|
|
1156
|
+
alias: "accept",
|
|
1157
|
+
required: false
|
|
1158
|
+
}]
|
|
1159
|
+
}],
|
|
1160
|
+
maxFileSize: [{
|
|
1161
|
+
type: i0.Input,
|
|
1162
|
+
args: [{
|
|
1163
|
+
isSignal: true,
|
|
1164
|
+
alias: "maxFileSize",
|
|
1165
|
+
required: false
|
|
1166
|
+
}]
|
|
1167
|
+
}],
|
|
1168
|
+
fileLimit: [{
|
|
1169
|
+
type: i0.Input,
|
|
1170
|
+
args: [{
|
|
1171
|
+
isSignal: true,
|
|
1172
|
+
alias: "fileLimit",
|
|
1173
|
+
required: false
|
|
1174
|
+
}]
|
|
1175
|
+
}],
|
|
1176
|
+
disabledInput: [{
|
|
1177
|
+
type: i0.Input,
|
|
1178
|
+
args: [{
|
|
1179
|
+
isSignal: true,
|
|
1180
|
+
alias: "disabled",
|
|
1181
|
+
required: false
|
|
1182
|
+
}]
|
|
1183
|
+
}],
|
|
1184
|
+
invalid: [{
|
|
1185
|
+
type: i0.Input,
|
|
1186
|
+
args: [{
|
|
1187
|
+
isSignal: true,
|
|
1188
|
+
alias: "invalid",
|
|
1189
|
+
required: false
|
|
1190
|
+
}]
|
|
1191
|
+
}],
|
|
1192
|
+
auto: [{
|
|
1193
|
+
type: i0.Input,
|
|
1194
|
+
args: [{
|
|
1195
|
+
isSignal: true,
|
|
1196
|
+
alias: "auto",
|
|
1197
|
+
required: false
|
|
1198
|
+
}]
|
|
1199
|
+
}],
|
|
1200
|
+
url: [{
|
|
1201
|
+
type: i0.Input,
|
|
1202
|
+
args: [{
|
|
1203
|
+
isSignal: true,
|
|
1204
|
+
alias: "url",
|
|
1205
|
+
required: false
|
|
1206
|
+
}]
|
|
1207
|
+
}],
|
|
1208
|
+
name: [{
|
|
1209
|
+
type: i0.Input,
|
|
1210
|
+
args: [{
|
|
1211
|
+
isSignal: true,
|
|
1212
|
+
alias: "name",
|
|
1213
|
+
required: false
|
|
1214
|
+
}]
|
|
1215
|
+
}],
|
|
1216
|
+
method: [{
|
|
1217
|
+
type: i0.Input,
|
|
1218
|
+
args: [{
|
|
1219
|
+
isSignal: true,
|
|
1220
|
+
alias: "method",
|
|
1221
|
+
required: false
|
|
1222
|
+
}]
|
|
1223
|
+
}],
|
|
1224
|
+
headers: [{
|
|
1225
|
+
type: i0.Input,
|
|
1226
|
+
args: [{
|
|
1227
|
+
isSignal: true,
|
|
1228
|
+
alias: "headers",
|
|
1229
|
+
required: false
|
|
1230
|
+
}]
|
|
1231
|
+
}],
|
|
1232
|
+
withCredentials: [{
|
|
1233
|
+
type: i0.Input,
|
|
1234
|
+
args: [{
|
|
1235
|
+
isSignal: true,
|
|
1236
|
+
alias: "withCredentials",
|
|
1237
|
+
required: false
|
|
1238
|
+
}]
|
|
1239
|
+
}],
|
|
1240
|
+
customUpload: [{
|
|
1241
|
+
type: i0.Input,
|
|
1242
|
+
args: [{
|
|
1243
|
+
isSignal: true,
|
|
1244
|
+
alias: "customUpload",
|
|
1245
|
+
required: false
|
|
1246
|
+
}]
|
|
1247
|
+
}],
|
|
1248
|
+
description: [{
|
|
1249
|
+
type: i0.Input,
|
|
1250
|
+
args: [{
|
|
1251
|
+
isSignal: true,
|
|
1252
|
+
alias: "description",
|
|
1253
|
+
required: false
|
|
1254
|
+
}]
|
|
1255
|
+
}],
|
|
1256
|
+
chooseLabel: [{
|
|
1257
|
+
type: i0.Input,
|
|
1258
|
+
args: [{
|
|
1259
|
+
isSignal: true,
|
|
1260
|
+
alias: "chooseLabel",
|
|
1261
|
+
required: false
|
|
1262
|
+
}]
|
|
1263
|
+
}],
|
|
1264
|
+
uploadLabel: [{
|
|
1265
|
+
type: i0.Input,
|
|
1266
|
+
args: [{
|
|
1267
|
+
isSignal: true,
|
|
1268
|
+
alias: "uploadLabel",
|
|
1269
|
+
required: false
|
|
1270
|
+
}]
|
|
1271
|
+
}],
|
|
1272
|
+
cancelLabel: [{
|
|
1273
|
+
type: i0.Input,
|
|
1274
|
+
args: [{
|
|
1275
|
+
isSignal: true,
|
|
1276
|
+
alias: "cancelLabel",
|
|
1277
|
+
required: false
|
|
1278
|
+
}]
|
|
1279
|
+
}],
|
|
1280
|
+
chooseIcon: [{
|
|
1281
|
+
type: i0.Input,
|
|
1282
|
+
args: [{
|
|
1283
|
+
isSignal: true,
|
|
1284
|
+
alias: "chooseIcon",
|
|
1285
|
+
required: false
|
|
1286
|
+
}]
|
|
1287
|
+
}],
|
|
1288
|
+
uploadIcon: [{
|
|
1289
|
+
type: i0.Input,
|
|
1290
|
+
args: [{
|
|
1291
|
+
isSignal: true,
|
|
1292
|
+
alias: "uploadIcon",
|
|
1293
|
+
required: false
|
|
1294
|
+
}]
|
|
1295
|
+
}],
|
|
1296
|
+
cancelIcon: [{
|
|
1297
|
+
type: i0.Input,
|
|
1298
|
+
args: [{
|
|
1299
|
+
isSignal: true,
|
|
1300
|
+
alias: "cancelIcon",
|
|
1301
|
+
required: false
|
|
1302
|
+
}]
|
|
1303
|
+
}],
|
|
1304
|
+
showUploadButton: [{
|
|
1305
|
+
type: i0.Input,
|
|
1306
|
+
args: [{
|
|
1307
|
+
isSignal: true,
|
|
1308
|
+
alias: "showUploadButton",
|
|
1309
|
+
required: false
|
|
1310
|
+
}]
|
|
1311
|
+
}],
|
|
1312
|
+
showCancelButton: [{
|
|
1313
|
+
type: i0.Input,
|
|
1314
|
+
args: [{
|
|
1315
|
+
isSignal: true,
|
|
1316
|
+
alias: "showCancelButton",
|
|
1317
|
+
required: false
|
|
1318
|
+
}]
|
|
1319
|
+
}],
|
|
1320
|
+
showMessages: [{
|
|
1321
|
+
type: i0.Input,
|
|
1322
|
+
args: [{
|
|
1323
|
+
isSignal: true,
|
|
1324
|
+
alias: "showMessages",
|
|
1325
|
+
required: false
|
|
1326
|
+
}]
|
|
1327
|
+
}],
|
|
1328
|
+
invalidFileTypeMessage: [{
|
|
1329
|
+
type: i0.Input,
|
|
1330
|
+
args: [{
|
|
1331
|
+
isSignal: true,
|
|
1332
|
+
alias: "invalidFileTypeMessage",
|
|
1333
|
+
required: false
|
|
1334
|
+
}]
|
|
1335
|
+
}],
|
|
1336
|
+
invalidFileSizeMessage: [{
|
|
1337
|
+
type: i0.Input,
|
|
1338
|
+
args: [{
|
|
1339
|
+
isSignal: true,
|
|
1340
|
+
alias: "invalidFileSizeMessage",
|
|
1341
|
+
required: false
|
|
1342
|
+
}]
|
|
1343
|
+
}],
|
|
1344
|
+
invalidFileLimitMessage: [{
|
|
1345
|
+
type: i0.Input,
|
|
1346
|
+
args: [{
|
|
1347
|
+
isSignal: true,
|
|
1348
|
+
alias: "invalidFileLimitMessage",
|
|
1349
|
+
required: false
|
|
1350
|
+
}]
|
|
1351
|
+
}],
|
|
1352
|
+
ariaLabel: [{
|
|
1353
|
+
type: i0.Input,
|
|
1354
|
+
args: [{
|
|
1355
|
+
isSignal: true,
|
|
1356
|
+
alias: "ariaLabel",
|
|
1357
|
+
required: false
|
|
1358
|
+
}]
|
|
1359
|
+
}],
|
|
1360
|
+
dt: [{
|
|
1361
|
+
type: i0.Input,
|
|
1362
|
+
args: [{
|
|
1363
|
+
isSignal: true,
|
|
1364
|
+
alias: "dt",
|
|
1365
|
+
required: false
|
|
1366
|
+
}]
|
|
1367
|
+
}],
|
|
1368
|
+
pt: [{
|
|
1369
|
+
type: i0.Input,
|
|
1370
|
+
args: [{
|
|
1371
|
+
isSignal: true,
|
|
1372
|
+
alias: "pt",
|
|
1373
|
+
required: false
|
|
1374
|
+
}]
|
|
1375
|
+
}],
|
|
1376
|
+
ptOptions: [{
|
|
1377
|
+
type: i0.Input,
|
|
1378
|
+
args: [{
|
|
1379
|
+
isSignal: true,
|
|
1380
|
+
alias: "ptOptions",
|
|
1381
|
+
required: false
|
|
1382
|
+
}]
|
|
1383
|
+
}],
|
|
1384
|
+
unstyled: [{
|
|
1385
|
+
type: i0.Input,
|
|
1386
|
+
args: [{
|
|
1387
|
+
isSignal: true,
|
|
1388
|
+
alias: "unstyled",
|
|
1389
|
+
required: false
|
|
1390
|
+
}]
|
|
1391
|
+
}],
|
|
1392
|
+
selected: [{
|
|
1393
|
+
type: i0.Output,
|
|
1394
|
+
args: ["selected"]
|
|
1395
|
+
}],
|
|
1396
|
+
removed: [{
|
|
1397
|
+
type: i0.Output,
|
|
1398
|
+
args: ["removed"]
|
|
1399
|
+
}],
|
|
1400
|
+
cleared: [{
|
|
1401
|
+
type: i0.Output,
|
|
1402
|
+
args: ["cleared"]
|
|
1403
|
+
}],
|
|
1404
|
+
rejected: [{
|
|
1405
|
+
type: i0.Output,
|
|
1406
|
+
args: ["rejected"]
|
|
1407
|
+
}],
|
|
1408
|
+
beforeUpload: [{
|
|
1409
|
+
type: i0.Output,
|
|
1410
|
+
args: ["beforeUpload"]
|
|
1411
|
+
}],
|
|
1412
|
+
uploadProgress: [{
|
|
1413
|
+
type: i0.Output,
|
|
1414
|
+
args: ["uploadProgress"]
|
|
1415
|
+
}],
|
|
1416
|
+
uploaded: [{
|
|
1417
|
+
type: i0.Output,
|
|
1418
|
+
args: ["uploaded"]
|
|
1419
|
+
}],
|
|
1420
|
+
uploadFailed: [{
|
|
1421
|
+
type: i0.Output,
|
|
1422
|
+
args: ["uploadFailed"]
|
|
1423
|
+
}],
|
|
1424
|
+
uploadHandler: [{
|
|
1425
|
+
type: i0.Output,
|
|
1426
|
+
args: ["uploadHandler"]
|
|
1427
|
+
}],
|
|
1428
|
+
uploadedFileRemoved: [{
|
|
1429
|
+
type: i0.Output,
|
|
1430
|
+
args: ["uploadedFileRemoved"]
|
|
1431
|
+
}],
|
|
1432
|
+
fileTemplate: [{
|
|
1433
|
+
type: i0.ContentChild,
|
|
1434
|
+
args: [i0.forwardRef(() => TxFileUploadFileTemplate), { isSignal: true }]
|
|
1435
|
+
}],
|
|
1436
|
+
dropzoneTemplate: [{
|
|
1437
|
+
type: i0.ContentChild,
|
|
1438
|
+
args: [i0.forwardRef(() => TxFileUploadDropzoneTemplate), { isSignal: true }]
|
|
1439
|
+
}],
|
|
1440
|
+
actions: [{
|
|
1441
|
+
type: i0.ContentChild,
|
|
1442
|
+
args: [i0.forwardRef(() => TxFileUploadActions), { isSignal: true }]
|
|
1443
|
+
}],
|
|
1444
|
+
inputElement: [{
|
|
1445
|
+
type: i0.ViewChild,
|
|
1446
|
+
args: ["input", { isSignal: true }]
|
|
1447
|
+
}]
|
|
1448
|
+
}
|
|
1449
|
+
});
|
|
1450
|
+
export { TX_FILE_SIZE_UNITS, TxFileUpload, TxFileUploadActions, TxFileUploadDropzoneTemplate, TxFileUploadFileTemplate, acceptLabel, fileExtension, fileKind, fileMatchesAccept, fileSizeParts, sameFile };
|
|
1451
|
+
|
|
1452
|
+
//# sourceMappingURL=tectra-ng-ui-file-upload.mjs.map
|