@mantine-vue/dropzone 3.0.0 → 3.1.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/cjs/index.cjs +356 -290
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +353 -289
- package/esm/index.mjs.map +1 -1
- package/lib/components/Dropzone/Dropzone.types.d.ts +102 -0
- package/lib/components/Dropzone/Dropzone.vue.d.ts +32 -0
- package/lib/components/Dropzone/index.d.ts +19 -0
- package/lib/components/DropzoneFullScreen/DropzoneFullScreen.types.d.ts +30 -0
- package/lib/components/DropzoneFullScreen/DropzoneFullScreen.vue.d.ts +33 -0
- package/lib/components/DropzoneFullScreen/index.d.ts +11 -0
- package/lib/components/DropzoneStatus/DropzoneAccept.vue.d.ts +3 -0
- package/lib/components/DropzoneStatus/DropzoneIdle.vue.d.ts +3 -0
- package/lib/components/DropzoneStatus/DropzoneReject.vue.d.ts +3 -0
- package/lib/components/DropzoneStatus/DropzoneStatus.types.d.ts +8 -0
- package/lib/components/DropzoneStatus/DropzoneStatus.vue.d.ts +8 -0
- package/lib/components/DropzoneStatus/index.d.ts +4 -0
- package/lib/index.d.mts +6 -6
- package/lib/index.d.ts +6 -6
- package/package.json +3 -3
- package/lib/Dropzone.d.ts +0 -1240
- package/lib/DropzoneFullScreen.d.ts +0 -101
- package/lib/DropzoneStatus.d.ts +0 -58
package/cjs/index.cjs
CHANGED
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _mantine_vue_core = require("@mantine-vue/core");
|
|
2
3
|
let vue = require("vue");
|
|
3
4
|
let _mantine_vue_hooks = require("@mantine-vue/hooks");
|
|
4
|
-
let _mantine_vue_core = require("@mantine-vue/core");
|
|
5
5
|
//#region src/Dropzone.context.ts
|
|
6
6
|
var [provideDropzoneContext, useDropzoneContext] = (0, _mantine_vue_core.createSafeContext)("Dropzone component was not found in tree");
|
|
7
7
|
//#endregion
|
|
8
|
-
//#region src/DropzoneStatus.ts
|
|
9
|
-
function upperFirst(value) {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
function createDropzoneStatus(status) {
|
|
13
|
-
return (0, vue.defineComponent)({
|
|
14
|
-
name: `Dropzone${upperFirst(status)}`,
|
|
15
|
-
slots: Object,
|
|
16
|
-
props: { children: {
|
|
17
|
-
type: null,
|
|
18
|
-
default: void 0
|
|
19
|
-
} },
|
|
20
|
-
setup(props, { slots, attrs }) {
|
|
21
|
-
const ctx = useDropzoneContext();
|
|
22
|
-
return () => {
|
|
23
|
-
if (!ctx[status]) return null;
|
|
24
|
-
const slotChildren = slots.default?.();
|
|
25
|
-
const children = props.children !== void 0 ? props.children : slotChildren;
|
|
26
|
-
const child = Array.isArray(children) && children.length === 1 ? children[0] : children;
|
|
27
|
-
if ((0, vue.isVNode)(child) && !Array.isArray(child)) return (0, vue.cloneVNode)(child, attrs);
|
|
28
|
-
return (0, vue.h)("span", attrs, children);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
var DropzoneAccept = createDropzoneStatus("accept");
|
|
34
|
-
var DropzoneReject = createDropzoneStatus("reject");
|
|
35
|
-
var DropzoneIdle = createDropzoneStatus("idle");
|
|
36
|
-
//#endregion
|
|
37
8
|
//#region src/get-files-from-event.ts
|
|
38
9
|
function toFileWithPath(file, path) {
|
|
39
10
|
const fileWithPath = file;
|
|
@@ -459,19 +430,8 @@ var Dropzone_module_default = {
|
|
|
459
430
|
dropzone: "_dropzone_27ynu_71"
|
|
460
431
|
};
|
|
461
432
|
//#endregion
|
|
462
|
-
//#region src/Dropzone.ts
|
|
463
|
-
var
|
|
464
|
-
multiple: true,
|
|
465
|
-
maxSize: Infinity,
|
|
466
|
-
activateOnClick: true,
|
|
467
|
-
activateOnDrag: true,
|
|
468
|
-
dragEventsBubbling: true,
|
|
469
|
-
activateOnKeyboard: true,
|
|
470
|
-
useFsAccessApi: false,
|
|
471
|
-
preventDropOnDocument: true,
|
|
472
|
-
variant: "light",
|
|
473
|
-
rejectColor: "red"
|
|
474
|
-
};
|
|
433
|
+
//#region src/components/Dropzone/Dropzone.vue?vue&type=script&setup=true&lang.ts
|
|
434
|
+
var _hoisted_1 = ["data-enable-pointer-events"];
|
|
475
435
|
var varsResolver = (0, _mantine_vue_core.createVarsResolver)((theme, { radius, variant, acceptColor, rejectColor }) => {
|
|
476
436
|
const acceptColors = theme.variantColorResolver({
|
|
477
437
|
color: acceptColor || theme.primaryColor,
|
|
@@ -491,22 +451,17 @@ var varsResolver = (0, _mantine_vue_core.createVarsResolver)((theme, { radius, v
|
|
|
491
451
|
"--dropzone-reject-bg": rejectColors.background
|
|
492
452
|
} };
|
|
493
453
|
});
|
|
494
|
-
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/components/Dropzone/Dropzone.vue
|
|
456
|
+
var Dropzone_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
495
457
|
name: "Dropzone",
|
|
496
458
|
inheritAttrs: false,
|
|
459
|
+
__name: "Dropzone",
|
|
497
460
|
props: {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
},
|
|
502
|
-
rejectColor: {
|
|
503
|
-
type: String,
|
|
504
|
-
default: void 0
|
|
505
|
-
},
|
|
506
|
-
radius: {
|
|
507
|
-
type: [String, Number],
|
|
508
|
-
default: void 0
|
|
509
|
-
},
|
|
461
|
+
rootRef: {},
|
|
462
|
+
acceptColor: {},
|
|
463
|
+
rejectColor: { default: "red" },
|
|
464
|
+
radius: {},
|
|
510
465
|
disabled: {
|
|
511
466
|
type: Boolean,
|
|
512
467
|
default: false
|
|
@@ -515,133 +470,69 @@ var DropzoneBaseComponent = (0, vue.defineComponent)({
|
|
|
515
470
|
type: Boolean,
|
|
516
471
|
default: false
|
|
517
472
|
},
|
|
518
|
-
accept: {
|
|
519
|
-
|
|
520
|
-
default: void 0
|
|
521
|
-
},
|
|
473
|
+
accept: {},
|
|
474
|
+
openRef: {},
|
|
522
475
|
multiple: {
|
|
523
476
|
type: Boolean,
|
|
524
|
-
default:
|
|
525
|
-
},
|
|
526
|
-
maxSize: {
|
|
527
|
-
type: Number,
|
|
528
|
-
default: void 0
|
|
529
|
-
},
|
|
530
|
-
name: {
|
|
531
|
-
type: String,
|
|
532
|
-
default: void 0
|
|
533
|
-
},
|
|
534
|
-
maxFiles: {
|
|
535
|
-
type: Number,
|
|
536
|
-
default: void 0
|
|
537
|
-
},
|
|
538
|
-
autoFocus: {
|
|
539
|
-
type: Boolean,
|
|
540
|
-
default: false
|
|
477
|
+
default: true
|
|
541
478
|
},
|
|
479
|
+
maxSize: { default: Infinity },
|
|
480
|
+
name: {},
|
|
481
|
+
maxFiles: {},
|
|
482
|
+
autoFocus: { type: Boolean },
|
|
542
483
|
activateOnClick: {
|
|
543
484
|
type: Boolean,
|
|
544
|
-
default:
|
|
485
|
+
default: true
|
|
545
486
|
},
|
|
546
487
|
activateOnDrag: {
|
|
547
488
|
type: Boolean,
|
|
548
|
-
default:
|
|
489
|
+
default: true
|
|
549
490
|
},
|
|
550
491
|
activateOnKeyboard: {
|
|
551
492
|
type: Boolean,
|
|
552
|
-
default:
|
|
493
|
+
default: true
|
|
553
494
|
},
|
|
554
495
|
dragEventsBubbling: {
|
|
555
496
|
type: Boolean,
|
|
556
|
-
default:
|
|
497
|
+
default: true
|
|
557
498
|
},
|
|
558
499
|
preventDropOnDocument: {
|
|
559
500
|
type: Boolean,
|
|
560
|
-
default:
|
|
501
|
+
default: true
|
|
561
502
|
},
|
|
562
503
|
useFsAccessApi: {
|
|
563
504
|
type: Boolean,
|
|
564
|
-
default:
|
|
505
|
+
default: false
|
|
565
506
|
},
|
|
507
|
+
getFilesFromEvent: {},
|
|
508
|
+
validator: {},
|
|
566
509
|
enablePointerEvents: {
|
|
567
510
|
type: Boolean,
|
|
568
511
|
default: false
|
|
569
512
|
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
},
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
},
|
|
578
|
-
inputProps: {
|
|
579
|
-
type: Object,
|
|
580
|
-
default: void 0
|
|
581
|
-
},
|
|
582
|
-
validator: {
|
|
583
|
-
type: Function,
|
|
584
|
-
default: void 0
|
|
585
|
-
},
|
|
586
|
-
getFilesFromEvent: {
|
|
587
|
-
type: Function,
|
|
588
|
-
default: void 0
|
|
589
|
-
},
|
|
590
|
-
openRef: {
|
|
591
|
-
type: [Object, Function],
|
|
592
|
-
default: void 0
|
|
593
|
-
},
|
|
594
|
-
onDrop: {
|
|
595
|
-
type: Function,
|
|
596
|
-
required: true
|
|
597
|
-
},
|
|
598
|
-
onDropAny: {
|
|
599
|
-
type: Function,
|
|
600
|
-
default: void 0
|
|
601
|
-
},
|
|
602
|
-
onReject: {
|
|
603
|
-
type: Function,
|
|
604
|
-
default: void 0
|
|
605
|
-
},
|
|
606
|
-
onDragEnter: {
|
|
607
|
-
type: Function,
|
|
608
|
-
default: void 0
|
|
609
|
-
},
|
|
610
|
-
onDragLeave: {
|
|
611
|
-
type: Function,
|
|
612
|
-
default: void 0
|
|
613
|
-
},
|
|
614
|
-
onDragOver: {
|
|
615
|
-
type: Function,
|
|
616
|
-
default: void 0
|
|
617
|
-
},
|
|
618
|
-
onFileDialogCancel: {
|
|
619
|
-
type: Function,
|
|
620
|
-
default: void 0
|
|
621
|
-
},
|
|
622
|
-
onFileDialogOpen: {
|
|
623
|
-
type: Function,
|
|
624
|
-
default: void 0
|
|
625
|
-
},
|
|
626
|
-
classNames: {
|
|
627
|
-
type: [Object, Function],
|
|
628
|
-
default: void 0
|
|
629
|
-
},
|
|
630
|
-
styles: {
|
|
631
|
-
type: [Object, Function],
|
|
632
|
-
default: void 0
|
|
633
|
-
},
|
|
634
|
-
vars: {
|
|
635
|
-
type: [Object, Function],
|
|
636
|
-
default: void 0
|
|
637
|
-
},
|
|
638
|
-
unstyled: {
|
|
639
|
-
type: Boolean,
|
|
640
|
-
default: false
|
|
641
|
-
}
|
|
513
|
+
loaderProps: {},
|
|
514
|
+
inputProps: {},
|
|
515
|
+
variant: { default: "light" },
|
|
516
|
+
classNames: {},
|
|
517
|
+
styles: {},
|
|
518
|
+
vars: {},
|
|
519
|
+
unstyled: { type: Boolean }
|
|
642
520
|
},
|
|
643
|
-
|
|
644
|
-
|
|
521
|
+
emits: [
|
|
522
|
+
"drop-any",
|
|
523
|
+
"drop",
|
|
524
|
+
"reject",
|
|
525
|
+
"drag-enter",
|
|
526
|
+
"drag-leave",
|
|
527
|
+
"drag-over",
|
|
528
|
+
"file-dialog-cancel",
|
|
529
|
+
"file-dialog-open"
|
|
530
|
+
],
|
|
531
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
532
|
+
const rawProps = __props;
|
|
533
|
+
const emit = __emit;
|
|
534
|
+
const props = (0, _mantine_vue_core.useProps)("Dropzone", null, rawProps);
|
|
535
|
+
const attrs = (0, vue.useAttrs)();
|
|
645
536
|
const getStyles = (0, _mantine_vue_core.useStyles)({
|
|
646
537
|
name: "Dropzone",
|
|
647
538
|
classes: Dropzone_module_default,
|
|
@@ -655,8 +546,8 @@ var DropzoneBaseComponent = (0, vue.defineComponent)({
|
|
|
655
546
|
unstyled: props.unstyled
|
|
656
547
|
});
|
|
657
548
|
const dz = useDropzone({
|
|
658
|
-
accept: () => Array.isArray(props.accept) ? props.accept.reduce((
|
|
659
|
-
...
|
|
549
|
+
accept: () => Array.isArray(props.accept) ? props.accept.reduce((result, key) => ({
|
|
550
|
+
...result,
|
|
660
551
|
[key]: []
|
|
661
552
|
}), {}) : props.accept,
|
|
662
553
|
disabled: () => props.disabled || props.loading,
|
|
@@ -672,127 +563,267 @@ var DropzoneBaseComponent = (0, vue.defineComponent)({
|
|
|
672
563
|
useFsAccessApi: () => props.useFsAccessApi,
|
|
673
564
|
validator: () => props.validator,
|
|
674
565
|
getFilesFromEvent: () => props.getFilesFromEvent,
|
|
675
|
-
onDrop: (files,
|
|
676
|
-
onDropAccepted: (files) =>
|
|
677
|
-
onDropRejected: (
|
|
678
|
-
onDragEnter: (event) =>
|
|
679
|
-
onDragLeave: (event) =>
|
|
680
|
-
onDragOver: (event) =>
|
|
681
|
-
onFileDialogCancel: () =>
|
|
682
|
-
onFileDialogOpen: () =>
|
|
566
|
+
onDrop: (files, rejected) => emit("drop-any", files, rejected),
|
|
567
|
+
onDropAccepted: (files) => emit("drop", files),
|
|
568
|
+
onDropRejected: (rejected) => emit("reject", rejected),
|
|
569
|
+
onDragEnter: (event) => emit("drag-enter", event),
|
|
570
|
+
onDragLeave: (event) => emit("drag-leave", event),
|
|
571
|
+
onDragOver: (event) => emit("drag-over", event),
|
|
572
|
+
onFileDialogCancel: () => emit("file-dialog-cancel"),
|
|
573
|
+
onFileDialogOpen: () => emit("file-dialog-open")
|
|
683
574
|
});
|
|
684
|
-
(0,
|
|
575
|
+
(0, vue.watch)(() => props.openRef, (value) => (0, _mantine_vue_hooks.assignRef)(value, dz.open), { immediate: true });
|
|
576
|
+
const accepted = (0, vue.computed)(() => dz.isDragActive.value && dz.isDragAccept.value);
|
|
577
|
+
const rejected = (0, vue.computed)(() => dz.isDragActive.value && dz.isDragReject.value);
|
|
578
|
+
const idle = (0, vue.computed)(() => !accepted.value && !rejected.value);
|
|
685
579
|
provideDropzoneContext({
|
|
686
580
|
get accept() {
|
|
687
|
-
return
|
|
581
|
+
return accepted.value;
|
|
688
582
|
},
|
|
689
583
|
get reject() {
|
|
690
|
-
return
|
|
584
|
+
return rejected.value;
|
|
691
585
|
},
|
|
692
586
|
get idle() {
|
|
693
|
-
|
|
694
|
-
const rejected = dz.isDragActive.value && dz.isDragReject.value;
|
|
695
|
-
return !accepted && !rejected;
|
|
587
|
+
return idle.value;
|
|
696
588
|
}
|
|
697
589
|
});
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
(0, vue.
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
590
|
+
const rootAttrs = () => ({
|
|
591
|
+
...dz.getRootProps(),
|
|
592
|
+
...getStyles("root"),
|
|
593
|
+
...attrs,
|
|
594
|
+
mod: [{
|
|
595
|
+
accept: accepted.value,
|
|
596
|
+
reject: rejected.value,
|
|
597
|
+
idle: idle.value,
|
|
598
|
+
disabled: props.disabled,
|
|
599
|
+
loading: props.loading,
|
|
600
|
+
"activate-on-click": props.activateOnClick
|
|
601
|
+
}, attrs.mod]
|
|
602
|
+
});
|
|
603
|
+
const inputAttrs = () => ({
|
|
604
|
+
...dz.getInputProps(props.inputProps),
|
|
605
|
+
name: props.name
|
|
606
|
+
});
|
|
607
|
+
const rootElement = (0, vue.ref)(null);
|
|
608
|
+
const setRootRef = (node) => {
|
|
609
|
+
rootElement.value = node;
|
|
610
|
+
(0, _mantine_vue_hooks.assignRef)(props.rootRef, node);
|
|
611
|
+
};
|
|
612
|
+
__expose({ rootElement });
|
|
613
|
+
return (_ctx, _cache) => {
|
|
614
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.mergeProps)({ rootRef: setRootRef }, rootAttrs()), {
|
|
615
|
+
default: (0, vue.withCtx)(() => [
|
|
616
|
+
(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.LoadingOverlay), {
|
|
617
|
+
visible: (0, vue.unref)(props).loading,
|
|
618
|
+
"overlay-props": { radius: (0, vue.unref)(props).radius },
|
|
619
|
+
unstyled: (0, vue.unref)(props).unstyled,
|
|
620
|
+
"loader-props": (0, vue.unref)(props).loaderProps
|
|
621
|
+
}, null, 8, [
|
|
622
|
+
"visible",
|
|
623
|
+
"overlay-props",
|
|
624
|
+
"unstyled",
|
|
625
|
+
"loader-props"
|
|
626
|
+
]),
|
|
627
|
+
(0, vue.createElementVNode)("input", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(inputAttrs())), null, 16),
|
|
628
|
+
(0, vue.createElementVNode)("div", (0, vue.mergeProps)((0, vue.unref)(getStyles)("inner"), { "data-enable-pointer-events": (0, vue.unref)(props).enablePointerEvents || void 0 }), [(0, vue.renderSlot)(_ctx.$slots, "default")], 16, _hoisted_1)
|
|
629
|
+
]),
|
|
630
|
+
_: 3
|
|
631
|
+
}, 16);
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/components/DropzoneStatus/DropzoneStatus.vue
|
|
637
|
+
var DropzoneStatus_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
638
|
+
name: "DropzoneStatus",
|
|
639
|
+
inheritAttrs: false,
|
|
640
|
+
__name: "DropzoneStatus",
|
|
641
|
+
props: {
|
|
642
|
+
children: { type: [
|
|
643
|
+
Object,
|
|
644
|
+
String,
|
|
645
|
+
Number,
|
|
646
|
+
Boolean,
|
|
647
|
+
null,
|
|
648
|
+
Array
|
|
649
|
+
] },
|
|
650
|
+
status: {}
|
|
651
|
+
},
|
|
652
|
+
setup(__props) {
|
|
653
|
+
const props = __props;
|
|
654
|
+
const slots = (0, vue.useSlots)();
|
|
655
|
+
const attrs = (0, vue.useAttrs)();
|
|
656
|
+
const ctx = useDropzoneContext();
|
|
657
|
+
const renderContent = () => {
|
|
658
|
+
const slotChildren = slots.default?.();
|
|
659
|
+
const children = props.children !== void 0 ? props.children : slotChildren;
|
|
660
|
+
const child = Array.isArray(children) && children.length === 1 ? children[0] : children;
|
|
661
|
+
return (0, vue.isVNode)(child) && !Array.isArray(child) ? (0, vue.cloneVNode)(child, attrs) : child;
|
|
662
|
+
};
|
|
663
|
+
return (_ctx, _cache) => {
|
|
664
|
+
return (0, vue.unref)(ctx)[props.status] && (0, vue.isVNode)(renderContent()) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderContent), { key: 0 })) : (0, vue.unref)(ctx)[props.status] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, (0, vue.unref)(attrs))), [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderContent)))], 16)) : (0, vue.createCommentVNode)("", true);
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/components/DropzoneStatus/DropzoneAccept.vue
|
|
670
|
+
var DropzoneAccept_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
671
|
+
name: "DropzoneAccept",
|
|
672
|
+
inheritAttrs: false,
|
|
673
|
+
__name: "DropzoneAccept",
|
|
674
|
+
props: { children: { type: [
|
|
675
|
+
Object,
|
|
676
|
+
String,
|
|
677
|
+
Number,
|
|
678
|
+
Boolean,
|
|
679
|
+
null,
|
|
680
|
+
Array
|
|
681
|
+
] } },
|
|
682
|
+
setup(__props) {
|
|
683
|
+
const slots = (0, vue.useSlots)();
|
|
684
|
+
return (_ctx, _cache) => {
|
|
685
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(DropzoneStatus_default, (0, vue.mergeProps)({
|
|
686
|
+
..._ctx.$props,
|
|
687
|
+
..._ctx.$attrs
|
|
688
|
+
}, {
|
|
689
|
+
status: "accept",
|
|
690
|
+
children: (0, vue.unref)(slots).default?.()
|
|
691
|
+
}), null, 16, ["children"]);
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/components/DropzoneStatus/DropzoneReject.vue
|
|
697
|
+
var DropzoneReject_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
698
|
+
name: "DropzoneReject",
|
|
699
|
+
inheritAttrs: false,
|
|
700
|
+
__name: "DropzoneReject",
|
|
701
|
+
props: { children: { type: [
|
|
702
|
+
Object,
|
|
703
|
+
String,
|
|
704
|
+
Number,
|
|
705
|
+
Boolean,
|
|
706
|
+
null,
|
|
707
|
+
Array
|
|
708
|
+
] } },
|
|
709
|
+
setup(__props) {
|
|
710
|
+
const slots = (0, vue.useSlots)();
|
|
711
|
+
return (_ctx, _cache) => {
|
|
712
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(DropzoneStatus_default, (0, vue.mergeProps)({
|
|
713
|
+
..._ctx.$props,
|
|
714
|
+
..._ctx.$attrs
|
|
715
|
+
}, {
|
|
716
|
+
status: "reject",
|
|
717
|
+
children: (0, vue.unref)(slots).default?.()
|
|
718
|
+
}), null, 16, ["children"]);
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/components/DropzoneStatus/DropzoneIdle.vue
|
|
724
|
+
var DropzoneIdle_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
725
|
+
name: "DropzoneIdle",
|
|
726
|
+
inheritAttrs: false,
|
|
727
|
+
__name: "DropzoneIdle",
|
|
728
|
+
props: { children: { type: [
|
|
729
|
+
Object,
|
|
730
|
+
String,
|
|
731
|
+
Number,
|
|
732
|
+
Boolean,
|
|
733
|
+
null,
|
|
734
|
+
Array
|
|
735
|
+
] } },
|
|
736
|
+
setup(__props) {
|
|
737
|
+
const slots = (0, vue.useSlots)();
|
|
738
|
+
return (_ctx, _cache) => {
|
|
739
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(DropzoneStatus_default, (0, vue.mergeProps)({
|
|
740
|
+
..._ctx.$props,
|
|
741
|
+
..._ctx.$attrs
|
|
742
|
+
}, {
|
|
743
|
+
status: "idle",
|
|
744
|
+
children: (0, vue.unref)(slots).default?.()
|
|
745
|
+
}), null, 16, ["children"]);
|
|
732
746
|
};
|
|
733
747
|
}
|
|
734
748
|
});
|
|
735
|
-
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/components/Dropzone/index.ts
|
|
751
|
+
var Dropzone$1 = (0, _mantine_vue_core.factory)(Dropzone_default, {
|
|
736
752
|
classes: Dropzone_module_default,
|
|
737
753
|
varsResolver,
|
|
738
|
-
Accept:
|
|
739
|
-
Idle:
|
|
740
|
-
Reject:
|
|
754
|
+
Accept: DropzoneAccept_default,
|
|
755
|
+
Idle: DropzoneIdle_default,
|
|
756
|
+
Reject: DropzoneReject_default
|
|
741
757
|
});
|
|
742
758
|
//#endregion
|
|
743
|
-
//#region src/DropzoneFullScreen.
|
|
744
|
-
var
|
|
745
|
-
maxSize: Infinity,
|
|
746
|
-
activateOnDrag: true,
|
|
747
|
-
dragEventsBubbling: true,
|
|
748
|
-
activateOnKeyboard: true,
|
|
749
|
-
active: true,
|
|
750
|
-
zIndex: (0, _mantine_vue_core.getDefaultZIndex)("max"),
|
|
751
|
-
withinPortal: true
|
|
752
|
-
};
|
|
753
|
-
var DropzoneFullScreenBaseComponent = (0, vue.defineComponent)({
|
|
759
|
+
//#region src/components/DropzoneFullScreen/DropzoneFullScreen.vue
|
|
760
|
+
var DropzoneFullScreen_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
754
761
|
name: "DropzoneFullScreen",
|
|
755
762
|
inheritAttrs: false,
|
|
763
|
+
__name: "DropzoneFullScreen",
|
|
756
764
|
props: {
|
|
757
765
|
active: {
|
|
758
766
|
type: Boolean,
|
|
759
|
-
default:
|
|
760
|
-
},
|
|
761
|
-
onDrop: {
|
|
762
|
-
type: Function,
|
|
763
|
-
required: true
|
|
764
|
-
},
|
|
765
|
-
onReject: {
|
|
766
|
-
type: Function,
|
|
767
|
-
default: void 0
|
|
768
|
-
},
|
|
769
|
-
zIndex: {
|
|
770
|
-
type: [String, Number],
|
|
771
|
-
default: void 0
|
|
767
|
+
default: true
|
|
772
768
|
},
|
|
769
|
+
zIndex: { default: (0, _mantine_vue_core.getDefaultZIndex)("max") },
|
|
773
770
|
withinPortal: {
|
|
774
771
|
type: Boolean,
|
|
775
|
-
default:
|
|
776
|
-
},
|
|
777
|
-
portalProps: {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
},
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
772
|
+
default: true
|
|
773
|
+
},
|
|
774
|
+
portalProps: {},
|
|
775
|
+
classNames: {},
|
|
776
|
+
styles: {},
|
|
777
|
+
rootRef: {},
|
|
778
|
+
acceptColor: {},
|
|
779
|
+
rejectColor: {},
|
|
780
|
+
radius: {},
|
|
781
|
+
disabled: { type: Boolean },
|
|
782
|
+
loading: { type: Boolean },
|
|
783
|
+
accept: {},
|
|
784
|
+
openRef: {},
|
|
785
|
+
multiple: { type: Boolean },
|
|
786
|
+
maxSize: { default: Infinity },
|
|
787
|
+
name: {},
|
|
788
|
+
maxFiles: {},
|
|
789
|
+
autoFocus: { type: Boolean },
|
|
790
|
+
activateOnClick: { type: Boolean },
|
|
791
|
+
activateOnDrag: {
|
|
792
|
+
type: Boolean,
|
|
793
|
+
default: true
|
|
784
794
|
},
|
|
785
|
-
|
|
786
|
-
type:
|
|
787
|
-
default:
|
|
795
|
+
activateOnKeyboard: {
|
|
796
|
+
type: Boolean,
|
|
797
|
+
default: true
|
|
788
798
|
},
|
|
789
|
-
|
|
799
|
+
dragEventsBubbling: {
|
|
790
800
|
type: Boolean,
|
|
791
|
-
default:
|
|
792
|
-
}
|
|
801
|
+
default: true
|
|
802
|
+
},
|
|
803
|
+
preventDropOnDocument: { type: Boolean },
|
|
804
|
+
useFsAccessApi: { type: Boolean },
|
|
805
|
+
getFilesFromEvent: {},
|
|
806
|
+
validator: {},
|
|
807
|
+
enablePointerEvents: { type: Boolean },
|
|
808
|
+
loaderProps: {},
|
|
809
|
+
inputProps: {},
|
|
810
|
+
unstyled: { type: Boolean }
|
|
793
811
|
},
|
|
794
|
-
|
|
795
|
-
|
|
812
|
+
emits: [
|
|
813
|
+
"drop-any",
|
|
814
|
+
"drop",
|
|
815
|
+
"reject",
|
|
816
|
+
"drag-enter",
|
|
817
|
+
"drag-leave",
|
|
818
|
+
"drag-over",
|
|
819
|
+
"file-dialog-cancel",
|
|
820
|
+
"file-dialog-open"
|
|
821
|
+
],
|
|
822
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
823
|
+
const rawProps = __props;
|
|
824
|
+
const emit = __emit;
|
|
825
|
+
const props = (0, _mantine_vue_core.useProps)("DropzoneFullScreen", null, rawProps);
|
|
826
|
+
const attrs = (0, vue.useAttrs)();
|
|
796
827
|
const getStyles = (0, _mantine_vue_core.useStyles)({
|
|
797
828
|
name: "DropzoneFullScreen",
|
|
798
829
|
classes: Dropzone_module_default,
|
|
@@ -806,64 +837,99 @@ var DropzoneFullScreenBaseComponent = (0, vue.defineComponent)({
|
|
|
806
837
|
});
|
|
807
838
|
const counter = (0, vue.ref)(0);
|
|
808
839
|
const [visible, { open, close }] = (0, _mantine_vue_hooks.useDisclosure)(false);
|
|
809
|
-
|
|
840
|
+
function reset() {
|
|
841
|
+
close();
|
|
842
|
+
counter.value = 0;
|
|
843
|
+
}
|
|
844
|
+
function handleDragEnter(event) {
|
|
810
845
|
if (event.dataTransfer?.types.includes("Files")) {
|
|
811
846
|
counter.value += 1;
|
|
812
847
|
open();
|
|
813
848
|
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
counter.value
|
|
817
|
-
}
|
|
849
|
+
}
|
|
850
|
+
function handleDragLeave() {
|
|
851
|
+
counter.value = Math.max(0, counter.value - 1);
|
|
852
|
+
}
|
|
818
853
|
(0, vue.watch)(counter, (value) => {
|
|
819
854
|
if (value === 0) close();
|
|
820
855
|
});
|
|
821
856
|
let attached = false;
|
|
822
|
-
|
|
857
|
+
function attach() {
|
|
823
858
|
if (attached) return;
|
|
824
859
|
document.addEventListener("dragenter", handleDragEnter, false);
|
|
825
860
|
document.addEventListener("dragleave", handleDragLeave, false);
|
|
826
861
|
attached = true;
|
|
827
|
-
}
|
|
828
|
-
|
|
862
|
+
}
|
|
863
|
+
function detach() {
|
|
829
864
|
if (!attached) return;
|
|
830
865
|
document.removeEventListener("dragenter", handleDragEnter, false);
|
|
831
866
|
document.removeEventListener("dragleave", handleDragLeave, false);
|
|
832
867
|
attached = false;
|
|
833
|
-
}
|
|
868
|
+
}
|
|
834
869
|
(0, vue.watch)(() => props.active, (active) => {
|
|
835
870
|
detach();
|
|
836
871
|
if (active) attach();
|
|
872
|
+
else reset();
|
|
837
873
|
}, { immediate: true });
|
|
838
874
|
(0, vue.onUnmounted)(detach);
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
875
|
+
const rootElement = (0, vue.ref)(null);
|
|
876
|
+
const setRootRef = (node) => {
|
|
877
|
+
const element = node && "$el" in node ? node.$el : node;
|
|
878
|
+
rootElement.value = element;
|
|
879
|
+
(0, _mantine_vue_hooks.assignRef)(props.rootRef, element);
|
|
880
|
+
};
|
|
881
|
+
__expose({ rootElement });
|
|
882
|
+
const dropzoneAttrs = () => {
|
|
883
|
+
const rest = Object.fromEntries(Object.entries(props).filter(([key]) => ![
|
|
884
|
+
"active",
|
|
885
|
+
"zIndex",
|
|
886
|
+
"withinPortal",
|
|
887
|
+
"portalProps",
|
|
888
|
+
"classNames",
|
|
889
|
+
"styles"
|
|
890
|
+
].includes(key)));
|
|
891
|
+
const { classNames, styles } = props;
|
|
892
|
+
return {
|
|
893
|
+
...rest,
|
|
894
|
+
...attrs,
|
|
895
|
+
activateOnClick: false,
|
|
896
|
+
classNames,
|
|
897
|
+
styles,
|
|
898
|
+
class: Dropzone_module_default.dropzone,
|
|
899
|
+
onDrop: (files) => {
|
|
900
|
+
emit("drop", files);
|
|
901
|
+
reset();
|
|
902
|
+
},
|
|
903
|
+
onReject: (rejections) => {
|
|
904
|
+
emit("reject", rejections);
|
|
905
|
+
reset();
|
|
906
|
+
},
|
|
907
|
+
onDropAny: (files, rejections) => emit("drop-any", files, rejections),
|
|
908
|
+
onDragEnter: (event) => emit("drag-enter", event),
|
|
909
|
+
onDragLeave: (event) => emit("drag-leave", event),
|
|
910
|
+
onDragOver: (event) => emit("drag-over", event),
|
|
911
|
+
onFileDialogCancel: () => emit("file-dialog-cancel"),
|
|
912
|
+
onFileDialogOpen: () => emit("file-dialog-open")
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
return (_ctx, _cache) => {
|
|
916
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.OptionalPortal), (0, vue.mergeProps)((0, vue.unref)(props).portalProps, { "within-portal": (0, vue.unref)(props).withinPortal }), {
|
|
917
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.mergeProps)({ ref: setRootRef }, (0, vue.unref)(getStyles)("fullScreen", { style: {
|
|
918
|
+
opacity: (0, vue.unref)(visible) ? 1 : 0,
|
|
919
|
+
pointerEvents: (0, vue.unref)(visible) ? "all" : "none",
|
|
920
|
+
zIndex: (0, vue.unref)(props).zIndex
|
|
921
|
+
} })), [(0, vue.createVNode)(Dropzone_default, (0, vue.normalizeProps)((0, vue.guardReactiveProps)(dropzoneAttrs())), {
|
|
922
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
923
|
+
_: 3
|
|
924
|
+
}, 16)], 16)]),
|
|
925
|
+
_: 3
|
|
926
|
+
}, 16, ["within-portal"]);
|
|
927
|
+
};
|
|
864
928
|
}
|
|
865
929
|
});
|
|
866
|
-
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/components/DropzoneFullScreen/index.ts
|
|
932
|
+
var DropzoneFullScreen = (0, _mantine_vue_core.factory)(DropzoneFullScreen_default, { classes: Dropzone_module_default });
|
|
867
933
|
//#endregion
|
|
868
934
|
//#region src/mime-types.ts
|
|
869
935
|
var MIME_TYPES = {
|
|
@@ -910,10 +976,10 @@ Object.assign(Dropzone$1, { FullScreen: DropzoneFullScreen });
|
|
|
910
976
|
var Dropzone = Dropzone$1;
|
|
911
977
|
//#endregion
|
|
912
978
|
exports.Dropzone = Dropzone;
|
|
913
|
-
exports.DropzoneAccept =
|
|
979
|
+
exports.DropzoneAccept = DropzoneAccept_default;
|
|
914
980
|
exports.DropzoneFullScreen = DropzoneFullScreen;
|
|
915
|
-
exports.DropzoneIdle =
|
|
916
|
-
exports.DropzoneReject =
|
|
981
|
+
exports.DropzoneIdle = DropzoneIdle_default;
|
|
982
|
+
exports.DropzoneReject = DropzoneReject_default;
|
|
917
983
|
exports.EXE_MIME_TYPE = EXE_MIME_TYPE;
|
|
918
984
|
exports.ErrorCode = ErrorCode;
|
|
919
985
|
exports.FILE_INVALID_TYPE = FILE_INVALID_TYPE;
|