classcard-ui 0.2.278 → 0.2.279
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/classcard-ui.common.js +32 -43
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +32 -43
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CUpload/CUpload.vue +25 -39
package/package.json
CHANGED
|
@@ -2,43 +2,16 @@
|
|
|
2
2
|
<div>
|
|
3
3
|
<div v-if="type === 'default'">
|
|
4
4
|
<slot></slot>
|
|
5
|
-
<div
|
|
6
|
-
:class="errorClasses"
|
|
7
|
-
class=""
|
|
8
|
-
id="c-file-area"
|
|
9
|
-
@click.prevent="uploader.open()"
|
|
10
|
-
>
|
|
5
|
+
<div :class="errorClasses" class="" id="c-file-area" @click.prevent="uploader.open()">
|
|
11
6
|
<button
|
|
12
7
|
type="white"
|
|
13
|
-
class="
|
|
14
|
-
inline-flex
|
|
15
|
-
items-center
|
|
16
|
-
px-4
|
|
17
|
-
py-2
|
|
18
|
-
shadow-sm
|
|
19
|
-
text-sm
|
|
20
|
-
font-medium
|
|
21
|
-
rounded-md
|
|
22
|
-
focus:outline-none
|
|
23
|
-
focus:ring-2 focus:ring-offset-2
|
|
24
|
-
disabled:opacity-50
|
|
25
|
-
text-gray-700
|
|
26
|
-
border
|
|
27
|
-
bg-white
|
|
28
|
-
border-gray-300
|
|
29
|
-
hover:bg-gray-50
|
|
30
|
-
focus:ring-indigo-600
|
|
31
|
-
"
|
|
8
|
+
class="pic-btn inline-flex items-center px-4 py-2 shadow-sm text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 text-gray-700 border bg-white border-gray-300 hover:bg-gray-50 focus:ring-indigo-600"
|
|
32
9
|
>
|
|
33
10
|
{{ buttonText }}
|
|
34
11
|
</button>
|
|
35
12
|
</div>
|
|
36
13
|
</div>
|
|
37
|
-
<div
|
|
38
|
-
v-if="type === 'filestack'"
|
|
39
|
-
:class="filestackClasses"
|
|
40
|
-
id="filestack-uploader"
|
|
41
|
-
></div>
|
|
14
|
+
<div v-if="type === 'filestack'" :class="filestackClasses" id="filestack-uploader"></div>
|
|
42
15
|
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
43
16
|
{{ errorMessage }}
|
|
44
17
|
</p>
|
|
@@ -78,10 +51,26 @@ export default {
|
|
|
78
51
|
type: String,
|
|
79
52
|
default: "w-96 h-96",
|
|
80
53
|
},
|
|
54
|
+
url: {
|
|
55
|
+
type: String,
|
|
56
|
+
},
|
|
81
57
|
maxFiles: {
|
|
82
58
|
type: Number,
|
|
83
59
|
default: 1,
|
|
84
60
|
},
|
|
61
|
+
onUploadSuccess: {
|
|
62
|
+
type: Function,
|
|
63
|
+
},
|
|
64
|
+
includeUnsplash: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
},
|
|
67
|
+
cropImage: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
},
|
|
70
|
+
aspectRatioDimensions: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 23 / 45,
|
|
73
|
+
},
|
|
85
74
|
},
|
|
86
75
|
data() {
|
|
87
76
|
return {
|
|
@@ -109,23 +98,20 @@ export default {
|
|
|
109
98
|
compressionToMime: "image/jpeg",
|
|
110
99
|
maxSize: [500, 1000],
|
|
111
100
|
uploader: xhrUploader({
|
|
112
|
-
endpoint:
|
|
101
|
+
endpoint: `${this.url}`,
|
|
113
102
|
fileKeyName: "image",
|
|
114
|
-
// settingsFunction: (xmlHttp) => {
|
|
115
|
-
// xmlHttp.setRequestHeader("Authorization", `Bearer ${token}`);
|
|
116
|
-
// },
|
|
117
103
|
responseFunction: (response) => {
|
|
118
|
-
|
|
104
|
+
this.$emit("onUploadSuccess", response);
|
|
119
105
|
},
|
|
120
106
|
}),
|
|
121
|
-
// bind: document.querySelector("#imagePreview"),
|
|
122
107
|
});
|
|
123
108
|
this.uploader.use([
|
|
124
109
|
new Local(),
|
|
125
|
-
|
|
126
|
-
|
|
110
|
+
...(this.includeUnsplash
|
|
111
|
+
? [new Unsplash("hXfo-C0svXV4IDCncBo7s-ySQpVJVeZrGuWxwwgC7qw")]
|
|
112
|
+
: []),
|
|
113
|
+
...(this.cropImage ? [new Crop({ aspectRatio: this.aspectRatioDimensions })] : []),
|
|
127
114
|
]);
|
|
128
|
-
|
|
129
115
|
// Uppload Error Handle
|
|
130
116
|
this.uploader.on("error", (error) => {
|
|
131
117
|
console.log("The error message is", error);
|