@functionalcms/svelte-components 4.14.0 → 4.14.3
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/dist/components/form/dropzone/DefaultDropzone.svelte +1 -1
- package/dist/components/form/dropzone/DefaultDropzone.svelte.d.ts +1 -1
- package/dist/components/form/dropzone/Dropzone.svelte +14 -6
- package/dist/components/form/dropzone/Dropzone.svelte.d.ts +1 -1
- package/dist/components/form/dropzone/UseDropzone.d.ts +1 -1
- package/dist/components/form/dropzone/attr-accept.d.ts +1 -1
- package/dist/components/form/dropzone/default.d.ts +1 -1
- package/dist/components/form/dropzone/default.js +1 -1
- package/dist/components/form/dropzone/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { CustomDropzoneProps } from './types.
|
|
3
|
+
import type { CustomDropzoneProps } from './types.js';
|
|
4
4
|
interface DefaultDropzone extends CustomDropzoneProps {
|
|
5
5
|
defaultDropzoneElement: HTMLElement | undefined;
|
|
6
6
|
children: Snippet;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { CustomDropzoneProps } from './types.
|
|
2
|
+
import type { CustomDropzoneProps } from './types.js';
|
|
3
3
|
interface DefaultDropzone extends CustomDropzoneProps {
|
|
4
4
|
defaultDropzoneElement: HTMLElement | undefined;
|
|
5
5
|
children: Snippet;
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
isEventWithFiles,
|
|
7
7
|
isIeOrEdge,
|
|
8
8
|
isPropagationStopped
|
|
9
|
-
} from './default.
|
|
9
|
+
} from './default.js';
|
|
10
10
|
import type {
|
|
11
11
|
DropzoneEventHandler,
|
|
12
12
|
DropzoneProps,
|
|
13
13
|
FromEventFileTypes,
|
|
14
14
|
RejectedFile
|
|
15
|
-
} from './types.
|
|
15
|
+
} from './types.js';
|
|
16
16
|
import type { EventHandler } from 'svelte/elements';
|
|
17
17
|
import DefaultDropzone from './DefaultDropzone.svelte';
|
|
18
|
-
import useDropzone from './UseDropzone.
|
|
18
|
+
import useDropzone from './UseDropzone.js';
|
|
19
19
|
|
|
20
20
|
let {
|
|
21
21
|
accept,
|
|
@@ -24,11 +24,13 @@
|
|
|
24
24
|
maxSize = Infinity,
|
|
25
25
|
minSize = 0,
|
|
26
26
|
multiple = false,
|
|
27
|
+
dropzoneText = undefined,
|
|
27
28
|
preventDropOnDocument = true,
|
|
28
29
|
disableDropzoneClick = false,
|
|
29
30
|
disableDropzoneKeydown = false,
|
|
30
31
|
disableDropzoneDrag = false,
|
|
31
32
|
name = '',
|
|
33
|
+
appendOnDrop = false,
|
|
32
34
|
inputElement = $bindable(),
|
|
33
35
|
required = false,
|
|
34
36
|
dropzoneElement = $bindable(),
|
|
@@ -195,6 +197,11 @@
|
|
|
195
197
|
const dataTransfer = new DataTransfer();
|
|
196
198
|
const incomingFiles = acceptedFiles;
|
|
197
199
|
incomingFiles.forEach((v) => dataTransfer.items.add(v));
|
|
200
|
+
if (appendOnDrop) {
|
|
201
|
+
for(const file of inputElement.files || []) {
|
|
202
|
+
dataTransfer.items.add(file);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
198
205
|
inputElement.files = dataTransfer.files;
|
|
199
206
|
}
|
|
200
207
|
}
|
|
@@ -210,9 +217,10 @@
|
|
|
210
217
|
);
|
|
211
218
|
|
|
212
219
|
let defaultPlaceholderString = $derived(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
dropzoneText ||
|
|
221
|
+
(multiple
|
|
222
|
+
? "Drag 'n' drop some files here, or click to select files"
|
|
223
|
+
: "Drag 'n' drop a file here, or click to select a file")
|
|
216
224
|
);
|
|
217
225
|
|
|
218
226
|
// allow the entire document to be a drag target
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DropzoneProps } from './types.
|
|
1
|
+
import type { DropzoneProps } from './types.js';
|
|
2
2
|
declare const Dropzone: import("svelte").Component<DropzoneProps, {}, "inputElement" | "dropzoneElement">;
|
|
3
3
|
type Dropzone = ReturnType<typeof Dropzone>;
|
|
4
4
|
export default Dropzone;
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* @param accept {string}
|
|
9
9
|
* @returns {boolean}
|
|
10
10
|
*/
|
|
11
|
-
import type { FromEventFileTypes, MimeTypes } from "./types.
|
|
11
|
+
import type { FromEventFileTypes, MimeTypes } from "./types.js";
|
|
12
12
|
export default function (file: FromEventFileTypes, accept: MimeTypes[] | string[]): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FromEventFileTypes, MimeTypes, DropzoneErrorCode } from "./types.
|
|
1
|
+
import type { FromEventFileTypes, MimeTypes, DropzoneErrorCode } from "./types.js";
|
|
2
2
|
export declare const FILE_INVALID_TYPE = "file-invalid-type";
|
|
3
3
|
export declare const FILE_TOO_LARGE = "file-too-large";
|
|
4
4
|
export declare const FILE_TOO_SMALL = "file-too-small";
|
|
@@ -41,6 +41,7 @@ export interface DropzoneProps {
|
|
|
41
41
|
maxSize?: number;
|
|
42
42
|
minSize?: number;
|
|
43
43
|
multiple?: boolean;
|
|
44
|
+
dropzoneText?: string;
|
|
44
45
|
maxFileCountPerUpload?: number;
|
|
45
46
|
preventDropOnDocument?: boolean;
|
|
46
47
|
disableDropzoneClick?: boolean;
|
|
@@ -50,6 +51,7 @@ export interface DropzoneProps {
|
|
|
50
51
|
required?: boolean;
|
|
51
52
|
inputElement?: HTMLInputElement;
|
|
52
53
|
dropzoneElement?: HTMLElement | undefined;
|
|
54
|
+
appendOnDrop: boolean;
|
|
53
55
|
CustomDropzone?: Snippet<[CustomDropzoneProps]> | undefined;
|
|
54
56
|
children?: Snippet;
|
|
55
57
|
onDragenter?: DropzoneEventHandler<DataTransferItem>;
|