classcard-ui 0.2.241 → 0.2.250

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "classcard-ui",
3
- "version": "0.2.241",
3
+ "version": "0.2.250",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -25,6 +25,7 @@
25
25
  "gridjs-selection": "^3.4.0",
26
26
  "gridjs-vue": "^3.4.0",
27
27
  "lodash-es": "^4.17.21",
28
+ "uppload": "^3.2.1",
28
29
  "v-calendar": "^2.3.2",
29
30
  "vue": "^2.6.14",
30
31
  "vue-good-table": "^2.21.8",
@@ -3,10 +3,13 @@
3
3
  <div
4
4
  :class="divider || showSection ? 'border-b border-gray-200 pb-2' : ''"
5
5
  class="flex flex-row items-center justify-between cursor-pointer"
6
- @click="collapse"
6
+ @click.self="collapse"
7
7
  >
8
8
  <!-- left and right arrow icon as per opening and closing of collapsible -->
9
- <div class="flex flex-row items-center">
9
+ <div
10
+ class="flex flex-row items-center"
11
+ @click="collapse"
12
+ >
10
13
  <c-icon
11
14
  :name="showSection ? 'chevron-down' : 'chevron-right'"
12
15
  class="text-gray-900 h-5 w-5"
@@ -81,6 +84,7 @@ export default {
81
84
  },
82
85
  methods: {
83
86
  collapse() {
87
+ console.log("collapsing")
84
88
  this.showSection = !this.showSection;
85
89
  },
86
90
  },
@@ -106,7 +106,7 @@
106
106
  >
107
107
  <template slot="table-column" slot-scope="props">
108
108
  <!-- custom sorting icon -->
109
- <span v-if="props.column.sortable && sorting" class="flex">
109
+ <span v-if="props.column.sortable || sorting" class="flex">
110
110
  <div>
111
111
  {{ props.column.label }}
112
112
  </div>
@@ -2,31 +2,15 @@
2
2
  <div>
3
3
  <div v-if="type === 'default'">
4
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
5
  <div
12
6
  :class="errorClasses"
13
- class="w-full mt-2 flex justify-center px-6 py-14 border-2 rounded-md"
7
+ class=""
8
+ id="c-file-area"
9
+ @click="uploader.open()"
14
10
  >
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>
29
- </div>
11
+ <button type="white" class="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 ">
12
+ {{buttonText}}
13
+ </button>
30
14
  </div>
31
15
  </div>
32
16
  <div
@@ -41,14 +25,14 @@
41
25
  </template>
42
26
 
43
27
  <script>
44
- import CIcon from "../CIcon/CIcon.vue";
45
28
  import * as filestack from "filestack-js";
29
+ import { Uppload, Local, xhrUploader, en, Crop, Unsplash } from "uppload";
46
30
 
47
31
  export default {
48
32
  name: "CUpload",
49
- components: { CIcon },
33
+ components: { },
50
34
  props: {
51
- label: {
35
+ buttonText: {
52
36
  type: String,
53
37
  },
54
38
  fileSize: {
@@ -78,6 +62,11 @@ export default {
78
62
  default: 1,
79
63
  },
80
64
  },
65
+ data() {
66
+ return {
67
+ uploader: null
68
+ }
69
+ },
81
70
  methods: {
82
71
  initFilestack() {
83
72
  const client = filestack.init(this.filestackApiKey);
@@ -91,6 +80,36 @@ export default {
91
80
  const picker = client.picker(options);
92
81
  picker.open();
93
82
  },
83
+ initUppload() {
84
+ // Uppload library
85
+ this.uploader = new Uppload({
86
+ lang: en,
87
+ compression: 0.4,
88
+ compressionToMime: "image/jpeg",
89
+ maxSize: [500, 1000],
90
+ uploader: xhrUploader({
91
+ endpoint: `https://reportcard.tech/api/saveImage/`,
92
+ fileKeyName: "image",
93
+ // settingsFunction: (xmlHttp) => {
94
+ // xmlHttp.setRequestHeader("Authorization", `Bearer ${token}`);
95
+ // },
96
+ responseFunction: (response) => {
97
+ console.log(response);
98
+ },
99
+ }),
100
+ // bind: document.querySelector("#imagePreview"),
101
+ });
102
+ this.uploader.use([
103
+ new Local(),
104
+ new Unsplash("hXfo-C0svXV4IDCncBo7s-ySQpVJVeZrGuWxwwgC7qw"),
105
+ new Crop({ aspectRatio: 23 / 45 }),
106
+ ]);
107
+
108
+ // Uppload Error Handle
109
+ this.uploader.on("error", (error) => {
110
+ console.log("The error message is", error);
111
+ });
112
+ }
94
113
  },
95
114
  computed: {
96
115
  errorClasses() {
@@ -104,6 +123,8 @@ export default {
104
123
  mounted() {
105
124
  if (this.type === "filestack") {
106
125
  this.initFilestack();
126
+ } else if(this.type == "default") {
127
+ this.initUppload();
107
128
  }
108
129
  },
109
130
  };
@@ -26,7 +26,7 @@ const Template = (args, { argTypes }) => ({
26
26
 
27
27
  export const Default = Template.bind({});
28
28
  Default.args = {
29
- label: "Name",
29
+ buttonText: "Select File",
30
30
  hint: "Optional",
31
31
  fileSize: "10",
32
32
  isValidate: true,