@usssa/component-library 1.0.0-alpha.95 → 1.0.0-alpha.97

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.95",
3
+ "version": "1.0.0-alpha.97",
4
4
  "description": "A Quasar component library project",
5
5
  "productName": "Quasar component library App",
6
6
  "author": "Troy Moreland <troy.moreland@usssa.com>",
@@ -2,6 +2,8 @@
2
2
  import { computed, ref } from 'vue'
3
3
  import UBtnStd from './UBtnStd.vue'
4
4
 
5
+ const emit = defineEmits(['onBackIconClick', 'hideDialog'])
6
+ const model = defineModel()
5
7
  const props = defineProps({
6
8
  heading: {
7
9
  type: String,
@@ -25,22 +27,19 @@ const props = defineProps({
25
27
  divider: Boolean,
26
28
  })
27
29
 
28
- const model = defineModel()
29
- const emit = defineEmits(['onBackIconClick', 'hideDialog'])
30
-
31
30
  const dialogRef = ref(true)
32
31
 
33
- const handleBackClick = () => {
34
- return emit('onBackIconClick')
35
- }
32
+ const dialogStyle = computed(() => ({
33
+ '--customSize': props.customSize,
34
+ }))
36
35
 
37
36
  const headerClass = computed(() => {
38
37
  return props.divider ? 'divider' : ''
39
38
  })
40
39
 
41
- const dialogStyle = computed(() => ({
42
- '--customSize': props.customSize,
43
- }))
40
+ const handleBackClick = () => {
41
+ return emit('onBackIconClick')
42
+ }
44
43
  </script>
45
44
 
46
45
  <template>
@@ -51,8 +50,8 @@ const dialogStyle = computed(() => ({
51
50
  full-width
52
51
  no-backdrop-dismiss
53
52
  :position="position"
54
- :style="dialogStyle"
55
53
  ref="dialogRef"
54
+ :style="dialogStyle"
56
55
  >
57
56
  <q-card class="dialog-wrapper full-height">
58
57
  <q-card-section
@@ -63,9 +62,9 @@ const dialogStyle = computed(() => ({
63
62
  <div v-if="leftIcon">
64
63
  <UBtnStd
65
64
  class="dialog-action-icons"
66
- tabindex="0"
67
65
  :aria-label="leftIconLabel"
68
66
  :flat="true"
67
+ tabindex="0"
69
68
  @click="handleBackClick()"
70
69
  >
71
70
  <q-icon
@@ -226,7 +225,7 @@ const dialogStyle = computed(() => ({
226
225
 
227
226
  .q-btn.dialog-action-icons
228
227
  padding: 0px 0px !important
229
- min-width: 0px !important
228
+ min-width: 1.5rem !important
230
229
  min-height: 0px !important
231
230
  height: fit-content !important
232
231
  border-radius: 0px
@@ -7,22 +7,32 @@ import UMenuDropdownAdvancedSearch from './UMenuDropdownAdvancedSearch.vue'
7
7
  import UTabBtnStd from './UTabBtnStd.vue'
8
8
  import UTooltip from './UTooltip.vue'
9
9
  import { useNotify } from '../../composables/useNotify'
10
- import { parseInitials, categorizeObjects, deepEqual } from '../../utils/data'
10
+ import { categorizeObjects, deepEqual, parseInitials } from '../../utils/data'
11
+
12
+ const emit = defineEmits([
13
+ 'onInvitePerson',
14
+ 'onItemActionClick',
15
+ 'updateCountry',
16
+ 'updateModelVal',
17
+ 'updateTab',
18
+ ])
19
+
20
+ const loading = defineModel('loading')
11
21
 
12
22
  const props = defineProps({
13
- algoliaIndex: {
14
- type: Object,
15
- },
16
23
  // Label for button to select a record
17
24
  actionButtonLabel: {
18
25
  type: String,
19
26
  },
27
+ actionButtonLoading: {
28
+ type: Boolean,
29
+ },
20
30
  // Set default tab
21
31
  advancedSearchSelectedTab: {
22
32
  type: String,
23
33
  },
24
- actionButtonLoading: {
25
- type: Boolean,
34
+ algoliaIndex: {
35
+ type: Object,
26
36
  },
27
37
  // Set context for component for special handling
28
38
  // context.action (e.g. addContact)
@@ -33,6 +43,10 @@ const props = defineProps({
33
43
  disabledButtonColor: {
34
44
  type: String,
35
45
  },
46
+ disableActionButtonLabel: {
47
+ type: String,
48
+ default: '',
49
+ },
36
50
  exceedLimitCount: {
37
51
  type: Number,
38
52
  default: 50,
@@ -63,17 +77,9 @@ const props = defineProps({
63
77
  recentSearchesLoading: {
64
78
  type: Boolean,
65
79
  },
66
- showCustomMenu: {
67
- type: Boolean,
68
- default: false,
69
- },
70
80
  searchText: {
71
81
  type: String,
72
82
  },
73
- size: {
74
- type: String,
75
- default: 'md',
76
- },
77
83
  // Show/hide advanced search
78
84
  showAdvancedSearch: {
79
85
  type: Boolean,
@@ -84,15 +90,23 @@ const props = defineProps({
84
90
  type: Boolean,
85
91
  default: true,
86
92
  },
87
- // Show/hide recent searches
88
- showRecentSelected: {
93
+ showCustomMenu: {
89
94
  type: Boolean,
90
- default: true,
95
+ default: false,
91
96
  },
92
97
  showInviteBtn: {
93
98
  type: Boolean,
94
99
  default: false,
95
100
  },
101
+ size: {
102
+ type: String,
103
+ default: 'md',
104
+ },
105
+ // Show/hide recent searches
106
+ showRecentSelected: {
107
+ type: Boolean,
108
+ default: true,
109
+ },
96
110
  //Advance search title
97
111
  title: {
98
112
  type: String,
@@ -103,28 +117,18 @@ const props = defineProps({
103
117
  },
104
118
  })
105
119
 
106
- const emit = defineEmits([
107
- 'onInvitePerson',
108
- 'onItemActionClick',
109
- 'updateTab',
110
- 'updateModelVal',
111
- 'updateCountry',
112
- ])
113
-
114
- const loading = defineModel('loading')
115
120
  const { notify } = useNotify()
116
121
 
117
- const advancedSearchPendingFilterModel = structuredClone(toRaw(props.model))
118
- const advancedSearchSelectedTab = ref(props.advancedSearchSelectedTab ?? null)
119
-
120
- const advancedSearchFilterDirty = ref(false)
121
- const toggle = ref(false)
122
122
  const advancedSearchApplyFilter = ref(false)
123
+ const advancedSearchFilterDirty = ref(false)
123
124
  const advancedSearchFilterModelDefault = ref({})
125
+ const advancedSearchSelectedTab = ref(props.advancedSearchSelectedTab ?? null)
124
126
  const exceedLimit = ref(false)
125
127
  const searchMenuRef = ref(null)
126
- const searchResults = ref(null)
127
128
  const searchMenuShowing = ref(false)
129
+ const searchResults = ref(null)
130
+ const selectedItem = ref({})
131
+ const toggle = ref(false)
128
132
 
129
133
  const recentSearches = computed({
130
134
  get() {
@@ -139,39 +143,9 @@ const recentSearches = computed({
139
143
  },
140
144
  })
141
145
 
142
- const transformCategory = (category) => {
143
- switch (category) {
144
- case 'users':
145
- return 'People'
146
- case 'teams':
147
- return 'Teams'
148
- case 'events':
149
- return 'Events'
150
- case 'venues':
151
- return 'Venues'
152
- default:
153
- return 'Other'
154
- }
155
- }
156
-
157
- const onMenuShow = () => {
158
- searchMenuShowing.value = true
159
- }
160
-
161
- const onMenuHide = () => {
162
- searchMenuShowing.value = false
163
- }
164
-
165
- const updateModelVal = (event, label) => {
166
- emit('updateModelVal', event, label)
167
- }
168
-
169
- const updateCountry = (val, label) => {
170
- emit('updateCountry', val, label)
171
- }
172
-
173
- const onInvitePerson = (item) => {
174
- emit('onInvitePerson', item)
146
+ const convertDate = (inputDate) => {
147
+ const [month, day, year] = inputDate.split('/')
148
+ return `${year}-${month}-${day}`
175
149
  }
176
150
 
177
151
  const handleTabChange = (val) => {
@@ -188,7 +162,30 @@ const handleTabChange = (val) => {
188
162
  search()
189
163
  }
190
164
 
165
+ const onApplyAdvancedSearchFilter = () => {
166
+ advancedSearchApplyFilter.value = true
167
+ advancedSearchFilterDirty.value = false
168
+
169
+ search()
170
+ updateAdvanceSearchToggle()
171
+ }
172
+
173
+ const onClearAdvancedSearchFilter = () => {
174
+ Object.assign(
175
+ props.model,
176
+ structuredClone(toRaw(advancedSearchFilterModelDefault.value))
177
+ )
178
+ advancedSearchApplyFilter.value = false
179
+ advancedSearchFilterDirty.value = false
180
+ search()
181
+ }
182
+
183
+ const onInvitePerson = (item) => {
184
+ emit('onInvitePerson', item)
185
+ }
186
+
191
187
  const onItemActionClick = (item, isRecentSearchAction) => {
188
+ selectedItem.value = item
192
189
  return emit(
193
190
  'onItemActionClick',
194
191
  item,
@@ -197,34 +194,12 @@ const onItemActionClick = (item, isRecentSearchAction) => {
197
194
  )
198
195
  }
199
196
 
200
- const specialContextHandler = (results) => {
201
- // Mark result records that are already exits
202
- results = results.map((result) => {
203
- const isAlreadyContactSearch = props.context.filter(
204
- (contact) => contact.id === result.id
205
- )
206
-
207
- if (isAlreadyContactSearch && isAlreadyContactSearch.length > 0) {
208
- const tooltip = props.toolTipDisabledButton
209
- const color = props.disabledButtonColor
210
- return {
211
- ...result,
212
- disable: true,
213
- btnProps: {
214
- color,
215
- },
216
- tooltip,
217
- }
218
- }
219
- return result
220
- })
221
-
222
- return results
197
+ const onMenuHide = () => {
198
+ searchMenuShowing.value = false
223
199
  }
224
200
 
225
- const convertDate = (inputDate) => {
226
- const [month, day, year] = inputDate.split('/')
227
- return `${year}-${month}-${day}`
201
+ const onMenuShow = () => {
202
+ searchMenuShowing.value = true
228
203
  }
229
204
 
230
205
  const search = async () => {
@@ -361,26 +336,65 @@ const search = async () => {
361
336
  }
362
337
  }
363
338
 
339
+ const specialContextHandler = (results) => {
340
+ // Mark result records that are already exits
341
+ results = results.map((result) => {
342
+ const isAlreadyAddedSearch = props.context.filter(
343
+ (data) => data.id === result.id || data.id === result.docId
344
+ )
345
+ let label = props.actionButtonLabel
346
+
347
+ if (isAlreadyAddedSearch && isAlreadyAddedSearch.length > 0) {
348
+ const tooltip = props.toolTipDisabledButton
349
+ const color = props.disabledButtonColor
350
+ label = props.disableActionButtonLabel
351
+
352
+ return {
353
+ ...result,
354
+ disable: true,
355
+ btnProps: {
356
+ color,
357
+ label,
358
+ },
359
+ tooltip,
360
+ }
361
+ }
362
+ return {
363
+ ...result,
364
+ btnProps: {
365
+ label,
366
+ },
367
+ }
368
+ })
369
+
370
+ return results
371
+ }
372
+
373
+ const transformCategory = (category) => {
374
+ switch (category) {
375
+ case 'users':
376
+ return 'People'
377
+ case 'teams':
378
+ return 'Teams'
379
+ case 'events':
380
+ return 'Events'
381
+ case 'venues':
382
+ return 'Venues'
383
+ default:
384
+ return 'Other'
385
+ }
386
+ }
387
+
364
388
  const updateAdvanceSearchToggle = (val) => {
365
389
  toggle.value = !toggle.value
366
390
  }
367
391
 
368
- const onClearAdvancedSearchFilter = () => {
369
- Object.assign(
370
- props.model,
371
- structuredClone(toRaw(advancedSearchFilterModelDefault.value))
372
- )
373
- advancedSearchApplyFilter.value = false
374
- advancedSearchFilterDirty.value = false
375
- search()
392
+ const updateCountry = (val, label) => {
393
+ emit('updateCountry', val, label)
376
394
  }
377
395
 
378
- const onApplyAdvancedSearchFilter = () => {
379
- advancedSearchApplyFilter.value = true
380
- advancedSearchFilterDirty.value = false
381
-
382
- search()
383
- updateAdvanceSearchToggle()
396
+ const updateModelVal = (event, label) => {
397
+ emit('updateModelVal', event, label)
384
398
  }
385
399
 
386
400
  //Assign default model value on tab change
@@ -424,16 +438,16 @@ watch(
424
438
  <q-menu
425
439
  v-bind="$attrs"
426
440
  v-model="searchMenuShowing"
427
- aria-label="search menu"
428
441
  :class="`u-search-option-menu ${menuClass}`"
442
+ aria-label="search menu"
429
443
  fit
430
444
  no-focus
431
445
  :offset="[0, 4]"
432
446
  ref="searchMenuRef"
433
447
  role="menu"
434
448
  tabindex="1"
435
- @show="onMenuShow"
436
449
  @hide="onMenuHide"
450
+ @show="onMenuShow"
437
451
  >
438
452
  <q-list
439
453
  :class="`u-typeahead-menu q-px-ba q-pt-ba size-${size}`"
@@ -450,7 +464,7 @@ watch(
450
464
  :buttonTabsOptions="options"
451
465
  size="sm"
452
466
  :standard="false"
453
- @on-tab-click="handleTabChange"
467
+ @onTabClick="handleTabChange"
454
468
  />
455
469
  </div>
456
470
  </div>
@@ -462,15 +476,15 @@ watch(
462
476
  :fields="fields"
463
477
  :labelIcon="labelIcon"
464
478
  :model="model"
465
- :size="size"
466
479
  :showCustomMenu="showCustomMenu"
480
+ :size="size"
467
481
  :title="title"
468
482
  :toggle="toggle"
469
- @updateCountry="(event, label) => updateCountry(event, label)"
470
- @updateModelVal="(event, label) => updateModelVal(event, label)"
471
- @updateAdvanceSearchToggle="(val) => updateAdvanceSearchToggle(val)"
472
483
  @onApplyAdvancedSearchFilter="onApplyAdvancedSearchFilter"
473
484
  @onClearAdvancedSearchFilter="onClearAdvancedSearchFilter"
485
+ @updateAdvanceSearchToggle="(val) => updateAdvanceSearchToggle(val)"
486
+ @updateCountry="(event, label) => updateCountry(event, label)"
487
+ @updateModelVal="(event, label) => updateModelVal(event, label)"
474
488
  >
475
489
  </UMenuDropdownAdvancedSearch>
476
490
 
@@ -511,8 +525,8 @@ watch(
511
525
  :aria-label="item.name"
512
526
  :image="item.profilePictureUrl"
513
527
  :round="true"
514
- size="md"
515
528
  :showIndicator="false"
529
+ size="md"
516
530
  />
517
531
  </q-item-section>
518
532
 
@@ -529,9 +543,13 @@ watch(
529
543
  <UBtnStd
530
544
  v-bind="item.btnProps"
531
545
  :color="item.btnProps?.color ?? 'primary'"
532
- :disable="item.disable"
533
- :label="actionButtonLabel"
534
- :loading="actionButtonLoading"
546
+ :disable="
547
+ item.disable ||
548
+ (selectedItem?.id !== item.id && actionButtonLoading)
549
+ "
550
+ :loading="
551
+ selectedItem?.id === item.id ? actionButtonLoading : false
552
+ "
535
553
  outline
536
554
  size="sm"
537
555
  @click.stop="onItemActionClick(item)"
@@ -567,12 +585,11 @@ watch(
567
585
  </span>
568
586
  </div>
569
587
 
570
- <div class="row items-center full-width">
571
- <span :class="`searchText-${size} text-caption-md q-mr-xs`">{{
572
- searchText
573
- }}</span>
588
+ <div v-if="showInviteBtn" class="row items-center full-width">
589
+ <span :class="`searchText-${size} text-caption-md q-mr-xs`">
590
+ {{ searchText }}
591
+ </span>
574
592
  <UBtnStd
575
- v-if="showInviteBtn"
576
593
  color="primary"
577
594
  label="Invite"
578
595
  outline
@@ -636,8 +653,8 @@ watch(
636
653
  :aria-label="item.name"
637
654
  :image="item.profilePictureUrl"
638
655
  :round="true"
639
- size="md"
640
656
  :showIndicator="false"
657
+ size="md"
641
658
  />
642
659
  </q-item-section>
643
660
 
@@ -656,9 +673,13 @@ watch(
656
673
  <UBtnStd
657
674
  v-bind="item.btnProps"
658
675
  :color="item.btnProps?.color ?? 'primary'"
659
- :disable="item.disable"
660
- :label="actionButtonLabel"
661
- :loading="actionButtonLoading"
676
+ :disable="
677
+ item.disable ||
678
+ (selectedItem?.id !== item.id && actionButtonLoading)
679
+ "
680
+ :loading="
681
+ selectedItem?.id === item.id ? actionButtonLoading : false
682
+ "
662
683
  outline
663
684
  size="sm"
664
685
  @click.stop="onItemActionClick(item, true)"
@@ -527,7 +527,10 @@ const onRowPerPageChange = (value) => {
527
527
  <!-- to show the actions list if the actions are multiple -->
528
528
  <template v-else>
529
529
  <q-menu
530
- v-if="moreActionDialogData.showDialog[props.row.id]"
530
+ v-if="
531
+ moreActionDialogData &&
532
+ moreActionDialogData.showDialog[props.row.id]
533
+ "
531
534
  v-model="moreActionDialogData.showDialog[props.row.id]"
532
535
  :class="`more-action-popup q-px-ba q-py-ba`"
533
536
  anchor="top left"