@usssa/component-library 1.0.0-alpha.12 → 1.0.0-alpha.14
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 +1 -1
- package/package.json +1 -1
- package/src/components/core/UBtnIcon.vue +5 -1
- package/src/components/core/UBtnStd.vue +23 -19
- package/src/components/core/UCheckboxStd.vue +2 -0
- package/src/components/core/UInputTextStd.vue +9 -8
- package/src/components/core/UPagination.vue +2 -2
- package/src/components/core/USelectStd.vue +1 -1
- package/src/components/core/UTable/UTable.vue +10 -6
- package/src/components/core/UTable/UTd.vue +5 -1
- package/src/components/core/UTable/UTh.vue +5 -1
- package/src/components/core/UTable/UTr.vue +5 -1
- package/src/components/core/UTableStd.vue +78 -24
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -40,6 +40,10 @@ const props = defineProps({
|
|
|
40
40
|
type: String,
|
|
41
41
|
default: 'center end',
|
|
42
42
|
},
|
|
43
|
+
offset: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => [4, 4],
|
|
46
|
+
},
|
|
43
47
|
})
|
|
44
48
|
|
|
45
49
|
const emit = defineEmits(['onClick'])
|
|
@@ -97,7 +101,7 @@ const btnClass = computed(() => {
|
|
|
97
101
|
:description="tooltip"
|
|
98
102
|
:anchor="anchor"
|
|
99
103
|
:self="self"
|
|
100
|
-
:offset="
|
|
104
|
+
:offset="offset"
|
|
101
105
|
/>
|
|
102
106
|
</q-btn>
|
|
103
107
|
</template>
|
|
@@ -72,26 +72,30 @@ const isFullWidth = computed(() => {
|
|
|
72
72
|
:flat="flat"
|
|
73
73
|
@click="handleClick"
|
|
74
74
|
>
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
<template #default>
|
|
76
|
+
<slot name="default">
|
|
77
|
+
<div class="row items-center no-wrap">
|
|
78
|
+
<q-icon
|
|
79
|
+
v-if="leftIcon"
|
|
80
|
+
left
|
|
81
|
+
:class="leftIcon"
|
|
82
|
+
class="q-mr-xs"
|
|
83
|
+
size="1.25rem"
|
|
84
|
+
/>
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
<div class="text-center text-caption-md button-label">
|
|
87
|
+
{{ label }}
|
|
88
|
+
</div>
|
|
89
|
+
<q-icon
|
|
90
|
+
v-if="rightIcon"
|
|
91
|
+
right
|
|
92
|
+
:class="rightIcon"
|
|
93
|
+
class="q-ml-xs"
|
|
94
|
+
size="1.25rem"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
</slot>
|
|
98
|
+
</template>
|
|
95
99
|
</q-btn>
|
|
96
100
|
</template>
|
|
97
101
|
|
|
@@ -7,7 +7,6 @@ const props = defineProps({
|
|
|
7
7
|
},
|
|
8
8
|
hintIcon: {
|
|
9
9
|
type: String,
|
|
10
|
-
default: 'fa-kit-duotone fa-circle-info',
|
|
11
10
|
},
|
|
12
11
|
isRequired: {
|
|
13
12
|
type: Boolean,
|
|
@@ -32,7 +31,6 @@ const props = defineProps({
|
|
|
32
31
|
},
|
|
33
32
|
placeholder: {
|
|
34
33
|
type: String,
|
|
35
|
-
default: 'Input Text',
|
|
36
34
|
},
|
|
37
35
|
size: {
|
|
38
36
|
type: String,
|
|
@@ -147,13 +145,16 @@ const handleRightIconClick = () => {
|
|
|
147
145
|
<div class="q-ml-xxs text-body-xs">{{ hintText }}</div>
|
|
148
146
|
</div>
|
|
149
147
|
</template>
|
|
150
|
-
<template #append
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
<template #append>
|
|
149
|
+
<slot name="append">
|
|
150
|
+
<q-icon
|
|
151
|
+
v-if="rightIcon"
|
|
152
|
+
@click="handleRightIconClick"
|
|
153
|
+
:class="`slot-icon-size-${size} ${rightIcon}`"
|
|
154
|
+
:tabindex="0"
|
|
155
|
+
/>
|
|
156
|
+
</slot>
|
|
155
157
|
</template>
|
|
156
|
-
|
|
157
158
|
<template v-slot:error>
|
|
158
159
|
<div class="row items-center no-wrap" v-if="errorMessage">
|
|
159
160
|
<q-icon
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const props = defineProps({
|
|
3
3
|
title: {
|
|
4
4
|
type: String,
|
|
5
|
-
default: '
|
|
5
|
+
default: '',
|
|
6
6
|
},
|
|
7
7
|
rowKey: {
|
|
8
8
|
type: String,
|
|
@@ -12,10 +12,6 @@ const props = defineProps({
|
|
|
12
12
|
type: String,
|
|
13
13
|
default: 'horizontal',
|
|
14
14
|
},
|
|
15
|
-
loading: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
default: false,
|
|
18
|
-
},
|
|
19
15
|
flat: {
|
|
20
16
|
type: Boolean,
|
|
21
17
|
default: false,
|
|
@@ -42,6 +38,10 @@ const pagination = defineModel('pagination', {
|
|
|
42
38
|
default: null,
|
|
43
39
|
type: Object,
|
|
44
40
|
})
|
|
41
|
+
const loading = defineModel('loading', {
|
|
42
|
+
default: null,
|
|
43
|
+
type: Boolean,
|
|
44
|
+
})
|
|
45
45
|
const rows = defineModel('rows', {
|
|
46
46
|
default: () => [],
|
|
47
47
|
type: Array,
|
|
@@ -76,7 +76,11 @@ const columns = defineModel('columns', {
|
|
|
76
76
|
:virtual-scroll-item-size="48"
|
|
77
77
|
:virtual-scroll-sticky-size-start="48"
|
|
78
78
|
>
|
|
79
|
-
<template
|
|
79
|
+
<template
|
|
80
|
+
v-for="(_, slotName, index) in $slots"
|
|
81
|
+
v-slot:[slotName]="scope"
|
|
82
|
+
:key="index"
|
|
83
|
+
>
|
|
80
84
|
<slot :name="slotName" v-bind="{ ...scope }" />
|
|
81
85
|
</template>
|
|
82
86
|
</q-table>
|
|
@@ -34,7 +34,11 @@ const props = defineProps({
|
|
|
34
34
|
v-bind="$attrs"
|
|
35
35
|
:auto-width="tableDataAutoWidth"
|
|
36
36
|
>
|
|
37
|
-
<template
|
|
37
|
+
<template
|
|
38
|
+
v-for="(_, slotName, index) in $slots"
|
|
39
|
+
v-slot:[slotName]="scope"
|
|
40
|
+
:key="index"
|
|
41
|
+
>
|
|
38
42
|
<slot :name="slotName" v-bind="{ ...scope }" />
|
|
39
43
|
</template>
|
|
40
44
|
</q-td>
|
|
@@ -23,7 +23,11 @@ const props = defineProps({
|
|
|
23
23
|
v-bind="$attrs"
|
|
24
24
|
:auto-width="tableHeaderAutoWidth"
|
|
25
25
|
>
|
|
26
|
-
<template
|
|
26
|
+
<template
|
|
27
|
+
v-for="(_, slotName, index) in $slots"
|
|
28
|
+
v-slot:[slotName]="scope"
|
|
29
|
+
:key="index"
|
|
30
|
+
>
|
|
27
31
|
<slot :name="slotName" v-bind="{ ...scope }" />
|
|
28
32
|
</template>
|
|
29
33
|
</q-th>
|
|
@@ -9,7 +9,11 @@ const props = defineProps({
|
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
11
|
<q-tr v-bind="$attrs" :no-hover="tableRowHover" :props="props">
|
|
12
|
-
<template
|
|
12
|
+
<template
|
|
13
|
+
v-for="(_, slotName, index) in $slots"
|
|
14
|
+
v-slot:[slotName]="scope"
|
|
15
|
+
:key="index"
|
|
16
|
+
>
|
|
13
17
|
<slot :name="slotName" v-bind="{ ...scope }" />
|
|
14
18
|
</template>
|
|
15
19
|
</q-tr>
|
|
@@ -13,11 +13,7 @@ import UPagination from './UPagination.vue'
|
|
|
13
13
|
const props = defineProps({
|
|
14
14
|
title: {
|
|
15
15
|
type: String,
|
|
16
|
-
default: '
|
|
17
|
-
},
|
|
18
|
-
loading: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false,
|
|
16
|
+
default: '',
|
|
21
17
|
},
|
|
22
18
|
tableRowHover: {
|
|
23
19
|
type: Boolean,
|
|
@@ -81,6 +77,11 @@ const pagination = defineModel('pagination', {
|
|
|
81
77
|
default: () => {},
|
|
82
78
|
type: Object,
|
|
83
79
|
})
|
|
80
|
+
const loading = defineModel('loading', {
|
|
81
|
+
default: () => {},
|
|
82
|
+
type: Boolean,
|
|
83
|
+
})
|
|
84
|
+
const customLoading = ref(false)
|
|
84
85
|
const rowsPerPageOptions = ref([
|
|
85
86
|
{ label: '5 / per page', value: 5 },
|
|
86
87
|
{ label: '10 / per page', value: 10 },
|
|
@@ -146,7 +147,10 @@ const isRowSelected = (row) => {
|
|
|
146
147
|
} else {
|
|
147
148
|
return computed({
|
|
148
149
|
get: () => {
|
|
149
|
-
|
|
150
|
+
let dataLength = props.virtualScroll
|
|
151
|
+
? pagination.value.rowsPerPage
|
|
152
|
+
: props.rows.length
|
|
153
|
+
return selectedRows.value.length === dataLength
|
|
150
154
|
? true
|
|
151
155
|
: selectedRows.value.length === 0
|
|
152
156
|
? false
|
|
@@ -156,21 +160,59 @@ const isRowSelected = (row) => {
|
|
|
156
160
|
if (value !== null) {
|
|
157
161
|
selectedRows.value.splice(0, selectedRows.value.length)
|
|
158
162
|
} else {
|
|
159
|
-
props.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
if (props.virtualScroll) {
|
|
164
|
+
handleSelectAllData().then((res) => {
|
|
165
|
+
if (res === 200) {
|
|
166
|
+
customLoading.value = false
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
} else {
|
|
170
|
+
props.rows.forEach((element) => {
|
|
171
|
+
if (
|
|
172
|
+
selectedRows.value.findIndex(
|
|
173
|
+
(item) => item._id === element._id
|
|
174
|
+
) === -1
|
|
175
|
+
) {
|
|
176
|
+
selectedRows.value.push(element)
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
}
|
|
168
180
|
}
|
|
169
181
|
},
|
|
170
182
|
})
|
|
171
183
|
}
|
|
172
184
|
}
|
|
173
185
|
|
|
186
|
+
// handling the large selection data in chunks
|
|
187
|
+
const handleSelectAllData = () => {
|
|
188
|
+
customLoading.value = true
|
|
189
|
+
return new Promise((resolve, reject) => {
|
|
190
|
+
let index = 0
|
|
191
|
+
function processChunk() {
|
|
192
|
+
if (index >= pagination.value.rowsPerPage) {
|
|
193
|
+
resolve(200)
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
const chunk = props.rows.slice(index, index + 25)
|
|
197
|
+
chunk.forEach((element) => {
|
|
198
|
+
if (
|
|
199
|
+
selectedRows.value.findIndex((item) => item._id === element._id) ===
|
|
200
|
+
-1
|
|
201
|
+
) {
|
|
202
|
+
selectedRows.value.push(element)
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
index += 25
|
|
206
|
+
setTimeout(processChunk, 10)
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
processChunk()
|
|
210
|
+
} catch {
|
|
211
|
+
reject('error')
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
174
216
|
const emit = defineEmits(['onCustomSort'])
|
|
175
217
|
|
|
176
218
|
// sorting funtion to handle text and number type of data
|
|
@@ -253,16 +295,18 @@ const onRowPerPageChange = (value) => {
|
|
|
253
295
|
:separator="separator"
|
|
254
296
|
>
|
|
255
297
|
<UCheckboxStd
|
|
256
|
-
:id="`u-checkbox
|
|
298
|
+
:id="`u-checkbox-table-header`"
|
|
257
299
|
v-model="isRowSelected(null).value"
|
|
258
300
|
name="Table Header"
|
|
259
301
|
:indeterminate="true"
|
|
260
302
|
/>
|
|
261
303
|
</UTh>
|
|
262
304
|
<UTh
|
|
263
|
-
v-for="col in props.cols"
|
|
264
|
-
:class="`${col.sortable ? 'cursor-pointer' : ''}
|
|
265
|
-
|
|
305
|
+
v-for="(col, key) in props.cols"
|
|
306
|
+
:class="`${col.sortable ? 'cursor-pointer' : ''} ${
|
|
307
|
+
col.headerClasses
|
|
308
|
+
}`"
|
|
309
|
+
:key="key"
|
|
266
310
|
:tableHeaderAutoWidth="col.autoWidth"
|
|
267
311
|
:tableHeadAlignment="col.field === 'action' ? col.align : col.align"
|
|
268
312
|
@click="
|
|
@@ -273,6 +317,7 @@ const onRowPerPageChange = (value) => {
|
|
|
273
317
|
: null
|
|
274
318
|
"
|
|
275
319
|
:separator="separator"
|
|
320
|
+
:style="col.headerStyle"
|
|
276
321
|
>
|
|
277
322
|
{{ col.label }}
|
|
278
323
|
<span v-if="col.sortable && col.field !== 'action'">
|
|
@@ -280,7 +325,7 @@ const onRowPerPageChange = (value) => {
|
|
|
280
325
|
<q-icon
|
|
281
326
|
size="xs"
|
|
282
327
|
:class="`${getSortingIcon(col)} sorting-icon`"
|
|
283
|
-
aria-label="
|
|
328
|
+
:aria-label="col.label"
|
|
284
329
|
alt="sort-desc"
|
|
285
330
|
tabindex="0"
|
|
286
331
|
></q-icon>
|
|
@@ -310,7 +355,7 @@ const onRowPerPageChange = (value) => {
|
|
|
310
355
|
:name="props.row._id"
|
|
311
356
|
/>
|
|
312
357
|
</UTd>
|
|
313
|
-
<template v-for="(col, index) in props.cols" :key="
|
|
358
|
+
<template v-for="(col, index) in props.cols" :key="index">
|
|
314
359
|
<!-- to show the cell data without the action cell -->
|
|
315
360
|
<UTd
|
|
316
361
|
v-if="col.field !== 'action'"
|
|
@@ -320,6 +365,8 @@ const onRowPerPageChange = (value) => {
|
|
|
320
365
|
:tableDataAlignment="col.align"
|
|
321
366
|
:tableDataAutoWidth="col.autoWidth"
|
|
322
367
|
:separator="separator"
|
|
368
|
+
:style="col.style"
|
|
369
|
+
:class="col.classes"
|
|
323
370
|
>
|
|
324
371
|
<!-- to show the chips with different variant -->
|
|
325
372
|
<template v-if="col.chipValues && col.chipValues.length > 0">
|
|
@@ -382,11 +429,13 @@ const onRowPerPageChange = (value) => {
|
|
|
382
429
|
:tableDataAutoWidth="false"
|
|
383
430
|
style="width: 3%"
|
|
384
431
|
:separator="separator"
|
|
432
|
+
:style="col.style"
|
|
433
|
+
:class="col.classes"
|
|
385
434
|
>
|
|
386
435
|
<template v-if="col.actions && col.actions.length === 1">
|
|
387
436
|
<UBtnStd
|
|
388
|
-
v-for="(action,
|
|
389
|
-
:key="
|
|
437
|
+
v-for="(action, key) in col.actions"
|
|
438
|
+
:key="key"
|
|
390
439
|
:size="action.size"
|
|
391
440
|
:flat="action.flat"
|
|
392
441
|
:label="action.label"
|
|
@@ -447,7 +496,7 @@ const onRowPerPageChange = (value) => {
|
|
|
447
496
|
</template>
|
|
448
497
|
<!-- to add the custom loading state -->
|
|
449
498
|
<!-- <template v-slot:loading>
|
|
450
|
-
<q-inner-loading showing color="primary" />
|
|
499
|
+
<q-inner-loading v-if="customLoading" showing color="primary" />
|
|
451
500
|
</template> -->
|
|
452
501
|
</UTable>
|
|
453
502
|
<!-- customized pagination with the vitual scroll functionality and rows per page selection -->
|
|
@@ -463,6 +512,7 @@ const onRowPerPageChange = (value) => {
|
|
|
463
512
|
:maxPages="Number(Math.ceil(rows.length / pagination.rowsPerPage))"
|
|
464
513
|
/>
|
|
465
514
|
</div>
|
|
515
|
+
<q-inner-loading :showing="customLoading" class="custom-table-loader" />
|
|
466
516
|
</template>
|
|
467
517
|
|
|
468
518
|
<style lang="sass">
|
|
@@ -562,4 +612,8 @@ const onRowPerPageChange = (value) => {
|
|
|
562
612
|
|
|
563
613
|
.pagination-wrapper
|
|
564
614
|
margin-top: $ba
|
|
615
|
+
|
|
616
|
+
.custom-table-loader
|
|
617
|
+
.q-spinner
|
|
618
|
+
color: $primary
|
|
565
619
|
</style>
|