@usssa/component-library 1.0.0-alpha.106 → 1.0.0-alpha.108

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.106",
3
+ "version": "1.0.0-alpha.108",
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
@@ -3,16 +3,19 @@ import { ref, watch } from 'vue'
3
3
  import USelectStd from './USelectStd.vue'
4
4
 
5
5
  const emit = defineEmits(['update:modelValue', 'onRowChange', 'onPageChange'])
6
+
7
+ const model = defineModel()
8
+
6
9
  const props = defineProps({
7
- maxPages: {
8
- type: Number,
9
- default: 10,
10
- },
11
10
  maxPageLink: {
12
11
  //Maximum number of page links to display at a time
13
12
  type: Number,
14
13
  default: 2,
15
14
  },
15
+ maxPages: {
16
+ type: Number,
17
+ default: 1,
18
+ },
16
19
  modelValue: {
17
20
  type: Number,
18
21
  default: 1,
@@ -54,7 +57,7 @@ watch(currentPage, (newValue) => {
54
57
  <template>
55
58
  <div class="row u-pagination-container">
56
59
  <q-pagination
57
- v-model="currentPage"
60
+ v-model="model"
58
61
  class="u-pagination"
59
62
  active-color="primary"
60
63
  boundary-numbers
@@ -1,26 +1,42 @@
1
1
  <script setup>
2
- const pagination = defineModel('pagination', {
3
- default: { page: 1, rowsPerPage: 15 },
4
- type: Object,
2
+ const columns = defineModel('columns', {
3
+ default: () => [],
4
+ type: Array,
5
+ })
6
+ const filteredRows = defineModel('filteredRows', {
7
+ default: () => [],
8
+ type: Array,
5
9
  })
6
10
  const loading = defineModel('loading', {
7
11
  default: null,
8
12
  type: Boolean,
9
13
  })
10
- const rows = defineModel('rows', {
11
- default: () => [],
12
- type: Array,
14
+ const pagination = defineModel('pagination', {
15
+ default: { page: 1, rowsPerPage: 15 },
16
+ type: Object,
13
17
  })
14
- const columns = defineModel('columns', {
18
+ const rows = defineModel('rows', {
15
19
  default: () => [],
16
20
  type: Array,
17
21
  })
18
22
 
19
23
  const props = defineProps({
20
- title: {
24
+ bordered: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ filter: {
21
29
  type: String,
22
30
  default: '',
23
31
  },
32
+ flat: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ grid: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
24
40
  rowKey: {
25
41
  type: String,
26
42
  default: 'name',
@@ -29,37 +45,47 @@ const props = defineProps({
29
45
  type: String,
30
46
  default: 'horizontal',
31
47
  },
32
- flat: {
48
+ showPagination: {
33
49
  type: Boolean,
34
- default: false,
50
+ default: true,
35
51
  },
36
- bordered: {
52
+ stickyHeader: {
37
53
  type: Boolean,
38
54
  default: false,
39
55
  },
40
- grid: {
41
- type: Boolean,
42
- default: false,
56
+ title: {
57
+ type: String,
58
+ default: '',
43
59
  },
44
60
  virtualScroll: {
45
61
  type: Boolean,
46
62
  default: false,
47
63
  },
48
- stickyHeader: {
49
- type: Boolean,
50
- default: false,
51
- },
52
- showPagination: {
53
- type: Boolean,
54
- default: true,
55
- },
56
64
  })
65
+
66
+ const filterMethod = (rows, terms, cols, getCellValue) => {
67
+ let updatedRows = []
68
+ rows.forEach((row) => {
69
+ cols.forEach((col) => {
70
+ if (
71
+ col.type === 'text' &&
72
+ row[col.id].toLowerCase().includes(terms.toLowerCase()) &&
73
+ !updatedRows.includes(row)
74
+ ) {
75
+ updatedRows.push(row)
76
+ }
77
+ })
78
+ })
79
+ filteredRows.value = updatedRows
80
+
81
+ return updatedRows
82
+ }
57
83
  </script>
58
84
 
59
85
  <template>
60
86
  <q-table
61
- v-model:pagination="pagination"
62
87
  v-bind="$attrs"
88
+ v-model:pagination="pagination"
63
89
  :class="`u-table ${virtualScroll ? 'u-virtualscroll-table' : ''} ${
64
90
  grid ? 'u-virtualscroll-grid-table' : ''
65
91
  } ${stickyHeader ? 'u-sticky-table-header' : ''} ${
@@ -69,14 +95,16 @@ const props = defineProps({
69
95
  }`"
70
96
  :bordered="bordered"
71
97
  :columns="columns"
98
+ :filter="filter"
99
+ :filter-method="filterMethod"
72
100
  :flat="flat"
73
101
  :grid="grid"
74
102
  hide-pagination
75
103
  :loading="loading"
76
- :separator="separator"
77
- :rows="rows"
78
104
  :row-key="rowKey"
105
+ :rows="rows"
79
106
  :rows-per-page-options="[0]"
107
+ :separator="separator"
80
108
  :title="title"
81
109
  :virtual-scroll="!grid && virtualScroll"
82
110
  :virtual-scroll-item-size="48"
@@ -87,7 +115,7 @@ const props = defineProps({
87
115
  v-slot:[slotName]="scope"
88
116
  :key="index"
89
117
  >
90
- <slot :name="slotName" v-bind="{ ...scope }" />
118
+ <slot v-bind="{ ...scope }" :name="slotName" />
91
119
  </template>
92
120
  </q-table>
93
121
  </template>
@@ -18,6 +18,7 @@ const columns = defineModel('columns', {
18
18
  default: () => [],
19
19
  type: Array,
20
20
  })
21
+ const filteredRows = defineModel('filteredRows', { default: [], type: Array })
21
22
  const loading = defineModel('loading', {
22
23
  default: () => {},
23
24
  type: Boolean,
@@ -27,7 +28,7 @@ const moreActionDialogData = defineModel('moreActionDialogData', {
27
28
  default: null,
28
29
  })
29
30
  const pagination = defineModel('pagination', {
30
- default: { page: 1, rowsPerPage: 15 },
31
+ default: { page: 1, rowsPerPage: 5 },
31
32
  type: Object,
32
33
  })
33
34
  const rows = defineModel('rows', {
@@ -48,6 +49,10 @@ const props = defineProps({
48
49
  type: String,
49
50
  default: '',
50
51
  },
52
+ filter: {
53
+ type: String,
54
+ default: '',
55
+ },
51
56
  flat: {
52
57
  type: Boolean,
53
58
  default: false,
@@ -305,15 +310,26 @@ const onRowClick = (event, row) => {
305
310
  const onRowPerPageChange = (value) => {
306
311
  pagination.value.rowsPerPage = value
307
312
  }
313
+
314
+ const updatedRows = computed(() => {
315
+ if (props.filter.length && filteredRows.value?.length)
316
+ return filteredRows.value
317
+ else if(props.filter.length)
318
+ return []
319
+ return rows.value
320
+ })
321
+
308
322
  </script>
309
323
 
310
324
  <template>
311
325
  <UTable
312
326
  v-model:columns="columns"
327
+ v-model:filteredRows="filteredRows"
313
328
  v-model:pagination="pagination"
314
329
  v-model:rows="rows"
315
330
  :class="customClass"
316
331
  :bordered="bordered"
332
+ :filter="filter"
317
333
  :flat="flat"
318
334
  :grid="grid"
319
335
  :loading="loading"
@@ -778,12 +794,12 @@ const onRowPerPageChange = (value) => {
778
794
  class="row justify-end items-center pagination-wrapper"
779
795
  >
780
796
  <UPagination
781
- v-if="rows.length >= 6"
797
+ v-if="updatedRows.length >= 6"
782
798
  v-model="pagination.page"
783
799
  :maxPageLink="
784
- Number(Math.ceil(rows.length / pagination.rowsPerPage > 10 ? 6 : 3))
800
+ Number(Math.ceil(updatedRows.length / pagination.rowsPerPage > 10 ? 6 : 3))
785
801
  "
786
- :maxPages="Number(Math.ceil(rows.length / pagination.rowsPerPage))"
802
+ :maxPages="Number(Math.ceil(updatedRows.length / pagination.rowsPerPage))"
787
803
  :perPageOptions="getRowsPerPageOptions"
788
804
  :rowPerPage="pagination.rowsPerPage"
789
805
  @onPageChange="onPageChange"