@usssa/component-library 1.0.0-alpha.4 → 1.0.0-alpha.41
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/README.md +4 -1
- package/package.json +6 -4
- package/src/App.vue +9 -0
- package/src/assets/quasar-logo-vertical.svg +15 -0
- package/src/boot/.gitkeep +0 -0
- package/src/boot/google-maps.js +11 -0
- package/src/components/ComponentLink.vue +26 -0
- package/src/components/core/UAvatar.vue +161 -0
- package/src/components/core/UAvatarGroup.vue +119 -0
- package/src/components/core/UBadgeStd.vue +91 -0
- package/src/components/core/UBannerStd.vue +115 -0
- package/src/components/core/UBreadCrumbs.vue +67 -0
- package/src/components/core/UBtnIcon.vue +159 -0
- package/src/components/core/UBtnStd.vue +129 -0
- package/src/components/core/UBtnToggle.vue +68 -0
- package/src/components/core/UCheckboxStd.vue +95 -0
- package/src/components/core/UChip.vue +251 -0
- package/src/components/core/UDialogStd.vue +242 -0
- package/src/components/core/UDrawer.vue +211 -0
- package/src/components/core/UInnerLoader.vue +58 -0
- package/src/components/core/UInputAddressLookup.vue +466 -0
- package/src/components/core/UInputPhoneStd.vue +295 -0
- package/src/components/core/UInputTextStd.vue +293 -0
- package/src/components/core/UMenuButtonStd.vue +274 -0
- package/src/components/core/UMenuDropdown.vue +77 -0
- package/src/components/core/UMenuDropdownAdvancedSearch.vue +262 -0
- package/src/components/core/UMenuItem.vue +132 -0
- package/src/components/core/UMultiSelectStd.vue +259 -0
- package/src/components/core/UPagination.vue +104 -0
- package/src/components/core/URadioBtn.vue +116 -0
- package/src/components/core/URadioStd.vue +62 -0
- package/src/components/core/USelectStd.vue +233 -0
- package/src/components/core/UTabBtnStd.vue +167 -0
- package/src/components/core/UTable/UTable.vue +93 -0
- package/src/components/core/UTable/UTd.vue +63 -0
- package/src/components/core/UTable/UTh.vue +48 -0
- package/src/components/core/UTable/UTr.vue +20 -0
- package/src/components/core/UTableStd.vue +636 -0
- package/src/components/core/UTabsStd.vue +111 -0
- package/src/components/core/UToggleStd.vue +159 -0
- package/src/components/core/UTooltip.vue +71 -0
- package/src/components/index.js +66 -0
- package/src/composables/useNotify.js +79 -0
- package/src/composables/useOverlayLoader.js +23 -0
- package/src/css/app.sass +159 -0
- package/src/css/colors.sass +101 -0
- package/src/css/media.sass +1 -0
- package/src/css/quasar.variables.sass +119 -0
- package/src/css/typography.sass +0 -0
- package/src/css/vars/colors.variables.sass +126 -0
- package/src/layouts/MainLayout.vue +173 -0
- package/src/pages/AdvancedSearch.vue +512 -0
- package/src/pages/Avatar.vue +77 -0
- package/src/pages/AvatarGroup.vue +139 -0
- package/src/pages/BadgeStd.vue +83 -0
- package/src/pages/BannerPage.vue +76 -0
- package/src/pages/BreadCrumbs.vue +100 -0
- package/src/pages/BtnIcon.vue +120 -0
- package/src/pages/BtnStd.vue +138 -0
- package/src/pages/BtnToggle.vue +131 -0
- package/src/pages/CheckBox.vue +62 -0
- package/src/pages/Chip.vue +108 -0
- package/src/pages/ComponentBase.vue +54 -0
- package/src/pages/Dialog.vue +221 -0
- package/src/pages/Drawer.vue +128 -0
- package/src/pages/ErrorNotFound.vue +11 -0
- package/src/pages/IndexPage.vue +11 -0
- package/src/pages/InnerLoader.vue +81 -0
- package/src/pages/InputAddressLookup.vue +258 -0
- package/src/pages/InputPhone.vue +152 -0
- package/src/pages/InputText.vue +140 -0
- package/src/pages/MenuButton.vue +194 -0
- package/src/pages/MenuDropdown.vue +79 -0
- package/src/pages/MenuItem.vue +68 -0
- package/src/pages/MultiSelectStd.vue +174 -0
- package/src/pages/NotifyPage.vue +109 -0
- package/src/pages/OverlayLoader.vue +128 -0
- package/src/pages/Pagination.vue +71 -0
- package/src/pages/Radio.vue +80 -0
- package/src/pages/RadioBtn.vue +104 -0
- package/src/pages/SelectStd.vue +160 -0
- package/src/pages/TabButtonPage.vue +126 -0
- package/src/pages/TablePage.vue +375 -0
- package/src/pages/TabsPage.vue +261 -0
- package/src/pages/TogglePage.vue +58 -0
- package/src/pages/TooltipPage.vue +125 -0
- package/src/router/index.js +34 -0
- package/src/router/routes.js +149 -0
- package/dist/spa/assets/Avatar.45667392.js +0 -9
- package/dist/spa/assets/AvatarGroup.99557443.js +0 -9
- package/dist/spa/assets/AvatarGroup.bb4cd03a.css +0 -1
- package/dist/spa/assets/BadgeStd.ee4129c5.js +0 -6
- package/dist/spa/assets/BannerPage.6c6a98c4.js +0 -10
- package/dist/spa/assets/BannerPage.d195fcac.css +0 -1
- package/dist/spa/assets/BtnIcon.89e50d2e.css +0 -1
- package/dist/spa/assets/BtnIcon.934f8c5b.js +0 -10
- package/dist/spa/assets/BtnStd.95fc4510.js +0 -11
- package/dist/spa/assets/CheckBox.3c204a4b.css +0 -1
- package/dist/spa/assets/CheckBox.fbc0bd1a.js +0 -7
- package/dist/spa/assets/Chip.49ffc857.js +0 -11
- package/dist/spa/assets/Chip.74acaa33.css +0 -1
- package/dist/spa/assets/ComponentBase.1ae19b7e.js +0 -1
- package/dist/spa/assets/ErrorNotFound.6cccfaee.js +0 -1
- package/dist/spa/assets/IndexPage.17d09b76.js +0 -1
- package/dist/spa/assets/InputText.19c0d7d1.css +0 -1
- package/dist/spa/assets/InputText.3fcd97a4.js +0 -20
- package/dist/spa/assets/KFOkCnqEu92Fr1MmgVxIIzQ.34e9582c.woff +0 -0
- package/dist/spa/assets/KFOlCnqEu92Fr1MmEU9fBBc-.9ce7f3ac.woff +0 -0
- package/dist/spa/assets/KFOlCnqEu92Fr1MmSU5fBBc-.bf14c7d7.woff +0 -0
- package/dist/spa/assets/KFOlCnqEu92Fr1MmWUlfBBc-.e0fd57c0.woff +0 -0
- package/dist/spa/assets/KFOlCnqEu92Fr1MmYUtfBBc-.f6537e32.woff +0 -0
- package/dist/spa/assets/KFOmCnqEu92Fr1Mu4mxM.f2abf7fb.woff +0 -0
- package/dist/spa/assets/MainLayout.912bb0f8.js +0 -1
- package/dist/spa/assets/MultiSelectStd.644b108c.js +0 -17
- package/dist/spa/assets/MultiSelectStd.c7af49eb.css +0 -1
- package/dist/spa/assets/QAvatar.5940a79e.js +0 -1
- package/dist/spa/assets/QCheckbox.48b43f7d.js +0 -1
- package/dist/spa/assets/QPage.ca395ec4.js +0 -1
- package/dist/spa/assets/QRadio.0a7f5e2c.js +0 -1
- package/dist/spa/assets/QResizeObserver.30c3566c.js +0 -1
- package/dist/spa/assets/QSelect.a40eb786.js +0 -1
- package/dist/spa/assets/QTabs.72f2507e.js +0 -1
- package/dist/spa/assets/QToggle.376c48be.js +0 -1
- package/dist/spa/assets/QTooltip.5aa8e325.js +0 -1
- package/dist/spa/assets/Radio.0ac35288.js +0 -7
- package/dist/spa/assets/Radio.aca54a89.css +0 -1
- package/dist/spa/assets/SelectStd.5c6891db.css +0 -1
- package/dist/spa/assets/SelectStd.daf1def9.js +0 -16
- package/dist/spa/assets/TabButtonPage.20e871dd.js +0 -7
- package/dist/spa/assets/TabButtonPage.36ce9f9c.css +0 -1
- package/dist/spa/assets/TabsPage.9b94ff39.css +0 -1
- package/dist/spa/assets/TabsPage.b92cccee.js +0 -9
- package/dist/spa/assets/TogglePage.8129b631.css +0 -1
- package/dist/spa/assets/TogglePage.ba6e325c.js +0 -9
- package/dist/spa/assets/UAvatar.dda7e478.js +0 -1
- package/dist/spa/assets/UAvatar.ea8daa38.css +0 -1
- package/dist/spa/assets/UBadgeStd.3965db9a.css +0 -1
- package/dist/spa/assets/UBadgeStd.e165ee05.js +0 -1
- package/dist/spa/assets/UBtnStd.979ec4e8.js +0 -1
- package/dist/spa/assets/UBtnStd.bdd4f5e5.css +0 -1
- package/dist/spa/assets/UTooltip.d2e04d0c.js +0 -1
- package/dist/spa/assets/UTooltip.efa029a7.css +0 -1
- package/dist/spa/assets/dom.e9d4ad51.js +0 -1
- package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.fd84f88b.woff +0 -0
- package/dist/spa/assets/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.4a4dbc62.woff2 +0 -0
- package/dist/spa/assets/format.41663636.js +0 -1
- package/dist/spa/assets/index.43c62a18.js +0 -21
- package/dist/spa/assets/index.4fbd73cf.css +0 -5
- package/dist/spa/assets/option-sizes.10cc02d3.js +0 -1
- package/dist/spa/assets/render.e67ff27a.js +0 -1
- package/dist/spa/assets/tooltip.7c0d0774.js +0 -8
- package/dist/spa/assets/touch.9135741d.js +0 -1
- package/dist/spa/assets/use-checkbox.44a623c0.js +0 -1
- package/dist/spa/favicon.ico +0 -0
- package/dist/spa/icons/caret-down.svg +0 -5
- package/dist/spa/icons/circle-xmark.svg +0 -6
- package/dist/spa/icons/favicon-128x128.png +0 -0
- package/dist/spa/icons/favicon-16x16.png +0 -0
- package/dist/spa/icons/favicon-32x32.png +0 -0
- package/dist/spa/icons/favicon-96x96.png +0 -0
- package/dist/spa/index.html +0 -3
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UTd from './UTable/UTd.vue'
|
|
3
|
+
import UTh from './UTable/UTh.vue'
|
|
4
|
+
import UTr from './UTable/UTr.vue'
|
|
5
|
+
import UTable from './UTable/UTable.vue'
|
|
6
|
+
import { computed, ref } from 'vue'
|
|
7
|
+
import UCheckboxStd from './UCheckboxStd.vue'
|
|
8
|
+
import UChip from './UChip.vue'
|
|
9
|
+
import UAvatar from './UAvatar.vue'
|
|
10
|
+
import UBtnStd from './UBtnStd.vue'
|
|
11
|
+
import UTooltip from './UTooltip.vue'
|
|
12
|
+
import UPagination from './UPagination.vue'
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
title: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
tableRowHover: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
separator: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'horizontal',
|
|
25
|
+
},
|
|
26
|
+
multiSelection: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
flat: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
bordered: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
grid: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
virtualScroll: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
stickyHeader: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
isCustomSort: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false,
|
|
53
|
+
},
|
|
54
|
+
customClass: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
showPagination: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true,
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const selectedRows = defineModel('selectedRows', {
|
|
65
|
+
default: () => [],
|
|
66
|
+
type: Array,
|
|
67
|
+
})
|
|
68
|
+
const rows = defineModel('rows', {
|
|
69
|
+
default: () => [],
|
|
70
|
+
type: Array,
|
|
71
|
+
})
|
|
72
|
+
const columns = defineModel('columns', {
|
|
73
|
+
default: () => [],
|
|
74
|
+
type: Array,
|
|
75
|
+
})
|
|
76
|
+
const pagination = defineModel('pagination', {
|
|
77
|
+
default: { page: 1, rowsPerPage: 15 },
|
|
78
|
+
type: Object,
|
|
79
|
+
})
|
|
80
|
+
const loading = defineModel('loading', {
|
|
81
|
+
default: () => {},
|
|
82
|
+
type: Boolean,
|
|
83
|
+
})
|
|
84
|
+
const customLoading = ref(false)
|
|
85
|
+
const rowsPerPageOptions = ref([
|
|
86
|
+
{ label: '5 / per page', value: 5 },
|
|
87
|
+
{ label: '10 / per page', value: 10 },
|
|
88
|
+
{ label: '15 / per page', value: 15 },
|
|
89
|
+
{ label: '20 / per page', value: 20 },
|
|
90
|
+
{ label: '25 / per page', value: 25 },
|
|
91
|
+
])
|
|
92
|
+
|
|
93
|
+
const tableDataChip = ref(true) // this is required to show chip
|
|
94
|
+
|
|
95
|
+
//adding a new row to selectedRows
|
|
96
|
+
const handleToSelectRow = (row) => {
|
|
97
|
+
if (row) {
|
|
98
|
+
const index = selectedRows.value.findIndex((item) => item._id === row._id)
|
|
99
|
+
if (index === -1) {
|
|
100
|
+
selectedRows.value.push(row)
|
|
101
|
+
} else {
|
|
102
|
+
selectedRows.value.splice(index, 1)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// if virtual scroll is enbaled then adding large rows per page to view in virtual scroll
|
|
107
|
+
const getRowsPerPageOptions = computed(() => {
|
|
108
|
+
if (props.virtualScroll) {
|
|
109
|
+
return [
|
|
110
|
+
...rowsPerPageOptions.value,
|
|
111
|
+
{ label: '100 / per page', value: 100 },
|
|
112
|
+
{ label: '500 / per page', value: 500 },
|
|
113
|
+
{ label: '1000 / per page', value: 1000 },
|
|
114
|
+
]
|
|
115
|
+
} else {
|
|
116
|
+
return rowsPerPageOptions.value
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
//getting the sorted icon according the order
|
|
121
|
+
const getSortingIcon = (col) => {
|
|
122
|
+
if (col) {
|
|
123
|
+
if (col.sortOrder === 'asc') {
|
|
124
|
+
return 'fa-kit fa-ascending'
|
|
125
|
+
} else {
|
|
126
|
+
return 'fa-kit fa-descending'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// it is giving the selected row and setting the new selection
|
|
132
|
+
const isRowSelected = (row) => {
|
|
133
|
+
if (row) {
|
|
134
|
+
const index = selectedRows.value.findIndex((item) => item._id === row._id)
|
|
135
|
+
return computed({
|
|
136
|
+
get: () => {
|
|
137
|
+
return index === -1 ? false : true
|
|
138
|
+
},
|
|
139
|
+
set: () => {
|
|
140
|
+
if (index === -1) {
|
|
141
|
+
selectedRows.value.push(row)
|
|
142
|
+
} else {
|
|
143
|
+
selectedRows.value.splice(index, 1)
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
} else {
|
|
148
|
+
return computed({
|
|
149
|
+
get: () => {
|
|
150
|
+
let dataLength = props.rows.length
|
|
151
|
+
return selectedRows.value.length === dataLength
|
|
152
|
+
? true
|
|
153
|
+
: selectedRows.value.length === 0
|
|
154
|
+
? false
|
|
155
|
+
: null
|
|
156
|
+
},
|
|
157
|
+
set: (value) => {
|
|
158
|
+
if (value !== null) {
|
|
159
|
+
selectedRows.value.splice(0, selectedRows.value.length)
|
|
160
|
+
} else {
|
|
161
|
+
handleSelectAllData().then((res) => {
|
|
162
|
+
if (res === 200) {
|
|
163
|
+
customLoading.value = false
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// handling the large selection data in chunks
|
|
173
|
+
const handleSelectAllData = () => {
|
|
174
|
+
customLoading.value = true
|
|
175
|
+
return new Promise((resolve, reject) => {
|
|
176
|
+
let index = 0
|
|
177
|
+
function processChunk() {
|
|
178
|
+
if (index >= rows.value.length) {
|
|
179
|
+
resolve(200)
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
const chunk = props.rows.slice(index, index + 25)
|
|
183
|
+
chunk.forEach((element) => {
|
|
184
|
+
if (
|
|
185
|
+
selectedRows.value.findIndex((item) => item._id === element._id) ===
|
|
186
|
+
-1
|
|
187
|
+
) {
|
|
188
|
+
selectedRows.value.push(element)
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
index += 25
|
|
192
|
+
setTimeout(processChunk, 10)
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
processChunk()
|
|
196
|
+
} catch {
|
|
197
|
+
reject('error')
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const emit = defineEmits(['onCustomSort'])
|
|
203
|
+
|
|
204
|
+
// sorting funtion to handle text and number type of data
|
|
205
|
+
const dataSort = (data, key, order, type) => {
|
|
206
|
+
if (type === 'text') {
|
|
207
|
+
return data.sort((a, b) =>
|
|
208
|
+
order === 'asc'
|
|
209
|
+
? a[key].localeCompare(b[key])
|
|
210
|
+
: b[key].localeCompare(a[key])
|
|
211
|
+
)
|
|
212
|
+
} else {
|
|
213
|
+
return data.sort((a, b) =>
|
|
214
|
+
order === 'asc' ? a[key] - b[key] : b[key] - a[key]
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
//it is sorting the data according to type like text or number type of data
|
|
220
|
+
const handleSort = (key, sortOrder, type) => {
|
|
221
|
+
rows.value = dataSort(rows.value, key, sortOrder, type)
|
|
222
|
+
columns.value.forEach((col) => {
|
|
223
|
+
if (key === col.field) {
|
|
224
|
+
col.sortOrder = sortOrder === 'asc' ? 'desc' : 'asc'
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
//if user want to add custom sort on data
|
|
230
|
+
const handleCustomSort = (key, sortOrder, type) => {
|
|
231
|
+
emit('onCustomSort', key, sortOrder, type)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//adding a new row to selectedRows
|
|
235
|
+
const onRowClick = (event, row) => {
|
|
236
|
+
if (props.multiSelection) {
|
|
237
|
+
event.stopPropagation()
|
|
238
|
+
handleToSelectRow(row)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//getting the chip color accroding to value of chip from row
|
|
243
|
+
const getChipColor = (data, value) => {
|
|
244
|
+
const foundObject = data.find((chip) => chip.value === value)
|
|
245
|
+
if (foundObject) {
|
|
246
|
+
return foundObject['color']
|
|
247
|
+
} else {
|
|
248
|
+
return 'neutral-3'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// handle to change the page, and if virtual scroll is enabled and user scrolled to bottom it will take user to the top
|
|
253
|
+
const onPageChange = (value) => {
|
|
254
|
+
pagination.value.page = value
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
//handle to change the rows per page
|
|
258
|
+
const onRowPerPageChange = (value) => {
|
|
259
|
+
pagination.value.rowsPerPage = value
|
|
260
|
+
}
|
|
261
|
+
</script>
|
|
262
|
+
|
|
263
|
+
<template>
|
|
264
|
+
<UTable
|
|
265
|
+
:title="title"
|
|
266
|
+
v-model:rows="rows"
|
|
267
|
+
v-model:columns="columns"
|
|
268
|
+
:separator="separator"
|
|
269
|
+
:loading="loading"
|
|
270
|
+
:flat="flat"
|
|
271
|
+
:bordered="bordered"
|
|
272
|
+
v-model:pagination="pagination"
|
|
273
|
+
:grid="grid"
|
|
274
|
+
:virtualScroll="virtualScroll"
|
|
275
|
+
:stickyHeader="stickyHeader"
|
|
276
|
+
:class="customClass"
|
|
277
|
+
:showPagination="showPagination"
|
|
278
|
+
>
|
|
279
|
+
<!-- custom header slot to add customized header -->
|
|
280
|
+
<template v-slot:header="props">
|
|
281
|
+
<UTr :props="props" :tableRowHover="tableRowHover">
|
|
282
|
+
<UTh
|
|
283
|
+
v-if="multiSelection"
|
|
284
|
+
style="width: 3% !important"
|
|
285
|
+
:tableHeaderAutoWidth="false"
|
|
286
|
+
tableHeadAlignment="left"
|
|
287
|
+
:separator="separator"
|
|
288
|
+
>
|
|
289
|
+
<UCheckboxStd
|
|
290
|
+
:id="`u-checkbox-table-header`"
|
|
291
|
+
v-model="isRowSelected(null).value"
|
|
292
|
+
name="Table Header"
|
|
293
|
+
:indeterminate="true"
|
|
294
|
+
/>
|
|
295
|
+
</UTh>
|
|
296
|
+
<UTh
|
|
297
|
+
v-for="(col, key) in props.cols"
|
|
298
|
+
:class="`${col.sortable ? 'cursor-pointer' : ''} ${
|
|
299
|
+
col.headerClasses
|
|
300
|
+
}`"
|
|
301
|
+
:key="key"
|
|
302
|
+
:tableHeaderAutoWidth="col.autoWidth"
|
|
303
|
+
:tableHeadAlignment="col.field === 'action' ? col.align : col.align"
|
|
304
|
+
@click="
|
|
305
|
+
col.sortable
|
|
306
|
+
? isCustomSort
|
|
307
|
+
? handleCustomSort(col.field, col.sortOrder, col.type)
|
|
308
|
+
: handleSort(col.field, col.sortOrder, col.type)
|
|
309
|
+
: null
|
|
310
|
+
"
|
|
311
|
+
:separator="separator"
|
|
312
|
+
:style="col.headerStyle"
|
|
313
|
+
>
|
|
314
|
+
<span
|
|
315
|
+
:class="`${col.field === 'action' ? 'hidden-header-label' : ''}`"
|
|
316
|
+
>
|
|
317
|
+
{{ col.field === 'action' ? 'Action' : col.label }}
|
|
318
|
+
</span>
|
|
319
|
+
|
|
320
|
+
<span v-if="col.sortable && col.field !== 'action'">
|
|
321
|
+
<q-btn label="Sorting Button" :ripple="false" class="u-sorting-btn">
|
|
322
|
+
<q-icon
|
|
323
|
+
size="xs"
|
|
324
|
+
:class="`${getSortingIcon(col)} sorting-icon`"
|
|
325
|
+
:aria-label="col.label"
|
|
326
|
+
alt="sort-desc"
|
|
327
|
+
tabindex="0"
|
|
328
|
+
></q-icon>
|
|
329
|
+
</q-btn>
|
|
330
|
+
</span>
|
|
331
|
+
</UTh>
|
|
332
|
+
</UTr>
|
|
333
|
+
</template>
|
|
334
|
+
<!-- custom body slots to add customized cell data -->
|
|
335
|
+
<template v-slot:body="props">
|
|
336
|
+
<UTr
|
|
337
|
+
:props="props"
|
|
338
|
+
@click="onRowClick($event, props.row)"
|
|
339
|
+
:tableRowHover="tableRowHover"
|
|
340
|
+
:class="`${isRowSelected(props.row).value ? 'selected-data-row' : ''}`"
|
|
341
|
+
>
|
|
342
|
+
<UTd
|
|
343
|
+
v-if="multiSelection"
|
|
344
|
+
:index="-1"
|
|
345
|
+
tableDataAlignment="left"
|
|
346
|
+
:tableHeaderAutoWidth="false"
|
|
347
|
+
:separator="separator"
|
|
348
|
+
>
|
|
349
|
+
<UCheckboxStd
|
|
350
|
+
:id="`u-checkbox-${props.row._id}`"
|
|
351
|
+
v-model="isRowSelected(props.row).value"
|
|
352
|
+
:name="props.row._id"
|
|
353
|
+
/>
|
|
354
|
+
</UTd>
|
|
355
|
+
<template v-for="(col, index) in props.cols" :key="index">
|
|
356
|
+
<!-- to show the cell data without the action cell -->
|
|
357
|
+
<UTd
|
|
358
|
+
v-if="col.field !== 'action'"
|
|
359
|
+
:row="props.row"
|
|
360
|
+
:col="col"
|
|
361
|
+
:index="index"
|
|
362
|
+
:tableDataAlignment="col.align"
|
|
363
|
+
:tableDataAutoWidth="col.autoWidth"
|
|
364
|
+
:separator="separator"
|
|
365
|
+
:style="col.style"
|
|
366
|
+
:class="col.classes"
|
|
367
|
+
>
|
|
368
|
+
<!-- to show the chips with different variant -->
|
|
369
|
+
<template v-if="col.chipValues && col.chipValues.length > 0">
|
|
370
|
+
<UChip
|
|
371
|
+
v-model="tableDataChip"
|
|
372
|
+
:type="getChipColor(col.chipValues, props.row[col.field])"
|
|
373
|
+
avatarLabel=""
|
|
374
|
+
:chipLabel="props.row[col.field].toString()"
|
|
375
|
+
:removable="false"
|
|
376
|
+
class="u-table-chip"
|
|
377
|
+
:is-show-tooltip="col.showChipTooltip"
|
|
378
|
+
:offset="col.offset"
|
|
379
|
+
:anchor="col.anchor"
|
|
380
|
+
/>
|
|
381
|
+
</template>
|
|
382
|
+
<!-- to show the avatar of user image with name and other details -->
|
|
383
|
+
<template v-else-if="col.avatarKey">
|
|
384
|
+
<div class="flex justify-start items-center">
|
|
385
|
+
<div
|
|
386
|
+
v-if="
|
|
387
|
+
props.row[col.avatarKey] &&
|
|
388
|
+
typeof props.row[col.avatarKey] === 'object'
|
|
389
|
+
"
|
|
390
|
+
class="table-data-avatar"
|
|
391
|
+
>
|
|
392
|
+
<UAvatar
|
|
393
|
+
v-if="props.row[col.avatarKey]?.type === 'initials'"
|
|
394
|
+
size="md"
|
|
395
|
+
:name="`${props.row[col.avatarKey]?.value}`"
|
|
396
|
+
/>
|
|
397
|
+
<UAvatar
|
|
398
|
+
v-else-if="props.row[col.avatarKey]?.type === 'image'"
|
|
399
|
+
size="md"
|
|
400
|
+
:name="
|
|
401
|
+
props.row[col.avatarKey]?.name ??
|
|
402
|
+
props.row[col.avatarKey]?.value
|
|
403
|
+
"
|
|
404
|
+
:image="`${props.row[col.avatarKey]?.value}`"
|
|
405
|
+
/>
|
|
406
|
+
</div>
|
|
407
|
+
<div v-else class="table-data-avatar">
|
|
408
|
+
<UAvatar
|
|
409
|
+
size="md"
|
|
410
|
+
:name="`${props.row[col.avatarKey]}`"
|
|
411
|
+
:image="`${props.row[col.avatarKey]}`"
|
|
412
|
+
/>
|
|
413
|
+
</div>
|
|
414
|
+
<div class="td-grid-content">
|
|
415
|
+
<div>{{ props.row[col.field] }}</div>
|
|
416
|
+
<div class="td-caption text-body-xs" v-if="col.captionKey">
|
|
417
|
+
{{ props.row[col.captionKey] }}
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
</div>
|
|
421
|
+
</template>
|
|
422
|
+
<!-- to show other cell data -->
|
|
423
|
+
<template v-else>
|
|
424
|
+
<div class="td-grid-content">
|
|
425
|
+
<div>{{ props.row[col.field] }}</div>
|
|
426
|
+
<div class="td-caption text-body-xs" v-if="col.captionKey">
|
|
427
|
+
{{ props.row[col.captionKey] }}
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
</template>
|
|
431
|
+
</UTd>
|
|
432
|
+
<!-- to the action cell, it can have single and multiple -->
|
|
433
|
+
<UTd
|
|
434
|
+
v-else
|
|
435
|
+
:index="index"
|
|
436
|
+
:tableDataAlignment="col.align"
|
|
437
|
+
:tableDataAutoWidth="false"
|
|
438
|
+
style="width: 3%"
|
|
439
|
+
:separator="separator"
|
|
440
|
+
:style="col.style"
|
|
441
|
+
:class="col.classes"
|
|
442
|
+
>
|
|
443
|
+
<template v-if="col.actions && col.actions.length === 1">
|
|
444
|
+
<UBtnStd
|
|
445
|
+
v-for="(action, key) in col.actions"
|
|
446
|
+
:key="key"
|
|
447
|
+
:size="action.size"
|
|
448
|
+
:flat="action.flat"
|
|
449
|
+
:label="action.label"
|
|
450
|
+
:color="action.color"
|
|
451
|
+
:leftIcon="action.icon"
|
|
452
|
+
@onClick="action.handler(props.row)"
|
|
453
|
+
/>
|
|
454
|
+
</template>
|
|
455
|
+
<!-- to show the actions list if the actions are multiple -->
|
|
456
|
+
<template v-else>
|
|
457
|
+
<q-icon
|
|
458
|
+
size="xs"
|
|
459
|
+
class="fa-kit fa-ellipsis-vertical action-icon cursor-pointer"
|
|
460
|
+
aria-label="more-action-icon"
|
|
461
|
+
alt="action-icon-more"
|
|
462
|
+
tabindex="0"
|
|
463
|
+
>
|
|
464
|
+
<UTooltip description="More Actions" />
|
|
465
|
+
<q-menu
|
|
466
|
+
transition-show="slide-left"
|
|
467
|
+
transition-hide="slide-right"
|
|
468
|
+
anchor="center start"
|
|
469
|
+
self="center left"
|
|
470
|
+
>
|
|
471
|
+
<div
|
|
472
|
+
class="flex justify-end items-center more-action-wrapper"
|
|
473
|
+
>
|
|
474
|
+
<template v-for="(action, key) in col.actions" :key="key">
|
|
475
|
+
<UTooltip
|
|
476
|
+
:target="`#more-action-${key}`"
|
|
477
|
+
:description="action.tooltip"
|
|
478
|
+
/>
|
|
479
|
+
<q-icon
|
|
480
|
+
:size="action.size"
|
|
481
|
+
:id="`more-action-${key}`"
|
|
482
|
+
:class="`more-action-icon ${
|
|
483
|
+
action.icon
|
|
484
|
+
} cursor-pointer ${key > 0 ? 'q-ml-sm' : ''}`"
|
|
485
|
+
:aria-label="action.label"
|
|
486
|
+
:alt="`${action.label}-key`"
|
|
487
|
+
@click="action.handler(props.row)"
|
|
488
|
+
tabindex="0"
|
|
489
|
+
/>
|
|
490
|
+
</template>
|
|
491
|
+
</div>
|
|
492
|
+
</q-menu>
|
|
493
|
+
</q-icon>
|
|
494
|
+
</template>
|
|
495
|
+
</UTd>
|
|
496
|
+
</template>
|
|
497
|
+
</UTr>
|
|
498
|
+
</template>
|
|
499
|
+
<!-- slot to show if there is no data in rows -->
|
|
500
|
+
<template v-slot:no-data>
|
|
501
|
+
<div class="full-width row flex-center text-accent q-gutter-sm">
|
|
502
|
+
<span> No Data Found </span>
|
|
503
|
+
</div>
|
|
504
|
+
</template>
|
|
505
|
+
<!-- to add the custom loading state -->
|
|
506
|
+
<!-- <template v-slot:loading>
|
|
507
|
+
<q-inner-loading v-if="customLoading" showing color="primary" />
|
|
508
|
+
</template> -->
|
|
509
|
+
</UTable>
|
|
510
|
+
<!-- customized pagination with the vitual scroll functionality and rows per page selection -->
|
|
511
|
+
<div
|
|
512
|
+
v-if="showPagination"
|
|
513
|
+
class="row justify-end items-center pagination-wrapper"
|
|
514
|
+
>
|
|
515
|
+
<UPagination
|
|
516
|
+
v-if="rows.length >= 6"
|
|
517
|
+
v-model="pagination.page"
|
|
518
|
+
:rowPerPage="pagination.rowsPerPage"
|
|
519
|
+
:perPageOptions="getRowsPerPageOptions"
|
|
520
|
+
@onPageChange="onPageChange"
|
|
521
|
+
@onRowChange="onRowPerPageChange"
|
|
522
|
+
:maxPageLink="
|
|
523
|
+
Number(Math.ceil(rows.length / pagination.rowsPerPage > 10 ? 6 : 3))
|
|
524
|
+
"
|
|
525
|
+
:maxPages="Number(Math.ceil(rows.length / pagination.rowsPerPage))"
|
|
526
|
+
/>
|
|
527
|
+
</div>
|
|
528
|
+
<q-inner-loading :showing="customLoading" class="custom-table-loader" />
|
|
529
|
+
</template>
|
|
530
|
+
|
|
531
|
+
<style lang="sass">
|
|
532
|
+
.action-icon
|
|
533
|
+
height: $md
|
|
534
|
+
width: $md
|
|
535
|
+
color: $neutral-9
|
|
536
|
+
|
|
537
|
+
.table-data-avatar
|
|
538
|
+
padding: $xs
|
|
539
|
+
padding-left: 0px
|
|
540
|
+
|
|
541
|
+
.td-caption
|
|
542
|
+
color: $description
|
|
543
|
+
|
|
544
|
+
.more-action-wrapper
|
|
545
|
+
min-width: 3.125rem
|
|
546
|
+
padding: $xs
|
|
547
|
+
min-height: $xl
|
|
548
|
+
gap: $xs
|
|
549
|
+
border-bottom: 1.5px solid $neutral-4
|
|
550
|
+
background: $surface-bg-1
|
|
551
|
+
box-shadow: 0px 0px 4px 0px rgba(16, 17, 20, 0.08)
|
|
552
|
+
|
|
553
|
+
.more-action-icon
|
|
554
|
+
color: $neutral-9
|
|
555
|
+
|
|
556
|
+
.sorting-icon
|
|
557
|
+
color: $description
|
|
558
|
+
padding-left: $xs
|
|
559
|
+
font-size: $ba !important
|
|
560
|
+
|
|
561
|
+
.selected-data-row
|
|
562
|
+
background: #F7F7F7
|
|
563
|
+
|
|
564
|
+
.rows-per-page-dropdown
|
|
565
|
+
margin-right: 0.5rem
|
|
566
|
+
|
|
567
|
+
.u-table
|
|
568
|
+
height: auto
|
|
569
|
+
|
|
570
|
+
.q-table__progress
|
|
571
|
+
.q-linear-progress
|
|
572
|
+
color: $primary !important
|
|
573
|
+
height: 0.145rem
|
|
574
|
+
|
|
575
|
+
.force-auto-height-table
|
|
576
|
+
height: auto !important
|
|
577
|
+
|
|
578
|
+
.u-virtualscroll-table
|
|
579
|
+
height: 50rem
|
|
580
|
+
|
|
581
|
+
.u-virtualscroll-grid-table
|
|
582
|
+
max-height: 50rem
|
|
583
|
+
overflow: auto
|
|
584
|
+
|
|
585
|
+
.u-sticky-table-header
|
|
586
|
+
.q-table__top,
|
|
587
|
+
.q-table__bottom,
|
|
588
|
+
thead tr:first-child th
|
|
589
|
+
background-color: #FFFFFF
|
|
590
|
+
|
|
591
|
+
thead tr th
|
|
592
|
+
position: sticky
|
|
593
|
+
z-index: 1
|
|
594
|
+
|
|
595
|
+
thead tr:first-child th
|
|
596
|
+
top: 0
|
|
597
|
+
|
|
598
|
+
&.q-table--loading thead tr:last-child th
|
|
599
|
+
top: 48px
|
|
600
|
+
|
|
601
|
+
tbody
|
|
602
|
+
scroll-margin-top: 48px
|
|
603
|
+
|
|
604
|
+
.u-sorting-btn
|
|
605
|
+
padding: 0
|
|
606
|
+
min-height: auto
|
|
607
|
+
.block
|
|
608
|
+
display: none !important
|
|
609
|
+
|
|
610
|
+
.q-focus-helper
|
|
611
|
+
background: none !important
|
|
612
|
+
|
|
613
|
+
.u-sorting-btn:before
|
|
614
|
+
box-shadow: none !important
|
|
615
|
+
|
|
616
|
+
.u-table-chip
|
|
617
|
+
.q-icon
|
|
618
|
+
display: none
|
|
619
|
+
|
|
620
|
+
.no-border-bottom-cell
|
|
621
|
+
border-bottom: none !important
|
|
622
|
+
|
|
623
|
+
.pagination-wrapper
|
|
624
|
+
margin-top: $ba
|
|
625
|
+
|
|
626
|
+
.custom-table-loader
|
|
627
|
+
.q-spinner
|
|
628
|
+
color: $primary
|
|
629
|
+
|
|
630
|
+
.td-grid-content
|
|
631
|
+
text-wrap: balance
|
|
632
|
+
word-break: break-all
|
|
633
|
+
|
|
634
|
+
.hidden-header-label
|
|
635
|
+
visibility: hidden
|
|
636
|
+
</style>
|