@usssa/component-library 1.0.0-beta.9 → 1.0.0

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.
@@ -125,6 +125,10 @@ const props = defineProps({
125
125
  type: Boolean,
126
126
  default: false,
127
127
  },
128
+ minOverflowLength: {
129
+ type: Number,
130
+ default: 12,
131
+ },
128
132
  multiSelection: {
129
133
  type: Boolean,
130
134
  default: false,
@@ -320,10 +324,9 @@ const handleMenuHide = () => {
320
324
  }
321
325
 
322
326
  const handleMenuShow = (id) => {
323
- activeMenuId.value = id
324
- checkMenuPosition(id)
325
- window.addEventListener('scroll', onScroll, true)
326
-
327
+ activeMenuId.value = id
328
+ checkMenuPosition(id)
329
+ window.addEventListener('scroll', onScroll, true)
327
330
  }
328
331
  // handling the large selection data in chunks
329
332
  const handleSelectAllData = () => {
@@ -445,7 +448,7 @@ const onRowPerPageChange = (value) => {
445
448
  }
446
449
 
447
450
  const onScroll = () => {
448
- if(activeMenuId.value !== null) {
451
+ if (activeMenuId.value !== null) {
449
452
  checkMenuPosition(activeMenuId.value)
450
453
  }
451
454
  }
@@ -480,6 +483,7 @@ watch(
480
483
  :infinite-scroll="infiniteScroll"
481
484
  :infinite-scroll-property="infiniteScrollProperty"
482
485
  :loading="loading"
486
+ :minOverflowLength="minOverflowLength"
483
487
  :row-card-height="rowCardHeight"
484
488
  :select-more-options="selectMoreOptions"
485
489
  :separator="separator"
@@ -509,9 +513,11 @@ watch(
509
513
  </UTh>
510
514
  <template v-for="(col, key) in props.cols">
511
515
  <UTh
512
- v-if="typeof col.show === 'function'
516
+ v-if="
517
+ typeof col.show === 'function'
513
518
  ? col.show()
514
- : (typeof col.show === 'undefined' || col.show)"
519
+ : typeof col.show === 'undefined' || col.show
520
+ "
515
521
  :class="`${col.sortable ? 'cursor-pointer' : ''} ${
516
522
  col.headerClasses
517
523
  }`"
@@ -580,7 +586,7 @@ watch(
580
586
  col.field !== 'action' &&
581
587
  (typeof col.show === 'function'
582
588
  ? col.show()
583
- : (typeof col.show === 'undefined' || col.show))
589
+ : typeof col.show === 'undefined' || col.show)
584
590
  "
585
591
  :class="col.classes"
586
592
  :col="col"
@@ -723,6 +729,21 @@ watch(
723
729
  />
724
730
  </div>
725
731
  </div>
732
+ <div v-if="col.colIcon" class="q-ml-xxs">
733
+ <UBtnIcon
734
+ :iconClass="col.colIcon.icon"
735
+ :ariaLabel="
736
+ typeof col.colIcon.ariaLabel === 'function'
737
+ ? col.colIcon.ariaLabel(props.row)
738
+ : col.colIcon.ariaLabel
739
+ "
740
+ ref="btn-icon"
741
+ size="16px"
742
+ @click.stop="col.colIcon.colIconClick()"
743
+ @on-click="col.colIcon.colIconClick()"
744
+ >
745
+ </UBtnIcon>
746
+ </div>
726
747
  </div>
727
748
  </template>
728
749
  <!-- to show other cell data -->
@@ -733,8 +754,20 @@ watch(
733
754
  col.combineColoumn(props.row)
734
755
  ? ' combine-col-wrapper'
735
756
  : ''
757
+ } ${
758
+ typeof col?.colorMap === 'function'
759
+ ? `combine-col-wrapper`
760
+ : ``
736
761
  }`"
737
762
  >
763
+ <span
764
+ v-if="typeof col?.colorMap === 'function'"
765
+ :class="`table-text-colormap-${
766
+ col?.colorMap(props.row)?.color
767
+ } text-caption-md`"
768
+ >
769
+ {{ col?.colorMap(props.row)?.value }}
770
+ </span>
738
771
  <div v-if="col.type !== 'icon'">
739
772
  {{ props.row[col.field] }}
740
773
  </div>
@@ -753,7 +786,16 @@ watch(
753
786
  v-if="col.captionKey && col.type !== 'icon'"
754
787
  class="td-caption text-body-xs"
755
788
  >
756
- {{ props.row[col.captionKey] }}
789
+ <span
790
+ v-if="
791
+ col.strikeCaptionKey && props.row[col.strikeCaptionKey]
792
+ "
793
+ class="text-strike"
794
+ >
795
+ {{ props.row[col.strikeCaptionKey] }}
796
+ </span>
797
+ {{ col?.captionKeyPrefix }}
798
+ {{ `${props.row[col.captionKey]} ${col?.captionKeyPostfix??''}` }}
757
799
  </div>
758
800
  <template
759
801
  v-if="
@@ -785,9 +827,11 @@ watch(
785
827
  <!-- to the action cell, it can have single and multiple -->
786
828
 
787
829
  <UTd
788
- v-else-if="typeof col.show === 'function'
830
+ v-else-if="
831
+ typeof col.show === 'function'
789
832
  ? col.show()
790
- : (typeof col.show === 'undefined' || col.show)"
833
+ : typeof col.show === 'undefined' || col.show
834
+ "
791
835
  :class="col.classes"
792
836
  :index="index"
793
837
  :separator="separator"
@@ -805,64 +849,100 @@ watch(
805
849
  v-for="(action, key) in getInlineActions(col)"
806
850
  :key="key"
807
851
  >
808
- <UBtnStd
809
- v-if="
810
- typeof action.hide === 'function'
811
- ? !action.hide(props.row)
812
- : true
813
- "
814
- :class="`more-action-icon cursor-pointer table-more-action`"
815
- :iconClass="
816
- typeof action.icon === 'function'
817
- ? action.icon(props.row)
818
- : action.icon
819
- "
820
- :anchor="action.anchor"
821
- :ariaLabel="
822
- typeof action.label === 'function'
823
- ? action.label(props.row)
824
- : action.label
825
- "
826
- :color="
827
- typeof action.color === 'function'
828
- ? action.color(props.row)
829
- : action.color
830
- "
831
- :disable="
832
- typeof action.disable === 'function' &&
833
- action.disable(props.row)
834
- "
835
- :flat="
836
- typeof action.flat === 'function'
837
- ? action.flat(props.row)
838
- : action.flat
839
- "
840
- :label="
841
- typeof action.label === 'function'
842
- ? action.label(props.row)
843
- : action.label
844
- "
845
- :loading="
846
- typeof action.loading === 'function'
847
- ? action.loading(props.row)
848
- : action.loading
849
- "
850
- :offset="action.offset ? action.offset : [10, 40]"
851
- :outline="
852
- typeof action.outline === 'function'
853
- ? action.outline()
854
- : action.outline
855
- "
856
- :self="action.self"
857
- :size="action.size"
858
- :tooltip="
859
- typeof action.tooltip === 'function'
860
- ? action.tooltip(props.row)
861
- : action.tooltip
862
- "
863
- @click.stop="handleMenuEventStop"
864
- @on-click="action.handler(props.row)"
865
- />
852
+ <div v-if="action.btnIcon">
853
+ <q-icon
854
+ v-if="
855
+ typeof action.hide === 'function'
856
+ ? !action.hide(props.row)
857
+ : true
858
+ "
859
+ :class="`${action.btnIconClass} icon-container-border cursor-pointer`"
860
+ :ariaLabel="
861
+ typeof action.label === 'function'
862
+ ? action.label(props.row)
863
+ : action.label
864
+ "
865
+ color="primary"
866
+ :id="`actionPopupRefBtn-${props.row.id}`"
867
+ ref="btn-icon"
868
+ :showIconBorder="true"
869
+ tabindex="0"
870
+ size="16px"
871
+ @click.stop="handleMenuEventStop"
872
+ @on-click="onMoreActionButtonClick(props.row.id)"
873
+ />
874
+ <UTooltip
875
+ anchor="center right"
876
+ :description="
877
+ typeof action.tooltip === 'function'
878
+ ? action.tooltip(props.row)
879
+ : action.tooltip
880
+ "
881
+ :offset="[4, 14]"
882
+ self="center start"
883
+ />
884
+ </div>
885
+
886
+ <div v-else>
887
+ <UBtnStd
888
+ v-if="
889
+ typeof action.hide === 'function'
890
+ ? !action.hide(props.row)
891
+ : true
892
+ "
893
+ :class="`more-action-icon cursor-pointer table-more-action`"
894
+ :iconClass="
895
+ typeof action.icon === 'function'
896
+ ? action.icon(props.row)
897
+ : action.icon
898
+ "
899
+ :anchor="action.anchor"
900
+ :ariaLabel="
901
+ typeof action.label === 'function'
902
+ ? action.label(props.row)
903
+ : action.label
904
+ "
905
+ :color="
906
+ typeof action.color === 'function'
907
+ ? action.color(props.row)
908
+ : action.color
909
+ "
910
+ :disable="
911
+ typeof action.disable === 'function' &&
912
+ action.disable(props.row)
913
+ "
914
+ :flat="
915
+ typeof action.flat === 'function'
916
+ ? action.flat(props.row)
917
+ : action.flat
918
+ "
919
+ :label="
920
+ typeof action.label === 'function'
921
+ ? action.label(props.row)
922
+ : action.label
923
+ "
924
+ :loading="
925
+ typeof action.loading === 'function'
926
+ ? action.loading(props.row)
927
+ : action.loading
928
+ "
929
+ :offset="action.offset ? action.offset : [10, 40]"
930
+ :outline="
931
+ typeof action.outline === 'function'
932
+ ? action.outline()
933
+ : action.outline
934
+ "
935
+ :self="action.self"
936
+ :size="action.size"
937
+ :tooltip="
938
+ typeof action.tooltip === 'function'
939
+ ? action.tooltip(props.row)
940
+ : action.tooltip
941
+ "
942
+ @click.stop="handleMenuEventStop"
943
+ @on-click="action.handler(props.row)"
944
+ />
945
+ </div>
866
946
  </template>
867
947
  <!-- Three-dot menu for menu actions -->
868
948
  <UBtnIcon
@@ -1631,7 +1711,6 @@ watch(
1631
1711
  width: 10.5rem
1632
1712
 
1633
1713
  .mobile-primary-caption
1634
- width: 11.5rem !important
1635
1714
  white-space: nowrap
1636
1715
  overflow: hidden
1637
1716
  text-overflow: ellipsis
@@ -1656,10 +1735,8 @@ watch(
1656
1735
  .u-expansion-body
1657
1736
  display: flex
1658
1737
  flex-wrap: wrap
1659
- gap: $xs
1660
-
1661
- > *:not(:last-child)
1662
- margin-bottom: $ba
1738
+ column-gap: $xs
1739
+ row-gap: $ba
1663
1740
 
1664
1741
  .table-data-avatar
1665
1742
  display: flex
@@ -1682,4 +1759,28 @@ watch(
1682
1759
 
1683
1760
  .mobile-expansion-item
1684
1761
  flex: calc(50% - 8px)
1762
+
1763
+ .card-header-table
1764
+ text-overflow: ellipsis
1765
+ overflow: hidden
1766
+ white-space: nowrap
1767
+ display: block
1768
+
1769
+ .table-text-colormap-positive
1770
+ color: $green-6 !important
1771
+
1772
+ .table-text-colormap-accent
1773
+ color: $red-5 !important
1774
+
1775
+ .icon-container-border
1776
+ height: $md
1777
+ width: $md
1778
+ align-items: center
1779
+ border-radius: $xs
1780
+ border: 1.5px solid $primary
1781
+ &:hover
1782
+ background: #234ba926
1783
+ .q-btn--round
1784
+ width: 0px
1785
+ min-width: 0px
1685
1786
  </style>
@@ -68,6 +68,7 @@ const getTooltipText = computed(() => {
68
68
  border-radius: $xs
69
69
  padding: $xs $sm
70
70
  max-width: 22.5rem !important
71
+ word-break: break-word
71
72
 
72
73
  .tooltip-text
73
74
  color: $neutral-1
@@ -0,0 +1,221 @@
1
+ <script setup>
2
+ import { AdvancedMarker, GoogleMap } from 'vue3-google-map'
3
+ import { computed, onMounted, ref } from 'vue'
4
+ import UBtnStd from './UBtnStd.vue'
5
+ import UChip from './UChip.vue'
6
+ import { useScreenType } from '../../composables/useScreenType'
7
+ import UTooltip from './UTooltip.vue'
8
+
9
+ const props = defineProps({
10
+ address: {
11
+ default: '',
12
+ type: String,
13
+ },
14
+ dataTestId: {
15
+ type: String,
16
+ default: 'u-venue-card',
17
+ },
18
+ divisionLabel: {
19
+ default: '',
20
+ type: String,
21
+ },
22
+ divisions: {
23
+ default: () => [],
24
+ type: Array,
25
+ },
26
+ lat: {
27
+ default: 0,
28
+ type: Number,
29
+ },
30
+ lng: {
31
+ default: 0,
32
+ type: Number,
33
+ },
34
+ venueMapBtnLabel: {
35
+ default: 'Open in Map',
36
+ type: String,
37
+ },
38
+ venueName: {
39
+ default: '',
40
+ type: String,
41
+ },
42
+ zoom: {
43
+ default: 14,
44
+ type: Number,
45
+ },
46
+ })
47
+
48
+ const googleApiKey = process.env.GOOGLE_MAP_API_KEY
49
+
50
+ const $screen = useScreenType()
51
+
52
+ const addressRef = ref(null)
53
+ const chip = ref(true)
54
+ const isAddressOverflow = ref(false)
55
+ const isVenueNameOverflow = ref(false)
56
+ const venueNameRef = ref(null)
57
+
58
+ const mapUrl = computed(() => {
59
+ const encodedName = encodeURIComponent(props.venueName)
60
+ const latLng = `${props.lat},${props.lng}`
61
+
62
+ if ($screen.value.isMobile) {
63
+ return `https://www.google.com/maps/dir/?api=1&destination=${latLng}`
64
+ } else {
65
+ return `https://www.google.com/maps/search/?api=1&query=${encodedName}%20(${latLng})`
66
+ }
67
+ })
68
+
69
+ const handleMapBtn = () => {
70
+ const isMobile = $screen.value.isMobile
71
+
72
+ if (isMobile) {
73
+ window.location.href = mapUrl.value
74
+ } else {
75
+ window.open(mapUrl.value, '_blank', 'noopener,noreferrer')
76
+ }
77
+ }
78
+
79
+ onMounted(() => {
80
+ if (venueNameRef.value) {
81
+ isVenueNameOverflow.value =
82
+ venueNameRef.value.scrollWidth > venueNameRef.value.clientWidth
83
+ }
84
+
85
+ if (addressRef.value) {
86
+ isAddressOverflow.value =
87
+ addressRef.value.scrollWidth > addressRef.value.clientWidth
88
+ }
89
+ })
90
+ </script>
91
+
92
+ <template>
93
+ <q-card v-bind="$attrs" class="u-venue-card full-width">
94
+ <q-card-section class="u-venue-card-header col">
95
+ <span
96
+ class="text-heading-xxs q-mb-0 ellipsis"
97
+ ref="venueNameRef"
98
+ tabindex="0"
99
+ >
100
+ {{ venueName }}
101
+ </span>
102
+ <UTooltip
103
+ v-if="isVenueNameOverflow"
104
+ anchor="bottom middle"
105
+ :description="venueName"
106
+ :offset="[4, 4]"
107
+ self="top middle"
108
+ />
109
+
110
+ <span
111
+ class="text-body-xs text-description ellipsis"
112
+ ref="addressRef"
113
+ tabindex="0"
114
+ >
115
+ {{ address }}
116
+ </span>
117
+ <UTooltip
118
+ v-if="isAddressOverflow"
119
+ anchor="bottom middle"
120
+ :description="address"
121
+ :offset="[4, 4]"
122
+ self="top middle"
123
+ />
124
+ </q-card-section>
125
+
126
+ <q-card-section class="u-venue-card-body">
127
+ <GoogleMap
128
+ :api-key="googleApiKey"
129
+ :center="{ lat, lng }"
130
+ :clickable-icons="false"
131
+ :disable-default-u-i="true"
132
+ :fullscreen-control="false"
133
+ :gesture-handling="'none'"
134
+ :keyboard-shortcuts="false"
135
+ mapId="roadmap"
136
+ :map-type-control="false"
137
+ :street-view-control="false"
138
+ style="width: 100%; height: 7.25rem"
139
+ :zoom="zoom"
140
+ :zoom-control="false"
141
+ >
142
+ <AdvancedMarker :options="{ position: { lat, lng } }" />
143
+ </GoogleMap>
144
+
145
+ <UBtnStd
146
+ class="u-venue-card-map-btn"
147
+ :aria-label="venueMapBtnLabel"
148
+ color="primary"
149
+ data-test-id="open-map"
150
+ :label="venueMapBtnLabel"
151
+ size="sm"
152
+ @click="handleMapBtn"
153
+ />
154
+ </q-card-section>
155
+
156
+ <q-card-section class="u-venue-card-footer">
157
+ <span class="text-body-sm">{{ divisionLabel }}</span>
158
+ <div class="width-full chip-container">
159
+ <UChip
160
+ v-for="(item, index) in divisions"
161
+ v-model="chip"
162
+ :chip-label="item.label"
163
+ dense
164
+ :key="index"
165
+ :removable="false"
166
+ />
167
+ </div>
168
+ </q-card-section>
169
+ </q-card>
170
+ </template>
171
+
172
+ <style lang="sass">
173
+ .u-venue-card
174
+ display: flex
175
+ flex-direction: column
176
+ border-radius: $xs
177
+ box-shadow: none
178
+ padding: $ba
179
+ border: 1px solid $neutral-4
180
+ gap: $ba
181
+
182
+ .u-venue-card-header
183
+ display: flex
184
+ flex-direction: column
185
+ padding: 0
186
+
187
+ .u-venue-card-body
188
+ padding: 0
189
+ height: 7.25rem
190
+ background: $neutral-4
191
+ border-radius: $xs !important
192
+ position: relative
193
+
194
+ .u-venue-card-map-btn
195
+ position: absolute
196
+ bottom: $ba
197
+ right: $ba
198
+
199
+ .u-venue-card-footer
200
+ gap: $xs
201
+ padding: 0
202
+
203
+ .chip-container
204
+ display: flex
205
+ flex-wrap: nowrap
206
+ gap: $xs
207
+ margin-top: $xs
208
+ overflow-x: auto
209
+ white-space: nowrap
210
+ width: 100%
211
+ max-width: 100%
212
+ -ms-overflow-style: none // IE/Edge
213
+ scrollbar-width: none // Firefox
214
+
215
+ .q-chip
216
+ flex: 0 0 auto
217
+ margin: 0 !important
218
+
219
+ .chip-container::-webkit-scrollbar
220
+ display: none
221
+ </style>
@@ -24,6 +24,7 @@ import UInputPhoneStd from './core/UInputPhoneStd.vue'
24
24
  import UInputTextStd from './core/UInputTextStd.vue'
25
25
  import UInputTypeaheadAdvanceSearch from './core/UInputTypeaheadAdvanceSearch.vue'
26
26
  import UMenuButtonStd from './core/UMenuButtonStd.vue'
27
+ import UMatchup from './core/UMatchup.vue'
27
28
  import UMenuDropdown from './core/UMenuDropdown.vue'
28
29
  import UMenuDropdownAdvancedSearch from './core/UMenuDropdownAdvancedSearch.vue'
29
30
  import UMenuItem from './core/UMenuItem.vue'
@@ -44,6 +45,7 @@ import UToolbar from './core/UToolbar/UToolbar.vue'
44
45
  import UTooltip from './core/UTooltip.vue'
45
46
  import UTypeahead from './core/UTypeahead.vue'
46
47
  import UUploader from './core/UUploader.vue'
48
+ import UVenueCard from './core/UVenueCard.vue'
47
49
 
48
50
  import { useNotify } from '../composables/useNotify.js'
49
51
  import { useOverlayLoader } from '../composables/useOverlayLoader.js'
@@ -75,6 +77,7 @@ export {
75
77
  UInputPhoneStd,
76
78
  UInputTextStd,
77
79
  UInputTypeaheadAdvanceSearch,
80
+ UMatchup,
78
81
  UMenuButtonStd,
79
82
  UMenuDropdown,
80
83
  UMenuDropdownAdvancedSearch,
@@ -99,4 +102,5 @@ export {
99
102
  UTooltip,
100
103
  UTypeahead,
101
104
  UUploader,
105
+ UVenueCard
102
106
  }
@@ -44,7 +44,7 @@ export const useNotify = () => {
44
44
  `.q-notification__wrapper .q-notification__content`
45
45
  )
46
46
  if (childElement.childNodes.length == 1) {
47
- const iconEleHTML = `<i class='${icon}' aria-label='Custom Icon' style='height:24px; width:24px; font-size: 24px; margin-right: 8px;line-height: 1 !important' alt='Custom Icon Alt'></i>`
47
+ const iconEleHTML = `<i class='${icon} icon-secondary-opacity' aria-label='Custom Icon' style='height:24px; width:24px; font-size: 24px; margin-right: 8px;line-height: 1 !important' alt='Custom Icon Alt'></i>`
48
48
  childElement.insertAdjacentHTML('afterbegin', iconEleHTML)
49
49
  }
50
50
  }
@@ -60,7 +60,7 @@ export const useNotify = () => {
60
60
  caption: props.message,
61
61
  color: props.type,
62
62
  timeout: props.timeout,
63
- classes: `u-notify u-type-${props.type} q-notification-elem-${randomId} ${props?.altclasses}`,
63
+ classes: `u-notify u-type-${props.type} q-notification-elem-${randomId} ${props.altclasses}`,
64
64
  position: props.position,
65
65
  progress: props.progress,
66
66
  icon: props.icon ? handleGetCustomIcon(props.icon, randomId) : null,