classcard-ui 0.2.391 → 0.2.392

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.391",
3
+ "version": "0.2.392",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@babel/core": "^7.15.5",
40
- "@storybook/addon-actions": "^6.4.20",
41
- "@storybook/addon-essentials": "^6.4.20",
42
- "@storybook/addon-links": "^6.4.20",
43
- "@storybook/vue": "^6.4.20",
40
+ "@storybook/addon-actions": "^6.4.21",
41
+ "@storybook/addon-essentials": "^6.4.21",
42
+ "@storybook/addon-links": "^6.4.21",
43
+ "@storybook/vue": "^6.4.21",
44
44
  "@tailwindcss/postcss7-compat": "^2.2.14",
45
45
  "@types/lodash-es": "^4.17.5",
46
46
  "@vue/cli-plugin-babel": "^4.5.13",
@@ -1,6 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <div slot="table-actions" v-if="tableActions" class="mb-4 rounded-lg bg-gray-50 p-3">
3
+ <div
4
+ slot="table-actions"
5
+ v-if="tableActions"
6
+ class="mb-4 rounded-lg bg-gray-50 p-3"
7
+ >
4
8
  <div class="flex justify-between">
5
9
  <div v-if="searching">
6
10
  <c-input
@@ -18,11 +22,15 @@
18
22
  <div>
19
23
  <button
20
24
  @click="handleToggle"
21
- class="focus:outline-none inline-flex w-full justify-center rounded-md border border-gray-200 bg-white px-2 py-2 text-sm font-medium shadow-sm hover:bg-gray-50 focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
25
+ class="inline-flex w-full justify-center rounded-md border border-gray-200 bg-white px-2 py-2 text-sm font-medium shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2"
22
26
  aria-haspopup="true"
23
27
  aria-expanded="true"
24
28
  >
25
- <c-icon name="view-board" type="solid" class="h-5 w-5 text-gray-400"></c-icon>
29
+ <c-icon
30
+ name="view-board"
31
+ type="solid"
32
+ class="h-5 w-5 text-gray-400"
33
+ ></c-icon>
26
34
  <c-icon
27
35
  name="chevron-down"
28
36
  type="solid"
@@ -79,7 +87,9 @@
79
87
  class="overflow-hidden rounded-lg border-2 border-solid border-gray-100"
80
88
  mode="remote"
81
89
  ref="my-table"
82
- :styleClass="showLoader ? 'vgt-table opacity-50 pointer-events-none' : 'vgt-table'"
90
+ :styleClass="
91
+ showLoader ? 'vgt-table opacity-50 pointer-events-none' : 'vgt-table'
92
+ "
83
93
  row-style-class="focus:outline-none"
84
94
  min-height="400px"
85
95
  :globalSearch="true"
@@ -148,7 +158,12 @@
148
158
  <template slot="table-row" slot-scope="props">
149
159
  <!-- renders if drag and drop is present in table -->
150
160
  <span v-if="props.column.field == 'drag'">
151
- <c-icon name="menu-solid" type="solid" class="handle h-5 w-5 text-gray-500" :cursorType="'cursor-move'"></c-icon>
161
+ <c-icon
162
+ name="menu-solid"
163
+ type="solid"
164
+ class="handle h-5 w-5 text-gray-500"
165
+ :cursorType="'cursor-move'"
166
+ ></c-icon>
152
167
  </span>
153
168
  <!-- if customization or adding another form element is required -->
154
169
  <span v-else-if="props.column.customizeColumn">
@@ -206,6 +221,7 @@ import "vue-good-table/dist/vue-good-table.css";
206
221
  import { VueGoodTable } from "vue-good-table";
207
222
  import Sortable from "@shopify/draggable/lib/es5/sortable.js";
208
223
  import CInput from "../CInput/CInput.vue";
224
+ import { debounce, isEqual } from "lodash-es";
209
225
 
210
226
  export default {
211
227
  name: "CTable",
@@ -333,8 +349,12 @@ export default {
333
349
  },
334
350
  // array of rows after drag and drop
335
351
  rearrange(oldIndex, newIndex) {
336
- const movedItem = this.reorderedArray.find((item, index) => index === oldIndex);
337
- const remainingItems = this.reorderedArray.filter((item, index) => index !== oldIndex);
352
+ const movedItem = this.reorderedArray.find(
353
+ (item, index) => index === oldIndex
354
+ );
355
+ const remainingItems = this.reorderedArray.filter(
356
+ (item, index) => index !== oldIndex
357
+ );
338
358
  const reorderedItems = [
339
359
  ...remainingItems.slice(0, newIndex),
340
360
  movedItem,
@@ -350,9 +370,9 @@ export default {
350
370
  }
351
371
  this.$emit("onSortChange", params);
352
372
  },
353
- onSearching(params) {
373
+ onSearching: debounce(function (params) {
354
374
  this.$emit("onSearch", params);
355
- },
375
+ }, 500),
356
376
  setCurrentPageRecords(page) {
357
377
  this.paginationRecords.currentPage = page;
358
378
  this.$emit("pageChange", page);
@@ -377,6 +397,11 @@ export default {
377
397
  isLoading() {
378
398
  this.showLoader = this.isLoading;
379
399
  },
400
+ paginationData() {
401
+ if (!isEqual(this.paginationRecords, this.paginationData)) {
402
+ this.paginationRecords = this.paginationData;
403
+ }
404
+ },
380
405
  },
381
406
  };
382
407
  </script>