@usssa/component-library 1.0.0-alpha.97 → 1.0.0-alpha.98
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
|
@@ -8,17 +8,17 @@ const props = defineProps({
|
|
|
8
8
|
iconClass: {
|
|
9
9
|
type: String,
|
|
10
10
|
},
|
|
11
|
-
size: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: 'md',
|
|
14
|
-
validator: (val) => ['sm', 'md', 'lg'].includes(val),
|
|
15
|
-
},
|
|
16
11
|
menuClass: {
|
|
17
12
|
type: String,
|
|
18
13
|
},
|
|
19
14
|
selected: {
|
|
20
15
|
type: Boolean,
|
|
21
16
|
},
|
|
17
|
+
size: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'md',
|
|
20
|
+
validator: (val) => ['sm', 'md', 'lg'].includes(val),
|
|
21
|
+
},
|
|
22
22
|
})
|
|
23
23
|
</script>
|
|
24
24
|
|
|
@@ -30,6 +30,7 @@ const props = defineProps({
|
|
|
30
30
|
:destructive="item.destructive"
|
|
31
31
|
:disable="item.disable"
|
|
32
32
|
:hide="item.hide"
|
|
33
|
+
:index="index"
|
|
33
34
|
:label="item.label"
|
|
34
35
|
:leftIcon="item.leftIcon"
|
|
35
36
|
:rightIcon="item.rightIcon"
|
|
@@ -3,47 +3,46 @@ import { computed, ref, watch } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
const emit = defineEmits(['onClick'])
|
|
5
5
|
const props = defineProps({
|
|
6
|
-
|
|
7
|
-
type: String,
|
|
8
|
-
},
|
|
9
|
-
rightIcon: {
|
|
10
|
-
type: String,
|
|
11
|
-
},
|
|
12
|
-
label: {
|
|
13
|
-
type: String,
|
|
14
|
-
},
|
|
15
|
-
selected: {
|
|
6
|
+
destructive: {
|
|
16
7
|
type: Boolean,
|
|
17
8
|
default: false,
|
|
18
9
|
},
|
|
19
|
-
|
|
10
|
+
disable: {
|
|
11
|
+
default: false,
|
|
20
12
|
type: Boolean,
|
|
13
|
+
},
|
|
14
|
+
hide: {
|
|
21
15
|
default: false,
|
|
16
|
+
type: Boolean,
|
|
22
17
|
},
|
|
23
18
|
iconClass: {
|
|
24
19
|
type: String,
|
|
25
20
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
type: Boolean,
|
|
21
|
+
label: {
|
|
22
|
+
type: String,
|
|
29
23
|
},
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
leftIcon: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
rightIcon: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
selected: {
|
|
32
31
|
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
const type = ref(props.destructive ? 'destructive' : 'default')
|
|
37
37
|
|
|
38
38
|
/* Computed variables */
|
|
39
|
-
const
|
|
40
|
-
if (props.destructive) {
|
|
41
|
-
return '
|
|
42
|
-
} else if (props.selected) {
|
|
43
|
-
return 'text-primary'
|
|
39
|
+
const backgroundColor = computed(() => {
|
|
40
|
+
if (props.selected && !props.destructive) {
|
|
41
|
+
return 'bg-blue-1'
|
|
44
42
|
}
|
|
45
|
-
return '
|
|
43
|
+
return 'bg-neutral-1'
|
|
46
44
|
})
|
|
45
|
+
|
|
47
46
|
const iconColor = computed(() => {
|
|
48
47
|
if (props.destructive) {
|
|
49
48
|
return 'accent'
|
|
@@ -52,11 +51,14 @@ const iconColor = computed(() => {
|
|
|
52
51
|
}
|
|
53
52
|
return 'dark'
|
|
54
53
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
|
|
55
|
+
const labelColor = computed(() => {
|
|
56
|
+
if (props.destructive) {
|
|
57
|
+
return 'text-accent'
|
|
58
|
+
} else if (props.selected) {
|
|
59
|
+
return 'text-primary'
|
|
58
60
|
}
|
|
59
|
-
return '
|
|
61
|
+
return 'text-dark'
|
|
60
62
|
})
|
|
61
63
|
|
|
62
64
|
const handleClick = () => {
|
|
@@ -11,24 +11,13 @@ import UTable from './UTable/UTable.vue'
|
|
|
11
11
|
import UTd from './UTable/UTd.vue'
|
|
12
12
|
import UTh from './UTable/UTh.vue'
|
|
13
13
|
import UTr from './UTable/UTr.vue'
|
|
14
|
+
import UTooltip from './UTooltip.vue'
|
|
14
15
|
|
|
15
16
|
const emit = defineEmits(['onCustomSort'])
|
|
16
|
-
const selectedRows = defineModel('selectedRows', {
|
|
17
|
-
default: () => [],
|
|
18
|
-
type: Array,
|
|
19
|
-
})
|
|
20
|
-
const rows = defineModel('rows', {
|
|
21
|
-
default: () => [],
|
|
22
|
-
type: Array,
|
|
23
|
-
})
|
|
24
17
|
const columns = defineModel('columns', {
|
|
25
18
|
default: () => [],
|
|
26
19
|
type: Array,
|
|
27
20
|
})
|
|
28
|
-
const pagination = defineModel('pagination', {
|
|
29
|
-
default: { page: 1, rowsPerPage: 15 },
|
|
30
|
-
type: Object,
|
|
31
|
-
})
|
|
32
21
|
const loading = defineModel('loading', {
|
|
33
22
|
default: () => {},
|
|
34
23
|
type: Boolean,
|
|
@@ -37,58 +26,71 @@ const moreActionDialogData = defineModel('moreActionDialogData', {
|
|
|
37
26
|
type: Object,
|
|
38
27
|
default: null,
|
|
39
28
|
})
|
|
29
|
+
const pagination = defineModel('pagination', {
|
|
30
|
+
default: { page: 1, rowsPerPage: 15 },
|
|
31
|
+
type: Object,
|
|
32
|
+
})
|
|
33
|
+
const rows = defineModel('rows', {
|
|
34
|
+
default: () => [],
|
|
35
|
+
type: Array,
|
|
36
|
+
})
|
|
37
|
+
const selectedRows = defineModel('selectedRows', {
|
|
38
|
+
default: () => [],
|
|
39
|
+
type: Array,
|
|
40
|
+
})
|
|
41
|
+
|
|
40
42
|
const props = defineProps({
|
|
41
|
-
|
|
42
|
-
type: String,
|
|
43
|
-
default: '',
|
|
44
|
-
},
|
|
45
|
-
tableRowHover: {
|
|
43
|
+
bordered: {
|
|
46
44
|
type: Boolean,
|
|
47
45
|
default: false,
|
|
48
46
|
},
|
|
49
|
-
|
|
47
|
+
customClass: {
|
|
50
48
|
type: String,
|
|
51
|
-
default: '
|
|
52
|
-
},
|
|
53
|
-
multiSelection: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: false,
|
|
49
|
+
default: '',
|
|
56
50
|
},
|
|
57
51
|
flat: {
|
|
58
52
|
type: Boolean,
|
|
59
53
|
default: false,
|
|
60
54
|
},
|
|
61
|
-
|
|
55
|
+
grid: {
|
|
62
56
|
type: Boolean,
|
|
63
57
|
default: false,
|
|
64
58
|
},
|
|
65
|
-
|
|
59
|
+
isCustomSort: {
|
|
66
60
|
type: Boolean,
|
|
67
61
|
default: false,
|
|
68
62
|
},
|
|
69
|
-
|
|
63
|
+
multiSelection: {
|
|
70
64
|
type: Boolean,
|
|
71
65
|
default: false,
|
|
72
66
|
},
|
|
73
|
-
|
|
67
|
+
separator: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'horizontal',
|
|
70
|
+
},
|
|
71
|
+
showPagination: {
|
|
74
72
|
type: Boolean,
|
|
75
|
-
default:
|
|
73
|
+
default: true,
|
|
76
74
|
},
|
|
77
75
|
stickyHeader: {
|
|
78
76
|
type: Boolean,
|
|
79
77
|
default: false,
|
|
80
78
|
},
|
|
81
|
-
|
|
79
|
+
tableRowHover: {
|
|
82
80
|
type: Boolean,
|
|
83
81
|
default: false,
|
|
84
82
|
},
|
|
85
|
-
|
|
83
|
+
title: {
|
|
86
84
|
type: String,
|
|
87
85
|
default: '',
|
|
88
86
|
},
|
|
89
|
-
|
|
87
|
+
verticalMoreActions: {
|
|
90
88
|
type: Boolean,
|
|
91
|
-
default:
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
virtualScroll: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
92
94
|
},
|
|
93
95
|
})
|
|
94
96
|
|
|
@@ -150,6 +152,16 @@ const dataSort = (data, key, order, type) => {
|
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
154
|
|
|
155
|
+
//getting the chip color accroding to value of chip from row
|
|
156
|
+
const getChipColor = (data, value) => {
|
|
157
|
+
const foundObject = data.find((chip) => chip.value === value)
|
|
158
|
+
if (foundObject) {
|
|
159
|
+
return foundObject['color']
|
|
160
|
+
} else {
|
|
161
|
+
return 'neutral-3'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
153
165
|
//getting the sorted icon according the order
|
|
154
166
|
const getSortingIcon = (col) => {
|
|
155
167
|
if (col) {
|
|
@@ -161,16 +173,6 @@ const getSortingIcon = (col) => {
|
|
|
161
173
|
}
|
|
162
174
|
}
|
|
163
175
|
|
|
164
|
-
//getting the chip color accroding to value of chip from row
|
|
165
|
-
const getChipColor = (data, value) => {
|
|
166
|
-
const foundObject = data.find((chip) => chip.value === value)
|
|
167
|
-
if (foundObject) {
|
|
168
|
-
return foundObject['color']
|
|
169
|
-
} else {
|
|
170
|
-
return 'neutral-3'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
176
|
const handleActionColClick = (e) => {
|
|
175
177
|
e.preventDefault()
|
|
176
178
|
e.stopPropagation()
|
|
@@ -509,19 +511,57 @@ const onRowPerPageChange = (value) => {
|
|
|
509
511
|
? !action.hide(props.row)
|
|
510
512
|
: true
|
|
511
513
|
"
|
|
512
|
-
:color="
|
|
514
|
+
:color="
|
|
515
|
+
typeof action.color === 'function'
|
|
516
|
+
? action.color(props.row)
|
|
517
|
+
: action.color
|
|
518
|
+
"
|
|
513
519
|
:disable="
|
|
514
520
|
typeof action.disable === 'function' &&
|
|
515
521
|
action.disable(props.row)
|
|
516
522
|
"
|
|
517
|
-
:flat="
|
|
523
|
+
:flat="
|
|
524
|
+
typeof action.flat === 'function'
|
|
525
|
+
? action.flat(props.row)
|
|
526
|
+
: action.flat
|
|
527
|
+
"
|
|
518
528
|
:key="key"
|
|
519
|
-
:label="
|
|
520
|
-
|
|
521
|
-
|
|
529
|
+
:label="
|
|
530
|
+
typeof action.label === 'function'
|
|
531
|
+
? action.label(props.row)
|
|
532
|
+
: action.label
|
|
533
|
+
"
|
|
534
|
+
:leftIcon="
|
|
535
|
+
typeof action.icon === 'function'
|
|
536
|
+
? action.icon(props.row)
|
|
537
|
+
: action.icon
|
|
538
|
+
"
|
|
539
|
+
:outline="
|
|
540
|
+
typeof action.outline === 'function'
|
|
541
|
+
? action.outline(props.row)
|
|
542
|
+
: action.outline
|
|
543
|
+
"
|
|
522
544
|
:size="action.size"
|
|
523
545
|
@onClick="action.handler(props.row)"
|
|
524
|
-
|
|
546
|
+
>
|
|
547
|
+
<template #tooltip>
|
|
548
|
+
<UTooltip
|
|
549
|
+
v-if="
|
|
550
|
+
typeof action.tooltip === 'function'
|
|
551
|
+
? action.tooltip(props.row)
|
|
552
|
+
: action.tooltip
|
|
553
|
+
"
|
|
554
|
+
:anchor="action.anchor"
|
|
555
|
+
:description="
|
|
556
|
+
typeof action.tooltip === 'function'
|
|
557
|
+
? action.tooltip(props.row)
|
|
558
|
+
: action.tooltip
|
|
559
|
+
"
|
|
560
|
+
:offset="action.offset ? action.offset : [10, 40]"
|
|
561
|
+
:self="action.anchor"
|
|
562
|
+
/>
|
|
563
|
+
</template>
|
|
564
|
+
</UBtnStd>
|
|
525
565
|
</template>
|
|
526
566
|
</template>
|
|
527
567
|
<!-- to show the actions list if the actions are multiple -->
|
|
@@ -591,6 +631,7 @@ const onRowPerPageChange = (value) => {
|
|
|
591
631
|
:disable="moreActionDialogData.secondaryAction.disable"
|
|
592
632
|
:flat="moreActionDialogData.secondaryAction.flat"
|
|
593
633
|
:label="moreActionDialogData.secondaryAction.label"
|
|
634
|
+
:loading="moreActionDialogData.secondaryAction.loading"
|
|
594
635
|
:outline="moreActionDialogData.secondaryAction.outline"
|
|
595
636
|
:size="moreActionDialogData.secondaryAction.size"
|
|
596
637
|
@on-click="
|
|
@@ -604,6 +645,7 @@ const onRowPerPageChange = (value) => {
|
|
|
604
645
|
:disable="moreActionDialogData.primaryAction.disable"
|
|
605
646
|
:flat="moreActionDialogData.primaryAction.flat"
|
|
606
647
|
:label="moreActionDialogData.primaryAction.label"
|
|
648
|
+
:loading="moreActionDialogData.primaryAction.loading"
|
|
607
649
|
:outline="moreActionDialogData.primaryAction.outline"
|
|
608
650
|
:size="moreActionDialogData.primaryAction.size"
|
|
609
651
|
@on-click="
|
|
@@ -638,16 +680,31 @@ const onRowPerPageChange = (value) => {
|
|
|
638
680
|
: true && !verticalMoreActions
|
|
639
681
|
"
|
|
640
682
|
:class="`more-action-icon cursor-pointer table-more-action`"
|
|
641
|
-
:iconClass="
|
|
642
|
-
|
|
683
|
+
:iconClass="
|
|
684
|
+
typeof action.icon === 'function'
|
|
685
|
+
? action.icon(props.row)
|
|
686
|
+
: action.icon
|
|
687
|
+
"
|
|
688
|
+
:anchor="action.anchor"
|
|
689
|
+
:ariaLabel="
|
|
690
|
+
typeof action.label === 'function'
|
|
691
|
+
? action.label(props.row)
|
|
692
|
+
: action.label
|
|
693
|
+
"
|
|
643
694
|
:disable="
|
|
644
695
|
typeof action.disable === 'function' &&
|
|
645
696
|
action.disable(props.row)
|
|
646
697
|
"
|
|
647
698
|
:id="`more-action-${key}`"
|
|
699
|
+
:offset="action.offset ? action.offset : [10, 40]"
|
|
648
700
|
ref="btn-icon"
|
|
701
|
+
:self="action.self"
|
|
649
702
|
:size="action.size"
|
|
650
|
-
:tooltip="
|
|
703
|
+
:tooltip="
|
|
704
|
+
typeof action.tooltip === 'function'
|
|
705
|
+
? action.tooltip(props.row)
|
|
706
|
+
: action.tooltip
|
|
707
|
+
"
|
|
651
708
|
@click.stop="handleMenuEventStop"
|
|
652
709
|
@onClick="action.handler(props.row)"
|
|
653
710
|
/>
|
|
@@ -661,15 +718,21 @@ const onRowPerPageChange = (value) => {
|
|
|
661
718
|
:data="
|
|
662
719
|
col.actions.map((action) => {
|
|
663
720
|
return {
|
|
664
|
-
|
|
665
|
-
leftIcon: action.icon,
|
|
666
|
-
hide: !(typeof action.hide === 'function'
|
|
667
|
-
? !action.hide(props.row)
|
|
668
|
-
: true),
|
|
721
|
+
destructive: action.destructive,
|
|
669
722
|
disable:
|
|
670
723
|
typeof action.disable === 'function' &&
|
|
671
724
|
action.disable(props.row),
|
|
672
|
-
|
|
725
|
+
hide: !(typeof action.hide === 'function'
|
|
726
|
+
? !action.hide(props.row)
|
|
727
|
+
: true),
|
|
728
|
+
label:
|
|
729
|
+
typeof action.label === 'function'
|
|
730
|
+
? action.label(props.row)
|
|
731
|
+
: action.label,
|
|
732
|
+
leftIcon:
|
|
733
|
+
typeof action.icon === 'function'
|
|
734
|
+
? action.icon(props.row)
|
|
735
|
+
: action.icon,
|
|
673
736
|
handler: function () {
|
|
674
737
|
return action.handler(props.row)
|
|
675
738
|
},
|