classcard-ui 0.2.211 → 0.2.215
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 +149 -134
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +149 -134
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CDatepicker/CDatepicker.vue +3 -3
- package/src/components/CIcon/CIcon.vue +1 -1
- package/src/components/CInput/CInput.vue +1 -0
- package/src/components/CInputAddon/CInputAddon.vue +6 -7
- package/src/components/CMultiselect/CMultiselect.vue +7 -1
- package/src/components/CMultiselectr/CMultiselectr.vue +1 -1
- package/src/components/CPagination/CPagination.vue +75 -71
- package/src/components/CRadio/CRadio.vue +5 -0
- package/src/components/CSwitch/CSwitch.vue +11 -14
- package/src/components/CTable/CTable.vue +70 -58
- package/src/components/CTabs/CTabs.vue +1 -1
- package/src/stories/CCheckbox.stories.js +1 -1
- package/src/stories/CMultiselect.stories.js +2 -1
- package/src/stories/CPagination.stories.js +6 -1
- package/src/stories/CRadio.stories.js +1 -0
- package/src/stories/CSwitch.stories.js +1 -0
package/package.json
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
:value="inputValue"
|
|
38
38
|
:class="[
|
|
39
39
|
disabled
|
|
40
|
-
? 'border-gray-100 text-gray-400'
|
|
41
|
-
: 'border-gray-300 text-gray-700',
|
|
40
|
+
? 'border-gray-100 border-l-0 text-gray-400'
|
|
41
|
+
: 'border-gray-300 border-l-0 text-gray-700',
|
|
42
42
|
'bg-white w-full p-2 appearance-none border rounded-r-md focus:outline-none focus:border-blue-500 text-sm',
|
|
43
43
|
]"
|
|
44
44
|
:readonly="disabled"
|
|
@@ -87,8 +87,8 @@ export default {
|
|
|
87
87
|
data() {
|
|
88
88
|
const masks = {
|
|
89
89
|
input: [
|
|
90
|
-
"YYYY/MM/DD",
|
|
91
90
|
"MMM DD, YYYY",
|
|
91
|
+
"YYYY/MM/DD",
|
|
92
92
|
"DD-MM-YYYY",
|
|
93
93
|
"DD/MM/YYYY",
|
|
94
94
|
"YYYY-MM-DD",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
:type="type"
|
|
18
18
|
:value="inputValue"
|
|
19
19
|
@input="$emit('input', $event.target.value)"
|
|
20
|
+
@blur="$emit('blur', $event.target.value)"
|
|
20
21
|
:class="errorClasses"
|
|
21
22
|
class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full px-3 py-2 rounded-md sm:text-sm disabled:opacity-50"
|
|
22
23
|
:placeholder="placeholder"
|
|
@@ -71,20 +71,19 @@
|
|
|
71
71
|
:disabled="disabled"
|
|
72
72
|
/>
|
|
73
73
|
<div class="absolute inset-y-0 right-3 flex items-center pointer-events-none">
|
|
74
|
+
<div
|
|
75
|
+
v-if="!isValidate"
|
|
76
|
+
class="right-0 pr-2 flex items-center pointer-events-none text-red-600"
|
|
77
|
+
>
|
|
78
|
+
<c-icon name="exclamation-circle" type="solid" class="h-5 w-5"></c-icon>
|
|
79
|
+
</div>
|
|
74
80
|
<span
|
|
75
|
-
v-if="isValidate"
|
|
76
81
|
class="text-gray-500 sm:text-sm"
|
|
77
82
|
:class="disabled ? 'opacity-50' : ''"
|
|
78
83
|
>
|
|
79
84
|
{{ addon }}
|
|
80
85
|
</span>
|
|
81
86
|
</div>
|
|
82
|
-
<div
|
|
83
|
-
v-if="!isValidate"
|
|
84
|
-
class="absolute inset-y-0 right-0 pr-2 flex items-center pointer-events-none text-red-600"
|
|
85
|
-
>
|
|
86
|
-
<c-icon name="exclamation-circle" type="solid" class="h-5 w-5"></c-icon>
|
|
87
|
-
</div>
|
|
88
87
|
</div>
|
|
89
88
|
<div v-if="inlineAddon && addonType == 'leading'" class="relative mt-1 flex rounded-md">
|
|
90
89
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
@@ -74,7 +74,10 @@ export default {
|
|
|
74
74
|
required: true,
|
|
75
75
|
},
|
|
76
76
|
label: String,
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder:{
|
|
78
|
+
type: String,
|
|
79
|
+
default: "Start typing... (min 2 characters) to search options",
|
|
80
|
+
},
|
|
78
81
|
// whether multiple fields are allowed or not
|
|
79
82
|
isMultiple: {
|
|
80
83
|
type: Boolean,
|
|
@@ -170,4 +173,7 @@ export default {
|
|
|
170
173
|
.vs__dropdown-toggle.vs__dropdown-option--highlight {
|
|
171
174
|
@apply bg-indigo-700 text-white;
|
|
172
175
|
}
|
|
176
|
+
.vs__dropdown-option--highlight {
|
|
177
|
+
@apply bg-indigo-700 text-white;
|
|
178
|
+
}
|
|
173
179
|
</style>
|
|
@@ -1,80 +1,84 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div class="-
|
|
4
|
-
<a
|
|
5
|
-
@click="currentPageNumber == '1' ? '' : goToPreviousPage()"
|
|
6
|
-
class="pt-4 pr-1 inline-flex items-center text-sm font-medium"
|
|
7
|
-
:class="
|
|
8
|
-
currentPageNumber == '1'
|
|
9
|
-
? 'text-gray-400 pointer-events-none'
|
|
10
|
-
: 'text-gray-500 hover:text-gray-700 group cursor-pointer'
|
|
11
|
-
"
|
|
12
|
-
>
|
|
13
|
-
<c-icon
|
|
14
|
-
name="arrow-narrow-left-solid"
|
|
15
|
-
class="h-5 w-5 mr-3"
|
|
16
|
-
:class="
|
|
17
|
-
currentPageNumber == '1'
|
|
18
|
-
? 'text-gray-400 pointer-events-none'
|
|
19
|
-
: 'text-gray-500 group-hover:text-gray-800'
|
|
20
|
-
"
|
|
21
|
-
type="solid"
|
|
22
|
-
></c-icon>
|
|
2
|
+
<div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6">
|
|
3
|
+
<div class="flex-1 flex justify-between sm:hidden">
|
|
4
|
+
<a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
|
23
5
|
Previous
|
|
24
6
|
</a>
|
|
25
|
-
|
|
26
|
-
<div class="hidden md:-mt-px md:flex">
|
|
27
|
-
<div
|
|
28
|
-
v-for="page in pageRange"
|
|
29
|
-
:key="page"
|
|
30
|
-
class="text-gray-500 hover:text-gray-700 px-4 inline-flex items-center text-sm font-medium group"
|
|
31
|
-
:class="[
|
|
32
|
-
page == currentPageNumber
|
|
33
|
-
? 'border-indigo-500 border-t-4 cursor-pointer'
|
|
34
|
-
: 'hover:border-t-4',
|
|
35
|
-
page === '...' ? 'cursor-text hover:border-t-4 hover:border-transparent' : '',
|
|
36
|
-
page !== currentPageNumber && page !== '...'
|
|
37
|
-
? 'hover:border-gray-300 hover:border-t-4 cursor-pointer'
|
|
38
|
-
: '',
|
|
39
|
-
]"
|
|
40
|
-
@click="changePage(page)"
|
|
41
|
-
>
|
|
42
|
-
<div class="pt-4 group-hover:-mt-1" v-if="page === '...'">...</div>
|
|
43
|
-
<div v-else-if="page == currentPageNumber" class="pt-3.5 text-indigo-600">
|
|
44
|
-
{{ page }}
|
|
45
|
-
</div>
|
|
46
|
-
<div class="pt-4 group-hover:-mt-1" v-else>
|
|
47
|
-
{{ page }}
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="-mt-px w-0 flex-1 flex justify-end">
|
|
52
|
-
<a
|
|
53
|
-
@click="currentPageNumber == lastPageNumber ? '' : goToNextPage()"
|
|
54
|
-
class="pt-4 pl-1 inline-flex items-center text-sm"
|
|
55
|
-
:class="
|
|
56
|
-
currentPageNumber == lastPageNumber
|
|
57
|
-
? 'text-gray-400 pointer-events-none'
|
|
58
|
-
: 'text-gray-500 hover:text-gray-700 group cursor-pointer'
|
|
59
|
-
"
|
|
60
|
-
>
|
|
7
|
+
<a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
|
61
8
|
Next
|
|
62
|
-
<c-icon
|
|
63
|
-
class="ml-3 h-5 w-5"
|
|
64
|
-
:class="
|
|
65
|
-
currentPageNumber == lastPageNumber
|
|
66
|
-
? 'text-gray-400 pointer-events-none'
|
|
67
|
-
: 'text-gray-500 group-hover:text-gray-800'
|
|
68
|
-
"
|
|
69
|
-
name="arrow-narrow-right-solid"
|
|
70
|
-
type="solid"
|
|
71
|
-
></c-icon>
|
|
72
9
|
</a>
|
|
73
10
|
</div>
|
|
74
|
-
|
|
11
|
+
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
|
|
12
|
+
<div>
|
|
13
|
+
<p class="text-sm text-gray-700">
|
|
14
|
+
Showing
|
|
15
|
+
<span class="font-medium">1</span>
|
|
16
|
+
to
|
|
17
|
+
<span class="font-medium">10</span>
|
|
18
|
+
of
|
|
19
|
+
<span class="font-medium">97</span>
|
|
20
|
+
results
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div>
|
|
24
|
+
<nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
|
|
25
|
+
<div class="hidden md:-mt-px md:flex">
|
|
26
|
+
<div href="#"
|
|
27
|
+
@click="currentPageNumber == '1' ? '' : goToPreviousPage()"
|
|
28
|
+
class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-r-0 border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"
|
|
29
|
+
:class="
|
|
30
|
+
currentPageNumber == '1'
|
|
31
|
+
? 'text-gray-400 pointer-events-none'
|
|
32
|
+
: 'text-gray-500 hover:text-gray-700 group cursor-pointer'
|
|
33
|
+
"
|
|
34
|
+
>
|
|
35
|
+
<span class="sr-only">Previous</span>
|
|
36
|
+
<!-- Heroicon name: solid/chevron-left -->
|
|
37
|
+
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
38
|
+
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
|
|
39
|
+
</svg>
|
|
40
|
+
</div>
|
|
41
|
+
<div
|
|
42
|
+
v-for="page in pageRange"
|
|
43
|
+
:key="page"
|
|
44
|
+
:class="[
|
|
45
|
+
page == currentPageNumber
|
|
46
|
+
? 'z-10 bg-indigo-50 border-indigo-500 text-indigo-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium'
|
|
47
|
+
: '',
|
|
48
|
+
page === '...' ? 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border border-r-0 text-sm font-medium' : '',
|
|
49
|
+
page !== currentPageNumber && page !== '...'
|
|
50
|
+
? 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border border-r-0 text-sm font-medium'
|
|
51
|
+
: '',
|
|
52
|
+
]"
|
|
53
|
+
@click="changePage(page)"
|
|
54
|
+
>
|
|
55
|
+
<div v-if="page === '...'">...</div>
|
|
56
|
+
<div v-else>
|
|
57
|
+
{{ page }}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div href="#"
|
|
61
|
+
class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"
|
|
62
|
+
@click="currentPageNumber == lastPageNumber ? '' : goToNextPage()"
|
|
63
|
+
:class="
|
|
64
|
+
currentPageNumber == lastPageNumber
|
|
65
|
+
? 'text-gray-400 pointer-events-none'
|
|
66
|
+
: 'text-gray-500 hover:text-gray-700 group cursor-pointer'
|
|
67
|
+
"
|
|
68
|
+
>
|
|
69
|
+
<span class="sr-only">Next</span>
|
|
70
|
+
<!-- Heroicon name: solid/chevron-right -->
|
|
71
|
+
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
72
|
+
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
|
|
73
|
+
</svg>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</nav>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
75
80
|
</template>
|
|
76
81
|
<script>
|
|
77
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
78
82
|
export default {
|
|
79
83
|
name: "CPagination",
|
|
80
84
|
props: {
|
|
@@ -92,7 +96,7 @@ export default {
|
|
|
92
96
|
},
|
|
93
97
|
},
|
|
94
98
|
components: {
|
|
95
|
-
|
|
99
|
+
|
|
96
100
|
},
|
|
97
101
|
data() {
|
|
98
102
|
return {
|
|
@@ -148,4 +152,4 @@ export default {
|
|
|
148
152
|
},
|
|
149
153
|
},
|
|
150
154
|
};
|
|
151
|
-
</script>
|
|
155
|
+
</script>
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<input
|
|
11
11
|
type="radio"
|
|
12
12
|
:value="item.value"
|
|
13
|
+
:name="name"
|
|
13
14
|
v-model="selectedItem"
|
|
14
15
|
@click="onChange(item.value)"
|
|
15
16
|
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 cursor-pointer border-gray-300 disabled:opacity-50"
|
|
@@ -44,6 +45,10 @@ export default {
|
|
|
44
45
|
isDisabled: {
|
|
45
46
|
type: Boolean,
|
|
46
47
|
},
|
|
48
|
+
name: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
47
52
|
},
|
|
48
53
|
data() {
|
|
49
54
|
return {
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
<div
|
|
5
5
|
v-if="size === 'small'"
|
|
6
6
|
:class="label == '' ? 'items-center' : 'items-start'"
|
|
7
|
-
class="flex justify-between"
|
|
7
|
+
class="flex justify-between cursor-pointer"
|
|
8
8
|
>
|
|
9
|
-
<span class="flex-grow flex flex-col" id="smallleft" v-if="direction == 'left'">
|
|
9
|
+
<span class="flex-grow flex flex-col" id="smallleft" v-if="direction == 'left'" @click="switchValue">
|
|
10
10
|
<span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
|
|
11
11
|
<span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
|
|
12
12
|
</span>
|
|
13
13
|
<button
|
|
14
14
|
type="button"
|
|
15
|
-
class="flex-shrink-0 group relative rounded-full inline-flex items-center justify-center h-5 w-10 cursor-pointer focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
|
15
|
+
class="flex-shrink-0 group relative rounded-full inline-flex items-center justify-center h-5 w-10 cursor-pointer focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
|
|
16
16
|
aria-pressed="false"
|
|
17
17
|
@click="switchValue"
|
|
18
|
+
:disabled="disabled"
|
|
18
19
|
>
|
|
19
20
|
<span class="sr-only">Use setting</span>
|
|
20
21
|
<span
|
|
@@ -32,14 +33,14 @@
|
|
|
32
33
|
class="pointer-events-none absolute left-0 inline-block h-5 w-5 border border-gray-200 rounded-full bg-white transform ring-0 transition-transform ease-in-out duration-200"
|
|
33
34
|
></span>
|
|
34
35
|
</button>
|
|
35
|
-
<span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'">
|
|
36
|
+
<span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'" @click="switchValue">
|
|
36
37
|
<span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
|
|
37
38
|
<span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
|
|
38
39
|
</span>
|
|
39
40
|
</div>
|
|
40
41
|
<!-- large toggle -->
|
|
41
|
-
<div v-else :class="label == '' ? 'items-center' : 'items-start'" class="flex justify-between">
|
|
42
|
-
<span class="flex-grow flex flex-col" id="toggleLabel" v-if="direction == 'left'">
|
|
42
|
+
<div v-else :class="label == '' ? 'items-center' : 'items-start'" class="flex justify-between cursor-pointer">
|
|
43
|
+
<span class="flex-grow flex flex-col" id="toggleLabel" v-if="direction == 'left'" @click="switchValue">
|
|
43
44
|
<span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
|
|
44
45
|
<span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
|
|
45
46
|
</span>
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
aria-pressed="false"
|
|
49
50
|
:class="{ 'bg-indigo-600': isToggle == 1, 'bg-gray-200': isToggle == 0 }"
|
|
50
51
|
@click="switchValue"
|
|
51
|
-
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
|
52
|
+
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
|
|
53
|
+
:disabled="disabled"
|
|
52
54
|
>
|
|
53
55
|
<span class="sr-only">Use setting</span>
|
|
54
56
|
<span
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
class="inline-block h-5 w-5 rounded-full bg-white transform ring-0 transition ease-in-out duration-200"
|
|
58
60
|
></span>
|
|
59
61
|
</button>
|
|
60
|
-
<span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'">
|
|
62
|
+
<span class="flex flex-col" id="toggleLabel" v-if="direction == 'right'" disabled:opacity-50>
|
|
61
63
|
<span v-if="label" :class="classes" class="text-gray-900">{{ label }}</span>
|
|
62
64
|
<span v-if="description" class="text-sm text-gray-500">{{ description }}</span>
|
|
63
65
|
</span>
|
|
@@ -97,12 +99,7 @@ export default {
|
|
|
97
99
|
},
|
|
98
100
|
methods: {
|
|
99
101
|
switchValue() {
|
|
100
|
-
|
|
101
|
-
if (this.isToggle == 1) {
|
|
102
|
-
this.isToggle = 0;
|
|
103
|
-
} else if (this.isToggle == 0) {
|
|
104
|
-
this.isToggle = 1;
|
|
105
|
-
}
|
|
102
|
+
this.isToggle = this.isToggle === 1 ? 0 : 1;
|
|
106
103
|
this.$emit("returnToggleValue", this.isToggle);
|
|
107
104
|
},
|
|
108
105
|
},
|
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
|
|
4
|
+
<div slot="table-actions" v-if="tableActions" class="bg-gray-100 rounded-lg p-3 mb-6">
|
|
5
|
+
<div class="flex justify-between">
|
|
6
|
+
<div v-if="searching">
|
|
7
|
+
<c-input v-model="searchTerm" :isValidate="searching" :placeholder="searchPlaceholder" class="-mt-1 w-56" type="text"></c-input>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="flex">
|
|
10
|
+
<!-- dropdown icon on top right of table -->
|
|
11
|
+
<div class="relative inline-block text-left">
|
|
12
|
+
<!-- button to show list of columns to show hide in table -->
|
|
13
|
+
<div>
|
|
14
|
+
<button
|
|
15
|
+
@click="toggleDropdown = !toggleDropdown"
|
|
16
|
+
class="inline-flex justify-center w-full rounded-md border border-gray-200 shadow-sm px-2 py-2 bg-white text-sm font-medium hover:bg-gray-50 focus:outline-none focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600"
|
|
17
|
+
aria-haspopup="true"
|
|
18
|
+
aria-expanded="true"
|
|
19
|
+
@blur="toggleDropdown = false"
|
|
20
|
+
>
|
|
21
|
+
<c-icon name="view-board" type="solid" class="text-gray-400 h-5 w-5"></c-icon>
|
|
22
|
+
<c-icon
|
|
23
|
+
name="chevron-down"
|
|
24
|
+
type="solid"
|
|
25
|
+
class="ml-1 text-gray-400 h-5 w-5"
|
|
26
|
+
></c-icon>
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
<!-- dropdown having list of all columns to show hide -->
|
|
30
|
+
<div
|
|
31
|
+
v-show="toggleDropdown"
|
|
32
|
+
class="origin-top-right absolute right-0 mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-100 overflow-y-auto max-h-96"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="py-1"
|
|
36
|
+
role="menu"
|
|
37
|
+
aria-orientation="vertical"
|
|
38
|
+
aria-labelledby="option-menu"
|
|
39
|
+
>
|
|
40
|
+
<a
|
|
41
|
+
href="#"
|
|
42
|
+
v-for="column in showHideColumnList"
|
|
43
|
+
v-bind:key="column.field"
|
|
44
|
+
class="flex block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
45
|
+
role="menuitem"
|
|
46
|
+
>
|
|
47
|
+
<c-checkbox
|
|
48
|
+
:label="column.label"
|
|
49
|
+
@onChange="showHideColumn($event, column.field)"
|
|
50
|
+
:value="!column.hidden"
|
|
51
|
+
></c-checkbox>
|
|
52
|
+
</a>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div>
|
|
58
|
+
<c-button-icon
|
|
59
|
+
type="white"
|
|
60
|
+
:icon="{ name: 'download-solid', type: 'solid', class: 'h-5 w-5 text-gray-400' }"
|
|
61
|
+
class="ml-3"
|
|
62
|
+
></c-button-icon>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
3
68
|
<vue-good-table
|
|
69
|
+
class="border-solid border-2 border-gray-200 rounded-lg"
|
|
4
70
|
mode="remote"
|
|
5
71
|
ref="my-table"
|
|
6
72
|
:styleClass="showLoader ? 'vgt-table opacity-50 pointer-events-none' : 'vgt-table'"
|
|
@@ -13,6 +79,7 @@
|
|
|
13
79
|
:rows="rows"
|
|
14
80
|
:search-options="{
|
|
15
81
|
enabled: searching,
|
|
82
|
+
externalQuery: searchTerm,
|
|
16
83
|
placeholder: searchPlaceholder,
|
|
17
84
|
trigger: 'enter',
|
|
18
85
|
}"
|
|
@@ -82,63 +149,6 @@
|
|
|
82
149
|
{{ props.formattedRow[props.column.field] }}
|
|
83
150
|
</span>
|
|
84
151
|
</template>
|
|
85
|
-
<div slot="table-actions" v-if="tableActions">
|
|
86
|
-
<div class="flex flex-row-reverse">
|
|
87
|
-
<!-- dropdown icon on top right of table -->
|
|
88
|
-
<div>
|
|
89
|
-
<c-button-icon
|
|
90
|
-
type="white"
|
|
91
|
-
:icon="{ name: 'download', type: 'outline', class: 'h-5 w-5 text-gray-400' }"
|
|
92
|
-
class="ml-3"
|
|
93
|
-
></c-button-icon>
|
|
94
|
-
</div>
|
|
95
|
-
<div class="relative inline-block text-left">
|
|
96
|
-
<!-- button to show list of columns to show hide in table -->
|
|
97
|
-
<div>
|
|
98
|
-
<button
|
|
99
|
-
@click="toggleDropdown = !toggleDropdown"
|
|
100
|
-
class="inline-flex justify-center w-full rounded-md border border-gray-200 shadow-sm px-2 py-2 bg-white text-sm font-medium hover:bg-gray-50 focus:outline-none focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600"
|
|
101
|
-
aria-haspopup="true"
|
|
102
|
-
aria-expanded="true"
|
|
103
|
-
>
|
|
104
|
-
<c-icon name="view-board" type="solid" class="text-gray-400 h-5 w-5"></c-icon>
|
|
105
|
-
<c-icon
|
|
106
|
-
name="chevron-down"
|
|
107
|
-
type="solid"
|
|
108
|
-
class="ml-1 text-gray-400 h-5 w-5"
|
|
109
|
-
></c-icon>
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
<!-- dropdown having list of all columns to show hide -->
|
|
113
|
-
<div
|
|
114
|
-
v-show="toggleDropdown"
|
|
115
|
-
class="origin-top-right absolute right-0 mt-2 -mr-1 w-56 rounded-md shadow-lg bg-white ring-1 ring-gray-900 ring-opacity-5 z-100 overflow-y-auto max-h-96"
|
|
116
|
-
>
|
|
117
|
-
<div
|
|
118
|
-
class="py-1"
|
|
119
|
-
role="menu"
|
|
120
|
-
aria-orientation="vertical"
|
|
121
|
-
aria-labelledby="option-menu"
|
|
122
|
-
>
|
|
123
|
-
<a
|
|
124
|
-
href="#"
|
|
125
|
-
v-for="column in showHideColumnList"
|
|
126
|
-
v-bind:key="column.field"
|
|
127
|
-
class="flex block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
128
|
-
role="menuitem"
|
|
129
|
-
>
|
|
130
|
-
<c-checkbox
|
|
131
|
-
:label="column.label"
|
|
132
|
-
@onChange="showHideColumn($event, column.field)"
|
|
133
|
-
:value="!column.hidden"
|
|
134
|
-
></c-checkbox>
|
|
135
|
-
</a>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
<slot name="action"></slot>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
152
|
<!-- Custom pagination component -->
|
|
143
153
|
<template v-if="pagination" slot="pagination-bottom">
|
|
144
154
|
<c-pagination
|
|
@@ -185,6 +195,7 @@ import CButtonIcon from "../CButtonIcon/CButtonIcon.vue";
|
|
|
185
195
|
import "vue-good-table/dist/vue-good-table.css";
|
|
186
196
|
import { VueGoodTable } from "vue-good-table";
|
|
187
197
|
import Sortable from "@shopify/draggable/lib/es5/sortable.js";
|
|
198
|
+
import CInput from '../CInput/CInput.vue';
|
|
188
199
|
|
|
189
200
|
export default {
|
|
190
201
|
name: "CTable",
|
|
@@ -194,6 +205,7 @@ export default {
|
|
|
194
205
|
VueGoodTable,
|
|
195
206
|
CPagination,
|
|
196
207
|
CButtonIcon,
|
|
208
|
+
CInput,
|
|
197
209
|
},
|
|
198
210
|
props: {
|
|
199
211
|
// To show or hide pagination section
|
|
@@ -285,7 +297,7 @@ export default {
|
|
|
285
297
|
return {
|
|
286
298
|
toggleDropdown: false,
|
|
287
299
|
showLoader: this.isLoading,
|
|
288
|
-
searchTerm:
|
|
300
|
+
searchTerm: '',
|
|
289
301
|
paginationRecords: this.paginationData,
|
|
290
302
|
reorderedArray: [...this.rows],
|
|
291
303
|
};
|
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
options: Array,
|
|
9
9
|
label: String,
|
|
10
10
|
filterable: Boolean,
|
|
11
|
+
optionLabel: String,
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
14
|
|
|
@@ -19,7 +20,6 @@ const Template = (args, { argTypes }) => ({
|
|
|
19
20
|
|
|
20
21
|
export const Default = Template.bind({});
|
|
21
22
|
Default.args = {
|
|
22
|
-
// options: ["list", "of", "options"],
|
|
23
23
|
options: [
|
|
24
24
|
{
|
|
25
25
|
text: "Subjects",
|
|
@@ -90,6 +90,7 @@ Default.args = {
|
|
|
90
90
|
children: [{ id: "15820_Package", text: "Mathematics" }],
|
|
91
91
|
},
|
|
92
92
|
],
|
|
93
|
+
optionLabel: "text",
|
|
93
94
|
label: "Active",
|
|
94
95
|
showOptionImage: true,
|
|
95
96
|
filterable: false,
|