@usssa/component-library 1.0.0-alpha.171 → 1.0.0-alpha.173
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/README.md +1 -1
- package/package.json +1 -1
- package/src/components/core/UModal.vue +26 -18
- package/src/components/core/UMultiSelectStd.vue +117 -15
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -56,16 +56,15 @@ const dialogMaxHeight = ref(null)
|
|
|
56
56
|
const dialogRef = ref(true)
|
|
57
57
|
const scrollableMarginHeight = ref(null)
|
|
58
58
|
|
|
59
|
+
const className = computed(() => {
|
|
60
|
+
return props.class ? props.class : 'filter-dialog-modal'
|
|
61
|
+
})
|
|
59
62
|
const dialogStyle = computed(() => ({
|
|
60
63
|
'--customSize': props.customSize,
|
|
61
64
|
}))
|
|
62
65
|
const headerClass = computed(() => {
|
|
63
66
|
return props.divider ? 'divider' : ''
|
|
64
67
|
})
|
|
65
|
-
|
|
66
|
-
const className = computed(() => {
|
|
67
|
-
return props.class ? props.class: 'filter-dialog-modal'
|
|
68
|
-
})
|
|
69
68
|
const isDesktop = computed(() => $screen.value.isDesktop)
|
|
70
69
|
const isMobile = computed(() => $screen.value.isMobile)
|
|
71
70
|
const isSmallWidthDevices = computed(() => $q.screen.width < 400)
|
|
@@ -119,37 +118,44 @@ const getContentBottomSpace = () => {
|
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
const getDialogHeaderheight = () => {
|
|
121
|
+
currentDialogHeight.value =
|
|
122
|
+
props.showActionButtons && props.showSecondaryButtons
|
|
123
|
+
? $q.screen.height - 80
|
|
124
|
+
: props.showActionButtons || props.showSecondaryButtons
|
|
125
|
+
? !isTablet.value
|
|
126
|
+
? $q.screen.height - 50 + 'px !important'
|
|
127
|
+
: $q.screen.height / 2 - 50 + 'px !important'
|
|
128
|
+
: $q.screen.height - 10
|
|
129
|
+
|
|
122
130
|
setTimeout(() => {
|
|
123
131
|
const headingWrapper =
|
|
124
132
|
document.getElementsByClassName('no-heading-section')[0]
|
|
125
133
|
if (headingWrapper) {
|
|
126
134
|
scrollableMarginHeight.value = headingWrapper.clientHeight
|
|
127
135
|
}
|
|
128
|
-
|
|
129
|
-
setTimeout(() => {
|
|
136
|
+
|
|
130
137
|
// dynamically adding height by removing toolbar height of 50px
|
|
131
138
|
const dialogWrapper = document.getElementsByClassName('dialog-wrapper')[0]
|
|
132
139
|
if (dialogWrapper) {
|
|
133
140
|
dialogWrapper?.setAttribute(
|
|
134
141
|
'style',
|
|
135
|
-
`max-height: ${
|
|
142
|
+
`max-height: ${
|
|
143
|
+
!isTablet.value
|
|
144
|
+
? $q.screen.height - 80 + 'px !important'
|
|
145
|
+
: $q.screen.height / 2 - 50 + 'px !important'
|
|
146
|
+
}`
|
|
136
147
|
)
|
|
137
148
|
}
|
|
149
|
+
},50)
|
|
138
150
|
|
|
139
|
-
|
|
140
|
-
props.showActionButtons && props.showSecondaryButtons
|
|
141
|
-
? $q.screen.height - 80
|
|
142
|
-
: props.showActionButtons || props.showSecondaryButtons
|
|
143
|
-
? !isTablet.value ? $q.screen.height - 50+ 'px !important' : ($q.screen.height/2)- 50+ 'px !important'
|
|
144
|
-
: $q.screen.height - 10
|
|
145
|
-
|
|
151
|
+
setTimeout(() => {
|
|
146
152
|
dialogMaxHeight.value =
|
|
147
153
|
props.showActionButtons && props.showSecondaryButtons
|
|
148
154
|
? $q.screen.height - 80
|
|
149
155
|
: props.showActionButtons || props.showSecondaryButtons
|
|
150
156
|
? $q.screen.height - 50
|
|
151
157
|
: $q.screen.height - 10
|
|
152
|
-
},
|
|
158
|
+
}, 100)
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
const handleBackClick = () => {
|
|
@@ -252,7 +258,9 @@ watch(
|
|
|
252
258
|
<q-dialog
|
|
253
259
|
v-bind="$attrs"
|
|
254
260
|
v-model="model"
|
|
255
|
-
:class="`filter-dialog-${
|
|
261
|
+
:class="`filter-dialog-${
|
|
262
|
+
isMobile ? 'full' : isTablet ? 'tab' : size
|
|
263
|
+
} filter-dialog ${className}`"
|
|
256
264
|
:dataTestId="dataTestId"
|
|
257
265
|
full-width
|
|
258
266
|
no-backdrop-dismiss
|
|
@@ -343,8 +351,8 @@ watch(
|
|
|
343
351
|
:class="[
|
|
344
352
|
` main-content-dialog scroll q-px-ba${
|
|
345
353
|
isMobile ? ' scrollable-content' : ''
|
|
346
|
-
|
|
347
|
-
{ mobile: isMobile, desktop: isDesktop
|
|
354
|
+
} `,
|
|
355
|
+
{ mobile: isMobile, desktop: isDesktop, tablet: isTablet },
|
|
348
356
|
]"
|
|
349
357
|
:style="{
|
|
350
358
|
'margin-top': `${
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, ref, watch } from 'vue'
|
|
2
|
+
import { computed, ref, nextTick, watch } from 'vue'
|
|
3
3
|
import UBtnStd from './UBtnStd.vue'
|
|
4
|
+
import UBtnToggle from './UBtnToggle.vue'
|
|
4
5
|
import UChip from './UChip.vue'
|
|
5
6
|
import UMenuItem from './UMenuItem.vue'
|
|
6
7
|
import USheet from './USheet.vue'
|
|
8
|
+
import UTabBtnStd from './UTabBtnStd.vue'
|
|
7
9
|
import UTooltip from './UTooltip.vue'
|
|
8
10
|
import { useScreenType } from '../../composables/useScreenType'
|
|
9
11
|
|
|
10
|
-
const emit = defineEmits([
|
|
12
|
+
const emit = defineEmits([
|
|
13
|
+
'update:modelValue',
|
|
14
|
+
'onClick',
|
|
15
|
+
'handleTabChange',
|
|
16
|
+
'updateButtonToggle',
|
|
17
|
+
])
|
|
11
18
|
const props = defineProps({
|
|
19
|
+
beforeOptions: {
|
|
20
|
+
type: Array,
|
|
21
|
+
},
|
|
12
22
|
caption: {
|
|
13
23
|
type: String,
|
|
14
24
|
default: '',
|
|
@@ -32,10 +42,18 @@ const props = defineProps({
|
|
|
32
42
|
hintText: {
|
|
33
43
|
type: String,
|
|
34
44
|
},
|
|
45
|
+
isBeforeOptions: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
35
49
|
isRequired: {
|
|
36
50
|
type: Boolean,
|
|
37
51
|
default: false,
|
|
38
52
|
},
|
|
53
|
+
isTabBeforeOptions: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true,
|
|
56
|
+
},
|
|
39
57
|
label: {
|
|
40
58
|
type: String,
|
|
41
59
|
},
|
|
@@ -58,10 +76,6 @@ const props = defineProps({
|
|
|
58
76
|
type: String,
|
|
59
77
|
default: 'label',
|
|
60
78
|
},
|
|
61
|
-
options: {
|
|
62
|
-
type: Array,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
79
|
optionValue: {
|
|
66
80
|
type: String,
|
|
67
81
|
default: 'value',
|
|
@@ -92,27 +106,39 @@ const props = defineProps({
|
|
|
92
106
|
},
|
|
93
107
|
})
|
|
94
108
|
|
|
109
|
+
const options = defineModel('options', {
|
|
110
|
+
type: Array,
|
|
111
|
+
default: [],
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const selectedTab = defineModel('selectedTab', {
|
|
115
|
+
type: [String, Number],
|
|
116
|
+
default: null,
|
|
117
|
+
})
|
|
118
|
+
|
|
95
119
|
const $screen = useScreenType()
|
|
96
120
|
|
|
121
|
+
const cloneOptions = JSON.parse(JSON.stringify(options.value))
|
|
122
|
+
|
|
97
123
|
const chipModelVal = ref(true)
|
|
98
124
|
const dialogs = ref([])
|
|
99
|
-
const filterOptions = ref([...props.options])
|
|
100
125
|
const placeholderText = ref(props.placeholder)
|
|
101
126
|
const selectedItems = ref([...props.modelValue])
|
|
127
|
+
const selectRef = ref(null)
|
|
102
128
|
|
|
103
129
|
const sheetHeading = computed(() => props.label)
|
|
104
130
|
|
|
105
131
|
const filterSheetOptions = (val, update) => {
|
|
106
132
|
if (val === '') {
|
|
107
133
|
update(() => {
|
|
108
|
-
|
|
134
|
+
options.value = cloneOptions
|
|
109
135
|
})
|
|
110
136
|
return
|
|
111
137
|
}
|
|
112
138
|
|
|
113
139
|
const typeValue = val.toLowerCase()
|
|
114
140
|
update(() => {
|
|
115
|
-
|
|
141
|
+
options.value = options.value.filter((option) =>
|
|
116
142
|
option.label.toLowerCase().includes(typeValue)
|
|
117
143
|
)
|
|
118
144
|
})
|
|
@@ -133,7 +159,7 @@ const handleClick = (event) => {
|
|
|
133
159
|
emit('onClick')
|
|
134
160
|
return
|
|
135
161
|
}
|
|
136
|
-
|
|
162
|
+
if ($screen.value.isMobile && isSelectElement) {
|
|
137
163
|
event.stopPropagation()
|
|
138
164
|
|
|
139
165
|
dialogs.value = [
|
|
@@ -176,6 +202,13 @@ const handleSheetSelectionUpdate = (val) => {
|
|
|
176
202
|
selectedItems.value = val
|
|
177
203
|
}
|
|
178
204
|
|
|
205
|
+
const handleTabChange = (val) => {
|
|
206
|
+
nextTick(() => {
|
|
207
|
+
selectRef.value?.focus()
|
|
208
|
+
})
|
|
209
|
+
emit('handleTabChange', val)
|
|
210
|
+
}
|
|
211
|
+
|
|
179
212
|
const isSelected = (value) => {
|
|
180
213
|
let getItems = selectedItems.value.filter((e) => e.value === value)
|
|
181
214
|
return getItems.length ? true : false
|
|
@@ -187,6 +220,10 @@ const removeItems = (item) => {
|
|
|
187
220
|
)
|
|
188
221
|
}
|
|
189
222
|
|
|
223
|
+
const updateButtonToggle = () => {
|
|
224
|
+
emit('updateButtonToggle')
|
|
225
|
+
}
|
|
226
|
+
|
|
190
227
|
const updateVal = (val) => {
|
|
191
228
|
props.updateFn(val)
|
|
192
229
|
placeholderText.value = val.length ? '' : props.placeholder
|
|
@@ -201,6 +238,7 @@ watch(
|
|
|
201
238
|
watch(
|
|
202
239
|
() => $screen.value,
|
|
203
240
|
(newValue) => {
|
|
241
|
+
dialogs.value = []
|
|
204
242
|
if (newValue) {
|
|
205
243
|
selectedItems.value = [...props.modelValue]
|
|
206
244
|
}
|
|
@@ -249,6 +287,7 @@ watch(
|
|
|
249
287
|
outlined
|
|
250
288
|
:placeholder="modelValue.length ? '' : placeholderText"
|
|
251
289
|
popup-content-class="u-option-menu"
|
|
290
|
+
ref="selectRef"
|
|
252
291
|
use-chips
|
|
253
292
|
:use-input="useInput"
|
|
254
293
|
@add="
|
|
@@ -270,8 +309,27 @@ watch(
|
|
|
270
309
|
@update:model-value="(val) => updateVal(val)"
|
|
271
310
|
>
|
|
272
311
|
<template v-slot:no-option>
|
|
273
|
-
<q-item>
|
|
274
|
-
<
|
|
312
|
+
<q-item :class="[{ 'no-result-container': isBeforeOptions }]">
|
|
313
|
+
<div v-if="isBeforeOptions">
|
|
314
|
+
<div
|
|
315
|
+
v-if="isTabBeforeOptions"
|
|
316
|
+
class="tab-container q-mt-sm q-mx-xs"
|
|
317
|
+
>
|
|
318
|
+
<UTabBtnStd
|
|
319
|
+
v-model:selectedTab="selectedTab"
|
|
320
|
+
:buttonTabsOptions="beforeOptions"
|
|
321
|
+
size="sm"
|
|
322
|
+
@on-tab-click="(val) => handleTabChange(val)"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
<slot v-else name="before-options" />
|
|
326
|
+
</div>
|
|
327
|
+
<q-item-section
|
|
328
|
+
:class="[
|
|
329
|
+
'text-grey',
|
|
330
|
+
{ 'q-mt-xs q-mx-sm q-mb-xs': isBeforeOptions },
|
|
331
|
+
]"
|
|
332
|
+
>
|
|
275
333
|
{{ noSearchText }}
|
|
276
334
|
</q-item-section>
|
|
277
335
|
</q-item>
|
|
@@ -299,6 +357,23 @@ watch(
|
|
|
299
357
|
</div>
|
|
300
358
|
</template>
|
|
301
359
|
|
|
360
|
+
<template v-slot:before-options>
|
|
361
|
+
<div v-if="isBeforeOptions">
|
|
362
|
+
<div
|
|
363
|
+
v-if="isTabBeforeOptions"
|
|
364
|
+
class="tab-container q-mx-xs q-mt-sm q-mb-xs"
|
|
365
|
+
>
|
|
366
|
+
<UTabBtnStd
|
|
367
|
+
v-model:selectedTab="selectedTab"
|
|
368
|
+
:buttonTabsOptions="beforeOptions"
|
|
369
|
+
size="sm"
|
|
370
|
+
@on-tab-click="(val) => handleTabChange(val)"
|
|
371
|
+
/>
|
|
372
|
+
</div>
|
|
373
|
+
<slot v-else name="before-options" />
|
|
374
|
+
</div>
|
|
375
|
+
</template>
|
|
376
|
+
|
|
302
377
|
<template v-slot:option="scope">
|
|
303
378
|
<q-item
|
|
304
379
|
v-bind="scope.itemProps"
|
|
@@ -342,11 +417,22 @@ watch(
|
|
|
342
417
|
<USheet
|
|
343
418
|
v-if="$screen.isMobile && !useCustomComponent"
|
|
344
419
|
v-model:dialogs="dialogs"
|
|
420
|
+
dialog-class="options-dialog"
|
|
345
421
|
:heading="sheetHeading"
|
|
346
422
|
:heading-caption="caption"
|
|
347
423
|
:show-action-buttons="true"
|
|
348
424
|
>
|
|
349
425
|
<template #header>
|
|
426
|
+
<div v-if="isBeforeOptions" class="q-mt-xs">
|
|
427
|
+
<UBtnToggle
|
|
428
|
+
v-if="isTabBeforeOptions"
|
|
429
|
+
v-model="selectedTab"
|
|
430
|
+
:options="beforeOptions"
|
|
431
|
+
size="md"
|
|
432
|
+
@update:model-value="updateButtonToggle"
|
|
433
|
+
/>
|
|
434
|
+
<slot v-else name="before-options" />
|
|
435
|
+
</div>
|
|
350
436
|
<q-select
|
|
351
437
|
:model-value="selectedItems"
|
|
352
438
|
:class="`u-multi-select field-md q-mt-ba`"
|
|
@@ -367,6 +453,7 @@ watch(
|
|
|
367
453
|
<template v-slot:selected-item="scope">
|
|
368
454
|
<UChip
|
|
369
455
|
v-model="chipModelVal"
|
|
456
|
+
:avatar="scope.opt.img"
|
|
370
457
|
:chipLabel="scope.opt.label"
|
|
371
458
|
dense
|
|
372
459
|
:removable="true"
|
|
@@ -376,9 +463,10 @@ watch(
|
|
|
376
463
|
</template>
|
|
377
464
|
</q-select>
|
|
378
465
|
</template>
|
|
466
|
+
|
|
379
467
|
<template #content>
|
|
380
|
-
<template v-if="
|
|
381
|
-
<template v-for="(item, index) in
|
|
468
|
+
<template v-if="options.length > 0">
|
|
469
|
+
<template v-for="(item, index) in options" :key="index">
|
|
382
470
|
<UMenuItem
|
|
383
471
|
iconClass=""
|
|
384
472
|
:destructive="item.destructive"
|
|
@@ -479,7 +567,7 @@ watch(
|
|
|
479
567
|
.u-option-menu
|
|
480
568
|
border-radius: $xs
|
|
481
569
|
box-shadow: $shadow-2
|
|
482
|
-
max-height:
|
|
570
|
+
max-height: 12.25rem !important
|
|
483
571
|
width: 18rem
|
|
484
572
|
overflow-y: auto
|
|
485
573
|
scrollbar-width: none
|
|
@@ -492,4 +580,18 @@ watch(
|
|
|
492
580
|
|
|
493
581
|
.sheet-card-wrapper .q-select__dropdown-icon
|
|
494
582
|
display: none !important
|
|
583
|
+
|
|
584
|
+
.options-dialog
|
|
585
|
+
.heading-row
|
|
586
|
+
margin-bottom: $xs
|
|
587
|
+
.main-content-dialog
|
|
588
|
+
padding-top: $xs
|
|
589
|
+
|
|
590
|
+
.tab-container
|
|
591
|
+
.q-tabs__content--align-center
|
|
592
|
+
justify-content: flex-start
|
|
593
|
+
|
|
594
|
+
.no-result-container
|
|
595
|
+
display: block
|
|
596
|
+
padding: 0px
|
|
495
597
|
</style>
|