@naptics/vue-collection 0.2.8 → 0.2.9
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/components/NDropzone.d.ts +13 -0
- package/components/NDropzone.js +10 -3
- package/package.json +1 -1
|
@@ -46,6 +46,10 @@ export declare const nDropzoneProps: {
|
|
|
46
46
|
readonly type: StringConstructor;
|
|
47
47
|
readonly default: "min-h-36";
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* If set to `true`, the dropzone is disabled and does not accept input anymore.
|
|
51
|
+
*/
|
|
52
|
+
readonly disabled: BooleanConstructor;
|
|
49
53
|
readonly value: import("vue").PropType<File[]>;
|
|
50
54
|
readonly onUpdateValue: import("vue").PropType<(newValue: File[]) => void>;
|
|
51
55
|
};
|
|
@@ -101,6 +105,10 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
101
105
|
readonly type: StringConstructor;
|
|
102
106
|
readonly default: "min-h-36";
|
|
103
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* If set to `true`, the dropzone is disabled and does not accept input anymore.
|
|
110
|
+
*/
|
|
111
|
+
readonly disabled: BooleanConstructor;
|
|
104
112
|
readonly value: import("vue").PropType<File[]>;
|
|
105
113
|
readonly onUpdateValue: import("vue").PropType<(newValue: File[]) => void>;
|
|
106
114
|
}, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -151,9 +159,14 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
151
159
|
readonly type: StringConstructor;
|
|
152
160
|
readonly default: "min-h-36";
|
|
153
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* If set to `true`, the dropzone is disabled and does not accept input anymore.
|
|
164
|
+
*/
|
|
165
|
+
readonly disabled: BooleanConstructor;
|
|
154
166
|
readonly value: import("vue").PropType<File[]>;
|
|
155
167
|
readonly onUpdateValue: import("vue").PropType<(newValue: File[]) => void>;
|
|
156
168
|
}>> & {}, {
|
|
169
|
+
readonly disabled: boolean;
|
|
157
170
|
readonly maxFiles: number;
|
|
158
171
|
readonly maxFileSize: number;
|
|
159
172
|
readonly maxLengthFileNames: number;
|
package/components/NDropzone.js
CHANGED
|
@@ -60,7 +60,11 @@ export const nDropzoneProps = {
|
|
|
60
60
|
height: {
|
|
61
61
|
type: String,
|
|
62
62
|
default: 'min-h-36'
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* If set to `true`, the dropzone is disabled and does not accept input anymore.
|
|
66
|
+
*/
|
|
67
|
+
disabled: Boolean
|
|
64
68
|
};
|
|
65
69
|
/**
|
|
66
70
|
* The `NDropzone` is an area where files can be added by the user by drag & drop.
|
|
@@ -112,6 +116,7 @@ const Component = createComponent('NDropzone', nDropzoneProps, props => {
|
|
|
112
116
|
const onDrop = event => {
|
|
113
117
|
event.preventDefault();
|
|
114
118
|
isDragOver.value = false;
|
|
119
|
+
if (props.disabled) return;
|
|
115
120
|
const transfer = event.dataTransfer;
|
|
116
121
|
if (transfer == null) return;
|
|
117
122
|
if (transfer.items.length > 0) {
|
|
@@ -143,11 +148,13 @@ const Component = createComponent('NDropzone', nDropzoneProps, props => {
|
|
|
143
148
|
return () => {
|
|
144
149
|
let _slot;
|
|
145
150
|
return _createVNode("div", null, [_createVNode("button", {
|
|
146
|
-
"class": ['block w-full rounded-md border-dashed border-2
|
|
151
|
+
"class": ['block w-full rounded-md border-dashed border-2 focus-visible:border-primary-500 focus:outline-none ', 'flex flex-col items-center justify-center text-center text-sm select-none p-4', !props.disabled ? 'hover:border-primary-300 hover:bg-primary-50 hover:text-primary-700' : '', props.disabled ? 'border-default-300 bg-default-50/50 text-default-500/30' : isDragOver.value ? 'border-primary-300 bg-primary-50 text-primary-700' : 'border-default-300 bg-default-50 text-default-500', props.height],
|
|
147
152
|
"onDrop": onDrop,
|
|
148
153
|
"onDragover": onDragOver,
|
|
149
154
|
"onDragleave": onDragLeave,
|
|
150
|
-
"onClick": onClick
|
|
155
|
+
"onClick": onClick,
|
|
156
|
+
"type": "button",
|
|
157
|
+
"disabled": props.disabled
|
|
151
158
|
}, [_createVNode("input", {
|
|
152
159
|
"type": "file",
|
|
153
160
|
"class": "hidden",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@naptics/vue-collection",
|
|
3
3
|
"author": "Timo Siegenthaler",
|
|
4
4
|
"description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.9",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|