@4sh/ui-kit 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +2 -2
- package/README.md +2 -2
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +4 -4
- package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -1
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +429 -259
- package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
- package/mcp/data/component-api.json +146 -77
- package/mcp/data/text-search-docs.json +90 -20
- package/mcp/data/ui-config.json +174 -143
- package/mcp/package.json +1 -1
- package/package.json +1 -1
- package/styles/component-vars.scss +25 -19
- package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +195 -121
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// design token instead — it follows brand, light/dark and viewport.
|
|
12
12
|
//
|
|
13
13
|
// Generated by `pnpm docs:config`, values read from the compiled CSS — do not
|
|
14
|
-
// edit here.
|
|
14
|
+
// edit here. 1391 variables; 130 more exist whose value depends on the
|
|
15
15
|
// rendered variant, listed in each component’s “Theming” section in Storybook.
|
|
16
16
|
// =====================================================================
|
|
17
17
|
|
|
@@ -443,7 +443,6 @@
|
|
|
443
443
|
// Espacements
|
|
444
444
|
--ui-file-upload-browse-padding-x: var(--units-default);
|
|
445
445
|
--ui-file-upload-browse-padding-x-small: var(--units-md);
|
|
446
|
-
--ui-file-upload-content-gap: var(--units-sm);
|
|
447
446
|
--ui-file-upload-field-gap: var(--units-sm);
|
|
448
447
|
--ui-file-upload-field-padding-x: var(--units-md);
|
|
449
448
|
--ui-file-upload-gap: var(--units-default);
|
|
@@ -466,7 +465,6 @@
|
|
|
466
465
|
--ui-file-upload-field-font-size-small: var(--size-typography-text-md);
|
|
467
466
|
--ui-file-upload-field-text-weight: var(--weight-regular);
|
|
468
467
|
--ui-file-upload-message-font-size: var(--size-typography-text-md);
|
|
469
|
-
--ui-file-upload-total-font-size: var(--size-typography-text-md);
|
|
470
468
|
--ui-file-upload-zone-hint-font-size: var(--size-typography-text-md);
|
|
471
469
|
--ui-file-upload-zone-hint-font-size-small: var(--size-typography-text-sm);
|
|
472
470
|
--ui-file-upload-zone-link-weight: var(--weight-bold);
|
|
@@ -492,13 +490,12 @@
|
|
|
492
490
|
--ui-file-upload-surface-disabled: var(--form-high-surface-disabled);
|
|
493
491
|
--ui-file-upload-surface-dragging: var(--form-high-surface-focused);
|
|
494
492
|
--ui-file-upload-surface-hover: var(--form-high-surface-hover);
|
|
495
|
-
--ui-file-upload-total-color: var(--global-text-muted);
|
|
496
493
|
--ui-file-upload-zone-hint-color: var(--global-text-muted);
|
|
497
494
|
--ui-file-upload-zone-link-color: var(--actions-low-content-default);
|
|
498
495
|
// Divers
|
|
499
496
|
--ui-file-upload-placeholder-opacity: 0.75;
|
|
500
497
|
|
|
501
|
-
// ── ui-file-upload-
|
|
498
|
+
// ── ui-file-upload-item ──
|
|
502
499
|
// Dimensions
|
|
503
500
|
--ui-file-upload-item-media-size: 2.5rem;
|
|
504
501
|
--ui-file-upload-item-media-size-small: 2rem;
|
|
@@ -525,24 +522,33 @@
|
|
|
525
522
|
--ui-file-upload-font-family: var(--fontfamily-base);
|
|
526
523
|
--ui-file-upload-item-meta-font-size: var(--size-typography-text-sm);
|
|
527
524
|
--ui-file-upload-item-meta-font-size-small: var(--size-typography-text-sm);
|
|
525
|
+
--ui-file-upload-item-meta-weight: var(--weight-light);
|
|
528
526
|
--ui-file-upload-item-name-font-size: var(--size-typography-title-sm);
|
|
529
527
|
--ui-file-upload-item-name-font-size-small: var(--size-typography-text-md);
|
|
530
|
-
--ui-file-upload-
|
|
531
|
-
--ui-file-upload-name-weight: var(--weight-bold);
|
|
528
|
+
--ui-file-upload-item-name-weight: var(--weight-bold);
|
|
532
529
|
// Couleurs
|
|
530
|
+
--ui-file-upload-item-color: var(--form-high-content-default);
|
|
531
|
+
--ui-file-upload-item-color-error: var(--form-error-content-default);
|
|
532
|
+
--ui-file-upload-item-name-color: var(--actions-low-content-default);
|
|
533
|
+
--ui-file-upload-item-name-color-hover: var(--actions-low-content-hover);
|
|
534
|
+
--ui-file-upload-item-name-focus-ring-color: var(--form-high-stroke-focused);
|
|
533
535
|
--ui-file-upload-item-progress-color: var(--global-text-default);
|
|
534
|
-
--ui-file-upload-
|
|
535
|
-
--ui-file-upload-
|
|
536
|
-
--ui-file-upload-
|
|
537
|
-
--ui-file-upload-
|
|
538
|
-
--ui-file-upload-
|
|
539
|
-
--ui-file-upload-
|
|
540
|
-
--ui-file-upload-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
--ui-file-upload-list-
|
|
545
|
-
|
|
536
|
+
--ui-file-upload-item-progress-surface: var(--form-high-surface-hover);
|
|
537
|
+
--ui-file-upload-item-remove-color: var(--form-high-content-default);
|
|
538
|
+
--ui-file-upload-item-remove-color-hover: var(--global-text-default);
|
|
539
|
+
--ui-file-upload-item-remove-focus-ring-color: var(--form-high-stroke-focused);
|
|
540
|
+
--ui-file-upload-item-stroke: var(--form-high-stroke-default);
|
|
541
|
+
--ui-file-upload-item-stroke-error: var(--informative-errorhigh-stroke-default);
|
|
542
|
+
--ui-file-upload-item-surface: var(--form-high-surface-default);
|
|
543
|
+
|
|
544
|
+
// ── ui-file-upload-list ──
|
|
545
|
+
// Espacements
|
|
546
|
+
--ui-file-upload-list-gap: var(--units-sm);
|
|
547
|
+
// Typographie
|
|
548
|
+
--ui-file-upload-list-total-font-size: var(--size-typography-text-md);
|
|
549
|
+
--ui-file-upload-list-total-font-size-small: var(--size-typography-text-sm);
|
|
550
|
+
// Couleurs
|
|
551
|
+
--ui-file-upload-list-total-color: var(--global-text-muted);
|
|
546
552
|
|
|
547
553
|
// ── ui-input ──
|
|
548
554
|
// Typographie
|
|
@@ -6,11 +6,11 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
import { TemplateRef } from "@angular/core";
|
|
7
7
|
/** Lifecycle of a selected file. */
|
|
8
8
|
export type UiUploadStatus = 'pending' | 'uploading' | 'completed' | 'error';
|
|
9
|
-
/** A file
|
|
9
|
+
/** A file and its upload state: picked in the uploader, or stored server-side and listed by the app. */
|
|
10
10
|
export interface UiUploadFile {
|
|
11
11
|
/** Stable id for tracking (kept across re-renders); the server id for a stored file. */
|
|
12
12
|
readonly id: string;
|
|
13
|
-
/** The underlying browser File; absent for a file already stored server-side (`
|
|
13
|
+
/** The underlying browser File; absent for a file already stored server-side (`storedUploadFile()`). */
|
|
14
14
|
readonly file?: File;
|
|
15
15
|
/** File name (from the File, exposed for template convenience). */
|
|
16
16
|
readonly name: string;
|
|
@@ -31,9 +31,9 @@ export interface UiUploadFile {
|
|
|
31
31
|
export type UiLocalUploadFile = UiUploadFile & {
|
|
32
32
|
readonly file: File;
|
|
33
33
|
};
|
|
34
|
-
/** A file already stored server-side,
|
|
34
|
+
/** A file already stored server-side, as the app knows it; `storedUploadFile()` makes it a list row. */
|
|
35
35
|
export interface UiStoredFile {
|
|
36
|
-
/** Server id, kept as the row id: `
|
|
36
|
+
/** Server id, kept as the row id: the list's `open` and `remove` hand it back. */
|
|
37
37
|
readonly id: string;
|
|
38
38
|
/** File name. */
|
|
39
39
|
readonly name: string;
|
|
@@ -42,22 +42,25 @@ export interface UiStoredFile {
|
|
|
42
42
|
/** MIME type, when known. */
|
|
43
43
|
readonly type?: string;
|
|
44
44
|
}
|
|
45
|
+
/** A stored file as a list row: status `completed`, no `File`, the server id as row id. */
|
|
46
|
+
export declare function storedUploadFile(stored: UiStoredFile): UiUploadFile;
|
|
45
47
|
/** Whether a file was picked in the browser, as opposed to stored server-side. */
|
|
46
48
|
export declare function isLocalUploadFile(file: UiUploadFile): file is UiLocalUploadFile;
|
|
47
49
|
/** Payload for the custom upload handler (customUpload = true). */
|
|
48
50
|
export interface UiUploadHandlerEvent {
|
|
49
51
|
/** Files awaiting upload (status `pending`), all picked in the browser. */
|
|
50
52
|
files: UiLocalUploadFile[];
|
|
51
|
-
/** Marks a file as uploaded
|
|
53
|
+
/** Marks a file as uploaded: it leaves the uploader's queue and is handed over through `uploaded`. */
|
|
52
54
|
markUploaded: (file: UiUploadFile) => void;
|
|
53
55
|
/** Marks a file as failed with an optional message. */
|
|
54
56
|
markError: (file: UiUploadFile, message?: string) => void;
|
|
55
57
|
/** Updates a file's progress (0–100). */
|
|
56
58
|
setProgress: (file: UiUploadFile, progress: number) => void;
|
|
57
59
|
}
|
|
58
|
-
/** Emitted when files finish uploading (built-in
|
|
60
|
+
/** Emitted when files finish uploading and leave the uploader's queue (built-in or custom upload). */
|
|
59
61
|
export interface UiUploadEvent {
|
|
60
|
-
files:
|
|
62
|
+
/** The uploaded files: status `completed`, `File` kept, preview URL already revoked. */
|
|
63
|
+
files: UiLocalUploadFile[];
|
|
61
64
|
/** Raw XHR of the last request (built-in uploader only). */
|
|
62
65
|
xhr?: XMLHttpRequest;
|
|
63
66
|
}
|
|
@@ -77,28 +80,29 @@ export declare function formatFileSize(bytes: number): string;
|
|
|
77
80
|
export declare function isFileTypeAccepted(file: File, accept: string | undefined): boolean;
|
|
78
81
|
/** Whether a File is a previewable image. */
|
|
79
82
|
export declare function isImageFile(file: File): boolean;
|
|
80
|
-
export type
|
|
83
|
+
export type UiFileUploadItemSize = 'default' | 'small';
|
|
81
84
|
/**
|
|
82
|
-
* ui-file-upload-
|
|
85
|
+
* ui-file-upload-item — a single file row, usable alone or stacked by `ui-file-upload-list`.
|
|
83
86
|
*
|
|
84
87
|
* Presentational: shows a leading thumbnail (for images) or file icon, the file
|
|
85
|
-
* name + size/status, and a remove button. With `openable`, the name
|
|
86
|
-
* `open` (e.g. to preview the file)
|
|
87
|
-
*
|
|
88
|
-
* the
|
|
88
|
+
* name + size/status, and a remove button. With `openable`, the name of a sent or stored file
|
|
89
|
+
* (status `completed`) becomes a button emitting `open` (e.g. to preview the file): a file still
|
|
90
|
+
* pending, uploading or failed has nothing to open yet. Content projected into the row lands next
|
|
91
|
+
* to the remove button, for extra actions. While the file is uploading it swaps the leading icon
|
|
92
|
+
* for a `ui-spinner` and reveals a slim progress bar.
|
|
89
93
|
*
|
|
90
|
-
*
|
|
94
|
+
* Mirrors the Figma file-row component.
|
|
91
95
|
*/
|
|
92
|
-
export declare class
|
|
96
|
+
export declare class UiFileUploadItem {
|
|
93
97
|
/** The file to display (name/size/status/progress/preview). */
|
|
94
98
|
file: import("@angular/core").InputSignal<UiUploadFile>;
|
|
95
99
|
/** Size of the file rows. */
|
|
96
|
-
size: import("@angular/core").InputSignal<
|
|
100
|
+
size: import("@angular/core").InputSignal<UiFileUploadItemSize>;
|
|
97
101
|
/** FontAwesome icon for non-image files. */
|
|
98
102
|
icon: import("@angular/core").InputSignal<string>;
|
|
99
103
|
/** Whether the remove button is shown. */
|
|
100
104
|
removable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
101
|
-
/** Makes the file name a button emitting `open
|
|
105
|
+
/** Makes the file name a button emitting `open` — only once the file is sent or stored (`completed`). */
|
|
102
106
|
openable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
103
107
|
/** Accessible name of the file name button (`openable`) — `{0}` is the file name. */
|
|
104
108
|
openLabel: import("@angular/core").InputSignal<string>;
|
|
@@ -112,10 +116,12 @@ export declare class UiFileUploadList {
|
|
|
112
116
|
progressLabel: import("@angular/core").InputSignal<string>;
|
|
113
117
|
/** Emitted when the remove button is activated. */
|
|
114
118
|
remove: import("@angular/core").OutputEmitterRef<UiUploadFile>;
|
|
115
|
-
/** Emitted when the file name is activated (`openable
|
|
119
|
+
/** Emitted when the file name is activated (`openable`, completed file only). */
|
|
116
120
|
open: import("@angular/core").OutputEmitterRef<UiUploadFile>;
|
|
117
121
|
/** @ignore Formatted size (e.g. "2.5 MB"). */
|
|
118
122
|
protected readonly sizeLabel: import("@angular/core").Signal<string>;
|
|
123
|
+
/** @ignore Whether the name is a button: `openable`, and a sent or stored file to open. */
|
|
124
|
+
protected readonly canOpen: import("@angular/core").Signal<boolean>;
|
|
119
125
|
/** @ignore Accessible name of the file name button (`{0}` filled with the file name). */
|
|
120
126
|
protected readonly openAriaLabel: import("@angular/core").Signal<string>;
|
|
121
127
|
/** @ignore Accessible name of the upload spinner (`{0}` filled with the file name). */
|
|
@@ -138,8 +144,8 @@ export declare class UiFileUploadList {
|
|
|
138
144
|
protected onRemove(): void;
|
|
139
145
|
/** @ignore */
|
|
140
146
|
protected onOpen(): void;
|
|
141
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
142
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
147
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiFileUploadItem, never>;
|
|
148
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiFileUploadItem, "ui-file-upload-item", never, {
|
|
143
149
|
"file": {
|
|
144
150
|
"alias": "file";
|
|
145
151
|
"required": true;
|
|
@@ -195,6 +201,125 @@ export declare class UiFileUploadList {
|
|
|
195
201
|
"open": "open";
|
|
196
202
|
}, never, ["*"], true, never>;
|
|
197
203
|
}
|
|
204
|
+
export type UiFileUploadListSize = 'default' | 'small';
|
|
205
|
+
/**
|
|
206
|
+
* ui-file-upload-list — the list of an app's files: stored ones, uploads in progress, failures.
|
|
207
|
+
*
|
|
208
|
+
* Presentational and stateless: the app owns `files` and decides what `open` and `remove` do
|
|
209
|
+
* (preview, server deletion, `ui-file-upload`'s `remove()` for a queued file…). One
|
|
210
|
+
* `ui-file-upload-item` per file; only a sent or stored file (`completed`) has an openable name.
|
|
211
|
+
* The optional total counts the files that take room, failed ones left out — the same scope as
|
|
212
|
+
* `ui-file-upload`'s `maxTotalSize`.
|
|
213
|
+
*/
|
|
214
|
+
export declare class UiFileUploadList {
|
|
215
|
+
/** The files to list, in order (stored, uploading, failed…). */
|
|
216
|
+
files: import("@angular/core").InputSignal<readonly UiUploadFile[]>;
|
|
217
|
+
/** Size of the rows. */
|
|
218
|
+
size: import("@angular/core").InputSignal<UiFileUploadListSize>;
|
|
219
|
+
/** Whether each row shows its remove button. */
|
|
220
|
+
removable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
221
|
+
/** Makes the name of each sent or stored file (`completed`) a button emitting `open`. */
|
|
222
|
+
openable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
223
|
+
/** Show the file count and total size under the list, failed files left out. */
|
|
224
|
+
showTotal: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
225
|
+
/** Extra actions on each row, next to its remove button (context: `{ $implicit: UiUploadFile, remove, open }`). */
|
|
226
|
+
fileActionsTemplate: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
227
|
+
/** Accessible name of the list. */
|
|
228
|
+
ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
229
|
+
/** Total under the list (`showTotal`) — `{0}` is the file count, `{1}` the total size. */
|
|
230
|
+
totalLabel: import("@angular/core").InputSignal<string>;
|
|
231
|
+
/** Accessible name of a file name button (`openable`) — `{0}` is the file name. */
|
|
232
|
+
openLabel: import("@angular/core").InputSignal<string>;
|
|
233
|
+
/** Accessible name of a remove button (raw text — the file name is appended). */
|
|
234
|
+
removeAriaLabel: import("@angular/core").InputSignal<string>;
|
|
235
|
+
/** Fallback error text when a failed file carries no message. */
|
|
236
|
+
failedLabel: import("@angular/core").InputSignal<string>;
|
|
237
|
+
/** Accessible name of a row's upload spinner — `{0}` is the file name. */
|
|
238
|
+
uploadingLabel: import("@angular/core").InputSignal<string>;
|
|
239
|
+
/** Accessible name of a row's progress bar — `{0}` is the file name. */
|
|
240
|
+
progressLabel: import("@angular/core").InputSignal<string>;
|
|
241
|
+
/** A file name was activated (`openable`, completed file only). */
|
|
242
|
+
open: import("@angular/core").OutputEmitterRef<UiUploadFile>;
|
|
243
|
+
/** A row's remove button was activated: the app removes the file. */
|
|
244
|
+
remove: import("@angular/core").OutputEmitterRef<UiUploadFile>;
|
|
245
|
+
/** @ignore File count and total size, failed files left out (they are stored nowhere). */
|
|
246
|
+
protected readonly totalSummary: import("@angular/core").Signal<string>;
|
|
247
|
+
/** @ignore */
|
|
248
|
+
protected readonly classes: import("@angular/core").Signal<string>;
|
|
249
|
+
/** @ignore */ protected readonly removeFn: (f: UiUploadFile) => void;
|
|
250
|
+
/** @ignore */ protected readonly openFn: (f: UiUploadFile) => void;
|
|
251
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiFileUploadList, never>;
|
|
252
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UiFileUploadList, "ui-file-upload-list", never, {
|
|
253
|
+
"files": {
|
|
254
|
+
"alias": "files";
|
|
255
|
+
"required": false;
|
|
256
|
+
"isSignal": true;
|
|
257
|
+
};
|
|
258
|
+
"size": {
|
|
259
|
+
"alias": "size";
|
|
260
|
+
"required": false;
|
|
261
|
+
"isSignal": true;
|
|
262
|
+
};
|
|
263
|
+
"removable": {
|
|
264
|
+
"alias": "removable";
|
|
265
|
+
"required": false;
|
|
266
|
+
"isSignal": true;
|
|
267
|
+
};
|
|
268
|
+
"openable": {
|
|
269
|
+
"alias": "openable";
|
|
270
|
+
"required": false;
|
|
271
|
+
"isSignal": true;
|
|
272
|
+
};
|
|
273
|
+
"showTotal": {
|
|
274
|
+
"alias": "showTotal";
|
|
275
|
+
"required": false;
|
|
276
|
+
"isSignal": true;
|
|
277
|
+
};
|
|
278
|
+
"fileActionsTemplate": {
|
|
279
|
+
"alias": "fileActionsTemplate";
|
|
280
|
+
"required": false;
|
|
281
|
+
"isSignal": true;
|
|
282
|
+
};
|
|
283
|
+
"ariaLabel": {
|
|
284
|
+
"alias": "ariaLabel";
|
|
285
|
+
"required": false;
|
|
286
|
+
"isSignal": true;
|
|
287
|
+
};
|
|
288
|
+
"totalLabel": {
|
|
289
|
+
"alias": "totalLabel";
|
|
290
|
+
"required": false;
|
|
291
|
+
"isSignal": true;
|
|
292
|
+
};
|
|
293
|
+
"openLabel": {
|
|
294
|
+
"alias": "openLabel";
|
|
295
|
+
"required": false;
|
|
296
|
+
"isSignal": true;
|
|
297
|
+
};
|
|
298
|
+
"removeAriaLabel": {
|
|
299
|
+
"alias": "removeAriaLabel";
|
|
300
|
+
"required": false;
|
|
301
|
+
"isSignal": true;
|
|
302
|
+
};
|
|
303
|
+
"failedLabel": {
|
|
304
|
+
"alias": "failedLabel";
|
|
305
|
+
"required": false;
|
|
306
|
+
"isSignal": true;
|
|
307
|
+
};
|
|
308
|
+
"uploadingLabel": {
|
|
309
|
+
"alias": "uploadingLabel";
|
|
310
|
+
"required": false;
|
|
311
|
+
"isSignal": true;
|
|
312
|
+
};
|
|
313
|
+
"progressLabel": {
|
|
314
|
+
"alias": "progressLabel";
|
|
315
|
+
"required": false;
|
|
316
|
+
"isSignal": true;
|
|
317
|
+
};
|
|
318
|
+
}, {
|
|
319
|
+
"open": "open";
|
|
320
|
+
"remove": "remove";
|
|
321
|
+
}, never, never, true, never>;
|
|
322
|
+
}
|
|
198
323
|
export type UiFileUploadMode = 'field' | 'drag';
|
|
199
324
|
export type UiFileUploadSize = 'default' | 'small';
|
|
200
325
|
/**
|
|
@@ -207,9 +332,11 @@ export type UiFileUploadSize = 'default' | 'small';
|
|
|
207
332
|
* handler (`customUpload`). Progress is tracked with `XMLHttpRequest` so no
|
|
208
333
|
* global HTTP provider is required.
|
|
209
334
|
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
335
|
+
* It is a drop zone and a picker, not a list: it only keeps the files it has not handed to the
|
|
336
|
+
* app yet (its queue: waiting for a manual upload, uploading, or failed), exposed as `files()`.
|
|
337
|
+
* A file leaves the queue once uploaded (`uploaded`); the app owns the list of its files and
|
|
338
|
+
* shows them, queue included, with `ui-file-upload-list`. `add()` feeds files obtained outside
|
|
339
|
+
* the picker (e.g. a camera capture) through the same validation and upload as a selection.
|
|
213
340
|
*
|
|
214
341
|
* Security notes: client-side validation is a UX convenience — always re-validate
|
|
215
342
|
* server-side. Image previews use object URLs that are revoked on removal/clear.
|
|
@@ -217,9 +344,9 @@ export type UiFileUploadSize = 'default' | 'small';
|
|
|
217
344
|
export declare class UiFileUpload {
|
|
218
345
|
/** `field` = compact input + Browse button; `drag` = full drop zone. */
|
|
219
346
|
mode: import("@angular/core").InputSignal<UiFileUploadMode>;
|
|
220
|
-
/** Size of the control
|
|
347
|
+
/** Size of the control and its buttons. */
|
|
221
348
|
size: import("@angular/core").InputSignal<UiFileUploadSize>;
|
|
222
|
-
/** Native `name`: a surrounding `<form>` submits the
|
|
349
|
+
/** Native `name`: a surrounding `<form>` submits the queued files under it. */
|
|
223
350
|
name: import("@angular/core").InputSignal<string | undefined>;
|
|
224
351
|
/** Allow selecting more than one file. */
|
|
225
352
|
multiple: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
@@ -229,18 +356,16 @@ export declare class UiFileUpload {
|
|
|
229
356
|
accept: import("@angular/core").InputSignal<string | undefined>;
|
|
230
357
|
/** Max size per file, in bytes. */
|
|
231
358
|
maxFileSize: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
232
|
-
/** Max size of the
|
|
359
|
+
/** Max size of all the files, in bytes: `currentTotalSize` plus the queue, failed files left out. */
|
|
233
360
|
maxTotalSize: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
234
|
-
/** Max number of files
|
|
361
|
+
/** Max number of files: `currentCount` plus the queue, failed files left out. */
|
|
235
362
|
fileLimit: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
|
|
363
|
+
/** Number of files the app already holds (e.g. stored server-side), counted by `fileLimit`. */
|
|
364
|
+
currentCount: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
365
|
+
/** Size of the files the app already holds, in bytes, counted by `maxTotalSize`. */
|
|
366
|
+
currentTotalSize: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
236
367
|
/** Disables selection, drop and upload. */
|
|
237
368
|
disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
238
|
-
/**
|
|
239
|
-
* Files already stored server-side, listed with the new ones (status `completed`, no `File`).
|
|
240
|
-
* Setting it resets the selection to these files, without emitting `filesChange`; files picked
|
|
241
|
-
* in the browser and not uploaded yet (pending, uploading, failed) are kept.
|
|
242
|
-
*/
|
|
243
|
-
initialFiles: import("@angular/core").InputSignal<UiStoredFile[]>;
|
|
244
369
|
/** Upload each file as soon as it is selected. */
|
|
245
370
|
auto: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
246
371
|
/** Delegate uploading to the `uploadHandler` output instead of the built-in XHR. */
|
|
@@ -253,21 +378,15 @@ export declare class UiFileUpload {
|
|
|
253
378
|
fieldName: import("@angular/core").InputSignal<string>;
|
|
254
379
|
/** Send credentials (cookies) with the built-in upload request. */
|
|
255
380
|
withCredentials: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
256
|
-
/** Show the file list under the control. */
|
|
257
|
-
showFileList: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
258
381
|
/** Show the Upload/Cancel toolbar buttons (drag mode). */
|
|
259
382
|
showControls: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
260
|
-
/** Show the file count and total size under the list. */
|
|
261
|
-
showTotal: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
262
|
-
/** Makes each file name a button emitting `fileOpen` (e.g. to preview the file). */
|
|
263
|
-
openable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
264
383
|
/** Label of the Browse button. */
|
|
265
384
|
browseLabel: import("@angular/core").InputSignal<string>;
|
|
266
385
|
/** Placeholder shown in field mode before any selection. */
|
|
267
386
|
chooseLabel: import("@angular/core").InputSignal<string>;
|
|
268
387
|
/** Label of the Upload toolbar button (drag mode). */
|
|
269
388
|
uploadLabel: import("@angular/core").InputSignal<string>;
|
|
270
|
-
/** Label of the toolbar button that clears the
|
|
389
|
+
/** Label of the toolbar button that clears the queue (drag mode). */
|
|
271
390
|
cancelLabel: import("@angular/core").InputSignal<string>;
|
|
272
391
|
/** Drag-zone link + prompt. */
|
|
273
392
|
dragLinkLabel: import("@angular/core").InputSignal<string>;
|
|
@@ -283,8 +402,6 @@ export declare class UiFileUpload {
|
|
|
283
402
|
invalidTypeMessage: import("@angular/core").InputSignal<string>;
|
|
284
403
|
/** Rejection message: file too large — `{0}` is the file name. */
|
|
285
404
|
invalidSizeMessage: import("@angular/core").InputSignal<string>;
|
|
286
|
-
/** Total under the list (`showTotal`) — `{0}` is the file count, `{1}` the total size. */
|
|
287
|
-
totalLabel: import("@angular/core").InputSignal<string>;
|
|
288
405
|
/** Rejection message: `maxTotalSize` exceeded — `{0}` is the file name, `{1}` the limit. */
|
|
289
406
|
totalSizeExceededMessage: import("@angular/core").InputSignal<string>;
|
|
290
407
|
/** Rejection message: `fileLimit` reached — `{0}` is the limit. */
|
|
@@ -295,30 +412,22 @@ export declare class UiFileUpload {
|
|
|
295
412
|
networkErrorMessage: import("@angular/core").InputSignal<string>;
|
|
296
413
|
/** Error shown on a non-2xx response — `{0}` is the HTTP status. */
|
|
297
414
|
httpErrorMessage: import("@angular/core").InputSignal<string>;
|
|
298
|
-
/**
|
|
299
|
-
fileTemplate: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
300
|
-
/** Extra actions on a default file row, next to its remove button (context: `{ $implicit: UiUploadFile, remove, open }`). */
|
|
301
|
-
fileActionsTemplate: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
302
|
-
/** Overrides the content section (context: `{ $implicit: UiUploadFile[], remove, clear }`). */
|
|
303
|
-
contentTemplate: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
304
|
-
/** Custom toolbar content (context: `{ $implicit: UiUploadFile[], choose, upload, clear }`). */
|
|
415
|
+
/** Custom toolbar content (context: `{ $implicit: UiLocalUploadFile[], choose, upload, clear }`). */
|
|
305
416
|
toolbarTemplate: import("@angular/core").InputSignal<TemplateRef<unknown> | undefined>;
|
|
306
|
-
/** Files added to the
|
|
417
|
+
/** Files added to the queue (validated). */
|
|
307
418
|
selected: import("@angular/core").OutputEmitterRef<UiLocalUploadFile[]>;
|
|
308
|
-
/** The
|
|
309
|
-
filesChange: import("@angular/core").OutputEmitterRef<
|
|
419
|
+
/** The queue changed (files added, removed, cleared or handed over). */
|
|
420
|
+
filesChange: import("@angular/core").OutputEmitterRef<UiLocalUploadFile[]>;
|
|
310
421
|
/** A custom upload was requested (customUpload = true). */
|
|
311
422
|
uploadHandler: import("@angular/core").OutputEmitterRef<UiUploadHandlerEvent>;
|
|
312
|
-
/**
|
|
423
|
+
/** A file was uploaded (built-in or custom upload) and leaves the queue: the app takes it over. */
|
|
313
424
|
uploaded: import("@angular/core").OutputEmitterRef<UiUploadEvent>;
|
|
314
425
|
/** A file failed validation or upload. */
|
|
315
426
|
uploadError: import("@angular/core").OutputEmitterRef<UiUploadErrorEvent>;
|
|
316
|
-
/** A file was removed. */
|
|
317
|
-
removed: import("@angular/core").OutputEmitterRef<
|
|
318
|
-
/** The
|
|
427
|
+
/** A queued file was removed (`remove()`, or replaced in single-file mode). */
|
|
428
|
+
removed: import("@angular/core").OutputEmitterRef<UiLocalUploadFile>;
|
|
429
|
+
/** The queue was cleared. */
|
|
319
430
|
cleared: import("@angular/core").OutputEmitterRef<void>;
|
|
320
|
-
/** A file name was activated (`openable`). */
|
|
321
|
-
fileOpen: import("@angular/core").OutputEmitterRef<UiUploadFile>;
|
|
322
431
|
/** @ignore Stable id linking the visible label(s) to the native input. */
|
|
323
432
|
protected readonly inputId: string;
|
|
324
433
|
private readonly host;
|
|
@@ -327,13 +436,10 @@ export declare class UiFileUpload {
|
|
|
327
436
|
private readonly formValueInput;
|
|
328
437
|
/** In-flight requests, keyed by file id, so we can abort. */
|
|
329
438
|
private readonly requests;
|
|
330
|
-
/** @ignore
|
|
331
|
-
private readonly
|
|
332
|
-
/**
|
|
333
|
-
readonly files: import("@angular/core").Signal<
|
|
334
|
-
/** @ignore `initialFiles` compared by content, so a list rebuilt on every check (same files)
|
|
335
|
-
* does not wipe the files the user has just added. */
|
|
336
|
-
private readonly storedFiles;
|
|
439
|
+
/** @ignore Files not handed to the app yet: pending, uploading or failed. */
|
|
440
|
+
private readonly queue;
|
|
441
|
+
/** The queue, read-only: the files not handed to the app yet (pending, uploading, failed). */
|
|
442
|
+
readonly files: import("@angular/core").Signal<UiLocalUploadFile[]>;
|
|
337
443
|
/** @ignore Drop-zone highlight while dragging over. */
|
|
338
444
|
protected readonly dragging: import("@angular/core").WritableSignal<boolean>;
|
|
339
445
|
/** @ignore Transient validation messages (rendered in a live region). */
|
|
@@ -341,38 +447,32 @@ export declare class UiFileUpload {
|
|
|
341
447
|
constructor();
|
|
342
448
|
/** @ignore */
|
|
343
449
|
protected readonly hasFiles: import("@angular/core").Signal<boolean>;
|
|
344
|
-
/** @ignore Files picked in the browser: what the toolbar's clear acts on. */
|
|
345
|
-
protected readonly hasLocalFiles: import("@angular/core").Signal<boolean>;
|
|
346
450
|
/** @ignore */
|
|
347
451
|
protected readonly pending: import("@angular/core").Signal<UiLocalUploadFile[]>;
|
|
348
|
-
/** @ignore
|
|
349
|
-
protected readonly totalSummary: import("@angular/core").Signal<string>;
|
|
350
|
-
/** @ignore Single-file summary shown in field mode. */
|
|
452
|
+
/** @ignore Summary shown in field mode: the queued files. */
|
|
351
453
|
protected readonly fieldSummary: import("@angular/core").Signal<string>;
|
|
352
454
|
/** @ignore */
|
|
353
455
|
protected readonly canUpload: import("@angular/core").Signal<boolean>;
|
|
354
456
|
/** @ignore */
|
|
355
457
|
protected readonly classes: import("@angular/core").Signal<string>;
|
|
356
|
-
/** @ignore */ protected readonly removeFn: (f: UiUploadFile) => void;
|
|
357
458
|
/** @ignore */ protected readonly clearFn: () => void;
|
|
358
459
|
/** @ignore */ protected readonly chooseFn: () => void;
|
|
359
460
|
/** @ignore */ protected readonly uploadFn: () => void;
|
|
360
|
-
/** @ignore */ protected readonly openFn: (f: UiUploadFile) => void;
|
|
361
461
|
/** Opens the native file picker. */
|
|
362
462
|
choose(): void;
|
|
363
463
|
/**
|
|
364
464
|
* Adds files obtained outside the picker (e.g. a camera capture) exactly like a selection or a
|
|
365
|
-
* drop: validation and its messages,
|
|
465
|
+
* drop: validation and its messages, queue, then upload when `auto`.
|
|
366
466
|
*/
|
|
367
467
|
add(files: FileList | readonly File[]): void;
|
|
368
468
|
/** Uploads all pending files (built-in XHR, or emits `uploadHandler`). */
|
|
369
469
|
upload(): void;
|
|
370
|
-
/** Removes a file (aborts its upload, revokes its preview). */
|
|
371
|
-
remove(target: UiUploadFile): void;
|
|
372
470
|
/**
|
|
373
|
-
*
|
|
374
|
-
*
|
|
471
|
+
* Removes a queued file (aborts its upload, revokes its preview). A file the queue does not
|
|
472
|
+
* hold (already handed over, or one of the app's) is ignored: the app removes those.
|
|
375
473
|
*/
|
|
474
|
+
remove(target: UiUploadFile): void;
|
|
475
|
+
/** Empties the queue (aborts the uploads in progress). The app's files are not touched. */
|
|
376
476
|
clear(): void;
|
|
377
477
|
/** @ignore */
|
|
378
478
|
protected onInputChange(event: Event): void;
|
|
@@ -382,14 +482,19 @@ export declare class UiFileUpload {
|
|
|
382
482
|
protected onDragLeave(event: DragEvent): void;
|
|
383
483
|
/** @ignore */
|
|
384
484
|
protected onDrop(event: DragEvent): void;
|
|
385
|
-
/** Validate + add files to the
|
|
485
|
+
/** Validate + add files to the queue. */
|
|
386
486
|
private ingest;
|
|
387
|
-
/** Resets the selection to the stored files, keeping the unfinished local ones, without outputs. */
|
|
388
|
-
private reset;
|
|
389
487
|
private toUploadFile;
|
|
390
488
|
private fail;
|
|
391
|
-
/** Mutates one file
|
|
489
|
+
/** Mutates one queued file (immutably) and pushes a new array reference. */
|
|
392
490
|
private patch;
|
|
491
|
+
/**
|
|
492
|
+
* Hands an uploaded file over to the app: it leaves the queue and is emitted through
|
|
493
|
+
* `uploaded`, completed, its preview URL revoked (the queue owned it; the `File` stays).
|
|
494
|
+
*/
|
|
495
|
+
private handOver;
|
|
496
|
+
/** Aborts a queued file's upload and revokes its preview. */
|
|
497
|
+
private drop;
|
|
393
498
|
private emitCustomUpload;
|
|
394
499
|
private xhrUpload;
|
|
395
500
|
private uploadFailed;
|
|
@@ -442,13 +547,18 @@ export declare class UiFileUpload {
|
|
|
442
547
|
"required": false;
|
|
443
548
|
"isSignal": true;
|
|
444
549
|
};
|
|
445
|
-
"
|
|
446
|
-
"alias": "
|
|
550
|
+
"currentCount": {
|
|
551
|
+
"alias": "currentCount";
|
|
552
|
+
"required": false;
|
|
553
|
+
"isSignal": true;
|
|
554
|
+
};
|
|
555
|
+
"currentTotalSize": {
|
|
556
|
+
"alias": "currentTotalSize";
|
|
447
557
|
"required": false;
|
|
448
558
|
"isSignal": true;
|
|
449
559
|
};
|
|
450
|
-
"
|
|
451
|
-
"alias": "
|
|
560
|
+
"disabled": {
|
|
561
|
+
"alias": "disabled";
|
|
452
562
|
"required": false;
|
|
453
563
|
"isSignal": true;
|
|
454
564
|
};
|
|
@@ -482,26 +592,11 @@ export declare class UiFileUpload {
|
|
|
482
592
|
"required": false;
|
|
483
593
|
"isSignal": true;
|
|
484
594
|
};
|
|
485
|
-
"showFileList": {
|
|
486
|
-
"alias": "showFileList";
|
|
487
|
-
"required": false;
|
|
488
|
-
"isSignal": true;
|
|
489
|
-
};
|
|
490
595
|
"showControls": {
|
|
491
596
|
"alias": "showControls";
|
|
492
597
|
"required": false;
|
|
493
598
|
"isSignal": true;
|
|
494
599
|
};
|
|
495
|
-
"showTotal": {
|
|
496
|
-
"alias": "showTotal";
|
|
497
|
-
"required": false;
|
|
498
|
-
"isSignal": true;
|
|
499
|
-
};
|
|
500
|
-
"openable": {
|
|
501
|
-
"alias": "openable";
|
|
502
|
-
"required": false;
|
|
503
|
-
"isSignal": true;
|
|
504
|
-
};
|
|
505
600
|
"browseLabel": {
|
|
506
601
|
"alias": "browseLabel";
|
|
507
602
|
"required": false;
|
|
@@ -557,11 +652,6 @@ export declare class UiFileUpload {
|
|
|
557
652
|
"required": false;
|
|
558
653
|
"isSignal": true;
|
|
559
654
|
};
|
|
560
|
-
"totalLabel": {
|
|
561
|
-
"alias": "totalLabel";
|
|
562
|
-
"required": false;
|
|
563
|
-
"isSignal": true;
|
|
564
|
-
};
|
|
565
655
|
"totalSizeExceededMessage": {
|
|
566
656
|
"alias": "totalSizeExceededMessage";
|
|
567
657
|
"required": false;
|
|
@@ -587,21 +677,6 @@ export declare class UiFileUpload {
|
|
|
587
677
|
"required": false;
|
|
588
678
|
"isSignal": true;
|
|
589
679
|
};
|
|
590
|
-
"fileTemplate": {
|
|
591
|
-
"alias": "fileTemplate";
|
|
592
|
-
"required": false;
|
|
593
|
-
"isSignal": true;
|
|
594
|
-
};
|
|
595
|
-
"fileActionsTemplate": {
|
|
596
|
-
"alias": "fileActionsTemplate";
|
|
597
|
-
"required": false;
|
|
598
|
-
"isSignal": true;
|
|
599
|
-
};
|
|
600
|
-
"contentTemplate": {
|
|
601
|
-
"alias": "contentTemplate";
|
|
602
|
-
"required": false;
|
|
603
|
-
"isSignal": true;
|
|
604
|
-
};
|
|
605
680
|
"toolbarTemplate": {
|
|
606
681
|
"alias": "toolbarTemplate";
|
|
607
682
|
"required": false;
|
|
@@ -615,6 +690,5 @@ export declare class UiFileUpload {
|
|
|
615
690
|
"uploadError": "uploadError";
|
|
616
691
|
"removed": "removed";
|
|
617
692
|
"cleared": "cleared";
|
|
618
|
-
"fileOpen": "fileOpen";
|
|
619
693
|
}, never, never, true, never>;
|
|
620
694
|
}
|