classcard-ui 0.2.389 → 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/dist/classcard-ui.common.js +2910 -496
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +2910 -496
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +7 -7
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +5 -5
- package/src/components/CIcon/CIcon.vue +7 -5
- package/src/components/CMultiselect/CMultiselect.vue +47 -5
- package/src/components/CTable/CTable.vue +34 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "classcard-ui",
|
|
3
|
-
"version": "0.2.
|
|
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.
|
|
41
|
-
"@storybook/addon-essentials": "^6.4.
|
|
42
|
-
"@storybook/addon-links": "^6.4.
|
|
43
|
-
"@storybook/vue": "^6.4.
|
|
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",
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
</svg>
|
|
21
21
|
<svg
|
|
22
22
|
v-if="name !== 'loader' && type == 'solid'"
|
|
23
|
-
:class="classes"
|
|
24
|
-
class="cursor-pointer"
|
|
23
|
+
:class="(classes ? classes : '') + (cursorType ? cursorType : ' cursor-pointer')"
|
|
25
24
|
:viewBox="viewBox"
|
|
26
25
|
fill="currentColor"
|
|
27
26
|
fill-rule="evenodd"
|
|
@@ -30,11 +29,10 @@
|
|
|
30
29
|
</svg>
|
|
31
30
|
<svg
|
|
32
31
|
v-if="name !== 'loader' && type == 'outline'"
|
|
33
|
-
|
|
32
|
+
:class="(classes ? classes : '') + (cursorType ? cursorType : ' cursor-pointer')"
|
|
34
33
|
viewBox="0 0 24 24"
|
|
34
|
+
fill="none"
|
|
35
35
|
stroke="currentColor"
|
|
36
|
-
:class="classes"
|
|
37
|
-
class="cursor-pointer"
|
|
38
36
|
>
|
|
39
37
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" :d="path" />
|
|
40
38
|
</svg>
|
|
@@ -60,6 +58,10 @@ export default {
|
|
|
60
58
|
type: String,
|
|
61
59
|
default: "0 0 20 20",
|
|
62
60
|
},
|
|
61
|
+
cursorType: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "cursor-pointer",
|
|
64
|
+
},
|
|
63
65
|
},
|
|
64
66
|
computed: {
|
|
65
67
|
path() {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div class="flex items-center">
|
|
4
|
-
<label v-if="label" class="text-sm font-medium text-gray-900">{{
|
|
4
|
+
<label v-if="label" class="text-sm font-medium text-gray-900">{{
|
|
5
|
+
label
|
|
6
|
+
}}</label>
|
|
5
7
|
<!-- asterisk sign to render if field is required -->
|
|
6
8
|
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
7
9
|
</div>
|
|
@@ -42,7 +44,9 @@
|
|
|
42
44
|
</template>
|
|
43
45
|
<!-- eslint-disable-next-line vue/no-unused-vars -->
|
|
44
46
|
<template #no-options="{ search, searching, loading }">
|
|
45
|
-
<span v-if="search.length < 1"
|
|
47
|
+
<span v-if="search.length < 1"
|
|
48
|
+
>Start typing to search for options...</span
|
|
49
|
+
>
|
|
46
50
|
<span v-else>No options found, try searching something else.</span>
|
|
47
51
|
</template>
|
|
48
52
|
<template #spinner="{ loading }">
|
|
@@ -91,7 +95,34 @@
|
|
|
91
95
|
</div>
|
|
92
96
|
</template>
|
|
93
97
|
<template #list-footer>
|
|
94
|
-
<li ref="load" class="loader" v-show="hasNextPage">
|
|
98
|
+
<li ref="load" class="loader" v-show="hasNextPage">
|
|
99
|
+
Loading more options...
|
|
100
|
+
</li>
|
|
101
|
+
<li
|
|
102
|
+
v-if="showFooterButton"
|
|
103
|
+
class="group sticky bottom-0 mt-1 cursor-pointer select-none bg-gray-50 py-2 pl-3 pr-9 text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
104
|
+
id="listbox-option-0"
|
|
105
|
+
role="option"
|
|
106
|
+
@click="$emit('footerButtonClick')"
|
|
107
|
+
>
|
|
108
|
+
<div class="flex items-center">
|
|
109
|
+
<svg
|
|
110
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
111
|
+
class="h-6 w-6 flex-shrink-0 text-gray-400"
|
|
112
|
+
viewBox="0 0 20 20"
|
|
113
|
+
fill="currentColor"
|
|
114
|
+
>
|
|
115
|
+
<path
|
|
116
|
+
fill-rule="evenodd"
|
|
117
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z"
|
|
118
|
+
clip-rule="evenodd"
|
|
119
|
+
/>
|
|
120
|
+
</svg>
|
|
121
|
+
<span class="ml-3 block truncate font-semibold">
|
|
122
|
+
{{ footerButtonText }}
|
|
123
|
+
</span>
|
|
124
|
+
</div>
|
|
125
|
+
</li>
|
|
95
126
|
</template>
|
|
96
127
|
</v-select>
|
|
97
128
|
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
@@ -113,6 +144,14 @@ export default {
|
|
|
113
144
|
type: Array,
|
|
114
145
|
required: true,
|
|
115
146
|
},
|
|
147
|
+
showFooterButton: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: false,
|
|
150
|
+
},
|
|
151
|
+
footerButtonText: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: "",
|
|
154
|
+
},
|
|
116
155
|
label: String,
|
|
117
156
|
isRequired: {
|
|
118
157
|
type: Boolean,
|
|
@@ -184,7 +223,10 @@ export default {
|
|
|
184
223
|
data() {
|
|
185
224
|
return {
|
|
186
225
|
loaderSearching: true,
|
|
187
|
-
value:
|
|
226
|
+
value:
|
|
227
|
+
this.optionsSelected && this.optionsSelected.length
|
|
228
|
+
? this.optionsSelected
|
|
229
|
+
: [],
|
|
188
230
|
observer: null,
|
|
189
231
|
};
|
|
190
232
|
},
|
|
@@ -262,7 +304,7 @@ export default {
|
|
|
262
304
|
@apply pt-0 pr-3;
|
|
263
305
|
}
|
|
264
306
|
.vs__dropdown-menu {
|
|
265
|
-
@apply focus:outline-none mt-2 max-h-60 overflow-auto rounded-md bg-white py-
|
|
307
|
+
@apply focus:outline-none mt-2 max-h-60 overflow-auto rounded-md bg-white py-0 text-base shadow-lg ring-1 ring-opacity-5 sm:text-sm;
|
|
266
308
|
}
|
|
267
309
|
.vs__dropdown-option {
|
|
268
310
|
@apply py-2;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div
|
|
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="
|
|
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
|
|
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="
|
|
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
|
|
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(
|
|
337
|
-
|
|
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>
|