@usssa/component-library 1.0.0-alpha.105 → 1.0.0-alpha.107

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usssa/component-library",
3
- "version": "1.0.0-alpha.105",
3
+ "version": "1.0.0-alpha.107",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -20,10 +20,6 @@ const props = defineProps({
20
20
  model: {
21
21
  type: Object,
22
22
  },
23
- size: {
24
- type: String,
25
- default: 'md',
26
- },
27
23
  searchType: {
28
24
  type: String,
29
25
  },
@@ -31,6 +27,10 @@ const props = defineProps({
31
27
  type: Boolean,
32
28
  default: false,
33
29
  },
30
+ size: {
31
+ type: String,
32
+ default: 'md',
33
+ },
34
34
  title: {
35
35
  type: String,
36
36
  default: 'Advanced search',
@@ -48,22 +48,22 @@ const emit = defineEmits([
48
48
  'updateAdvanceSearchToggle',
49
49
  ])
50
50
 
51
- const menuSize = computed(() => {
52
- if (props.size === 'md') {
53
- return '24.1875rem'
54
- } else if (props.size === 'sm') {
55
- return '23.5625rem'
51
+ const clearFields = () => {
52
+ emit('onClearAdvancedSearchFilter')
53
+ }
54
+
55
+ const getKeyValueByTitle = (label) => {
56
+ const model = props.model
57
+ const camelCaseKey = titleToCamelCase(label)
58
+ if (camelCaseKey in model) {
59
+ return model[camelCaseKey]
56
60
  } else {
57
- return props.size
61
+ return ''
58
62
  }
59
- })
60
-
61
- const updateModelVal = (event, index) => {
62
- emit('updateModelVal', event.trim(), index)
63
63
  }
64
64
 
65
- const updateCountry = (val, label) => {
66
- emit('updateCountry', val, label)
65
+ const onApply = () => {
66
+ emit('onApplyAdvancedSearchFilter')
67
67
  }
68
68
 
69
69
  const titleToCamelCase = (str) => {
@@ -79,22 +79,12 @@ const titleToCamelCase = (str) => {
79
79
  .join('')
80
80
  }
81
81
 
82
- const getKeyValueByTitle = (label) => {
83
- const model = props.model
84
- const camelCaseKey = titleToCamelCase(label)
85
- if (camelCaseKey in model) {
86
- return model[camelCaseKey]
87
- } else {
88
- return ''
89
- }
90
- }
91
-
92
- const clearFields = () => {
93
- emit('onClearAdvancedSearchFilter')
82
+ const updateCountry = (val, label) => {
83
+ emit('updateCountry', val, label)
94
84
  }
95
85
 
96
- const onApply = () => {
97
- emit('onApplyAdvancedSearchFilter')
86
+ const updateModelVal = (event, index) => {
87
+ emit('updateModelVal', event.trim(), index)
98
88
  }
99
89
 
100
90
  const updateToggle = (val) => {
@@ -106,17 +96,17 @@ const updateToggle = (val) => {
106
96
  <div>
107
97
  <q-expansion-item
108
98
  v-bind="$attrs"
99
+ :modelValue="toggle"
109
100
  class="overflow-hidden u-expansion"
110
101
  dense-toggle
111
102
  header-class="bg-neutral-2"
112
103
  :label="title"
113
104
  :style="`width: ${size}`"
114
- :modelValue="toggle"
115
105
  @update:modelValue="(val) => updateToggle(val)"
116
106
  >
117
107
  <template #header>
118
108
  <div class="row items-center full-width">
119
- <q-icon :class="labelIcon" size="1rem" color="neutral-9" />
109
+ <q-icon :class="`${labelIcon}`" color="neutral-9" size="1rem" />
120
110
  <span class="q-ml-xs text-caption-sm text-neutral-13">
121
111
  {{ title }}
122
112
  </span>
@@ -128,7 +118,7 @@ const updateToggle = (val) => {
128
118
  <slot name="custom-menu" />
129
119
  </template>
130
120
 
131
- <section v-else class="bg-neutral-2 q-px-ba">
121
+ <section v-else class="bg-neutral-2 q-px-ba q-pb-ba">
132
122
  <div class="row items-container">
133
123
  <div
134
124
  v-for="(item, index) in fields && fields.length ? fields : []"
@@ -144,10 +134,10 @@ const updateToggle = (val) => {
144
134
  <UInputTextStd
145
135
  v-if="item.inputType === 'Text'"
146
136
  v-bind="item.props"
137
+ :modelValue="getKeyValueByTitle(item.label)"
147
138
  :aria-label="item.label"
148
139
  :hintText="item.hintText"
149
140
  :label="item.label"
150
- :modelValue="getKeyValueByTitle(item.label)"
151
141
  @update:modelValue="
152
142
  updateModelVal($event, titleToCamelCase(item.label))
153
143
  "
@@ -155,11 +145,11 @@ const updateToggle = (val) => {
155
145
  <USelectStd
156
146
  v-if="item.inputType === 'Select'"
157
147
  v-bind="item.props"
148
+ :modelValue="getKeyValueByTitle(item.label)"
158
149
  :aria-label="item.label"
159
150
  hintIcon=""
160
151
  :hintText="item.hintText"
161
152
  :label="item.label"
162
- :modelValue="getKeyValueByTitle(item.label)"
163
153
  :options="item.options"
164
154
  @update:modelValue="
165
155
  updateModelVal($event, titleToCamelCase(item.label))
@@ -168,10 +158,10 @@ const updateToggle = (val) => {
168
158
  <UMultiSelectStd
169
159
  v-if="item.inputType === 'Multiselect'"
170
160
  v-bind="item.props"
161
+ :modelValue="getKeyValueByTitle(item.label)"
171
162
  :aria-label="item.label"
172
163
  :hintText="item.hintText"
173
164
  :label="item.label"
174
- :modelValue="getKeyValueByTitle(item.label)"
175
165
  :options="item.options"
176
166
  @update:modelValue="
177
167
  updateModelVal($event, titleToCamelCase(item.label))
@@ -180,11 +170,11 @@ const updateToggle = (val) => {
180
170
  <UInputPhoneStd
181
171
  v-if="item.inputType === 'Phone'"
182
172
  v-bind="item.props"
173
+ :modelValue="getKeyValueByTitle(item.label)"
183
174
  :aria-label="item.label"
184
175
  hintIcon=""
185
176
  :hintText="item.hintText"
186
177
  :label="item.label"
187
- :modelValue="getKeyValueByTitle(item.label)"
188
178
  :options="item.options"
189
179
  placeholder=""
190
180
  :selected-country="model.selectedCountry"
@@ -200,10 +190,10 @@ const updateToggle = (val) => {
200
190
  <UInputTextStd
201
191
  v-if="item.inputType === 'Date'"
202
192
  v-bind="item.props"
193
+ :modelValue="getKeyValueByTitle(item.label)"
203
194
  :aria-label="item.label"
204
195
  :hintText="item.hintText"
205
196
  :label="item.label"
206
- :modelValue="getKeyValueByTitle(item.label)"
207
197
  outlined
208
198
  parentClass="col"
209
199
  @update:modelValue="
@@ -212,7 +202,7 @@ const updateToggle = (val) => {
212
202
  >
213
203
  <template v-slot:append>
214
204
  <q-icon
215
- class="fa-kit-duotone fa-calendar-range cursor-pointer"
205
+ class="fa-kit-duotone fa-calendar-range cursor-pointer icon-secondary-opacity"
216
206
  aria-label="Birthday calendar"
217
207
  color="neutral-9"
218
208
  size="1rem"
@@ -220,14 +210,14 @@ const updateToggle = (val) => {
220
210
  >
221
211
  <q-popup-proxy
222
212
  cover
223
- transition-show="scale"
224
213
  transition-hide="scale"
214
+ transition-show="scale"
225
215
  >
226
216
  <q-date
227
217
  v-model="item.value"
228
218
  v-bind="item.dateProps"
229
- mask="MM/DD/YYYY"
230
219
  :modelValue="getKeyValueByTitle(item.label)"
220
+ mask="MM/DD/YYYY"
231
221
  @update:modelValue="
232
222
  updateModelVal($event, titleToCamelCase(item.label))
233
223
  "
@@ -250,25 +240,23 @@ const updateToggle = (val) => {
250
240
 
251
241
  <!-- Action Buttons -->
252
242
 
253
- <div class="action-wrapper">
254
- <q-card-actions align="left" class="full-width">
255
- <UBtnStd
256
- color="primary"
257
- flat
258
- label="Clear All Fields"
259
- leftIcon="fa-kit fa-rotate-left"
260
- @onClick="clearFields"
261
- />
262
- </q-card-actions>
263
- <q-card-actions align="right" class="full-width">
264
- <UBtnStd
265
- color="primary"
266
- :disable="disbaleApplyFilter"
267
- :full-width="true"
268
- label="Apply"
269
- @onClick="onApply"
270
- />
271
- </q-card-actions>
243
+ <div class="action-wrapper q-mt-ba">
244
+ <UBtnStd
245
+ class="col"
246
+ color="primary"
247
+ flat
248
+ label="Clear All Fields"
249
+ leftIcon="fa-kit fa-rotate-left"
250
+ @onClick="clearFields"
251
+ />
252
+
253
+ <UBtnStd
254
+ class="col"
255
+ color="primary"
256
+ :disable="disbaleApplyFilter"
257
+ label="Apply"
258
+ @onClick="onApply"
259
+ />
272
260
  </div>
273
261
  </section>
274
262
  </q-expansion-item>
@@ -288,7 +276,6 @@ const updateToggle = (val) => {
288
276
  color: $neutral-9
289
277
  .action-wrapper
290
278
  display: flex
291
- justify-content: space-between
292
279
  gap: $xs
293
280
  .q-card__actions
294
281
  padding: 0px
@@ -473,7 +473,7 @@ watch(
473
473
  @show="onMenuShow"
474
474
  >
475
475
  <q-list
476
- :class="`u-typeahead-menu q-px-ba q-pt-ba size-${size}`"
476
+ :class="`u-typeahead-menu q-pl-ba q-pt-ba size-${size}`"
477
477
  role="menuitem"
478
478
  >
479
479
  <div v-if="showAdvancedSearchTabs" class="q-pb-xs">
@@ -491,7 +491,7 @@ watch(
491
491
  />
492
492
  </div>
493
493
  </div>
494
- <div class="q-mt-xs">
494
+ <div class="q-mt-xs q-mr-ba">
495
495
  <!-- Menu dropdown -->
496
496
  <UMenuDropdownAdvancedSearch
497
497
  v-if="showAdvancedSearch"
@@ -515,7 +515,7 @@ watch(
515
515
 
516
516
  <q-list
517
517
  v-if="searchResults && !exceedLimit && searchText.length"
518
- class="search-list q-mt-xs"
518
+ class="search-list q-mt-xs q-px-xxs"
519
519
  >
520
520
  <span class="text-overline-xs">Search results</span>
521
521
  <template
@@ -523,7 +523,7 @@ watch(
523
523
  :key="category"
524
524
  >
525
525
  <q-item-label caption>
526
- <span class="text-caption-sm">
526
+ <span class="text-caption-sm q-py-xxs">
527
527
  {{ transformCategory(category) }}
528
528
  </span>
529
529
  </q-item-label>
@@ -547,6 +547,7 @@ watch(
547
547
  v-else
548
548
  :aria-label="item.name"
549
549
  :image="item.profilePictureUrl"
550
+ :name="item.name"
550
551
  :round="true"
551
552
  :showIndicator="false"
552
553
  size="md"
@@ -621,7 +622,9 @@ watch(
621
622
  </div>
622
623
 
623
624
  <div v-if="showInviteBtn" class="row items-center full-width">
624
- <span :class="`searchText-${size} text-caption-md q-mr-xs`">
625
+ <span
626
+ :class="`searchText-${size} text-caption-md q-mr-xs col wrapped-text`"
627
+ >
625
628
  {{ searchText }}
626
629
  </span>
627
630
  <UBtnStd
@@ -653,7 +656,7 @@ watch(
653
656
 
654
657
  <!-- Recently selected list -->
655
658
 
656
- <q-list class="search-list q-mt-xs">
659
+ <q-list class="search-list q-mt-xs q-px-xxs">
657
660
  <div
658
661
  v-if="showRecentSelected && recentSearchesLoading"
659
662
  class="row justify-between items-center"
@@ -768,8 +771,13 @@ watch(
768
771
  overflow-wrap: unset
769
772
  .u-tabs-outer .u-tab-sm
770
773
  margin: 0 $xxs
774
+ padding: 0 $ba
771
775
  .u-tabs-outer .u-tab-sm:first-child
772
776
  margin-left: 0px
777
+ .u-tabs-outer .u-tab-sm:last-child
778
+ margin-right: 0px
779
+ .u-tabs-outer .q-tab__content .q-icon
780
+ font-size: 0.75rem
773
781
  .tabs-option
774
782
  display: flex
775
783
  overflow-y: auto
@@ -779,16 +787,15 @@ watch(
779
787
  border-radius: $xs
780
788
  background: $neutral-1
781
789
  &.size-sm
782
- width: 24.5625rem
790
+ max-width: 25.5625rem
783
791
  &.size-md
784
- width: 26.5rem
792
+ max-width: 26.5rem
785
793
  .search-list
786
794
  display: flex
787
795
  flex-direction: column
788
796
  gap: $xxs
789
797
  .list-item
790
798
  border-radius: $xs
791
- padding: $xs
792
799
  align-items: center
793
800
  display: flex
794
801
  cursor: default !important
@@ -1,23 +1,21 @@
1
1
  <script setup>
2
2
  import { ref, watch } from 'vue'
3
3
  import USelectStd from './USelectStd.vue'
4
+
5
+ const emit = defineEmits(['update:modelValue', 'onRowChange', 'onPageChange'])
4
6
  const props = defineProps({
5
- modelValue: {
6
- type: Number,
7
- default: 1,
8
- },
9
- rowPerPage: {
7
+ maxPages: {
10
8
  type: Number,
11
- default: 5,
9
+ default: 10,
12
10
  },
13
11
  maxPageLink: {
14
12
  //Maximum number of page links to display at a time
15
13
  type: Number,
16
14
  default: 2,
17
15
  },
18
- maxPages: {
16
+ modelValue: {
19
17
  type: Number,
20
- default: 10,
18
+ default: 1,
21
19
  },
22
20
  perPageOptions: {
23
21
  type: Array,
@@ -28,45 +26,53 @@ const props = defineProps({
28
26
  { label: '20 / per page', value: 20 },
29
27
  ],
30
28
  },
29
+ rowPerPage: {
30
+ type: Number,
31
+ default: 5,
32
+ },
31
33
  })
32
- const emit = defineEmits(['update:modelValue', 'onRowChange', 'onPageChange'])
33
- const rowPerPage = ref(props.rowPerPage)
34
+
35
+ // refs
34
36
  const currentPage = ref(props.modelValue)
37
+ const rowPerPage = ref(props.rowPerPage)
35
38
 
36
- watch(currentPage, (newValue) => {
37
- emit('update:modelValue', newValue)
38
- emit('onPageChange', newValue)
39
- })
39
+ // custom functions
40
40
  const onPageChange = (newPage) => {
41
41
  currentPage.value = newPage
42
42
  }
43
43
  const onRowChange = (newRowPerPage) => {
44
44
  emit('onRowChange', newRowPerPage)
45
45
  }
46
+
47
+ // watcher function
48
+ watch(currentPage, (newValue) => {
49
+ emit('update:modelValue', newValue)
50
+ emit('onPageChange', newValue)
51
+ })
46
52
  </script>
47
53
 
48
54
  <template>
49
- <div class="row u-pagination-container">
55
+ <div class="row u-pagination-container">
50
56
  <q-pagination
51
- class="u-pagination"
52
57
  v-model="currentPage"
58
+ class="u-pagination"
59
+ active-color="primary"
60
+ boundary-numbers
61
+ color="dark"
53
62
  direction-links
54
63
  flat
55
- color="dark"
56
- active-color="primary"
64
+ gutter="sm"
57
65
  :max="maxPages"
58
66
  :max-pages="maxPageLink"
59
- boundary-numbers
60
67
  @update:model-value="onPageChange"
61
- gutter="sm"
62
68
  />
63
69
 
64
70
  <USelectStd
65
- class="q-gutter-x-sm text-body-sm perpage-dropdown"
66
71
  v-model="rowPerPage"
72
+ class="q-gutter-x-sm text-body-sm perpage-dropdown"
73
+ popupClass="pagination-dropdown"
67
74
  color="primary"
68
75
  :options="perPageOptions"
69
- popupClass="pagination-dropdown"
70
76
  @update:model-value="onRowChange"
71
77
  />
72
78
  </div>
@@ -77,9 +83,10 @@ const onRowChange = (newRowPerPage) => {
77
83
  width: auto !important
78
84
 
79
85
  .perpage-dropdown
80
- width: 9.375rem
81
86
  .q-field__marginal
82
87
  padding-left: $xs
88
+ .q-field--outlined
89
+ margin-top: 0 !important
83
90
  .q-field--outlined .q-field__control
84
91
  display: inline-flex
85
92
  width: 8.75rem
@@ -88,6 +88,31 @@ const model = computed({
88
88
  return emit('update:modelValue', value)
89
89
  },
90
90
  })
91
+
92
+ // adding scroll if highlighted menu is not visible to user
93
+ const handleKeydown = () => {
94
+ setTimeout(() => {
95
+ const currentItem = document.getElementsByClassName(
96
+ 'q-manual-focusable--focused'
97
+ )[0]
98
+ const dropdownContainer =
99
+ document.getElementsByClassName('u-options-menu')[0]
100
+ if (currentItem && dropdownContainer) {
101
+ const itemRect = currentItem.getBoundingClientRect()
102
+ const containerRect = dropdownContainer.getBoundingClientRect()
103
+ const isVisible =
104
+ itemRect.top >= containerRect.top &&
105
+ itemRect.bottom <= containerRect.bottom
106
+ if (!isVisible) {
107
+ currentItem.scrollIntoView({
108
+ behavior: 'smooth',
109
+ block: 'nearest',
110
+ inline: 'nearest',
111
+ })
112
+ }
113
+ }
114
+ }, 100)
115
+ }
91
116
  </script>
92
117
 
93
118
  <template>
@@ -134,6 +159,7 @@ const model = computed({
134
159
  :placeholder="placeholder"
135
160
  :use-input="useInput"
136
161
  @filter="filterFn"
162
+ @keydown="handleKeydown"
137
163
  >
138
164
  <template v-slot:no-option>
139
165
  <q-item>
@@ -178,16 +178,16 @@ const handleActionColClick = (e) => {
178
178
  e.stopPropagation()
179
179
  }
180
180
 
181
- const handleMenuEventStop = (e) => {
182
- e.preventDefault()
183
- e.stopPropagation()
184
- }
185
-
186
181
  //if user want to add custom sort on data
187
182
  const handleCustomSort = (key, sortOrder, type) => {
188
183
  emit('onCustomSort', key, sortOrder, type)
189
184
  }
190
185
 
186
+ const handleMenuEventStop = (e) => {
187
+ e.preventDefault()
188
+ e.stopPropagation()
189
+ }
190
+
191
191
  // handling the large selection data in chunks
192
192
  const handleSelectAllData = () => {
193
193
  customLoading.value = true
@@ -281,6 +281,13 @@ const isRowSelected = (row) => {
281
281
  }
282
282
  }
283
283
 
284
+ // removing console error for show dialog
285
+ const onMoreActionButtonClick = (id) => {
286
+ if (moreActionDialogData.value) {
287
+ moreActionDialogData.value.showDialog[id] = false
288
+ }
289
+ }
290
+
284
291
  // handle to change the page, and if virtual scroll is enabled and user scrolled to bottom it will take user to the top
285
292
  const onPageChange = (value) => {
286
293
  pagination.value.page = value
@@ -323,8 +330,8 @@ const onRowPerPageChange = (value) => {
323
330
  v-if="multiSelection"
324
331
  :separator="separator"
325
332
  style="width: 3% !important"
326
- :tableHeaderAutoWidth="false"
327
333
  tableHeadAlignment="left"
334
+ :tableHeaderAutoWidth="false"
328
335
  >
329
336
  <UCheckboxStd
330
337
  v-model="isRowSelected(null).value"
@@ -342,8 +349,8 @@ const onRowPerPageChange = (value) => {
342
349
  :key="key"
343
350
  :separator="separator"
344
351
  :style="col.headerStyle"
345
- :tableHeaderAutoWidth="col.autoWidth"
346
352
  :tableHeadAlignment="col.field === 'action' ? col.align : col.align"
353
+ :tableHeaderAutoWidth="col.autoWidth"
347
354
  @click="
348
355
  col.sortable
349
356
  ? isCustomSort
@@ -414,8 +421,8 @@ const onRowPerPageChange = (value) => {
414
421
  <UChip
415
422
  v-model="tableDataChip"
416
423
  class="u-table-chip"
417
- avatarLabel=""
418
424
  :anchor="col.anchor"
425
+ avatarLabel=""
419
426
  :chipLabel="props.row[col.field].toString()"
420
427
  :dense="col.denseChip"
421
428
  :is-show-tooltip="col.showChipTooltip"
@@ -474,8 +481,8 @@ const onRowPerPageChange = (value) => {
474
481
  <template v-if="props.row[col.field]">
475
482
  <q-icon
476
483
  :class="props.row[col.field]"
477
- :aria-label="props.row.ariaLabel"
478
484
  :alt="props.row.ariaLabel"
485
+ :aria-label="props.row.ariaLabel"
479
486
  :color="props?.row?.iconColor ?? 'primary'"
480
487
  size="1.5rem"
481
488
  />
@@ -547,7 +554,7 @@ const onRowPerPageChange = (value) => {
547
554
  : action.outline
548
555
  "
549
556
  :size="action.size"
550
- @onClick="action.handler(props.row)"
557
+ @on-click="action.handler(props.row)"
551
558
  >
552
559
  <template #tooltip>
553
560
  <UTooltip
@@ -585,8 +592,8 @@ const onRowPerPageChange = (value) => {
585
592
  :offset="[85, 0]"
586
593
  role="list"
587
594
  self="bottom middle"
588
- transition-show="scale"
589
595
  transition-hide="scale"
596
+ transition-show="scale"
590
597
  @show="checkMenuPosition(props.row.id)"
591
598
  >
592
599
  <div :class="tailClass"></div>
@@ -669,9 +676,7 @@ const onRowPerPageChange = (value) => {
669
676
  :key="index"
670
677
  ref="btn-icon"
671
678
  @click.stop="handleMenuEventStop"
672
- @on-click="
673
- moreActionDialogData.showDialog[props.row.id] = false
674
- "
679
+ @on-click="onMoreActionButtonClick(props.row.id)"
675
680
  >
676
681
  <template #menu>
677
682
  <q-menu v-if="!verticalMoreActions" auto-close role="list">
@@ -714,7 +719,7 @@ const onRowPerPageChange = (value) => {
714
719
  : action.tooltip
715
720
  "
716
721
  @click.stop="handleMenuEventStop"
717
- @onClick="action.handler(props.row)"
722
+ @on-click="action.handler(props.row)"
718
723
  />
719
724
  </template>
720
725
  </div>