classcard-ui 0.2.190 → 0.2.191
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 +216 -52
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +216 -52
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +46 -5
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +6 -5
- package/src/components/CUpload/CUpload.vue +59 -20
- package/src/stories/CUpload.stories.js +16 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "classcard-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.191",
|
|
4
4
|
"main": "dist/classcard-ui.common.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@tailwindcss/forms": "^0.2.1",
|
|
21
21
|
"core-js": "^3.18.0",
|
|
22
22
|
"dayjs": "^1.10.7",
|
|
23
|
+
"filestack-js": "^3.25.0",
|
|
23
24
|
"gridjs-selection": "^3.4.0",
|
|
24
25
|
"gridjs-vue": "^3.4.0",
|
|
25
26
|
"lodash-es": "^4.17.21",
|
|
@@ -35,10 +36,10 @@
|
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@babel/core": "^7.15.5",
|
|
38
|
-
"@storybook/addon-actions": "^6.
|
|
39
|
-
"@storybook/addon-essentials": "^6.
|
|
40
|
-
"@storybook/addon-links": "^6.
|
|
41
|
-
"@storybook/vue": "^6.
|
|
39
|
+
"@storybook/addon-actions": "^6.4.0",
|
|
40
|
+
"@storybook/addon-essentials": "^6.4.0",
|
|
41
|
+
"@storybook/addon-links": "^6.4.0",
|
|
42
|
+
"@storybook/vue": "^6.4.0",
|
|
42
43
|
"@tailwindcss/postcss7-compat": "^2.2.14",
|
|
43
44
|
"@types/lodash-es": "^4.17.5",
|
|
44
45
|
"@vue/cli-plugin-babel": "^4.5.13",
|
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<div class="
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
<div v-if="type === 'default'">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
<div class="flex justify-between">
|
|
6
|
+
<label class="block text-sm font-medium text-gray-900">
|
|
7
|
+
{{ label }}
|
|
8
|
+
</label>
|
|
9
|
+
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
:class="errorClasses"
|
|
13
|
+
class="w-full mt-2 flex justify-center px-6 py-14 border-2 rounded-md"
|
|
14
|
+
>
|
|
15
|
+
<div class="space-y-1 text-center">
|
|
16
|
+
<div class="flex text-sm text-gray-600">
|
|
17
|
+
<c-icon
|
|
18
|
+
type="solid"
|
|
19
|
+
class="h-5 w-5 text-indigo-600"
|
|
20
|
+
name="arrow-up"
|
|
21
|
+
></c-icon>
|
|
22
|
+
<label
|
|
23
|
+
class="relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500 ml-1"
|
|
24
|
+
>
|
|
25
|
+
<span>Upload</span>
|
|
26
|
+
<input type="file" class="sr-only" />
|
|
27
|
+
</label>
|
|
28
|
+
</div>
|
|
23
29
|
</div>
|
|
24
30
|
</div>
|
|
25
31
|
</div>
|
|
32
|
+
<div v-if="type === 'filestack'" class="" id="filestack-uploader"></div>
|
|
26
33
|
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
27
34
|
{{ errorMessage }}
|
|
28
35
|
</p>
|
|
@@ -31,6 +38,8 @@
|
|
|
31
38
|
|
|
32
39
|
<script>
|
|
33
40
|
import CIcon from "../CIcon/CIcon.vue";
|
|
41
|
+
import * as filestack from "filestack-js";
|
|
42
|
+
|
|
34
43
|
export default {
|
|
35
44
|
name: "CUpload",
|
|
36
45
|
components: { CIcon },
|
|
@@ -48,6 +57,31 @@ export default {
|
|
|
48
57
|
errorMessage: {
|
|
49
58
|
type: String,
|
|
50
59
|
},
|
|
60
|
+
type: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "default",
|
|
63
|
+
},
|
|
64
|
+
filestackApiKey: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "",
|
|
67
|
+
},
|
|
68
|
+
filestackClasses: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: "w-96 h-96",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
initFilestack() {
|
|
75
|
+
const client = filestack.init(this.filestackApiKey);
|
|
76
|
+
const options = {
|
|
77
|
+
displayMode: "inline",
|
|
78
|
+
container: "#filestack-uploader",
|
|
79
|
+
uploadInBackground: false,
|
|
80
|
+
onUploadDone: (res) => this.$emit("filestack-uploaded", res),
|
|
81
|
+
};
|
|
82
|
+
const picker = client.picker(options);
|
|
83
|
+
picker.open();
|
|
84
|
+
},
|
|
51
85
|
},
|
|
52
86
|
computed: {
|
|
53
87
|
errorClasses() {
|
|
@@ -58,6 +92,11 @@ export default {
|
|
|
58
92
|
};
|
|
59
93
|
},
|
|
60
94
|
},
|
|
95
|
+
mounted() {
|
|
96
|
+
if (this.type === "filestack") {
|
|
97
|
+
this.initFilestack();
|
|
98
|
+
}
|
|
99
|
+
},
|
|
61
100
|
};
|
|
62
101
|
</script>
|
|
63
102
|
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import CUpload from
|
|
2
|
-
import
|
|
1
|
+
import CUpload from "../components/CUpload/CUpload.vue";
|
|
2
|
+
import "./utils.css";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: "CUpload",
|
|
6
6
|
component: CUpload,
|
|
7
7
|
argTypes: {
|
|
8
8
|
label: String,
|
|
9
9
|
hint: String,
|
|
10
10
|
fileSize: String,
|
|
11
|
-
isValidate: Boolean
|
|
11
|
+
isValidate: Boolean,
|
|
12
|
+
type: {
|
|
13
|
+
control: {
|
|
14
|
+
type: "inline-radio",
|
|
15
|
+
options: ["default", "filestack", "uppload"],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
12
18
|
},
|
|
13
19
|
};
|
|
14
20
|
|
|
@@ -20,8 +26,10 @@ const Template = (args, { argTypes }) => ({
|
|
|
20
26
|
|
|
21
27
|
export const Default = Template.bind({});
|
|
22
28
|
Default.args = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
label: "Name",
|
|
30
|
+
hint: "Optional",
|
|
31
|
+
fileSize: "10",
|
|
32
|
+
isValidate: true,
|
|
33
|
+
type: "default",
|
|
34
|
+
filestackApiKey: "",
|
|
27
35
|
};
|