classcard-ui 0.2.188 → 0.2.192

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.188",
3
+ "version": "0.2.192",
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.3.12",
39
- "@storybook/addon-essentials": "^6.3.12",
40
- "@storybook/addon-links": "^6.3.12",
41
- "@storybook/vue": "^6.3.12",
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",
@@ -287,6 +287,7 @@ export default {
287
287
  showLoader: this.isLoading,
288
288
  searchTerm: "",
289
289
  paginationRecords: this.paginationData,
290
+ reorderedArray: [...this.rows],
290
291
  };
291
292
  },
292
293
  methods: {
@@ -299,22 +300,15 @@ export default {
299
300
  },
300
301
  // array of rows after drag and drop
301
302
  rearrange(oldIndex, newIndex) {
302
- // var reorderedArray = [];
303
- // this.rows.forEach(function (row) {
304
- // reorderedArray.push({ oldSortOrder: row.id });
305
- // });
306
- const movedItem = this.rows.find((item, index) => index === oldIndex);
307
- const remainingItems = this.rows.filter((item, index) => index !== oldIndex);
303
+ const movedItem = this.reorderedArray.find((item, index) => index === oldIndex);
304
+ const remainingItems = this.reorderedArray.filter((item, index) => index !== oldIndex);
308
305
  const reorderedItems = [
309
306
  ...remainingItems.slice(0, newIndex),
310
307
  movedItem,
311
308
  ...remainingItems.slice(newIndex),
312
309
  ];
313
- // reorderedItems.forEach(function (row, index) {
314
- // reorderedArray[index].newSortOrder = row.id;
315
- // });
316
- this.$emit('reordered', reorderedItems);
317
- return reorderedItems;
310
+ this.reorderedArray = [...reorderedItems];
311
+ this.$emit('reordered', this.reorderedArray);
318
312
  },
319
313
  // listing functions
320
314
  sortChange(params) {
@@ -1,28 +1,39 @@
1
1
  <template>
2
2
  <div>
3
- <slot></slot>
4
- <div class="flex justify-between">
5
- <label class="block text-sm font-medium text-gray-900">
6
- {{ label }}
7
- </label>
8
- <span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
9
- </div>
10
- <div
11
- :class="errorClasses"
12
- class="w-full mt-2 flex justify-center px-6 py-14 border-2 rounded-md"
13
- >
14
- <div class="space-y-1 text-center">
15
- <div class="flex text-sm text-gray-600">
16
- <c-icon type="solid" class="h-5 w-5 text-indigo-600" name="arrow-up"></c-icon>
17
- <label
18
- 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"
19
- >
20
- <span>Upload</span>
21
- <input type="file" class="sr-only" />
22
- </label>
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
33
+ v-if="type === 'filestack'"
34
+ :class="filestackClasses"
35
+ id="filestack-uploader"
36
+ ></div>
26
37
  <p v-if="!isValidate" class="mt-2 text-sm text-red-600">
27
38
  {{ errorMessage }}
28
39
  </p>
@@ -31,6 +42,8 @@
31
42
 
32
43
  <script>
33
44
  import CIcon from "../CIcon/CIcon.vue";
45
+ import * as filestack from "filestack-js";
46
+
34
47
  export default {
35
48
  name: "CUpload",
36
49
  components: { CIcon },
@@ -48,6 +61,31 @@ export default {
48
61
  errorMessage: {
49
62
  type: String,
50
63
  },
64
+ type: {
65
+ type: String,
66
+ default: "default",
67
+ },
68
+ filestackApiKey: {
69
+ type: String,
70
+ default: "",
71
+ },
72
+ filestackClasses: {
73
+ type: String,
74
+ default: "w-96 h-96",
75
+ },
76
+ },
77
+ methods: {
78
+ initFilestack() {
79
+ const client = filestack.init(this.filestackApiKey);
80
+ const options = {
81
+ displayMode: "inline",
82
+ container: "#filestack-uploader",
83
+ uploadInBackground: false,
84
+ onUploadDone: (res) => this.$emit("filestack-uploaded", res),
85
+ };
86
+ const picker = client.picker(options);
87
+ picker.open();
88
+ },
51
89
  },
52
90
  computed: {
53
91
  errorClasses() {
@@ -58,6 +96,11 @@ export default {
58
96
  };
59
97
  },
60
98
  },
99
+ mounted() {
100
+ if (this.type === "filestack") {
101
+ this.initFilestack();
102
+ }
103
+ },
61
104
  };
62
105
  </script>
63
106
 
@@ -29,18 +29,14 @@ export const Default = Template.bind({});
29
29
  Default.args = {
30
30
  cols: [
31
31
  { label: "", field: "drag", hidden: false },
32
+ { label: "Payment mode", field: "mode", hidden: false },
32
33
  {
33
- label: "Make",
34
- field: "make",
34
+ label: "",
35
+ field: "menuOptions",
35
36
  hidden: false,
36
- sortable: true,
37
- direction: null,
38
- },
39
- { label: "Model", field: "modal", hidden: false, sortable: true, direction: null },
40
- { label: "Staff", field: "staff", hidden: false },
41
- { label: "CRR", field: "crr", hidden: false, sortable: true, direction: null, type: "decimal" },
42
- { label: "Switch", field: "switch", hidden: false },
43
- { label: "Icon", field: "color", hidden: false },
37
+ customizeColumn: true,
38
+ width: "60px"
39
+ }
44
40
  ],
45
41
  showHideColumnList: [
46
42
  { label: "", field: "drag", hidden: false },
@@ -68,50 +64,7 @@ Default.args = {
68
64
  { label: "Switch", field: "switch", hidden: false },
69
65
  { label: "Icon", field: "color", hidden: false },
70
66
  ],
71
- rows: [
72
- {
73
- type: "",
74
- id: 1,
75
- make: "Baleno",
76
- modal: "Fusion",
77
- switch: "",
78
- staff: {
79
- image:
80
- "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80",
81
- name: "Manager",
82
- },
83
- crr: "0.00",
84
- color: { name: "trash", type: "solid", class: "h-5 w-5" },
85
- },
86
- {
87
- type: "",
88
- id: 2,
89
- make: "Test",
90
- modal: "Cruz",
91
- switch: "",
92
- staff: {
93
- image:
94
- "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80",
95
- name: "Manager",
96
- },
97
- crr: "9.56",
98
- color: { name: "trash", type: "solid", class: "h-5 w-5" },
99
- },
100
- {
101
- type: "",
102
- id: 3,
103
- make: "Honda City",
104
- modal: "Maruti",
105
- switch: "",
106
- staff: {
107
- image:
108
- "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80",
109
- name: "Manager",
110
- },
111
- crr: "3.28",
112
- color: { name: "trash", type: "solid", class: "h-5 w-5" },
113
- },
114
- ],
67
+ rows: [{"id":5,"mode":"ATM Machine 1","sort_order":2,"status":1,"rcInstitutionID":82,"created_at":"2020-09-02T12:53:09.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":11,"mode":"QA 1","sort_order":3,"status":1,"rcInstitutionID":82,"created_at":"2020-09-04T09:57:47.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":7,"mode":"ATM Machine 2","sort_order":4,"status":1,"rcInstitutionID":82,"created_at":"2020-09-04T09:45:47.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":18,"mode":"QA 3","sort_order":8,"status":1,"rcInstitutionID":82,"created_at":"2020-09-04T10:05:15.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":12,"mode":"QA 2","sort_order":21,"status":1,"rcInstitutionID":82,"created_at":"2020-09-04T09:57:55.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":15,"mode":"QA 4","sort_order":22,"status":1,"rcInstitutionID":82,"created_at":"2020-09-04T10:00:23.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":162,"mode":"Yes bank","sort_order":62,"status":1,"rcInstitutionID":82,"created_at":"2020-11-18T09:22:43.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":163,"mode":"SBI bank","sort_order":63,"status":1,"rcInstitutionID":82,"created_at":"2020-11-18T09:33:17.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":164,"mode":"BOB bank","sort_order":64,"status":1,"rcInstitutionID":82,"created_at":"2020-11-18T09:35:12.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"},{"id":165,"mode":"PNB bank","sort_order":65,"status":1,"rcInstitutionID":82,"created_at":"2020-11-18T09:55:16.000000Z","updated_at":"2021-11-25T13:13:56.000000Z"}],
115
68
  pagination: true,
116
69
  sorting: false,
117
70
  searching: true,
@@ -1,14 +1,20 @@
1
- import CUpload from '../components/CUpload/CUpload.vue';
2
- import './utils.css'
1
+ import CUpload from "../components/CUpload/CUpload.vue";
2
+ import "./utils.css";
3
3
 
4
4
  export default {
5
- title: 'CUpload',
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
- label: 'Name',
24
- hint: 'Optional',
25
- fileSize: '10',
26
- isValidate: false
29
+ label: "Name",
30
+ hint: "Optional",
31
+ fileSize: "10",
32
+ isValidate: true,
33
+ type: "default",
34
+ filestackApiKey: "",
27
35
  };